{"version":3,"sources":["../../src/sections/list-section.ts"],"sourcesContent":["import { DocumentSection, DocumentSectionOptions } from './section.js';\nimport { heading } from '../elements/heading.js';\nimport { orderedList, unorderedList } from '../elements/list.js';\n\nexport type ListType = 'None' | 'Ordered' | 'Unordered';\n\nexport interface ListOptions<ListItem> extends DocumentSectionOptions {\n  type: ListType;\n  items?: Array<ListItem>;\n}\n\nexport abstract class ListSection<ListItem> extends DocumentSection {\n  protected items: Array<ListItem>;\n\n  constructor(private options: ListOptions<ListItem>) {\n    super(options);\n    this.items = options.items ?? [];\n  }\n\n  public add(item: ListItem) {\n    this.items.push(item);\n    return this;\n  }\n\n  protected abstract itemMapper(item: ListItem): string;\n\n  protected synthesizeContent(): Array<string> {\n    const items = this.items.map((item) => this.itemMapper(item));\n    let listItems: string;\n    switch (this.options.type) {\n      case 'Ordered':\n        listItems = orderedList(items);\n        break;\n      case 'Unordered':\n        listItems = unorderedList(items);\n        break;\n      case 'None':\n        listItems = items.join('\\n\\n');\n        break;\n    }\n\n    return [heading(this.headingLevel, this.title), '', listItems];\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwD;AACxD,qBAAwB;AACxB,kBAA2C;AASpC,MAAe,oBAA8B,+BAAgB;AAAA,EAGlE,YAAoB,SAAgC;AAClD,UAAM,OAAO;AADK;AAElB,SAAK,QAAQ,QAAQ,SAAS,CAAC;AAAA,EACjC;AAAA,EALU;AAAA,EAOH,IAAI,MAAgB;AACzB,SAAK,MAAM,KAAK,IAAI;AACpB,WAAO;AAAA,EACT;AAAA,EAIU,oBAAmC;AAC3C,UAAM,QAAQ,KAAK,MAAM,IAAI,CAAC,SAAS,KAAK,WAAW,IAAI,CAAC;AAC5D,QAAI;AACJ,YAAQ,KAAK,QAAQ,MAAM;AAAA,MACzB,KAAK;AACH,wBAAY,yBAAY,KAAK;AAC7B;AAAA,MACF,KAAK;AACH,wBAAY,2BAAc,KAAK;AAC/B;AAAA,MACF,KAAK;AACH,oBAAY,MAAM,KAAK,MAAM;AAC7B;AAAA,IACJ;AAEA,WAAO,KAAC,wBAAQ,KAAK,cAAc,KAAK,KAAK,GAAG,IAAI,SAAS;AAAA,EAC/D;AACF;","names":[]}