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EAAE;YACvC,2BAAY,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAOO,mBAAmB,CAAC,IAAe;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,CAAC,KAAK,YAAY,kBAAU,CAAC,EAAE;YAChC,OAAO;SACV;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,+BAAc,EAAE,CAAC;QAChC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAQD,MAAM,CAAC,QAAQ,CAAC,KAA4B,EAAE,MAAsB;QAChE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;QACtC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAA4B,EAAE,EAAE;YAC9C,MAAM,IAAI,GAAG,+BAAc,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YACxD,YAAY,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAlFD,oCAkFC","sourcesContent":["import * as FS from 'fs';\nimport * as Path from 'path';\n\nimport { DefaultTheme } from './DefaultTheme';\nimport { Renderer } from '../renderer';\nimport { UrlMapping } from '../models/UrlMapping';\nimport { Reflection, DeclarationReflection, ProjectReflection } from '../../models/reflections/index';\nimport { PageEvent } from '../events';\nimport { NavigationItem } from '../models/NavigationItem';\n\nexport class MinimalTheme extends DefaultTheme {\n /**\n * Create a new DefaultTheme instance.\n *\n * @param renderer The renderer this theme is attached to.\n * @param basePath The base path of this theme.\n */\n constructor(renderer: Renderer, basePath: string) {\n super(renderer, basePath);\n\n renderer.removeComponent('assets');\n renderer.removeComponent('javascriptIndex');\n renderer.removeComponent('navigation');\n renderer.removeComponent('toc');\n\n this.listenTo(renderer, PageEvent.BEGIN, this.onRendererBeginPage);\n }\n\n /**\n * Test whether the given path contains a documentation generated by this theme.\n *\n * @param path The path of the directory that should be tested.\n * @returns TRUE if the given path seems to be a previous output directory,\n * otherwise FALSE.\n */\n isOutputDirectory(path: string): boolean {\n if (!FS.existsSync(Path.join(path, 'index.html'))) {\n return false;\n }\n return true;\n }\n\n /**\n * Map the models of the given project to the desired output files.\n *\n * @param project The project whose urls should be generated.\n * @returns A list of [[UrlMapping]] instances defining which models\n * should be rendered to which files.\n */\n getUrls(project: ProjectReflection): UrlMapping[] {\n const urls: UrlMapping[] = [];\n urls.push(new UrlMapping('index.html', project, 'index.hbs'));\n\n project.url = 'index.html';\n project.anchor = undefined;\n project.hasOwnDocument = true;\n\n (project.children || []).forEach((child) => {\n DefaultTheme.applyAnchorUrl(child, project);\n });\n\n return urls;\n }\n\n /**\n * Triggered before a document will be rendered.\n *\n * @param page An event object describing the current render operation.\n */\n private onRendererBeginPage(page: PageEvent) {\n const model = page.model;\n if (!(model instanceof Reflection)) {\n return;\n }\n\n page.toc = new NavigationItem();\n MinimalTheme.buildToc(page.model, page.toc);\n }\n\n /**\n * Create a toc navigation item structure.\n *\n * @param model The models whose children should be written to the toc.\n * @param parent The parent [[Models.NavigationItem]] the toc should be appended to.\n */\n static buildToc(model: DeclarationReflection, parent: NavigationItem) {\n const children = model.children || [];\n children.forEach((child: DeclarationReflection) => {\n const item = NavigationItem.create(child, parent, true);\n MinimalTheme.buildToc(child, item);\n });\n }\n}\n"]}
\No newline at end of file