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,EAAU,CAAC,CAAC,EAAE,AAAA,IAAY,kBAAA,CAAmB,CAAC,EAC9C,AAAA,EAAK,AAAA,EAAU,KDN3B,SAAS,EAAO,CAAwC,EACpD,OAAO,AAAA,EACH,gEACA,CAAC,cAAc,EAAE,KAAK,SAAA,CAAU,GAAqB,CAAC,CAE9D,CKFA,IAAM,EAAU,CAAC,EAA4B,GAAG,KAC5C,IAAI,EACJ,OAAO,EAAQ,MAAf,EACI,KAAK,EACD,EAAkB,AAAA,EAAU,IAC5B,KAEJ,MAAK,EACD,EAAkB,CAAO,CAAC,EAAE,CAC5B,KAEJ,SAAS,CAEL,IAAM,EAAiB,EAAE,CACzB,EAAQ,OAAA,CAAQ,AAAC,IACb,EAAe,IAAA,CAAK,GACpB,EAAe,IAAA,CAAK,AAAA,IACxB,GACA,EAAe,GAAf,GACA,EAAkB,AAAA,KAAW,EAEjC,CACJ,CACA,OAAO,AAAA,EACH,AAAA,EAAY,EAAkB,GAC9B,AAAA,IAER,EC3BA,SAAS,EAAO,CAAqB,EACjC,OAAO,AAAA,EAAQ,AAAA,EAAU,UAAW,EACxC,Q,K,O,C,K,M,C,K,W,C,K,O,C,K,S,C,K,I,C,K,M,C,K,I,C,K,O,C,K,S,C,K,S","sources":["<anon>","src/index.ts","src/base-components/index.ts","src/base-components/divider.ts","src/base-components/statement.ts","src/base-components/none.ts","src/config/index.ts","src/base-components/format.ts","src/base-components/instruction.ts","src/utils/index.ts","src/utils/tabs.ts","src/utils/compose.ts","src/base-components/section.ts","src/base-components/system.ts"],"sourcesContent":["const $9beec52b6dc174a1$export$57ca7e07b341709d = ()=>()=>\"\";\n\n\nconst $6219ef8e7bae4469$export$c84356afd4299847 = (inputStr = (0, $9beec52b6dc174a1$export$57ca7e07b341709d)())=>(nextInputStr = (0, $9beec52b6dc174a1$export$57ca7e07b341709d)())=>{\n        let str1 = inputStr;\n        let str2 = nextInputStr;\n        while(typeof str1 === \"function\")str1 = str1();\n        while(typeof str2 === \"function\")str2 = str2();\n        return `${str1}${str2}`;\n    };\n\n\nconst $d3bb3b39be3ce48b$var$CONSTANT = {\n    CONFIG: {\n        dividerType: \" \",\n        dividerRepeat: 5,\n        dividerBefore: \"\\n\",\n        dividerAfter: \"\\n\",\n        tabType: \" \",\n        tabRepeat: 4,\n        instructionSpacing: \"\\n\"\n    }\n};\nfunction $d3bb3b39be3ce48b$export$44487a86467333c3() {\n    return $d3bb3b39be3ce48b$var$CONSTANT.CONFIG;\n}\nfunction $d3bb3b39be3ce48b$export$940a7873bb071df8(newConfig) {\n    $d3bb3b39be3ce48b$var$CONSTANT.CONFIG = {\n        ...$d3bb3b39be3ce48b$var$CONSTANT.CONFIG,\n        ...newConfig\n    };\n}\n\n\nconst $9d66301214a59b2b$export$2e0a83ec2e27ecbb = ()=>{\n    const config = (0, $d3bb3b39be3ce48b$export$44487a86467333c3)();\n    const separator = config.dividerType;\n    const repeatCount = config.dividerRepeat;\n    return (0, $6219ef8e7bae4469$export$c84356afd4299847)(`${config.dividerBefore}${separator.repeat(repeatCount)}${config.dividerAfter}`);\n};\n\n\n\n\n\n\nconst $8e9118bed76d4b08$export$b2539bed5023c21c = (prompt)=>(input = (0, $9beec52b6dc174a1$export$57ca7e07b341709d)())=>{\n        const config = (0, $d3bb3b39be3ce48b$export$44487a86467333c3)();\n        const TAB_TEXT = config.tabType.repeat(config.tabRepeat);\n        let text = (0, $6219ef8e7bae4469$export$c84356afd4299847)(prompt)(input);\n        text = TAB_TEXT + text;\n        text = text.replaceAll(\"\\n\", `\\n${TAB_TEXT}`);\n        return text;\n    };\n\n\n\nconst $7e35d71b6a16679b$export$f672e0b6f7222cd7 = (...strFns)=>{\n    return (input)=>{\n        const safeInput = (0, $6219ef8e7bae4469$export$c84356afd4299847)()(input);\n        return strFns.reduceRight((result, next)=>{\n            return (0, $6219ef8e7bae4469$export$c84356afd4299847)(next)(result);\n        }, safeInput);\n    };\n};\n\n\n\n\nconst $34e191ef4173254d$export$f361d4ae234b90f4 = (instructionTitle, instructionText)=>{\n    return (0, $7e35d71b6a16679b$export$f672e0b6f7222cd7)((0, $6219ef8e7bae4469$export$c84356afd4299847)(instructionTitle), (0, $6219ef8e7bae4469$export$c84356afd4299847)(`:${(0, $d3bb3b39be3ce48b$export$44487a86467333c3)().instructionSpacing}`), (0, $8e9118bed76d4b08$export$b2539bed5023c21c)((0, $6219ef8e7bae4469$export$c84356afd4299847)(instructionText)));\n};\n\n\nfunction $f4c1454779f0c3ba$export$93514d28bd18d75a(dataStructureSample) {\n    return (0, $34e191ef4173254d$export$f361d4ae234b90f4)(`Answer should be in a valid JSON, use the following structure`, `ResponseJSON: ${JSON.stringify(dataStructureSample)}`);\n}\n\n\n\n\n\n\n\nconst $a710ea5de3ff73a0$export$6e2c8f0811a474ce = (instructionTitle, ...content)=>{\n    let instructionText;\n    switch(content.length){\n        case 0:\n            instructionText = (0, $6219ef8e7bae4469$export$c84356afd4299847)(\"\");\n            break;\n        case 1:\n            instructionText = content[0];\n            break;\n        default:\n            {\n                // (content.length > 1)\n                const dividedContent = [];\n                content.forEach((cont)=>{\n                    dividedContent.push(cont);\n                    dividedContent.push((0, $9d66301214a59b2b$export$2e0a83ec2e27ecbb)());\n                });\n                dividedContent.pop();\n                instructionText = (0, $7e35d71b6a16679b$export$f672e0b6f7222cd7)(...dividedContent);\n                break;\n            }\n    }\n    return (0, $7e35d71b6a16679b$export$f672e0b6f7222cd7)((0, $34e191ef4173254d$export$f361d4ae234b90f4)(instructionTitle, instructionText), (0, $9d66301214a59b2b$export$2e0a83ec2e27ecbb)());\n};\n\n\n\n\n\nfunction $b3347eb5ea8e858a$export$e1dae5660003ffa7(instruction) {\n    return (0, $a710ea5de3ff73a0$export$6e2c8f0811a474ce)((0, $6219ef8e7bae4469$export$c84356afd4299847)(\"System\"), instruction); // Instruction(Statement(\"System\"), );\n}\n\n\n\n\n\n\n\n\n\nexport {$9d66301214a59b2b$export$2e0a83ec2e27ecbb as Divider, $f4c1454779f0c3ba$export$93514d28bd18d75a as Format, $34e191ef4173254d$export$f361d4ae234b90f4 as Instruction, $a710ea5de3ff73a0$export$6e2c8f0811a474ce as Section, $6219ef8e7bae4469$export$c84356afd4299847 as Statement, $9beec52b6dc174a1$export$57ca7e07b341709d as None, $b3347eb5ea8e858a$export$e1dae5660003ffa7 as System, $8e9118bed76d4b08$export$b2539bed5023c21c as Tabs, $7e35d71b6a16679b$export$f672e0b6f7222cd7 as compose, $d3bb3b39be3ce48b$export$44487a86467333c3 as getConfig, $d3bb3b39be3ce48b$export$940a7873bb071df8 as setConfig};\n//# sourceMappingURL=main.mjs.map\n","export type { PromptIO, StatementPrompt, ComposePrompt } from \"./base-components\";\nexport { Divider, Format, Instruction, Section, Statement, None, System} from \"./base-components\";\nexport { Tabs, compose } from \"./utils\";\nexport { getConfig, setConfig } from \"./config\";\n","export { Divider } from \"./divider\";\nexport { Format } from \"./format\";\nexport { Instruction } from \"./instruction\";\nexport { Section } from \"./section\";\nexport { Statement } from \"./statement\";\nexport { System } from \"./system\";\nexport { None } from \"./none\";\nexport type { PromptIO, StatementPrompt, ComposePrompt } from \"./components.interface\";\n","import { Statement } from \"./statement\";\nimport { getConfig } from \"../config\";\n\nconst Divider = () => {\n    const config = getConfig();\n    const separator = config.dividerType;\n    const repeatCount = config.dividerRepeat;\n    return Statement(`${config.dividerBefore}${separator.repeat(repeatCount)}${config.dividerAfter}`);\n};\n\nexport {  \n    Divider\n};","import { StatementPrompt, PromptIO } from \"./components.interface\";\nimport { None } from \"./none\";\n\nconst Statement = ((inputStr: PromptIO = None())=>(nextInputStr: PromptIO = None()): string => {\n\n    let str1 = inputStr;\n    let str2 = nextInputStr;\n\n    while(typeof str1 === \"function\") {\n        str1 = str1();\n    }\n\n    while(typeof str2 === \"function\") {\n        str2 = str2();\n    }\n    return `${str1}${str2}`;\n}) satisfies StatementPrompt;\n\nexport {\n    Statement\n};","import type { StatementPrompt } from \"./components.interface\";\n\nconst None = (()=>()=> \"\") satisfies StatementPrompt;\n\nexport {\n    None\n}","const CONSTANT = {\n    CONFIG: {\n        dividerType: \" \",\n        dividerRepeat: 5,\n        dividerBefore: \"\\n\",\n        dividerAfter: \"\\n\",\n        tabType:\" \",\n        tabRepeat: 4,\n        instructionSpacing:\"\\n\"\n    }\n    \n};\n\ntype CONFIG_TYPE = typeof CONSTANT.CONFIG;\n\nfunction getConfig() {\n    return CONSTANT.CONFIG;\n}\n\nfunction setConfig(newConfig: Partial<CONFIG_TYPE>) {\n    CONSTANT.CONFIG ={\n        ...CONSTANT.CONFIG,\n        ...newConfig\n    };\n}\n\nexport {\n    getConfig,\n    setConfig\n};","import { Instruction } from \"./instruction\";\nimport { Section } from \"./section\";\n\nfunction Format(dataStructureSample: Array<any> | Object) {\n    return Instruction(\n        `Answer should be in a valid JSON, use the following structure`,\n        `ResponseJSON: ${JSON.stringify(dataStructureSample)}`\n    );\n}\n\nexport {\n    Format\n};","import { Statement } from \"./statement\";\nimport { getConfig } from \"../config\";\nimport { PromptIO } from \"./components.interface\";\nimport { compose, Tabs } from \"../utils\";\n\nconst Instruction = (instructionTitle: PromptIO, instructionText: PromptIO)=> {\n    return compose(\n            Statement(instructionTitle),\n            Statement(`:${getConfig().instructionSpacing}`),\n            Tabs(Statement(instructionText))\n    );\n};\n\nexport {\n    Instruction\n};","export { Tabs }  from \"./tabs\";\nexport { compose } from \"./compose\";","import { PromptIO } from \"../base-components/components.interface\";\nimport { Statement, None } from \"../base-components\";\nimport { getConfig } from \"../config\"\n\nconst Tabs = (prompt: PromptIO)=>(input: PromptIO = None())=>{\n    const config = getConfig();\n    const TAB_TEXT = config.tabType.repeat(config.tabRepeat);\n    let text = Statement(prompt)(input);\n    text = TAB_TEXT + text;\n    text = text.replaceAll(\"\\n\", `\\n${TAB_TEXT}`);\n\n    return text;\n}\n\nexport {\n    Tabs\n};\n","import type { PromptIO } from \"../base-components/components.interface\";\nimport { Statement } from \"../base-components\";  \n\nconst compose = (...strFns: PromptIO[]) => {\n    return (input?: PromptIO) => {\n        const safeInput = Statement()(input);\n        return strFns.reduceRight<string>((result: PromptIO, next: PromptIO)=> {\n            return Statement(next)(result);\n        }, safeInput); \n    };\n};\n\nexport {\n    compose\n};\n","import { Divider } from \"./divider\";\nimport { compose } from \"../utils\";\nimport { Instruction } from \"./instruction\";\nimport { Statement } from \"./statement\";\nimport type { PromptIO } from \"./components.interface\";\n\nconst Section = (instructionTitle: PromptIO, ...content: PromptIO[]) => {\n    let instructionText: PromptIO;\n    switch(content.length) {\n        case 0: {\n            instructionText = Statement(\"\");\n            break;\n        }\n        case 1: {\n            instructionText = content[0];\n            break;\n        }\n        default: {\n            // (content.length > 1)\n            const dividedContent = [];\n            content.forEach((cont)=>{\n                dividedContent.push(cont);\n                dividedContent.push(Divider());\n            });\n            dividedContent.pop();\n            instructionText = compose(...dividedContent);\n            break;\n        }\n    }  \n    return compose(\n        Instruction(instructionTitle, instructionText),\n        Divider(),\n    )\n} ;\n\nexport {\n    Section\n};\n\n\n","import { compose } from \"../utils\"\nimport { Statement } from \"./statement\";\nimport { Instruction } from \"./instruction\";\nimport { Section } from \"./section\";\nimport { PromptIO } from \"./components.interface\";\n\nfunction System(instruction: PromptIO) {\n    return Section(Statement(\"System\"), instruction);// Instruction(Statement(\"System\"), );\n}\n\nexport {\n    System\n};\n"],"names":["$9beec52b6dc174a1$export$57ca7e07b341709d","$6219ef8e7bae4469$export$c84356afd4299847","inputStr","nextInputStr","str1","str2","$d3bb3b39be3ce48b$var$CONSTANT","CONFIG","dividerType","dividerRepeat","dividerBefore","dividerAfter","tabType","tabRepeat","instructionSpacing","$d3bb3b39be3ce48b$export$44487a86467333c3","$d3bb3b39be3ce48b$export$940a7873bb071df8","newConfig","$9d66301214a59b2b$export$2e0a83ec2e27ecbb","config","separator","repeatCount","repeat","$8e9118bed76d4b08$export$b2539bed5023c21c","prompt","input","TAB_TEXT","text","replaceAll","$7e35d71b6a16679b$export$f672e0b6f7222cd7","strFns","safeInput","reduceRight","result","next","$34e191ef4173254d$export$f361d4ae234b90f4","instructionTitle","instructionText","$f4c1454779f0c3ba$export$93514d28bd18d75a","dataStructureSample","JSON","stringify","$a710ea5de3ff73a0$export$6e2c8f0811a474ce","content","length","dividedContent","forEach","cont","push","pop","$b3347eb5ea8e858a$export$e1dae5660003ffa7","instruction","Divider","Format","Instruction","Section","Statement","None","System","Tabs","compose","getConfig","setConfig"],"version":3,"file":"main.mjs.map","sourceRoot":"../"}