@velastack/patterns 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{collections-BaY_bexm.js → collections-BIx6tDrV.js} +3 -3
- package/dist/chunks/{collections-BaY_bexm.js.map → collections-BIx6tDrV.js.map} +1 -1
- package/dist/chunks/{env.runtime-C0w1qoWl.js → env.runtime-sHetoQ7B.js} +2 -2
- package/dist/chunks/{env.runtime-C0w1qoWl.js.map → env.runtime-sHetoQ7B.js.map} +1 -1
- package/dist/chunks/{generate.runtime-vKonp83V.js → generate.runtime-B5wEl4BS.js} +3 -3
- package/dist/chunks/{generate.runtime-vKonp83V.js.map → generate.runtime-B5wEl4BS.js.map} +1 -1
- package/dist/chunks/{index-CDgw5XzM.js → index-BP2ybpuw.js} +366 -332
- package/dist/chunks/index-BP2ybpuw.js.map +1 -0
- package/dist/chunks/{pocketbase-B1HjIB8v.js → pocketbase-BFCpPJlW.js} +2 -2
- package/dist/chunks/{pocketbase-B1HjIB8v.js.map → pocketbase-BFCpPJlW.js.map} +1 -1
- package/dist/index.d.ts +165 -19
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/index-CDgw5XzM.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BP2ybpuw.js","sources":["../../src/core/format-result.ts","../../node_modules/dedent/dist/dedent.mjs","../../src/core/util.ts","../../src/patterns/generate/field/index.ts","../../node_modules/change-case/dist/index.js","../../node_modules/pluralize/pluralize.js","../../src/core/constants.ts","../../src/parse/model.ts","../../src/parse/collections.ts","../../src/parse/permissions.ts","../../src/parse/fields.ts","../../src/patterns/generate/tests.ts","../../src/patterns/generate/form/generate.ts","../../src/patterns/generate/form/index.ts","../../src/patterns/generate/shared.ts","../../src/patterns/generate/resource/generate.ts","../../src/patterns/generate/resource/index.ts","../../src/patterns/generate/scaffold/generate.ts","../../src/patterns/generate/scaffold/index.ts","../../src/patterns/generate/schema/generate.ts","../../src/patterns/generate/schema/index.ts","../../src/patterns/enable/auth/creates/src/lib/components/app-sidebar.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/nav-main.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/nav-user.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/auth-menu.svelte?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/context.ts?raw","../../src/patterns/enable/auth/creates/src/lib/components/ui/auth-menu/index.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/changeEmail.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/changePassword.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/confirmEmailChange.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/confirmReset.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/login.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/otp.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/profile.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/reset.ts?raw","../../src/patterns/enable/auth/creates/src/lib/schemas/signup.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/+layout.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/+layout.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/dashboard/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/dashboard/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/settings/+layout.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/settings/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(app)/settings/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-reset/[token]/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-reset/[token]/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-verification/[token]/+server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/confirm-verification/[token]/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/login/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/login/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/login/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/logout/+server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/logout/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/otp/[token]/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/otp/[token]/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/otp/[token]/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/reset/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/reset/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/reset/server.test.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/signup/+page.server.ts?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/signup/+page.svelte?raw","../../src/patterns/enable/auth/creates/src/routes/(public)/signup/server.test.ts?raw","../../src/patterns/enable/auth/generate.ts","../../src/patterns/enable/auth/preview-modifies/migrations/1776099881_created_oauth_accounts.js?raw","../../src/patterns/enable/auth/preview-modifies/migrations/1776099881_updated_users.js?raw","../../src/patterns/enable/auth/preview-modifies/src/hooks.server.ts?raw","../../src/patterns/enable/auth/preview-modifies/src/routes/(public)/root-layout.svelte?raw","../../src/patterns/enable/auth/preview-modifies/src/routes/+layout.server.ts?raw","../../src/patterns/enable/auth/generate.preview.ts","../../src/patterns/enable/auth/index.ts","../../src/index.ts"],"sourcesContent":["import prettier from \"prettier\";\nimport type { File, Result } from \"./types\";\nimport sveltePlugin from \"prettier-plugin-svelte\";\n\nfunction canFormatFile(file: File): boolean {\n return (\n file.language === \"ts\" ||\n file.language === \"svelte\" ||\n file.path.endsWith(\".json\")\n );\n}\n\nasync function formatFile(file: File): Promise<File> {\n if (!canFormatFile(file)) {\n return file;\n }\n\n try {\n const content = await prettier.format(file.content, {\n filepath: file.path,\n plugins: [sveltePlugin],\n });\n return {\n ...file,\n content,\n };\n } catch {\n return file;\n }\n}\n\nasync function formatFiles(files: File[]): Promise<File[]> {\n return Promise.all(files.map((file) => formatFile(file)));\n}\n\nexport async function formatResult(result: Result): Promise<Result> {\n const [creates, modifies] = await Promise.all([\n formatFiles(result.creates),\n formatFiles(result.modifies),\n ]);\n\n return {\n ...result,\n creates,\n modifies,\n };\n}\n","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nconst dedent = createDedent({});\nexport default dedent;\nfunction createDedent(options) {\n dedent.withOptions = newOptions => createDedent(_objectSpread(_objectSpread({}, options), newOptions));\n return dedent;\n function dedent(strings, ...values) {\n const raw = typeof strings === \"string\" ? [strings] : strings.raw;\n const {\n alignValues = false,\n escapeSpecialCharacters = Array.isArray(strings),\n trimWhitespace = true\n } = options;\n\n // first, perform interpolation\n let result = \"\";\n for (let i = 0; i < raw.length; i++) {\n let next = raw[i];\n if (escapeSpecialCharacters) {\n // handle escaped newlines, backticks, and interpolation characters\n next = next.replace(/\\\\\\n[ \\t]*/g, \"\").replace(/\\\\`/g, \"`\").replace(/\\\\\\$/g, \"$\").replace(/\\\\\\{/g, \"{\");\n }\n result += next;\n if (i < values.length) {\n const value = alignValues ? alignValue(values[i], result) : values[i];\n\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n result += value;\n }\n }\n\n // now strip indentation\n const lines = result.split(\"\\n\");\n let mindent = null;\n for (const l of lines) {\n const m = l.match(/^(\\s+)\\S+/);\n if (m) {\n const indent = m[1].length;\n if (!mindent) {\n // this is the first indented line\n mindent = indent;\n } else {\n mindent = Math.min(mindent, indent);\n }\n }\n }\n if (mindent !== null) {\n const m = mindent; // appease TypeScript\n result = lines\n // https://github.com/typescript-eslint/typescript-eslint/issues/7140\n // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with\n .map(l => l[0] === \" \" || l[0] === \"\\t\" ? l.slice(m) : l).join(\"\\n\");\n }\n\n // dedent eats leading and trailing whitespace too\n if (trimWhitespace) {\n result = result.trim();\n }\n\n // Unescape escapes after trimming so sequences like `\\n`, `\\t`,\n // `\\xHH` and `\\u{...}` are preserved (fixes #24)\n if (escapeSpecialCharacters) {\n result = result.replace(/\\\\n/g, \"\\n\").replace(/\\\\t/g, \"\\t\").replace(/\\\\r/g, \"\\r\").replace(/\\\\v/g, \"\\v\").replace(/\\\\b/g, \"\\b\").replace(/\\\\f/g, \"\\f\").replace(/\\\\0/g, \"\\0\").replace(/\\\\x([\\da-fA-F]{2})/g, (_, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\\\u\\{([\\da-fA-F]{1,6})\\}/g, (_, h) => String.fromCodePoint(parseInt(h, 16))).replace(/\\\\u([\\da-fA-F]{4})/g, (_, h) => String.fromCharCode(parseInt(h, 16)));\n }\n\n // Workaround for Bun issue with Unicode characters\n // https://github.com/oven-sh/bun/issues/8745\n if (typeof Bun !== \"undefined\") {\n result = result.replace(\n // Matches e.g. \\\\u{1f60a} or \\\\u5F1F\n /\\\\u(?:\\{([\\da-fA-F]{1,6})\\}|([\\da-fA-F]{4}))/g, (_, braced, unbraced) => {\n var _ref;\n const hex = (_ref = braced !== null && braced !== void 0 ? braced : unbraced) !== null && _ref !== void 0 ? _ref : \"\";\n return String.fromCodePoint(parseInt(hex, 16));\n });\n }\n return result;\n }\n}\n\n/**\n * Adjusts the indentation of a multi-line interpolated value to match the current line.\n */\nfunction alignValue(value, precedingText) {\n if (typeof value !== \"string\" || !value.includes(\"\\n\")) {\n return value;\n }\n const currentLine = precedingText.slice(precedingText.lastIndexOf(\"\\n\") + 1);\n const indentMatch = currentLine.match(/^(\\s+)/);\n if (indentMatch) {\n const indent = indentMatch[1];\n return value.replace(/\\n/g, `\\n${indent}`);\n }\n return value;\n}\n","import type { Result } from \"./types\";\n\nexport function appRelativePath(globKey: string, prefix: string): string {\n if (globKey.startsWith(prefix)) {\n return globKey.slice(prefix.length);\n }\n return globKey.replace(/^\\.\\//, \"\");\n}\n\nexport function languageFromPath(path: string): string {\n if (path.endsWith(\".svelte\")) return \"svelte\";\n if (path.endsWith(\".tsx\")) return \"ts\";\n if (path.endsWith(\".ts\")) return \"ts\";\n if (path.endsWith(\".jsx\")) return \"js\";\n if (path.endsWith(\".js\")) return \"js\";\n return \"text\";\n}\n\nexport function mergeResults(results: Result[]) {\n return results.reduce(\n (acc, result) => {\n acc.creates.push(...result.creates);\n acc.modifies.push(...result.modifies);\n acc.deletes.push(...result.deletes);\n acc.components.push(...result.components);\n acc.packages.push(...result.packages);\n acc.collections.push(...result.collections);\n return acc;\n },\n {\n creates: [],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n } satisfies Result,\n );\n}\n","import dedent from \"dedent\";\nimport type { Field, Model } from \"../../../parse\";\n\ntype InputPropValue = string | number | boolean | null | undefined;\n\ninterface FieldRenderExtensions {\n inputProps?: Record<string, InputPropValue>;\n labelAside?: string;\n}\n\nexport type RenderableField = Field & FieldRenderExtensions;\n\nexport type FieldComponent =\n | \"form\"\n | \"file-form\"\n | \"multiselect\"\n | \"input\"\n | \"checkbox\"\n | \"textarea\"\n | \"select\"\n | \"geopoint\"\n | \"button\";\n\nconst FIELD_COMPONENTS: Record<Field[\"type\"], FieldComponent[]> = {\n text: [\"form\", \"input\"],\n number: [\"form\", \"input\"],\n email: [\"form\", \"input\"],\n password: [\"form\", \"input\"],\n bool: [\"form\", \"checkbox\"],\n date: [\"form\", \"input\"],\n select: [\"form\", \"multiselect\"],\n file: [\"form\", \"input\", \"file-form\", \"button\"],\n json: [\"form\", \"textarea\"],\n geoPoint: [\"form\", \"geopoint\"],\n relation: [\"form\", \"multiselect\"],\n url: [\"form\", \"input\"],\n editor: [\"form\", \"textarea\"],\n autodate: [\"form\", \"input\"],\n};\n\nconst FIELD_IMPORTS: Record<FieldComponent, string[]> = {\n form: ['import * as Form from \"$lib/components/ui/form\";'],\n \"file-form\": ['import * as FileForm from \"$lib/components/ui/file-form\";'],\n multiselect: [\n 'import * as MultiSelect from \"$lib/components/ui/multiselect\";',\n 'import * as Command from \"$lib/components/ui/command\";',\n ],\n input: ['import { Input } from \"$lib/components/ui/input\";'],\n checkbox: ['import { Checkbox } from \"$lib/components/ui/checkbox\";'],\n textarea: ['import { Textarea } from \"$lib/components/ui/textarea\";'],\n select: ['import * as Select from \"$lib/components/ui/select\";'],\n geopoint: ['import { GeopointInput } from \"$lib/components/ui/geopoint\";'],\n button: ['import { Button } from \"$lib/components/ui/button\";'],\n};\n\nexport function fieldValueBinding(field: Pick<Field, \"name\">): string {\n return `$formData.${field.name}`;\n}\n\nfunction renderInputProps(field: RenderableField): string {\n if (!field.inputProps) {\n return \"\";\n }\n\n return Object.entries(field.inputProps)\n .flatMap(([key, value]) => {\n if (value === undefined || value === null || value === false) {\n return [];\n }\n\n if (value === true) {\n return [` ${key}`];\n }\n\n return [` ${key}=${JSON.stringify(String(value))}`];\n })\n .join(\"\");\n}\n\nfunction renderLabel(field: RenderableField): string {\n if (!field.labelAside) {\n return `<Form.Label>${field.title}</Form.Label>`;\n }\n\n return dedent`\n <div class=\"flex justify-between\">\n <Form.Label>${field.title}</Form.Label>\n ${field.labelAside}\n </div>\n `;\n}\n\nfunction renderInputField(field: RenderableField, type: string): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Input {...props} type=\"${type}\" bind:value={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderTextareaField(field: RenderableField): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-2\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Textarea {...props} bind:value={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderBoolField(field: RenderableField): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1 flex items-start space-x-2\">\n <Form.Control>\n {#snippet children({ props })}\n <Checkbox {...props} bind:checked={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n ${renderLabel(field)}\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderGeoPointField(field: RenderableField): string {\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <GeopointInput {...props} bind:value={${fieldValueBinding(field)}} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderFileField(field: Extract<RenderableField, { type: \"file\" }>): string {\n const required = field.required ? \" required\" : \"\";\n const fileMode = field.maxSelect > 1 ? \"Multiple\" : \"Single\";\n\n return dedent`\n <FileForm.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <FileForm.${fileMode}>\n {#snippet display({ file, filename, onremove })}\n <div class=\"flex gap-2 justify-between items-center\">\n <div class=\"flex gap-2 items-center\">\n <FileForm.Thumb {file} {filename} class=\"w-16 h-16 rounded-md object-cover\" />\n <p class=\"text-sm text-muted-foreground\">{filename}</p>\n </div>\n <Button variant=\"outline\" onclick={() => onremove(file)}>Remove</Button>\n </div>\n {/snippet}\n {#snippet input()}\n <FileForm.Input {...props}${required}${renderInputProps(field)} />\n {/snippet}\n </FileForm.${fileMode}>\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </FileForm.Field>\n `;\n}\n\nfunction renderSelectField(field: Extract<RenderableField, { type: \"select\" }>): string {\n const multiType = field.maxSelect > 1 ? \"multiple\" : \"single\";\n const required = field.required ? \" required\" : \"\";\n const placeholder = field.maxSelect > 1 ? \"Select options\" : \"Select an option\";\n\n const options = field.options\n .map(\n (option) =>\n `<MultiSelect.Item value=${JSON.stringify(option.value)} label={${field.name}Labels[${JSON.stringify(option.value)}].label} />`,\n )\n .join(\"\\n \");\n\n return dedent`\n <MultiSelect.Field {form} type=\"${multiType}\" name=\"${field.name}\"${required} class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <MultiSelect.Trigger class=\"w-full justify-between\">\n <MultiSelect.Input bind:value={${fieldValueBinding(field)}} placeholder=\"${placeholder}\" {...props}>\n {#snippet children({ selected })}\n <div class=\"flex flex-wrap gap-1\">\n {#each selected as value}\n <MultiSelect.Chip>{${field.name}Labels[value].label}</MultiSelect.Chip>\n {/each}\n </div>\n {/snippet}\n </MultiSelect.Input>\n </MultiSelect.Trigger>\n {/snippet}\n </Form.Control>\n\n <MultiSelect.Content class=\"p-0\">\n <Command.Root>\n <Command.Input autofocus placeholder=\"Search...\" />\n <Command.Empty>No options found</Command.Empty>\n <Command.Group>\n ${options}\n </Command.Group>\n </Command.Root>\n </MultiSelect.Content>\n\n <Form.FieldErrors class=\"contents text-destructive\" />\n </MultiSelect.Field>\n `;\n}\n\nfunction renderRelationField(\n field: Extract<RenderableField, { type: \"relation\" }>,\n): string {\n const multiType = field.maxSelect > 1 ? \"multiple\" : \"single\";\n const placeholder =\n field.maxSelect > 1\n ? `Select ${field.relatedModel.pluralDisplayName.toLowerCase()}`\n : `Select ${field.relatedModel.displayName.toLowerCase()}`;\n const searchPlaceholder = `Search ${field.relatedModel.pluralDisplayName.toLowerCase()}...`;\n const emptyText = `No ${field.relatedModel.pluralDisplayName.toLowerCase()} found`;\n const modelName = field.relatedModel.name;\n const listName = field.relatedModel.pluralName;\n\n return dedent`\n <MultiSelect.Field {form} type=\"${multiType}\" name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>${field.title}</Form.Label>\n <MultiSelect.Trigger class=\"w-full justify-between\">\n <MultiSelect.Input bind:value={${fieldValueBinding(field)}} placeholder=\"${placeholder}\" {...props}>\n {#snippet children({ selected })}\n <div class=\"flex flex-wrap gap-1\">\n {#each selected as value}\n {@const ${modelName} = data.${listName}.find((${modelName}) => ${modelName}.id === value)!}\n <MultiSelect.Chip>{${modelName}.${field.displayField}}</MultiSelect.Chip>\n {/each}\n </div>\n {/snippet}\n </MultiSelect.Input>\n </MultiSelect.Trigger>\n {/snippet}\n </Form.Control>\n\n <MultiSelect.Content class=\"p-0\">\n <Command.Root>\n <Command.Input autofocus placeholder=\"${searchPlaceholder}\" />\n <Command.Empty>${emptyText}</Command.Empty>\n <Command.Group>\n {#each data.${listName} as ${modelName}}\n <MultiSelect.Item value={${modelName}.id} label={${modelName}.${field.displayField}} />\n {/each}\n </Command.Group>\n </Command.Root>\n </MultiSelect.Content>\n\n <Form.FieldErrors class=\"contents text-destructive\" />\n </MultiSelect.Field>\n `;\n}\n\nfunction renderAutodateField(field: RenderableField): string {\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Input {...props} type=\"text\" value={${fieldValueBinding(field)}}${renderInputProps(field)} readonly />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nexport function renderField(field: RenderableField): string {\n switch (field.type) {\n case \"text\":\n return renderInputField(field, \"text\");\n case \"number\":\n return renderInputField(field, \"number\");\n case \"date\":\n return renderInputField(field, \"date\");\n case \"email\":\n return renderInputField(field, \"email\");\n case \"password\":\n return renderInputField(field, \"password\");\n case \"url\":\n return renderInputField(field, \"url\");\n case \"autodate\":\n return renderAutodateField(field);\n case \"editor\":\n case \"json\":\n return renderTextareaField(field);\n case \"bool\":\n return renderBoolField(field);\n case \"geoPoint\":\n return renderGeoPointField(field);\n case \"file\":\n return renderFileField(field);\n case \"select\":\n return renderSelectField(field);\n case \"relation\":\n return renderRelationField(field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n\nexport function selectFieldLabelMap(field: Extract<Field, { type: \"select\" }>): string {\n const labels = field.options\n .map(\n (option) => dedent`\n ${JSON.stringify(option.value)}: {\n label: ${JSON.stringify(option.label)},\n value: ${JSON.stringify(option.value)}\n }\n `,\n )\n .join(\",\\n\");\n\n return dedent`\n const ${field.name}Labels = {\n ${labels}\n } as const;\n `;\n}\n\nexport function getFieldComponents(fields: Field[]): FieldComponent[] {\n const components = fields.flatMap((field) => FIELD_COMPONENTS[field.type]);\n return [...new Set(components)];\n}\n\nexport function getFieldImports(components: FieldComponent[]): string[] {\n return [...new Set(components.flatMap((component) => FIELD_IMPORTS[component]))];\n}\n\nfunction displayDataPath(model: Model, field: Pick<Field, \"name\">): string {\n return `data.${model.name}.${field.name}`;\n}\n\nfunction renderDisplaySimple(\n model: Model,\n field: Pick<Field, \"name\" | \"title\">,\n valueExpression: string,\n): string {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">${valueExpression}</p>\n </div>\n `;\n}\n\nfunction renderDisplayDateField(\n model: Model,\n field: Field & { type: \"date\" | \"autodate\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const dateLine = `<p class=\"text-muted-foreground\">{new Date(${dataPath}).toLocaleDateString()}</p>`;\n const body = field.required\n ? dateLine\n : dedent`\n {#if ${dataPath}}\n ${dateLine}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nfunction renderDisplayUrlField(model: Model, field: Field & { type: \"url\" }): string {\n const dataPath = displayDataPath(model, field);\n const anchor = dedent`\n <a href={${dataPath}} target=\"_blank\" rel=\"noopener noreferrer\">\n {${dataPath}}\n </a>\n `;\n const body = field.required\n ? anchor\n : dedent`\n {#if ${dataPath}}\n ${anchor}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">\n ${body}\n </p>\n </div>\n `;\n}\n\nfunction renderDisplaySelectField(\n model: Model,\n field: Extract<Field, { type: \"select\" }>,\n): string {\n const dataPath = displayDataPath(model, field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#each ${dataPath} as ${field.name}}\n <Badge variant=\"outline\" class=\"mr-1\">{${field.name}Labels[${field.name}].label}</Badge>\n {/each}\n </div>\n `;\n }\n\n const badge = `<Badge variant=\"outline\" class=\"mr-1\">{${field.name}Labels[${dataPath}].label}</Badge>`;\n const body = field.required\n ? badge\n : dedent`\n {#if ${dataPath}}\n ${badge}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nfunction renderDisplayFileField(model: Model, field: Extract<Field, { type: \"file\" }>): string {\n const dataPath = displayDataPath(model, field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${dataPath}}\n {#each ${dataPath} as filename}\n <div class=\"flex gap-2 items-center\">\n {#if [\".jpg\", \".png\", \".jpeg\", \".webp\", \".gif\"].some((ext) => filename.endsWith(ext))}\n <img\n src=\"/api/files/{data.${model.name}.collectionId}/{data.${model.name}.id}/{filename}\"\n alt={filename}\n class=\"w-16 h-16 rounded-md object-cover\"\n />\n {:else}\n <div class=\"flex items-center justify-center w-16 h-16 bg-muted rounded-md\">\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n <p class=\"text-sm text-muted-foreground\">{filename}</p>\n </div>\n {/each}\n {/if}\n </div>\n `;\n }\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${dataPath}}\n <div class=\"flex gap-2 items-center\">\n {#if [\".jpg\", \".png\", \".jpeg\", \".webp\", \".gif\"].some((ext) => ${dataPath}?.endsWith(ext))}\n <img\n src=\"/api/files/{data.${model.name}.collectionId}/{data.${model.name}.id}/{${dataPath}}\"\n alt={${dataPath}}\n class=\"w-16 h-16 rounded-md object-cover\"\n />\n {:else}\n <div class=\"flex items-center justify-center w-16 h-16 bg-muted rounded-md\">\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n <p class=\"text-sm text-muted-foreground\">{${dataPath}}</p>\n </div>\n {/if}\n </div>\n `;\n}\n\nfunction relationListUrl(field: Extract<Field, { type: \"relation\" }>): string {\n return `/${field.relatedModel.routeSegment}`;\n}\n\nfunction renderDisplayRelationField(\n model: Model,\n field: Extract<Field, { type: \"relation\" }>,\n): string {\n const relationPath = `data.${model.name}.expand?.${field.name}`;\n const listUrl = relationListUrl(field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#each ${relationPath} ?? [] as ${field.singularRelationName}}\n <a href=\"${listUrl}/{${field.singularRelationName}.id}\">\n <Badge variant=\"outline\" class=\"text-muted-foreground\">\n {${field.singularRelationName}.${field.displayField}}\n <CircleArrowRightIcon class=\"w-4 h-4\" />\n </Badge>\n </a>\n {/each}\n </div>\n `;\n }\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${relationPath}}\n <a href=\"${listUrl}/{${relationPath}.id}\">\n <Badge variant=\"outline\" class=\"text-muted-foreground\">\n {${relationPath}.${field.displayField}}\n <CircleArrowRightIcon class=\"w-4 h-4\" />\n </Badge>\n </a>\n {/if}\n </div>\n `;\n}\n\nfunction renderDisplayGeoPointField(model: Model, field: Field & { type: \"geoPoint\" }): string {\n const dataPath = displayDataPath(model, field);\n const content = dedent`\n {#await import(\"$lib/components/ui/leaflet/leaflet.svelte\")}\n <div class=\"h-56.25 w-full bg-input rounded-md\"></div>\n {:then { default: Leaflet }}\n <Leaflet point={${dataPath}} readonly class=\"rounded-md overflow-hidden\" />\n {/await}\n <p class=\"text-muted-foreground\">\n {${dataPath}?.lat.toFixed(6)}, {${dataPath}?.lon.toFixed(6)}\n </p>\n `;\n const body = field.required\n ? content\n : dedent`\n {#if ${dataPath}}\n ${content}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nexport function renderDisplayField(model: Model, field: Field): string {\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"editor\":\n return renderDisplaySimple(model, field, `{${displayDataPath(model, field)}}`);\n case \"password\":\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">\n <code class=\"text-xs font-mono bg-muted rounded-md px-1 py-0.5\">********</code>\n </p>\n </div>\n `;\n case \"bool\":\n return renderDisplaySimple(\n model,\n field,\n `{${displayDataPath(model, field)} ? \"Yes\" : \"No\"}`,\n );\n case \"date\":\n case \"autodate\":\n return renderDisplayDateField(model, field as Field & { type: \"date\" | \"autodate\" });\n case \"url\":\n return renderDisplayUrlField(model, field as Field & { type: \"url\" });\n case \"select\":\n return renderDisplaySelectField(model, field);\n case \"file\":\n return renderDisplayFileField(model, field);\n case \"json\":\n return renderDisplaySimple(model, field, `{JSON.stringify(${displayDataPath(model, field)})}`);\n case \"geoPoint\":\n return renderDisplayGeoPointField(model, field as Field & { type: \"geoPoint\" });\n case \"relation\":\n return renderDisplayRelationField(model, field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n","// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\n// Used to iterate over the initial split result and separate numbers.\nconst SPLIT_SEPARATE_NUMBER_RE = /(\\d)\\p{Ll}|(\\p{L})\\d/u;\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_SUFFIX_CHARACTERS = \"\";\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(value) {\n let result = value.trim();\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n let start = 0;\n let end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\")\n start++;\n if (start === end)\n return [];\n while (result.charAt(end - 1) === \"\\0\")\n end--;\n return result.slice(start, end).split(/\\0/g);\n}\n/**\n * Split the input string into an array of words, separating numbers.\n */\nexport function splitSeparateNumbers(value) {\n const words = split(value);\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);\n if (match) {\n const offset = match.index + (match[1] ?? match[2]).length;\n words.splice(i, 1, word.slice(0, offset), word.slice(offset));\n }\n }\n return words;\n}\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input, options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (prefix +\n words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? \" \") +\n suffix);\n}\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input, options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (prefix +\n words\n .map((word, index) => {\n if (index === 0)\n return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\") +\n suffix);\n}\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input, options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return prefix + words.map(transform).join(options?.delimiter ?? \"\") + suffix;\n}\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input, options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input, options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (prefix +\n words\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \") +\n suffix);\n}\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input, options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (prefix +\n words.map(upperFactory(options?.locale)).join(options?.delimiter ?? \"_\") +\n suffix);\n}\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input, options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input, options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input, options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input, options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (prefix +\n words\n .map((word, index) => {\n if (index === 0)\n return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \") +\n suffix);\n}\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input, options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input, options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\nfunction lowerFactory(locale) {\n return locale === false\n ? (input) => input.toLowerCase()\n : (input) => input.toLocaleLowerCase(locale);\n}\nfunction upperFactory(locale) {\n return locale === false\n ? (input) => input.toUpperCase()\n : (input) => input.toLocaleUpperCase(locale);\n}\nfunction capitalCaseTransformFactory(lower, upper) {\n return (word) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\nfunction pascalCaseTransformFactory(lower, upper) {\n return (word, index) => {\n const char0 = word[0];\n const initial = index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\nfunction splitPrefixSuffix(input, options = {}) {\n const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);\n const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n let prefixIndex = 0;\n let suffixIndex = input.length;\n while (prefixIndex < input.length) {\n const char = input.charAt(prefixIndex);\n if (!prefixCharacters.includes(char))\n break;\n prefixIndex++;\n }\n while (suffixIndex > prefixIndex) {\n const index = suffixIndex - 1;\n const char = input.charAt(index);\n if (!suffixCharacters.includes(char))\n break;\n suffixIndex = index;\n }\n return [\n input.slice(0, prefixIndex),\n splitFn(input.slice(prefixIndex, suffixIndex)),\n input.slice(suffixIndex),\n ];\n}\n//# sourceMappingURL=index.js.map","/* global define */\n\n(function (root, pluralize) {\n /* istanbul ignore else */\n if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {\n // Node.\n module.exports = pluralize();\n } else if (typeof define === 'function' && define.amd) {\n // AMD, registers as an anonymous module.\n define(function () {\n return pluralize();\n });\n } else {\n // Browser global.\n root.pluralize = pluralize();\n }\n})(this, function () {\n // Rule storage - pluralize and singularize need to be run sequentially,\n // while other rules can be optimized using an object for instant lookups.\n var pluralRules = [];\n var singularRules = [];\n var uncountables = {};\n var irregularPlurals = {};\n var irregularSingles = {};\n\n /**\n * Sanitize a pluralization rule to a usable regular expression.\n *\n * @param {(RegExp|string)} rule\n * @return {RegExp}\n */\n function sanitizeRule (rule) {\n if (typeof rule === 'string') {\n return new RegExp('^' + rule + '$', 'i');\n }\n\n return rule;\n }\n\n /**\n * Pass in a word token to produce a function that can replicate the case on\n * another word.\n *\n * @param {string} word\n * @param {string} token\n * @return {Function}\n */\n function restoreCase (word, token) {\n // Tokens are an exact match.\n if (word === token) return token;\n\n // Lower cased words. E.g. \"hello\".\n if (word === word.toLowerCase()) return token.toLowerCase();\n\n // Upper cased words. E.g. \"WHISKY\".\n if (word === word.toUpperCase()) return token.toUpperCase();\n\n // Title cased words. E.g. \"Title\".\n if (word[0] === word[0].toUpperCase()) {\n return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();\n }\n\n // Lower cased words. E.g. \"test\".\n return token.toLowerCase();\n }\n\n /**\n * Interpolate a regexp string.\n *\n * @param {string} str\n * @param {Array} args\n * @return {string}\n */\n function interpolate (str, args) {\n return str.replace(/\\$(\\d{1,2})/g, function (match, index) {\n return args[index] || '';\n });\n }\n\n /**\n * Replace a word using a rule.\n *\n * @param {string} word\n * @param {Array} rule\n * @return {string}\n */\n function replace (word, rule) {\n return word.replace(rule[0], function (match, index) {\n var result = interpolate(rule[1], arguments);\n\n if (match === '') {\n return restoreCase(word[index - 1], result);\n }\n\n return restoreCase(match, result);\n });\n }\n\n /**\n * Sanitize a word by passing in the word and sanitization rules.\n *\n * @param {string} token\n * @param {string} word\n * @param {Array} rules\n * @return {string}\n */\n function sanitizeWord (token, word, rules) {\n // Empty string or doesn't need fixing.\n if (!token.length || uncountables.hasOwnProperty(token)) {\n return word;\n }\n\n var len = rules.length;\n\n // Iterate over the sanitization rules and use the first one to match.\n while (len--) {\n var rule = rules[len];\n\n if (rule[0].test(word)) return replace(word, rule);\n }\n\n return word;\n }\n\n /**\n * Replace a word with the updated word.\n *\n * @param {Object} replaceMap\n * @param {Object} keepMap\n * @param {Array} rules\n * @return {Function}\n */\n function replaceWord (replaceMap, keepMap, rules) {\n return function (word) {\n // Get the correct token and case restoration functions.\n var token = word.toLowerCase();\n\n // Check against the keep object map.\n if (keepMap.hasOwnProperty(token)) {\n return restoreCase(word, token);\n }\n\n // Check against the replacement map for a direct word replacement.\n if (replaceMap.hasOwnProperty(token)) {\n return restoreCase(word, replaceMap[token]);\n }\n\n // Run all the rules against the word.\n return sanitizeWord(token, word, rules);\n };\n }\n\n /**\n * Check if a word is part of the map.\n */\n function checkWord (replaceMap, keepMap, rules, bool) {\n return function (word) {\n var token = word.toLowerCase();\n\n if (keepMap.hasOwnProperty(token)) return true;\n if (replaceMap.hasOwnProperty(token)) return false;\n\n return sanitizeWord(token, token, rules) === token;\n };\n }\n\n /**\n * Pluralize or singularize a word based on the passed in count.\n *\n * @param {string} word The word to pluralize\n * @param {number} count How many of the word exist\n * @param {boolean} inclusive Whether to prefix with the number (e.g. 3 ducks)\n * @return {string}\n */\n function pluralize (word, count, inclusive) {\n var pluralized = count === 1\n ? pluralize.singular(word) : pluralize.plural(word);\n\n return (inclusive ? count + ' ' : '') + pluralized;\n }\n\n /**\n * Pluralize a word.\n *\n * @type {Function}\n */\n pluralize.plural = replaceWord(\n irregularSingles, irregularPlurals, pluralRules\n );\n\n /**\n * Check if a word is plural.\n *\n * @type {Function}\n */\n pluralize.isPlural = checkWord(\n irregularSingles, irregularPlurals, pluralRules\n );\n\n /**\n * Singularize a word.\n *\n * @type {Function}\n */\n pluralize.singular = replaceWord(\n irregularPlurals, irregularSingles, singularRules\n );\n\n /**\n * Check if a word is singular.\n *\n * @type {Function}\n */\n pluralize.isSingular = checkWord(\n irregularPlurals, irregularSingles, singularRules\n );\n\n /**\n * Add a pluralization rule to the collection.\n *\n * @param {(string|RegExp)} rule\n * @param {string} replacement\n */\n pluralize.addPluralRule = function (rule, replacement) {\n pluralRules.push([sanitizeRule(rule), replacement]);\n };\n\n /**\n * Add a singularization rule to the collection.\n *\n * @param {(string|RegExp)} rule\n * @param {string} replacement\n */\n pluralize.addSingularRule = function (rule, replacement) {\n singularRules.push([sanitizeRule(rule), replacement]);\n };\n\n /**\n * Add an uncountable word rule.\n *\n * @param {(string|RegExp)} word\n */\n pluralize.addUncountableRule = function (word) {\n if (typeof word === 'string') {\n uncountables[word.toLowerCase()] = true;\n return;\n }\n\n // Set singular and plural references for the word.\n pluralize.addPluralRule(word, '$0');\n pluralize.addSingularRule(word, '$0');\n };\n\n /**\n * Add an irregular word definition.\n *\n * @param {string} single\n * @param {string} plural\n */\n pluralize.addIrregularRule = function (single, plural) {\n plural = plural.toLowerCase();\n single = single.toLowerCase();\n\n irregularSingles[single] = plural;\n irregularPlurals[plural] = single;\n };\n\n /**\n * Irregular rules.\n */\n [\n // Pronouns.\n ['I', 'we'],\n ['me', 'us'],\n ['he', 'they'],\n ['she', 'they'],\n ['them', 'them'],\n ['myself', 'ourselves'],\n ['yourself', 'yourselves'],\n ['itself', 'themselves'],\n ['herself', 'themselves'],\n ['himself', 'themselves'],\n ['themself', 'themselves'],\n ['is', 'are'],\n ['was', 'were'],\n ['has', 'have'],\n ['this', 'these'],\n ['that', 'those'],\n // Words ending in with a consonant and `o`.\n ['echo', 'echoes'],\n ['dingo', 'dingoes'],\n ['volcano', 'volcanoes'],\n ['tornado', 'tornadoes'],\n ['torpedo', 'torpedoes'],\n // Ends with `us`.\n ['genus', 'genera'],\n ['viscus', 'viscera'],\n // Ends with `ma`.\n ['stigma', 'stigmata'],\n ['stoma', 'stomata'],\n ['dogma', 'dogmata'],\n ['lemma', 'lemmata'],\n ['schema', 'schemata'],\n ['anathema', 'anathemata'],\n // Other irregular rules.\n ['ox', 'oxen'],\n ['axe', 'axes'],\n ['die', 'dice'],\n ['yes', 'yeses'],\n ['foot', 'feet'],\n ['eave', 'eaves'],\n ['goose', 'geese'],\n ['tooth', 'teeth'],\n ['quiz', 'quizzes'],\n ['human', 'humans'],\n ['proof', 'proofs'],\n ['carve', 'carves'],\n ['valve', 'valves'],\n ['looey', 'looies'],\n ['thief', 'thieves'],\n ['groove', 'grooves'],\n ['pickaxe', 'pickaxes'],\n ['passerby', 'passersby']\n ].forEach(function (rule) {\n return pluralize.addIrregularRule(rule[0], rule[1]);\n });\n\n /**\n * Pluralization rules.\n */\n [\n [/s?$/i, 's'],\n [/[^\\u0000-\\u007F]$/i, '$0'],\n [/([^aeiou]ese)$/i, '$1'],\n [/(ax|test)is$/i, '$1es'],\n [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],\n [/(e[mn]u)s?$/i, '$1s'],\n [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],\n [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],\n [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],\n [/(seraph|cherub)(?:im)?$/i, '$1im'],\n [/(her|at|gr)o$/i, '$1oes'],\n [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],\n [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],\n [/sis$/i, 'ses'],\n [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],\n [/([^aeiouy]|qu)y$/i, '$1ies'],\n [/([^ch][ieo][ln])ey$/i, '$1ies'],\n [/(x|ch|ss|sh|zz)$/i, '$1es'],\n [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],\n [/\\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],\n [/(pe)(?:rson|ople)$/i, '$1ople'],\n [/(child)(?:ren)?$/i, '$1ren'],\n [/eaux$/i, '$0'],\n [/m[ae]n$/i, 'men'],\n ['thou', 'you']\n ].forEach(function (rule) {\n return pluralize.addPluralRule(rule[0], rule[1]);\n });\n\n /**\n * Singularization rules.\n */\n [\n [/s$/i, ''],\n [/(ss)$/i, '$1'],\n [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\\w]|^)li)ves$/i, '$1fe'],\n [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],\n [/ies$/i, 'y'],\n [/\\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],\n [/\\b(mon|smil)ies$/i, '$1ey'],\n [/\\b((?:tit)?m|l)ice$/i, '$1ouse'],\n [/(seraph|cherub)im$/i, '$1'],\n [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],\n [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],\n [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],\n [/(test)(?:is|es)$/i, '$1is'],\n [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],\n [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],\n [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],\n [/(alumn|alg|vertebr)ae$/i, '$1a'],\n [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],\n [/(matr|append)ices$/i, '$1ix'],\n [/(pe)(rson|ople)$/i, '$1rson'],\n [/(child)ren$/i, '$1'],\n [/(eau)x?$/i, '$1'],\n [/men$/i, 'man']\n ].forEach(function (rule) {\n return pluralize.addSingularRule(rule[0], rule[1]);\n });\n\n /**\n * Uncountable rules.\n */\n [\n // Singular words with no plurals.\n 'adulthood',\n 'advice',\n 'agenda',\n 'aid',\n 'aircraft',\n 'alcohol',\n 'ammo',\n 'analytics',\n 'anime',\n 'athletics',\n 'audio',\n 'bison',\n 'blood',\n 'bream',\n 'buffalo',\n 'butter',\n 'carp',\n 'cash',\n 'chassis',\n 'chess',\n 'clothing',\n 'cod',\n 'commerce',\n 'cooperation',\n 'corps',\n 'debris',\n 'diabetes',\n 'digestion',\n 'elk',\n 'energy',\n 'equipment',\n 'excretion',\n 'expertise',\n 'firmware',\n 'flounder',\n 'fun',\n 'gallows',\n 'garbage',\n 'graffiti',\n 'hardware',\n 'headquarters',\n 'health',\n 'herpes',\n 'highjinks',\n 'homework',\n 'housework',\n 'information',\n 'jeans',\n 'justice',\n 'kudos',\n 'labour',\n 'literature',\n 'machinery',\n 'mackerel',\n 'mail',\n 'media',\n 'mews',\n 'moose',\n 'music',\n 'mud',\n 'manga',\n 'news',\n 'only',\n 'personnel',\n 'pike',\n 'plankton',\n 'pliers',\n 'police',\n 'pollution',\n 'premises',\n 'rain',\n 'research',\n 'rice',\n 'salmon',\n 'scissors',\n 'series',\n 'sewage',\n 'shambles',\n 'shrimp',\n 'software',\n 'species',\n 'staff',\n 'swine',\n 'tennis',\n 'traffic',\n 'transportation',\n 'trout',\n 'tuna',\n 'wealth',\n 'welfare',\n 'whiting',\n 'wildebeest',\n 'wildlife',\n 'you',\n /pok[eé]mon$/i,\n // Regexes.\n /[^aeiou]ese$/i, // \"chinese\", \"japanese\"\n /deer$/i, // \"deer\", \"reindeer\"\n /fish$/i, // \"fish\", \"blowfish\", \"angelfish\"\n /measles$/i,\n /o[iu]s$/i, // \"carnivorous\"\n /pox$/i, // \"chickpox\", \"smallpox\"\n /sheep$/i\n ].forEach(pluralize.addUncountableRule);\n\n return pluralize;\n});\n","export const DATA_DIR = \"data\";\nexport const MIGRATIONS_DIR = \"migrations\";\nexport const FIXTURE_PREFIX = \"vela\";\nexport const PUBLIC_DIR = \"(public)\";\nexport const APP_DIR = \"(app)\";\nexport const AUTHED_REDIRECT_PATH = \"/dashboard\";\nexport const API_URL = \"http://localhost:5173\";\n","import * as changeCase from \"change-case\";\nimport pluralize from \"pluralize\";\nimport { APP_DIR } from \"../core/constants\";\nimport type { Options } from \"../core/types\";\nimport type { Model, ModelPaths, ModelUrls } from \"./types\";\n\nconst RESERVED_WORDS = new Set([\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"export\",\n \"extends\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n \"let\",\n \"static\",\n \"package\",\n \"protected\",\n \"private\",\n \"public\",\n \"interface\",\n \"enum\",\n \"implements\",\n \"type\",\n \"namespace\",\n \"null\",\n \"true\",\n \"false\",\n \"await\",\n \"async\",\n \"arguments\",\n \"constructor\",\n]);\n\nconst RESERVED_ALIASES: Record<string, string> = {\n function: \"fn\",\n interface: \"iface\",\n type: \"type_\",\n enum: \"enum_\",\n const: \"const_\",\n let: \"let_\",\n var: \"var_\",\n class: \"class_\",\n default: \"default_\",\n delete: \"delete_\",\n new: \"new_\",\n import: \"import_\",\n export: \"export_\",\n extends: \"extends_\",\n super: \"super_\",\n return: \"return_\",\n case: \"case_\",\n switch: \"switch_\",\n try: \"try_\",\n catch: \"catch_\",\n finally: \"finally_\",\n do: \"do_\",\n while: \"while_\",\n for: \"for_\",\n if: \"if_\",\n in: \"in_\",\n of: \"of_\",\n with: \"with_\",\n this: \"this_\",\n throw: \"throw_\",\n void: \"void_\",\n typeof: \"typeOf\",\n instanceof: \"instanceOf\",\n yield: \"yield_\",\n await: \"await_\",\n async: \"async_\",\n implements: \"implements_\",\n package: \"package_\",\n private: \"private_\",\n protected: \"protected_\",\n public: \"public_\",\n namespace: \"namespace_\",\n null: \"nullValue\",\n true: \"trueValue\",\n false: \"falseValue\",\n arguments: \"args\",\n constructor: \"ctor\",\n};\n\nexport function safeVarName(str: string): string {\n if (RESERVED_WORDS.has(str)) {\n return RESERVED_ALIASES[str] ?? `${str}_`;\n }\n return str;\n}\n\nexport function validateModelName(model: string): void {\n if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(model)) {\n throw new Error(\n \"Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore\",\n );\n }\n}\n\nfunction routesDir(options: Pick<Options, \"features\">): string {\n if (options.features.auth) {\n return `src/routes/${APP_DIR}`;\n }\n return \"src/routes\";\n}\n\nexport function parseModel(\n modelPath: string,\n options: Pick<Options, \"features\">,\n): Model {\n const parts = modelPath.split(\"/\");\n const finalPart = parts[parts.length - 1];\n const restParts = parts.slice(0, -1);\n\n const displayName = pluralize.singular(changeCase.capitalCase(finalPart));\n const pluralDisplay = pluralize.plural(displayName);\n\n const name = changeCase.camelCase(displayName);\n const urlName = changeCase.kebabCase(pluralDisplay);\n const segment = [...restParts, urlName].join(\"/\");\n\n return {\n name: safeVarName(name),\n pluralName: safeVarName(changeCase.camelCase(pluralDisplay)),\n typeName: changeCase.pascalCase(displayName),\n tableName: changeCase.snakeCase(pluralDisplay),\n displayName,\n pluralDisplayName: pluralDisplay,\n schemaName: `${safeVarName(name)}Schema`,\n routeSegment: segment,\n routesDir: routesDir(options),\n };\n}\n\nexport function modelPaths(model: Model): ModelPaths {\n const base = `${model.routesDir}/${model.routeSegment}`;\n return {\n list: base,\n new: `${base}/new`,\n show: `${base}/[id]`,\n edit: `${base}/[id]/edit`,\n };\n}\n\nexport function modelUrls(model: Model): ModelUrls {\n const base = `/${model.routeSegment}`;\n return {\n list: base,\n new: `${base}/new`,\n show: `${base}/[id]`,\n edit: `${base}/[id]/edit`,\n };\n}\n","import type { Collection, CollectionField } from \"./types\";\n\nexport const DISPLAY_FIELD_CANDIDATES: string[] = [\n \"title\",\n \"name\",\n \"label\",\n \"display\",\n \"display_name\",\n \"full_name\",\n \"first_name\",\n \"last_name\",\n \"given_name\",\n \"surname\",\n \"family_name\",\n \"username\",\n \"handle\",\n \"nickname\",\n \"email\",\n \"phone\",\n \"phone_number\",\n \"headline\",\n \"subject\",\n \"caption\",\n \"summary\",\n \"description\",\n \"sku\",\n \"code\",\n \"key\",\n \"identifier\",\n \"ref\",\n \"reference\",\n \"slug\",\n \"path\",\n \"url\",\n \"id\",\n];\n\nexport function pickDisplayField(\n fields: Array<Pick<CollectionField, \"name\" | \"type\">>,\n): string {\n for (const candidate of DISPLAY_FIELD_CANDIDATES) {\n if (fields.some((f) => f.name === candidate)) {\n return candidate;\n }\n }\n return \"id\";\n}\n\nexport function collectionNames(collections: Collection[]): string[] {\n return collections.map((c) => c.name).filter((n) => !n.startsWith(\"_\"));\n}\n\nexport function collectionIdMap(\n collections: Collection[],\n): Record<string, string> {\n return Object.fromEntries(collections.map((c) => [c.name, c.id]));\n}\n\nexport function collectionDisplayFieldMap(\n collections: Collection[],\n): Record<string, string> {\n return Object.fromEntries(\n collections.map((c) => [c.name, pickDisplayField(c.fields)]),\n );\n}\n","import type { Collection, OwnershipResult } from \"./types\";\n\ninterface AuthRuleOptions {\n authCollections?: string[];\n userFieldHints?: string[];\n maxDepth?: number;\n includeRootPrefix?: boolean;\n rootPrefix?: string;\n}\n\ntype Edge = {\n from: string;\n fieldName: string;\n to: string;\n isMulti: boolean;\n hintScore: number;\n};\n\nconst DEFAULT_USER_HINTS = [\n \"user\",\n \"owner\",\n \"created_by\",\n \"author\",\n \"member\",\n \"account\",\n \"creator\",\n];\n\nfunction lower(s: string): string {\n return s.toLowerCase();\n}\n\nfunction fallback(start: string): OwnershipResult {\n return {\n rule: '@request.auth.id != \"\"',\n ownershipChainCollections: [start],\n ownershipChainFields: [],\n operator: \"=\",\n };\n}\n\nexport function generateAuthRule(\n schema: Collection[],\n startCollectionName: string,\n opts: AuthRuleOptions = {},\n): OwnershipResult {\n const AUTH = new Set((opts.authCollections ?? [\"users\"]).map(lower));\n const USER_HINTS = new Set(\n (opts.userFieldHints ?? DEFAULT_USER_HINTS).map(lower),\n );\n const MAX_DEPTH = opts.maxDepth ?? 8;\n\n const byName = new Map<string, Collection>();\n const byId = new Map<string, Collection>();\n for (const c of schema) {\n byName.set(c.name, c);\n byId.set(c.id, c);\n }\n\n if (!byName.has(startCollectionName)) {\n return fallback(startCollectionName);\n }\n\n if (AUTH.has(lower(startCollectionName))) {\n return {\n rule: \"@request.auth.id = id\",\n ownershipChainCollections: [startCollectionName],\n ownershipChainFields: [],\n operator: \"=\",\n };\n }\n\n function hintScore(fieldName: string): number {\n const l = lower(fieldName);\n if (l === \"user\") return 50;\n if (USER_HINTS.has(l)) return 20;\n return 0;\n }\n\n function outEdges(collName: string): Edge[] {\n const c = byName.get(collName);\n if (!c?.fields) return [];\n const edges: Edge[] = [];\n for (const f of c.fields) {\n if (f.type !== \"relation\" || !f.collectionId) continue;\n const toColl = byId.get(f.collectionId);\n if (!toColl) continue;\n edges.push({\n from: collName,\n fieldName: f.name,\n to: toColl.name,\n isMulti: Boolean(f.maxSelect && f.maxSelect > 1),\n hintScore: hintScore(f.name),\n });\n }\n edges.sort((a, b) => a.fieldName.localeCompare(b.fieldName));\n return edges;\n }\n\n function isAuth(collName: string): boolean {\n return AUTH.has(lower(collName));\n }\n\n function validPath(path: Edge[]): boolean {\n if (path.length === 0) return false;\n for (let i = 0; i < path.length - 1; i++) {\n if (path[i].isMulti) return false;\n }\n return isAuth(path[path.length - 1].to);\n }\n\n function pathScore(path: Edge[]): number {\n const last = path[path.length - 1];\n const lastIsMulti = last.isMulti ? 1 : 0;\n const singlesAll = path.every((e) => !e.isMulti) ? 1 : 0;\n const hintSum = path.reduce((s, e) => s + e.hintScore, 0);\n const lastIsFieldNamedUser = lower(last.fieldName) === \"user\" ? 1 : 0;\n return (\n 100 * path.length +\n 50 * lastIsMulti -\n 40 * lastIsFieldNamedUser -\n 15 * singlesAll -\n hintSum\n );\n }\n\n function pathKey(path: Edge[]): string {\n return path.map((e) => `${e.from}.${e.fieldName}->${e.to}`).join(\"|\");\n }\n\n const candidates: Edge[][] = [];\n const visited = new Set<string>([startCollectionName]);\n\n function dfs(curr: string, path: Edge[], depth: number) {\n if (depth > MAX_DEPTH) return;\n\n if (\n path.length > 0 &&\n isAuth(path[path.length - 1].to) &&\n validPath(path)\n ) {\n candidates.push([...path]);\n return;\n }\n\n for (const e of outEdges(curr)) {\n if (visited.has(e.to)) continue;\n if (e.isMulti && !isAuth(e.to)) continue;\n\n visited.add(e.to);\n path.push(e);\n dfs(e.to, path, depth + 1);\n path.pop();\n visited.delete(e.to);\n }\n }\n\n dfs(startCollectionName, [], 0);\n\n if (candidates.length === 0) {\n return fallback(startCollectionName);\n }\n\n candidates.sort((a, b) => {\n const diff = pathScore(a) - pathScore(b);\n if (diff !== 0) return diff;\n return pathKey(a).localeCompare(pathKey(b));\n });\n\n const best = candidates[0];\n const fields = best.map((e) => e.fieldName);\n const collections = [startCollectionName, ...best.map((e) => e.to)];\n const last = best[best.length - 1];\n const operator: \"=\" | \"?=\" = last.isMulti ? \"?=\" : \"=\";\n\n const fieldChain = fields.join(\".\");\n const prefix = opts.includeRootPrefix\n ? (opts.rootPrefix ?? startCollectionName) + \".\"\n : \"\";\n const rule = `@request.auth.id ${operator} ${prefix}${fieldChain}.id`;\n\n return {\n rule,\n ownershipChainCollections: collections,\n ownershipChainFields: fields,\n operator,\n };\n}\n","import * as changeCase from \"change-case\";\nimport pluralize from \"pluralize\";\nimport type { Options } from \"../core/types\";\nimport {\n collectionDisplayFieldMap,\n collectionIdMap,\n collectionNames,\n} from \"./collections\";\nimport { parseModel } from \"./model\";\nimport { generateAuthRule } from \"./permissions\";\nimport type { Collection, Field, Model, OwnershipResult } from \"./types\";\n\nexport function splitFieldDef(definition: string): [string, string] {\n let inQuote: '\"' | \"'\" | null = null;\n let escape = false;\n let parenDepth = 0;\n for (let i = 0; i < definition.length; i++) {\n const ch = definition[i];\n if (escape) {\n escape = false;\n continue;\n }\n if (inQuote) {\n if (ch === \"\\\\\") {\n escape = true;\n continue;\n }\n if (ch === inQuote) {\n inQuote = null;\n }\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n inQuote = ch;\n continue;\n }\n if (ch === \"(\") {\n parenDepth++;\n continue;\n }\n if (ch === \")\") {\n parenDepth = Math.max(0, parenDepth - 1);\n continue;\n }\n if (ch === \":\" && parenDepth === 0) {\n return [definition.slice(0, i), definition.slice(i + 1)];\n }\n }\n return [definition, \"\"];\n}\n\nfunction stripQuotes(s: string): string {\n const t = s.trim();\n if (\n (t.startsWith('\"') && t.endsWith('\"')) ||\n (t.startsWith(\"'\") && t.endsWith(\"'\"))\n ) {\n return t.slice(1, -1).replace(/\\\\([\"'])/g, \"$1\");\n }\n return t;\n}\n\nfunction parseOptionToken(token: string): { label: string; value: string } {\n let colonIndex = -1;\n let inQuote: '\"' | \"'\" | null = null;\n let escape = false;\n for (let j = 0; j < token.length; j++) {\n const ch = token[j];\n if (escape) {\n escape = false;\n continue;\n }\n if (inQuote) {\n if (ch === \"\\\\\") {\n escape = true;\n continue;\n }\n if (ch === inQuote) {\n inQuote = null;\n }\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n inQuote = ch;\n continue;\n }\n if (ch === \":\") {\n colonIndex = j;\n break;\n }\n }\n\n let value: string;\n let label: string;\n if (colonIndex >= 0) {\n value = token.slice(0, colonIndex).trim();\n label = token.slice(colonIndex + 1).trim();\n } else {\n value = token.trim();\n label = value;\n }\n return { label: stripQuotes(label), value: stripQuotes(value) };\n}\n\nexport function parseSelectOptions(\n options: string,\n): Array<{ label: string; value: string }> {\n const result: Array<{ label: string; value: string }> = [];\n let current = \"\";\n let inQuote: '\"' | \"'\" | null = null;\n let escape = false;\n\n for (let i = 0; i < options.length; i++) {\n const ch = options[i];\n\n if (escape) {\n current += ch;\n escape = false;\n continue;\n }\n\n if (inQuote) {\n if (ch === \"\\\\\") {\n escape = true;\n current += ch;\n continue;\n }\n if (ch === inQuote) {\n inQuote = null;\n current += ch;\n continue;\n }\n current += ch;\n continue;\n }\n\n if (ch === '\"' || ch === \"'\") {\n inQuote = ch;\n current += ch;\n continue;\n }\n\n if (ch === \",\") {\n const token = current.trim();\n if (token.length > 0) {\n result.push(parseOptionToken(token));\n }\n current = \"\";\n continue;\n }\n\n current += ch;\n }\n\n const last = current.trim();\n if (last.length > 0) {\n result.push(parseOptionToken(last));\n }\n\n return result;\n}\n\nconst TYPE_ALIASES: Record<string, string> = {\n string: \"text\",\n boolean: \"bool\",\n geopoint: \"geoPoint\",\n references: \"relation\",\n integer: \"number\",\n int: \"number\",\n float: \"number\",\n decimal: \"number\",\n double: \"number\",\n datetime: \"date\",\n timestamp: \"date\",\n};\n\ninterface NormalizedType {\n type: string;\n required: boolean;\n selectOptions: Array<{ label: string; value: string }>;\n}\n\nfunction normalizeType(rawType: string): NormalizedType {\n const required = rawType.endsWith(\"!\");\n let type = required ? rawType.slice(0, -1) : rawType;\n let selectOptions: Array<{ label: string; value: string }> = [];\n\n if (type.startsWith(\"select(\") && type.endsWith(\")\")) {\n const inner = type.slice(7, -1);\n selectOptions = parseSelectOptions(inner);\n type = \"select\";\n }\n\n if (type === \"files\") {\n return { type: \"file\", required, selectOptions };\n }\n\n if (type in TYPE_ALIASES) {\n type = TYPE_ALIASES[type];\n }\n\n return { type, required, selectOptions };\n}\n\nfunction inferMaxSelect(name: string): number {\n const singular = pluralize.singular(name);\n const plural = pluralize.plural(singular);\n return name === plural ? 99 : 1;\n}\n\nfunction resolveRelation(\n name: string,\n collectionName: string,\n parent: Model,\n ids: Record<string, string>,\n displayFields: Record<string, string>,\n options: Pick<Options, \"features\">,\n): {\n collectionId: string;\n displayField: string;\n relatedModel: Model;\n singularRelationName: string;\n pluralRelationName: string;\n maxSelect: number;\n} {\n const relatedModel = parseModel(collectionName, options);\n const singular = pluralize.singular(name);\n const plural = pluralize.plural(singular);\n return {\n collectionId: ids[collectionName],\n displayField: displayFields[collectionName] ?? \"id\",\n relatedModel,\n singularRelationName: changeCase.camelCase(\n `${parent.displayName} ${relatedModel.displayName}`,\n ),\n pluralRelationName: changeCase.camelCase(\n `${parent.displayName} ${relatedModel.pluralDisplayName}`,\n ),\n maxSelect: name === plural ? 999 : 1,\n };\n}\n\nfunction resolveField(\n name: string,\n normalized: NormalizedType,\n parent: Model,\n collections: Collection[],\n options: Pick<Options, \"features\">,\n): Field {\n const title = changeCase.capitalCase(name);\n const { type, required, selectOptions } = normalized;\n const names = collectionNames(collections);\n const ids = collectionIdMap(collections);\n const displayFields = collectionDisplayFieldMap(collections);\n const namesSingular = names.map((c) => pluralize.singular(c));\n\n // current_user: special auth-mode relation to users\n if (options.features.auth && type === \"current_user\" && ids[\"users\"]) {\n const rel = resolveRelation(\n name,\n \"users\",\n parent,\n ids,\n displayFields,\n options,\n );\n return {\n type: \"relation\",\n name,\n title,\n required,\n collectionId: rel.collectionId,\n maxSelect: 1,\n displayField: rel.displayField,\n relatedModel: rel.relatedModel,\n singularRelationName: rel.singularRelationName,\n pluralRelationName: rel.pluralRelationName,\n isCurrentUser: true,\n };\n }\n\n // autodate\n if (type === \"autodate\") {\n const onCreate = name.includes(\"create\");\n const onUpdate = name.includes(\"update\");\n if (!onCreate && !onUpdate) {\n throw new Error(\n `Invalid autodate field: ${name}. Must be one of created/created_at/updated/updated_at.`,\n );\n }\n return { type: \"autodate\", name, title, required, onCreate, onUpdate };\n }\n\n // select with inline options\n if (type === \"select\") {\n return {\n type: \"select\",\n name,\n title,\n required,\n maxSelect: inferMaxSelect(name),\n options: selectOptions,\n };\n }\n\n // file / files\n if (type === \"file\") {\n return {\n type: \"file\",\n name,\n title,\n required,\n maxSelect: inferMaxSelect(name),\n };\n }\n\n // relation via `name:relation` or `name:references`\n if (type === \"relation\") {\n const singular = pluralize.singular(name);\n const plural = pluralize.plural(singular);\n if (!names.includes(plural)) {\n throw new Error(\n `Invalid relation field: ${name}. Must be one of ${names.join(\", \")} (singular or plural)`,\n );\n }\n const rel = resolveRelation(\n name,\n plural,\n parent,\n ids,\n displayFields,\n options,\n );\n return {\n type: \"relation\",\n name,\n title,\n required,\n ...rel,\n isCurrentUser: false,\n };\n }\n\n // relation via collection name as type: `owners:users` or `owner:user`\n if (names.includes(type)) {\n const rel = resolveRelation(\n name,\n type,\n parent,\n ids,\n displayFields,\n options,\n );\n return {\n type: \"relation\",\n name,\n title,\n required,\n ...rel,\n isCurrentUser: false,\n };\n }\n if (namesSingular.includes(type)) {\n const plural = pluralize.plural(type);\n if (names.includes(plural)) {\n const rel = resolveRelation(\n name,\n plural,\n parent,\n ids,\n displayFields,\n options,\n );\n return {\n type: \"relation\",\n name,\n title,\n required,\n collectionId: rel.collectionId,\n displayField: rel.displayField,\n relatedModel: rel.relatedModel,\n singularRelationName: rel.singularRelationName,\n pluralRelationName: rel.pluralRelationName,\n maxSelect: 1,\n isCurrentUser: false,\n };\n }\n }\n\n // Validate that it's a known simple type\n const allValidTypes = [\n ...new Set([\n \"text\",\n \"number\",\n \"bool\",\n \"date\",\n \"email\",\n \"password\",\n \"url\",\n \"editor\",\n \"json\",\n \"geoPoint\",\n \"autodate\",\n \"select\",\n \"file\",\n \"relation\",\n ...(options.features.auth ? [\"current_user\"] : []),\n ...names,\n ]),\n ];\n if (\n !(\n [\n \"text\",\n \"number\",\n \"bool\",\n \"date\",\n \"email\",\n \"password\",\n \"url\",\n \"editor\",\n \"json\",\n \"geoPoint\",\n ] as string[]\n ).includes(type)\n ) {\n throw new Error(\n `Invalid field type: ${type}. Valid types are: ${allValidTypes.join(\", \").replace(\"relation\", \"references\")}`,\n );\n }\n\n return { type: type as Field[\"type\"], name, title, required } as Field;\n}\n\nexport function resolveFields(\n fields: string[],\n parent: Model,\n collections: Collection[],\n options: Pick<Options, \"features\">,\n): { fields: Field[]; auth: OwnershipResult | undefined } {\n const parsed: Field[] = [];\n\n for (const fieldDef of fields) {\n const [name, rawType] = splitFieldDef(fieldDef);\n\n if (!name || !rawType) {\n throw new Error(\n `Invalid field format: ${fieldDef}. Expected format: name:type or name:type!`,\n );\n }\n\n if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name)) {\n throw new Error(\n `Invalid field name: ${name}. Must start with a letter and contain only alphanumeric characters`,\n );\n }\n\n const normalized = normalizeType(rawType);\n parsed.push(resolveField(name, normalized, parent, collections, options));\n }\n\n const auth = options.features.auth\n ? generateAuthRule(\n [\n ...collections,\n {\n id: \"new\",\n name: parent.tableName,\n type: \"base\",\n fields: parsed.map((f) => ({\n name: f.name,\n type: f.type,\n collectionId: f.type === \"relation\" ? f.collectionId : undefined,\n maxSelect: \"maxSelect\" in f ? f.maxSelect : undefined,\n })),\n },\n ],\n parent.tableName,\n )\n : undefined;\n\n return { fields: parsed, auth };\n}\n\nexport async function parseFields(\n fields: string[],\n parent: Model,\n options: Pick<Options, \"env\" | \"features\">,\n): Promise<{ fields: Field[]; auth: OwnershipResult | undefined }> {\n let collections: Collection[];\n if (options.env === \"runtime\") {\n const { getCollections } = await import(\"./env.runtime\");\n collections = await getCollections();\n } else {\n const { getPreviewCollections } = await import(\"./env.preview\");\n collections = getPreviewCollections(options);\n }\n return resolveFields(fields, parent, collections, options);\n}\n","import dedent from \"dedent\";\nimport type { Options } from \"../../core/types\";\nimport { parseModel, type Collection, type Field, type Model } from \"../../parse\";\n\nconst GENERATED_DATE = \"2024-01-01T00:00:00.000Z\";\n\nclass RawExpression {\n constructor(public readonly expression: string) {}\n}\n\ntype FixtureValue =\n | string\n | number\n | boolean\n | null\n | FixtureValue[]\n | { [key: string]: FixtureValue }\n | RawExpression;\n\ntype RuntimeCollectionField = Collection[\"fields\"][number] & {\n values?: string[];\n system?: boolean;\n};\n\ntype ScaffoldUrls = {\n list: string;\n new: string;\n show: string;\n edit: string;\n};\n\nfunction fixtureToCode(value: FixtureValue): string {\n if (value instanceof RawExpression) {\n return value.expression;\n }\n\n if (Array.isArray(value)) {\n return `[${value.map((entry) => fixtureToCode(entry)).join(\", \")}]`;\n }\n\n if (value && typeof value === \"object\") {\n const entries = Object.entries(value)\n .map(([key, entry]) => `${JSON.stringify(key)}: ${fixtureToCode(entry)}`)\n .join(\", \");\n return `{ ${entries} }`;\n }\n\n return JSON.stringify(value);\n}\n\nfunction fixtureObjectToCode(data: Record<string, FixtureValue>): string {\n const entries = Object.entries(data).map(\n ([key, value]) => `${JSON.stringify(key)}: ${fixtureToCode(value)}`,\n );\n return `{ ${entries.join(\", \")} }`;\n}\n\nfunction fieldTypeFromCollectionField(rawType: string): Field[\"type\"] | undefined {\n switch (rawType) {\n case \"text\":\n case \"number\":\n case \"bool\":\n case \"date\":\n case \"email\":\n case \"password\":\n case \"url\":\n case \"editor\":\n case \"autodate\":\n case \"select\":\n case \"file\":\n case \"json\":\n case \"geoPoint\":\n case \"relation\":\n return rawType;\n case \"string\":\n return \"text\";\n case \"boolean\":\n return \"bool\";\n case \"datetime\":\n case \"timestamp\":\n return \"date\";\n case \"references\":\n return \"relation\";\n case \"float\":\n case \"integer\":\n case \"int\":\n case \"decimal\":\n case \"double\":\n return \"number\";\n default:\n return undefined;\n }\n}\n\nfunction relationUrl(url: string, idExpression: string): string {\n return url.replace(\"[id]\", `\\${${idExpression}}`);\n}\n\nfunction mockValueForField(\n field: Pick<Field, \"name\" | \"type\"> & Partial<Field>,\n relationIdsByCollectionId: Record<string, string>,\n options: { forForm: boolean; authEnabled: boolean },\n): FixtureValue | undefined {\n switch (field.type) {\n case \"text\":\n case \"editor\":\n return `${field.name} value`;\n case \"number\":\n return 42;\n case \"bool\":\n return true;\n case \"date\":\n return GENERATED_DATE;\n case \"email\":\n return `test-${field.name}@example.com`;\n case \"password\":\n return \"password\";\n case \"url\":\n return \"https://example.com\";\n case \"json\":\n return options.forForm\n ? JSON.stringify({ [field.name]: \"value\" })\n : { [field.name]: \"value\" };\n case \"geoPoint\":\n return options.forForm\n ? JSON.stringify({ lat: 40.7128, lon: -74.006 })\n : { lat: 40.7128, lon: -74.006 };\n case \"select\": {\n const value = field.options?.[0]?.value ?? \"default\";\n return field.maxSelect && field.maxSelect > 1 ? [value] : value;\n }\n case \"relation\": {\n if (\n options.authEnabled &&\n (field.isCurrentUser || field.relatedModel?.tableName === \"users\")\n ) {\n return new RawExpression(\"context.user.id\");\n }\n\n const relationId = field.collectionId\n ? relationIdsByCollectionId[field.collectionId]\n : undefined;\n if (relationId) {\n return new RawExpression(relationId);\n }\n return \"missing-relation-id\";\n }\n case \"file\":\n case \"autodate\":\n return undefined;\n default:\n return undefined;\n }\n}\n\nfunction fixtureDataFromFields(\n fields: Field[],\n relationIdsByCollectionId: Record<string, string>,\n options: { forForm: boolean; authEnabled: boolean },\n): Record<string, FixtureValue> {\n const data: Record<string, FixtureValue> = {};\n\n for (const field of fields) {\n if (field.type === \"file\" || field.type === \"autodate\") {\n continue;\n }\n\n if (options.authEnabled && field.type === \"relation\" && field.isCurrentUser) {\n if (!options.forForm) {\n data[field.name] = new RawExpression(\"context.user.id\");\n }\n continue;\n }\n\n const value = mockValueForField(field, relationIdsByCollectionId, options);\n if (value !== undefined) {\n data[field.name] = value;\n }\n }\n\n return data;\n}\n\nfunction fixtureDataFromCollectionFields(\n fields: RuntimeCollectionField[],\n relationIdsByCollectionId: Record<string, string>,\n options: Pick<Options, \"features\">,\n): Record<string, FixtureValue> {\n const data: Record<string, FixtureValue> = {};\n\n for (const field of fields) {\n if (field.system || field.name === \"id\") {\n continue;\n }\n\n const type = fieldTypeFromCollectionField(field.type);\n if (!type || type === \"file\" || type === \"autodate\") {\n continue;\n }\n\n if (type === \"relation\" && !field.collectionId) {\n continue;\n }\n\n let value: FixtureValue | undefined;\n if (type === \"relation\") {\n value = field.collectionId\n ? new RawExpression(\n relationIdsByCollectionId[field.collectionId] ?? '\"missing-relation-id\"',\n )\n : undefined;\n } else if (type === \"select\") {\n const firstValue = field.values?.[0] ?? \"default\";\n value = (field.maxSelect ?? 1) > 1 ? [firstValue] : firstValue;\n } else {\n value = mockValueForField(\n { name: field.name, type },\n relationIdsByCollectionId,\n { forForm: false, authEnabled: options.features.auth },\n );\n }\n\n if (value !== undefined) {\n data[field.name] = value;\n }\n }\n\n return data;\n}\n\nfunction ensureAuthCollectionFixture(data: Record<string, FixtureValue>) {\n data.email = new RawExpression(\n \"`test-${Math.random().toString(36).slice(2)}@example.com`\",\n );\n data.password = \"password\";\n data.passwordConfirm = \"password\";\n}\n\nfunction orderedDependencyCollections(\n collection: Collection | undefined,\n collections: Collection[],\n): Collection[] {\n if (!collection) {\n return [];\n }\n\n const byId = new Map(collections.map((entry) => [entry.id, entry]));\n const visited = new Set<string>();\n const visiting = new Set<string>();\n const ordered: Collection[] = [];\n\n const walk = (collectionId: string) => {\n if (visited.has(collectionId) || visiting.has(collectionId)) {\n return;\n }\n\n const candidate = byId.get(collectionId);\n if (!candidate) {\n return;\n }\n\n visiting.add(collectionId);\n for (const field of candidate.fields as RuntimeCollectionField[]) {\n if (field.type !== \"relation\" || !field.collectionId) {\n continue;\n }\n walk(field.collectionId);\n }\n visiting.delete(collectionId);\n visited.add(collectionId);\n ordered.push(candidate);\n };\n\n for (const field of collection.fields as RuntimeCollectionField[]) {\n if (field.type !== \"relation\" || !field.collectionId) {\n continue;\n }\n walk(field.collectionId);\n }\n\n return ordered;\n}\n\nfunction uniqueVarName(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n\n let index = 2;\n while (used.has(`${base}${index}`)) {\n index += 1;\n }\n\n const name = `${base}${index}`;\n used.add(name);\n return name;\n}\n\nfunction fallbackCollectionFromFields(model: Model, fields: Field[]): Collection {\n return {\n id: `generated-${model.tableName}`,\n name: model.tableName,\n type: \"base\",\n fields: fields.map((field) => {\n if (field.type === \"relation\") {\n return {\n name: field.name,\n type: field.type,\n collectionId: field.collectionId,\n maxSelect: field.maxSelect,\n };\n }\n\n if (field.type === \"select\") {\n return {\n name: field.name,\n type: field.type,\n maxSelect: field.maxSelect,\n values: field.options.map((option) => option.value),\n };\n }\n\n if (field.type === \"file\" || field.type === \"autodate\") {\n return {\n name: field.name,\n type: field.type,\n maxSelect: field.type === \"file\" ? field.maxSelect : undefined,\n };\n }\n\n return { name: field.name, type: field.type };\n }),\n };\n}\n\nfunction relationDependencyContext(\n model: Model,\n fields: Field[],\n options: Options,\n collections: Collection[],\n) {\n const collection =\n collections.find((entry) => entry.name === model.tableName) ??\n fallbackCollectionFromFields(model, fields);\n\n const dependencies = orderedDependencyCollections(collection, collections).filter(\n (entry) => !(options.features.auth && entry.name === \"users\"),\n );\n\n const relationIdsByCollectionId: Record<string, string> = {};\n const dependencyVars: Array<{ varName: string; collection: Collection }> = [];\n const usedVarNames = new Set<string>();\n\n for (const dependency of dependencies) {\n const varName = uniqueVarName(parseModel(dependency.name, options).name, usedVarNames);\n dependencyVars.push({ varName, collection: dependency });\n relationIdsByCollectionId[dependency.id] = `${varName}.id`;\n }\n\n const declarations = dependencyVars.length\n ? `${dependencyVars.map((dependency) => `let ${dependency.varName}: { id: string };`).join(\"\\n\")}\\n\\n`\n : \"\";\n\n const setupLines = dependencyVars.map(({ varName, collection: dependency }) => {\n const payload = fixtureDataFromCollectionFields(\n dependency.fields as RuntimeCollectionField[],\n relationIdsByCollectionId,\n options,\n );\n if (dependency.type === \"auth\") {\n ensureAuthCollectionFixture(payload);\n }\n return `${varName} = await context.admin.collection(\"${dependency.name}\").create(${fixtureObjectToCode(payload)});`;\n });\n\n const cleanupLines = dependencyVars\n .slice()\n .reverse()\n .map(\n ({ varName, collection: dependency }) =>\n `await context.admin.collection(\"${dependency.name}\").delete(${varName}.id);`,\n );\n\n const requestAgent = options.features.auth ? \"context.agent\" : \"context.request\";\n const authSetup = options.features.auth\n ? 'await context.agent.authenticateUser();\\n '\n : \"\";\n\n let setupSection = \"\";\n if (setupLines.length > 0 || options.features.auth) {\n setupSection += dedent`\n beforeEach(async (context) => {\n ${authSetup}${setupLines.join(\"\\n \")}\n });\n `;\n }\n\n if (cleanupLines.length > 0) {\n setupSection +=\n \"\\n\\n\" +\n dedent`\n afterEach(async (context) => {\n ${cleanupLines.join(\"\\n \")}\n });\n `;\n }\n\n return {\n declarations,\n setupSection,\n requestAgent,\n modelDbData: fixtureObjectToCode(\n fixtureDataFromFields(fields, relationIdsByCollectionId, {\n forForm: false,\n authEnabled: options.features.auth,\n }),\n ),\n modelFormData: fixtureObjectToCode(\n fixtureDataFromFields(fields, relationIdsByCollectionId, {\n forForm: true,\n authEnabled: options.features.auth,\n }),\n ),\n };\n}\n\nexport function generateScaffoldServerTestSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n options: Options,\n collections: Collection[],\n): string {\n const { declarations, setupSection, requestAgent, modelDbData, modelFormData } =\n relationDependencyContext(model, fields, options, collections);\n\n return dedent`\n import { afterEach, beforeEach, describe, expect, it } from \"vitest\";\n\n describe(\"${model.pluralName}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${urls.list}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${urls.list}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${urls.new}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${urls.new}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${urls.new}\", () => {\n it(\"should create a new ${model.displayName.toLowerCase()}\", async (context) => {\n const response = await ${requestAgent}.post(\"${urls.new}\").type(\"form\").send(${modelFormData});\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(response.body.location);\n expect(response2.status).toBe(200);\n });\n });\n\n describe(\"GET ${urls.show}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(urls.show, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n\n it(\"should return a 404 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${urls.show.replace(\"[id]\", \"non-existent\")}\");\n expect(response.status).toBe(404);\n });\n });\n\n describe(\"POST ${urls.show}\", () => {\n it(\"should delete a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.post(\\`${relationUrl(urls.show, \"id\")}\\`).type(\"form\");\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(\\`${relationUrl(urls.show, \"id\")}\\`);\n expect(response2.status).toBe(404);\n });\n });\n\n describe(\"GET ${urls.edit}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(urls.edit, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${urls.edit}\", () => {\n it(\"should update a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}\n .post(\\`${relationUrl(urls.edit, \"id\")}\\`)\n .type(\"form\")\n .send(${modelFormData});\n expect(response.body.status).toBe(303);\n expect(response.body.location).toBe(\\`${relationUrl(urls.show, \"id\")}\\`);\n });\n });\n });\n `;\n}\n\nexport function generateFormServerTestSnippet(\n model: Model,\n formUrl: string,\n fields: Field[],\n options: Options,\n collections: Collection[],\n): string {\n const { declarations, setupSection, requestAgent, modelFormData } =\n relationDependencyContext(model, fields, options, collections);\n\n return dedent`\n import { afterEach, beforeEach, describe, expect, it } from \"vitest\";\n\n describe(\"${formUrl}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${formUrl}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${formUrl}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${formUrl}\", () => {\n it(\"should submit the form successfully\", async (context) => {\n const response = await ${requestAgent}.post(\"${formUrl}\").type(\"form\").send(${modelFormData});\n expect(response.body.status).toBe(200);\n });\n });\n });\n `;\n}\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n getFieldComponents,\n getFieldImports,\n renderField,\n selectFieldLabelMap,\n} from \"../field\";\nimport {\n parseFields,\n parseModel,\n validateModelName,\n type Collection,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport { generateFormServerTestSnippet } from \"../tests\";\n\nfunction formPaths(modelPath: string, routesDir: string) {\n const normalizedModelPath = modelPath.replace(/^\\/+|\\/+$/g, \"\");\n const basePath = `${routesDir}/${normalizedModelPath}`;\n const baseUrl = `/${normalizedModelPath}`;\n\n return {\n pagePath: basePath,\n pageUrl: baseUrl,\n };\n}\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new Error(\"Invalid command arguments. Expected: <model> <fields...>\");\n }\n if (fields.length === 0) {\n throw new Error(\"At least one field definition is required.\");\n }\n\n return { modelPath, fields };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction escapeFieldName(fieldName: string): string {\n const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n return validIdentifierRegex.test(fieldName) ? fieldName : `'${fieldName}'`;\n}\n\nfunction getFormSchemaForField(field: Field): string {\n const selectValues =\n field.type === \"select\"\n ? `[${field.options.map((option) => JSON.stringify(option.value)).join(\", \")}]`\n : \"\";\n\n let schema: string;\n switch (field.type) {\n case \"text\":\n schema = \"z.string()\";\n break;\n case \"number\":\n schema = \"z.number()\";\n break;\n case \"bool\":\n schema = \"z.boolean().default(false)\";\n break;\n case \"date\":\n schema = \"z.string()\";\n break;\n case \"email\":\n schema = \"z.string().email()\";\n break;\n case \"password\":\n schema = \"z.string()\";\n break;\n case \"url\":\n schema = \"z.string().url()\";\n break;\n case \"editor\":\n schema = \"z.string()\";\n break;\n case \"autodate\":\n schema = \"z.string()\";\n break;\n case \"select\":\n if (selectValues) {\n schema =\n field.maxSelect > 1\n ? `z.array(z.enum(${selectValues}))`\n : `z.enum(${selectValues})`;\n } else {\n schema = \"z.string()\";\n }\n break;\n case \"file\":\n schema =\n field.maxSelect > 1\n ? \"z.string().array()\"\n : \"z.union([z.instanceof(File), z.string()])\";\n break;\n case \"json\":\n schema = \"z.any()\";\n break;\n case \"geoPoint\":\n schema = `z.preprocess((val) => {\n if (typeof val === \"string\") {\n return val;\n }\n return JSON.stringify(val);\n}, z.string()${field.required ? \"\" : \".optional()\"}) as z.ZodEffects<${field.required ? \"\" : \"z.ZodOptional<\"}z.ZodString${field.required ? \"\" : \">\"}, any, any>`;\n break;\n case \"relation\":\n schema = field.maxSelect > 1 ? \"z.array(z.string())\" : \"z.string()\";\n break;\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n\n const nonEmptyTypes: Field[\"type\"][] = [\"text\"];\n if (nonEmptyTypes.includes(field.type)) {\n return field.required ? `${schema}.nonempty()` : `${schema}.optional()`;\n }\n\n if (field.required) {\n return schema;\n }\n\n if (field.type === \"geoPoint\") {\n return schema;\n }\n\n if (field.type === \"file\" && field.maxSelect <= 1) {\n return `${schema}.optional().default(\"\")`;\n }\n\n return `${schema}.optional()`;\n}\n\nfunction schemaFields(\n fields: Field[],\n): Array<{ name: string; schema: string }> {\n const allFields: Array<{ name: string; schema: string }> = [];\n\n for (const field of fields) {\n if (field.type === \"file\" && field.maxSelect > 1) {\n allFields.push({\n name: field.name,\n schema: getFormSchemaForField({ ...field, required: false }),\n });\n allFields.push({\n name: `${field.name}+`,\n schema: \"z.instanceof(File).array().optional()\",\n });\n allFields.push({\n name: `${field.name}-`,\n schema: \"z.string().array().optional()\",\n });\n continue;\n }\n\n allFields.push({ name: field.name, schema: getFormSchemaForField(field) });\n }\n\n return allFields;\n}\n\nfunction generateSchema(model: Model, fields: Field[]): string {\n const fieldLines = schemaFields(fields)\n .map((field) => `${escapeFieldName(field.name)}: ${field.schema}`)\n .join(\",\\n \");\n\n return dedent`\n import { z } from \"zod/v3\";\n\n export const ${model.schemaName} = z.object({\n ${fieldLines}\n });\n `;\n}\n\nfunction pageImports(model: Model, fields: Field[]): string[] {\n const components = getFieldComponents(fields);\n const imports = [\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zodClient } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"$lib/schemas/${model.name}\";`,\n ...getFieldImports(components),\n ];\n\n return [...new Set(imports)];\n}\n\nfunction pageScriptSnippet(model: Model, fields: Field[]): string {\n const selectFields = fields.filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n );\n const labelMaps = selectFields\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n\n return dedent`\n ${labelMaps}\n\n const form = superForm(untrack(() => data.form), {\n validators: zodClient(${model.schemaName}),\n });\n\n const { form: formData } = form;\n `;\n}\n\nfunction pageSnippet(model: Model, fields: Field[]): string {\n const imports = pageImports(model, fields).join(\"\\n\");\n const scriptSnippet = pageScriptSnippet(model, fields);\n const fieldSnippet = fields.map((field) => renderField(field)).join(\"\\n\");\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n let { data } = $props();\n ${scriptSnippet}\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\">${model.displayName}</h1>\n </div>\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldSnippet}\n </div>\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button>Submit</Form.Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction serverSnippet(model: Model, fields: Field[]): string {\n const withFiles = hasFiles(fields);\n const imports = dedent`\n import { fail, superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"$lib/schemas/${model.name}\";\n import { setFlash } from \"sveltekit-flash-message/server\";\n `;\n\n return dedent`\n ${imports}\n\n export const load = async () => {\n const form = await superValidate(zod(${model.schemaName}));\n return { form };\n };\n\n export const actions = {\n default: async ({ request, cookies }) => {\n const form = await superValidate(request, zod(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n setFlash({ type: \"toast\", message: \"Form posted successfully\" }, cookies);\n\n return ${withFiles ? \"withFiles({ form })\" : \"{ form }\"};\n }\n };\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n\n validateModelName(modelPath);\n const model = parseModel(modelPath, options);\n const parsed = await parseFields(fieldDefs, model, options);\n const fields = parsed.fields;\n const { pagePath, pageUrl } = formPaths(modelPath, model.routesDir);\n const collections =\n options.env === \"runtime\"\n ? ((await (\n await import(\"../../../parse/env.runtime\")\n ).getCollections()) as Collection[])\n : (await import(\"../../../parse/env.preview\")).getPreviewCollections(\n options,\n );\n\n const creates = [\n toFile(`${pagePath}/+page.svelte`, pageSnippet(model, fields)),\n toFile(`${pagePath}/+page.server.ts`, serverSnippet(model, fields)),\n toFile(\n `${pagePath}/server.test.ts`,\n generateFormServerTestSnippet(\n model,\n pageUrl,\n fields,\n options,\n collections,\n ),\n ),\n toFile(`src/lib/schemas/${model.name}.ts`, generateSchema(model, fields)),\n ];\n\n const components = getFieldComponents(fields) as Component[];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n packages: [],\n collections: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-form\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/generate/form\";\nconst DOCS = \"/generate/form\";\n\n// Generate entrypoint for the pattern. This function is roughly the same for all patterns.\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a form\",\n summary: \"Generates a form.\",\n categories: [\"forms\"],\n tags: [\"sveltekit\", \"superforms\", \"validation\", \"zod\"],\n\n command: {\n raw: \"vela generate form contact name:text email:email message:editor\",\n base: \"vela generate form\",\n argv: [\"contact\", \"name:text\", \"email:email\", \"message:editor\"],\n },\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import * as changeCase from \"change-case\";\nimport dedent from \"dedent\";\nimport pluralize from \"pluralize\";\nimport type { CollectionFieldSpec, CollectionSpec, Options } from \"../../core/types\";\nimport {\n collectionDisplayFieldMap,\n parseModel,\n type Collection,\n type Field,\n type Model,\n type OwnershipResult,\n} from \"../../parse\";\n\ninterface RuntimeCollectionField {\n name: string;\n type: string;\n required?: boolean;\n system?: boolean;\n collectionId?: string;\n maxSelect?: number;\n values?: string[];\n onCreate?: boolean;\n onUpdate?: boolean;\n}\n\ninterface SchemaField {\n name: string;\n type: Field[\"type\"];\n required: boolean;\n maxSelect?: number;\n options?: Array<{ label: string; value: string }>;\n collectionId?: string;\n onCreate?: boolean;\n onUpdate?: boolean;\n}\n\nconst NON_EMPTY_FIELDS: Field[\"type\"][] = [\"text\"];\n\nconst TYPE_ALIASES: Record<string, Field[\"type\"]> = {\n string: \"text\",\n boolean: \"bool\",\n geopoint: \"geoPoint\",\n references: \"relation\",\n integer: \"number\",\n int: \"number\",\n float: \"number\",\n decimal: \"number\",\n double: \"number\",\n datetime: \"date\",\n timestamp: \"date\",\n text: \"text\",\n number: \"number\",\n bool: \"bool\",\n date: \"date\",\n email: \"email\",\n password: \"password\",\n url: \"url\",\n editor: \"editor\",\n autodate: \"autodate\",\n select: \"select\",\n file: \"file\",\n json: \"json\",\n geoPoint: \"geoPoint\",\n relation: \"relation\",\n};\n\nfunction escapeFieldName(fieldName: string): string {\n const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n return validIdentifierRegex.test(fieldName) ? fieldName : `'${fieldName}'`;\n}\n\nfunction zodSchemaForField(\n field: SchemaField,\n options: { forForm: boolean },\n): string {\n const selectValues =\n field.type === \"select\"\n ? `[${(field.options ?? []).map((option) => JSON.stringify(option.value)).join(\", \")}]`\n : \"\";\n\n let schema: string;\n switch (field.type) {\n case \"text\":\n schema = \"z.string()\";\n break;\n case \"number\":\n schema = \"z.number()\";\n break;\n case \"bool\":\n schema = \"z.boolean().default(false)\";\n break;\n case \"date\":\n schema = options.forForm ? \"z.string()\" : \"z.date()\";\n break;\n case \"email\":\n schema = \"z.string().email()\";\n break;\n case \"password\":\n schema = \"z.string()\";\n break;\n case \"url\":\n schema = \"z.string().url()\";\n break;\n case \"editor\":\n schema = \"z.string()\";\n break;\n case \"autodate\":\n schema = options.forForm ? \"z.string()\" : \"z.date()\";\n break;\n case \"select\":\n if (selectValues) {\n schema =\n (field.maxSelect ?? 1) > 1\n ? `z.array(z.enum(${selectValues}))`\n : `z.enum(${selectValues})`;\n } else {\n schema = \"z.string()\";\n }\n break;\n case \"file\":\n schema =\n (field.maxSelect ?? 1) > 1\n ? \"z.string().array()\"\n : \"z.union([z.instanceof(File), z.string()])\";\n break;\n case \"json\":\n schema = \"z.any()\";\n break;\n case \"geoPoint\":\n schema = options.forForm\n ? `z.preprocess((val) => {\n if (typeof val === \"string\") {\n return val;\n }\n return JSON.stringify(val);\n}, z.string()${field.required ? \"\" : \".optional()\"}) as z.ZodEffects<${field.required ? \"\" : \"z.ZodOptional<\"}z.ZodString${field.required ? \"\" : \">\"}, any, any>`\n : dedent`\n z.object({\n lat: z.number().min(-90).max(90),\n lon: z.number().min(-180).max(180)\n })\n `;\n break;\n case \"relation\":\n schema = (field.maxSelect ?? 1) > 1 ? \"z.array(z.string())\" : \"z.string()\";\n break;\n default: {\n const exhaustiveType: never = field.type;\n return exhaustiveType;\n }\n }\n\n if (NON_EMPTY_FIELDS.includes(field.type)) {\n return field.required ? `${schema}.nonempty()` : `${schema}.optional()`;\n }\n\n if (field.required) {\n return schema;\n }\n\n if (field.type === \"geoPoint\") {\n return schema;\n }\n\n if (field.type === \"file\" && (field.maxSelect ?? 1) <= 1) {\n return `${schema}.optional().default(\"\")`;\n }\n\n return `${schema}.optional()`;\n}\n\nexport function generateSchemaSnippet(\n model: Pick<Model, \"schemaName\" | \"tableName\">,\n fields: Field[],\n options: { includeModelFields: boolean; forForm: boolean },\n): string {\n const allFields: SchemaField[] = [];\n\n if (options.includeModelFields) {\n allFields.push({ name: \"id\", type: \"text\", required: false });\n allFields.push({ name: \"collectionId\", type: \"text\", required: false });\n }\n\n for (const field of fields) {\n if (field.type === \"file\" && field.maxSelect > 1) {\n allFields.push({ ...field, required: false });\n allFields.push({ name: `${field.name}+`, type: \"file\", required: false, maxSelect: 999 });\n allFields.push({ name: `${field.name}-`, type: \"file\", required: false, maxSelect: 999 });\n continue;\n }\n allFields.push(field);\n }\n\n const schemaFields = allFields\n .map((field) => `${escapeFieldName(field.name)}: ${zodSchemaForField(field, options)}`)\n .join(\",\\n \");\n\n const modelTypeImport = options.includeModelFields\n ? '\\nimport type { Schemas } from \"pocketbase-svelte\";'\n : \"\";\n const modelSatisfies = options.includeModelFields\n ? ` satisfies Schemas[\"${model.tableName}\"]`\n : \"\";\n\n return dedent`\n import { z } from \"zod/v3\";${modelTypeImport}\n\n export const ${model.schemaName} = z.object({\n ${schemaFields}\n })${modelSatisfies};\n `;\n}\n\nfunction normalizeType(type: string): Field[\"type\"] {\n const normalized = TYPE_ALIASES[type];\n if (!normalized) {\n throw new Error(`Unsupported collection field type \"${type}\" when generating from collection`);\n }\n return normalized;\n}\n\nexport function fieldsFromCollection(\n model: Model,\n collections: Collection[],\n options: Pick<Options, \"features\">,\n): Field[] {\n const collection = collections.find((item) => item.name === model.tableName);\n if (!collection) {\n throw new Error(`Collection \"${model.tableName}\" not found`);\n }\n\n const displayFields = collectionDisplayFieldMap(collections);\n const collectionById = new Map(collections.map((item) => [item.id, item]));\n\n const resolvedFields: Field[] = [];\n for (const raw of collection.fields as RuntimeCollectionField[]) {\n if (raw.name === \"id\" || raw.system) {\n continue;\n }\n\n const type = normalizeType(raw.type);\n const required = Boolean(raw.required);\n const title = changeCase.capitalCase(raw.name);\n\n if (type === \"relation\") {\n const relatedCollection = raw.collectionId\n ? collectionById.get(raw.collectionId)\n : undefined;\n if (!relatedCollection) {\n continue;\n }\n const relatedModel = parseModel(relatedCollection.name, options);\n resolvedFields.push({\n name: raw.name,\n title,\n type: \"relation\",\n required,\n collectionId: relatedCollection.id,\n maxSelect: raw.maxSelect ?? 1,\n displayField: displayFields[relatedCollection.name] ?? \"id\",\n relatedModel,\n singularRelationName: changeCase.camelCase(\n `${model.displayName} ${relatedModel.displayName}`,\n ),\n pluralRelationName: changeCase.camelCase(\n `${model.displayName} ${relatedModel.pluralDisplayName}`,\n ),\n isCurrentUser:\n options.features.auth &&\n relatedCollection.name === \"users\" &&\n /user|owner|author/i.test(raw.name),\n });\n continue;\n }\n\n if (type === \"select\") {\n resolvedFields.push({\n name: raw.name,\n title,\n type: \"select\",\n required,\n maxSelect: raw.maxSelect ?? 1,\n options: (raw.values ?? []).map((value) => ({ label: value, value })),\n });\n continue;\n }\n\n if (type === \"file\") {\n resolvedFields.push({\n name: raw.name,\n title,\n type: \"file\",\n required,\n maxSelect: raw.maxSelect ?? 1,\n });\n continue;\n }\n\n if (type === \"autodate\") {\n resolvedFields.push({\n name: raw.name,\n title,\n type: \"autodate\",\n required,\n onCreate: raw.onCreate ?? raw.name.includes(\"create\"),\n onUpdate: raw.onUpdate ?? raw.name.includes(\"update\"),\n });\n continue;\n }\n\n resolvedFields.push({\n name: raw.name,\n title,\n type,\n required,\n } as Field);\n }\n\n return resolvedFields.filter((field) => field.name !== \"id\");\n}\n\nexport function inferPrimaryField(fields: Field[]): Field | undefined {\n const preferred = [\"title\", \"name\", \"label\", \"email\", \"id\"];\n for (const name of preferred) {\n const field = fields.find((item) => item.name === name);\n if (field) return field;\n }\n return fields[0];\n}\n\nexport function relationExpandParam(fields: Field[]): string | undefined {\n const names = fields\n .filter((field): field is Extract<Field, { type: \"relation\" }> => field.type === \"relation\")\n .map((field) => field.name);\n return names.length > 0 ? names.join(\",\") : undefined;\n}\n\nexport function uniqueRelationCollections(\n fields: Field[],\n): Array<Extract<Field, { type: \"relation\" }>[\"relatedModel\"]> {\n const seen = new Set<string>();\n const models: Array<Extract<Field, { type: \"relation\" }>[\"relatedModel\"]> = [];\n\n for (const field of fields) {\n if (field.type !== \"relation\") continue;\n if (seen.has(field.relatedModel.tableName)) continue;\n seen.add(field.relatedModel.tableName);\n models.push(field.relatedModel);\n }\n\n return models;\n}\n\nexport function routeWithId(routeSegment: string, idExpression: string): string {\n return `/${routeSegment}/\\${${idExpression}}`;\n}\n\nexport function inferModelCollectionName(name: string): string {\n return pluralize.plural(changeCase.snakeCase(name));\n}\n\nfunction toCollectionFieldSpec(field: Field): CollectionFieldSpec {\n const base = {\n name: field.name,\n type: field.type,\n required: field.required,\n } satisfies CollectionFieldSpec;\n\n if (field.type === \"relation\") {\n return {\n ...base,\n collectionId: field.collectionId,\n maxSelect: field.maxSelect,\n };\n }\n\n if (field.type === \"file\") {\n return {\n ...base,\n maxSelect: field.maxSelect,\n };\n }\n\n if (field.type === \"select\") {\n return {\n ...base,\n maxSelect: field.maxSelect,\n values: field.options.map((option) => option.value),\n };\n }\n\n if (field.type === \"autodate\") {\n return {\n ...base,\n onCreate: field.onCreate,\n onUpdate: field.onUpdate,\n };\n }\n\n return base;\n}\n\nexport function collectionSpecFromModelFields(\n model: Pick<Model, \"tableName\">,\n fields: Field[],\n auth?: OwnershipResult,\n): CollectionSpec {\n const rules = auth\n ? {\n listRule: auth.rule,\n viewRule: auth.rule,\n createRule: auth.rule,\n updateRule: auth.rule,\n deleteRule: auth.rule,\n }\n : {};\n\n return {\n name: model.tableName,\n type: \"base\",\n ...rules,\n fields: fields.map(toCollectionFieldSpec),\n };\n}\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n parseFields,\n parseModel,\n validateModelName,\n type Collection,\n} from \"../../../parse\";\nimport {\n collectionSpecFromModelFields,\n fieldsFromCollection,\n generateSchemaSnippet,\n} from \"../shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new Error(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n };\n}\n\nasync function resolveInputFields(options: Options, modelPath: string, fieldDefs: string[]) {\n validateModelName(modelPath);\n const model = parseModel(modelPath, options);\n\n if (fieldDefs.length > 0) {\n const parsed = await parseFields(fieldDefs, model, options);\n return { model, fields: parsed.fields, auth: parsed.auth, shouldCreateCollection: true };\n }\n\n const collections =\n options.env === \"runtime\"\n ? ((await (await import(\"../../../parse/env.runtime\")).getCollections()) as Collection[])\n : (await import(\"../../../parse/env.preview\")).getPreviewCollections(options);\n const fields = fieldsFromCollection(model, collections, options);\n return { model, fields, auth: undefined, shouldCreateCollection: false };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection } = await resolveInputFields(\n options,\n modelPath,\n fieldDefs,\n );\n\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const schema = generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n });\n\n return {\n creates: [toFile(schemaPath, schema)],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth)]\n : [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-resource\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/generate/resource\";\nconst DOCS = \"/generate/resource\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes);\n }\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(runtimeRes), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a resource\",\n summary: \"Generates model schema resources.\",\n categories: [\"data\"],\n tags: [\"pocketbase\", \"resource\", \"schema\"],\n\n command: {\n raw: \"vela generate resource contact name:text email:email\",\n base: \"vela generate resource\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n modelPaths,\n modelUrls,\n parseFields,\n parseModel,\n validateModelName,\n type Collection,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport {\n getFieldComponents,\n getFieldImports,\n renderDisplayField,\n renderField,\n selectFieldLabelMap,\n} from \"../field\";\nimport {\n collectionSpecFromModelFields,\n fieldsFromCollection,\n generateSchemaSnippet,\n relationExpandParam,\n uniqueRelationCollections,\n} from \"../shared\";\nimport { generateScaffoldServerTestSnippet } from \"../tests\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new Error(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction uniqueImports(imports: string[]): string[] {\n return [...new Set(imports.filter(Boolean))];\n}\n\nfunction selectLabelMaps(fields: Field[]): string {\n return fields\n .filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n )\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\nfunction relationLoadLines(fields: Field[], pbInstance: string): string {\n return uniqueRelationCollections(fields)\n .map(\n (relatedModel) =>\n `const ${relatedModel.pluralName} = await ${pbInstance}.collection(\"${relatedModel.tableName}\").getFullList();`,\n )\n .join(\"\\n\\t\\t\\t\");\n}\n\nfunction relationLoadReturnVars(fields: Field[]): string {\n return uniqueRelationCollections(fields)\n .map((relatedModel) => relatedModel.pluralName)\n .join(\", \");\n}\n\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth ? \"locals.pb\" : \"locals.admin\";\n}\n\nfunction formScript(\n model: Model,\n fields: Field[],\n includeParams = false,\n): string {\n const labels = selectLabelMaps(fields);\n const paramsLine = includeParams\n ? \"let { data, params } = $props();\"\n : \"let { data } = $props();\";\n\n return dedent`\n ${labels}\n ${paramsLine}\n\n const form = superForm(untrack(() => data.form), {\n validators: zodClient(${model.schemaName}),\n });\n\n const { form: formData } = form;\n `;\n}\n\nfunction newPageSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const imports = uniqueImports([\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zodClient } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"$lib/schemas/${model.name}\";`,\n ...getFieldImports(getFieldComponents(fields)),\n 'import { Button } from \"$lib/components/ui/button\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n 'import * as Form from \"$lib/components/ui/form\";',\n hasSelectFields ? 'import type { Models } from \"pocketbase-svelte\";' : \"\",\n ]).join(\"\\n\");\n const fieldContent = fields.map((field) => renderField(field)).join(\"\\n\");\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${formScript(model, fields)}\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 ${model.displayName.toLowerCase()}</h1>\n <Button href=\"${urls.list}\" variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button size=\"sm\">Save</Form.Button>\n <Button href=\"${urls.list}\" variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction editPageSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const imports = uniqueImports([\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zodClient } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"$lib/schemas/${model.name}\";`,\n ...getFieldImports(getFieldComponents(fields)),\n 'import { Button } from \"$lib/components/ui/button\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n 'import * as Form from \"$lib/components/ui/form\";',\n hasSelectFields ? 'import type { Models } from \"pocketbase-svelte\";' : \"\",\n ]).join(\"\\n\");\n const fieldContent = fields.map((field) => renderField(field)).join(\"\\n\");\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${formScript(model, fields, true)}\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 ${model.displayName.toLowerCase()}</h1>\n <Button href=\"${urls.list}\" variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button size=\"sm\">Save changes</Form.Button>\n <Button href=\"${urls.list}/\\${params.id}\" variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction listPageSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const selectFieldsLabelMaps = hasSelectFields\n ? `${selectLabelMaps(fields)}`\n : \"\";\n const columnDefs = fields\n .map((field) => {\n let cellParams = \"{ getValue }\";\n let cellProps = \"{ value: getValue() }\";\n\n if (field.type === \"relation\") {\n cellParams = \"{ getValue, row }\";\n cellProps = `{ value: getValue(), expanded: row.original.expand?.${field.name}, displayField: \"${field.displayField}\" }`;\n }\n\n if (field.type === \"select\") {\n cellProps = `{ value: getValue(), options: ${field.name}Labels }`;\n }\n\n if (field.type === \"file\") {\n cellParams = \"{ getValue, row }\";\n cellProps =\n \"{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }\";\n }\n\n return dedent`\n columnHelper.accessor(\"${field.name}\", {\n header: ({ column }) => renderComponent(ColumnHeader, { column, title: \"${field.title}\" }),\n cell: (${cellParams}) => renderComponent(Cells.${field.type.charAt(0).toUpperCase() + field.type.slice(1)}Cell, ${cellProps})\n })\n `;\n })\n .join(\",\\n\");\n const filterFields = fields\n .filter((field) => field.type === \"select\")\n .map(\n (field) =>\n `<FacetedFilter column={table.getColumn(\"${field.name}\")!} title=\"${field.title}\" options={Object.values(${field.name}Labels)} />`,\n )\n .join(\"\\n\");\n\n return dedent`\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 ${hasSelectFields ? 'import { FacetedFilter } from \"$lib/components/ui/faceted-filter\";' : \"\"}\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 ${selectFieldsLabelMaps}\n\n const columnHelper = createColumnHelper<Models[\"${model.tableName}\"]>();\n const columns = [\n columnHelper.display({\n id: \"select\",\n header: ({ table }) =>\n renderComponent(Checkbox, {\n checked: table.getIsAllPageRowsSelected(),\n onCheckedChange: (value) => table.toggleAllPageRowsSelected(value),\n indeterminate: table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected(),\n \"aria-label\": \"Select all\"\n }),\n cell: ({ row }) =>\n renderComponent(Checkbox, {\n checked: row.getIsSelected(),\n onCheckedChange: (value) => row.toggleSelected(value),\n \"aria-label\": \"Select row\"\n }),\n enableSorting: false,\n enableHiding: false\n }),\n ${columnDefs}${fields.length > 0 ? \",\" : \"\"}\n columnHelper.display({\n id: \"actions\",\n cell: ({ row }) =>\n renderComponent(RowActions, {\n viewPath: \\`${urls.list}/\\${row.original.id}\\`,\n editPath: \\`${urls.list}/\\${row.original.id}/edit\\`,\n deletePath: \\`${urls.list}/\\${row.original.id}\\`\n })\n })\n ];\n\n const table = createSvelteTable({\n get data() {\n return data.${model.pluralName};\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\">${model.pluralDisplayName}</h1>\n <Button href=\"${urls.new}\" variant=\"outline\">New ${model.displayName.toLowerCase()}</Button>\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 ${model.pluralDisplayName.toLowerCase()}...\"\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 ${filterFields}\n {#if table.getState().columnFilters.length > 0}\n <Button variant=\"ghost\" onclick={() => table.resetColumnFilters()} class=\"h-8 px-2 lg:px-3\">\n Reset\n <XIcon />\n </Button>\n {/if}\n </div>\n\n <Button href=\"${urls.new}\" variant=\"outline\" size=\"sm\">\n <PlusIcon class=\"w-4 h-4\" />\n New ${model.displayName.toLowerCase()}\n </Button>\n </div>\n\n <div class=\"rounded-md border overflow-hidden\">\n <Table.Root>\n <Table.Header>\n {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}\n <Table.Row>\n {#each headerGroup.headers as header (header.id)}\n <Table.Head colspan={header.colSpan}>\n {#if !header.isPlaceholder}\n <FlexRender content={header.column.columnDef.header} context={header.getContext()} />\n {/if}\n </Table.Head>\n {/each}\n </Table.Row>\n {/each}\n </Table.Header>\n <Table.Body>\n {#each table.getRowModel().rows as row (row.id)}\n <Table.Row data-state={row.getIsSelected() && \"selected\"}>\n {#each row.getVisibleCells() as cell (cell.id)}\n <Table.Cell>\n <FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />\n </Table.Cell>\n {/each}\n </Table.Row>\n {:else}\n <Table.Row>\n <Table.Cell colspan={columns.length} class=\"h-24 text-center\">No results.</Table.Cell>\n </Table.Row>\n {/each}\n </Table.Body>\n </Table.Root>\n </div>\n\n <Pagination {table} />\n </div>\n </section>\n `;\n}\n\nfunction listServerSnippet(model: Model, fields: Field[], pb: string): string {\n const expand = relationExpandParam(fields);\n const getFullListArgs = expand ? `{ expand: \"${expand}\" }` : \"\";\n\n return dedent`\n export const load = async ({ locals }) => {\n const ${model.pluralName} = await ${pb}.collection(\"${model.tableName}\").getFullList(${getFullListArgs});\n return { ${model.pluralName} };\n };\n `;\n}\n\nfunction newServerSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n pb: string,\n authMode: boolean,\n): string {\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n const currentUserField = fields.find(\n (field): field is Extract<Field, { type: \"relation\" }> =>\n field.type === \"relation\" && field.isCurrentUser,\n );\n const createPayload =\n authMode && currentUserField\n ? dedent`\n {\n ...form.data,\n ${currentUserField.name}: locals.pb.authStore.record?.id\n }\n `\n : \"form.data\";\n\n return dedent`\n import { fail, redirect } from \"@sveltejs/kit\";\n import { superValidate } from \"sveltekit-superforms\";\n import { zod } from \"sveltekit-superforms/adapters\";\n import { setPocketbaseErrors } from \"@velastack/pocketbase\";\n import { ${model.schemaName} } from \"$lib/schemas/${model.name}\";\n\n export const load = async ({ locals }) => {\n ${relationLoads}\n return { form: await superValidate(zod(${model.schemaName}))${relationReturn} };\n };\n\n export const actions = {\n default: async ({ locals, request }) => {\n const form = await superValidate(request, zod(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n try {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n return redirect(303, \\`${urls.list}/\\${${model.name}.id}\\`);\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, { form });\n }\n },\n };\n `;\n}\n\nfunction showServerSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n pb: string,\n): string {\n const expand = relationExpandParam(fields);\n const getOneArgs = expand ? `, { expand: \"${expand}\" }` : \"\";\n return dedent`\n import { error, redirect } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n try {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id${getOneArgs});\n return { ${model.name} };\n } catch {\n throw error(404, \"Not found\");\n }\n };\n\n export const actions = {\n default: async ({ locals, params }) => {\n await ${pb}.collection(\"${model.tableName}\").delete(params.id);\n throw redirect(303, \"${urls.list}\");\n },\n };\n `;\n}\n\nfunction showPageSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const hasRelationFields = fields.some((field) => field.type === \"relation\");\n const hasFileFields = fields.some((field) => field.type === \"file\");\n\n const imports = [\n 'import { Button } from \"$lib/components/ui/button\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n hasSelectFields || hasRelationFields\n ? 'import { Badge } from \"$lib/components/ui/badge\";'\n : \"\",\n hasRelationFields\n ? 'import CircleArrowRightIcon from \"@lucide/svelte/icons/circle-arrow-right\";'\n : \"\",\n hasFileFields ? 'import FileIcon from \"@lucide/svelte/icons/file\";' : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n const labels = selectLabelMaps(fields);\n const displays = fields\n .map((field) => renderDisplayField(model, field))\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${labels}\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\">${model.displayName} details</h1>\n <Button href=\"${urls.list}\" variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm\">\n ${displays}\n </div>\n\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4 justify-between\">\n <Button href=\"${urls.list}/{data.${model.name}.id}/edit\" variant=\"outline\" size=\"sm\">\n Edit\n </Button>\n <form method=\"POST\">\n <Button type=\"submit\" variant=\"destructive\" size=\"sm\">Delete</Button>\n </form>\n </div>\n </div>\n </section>\n `;\n}\n\nfunction editServerSnippet(\n model: Model,\n urls: ReturnType<typeof modelUrls>,\n fields: Field[],\n pb: string,\n): string {\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n return dedent`\n import { error, fail, redirect } from \"@sveltejs/kit\";\n import { setPocketbaseErrors, setDefaultData } from \"@velastack/pocketbase\";\n import { superValidate } from \"sveltekit-superforms\";\n import { zod } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"$lib/schemas/${model.name}\";\n\n export const load = async ({ locals, params }) => {\n let ${model.name};\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n } catch {\n throw error(404, \"Not found\");\n }\n ${relationLoads}\n return { form: await superValidate(${model.name}, zod(${model.schemaName}))${relationReturn} };\n };\n\n export const actions = {\n default: async ({ locals, params, request }) => {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n const form = await superValidate(request, zod(${model.schemaName}));\n\n if (!form.valid) {\n setDefaultData(form, ${model.name});\n return fail(400, { form });\n }\n\n try {\n await ${pb}.collection(\"${model.tableName}\").update(params.id, form.data);\n return redirect(303, \\`${urls.list}/\\${params.id}\\`);\n } catch (error) {\n setPocketbaseErrors(form, error);\n setDefaultData(form, ${model.name});\n return fail(400, { form });\n }\n },\n };\n `;\n}\n\nasync function resolveInputFields(\n options: Options,\n modelPath: string,\n fieldDefs: string[],\n) {\n validateModelName(modelPath);\n const model = parseModel(modelPath, options);\n const collections =\n options.env === \"runtime\"\n ? ((await (await import(\"../../../parse/env.runtime\")).getCollections()) as Collection[])\n : (await import(\"../../../parse/env.preview\")).getPreviewCollections(options);\n\n // If fields are provided, let's parse them and mark the collection as \"shouldCreateCollection\"\n if (fieldDefs.length > 0) {\n const parsed = await parseFields(fieldDefs, model, options);\n return {\n model,\n fields: parsed.fields,\n auth: parsed.auth,\n shouldCreateCollection: true,\n collections,\n };\n }\n\n // If fields aren't provided, let's check if the model references an existing collection\n const fields = fieldsFromCollection(model, collections, options);\n return {\n model,\n fields,\n auth: undefined,\n shouldCreateCollection: false,\n collections,\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const paths = modelPaths(model);\n const urls = modelUrls(model);\n const pb = pbInstance(options);\n const uiFields = fields.filter(\n (field) => !(field.type === \"relation\" && field.isCurrentUser),\n );\n\n const creates: File[] = [\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n }),\n ),\n toFile(\n `${paths.list}/+page.server.ts`,\n listServerSnippet(model, uiFields, pb),\n ),\n toFile(\n `${paths.list}/+page.svelte`,\n listPageSnippet(model, urls, uiFields),\n ),\n toFile(\n `${paths.new}/+page.server.ts`,\n newServerSnippet(model, urls, uiFields, pb, options.features.auth),\n ),\n toFile(`${paths.new}/+page.svelte`, newPageSnippet(model, urls, uiFields)),\n toFile(\n `${paths.show}/+page.server.ts`,\n showServerSnippet(model, urls, uiFields, pb),\n ),\n toFile(\n `${paths.show}/+page.svelte`,\n showPageSnippet(model, urls, uiFields),\n ),\n toFile(\n `${paths.edit}/+page.server.ts`,\n editServerSnippet(model, urls, uiFields, pb),\n ),\n toFile(\n `${paths.edit}/+page.svelte`,\n editPageSnippet(model, urls, uiFields),\n ),\n toFile(\n `${paths.list}/server.test.ts`,\n generateScaffoldServerTestSnippet(model, urls, fields, options, collections),\n ),\n ];\n\n const components = [\n ...getFieldComponents(uiFields),\n \"button\",\n \"table\",\n \"data-table\",\n \"command\",\n \"popover\",\n \"separator\",\n \"badge\",\n \"dropdown-menu\",\n \"checkbox\",\n \"select\",\n \"cells\",\n \"column-header\",\n \"faceted-filter\",\n \"pagination\",\n \"row-actions\",\n ] as Component[];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [...new Set(components)],\n packages: [],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth)]\n : [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-scaffold\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/generate/scaffold\";\nconst DOCS = \"/generate/scaffold\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes);\n }\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(runtimeRes), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a scaffold\",\n summary: \"Generates CRUD routes and schema.\",\n categories: [\"data\", \"forms\"],\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\"],\n\n command: {\n raw: \"vela generate scaffold contact name:text email:email\",\n base: \"vela generate scaffold\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n parseFields,\n parseModel,\n validateModelName,\n type Collection,\n} from \"../../../parse\";\nimport { fieldsFromCollection, generateSchemaSnippet } from \"../shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new Error(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n };\n}\n\nasync function resolveInputFields(options: Options, modelPath: string, fieldDefs: string[]) {\n validateModelName(modelPath);\n const model = parseModel(modelPath, options);\n\n if (fieldDefs.length > 0) {\n const parsed = await parseFields(fieldDefs, model, options);\n return { model, fields: parsed.fields, includeModelFields: false };\n }\n\n const collections =\n options.env === \"runtime\"\n ? ((await (await import(\"../../../parse/env.runtime\")).getCollections()) as Collection[])\n : (await import(\"../../../parse/env.preview\")).getPreviewCollections(options);\n const fields = fieldsFromCollection(model, collections, options);\n return { model, fields, includeModelFields: true };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, includeModelFields } = await resolveInputFields(\n options,\n modelPath,\n fieldDefs,\n );\n\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const schema = generateSchemaSnippet(model, fields, {\n includeModelFields,\n forForm: true,\n });\n\n return {\n creates: [toFile(schemaPath, schema)],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-schema\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/generate/schema\";\nconst DOCS = \"/generate/schema\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a schema\",\n summary: \"Generates a zod schema.\",\n categories: [\"data\"],\n tags: [\"zod\", \"schema\", \"pocketbase\"],\n\n command: {\n raw: \"vela generate schema contact name:text email:email\",\n base: \"vela generate schema\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","export default \"<script lang=\\\"ts\\\" module>\\n\\timport HomeIcon from '@lucide/svelte/icons/home';\\n\\n\\tlet data = {\\n\\t\\tnavMain: [\\n\\t\\t\\t{\\n\\t\\t\\t\\ttitle: 'Dashboard',\\n\\t\\t\\t\\turl: '/dashboard',\\n\\t\\t\\t\\ticon: HomeIcon\\n\\t\\t\\t}\\n\\t\\t]\\n\\t};\\n</script>\\n\\n<script lang=\\\"ts\\\">\\n\\timport NavMain from './nav-main.svelte';\\n\\timport NavUser from './nav-user.svelte';\\n\\timport * as Sidebar from '$lib/components/ui/sidebar';\\n\\timport type { ComponentProps } from 'svelte';\\n\\n\\tlet {\\n\\t\\tuser,\\n\\t\\tmeta,\\n\\t\\tref = $bindable(null),\\n\\t\\t...restProps\\n\\t}: ComponentProps<typeof Sidebar.Root> & { user: any; meta: any } = $props();\\n</script>\\n\\n<Sidebar.Root bind:ref variant=\\\"inset\\\" {...restProps}>\\n\\t<Sidebar.Header>\\n\\t\\t<Sidebar.Menu>\\n\\t\\t\\t<Sidebar.MenuItem>\\n\\t\\t\\t\\t<Sidebar.MenuButton size=\\\"lg\\\">\\n\\t\\t\\t\\t\\t{#snippet child({ props })}\\n\\t\\t\\t\\t\\t\\t<a href=\\\"/dashboard\\\" {...props}>\\n\\t\\t\\t\\t\\t\\t\\t<div\\n\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"bg-sidebar-accent text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg\\\"\\n\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-6\\\" />\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid flex-1 text-left text-sm leading-tight\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<span class=\\\"truncate font-medium\\\">{meta.appName}</span>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t</Sidebar.MenuButton>\\n\\t\\t\\t</Sidebar.MenuItem>\\n\\t\\t</Sidebar.Menu>\\n\\t</Sidebar.Header>\\n\\t<Sidebar.Content>\\n\\t\\t<NavMain items={data.navMain} />\\n\\t</Sidebar.Content>\\n\\t<Sidebar.Footer>\\n\\t\\t<NavUser {user} />\\n\\t</Sidebar.Footer>\\n</Sidebar.Root>\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport type { Component } from 'svelte';\\n\\timport * as Sidebar from '$lib/components/ui/sidebar';\\n\\timport { page } from '$app/state';\\n\\n\\tconst isActive = (url: string) => {\\n\\t\\treturn page.url.pathname.startsWith(url);\\n\\t};\\n\\n\\tlet {\\n\\t\\titems\\n\\t}: {\\n\\t\\titems: {\\n\\t\\t\\ttitle: string;\\n\\t\\t\\turl: string;\\n\\t\\t\\ticon: Component;\\n\\t\\t\\titems?: {\\n\\t\\t\\t\\ttitle: string;\\n\\t\\t\\t\\turl: string;\\n\\t\\t\\t}[];\\n\\t\\t}[];\\n\\t} = $props();\\n</script>\\n\\n<Sidebar.Group>\\n\\t<Sidebar.Menu>\\n\\t\\t{#each items as item (item.title)}\\n\\t\\t\\t<Sidebar.MenuItem>\\n\\t\\t\\t\\t<Sidebar.MenuButton isActive={isActive(item.url)}>\\n\\t\\t\\t\\t\\t{#snippet child({ props })}\\n\\t\\t\\t\\t\\t\\t<a href={item.url} {...props}>\\n\\t\\t\\t\\t\\t\\t\\t<item.icon />\\n\\t\\t\\t\\t\\t\\t\\t<span>{item.title}</span>\\n\\t\\t\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t</Sidebar.MenuButton>\\n\\t\\t\\t</Sidebar.MenuItem>\\n\\t\\t{/each}\\n\\t</Sidebar.Menu>\\n</Sidebar.Group>\\n\"","export default \"<script lang=\\\"ts\\\" module>\\n\\timport Settings2Icon from '@lucide/svelte/icons/settings-2';\\n\\n\\tlet data = {\\n\\t\\tnavUser: [\\n\\t\\t\\t{\\n\\t\\t\\t\\ttitle: 'Settings',\\n\\t\\t\\t\\turl: '/settings',\\n\\t\\t\\t\\ticon: Settings2Icon\\n\\t\\t\\t}\\n\\t\\t]\\n\\t};\\n</script>\\n\\n<script lang=\\\"ts\\\">\\n\\timport ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\\n\\timport LogOutIcon from '@lucide/svelte/icons/log-out';\\n\\timport MoonIcon from '@lucide/svelte/icons/moon';\\n\\timport SunIcon from '@lucide/svelte/icons/sun';\\n\\timport * as Avatar from '$lib/components/ui/avatar';\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu';\\n\\timport * as Sidebar from '$lib/components/ui/sidebar';\\n\\timport { toggleMode, mode } from 'mode-watcher';\\n\\n\\tlet {\\n\\t\\tuser\\n\\t}: {\\n\\t\\tuser: {\\n\\t\\t\\tid: string;\\n\\t\\t\\tname: string;\\n\\t\\t\\temail: string;\\n\\t\\t\\tavatar: string;\\n\\t\\t};\\n\\t} = $props();\\n\\n\\tconst sidebar = Sidebar.useSidebar();\\n</script>\\n\\n<Sidebar.Menu>\\n\\t<Sidebar.MenuItem>\\n\\t\\t<DropdownMenu.Root>\\n\\t\\t\\t<DropdownMenu.Trigger>\\n\\t\\t\\t\\t{#snippet child({ props })}\\n\\t\\t\\t\\t\\t<Sidebar.MenuButton\\n\\t\\t\\t\\t\\t\\tsize=\\\"lg\\\"\\n\\t\\t\\t\\t\\t\\tclass=\\\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground\\\"\\n\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t<Avatar.Root class=\\\"size-8 rounded-lg\\\">\\n\\t\\t\\t\\t\\t\\t\\t{#if user.avatar}\\n\\t\\t\\t\\t\\t\\t\\t\\t<Avatar.Image src=\\\"/api/files/users/{user.id}/{user.avatar}\\\" alt={user.name} />\\n\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t<Avatar.Fallback class=\\\"rounded-lg\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t{user.email?.charAt(0).toUpperCase()}\\n\\t\\t\\t\\t\\t\\t\\t</Avatar.Fallback>\\n\\t\\t\\t\\t\\t\\t</Avatar.Root>\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid flex-1 text-left text-sm leading-tight\\\">\\n\\t\\t\\t\\t\\t\\t\\t<span class=\\\"truncate font-medium\\\">{user.name}</span>\\n\\t\\t\\t\\t\\t\\t\\t<span class=\\\"truncate text-xs\\\">{user.email}</span>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t<ChevronsUpDownIcon class=\\\"ml-auto size-4\\\" />\\n\\t\\t\\t\\t\\t</Sidebar.MenuButton>\\n\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t</DropdownMenu.Trigger>\\n\\t\\t\\t<DropdownMenu.Content\\n\\t\\t\\t\\tclass=\\\"w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg\\\"\\n\\t\\t\\t\\tside={sidebar.isMobile ? 'bottom' : 'right'}\\n\\t\\t\\t\\talign=\\\"end\\\"\\n\\t\\t\\t\\tsideOffset={4}\\n\\t\\t\\t>\\n\\t\\t\\t\\t<DropdownMenu.Label class=\\\"p-0 font-normal\\\">\\n\\t\\t\\t\\t\\t<div class=\\\"flex items-center gap-2 px-1 py-1.5 text-left text-sm\\\">\\n\\t\\t\\t\\t\\t\\t<Avatar.Root class=\\\"size-8 rounded-lg\\\">\\n\\t\\t\\t\\t\\t\\t\\t{#if user.avatar}\\n\\t\\t\\t\\t\\t\\t\\t\\t<Avatar.Image src=\\\"/api/files/users/{user.id}/{user.avatar}\\\" alt={user.name} />\\n\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t<Avatar.Fallback class=\\\"rounded-lg\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t{user.email?.charAt(0).toUpperCase()}\\n\\t\\t\\t\\t\\t\\t\\t</Avatar.Fallback>\\n\\t\\t\\t\\t\\t\\t</Avatar.Root>\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid flex-1 text-left text-sm leading-tight\\\">\\n\\t\\t\\t\\t\\t\\t\\t<span class=\\\"truncate font-medium\\\">{user.name}</span>\\n\\t\\t\\t\\t\\t\\t\\t<span class=\\\"truncate text-xs\\\">{user.email}</span>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</DropdownMenu.Label>\\n\\t\\t\\t\\t<DropdownMenu.Separator />\\n\\t\\t\\t\\t<DropdownMenu.Group>\\n\\t\\t\\t\\t\\t<DropdownMenu.Item onclick={toggleMode}>\\n\\t\\t\\t\\t\\t\\t{#if mode.current === 'dark'}\\n\\t\\t\\t\\t\\t\\t\\t<SunIcon />\\n\\t\\t\\t\\t\\t\\t\\tLight mode\\n\\t\\t\\t\\t\\t\\t{:else}\\n\\t\\t\\t\\t\\t\\t\\t<MoonIcon />\\n\\t\\t\\t\\t\\t\\t\\tDark mode\\n\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t</DropdownMenu.Item>\\n\\t\\t\\t\\t\\t{#each data.navUser as item}\\n\\t\\t\\t\\t\\t\\t<DropdownMenu.Item class=\\\"p-0\\\">\\n\\t\\t\\t\\t\\t\\t\\t<a href={item.url} class=\\\"flex cursor-default items-center gap-2 px-2 py-1.5 w-full\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<item.icon />\\n\\t\\t\\t\\t\\t\\t\\t\\t{item.title}\\n\\t\\t\\t\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t\\t\\t</DropdownMenu.Item>\\n\\t\\t\\t\\t\\t{/each}\\n\\t\\t\\t\\t</DropdownMenu.Group>\\n\\t\\t\\t\\t<DropdownMenu.Separator />\\n\\t\\t\\t\\t<DropdownMenu.Item class=\\\"p-0\\\">\\n\\t\\t\\t\\t\\t<form action=\\\"/logout\\\" method=\\\"post\\\" class=\\\"w-full\\\">\\n\\t\\t\\t\\t\\t\\t<button type=\\\"submit\\\" class=\\\"flex cursor-default items-center gap-2 px-2 py-1.5 w-full\\\">\\n\\t\\t\\t\\t\\t\\t\\t<LogOutIcon />\\n\\t\\t\\t\\t\\t\\t\\tLog out\\n\\t\\t\\t\\t\\t\\t</button>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</DropdownMenu.Item>\\n\\t\\t\\t</DropdownMenu.Content>\\n\\t\\t</DropdownMenu.Root>\\n\\t</Sidebar.MenuItem>\\n</Sidebar.Menu>\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { cn } from '$lib/utils';\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\\n\\timport { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';\\n\\timport { getContext } from 'svelte';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\n\\tlet {\\n\\t\\tchildren,\\n\\t\\tclass: className,\\n\\t\\t...restProps\\n\\t}: DropdownMenuPrimitive.ContentProps & {\\n\\t\\tportalProps?: DropdownMenuPrimitive.PortalProps;\\n\\t} = $props();\\n\\n\\tlet { isDesktop } =\\n\\t\\tgetContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\\n</script>\\n\\n{#if isDesktop}\\n\\t<DropdownMenu.Content class={className} {...restProps}>\\n\\t\\t{@render children?.()}\\n\\t</DropdownMenu.Content>\\n{:else}\\n\\t<div class={cn('flex flex-col w-full', className)}>\\n\\t\\t{@render children?.()}\\n\\t</div>\\n{/if}\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\\n\\timport { getContext } from 'svelte';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\tlet { isDesktop } =\\n\\t\\tgetContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\\n\\tlet { children, ...restProps } = $props();\\n</script>\\n\\n{#if isDesktop}\\n\\t<DropdownMenu.Group {...restProps}>\\n\\t\\t{@render children?.()}\\n\\t</DropdownMenu.Group>\\n{:else}\\n\\t{@render children?.()}\\n{/if}\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { goto } from '$app/navigation';\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport { getContext } from 'svelte';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\tlet { children, href = undefined, ...restProps } = $props();\\n\\n\\tconst { isDesktop } =\\n\\t\\tgetContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\\n\\n\\tconst handleClick = () => {\\n\\t\\tif (restProps.onclick) {\\n\\t\\t\\trestProps.onclick();\\n\\t\\t} else {\\n\\t\\t\\tif (href) {\\n\\t\\t\\t\\tgoto(href);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t};\\n</script>\\n\\n{#if isDesktop}\\n\\t<DropdownMenu.Item {...restProps} onclick={handleClick}>\\n\\t\\t{@render children?.()}\\n\\t</DropdownMenu.Item>\\n{:else}\\n\\t<Button\\n\\t\\tclass=\\\"w-full justify-start md:justify-center md:w-auto\\\"\\n\\t\\tvariant=\\\"ghost\\\"\\n\\t\\t{href}\\n\\t\\t{...restProps}\\n\\t>\\n\\t\\t{@render children?.()}\\n\\t</Button>\\n{/if}\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\\n\\timport { getContext } from 'svelte';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\tconst { isDesktop } =\\n\\t\\tgetContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\\n\\tlet { children, ...restProps } = $props();\\n</script>\\n\\n{#if isDesktop}\\n\\t<DropdownMenu.Label {...restProps}>\\n\\t\\t{@render children?.()}\\n\\t</DropdownMenu.Label>\\n{/if}\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\\n\\timport { getContext } from 'svelte';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\tconst { isDesktop } =\\n\\t\\tgetContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\\n\\tlet restProps = $props();\\n</script>\\n\\n{#if isDesktop}\\n\\t<DropdownMenu.Separator {...restProps} />\\n{/if}\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { cn } from '$lib/utils';\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\\n\\timport { getContext } from 'svelte';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\tlet { class: className = '', ...restProps } = $props();\\n\\n\\tconst { isDesktop } =\\n\\t\\tgetContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\\n</script>\\n\\n{#if isDesktop}\\n\\t<DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />\\n{/if}\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { page } from '$app/state';\\n\\timport { browser } from '$app/environment';\\n\\timport { onMount, setContext } from 'svelte';\\n\\timport * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';\\n\\timport { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\\n\\n\\tlet { user, guest } = $props();\\n\\n\\tconst breakpoint = 768;\\n\\tconst breakpointQuery = `(min-width: ${breakpoint}px)`;\\n\\n\\tlet hasMounted = $state(false);\\n\\tlet authMenuContext = $state<AuthMenuContext>({ isDesktop: true });\\n\\n\\tsetContext(AUTH_MENU_CONTEXT_KEY, authMenuContext);\\n\\n\\tfunction updateIsDesktop() {\\n\\t\\tif (!browser) return;\\n\\t\\tauthMenuContext.isDesktop = window.matchMedia(breakpointQuery).matches;\\n\\t}\\n\\n\\tonMount(() => {\\n\\t\\tupdateIsDesktop();\\n\\t\\thasMounted = true;\\n\\t\\tconst mq = window.matchMedia(breakpointQuery);\\n\\t\\tconst listener = () => (authMenuContext.isDesktop = mq.matches);\\n\\t\\tmq.addEventListener('change', listener);\\n\\t\\treturn () => mq.removeEventListener('change', listener);\\n\\t});\\n</script>\\n\\n{#if page.data.user}\\n\\t{#if authMenuContext.isDesktop}\\n\\t\\t<DropdownMenu.Root>\\n\\t\\t\\t{@render user?.()}\\n\\t\\t</DropdownMenu.Root>\\n\\t{:else}\\n\\t\\t<!-- This prevents the menu from being rendered twice before we know if we're on desktop or not -->\\n\\t\\t{#if hasMounted}\\n\\t\\t\\t{@render user?.()}\\n\\t\\t{/if}\\n\\t{/if}\\n{:else}\\n\\t{@render guest?.()}\\n{/if}\\n\"","export default \"export type AuthMenuContext = {\\n\\tisDesktop: boolean;\\n};\\n\\nexport const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');\\n\"","export default \"import Root from './auth-menu.svelte';\\nimport Content from './auth-menu-content.svelte';\\nimport Trigger from './auth-menu-trigger.svelte';\\nimport Group from './auth-menu-group.svelte';\\nimport Label from './auth-menu-label.svelte';\\nimport Separator from './auth-menu-separator.svelte';\\nimport Item from './auth-menu-item.svelte';\\n\\nexport { Root, Content, Trigger, Group, Label, Separator, Item };\\n\"","export default \"import { z } from 'zod/v3';\\n\\nexport const changeEmailSchema = z.object({\\n\\temail: z.string().email()\\n});\\n\"","export default \"import { z } from 'zod/v3';\\n\\nexport const changePasswordSchema = z\\n\\t.object({\\n\\t\\tpassword: z.string(),\\n\\t\\tpasswordConfirm: z.string()\\n\\t})\\n\\t.refine((data) => data.password === data.passwordConfirm, {\\n\\t\\tmessage: \\\"Passwords don't match\\\",\\n\\t\\tpath: ['passwordConfirm']\\n\\t});\\n\"","export default \"import { z } from 'zod/v3';\\nexport const confirmEmailChangeSchema = z.object({\\n\\tpassword: z.string()\\n});\\n\"","export default \"import { z } from 'zod/v3';\\nexport const confirmResetSchema = z.object({\\n\\tpassword: z.string(),\\n\\tpasswordConfirm: z.string()\\n});\\n\"","export default \"import { z } from 'zod/v3';\\n\\nconst otpSchema = z.object({\\n\\ttype: z.literal('otp'),\\n\\temail: z.string().email()\\n});\\n\\nconst passwordSchema = z.object({\\n\\ttype: z.literal('password'),\\n\\temail: z.string().email(),\\n\\tpassword: z.string()\\n});\\n\\nconst oAuth2Schema = z.object({\\n\\ttype: z.literal('oauth2'),\\n\\temail: z.string().email()\\n});\\n\\nexport const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);\\n\"","export default \"import { z } from 'zod/v3';\\nexport const otpSchema = z.object({\\n\\totp: z.string()\\n});\\n\"","export default \"import { z } from 'zod/v3';\\n\\nexport const profileSchema = z.object({\\n\\tname: z.string().optional(),\\n\\tavatar: z.union([z.instanceof(File), z.string()]).optional(),\\n\\temailVisibility: z.boolean().optional()\\n});\\n\"","export default \"import { z } from 'zod/v3';\\nexport const resetSchema = z.object({\\n\\temail: z.string().email()\\n});\\n\"","export default \"import { z } from 'zod/v3';\\n\\nexport const signupSchema = z.object({\\n\\temail: z.string().email(),\\n\\tpassword: z.string(),\\n\\tpasswordConfirm: z.string()\\n});\\n\"","export default \"export const load = ({ locals }) => {\\n\\tconst user = locals.pb.authStore.record!;\\n\\tconst breadcrumbs = [{ title: 'Home', url: '/dashboard' }];\\n\\n\\treturn { user, breadcrumbs };\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport * as Sidebar from '$lib/components/ui/sidebar';\\n\\timport { Separator } from '$lib/components/ui/separator';\\n\\timport AppSidebar from '$lib/components/app-sidebar.svelte';\\n\\timport * as Breadcrumb from '$lib/components/ui/breadcrumb';\\n\\timport { page } from '$app/state';\\n\\n\\tlet breadcrumbs = $derived(page.data.breadcrumbs || []) as { title: string; url: string }[];\\n\\tlet { data, children } = $props();\\n</script>\\n\\n<div class=\\\"min-h-dvh dashboard\\\">\\n\\t<Sidebar.Provider>\\n\\t\\t<AppSidebar user={data.user} meta={data.meta} />\\n\\t\\t<Sidebar.Inset>\\n\\t\\t\\t<header class=\\\"flex h-16 shrink-0 items-center gap-2\\\">\\n\\t\\t\\t\\t<div class=\\\"flex items-center gap-2 px-4\\\">\\n\\t\\t\\t\\t\\t<Sidebar.Trigger class=\\\"-ml-1\\\" />\\n\\t\\t\\t\\t\\t<Separator orientation=\\\"vertical\\\" class=\\\"mr-2 data-[orientation=vertical]:h-4\\\" />\\n\\t\\t\\t\\t\\t{#if breadcrumbs.length > 0}\\n\\t\\t\\t\\t\\t\\t<Breadcrumb.Root>\\n\\t\\t\\t\\t\\t\\t\\t<Breadcrumb.List>\\n\\t\\t\\t\\t\\t\\t\\t\\t{#if breadcrumbs.length > 1}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#each breadcrumbs.slice(0, -1) as breadcrumb}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Breadcrumb.Item>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Breadcrumb.Link href={breadcrumb.url}>{breadcrumb.title}</Breadcrumb.Link>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Breadcrumb.Item>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Breadcrumb.Separator />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/each}\\n\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t\\t<Breadcrumb.Page>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{breadcrumbs[breadcrumbs.length - 1].title}\\n\\t\\t\\t\\t\\t\\t\\t\\t</Breadcrumb.Page>\\n\\t\\t\\t\\t\\t\\t\\t</Breadcrumb.List>\\n\\t\\t\\t\\t\\t\\t</Breadcrumb.Root>\\n\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</header>\\n\\t\\t\\t<div class=\\\"flex flex-1 flex-col p-4 pt-0\\\">\\n\\t\\t\\t\\t{@render children?.()}\\n\\t\\t\\t</div>\\n\\t\\t</Sidebar.Inset>\\n\\t</Sidebar.Provider>\\n</div>\\n\\n<style>\\n\\t:global(body:has(div.dashboard)) {\\n\\t\\tbackground-color: var(--color-sidebar);\\n\\t}\\n</style>\\n\"","export default \"\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('dashboard', () => {\\n\\tit('should redirect to the login page', async (context) => {\\n\\t\\tconst response = await context.request.get('/dashboard' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(302);\\n\\t\\texpect(response.headers.location).toBe('/login?redirect=%2Fdashboard');\\n\\t});\\n\\n\\tit('authenticated user should be able to access the dashboard', async (context) => {\\n\\t\\tawait context.agent.authenticateUser();\\n\\t\\tconst response = await context.agent.get('/dashboard' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n});\\n\"","export default \"export const load = async ({ parent }) => {\\n\\tconst { breadcrumbs } = await parent();\\n\\n\\treturn {\\n\\t\\tbreadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]\\n\\t};\\n};\\n\"","export default \"import { superValidate, fail, withFiles } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { setFlash } from 'sveltekit-flash-message/server';\\nimport { profileSchema } from '$lib/schemas/profile';\\nimport { changeEmailSchema } from '$lib/schemas/changeEmail';\\nimport { changePasswordSchema } from '$lib/schemas/changePassword';\\n\\nexport const load = async ({ parent }) => {\\n\\tconst { user } = await parent();\\n\\n\\tconst profileForm = await superValidate(\\n\\t\\t{\\n\\t\\t\\tavatar: user.avatar,\\n\\t\\t\\tname: user.name,\\n\\t\\t\\temailVisibility: user.emailVisibility\\n\\t\\t},\\n\\t\\tzod(profileSchema)\\n\\t);\\n\\tconst emailForm = await superValidate(zod(changeEmailSchema));\\n\\tconst passwordForm = await superValidate(zod(changePasswordSchema));\\n\\n\\treturn { profileForm, emailForm, passwordForm, user };\\n};\\n\\nexport const actions = {\\n\\tupdateProfile: async ({ locals, request, cookies }) => {\\n\\t\\tconst form = await superValidate(request, zod(profileSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { profileForm: form });\\n\\t\\t}\\n\\n\\t\\tawait locals.pb.collection('users').update(locals.pb.authStore.record!.id, form.data);\\n\\n\\t\\tsetFlash({ type: 'toast', message: 'Profile updated successfully.' }, cookies);\\n\\t\\treturn withFiles({ profileForm: form });\\n\\t},\\n\\tchangeEmail: async ({ locals, request, cookies }) => {\\n\\t\\tconst form = await superValidate(request, zod(changeEmailSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { emailForm: form });\\n\\t\\t}\\n\\n\\t\\tawait locals.pb.collection('users').requestEmailChange(form.data.email);\\n\\t\\tsetFlash({ type: 'toast', message: 'We sent a confirmation link to your new email.' }, cookies);\\n\\t\\treturn { emailForm: form };\\n\\t},\\n\\tchangePassword: async ({ locals, request, cookies }) => {\\n\\t\\tconst form = await superValidate(request, zod(changePasswordSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { passwordForm: form });\\n\\t\\t}\\n\\n\\t\\tawait locals.admin.collection('users').update(locals.pb.authStore.record!.id, {\\n\\t\\t\\tpassword: form.data.password,\\n\\t\\t\\tpasswordConfirm: form.data.passwordConfirm\\n\\t\\t});\\n\\n\\t\\tsetFlash({ type: 'toast', message: 'Password updated successfully.' }, cookies);\\n\\t\\treturn { passwordForm: form };\\n\\t},\\n\\tresendVerificationEmail: async ({ locals, request, cookies }) => {\\n\\t\\tawait locals.pb.collection('users').requestVerification(locals.pb.authStore.record!.email);\\n\\t\\tsetFlash({ type: 'toast', message: 'We sent a verification email to your email.' }, cookies);\\n\\t\\treturn {};\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { changeEmailSchema } from '$lib/schemas/changeEmail';\\n\\timport { changePasswordSchema } from '$lib/schemas/changePassword';\\n\\timport { profileSchema } from '$lib/schemas/profile';\\n\\timport { Button, buttonVariants } from '$lib/components/ui/button';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\timport { Badge } from '$lib/components/ui/badge';\\n\\timport * as Dialog from '$lib/components/ui/dialog';\\n\\timport { Checkbox } from '$lib/components/ui/checkbox';\\n\\timport * as Avatar from '$lib/components/ui/avatar';\\n\\timport * as FileForm from '$lib/components/ui/file-form';\\n\\n\\tlet { data } = $props();\\n\\n\\tconst profileForm = superForm(\\n\\t\\tuntrack(() => data.profileForm),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(profileSchema),\\n\\t\\t\\tid: 'profileForm'\\n\\t\\t}\\n\\t);\\n\\n\\tconst emailForm = superForm(\\n\\t\\tuntrack(() => data.emailForm),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(changeEmailSchema),\\n\\t\\t\\tid: 'emailForm'\\n\\t\\t}\\n\\t);\\n\\n\\tconst passwordForm = superForm(\\n\\t\\tuntrack(() => data.passwordForm),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(changePasswordSchema),\\n\\t\\t\\tid: 'passwordForm'\\n\\t\\t}\\n\\t);\\n\\n\\tconst { form: profileFormData } = profileForm;\\n\\tconst { form: emailFormData } = emailForm;\\n\\tconst { form: passwordFormData } = passwordForm;\\n</script>\\n\\n<div class=\\\"divide-y divide-gray-900/10 dark:divide-white/10\\\">\\n\\t<div class=\\\"grid grid-cols-1 gap-x-8 gap-y-8 py-10 md:grid-cols-3\\\">\\n\\t\\t<div class=\\\"px-4 sm:px-0\\\">\\n\\t\\t\\t<h2 class=\\\"text-base/7 font-semibold text-gray-900 dark:text-white\\\">Profile</h2>\\n\\t\\t\\t<p class=\\\"mt-1 text-sm/6 text-gray-600 dark:text-gray-400\\\">Your profile information.</p>\\n\\t\\t</div>\\n\\n\\t\\t<form\\n\\t\\t\\tmethod=\\\"POST\\\"\\n\\t\\t\\taction=\\\"?/updateProfile\\\"\\n\\t\\t\\tenctype=\\\"multipart/form-data\\\"\\n\\t\\t\\tclass=\\\"md:col-span-2\\\"\\n\\t\\t>\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t<Card.Content class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t\\t\\t<FileForm.Field form={profileForm} name=\\\"avatar\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex items-center gap-3 justify-between\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#if !$profileFormData.avatar}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex items-center gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Avatar.Root class=\\\"size-16\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Avatar.Fallback>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{data.user.email.charAt(0).toUpperCase()}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Avatar.Fallback>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Avatar.Root>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<span class=\\\"text-sm font-medium leading-none\\\">Avatar</span>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<p class=\\\"text-muted-foreground text-sm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tUpload a new avatar for your profile.\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</p>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<FileForm.Single>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet display({ file, filename, onremove })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex-1 flex gap-2 justify-between items-center\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex items-center gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<FileForm.Thumb\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{file}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{filename}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tcollectionId=\\\"users\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tid={data.user.id}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-16 h-16 object-cover rounded-full\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<span class=\\\"text-sm font-medium leading-none\\\">Avatar</span>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<p class=\\\"text-muted-foreground text-sm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tUpload a new avatar for your profile.\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</p>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button variant=\\\"outline\\\" onclick={() => onremove(file)}>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tRemove avatar\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet input()}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label class={buttonVariants({ variant: 'outline' })}>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tUpload new picture\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<FileForm.Input class=\\\"hidden\\\" {...props} />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</FileForm.Single>\\n\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t</FileForm.Field>\\n\\n\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t<Form.Field form={profileForm} name=\\\"name\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Name</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input {...props} type=\\\"text\\\" bind:value={$profileFormData.name} />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t<Form.Field form={profileForm} name=\\\"emailVisibility\\\" class=\\\"flex items-start gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Checkbox {...props} bind:checked={$profileFormData.emailVisibility} />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Display email publicly</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<p class=\\\"text-muted-foreground text-sm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tBy clicking this checkbox, your email will be displayed publicly.\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</p>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t\\t<Card.Footer class=\\\"border-t justify-end\\\">\\n\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-fit\\\">Save changes</Button>\\n\\t\\t\\t\\t</Card.Footer>\\n\\t\\t\\t</Card.Root>\\n\\t\\t</form>\\n\\t</div>\\n\\n\\t<div class=\\\"grid grid-cols-1 gap-x-8 gap-y-8 py-10 md:grid-cols-3\\\">\\n\\t\\t<div class=\\\"px-4 sm:px-0\\\">\\n\\t\\t\\t<h2 class=\\\"text-base/7 font-semibold text-gray-900 dark:text-white\\\">Email</h2>\\n\\t\\t\\t<p class=\\\"mt-1 text-sm/6 text-gray-600 dark:text-gray-400\\\">\\n\\t\\t\\t\\tThe email address associated with your account.\\n\\t\\t\\t</p>\\n\\t\\t</div>\\n\\n\\t\\t<Card.Root class=\\\"md:col-span-2\\\">\\n\\t\\t\\t<Card.Content class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t\\t<div class=\\\"flex justify-between items-center\\\">\\n\\t\\t\\t\\t\\t<span class=\\\"text-sm flex items-center gap-2\\\">\\n\\t\\t\\t\\t\\t\\t{data.user.email}\\n\\t\\t\\t\\t\\t\\t<Badge variant=\\\"secondary\\\">{data.user.verified ? 'Verified' : 'Unverified'}</Badge>\\n\\t\\t\\t\\t\\t</span>\\n\\t\\t\\t\\t\\t<div class=\\\"flex items-center gap-3\\\">\\n\\t\\t\\t\\t\\t\\t{#if !data.user.verified}\\n\\t\\t\\t\\t\\t\\t\\t<form method=\\\"POST\\\" action=\\\"?/resendVerificationEmail\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" variant=\\\"outline\\\" class=\\\"w-fit\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t>Resend verification email</Button\\n\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t<Dialog.Root>\\n\\t\\t\\t\\t\\t\\t\\t<Dialog.Trigger class={buttonVariants({ variant: 'outline' })}>\\n\\t\\t\\t\\t\\t\\t\\t\\tChange email\\n\\t\\t\\t\\t\\t\\t\\t</Dialog.Trigger>\\n\\t\\t\\t\\t\\t\\t\\t<Dialog.Content>\\n\\t\\t\\t\\t\\t\\t\\t\\t<Dialog.Header>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Dialog.Title>Change email</Dialog.Title>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Dialog.Description>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tEnter your new email address. You will receive a verification email.\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Dialog.Description>\\n\\t\\t\\t\\t\\t\\t\\t\\t</Dialog.Header>\\n\\t\\t\\t\\t\\t\\t\\t\\t<form method=\\\"POST\\\" action=\\\"?/changeEmail\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field form={emailForm} name=\\\"email\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Email</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"email\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$emailFormData.email}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t\\t\\t\\t\\t<Dialog.Footer>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-fit\\\">Change email</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t</Dialog.Footer>\\n\\t\\t\\t\\t\\t\\t\\t</Dialog.Content>\\n\\t\\t\\t\\t\\t\\t</Dialog.Root>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</Card.Content>\\n\\t\\t</Card.Root>\\n\\t</div>\\n\\n\\t<div class=\\\"grid grid-cols-1 gap-x-8 gap-y-8 py-10 md:grid-cols-3\\\">\\n\\t\\t<div class=\\\"px-4 sm:px-0\\\">\\n\\t\\t\\t<h2 class=\\\"text-base/7 font-semibold text-gray-900 dark:text-white\\\">Password</h2>\\n\\t\\t\\t<p class=\\\"mt-1 text-sm/6 text-gray-600 dark:text-gray-400\\\">\\n\\t\\t\\t\\tYour password is used to log in to your account.\\n\\t\\t\\t</p>\\n\\t\\t</div>\\n\\n\\t\\t<form method=\\\"POST\\\" action=\\\"?/changePassword\\\" class=\\\"md:col-span-2\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t<Card.Content class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t<Form.Field form={passwordForm} name=\\\"password\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>New password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$passwordFormData.password}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"new-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-3\\\">\\n\\t\\t\\t\\t\\t\\t\\t<Form.Field form={passwordForm} name=\\\"passwordConfirm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Confirm new password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$passwordFormData.passwordConfirm}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"new-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t\\t<Card.Footer class=\\\"border-t justify-end\\\">\\n\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-fit\\\">Update password</Button>\\n\\t\\t\\t\\t</Card.Footer>\\n\\t\\t\\t</Card.Root>\\n\\t\\t</form>\\n\\t</div>\\n</div>\\n\"","export default \"import { fail, superValidate } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';\\nimport { redirect } from '@sveltejs/kit';\\nimport { setFlash } from 'sveltekit-flash-message/server';\\n\\nexport const load = async () => {\\n\\treturn { form: await superValidate(zod(confirmEmailChangeSchema)) };\\n};\\n\\nexport const actions = {\\n\\tdefault: async ({ locals, params, request, cookies }) => {\\n\\t\\tconst form = await superValidate(request, zod(confirmEmailChangeSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\tawait locals.admin.collection('users').confirmEmailChange(params.token, form.data.password);\\n\\n\\t\\tlocals.pb.authStore.clear();\\n\\t\\tlocals.pb.authStore.clearCookie(cookies);\\n\\n\\t\\tsetFlash({ type: 'toast', message: 'Email changed successfully.' }, cookies);\\n\\t\\treturn redirect(303, '/login');\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\n\\tlet { data } = $props();\\n\\n\\tconst form = superForm(\\n\\t\\tuntrack(() => data.form),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(confirmEmailChangeSchema)\\n\\t\\t}\\n\\t);\\n\\n\\tconst { form: formData } = form;\\n</script>\\n\\n<div class=\\\"flex flex-col flex-1 items-center justify-center gap-6 p-6 md:p-10\\\">\\n\\t<div class=\\\"flex w-full max-w-sm flex-col gap-6\\\">\\n\\t\\t<a href=\\\"/\\\" class=\\\"flex items-center gap-2 self-center font-medium\\\">\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-4\\\" />\\n\\t\\t\\t</div>\\n\\t\\t\\t{data.meta.appName}\\n\\t\\t</a>\\n\\n\\t\\t<div class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Confirm your email change</Card.Title>\\n\\t\\t\\t\\t\\t<Card.Description>Enter your password to confirm your email change</Card.Description>\\n\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t<Card.Content>\\n\\t\\t\\t\\t\\t<form method=\\\"POST\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"password\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$formData.password}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"current-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Confirm email change</Button>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t</Card.Root>\\n\\t\\t</div>\\n\\t</div>\\n</div>\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /confirm-email-change/[token]', () => {\\n\\tit('should render the confirm-email-change page', async (context) => {\\n\\t\\tconst response = await context.request.get(\\n\\t\\t\\t'/confirm-email-change/123456' satisfies Match<RouteId>\\n\\t\\t);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n});\\n\"","export default \"import { fail, superValidate } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { confirmResetSchema } from '$lib/schemas/confirmReset';\\nimport { redirect } from '@sveltejs/kit';\\nimport { setFlash } from 'sveltekit-flash-message/server';\\n\\nexport const load = async () => {\\n\\treturn { form: await superValidate(zod(confirmResetSchema)) };\\n};\\n\\nexport const actions = {\\n\\tdefault: async ({ locals, request, params, cookies }) => {\\n\\t\\tconst form = await superValidate(request, zod(confirmResetSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\tawait locals.admin\\n\\t\\t\\t.collection('users')\\n\\t\\t\\t.confirmPasswordReset(params.token, form.data.password, form.data.passwordConfirm);\\n\\n\\t\\tlocals.pb.authStore.clear();\\n\\t\\tlocals.pb.authStore.clearCookie(cookies);\\n\\n\\t\\tsetFlash({ type: 'toast', message: 'Password reset successfully.' }, cookies);\\n\\t\\treturn redirect(303, '/login');\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { confirmResetSchema } from '$lib/schemas/confirmReset';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\n\\tlet { data } = $props();\\n\\n\\tconst form = superForm(\\n\\t\\tuntrack(() => data.form),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(confirmResetSchema)\\n\\t\\t}\\n\\t);\\n\\n\\tconst { form: formData } = form;\\n</script>\\n\\n<div class=\\\"flex flex-col flex-1 items-center justify-center gap-6 p-6 md:p-10\\\">\\n\\t<div class=\\\"flex w-full max-w-sm flex-col gap-6\\\">\\n\\t\\t<a href=\\\"/\\\" class=\\\"flex items-center gap-2 self-center font-medium\\\">\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-4\\\" />\\n\\t\\t\\t</div>\\n\\t\\t\\t{data.meta.appName}\\n\\t\\t</a>\\n\\n\\t\\t<div class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Reset your password</Card.Title>\\n\\t\\t\\t\\t\\t<Card.Description>Enter your new password</Card.Description>\\n\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t<Card.Content>\\n\\t\\t\\t\\t\\t<form method=\\\"POST\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"password\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$formData.password}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"new-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"passwordConfirm\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Confirm Password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$formData.passwordConfirm}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"new-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Reset password</Button>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t</Card.Root>\\n\\t\\t</div>\\n\\t</div>\\n</div>\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /confirm-reset/[token]', () => {\\n\\tit('should render the confirm-reset page', async (context) => {\\n\\t\\tconst response = await context.request.get('/confirm-reset/123456' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n});\\n\"","export default \"import { redirect } from '@sveltejs/kit';\\nimport { setFlash } from 'sveltekit-flash-message/server';\\n\\nexport const GET = async ({ params, locals, cookies }) => {\\n\\tlet message = '';\\n\\tlet redirectPath = '';\\n\\n\\ttry {\\n\\t\\tawait locals.admin.collection('users').confirmVerification(params.token);\\n\\t\\tmessage = 'Email verified successfully.';\\n\\t\\tredirectPath = '/dashboard';\\n\\t} catch (error: any) {\\n\\t\\tmessage = 'Invalid or expired verification token. Please request a new verification email.';\\n\\t\\tredirectPath = '/login';\\n\\t}\\n\\n\\tsetFlash({ type: 'toast', message }, cookies);\\n\\tredirect(303, redirectPath);\\n};\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /confirm-verification/[token]', () => {\\n\\tit('should redirect if the token is invalid', async (context) => {\\n\\t\\tconst response = await context.request.get(\\n\\t\\t\\t'/confirm-verification/123456' satisfies Match<RouteId>\\n\\t\\t);\\n\\t\\texpect(response.status).toBe(303);\\n\\t\\texpect(response.headers['location']).toBe('/login');\\n\\t});\\n});\\n\"","export default \"import { fail, superValidate, message } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { loginSchema } from '$lib/schemas/login';\\nimport { redirect } from '@sveltejs/kit';\\nimport { dev } from '$app/environment';\\n\\nexport const load = async ({ locals }) => {\\n\\tif (locals.pb.authStore.isValid) {\\n\\t\\tredirect(303, '/dashboard');\\n\\t}\\n\\n\\tconst authMethods = await locals.admin.collection('users').listAuthMethods();\\n\\n\\tconst type: 'password' | 'otp' | 'oauth2' = authMethods.otp.enabled\\n\\t\\t? 'otp'\\n\\t\\t: authMethods.password.enabled\\n\\t\\t\\t? 'password'\\n\\t\\t\\t: 'oauth2';\\n\\n\\treturn {\\n\\t\\tform: await superValidate(zod(loginSchema.default({ type, email: '', password: '' }))),\\n\\t\\tauthMethods\\n\\t};\\n};\\n\\nexport const actions = {\\n\\tdefault: async ({ locals, request, cookies, url }) => {\\n\\t\\tconst form = await superValidate(request, zod(loginSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\tconst redirectParam = url.searchParams.get('redirect');\\n\\t\\tif (form.data.type === 'otp') {\\n\\t\\t\\tconst req = await locals.pb.collection('users').requestOTP(form.data.email);\\n\\t\\t\\treturn redirect(\\n\\t\\t\\t\\t303,\\n\\t\\t\\t\\t`/otp/${req.otpId}${redirectParam ? `?redirect=${encodeURIComponent(redirectParam)}` : ''}`\\n\\t\\t\\t);\\n\\t\\t} else if (form.data.type === 'password') {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tawait locals.pb.collection('users').authWithPassword(form.data.email, form.data.password);\\n\\t\\t\\t} catch (error: any) {\\n\\t\\t\\t\\treturn message(form, { type: 'error', text: error.response.message }, { status: 400 });\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\tconst redirectUrl = redirectParam ?? '/dashboard';\\n\\t\\tconst cookie = locals.pb.authStore.getCookie();\\n\\t\\tcookies.set('pb_auth', cookie, {\\n\\t\\t\\tpath: '/',\\n\\t\\t\\thttpOnly: true,\\n\\t\\t\\tsameSite: 'lax',\\n\\t\\t\\tsecure: !dev,\\n\\t\\t\\tmaxAge: 60 * 60 * 24 * 30\\n\\t\\t});\\n\\n\\t\\tredirect(303, redirectUrl);\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { loginSchema } from '$lib/schemas/login';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\timport PocketBase from 'pocketbase-svelte';\\n\\timport { goto } from '$app/navigation';\\n\\timport { page } from '$app/state';\\n\\n\\tlet { data } = $props();\\n\\tlet { authMethods } = data;\\n\\n\\tconst redirect = page.url.searchParams.get('redirect');\\n\\tconst hasOAuth2 = authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0;\\n\\tconst hasAuthMethods = authMethods.password.enabled || authMethods.otp.enabled || hasOAuth2;\\n\\n\\tconst form = superForm(\\n\\t\\tuntrack(() => data.form),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(loginSchema)\\n\\t\\t}\\n\\t);\\n\\n\\tconst handleOAuth2 = (provider: string) => {\\n\\t\\tconst pb = new PocketBase('/');\\n\\n\\t\\tpb.collection('users')\\n\\t\\t\\t.authWithOAuth2({ provider, createData: {} })\\n\\t\\t\\t.then(() => goto('/dashboard'));\\n\\t};\\n\\n\\tconst { form: formData, message } = form;\\n</script>\\n\\n<div class=\\\"h-full flex flex-col items-center justify-center gap-6 p-6 md:p-10\\\">\\n\\t<div class=\\\"flex w-full max-w-sm flex-col gap-6\\\">\\n\\t\\t<a href=\\\"/\\\" class=\\\"flex items-center gap-2 self-center font-medium\\\">\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-4\\\" />\\n\\t\\t\\t</div>\\n\\t\\t\\t{data.meta.appName}\\n\\t\\t</a>\\n\\n\\t\\t<div class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t{#if hasAuthMethods}\\n\\t\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Welcome back</Card.Title>\\n\\t\\t\\t\\t\\t\\t{#if hasOAuth2}\\n\\t\\t\\t\\t\\t\\t\\t<Card.Description>Choose a login method</Card.Description>\\n\\t\\t\\t\\t\\t\\t{:else}\\n\\t\\t\\t\\t\\t\\t\\t<Card.Description>Use your email to login</Card.Description>\\n\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t{:else}\\n\\t\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Login is disabled</Card.Title>\\n\\t\\t\\t\\t\\t\\t<Card.Description>Check back later for login options</Card.Description>\\n\\t\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t<Card.Content>\\n\\t\\t\\t\\t\\t<form method=\\\"POST\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t{#if hasOAuth2}\\n\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex flex-col gap-4\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#each authMethods.oauth2.providers as provider}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tvariant=\\\"outline\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-full\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tonclick={() => handleOAuth2(provider.name)}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<img\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tsrc=\\\"/admin/_/images/oauth2/{provider.name}.svg\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"size-5 bg-white p-0.5 rounded-sm\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\talt=\\\"\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tLogin with {provider.displayName}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/each}\\n\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t{#if authMethods.password.enabled || authMethods.otp.enabled}\\n\\t\\t\\t\\t\\t\\t\\t\\t{#if hasOAuth2}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<div\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<span class=\\\"bg-card text-muted-foreground relative z-10 px-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tOr continue with\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</span>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"email\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Email</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input {...props} type=\\\"email\\\" bind:value={$formData.email} required />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#if $formData.type === 'password' && authMethods.password.enabled}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"password\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex justify-between\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<a\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\thref=\\\"/reset\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"ml-auto text-sm underline-offset-4 hover:underline\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>Forgot your password?</a\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$formData.password}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"current-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#if $message && $message.type === 'error'}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"text-destructive text-sm font-medium -mt-2\\\">{$message.text}</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Login</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#if authMethods.otp.enabled}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tvariant=\\\"outline\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-full\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tonclick={() => ($formData.type = 'otp' as 'password')}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>Use one-time code instead</Button\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{:else if $formData.type === 'otp' && authMethods.otp.enabled}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Send one-time code</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#if authMethods.password.enabled}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tvariant=\\\"outline\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-full\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tonclick={() => ($formData.type = 'password' as 'otp')}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>Continue with password</Button\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<input type=\\\"hidden\\\" name=\\\"type\\\" bind:value={$formData.type} />\\n\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"text-center text-sm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\tDon't have an account?\\n\\t\\t\\t\\t\\t\\t\\t\\t<a\\n\\t\\t\\t\\t\\t\\t\\t\\t\\thref=\\\"/signup{redirect ? `?redirect=${encodeURIComponent(redirect)}` : ''}\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"underline underline-offset-4\\\">Sign up</a\\n\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t</Card.Root>\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\tBy clicking continue, you agree to our <a href=\\\"/terms\\\">Terms of Service</a>\\n\\t\\t\\t\\tand <a href=\\\"/privacy\\\">Privacy Policy</a>.\\n\\t\\t\\t</div>\\n\\t\\t</div>\\n\\t</div>\\n</div>\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport * as devalue from 'devalue';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /login', () => {\\n\\tit('should render the login page', async (context) => {\\n\\t\\tconst response = await context.agent.get('/login' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n\\n\\tit('should redirect to the dashboard if the user is already authenticated', async (context) => {\\n\\t\\tawait context.agent.authenticateUser();\\n\\t\\tconst response = await context.agent.get('/login' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(303);\\n\\t\\texpect(response.headers.location).toBe('/dashboard');\\n\\t});\\n});\\n\\ndescribe('POST /login', () => {\\n\\tit('should login with password', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/login' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({\\n\\t\\t\\t\\ttype: 'password',\\n\\t\\t\\t\\temail: context.user.email,\\n\\t\\t\\t\\tpassword: 'password'\\n\\t\\t\\t});\\n\\t\\texpect(response.body.status).toBe(303);\\n\\t\\texpect(response.body.location).toBe('/dashboard');\\n\\t});\\n\\n\\tit('should error if the password is incorrect', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/login' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({\\n\\t\\t\\t\\ttype: 'password',\\n\\t\\t\\t\\temail: context.user.email,\\n\\t\\t\\t\\tpassword: 'incorrect'\\n\\t\\t\\t});\\n\\t\\tconst data = devalue.parse(response.body.data);\\n\\t\\texpect(response.body.status).toBe(400);\\n\\t\\texpect(data.form.message.text).toBe('Failed to authenticate.');\\n\\t});\\n});\\n\"","export default \"import { redirect } from '@sveltejs/kit';\\n\\nexport const POST = ({ cookies, locals }) => {\\n\\tlocals.pb.authStore.clear();\\n\\tlocals.pb.authStore.clearCookie(cookies);\\n\\tthrow redirect(303, '/');\\n};\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('POST /logout', () => {\\n\\tit('should logout the user', async (context) => {\\n\\t\\tawait context.agent.authenticateUser();\\n\\t\\tconst response = await context.agent.post('/logout' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(303);\\n\\t\\texpect(response.headers.location).toBe('/');\\n\\t});\\n});\\n\"","export default \"import { fail, message, superValidate } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { otpSchema } from '$lib/schemas/otp';\\nimport { redirect } from '@sveltejs/kit';\\nimport { dev } from '$app/environment';\\n\\nexport const load = async ({ locals }) => {\\n\\tif (locals.pb.authStore.isValid) {\\n\\t\\tredirect(303, '/dashboard');\\n\\t}\\n\\n\\treturn { form: await superValidate(zod(otpSchema)) };\\n};\\n\\nexport const actions = {\\n\\tdefault: async ({ locals, request, params, cookies, url }) => {\\n\\t\\tconst form = await superValidate(request, zod(otpSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\ttry {\\n\\t\\t\\tawait locals.pb.collection('users').authWithOTP(params.token, form.data.otp);\\n\\t\\t} catch (error: any) {\\n\\t\\t\\treturn message(form, { type: 'error', text: error.response.message }, { status: 400 });\\n\\t\\t}\\n\\n\\t\\tconst redirectUrl = url.searchParams.get('redirect') ?? '/dashboard';\\n\\t\\tconst cookie = locals.pb.authStore.getCookie();\\n\\t\\tcookies.set('pb_auth', cookie, {\\n\\t\\t\\tpath: '/',\\n\\t\\t\\thttpOnly: true,\\n\\t\\t\\tsameSite: 'lax',\\n\\t\\t\\tsecure: !dev,\\n\\t\\t\\tmaxAge: 60 * 60 * 24 * 30\\n\\t\\t});\\n\\n\\t\\tredirect(303, redirectUrl);\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { otpSchema } from '$lib/schemas/otp';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\n\\tlet { data } = $props();\\n\\n\\tconst form = superForm(\\n\\t\\tuntrack(() => data.form),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(otpSchema)\\n\\t\\t}\\n\\t);\\n\\n\\tconst { form: formData, message } = form;\\n</script>\\n\\n<div class=\\\"flex flex-col flex-1 items-center justify-center gap-6 p-6 md:p-10\\\">\\n\\t<div class=\\\"flex w-full max-w-sm flex-col gap-6\\\">\\n\\t\\t<a href=\\\"/\\\" class=\\\"flex items-center gap-2 self-center font-medium\\\">\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-4\\\" />\\n\\t\\t\\t</div>\\n\\t\\t\\t{data.meta.appName}\\n\\t\\t</a>\\n\\n\\t\\t<div class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Enter your OTP code</Card.Title>\\n\\t\\t\\t\\t\\t<Card.Description>Enter the code sent to your email</Card.Description>\\n\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t<Card.Content>\\n\\t\\t\\t\\t\\t<form method=\\\"POST\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"otp\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>OTP code</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input {...props} type=\\\"text\\\" bind:value={$formData.otp} required />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t{#if $message && $message.type === 'error'}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"text-destructive text-sm font-medium -mt-2\\\">{$message.text}</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Verify code</Button>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t</Card.Root>\\n\\t\\t</div>\\n\\t</div>\\n</div>\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /otp/[token]', () => {\\n\\tit('should render the otp page', async (context) => {\\n\\t\\tconst response = await context.request.get('/otp/123456' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n});\\n\\ndescribe('POST /otp/[token]', () => {\\n\\tit('should throw an error if the otp is invalid', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/otp/123456' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({ otp: '123456' });\\n\\t\\texpect(response.body.status).toBe(400);\\n\\t});\\n});\\n\"","export default \"import { fail, superValidate } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { resetSchema } from '$lib/schemas/reset';\\nimport { redirect } from '@sveltejs/kit';\\nimport { setFlash } from 'sveltekit-flash-message/server';\\n\\nexport const load = async ({ locals }) => {\\n\\tif (locals.pb.authStore.isValid) {\\n\\t\\tredirect(303, '/dashboard');\\n\\t}\\n\\n\\treturn { form: await superValidate(zod(resetSchema)) };\\n};\\n\\nexport const actions = {\\n\\tdefault: async ({ locals, request, cookies }) => {\\n\\t\\tconst form = await superValidate(request, zod(resetSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\tawait locals.pb.collection('users').requestPasswordReset(form.data.email);\\n\\t\\tsetFlash({ type: 'toast', message: 'We sent a password reset link to your email.' }, cookies);\\n\\n\\t\\treturn { form };\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { resetSchema } from '$lib/schemas/reset';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\n\\tlet { data } = $props();\\n\\n\\tconst form = superForm(\\n\\t\\tuntrack(() => data.form),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(resetSchema)\\n\\t\\t}\\n\\t);\\n\\n\\tconst { form: formData } = form;\\n</script>\\n\\n<div class=\\\"flex flex-col flex-1 items-center justify-center gap-6 p-6 md:p-10\\\">\\n\\t<div class=\\\"flex w-full max-w-sm flex-col gap-6\\\">\\n\\t\\t<a href=\\\"/\\\" class=\\\"flex items-center gap-2 self-center font-medium\\\">\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-4\\\" />\\n\\t\\t\\t</div>\\n\\t\\t\\t{data.meta.appName}\\n\\t\\t</a>\\n\\n\\t\\t<div class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Reset your password</Card.Title>\\n\\t\\t\\t\\t\\t<Card.Description>Enter your email to reset your password</Card.Description>\\n\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t<Card.Content>\\n\\t\\t\\t\\t\\t<form method=\\\"POST\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"email\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Email</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input {...props} type=\\\"email\\\" bind:value={$formData.email} required />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Send reset link</Button>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"text-center text-sm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\tRemembered your password?\\n\\t\\t\\t\\t\\t\\t\\t\\t<a href=\\\"/login\\\" class=\\\"underline underline-offset-4\\\">Log in</a>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t</Card.Root>\\n\\t\\t</div>\\n\\t</div>\\n</div>\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /reset', () => {\\n\\tit('should render the reset page', async (context) => {\\n\\t\\tconst response = await context.request.get('/reset' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n});\\n\\ndescribe('POST /reset', () => {\\n\\tit('should request a password reset', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/reset' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({ email: context.user.email });\\n\\t\\texpect(response.body.status).toBe(200);\\n\\t});\\n});\\n\"","export default \"import { redirect } from '@sveltejs/kit';\\nimport { fail, superValidate } from 'sveltekit-superforms';\\nimport { zod } from 'sveltekit-superforms/adapters';\\nimport { setFlash } from 'sveltekit-flash-message/server';\\nimport { setPocketbaseErrors } from '@velastack/pocketbase';\\nimport { dev } from '$app/environment';\\nimport { signupSchema } from '$lib/schemas/signup';\\n\\nexport const load = async ({ locals }) => {\\n\\tconst authMethods = await locals.admin.collection('users').listAuthMethods();\\n\\n\\tif (locals.pb.authStore.isValid) {\\n\\t\\tredirect(303, '/dashboard');\\n\\t}\\n\\n\\treturn { form: await superValidate(zod(signupSchema)), authMethods };\\n};\\n\\nexport const actions = {\\n\\tdefault: async ({ locals, request, cookies, url }) => {\\n\\t\\tconst form = await superValidate(request, zod(signupSchema));\\n\\n\\t\\tif (!form.valid) {\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\tlet user;\\n\\n\\t\\ttry {\\n\\t\\t\\tuser = await locals.admin.collection('users').create({\\n\\t\\t\\t\\temail: form.data.email,\\n\\t\\t\\t\\tpassword: form.data.password,\\n\\t\\t\\t\\tpasswordConfirm: form.data.passwordConfirm\\n\\t\\t\\t});\\n\\t\\t} catch (error) {\\n\\t\\t\\tsetPocketbaseErrors(form, error);\\n\\t\\t\\treturn fail(400, { form });\\n\\t\\t}\\n\\n\\t\\tawait locals.pb.collection('users').requestVerification(user.email);\\n\\t\\tawait locals.pb.collection('users').authWithPassword(form.data.email, form.data.password);\\n\\n\\t\\tconst redirectUrl = url.searchParams.get('redirect') ?? '/dashboard';\\n\\t\\tconst cookie = locals.pb.authStore.getCookie();\\n\\t\\tcookies.set('pb_auth', cookie, {\\n\\t\\t\\tpath: '/',\\n\\t\\t\\thttpOnly: true,\\n\\t\\t\\tsameSite: 'lax',\\n\\t\\t\\tsecure: !dev,\\n\\t\\t\\tmaxAge: 60 * 60 * 24 * 30\\n\\t\\t});\\n\\n\\t\\tsetFlash({ type: 'toast', message: 'We sent a confirmation link to your email.' }, cookies);\\n\\t\\treturn redirect(303, redirectUrl);\\n\\t}\\n};\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { untrack } from 'svelte';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as Card from '$lib/components/ui/card';\\n\\timport { superForm } from 'sveltekit-superforms';\\n\\timport { zodClient } from 'sveltekit-superforms/adapters';\\n\\timport { signupSchema } from '$lib/schemas/signup';\\n\\timport * as Form from '$lib/components/ui/form';\\n\\timport { Input } from '$lib/components/ui/input';\\n\\timport PocketBase from 'pocketbase-svelte';\\n\\timport { goto } from '$app/navigation';\\n\\timport { page } from '$app/state';\\n\\n\\tlet { data } = $props();\\n\\tlet { authMethods } = data;\\n\\n\\tconst redirect = page.url.searchParams.get('redirect');\\n\\tconst hasOAuth2 = authMethods.oauth2.enabled && authMethods.oauth2.providers.length > 0;\\n\\tconst hasAuthMethods = authMethods.password.enabled || authMethods.otp.enabled || hasOAuth2;\\n\\n\\tconst form = superForm(\\n\\t\\tuntrack(() => data.form),\\n\\t\\t{\\n\\t\\t\\tvalidators: zodClient(signupSchema)\\n\\t\\t}\\n\\t);\\n\\n\\tconst handleOAuth2 = (provider: string) => {\\n\\t\\tconst pb = new PocketBase('/');\\n\\n\\t\\tpb.collection('users')\\n\\t\\t\\t.authWithOAuth2({ provider, createData: {} })\\n\\t\\t\\t.then(() => goto('/dashboard'));\\n\\t};\\n\\n\\tconst { form: formData } = form;\\n</script>\\n\\n<div class=\\\"h-full flex flex-col items-center justify-center gap-6 p-6 md:p-10\\\">\\n\\t<div class=\\\"flex w-full max-w-sm flex-col gap-6\\\">\\n\\t\\t<a href=\\\"/\\\" class=\\\"flex items-center gap-2 self-center font-medium\\\">\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<img src=\\\"/favicon.svg\\\" alt=\\\"logo\\\" class=\\\"size-4\\\" />\\n\\t\\t\\t</div>\\n\\t\\t\\t{data.meta.appName}\\n\\t\\t</a>\\n\\n\\t\\t<div class=\\\"flex flex-col gap-6\\\">\\n\\t\\t\\t<Card.Root>\\n\\t\\t\\t\\t{#if hasAuthMethods}\\n\\t\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Create an account</Card.Title>\\n\\t\\t\\t\\t\\t\\t{#if hasOAuth2}\\n\\t\\t\\t\\t\\t\\t\\t<Card.Description>Choose a sign up method</Card.Description>\\n\\t\\t\\t\\t\\t\\t{:else}\\n\\t\\t\\t\\t\\t\\t\\t<Card.Description>Use your email to sign up</Card.Description>\\n\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t{:else}\\n\\t\\t\\t\\t\\t<Card.Header class=\\\"text-center\\\">\\n\\t\\t\\t\\t\\t\\t<Card.Title class=\\\"text-xl\\\">Signups are disabled</Card.Title>\\n\\t\\t\\t\\t\\t\\t<Card.Description>Check back later for signup options</Card.Description>\\n\\t\\t\\t\\t\\t</Card.Header>\\n\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t<Card.Content>\\n\\t\\t\\t\\t\\t<form method=\\\"POST\\\">\\n\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-6\\\">\\n\\t\\t\\t\\t\\t\\t\\t{#if hasOAuth2}\\n\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"flex flex-col gap-4\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{#each authMethods.oauth2.providers as provider}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tvariant=\\\"outline\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-full\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tonclick={() => handleOAuth2(provider.name)}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<img\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tsrc=\\\"/admin/_/images/oauth2/{provider.name}.svg\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"size-5 bg-white p-0.5 rounded-sm\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\talt=\\\"\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tLogin with {provider.displayName}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{/each}\\n\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t{#if authMethods.password.enabled}\\n\\t\\t\\t\\t\\t\\t\\t\\t{#if hasOAuth2}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<div\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<span class=\\\"bg-card text-muted-foreground relative z-10 px-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tOr continue with\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</span>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t<div class=\\\"grid gap-2\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"email\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Email</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input {...props} type=\\\"email\\\" bind:value={$formData.email} required />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"password\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$formData.password}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"new-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Field {form} name=\\\"passwordConfirm\\\" class=\\\"col-span-1\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{#snippet children({ props })}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.Label>Confirm Password</Form.Label>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Input\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{...props}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttype=\\\"password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tbind:value={$formData.passwordConfirm}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\trequired\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tautocomplete=\\\"new-password\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Control>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<Form.FieldErrors class=\\\"contents text-destructive\\\" />\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</Form.Field>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Button type=\\\"submit\\\" class=\\\"w-full\\\">Create account</Button>\\n\\t\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\n\\t\\t\\t\\t\\t\\t\\t<div class=\\\"text-center text-sm\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\tAlready have an account?\\n\\t\\t\\t\\t\\t\\t\\t\\t<a\\n\\t\\t\\t\\t\\t\\t\\t\\t\\thref=\\\"/login{redirect ? `?redirect=${encodeURIComponent(redirect)}` : ''}\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\tclass=\\\"underline underline-offset-4\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\tLog in\\n\\t\\t\\t\\t\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t</Card.Content>\\n\\t\\t\\t</Card.Root>\\n\\t\\t\\t<div\\n\\t\\t\\t\\tclass=\\\"text-muted-foreground *:[a]:hover:text-primary *:[a]:underline *:[a]:underline-offset-4 text-balance text-center text-xs\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\tBy clicking continue, you agree to our <a href=\\\"/terms\\\">Terms of Service</a>\\n\\t\\t\\t\\tand <a href=\\\"/privacy\\\">Privacy Policy</a>.\\n\\t\\t\\t</div>\\n\\t\\t</div>\\n\\t</div>\\n</div>\\n\"","export default \"import { describe, it, expect } from 'vitest';\\nimport type { Match } from '@velastack/pocketbase';\\nimport * as devalue from 'devalue';\\nimport type { RouteId } from './$types';\\n\\ndescribe('GET /signup', () => {\\n\\tit('should render the signup page', async (context) => {\\n\\t\\tconst response = await context.request.get('/signup' satisfies Match<RouteId>);\\n\\t\\texpect(response.status).toBe(200);\\n\\t});\\n});\\n\\ndescribe('POST /signup', () => {\\n\\tit('should signup with password', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/signup' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({\\n\\t\\t\\t\\temail: `test-${Math.random().toString(36).slice(2)}@example.com`,\\n\\t\\t\\t\\tpassword: 'password',\\n\\t\\t\\t\\tpasswordConfirm: 'password'\\n\\t\\t\\t});\\n\\t\\texpect(response.body.status).toBe(303);\\n\\t\\texpect(response.body.location).toBe('/dashboard');\\n\\t});\\n\\n\\tit('should error if the password does not match', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/signup' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({\\n\\t\\t\\t\\temail: `test-${Math.random().toString(36).slice(2)}@example.com`,\\n\\t\\t\\t\\tpassword: 'password',\\n\\t\\t\\t\\tpasswordConfirm: 'password2'\\n\\t\\t\\t});\\n\\t\\texpect(response.body.status).toBe(400);\\n\\t\\tconst data = devalue.parse(response.body.data);\\n\\t\\texpect(data.form.errors.passwordConfirm).toBeDefined();\\n\\t\\texpect(data.form.errors.passwordConfirm[0]).toBe(\\\"Values don't match.\\\");\\n\\t});\\n\\n\\tit('should error if the email is already taken', async (context) => {\\n\\t\\tconst response = await context.agent\\n\\t\\t\\t.post('/signup' satisfies Match<RouteId>)\\n\\t\\t\\t.type('form')\\n\\t\\t\\t.send({\\n\\t\\t\\t\\temail: context.user.email,\\n\\t\\t\\t\\tpassword: 'password',\\n\\t\\t\\t\\tpasswordConfirm: 'password'\\n\\t\\t\\t});\\n\\t\\texpect(response.body.status).toBe(400);\\n\\t\\tconst data = devalue.parse(response.body.data);\\n\\t\\texpect(data.form.errors.email).toBeDefined();\\n\\t\\texpect(data.form.errors.email[0]).toBe('Value must be unique.');\\n\\t});\\n});\\n\"","import { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n const components = [\n \"sidebar\",\n \"breadcrumb\",\n \"separator\",\n \"form\",\n \"collapsible\",\n \"avatar\",\n \"dropdown-menu\",\n \"card\",\n \"input\",\n \"label\",\n \"button\",\n \"badge\",\n \"dialog\",\n \"checkbox\",\n \"file-form\",\n \"auth-menu\",\n ];\n\n if (options.features.payments) {\n components.push(\"alert-dialog\");\n }\n\n const collections = [\n {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n name: \"oauth_accounts\",\n type: \"base\" as const,\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n name: \"user\",\n type: \"relation\",\n required: true,\n maxSelect: 1,\n },\n {\n name: \"providerId\",\n required: true,\n type: \"text\",\n },\n {\n name: \"provider\",\n required: true,\n type: \"text\",\n },\n {\n name: \"accessToken\",\n type: \"text\",\n },\n {\n name: \"refreshToken\",\n type: \"text\",\n },\n {\n name: \"avatarURL\",\n type: \"text\",\n },\n {\n name: \"expiry\",\n type: \"date\",\n },\n {\n name: \"email\",\n type: \"text\",\n },\n {\n name: \"name\",\n type: \"text\",\n },\n {\n name: \"username\",\n type: \"text\",\n },\n {\n name: \"rawUser\",\n type: \"json\",\n },\n ],\n },\n ];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n packages: [],\n collections,\n } satisfies Result;\n}\n","export default \"/// <reference path=\\\"../pb_data/types.d.ts\\\" />\\nmigrate(\\n\\t(app) => {\\n\\t\\tconst collection = new Collection({\\n\\t\\t\\tcreateRule: null,\\n\\t\\t\\tdeleteRule: null,\\n\\t\\t\\tfields: [\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '[a-z0-9]{15}',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text3208210256',\\n\\t\\t\\t\\t\\tmax: 15,\\n\\t\\t\\t\\t\\tmin: 15,\\n\\t\\t\\t\\t\\tname: 'id',\\n\\t\\t\\t\\t\\tpattern: '^[a-z0-9]+$',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: true,\\n\\t\\t\\t\\t\\trequired: true,\\n\\t\\t\\t\\t\\tsystem: true,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tcascadeDelete: false,\\n\\t\\t\\t\\t\\tcollectionId: '_pb_users_auth_',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'relation2375276105',\\n\\t\\t\\t\\t\\tmaxSelect: 1,\\n\\t\\t\\t\\t\\tminSelect: 0,\\n\\t\\t\\t\\t\\tname: 'user',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\trequired: true,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'relation'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text1044722854',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'providerId',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: true,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text2462348188',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'provider',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: true,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text889886754',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'accessToken',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text1769204838',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'refreshToken',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text2192111876',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'avatarURL',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'date951064219',\\n\\t\\t\\t\\t\\tmax: '',\\n\\t\\t\\t\\t\\tmin: '',\\n\\t\\t\\t\\t\\tname: 'expiry',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'date'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text3885137012',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'email',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text1579384326',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'name',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\tautogeneratePattern: '',\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'text4166911607',\\n\\t\\t\\t\\t\\tmax: 0,\\n\\t\\t\\t\\t\\tmin: 0,\\n\\t\\t\\t\\t\\tname: 'username',\\n\\t\\t\\t\\t\\tpattern: '',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\tprimaryKey: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'text'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\thidden: false,\\n\\t\\t\\t\\t\\tid: 'json1646549047',\\n\\t\\t\\t\\t\\tmaxSize: 0,\\n\\t\\t\\t\\t\\tname: 'rawUser',\\n\\t\\t\\t\\t\\tpresentable: false,\\n\\t\\t\\t\\t\\trequired: false,\\n\\t\\t\\t\\t\\tsystem: false,\\n\\t\\t\\t\\t\\ttype: 'json'\\n\\t\\t\\t\\t}\\n\\t\\t\\t],\\n\\t\\t\\tid: 'pbc_3445581863',\\n\\t\\t\\tindexes: [],\\n\\t\\t\\tlistRule: '@request.auth.id = user.id',\\n\\t\\t\\tname: 'oauth_accounts',\\n\\t\\t\\tsystem: false,\\n\\t\\t\\ttype: 'base',\\n\\t\\t\\tupdateRule: null,\\n\\t\\t\\tviewRule: '@request.auth.id = user.id'\\n\\t\\t});\\n\\n\\t\\treturn app.save(collection);\\n\\t},\\n\\t(app) => {\\n\\t\\tconst collection = app.findCollectionByNameOrId('pbc_3445581863');\\n\\n\\t\\treturn app.delete(collection);\\n\\t}\\n);\\n\"","export default \"/// <reference path=\\\"../pb_data/types.d.ts\\\" />\\nmigrate(\\n\\t(app) => {\\n\\t\\tconst collection = app.findCollectionByNameOrId('_pb_users_auth_');\\n\\n\\t\\t// update collection data\\n\\t\\tunmarshal(\\n\\t\\t\\t{\\n\\t\\t\\t\\tconfirmEmailChangeTemplate: {\\n\\t\\t\\t\\t\\tbody: '<p>Hello,</p>\\\\n<p>Click on the button below to confirm your new email address.</p>\\\\n<p>\\\\n <a class=\\\"btn\\\" href=\\\"{APP_URL}/confirm-email-change/{TOKEN}\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Confirm new email</a>\\\\n</p>\\\\n<p><i>If you didn\\\\'t ask to change your email address, you can ignore this email.</i></p>\\\\n<p>\\\\n Thanks,<br/>\\\\n {APP_NAME} team\\\\n</p>'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\tcreateRule: '@request.auth.id = id',\\n\\t\\t\\t\\tdeleteRule: '@request.auth.id = id',\\n\\t\\t\\t\\tlistRule: '@request.auth.id = id',\\n\\t\\t\\t\\tresetPasswordTemplate: {\\n\\t\\t\\t\\t\\tbody: '<p>Hello,</p>\\\\n<p>Click on the button below to reset your password.</p>\\\\n<p>\\\\n <a class=\\\"btn\\\" href=\\\"{APP_URL}/confirm-password-reset/{TOKEN}\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Reset password</a>\\\\n</p>\\\\n<p><i>If you didn\\\\'t ask to reset your password, you can ignore this email.</i></p>\\\\n<p>\\\\n Thanks,<br/>\\\\n {APP_NAME} team\\\\n</p>'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\tupdateRule: '@request.auth.id = id',\\n\\t\\t\\t\\tverificationTemplate: {\\n\\t\\t\\t\\t\\tbody: '<p>Hello,</p>\\\\n<p>Thank you for joining us at {APP_NAME}.</p>\\\\n<p>Click on the button below to verify your email address.</p>\\\\n<p>\\\\n <a class=\\\"btn\\\" href=\\\"{APP_URL}/confirm-verification/{TOKEN}\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Verify</a>\\\\n</p>\\\\n<p>\\\\n Thanks,<br/>\\\\n {APP_NAME} team\\\\n</p>'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\tviewRule: '@request.auth.id = id'\\n\\t\\t\\t},\\n\\t\\t\\tcollection\\n\\t\\t);\\n\\n\\t\\treturn app.save(collection);\\n\\t},\\n\\t(app) => {\\n\\t\\tconst collection = app.findCollectionByNameOrId('_pb_users_auth_');\\n\\n\\t\\t// update collection data\\n\\t\\tunmarshal(\\n\\t\\t\\t{\\n\\t\\t\\t\\tconfirmEmailChangeTemplate: {\\n\\t\\t\\t\\t\\tbody: '<p>Hello,</p>\\\\n<p>Click on the button below to confirm your new email address.</p>\\\\n<p>\\\\n <a class=\\\"btn\\\" href=\\\"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Confirm new email</a>\\\\n</p>\\\\n<p><i>If you didn\\\\'t ask to change your email address, you can ignore this email.</i></p>\\\\n<p>\\\\n Thanks,<br/>\\\\n {APP_NAME} team\\\\n</p>'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\tcreateRule: '',\\n\\t\\t\\t\\tdeleteRule: 'id = @request.auth.id',\\n\\t\\t\\t\\tlistRule: 'id = @request.auth.id',\\n\\t\\t\\t\\tresetPasswordTemplate: {\\n\\t\\t\\t\\t\\tbody: '<p>Hello,</p>\\\\n<p>Click on the button below to reset your password.</p>\\\\n<p>\\\\n <a class=\\\"btn\\\" href=\\\"{APP_URL}/_/#/auth/confirm-password-reset/{TOKEN}\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Reset password</a>\\\\n</p>\\\\n<p><i>If you didn\\\\'t ask to reset your password, you can ignore this email.</i></p>\\\\n<p>\\\\n Thanks,<br/>\\\\n {APP_NAME} team\\\\n</p>'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\tupdateRule: 'id = @request.auth.id',\\n\\t\\t\\t\\tverificationTemplate: {\\n\\t\\t\\t\\t\\tbody: '<p>Hello,</p>\\\\n<p>Thank you for joining us at {APP_NAME}.</p>\\\\n<p>Click on the button below to verify your email address.</p>\\\\n<p>\\\\n <a class=\\\"btn\\\" href=\\\"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">Verify</a>\\\\n</p>\\\\n<p>\\\\n Thanks,<br/>\\\\n {APP_NAME} team\\\\n</p>'\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\tviewRule: 'id = @request.auth.id'\\n\\t\\t\\t},\\n\\t\\t\\tcollection\\n\\t\\t);\\n\\n\\t\\treturn app.save(collection);\\n\\t}\\n);\\n\"","export default \"import {\\n\\tPOCKETBASE_URL,\\n\\tPOCKETBASE_SUPERUSER_EMAIL,\\n\\tPOCKETBASE_SUPERUSER_PASSWORD\\n} from '$env/static/private';\\nimport { handlePocketbase } from '@velastack/pocketbase';\\n\\nexport const handle = handlePocketbase({\\n\\tpocketbaseUrl: POCKETBASE_URL,\\n\\tsuperuserEmail: POCKETBASE_SUPERUSER_EMAIL,\\n\\tsuperuserPassword: POCKETBASE_SUPERUSER_PASSWORD,\\n\\tauth: { protectedRoutes: ['/(app)'] }\\n});\\n\"","export default \"<script lang=\\\"ts\\\">\\n\\timport { toggleMode } from 'mode-watcher';\\n\\timport * as Navbar from '$lib/components/ui/navbar';\\n\\timport { Button } from '$lib/components/ui/button';\\n\\timport * as AuthMenu from '$lib/components/ui/auth-menu';\\n\\timport * as Avatar from '$lib/components/ui/avatar';\\n\\n\\tlet { children, data } = $props();\\n</script>\\n\\n<div class=\\\"min-h-dvh grid grid-rows-[max-content_1fr_max-content] root-layout\\\">\\n\\t<Navbar.Root>\\n\\t\\t<Navbar.Brand href=\\\"/\\\">\\n\\t\\t\\t<Navbar.Logo src=\\\"/favicon.svg\\\" alt=\\\"Logo\\\" />\\n\\t\\t</Navbar.Brand>\\n\\n\\t\\t<Navbar.MobileToggle />\\n\\n\\t\\t<Navbar.List>\\n\\t\\t\\t<Navbar.Item>\\n\\t\\t\\t\\t<Button class=\\\"w-full justify-start md:justify-center md:w-auto\\\" href=\\\"/\\\" variant=\\\"ghost\\\">\\n\\t\\t\\t\\t\\tHome\\n\\t\\t\\t\\t</Button>\\n\\t\\t\\t</Navbar.Item>\\n\\n\\t\\t\\t<Navbar.Item\\n\\t\\t\\t\\tclass=\\\"flex flex-col md:flex-row items-center space-y-2 md:space-y-0 md:space-x-4\\\"\\n\\t\\t\\t>\\n\\t\\t\\t\\t<AuthMenu.Root>\\n\\t\\t\\t\\t\\t{#snippet user()}\\n\\t\\t\\t\\t\\t\\t<AuthMenu.Trigger>\\n\\t\\t\\t\\t\\t\\t\\t<Avatar.Root>\\n\\t\\t\\t\\t\\t\\t\\t\\t{#if data.user?.avatar}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<Avatar.Image\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tsrc=\\\"/api/files/users/{data.user?.id}/{data.user?.avatar}\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\talt={data.user?.email}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t/>\\n\\t\\t\\t\\t\\t\\t\\t\\t{/if}\\n\\t\\t\\t\\t\\t\\t\\t\\t<Avatar.Fallback>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t{data.user?.email?.charAt(0).toUpperCase()}\\n\\t\\t\\t\\t\\t\\t\\t\\t</Avatar.Fallback>\\n\\t\\t\\t\\t\\t\\t\\t</Avatar.Root>\\n\\t\\t\\t\\t\\t\\t</AuthMenu.Trigger>\\n\\n\\t\\t\\t\\t\\t\\t<AuthMenu.Content align=\\\"end\\\">\\n\\t\\t\\t\\t\\t\\t\\t<AuthMenu.Item href=\\\"/dashboard\\\">Dashboard</AuthMenu.Item>\\n\\t\\t\\t\\t\\t\\t\\t<AuthMenu.Group>\\n\\t\\t\\t\\t\\t\\t\\t\\t<AuthMenu.Item href=\\\"/settings\\\">Settings</AuthMenu.Item>\\n\\t\\t\\t\\t\\t\\t\\t\\t<AuthMenu.Item>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t<form action=\\\"/logout\\\" method=\\\"post\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<button type=\\\"submit\\\" class=\\\"contents\\\">Logout</button>\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t</form>\\n\\t\\t\\t\\t\\t\\t\\t\\t</AuthMenu.Item>\\n\\t\\t\\t\\t\\t\\t\\t</AuthMenu.Group>\\n\\t\\t\\t\\t\\t\\t</AuthMenu.Content>\\n\\t\\t\\t\\t\\t{/snippet}\\n\\n\\t\\t\\t\\t\\t{#snippet guest()}\\n\\t\\t\\t\\t\\t\\t<Button\\n\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-full justify-start md:justify-center md:w-auto\\\"\\n\\t\\t\\t\\t\\t\\t\\tvariant=\\\"ghost\\\"\\n\\t\\t\\t\\t\\t\\t\\thref=\\\"/login\\\">Login</Button\\n\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t\\t<Button\\n\\t\\t\\t\\t\\t\\t\\tclass=\\\"w-full justify-start md:justify-center md:w-auto\\\"\\n\\t\\t\\t\\t\\t\\t\\tvariant=\\\"outline\\\"\\n\\t\\t\\t\\t\\t\\t\\thref=\\\"/signup\\\">Sign up</Button\\n\\t\\t\\t\\t\\t\\t>\\n\\t\\t\\t\\t\\t{/snippet}\\n\\t\\t\\t\\t</AuthMenu.Root>\\n\\t\\t\\t</Navbar.Item>\\n\\t\\t</Navbar.List>\\n\\t</Navbar.Root>\\n\\n\\t{@render children?.()}\\n\\n\\t<footer class=\\\"border-t border-border py-4\\\">\\n\\t\\t<div\\n\\t\\t\\tclass=\\\"mx-auto flex max-w-7xl px-4 flex-col items-center justify-between gap-3 sm:flex-row\\\"\\n\\t\\t>\\n\\t\\t\\t<p class=\\\"text-muted-foreground text-sm\\\">\\n\\t\\t\\t\\t© {new Date().getFullYear()}\\n\\t\\t\\t\\t{data.meta.appName}. All rights reserved.\\n\\t\\t\\t</p>\\n\\t\\t\\t<nav class=\\\"flex items-center gap-4 text-sm\\\">\\n\\t\\t\\t\\t<Button onclick={toggleMode} variant=\\\"ghost\\\" size=\\\"icon\\\">\\n\\t\\t\\t\\t\\t<Navbar.Mode />\\n\\t\\t\\t\\t</Button>\\n\\t\\t\\t\\t<a href=\\\"/privacy\\\" class=\\\"underline-offset-4 hover:underline\\\">Privacy</a>\\n\\t\\t\\t\\t<a href=\\\"/terms\\\" class=\\\"underline-offset-4 hover:underline\\\">Terms</a>\\n\\t\\t\\t</nav>\\n\\t\\t</div>\\n\\t</footer>\\n</div>\\n\\n<style lang=\\\"postcss\\\">\\n\\t@reference \\\"tailwindcss\\\";\\n\\n\\t.root-layout :global(section[data-role='content']) {\\n\\t\\t@apply container mx-auto max-w-7xl px-4 py-8 w-full;\\n\\t}\\n</style>\\n\"","export default \"import { loadFlash } from \\\"sveltekit-flash-message/server\\\";\\n\\nexport const load = loadFlash(async ({ locals }) => {\\n return {\\n user: locals.pb.authStore.record,\\n };\\n});\\n\"","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-auth\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/enable/auth\";\nconst DOCS = \"/enable/auth\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]));\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes])),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable authentication\",\n summary: \"Enables authentication.\",\n categories: [\"authentication\"],\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"velastack\",\n \"oauth\",\n \"pocketbase\",\n ],\n\n command: {\n raw: \"vela enable auth\",\n base: \"vela enable auth\",\n argv: [],\n },\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import generateForm from \"./patterns/generate/form\";\nimport generateResource from \"./patterns/generate/resource\";\nimport generateScaffold from \"./patterns/generate/scaffold\";\nimport generateSchema from \"./patterns/generate/schema\";\nimport enableAuth from \"./patterns/enable/auth\";\n\nconst patterns = [\n generateForm,\n generateSchema,\n generateResource,\n generateScaffold,\n enableAuth,\n];\n\ntype PatternEntry = (typeof patterns)[number];\n\nexport type Slug = PatternEntry[\"slug\"];\n\ntype PatternsBySlug = {\n [Pattern in PatternEntry as Pattern[\"slug\"]]: Pattern;\n};\n\nconst bySlug = Object.fromEntries(\n patterns.map((pattern) => [pattern.slug, pattern]),\n) as PatternsBySlug;\n\nexport default {\n version: \"0.1.0\",\n patterns,\n bySlug,\n};\n"],"names":["canFormatFile","file","formatFile","content","prettier","sveltePlugin","formatFiles","files","formatResult","result","creates","modifies","ownKeys","object","enumerableOnly","keys","symbols","sym","_objectSpread","target","i","source","key","_defineProperty","obj","value","_toPropertyKey","arg","_toPrimitive","input","hint","prim","res","dedent","createDedent","options","newOptions","strings","values","raw","alignValues","escapeSpecialCharacters","trimWhitespace","next","alignValue","lines","mindent","l","m","indent","_","h","braced","unbraced","_ref","hex","precedingText","indentMatch","appRelativePath","globKey","prefix","languageFromPath","path","mergeResults","results","acc","FIELD_COMPONENTS","FIELD_IMPORTS","fieldValueBinding","field","renderInputProps","renderLabel","renderInputField","type","required","renderTextareaField","renderBoolField","renderGeoPointField","renderFileField","fileMode","renderSelectField","multiType","placeholder","option","renderRelationField","searchPlaceholder","emptyText","modelName","listName","renderAutodateField","renderField","selectFieldLabelMap","labels","getFieldComponents","fields","components","getFieldImports","component","displayDataPath","model","renderDisplaySimple","valueExpression","renderDisplayDateField","dataPath","dateLine","body","renderDisplayUrlField","anchor","renderDisplaySelectField","badge","renderDisplayFileField","relationListUrl","renderDisplayRelationField","relationPath","listUrl","renderDisplayGeoPointField","renderDisplayField","SPLIT_LOWER_UPPER_RE","SPLIT_UPPER_UPPER_RE","SPLIT_SEPARATE_NUMBER_RE","DEFAULT_STRIP_REGEXP","SPLIT_REPLACE_VALUE","DEFAULT_PREFIX_SUFFIX_CHARACTERS","split","start","end","splitSeparateNumbers","words","word","match","offset","noCase","suffix","splitPrefixSuffix","lowerFactory","camelCase","lower","upper","upperFactory","transform","pascalCaseTransformFactory","index","pascalCase","capitalCase","capitalCaseTransformFactory","kebabCase","snakeCase","locale","char0","splitFn","prefixCharacters","suffixCharacters","prefixIndex","suffixIndex","char","root","pluralize","require","module","this","pluralRules","singularRules","uncountables","irregularPlurals","irregularSingles","sanitizeRule","rule","restoreCase","token","interpolate","str","args","replace","sanitizeWord","rules","len","replaceWord","replaceMap","keepMap","checkWord","bool","count","inclusive","pluralized","replacement","single","plural","DATA_DIR","MIGRATIONS_DIR","APP_DIR","RESERVED_WORDS","RESERVED_ALIASES","safeVarName","validateModelName","routesDir","parseModel","modelPath","parts","finalPart","restParts","displayName","changeCase.capitalCase","pluralDisplay","name","changeCase.camelCase","urlName","changeCase.kebabCase","segment","changeCase.pascalCase","changeCase.snakeCase","modelPaths","base","modelUrls","DISPLAY_FIELD_CANDIDATES","pickDisplayField","candidate","f","collectionNames","collections","c","n","collectionIdMap","collectionDisplayFieldMap","DEFAULT_USER_HINTS","s","fallback","generateAuthRule","schema","startCollectionName","opts","AUTH","USER_HINTS","MAX_DEPTH","byName","byId","hintScore","fieldName","outEdges","collName","edges","toColl","a","b","isAuth","validPath","pathScore","last","lastIsMulti","singlesAll","e","hintSum","lastIsFieldNamedUser","pathKey","candidates","visited","dfs","curr","depth","diff","best","operator","fieldChain","splitFieldDef","definition","inQuote","escape","parenDepth","ch","stripQuotes","t","parseOptionToken","colonIndex","j","label","parseSelectOptions","current","TYPE_ALIASES","normalizeType","rawType","selectOptions","inner","inferMaxSelect","singular","resolveRelation","collectionName","parent","ids","displayFields","relatedModel","resolveField","normalized","title","names","namesSingular","rel","onCreate","onUpdate","allValidTypes","resolveFields","parsed","fieldDef","auth","parseFields","getCollections","getPreviewCollections","GENERATED_DATE","RawExpression","expression","fixtureToCode","entry","fixtureObjectToCode","data","fieldTypeFromCollectionField","relationUrl","url","idExpression","mockValueForField","relationIdsByCollectionId","_b","_a","_c","relationId","fixtureDataFromFields","fixtureDataFromCollectionFields","firstValue","ensureAuthCollectionFixture","orderedDependencyCollections","collection","visiting","ordered","walk","collectionId","uniqueVarName","used","fallbackCollectionFromFields","relationDependencyContext","dependencies","dependencyVars","usedVarNames","dependency","varName","declarations","setupLines","payload","cleanupLines","requestAgent","authSetup","setupSection","generateScaffoldServerTestSnippet","urls","modelDbData","modelFormData","generateFormServerTestSnippet","formUrl","formPaths","normalizedModelPath","basePath","baseUrl","parsePatternArgs","argv","hasFiles","escapeFieldName","getFormSchemaForField","selectValues","schemaFields","allFields","generateSchema","fieldLines","pageImports","imports","pageScriptSnippet","labelMaps","pageSnippet","scriptSnippet","fieldSnippet","enctype","__template","serverSnippet","withFiles","toFile","generate","fieldDefs","pagePath","pageUrl","SLUG","VERSION","SOURCE","DOCS","baseRes","generateBase","writeResult","generateForm","NON_EMPTY_FIELDS","zodSchemaForField","generateSchemaSnippet","modelTypeImport","modelSatisfies","fieldsFromCollection","item","collectionById","resolvedFields","relatedCollection","relationExpandParam","uniqueRelationCollections","seen","models","toCollectionFieldSpec","collectionSpecFromModelFields","resolveInputFields","shouldCreateCollection","schemaPath","createCollections","migrationCreates","runtimeRes","generateResource","_d","uniqueImports","selectLabelMaps","relationLoadLines","pbInstance","relationLoadReturnVars","formScript","includeParams","newPageSnippet","hasSelectFields","fieldContent","editPageSnippet","listPageSnippet","selectFieldsLabelMaps","columnDefs","cellParams","cellProps","filterFields","listServerSnippet","pb","expand","getFullListArgs","newServerSnippet","authMode","relationLoads","relationVars","relationReturn","currentUserField","createPayload","showServerSnippet","getOneArgs","showPageSnippet","hasRelationFields","hasFileFields","displays","editServerSnippet","paths","uiFields","generateScaffold","includeModelFields","__vite_glob_0_0$1","__vite_glob_0_1$1","__vite_glob_0_2$1","__vite_glob_0_3$1","__vite_glob_0_4$1","__vite_glob_0_5","__vite_glob_0_6","__vite_glob_0_7","__vite_glob_0_8","__vite_glob_0_9","__vite_glob_0_10","__vite_glob_0_11","__vite_glob_0_12","__vite_glob_0_13","__vite_glob_0_14","__vite_glob_0_15","__vite_glob_0_16","__vite_glob_0_17","__vite_glob_0_18","__vite_glob_0_19","__vite_glob_0_20","__vite_glob_0_21","__vite_glob_0_22","__vite_glob_0_23","__vite_glob_0_24","__vite_glob_0_25","__vite_glob_0_26","__vite_glob_0_27","__vite_glob_0_28","__vite_glob_0_29","__vite_glob_0_30","__vite_glob_0_31","__vite_glob_0_32","__vite_glob_0_33","__vite_glob_0_34","__vite_glob_0_35","__vite_glob_0_36","__vite_glob_0_37","__vite_glob_0_38","__vite_glob_0_39","__vite_glob_0_40","__vite_glob_0_41","__vite_glob_0_42","__vite_glob_0_43","__vite_glob_0_44","__vite_glob_0_45","__vite_glob_0_46","__vite_glob_0_47","__vite_glob_0_48","__vite_glob_0_49","createsRaw","__vite_glob_0_0","__vite_glob_0_1","__vite_glob_0_2","__vite_glob_0_3","__vite_glob_0_4","CREATES_PREFIX","previewRaw","PREVIEW_PREFIX","_options","previewRes","generatePreview","generateRuntime","enableAuth","patterns","bySlug","pattern"],"mappings":";;AAIA,SAASA,GAAcC,GAAqB;AAC1C,SACEA,EAAK,aAAa,QAClBA,EAAK,aAAa,YAClBA,EAAK,KAAK,SAAS,OAAO;AAE9B;AAEA,eAAeC,GAAWD,GAA2B;AACnD,MAAI,CAACD,GAAcC,CAAI;AACrB,WAAOA;AAGT,MAAI;AACF,UAAME,IAAU,MAAMC,GAAS,OAAOH,EAAK,SAAS;AAAA,MAClD,UAAUA,EAAK;AAAA,MACf,SAAS,CAACI,EAAY;AAAA,IAAA,CACvB;AACD,WAAO;AAAA,MACL,GAAGJ;AAAA,MACH,SAAAE;AAAA,IAAA;AAAA,EAEJ,QAAQ;AACN,WAAOF;AAAA,EACT;AACF;AAEA,eAAeK,GAAYC,GAAgC;AACzD,SAAO,QAAQ,IAAIA,EAAM,IAAI,CAACN,MAASC,GAAWD,CAAI,CAAC,CAAC;AAC1D;AAEA,eAAsBO,EAAaC,GAAiC;AAClE,QAAM,CAACC,GAASC,CAAQ,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC5CL,GAAYG,EAAO,OAAO;AAAA,IAC1BH,GAAYG,EAAO,QAAQ;AAAA,EAAA,CAC5B;AAED,SAAO;AAAA,IACL,GAAGA;AAAA,IACH,SAAAC;AAAA,IACA,UAAAC;AAAA,EAAA;AAEJ;AC9CA,SAASC,GAAQC,GAAQC,GAAgB;AAAE,MAAIC,IAAO,OAAO,KAAKF,CAAM;AAAG,MAAI,OAAO,uBAAuB;AAAE,QAAIG,IAAU,OA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