import{i as a}from"./_virtual___federation_fn_import-DB-0B1B_.js";import{j as e}from"./jsx-runtime-u17CrQMm.js";import{a as h}from"./zod-DVFqTTZn.js";import{E as p}from"./config-reRjRYUH.js";const{createTemplateExtractorSchema:f}=await a("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:b,useDefinitionSchema:u,useProjectDefinition:j,useResettableForm:g}=await a("@baseplate-dev/project-builder-lib/web"),{Alert:E,AlertDescription:T,AlertTitle:S,CheckboxFieldController:v,FormActionBar:w,SectionList:A,SectionListSection:L,SectionListSectionContent:R,SectionListSectionHeader:N,SectionListSectionTitle:y,TextareaFieldController:C}=await a("@baseplate-dev/ui-components");function k(){const{definition:s,saveDefinitionWithFeedback:r}=j(),o=s.settings.templateExtractor??{writeMetadata:!1,fileIdRegexWhitelist:""},n=u(f),i=g({resolver:h(n),defaultValues:o}),{handleSubmit:c,control:t,reset:d}=i,l=c(m=>r(x=>{x.settings.templateExtractor=m}));return b({control:t,reset:d,onSubmit:l}),p?e.jsxs("form",{className:"relative h-full max-h-full pb-(--action-bar-height)",onSubmit:l,children:[e.jsxs("div",{className:"flex h-full max-h-full flex-1 flex-col overflow-y-auto px-6",children:[e.jsx("div",{className:"sticky top-0 border-b bg-background py-6",children:e.jsx("h1",{children:"Template Extractor"})}),e.jsx(A,{children:e.jsxs(L,{children:[e.jsx(N,{children:e.jsx(y,{children:"Settings"})}),e.jsxs(R,{className:"flex max-w-md flex-col gap-4",children:[e.jsx(v,{name:"writeMetadata",label:"Write Metadata",description:"Write metadata to the project to enable template extraction",control:t}),e.jsx(C,{name:"fileIdRegexWhitelist",label:"File ID Regex Whitelist",description:"A list of file IDs to include in the template extractor metadata for generators that have a manually assigned file IDs, e.g. files generated by generators that have multiple instances. The list is delimited by a newline and must be a valid regex.",control:t})]})]})})]}),e.jsx(w,{form:i})]}):e.jsxs(E,{variant:"error",className:"mx-auto my-16 max-w-2xl",children:[e.jsx(S,{children:"Template Extractor is disabled"}),e.jsxs(T,{children:["Template extractor is disabled in the environment. Please enable it with ",e.jsx("code",{children:"VITE_ENABLE_TEMPLATE_EXTRACTOR=true"})," to use it."]})]})}export{k as component};
//# sourceMappingURL=template-extractor-DmtACUDv.js.map
