@velastack/patterns 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +9 -16
  2. package/dist/chunks/{collections-Bzyt18yv.js → collections-DdGJC7Ip.js} +5 -3
  3. package/dist/chunks/collections-DdGJC7Ip.js.map +1 -0
  4. package/dist/chunks/{generate.runtime-uPCB71Ki.js → generate.runtime-B0EfMNMf.js} +212 -134
  5. package/dist/chunks/generate.runtime-B0EfMNMf.js.map +1 -0
  6. package/dist/chunks/generate.runtime-Bt6kbkWX.js +289 -0
  7. package/dist/chunks/generate.runtime-Bt6kbkWX.js.map +1 -0
  8. package/dist/chunks/generate.runtime-BtGvtuWm.js +81 -0
  9. package/dist/chunks/generate.runtime-BtGvtuWm.js.map +1 -0
  10. package/dist/chunks/generate.runtime-CcKMIm9M.js +430 -0
  11. package/dist/chunks/generate.runtime-CcKMIm9M.js.map +1 -0
  12. package/dist/chunks/generate.runtime-DiJDMdAq.js +207 -0
  13. package/dist/chunks/generate.runtime-DiJDMdAq.js.map +1 -0
  14. package/dist/chunks/modify-file-Dxow9QKT.js +22 -0
  15. package/dist/chunks/modify-file-Dxow9QKT.js.map +1 -0
  16. package/dist/chunks/{ts-morph-helpers-BiOU9sUx.js → ts-morph-helpers-DmD7iwna.js} +1 -1
  17. package/dist/chunks/{ts-morph-helpers-BiOU9sUx.js.map → ts-morph-helpers-DmD7iwna.js.map} +1 -1
  18. package/dist/chunks/{write-result-CSxmq40z.js → write-result-DhQIE6kA.js} +4 -4
  19. package/dist/chunks/{write-result-CSxmq40z.js.map → write-result-DhQIE6kA.js.map} +1 -1
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.js +250 -231
  22. package/dist/index.js.map +1 -1
  23. package/package.json +3 -2
  24. package/dist/chunks/collections-Bzyt18yv.js.map +0 -1
  25. package/dist/chunks/generate.runtime-BEuc5hDN.js +0 -225
  26. package/dist/chunks/generate.runtime-BEuc5hDN.js.map +0 -1
  27. package/dist/chunks/generate.runtime-CHmm4bBZ.js +0 -154
  28. package/dist/chunks/generate.runtime-CHmm4bBZ.js.map +0 -1
  29. package/dist/chunks/generate.runtime-DXkJgkP4.js +0 -232
  30. package/dist/chunks/generate.runtime-DXkJgkP4.js.map +0 -1
  31. package/dist/chunks/generate.runtime-egq8I3EA.js +0 -61
  32. package/dist/chunks/generate.runtime-egq8I3EA.js.map +0 -1
  33. package/dist/chunks/generate.runtime-uPCB71Ki.js.map +0 -1
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ var l = Object.create, u = Object.defineProperty, d = Object.getOwnPropertyDescr
19
19
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
20
20
  }), ee = {
21
21
  name: "@velastack/patterns",
22
- version: "0.0.23",
22
+ version: "0.0.25",
23
23
  type: "module",
24
24
  private: !1,
25
25
  main: "./dist/index.js",
@@ -35,7 +35,8 @@ var l = Object.create, u = Object.defineProperty, d = Object.getOwnPropertyDescr
35
35
  "lint:format": "prettier --check .",
36
36
  test: "vitest run --exclude **/integration.test.ts",
37
37
  "test:watch": "vitest --watch --exclude **/integration.test.ts",
38
- "test:integration": "vitest run **/integration.test.ts"
38
+ "test:integration": "vitest run **/integration.test.ts",
39
+ prepare: "npm run build"
39
40
  },
40
41
  dependencies: {
41
42
  prettier: "^3.8.2",
@@ -79,6 +80,10 @@ var l = Object.create, u = Object.defineProperty, d = Object.getOwnPropertyDescr
79
80
  "vite-plugin-dts": "^4.5.4",
80
81
  vitest: "^4.1.4"
81
82
  }
83
+ }, y = class extends Error {
84
+ constructor(e) {
85
+ super(e), this.name = "InvalidArgumentError";
86
+ }
82
87
  };
83
88
  //#endregion
84
89
  //#region src/core/format-result.ts
@@ -86,7 +91,7 @@ function te(e) {
86
91
  return e.language === "ts" || e.language === "svelte" || e.path.endsWith(".json");
87
92
  }
