{"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/zod/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n                       ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website:                  https://stormsoftware.com\n Repository:               https://github.com/storm-software/stryke\n Documentation:            https://docs.stormsoftware.com/projects/stryke\n Contact:                  https://stormsoftware.com/contact\n\n SPDX-License-Identifier:  Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayTree } from \"parenthesis\";\nimport parenthesis from \"parenthesis\";\nimport { chunk } from \"./model-helpers\";\n\nexport const getJSDocs = (docString?: string) => {\n  const lines: string[] = [];\n\n  if (docString) {\n    const docLines = docString\n      .split(\"\\n\")\n      .filter(dL => !dL.trimStart().startsWith(\"@zod\"));\n\n    if (docLines.length) {\n      lines.push(\"/**\");\n      docLines.forEach(dL => lines.push(` * ${dL}`));\n      lines.push(\" */\");\n    }\n  }\n\n  return lines;\n};\n\nexport const getZodDocElements = (docString: string) =>\n  docString\n    .split(\"\\n\")\n    .filter(line => line.trimStart().startsWith(\"@zod\"))\n    .map(line => line.trimStart().slice(4))\n    .flatMap(line =>\n      // Array.from(line.matchAll(/\\.([^().]+\\(.*?\\))/g), (m) => m.slice(1)).flat()\n      chunk(parenthesis.parse(line), 2)\n        .slice(0, -1)\n        .map(\n          ([each, contents]) =>\n            `${(each as string).replace(\n              /\\)?\\./,\n              \"\"\n            )}${parenthesis.stringify(contents as ArrayTree)})`\n        )\n    );\n"],"mappings":";;;;AAsBA,MAAa,aAAa,cAAuB;CAC/C,MAAM,QAAkB,EAAE;AAE1B,KAAI,WAAW;EACb,MAAM,WAAW,UACd,MAAM,KAAK,CACX,QAAO,OAAM,CAAC,GAAG,WAAW,CAAC,WAAW,OAAO,CAAC;AAEnD,MAAI,SAAS,QAAQ;AACnB,SAAM,KAAK,MAAM;AACjB,YAAS,SAAQ,OAAM,MAAM,KAAK,MAAM,KAAK,CAAC;AAC9C,SAAM,KAAK,MAAM;;;AAIrB,QAAO;;AAGT,MAAa,qBAAqB,cAChC,UACG,MAAM,KAAK,CACX,QAAO,SAAQ,KAAK,WAAW,CAAC,WAAW,OAAO,CAAC,CACnD,KAAI,SAAQ,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC,CACtC,SAAQ,SAEP,MAAM,YAAY,MAAM,KAAK,EAAE,EAAE,CAC9B,MAAM,GAAG,GAAG,CACZ,KACE,CAAC,MAAM,cACN,GAAI,KAAgB,QAClB,SACA,GACD,GAAG,YAAY,UAAU,SAAsB,CAAC,GACpD,CACJ"}