@velastack/patterns 0.0.15 → 0.0.16

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,13 +1,13 @@
1
1
  import Qt from "prettier";
2
2
  import te from "prettier-plugin-svelte";
3
- const ee = "0.0.14", ne = {
3
+ const ee = "0.0.16", ne = {
4
4
  version: ee
5
5
  };
6
- function re(t) {
6
+ function ae(t) {
7
7
  return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
8
8
  }
9
- async function ae(t) {
10
- if (!re(t))
9
+ async function re(t) {
10
+ if (!ae(t))
11
11
  return t;
12
12
  try {
13
13
  const e = await Qt.format(t.content, {
@@ -23,7 +23,7 @@ async function ae(t) {
23
23
  }
24
24
  }
25
25
  async function ut(t) {
26
- return Promise.all(t.map((e) => ae(e)));
26
+ return Promise.all(t.map((e) => re(e)));
27
27
  }
28
28
  async function S(t) {
29
29
  const [e, n] = await Promise.all([
@@ -36,23 +36,23 @@ async function S(t) {
36
36
  modifies: n
37
37
  };
38
38
  }
39
- function dt(t, e) {
39
+ function pt(t, e) {
40
40
  var n = Object.keys(t);
41
41
  if (Object.getOwnPropertySymbols) {
42
- var r = Object.getOwnPropertySymbols(t);
43
- e && (r = r.filter(function(a) {
44
- return Object.getOwnPropertyDescriptor(t, a).enumerable;
45
- })), n.push.apply(n, r);
42
+ var a = Object.getOwnPropertySymbols(t);
43
+ e && (a = a.filter(function(r) {
44
+ return Object.getOwnPropertyDescriptor(t, r).enumerable;
45
+ })), n.push.apply(n, a);
46
46
  }
47
47
  return n;
48
48
  }
49
- function pt(t) {
49
+ function dt(t) {
50
50
  for (var e = 1; e < arguments.length; e++) {
51
51
  var n = arguments[e] != null ? arguments[e] : {};
52
- e % 2 ? dt(Object(n), !0).forEach(function(r) {
53
- oe(t, r, n[r]);
54
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : dt(Object(n)).forEach(function(r) {
55
- Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
52
+ e % 2 ? pt(Object(n), !0).forEach(function(a) {
53
+ oe(t, a, n[a]);
54
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : pt(Object(n)).forEach(function(a) {
55
+ Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(n, a));
56
56
  });
57
57
  }
58
58
  return t;
@@ -68,26 +68,26 @@ function ie(t, e) {
68
68
  if (typeof t != "object" || t === null) return t;
69
69
  var n = t[Symbol.toPrimitive];
70
70
  if (n !== void 0) {
71
- var r = n.call(t, e);
72
- if (typeof r != "object") return r;
71
+ var a = n.call(t, e);
72
+ if (typeof a != "object") return a;
73
73
  throw new TypeError("@@toPrimitive must return a primitive value.");
74
74
  }
75
75
  return (e === "string" ? String : Number)(t);
76
76
  }
77
- const d = It({});
78
- function It(t) {
79
- return e.withOptions = (n) => It(pt(pt({}, t), n)), e;
80
- function e(n, ...r) {
81
- const a = typeof n == "string" ? [n] : n.raw, {
77
+ const p = zt({});
78
+ function zt(t) {
79
+ return e.withOptions = (n) => zt(dt(dt({}, t), n)), e;
80
+ function e(n, ...a) {
81
+ const r = typeof n == "string" ? [n] : n.raw, {
82
82
  alignValues: s = !1,
83
83
  escapeSpecialCharacters: i = Array.isArray(n),
84
84
  trimWhitespace: o = !0
85
85
  } = t;
86
86
  let c = "";
87
- for (let f = 0; f < a.length; f++) {
88
- let h = a[f];
89
- if (i && (h = h.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += h, f < r.length) {
90
- const $ = s ? le(r[f], c) : r[f];
87
+ for (let f = 0; f < r.length; f++) {
88
+ let h = r[f];
89
+ if (i && (h = h.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += h, f < a.length) {
90
+ const $ = s ? le(a[f], c) : a[f];
91
91
  c += $;
92
92
  }
93
93
  }
@@ -122,22 +122,22 @@ function le(t, e) {
122
122
  if (typeof t != "string" || !t.includes(`
123
123
  `))
124
124
  return t;
125
- const r = e.slice(e.lastIndexOf(`
125
+ const a = e.slice(e.lastIndexOf(`
126
126
  `) + 1).match(/^(\s+)/);
127
- if (r) {
128
- const a = r[1];
127
+ if (a) {
128
+ const r = a[1];
129
129
  return t.replace(/\n/g, `
130
- ${a}`);
130
+ ${r}`);
131
131
  }
132
132
  return t;
133
133
  }
134
- function G(t, e) {
134
+ function N(t, e) {
135
135
  return t.startsWith(e) ? t.slice(e.length) : t.replace(/^\.\//, "");
136
136
  }
137
- function P(t) {
137
+ function R(t) {
138
138
  return t.endsWith(".svelte") ? "svelte" : t.endsWith(".tsx") || t.endsWith(".ts") ? "ts" : t.endsWith(".jsx") || t.endsWith(".js") ? "js" : "text";
139
139
  }
140
- function H(t) {
140
+ function A(t) {
141
141
  return t.reduce(
142
142
  (e, n) => (e.creates.push(...n.creates), e.modifies.push(...n.modifies), e.deletes.push(...n.deletes), e.components.push(...n.components), e.packages.push(...n.packages), e.collections.push(...n.collections), e),
143
143
  {
@@ -182,11 +182,11 @@ const ce = {
182
182
  function E(t) {
183
183
  return `$formData.${t.name}`;
184
184
  }
185
- function O(t) {
185
+ function q(t) {
186
186
  return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
187
187
  }
188
- function I(t) {
189
- return t.labelAside ? d`
188
+ function z(t) {
189
+ return t.labelAside ? p`
190
190
  <div class="flex justify-between">
191
191
  <Form.Label>${t.title}</Form.Label>
192
192
  ${t.labelAside}
@@ -195,12 +195,12 @@ function I(t) {
195
195
  }
196
196
  function D(t, e) {
197
197
  const n = t.required ? " required" : "";
198
- return d`
198
+ return p`
199
199
  <Form.Field {form} name="${t.name}" class="col-span-1">
200
200
  <Form.Control>
201
201
  {#snippet children({ props })}
202
- ${I(t)}
203
- <Input {...props} type="${e}" bind:value={${E(t)}}${n}${O(t)} />
202
+ ${z(t)}
203
+ <Input {...props} type="${e}" bind:value={${E(t)}}${n}${q(t)} />
204
204
  {/snippet}
205
205
  </Form.Control>
206
206
  <Form.FieldErrors class="contents text-destructive" />
@@ -209,38 +209,38 @@ function D(t, e) {
209
209
  }
210
210
  function ue(t) {
211
211
  const e = t.required ? " required" : "";
212
- return d`
212
+ return p`
213
213
  <Form.Field {form} name="${t.name}" class="col-span-2">
214
214
  <Form.Control>
215
215
  {#snippet children({ props })}
216
- ${I(t)}
217
- <Textarea {...props} bind:value={${E(t)}}${e}${O(t)} />
216
+ ${z(t)}
217
+ <Textarea {...props} bind:value={${E(t)}}${e}${q(t)} />
218
218
  {/snippet}
219
219
  </Form.Control>
220
220
  <Form.FieldErrors class="contents text-destructive" />
221
221
  </Form.Field>
222
222
  `;
223
223
  }
224
- function de(t) {
224
+ function pe(t) {
225
225
  const e = t.required ? " required" : "";
226
- return d`
226
+ return p`
227
227
  <Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
228
228
  <Form.Control>
229
229
  {#snippet children({ props })}
230
- <Checkbox {...props} bind:checked={${E(t)}}${e}${O(t)} />
231
- ${I(t)}
230
+ <Checkbox {...props} bind:checked={${E(t)}}${e}${q(t)} />
231
+ ${z(t)}
232
232
  {/snippet}
233
233
  </Form.Control>
234
234
  <Form.FieldErrors class="contents text-destructive" />
235
235
  </Form.Field>
236
236
  `;
237
237
  }
238
- function pe(t) {
239
- return d`
238
+ function de(t) {
239
+ return p`
240
240
  <Form.Field {form} name="${t.name}" class="col-span-1">
241
241
  <Form.Control>
242
242
  {#snippet children({ props })}
243
- ${I(t)}
243
+ ${z(t)}
244
244
  <GeopointInput {...props} bind:value={${E(t)}} />
245
245
  {/snippet}
246
246
  </Form.Control>
@@ -250,11 +250,11 @@ function pe(t) {
250
250
  }
251
251
  function fe(t) {
252
252
  const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
253
- return d`
253
+ return p`
254
254
  <FileForm.Field {form} name="${t.name}" class="col-span-1">
255
255
  <Form.Control>
256
256
  {#snippet children({ props })}
257
- ${I(t)}
257
+ ${z(t)}
258
258
  <FileForm.${n}>
259
259
  {#snippet display({ file, filename, onremove })}
260
260
  <div class="flex gap-2 justify-between items-center">
@@ -266,7 +266,7 @@ function fe(t) {
266
266
  </div>
267
267
  {/snippet}
268
268
  {#snippet input()}
269
- <FileForm.Input {...props}${e}${O(t)} />
269
+ <FileForm.Input {...props}${e}${q(t)} />
270
270
  {/snippet}
271
271
  </FileForm.${n}>
272
272
  {/snippet}
@@ -276,17 +276,17 @@ function fe(t) {
276
276
  `;
277
277
  }
278
278
  function ge(t) {
279
- const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", a = t.options.map(
279
+ const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", a = t.maxSelect > 1 ? "Select options" : "Select an option", r = t.options.map(
280
280
  (s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
281
281
  ).join(`
282
282
  `);
283
- return d`
283
+ return p`
284
284
  <MultiSelect.Field {form} type="${e}" name="${t.name}"${n} class="col-span-1">
285
285
  <Form.Control>
286
286
  {#snippet children({ props })}
287
- ${I(t)}
287
+ ${z(t)}
288
288
  <MultiSelect.Trigger class="w-full justify-between">
289
- <MultiSelect.Input bind:value={${E(t)}} placeholder="${r}" {...props}>
289
+ <MultiSelect.Input bind:value={${E(t)}} placeholder="${a}" {...props}>
290
290
  {#snippet children({ selected })}
291
291
  <div class="flex flex-wrap gap-1">
292
292
  {#each selected as value}
@@ -304,7 +304,7 @@ function ge(t) {
304
304
  <Command.Input autofocus placeholder="Search..." />
305
305
  <Command.Empty>No options found</Command.Empty>
306
306
  <Command.Group>
307
- ${a}
307
+ ${r}
308
308
  </Command.Group>
309
309
  </Command.Root>
310
310
  </MultiSelect.Content>
@@ -314,8 +314,8 @@ function ge(t) {
314
314
  `;
315
315
  }
316
316
  function he(t) {
317
- 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;
318
- return d`
317
+ const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, a = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, r = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
318
+ return p`
319
319
  <MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
320
320
  <Form.Control>
321
321
  {#snippet children({ props })}
@@ -337,8 +337,8 @@ function he(t) {
337
337
 
338
338
  <MultiSelect.Content class="p-0">
339
339
  <Command.Root>
340
- <Command.Input autofocus placeholder="${r}" />
341
- <Command.Empty>${a}</Command.Empty>
340
+ <Command.Input autofocus placeholder="${a}" />
341
+ <Command.Empty>${r}</Command.Empty>
342
342
  <Command.Group>
343
343
  {#each data.${i} as ${s}}
344
344
  <MultiSelect.Item value={${s}.id} label={${s}.${t.displayField}} />
@@ -352,19 +352,19 @@ function he(t) {
352
352
  `;
353
353
  }
354
354
  function be(t) {
355
- return d`
355
+ return p`
356
356
  <Form.Field {form} name="${t.name}" class="col-span-1">
357
357
  <Form.Control>
358
358
  {#snippet children({ props })}
359
- ${I(t)}
360
- <Input {...props} type="text" value={${E(t)}}${O(t)} readonly />
359
+ ${z(t)}
360
+ <Input {...props} type="text" value={${E(t)}}${q(t)} readonly />
361
361
  {/snippet}
362
362
  </Form.Control>
363
363
  <Form.FieldErrors class="contents text-destructive" />
364
364
  </Form.Field>
365
365
  `;
366
366
  }
367
- function rt(t) {
367
+ function at(t) {
368
368
  switch (t.type) {
369
369
  case "text":
370
370
  return D(t, "text");
@@ -384,9 +384,9 @@ function rt(t) {
384
384
  case "json":
385
385
  return ue(t);
386
386
  case "bool":
387
- return de(t);
388
- case "geoPoint":
389
387
  return pe(t);
388
+ case "geoPoint":
389
+ return de(t);
390
390
  case "file":
391
391
  return fe(t);
392
392
  case "select":
@@ -397,9 +397,9 @@ function rt(t) {
397
397
  return t;
398
398
  }
399
399
  }
400
- function zt(t) {
400
+ function It(t) {
401
401
  const e = t.options.map(
402
- (n) => d`
402
+ (n) => p`
403
403
  ${JSON.stringify(n.value)}: {
404
404
  label: ${JSON.stringify(n.label)},
405
405
  value: ${JSON.stringify(n.value)}
@@ -407,24 +407,24 @@ function zt(t) {
407
407
  `
408
408
  ).join(`,
409
409
  `);
410
- return d`
410
+ return p`
411
411
  const ${t.name}Labels = {
412
412
  ${e}
413
413
  } as const;
414
414
  `;
415
415
  }
416
- function L(t) {
416
+ function U(t) {
417
417
  const e = t.flatMap((n) => ce[n.type]);
418
418
  return [...new Set(e)];
419
419
  }
420
- function at(t) {
420
+ function rt(t) {
421
421
  return [...new Set(t.flatMap((e) => me[e]))];
422
422
  }
423
- function R(t, e) {
423
+ function P(t, e) {
424
424
  return `data.${t.name}.${e.name}`;
425
425
  }
426
426
  function Q(t, e, n) {
427
- return d`
427
+ return p`
428
428
  <div class="space-y-2">
429
429
  <h3 class="font-medium leading-none">${e.title}</h3>
430
430
  <p class="text-muted-foreground">${n}</p>
@@ -432,41 +432,41 @@ function Q(t, e, n) {
432
432
  `;
433
433
  }
434
434
  function ve(t, e) {
435
- const n = R(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, a = e.required ? r : d`
435
+ const n = P(t, e), a = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, r = e.required ? a : p`
436
436
  {#if ${n}}
437
- ${r}
437
+ ${a}
438
438
  {/if}
439
439
  `;
440
- return d`
440
+ return p`
441
441
  <div class="space-y-2">
442
442
  <h3 class="font-medium leading-none">${e.title}</h3>
443
- ${a}
443
+ ${r}
444
444
  </div>
445
445
  `;
446
446
  }
447
447
  function we(t, e) {
448
- const n = R(t, e), r = d`
448
+ const n = P(t, e), a = p`
449
449
  <a href={${n}} target="_blank" rel="noopener noreferrer">
450
450
  {${n}}
451
451
  </a>
452
- `, a = e.required ? r : d`
452
+ `, r = e.required ? a : p`
453
453
  {#if ${n}}
454
- ${r}
454
+ ${a}
455
455
  {/if}
456
456
  `;
457
- return d`
457
+ return p`
458
458
  <div class="space-y-2">
459
459
  <h3 class="font-medium leading-none">${e.title}</h3>
460
460
  <p class="text-muted-foreground">
461
- ${a}
461
+ ${r}
462
462
  </p>
463
463
  </div>
464
464
  `;
465
465
  }
466
466
  function ye(t, e) {
467
- const n = R(t, e);
467
+ const n = P(t, e);
468
468
  if (e.maxSelect > 1)
469
- return d`
469
+ return p`
470
470
  <div class="space-y-2">
471
471
  <h3 class="font-medium leading-none">${e.title}</h3>
472
472
  {#each ${n} as ${e.name}}
@@ -474,21 +474,21 @@ function ye(t, e) {
474
474
  {/each}
475
475
  </div>
476
476
  `;
477
- const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, a = e.required ? r : d`
477
+ const a = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, r = e.required ? a : p`
478
478
  {#if ${n}}
479
- ${r}
479
+ ${a}
480
480
  {/if}
481
481
  `;
482
- return d`
482
+ return p`
483
483
  <div class="space-y-2">
484
484
  <h3 class="font-medium leading-none">${e.title}</h3>
485
- ${a}
485
+ ${r}
486
486
  </div>
487
487
  `;
488
488
  }
489
489
  function $e(t, e) {
490
- const n = R(t, e);
491
- return e.maxSelect > 1 ? d`
490
+ const n = P(t, e);
491
+ return e.maxSelect > 1 ? p`
492
492
  <div class="space-y-2">
493
493
  <h3 class="font-medium leading-none">${e.title}</h3>
494
494
  {#if ${n}}
@@ -510,7 +510,7 @@ function $e(t, e) {
510
510
  {/each}
511
511
  {/if}
512
512
  </div>
513
- ` : d`
513
+ ` : p`
514
514
  <div class="space-y-2">
515
515
  <h3 class="font-medium leading-none">${e.title}</h3>
516
516
  {#if ${n}}
@@ -536,12 +536,12 @@ function xe(t) {
536
536
  return `/${t.relatedModel.routeSegment}`;
537
537
  }
538
538
  function Fe(t, e) {
539
- const n = `data.${t.name}.expand?.${e.name}`, r = xe(e);
540
- return e.maxSelect > 1 ? d`
539
+ const n = `data.${t.name}.expand?.${e.name}`, a = xe(e);
540
+ return e.maxSelect > 1 ? p`
541
541
  <div class="space-y-2">
542
542
  <h3 class="font-medium leading-none">${e.title}</h3>
543
543
  {#each ${n} ?? [] as ${e.singularRelationName}}
544
- <a href="${r}/{${e.singularRelationName}.id}">
544
+ <a href="${a}/{${e.singularRelationName}.id}">
545
545
  <Badge variant="outline" class="text-muted-foreground">
546
546
  {${e.singularRelationName}.${e.displayField}}
547
547
  <CircleArrowRightIcon class="w-4 h-4" />
@@ -549,11 +549,11 @@ function Fe(t, e) {
549
549
  </a>
550
550
  {/each}
551
551
  </div>
552
- ` : d`
552
+ ` : p`
553
553
  <div class="space-y-2">
554
554
  <h3 class="font-medium leading-none">${e.title}</h3>
555
555
  {#if ${n}}
556
- <a href="${r}/{${n}.id}">
556
+ <a href="${a}/{${n}.id}">
557
557
  <Badge variant="outline" class="text-muted-foreground">
558
558
  {${n}.${e.displayField}}
559
559
  <CircleArrowRightIcon class="w-4 h-4" />
@@ -564,7 +564,7 @@ function Fe(t, e) {
564
564
  `;
565
565
  }
566
566
  function Se(t, e) {
567
- const n = R(t, e), r = d`
567
+ const n = P(t, e), a = p`
568
568
  {#await import("$lib/components/ui/leaflet/leaflet.svelte")}
569
569
  <div class="h-56.25 w-full bg-input rounded-md"></div>
570
570
  {:then { default: Leaflet }}
@@ -573,15 +573,15 @@ function Se(t, e) {
573
573
  <p class="text-muted-foreground">
574
574
  {${n}?.lat.toFixed(6)}, {${n}?.lon.toFixed(6)}
575
575
  </p>
576
- `, a = e.required ? r : d`
576
+ `, r = e.required ? a : p`
577
577
  {#if ${n}}
578
- ${r}
578
+ ${a}
579
579
  {/if}
580
580
  `;
581
- return d`
581
+ return p`
582
582
  <div class="space-y-2">
583
583
  <h3 class="font-medium leading-none">${e.title}</h3>
584
- ${a}
584
+ ${r}
585
585
  </div>
586
586
  `;
587
587
  }
@@ -591,9 +591,9 @@ function Ce(t, e) {
591
591
  case "number":
592
592
  case "email":
593
593
  case "editor":
594
- return Q(t, e, `{${R(t, e)}}`);
594
+ return Q(t, e, `{${P(t, e)}}`);
595
595
  case "password":
596
- return d`
596
+ return p`
597
597
  <div class="space-y-2">
598
598
  <h3 class="font-medium leading-none">${e.title}</h3>
599
599
  <p class="text-muted-foreground">
@@ -605,7 +605,7 @@ function Ce(t, e) {
605
605
  return Q(
606
606
  t,
607
607
  e,
608
- `{${R(t, e)} ? "Yes" : "No"}`
608
+ `{${P(t, e)} ? "Yes" : "No"}`
609
609
  );
610
610
  case "date":
611
611
  case "autodate":
@@ -617,7 +617,7 @@ function Ce(t, e) {
617
617
  case "file":
618
618
  return $e(t, e);
619
619
  case "json":
620
- return Q(t, e, `{JSON.stringify(${R(t, e)})}`);
620
+ return Q(t, e, `{JSON.stringify(${P(t, e)})}`);
621
621
  case "geoPoint":
622
622
  return Se(t, e);
623
623
  case "relation":
@@ -630,43 +630,43 @@ const _e = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), ke = new RegExp("(\\p{Lu
630
630
  function Mt(t) {
631
631
  let e = t.trim();
632
632
  e = e.replace(_e, ft).replace(ke, ft), e = e.replace(Pe, "\0");
633
- let n = 0, r = e.length;
633
+ let n = 0, a = e.length;
634
634
  for (; e.charAt(n) === "\0"; )
635
635
  n++;
636
- if (n === r)
636
+ if (n === a)
637
637
  return [];
638
- for (; e.charAt(r - 1) === "\0"; )
639
- r--;
640
- return e.slice(n, r).split(/\0/g);
638
+ for (; e.charAt(a - 1) === "\0"; )
639
+ a--;
640
+ return e.slice(n, a).split(/\0/g);
641
641
  }
642
642
  function Ee(t) {
643
643
  const e = Mt(t);
644
644
  for (let n = 0; n < e.length; n++) {
645
- const r = e[n], a = Re.exec(r);
646
- if (a) {
647
- const s = a.index + (a[1] ?? a[2]).length;
648
- e.splice(n, 1, r.slice(0, s), r.slice(s));
645
+ const a = e[n], r = Re.exec(a);
646
+ if (r) {
647
+ const s = r.index + (r[1] ?? r[2]).length;
648
+ e.splice(n, 1, a.slice(0, s), a.slice(s));
649
649
  }
650
650
  }
651
651
  return e;
652
652
  }
653
653
  function Bt(t, e) {
654
- const [n, r, a] = J(t, e);
655
- return n + r.map(W(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + a;
654
+ const [n, a, r] = J(t, e);
655
+ return n + a.map(W(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + r;
656
656
  }
657
- function j(t, e) {
658
- const [n, r, a] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale), o = Dt(s, i);
659
- return n + r.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + a;
657
+ function L(t, e) {
658
+ const [n, a, r] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale), o = Dt(s, i);
659
+ return n + a.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + r;
660
660
  }
661
- function Ie(t, e) {
662
- const [n, r, a] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale), o = Dt(s, i);
663
- return n + r.map(o).join("") + a;
661
+ function ze(t, e) {
662
+ const [n, a, r] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale), o = Dt(s, i);
663
+ return n + a.map(o).join("") + r;
664
664
  }
665
665
  function ot(t, e) {
666
- const [n, r, a] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale);
667
- return n + r.map(Be(s, i)).join(" ") + a;
666
+ const [n, a, r] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale);
667
+ return n + a.map(Be(s, i)).join(" ") + r;
668
668
  }
669
- function ze(t, e) {
669
+ function Ie(t, e) {
670
670
  return Bt(t, { delimiter: "-", ...e });
671
671
  }
672
672
  function Me(t, e) {
@@ -682,23 +682,23 @@ function Be(t, e) {
682
682
  return (n) => `${e(n[0])}${t(n.slice(1))}`;
683
683
  }
684
684
  function Dt(t, e) {
685
- return (n, r) => {
686
- const a = n[0];
687
- return (r > 0 && a >= "0" && a <= "9" ? "_" + a : e(a)) + t(n.slice(1));
685
+ return (n, a) => {
686
+ const r = n[0];
687
+ return (a > 0 && r >= "0" && r <= "9" ? "_" + r : e(r)) + t(n.slice(1));
688
688
  };
689
689
  }
690
690
  function J(t, e = {}) {
691
- const n = e.split ?? (e.separateNumbers ? Ee : Mt), r = e.prefixCharacters ?? gt, a = e.suffixCharacters ?? gt;
691
+ const n = e.split ?? (e.separateNumbers ? Ee : Mt), a = e.prefixCharacters ?? gt, r = e.suffixCharacters ?? gt;
692
692
  let s = 0, i = t.length;
693
693
  for (; s < t.length; ) {
694
694
  const o = t.charAt(s);
695
- if (!r.includes(o))
695
+ if (!a.includes(o))
696
696
  break;
697
697
  s++;
698
698
  }
699
699
  for (; i > s; ) {
700
700
  const o = i - 1, c = t.charAt(o);
701
- if (!a.includes(c))
701
+ if (!r.includes(c))
702
702
  break;
703
703
  i = o;
704
704
  }
@@ -711,57 +711,57 @@ function J(t, e = {}) {
711
711
  function De(t) {
712
712
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
713
713
  }
714
- function Te(t) {
714
+ function je(t) {
715
715
  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.');
716
716
  }
717
- var U = { exports: {} }, Ae = U.exports, ht;
718
- function je() {
717
+ var G = { exports: {} }, Te = G.exports, ht;
718
+ function Ae() {
719
719
  return ht || (ht = 1, (function(t, e) {
720
- (function(n, r) {
721
- typeof Te == "function" ? t.exports = r() : n.pluralize = r();
722
- })(Ae, function() {
723
- var n = [], r = [], a = {}, s = {}, i = {};
720
+ (function(n, a) {
721
+ typeof je == "function" ? t.exports = a() : n.pluralize = a();
722
+ })(Te, function() {
723
+ var n = [], a = [], r = {}, s = {}, i = {};
724
724
  function o(l) {
725
725
  return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
726
726
  }
727
- function c(l, p) {
728
- return l === p ? p : l === l.toLowerCase() ? p.toLowerCase() : l === l.toUpperCase() ? p.toUpperCase() : l[0] === l[0].toUpperCase() ? p.charAt(0).toUpperCase() + p.substr(1).toLowerCase() : p.toLowerCase();
727
+ function c(l, d) {
728
+ return l === d ? d : l === l.toLowerCase() ? d.toLowerCase() : l === l.toUpperCase() ? d.toUpperCase() : l[0] === l[0].toUpperCase() ? d.charAt(0).toUpperCase() + d.substr(1).toLowerCase() : d.toLowerCase();
729
729
  }
730
- function m(l, p) {
730
+ function m(l, d) {
731
731
  return l.replace(/\$(\d{1,2})/g, function(w, x) {
732
- return p[x] || "";
732
+ return d[x] || "";
733
733
  });
734
734
  }
735
- function g(l, p) {
736
- return l.replace(p[0], function(w, x) {
737
- var F = m(p[1], arguments);
735
+ function g(l, d) {
736
+ return l.replace(d[0], function(w, x) {
737
+ var F = m(d[1], arguments);
738
738
  return c(w === "" ? l[x - 1] : w, F);
739
739
  });
740
740
  }
741
- function f(l, p, w) {
742
- if (!l.length || a.hasOwnProperty(l))
743
- return p;
741
+ function f(l, d, w) {
742
+ if (!l.length || r.hasOwnProperty(l))
743
+ return d;
744
744
  for (var x = w.length; x--; ) {
745
745
  var F = w[x];
746
- if (F[0].test(p)) return g(p, F);
746
+ if (F[0].test(d)) return g(d, F);
747
747
  }
748
- return p;
748
+ return d;
749
749
  }
750
- function h(l, p, w) {
750
+ function h(l, d, w) {
751
751
  return function(x) {
752
752
  var F = x.toLowerCase();
753
- return p.hasOwnProperty(F) ? c(x, F) : l.hasOwnProperty(F) ? c(x, l[F]) : f(F, x, w);
753
+ return d.hasOwnProperty(F) ? c(x, F) : l.hasOwnProperty(F) ? c(x, l[F]) : f(F, x, w);
754
754
  };
755
755
  }
756
- function $(l, p, w, x) {
756
+ function $(l, d, w, x) {
757
757
  return function(F) {
758
758
  var M = F.toLowerCase();
759
- return p.hasOwnProperty(M) ? !0 : l.hasOwnProperty(M) ? !1 : f(M, M, w) === M;
759
+ return d.hasOwnProperty(M) ? !0 : l.hasOwnProperty(M) ? !1 : f(M, M, w) === M;
760
760
  };
761
761
  }
762
- function u(l, p, w) {
763
- var x = p === 1 ? u.singular(l) : u.plural(l);
764
- return (w ? p + " " : "") + x;
762
+ function u(l, d, w) {
763
+ var x = d === 1 ? u.singular(l) : u.plural(l);
764
+ return (w ? d + " " : "") + x;
765
765
  }
766
766
  return u.plural = h(
767
767
  i,
@@ -774,23 +774,23 @@ function je() {
774
774
  ), u.singular = h(
775
775
  s,
776
776
  i,
777
- r
777
+ a
778
778
  ), u.isSingular = $(
779
779
  s,
780
780
  i,
781
- r
782
- ), u.addPluralRule = function(l, p) {
783
- n.push([o(l), p]);
784
- }, u.addSingularRule = function(l, p) {
785
- r.push([o(l), p]);
781
+ a
782
+ ), u.addPluralRule = function(l, d) {
783
+ n.push([o(l), d]);
784
+ }, u.addSingularRule = function(l, d) {
785
+ a.push([o(l), d]);
786
786
  }, u.addUncountableRule = function(l) {
787
787
  if (typeof l == "string") {
788
- a[l.toLowerCase()] = !0;
788
+ r[l.toLowerCase()] = !0;
789
789
  return;
790
790
  }
791
791
  u.addPluralRule(l, "$0"), u.addSingularRule(l, "$0");
792
- }, u.addIrregularRule = function(l, p) {
793
- p = p.toLowerCase(), l = l.toLowerCase(), i[l] = p, s[p] = l;
792
+ }, u.addIrregularRule = function(l, d) {
793
+ d = d.toLowerCase(), l = l.toLowerCase(), i[l] = d, s[d] = l;
794
794
  }, [
795
795
  // Pronouns.
796
796
  ["I", "we"],
@@ -1012,10 +1012,10 @@ function je() {
1012
1012
  /sheep$/i
1013
1013
  ].forEach(u.addUncountableRule), u;
1014
1014
  });
1015
- })(U)), U.exports;
1015
+ })(G)), G.exports;
1016
1016
  }
1017
- var Ne = je();
1018
- const k = /* @__PURE__ */ De(Ne), La = "data", qa = "migrations", Oe = "(app)", Le = /* @__PURE__ */ new Set([
1017
+ var Le = Ae();
1018
+ const k = /* @__PURE__ */ De(Le), io = "data", lo = "migrations", Oe = "(app)", Ne = /* @__PURE__ */ new Set([
1019
1019
  "break",
1020
1020
  "case",
1021
1021
  "catch",
@@ -1117,32 +1117,32 @@ const k = /* @__PURE__ */ De(Ne), La = "data", qa = "migrations", Oe = "(app)",
1117
1117
  constructor: "ctor"
1118
1118
  };
1119
1119
  function tt(t) {
1120
- return Le.has(t) ? qe[t] ?? `${t}_` : t;
1120
+ return Ne.has(t) ? qe[t] ?? `${t}_` : t;
1121
1121
  }
1122
- function Z(t) {
1122
+ function K(t) {
1123
1123
  if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
1124
1124
  throw new Error(
1125
1125
  "Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
1126
1126
  );
1127
1127
  }
1128
- function Ve(t) {
1128
+ function Ue(t) {
1129
1129
  return t.features.auth ? `src/routes/${Oe}` : "src/routes";
1130
1130
  }
1131
- function z(t, e) {
1132
- const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = k.singular(ot(r)), i = k.plural(s), o = j(s), c = ze(i), m = [...a, c].join("/");
1131
+ function I(t, e) {
1132
+ const n = t.split("/"), a = n[n.length - 1], r = n.slice(0, -1), s = k.singular(ot(a)), i = k.plural(s), o = L(s), c = Ie(i), m = [...r, c].join("/");
1133
1133
  return {
1134
1134
  name: tt(o),
1135
- pluralName: tt(j(i)),
1136
- typeName: Ie(s),
1135
+ pluralName: tt(L(i)),
1136
+ typeName: ze(s),
1137
1137
  tableName: Me(i),
1138
1138
  displayName: s,
1139
1139
  pluralDisplayName: i,
1140
1140
  schemaName: `${tt(o)}Schema`,
1141
1141
  routeSegment: m,
1142
- routesDir: Ve(e)
1142
+ routesDir: Ue(e)
1143
1143
  };
1144
1144
  }
1145
- function Ue(t) {
1145
+ function Ve(t) {
1146
1146
  const e = `${t.routesDir}/${t.routeSegment}`;
1147
1147
  return {
1148
1148
  list: e,
@@ -1203,15 +1203,15 @@ function We(t) {
1203
1203
  function Je(t) {
1204
1204
  return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
1205
1205
  }
1206
- function Ze(t) {
1206
+ function Ke(t) {
1207
1207
  return Object.fromEntries(t.map((e) => [e.name, e.id]));
1208
1208
  }
1209
- function Tt(t) {
1209
+ function jt(t) {
1210
1210
  return Object.fromEntries(
1211
1211
  t.map((e) => [e.name, We(e.fields)])
1212
1212
  );
1213
1213
  }
1214
- const Ke = [
1214
+ const Ze = [
1215
1215
  "user",
1216
1216
  "owner",
1217
1217
  "created_by",
@@ -1220,7 +1220,7 @@ const Ke = [
1220
1220
  "account",
1221
1221
  "creator"
1222
1222
  ];
1223
- function T(t) {
1223
+ function j(t) {
1224
1224
  return t.toLowerCase();
1225
1225
  }
1226
1226
  function bt(t) {
@@ -1232,14 +1232,14 @@ function bt(t) {
1232
1232
  };
1233
1233
  }
1234
1234
  function Xe(t, e, n = {}) {
1235
- const r = new Set((n.authCollections ?? ["users"]).map(T)), a = new Set(
1236
- (n.userFieldHints ?? Ke).map(T)
1235
+ const a = new Set((n.authCollections ?? ["users"]).map(j)), r = new Set(
1236
+ (n.userFieldHints ?? Ze).map(j)
1237
1237
  ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1238
1238
  for (const b of t)
1239
1239
  i.set(b.name, b), o.set(b.id, b);
1240
1240
  if (!i.has(e))
1241
1241
  return bt(e);
1242
- if (r.has(T(e)))
1242
+ if (a.has(j(e)))
1243
1243
  return {
1244
1244
  rule: "@request.auth.id = id",
1245
1245
  ownershipChainCollections: [e],
@@ -1247,8 +1247,8 @@ function Xe(t, e, n = {}) {
1247
1247
  operator: "="
1248
1248
  };
1249
1249
  function c(b) {
1250
- const v = T(b);
1251
- return v === "user" ? 50 : a.has(v) ? 20 : 0;
1250
+ const v = j(b);
1251
+ return v === "user" ? 50 : r.has(v) ? 20 : 0;
1252
1252
  }
1253
1253
  function m(b) {
1254
1254
  const v = i.get(b);
@@ -1268,7 +1268,7 @@ function Xe(t, e, n = {}) {
1268
1268
  return C.sort((y, B) => y.fieldName.localeCompare(B.fieldName)), C;
1269
1269
  }
1270
1270
  function g(b) {
1271
- return r.has(T(b));
1271
+ return a.has(j(b));
1272
1272
  }
1273
1273
  function f(b) {
1274
1274
  if (b.length === 0) return !1;
@@ -1277,41 +1277,41 @@ function Xe(t, e, n = {}) {
1277
1277
  return g(b[b.length - 1].to);
1278
1278
  }
1279
1279
  function h(b) {
1280
- const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, B = b.reduce((Y, Yt) => Y + Yt.hintScore, 0), Xt = T(v.fieldName) === "user" ? 1 : 0;
1280
+ const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, B = b.reduce((Y, Yt) => Y + Yt.hintScore, 0), Xt = j(v.fieldName) === "user" ? 1 : 0;
1281
1281
  return 100 * b.length + 50 * C - 40 * Xt - 15 * y - B;
1282
1282
  }
1283
1283
  function $(b) {
1284
1284
  return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
1285
1285
  }
1286
1286
  const u = [], l = /* @__PURE__ */ new Set([e]);
1287
- function p(b, v, C) {
1287
+ function d(b, v, C) {
1288
1288
  if (!(C > s)) {
1289
1289
  if (v.length > 0 && g(v[v.length - 1].to) && f(v)) {
1290
1290
  u.push([...v]);
1291
1291
  return;
1292
1292
  }
1293
1293
  for (const y of m(b))
1294
- l.has(y.to) || y.isMulti && !g(y.to) || (l.add(y.to), v.push(y), p(y.to, v, C + 1), v.pop(), l.delete(y.to));
1294
+ l.has(y.to) || y.isMulti && !g(y.to) || (l.add(y.to), v.push(y), d(y.to, v, C + 1), v.pop(), l.delete(y.to));
1295
1295
  }
1296
1296
  }
1297
- if (p(e, [], 0), u.length === 0)
1297
+ if (d(e, [], 0), u.length === 0)
1298
1298
  return bt(e);
1299
1299
  u.sort((b, v) => {
1300
1300
  const C = h(b) - h(v);
1301
1301
  return C !== 0 ? C : $(b).localeCompare($(v));
1302
1302
  });
1303
- const w = u[0], x = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], mt = w[w.length - 1].isMulti ? "?=" : "=", Zt = x.join("."), Kt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1303
+ const w = u[0], x = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], mt = w[w.length - 1].isMulti ? "?=" : "=", Kt = x.join("."), Zt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1304
1304
  return {
1305
- rule: `@request.auth.id ${mt} ${Kt}${Zt}.id`,
1305
+ rule: `@request.auth.id ${mt} ${Zt}${Kt}.id`,
1306
1306
  ownershipChainCollections: F,
1307
1307
  ownershipChainFields: x,
1308
1308
  operator: mt
1309
1309
  };
1310
1310
  }
1311
1311
  function Ye(t) {
1312
- let e = null, n = !1, r = 0;
1313
- for (let a = 0; a < t.length; a++) {
1314
- const s = t[a];
1312
+ let e = null, n = !1, a = 0;
1313
+ for (let r = 0; r < t.length; r++) {
1314
+ const s = t[r];
1315
1315
  if (n) {
1316
1316
  n = !1;
1317
1317
  continue;
@@ -1329,15 +1329,15 @@ function Ye(t) {
1329
1329
  continue;
1330
1330
  }
1331
1331
  if (s === "(") {
1332
- r++;
1332
+ a++;
1333
1333
  continue;
1334
1334
  }
1335
1335
  if (s === ")") {
1336
- r = Math.max(0, r - 1);
1336
+ a = Math.max(0, a - 1);
1337
1337
  continue;
1338
1338
  }
1339
- if (s === ":" && r === 0)
1340
- return [t.slice(0, a), t.slice(a + 1)];
1339
+ if (s === ":" && a === 0)
1340
+ return [t.slice(0, r), t.slice(r + 1)];
1341
1341
  }
1342
1342
  return [t, ""];
1343
1343
  }
@@ -1346,16 +1346,16 @@ function vt(t) {
1346
1346
  return e.startsWith('"') && e.endsWith('"') || e.startsWith("'") && e.endsWith("'") ? e.slice(1, -1).replace(/\\(["'])/g, "$1") : e;
1347
1347
  }
1348
1348
  function wt(t) {
1349
- let e = -1, n = null, r = !1;
1349
+ let e = -1, n = null, a = !1;
1350
1350
  for (let i = 0; i < t.length; i++) {
1351
1351
  const o = t[i];
1352
- if (r) {
1353
- r = !1;
1352
+ if (a) {
1353
+ a = !1;
1354
1354
  continue;
1355
1355
  }
1356
1356
  if (n) {
1357
1357
  if (o === "\\") {
1358
- r = !0;
1358
+ a = !0;
1359
1359
  continue;
1360
1360
  }
1361
1361
  o === n && (n = null);
@@ -1370,32 +1370,32 @@ function wt(t) {
1370
1370
  break;
1371
1371
  }
1372
1372
  }
1373
- let a, s;
1374
- return e >= 0 ? (a = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (a = t.trim(), s = a), { label: vt(s), value: vt(a) };
1373
+ let r, s;
1374
+ return e >= 0 ? (r = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (r = t.trim(), s = r), { label: vt(s), value: vt(r) };
1375
1375
  }
1376
1376
  function Qe(t) {
1377
1377
  const e = [];
1378
- let n = "", r = null, a = !1;
1378
+ let n = "", a = null, r = !1;
1379
1379
  for (let i = 0; i < t.length; i++) {
1380
1380
  const o = t[i];
1381
- if (a) {
1382
- n += o, a = !1;
1381
+ if (r) {
1382
+ n += o, r = !1;
1383
1383
  continue;
1384
1384
  }
1385
- if (r) {
1385
+ if (a) {
1386
1386
  if (o === "\\") {
1387
- a = !0, n += o;
1387
+ r = !0, n += o;
1388
1388
  continue;
1389
1389
  }
1390
- if (o === r) {
1391
- r = null, n += o;
1390
+ if (o === a) {
1391
+ a = null, n += o;
1392
1392
  continue;
1393
1393
  }
1394
1394
  n += o;
1395
1395
  continue;
1396
1396
  }
1397
1397
  if (o === '"' || o === "'") {
1398
- r = o, n += o;
1398
+ a = o, n += o;
1399
1399
  continue;
1400
1400
  }
1401
1401
  if (o === ",") {
@@ -1423,42 +1423,42 @@ const yt = {
1423
1423
  };
1424
1424
  function tn(t) {
1425
1425
  const e = t.endsWith("!");
1426
- let n = e ? t.slice(0, -1) : t, r = [];
1426
+ let n = e ? t.slice(0, -1) : t, a = [];
1427
1427
  if (n.startsWith("select(") && n.endsWith(")")) {
1428
- const a = n.slice(7, -1);
1429
- r = Qe(a), n = "select";
1428
+ const r = n.slice(7, -1);
1429
+ a = Qe(r), n = "select";
1430
1430
  }
1431
- return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in yt && (n = yt[n]), { type: n, required: e, selectOptions: r });
1431
+ return n === "files" ? { type: "file", required: e, selectOptions: a } : (n in yt && (n = yt[n]), { type: n, required: e, selectOptions: a });
1432
1432
  }
1433
1433
  function $t(t) {
1434
1434
  const e = k.singular(t), n = k.plural(e);
1435
1435
  return t === n ? 99 : 1;
1436
1436
  }
1437
- function q(t, e, n, r, a, s) {
1438
- const i = z(e, s), o = k.singular(t), c = k.plural(o);
1437
+ function V(t, e, n, a, r, s) {
1438
+ const i = I(e, s), o = k.singular(t), c = k.plural(o);
1439
1439
  return {
1440
- collectionId: r[e],
1441
- displayField: a[e] ?? "id",
1440
+ collectionId: a[e],
1441
+ displayField: r[e] ?? "id",
1442
1442
  relatedModel: i,
1443
- singularRelationName: j(
1443
+ singularRelationName: L(
1444
1444
  `${n.displayName} ${i.displayName}`
1445
1445
  ),
1446
- pluralRelationName: j(
1446
+ pluralRelationName: L(
1447
1447
  `${n.displayName} ${i.pluralDisplayName}`
1448
1448
  ),
1449
1449
  maxSelect: t === c ? 999 : 1
1450
1450
  };
1451
1451
  }
1452
- function en(t, e, n, r, a) {
1453
- const s = ot(t), { type: i, required: o, selectOptions: c } = e, m = Je(r), g = Ze(r), f = Tt(r), h = m.map((u) => k.singular(u));
1454
- if (a.features.auth && i === "current_user" && g.users) {
1455
- const u = q(
1452
+ function en(t, e, n, a, r) {
1453
+ const s = ot(t), { type: i, required: o, selectOptions: c } = e, m = Je(a), g = Ke(a), f = jt(a), h = m.map((u) => k.singular(u));
1454
+ if (r.features.auth && i === "current_user" && g.users) {
1455
+ const u = V(
1456
1456
  t,
1457
1457
  "users",
1458
1458
  n,
1459
1459
  g,
1460
1460
  f,
1461
- a
1461
+ r
1462
1462
  );
1463
1463
  return {
1464
1464
  type: "relation",
@@ -1505,31 +1505,31 @@ function en(t, e, n, r, a) {
1505
1505
  throw new Error(
1506
1506
  `Invalid relation field: ${t}. Must be one of ${m.join(", ")} (singular or plural)`
1507
1507
  );
1508
- const p = q(
1508
+ const d = V(
1509
1509
  t,
1510
1510
  l,
1511
1511
  n,
1512
1512
  g,
1513
1513
  f,
1514
- a
1514
+ r
1515
1515
  );
1516
1516
  return {
1517
1517
  type: "relation",
1518
1518
  name: t,
1519
1519
  title: s,
1520
1520
  required: o,
1521
- ...p,
1521
+ ...d,
1522
1522
  isCurrentUser: !1
1523
1523
  };
1524
1524
  }
1525
1525
  if (m.includes(i)) {
1526
- const u = q(
1526
+ const u = V(
1527
1527
  t,
1528
1528
  i,
1529
1529
  n,
1530
1530
  g,
1531
1531
  f,
1532
- a
1532
+ r
1533
1533
  );
1534
1534
  return {
1535
1535
  type: "relation",
@@ -1543,13 +1543,13 @@ function en(t, e, n, r, a) {
1543
1543
  if (h.includes(i)) {
1544
1544
  const u = k.plural(i);
1545
1545
  if (m.includes(u)) {
1546
- const l = q(
1546
+ const l = V(
1547
1547
  t,
1548
1548
  u,
1549
1549
  n,
1550
1550
  g,
1551
1551
  f,
1552
- a
1552
+ r
1553
1553
  );
1554
1554
  return {
1555
1555
  type: "relation",
@@ -1582,7 +1582,7 @@ function en(t, e, n, r, a) {
1582
1582
  "select",
1583
1583
  "file",
1584
1584
  "relation",
1585
- ...a.features.auth ? ["current_user"] : [],
1585
+ ...r.features.auth ? ["current_user"] : [],
1586
1586
  ...m
1587
1587
  ])
1588
1588
  ];
@@ -1603,8 +1603,8 @@ function en(t, e, n, r, a) {
1603
1603
  );
1604
1604
  return { type: i, name: t, title: s, required: o };
1605
1605
  }
1606
- function nn(t, e, n, r) {
1607
- const a = [];
1606
+ function nn(t, e, n, a) {
1607
+ const r = [];
1608
1608
  for (const i of t) {
1609
1609
  const [o, c] = Ye(i);
1610
1610
  if (!o || !c)
@@ -1616,16 +1616,16 @@ function nn(t, e, n, r) {
1616
1616
  `Invalid field name: ${o}. Must start with a letter and contain only alphanumeric characters`
1617
1617
  );
1618
1618
  const m = tn(c);
1619
- a.push(en(o, m, e, n, r));
1619
+ r.push(en(o, m, e, n, a));
1620
1620
  }
1621
- const s = r.features.auth ? Xe(
1621
+ const s = a.features.auth ? Xe(
1622
1622
  [
1623
1623
  ...n,
1624
1624
  {
1625
1625
  id: "new",
1626
1626
  name: e.tableName,
1627
1627
  type: "base",
1628
- fields: a.map((i) => ({
1628
+ fields: r.map((i) => ({
1629
1629
  name: i.name,
1630
1630
  type: i.type,
1631
1631
  collectionId: i.type === "relation" ? i.collectionId : void 0,
@@ -1635,34 +1635,34 @@ function nn(t, e, n, r) {
1635
1635
  ],
1636
1636
  e.tableName
1637
1637
  ) : void 0;
1638
- return { fields: a, auth: s };
1638
+ return { fields: r, auth: s };
1639
1639
  }
1640
- async function K(t, e, n) {
1641
- let r;
1640
+ async function Z(t, e, n) {
1641
+ let a;
1642
1642
  if (n.env === "runtime") {
1643
- const { getCollections: a } = await import("./env.runtime-BTggk_Vb.js");
1644
- r = await a();
1643
+ const { getCollections: r } = await import("./env.runtime-BTICtvm9.js");
1644
+ a = await r();
1645
1645
  } else {
1646
- const { getPreviewCollections: a } = await import("./env.preview-HlXZOEL4.js");
1647
- r = a(n);
1646
+ const { getPreviewCollections: r } = await import("./env.preview-HlXZOEL4.js");
1647
+ a = r(n);
1648
1648
  }
1649
- return nn(t, e, r, n);
1649
+ return nn(t, e, a, n);
1650
1650
  }
1651
- const rn = "2024-01-01T00:00:00.000Z";
1652
- class N {
1651
+ const an = "2024-01-01T00:00:00.000Z";
1652
+ class O {
1653
1653
  constructor(e) {
1654
1654
  this.expression = e;
1655
1655
  }
1656
1656
  }
1657
1657
  function nt(t) {
1658
- return t instanceof N ? t.expression : Array.isArray(t) ? `[${t.map((e) => nt(e)).join(", ")}]` : t && typeof t == "object" ? `{ ${Object.entries(t).map(([n, r]) => `${JSON.stringify(n)}: ${nt(r)}`).join(", ")} }` : JSON.stringify(t);
1658
+ return t instanceof O ? t.expression : Array.isArray(t) ? `[${t.map((e) => nt(e)).join(", ")}]` : t && typeof t == "object" ? `{ ${Object.entries(t).map(([n, a]) => `${JSON.stringify(n)}: ${nt(a)}`).join(", ")} }` : JSON.stringify(t);
1659
1659
  }
1660
1660
  function et(t) {
1661
1661
  return `{ ${Object.entries(t).map(
1662
- ([n, r]) => `${JSON.stringify(n)}: ${nt(r)}`
1662
+ ([n, a]) => `${JSON.stringify(n)}: ${nt(a)}`
1663
1663
  ).join(", ")} }`;
1664
1664
  }
1665
- function an(t) {
1665
+ function rn(t) {
1666
1666
  switch (t) {
1667
1667
  case "text":
1668
1668
  case "number":
@@ -1698,11 +1698,11 @@ function an(t) {
1698
1698
  return;
1699
1699
  }
1700
1700
  }
1701
- function A(t, e) {
1701
+ function T(t, e) {
1702
1702
  return t.replace("[id]", `\${${e}}`);
1703
1703
  }
1704
- function At(t, e, n) {
1705
- var r, a, s;
1704
+ function Tt(t, e, n) {
1705
+ var a, r, s;
1706
1706
  switch (t.type) {
1707
1707
  case "text":
1708
1708
  case "editor":
@@ -1712,7 +1712,7 @@ function At(t, e, n) {
1712
1712
  case "bool":
1713
1713
  return !0;
1714
1714
  case "date":
1715
- return rn;
1715
+ return an;
1716
1716
  case "email":
1717
1717
  return `test-${t.name}@example.com`;
1718
1718
  case "password":
@@ -1724,14 +1724,14 @@ function At(t, e, n) {
1724
1724
  case "geoPoint":
1725
1725
  return n.forForm ? JSON.stringify({ lat: 40.7128, lon: -74.006 }) : { lat: 40.7128, lon: -74.006 };
1726
1726
  case "select": {
1727
- const i = ((a = (r = t.options) == null ? void 0 : r[0]) == null ? void 0 : a.value) ?? "default";
1727
+ const i = ((r = (a = t.options) == null ? void 0 : a[0]) == null ? void 0 : r.value) ?? "default";
1728
1728
  return t.maxSelect && t.maxSelect > 1 ? [i] : i;
1729
1729
  }
1730
1730
  case "relation": {
1731
1731
  if (n.authEnabled && (t.isCurrentUser || ((s = t.relatedModel) == null ? void 0 : s.tableName) === "users"))
1732
- return new N("context.user.id");
1732
+ return new O("context.user.id");
1733
1733
  const i = t.collectionId ? e[t.collectionId] : void 0;
1734
- return i ? new N(i) : "missing-relation-id";
1734
+ return i ? new O(i) : "missing-relation-id";
1735
1735
  }
1736
1736
  case "file":
1737
1737
  case "autodate":
@@ -1741,63 +1741,63 @@ function At(t, e, n) {
1741
1741
  }
1742
1742
  }
1743
1743
  function xt(t, e, n) {
1744
- const r = {};
1745
- for (const a of t) {
1746
- if (a.type === "file" || a.type === "autodate")
1744
+ const a = {};
1745
+ for (const r of t) {
1746
+ if (r.type === "file" || r.type === "autodate")
1747
1747
  continue;
1748
- if (n.authEnabled && a.type === "relation" && a.isCurrentUser) {
1749
- n.forForm || (r[a.name] = new N("context.user.id"));
1748
+ if (n.authEnabled && r.type === "relation" && r.isCurrentUser) {
1749
+ n.forForm || (a[r.name] = new O("context.user.id"));
1750
1750
  continue;
1751
1751
  }
1752
- const s = At(a, e, n);
1753
- s !== void 0 && (r[a.name] = s);
1752
+ const s = Tt(r, e, n);
1753
+ s !== void 0 && (a[r.name] = s);
1754
1754
  }
1755
- return r;
1755
+ return a;
1756
1756
  }
1757
1757
  function on(t, e, n) {
1758
- var a;
1759
- const r = {};
1758
+ var r;
1759
+ const a = {};
1760
1760
  for (const s of t) {
1761
1761
  if (s.system || s.name === "id")
1762
1762
  continue;
1763
- const i = an(s.type);
1763
+ const i = rn(s.type);
1764
1764
  if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
1765
1765
  continue;
1766
1766
  let o;
1767
1767
  if (i === "relation")
1768
- o = s.collectionId ? new N(
1768
+ o = s.collectionId ? new O(
1769
1769
  e[s.collectionId] ?? '"missing-relation-id"'
1770
1770
  ) : void 0;
1771
1771
  else if (i === "select") {
1772
- const c = ((a = s.values) == null ? void 0 : a[0]) ?? "default";
1772
+ const c = ((r = s.values) == null ? void 0 : r[0]) ?? "default";
1773
1773
  o = (s.maxSelect ?? 1) > 1 ? [c] : c;
1774
1774
  } else
1775
- o = At(
1775
+ o = Tt(
1776
1776
  { name: s.name, type: i },
1777
1777
  e,
1778
1778
  { forForm: !1, authEnabled: n.features.auth }
1779
1779
  );
1780
- o !== void 0 && (r[s.name] = o);
1780
+ o !== void 0 && (a[s.name] = o);
1781
1781
  }
1782
- return r;
1782
+ return a;
1783
1783
  }
1784
1784
  function sn(t) {
1785
- t.email = new N(
1785
+ t.email = new O(
1786
1786
  "`test-${Math.random().toString(36).slice(2)}@example.com`"
1787
1787
  ), t.password = "password", t.passwordConfirm = "password";
1788
1788
  }
1789
1789
  function ln(t, e) {
1790
1790
  if (!t)
1791
1791
  return [];
1792
- const n = new Map(e.map((o) => [o.id, o])), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = [], i = (o) => {
1793
- if (r.has(o) || a.has(o))
1792
+ const n = new Map(e.map((o) => [o.id, o])), a = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = [], i = (o) => {
1793
+ if (a.has(o) || r.has(o))
1794
1794
  return;
1795
1795
  const c = n.get(o);
1796
1796
  if (c) {
1797
- a.add(o);
1797
+ r.add(o);
1798
1798
  for (const m of c.fields)
1799
1799
  m.type !== "relation" || !m.collectionId || i(m.collectionId);
1800
- a.delete(o), r.add(o), s.push(c);
1800
+ r.delete(o), a.add(o), s.push(c);
1801
1801
  }
1802
1802
  };
1803
1803
  for (const o of t.fields)
@@ -1810,8 +1810,8 @@ function cn(t, e) {
1810
1810
  let n = 2;
1811
1811
  for (; e.has(`${t}${n}`); )
1812
1812
  n += 1;
1813
- const r = `${t}${n}`;
1814
- return e.add(r), r;
1813
+ const a = `${t}${n}`;
1814
+ return e.add(a), a;
1815
1815
  }
1816
1816
  function mn(t, e) {
1817
1817
  return {
@@ -1827,7 +1827,7 @@ function mn(t, e) {
1827
1827
  name: n.name,
1828
1828
  type: n.type,
1829
1829
  maxSelect: n.maxSelect,
1830
- values: n.options.map((r) => r.value)
1830
+ values: n.options.map((a) => a.value)
1831
1831
  } : n.type === "file" || n.type === "autodate" ? {
1832
1832
  name: n.name,
1833
1833
  type: n.type,
@@ -1835,37 +1835,37 @@ function mn(t, e) {
1835
1835
  } : { name: n.name, type: n.type })
1836
1836
  };
1837
1837
  }
1838
- function jt(t, e, n, r) {
1839
- const a = r.find((l) => l.name === t.tableName) ?? mn(t, e), s = ln(a, r).filter(
1838
+ function At(t, e, n, a) {
1839
+ const r = a.find((l) => l.name === t.tableName) ?? mn(t, e), s = ln(r, a).filter(
1840
1840
  (l) => !(n.features.auth && l.name === "users")
1841
1841
  ), i = {}, o = [], c = /* @__PURE__ */ new Set();
1842
1842
  for (const l of s) {
1843
- const p = cn(z(l.name, n).name, c);
1844
- o.push({ varName: p, collection: l }), i[l.id] = `${p}.id`;
1843
+ const d = cn(I(l.name, n).name, c);
1844
+ o.push({ varName: d, collection: l }), i[l.id] = `${d}.id`;
1845
1845
  }
1846
1846
  const m = o.length ? `${o.map((l) => `let ${l.varName}: { id: string };`).join(`
1847
1847
  `)}
1848
1848
 
1849
- ` : "", g = o.map(({ varName: l, collection: p }) => {
1849
+ ` : "", g = o.map(({ varName: l, collection: d }) => {
1850
1850
  const w = on(
1851
- p.fields,
1851
+ d.fields,
1852
1852
  i,
1853
1853
  n
1854
1854
  );
1855
- return p.type === "auth" && sn(w), `${l} = await context.admin.collection("${p.name}").create(${et(w)});`;
1855
+ return d.type === "auth" && sn(w), `${l} = await context.admin.collection("${d.name}").create(${et(w)});`;
1856
1856
  }), f = o.slice().reverse().map(
1857
- ({ varName: l, collection: p }) => `await context.admin.collection("${p.name}").delete(${l}.id);`
1857
+ ({ varName: l, collection: d }) => `await context.admin.collection("${d.name}").delete(${l}.id);`
1858
1858
  ), h = n.features.auth ? "context.agent" : "context.request", $ = n.features.auth ? `await context.agent.authenticateUser();
1859
1859
  ` : "";
1860
1860
  let u = "";
1861
- return (g.length > 0 || n.features.auth) && (u += d`
1861
+ return (g.length > 0 || n.features.auth) && (u += p`
1862
1862
  beforeEach(async (context) => {
1863
1863
  ${$}${g.join(`
1864
1864
  `)}
1865
1865
  });
1866
1866
  `), f.length > 0 && (u += `
1867
1867
 
1868
- ` + d`
1868
+ ` + p`
1869
1869
  afterEach(async (context) => {
1870
1870
  ${f.join(`
1871
1871
  `)}
@@ -1888,9 +1888,9 @@ function jt(t, e, n, r) {
1888
1888
  )
1889
1889
  };
1890
1890
  }
1891
- function un(t, e, n, r, a) {
1892
- const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = jt(t, n, r, a);
1893
- return d`
1891
+ function un(t, e, n, a, r) {
1892
+ const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = At(t, n, a, r);
1893
+ return p`
1894
1894
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
1895
1895
 
1896
1896
  describe("${t.pluralName}", () => {
@@ -1923,7 +1923,7 @@ function un(t, e, n, r, a) {
1923
1923
  describe("GET ${e.show}", () => {
1924
1924
  it("should return a 200 status code", async (context) => {
1925
1925
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1926
- const response = await ${o}.get(\`${A(e.show, "id")}\`);
1926
+ const response = await ${o}.get(\`${T(e.show, "id")}\`);
1927
1927
  expect(response.status).toBe(200);
1928
1928
  });
1929
1929
 
@@ -1936,10 +1936,10 @@ function un(t, e, n, r, a) {
1936
1936
  describe("POST ${e.show}", () => {
1937
1937
  it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
1938
1938
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1939
- const response = await ${o}.post(\`${A(e.show, "id")}\`).type("form");
1939
+ const response = await ${o}.post(\`${T(e.show, "id")}\`).type("form");
1940
1940
  expect(response.body.status).toBe(303);
1941
1941
 
1942
- const response2 = await ${o}.get(\`${A(e.show, "id")}\`);
1942
+ const response2 = await ${o}.get(\`${T(e.show, "id")}\`);
1943
1943
  expect(response2.status).toBe(404);
1944
1944
  });
1945
1945
  });
@@ -1947,7 +1947,7 @@ function un(t, e, n, r, a) {
1947
1947
  describe("GET ${e.edit}", () => {
1948
1948
  it("should return a 200 status code", async (context) => {
1949
1949
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1950
- const response = await ${o}.get(\`${A(e.edit, "id")}\`);
1950
+ const response = await ${o}.get(\`${T(e.edit, "id")}\`);
1951
1951
  expect(response.status).toBe(200);
1952
1952
  });
1953
1953
  });
@@ -1956,19 +1956,19 @@ function un(t, e, n, r, a) {
1956
1956
  it("should update a ${t.displayName.toLowerCase()}", async (context) => {
1957
1957
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1958
1958
  const response = await ${o}
1959
- .post(\`${A(e.edit, "id")}\`)
1959
+ .post(\`${T(e.edit, "id")}\`)
1960
1960
  .type("form")
1961
1961
  .send(${m});
1962
1962
  expect(response.body.status).toBe(303);
1963
- expect(response.body.location).toBe(\`${A(e.show, "id")}\`);
1963
+ expect(response.body.location).toBe(\`${T(e.show, "id")}\`);
1964
1964
  });
1965
1965
  });
1966
1966
  });
1967
1967
  `;
1968
1968
  }
1969
- function dn(t, e, n, r, a) {
1970
- const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = jt(t, n, r, a);
1971
- return d`
1969
+ function pn(t, e, n, a, r) {
1970
+ const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = At(t, n, a, r);
1971
+ return p`
1972
1972
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
1973
1973
 
1974
1974
  describe("${e}", () => {
@@ -1990,12 +1990,12 @@ function dn(t, e, n, r, a) {
1990
1990
  });
1991
1991
  `;
1992
1992
  }
1993
- var Ft = Object.freeze, pn = Object.defineProperty, fn = (t, e) => Ft(pn(t, "raw", { value: Ft(t.slice()) })), St;
1993
+ var Ft = Object.freeze, dn = Object.defineProperty, fn = (t, e) => Ft(dn(t, "raw", { value: Ft(t.slice()) })), St;
1994
1994
  function gn(t, e) {
1995
- const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, a = `/${n}`;
1995
+ const n = t.replace(/^\/+|\/+$/g, ""), a = `${e}/${n}`, r = `/${n}`;
1996
1996
  return {
1997
- pagePath: r,
1998
- pageUrl: a
1997
+ pagePath: a,
1998
+ pageUrl: r
1999
1999
  };
2000
2000
  }
2001
2001
  function hn(t) {
@@ -2006,14 +2006,14 @@ function hn(t) {
2006
2006
  throw new Error("At least one field definition is required.");
2007
2007
  return { modelPath: e, fields: n };
2008
2008
  }
2009
- function Nt(t) {
2009
+ function Lt(t) {
2010
2010
  return t.some((e) => e.type === "file");
2011
2011
  }
2012
2012
  function bn(t) {
2013
2013
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2014
2014
  }
2015
2015
  function Ct(t) {
2016
- const e = t.type === "select" ? `[${t.options.map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
2016
+ const e = t.type === "select" ? `[${t.options.map((r) => JSON.stringify(r.value)).join(", ")}]` : "";
2017
2017
  let n;
2018
2018
  switch (t.type) {
2019
2019
  case "text":
@@ -2089,9 +2089,9 @@ function vn(t) {
2089
2089
  return e;
2090
2090
  }
2091
2091
  function wn(t, e) {
2092
- const n = vn(e).map((r) => `${bn(r.name)}: ${r.schema}`).join(`,
2092
+ const n = vn(e).map((a) => `${bn(a.name)}: ${a.schema}`).join(`,
2093
2093
  `);
2094
- return d`
2094
+ return p`
2095
2095
  import { z } from "zod/v3";
2096
2096
 
2097
2097
  export const ${t.schemaName} = z.object({
@@ -2100,23 +2100,23 @@ function wn(t, e) {
2100
2100
  `;
2101
2101
  }
2102
2102
  function yn(t, e) {
2103
- const n = L(e), r = [
2103
+ const n = U(e), a = [
2104
2104
  'import { untrack } from "svelte";',
2105
2105
  'import { superForm } from "sveltekit-superforms";',
2106
2106
  'import { zodClient } from "sveltekit-superforms/adapters";',
2107
2107
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2108
- ...at(n)
2108
+ ...rt(n)
2109
2109
  ];
2110
- return [...new Set(r)];
2110
+ return [...new Set(a)];
2111
2111
  }
2112
2112
  function $n(t, e) {
2113
- const r = e.filter(
2114
- (a) => a.type === "select"
2115
- ).map((a) => zt(a)).join(`
2113
+ const a = e.filter(
2114
+ (r) => r.type === "select"
2115
+ ).map((r) => It(r)).join(`
2116
2116
 
2117
2117
  `);
2118
- return d`
2119
- ${r}
2118
+ return p`
2119
+ ${a}
2120
2120
 
2121
2121
  const form = superForm(untrack(() => data.form), {
2122
2122
  validators: zodClient(${t.schemaName}),
@@ -2127,9 +2127,9 @@ function $n(t, e) {
2127
2127
  }
2128
2128
  function xn(t, e) {
2129
2129
  const n = yn(t, e).join(`
2130
- `), r = $n(t, e), a = e.map((i) => rt(i)).join(`
2131
- `), s = Nt(e) ? ' enctype="multipart/form-data"' : "";
2132
- return d(St || (St = fn([`
2130
+ `), a = $n(t, e), r = e.map((i) => at(i)).join(`
2131
+ `), s = Lt(e) ? ' enctype="multipart/form-data"' : "";
2132
+ return p(St || (St = fn([`
2133
2133
  <script lang="ts">
2134
2134
  `, `
2135
2135
 
@@ -2152,17 +2152,17 @@ function xn(t, e) {
2152
2152
  </form>
2153
2153
  </div>
2154
2154
  </section>
2155
- `])), n, r, t.displayName, s, a);
2155
+ `])), n, a, t.displayName, s, r);
2156
2156
  }
2157
2157
  function Fn(t, e) {
2158
- const n = Nt(e), r = d`
2158
+ const n = Lt(e), a = p`
2159
2159
  import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
2160
2160
  import { zod } from "sveltekit-superforms/adapters";
2161
2161
  import { ${t.schemaName} } from "$lib/schemas/${t.name}";
2162
2162
  import { setFlash } from "sveltekit-flash-message/server";
2163
2163
  `;
2164
- return d`
2165
- ${r}
2164
+ return p`
2165
+ ${a}
2166
2166
 
2167
2167
  export const load = async () => {
2168
2168
  const form = await superValidate(zod(${t.schemaName}));
@@ -2184,33 +2184,33 @@ function Fn(t, e) {
2184
2184
  };
2185
2185
  `;
2186
2186
  }
2187
- function V(t, e) {
2187
+ function H(t, e) {
2188
2188
  return {
2189
2189
  path: t,
2190
- language: P(t),
2190
+ language: R(t),
2191
2191
  content: e
2192
2192
  };
2193
2193
  }
2194
2194
  async function Sn(t) {
2195
2195
  const { modelPath: e, fields: n } = hn(t.argv);
2196
- Z(e);
2197
- const r = z(e, t), s = (await K(n, r, t)).fields, { pagePath: i, pageUrl: o } = gn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
2196
+ K(e);
2197
+ const a = I(e, t), s = (await Z(n, a, t)).fields, { pagePath: i, pageUrl: o } = gn(e, a.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-BTICtvm9.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
2198
2198
  t
2199
2199
  ), m = [
2200
- V(`${i}/+page.svelte`, xn(r, s)),
2201
- V(`${i}/+page.server.ts`, Fn(r, s)),
2202
- V(
2200
+ H(`${i}/+page.svelte`, xn(a, s)),
2201
+ H(`${i}/+page.server.ts`, Fn(a, s)),
2202
+ H(
2203
2203
  `${i}/server.test.ts`,
2204
- dn(
2205
- r,
2204
+ pn(
2205
+ a,
2206
2206
  o,
2207
2207
  s,
2208
2208
  t,
2209
2209
  c
2210
2210
  )
2211
2211
  ),
2212
- V(`src/lib/schemas/${r.name}.ts`, wn(r, s))
2213
- ], g = L(s);
2212
+ H(`src/lib/schemas/${a.name}.ts`, wn(a, s))
2213
+ ], g = U(s);
2214
2214
  return {
2215
2215
  creates: m,
2216
2216
  modifies: [],
@@ -2249,7 +2249,7 @@ const En = {
2249
2249
  },
2250
2250
  baseline: "velastack",
2251
2251
  generate: Pn
2252
- }, In = ["text"], zn = {
2252
+ }, zn = ["text"], In = {
2253
2253
  string: "text",
2254
2254
  boolean: "bool",
2255
2255
  geopoint: "geoPoint",
@@ -2280,52 +2280,52 @@ function Mn(t) {
2280
2280
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2281
2281
  }
2282
2282
  function Bn(t, e) {
2283
- const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
2284
- let r;
2283
+ const n = t.type === "select" ? `[${(t.options ?? []).map((r) => JSON.stringify(r.value)).join(", ")}]` : "";
2284
+ let a;
2285
2285
  switch (t.type) {
2286
2286
  case "text":
2287
- r = "z.string()";
2287
+ a = "z.string()";
2288
2288
  break;
2289
2289
  case "number":
2290
- r = "z.number()";
2290
+ a = "z.number()";
2291
2291
  break;
2292
2292
  case "bool":
2293
- r = "z.boolean().default(false)";
2293
+ a = "z.boolean().default(false)";
2294
2294
  break;
2295
2295
  case "date":
2296
- r = e.forForm ? "z.string()" : "z.date()";
2296
+ a = e.forForm ? "z.string()" : "z.date()";
2297
2297
  break;
2298
2298
  case "email":
2299
- r = "z.string().email()";
2299
+ a = "z.string().email()";
2300
2300
  break;
2301
2301
  case "password":
2302
- r = "z.string()";
2302
+ a = "z.string()";
2303
2303
  break;
2304
2304
  case "url":
2305
- r = "z.string().url()";
2305
+ a = "z.string().url()";
2306
2306
  break;
2307
2307
  case "editor":
2308
- r = "z.string()";
2308
+ a = "z.string()";
2309
2309
  break;
2310
2310
  case "autodate":
2311
- r = e.forForm ? "z.string()" : "z.date()";
2311
+ a = e.forForm ? "z.string()" : "z.date()";
2312
2312
  break;
2313
2313
  case "select":
2314
- n ? r = (t.maxSelect ?? 1) > 1 ? `z.array(z.enum(${n}))` : `z.enum(${n})` : r = "z.string()";
2314
+ n ? a = (t.maxSelect ?? 1) > 1 ? `z.array(z.enum(${n}))` : `z.enum(${n})` : a = "z.string()";
2315
2315
  break;
2316
2316
  case "file":
2317
- r = (t.maxSelect ?? 1) > 1 ? "z.string().array()" : "z.union([z.instanceof(File), z.string()])";
2317
+ a = (t.maxSelect ?? 1) > 1 ? "z.string().array()" : "z.union([z.instanceof(File), z.string()])";
2318
2318
  break;
2319
2319
  case "json":
2320
- r = "z.any()";
2320
+ a = "z.any()";
2321
2321
  break;
2322
2322
  case "geoPoint":
2323
- r = e.forForm ? `z.preprocess((val) => {
2323
+ a = e.forForm ? `z.preprocess((val) => {
2324
2324
  if (typeof val === "string") {
2325
2325
  return val;
2326
2326
  }
2327
2327
  return JSON.stringify(val);
2328
- }, z.string()${t.required ? "" : ".optional()"}) as z.ZodEffects<${t.required ? "" : "z.ZodOptional<"}z.ZodString${t.required ? "" : ">"}, any, any>` : d`
2328
+ }, z.string()${t.required ? "" : ".optional()"}) as z.ZodEffects<${t.required ? "" : "z.ZodOptional<"}z.ZodString${t.required ? "" : ">"}, any, any>` : p`
2329
2329
  z.object({
2330
2330
  lat: z.number().min(-90).max(90),
2331
2331
  lon: z.number().min(-180).max(180)
@@ -2333,46 +2333,46 @@ function Bn(t, e) {
2333
2333
  `;
2334
2334
  break;
2335
2335
  case "relation":
2336
- r = (t.maxSelect ?? 1) > 1 ? "z.array(z.string())" : "z.string()";
2336
+ a = (t.maxSelect ?? 1) > 1 ? "z.array(z.string())" : "z.string()";
2337
2337
  break;
2338
2338
  default:
2339
2339
  return t.type;
2340
2340
  }
2341
- return In.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()`;
2341
+ return zn.includes(t.type) ? t.required ? `${a}.nonempty()` : `${a}.optional()` : t.required || t.type === "geoPoint" ? a : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${a}.optional().default("")` : `${a}.optional()`;
2342
2342
  }
2343
2343
  function it(t, e, n) {
2344
- const r = [];
2345
- n.includeModelFields && (r.push({ name: "id", type: "text", required: !1 }), r.push({ name: "collectionId", type: "text", required: !1 }));
2344
+ const a = [];
2345
+ n.includeModelFields && (a.push({ name: "id", type: "text", required: !1 }), a.push({ name: "collectionId", type: "text", required: !1 }));
2346
2346
  for (const o of e) {
2347
2347
  if (o.type === "file" && o.maxSelect > 1) {
2348
- 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 });
2348
+ a.push({ ...o, required: !1 }), a.push({ name: `${o.name}+`, type: "file", required: !1, maxSelect: 999 }), a.push({ name: `${o.name}-`, type: "file", required: !1, maxSelect: 999 });
2349
2349
  continue;
2350
2350
  }
2351
- r.push(o);
2351
+ a.push(o);
2352
2352
  }
2353
- const a = r.map((o) => `${Mn(o.name)}: ${Bn(o, n)}`).join(`,
2353
+ const r = a.map((o) => `${Mn(o.name)}: ${Bn(o, n)}`).join(`,
2354
2354
  `), s = n.includeModelFields ? `
2355
2355
  import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
2356
- return d`
2356
+ return p`
2357
2357
  import { z } from "zod/v3";${s}
2358
2358
 
2359
2359
  export const ${t.schemaName} = z.object({
2360
- ${a}
2360
+ ${r}
2361
2361
  })${i};
2362
2362
  `;
2363
2363
  }
2364
2364
  function Dn(t) {
2365
- const e = zn[t];
2365
+ const e = In[t];
2366
2366
  if (!e)
2367
2367
  throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
2368
2368
  return e;
2369
2369
  }
2370
2370
  function lt(t, e, n) {
2371
- const r = e.find((o) => o.name === t.tableName);
2372
- if (!r)
2371
+ const a = e.find((o) => o.name === t.tableName);
2372
+ if (!a)
2373
2373
  throw new Error(`Collection "${t.tableName}" not found`);
2374
- const a = Tt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
2375
- for (const o of r.fields) {
2374
+ const r = jt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
2375
+ for (const o of a.fields) {
2376
2376
  if (o.name === "id" || o.system)
2377
2377
  continue;
2378
2378
  const c = Dn(o.type), m = !!o.required, g = ot(o.name);
@@ -2380,7 +2380,7 @@ function lt(t, e, n) {
2380
2380
  const f = o.collectionId ? s.get(o.collectionId) : void 0;
2381
2381
  if (!f)
2382
2382
  continue;
2383
- const h = z(f.name, n);
2383
+ const h = I(f.name, n);
2384
2384
  i.push({
2385
2385
  name: o.name,
2386
2386
  title: g,
@@ -2388,12 +2388,12 @@ function lt(t, e, n) {
2388
2388
  required: m,
2389
2389
  collectionId: f.id,
2390
2390
  maxSelect: o.maxSelect ?? 1,
2391
- displayField: a[f.name] ?? "id",
2391
+ displayField: r[f.name] ?? "id",
2392
2392
  relatedModel: h,
2393
- singularRelationName: j(
2393
+ singularRelationName: L(
2394
2394
  `${t.displayName} ${h.displayName}`
2395
2395
  ),
2396
- pluralRelationName: j(
2396
+ pluralRelationName: L(
2397
2397
  `${t.displayName} ${h.pluralDisplayName}`
2398
2398
  ),
2399
2399
  isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(o.name)
@@ -2445,13 +2445,13 @@ function Ot(t) {
2445
2445
  const e = t.filter((n) => n.type === "relation").map((n) => n.name);
2446
2446
  return e.length > 0 ? e.join(",") : void 0;
2447
2447
  }
2448
- function Lt(t) {
2448
+ function Nt(t) {
2449
2449
  const e = /* @__PURE__ */ new Set(), n = [];
2450
- for (const r of t)
2451
- r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
2450
+ for (const a of t)
2451
+ a.type === "relation" && (e.has(a.relatedModel.tableName) || (e.add(a.relatedModel.tableName), n.push(a.relatedModel)));
2452
2452
  return n;
2453
2453
  }
2454
- function Tn(t) {
2454
+ function jn(t) {
2455
2455
  const e = {
2456
2456
  name: t.name,
2457
2457
  type: t.type,
@@ -2475,7 +2475,7 @@ function Tn(t) {
2475
2475
  } : e;
2476
2476
  }
2477
2477
  function qt(t, e, n) {
2478
- const r = n ? {
2478
+ const a = n ? {
2479
2479
  listRule: n.rule,
2480
2480
  viewRule: n.rule,
2481
2481
  createRule: n.rule,
@@ -2485,11 +2485,11 @@ function qt(t, e, n) {
2485
2485
  return {
2486
2486
  name: t.tableName,
2487
2487
  type: "base",
2488
- ...r,
2489
- fields: e.map(Tn)
2488
+ ...a,
2489
+ fields: e.map(jn)
2490
2490
  };
2491
2491
  }
2492
- function An(t) {
2492
+ function Tn(t) {
2493
2493
  const [e, ...n] = t;
2494
2494
  if (!e)
2495
2495
  throw new Error(
@@ -2497,60 +2497,60 @@ function An(t) {
2497
2497
  );
2498
2498
  return { modelPath: e, fields: n };
2499
2499
  }
2500
- function jn(t, e) {
2500
+ function An(t, e) {
2501
2501
  return {
2502
2502
  path: t,
2503
- language: P(t),
2503
+ language: R(t),
2504
2504
  content: e
2505
2505
  };
2506
2506
  }
2507
- async function Nn(t, e, n) {
2508
- Z(e);
2509
- const r = z(e, t);
2507
+ async function Ln(t, e, n) {
2508
+ K(e);
2509
+ const a = I(e, t);
2510
2510
  if (n.length > 0) {
2511
- const i = await K(n, r, t);
2512
- return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
2511
+ const i = await Z(n, a, t);
2512
+ return { model: a, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
2513
2513
  }
2514
- const a = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = lt(r, a, t);
2515
- return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
2514
+ const r = t.env === "runtime" ? await (await import("./env.runtime-BTICtvm9.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = lt(a, r, t);
2515
+ return { model: a, fields: s, auth: void 0, shouldCreateCollection: !1 };
2516
2516
  }
2517
2517
  async function On(t) {
2518
- const { modelPath: e, fields: n } = An(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await Nn(
2518
+ const { modelPath: e, fields: n } = Tn(t.argv), { model: a, fields: r, auth: s, shouldCreateCollection: i } = await Ln(
2519
2519
  t,
2520
2520
  e,
2521
2521
  n
2522
- ), o = `src/lib/schemas/${r.name}.ts`, c = it(r, a, {
2522
+ ), o = `src/lib/schemas/${a.name}.ts`, c = it(a, r, {
2523
2523
  includeModelFields: !0,
2524
2524
  forForm: !0
2525
2525
  });
2526
2526
  return {
2527
- creates: [jn(o, c)],
2527
+ creates: [An(o, c)],
2528
2528
  modifies: [],
2529
2529
  deletes: [],
2530
2530
  components: [],
2531
2531
  packages: [],
2532
- collections: i ? [qt(r, a, s)] : []
2532
+ collections: i ? [qt(a, r, s)] : []
2533
2533
  };
2534
2534
  }
2535
- const Ln = "generate-resource", qn = "1.0.7", Vn = "src/patterns/generate/resource", Un = "/generate/resource";
2535
+ const Nn = "generate-resource", qn = "1.0.7", Un = "src/patterns/generate/resource", Vn = "/generate/resource";
2536
2536
  async function Hn(t) {
2537
2537
  const e = await On(t);
2538
2538
  if (t.env !== "runtime")
2539
2539
  return S(e);
2540
- const { createCollections: n } = await import("./collections-t61Ot2Ax.js"), r = await n(
2540
+ const { createCollections: n } = await import("./collections-g6OYst1X.js"), a = await n(
2541
2541
  e.collections,
2542
2542
  t
2543
- ), a = {
2543
+ ), r = {
2544
2544
  ...e,
2545
- creates: [...e.creates, ...r]
2545
+ creates: [...e.creates, ...a]
2546
2546
  }, { writeResult: s } = await import("./write-result-CbUTMeAc.js");
2547
- return s(await S(a), t);
2547
+ return s(await S(r), t);
2548
2548
  }
2549
2549
  const Gn = {
2550
2550
  version: qn,
2551
- slug: Ln,
2552
- source: Vn,
2553
- docs: Un,
2551
+ slug: Nn,
2552
+ source: Un,
2553
+ docs: Vn,
2554
2554
  plan: "open",
2555
2555
  title: "Generate a resource",
2556
2556
  summary: "Generates model schema resources.",
@@ -2578,39 +2578,39 @@ function Jn(t) {
2578
2578
  function _(t, e) {
2579
2579
  return {
2580
2580
  path: t,
2581
- language: P(t),
2581
+ language: R(t),
2582
2582
  content: e
2583
2583
  };
2584
2584
  }
2585
- function Vt(t) {
2585
+ function Ut(t) {
2586
2586
  return t.some((e) => e.type === "file");
2587
2587
  }
2588
- function Ut(t) {
2588
+ function Vt(t) {
2589
2589
  return [...new Set(t.filter(Boolean))];
2590
2590
  }
2591
2591
  function ct(t) {
2592
2592
  return t.filter(
2593
2593
  (e) => e.type === "select"
2594
- ).map((e) => zt(e)).join(`
2594
+ ).map((e) => It(e)).join(`
2595
2595
 
2596
2596
  `);
2597
2597
  }
2598
2598
  function Ht(t, e) {
2599
- return Lt(t).map(
2599
+ return Nt(t).map(
2600
2600
  (n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
2601
2601
  ).join(`
2602
2602
  `);
2603
2603
  }
2604
2604
  function Gt(t) {
2605
- return Lt(t).map((e) => e.pluralName).join(", ");
2605
+ return Nt(t).map((e) => e.pluralName).join(", ");
2606
2606
  }
2607
- function Zn(t) {
2607
+ function Kn(t) {
2608
2608
  return t.features.auth ? "locals.pb" : "locals.admin";
2609
2609
  }
2610
2610
  function Wt(t, e, n = !1) {
2611
- const r = ct(e);
2612
- return d`
2613
- ${r}
2611
+ const a = ct(e);
2612
+ return p`
2613
+ ${a}
2614
2614
  ${n ? "let { data, params } = $props();" : "let { data } = $props();"}
2615
2615
 
2616
2616
  const form = superForm(untrack(() => data.form), {
@@ -2620,21 +2620,21 @@ function Wt(t, e, n = !1) {
2620
2620
  const { form: formData } = form;
2621
2621
  `;
2622
2622
  }
2623
- function Kn(t, e, n) {
2624
- const r = n.some((o) => o.type === "select"), a = Ut([
2623
+ function Zn(t, e, n) {
2624
+ const a = n.some((o) => o.type === "select"), r = Vt([
2625
2625
  'import { untrack } from "svelte";',
2626
2626
  'import { superForm } from "sveltekit-superforms";',
2627
2627
  'import { zodClient } from "sveltekit-superforms/adapters";',
2628
2628
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2629
- ...at(L(n)),
2629
+ ...rt(U(n)),
2630
2630
  'import { Button } from "$lib/components/ui/button";',
2631
2631
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
2632
2632
  'import * as Form from "$lib/components/ui/form";',
2633
- r ? 'import type { Models } from "pocketbase-svelte";' : ""
2633
+ a ? 'import type { Models } from "pocketbase-svelte";' : ""
2634
2634
  ]).join(`
2635
- `), s = n.map((o) => rt(o)).join(`
2636
- `), i = Vt(n) ? ' enctype="multipart/form-data"' : "";
2637
- return d(kt || (kt = X([`
2635
+ `), s = n.map((o) => at(o)).join(`
2636
+ `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2637
+ return p(kt || (kt = X([`
2638
2638
  <script lang="ts">
2639
2639
  `, `
2640
2640
  `, `
@@ -2661,23 +2661,23 @@ function Kn(t, e, n) {
2661
2661
  </form>
2662
2662
  </div>
2663
2663
  </section>
2664
- `])), a, Wt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2664
+ `])), r, Wt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2665
2665
  }
2666
2666
  function Xn(t, e, n) {
2667
- const r = n.some((o) => o.type === "select"), a = Ut([
2667
+ const a = n.some((o) => o.type === "select"), r = Vt([
2668
2668
  'import { untrack } from "svelte";',
2669
2669
  'import { superForm } from "sveltekit-superforms";',
2670
2670
  'import { zodClient } from "sveltekit-superforms/adapters";',
2671
2671
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2672
- ...at(L(n)),
2672
+ ...rt(U(n)),
2673
2673
  'import { Button } from "$lib/components/ui/button";',
2674
2674
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
2675
2675
  'import * as Form from "$lib/components/ui/form";',
2676
- r ? 'import type { Models } from "pocketbase-svelte";' : ""
2676
+ a ? 'import type { Models } from "pocketbase-svelte";' : ""
2677
2677
  ]).join(`
2678
- `), s = n.map((o) => rt(o)).join(`
2679
- `), i = Vt(n) ? ' enctype="multipart/form-data"' : "";
2680
- return d(Rt || (Rt = X([`
2678
+ `), s = n.map((o) => at(o)).join(`
2679
+ `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2680
+ return p(Rt || (Rt = X([`
2681
2681
  <script lang="ts">
2682
2682
  `, `
2683
2683
  `, `
@@ -2731,12 +2731,12 @@ function Xn(t, e, n) {
2731
2731
  </form>
2732
2732
  </div>
2733
2733
  </section>
2734
- `])), a, Wt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2734
+ `])), r, Wt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2735
2735
  }
2736
2736
  function Yn(t, e, n) {
2737
- const r = n.some((o) => o.type === "select"), a = r ? `${ct(n)}` : "", s = n.map((o) => {
2737
+ const a = n.some((o) => o.type === "select"), r = a ? `${ct(n)}` : "", s = n.map((o) => {
2738
2738
  let c = "{ getValue }", m = "{ value: getValue() }";
2739
- 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 }"), d`
2739
+ 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`
2740
2740
  columnHelper.accessor("${o.name}", {
2741
2741
  header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${o.title}" }),
2742
2742
  cell: (${c}) => renderComponent(Cells.${o.type.charAt(0).toUpperCase() + o.type.slice(1)}Cell, ${m})
@@ -2747,7 +2747,7 @@ function Yn(t, e, n) {
2747
2747
  (o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
2748
2748
  ).join(`
2749
2749
  `);
2750
- return d(Pt || (Pt = X([`
2750
+ return p(Pt || (Pt = X([`
2751
2751
  <script lang="ts">
2752
2752
  import {
2753
2753
  type ColumnFiltersState,
@@ -3121,27 +3121,27 @@ function Yn(t, e, n) {
3121
3121
  <Pagination {table} />
3122
3122
  </div>
3123
3123
  </section>
3124
- `])), 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());
3124
+ `])), a ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", r, 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());
3125
3125
  }
3126
3126
  function Qn(t, e, n) {
3127
- const r = Ot(e), a = r ? `{ expand: "${r}" }` : "";
3128
- return d`
3127
+ const a = Ot(e), r = a ? `{ expand: "${a}" }` : "";
3128
+ return p`
3129
3129
  export const load = async ({ locals }) => {
3130
- const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
3130
+ const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${r});
3131
3131
  return { ${t.pluralName} };
3132
3132
  };
3133
3133
  `;
3134
3134
  }
3135
- function tr(t, e, n, r, a) {
3136
- const s = Ht(n, r), i = Gt(n), o = i ? `, ${i}` : "", c = n.find(
3135
+ function ta(t, e, n, a, r) {
3136
+ const s = Ht(n, a), i = Gt(n), o = i ? `, ${i}` : "", c = n.find(
3137
3137
  (g) => g.type === "relation" && g.isCurrentUser
3138
- ), m = a && c ? d`
3138
+ ), m = r && c ? p`
3139
3139
  {
3140
3140
  ...form.data,
3141
3141
  ${c.name}: locals.pb.authStore.record?.id
3142
3142
  }
3143
3143
  ` : "form.data";
3144
- return d`
3144
+ return p`
3145
3145
  import { fail, redirect } from "@sveltejs/kit";
3146
3146
  import { superValidate } from "sveltekit-superforms";
3147
3147
  import { zod } from "sveltekit-superforms/adapters";
@@ -3162,7 +3162,7 @@ function tr(t, e, n, r, a) {
3162
3162
  }
3163
3163
 
3164
3164
  try {
3165
- const ${t.name} = await ${r}.collection("${t.tableName}").create(
3165
+ const ${t.name} = await ${a}.collection("${t.tableName}").create(
3166
3166
  ${m}
3167
3167
  );
3168
3168
  return redirect(303, \`${e.list}/\${${t.name}.id}\`);
@@ -3174,14 +3174,14 @@ function tr(t, e, n, r, a) {
3174
3174
  };
3175
3175
  `;
3176
3176
  }
3177
- function er(t, e, n, r) {
3178
- const a = Ot(n), s = a ? `, { expand: "${a}" }` : "";
3179
- return d`
3177
+ function ea(t, e, n, a) {
3178
+ const r = Ot(n), s = r ? `, { expand: "${r}" }` : "";
3179
+ return p`
3180
3180
  import { error, redirect } from "@sveltejs/kit";
3181
3181
 
3182
3182
  export const load = async ({ locals, params }) => {
3183
3183
  try {
3184
- const ${t.name} = await ${r}.collection("${t.tableName}").getOne(params.id${s});
3184
+ const ${t.name} = await ${a}.collection("${t.tableName}").getOne(params.id${s});
3185
3185
  return { ${t.name} };
3186
3186
  } catch {
3187
3187
  throw error(404, "Not found");
@@ -3190,23 +3190,23 @@ function er(t, e, n, r) {
3190
3190
 
3191
3191
  export const actions = {
3192
3192
  default: async ({ locals, params }) => {
3193
- await ${r}.collection("${t.tableName}").delete(params.id);
3193
+ await ${a}.collection("${t.tableName}").delete(params.id);
3194
3194
  throw redirect(303, "${e.list}");
3195
3195
  },
3196
3196
  };
3197
3197
  `;
3198
3198
  }
3199
- function nr(t, e, n) {
3200
- const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3199
+ function na(t, e, n) {
3200
+ const a = n.some((m) => m.type === "select"), r = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3201
3201
  'import { Button } from "$lib/components/ui/button";',
3202
3202
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
3203
- r || a ? 'import { Badge } from "$lib/components/ui/badge";' : "",
3204
- a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3203
+ a || r ? 'import { Badge } from "$lib/components/ui/badge";' : "",
3204
+ r ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3205
3205
  s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
3206
3206
  ].filter(Boolean).join(`
3207
3207
  `), o = ct(n), c = n.map((m) => Ce(t, m)).join(`
3208
3208
  `);
3209
- return d(Et || (Et = X([`
3209
+ return p(Et || (Et = X([`
3210
3210
  <script lang="ts">
3211
3211
  `, `
3212
3212
  `, `
@@ -3240,9 +3240,9 @@ function nr(t, e, n) {
3240
3240
  </section>
3241
3241
  `])), i, o, t.displayName, e.list, c, e.list, t.name);
3242
3242
  }
3243
- function rr(t, e, n, r) {
3244
- const a = Ht(n, r), s = Gt(n), i = s ? `, ${s}` : "";
3245
- return d`
3243
+ function aa(t, e, n, a) {
3244
+ const r = Ht(n, a), s = Gt(n), i = s ? `, ${s}` : "";
3245
+ return p`
3246
3246
  import { error, fail, redirect } from "@sveltejs/kit";
3247
3247
  import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
3248
3248
  import { superValidate } from "sveltekit-superforms";
@@ -3252,17 +3252,17 @@ function rr(t, e, n, r) {
3252
3252
  export const load = async ({ locals, params }) => {
3253
3253
  let ${t.name};
3254
3254
  try {
3255
- ${t.name} = await ${r}.collection("${t.tableName}").getOne(params.id);
3255
+ ${t.name} = await ${a}.collection("${t.tableName}").getOne(params.id);
3256
3256
  } catch {
3257
3257
  throw error(404, "Not found");
3258
3258
  }
3259
- ${a}
3259
+ ${r}
3260
3260
  return { form: await superValidate(${t.name}, zod(${t.schemaName}))${i} };
3261
3261
  };
3262
3262
 
3263
3263
  export const actions = {
3264
3264
  default: async ({ locals, params, request }) => {
3265
- const ${t.name} = await ${r}.collection("${t.tableName}").getOne(params.id);
3265
+ const ${t.name} = await ${a}.collection("${t.tableName}").getOne(params.id);
3266
3266
  const form = await superValidate(request, zod(${t.schemaName}));
3267
3267
 
3268
3268
  if (!form.valid) {
@@ -3271,7 +3271,7 @@ function rr(t, e, n, r) {
3271
3271
  }
3272
3272
 
3273
3273
  try {
3274
- await ${r}.collection("${t.tableName}").update(params.id, form.data);
3274
+ await ${a}.collection("${t.tableName}").update(params.id, form.data);
3275
3275
  return redirect(303, \`${e.list}/\${params.id}\`);
3276
3276
  } catch (error) {
3277
3277
  setPocketbaseErrors(form, error);
@@ -3282,82 +3282,82 @@ function rr(t, e, n, r) {
3282
3282
  };
3283
3283
  `;
3284
3284
  }
3285
- async function ar(t, e, n) {
3286
- Z(e);
3287
- const r = z(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
3285
+ async function ra(t, e, n) {
3286
+ K(e);
3287
+ const a = I(e, t), r = t.env === "runtime" ? await (await import("./env.runtime-BTICtvm9.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
3288
3288
  t
3289
3289
  );
3290
3290
  if (n.length > 0) {
3291
- const i = await K(n, r, t);
3291
+ const i = await Z(n, a, t);
3292
3292
  return {
3293
- model: r,
3293
+ model: a,
3294
3294
  fields: i.fields,
3295
3295
  auth: i.auth,
3296
3296
  shouldCreateCollection: !0,
3297
- collections: a
3297
+ collections: r
3298
3298
  };
3299
3299
  }
3300
- const s = lt(r, a, t);
3300
+ const s = lt(a, r, t);
3301
3301
  return {
3302
- model: r,
3302
+ model: a,
3303
3303
  fields: s,
3304
3304
  auth: void 0,
3305
3305
  shouldCreateCollection: !1,
3306
- collections: a
3306
+ collections: r
3307
3307
  };
3308
3308
  }
3309
- async function or(t) {
3310
- const { modelPath: e, fields: n } = Jn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i, collections: o } = await ar(t, e, n), c = Ue(r), m = He(r), g = Zn(t), f = a.filter(
3309
+ async function oa(t) {
3310
+ const { modelPath: e, fields: n } = Jn(t.argv), { model: a, fields: r, auth: s, shouldCreateCollection: i, collections: o } = await ra(t, e, n), c = Ve(a), m = He(a), g = Kn(t), f = r.filter(
3311
3311
  (u) => !(u.type === "relation" && u.isCurrentUser)
3312
3312
  ), h = [
3313
3313
  _(
3314
- `src/lib/schemas/${r.name}.ts`,
3315
- it(r, a, {
3314
+ `src/lib/schemas/${a.name}.ts`,
3315
+ it(a, r, {
3316
3316
  includeModelFields: !0,
3317
3317
  forForm: !0
3318
3318
  })
3319
3319
  ),
3320
3320
  _(
3321
3321
  `${c.list}/+page.server.ts`,
3322
- Qn(r, f, g)
3322
+ Qn(a, f, g)
3323
3323
  ),
3324
3324
  _(
3325
3325
  `${c.list}/+page.svelte`,
3326
- Yn(r, m, f)
3326
+ Yn(a, m, f)
3327
3327
  ),
3328
3328
  _(
3329
3329
  `${c.new}/+page.server.ts`,
3330
- tr(r, m, f, g, t.features.auth)
3330
+ ta(a, m, f, g, t.features.auth)
3331
3331
  ),
3332
- _(`${c.new}/+page.svelte`, Kn(r, m, f)),
3332
+ _(`${c.new}/+page.svelte`, Zn(a, m, f)),
3333
3333
  _(
3334
3334
  `${c.show}/+page.server.ts`,
3335
- er(r, m, f, g)
3335
+ ea(a, m, f, g)
3336
3336
  ),
3337
3337
  _(
3338
3338
  `${c.show}/+page.svelte`,
3339
- nr(r, m, f)
3339
+ na(a, m, f)
3340
3340
  ),
3341
3341
  _(
3342
3342
  `${c.edit}/+page.server.ts`,
3343
- rr(r, m, f, g)
3343
+ aa(a, m, f, g)
3344
3344
  ),
3345
3345
  _(
3346
3346
  `${c.edit}/+page.svelte`,
3347
- Xn(r, m, f)
3347
+ Xn(a, m, f)
3348
3348
  ),
3349
3349
  _(
3350
3350
  `${c.list}/server.test.ts`,
3351
3351
  un(
3352
- r,
3353
- m,
3354
3352
  a,
3353
+ m,
3354
+ r,
3355
3355
  t,
3356
3356
  o
3357
3357
  )
3358
3358
  )
3359
3359
  ], $ = [
3360
- ...L(f),
3360
+ ...U(f),
3361
3361
  "button",
3362
3362
  "table",
3363
3363
  "data-table",
@@ -3380,28 +3380,28 @@ async function or(t) {
3380
3380
  deletes: [],
3381
3381
  components: [...new Set($)],
3382
3382
  packages: ["@tanstack/table-core"],
3383
- collections: i ? [qt(r, a, s)] : []
3383
+ collections: i ? [qt(a, r, s)] : []
3384
3384
  };
3385
3385
  }
3386
- const sr = "generate-scaffold", ir = "1.0.7", lr = "src/patterns/generate/scaffold", cr = "/generate/scaffold";
3387
- async function mr(t) {
3388
- const e = await or(t);
3386
+ const sa = "generate-scaffold", ia = "1.0.7", la = "src/patterns/generate/scaffold", ca = "/generate/scaffold";
3387
+ async function ma(t) {
3388
+ const e = await oa(t);
3389
3389
  if (t.env !== "runtime")
3390
3390
  return S(e);
3391
- const { createCollections: n } = await import("./collections-t61Ot2Ax.js"), r = await n(
3391
+ const { createCollections: n } = await import("./collections-g6OYst1X.js"), a = await n(
3392
3392
  e.collections,
3393
3393
  t
3394
- ), a = {
3394
+ ), r = {
3395
3395
  ...e,
3396
- creates: [...e.creates, ...r]
3396
+ creates: [...e.creates, ...a]
3397
3397
  }, { writeResult: s } = await import("./write-result-CbUTMeAc.js");
3398
- return s(await S(a), t);
3398
+ return s(await S(r), t);
3399
3399
  }
3400
- const ur = {
3401
- version: ir,
3402
- slug: sr,
3403
- source: lr,
3404
- docs: cr,
3400
+ const ua = {
3401
+ version: ia,
3402
+ slug: sa,
3403
+ source: la,
3404
+ docs: ca,
3405
3405
  plan: "open",
3406
3406
  title: "Generate a scaffold",
3407
3407
  summary: "Generates CRUD routes and schema.",
@@ -3417,9 +3417,9 @@ const ur = {
3417
3417
  argv: ["contact", "name:text", "email:email"]
3418
3418
  },
3419
3419
  baseline: "velastack",
3420
- generate: mr
3420
+ generate: ma
3421
3421
  };
3422
- function dr(t) {
3422
+ function pa(t) {
3423
3423
  const [e, ...n] = t;
3424
3424
  if (!e)
3425
3425
  throw new Error(
@@ -3427,34 +3427,34 @@ function dr(t) {
3427
3427
  );
3428
3428
  return { modelPath: e, fields: n };
3429
3429
  }
3430
- function pr(t, e) {
3430
+ function da(t, e) {
3431
3431
  return {
3432
3432
  path: t,
3433
- language: P(t),
3433
+ language: R(t),
3434
3434
  content: e
3435
3435
  };
3436
3436
  }
3437
- async function fr(t, e, n) {
3438
- Z(e);
3439
- const r = z(e, t);
3437
+ async function fa(t, e, n) {
3438
+ K(e);
3439
+ const a = I(e, t);
3440
3440
  if (n.length > 0) {
3441
- const i = await K(n, r, t);
3442
- return { model: r, fields: i.fields, includeModelFields: !1 };
3441
+ const i = await Z(n, a, t);
3442
+ return { model: a, fields: i.fields, includeModelFields: !1 };
3443
3443
  }
3444
- const a = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = lt(r, a, t);
3445
- return { model: r, fields: s, includeModelFields: !0 };
3444
+ const r = t.env === "runtime" ? await (await import("./env.runtime-BTICtvm9.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = lt(a, r, t);
3445
+ return { model: a, fields: s, includeModelFields: !0 };
3446
3446
  }
3447
- async function gr(t) {
3448
- const { modelPath: e, fields: n } = dr(t.argv), { model: r, fields: a, includeModelFields: s } = await fr(
3447
+ async function ga(t) {
3448
+ const { modelPath: e, fields: n } = pa(t.argv), { model: a, fields: r, includeModelFields: s } = await fa(
3449
3449
  t,
3450
3450
  e,
3451
3451
  n
3452
- ), i = `src/lib/schemas/${r.name}.ts`, o = it(r, a, {
3452
+ ), i = `src/lib/schemas/${a.name}.ts`, o = it(a, r, {
3453
3453
  includeModelFields: s,
3454
3454
  forForm: !0
3455
3455
  });
3456
3456
  return {
3457
- creates: [pr(i, o)],
3457
+ creates: [da(i, o)],
3458
3458
  modifies: [],
3459
3459
  deletes: [],
3460
3460
  components: [],
@@ -3462,19 +3462,19 @@ async function gr(t) {
3462
3462
  collections: []
3463
3463
  };
3464
3464
  }
3465
- const hr = "generate-schema", br = "1.0.7", vr = "src/patterns/generate/schema", wr = "/generate/schema";
3466
- async function yr(t) {
3467
- const e = await gr(t);
3465
+ const ha = "generate-schema", ba = "1.0.7", va = "src/patterns/generate/schema", wa = "/generate/schema";
3466
+ async function ya(t) {
3467
+ const e = await ga(t);
3468
3468
  if (t.env !== "runtime")
3469
3469
  return S(e);
3470
3470
  const { writeResult: n } = await import("./write-result-CbUTMeAc.js");
3471
3471
  return n(await S(e), t);
3472
3472
  }
3473
- const $r = {
3474
- version: br,
3475
- slug: hr,
3476
- source: vr,
3477
- docs: wr,
3473
+ const $a = {
3474
+ version: ba,
3475
+ slug: ha,
3476
+ source: va,
3477
+ docs: wa,
3478
3478
  plan: "open",
3479
3479
  title: "Generate a schema",
3480
3480
  summary: "Generates a zod schema.",
@@ -3490,8 +3490,8 @@ const $r = {
3490
3490
  argv: ["contact", "name:text", "email:email"]
3491
3491
  },
3492
3492
  baseline: "velastack",
3493
- generate: yr
3494
- }, xr = `<script lang="ts">
3493
+ generate: ya
3494
+ }, xa = `<script lang="ts">
3495
3495
  import type { ComponentProps } from 'svelte';
3496
3496
  import HomeIcon from '@lucide/svelte/icons/home';
3497
3497
  import * as Sidebar from '$lib/components/ui/sidebar';
@@ -3544,7 +3544,7 @@ const $r = {
3544
3544
  <NavUser {user} />
3545
3545
  </Sidebar.Footer>
3546
3546
  </Sidebar.Root>
3547
- `, Fr = `<script lang="ts">
3547
+ `, Fa = `<script lang="ts">
3548
3548
  import type { Component } from 'svelte';
3549
3549
  import * as Sidebar from '$lib/components/ui/sidebar';
3550
3550
  import { page } from '$app/state';
@@ -3584,7 +3584,7 @@ const $r = {
3584
3584
  {/each}
3585
3585
  </Sidebar.Menu>
3586
3586
  </Sidebar.Group>
3587
- `, Sr = `<script lang="ts">
3587
+ `, Sa = `<script lang="ts">
3588
3588
  import { toggleMode, mode } from 'mode-watcher';
3589
3589
  import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
3590
3590
  import Settings2Icon from '@lucide/svelte/icons/settings-2';
@@ -3700,12 +3700,12 @@ const $r = {
3700
3700
  </DropdownMenu.Root>
3701
3701
  </Sidebar.MenuItem>
3702
3702
  </Sidebar.Menu>
3703
- `, Cr = `import { z } from 'zod/v3';
3703
+ `, Ca = `import { z } from 'zod/v3';
3704
3704
 
3705
3705
  export const changeEmailSchema = z.object({
3706
3706
  email: z.string().email()
3707
3707
  });
3708
- `, _r = `import { z } from 'zod/v3';
3708
+ `, _a = `import { z } from 'zod/v3';
3709
3709
 
3710
3710
  export const changePasswordSchema = z
3711
3711
  .object({
@@ -3716,18 +3716,18 @@ export const changePasswordSchema = z
3716
3716
  message: "Passwords don't match",
3717
3717
  path: ['passwordConfirm']
3718
3718
  });
3719
- `, kr = `import { z } from 'zod/v3';
3719
+ `, ka = `import { z } from 'zod/v3';
3720
3720
 
3721
3721
  export const confirmEmailChangeSchema = z.object({
3722
3722
  password: z.string()
3723
3723
  });
3724
- `, Rr = `import { z } from 'zod/v3';
3724
+ `, Ra = `import { z } from 'zod/v3';
3725
3725
 
3726
3726
  export const confirmResetSchema = z.object({
3727
3727
  password: z.string(),
3728
3728
  passwordConfirm: z.string()
3729
3729
  });
3730
- `, Pr = `import { z } from 'zod/v3';
3730
+ `, Pa = `import { z } from 'zod/v3';
3731
3731
 
3732
3732
  const otpSchema = z.object({
3733
3733
  type: z.literal('otp'),
@@ -3746,37 +3746,37 @@ const oAuth2Schema = z.object({
3746
3746
  });
3747
3747
 
3748
3748
  export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
3749
- `, Er = `import { z } from 'zod/v3';
3749
+ `, Ea = `import { z } from 'zod/v3';
3750
3750
 
3751
3751
  export const otpSchema = z.object({
3752
3752
  otp: z.string()
3753
3753
  });
3754
- `, Ir = `import { z } from 'zod/v3';
3754
+ `, za = `import { z } from 'zod/v3';
3755
3755
 
3756
3756
  export const profileSchema = z.object({
3757
3757
  name: z.string().optional(),
3758
3758
  avatar: z.union([z.instanceof(File), z.string()]).optional(),
3759
3759
  emailVisibility: z.boolean().optional()
3760
3760
  });
3761
- `, zr = `import { z } from 'zod/v3';
3761
+ `, Ia = `import { z } from 'zod/v3';
3762
3762
 
3763
3763
  export const resetSchema = z.object({
3764
3764
  email: z.string().email()
3765
3765
  });
3766
- `, Mr = `import { z } from 'zod/v3';
3766
+ `, Ma = `import { z } from 'zod/v3';
3767
3767
 
3768
3768
  export const signupSchema = z.object({
3769
3769
  email: z.string().email(),
3770
3770
  password: z.string(),
3771
3771
  passwordConfirm: z.string()
3772
3772
  });
3773
- `, Br = `export const load = ({ locals }) => {
3773
+ `, Ba = `export const load = ({ locals }) => {
3774
3774
  const user = locals.pb.authStore.record!;
3775
3775
  const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
3776
3776
 
3777
3777
  return { user, breadcrumbs };
3778
3778
  };
3779
- `, Dr = `<script lang="ts">
3779
+ `, Da = `<script lang="ts">
3780
3780
  import * as Sidebar from '$lib/components/ui/sidebar';
3781
3781
  import { Separator } from '$lib/components/ui/separator';
3782
3782
  import AppSidebar from '$lib/components/app-sidebar.svelte';
@@ -3826,7 +3826,7 @@ export const signupSchema = z.object({
3826
3826
  background-color: var(--color-sidebar);
3827
3827
  }
3828
3828
  </style>
3829
- `, Tr = "", Ar = `import { describe, it, expect } from 'vitest';
3829
+ `, ja = "", Ta = `import { describe, it, expect } from 'vitest';
3830
3830
  import type { Match } from '@velastack/pocketbase';
3831
3831
  import type { RouteId } from './$types';
3832
3832
 
@@ -3843,14 +3843,14 @@ describe('dashboard', () => {
3843
3843
  expect(response.status).toBe(200);
3844
3844
  });
3845
3845
  });
3846
- `, jr = `export const load = async ({ parent }) => {
3846
+ `, Aa = `export const load = async ({ parent }) => {
3847
3847
  const { breadcrumbs } = await parent();
3848
3848
 
3849
3849
  return {
3850
3850
  breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
3851
3851
  };
3852
3852
  };
3853
- `, Nr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
3853
+ `, La = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
3854
3854
  import { zod } from 'sveltekit-superforms/adapters';
3855
3855
  import { setFlash } from 'sveltekit-flash-message/server';
3856
3856
  import { profileSchema } from '$lib/schemas/profile';
@@ -3919,7 +3919,7 @@ export const actions = {
3919
3919
  return {};
3920
3920
  }
3921
3921
  };
3922
- `, Or = `<script lang="ts">
3922
+ `, Oa = `<script lang="ts">
3923
3923
  import { untrack } from 'svelte';
3924
3924
  import { superForm } from 'sveltekit-superforms';
3925
3925
  import { zodClient } from 'sveltekit-superforms/adapters';
@@ -4197,7 +4197,7 @@ export const actions = {
4197
4197
  </form>
4198
4198
  </div>
4199
4199
  </div>
4200
- `, Lr = `import { fail, superValidate } from 'sveltekit-superforms';
4200
+ `, Na = `import { fail, superValidate } from 'sveltekit-superforms';
4201
4201
  import { zod } from 'sveltekit-superforms/adapters';
4202
4202
  import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
4203
4203
  import { redirect } from '@sveltejs/kit';
@@ -4224,7 +4224,7 @@ export const actions = {
4224
4224
  return redirect(303, '/login');
4225
4225
  }
4226
4226
  };
4227
- `, qr = `<script lang="ts">
4227
+ `, qa = `<script lang="ts">
4228
4228
  import { untrack } from 'svelte';
4229
4229
  import { Button } from '$lib/components/ui/button';
4230
4230
  import * as Card from '$lib/components/ui/card';
@@ -4292,7 +4292,7 @@ export const actions = {
4292
4292
  </div>
4293
4293
  </div>
4294
4294
  </div>
4295
- `, Vr = `import { describe, it, expect } from 'vitest';
4295
+ `, Ua = `import { describe, it, expect } from 'vitest';
4296
4296
  import type { Match } from '@velastack/pocketbase';
4297
4297
  import type { RouteId } from './$types';
4298
4298
 
@@ -4304,7 +4304,7 @@ describe('GET /confirm-email-change/[token]', () => {
4304
4304
  expect(response.status).toBe(200);
4305
4305
  });
4306
4306
  });
4307
- `, Ur = `import { fail, superValidate } from 'sveltekit-superforms';
4307
+ `, Va = `import { fail, superValidate } from 'sveltekit-superforms';
4308
4308
  import { zod } from 'sveltekit-superforms/adapters';
4309
4309
  import { confirmResetSchema } from '$lib/schemas/confirmReset';
4310
4310
  import { redirect } from '@sveltejs/kit';
@@ -4333,7 +4333,7 @@ export const actions = {
4333
4333
  return redirect(303, '/login');
4334
4334
  }
4335
4335
  };
4336
- `, Hr = `<script lang="ts">
4336
+ `, Ha = `<script lang="ts">
4337
4337
  import { untrack } from 'svelte';
4338
4338
  import { Button } from '$lib/components/ui/button';
4339
4339
  import * as Card from '$lib/components/ui/card';
@@ -4417,7 +4417,7 @@ export const actions = {
4417
4417
  </div>
4418
4418
  </div>
4419
4419
  </div>
4420
- `, Gr = `import { describe, it, expect } from 'vitest';
4420
+ `, Ga = `import { describe, it, expect } from 'vitest';
4421
4421
  import type { Match } from '@velastack/pocketbase';
4422
4422
  import type { RouteId } from './$types';
4423
4423
 
@@ -4427,7 +4427,7 @@ describe('GET /confirm-reset/[token]', () => {
4427
4427
  expect(response.status).toBe(200);
4428
4428
  });
4429
4429
  });
4430
- `, Wr = `import { redirect } from '@sveltejs/kit';
4430
+ `, Wa = `import { redirect } from '@sveltejs/kit';
4431
4431
  import { setFlash } from 'sveltekit-flash-message/server';
4432
4432
 
4433
4433
  export const GET = async ({ params, locals, cookies }) => {
@@ -4446,7 +4446,7 @@ export const GET = async ({ params, locals, cookies }) => {
4446
4446
  setFlash({ type: 'toast', message }, cookies);
4447
4447
  redirect(303, redirectPath);
4448
4448
  };
4449
- `, Jr = `import { describe, it, expect } from 'vitest';
4449
+ `, Ja = `import { describe, it, expect } from 'vitest';
4450
4450
  import type { Match } from '@velastack/pocketbase';
4451
4451
  import type { RouteId } from './$types';
4452
4452
 
@@ -4459,7 +4459,7 @@ describe('GET /confirm-verification/[token]', () => {
4459
4459
  expect(response.headers['location']).toBe('/login');
4460
4460
  });
4461
4461
  });
4462
- `, Zr = `import { fail, superValidate, message } from 'sveltekit-superforms';
4462
+ `, Ka = `import { fail, superValidate, message } from 'sveltekit-superforms';
4463
4463
  import { zod } from 'sveltekit-superforms/adapters';
4464
4464
  import { loginSchema } from '$lib/schemas/login';
4465
4465
  import { redirect } from '@sveltejs/kit';
@@ -4520,7 +4520,7 @@ export const actions = {
4520
4520
  redirect(303, redirectUrl);
4521
4521
  }
4522
4522
  };
4523
- `, Kr = `<script lang="ts">
4523
+ `, Za = `<script lang="ts">
4524
4524
  import { untrack } from 'svelte';
4525
4525
  import { Button } from '$lib/components/ui/button';
4526
4526
  import * as Card from '$lib/components/ui/card';
@@ -4703,7 +4703,7 @@ export const actions = {
4703
4703
  </div>
4704
4704
  </div>
4705
4705
  </div>
4706
- `, Xr = `import { describe, it, expect } from 'vitest';
4706
+ `, Xa = `import { describe, it, expect } from 'vitest';
4707
4707
  import * as devalue from 'devalue';
4708
4708
  import type { Match } from '@velastack/pocketbase';
4709
4709
  import type { RouteId } from './$types';
@@ -4750,14 +4750,14 @@ describe('POST /login', () => {
4750
4750
  expect(data.form.message.text).toBe('Failed to authenticate.');
4751
4751
  });
4752
4752
  });
4753
- `, Yr = `import { redirect } from '@sveltejs/kit';
4753
+ `, Ya = `import { redirect } from '@sveltejs/kit';
4754
4754
 
4755
4755
  export const POST = ({ cookies, locals }) => {
4756
4756
  locals.pb.authStore.clear();
4757
4757
  locals.pb.authStore.clearCookie(cookies);
4758
4758
  throw redirect(303, '/');
4759
4759
  };
4760
- `, Qr = `import { describe, it, expect } from 'vitest';
4760
+ `, Qa = `import { describe, it, expect } from 'vitest';
4761
4761
  import type { Match } from '@velastack/pocketbase';
4762
4762
  import type { RouteId } from './$types';
4763
4763
 
@@ -4769,7 +4769,7 @@ describe('POST /logout', () => {
4769
4769
  expect(response.headers.location).toBe('/');
4770
4770
  });
4771
4771
  });
4772
- `, ta = `import { fail, message, superValidate } from 'sveltekit-superforms';
4772
+ `, tr = `import { fail, message, superValidate } from 'sveltekit-superforms';
4773
4773
  import { zod } from 'sveltekit-superforms/adapters';
4774
4774
  import { otpSchema } from '$lib/schemas/otp';
4775
4775
  import { redirect } from '@sveltejs/kit';
@@ -4810,7 +4810,7 @@ export const actions = {
4810
4810
  redirect(303, redirectUrl);
4811
4811
  }
4812
4812
  };
4813
- `, ea = `<script lang="ts">
4813
+ `, er = `<script lang="ts">
4814
4814
  import { untrack } from 'svelte';
4815
4815
  import { Button } from '$lib/components/ui/button';
4816
4816
  import * as Card from '$lib/components/ui/card';
@@ -4876,7 +4876,7 @@ export const actions = {
4876
4876
  </div>
4877
4877
  </div>
4878
4878
  </div>
4879
- `, na = `import { describe, it, expect } from 'vitest';
4879
+ `, nr = `import { describe, it, expect } from 'vitest';
4880
4880
  import type { Match } from '@velastack/pocketbase';
4881
4881
  import type { RouteId } from './$types';
4882
4882
 
@@ -4896,7 +4896,7 @@ describe('POST /otp/[token]', () => {
4896
4896
  expect(response.body.status).toBe(400);
4897
4897
  });
4898
4898
  });
4899
- `, ra = `import { fail, superValidate } from 'sveltekit-superforms';
4899
+ `, ar = `import { fail, superValidate } from 'sveltekit-superforms';
4900
4900
  import { zod } from 'sveltekit-superforms/adapters';
4901
4901
  import { resetSchema } from '$lib/schemas/reset';
4902
4902
  import { redirect } from '@sveltejs/kit';
@@ -4924,7 +4924,7 @@ export const actions = {
4924
4924
  return { form };
4925
4925
  }
4926
4926
  };
4927
- `, aa = `<script lang="ts">
4927
+ `, rr = `<script lang="ts">
4928
4928
  import { untrack } from 'svelte';
4929
4929
  import { Button } from '$lib/components/ui/button';
4930
4930
  import * as Card from '$lib/components/ui/card';
@@ -4991,7 +4991,7 @@ export const actions = {
4991
4991
  </div>
4992
4992
  </div>
4993
4993
  </div>
4994
- `, oa = `import { describe, it, expect } from 'vitest';
4994
+ `, or = `import { describe, it, expect } from 'vitest';
4995
4995
  import type { Match } from '@velastack/pocketbase';
4996
4996
  import type { RouteId } from './$types';
4997
4997
 
@@ -5011,7 +5011,7 @@ describe('POST /reset', () => {
5011
5011
  expect(response.body.status).toBe(200);
5012
5012
  });
5013
5013
  });
5014
- `, sa = `import { redirect } from '@sveltejs/kit';
5014
+ `, sr = `import { redirect } from '@sveltejs/kit';
5015
5015
  import { fail, superValidate } from 'sveltekit-superforms';
5016
5016
  import { zod } from 'sveltekit-superforms/adapters';
5017
5017
  import { setFlash } from 'sveltekit-flash-message/server';
@@ -5067,7 +5067,7 @@ export const actions = {
5067
5067
  return redirect(303, redirectUrl);
5068
5068
  }
5069
5069
  };
5070
- `, ia = `<script lang="ts">
5070
+ `, ir = `<script lang="ts">
5071
5071
  import { untrack } from 'svelte';
5072
5072
  import { Button } from '$lib/components/ui/button';
5073
5073
  import * as Card from '$lib/components/ui/card';
@@ -5234,7 +5234,7 @@ export const actions = {
5234
5234
  </div>
5235
5235
  </div>
5236
5236
  </div>
5237
- `, la = `import { describe, it, expect } from 'vitest';
5237
+ `, lr = `import { describe, it, expect } from 'vitest';
5238
5238
  import type { Match } from '@velastack/pocketbase';
5239
5239
  import * as devalue from 'devalue';
5240
5240
  import type { RouteId } from './$types';
@@ -5290,58 +5290,58 @@ describe('POST /signup', () => {
5290
5290
  expect(data.form.errors.email[0]).toBe('Value must be unique.');
5291
5291
  });
5292
5292
  });
5293
- `, ca = /* @__PURE__ */ Object.assign({
5294
- "./creates/src/lib/components/app-sidebar.svelte": xr,
5295
- "./creates/src/lib/components/nav-main.svelte": Fr,
5296
- "./creates/src/lib/components/nav-user.svelte": Sr,
5297
- "./creates/src/lib/schemas/changeEmail.ts": Cr,
5298
- "./creates/src/lib/schemas/changePassword.ts": _r,
5299
- "./creates/src/lib/schemas/confirmEmailChange.ts": kr,
5300
- "./creates/src/lib/schemas/confirmReset.ts": Rr,
5301
- "./creates/src/lib/schemas/login.ts": Pr,
5302
- "./creates/src/lib/schemas/otp.ts": Er,
5303
- "./creates/src/lib/schemas/profile.ts": Ir,
5304
- "./creates/src/lib/schemas/reset.ts": zr,
5305
- "./creates/src/lib/schemas/signup.ts": Mr,
5306
- "./creates/src/routes/(app)/+layout.server.ts": Br,
5307
- "./creates/src/routes/(app)/+layout.svelte": Dr,
5308
- "./creates/src/routes/(app)/dashboard/+page.svelte": Tr,
5309
- "./creates/src/routes/(app)/dashboard/server.test.ts": Ar,
5310
- "./creates/src/routes/(app)/settings/+layout.server.ts": jr,
5311
- "./creates/src/routes/(app)/settings/+page.server.ts": Nr,
5312
- "./creates/src/routes/(app)/settings/+page.svelte": Or,
5313
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Lr,
5314
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": qr,
5315
- "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Vr,
5316
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Ur,
5317
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Hr,
5318
- "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Gr,
5319
- "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Wr,
5320
- "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Jr,
5321
- "./creates/src/routes/(public)/login/+page.server.ts": Zr,
5322
- "./creates/src/routes/(public)/login/+page.svelte": Kr,
5323
- "./creates/src/routes/(public)/login/server.test.ts": Xr,
5324
- "./creates/src/routes/(public)/logout/+server.ts": Yr,
5325
- "./creates/src/routes/(public)/logout/server.test.ts": Qr,
5326
- "./creates/src/routes/(public)/otp/[token]/+page.server.ts": ta,
5327
- "./creates/src/routes/(public)/otp/[token]/+page.svelte": ea,
5328
- "./creates/src/routes/(public)/otp/[token]/server.test.ts": na,
5329
- "./creates/src/routes/(public)/reset/+page.server.ts": ra,
5330
- "./creates/src/routes/(public)/reset/+page.svelte": aa,
5331
- "./creates/src/routes/(public)/reset/server.test.ts": oa,
5332
- "./creates/src/routes/(public)/signup/+page.server.ts": sa,
5333
- "./creates/src/routes/(public)/signup/+page.svelte": ia,
5334
- "./creates/src/routes/(public)/signup/server.test.ts": la
5335
- }), ma = "./creates/";
5336
- async function ua(t) {
5337
- const e = Object.entries(ca).map(([a, s]) => {
5338
- const i = G(a, ma);
5293
+ `, cr = /* @__PURE__ */ Object.assign({
5294
+ "./creates/src/lib/components/app-sidebar.svelte": xa,
5295
+ "./creates/src/lib/components/nav-main.svelte": Fa,
5296
+ "./creates/src/lib/components/nav-user.svelte": Sa,
5297
+ "./creates/src/lib/schemas/changeEmail.ts": Ca,
5298
+ "./creates/src/lib/schemas/changePassword.ts": _a,
5299
+ "./creates/src/lib/schemas/confirmEmailChange.ts": ka,
5300
+ "./creates/src/lib/schemas/confirmReset.ts": Ra,
5301
+ "./creates/src/lib/schemas/login.ts": Pa,
5302
+ "./creates/src/lib/schemas/otp.ts": Ea,
5303
+ "./creates/src/lib/schemas/profile.ts": za,
5304
+ "./creates/src/lib/schemas/reset.ts": Ia,
5305
+ "./creates/src/lib/schemas/signup.ts": Ma,
5306
+ "./creates/src/routes/(app)/+layout.server.ts": Ba,
5307
+ "./creates/src/routes/(app)/+layout.svelte": Da,
5308
+ "./creates/src/routes/(app)/dashboard/+page.svelte": ja,
5309
+ "./creates/src/routes/(app)/dashboard/server.test.ts": Ta,
5310
+ "./creates/src/routes/(app)/settings/+layout.server.ts": Aa,
5311
+ "./creates/src/routes/(app)/settings/+page.server.ts": La,
5312
+ "./creates/src/routes/(app)/settings/+page.svelte": Oa,
5313
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Na,
5314
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": qa,
5315
+ "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Ua,
5316
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Va,
5317
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Ha,
5318
+ "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Ga,
5319
+ "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Wa,
5320
+ "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Ja,
5321
+ "./creates/src/routes/(public)/login/+page.server.ts": Ka,
5322
+ "./creates/src/routes/(public)/login/+page.svelte": Za,
5323
+ "./creates/src/routes/(public)/login/server.test.ts": Xa,
5324
+ "./creates/src/routes/(public)/logout/+server.ts": Ya,
5325
+ "./creates/src/routes/(public)/logout/server.test.ts": Qa,
5326
+ "./creates/src/routes/(public)/otp/[token]/+page.server.ts": tr,
5327
+ "./creates/src/routes/(public)/otp/[token]/+page.svelte": er,
5328
+ "./creates/src/routes/(public)/otp/[token]/server.test.ts": nr,
5329
+ "./creates/src/routes/(public)/reset/+page.server.ts": ar,
5330
+ "./creates/src/routes/(public)/reset/+page.svelte": rr,
5331
+ "./creates/src/routes/(public)/reset/server.test.ts": or,
5332
+ "./creates/src/routes/(public)/signup/+page.server.ts": sr,
5333
+ "./creates/src/routes/(public)/signup/+page.svelte": ir,
5334
+ "./creates/src/routes/(public)/signup/server.test.ts": lr
5335
+ }), mr = "./creates/";
5336
+ async function ur(t) {
5337
+ const e = Object.entries(cr).map(([r, s]) => {
5338
+ const i = N(r, mr);
5339
5339
  return {
5340
5340
  path: i,
5341
- language: P(i),
5341
+ language: R(i),
5342
5342
  content: s
5343
5343
  };
5344
- }).sort((a, s) => a.path.localeCompare(s.path)), n = [
5344
+ }).sort((r, s) => r.path.localeCompare(s.path)), n = [
5345
5345
  "sidebar",
5346
5346
  "breadcrumb",
5347
5347
  "separator",
@@ -5426,7 +5426,7 @@ async function ua(t) {
5426
5426
  ]
5427
5427
  };
5428
5428
  }
5429
- const da = `import {
5429
+ const pr = `import {
5430
5430
  POCKETBASE_URL,
5431
5431
  POCKETBASE_SUPERUSER_EMAIL,
5432
5432
  POCKETBASE_SUPERUSER_PASSWORD,
@@ -5440,7 +5440,7 @@ export const handle = handlePocketbase({
5440
5440
  // [!code highlight:1]
5441
5441
  auth: { protectedRoutes: ["/(app)"] },
5442
5442
  });
5443
- `, pa = `<script lang="ts">
5443
+ `, dr = `<script lang="ts">
5444
5444
  import { toggleMode } from "mode-watcher";
5445
5445
  import * as Navbar from "$lib/components/ui/navbar";
5446
5446
  import { Button } from "$lib/components/ui/button";
@@ -5547,7 +5547,7 @@ export const handle = handlePocketbase({
5547
5547
  @apply container mx-auto max-w-7xl px-4 py-8 w-full;
5548
5548
  }
5549
5549
  </style>
5550
- `, fa = `import { loadFlash } from "sveltekit-flash-message/server";
5550
+ `, fr = `import { loadFlash } from "sveltekit-flash-message/server";
5551
5551
 
5552
5552
  export const load = loadFlash(async ({ locals }) => {
5553
5553
  return {
@@ -5555,20 +5555,20 @@ export const load = loadFlash(async ({ locals }) => {
5555
5555
  user: locals.pb.authStore.record,
5556
5556
  };
5557
5557
  });
5558
- `, ga = /* @__PURE__ */ Object.assign({
5559
- "./preview-modifies/src/hooks.server.ts": da,
5560
- "./preview-modifies/src/routes/(public)/root-layout.svelte": pa,
5561
- "./preview-modifies/src/routes/+layout.server.ts": fa
5562
- }), ha = "./preview-modifies/";
5563
- async function ba(t) {
5564
- const e = Object.entries(ga).map(([n, r]) => {
5565
- const a = G(n, ha);
5558
+ `, gr = /* @__PURE__ */ Object.assign({
5559
+ "./preview-modifies/src/hooks.server.ts": pr,
5560
+ "./preview-modifies/src/routes/(public)/root-layout.svelte": dr,
5561
+ "./preview-modifies/src/routes/+layout.server.ts": fr
5562
+ }), hr = "./preview-modifies/";
5563
+ async function br(t) {
5564
+ const e = Object.entries(gr).map(([n, a]) => {
5565
+ const r = N(n, hr);
5566
5566
  return {
5567
- path: a,
5568
- language: P(a),
5569
- content: r
5567
+ path: r,
5568
+ language: R(r),
5569
+ content: a
5570
5570
  };
5571
- }).sort((n, r) => n.path.localeCompare(r.path));
5571
+ }).sort((n, a) => n.path.localeCompare(a.path));
5572
5572
  return {
5573
5573
  creates: [],
5574
5574
  modifies: e,
@@ -5578,24 +5578,24 @@ async function ba(t) {
5578
5578
  collections: []
5579
5579
  };
5580
5580
  }
5581
- const va = "enable-auth", wa = "1.0.7", ya = "src/patterns/enable/auth", $a = "/enable/auth";
5582
- async function xa(t) {
5583
- const e = await ua(t);
5581
+ const vr = "enable-auth", wr = "1.0.7", yr = "src/patterns/enable/auth", $r = "/enable/auth";
5582
+ async function xr(t) {
5583
+ const e = await ur(t);
5584
5584
  if (t.env === "preview") {
5585
- const s = await ba();
5586
- return S(H([e, s]));
5585
+ const s = await br();
5586
+ return S(A([e, s]));
5587
5587
  }
5588
- const { generate: n } = await import("./generate.runtime-5EvPE9YS.js"), r = await n(t), { writeResult: a } = await import("./write-result-CbUTMeAc.js");
5589
- return a(
5590
- await S(H([e, r])),
5588
+ const { generate: n } = await import("./generate.runtime-AE_6Wd2H.js"), a = await n(t), { writeResult: r } = await import("./write-result-CbUTMeAc.js");
5589
+ return r(
5590
+ await S(A([e, a])),
5591
5591
  t
5592
5592
  );
5593
5593
  }
5594
- const Fa = {
5595
- version: wa,
5596
- slug: va,
5597
- source: ya,
5598
- docs: $a,
5594
+ const Fr = {
5595
+ version: wr,
5596
+ slug: vr,
5597
+ source: yr,
5598
+ docs: $r,
5599
5599
  plan: "open",
5600
5600
  title: "Enable authentication",
5601
5601
  summary: "Enables authentication.",
@@ -5618,8 +5618,8 @@ const Fa = {
5618
5618
  argv: []
5619
5619
  },
5620
5620
  baseline: "velastack",
5621
- generate: xa
5622
- }, Sa = `import { describe, expect, it } from "vitest";
5621
+ generate: xr
5622
+ }, Sr = `import { describe, expect, it } from "vitest";
5623
5623
 
5624
5624
  describe("GET /api/health", () => {
5625
5625
  it("should return a 200 status code", async (context) => {
@@ -5627,19 +5627,19 @@ describe("GET /api/health", () => {
5627
5627
  expect(response.status).toBe(200);
5628
5628
  });
5629
5629
  });
5630
- `, Ca = /* @__PURE__ */ Object.assign({
5631
- "./creates/src/routes/api/server.test.ts": Sa
5632
- }), _a = "./creates/";
5633
- async function ka(t) {
5630
+ `, Cr = /* @__PURE__ */ Object.assign({
5631
+ "./creates/src/routes/api/server.test.ts": Sr
5632
+ }), _r = "./creates/";
5633
+ async function kr(t) {
5634
5634
  return {
5635
- creates: Object.entries(Ca).map(([n, r]) => {
5636
- const a = G(n, _a);
5635
+ creates: Object.entries(Cr).map(([n, a]) => {
5636
+ const r = N(n, _r);
5637
5637
  return {
5638
- path: a,
5639
- language: P(a),
5640
- content: r
5638
+ path: r,
5639
+ language: R(r),
5640
+ content: a
5641
5641
  };
5642
- }).sort((n, r) => n.path.localeCompare(r.path)),
5642
+ }).sort((n, a) => n.path.localeCompare(a.path)),
5643
5643
  modifies: [],
5644
5644
  deletes: [],
5645
5645
  components: [],
@@ -5647,7 +5647,7 @@ async function ka(t) {
5647
5647
  collections: []
5648
5648
  };
5649
5649
  }
5650
- const Ra = `import {
5650
+ const Rr = `import {
5651
5651
  POCKETBASE_URL,
5652
5652
  POCKETBASE_SUPERUSER_EMAIL,
5653
5653
  POCKETBASE_SUPERUSER_PASSWORD,
@@ -5661,18 +5661,18 @@ export const handle = handlePocketbase({
5661
5661
  // [!code highlight:1]
5662
5662
  api: { enabled: true },
5663
5663
  });
5664
- `, Pa = /* @__PURE__ */ Object.assign({
5665
- "./preview-modifies/src/hooks.server.ts": Ra
5666
- }), Ea = "./preview-modifies/";
5667
- async function Ia(t) {
5668
- const e = Object.entries(Pa).map(([n, r]) => {
5669
- const a = G(n, Ea);
5664
+ `, Pr = /* @__PURE__ */ Object.assign({
5665
+ "./preview-modifies/src/hooks.server.ts": Rr
5666
+ }), Er = "./preview-modifies/";
5667
+ async function zr(t) {
5668
+ const e = Object.entries(Pr).map(([n, a]) => {
5669
+ const r = N(n, Er);
5670
5670
  return {
5671
- path: a,
5672
- language: P(a),
5673
- content: r
5671
+ path: r,
5672
+ language: R(r),
5673
+ content: a
5674
5674
  };
5675
- }).sort((n, r) => n.path.localeCompare(r.path));
5675
+ }).sort((n, a) => n.path.localeCompare(a.path));
5676
5676
  return {
5677
5677
  creates: [],
5678
5678
  modifies: e,
@@ -5682,24 +5682,24 @@ async function Ia(t) {
5682
5682
  collections: []
5683
5683
  };
5684
5684
  }
5685
- const za = "enable-api", Ma = "1.0.7", Ba = "src/patterns/enable/api", Da = "/enable/api";
5686
- async function Ta(t) {
5687
- const e = await ka();
5685
+ const Ir = "enable-api", Mr = "1.0.7", Br = "src/patterns/enable/api", Dr = "/enable/api";
5686
+ async function jr(t) {
5687
+ const e = await kr();
5688
5688
  if (t.env === "preview") {
5689
- const s = await Ia();
5690
- return S(H([e, s]));
5689
+ const s = await zr();
5690
+ return S(A([e, s]));
5691
5691
  }
5692
- const { generate: n } = await import("./generate.runtime-C7g-zL0o.js"), r = await n(t), { writeResult: a } = await import("./write-result-CbUTMeAc.js");
5693
- return a(
5694
- await S(H([e, r])),
5692
+ const { generate: n } = await import("./generate.runtime-C7g-zL0o.js"), a = await n(t), { writeResult: r } = await import("./write-result-CbUTMeAc.js");
5693
+ return r(
5694
+ await S(A([e, a])),
5695
5695
  t
5696
5696
  );
5697
5697
  }
5698
- const Aa = {
5699
- version: Ma,
5700
- slug: za,
5701
- source: Ba,
5702
- docs: Da,
5698
+ const Tr = {
5699
+ version: Mr,
5700
+ slug: Ir,
5701
+ source: Br,
5702
+ docs: Dr,
5703
5703
  plan: "open",
5704
5704
  title: "Enable API",
5705
5705
  summary: "Enables the PocketBase API.",
@@ -5715,17 +5715,236 @@ const Aa = {
5715
5715
  argv: []
5716
5716
  },
5717
5717
  baseline: "velastack",
5718
- generate: Ta
5719
- }, Va = ne.version, Jt = [
5718
+ generate: jr
5719
+ }, Ar = `import { deLocalizeDefault } from "wuchale/url";
5720
+ import { matchUrl } from "$locales/main.url";
5721
+ import { locales } from "$locales/data";
5722
+
5723
+ export const reroute = ({ url }) => {
5724
+ const [upath, locale] = deLocalizeDefault(url.pathname, locales);
5725
+ const { path } = matchUrl(upath, locale);
5726
+ return path ?? url.pathname;
5727
+ };
5728
+ `, Lr = `import { deLocalizeDefault, fillParams } from "wuchale/url";
5729
+ import type { Locale } from "../locales/data";
5730
+ import { matchUrl } from "../locales/main.url";
5731
+ import { locales } from "../locales/data";
5732
+
5733
+ export const defaultLocale = "en";
5734
+
5735
+ export function localize(path: string, locale: Locale) {
5736
+ if (locale === defaultLocale) {
5737
+ return path;
5738
+ }
5739
+
5740
+ return \`/\${locale}\${path}\`;
5741
+ }
5742
+
5743
+ export function translateUrl(url: string, fromLocale: Locale, toLocale: Locale) {
5744
+ const [pathOnly] = deLocalizeDefault(url, locales);
5745
+ const result = matchUrl(pathOnly, fromLocale);
5746
+ if (result.path !== null) {
5747
+ const targetPath = fillParams(result.params, result.altPatterns[toLocale]);
5748
+ return localize(targetPath, toLocale);
5749
+ }
5750
+ return localize(url, toLocale);
5751
+ }
5752
+ `, Or = `// @ts-check
5753
+ import { adapter as svelte } from "@wuchale/svelte";
5754
+ import { adapter as js } from "wuchale/adapter-vanilla";
5755
+ import { defineConfig } from "wuchale";
5756
+
5757
+ export default defineConfig({
5758
+ locales: ["en", "es"],
5759
+ adapters: {
5760
+ main: svelte({ loader: "sveltekit", url: { localize: true, patterns: ["/"] } }),
5761
+ js: js({
5762
+ loader: "vite",
5763
+ files: ["src/**/+{page,layout}.{js,ts}", "src/**/+{page,layout}.server.{js,ts}"],
5764
+ }),
5765
+ },
5766
+ });
5767
+ `, Nr = /* @__PURE__ */ Object.assign({
5768
+ "./creates/src/hooks.ts": Ar,
5769
+ "./creates/src/lib/url.ts": Lr,
5770
+ "./creates/wuchale.config.js": Or
5771
+ }), qr = "./creates/";
5772
+ async function Ur(t) {
5773
+ return {
5774
+ creates: Object.entries(Nr).map(([n, a]) => {
5775
+ const r = N(n, qr);
5776
+ return {
5777
+ path: r,
5778
+ language: R(r),
5779
+ content: a
5780
+ };
5781
+ }).sort((n, a) => n.path.localeCompare(a.path)),
5782
+ modifies: [],
5783
+ deletes: [],
5784
+ components: [],
5785
+ packages: ["wuchale", "@wuchale/svelte"],
5786
+ collections: []
5787
+ };
5788
+ }
5789
+ const Vr = `<!doctype html>
5790
+ <!-- [!code highlight:1] -->
5791
+ <html lang="%sveltekit.lang%">
5792
+
5793
+ <head>
5794
+ <meta charset="utf-8" />
5795
+ </head>
5796
+
5797
+ <body>
5798
+ <div style="display: contents">%sveltekit.body%</div>
5799
+ </body>
5800
+
5801
+ </html>
5802
+ `, Hr = `import { env } from "$env/dynamic/private";
5803
+ import { handlePocketbase } from "@velastack/pocketbase";
5804
+ // [!code highlight:6]
5805
+ import { sequence } from "@sveltejs/kit/hooks";
5806
+ import { runWithLocale, loadLocales } from "wuchale/load-utils/server";
5807
+ import { getLocale } from "$locales/main.url";
5808
+ import { locales } from "$locales/data";
5809
+ import * as main from "$locales/main.loader.server.svelte.js";
5810
+ import * as js from "$locales/js.loader.server.js";
5811
+
5812
+ // [!code highlight:2]
5813
+ loadLocales(main.key, main.loadIDs, main.loadCatalog, locales);
5814
+ loadLocales(js.key, js.loadIDs, js.loadCatalog, locales);
5815
+
5816
+ // [!code highlight:9]
5817
+ const handleWuchale = async ({ event, resolve }: any) => {
5818
+ const locale = getLocale(event.url);
5819
+ return await runWithLocale(locale, () =>
5820
+ resolve(event, {
5821
+ transformPageChunk: ({ html }: { html: string }) =>
5822
+ html.replace("%sveltekit.lang%", locale),
5823
+ }),
5824
+ );
5825
+ };
5826
+
5827
+ export const handle = sequence(
5828
+ // [!code highlight:1]
5829
+ handleWuchale,
5830
+ handlePocketbase({
5831
+ pocketbaseUrl: env.POCKETBASE_URL,
5832
+ superuserEmail: env.POCKETBASE_SUPERUSER_EMAIL,
5833
+ superuserPassword: env.POCKETBASE_SUPERUSER_PASSWORD,
5834
+ }),
5835
+ );
5836
+ `, Gr = `import { browser } from "$app/environment";
5837
+ // [!code highlight:4]
5838
+ import { loadLocale } from "wuchale/load-utils";
5839
+ import { getLocale } from "$locales/main.url";
5840
+ import "$locales/main.loader.svelte";
5841
+ import "$locales/js.loader";
5842
+
5843
+ export const load = async ({ url, data }) => {
5844
+ // [!code highlight:5]
5845
+ const locale = getLocale(url);
5846
+
5847
+ if (browser) {
5848
+ await loadLocale(locale);
5849
+ }
5850
+
5851
+ return data;
5852
+ };
5853
+ `, Wr = `import adapter from "@sveltejs/adapter-auto";
5854
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
5855
+
5856
+ const config = {
5857
+ preprocess: vitePreprocess(),
5858
+ kit: {
5859
+ adapter,
5860
+ // [!code highlight:3]
5861
+ alias: {
5862
+ $locales: "src/locales",
5863
+ },
5864
+ },
5865
+ };
5866
+
5867
+ export default config;
5868
+ `, Jr = `import { defineConfig } from "vite";
5869
+ import { sveltekit } from "@sveltejs/kit/vite";
5870
+ import tailwindcss from "@tailwindcss/vite";
5871
+ // [!code highlight:1]
5872
+ import { wuchale } from "wuchale/vite";
5873
+
5874
+ export default defineConfig({
5875
+ // [!code highlight:1]
5876
+ plugins: [wuchale(), tailwindcss(), sveltekit()],
5877
+ });
5878
+ `, Kr = /* @__PURE__ */ Object.assign({
5879
+ "./preview-modifies/src/app.html": Vr,
5880
+ "./preview-modifies/src/hooks.server.ts": Hr,
5881
+ "./preview-modifies/src/routes/+layout.ts": Gr,
5882
+ "./preview-modifies/svelte.config.js": Wr,
5883
+ "./preview-modifies/vite.config.ts": Jr
5884
+ }), Zr = "./preview-modifies/";
5885
+ async function Xr(t) {
5886
+ const e = Object.entries(Kr).map(([n, a]) => {
5887
+ const r = N(n, Zr);
5888
+ return {
5889
+ path: r,
5890
+ language: R(r),
5891
+ content: a
5892
+ };
5893
+ }).sort((n, a) => n.path.localeCompare(a.path));
5894
+ return {
5895
+ creates: [],
5896
+ modifies: e,
5897
+ deletes: [],
5898
+ components: [],
5899
+ packages: [],
5900
+ collections: []
5901
+ };
5902
+ }
5903
+ const Yr = "enable-i18n", Qr = "1.0.0", to = "src/patterns/enable/i18n", eo = "/enable/i18n";
5904
+ async function no(t) {
5905
+ const e = await Ur();
5906
+ if (t.env === "preview") {
5907
+ const s = await Xr();
5908
+ return S(A([e, s]));
5909
+ }
5910
+ const { generate: n } = await import("./generate.runtime-B_lW3Sj0.js"), a = await n(t), { writeResult: r } = await import("./write-result-CbUTMeAc.js");
5911
+ return r(
5912
+ await S(A([e, a])),
5913
+ t
5914
+ );
5915
+ }
5916
+ const ao = {
5917
+ version: Qr,
5918
+ slug: Yr,
5919
+ source: to,
5920
+ docs: eo,
5921
+ plan: "open",
5922
+ title: "Enable i18n",
5923
+ summary: "Enables i18n with Wuchale and locale-aware routing.",
5924
+ requires: {
5925
+ auth: !1,
5926
+ payments: !1
5927
+ },
5928
+ category: "i18n",
5929
+ tags: ["sveltekit", "i18n", "localization", "wuchale", "velastack"],
5930
+ command: {
5931
+ raw: "vela enable i18n",
5932
+ base: "vela enable i18n",
5933
+ argv: []
5934
+ },
5935
+ baseline: "velastack",
5936
+ generate: no
5937
+ }, co = ne.version, Jt = [
5720
5938
  En,
5721
- $r,
5939
+ $a,
5722
5940
  Gn,
5723
- ur,
5724
- Fa,
5725
- Aa
5726
- ], Ua = Object.fromEntries(
5941
+ ua,
5942
+ Fr,
5943
+ Tr,
5944
+ ao
5945
+ ], mo = Object.fromEntries(
5727
5946
  Jt.map((t) => [t.slug, t])
5728
- ), Ha = Jt.reduce(
5947
+ ), uo = Jt.reduce(
5729
5948
  (t, e) => {
5730
5949
  const n = e.category;
5731
5950
  return t[n] ?? (t[n] = []), t[n].push(e), t;
@@ -5733,13 +5952,13 @@ const Aa = {
5733
5952
  {}
5734
5953
  );
5735
5954
  export {
5736
- La as D,
5737
- qa as M,
5738
- Ua as a,
5739
- Ha as b,
5740
- d,
5741
- P as l,
5955
+ io as D,
5956
+ lo as M,
5957
+ mo as a,
5958
+ uo as b,
5959
+ p as d,
5960
+ R as l,
5742
5961
  Jt as p,
5743
- Va as v
5962
+ co as v
5744
5963
  };
5745
- //# sourceMappingURL=index-Dav9F9Qf.js.map
5964
+ //# sourceMappingURL=index-BOXPYvqZ.js.map