88
93
  async function ne(e) {
89
- if (!te(e)) return e;
94
+ if (e.status !== "success" || !te(e)) return e;
90
95
  try {
91
96
  let t = await s.format(e.content, {
92
97
  filepath: e.path,
@@ -103,7 +108,7 @@ async function ne(e) {
103
108
  async function re(e) {
104
109
  return Promise.all(e.map((e) => ne(e)));
105
110
  }
106
- async function y(e) {
111
+ async function b(e) {
107
112
  let [t, n] = await Promise.all([re(e.creates), re(e.modifies)]);
108
113
  return {
109
114
  ...e,
@@ -144,13 +149,13 @@ var ie = {
144
149
  geopoint: ["import { GeopointInput } from \"$lib/components/ui/geopoint\";"],
145
150
  button: ["import { Button } from \"$lib/components/ui/button\";"]
146
151
  };
147
- function b(e) {
152
+ function x(e) {
148
153
  return `$formData.${e.name}`;
149
154
  }
150
- function x(e) {
155
+ function S(e) {
151
156
  return e.inputProps ? Object.entries(e.inputProps).flatMap(([e, t]) => t == null || t === !1 ? [] : t === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(t))}`]).join("") : "";
152
157
  }
153
- function S(t) {
158
+ function C(t) {
154
159
  return t.labelAside ? e`
155
160
  <div class="flex justify-between">
156
161
  <Form.Label>${t.title}</Form.Label>
@@ -158,14 +163,14 @@ function S(t) {
158
163
  </div>
159
164
  ` : `<Form.Label>${t.title}</Form.Label>`;
160
165
  }
161
- function C(t, n) {
166
+ function w(t, n) {
162
167
  let r = t.required ? " required" : "";
163
168
  return e`
164
169
  <Form.Field {form} name="${t.name}" class="col-span-1">
165
170
  <Form.Control>
166
171
  {#snippet children({ props })}
167
- ${S(t)}
168
- <Input {...props} type="${n}" bind:value={${b(t)}}${r}${x(t)} />
172
+ ${C(t)}
173
+ <Input {...props} type="${n}" bind:value={${x(t)}}${r}${S(t)} />
169
174
  {/snippet}
170
175
  </Form.Control>
171
176
  <Form.FieldErrors class="contents text-destructive" />
@@ -178,8 +183,8 @@ function oe(t) {
178
183
  <Form.Field {form} name="${t.name}" class="col-span-2">
179
184
  <Form.Control>
180
185
  {#snippet children({ props })}
181
- ${S(t)}
182
- <Textarea {...props} bind:value={${b(t)}}${n}${x(t)} />
186
+ ${C(t)}
187
+ <Textarea {...props} bind:value={${x(t)}}${n}${S(t)} />
183
188
  {/snippet}
184
189
  </Form.Control>
185
190
  <Form.FieldErrors class="contents text-destructive" />
@@ -192,8 +197,8 @@ function se(t) {
192
197
  <Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
193
198
  <Form.Control>
194
199
  {#snippet children({ props })}
195
- <Checkbox {...props} bind:checked={${b(t)}}${n}${x(t)} />
196
- ${S(t)}
200
+ <Checkbox {...props} bind:checked={${x(t)}}${n}${S(t)} />
201
+ ${C(t)}
197
202
  {/snippet}
198
203
  </Form.Control>
199
204
  <Form.FieldErrors class="contents text-destructive" />
@@ -205,8 +210,8 @@ function ce(t) {
205
210
  <Form.Field {form} name="${t.name}" class="col-span-1">
206
211
  <Form.Control>
207
212
  {#snippet children({ props })}
208
- ${S(t)}
209
- <GeopointInput {...props} bind:value={${b(t)}} />
213
+ ${C(t)}
214
+ <GeopointInput {...props} bind:value={${x(t)}} />
210
215
  {/snippet}
211
216
  </Form.Control>
212
217
  <Form.FieldErrors class="contents text-destructive" />
@@ -219,7 +224,7 @@ function le(t) {
219
224
  <FileForm.Field {form} name="${t.name}" class="col-span-1">
220
225
  <Form.Control>
221
226
  {#snippet children({ props })}
222
- ${S(t)}
227
+ ${C(t)}
223
228
  <FileForm.${r}>
224
229
  {#snippet display({ file, filename, onremove })}
225
230
  <div class="flex gap-2 justify-between items-center">
@@ -231,7 +236,7 @@ function le(t) {
231
236
  </div>
232
237
  {/snippet}
233
238
  {#snippet input()}
234
- <FileForm.Input {...props}${n}${x(t)} />
239
+ <FileForm.Input {...props}${n}${S(t)} />
235
240
  {/snippet}
236
241
  </FileForm.${r}>
237
242
  {/snippet}
@@ -246,9 +251,9 @@ function ue(t) {
246
251
  <MultiSelect.Field {form} type="${n}" name="${t.name}"${r} class="col-span-1">
247
252
  <Form.Control>
248
253
  {#snippet children({ props })}
249
- ${S(t)}
254
+ ${C(t)}
250
255
  <MultiSelect.Trigger class="w-full justify-between">
251
- <MultiSelect.Input bind:value={${b(t)}} placeholder="${i}" {...props}>
256
+ <MultiSelect.Input bind:value={${x(t)}} placeholder="${i}" {...props}>
252
257
  {#snippet children({ selected })}
253
258
  <div class="flex flex-wrap gap-1">
254
259
  {#each selected as value}
@@ -283,7 +288,7 @@ function de(t) {
283
288
  {#snippet children({ props })}
284
289
  <Form.Label>${t.title}</Form.Label>
285
290
  <MultiSelect.Trigger class="w-full justify-between">
286
- <MultiSelect.Input bind:value={${b(t)}} placeholder="${r}" {...props}>
291
+ <MultiSelect.Input bind:value={${x(t)}} placeholder="${r}" {...props}>
287
292
  {#snippet children({ selected })}
288
293
  <div class="flex flex-wrap gap-1">
289
294
  {#each selected as value}
@@ -318,22 +323,22 @@ function fe(t) {
318
323
  <Form.Field {form} name="${t.name}" class="col-span-1">
319
324
  <Form.Control>
320
325
  {#snippet children({ props })}
321
- ${S(t)}
322
- <Input {...props} type="text" value={${b(t)}}${x(t)} readonly />
326
+ ${C(t)}
327
+ <Input {...props} type="text" value={${x(t)}}${S(t)} readonly />
323
328
  {/snippet}
324
329
  </Form.Control>
325
330
  <Form.FieldErrors class="contents text-destructive" />
326
331
  </Form.Field>
327
332
  `;
328
333
  }
329
- function w(e) {
334
+ function T(e) {
330
335
  switch (e.type) {
331
- case "text": return C(e, "text");
332
- case "number": return C(e, "number");
333
- case "date": return C(e, "date");
334
- case "email": return C(e, "email");
335
- case "password": return C(e, "password");
336
- case "url": return C(e, "url");
336
+ case "text": return w(e, "text");
337
+ case "number": return w(e, "number");
338
+ case "date": return w(e, "date");
339
+ case "email": return w(e, "email");
340
+ case "password": return w(e, "password");
341
+ case "url": return w(e, "url");
337
342
  case "autodate": return fe(e);
338
343
  case "editor":
339
344
  case "json": return oe(e);
@@ -358,17 +363,17 @@ function pe(t) {
358
363
  } as const;
359
364
  `;
360
365
  }
361
- function T(e) {
366
+ function E(e) {
362
367
  let t = e.flatMap((e) => ie[e.type]);
363
368
  return [...new Set(t)];
364
369
  }
365
- function E(e) {
370
+ function D(e) {
366
371
  return [...new Set(e.flatMap((e) => ae[e]))];
367
372
  }
368
- function D(e, t) {
373
+ function O(e, t) {
369
374
  return `data.${e.name}.${t.name}`;
370
375
  }
371
- function O(t, n, r) {
376
+ function k(t, n, r) {
372
377
  return e`
373
378
  <div class="space-y-2">
374
379
  <h3 class="font-medium leading-none">${n.title}</h3>
@@ -377,7 +382,7 @@ function O(t, n, r) {
377
382
  `;
378
383
  }
379
384
  function me(t, n) {
380
- let r = D(t, n), i = `<p class="text-muted-foreground">{new Date(${r}).toLocaleDateString()}</p>`, a = n.required ? i : e`
385
+ let r = O(t, n), i = `<p class="text-muted-foreground">{new Date(${r}).toLocaleDateString()}</p>`, a = n.required ? i : e`
381
386
  {#if ${r}}
382
387
  ${i}
383
388
  {/if}
@@ -390,7 +395,7 @@ function me(t, n) {
390
395
  `;
391
396
  }
392
397
  function he(t, n) {
393
- let r = D(t, n), i = e`
398
+ let r = O(t, n), i = e`
394
399
  <a href={${r}} target="_blank" rel="noopener noreferrer">
395
400
  {${r}}
396
401
  </a>
@@ -409,7 +414,7 @@ function he(t, n) {
409
414
  `;
410
415
  }
411
416
  function ge(t, n) {
412
- let r = D(t, n);
417
+ let r = O(t, n);
413
418
  if (n.maxSelect > 1) return e`
414
419
  <div class="space-y-2">
415
420
  <h3 class="font-medium leading-none">${n.title}</h3>
@@ -431,7 +436,7 @@ function ge(t, n) {
431
436
  `;
432
437
  }
433
438
  function _e(t, n) {
434
- let r = D(t, n);
439
+ let r = O(t, n);
435
440
  return n.maxSelect > 1 ? e`
436
441
  <div class="space-y-2">
437
442
  <h3 class="font-medium leading-none">${n.title}</h3>
@@ -508,7 +513,7 @@ function ye(t, n) {
508
513
  `;
509
514
  }
510
515
  function be(t, n) {
511
- let r = D(t, n), i = e`
516
+ let r = O(t, n), i = e`
512
517
  {#await import("$lib/components/ui/leaflet/leaflet.svelte")}
513
518
  <div class="h-56.25 w-full bg-input rounded-md"></div>
514
519
  {:then { default: Leaflet }}
@@ -534,7 +539,7 @@ function xe(t, n) {
534
539
  case "text":
535
540
  case "number":
536
541
  case "email":
537
- case "editor": return O(t, n, `{${D(t, n)}}`);
542
+ case "editor": return k(t, n, `{${O(t, n)}}`);
538
543
  case "password": return e`
539
544
  <div class="space-y-2">
540
545
  <h3 class="font-medium leading-none">${n.title}</h3>
@@ -543,13 +548,13 @@ function xe(t, n) {
543
548
  </p>
544
549
  </div>
545
550
  `;
546
- case "bool": return O(t, n, `{${D(t, n)} ? "Yes" : "No"}`);
551
+ case "bool": return k(t, n, `{${O(t, n)} ? "Yes" : "No"}`);
547
552
  case "date":
548
553
  case "autodate": return me(t, n);
549
554
  case "url": return he(t, n);
550
555
  case "select": return ge(t, n);
551
556
  case "file": return _e(t, n);
552
- case "json": return O(t, n, `{JSON.stringify(${D(t, n)})}`);
557
+ case "json": return k(t, n, `{JSON.stringify(${O(t, n)})}`);
553
558
  case "geoPoint": return be(t, n);
554
559
  case "relation": return ye(t, n);
555
560
  default: return n;
@@ -579,20 +584,20 @@ function ke(e) {
579
584
  return t;
580
585
  }
581
586
  function Ae(e, t) {
582
- let [n, r, i] = N(e, t);
583
- return n + r.map(j(t?.locale)).join(t?.delimiter ?? " ") + i;
587
+ let [n, r, i] = P(e, t);
588
+ return n + r.map(M(t?.locale)).join(t?.delimiter ?? " ") + i;
584
589
  }
585
- function k(e, t) {
586
- let [n, r, i] = N(e, t), a = j(t?.locale), o = M(t?.locale), s = t?.mergeAmbiguousCharacters ? Pe(a, o) : Fe(a, o);
590
+ function A(e, t) {
591
+ let [n, r, i] = P(e, t), a = M(t?.locale), o = Pe(t?.locale), s = t?.mergeAmbiguousCharacters ? N(a, o) : Fe(a, o);
587
592
  return n + r.map((e, t) => t === 0 ? a(e) : s(e, t)).join(t?.delimiter ?? "") + i;
588
593
  }
589
594
  function je(e, t) {
590
- let [n, r, i] = N(e, t), a = j(t?.locale), o = M(t?.locale), s = t?.mergeAmbiguousCharacters ? Pe(a, o) : Fe(a, o);
595
+ let [n, r, i] = P(e, t), a = M(t?.locale), o = Pe(t?.locale), s = t?.mergeAmbiguousCharacters ? N(a, o) : Fe(a, o);
591
596
  return n + r.map(s).join(t?.delimiter ?? "") + i;
592
597
  }
593
- function A(e, t) {
594
- let [n, r, i] = N(e, t), a = j(t?.locale), o = M(t?.locale);
595
- return n + r.map(Pe(a, o)).join(t?.delimiter ?? " ") + i;
598
+ function j(e, t) {
599
+ let [n, r, i] = P(e, t), a = M(t?.locale), o = Pe(t?.locale);
600
+ return n + r.map(N(a, o)).join(t?.delimiter ?? " ") + i;
596
601
  }
597
602
  function Me(e, t) {
598
603
  return Ae(e, {
@@ -606,13 +611,13 @@ function Ne(e, t) {
606
611
  ...t
607
612
  });
608
613
  }
609
- function j(e) {
614
+ function M(e) {
610
615
  return e === !1 ? (e) => e.toLowerCase() : (t) => t.toLocaleLowerCase(e);
611
616
  }
612
- function M(e) {
617
+ function Pe(e) {
613
618
  return e === !1 ? (e) => e.toUpperCase() : (t) => t.toLocaleUpperCase(e);
614
619
  }
615
- function Pe(e, t) {
620
+ function N(e, t) {
616
621
  return (n) => `${t(n[0])}${e(n.slice(1))}`;
617
622
  }
618
623
  function Fe(e, t) {
@@ -621,7 +626,7 @@ function Fe(e, t) {
621
626
  return (r > 0 && i >= "0" && i <= "9" ? "_" + i : t(i)) + e(n.slice(1));
622
627
  };
623
628
  }
624
- function N(e, t = {}) {
629
+ function P(e, t = {}) {
625
630
  let n = t.split ?? (t.separateNumbers ? ke : Oe), r = t.prefixCharacters ?? De, i = t.suffixCharacters ?? De, a = 0, o = e.length;
626
631
  for (; a < e.length;) {
627
632
  let t = e.charAt(a);
@@ -641,7 +646,7 @@ function N(e, t = {}) {
641
646
  }
642
647
  //#endregion
643
648
  //#region src/parse/model.ts
644
- var P = /* @__PURE__ */ _((/* @__PURE__ */ h(((e, t) => {
649
+ var F = /* @__PURE__ */ _((/* @__PURE__ */ h(((e, t) => {
645
650
  (function(n, r) {
646
651
  /* istanbul ignore else */
647
652
  typeof v == "function" && typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define(function() {
@@ -960,25 +965,25 @@ var P = /* @__PURE__ */ _((/* @__PURE__ */ h(((e, t) => {
960
965
  arguments: "args",
961
966
  constructor: "ctor"
962
967
  };
963
- function F(e) {
968
+ function I(e) {
964
969
  return Ie.has(e) ? Le[e] ?? `${e}_` : e;
965
970
  }
966
971
  function Re(e) {
967
- if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(e)) throw Error("Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore");
972
+ if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(e)) throw new y("Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore");
968
973
  }
969
974
  function ze(e) {
970
975
  return e.features.auth ? `src/routes/${a}` : `src/routes/${i}`;
971
976
  }
972
- function I(e, t) {
973
- let n = e.split("/"), r = n[n.length - 1], i = n.slice(0, -1), a = P.default.singular(A(r)), o = P.default.plural(a), s = k(a), c = Me(o), l = [...i, c].join("/");
977
+ function L(e, t) {
978
+ let n = e.split("/"), r = n[n.length - 1], i = n.slice(0, -1), a = F.default.singular(j(r)), o = F.default.plural(a), s = A(a), c = Me(o), l = [...i, c].join("/");
974
979
  return {
975
- name: F(s),
976
- pluralName: F(k(o)),
980
+ name: I(s),
981
+ pluralName: I(A(o)),
977
982
  typeName: je(a),
978
983
  tableName: Ne(o),
979
984
  displayName: a,
980
985
  pluralDisplayName: o,
981
- schemaName: `${F(s)}Schema`,
986
+ schemaName: `${I(s)}Schema`,
982
987
  routeSegment: l,
983
988
  routesDir: ze(t)
984
989
  };
@@ -1028,7 +1033,7 @@ var qe = [
1028
1033
  "account",
1029
1034
  "creator"
1030
1035
  ];
1031
- function L(e) {
1036
+ function R(e) {
1032
1037
  return e.toLowerCase();
1033
1038
  }
1034
1039
  function Je(e) {
@@ -1040,17 +1045,17 @@ function Je(e) {
1040
1045
  };
1041
1046
  }
1042
1047
  function Ye(e, t, n = {}) {
1043
- let r = new Set((n.authCollections ?? ["users"]).map(L)), i = new Set((n.userFieldHints ?? qe).map(L)), a = n.maxDepth ?? 8, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1048
+ let r = new Set((n.authCollections ?? ["users"]).map(R)), i = new Set((n.userFieldHints ?? qe).map(R)), a = n.maxDepth ?? 8, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1044
1049
  for (let t of e) o.set(t.name, t), s.set(t.id, t);
1045
1050
  if (!o.has(t)) return Je(t);
1046
- if (r.has(L(t))) return {
1051
+ if (r.has(R(t))) return {
1047
1052
  rule: "@request.auth.id = id",
1048
1053
  ownershipChainCollections: [t],
1049
1054
  ownershipChainFields: [],
1050
1055
  operator: "="
1051
1056
  };
1052
1057
  function c(e) {
1053
- let t = L(e);
1058
+ let t = R(e);
1054
1059
  return t === "user" ? 50 : i.has(t) ? 20 : 0;
1055
1060
  }
1056
1061
  function l(e) {
@@ -1071,7 +1076,7 @@ function Ye(e, t, n = {}) {
1071
1076
  return n.sort((e, t) => e.fieldName.localeCompare(t.fieldName)), n;
1072
1077
  }
1073
1078
  function u(e) {
1074
- return r.has(L(e));
1079
+ return r.has(R(e));
1075
1080
  }
1076
1081
  function d(e) {
1077
1082
  if (e.length === 0) return !1;
@@ -1079,7 +1084,7 @@ function Ye(e, t, n = {}) {
1079
1084
  return u(e[e.length - 1].to);
1080
1085
  }
1081
1086
  function f(e) {
1082
- let t = e[e.length - 1], n = +!!t.isMulti, r = +!!e.every((e) => !e.isMulti), i = e.reduce((e, t) => e + t.hintScore, 0), a = +(L(t.fieldName) === "user");
1087
+ let t = e[e.length - 1], n = +!!t.isMulti, r = +!!e.every((e) => !e.isMulti), i = e.reduce((e, t) => e + t.hintScore, 0), a = +(R(t.fieldName) === "user");
1083
1088
  return 100 * e.length + 50 * n - 40 * a - 15 * r - i;
1084
1089
  }
1085
1090
  function p(e) {
@@ -1100,12 +1105,12 @@ function Ye(e, t, n = {}) {
1100
1105
  let n = f(e) - f(t);
1101
1106
  return n === 0 ? p(e).localeCompare(p(t)) : n;
1102
1107
  });
1103
- let _ = m[0], v = _.map((e) => e.fieldName), ee = [t, ..._.map((e) => e.to)], te = _[_.length - 1].isMulti ? "?=" : "=", ne = v.join(".");
1108
+ let _ = m[0], v = _.map((e) => e.fieldName), ee = [t, ..._.map((e) => e.to)], y = _[_.length - 1].isMulti ? "?=" : "=", te = v.join(".");
1104
1109
  return {
1105
- rule: `@request.auth.id ${te} ${n.includeRootPrefix ? (n.rootPrefix ?? t) + "." : ""}${ne}.id`,
1110
+ rule: `@request.auth.id ${y} ${n.includeRootPrefix ? (n.rootPrefix ?? t) + "." : ""}${te}.id`,
1106
1111
  ownershipChainCollections: ee,
1107
1112
  ownershipChainFields: v,
1108
- operator: te
1113
+ operator: y
1109
1114
  };
1110
1115
  }
1111
1116
  //#endregion
@@ -1237,24 +1242,24 @@ function tt(e) {
1237
1242
  });
1238
1243
  }
1239
1244
  function nt(e) {
1240
- let t = P.default.singular(e);
1241
- return e === P.default.plural(t) ? 99 : 1;
1245
+ let t = F.default.singular(e);
1246
+ return e === F.default.plural(t) ? 99 : 1;
1242
1247
  }
1243
- function R(e, t, n, r, i, a) {
1244
- let o = I(t, a), s = P.default.singular(e), c = P.default.plural(s);
1248
+ function z(e, t, n, r, i, a) {
1249
+ let o = L(t, a), s = F.default.singular(e), c = F.default.plural(s);
1245
1250
  return {
1246
1251
  collectionId: r[t],
1247
1252
  displayField: i[t] ?? "id",
1248
1253
  relatedModel: o,
1249
- singularRelationName: k(`${n.displayName} ${o.displayName}`),
1250
- pluralRelationName: k(`${n.displayName} ${o.pluralDisplayName}`),
1254
+ singularRelationName: A(`${n.displayName} ${o.displayName}`),
1255
+ pluralRelationName: A(`${n.displayName} ${o.pluralDisplayName}`),
1251
1256
  maxSelect: e === c ? 999 : 1
1252
1257
  };
1253
1258
  }
1254
1259
  function rt(e, t, n, r, i) {
1255
- let a = A(e), { type: o, required: s, selectOptions: c } = t, l = We(r), u = Ge(r), d = Ke(r), f = l.map((e) => P.default.singular(e));
1260
+ let a = j(e), { type: o, required: s, selectOptions: c } = t, l = We(r), u = Ge(r), d = Ke(r), f = l.map((e) => F.default.singular(e));
1256
1261
  if (i.features.auth && o === "current_user" && u.users) {
1257
- let t = R(e, "users", n, u, d, i);
1262
+ let t = z(e, "users", n, u, d, i);
1258
1263
  return {
1259
1264
  type: "relation",
1260
1265
  name: e,
@@ -1271,7 +1276,7 @@ function rt(e, t, n, r, i) {
1271
1276
  }
1272
1277
  if (o === "autodate") {
1273
1278
  let t = e.includes("create"), n = e.includes("update");
1274
- if (!t && !n) throw Error(`Invalid autodate field: ${e}. Must be one of created/created_at/updated/updated_at.`);
1279
+ if (!t && !n) throw new y(`Invalid autodate field: ${e}. Must be one of created/created_at/updated/updated_at.`);
1275
1280
  return {
1276
1281
  type: "autodate",
1277
1282
  name: e,
@@ -1297,14 +1302,14 @@ function rt(e, t, n, r, i) {
1297
1302
  maxSelect: nt(e)
1298
1303
  };
1299
1304
  if (o === "relation") {
1300
- let t = P.default.singular(e), r = P.default.plural(t);
1301
- if (!l.includes(r)) throw Error(`Invalid relation field: ${e}. Must be one of ${l.join(", ")} (singular or plural)`);
1305
+ let t = F.default.singular(e), r = F.default.plural(t);
1306
+ if (!l.includes(r)) throw new y(`Invalid relation field: ${e}. Must be one of ${l.join(", ")} (singular or plural)`);
1302
1307
  return {
1303
1308
  type: "relation",
1304
1309
  name: e,
1305
1310
  title: a,
1306
1311
  required: s,
1307
- ...R(e, r, n, u, d, i),
1312
+ ...z(e, r, n, u, d, i),
1308
1313
  isCurrentUser: !1
1309
1314
  };
1310
1315
  }
@@ -1313,13 +1318,13 @@ function rt(e, t, n, r, i) {
1313
1318
  name: e,
1314
1319
  title: a,
1315
1320
  required: s,
1316
- ...R(e, o, n, u, d, i),
1321
+ ...z(e, o, n, u, d, i),
1317
1322
  isCurrentUser: !1
1318
1323
  };
1319
1324
  if (f.includes(o)) {
1320
- let t = P.default.plural(o);
1325
+ let t = F.default.plural(o);
1321
1326
  if (l.includes(t)) {
1322
- let r = R(e, t, n, u, d, i);
1327
+ let r = z(e, t, n, u, d, i);
1323
1328
  return {
1324
1329
  type: "relation",
1325
1330
  name: e,
@@ -1364,7 +1369,7 @@ function rt(e, t, n, r, i) {
1364
1369
  "editor",
1365
1370
  "json",
1366
1371
  "geoPoint"
1367
- ].includes(o)) throw Error(`Invalid field type: ${o}. Valid types are: ${p.join(", ").replace("relation", "references")}`);
1372
+ ].includes(o)) throw new y(`Invalid field type: ${o}. Valid types are: ${p.join(", ").replace("relation", "references")}`);
1368
1373
  return {
1369
1374
  type: o,
1370
1375
  name: e,
@@ -1376,8 +1381,8 @@ function it(e, t, n, r) {
1376
1381
  let i = [];
1377
1382
  for (let a of e) {
1378
1383
  let [e, o] = Xe(a);
1379
- if (!e || !o) throw Error(`Invalid field format: ${a}. Expected format: name:type or name:type!`);
1380
- if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)) throw Error(`Invalid field name: ${e}. Must start with a letter and contain only alphanumeric characters`);
1384
+ if (!e || !o) throw new y(`Invalid field format: ${a}. Expected format: name:type or name:type!`);
1385
+ if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)) throw new y(`Invalid field name: ${e}. Must start with a letter and contain only alphanumeric characters`);
1381
1386
  let s = tt(o);
1382
1387
  i.push(rt(e, s, t, n, r));
1383
1388
  }
@@ -1398,16 +1403,16 @@ function it(e, t, n, r) {
1398
1403
  }
1399
1404
  //#endregion
1400
1405
  //#region src/core/tests.ts
1401
- var at = "2024-01-01T00:00:00.000Z", z = class {
1406
+ var at = "2024-01-01T00:00:00.000Z", B = class {
1402
1407
  constructor(e) {
1403
1408
  this.expression = e;
1404
1409
  }
1405
1410
  };
1406
- function B(e) {
1407
- return e instanceof z ? e.expression : Array.isArray(e) ? `[${e.map((e) => B(e)).join(", ")}]` : e && typeof e == "object" ? `{ ${Object.entries(e).map(([e, t]) => `${JSON.stringify(e)}: ${B(t)}`).join(", ")} }` : JSON.stringify(e);
1408
- }
1409
1411
  function V(e) {
1410
- return `{ ${Object.entries(e).map(([e, t]) => `${JSON.stringify(e)}: ${B(t)}`).join(", ")} }`;
1412
+ return e instanceof B ? e.expression : Array.isArray(e) ? `[${e.map((e) => V(e)).join(", ")}]` : e && typeof e == "object" ? `{ ${Object.entries(e).map(([e, t]) => `${JSON.stringify(e)}: ${V(t)}`).join(", ")} }` : JSON.stringify(e);
1413
+ }
1414
+ function H(e) {
1415
+ return `{ ${Object.entries(e).map(([e, t]) => `${JSON.stringify(e)}: ${V(t)}`).join(", ")} }`;
1411
1416
  }
1412
1417
  function ot(e) {
1413
1418
  switch (e) {
@@ -1438,7 +1443,7 @@ function ot(e) {
1438
1443
  default: return;
1439
1444
  }
1440
1445
  }
1441
- function H(e, t) {
1446
+ function U(e, t) {
1442
1447
  return e.replace("[id]", `\${${t}}`);
1443
1448
  }
1444
1449
  function st(e, t, n) {
@@ -1464,9 +1469,9 @@ function st(e, t, n) {
1464
1469
  return e.maxSelect && e.maxSelect > 1 ? [t] : t;
1465
1470
  }
1466
1471
  case "relation": {
1467
- if (n.authEnabled && (e.isCurrentUser || e.relatedModel?.tableName === "users")) return new z("context.user.id");
1472
+ if (n.authEnabled && (e.isCurrentUser || e.relatedModel?.tableName === "users")) return new B("context.user.id");
1468
1473
  let r = e.collectionId ? t[e.collectionId] : void 0;
1469
- return r ? new z(r) : "missing-relation-id";
1474
+ return r ? new B(r) : "missing-relation-id";
1470
1475
  }
1471
1476
  case "file":
1472
1477
  case "autodate": return;
@@ -1478,7 +1483,7 @@ function ct(e, t, n) {
1478
1483
  for (let i of e) {
1479
1484
  if (i.type === "file" || i.type === "autodate") continue;
1480
1485
  if (n.authEnabled && i.type === "relation" && i.isCurrentUser) {
1481
- n.forForm || (r[i.name] = new z("context.user.id"));
1486
+ n.forForm || (r[i.name] = new B("context.user.id"));
1482
1487
  continue;
1483
1488
  }
1484
1489
  let e = st(i, t, n);
@@ -1493,7 +1498,7 @@ function lt(e, t, n) {
1493
1498
  let e = ot(i.type);
1494
1499
  if (!e || e === "file" || e === "autodate" || e === "relation" && !i.collectionId) continue;
1495
1500
  let a;
1496
- if (e === "relation") a = i.collectionId ? new z(t[i.collectionId] ?? "\"missing-relation-id\"") : void 0;
1501
+ if (e === "relation") a = i.collectionId ? new B(t[i.collectionId] ?? "\"missing-relation-id\"") : void 0;
1497
1502
  else if (e === "select") {
1498
1503
  let e = i.values?.[0] ?? "default";
1499
1504
  a = (i.maxSelect ?? 1) > 1 ? [e] : e;
@@ -1509,7 +1514,7 @@ function lt(e, t, n) {
1509
1514
  return r;
1510
1515
  }
1511
1516
  function ut(e) {
1512
- e.email = new z("`test-${Math.random().toString(36).slice(2)}@example.com`"), e.password = "password", e.passwordConfirm = "password";
1517
+ e.email = new B("`test-${Math.random().toString(36).slice(2)}@example.com`"), e.password = "password", e.passwordConfirm = "password";
1513
1518
  }
1514
1519
  function dt(e, t) {
1515
1520
  if (!e) return [];
@@ -1560,7 +1565,7 @@ function pt(e, t) {
1560
1565
  function mt(t, n, r, i) {
1561
1566
  let a = dt(i.find((e) => e.name === t.tableName) ?? pt(t, n), i).filter((e) => !(r.features.auth && e.name === "users")), o = {}, s = [], c = /* @__PURE__ */ new Set();
1562
1567
  for (let e of a) {
1563
- let t = ft(I(e.name, r).name, c);
1568
+ let t = ft(L(e.name, r).name, c);
1564
1569
  s.push({
1565
1570
  varName: t,
1566
1571
  collection: e
@@ -1568,7 +1573,7 @@ function mt(t, n, r, i) {
1568
1573
  }
1569
1574
  let l = s.length ? `${s.map((e) => `let ${e.varName}: { id: string };`).join("\n")}\n\n` : "", u = s.map(({ varName: e, collection: t }) => {
1570
1575
  let n = lt(t.fields, o, r);
1571
- return t.type === "auth" && ut(n), `${e} = await context.admin.collection("${t.name}").create(${V(n)});`;
1576
+ return t.type === "auth" && ut(n), `${e} = await context.admin.collection("${t.name}").create(${H(n)});`;
1572
1577
  }), d = s.slice().reverse().map(({ varName: e, collection: t }) => `await context.admin.collection("${t.name}").delete(${e}.id);`), f = r.features.auth ? "context.agent" : "context.request", p = r.features.auth ? "await context.agent.authenticateUser();\n " : "", m = "";
1573
1578
  return (u.length > 0 || r.features.auth) && (m += e`
1574
1579
  beforeEach(async (context) => {
@@ -1582,11 +1587,11 @@ function mt(t, n, r, i) {
1582
1587
  declarations: l,
1583
1588
  setupSection: m,
1584
1589
  requestAgent: f,
1585
- modelDbData: V(ct(n, o, {
1590
+ modelDbData: H(ct(n, o, {
1586
1591
  forForm: !1,
1587
1592
  authEnabled: r.features.auth
1588
1593
  })),
1589
- modelFormData: V(ct(n, o, {
1594
+ modelFormData: H(ct(n, o, {
1590
1595
  forForm: !0,
1591
1596
  authEnabled: r.features.auth
1592
1597
  }))
@@ -1627,7 +1632,7 @@ function ht(t, n, r, i, a) {
1627
1632
  describe("GET ${n.show}", () => {
1628
1633
  it("should return a 200 status code", async (context) => {
1629
1634
  const { id } = await context.admin.collection("${t.tableName}").create(${l});
1630
- const response = await ${c}.get(\`${H(n.show, "id")}\`);
1635
+ const response = await ${c}.get(\`${U(n.show, "id")}\`);
1631
1636
  expect(response.status).toBe(200);
1632
1637
  });
1633
1638
 
@@ -1640,10 +1645,10 @@ function ht(t, n, r, i, a) {
1640
1645
  describe("POST ${n.show}", () => {
1641
1646
  it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
1642
1647
  const { id } = await context.admin.collection("${t.tableName}").create(${l});
1643
- const response = await ${c}.post(\`${H(n.show, "id")}\`).type("form");
1648
+ const response = await ${c}.post(\`${U(n.show, "id")}\`).type("form");
1644
1649
  expect(response.body.status).toBe(303);
1645
1650
 
1646
- const response2 = await ${c}.get(\`${H(n.show, "id")}\`);
1651
+ const response2 = await ${c}.get(\`${U(n.show, "id")}\`);
1647
1652
  expect(response2.status).toBe(404);
1648
1653
  });
1649
1654
  });
@@ -1651,7 +1656,7 @@ function ht(t, n, r, i, a) {
1651
1656
  describe("GET ${n.edit}", () => {
1652
1657
  it("should return a 200 status code", async (context) => {
1653
1658
  const { id } = await context.admin.collection("${t.tableName}").create(${l});
1654
- const response = await ${c}.get(\`${H(n.edit, "id")}\`);
1659
+ const response = await ${c}.get(\`${U(n.edit, "id")}\`);
1655
1660
  expect(response.status).toBe(200);
1656
1661
  });
1657
1662
  });
@@ -1660,11 +1665,11 @@ function ht(t, n, r, i, a) {
1660
1665
  it("should update a ${t.displayName.toLowerCase()}", async (context) => {
1661
1666
  const { id } = await context.admin.collection("${t.tableName}").create(${l});
1662
1667
  const response = await ${c}
1663
- .post(\`${H(n.edit, "id")}\`)
1668
+ .post(\`${U(n.edit, "id")}\`)
1664
1669
  .type("form")
1665
1670
  .send(${u});
1666
1671
  expect(response.body.status).toBe(303);
1667
- expect(response.body.location).toBe(\`${H(n.show, "id")}\`);
1672
+ expect(response.body.location).toBe(\`${U(n.show, "id")}\`);
1668
1673
  });
1669
1674
  });
1670
1675
  });
@@ -1726,7 +1731,7 @@ var _t = ["text"], vt = {
1726
1731
  function yt(e) {
1727
1732
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e) ? e : `'${e}'`;
1728
1733
  }
1729
- function U(t, n) {
1734
+ function W(t, n) {
1730
1735
  let r = t.type === "select" ? `[${(t.options ?? []).map((e) => JSON.stringify(e.value)).join(", ")}]` : "", i;
1731
1736
  switch (t.type) {
1732
1737
  case "text":
@@ -1793,9 +1798,9 @@ async function bt(e) {
1793
1798
  let { getPreviewCollections: t } = await import("./chunks/env.preview-Cpr4Im0G.js");
1794
1799
  return t(e);
1795
1800
  }
1796
- async function W(e, t, n) {
1801
+ async function G(e, t, n) {
1797
1802
  Re(t);
1798
- let r = I(t, e), i = await bt(e);
1803
+ let r = L(t, e), i = await bt(e);
1799
1804
  if (n.length > 0) {
1800
1805
  let { fields: t, auth: a } = it(n, r, i, e);
1801
1806
  return {
@@ -1814,18 +1819,18 @@ async function W(e, t, n) {
1814
1819
  collections: i
1815
1820
  };
1816
1821
  }
1817
- function G(t, n, r) {
1822
+ function K(t, n, r) {
1818
1823
  let i = [];
1819
1824
  r.includeModelFields && (i.push({
1820
1825
  name: "id",
1821
- schema: U({
1826
+ schema: W({
1822
1827
  name: "id",
1823
1828
  type: "text",
1824
1829
  required: !1
1825
1830
  }, r)
1826
1831
  }), i.push({
1827
1832
  name: "collectionId",
1828
- schema: U({
1833
+ schema: W({
1829
1834
  name: "collectionId",
1830
1835
  type: "text",
1831
1836
  required: !1
@@ -1835,7 +1840,7 @@ function G(t, n, r) {
1835
1840
  if (e.type === "file" && e.maxSelect > 1) {
1836
1841
  i.push({
1837
1842
  name: e.name,
1838
- schema: U({
1843
+ schema: W({
1839
1844
  ...e,
1840
1845
  required: !1
1841
1846
  }, r)
@@ -1850,7 +1855,7 @@ function G(t, n, r) {
1850
1855
  }
1851
1856
  i.push({
1852
1857
  name: e.name,
1853
- schema: U(e, r)
1858
+ schema: W(e, r)
1854
1859
  });
1855
1860
  }
1856
1861
  let a = i.map((e) => `${yt(e.name)}: ${e.schema}`).join(",\n "), o = r.includeModelFields ? "\nimport type { Schemas } from \"pocketbase-svelte\";" : "", s = r.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
@@ -1873,11 +1878,11 @@ function St(e, t, n) {
1873
1878
  let i = Ke(t), a = new Map(t.map((e) => [e.id, e])), o = [];
1874
1879
  for (let t of r.fields) {
1875
1880
  if (t.name === "id" || t.system) continue;
1876
- let r = xt(t.type), s = !!t.required, c = A(t.name);
1881
+ let r = xt(t.type), s = !!t.required, c = j(t.name);
1877
1882
  if (r === "relation") {
1878
1883
  let r = t.collectionId ? a.get(t.collectionId) : void 0;
1879
1884
  if (!r) continue;
1880
- let l = I(r.name, n);
1885
+ let l = L(r.name, n);
1881
1886
  o.push({
1882
1887
  name: t.name,
1883
1888
  title: c,
@@ -1887,8 +1892,8 @@ function St(e, t, n) {
1887
1892
  maxSelect: t.maxSelect ?? 1,
1888
1893
  displayField: i[r.name] ?? "id",
1889
1894
  relatedModel: l,
1890
- singularRelationName: k(`${e.displayName} ${l.displayName}`),
1891
- pluralRelationName: k(`${e.displayName} ${l.pluralDisplayName}`),
1895
+ singularRelationName: A(`${e.displayName} ${l.displayName}`),
1896
+ pluralRelationName: A(`${e.displayName} ${l.pluralDisplayName}`),
1892
1897
  isCurrentUser: n.features.auth && r.name === "users" && /user|owner|author/i.test(t.name)
1893
1898
  });
1894
1899
  continue;
@@ -1986,7 +1991,7 @@ function Et(e, t, n) {
1986
1991
  }
1987
1992
  //#endregion
1988
1993
  //#region \0@oxc-project+runtime@0.124.0/helpers/taggedTemplateLiteral.js
1989
- function K(e, t) {
1994
+ function q(e, t) {
1990
1995
  return t ||= e.slice(0), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } }));
1991
1996
  }
1992
1997
  //#endregion
@@ -2001,8 +2006,8 @@ function Ot(e, t) {
2001
2006
  }
2002
2007
  function kt(e) {
2003
2008
  let [t, ...n] = e;
2004
- if (!t) throw Error("Invalid command arguments. Expected: <model> <fields...>");
2005
- if (n.length === 0) throw Error("At least one field definition is required.");
2009
+ if (!t) throw new y("Invalid command arguments. Expected: <model> <fields...>");
2010
+ if (n.length === 0) throw new y("At least one field definition is required.");
2006
2011
  return {
2007
2012
  modelPath: t,
2008
2013
  fieldDefs: n
@@ -2012,12 +2017,12 @@ function At(e) {
2012
2017
  return e.some((e) => e.type === "file");
2013
2018
  }
2014
2019
  function jt(e, t) {
2015
- let n = T(t), r = [
2020
+ let n = E(t), r = [
2016
2021
  "import { untrack } from \"svelte\";",
2017
2022
  "import { superForm } from \"sveltekit-superforms\";",
2018
2023
  "import { zod4Client } from \"sveltekit-superforms/adapters\";",
2019
2024
  `import { ${e.schemaName} } from "$lib/schemas/${e.name}";`,
2020
- ...E(n)
2025
+ ...D(n)
2021
2026
  ];
2022
2027
  return [...new Set(r)];
2023
2028
  }
@@ -2033,8 +2038,8 @@ function Mt(t, n) {
2033
2038
  `;
2034
2039
  }
2035
2040
  function Nt(t, n) {
2036
- let r = jt(t, n).join("\n"), i = Mt(t, n), a = n.map((e) => w(e)).join("\n"), o = At(n) ? " enctype=\"multipart/form-data\"" : "";
2037
- return e(Dt ||= K([
2041
+ let r = jt(t, n).join("\n"), i = Mt(t, n), a = n.map((e) => T(e)).join("\n"), o = At(n) ? " enctype=\"multipart/form-data\"" : "";
2042
+ return e(Dt ||= q([
2038
2043
  "\n <script lang=\"ts\">\n ",
2039
2044
  "\n\n let { data } = $props();\n ",
2040
2045
  "\n <\/script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">",
@@ -2073,28 +2078,29 @@ function Pt(t, n) {
2073
2078
  };
2074
2079
  `;
2075
2080
  }
2076
- function q(e, n) {
2081
+ function J(e, n) {
2077
2082
  return {
2078
2083
  path: e,
2079
2084
  language: t(e),
2080
- content: n
2085
+ content: n,
2086
+ status: "success"
2081
2087
  };
2082
2088
  }
2083
2089
  async function Ft(e) {
2084
- let { modelPath: t, fieldDefs: n } = kt(e.argv), { model: r, fields: i, collections: a } = await W(e, t, n), { pagePath: o, pageUrl: s } = Ot(t, r.routesDir);
2090
+ let { modelPath: t, fieldDefs: n } = kt(e.argv), { model: r, fields: i, collections: a } = await G(e, t, n), { pagePath: o, pageUrl: s } = Ot(t, r.routesDir);
2085
2091
  return {
2086
2092
  creates: [
2087
- q(`${o}/+page.svelte`, Nt(r, i)),
2088
- q(`${o}/+page.server.ts`, Pt(r, i)),
2089
- q(`${o}/server.test.ts`, gt(r, s, i, e, a)),
2090
- q(`src/lib/schemas/${r.name}.ts`, G(r, i, {
2093
+ J(`${o}/+page.svelte`, Nt(r, i)),
2094
+ J(`${o}/+page.server.ts`, Pt(r, i)),
2095
+ J(`${o}/server.test.ts`, gt(r, s, i, e, a)),
2096
+ J(`src/lib/schemas/${r.name}.ts`, K(r, i, {
2091
2097
  includeModelFields: !1,
2092
2098
  forForm: !0
2093
2099
  }))
2094
2100
  ],
2095
2101
  modifies: [],
2096
2102
  deletes: [],
2097
- components: T(i),
2103
+ components: E(i),
2098
2104
  packages: [],
2099
2105
  collections: []
2100
2106
  };
@@ -2104,9 +2110,9 @@ async function Ft(e) {
2104
2110
  var It = "generate-form", Lt = "1.0.7", Rt = "src/patterns/generate/form", zt = "/generate/form";
2105
2111
  async function Bt(e) {
2106
2112
  let t = await Ft(e);
2107
- if (e.env !== "runtime") return y(t);
2108
- let { writeResult: n } = await import("./chunks/write-result-CSxmq40z.js");
2109
- return n(await y(t), e);
2113
+ if (e.env !== "runtime") return b(t);
2114
+ let { writeResult: n } = await import("./chunks/write-result-DhQIE6kA.js");
2115
+ return n(await b(t), e);
2110
2116
  }
2111
2117
  var Vt = {
2112
2118
  version: Lt,
@@ -2149,7 +2155,7 @@ var Vt = {
2149
2155
  //#region src/patterns/generate/resource/generate.ts
2150
2156
  function Ht(e) {
2151
2157
  let [t, ...n] = e;
2152
- if (!t) throw Error("Invalid command arguments. Expected: <model> [fields...]");
2158
+ if (!t) throw new y("Invalid command arguments. Expected: <model> [fields...]");
2153
2159
  return {
2154
2160
  modelPath: t,
2155
2161
  fields: n
@@ -2159,13 +2165,14 @@ function Ut(e, n) {
2159
2165
  return {
2160
2166
  path: e,
2161
2167
  language: t(e),
2162
- content: n
2168
+ content: n,
2169
+ status: "success"
2163
2170
  };
2164
2171
  }
2165
2172
  async function Wt(e) {
2166
- let { modelPath: t, fields: n } = Ht(e.argv), { model: r, fields: i, auth: a, shouldCreateCollection: o } = await W(e, t, n);
2173
+ let { modelPath: t, fields: n } = Ht(e.argv), { model: r, fields: i, auth: a, shouldCreateCollection: o } = await G(e, t, n);
2167
2174
  return {
2168
- creates: [Ut(`src/lib/schemas/${r.name}.ts`, G(r, i, {
2175
+ creates: [Ut(`src/lib/schemas/${r.name}.ts`, K(r, i, {
2169
2176
  includeModelFields: !0,
2170
2177
  forForm: !0
2171
2178
  }))],
@@ -2181,12 +2188,12 @@ async function Wt(e) {
2181
2188
  var Gt = "generate-resource", Kt = "1.0.7", qt = "src/patterns/generate/resource", Jt = "/generate/resource";
2182
2189
  async function Yt(e) {
2183
2190
  let t = await Wt(e);
2184
- if (e.env !== "runtime") return y(t);
2185
- let { createCollections: n } = await import("./chunks/collections-Bzyt18yv.js"), r = await n(t.collections, e), i = {
2191
+ if (e.env !== "runtime") return b(t);
2192
+ let { createCollections: n } = await import("./chunks/collections-DdGJC7Ip.js"), r = await n(t.collections, e), i = {
2186
2193
  ...t,
2187
2194
  creates: [...t.creates, ...r]
2188
- }, { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
2189
- return a(await y(i), e);
2195
+ }, { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
2196
+ return a(await b(i), e);
2190
2197
  }
2191
2198
  var Xt = {
2192
2199
  version: Kt,
@@ -2225,26 +2232,27 @@ var Xt = {
2225
2232
  }, Zt, Qt, $t, en;
2226
2233
  function tn(e) {
2227
2234
  let [t, ...n] = e;
2228
- if (!t) throw Error("Invalid command arguments. Expected: <model> [fields...]");
2235
+ if (!t) throw new y("Invalid command arguments. Expected: <model> [fields...]");
2229
2236
  return {
2230
2237
  modelPath: t,
2231
2238
  fields: n
2232
2239
  };
2233
2240
  }
2234
- function J(e, n) {
2241
+ function Y(e, n) {
2235
2242
  return {
2236
2243
  path: e,
2237
2244
  language: t(e),
2238
- content: n
2245
+ content: n,
2246
+ status: "success"
2239
2247
  };
2240
2248
  }
2241
- function Y(e) {
2249
+ function X(e) {
2242
2250
  return e.some((e) => e.type === "file");
2243
2251
  }
2244
2252
  function nn(e) {
2245
2253
  return [...new Set(e.filter(Boolean))];
2246
2254
  }
2247
- function X(e) {
2255
+ function Z(e) {
2248
2256
  return e.filter((e) => e.type === "select").map((e) => pe(e)).join("\n\n");
2249
2257
  }
2250
2258
  function rn(e, t) {
@@ -2258,7 +2266,7 @@ function on(e) {
2258
2266
  }
2259
2267
  function sn(t, n, r = !1) {
2260
2268
  return e`
2261
- ${X(n)}
2269
+ ${Z(n)}
2262
2270
  ${r ? "let { data, params } = $props();" : "let { data } = $props();"}
2263
2271
 
2264
2272
  const form = superForm(untrack(() => data.form), {
@@ -2274,13 +2282,13 @@ function cn(t, n, r) {
2274
2282
  "import { superForm } from \"sveltekit-superforms\";",
2275
2283
  "import { zod4Client } from \"sveltekit-superforms/adapters\";",
2276
2284
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2277
- ...E(T(r)),
2285
+ ...D(E(r)),
2278
2286
  "import { Button } from \"$lib/components/ui/button\";",
2279
2287
  "import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";",
2280
2288
  "import * as Form from \"$lib/components/ui/form\";",
2281
2289
  i ? "import type { Models } from \"pocketbase-svelte\";" : ""
2282
- ]).join("\n"), o = r.map((e) => w(e)).join("\n"), s = Y(r) ? " enctype=\"multipart/form-data\"" : "";
2283
- return e(Zt ||= K([
2290
+ ]).join("\n"), o = r.map((e) => T(e)).join("\n"), s = X(r) ? " enctype=\"multipart/form-data\"" : "";
2291
+ return e(Zt ||= q([
2284
2292
  "\n <script lang=\"ts\">\n ",
2285
2293
  "\n ",
2286
2294
  "\n <\/script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">New ",
@@ -2297,13 +2305,13 @@ function ln(t, n, r) {
2297
2305
  "import { superForm } from \"sveltekit-superforms\";",
2298
2306
  "import { zod4Client } from \"sveltekit-superforms/adapters\";",
2299
2307
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2300
- ...E(T(r)),
2308
+ ...D(E(r)),
2301
2309
  "import { Button } from \"$lib/components/ui/button\";",
2302
2310
  "import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";",
2303
2311
  "import * as Form from \"$lib/components/ui/form\";",
2304
2312
  i ? "import type { Models } from \"pocketbase-svelte\";" : ""
2305
- ]).join("\n"), o = r.map((e) => w(e)).join("\n"), s = Y(r) ? " enctype=\"multipart/form-data\"" : "";
2306
- return e(Qt ||= K([
2313
+ ]).join("\n"), o = r.map((e) => T(e)).join("\n"), s = X(r) ? " enctype=\"multipart/form-data\"" : "";
2314
+ return e(Qt ||= q([
2307
2315
  "\n <script lang=\"ts\">\n ",
2308
2316
  "\n ",
2309
2317
  "\n <\/script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">Edit ",
@@ -2324,7 +2332,7 @@ function ln(t, n, r) {
2324
2332
  ]), a, sn(t, r, !0), t.displayName.toLowerCase(), n.list, s, o, n.list);
2325
2333
  }
2326
2334
  function un(t, n, r) {
2327
- let i = r.some((e) => e.type === "select"), a = i ? `${X(r)}` : "", o = r.map((t) => {
2335
+ let i = r.some((e) => e.type === "select"), a = i ? `${Z(r)}` : "", o = r.map((t) => {
2328
2336
  let n = "{ getValue }", r = "{ value: getValue() }";
2329
2337
  return t.type === "relation" && (n = "{ getValue, row }", r = `{ value: getValue(), expanded: row.original.expand?.${t.name}, displayField: "${t.displayField}" }`), t.type === "select" && (r = `{ value: getValue(), options: ${t.name}Labels }`), t.type === "file" && (n = "{ getValue, row }", r = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), e`
2330
2338
  columnHelper.accessor("${t.name}", {
@@ -2333,7 +2341,7 @@ function un(t, n, r) {
2333
2341
  })
2334
2342
  `;
2335
2343
  }).join(",\n"), s = r.filter((e) => e.type === "select").map((e) => `<FacetedFilter column={table.getColumn("${e.name}")!} title="${e.title}" options={Object.values(${e.name}Labels)} />`).join("\n");
2336
- return e($t ||= K([
2344
+ return e($t ||= q([
2337
2345
  "\n <script lang=\"ts\">\n import {\n type ColumnFiltersState,\n type PaginationState,\n type RowSelectionState,\n type SortingState,\n type VisibilityState,\n getCoreRowModel,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n createColumnHelper\n } from \"@tanstack/table-core\";\n import { createSvelteTable, FlexRender, renderComponent } from \"$lib/components/ui/data-table\";\n import * as Table from \"$lib/components/ui/table\";\n import { Checkbox } from \"$lib/components/ui/checkbox\";\n import { ColumnHeader } from \"$lib/components/ui/column-header\";\n import { Pagination } from \"$lib/components/ui/pagination\";\n import { RowActions } from \"$lib/components/ui/row-actions\";\n import * as Cells from \"$lib/components/ui/cells\";\n import { Button } from \"$lib/components/ui/button\";\n import { Input } from \"$lib/components/ui/input\";\n ",
2338
2346
  "\n import XIcon from \"@lucide/svelte/icons/x\";\n import PlusIcon from \"@lucide/svelte/icons/plus\";\n import type { Models } from \"pocketbase-svelte\";\n\n let { data } = $props();\n let rowSelection = $state<RowSelectionState>({});\n let columnVisibility = $state<VisibilityState>({});\n let columnFilters = $state<ColumnFiltersState>([]);\n let sorting = $state<SortingState>([]);\n let pagination = $state<PaginationState>({ pageIndex: 0, pageSize: 10 });\n\n ",
2339
2347
  "\n\n const columnHelper = createColumnHelper<Models[\"",
@@ -2342,7 +2350,7 @@ function un(t, n, r) {
2342
2350
  "\n columnHelper.display({\n id: \"actions\",\n cell: ({ row }) =>\n renderComponent(RowActions, {\n viewPath: `",
2343
2351
  "/${row.original.id}`,\n editPath: `",
2344
2352
  "/${row.original.id}/edit`,\n deletePath: `",
2345
- "/${row.original.id}`\n })\n meta: { class: \"w-0 text-right\" },\n })\n ];\n\n const table = createSvelteTable({\n get data() {\n return data.",
2353
+ "/${row.original.id}`\n }),\n meta: { class: \"w-0 text-right\" },\n })\n ];\n\n const table = createSvelteTable({\n get data() {\n return data.",
2346
2354
  ";\n },\n state: {\n get sorting() {\n return sorting;\n },\n get columnVisibility() {\n return columnVisibility;\n },\n get rowSelection() {\n return rowSelection;\n },\n get columnFilters() {\n return columnFilters;\n },\n get pagination() {\n return pagination;\n }\n },\n columns,\n enableRowSelection: true,\n onRowSelectionChange: (updater) => {\n rowSelection = typeof updater === \"function\" ? updater(rowSelection) : updater;\n },\n onSortingChange: (updater) => {\n sorting = typeof updater === \"function\" ? updater(sorting) : updater;\n },\n onColumnFiltersChange: (updater) => {\n columnFilters = typeof updater === \"function\" ? updater(columnFilters) : updater;\n },\n onColumnVisibilityChange: (updater) => {\n columnVisibility = typeof updater === \"function\" ? updater(columnVisibility) : updater;\n },\n onPaginationChange: (updater) => {\n pagination = typeof updater === \"function\" ? updater(pagination) : updater;\n },\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFacetedRowModel: getFacetedRowModel(),\n getFacetedUniqueValues: getFacetedUniqueValues()\n });\n <\/script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">",
2347
2355
  "</h1>\n </div>\n\n <div class=\"space-y-4\">\n <div class=\"flex items-center justify-between\">\n <div class=\"flex flex-1 items-center space-x-2\">\n <Input\n placeholder=\"Filter ",
2348
2356
  "...\"\n value={(table.getColumn(\"name\")?.getFilterValue() as string) ?? \"\"}\n oninput={(e) => {\n table.getColumn(\"name\")?.setFilterValue(e.currentTarget.value);\n }}\n onchange={(e) => {\n table.getColumn(\"name\")?.setFilterValue(e.currentTarget.value);\n }}\n class=\"h-8 w-[150px] lg:w-[250px]\"\n />\n ",
@@ -2358,7 +2366,7 @@ function un(t, n, r) {
2358
2366
  "\n columnHelper.display({\n id: \"actions\",\n cell: ({ row }) =>\n renderComponent(RowActions, {\n viewPath: \\`",
2359
2367
  "/\\${row.original.id}\\`,\n editPath: \\`",
2360
2368
  "/\\${row.original.id}/edit\\`,\n deletePath: \\`",
2361
- "/\\${row.original.id}\\`\n })\n meta: { class: \"w-0 text-right\" },\n })\n ];\n\n const table = createSvelteTable({\n get data() {\n return data.",
2369
+ "/\\${row.original.id}\\`\n }),\n meta: { class: \"w-0 text-right\" },\n })\n ];\n\n const table = createSvelteTable({\n get data() {\n return data.",
2362
2370
  ";\n },\n state: {\n get sorting() {\n return sorting;\n },\n get columnVisibility() {\n return columnVisibility;\n },\n get rowSelection() {\n return rowSelection;\n },\n get columnFilters() {\n return columnFilters;\n },\n get pagination() {\n return pagination;\n }\n },\n columns,\n enableRowSelection: true,\n onRowSelectionChange: (updater) => {\n rowSelection = typeof updater === \"function\" ? updater(rowSelection) : updater;\n },\n onSortingChange: (updater) => {\n sorting = typeof updater === \"function\" ? updater(sorting) : updater;\n },\n onColumnFiltersChange: (updater) => {\n columnFilters = typeof updater === \"function\" ? updater(columnFilters) : updater;\n },\n onColumnVisibilityChange: (updater) => {\n columnVisibility = typeof updater === \"function\" ? updater(columnVisibility) : updater;\n },\n onPaginationChange: (updater) => {\n pagination = typeof updater === \"function\" ? updater(pagination) : updater;\n },\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFacetedRowModel: getFacetedRowModel(),\n getFacetedUniqueValues: getFacetedUniqueValues()\n });\n <\/script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">",
2363
2371
  "</h1>\n </div>\n\n <div class=\"space-y-4\">\n <div class=\"flex items-center justify-between\">\n <div class=\"flex flex-1 items-center space-x-2\">\n <Input\n placeholder=\"Filter ",
2364
2372
  "...\"\n value={(table.getColumn(\"name\")?.getFilterValue() as string) ?? \"\"}\n oninput={(e) => {\n table.getColumn(\"name\")?.setFilterValue(e.currentTarget.value);\n }}\n onchange={(e) => {\n table.getColumn(\"name\")?.setFilterValue(e.currentTarget.value);\n }}\n class=\"h-8 w-[150px] lg:w-[250px]\"\n />\n ",
@@ -2377,7 +2385,7 @@ function dn(t, n, r) {
2377
2385
  `;
2378
2386
  }
2379
2387
  function fn(t, n, r, i, a) {
2380
- let o = Y(r), s = rn(r, i), c = an(r), l = c ? `, ${c}` : "", u = r.find((e) => e.type === "relation" && e.isCurrentUser), d = a && u ? e`
2388
+ let o = X(r), s = rn(r, i), c = an(r), l = c ? `, ${c}` : "", u = r.find((e) => e.type === "relation" && e.isCurrentUser), d = a && u ? e`
2381
2389
  {
2382
2390
  ...form.data,
2383
2391
  ${u.name}: locals.pb.authStore.record?.id
@@ -2448,8 +2456,8 @@ function mn(t, n, r) {
2448
2456
  i || a ? "import { Badge } from \"$lib/components/ui/badge\";" : "",
2449
2457
  a ? "import CircleArrowRightIcon from \"@lucide/svelte/icons/circle-arrow-right\";" : "",
2450
2458
  o ? "import FileIcon from \"@lucide/svelte/icons/file\";" : ""
2451
- ].filter(Boolean).join("\n"), c = X(r), l = r.map((e) => xe(t, e)).join("\n");
2452
- return e(en ||= K([
2459
+ ].filter(Boolean).join("\n"), c = Z(r), l = r.map((e) => xe(t, e)).join("\n");
2460
+ return e(en ||= q([
2453
2461
  "\n <script lang=\"ts\">\n ",
2454
2462
  "\n ",
2455
2463
  "\n\n let { data } = $props();\n <\/script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">",
@@ -2461,7 +2469,7 @@ function mn(t, n, r) {
2461
2469
  ]), s, c, t.displayName, n.list, l, n.list, t.name);
2462
2470
  }
2463
2471
  function hn(t, n, r, i) {
2464
- let a = Y(r), o = rn(r, i), s = an(r), c = s ? `, ${s}` : "";
2472
+ let a = X(r), o = rn(r, i), s = an(r), c = s ? `, ${s}` : "";
2465
2473
  return e`
2466
2474
  import { error, fail, redirect } from "@sveltejs/kit";
2467
2475
  import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
@@ -2503,22 +2511,22 @@ function hn(t, n, r, i) {
2503
2511
  `;
2504
2512
  }
2505
2513
  async function gn(e) {
2506
- let { modelPath: t, fields: n } = tn(e.argv), { model: r, fields: i, auth: a, shouldCreateCollection: o, collections: s } = await W(e, t, n), c = Be(r), l = Ve(r), u = on(e), d = i.filter((e) => !(e.type === "relation" && e.isCurrentUser)), f = [
2507
- J(`src/lib/schemas/${r.name}.ts`, G(r, i, {
2514
+ let { modelPath: t, fields: n } = tn(e.argv), { model: r, fields: i, auth: a, shouldCreateCollection: o, collections: s } = await G(e, t, n), c = Be(r), l = Ve(r), u = on(e), d = i.filter((e) => !(e.type === "relation" && e.isCurrentUser)), f = [
2515
+ Y(`src/lib/schemas/${r.name}.ts`, K(r, i, {
2508
2516
  includeModelFields: !0,
2509
2517
  forForm: !0
2510
2518
  })),
2511
- J(`${c.list}/+page.server.ts`, dn(r, d, u)),
2512
- J(`${c.list}/+page.svelte`, un(r, l, d)),
2513
- J(`${c.new}/+page.server.ts`, fn(r, l, d, u, e.features.auth)),
2514
- J(`${c.new}/+page.svelte`, cn(r, l, d)),
2515
- J(`${c.show}/+page.server.ts`, pn(r, l, d, u)),
2516
- J(`${c.show}/+page.svelte`, mn(r, l, d)),
2517
- J(`${c.edit}/+page.server.ts`, hn(r, l, d, u)),
2518
- J(`${c.edit}/+page.svelte`, ln(r, l, d)),
2519
- J(`${c.list}/server.test.ts`, ht(r, l, i, e, s))
2519
+ Y(`${c.list}/+page.server.ts`, dn(r, d, u)),
2520
+ Y(`${c.list}/+page.svelte`, un(r, l, d)),
2521
+ Y(`${c.new}/+page.server.ts`, fn(r, l, d, u, e.features.auth)),
2522
+ Y(`${c.new}/+page.svelte`, cn(r, l, d)),
2523
+ Y(`${c.show}/+page.server.ts`, pn(r, l, d, u)),
2524
+ Y(`${c.show}/+page.svelte`, mn(r, l, d)),
2525
+ Y(`${c.edit}/+page.server.ts`, hn(r, l, d, u)),
2526
+ Y(`${c.edit}/+page.svelte`, ln(r, l, d)),
2527
+ Y(`${c.list}/server.test.ts`, ht(r, l, i, e, s))
2520
2528
  ], p = [
2521
- ...T(d),
2529
+ ...E(d),
2522
2530
  "button",
2523
2531
  "table",
2524
2532
  "data-table",
@@ -2549,12 +2557,12 @@ async function gn(e) {
2549
2557
  var _n = "generate-scaffold", vn = "1.0.7", yn = "src/patterns/generate/scaffold", bn = "/generate/scaffold";
2550
2558
  async function xn(e) {
2551
2559
  let t = await gn(e);
2552
- if (e.env !== "runtime") return y(t);
2553
- let { createCollections: n } = await import("./chunks/collections-Bzyt18yv.js"), r = await n(t.collections, e), i = {
2560
+ if (e.env !== "runtime") return b(t);
2561
+ let { createCollections: n } = await import("./chunks/collections-DdGJC7Ip.js"), r = await n(t.collections, e), i = {
2554
2562
  ...t,
2555
2563
  creates: [...t.creates, ...r]
2556
- }, { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
2557
- return a(await y(i), e);
2564
+ }, { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
2565
+ return a(await b(i), e);
2558
2566
  }
2559
2567
  var Sn = {
2560
2568
  version: vn,
@@ -2588,7 +2596,7 @@ var Sn = {
2588
2596
  "email:email"
2589
2597
  ]
2590
2598
  },
2591
- tests: 7,
2599
+ tests: 8,
2592
2600
  baseline: "velastack",
2593
2601
  generate: xn
2594
2602
  };
@@ -2596,7 +2604,7 @@ var Sn = {
2596
2604
  //#region src/patterns/generate/schema/generate.ts
2597
2605
  function Cn(e) {
2598
2606
  let [t, ...n] = e;
2599
- if (!t) throw Error("Invalid command arguments. Expected: <model> [fields...]");
2607
+ if (!t) throw new y("Invalid command arguments. Expected: <model> [fields...]");
2600
2608
  return {
2601
2609
  modelPath: t,
2602
2610
  fields: n
@@ -2606,13 +2614,14 @@ function wn(e, n) {
2606
2614
  return {
2607
2615
  path: e,
2608
2616
  language: t(e),
2609
- content: n
2617
+ content: n,
2618
+ status: "success"
2610
2619
  };
2611
2620
  }
2612
2621
  async function Tn(e) {
2613
- let { modelPath: t, fields: n } = Cn(e.argv), { model: r, fields: i, shouldCreateCollection: a } = await W(e, t, n);
2622
+ let { modelPath: t, fields: n } = Cn(e.argv), { model: r, fields: i, shouldCreateCollection: a } = await G(e, t, n);
2614
2623
  return {
2615
- creates: [wn(`src/lib/schemas/${r.name}.ts`, G(r, i, {
2624
+ creates: [wn(`src/lib/schemas/${r.name}.ts`, K(r, i, {
2616
2625
  includeModelFields: !a,
2617
2626
  forForm: !0
2618
2627
  }))],
@@ -2628,9 +2637,9 @@ async function Tn(e) {
2628
2637
  var En = "generate-schema", Dn = "1.0.7", On = "src/patterns/generate/schema", kn = "/generate/schema";
2629
2638
  async function An(e) {
2630
2639
  let t = await Tn(e);
2631
- if (e.env !== "runtime") return y(t);
2632
- let { writeResult: n } = await import("./chunks/write-result-CSxmq40z.js");
2633
- return n(await y(t), e);
2640
+ if (e.env !== "runtime") return b(t);
2641
+ let { writeResult: n } = await import("./chunks/write-result-DhQIE6kA.js");
2642
+ return n(await b(t), e);
2634
2643
  }
2635
2644
  var jn = {
2636
2645
  version: Dn,
@@ -2715,7 +2724,8 @@ async function Pn(e) {
2715
2724
  return {
2716
2725
  path: i,
2717
2726
  language: t(i),
2718
- content: n
2727
+ content: n,
2728
+ status: "success"
2719
2729
  };
2720
2730
  }).sort((e, t) => e.path.localeCompare(t.path)), i = [
2721
2731
  "sidebar",
@@ -2815,7 +2825,8 @@ async function Ln(e) {
2815
2825
  return {
2816
2826
  path: i,
2817
2827
  language: t(i),
2818
- content: n
2828
+ content: n,
2829
+ status: "success"
2819
2830
  };
2820
2831
  }).sort((e, t) => e.path.localeCompare(t.path)),
2821
2832
  deletes: [],
@@ -2829,9 +2840,9 @@ async function Ln(e) {
2829
2840
  var Rn = "enable-auth", zn = "1.0.7", Bn = "src/patterns/enable/auth", Vn = "/enable/auth";
2830
2841
  async function Hn(e) {
2831
2842
  let t = await Pn(e);
2832
- if (e.env === "preview") return y(n([t, await Ln(e)]));
2833
- let { generate: r } = await import("./chunks/generate.runtime-DXkJgkP4.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
2834
- return a(await y(n([t, i])), e);
2843
+ if (e.env === "preview") return b(n([t, await Ln(e)]));
2844
+ let { generate: r } = await import("./chunks/generate.runtime-Bt6kbkWX.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
2845
+ return a(await b(n([t, i])), e);
2835
2846
  }
2836
2847
  var Un = {
2837
2848
  version: zn,
@@ -2874,7 +2885,8 @@ async function Kn(e) {
2874
2885
  return {
2875
2886
  path: i,
2876
2887
  language: t(i),
2877
- content: n
2888
+ content: n,
2889
+ status: "success"
2878
2890
  };
2879
2891
  }).sort((e, t) => e.path.localeCompare(t.path)),
2880
2892
  modifies: [],
@@ -2895,7 +2907,8 @@ async function Yn(e) {
2895
2907
  return {
2896
2908
  path: i,
2897
2909
  language: t(i),
2898
- content: n
2910
+ content: n,
2911
+ status: "success"
2899
2912
  };
2900
2913
  }).sort((e, t) => e.path.localeCompare(t.path)),
2901
2914
  deletes: [],
@@ -2909,9 +2922,9 @@ async function Yn(e) {
2909
2922
  var Xn = "enable-api", Zn = "1.0.7", Qn = "src/patterns/enable/api", $n = "/enable/api";
2910
2923
  async function er(e) {
2911
2924
  let t = await Kn(e);
2912
- if (e.env === "preview") return y(n([t, await Yn(e)]));
2913
- let { generate: r } = await import("./chunks/generate.runtime-egq8I3EA.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
2914
- return a(await y(n([t, i])), e);
2925
+ if (e.env === "preview") return b(n([t, await Yn(e)]));
2926
+ let { generate: r } = await import("./chunks/generate.runtime-BtGvtuWm.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
2927
+ return a(await b(n([t, i])), e);
2915
2928
  }
2916
2929
  var tr = {
2917
2930
  version: Zn,
@@ -2964,7 +2977,8 @@ async function ir(e) {
2964
2977
  return {
2965
2978
  path: i,
2966
2979
  language: t(i),
2967
- content: n
2980
+ content: n,
2981
+ status: "success"
2968
2982
  };
2969
2983
  }).sort((e, t) => e.path.localeCompare(t.path)),
2970
2984
  modifies: [],
@@ -2989,7 +3003,8 @@ async function sr(e) {
2989
3003
  return {
2990
3004
  path: i,
2991
3005
  language: t(i),
2992
- content: n
3006
+ content: n,
3007
+ status: "success"
2993
3008
  };
2994
3009
  }).sort((e, t) => e.path.localeCompare(t.path)),
2995
3010
  deletes: [],
@@ -3003,9 +3018,9 @@ async function sr(e) {
3003
3018
  var cr = "enable-api-keys", lr = "1.0.0", ur = "src/patterns/enable/api-keys", dr = "/enable/api-keys";
3004
3019
  async function fr(e) {
3005
3020
  let t = await ir(e);
3006
- if (e.env === "preview") return y(n([t, await sr(e)]));
3007
- let { generate: r } = await import("./chunks/generate.runtime-CHmm4bBZ.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
3008
- return a(await y(n([t, i])), e);
3021
+ if (e.env === "preview") return b(n([t, await sr(e)]));
3022
+ let { generate: r } = await import("./chunks/generate.runtime-DiJDMdAq.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
3023
+ return a(await b(n([t, i])), e);
3009
3024
  }
3010
3025
  var pr = {
3011
3026
  version: lr,
@@ -3052,7 +3067,8 @@ async function gr(e) {
3052
3067
  return {
3053
3068
  path: i,
3054
3069
  language: t(i),
3055
- content: n
3070
+ content: n,
3071
+ status: "success"
3056
3072
  };
3057
3073
  }).sort((e, t) => e.path.localeCompare(t.path)),
3058
3074
  modifies: [],
@@ -3079,7 +3095,8 @@ async function yr(e) {
3079
3095
  return {
3080
3096
  path: i,
3081
3097
  language: t(i),
3082
- content: n
3098
+ content: n,
3099
+ status: "success"
3083
3100
  };
3084
3101
  }).sort((e, t) => e.path.localeCompare(t.path)),
3085
3102
  deletes: [],
@@ -3093,9 +3110,9 @@ async function yr(e) {
3093
3110
  var br = "enable-i18n", xr = "1.0.0", Sr = "src/patterns/enable/i18n", Cr = "/enable/i18n";
3094
3111
  async function wr(e) {
3095
3112
  let t = await gr(e);
3096
- if (e.env === "preview") return y(n([t, await yr(e)]));
3097
- let { generate: r } = await import("./chunks/generate.runtime-BEuc5hDN.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
3098
- return a(await y(n([t, i])), e);
3113
+ if (e.env === "preview") return b(n([t, await yr(e)]));
3114
+ let { generate: r } = await import("./chunks/generate.runtime-CcKMIm9M.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
3115
+ return a(await b(n([t, i])), e);
3099
3116
  }
3100
3117
  var Tr = {
3101
3118
  version: xr,
@@ -3170,7 +3187,8 @@ async function Or(e) {
3170
3187
  return {
3171
3188
  path: i,
3172
3189
  language: t(i),
3173
- content: n
3190
+ content: n,
3191
+ status: "success"
3174
3192
  };
3175
3193
  }).sort((e, t) => e.path.localeCompare(t.path)),
3176
3194
  modifies: [],
@@ -3194,8 +3212,8 @@ async function Or(e) {
3194
3212
  }
3195
3213
  //#endregion
3196
3214
  //#region src/patterns/enable/teams/preview-modifies/src/lib/components/app-sidebar.svelte?raw
3197
- var kr = "<script lang=\"ts\">\n import type { ComponentProps } from 'svelte';\n import HomeIcon from '@lucide/svelte/icons/home';\n import * as Sidebar from '$lib/components/ui/sidebar';\n import NavMain from './nav-main.svelte';\n import NavUser from './nav-user.svelte';\n // [!code highlight:3]\n import TeamSwitcher from '$lib/components/team-switcher.svelte';\n import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\n import * as Avatar from '$lib/components/ui/avatar';\n\n let data = {\n navMain: [\n {\n title: 'Dashboard',\n url: '/dashboard',\n icon: HomeIcon\n }\n ]\n };\n\n let {\n user,\n meta,\n team,\n teams = [],\n ref = $bindable(null),\n ...restProps\n }: ComponentProps<typeof Sidebar.Root> & {\n user: any;\n meta: any;\n team?: string | undefined;\n teams?: { id: string; name: string }[];\n } = $props();\n<\/script>\n\n<Sidebar.Root bind:ref variant=\"inset\" {...restProps}>\n <Sidebar.Header>\n <Sidebar.Menu>\n <TeamSwitcher {teams}>\n {#snippet children()}\n {@const activeTeam = teams.find((t) => t.id === team)}\n {#if activeTeam}\n <Avatar.Root class=\"size-8 rounded-lg\">\n <Avatar.Fallback class=\"rounded-lg bg-primary text-primary-foreground font-medium\">\n {activeTeam.name?.charAt(0).toUpperCase()}\n </Avatar.Fallback>\n </Avatar.Root>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">\n {activeTeam.name}\n </span>\n </div>\n {:else}\n <div\n class=\"bg-sidebar-accent text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg\"\n >\n <img src=\"/favicon.svg\" alt=\"logo\" class=\"size-6\" />\n </div>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{meta.appName}</span>\n </div>\n {/if}\n <ChevronsUpDownIcon class=\"ml-auto\" />\n {/snippet}\n </TeamSwitcher>\n </Sidebar.Menu>\n </Sidebar.Header>\n <Sidebar.Content>\n <NavMain items={data.navMain} />\n </Sidebar.Content>\n <Sidebar.Footer>\n <NavUser {user} />\n </Sidebar.Footer>\n</Sidebar.Root>\n", Ar = "<script lang=\"ts\">\n import { toggleMode, mode } from 'mode-watcher';\n import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\n import Settings2Icon from '@lucide/svelte/icons/settings-2';\n // [!code highlight:1]\n import UsersIcon from '@lucide/svelte/icons/users';\n import LogOutIcon from '@lucide/svelte/icons/log-out';\n import MoonIcon from '@lucide/svelte/icons/moon';\n import SunIcon from '@lucide/svelte/icons/sun';\n import * as Avatar from '$lib/components/ui/avatar';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import * as Sidebar from '$lib/components/ui/sidebar';\n\n let data = {\n navUser: [\n {\n title: 'Settings',\n url: '/settings',\n icon: Settings2Icon\n },\n // [!code highlight:5]\n {\n title: 'Teams',\n url: '/teams',\n icon: UsersIcon\n }\n ]\n };\n\n let {\n user\n }: {\n user: {\n id: string;\n name: string;\n email: string;\n avatar: string;\n };\n } = $props();\n\n const sidebar = Sidebar.useSidebar();\n<\/script>\n\n<Sidebar.Menu>\n <Sidebar.MenuItem>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger>\n {#snippet child({ props })}\n <Sidebar.MenuButton\n size=\"lg\"\n class=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n {...props}\n >\n <Avatar.Root class=\"size-8 rounded-lg\">\n {#if user.avatar}\n <Avatar.Image src=\"/api/files/users/{user.id}/{user.avatar}\" alt={user.name} />\n {/if}\n <Avatar.Fallback class=\"rounded-lg\">\n {user.email?.charAt(0).toUpperCase()}\n </Avatar.Fallback>\n </Avatar.Root>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{user.name}</span>\n <span class=\"truncate text-xs\">{user.email}</span>\n </div>\n <ChevronsUpDownIcon class=\"ml-auto size-4\" />\n </Sidebar.MenuButton>\n {/snippet}\n </DropdownMenu.Trigger>\n <DropdownMenu.Content\n class=\"w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg\"\n side={sidebar.isMobile ? 'bottom' : 'right'}\n align=\"end\"\n sideOffset={4}\n >\n <DropdownMenu.Label class=\"p-0 font-normal\">\n <div class=\"flex items-center gap-2 px-1 py-1.5 text-left text-sm\">\n <Avatar.Root class=\"size-8 rounded-lg\">\n {#if user.avatar}\n <Avatar.Image src=\"/api/files/users/{user.id}/{user.avatar}\" alt={user.name} />\n {/if}\n <Avatar.Fallback class=\"rounded-lg\">\n {user.email?.charAt(0).toUpperCase()}\n </Avatar.Fallback>\n </Avatar.Root>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{user.name}</span>\n <span class=\"truncate text-xs\">{user.email}</span>\n </div>\n </div>\n </DropdownMenu.Label>\n <DropdownMenu.Separator />\n <DropdownMenu.Group>\n <DropdownMenu.Item onclick={toggleMode}>\n {#if mode.current === 'dark'}\n <SunIcon />\n Light mode\n {:else}\n <MoonIcon />\n Dark mode\n {/if}\n </DropdownMenu.Item>\n {#each data.navUser as item}\n <DropdownMenu.Item class=\"p-0\">\n <a href={item.url} class=\"flex cursor-default items-center gap-2 px-2 py-1.5 w-full\">\n <item.icon />\n {item.title}\n </a>\n </DropdownMenu.Item>\n {/each}\n </DropdownMenu.Group>\n <DropdownMenu.Separator />\n <DropdownMenu.Item class=\"p-0\">\n <form action=\"/logout\" method=\"post\" class=\"w-full\">\n <button type=\"submit\" class=\"flex cursor-default items-center gap-2 px-2 py-1.5 w-full\">\n <LogOutIcon />\n Log out\n </button>\n </form>\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n </Sidebar.MenuItem>\n</Sidebar.Menu>\n", jr = "export const load = async ({ locals, depends }) => {\n const user = locals.pb.authStore.record!;\n // [!code highlight:3]\n const team = locals.team;\n const teams = await locals.pb.collection(\"teams\").getFullList();\n depends(\"app:team\");\n\n const breadcrumbs = [{ title: \"Home\", url: \"/dashboard\" }];\n\n return { user, team, teams, breadcrumbs };\n};\n", Mr = "<script lang=\"ts\">\n import * as Sidebar from '$lib/components/ui/sidebar';\n import { Separator } from '$lib/components/ui/separator';\n import AppSidebar from '$lib/components/app-sidebar.svelte';\n import * as Breadcrumb from '$lib/components/ui/breadcrumb';\n import { page } from '$app/state';\n\n let breadcrumbs = $derived(page.data.breadcrumbs || []) as { title: string; url: string }[];\n let { data, children } = $props();\n<\/script>\n\n<div class=\"min-h-dvh dashboard\">\n <Sidebar.Provider>\n <!-- [!code highlight:1] -->\n <AppSidebar user={data.user} meta={data.meta} team={data.team} teams={data.teams ?? []} />\n <Sidebar.Inset>\n <header class=\"flex h-16 shrink-0 items-center gap-2\">\n <div class=\"flex items-center gap-2 px-4\">\n <Sidebar.Trigger class=\"-ml-1\" />\n <Separator orientation=\"vertical\" class=\"mr-2 data-[orientation=vertical]:h-4\" />\n {#if breadcrumbs.length > 0}\n <Breadcrumb.Root>\n <Breadcrumb.List>\n {#if breadcrumbs.length > 1}\n {#each breadcrumbs.slice(0, -1) as breadcrumb}\n <Breadcrumb.Item>\n <Breadcrumb.Link href={breadcrumb.url}>{breadcrumb.title}</Breadcrumb.Link>\n </Breadcrumb.Item>\n <Breadcrumb.Separator />\n {/each}\n {/if}\n <Breadcrumb.Page>\n {breadcrumbs[breadcrumbs.length - 1].title}\n </Breadcrumb.Page>\n </Breadcrumb.List>\n </Breadcrumb.Root>\n {/if}\n </div>\n </header>\n <div class=\"flex flex-1 flex-col p-4 pt-0\">\n {@render children?.()}\n </div>\n </Sidebar.Inset>\n </Sidebar.Provider>\n</div>\n\n<style>\n :global(body:has(div.dashboard)) {\n background-color: var(--color-sidebar);\n }\n</style>\n", Nr = "users", Z = "teams", Pr = "team_memberships";
3198
- function Q(e) {
3215
+ var kr = "<script lang=\"ts\">\n import type { ComponentProps } from 'svelte';\n import HomeIcon from '@lucide/svelte/icons/home';\n import * as Sidebar from '$lib/components/ui/sidebar';\n import NavMain from './nav-main.svelte';\n import NavUser from './nav-user.svelte';\n // [!code highlight:3]\n import TeamSwitcher from '$lib/components/team-switcher.svelte';\n import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\n import * as Avatar from '$lib/components/ui/avatar';\n\n let data = {\n navMain: [\n {\n title: 'Dashboard',\n url: '/dashboard',\n icon: HomeIcon\n }\n ]\n };\n\n let {\n user,\n meta,\n team,\n teams = [],\n ref = $bindable(null),\n ...restProps\n }: ComponentProps<typeof Sidebar.Root> & {\n user: any;\n meta: any;\n team?: string | undefined;\n teams?: { id: string; name: string }[];\n } = $props();\n<\/script>\n\n<Sidebar.Root bind:ref variant=\"inset\" {...restProps}>\n <Sidebar.Header>\n <Sidebar.Menu>\n <TeamSwitcher {teams}>\n {#snippet children()}\n {@const activeTeam = teams.find((t) => t.id === team)}\n {#if activeTeam}\n <Avatar.Root class=\"size-8 rounded-lg\">\n <Avatar.Fallback class=\"rounded-lg bg-primary text-primary-foreground font-medium\">\n {activeTeam.name?.charAt(0).toUpperCase()}\n </Avatar.Fallback>\n </Avatar.Root>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">\n {activeTeam.name}\n </span>\n </div>\n {:else}\n <div\n class=\"bg-sidebar-accent text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg\"\n >\n <img src=\"/favicon.svg\" alt=\"logo\" class=\"size-6\" />\n </div>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{meta.appName}</span>\n </div>\n {/if}\n <ChevronsUpDownIcon class=\"ml-auto\" />\n {/snippet}\n </TeamSwitcher>\n </Sidebar.Menu>\n </Sidebar.Header>\n <Sidebar.Content>\n <NavMain items={data.navMain} />\n </Sidebar.Content>\n <Sidebar.Footer>\n <NavUser {user} />\n </Sidebar.Footer>\n</Sidebar.Root>\n", Ar = "<script lang=\"ts\">\n import { toggleMode, mode } from 'mode-watcher';\n import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\n import Settings2Icon from '@lucide/svelte/icons/settings-2';\n // [!code highlight:1]\n import UsersIcon from '@lucide/svelte/icons/users';\n import LogOutIcon from '@lucide/svelte/icons/log-out';\n import MoonIcon from '@lucide/svelte/icons/moon';\n import SunIcon from '@lucide/svelte/icons/sun';\n import * as Avatar from '$lib/components/ui/avatar';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import * as Sidebar from '$lib/components/ui/sidebar';\n\n let data = {\n navUser: [\n {\n title: 'Settings',\n url: '/settings',\n icon: Settings2Icon\n },\n // [!code highlight:5]\n {\n title: 'Teams',\n url: '/teams',\n icon: UsersIcon\n }\n ]\n };\n\n let {\n user\n }: {\n user: {\n id: string;\n name: string;\n email: string;\n avatar: string;\n };\n } = $props();\n\n const sidebar = Sidebar.useSidebar();\n<\/script>\n\n<Sidebar.Menu>\n <Sidebar.MenuItem>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger>\n {#snippet child({ props })}\n <Sidebar.MenuButton\n size=\"lg\"\n class=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\"\n {...props}\n >\n <Avatar.Root class=\"size-8 rounded-lg\">\n {#if user.avatar}\n <Avatar.Image src=\"/api/files/users/{user.id}/{user.avatar}\" alt={user.name} />\n {/if}\n <Avatar.Fallback class=\"rounded-lg\">\n {user.email?.charAt(0).toUpperCase()}\n </Avatar.Fallback>\n </Avatar.Root>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{user.name}</span>\n <span class=\"truncate text-xs\">{user.email}</span>\n </div>\n <ChevronsUpDownIcon class=\"ml-auto size-4\" />\n </Sidebar.MenuButton>\n {/snippet}\n </DropdownMenu.Trigger>\n <DropdownMenu.Content\n class=\"w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg\"\n side={sidebar.isMobile ? 'bottom' : 'right'}\n align=\"end\"\n sideOffset={4}\n >\n <DropdownMenu.Label class=\"p-0 font-normal\">\n <div class=\"flex items-center gap-2 px-1 py-1.5 text-left text-sm\">\n <Avatar.Root class=\"size-8 rounded-lg\">\n {#if user.avatar}\n <Avatar.Image src=\"/api/files/users/{user.id}/{user.avatar}\" alt={user.name} />\n {/if}\n <Avatar.Fallback class=\"rounded-lg\">\n {user.email?.charAt(0).toUpperCase()}\n </Avatar.Fallback>\n </Avatar.Root>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{user.name}</span>\n <span class=\"truncate text-xs\">{user.email}</span>\n </div>\n </div>\n </DropdownMenu.Label>\n <DropdownMenu.Separator />\n <DropdownMenu.Group>\n <DropdownMenu.Item onclick={toggleMode}>\n {#if mode.current === 'dark'}\n <SunIcon />\n Light mode\n {:else}\n <MoonIcon />\n Dark mode\n {/if}\n </DropdownMenu.Item>\n {#each data.navUser as item}\n <DropdownMenu.Item class=\"p-0\">\n <a href={item.url} class=\"flex cursor-default items-center gap-2 px-2 py-1.5 w-full\">\n <item.icon />\n {item.title}\n </a>\n </DropdownMenu.Item>\n {/each}\n </DropdownMenu.Group>\n <DropdownMenu.Separator />\n <DropdownMenu.Item class=\"p-0\">\n <form action=\"/logout\" method=\"post\" class=\"w-full\">\n <button type=\"submit\" class=\"flex cursor-default items-center gap-2 px-2 py-1.5 w-full\">\n <LogOutIcon />\n Log out\n </button>\n </form>\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n </Sidebar.MenuItem>\n</Sidebar.Menu>\n", jr = "export const load = async ({ locals, depends }) => {\n const user = locals.pb.authStore.record!;\n // [!code highlight:3]\n const team = locals.team;\n const teams = await locals.pb.collection(\"teams\").getFullList();\n depends(\"app:team\");\n\n const breadcrumbs = [{ title: \"Home\", url: \"/dashboard\" }];\n\n return { user, team, teams, breadcrumbs };\n};\n", Mr = "<script lang=\"ts\">\n import * as Sidebar from '$lib/components/ui/sidebar';\n import { Separator } from '$lib/components/ui/separator';\n import AppSidebar from '$lib/components/app-sidebar.svelte';\n import * as Breadcrumb from '$lib/components/ui/breadcrumb';\n import { page } from '$app/state';\n\n let breadcrumbs = $derived(page.data.breadcrumbs || []) as { title: string; url: string }[];\n let { data, children } = $props();\n<\/script>\n\n<div class=\"min-h-dvh dashboard\">\n <Sidebar.Provider>\n <!-- [!code highlight:1] -->\n <AppSidebar user={data.user} meta={data.meta} team={data.team} teams={data.teams ?? []} />\n <Sidebar.Inset>\n <header class=\"flex h-16 shrink-0 items-center gap-2\">\n <div class=\"flex items-center gap-2 px-4\">\n <Sidebar.Trigger class=\"-ml-1\" />\n <Separator orientation=\"vertical\" class=\"mr-2 data-[orientation=vertical]:h-4\" />\n {#if breadcrumbs.length > 0}\n <Breadcrumb.Root>\n <Breadcrumb.List>\n {#if breadcrumbs.length > 1}\n {#each breadcrumbs.slice(0, -1) as breadcrumb}\n <Breadcrumb.Item>\n <Breadcrumb.Link href={breadcrumb.url}>{breadcrumb.title}</Breadcrumb.Link>\n </Breadcrumb.Item>\n <Breadcrumb.Separator />\n {/each}\n {/if}\n <Breadcrumb.Page>\n {breadcrumbs[breadcrumbs.length - 1].title}\n </Breadcrumb.Page>\n </Breadcrumb.List>\n </Breadcrumb.Root>\n {/if}\n </div>\n </header>\n <div class=\"flex flex-1 flex-col p-4 pt-0\">\n {@render children?.()}\n </div>\n </Sidebar.Inset>\n </Sidebar.Provider>\n</div>\n\n<style>\n :global(body:has(div.dashboard)) {\n background-color: var(--color-sidebar);\n }\n</style>\n", Nr = "users", Q = "teams", Pr = "team_memberships";
3216
+ function $(e) {
3199
3217
  let t = o.find((t) => t.collectionName === e);
3200
3218
  if (!t) throw Error(`teams: missing TEAM_RULE_PATCHES entry for "${e}"`);
3201
3219
  return {
@@ -3210,7 +3228,7 @@ var Fr = [
3210
3228
  {
3211
3229
  name: "teams",
3212
3230
  type: "base",
3213
- ...Q("teams"),
3231
+ ...$("teams"),
3214
3232
  fields: [
3215
3233
  {
3216
3234
  name: "id",
@@ -3253,7 +3271,7 @@ var Fr = [
3253
3271
  {
3254
3272
  name: "team_memberships",
3255
3273
  type: "base",
3256
- ...Q("team_memberships"),
3274
+ ...$("team_memberships"),
3257
3275
  fields: [
3258
3276
  {
3259
3277
  name: "id",
@@ -3268,7 +3286,7 @@ var Fr = [
3268
3286
  {
3269
3287
  name: "team",
3270
3288
  cascadeDelete: !0,
3271
- collectionId: Z,
3289
+ collectionId: Q,
3272
3290
  maxSelect: 1,
3273
3291
  minSelect: 0,
3274
3292
  required: !0,
@@ -3311,7 +3329,7 @@ var Fr = [
3311
3329
  {
3312
3330
  name: "team_users",
3313
3331
  type: "view",
3314
- ...Q("team_users"),
3332
+ ...$("team_users"),
3315
3333
  viewQuery: "select users.id, users.email, users.name, team_memberships.id as membership_id, team_memberships.team, team_memberships.role from users join team_memberships on team_memberships.user = users.id;",
3316
3334
  fields: [
3317
3335
  {
@@ -3346,7 +3364,7 @@ var Fr = [
3346
3364
  {
3347
3365
  name: "team",
3348
3366
  cascadeDelete: !0,
3349
- collectionId: Z,
3367
+ collectionId: Q,
3350
3368
  maxSelect: 1,
3351
3369
  minSelect: 0,
3352
3370
  required: !0,
@@ -3368,7 +3386,7 @@ var Fr = [
3368
3386
  {
3369
3387
  name: "team_invites",
3370
3388
  type: "base",
3371
- ...Q("team_invites"),
3389
+ ...$("team_invites"),
3372
3390
  fields: [
3373
3391
  {
3374
3392
  name: "id",
@@ -3384,7 +3402,7 @@ var Fr = [
3384
3402
  name: "team",
3385
3403
  type: "relation",
3386
3404
  cascadeDelete: !0,
3387
- collectionId: Z,
3405
+ collectionId: Q,
3388
3406
  maxSelect: 1,
3389
3407
  minSelect: 0,
3390
3408
  required: !0
@@ -3411,7 +3429,7 @@ var Fr = [
3411
3429
  {
3412
3430
  name: "team_invite_links",
3413
3431
  type: "base",
3414
- ...Q("team_invite_links"),
3432
+ ...$("team_invite_links"),
3415
3433
  indexes: ["CREATE UNIQUE INDEX `idx_9y3Oz1KVzz` ON `team_invite_links` (`team`)"],
3416
3434
  fields: [
3417
3435
  {
@@ -3427,7 +3445,7 @@ var Fr = [
3427
3445
  {
3428
3446
  name: "team",
3429
3447
  cascadeDelete: !0,
3430
- collectionId: Z,
3448
+ collectionId: Q,
3431
3449
  maxSelect: 1,
3432
3450
  minSelect: 0,
3433
3451
  required: !0,
@@ -3461,7 +3479,8 @@ async function Rr(e) {
3461
3479
  return {
3462
3480
  path: i,
3463
3481
  language: t(i),
3464
- content: n
3482
+ content: n,
3483
+ status: "success"
3465
3484
  };
3466
3485
  }).sort((e, t) => e.path.localeCompare(t.path)),
3467
3486
  deletes: [],
@@ -3475,9 +3494,9 @@ async function Rr(e) {
3475
3494
  var zr = "enable-teams", Br = "1.0.0", Vr = "src/patterns/enable/teams", Hr = "/enable/teams";
3476
3495
  async function Ur(e) {
3477
3496
  let t = await Or(e);
3478
- if (e.env === "preview") return y(n([t, await Rr(e)]));
3479
- let { generate: r } = await import("./chunks/generate.runtime-uPCB71Ki.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-CSxmq40z.js");
3480
- return a(await y(n([t, i])), e);
3497
+ if (e.env === "preview") return b(n([t, await Rr(e)]));
3498
+ let { generate: r } = await import("./chunks/generate.runtime-B0EfMNMf.js"), i = await r(e), { writeResult: a } = await import("./chunks/write-result-DhQIE6kA.js");
3499
+ return a(await b(n([t, i])), e);
3481
3500
  }
3482
3501
  var Wr = {
3483
3502
  version: Br,
@@ -3512,7 +3531,7 @@ var Wr = {
3512
3531
  tests: 36,
3513
3532
  baseline: "velastack",
3514
3533
  generate: Ur
3515
- }, Gr = ee.version, $ = [
3534
+ }, Gr = ee.version, Kr = [
3516
3535
  Vt,
3517
3536
  jn,
3518
3537
  Xt,
@@ -3522,11 +3541,11 @@ var Wr = {
3522
3541
  pr,
3523
3542
  Tr,
3524
3543
  Wr
3525
- ], Kr = Object.fromEntries($.map((e) => [e.slug, e])), qr = $.reduce((e, t) => {
3544
+ ], qr = Object.fromEntries(Kr.map((e) => [e.slug, e])), Jr = Kr.reduce((e, t) => {
3526
3545
  let n = t.category;
3527
3546
  return e[n] ??= [], e[n].push(t), e;
3528
3547
  }, {});
3529
3548
  //#endregion
3530
- export { qr as byCategory, Kr as bySlug, $ as patterns, Gr as version };
3549
+ export { y as InvalidArgumentError, Jr as byCategory, qr as bySlug, Kr as patterns, Gr as version };
3531
3550
 
3532
3551
  //# sourceMappingURL=index.js.map