import*as a from"path";import{logger as i}from"../../server/utils/index.js";import{DEFAULT_THEME_NAME as m,USER_THEME_ALIAS as T}from"../../server/config/constants.js";import{resolveTheme as A}from"./resolveTheme.js";import{EntitlementsProvider as F}from"../../server/entitlements/entitlements-provider.js";const y=["markdoc/attributes/code-walkthrough-filesets.ts","markdoc/attributes/code-walkthrough-filters.ts","markdoc/components/CodeWalkthrough/**","markdoc/tags/code-step.ts","markdoc/tags/code-toggle.ts","markdoc/tags/code-walkthrough.ts"],p=["./core/**","./markdoc/**/default.*","**/__mocks__/**","**/index.*","**/utils/**/*","**/__tests__/**/*","**/__snapshots__/**/*","**/*.stories.*","**/variables.*",...y],v=["./components/Catalog/CatalogCard.*","./components/ColorModeSwitcher/**","./components/Feedback/**","./components/Filter/**","./components/Footer/**","./components/LanguagePicker/**","./components/Menu/**","./components/Navbar/**","./components/PageNavigation/**","./components/Product/**","./components/Search/**","./components/UserMenu/**","./layouts/RootLayout.*","./layouts/NotFound.*","./icons/**","./markdoc/**","./ext/**"];async function j(t){const[l,r]=t._,{theme:d,force:g,onSuccess:u,onError:h,onOverride:E,config:_}=t,f=F.instance(),s=a.resolve(t["project-dir"]);let o=d;o||(o=m);const n=await A(s,_.plugins||[],o,r);n||i.panicOnContentError(`Theme ${o} not found. Skipping eject.`);const e=n?.config.ejectIgnore;e&&!Array.isArray(e)&&i.warn("'ejectIgnore' must be of type Array. Skipping.");const c=await f.getPackageEjectIgnore(),k={force:g,onSuccess:u,onError:h,onOverride:E,onlyFiles:o===m?v:void 0,ignoreFiles:Array.isArray(e)?[...e,...c,...p]:[...c,...p]};return{objectType:l,pathToThemeFolder:n?.pluginDirAbsolutePath,pathToPortalCustomThemeFolder:a.resolve(s,T),componentToEject:r,theme:o,options:k}}export{p as DEFAULT_IGNORED_FILES,v as EJECTABLE_FILES,j as default};
