[{"data":1,"prerenderedAt":1286},["ShallowReactive",2],{"lit-docx-doc:\u002Fen":3,"lit-docx-source:recipes\u002Fread-text.ts":420,"lit-docx-source:recipes\u002Fcreate-report.ts":421,"mdc--wlncsa-key":422,"mdc--1ezb2t-key":1027},{"id":4,"title":5,"body":6,"description":407,"extension":408,"keywords":409,"locale":412,"meta":413,"navigation":414,"order":51,"path":415,"section":416,"seo":417,"stem":418,"__hash__":419},"docs\u002Findex.en.md","Quick start",{"type":7,"value":8,"toc":400},"minimark",[9,30,35,38,63,66,70,80,84,88,109,120,208,220,231,235,246,250,265,339,346,349,353,396],[10,11,12,16,17,20,21,25,26,29],"p",{},[13,14,15],"code",{},"@quirekit\u002Flit-docx"," does two things: ",[13,18,19],{},"parseDocx"," reads a DOCX file into ",[22,23,24],"strong",{},"LitAST",", a document tree made of plain JSON objects, and ",[13,27,28],{},"generateDocx"," writes LitAST back to DOCX. It does not depend on any editor and never touches the file system; it only works with bytes, so the same code runs in browsers and Node. It is a QuireKit commercial component distributed as a compiled build: development and evaluation are free, the free edition runs in production with an evaluation notice, and a license key removes the notice. Individuals, education, open-source projects and small teams can request a free community key.",[31,32,34],"h2",{"id":33},"installation","Installation",[10,36,37],{},"lit-docx is a preview and has not been published to npm yet. Once published, install it with:",[39,40,45],"pre",{"className":41,"code":42,"language":43,"meta":44,"style":44},"language-bash shiki shiki-themes github-light github-light github-dark","pnpm add @quirekit\u002Flit-docx\n","bash","",[13,46,47],{"__ignoreMap":44},[48,49,52,56,60],"span",{"class":50,"line":51},"line",1,[48,53,55],{"class":54},"sgQzM","pnpm",[48,57,59],{"class":58},"s-HEn"," add",[48,61,62],{"class":58}," @quirekit\u002Flit-docx\n",[10,64,65],{},"It requires Node 18 or later, or a modern browser. The package ships both ESM and CommonJS builds.",[31,67,69],{"id":68},"try-it-in-the-browser","Try it in the browser",[10,71,72,73,76,77,79],{},"The example below runs entirely in this page. It loads a sample report generated by lit-docx; switch to “Your file” to open your own ",[13,74,75],{},".docx",". Inspect the result as a rendered preview or as LitAST, then generate a new ",[13,78,75],{}," from the LitAST.",[81,82],"docs-demo",{"name":83},"demos\u002Fround-trip",[31,85,87],{"id":86},"read-a-docx","Read a DOCX",[10,89,90,92,93,96,97,100,101,104,105,108],{},[13,91,19],{}," takes the bytes of a complete file (",[13,94,95],{},"Uint8Array",") and returns the document tree ",[13,98,99],{},"ast"," together with non-fatal ",[13,102,103],{},"warnings",". A file that is not DOCX throws ",[13,106,107],{},"DocxPackageError",".",[10,110,111,112,115,116,119],{},"Start with two steps: obtain bytes, then parse them. Here ",[13,113,114],{},"file"," is a browser ",[13,117,118],{},"File"," selected by the user:",[39,121,126],{"className":122,"code":123,"filename":124,"language":125,"meta":44,"style":44},"language-ts shiki shiki-themes github-light github-light github-dark","import { parseDocx } from '@quirekit\u002Flit-docx'\nconst bytes = new Uint8Array(await file.arrayBuffer())\nconst { ast, warnings } = await parseDocx(bytes)\n","Read a browser file","ts",[13,127,128,144,178],{"__ignoreMap":44},[48,129,130,134,138,141],{"class":50,"line":51},[48,131,133],{"class":132},"sDD9d","import",[48,135,137],{"class":136},"sVPnS"," { parseDocx } ",[48,139,140],{"class":132},"from",[48,142,143],{"class":58}," '@quirekit\u002Flit-docx'\n",[48,145,147,150,154,157,160,163,166,169,172,175],{"class":50,"line":146},2,[48,148,149],{"class":132},"const",[48,151,153],{"class":152},"sUNQB"," bytes",[48,155,156],{"class":132}," =",[48,158,159],{"class":132}," new",[48,161,162],{"class":54}," Uint8Array",[48,164,165],{"class":136},"(",[48,167,168],{"class":132},"await",[48,170,171],{"class":136}," file.",[48,173,174],{"class":54},"arrayBuffer",[48,176,177],{"class":136},"())\n",[48,179,181,183,186,188,191,193,196,199,202,205],{"class":50,"line":180},3,[48,182,149],{"class":132},[48,184,185],{"class":136}," { ",[48,187,99],{"class":152},[48,189,190],{"class":136},", ",[48,192,103],{"class":152},[48,194,195],{"class":136}," } ",[48,197,198],{"class":132},"=",[48,200,201],{"class":132}," await",[48,203,204],{"class":54}," parseDocx",[48,206,207],{"class":136},"(bytes)\n",[10,209,210,212,213,215,216,219],{},[13,211,99],{}," is the tree to read or modify; ",[13,214,103],{}," describes parsing issues to explain to the user. In Node, obtain bytes with ",[13,217,218],{},"readFile()"," and use the same parser.",[10,221,222,223,226,227,230],{},"For text extraction, inspect ",[13,224,225],{},"recipes\u002Fread-text.ts"," for reading and parsing, and ",[13,228,229],{},"shared\u002Ftext.ts"," for tree traversal.",[232,233],"docs-recipe",{"name":234},"recipes\u002Fread-text",[10,236,237,238,241,242,245],{},"The ",[13,239,240],{},"collectParagraphText"," helper used above just walks the tree: the words of paragraphs and headings live in their ",[13,243,244],{},"text"," children.",[31,247,249],{"id":248},"generate-a-docx","Generate a DOCX",[10,251,252,253,256,257,260,261,264],{},"LitAST is plain objects. You can write it by hand or with the package's ",[13,254,255],{},"docx"," authoring helpers; both produce exactly the same structure. The report in the example above is built this way: a title, formatted text, a bullet list, a bordered table with a shaded header row, a link, and an A4 page with a header and footer. ",[13,258,259],{},"shared\u002Freport.ts"," builds that report; ",[13,262,263],{},"recipes\u002Fcreate-report.ts"," generates bytes and writes them. First, generate just one paragraph:",[39,266,269],{"className":122,"code":267,"filename":268,"language":125,"meta":44,"style":44},"import { generateDocx } from '@quirekit\u002Flit-docx'\nconst bytes = await generateDocx({\n  type: 'document',\n  children: [{ type: 'paragraph', children: [{ type: 'text', text: 'Hello' }] }],\n})\n","Generate one paragraph",[13,270,271,282,298,309,333],{"__ignoreMap":44},[48,272,273,275,278,280],{"class":50,"line":51},[48,274,133],{"class":132},[48,276,277],{"class":136}," { generateDocx } ",[48,279,140],{"class":132},[48,281,143],{"class":58},[48,283,284,286,288,290,292,295],{"class":50,"line":146},[48,285,149],{"class":132},[48,287,153],{"class":152},[48,289,156],{"class":132},[48,291,201],{"class":132},[48,293,294],{"class":54}," generateDocx",[48,296,297],{"class":136},"({\n",[48,299,300,303,306],{"class":50,"line":180},[48,301,302],{"class":136},"  type: ",[48,304,305],{"class":58},"'document'",[48,307,308],{"class":136},",\n",[48,310,312,315,318,321,324,327,330],{"class":50,"line":311},4,[48,313,314],{"class":136},"  children: [{ type: ",[48,316,317],{"class":58},"'paragraph'",[48,319,320],{"class":136},", children: [{ type: ",[48,322,323],{"class":58},"'text'",[48,325,326],{"class":136},", text: ",[48,328,329],{"class":58},"'Hello'",[48,331,332],{"class":136}," }] }],\n",[48,334,336],{"class":50,"line":335},5,[48,337,338],{"class":136},"})\n",[10,340,341,342,345],{},"Write ",[13,343,344],{},"bytes"," to a Node file or download them in a browser. Inspect the complete report by file below:",[232,347],{"name":348},"recipes\u002Fcreate-report",[31,350,352],{"id":351},"next-steps","Next steps",[354,355,356,365,375,382,389],"ul",{},[357,358,359,364],"li",{},[360,361,363],"a",{"href":362},"\u002Fen\u002Fguide\u002Freading","Reading DOCX",": input types, parse options, warnings and errors.",[357,366,367,371,372,374],{},[360,368,370],{"href":369},"\u002Fen\u002Fguide\u002Fgenerating","Generating DOCX",": hand-written nodes, the ",[13,373,255],{}," helpers, and unit conventions.",[357,376,377,381],{},[360,378,380],{"href":379},"\u002Fen\u002Fguide\u002Flitast","The LitAST node model",": which nodes and marks exist and what they look like.",[357,383,384,388],{},[360,385,387],{"href":386},"\u002Fen\u002Fguide\u002Fround-trip","Round trips and preservation",": what survives reading a file and writing it back, and what does not.",[357,390,391,395],{},[360,392,394],{"href":393},"\u002Fen\u002Fsupport","Support matrix",": how each Word feature is supported for reading and for generating.",[397,398,399],"style",{},"html pre.shiki code .sgQzM, html code.shiki .sgQzM{--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s-HEn, html code.shiki .s-HEn{--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sDD9d, html code.shiki .sDD9d{--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVPnS, html code.shiki .sVPnS{--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sUNQB, html code.shiki .sUNQB{--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF}",{"title":44,"searchDepth":146,"depth":146,"links":401},[402,403,404,405,406],{"id":33,"depth":146,"text":34},{"id":68,"depth":146,"text":69},{"id":86,"depth":146,"text":87},{"id":248,"depth":146,"text":249},{"id":351,"depth":146,"text":352},"Read DOCX into a traversable LitAST, then generate DOCX from LitAST, in browsers and Node alike.","md",[410,19,28,411],"install","introduction","en",{},true,"\u002Fen","Getting started",{"title":5,"description":407},"index.en","zBpAuDLp35IUZFq3JL5AzBWikbgvmD8odVEOH-yeWR0","import { readFile } from \"node:fs\u002Fpromises\";\nimport { DocxPackageError, parseDocx } from \"@quirekit\u002Flit-docx\";\nimport { collectParagraphText } from \"..\u002Fshared\u002Ftext\";\n\n\u002F**\n * Reads a DOCX file and prints its paragraphs and parser warnings.\n * @param path - DOCX file on disk.\n * @returns Resolves after printing.\n *\u002F\nexport async function printDocx(path: string): Promise\u003Cvoid> {\n  try {\n    const { ast, warnings } = await parseDocx(new Uint8Array(await readFile(path)));\n    for (const line of collectParagraphText(ast)) console.log(line);\n    for (const warning of warnings) console.warn(`[${warning.code}] ${warning.message}`);\n  } catch (error) {\n    \u002F\u002F Not a DOCX ZIP package at all, or an encrypted \u002F legacy .doc container.\n    if (error instanceof DocxPackageError) console.error(`Cannot open ${path}: ${error.code}`);\n    else throw error;\n  }\n}\n","import { writeFile } from \"node:fs\u002Fpromises\";\nimport { generateDocx } from \"@quirekit\u002Flit-docx\";\nimport { createReport } from \"..\u002Fshared\u002Freport\";\n\n\u002F**\n * Writes the report to disk.\n * @param path - Destination `.docx` path.\n * @returns Resolves once the file is written.\n *\u002F\nexport async function writeReport(path: string): Promise\u003Cvoid> {\n  await writeFile(path, await generateDocx(createReport()));\n}\n",{"data":423,"body":424},{},{"type":425,"children":426},"root",[427,1022],{"type":428,"tag":39,"props":429,"children":431},"element",{"className":122,"code":430,"language":125,"meta":44,"style":44},"import { readFile } from \"node:fs\u002Fpromises\";\nimport { DocxPackageError, parseDocx } from \"@quirekit\u002Flit-docx\";\nimport { collectParagraphText } from \"..\u002Fshared\u002Ftext\";\n\n\u002F**\n * Reads a DOCX file and prints its paragraphs and parser warnings.\n * @param path - DOCX file on disk.\n * @returns Resolves after printing.\n *\u002F\nexport async function printDocx(path: string): Promise\u003Cvoid> {\n  try {\n    const { ast, warnings } = await parseDocx(new Uint8Array(await readFile(path)));\n    for (const line of collectParagraphText(ast)) console.log(line);\n    for (const warning of warnings) console.warn(`[${warning.code}] ${warning.message}`);\n  } catch (error) {\n    \u002F\u002F Not a DOCX ZIP package at all, or an encrypted \u002F legacy .doc container.\n    if (error instanceof DocxPackageError) console.error(`Cannot open ${path}: ${error.code}`);\n    else throw error;\n  }\n}\n\n",[432],{"type":428,"tag":13,"props":433,"children":434},{"__ignoreMap":44},[435,464,489,514,522,531,540,564,582,591,666,680,752,800,885,904,913,985,1004,1013],{"type":428,"tag":48,"props":436,"children":437},{"class":50,"line":51},[438,443,449,453,459],{"type":428,"tag":48,"props":439,"children":441},{"style":440},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[442],{"type":244,"value":133},{"type":428,"tag":48,"props":444,"children":446},{"style":445},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[447],{"type":244,"value":448}," { readFile } ",{"type":428,"tag":48,"props":450,"children":451},{"style":440},[452],{"type":244,"value":140},{"type":428,"tag":48,"props":454,"children":456},{"style":455},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[457],{"type":244,"value":458}," \"node:fs\u002Fpromises\"",{"type":428,"tag":48,"props":460,"children":461},{"style":445},[462],{"type":244,"value":463},";\n",{"type":428,"tag":48,"props":465,"children":466},{"class":50,"line":146},[467,471,476,480,485],{"type":428,"tag":48,"props":468,"children":469},{"style":440},[470],{"type":244,"value":133},{"type":428,"tag":48,"props":472,"children":473},{"style":445},[474],{"type":244,"value":475}," { DocxPackageError, parseDocx } ",{"type":428,"tag":48,"props":477,"children":478},{"style":440},[479],{"type":244,"value":140},{"type":428,"tag":48,"props":481,"children":482},{"style":455},[483],{"type":244,"value":484}," \"@quirekit\u002Flit-docx\"",{"type":428,"tag":48,"props":486,"children":487},{"style":445},[488],{"type":244,"value":463},{"type":428,"tag":48,"props":490,"children":491},{"class":50,"line":180},[492,496,501,505,510],{"type":428,"tag":48,"props":493,"children":494},{"style":440},[495],{"type":244,"value":133},{"type":428,"tag":48,"props":497,"children":498},{"style":445},[499],{"type":244,"value":500}," { collectParagraphText } ",{"type":428,"tag":48,"props":502,"children":503},{"style":440},[504],{"type":244,"value":140},{"type":428,"tag":48,"props":506,"children":507},{"style":455},[508],{"type":244,"value":509}," \"..\u002Fshared\u002Ftext\"",{"type":428,"tag":48,"props":511,"children":512},{"style":445},[513],{"type":244,"value":463},{"type":428,"tag":48,"props":515,"children":516},{"class":50,"line":311},[517],{"type":428,"tag":48,"props":518,"children":519},{"emptyLinePlaceholder":414},[520],{"type":244,"value":521},"\n",{"type":428,"tag":48,"props":523,"children":524},{"class":50,"line":335},[525],{"type":428,"tag":48,"props":526,"children":528},{"style":527},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[529],{"type":244,"value":530},"\u002F**\n",{"type":428,"tag":48,"props":532,"children":534},{"class":50,"line":533},6,[535],{"type":428,"tag":48,"props":536,"children":537},{"style":527},[538],{"type":244,"value":539}," * Reads a DOCX file and prints its paragraphs and parser warnings.\n",{"type":428,"tag":48,"props":541,"children":543},{"class":50,"line":542},7,[544,549,554,559],{"type":428,"tag":48,"props":545,"children":546},{"style":527},[547],{"type":244,"value":548}," * ",{"type":428,"tag":48,"props":550,"children":551},{"style":440},[552],{"type":244,"value":553},"@param",{"type":428,"tag":48,"props":555,"children":556},{"style":445},[557],{"type":244,"value":558}," path",{"type":428,"tag":48,"props":560,"children":561},{"style":527},[562],{"type":244,"value":563}," - DOCX file on disk.\n",{"type":428,"tag":48,"props":565,"children":567},{"class":50,"line":566},8,[568,572,577],{"type":428,"tag":48,"props":569,"children":570},{"style":527},[571],{"type":244,"value":548},{"type":428,"tag":48,"props":573,"children":574},{"style":440},[575],{"type":244,"value":576},"@returns",{"type":428,"tag":48,"props":578,"children":579},{"style":527},[580],{"type":244,"value":581}," Resolves after printing.\n",{"type":428,"tag":48,"props":583,"children":585},{"class":50,"line":584},9,[586],{"type":428,"tag":48,"props":587,"children":588},{"style":527},[589],{"type":244,"value":590}," *\u002F\n",{"type":428,"tag":48,"props":592,"children":594},{"class":50,"line":593},10,[595,600,605,610,616,620,626,631,637,642,646,651,656,661],{"type":428,"tag":48,"props":596,"children":597},{"style":440},[598],{"type":244,"value":599},"export",{"type":428,"tag":48,"props":601,"children":602},{"style":440},[603],{"type":244,"value":604}," async",{"type":428,"tag":48,"props":606,"children":607},{"style":440},[608],{"type":244,"value":609}," function",{"type":428,"tag":48,"props":611,"children":613},{"style":612},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[614],{"type":244,"value":615}," printDocx",{"type":428,"tag":48,"props":617,"children":618},{"style":445},[619],{"type":244,"value":165},{"type":428,"tag":48,"props":621,"children":623},{"style":622},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[624],{"type":244,"value":625},"path",{"type":428,"tag":48,"props":627,"children":628},{"style":440},[629],{"type":244,"value":630},":",{"type":428,"tag":48,"props":632,"children":634},{"style":633},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[635],{"type":244,"value":636}," string",{"type":428,"tag":48,"props":638,"children":639},{"style":445},[640],{"type":244,"value":641},")",{"type":428,"tag":48,"props":643,"children":644},{"style":440},[645],{"type":244,"value":630},{"type":428,"tag":48,"props":647,"children":648},{"style":612},[649],{"type":244,"value":650}," Promise",{"type":428,"tag":48,"props":652,"children":653},{"style":445},[654],{"type":244,"value":655},"\u003C",{"type":428,"tag":48,"props":657,"children":658},{"style":633},[659],{"type":244,"value":660},"void",{"type":428,"tag":48,"props":662,"children":663},{"style":445},[664],{"type":244,"value":665},"> {\n",{"type":428,"tag":48,"props":667,"children":669},{"class":50,"line":668},11,[670,675],{"type":428,"tag":48,"props":671,"children":672},{"style":440},[673],{"type":244,"value":674},"  try",{"type":428,"tag":48,"props":676,"children":677},{"style":445},[678],{"type":244,"value":679}," {\n",{"type":428,"tag":48,"props":681,"children":683},{"class":50,"line":682},12,[684,689,693,697,701,705,709,713,717,721,725,730,734,738,742,747],{"type":428,"tag":48,"props":685,"children":686},{"style":440},[687],{"type":244,"value":688},"    const",{"type":428,"tag":48,"props":690,"children":691},{"style":445},[692],{"type":244,"value":185},{"type":428,"tag":48,"props":694,"children":695},{"style":633},[696],{"type":244,"value":99},{"type":428,"tag":48,"props":698,"children":699},{"style":445},[700],{"type":244,"value":190},{"type":428,"tag":48,"props":702,"children":703},{"style":633},[704],{"type":244,"value":103},{"type":428,"tag":48,"props":706,"children":707},{"style":445},[708],{"type":244,"value":195},{"type":428,"tag":48,"props":710,"children":711},{"style":440},[712],{"type":244,"value":198},{"type":428,"tag":48,"props":714,"children":715},{"style":440},[716],{"type":244,"value":201},{"type":428,"tag":48,"props":718,"children":719},{"style":612},[720],{"type":244,"value":204},{"type":428,"tag":48,"props":722,"children":723},{"style":445},[724],{"type":244,"value":165},{"type":428,"tag":48,"props":726,"children":727},{"style":440},[728],{"type":244,"value":729},"new",{"type":428,"tag":48,"props":731,"children":732},{"style":612},[733],{"type":244,"value":162},{"type":428,"tag":48,"props":735,"children":736},{"style":445},[737],{"type":244,"value":165},{"type":428,"tag":48,"props":739,"children":740},{"style":440},[741],{"type":244,"value":168},{"type":428,"tag":48,"props":743,"children":744},{"style":612},[745],{"type":244,"value":746}," readFile",{"type":428,"tag":48,"props":748,"children":749},{"style":445},[750],{"type":244,"value":751},"(path)));\n",{"type":428,"tag":48,"props":753,"children":755},{"class":50,"line":754},13,[756,761,766,770,775,780,785,790,795],{"type":428,"tag":48,"props":757,"children":758},{"style":440},[759],{"type":244,"value":760},"    for",{"type":428,"tag":48,"props":762,"children":763},{"style":445},[764],{"type":244,"value":765}," (",{"type":428,"tag":48,"props":767,"children":768},{"style":440},[769],{"type":244,"value":149},{"type":428,"tag":48,"props":771,"children":772},{"style":633},[773],{"type":244,"value":774}," line",{"type":428,"tag":48,"props":776,"children":777},{"style":440},[778],{"type":244,"value":779}," of",{"type":428,"tag":48,"props":781,"children":782},{"style":612},[783],{"type":244,"value":784}," collectParagraphText",{"type":428,"tag":48,"props":786,"children":787},{"style":445},[788],{"type":244,"value":789},"(ast)) console.",{"type":428,"tag":48,"props":791,"children":792},{"style":612},[793],{"type":244,"value":794},"log",{"type":428,"tag":48,"props":796,"children":797},{"style":445},[798],{"type":244,"value":799},"(line);\n",{"type":428,"tag":48,"props":801,"children":803},{"class":50,"line":802},14,[804,808,812,816,821,825,830,835,839,844,849,853,857,862,866,870,875,880],{"type":428,"tag":48,"props":805,"children":806},{"style":440},[807],{"type":244,"value":760},{"type":428,"tag":48,"props":809,"children":810},{"style":445},[811],{"type":244,"value":765},{"type":428,"tag":48,"props":813,"children":814},{"style":440},[815],{"type":244,"value":149},{"type":428,"tag":48,"props":817,"children":818},{"style":633},[819],{"type":244,"value":820}," warning",{"type":428,"tag":48,"props":822,"children":823},{"style":440},[824],{"type":244,"value":779},{"type":428,"tag":48,"props":826,"children":827},{"style":445},[828],{"type":244,"value":829}," warnings) console.",{"type":428,"tag":48,"props":831,"children":832},{"style":612},[833],{"type":244,"value":834},"warn",{"type":428,"tag":48,"props":836,"children":837},{"style":445},[838],{"type":244,"value":165},{"type":428,"tag":48,"props":840,"children":841},{"style":455},[842],{"type":244,"value":843},"`[${",{"type":428,"tag":48,"props":845,"children":846},{"style":445},[847],{"type":244,"value":848},"warning",{"type":428,"tag":48,"props":850,"children":851},{"style":455},[852],{"type":244,"value":108},{"type":428,"tag":48,"props":854,"children":855},{"style":445},[856],{"type":244,"value":13},{"type":428,"tag":48,"props":858,"children":859},{"style":455},[860],{"type":244,"value":861},"}] ${",{"type":428,"tag":48,"props":863,"children":864},{"style":445},[865],{"type":244,"value":848},{"type":428,"tag":48,"props":867,"children":868},{"style":455},[869],{"type":244,"value":108},{"type":428,"tag":48,"props":871,"children":872},{"style":445},[873],{"type":244,"value":874},"message",{"type":428,"tag":48,"props":876,"children":877},{"style":455},[878],{"type":244,"value":879},"}`",{"type":428,"tag":48,"props":881,"children":882},{"style":445},[883],{"type":244,"value":884},");\n",{"type":428,"tag":48,"props":886,"children":888},{"class":50,"line":887},15,[889,894,899],{"type":428,"tag":48,"props":890,"children":891},{"style":445},[892],{"type":244,"value":893},"  } ",{"type":428,"tag":48,"props":895,"children":896},{"style":440},[897],{"type":244,"value":898},"catch",{"type":428,"tag":48,"props":900,"children":901},{"style":445},[902],{"type":244,"value":903}," (error) {\n",{"type":428,"tag":48,"props":905,"children":907},{"class":50,"line":906},16,[908],{"type":428,"tag":48,"props":909,"children":910},{"style":527},[911],{"type":244,"value":912},"    \u002F\u002F Not a DOCX ZIP package at all, or an encrypted \u002F legacy .doc container.\n",{"type":428,"tag":48,"props":914,"children":916},{"class":50,"line":915},17,[917,922,927,932,937,942,947,951,956,960,965,969,973,977,981],{"type":428,"tag":48,"props":918,"children":919},{"style":440},[920],{"type":244,"value":921},"    if",{"type":428,"tag":48,"props":923,"children":924},{"style":445},[925],{"type":244,"value":926}," (error ",{"type":428,"tag":48,"props":928,"children":929},{"style":440},[930],{"type":244,"value":931},"instanceof",{"type":428,"tag":48,"props":933,"children":934},{"style":612},[935],{"type":244,"value":936}," DocxPackageError",{"type":428,"tag":48,"props":938,"children":939},{"style":445},[940],{"type":244,"value":941},") console.",{"type":428,"tag":48,"props":943,"children":944},{"style":612},[945],{"type":244,"value":946},"error",{"type":428,"tag":48,"props":948,"children":949},{"style":445},[950],{"type":244,"value":165},{"type":428,"tag":48,"props":952,"children":953},{"style":455},[954],{"type":244,"value":955},"`Cannot open ${",{"type":428,"tag":48,"props":957,"children":958},{"style":445},[959],{"type":244,"value":625},{"type":428,"tag":48,"props":961,"children":962},{"style":455},[963],{"type":244,"value":964},"}: ${",{"type":428,"tag":48,"props":966,"children":967},{"style":445},[968],{"type":244,"value":946},{"type":428,"tag":48,"props":970,"children":971},{"style":455},[972],{"type":244,"value":108},{"type":428,"tag":48,"props":974,"children":975},{"style":445},[976],{"type":244,"value":13},{"type":428,"tag":48,"props":978,"children":979},{"style":455},[980],{"type":244,"value":879},{"type":428,"tag":48,"props":982,"children":983},{"style":445},[984],{"type":244,"value":884},{"type":428,"tag":48,"props":986,"children":988},{"class":50,"line":987},18,[989,994,999],{"type":428,"tag":48,"props":990,"children":991},{"style":440},[992],{"type":244,"value":993},"    else",{"type":428,"tag":48,"props":995,"children":996},{"style":440},[997],{"type":244,"value":998}," throw",{"type":428,"tag":48,"props":1000,"children":1001},{"style":445},[1002],{"type":244,"value":1003}," error;\n",{"type":428,"tag":48,"props":1005,"children":1007},{"class":50,"line":1006},19,[1008],{"type":428,"tag":48,"props":1009,"children":1010},{"style":445},[1011],{"type":244,"value":1012},"  }\n",{"type":428,"tag":48,"props":1014,"children":1016},{"class":50,"line":1015},20,[1017],{"type":428,"tag":48,"props":1018,"children":1019},{"style":445},[1020],{"type":244,"value":1021},"}\n",{"type":428,"tag":397,"props":1023,"children":1024},{},[1025],{"type":244,"value":1026},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"data":1028,"body":1029},{},{"type":425,"children":1030},[1031,1282],{"type":428,"tag":39,"props":1032,"children":1034},{"className":122,"code":1033,"language":125,"meta":44,"style":44},"import { writeFile } from \"node:fs\u002Fpromises\";\nimport { generateDocx } from \"@quirekit\u002Flit-docx\";\nimport { createReport } from \"..\u002Fshared\u002Freport\";\n\n\u002F**\n * Writes the report to disk.\n * @param path - Destination `.docx` path.\n * @returns Resolves once the file is written.\n *\u002F\nexport async function writeReport(path: string): Promise\u003Cvoid> {\n  await writeFile(path, await generateDocx(createReport()));\n}\n\n",[1035],{"type":428,"tag":13,"props":1036,"children":1037},{"__ignoreMap":44},[1038,1062,1085,1110,1117,1124,1132,1152,1168,1175,1235,1275],{"type":428,"tag":48,"props":1039,"children":1040},{"class":50,"line":51},[1041,1045,1050,1054,1058],{"type":428,"tag":48,"props":1042,"children":1043},{"style":440},[1044],{"type":244,"value":133},{"type":428,"tag":48,"props":1046,"children":1047},{"style":445},[1048],{"type":244,"value":1049}," { writeFile } ",{"type":428,"tag":48,"props":1051,"children":1052},{"style":440},[1053],{"type":244,"value":140},{"type":428,"tag":48,"props":1055,"children":1056},{"style":455},[1057],{"type":244,"value":458},{"type":428,"tag":48,"props":1059,"children":1060},{"style":445},[1061],{"type":244,"value":463},{"type":428,"tag":48,"props":1063,"children":1064},{"class":50,"line":146},[1065,1069,1073,1077,1081],{"type":428,"tag":48,"props":1066,"children":1067},{"style":440},[1068],{"type":244,"value":133},{"type":428,"tag":48,"props":1070,"children":1071},{"style":445},[1072],{"type":244,"value":277},{"type":428,"tag":48,"props":1074,"children":1075},{"style":440},[1076],{"type":244,"value":140},{"type":428,"tag":48,"props":1078,"children":1079},{"style":455},[1080],{"type":244,"value":484},{"type":428,"tag":48,"props":1082,"children":1083},{"style":445},[1084],{"type":244,"value":463},{"type":428,"tag":48,"props":1086,"children":1087},{"class":50,"line":180},[1088,1092,1097,1101,1106],{"type":428,"tag":48,"props":1089,"children":1090},{"style":440},[1091],{"type":244,"value":133},{"type":428,"tag":48,"props":1093,"children":1094},{"style":445},[1095],{"type":244,"value":1096}," { createReport } ",{"type":428,"tag":48,"props":1098,"children":1099},{"style":440},[1100],{"type":244,"value":140},{"type":428,"tag":48,"props":1102,"children":1103},{"style":455},[1104],{"type":244,"value":1105}," \"..\u002Fshared\u002Freport\"",{"type":428,"tag":48,"props":1107,"children":1108},{"style":445},[1109],{"type":244,"value":463},{"type":428,"tag":48,"props":1111,"children":1112},{"class":50,"line":311},[1113],{"type":428,"tag":48,"props":1114,"children":1115},{"emptyLinePlaceholder":414},[1116],{"type":244,"value":521},{"type":428,"tag":48,"props":1118,"children":1119},{"class":50,"line":335},[1120],{"type":428,"tag":48,"props":1121,"children":1122},{"style":527},[1123],{"type":244,"value":530},{"type":428,"tag":48,"props":1125,"children":1126},{"class":50,"line":533},[1127],{"type":428,"tag":48,"props":1128,"children":1129},{"style":527},[1130],{"type":244,"value":1131}," * Writes the report to disk.\n",{"type":428,"tag":48,"props":1133,"children":1134},{"class":50,"line":542},[1135,1139,1143,1147],{"type":428,"tag":48,"props":1136,"children":1137},{"style":527},[1138],{"type":244,"value":548},{"type":428,"tag":48,"props":1140,"children":1141},{"style":440},[1142],{"type":244,"value":553},{"type":428,"tag":48,"props":1144,"children":1145},{"style":445},[1146],{"type":244,"value":558},{"type":428,"tag":48,"props":1148,"children":1149},{"style":527},[1150],{"type":244,"value":1151}," - Destination `.docx` path.\n",{"type":428,"tag":48,"props":1153,"children":1154},{"class":50,"line":566},[1155,1159,1163],{"type":428,"tag":48,"props":1156,"children":1157},{"style":527},[1158],{"type":244,"value":548},{"type":428,"tag":48,"props":1160,"children":1161},{"style":440},[1162],{"type":244,"value":576},{"type":428,"tag":48,"props":1164,"children":1165},{"style":527},[1166],{"type":244,"value":1167}," Resolves once the file is written.\n",{"type":428,"tag":48,"props":1169,"children":1170},{"class":50,"line":584},[1171],{"type":428,"tag":48,"props":1172,"children":1173},{"style":527},[1174],{"type":244,"value":590},{"type":428,"tag":48,"props":1176,"children":1177},{"class":50,"line":593},[1178,1182,1186,1190,1195,1199,1203,1207,1211,1215,1219,1223,1227,1231],{"type":428,"tag":48,"props":1179,"children":1180},{"style":440},[1181],{"type":244,"value":599},{"type":428,"tag":48,"props":1183,"children":1184},{"style":440},[1185],{"type":244,"value":604},{"type":428,"tag":48,"props":1187,"children":1188},{"style":440},[1189],{"type":244,"value":609},{"type":428,"tag":48,"props":1191,"children":1192},{"style":612},[1193],{"type":244,"value":1194}," writeReport",{"type":428,"tag":48,"props":1196,"children":1197},{"style":445},[1198],{"type":244,"value":165},{"type":428,"tag":48,"props":1200,"children":1201},{"style":622},[1202],{"type":244,"value":625},{"type":428,"tag":48,"props":1204,"children":1205},{"style":440},[1206],{"type":244,"value":630},{"type":428,"tag":48,"props":1208,"children":1209},{"style":633},[1210],{"type":244,"value":636},{"type":428,"tag":48,"props":1212,"children":1213},{"style":445},[1214],{"type":244,"value":641},{"type":428,"tag":48,"props":1216,"children":1217},{"style":440},[1218],{"type":244,"value":630},{"type":428,"tag":48,"props":1220,"children":1221},{"style":612},[1222],{"type":244,"value":650},{"type":428,"tag":48,"props":1224,"children":1225},{"style":445},[1226],{"type":244,"value":655},{"type":428,"tag":48,"props":1228,"children":1229},{"style":633},[1230],{"type":244,"value":660},{"type":428,"tag":48,"props":1232,"children":1233},{"style":445},[1234],{"type":244,"value":665},{"type":428,"tag":48,"props":1236,"children":1237},{"class":50,"line":668},[1238,1243,1248,1253,1257,1261,1265,1270],{"type":428,"tag":48,"props":1239,"children":1240},{"style":440},[1241],{"type":244,"value":1242},"  await",{"type":428,"tag":48,"props":1244,"children":1245},{"style":612},[1246],{"type":244,"value":1247}," writeFile",{"type":428,"tag":48,"props":1249,"children":1250},{"style":445},[1251],{"type":244,"value":1252},"(path, ",{"type":428,"tag":48,"props":1254,"children":1255},{"style":440},[1256],{"type":244,"value":168},{"type":428,"tag":48,"props":1258,"children":1259},{"style":612},[1260],{"type":244,"value":294},{"type":428,"tag":48,"props":1262,"children":1263},{"style":445},[1264],{"type":244,"value":165},{"type":428,"tag":48,"props":1266,"children":1267},{"style":612},[1268],{"type":244,"value":1269},"createReport",{"type":428,"tag":48,"props":1271,"children":1272},{"style":445},[1273],{"type":244,"value":1274},"()));\n",{"type":428,"tag":48,"props":1276,"children":1277},{"class":50,"line":682},[1278],{"type":428,"tag":48,"props":1279,"children":1280},{"style":445},[1281],{"type":244,"value":1021},{"type":428,"tag":397,"props":1283,"children":1284},{},[1285],{"type":244,"value":1026},1793045343568]