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,KAAK,UAAU,EAAa,KAAM,SAE7E,IAArB,EAAY,KACZ,MAAM,IAAI,EAAuB,uBAErC,MAAM,EAAW,IACX,EAAQ,CACV,MAAO,EACP,MAAO,CACH,YAAa,EAAgB,EAAY,MAAM,iBAC5C,EAAmB,IAE1B,OAAQ,CACJ,YAAa,EAAgB,EAAY,MAAM,qBAC5C,EAAmB,EAAY,QAG1C,OAAO,EAAW,CACd,KAAM,eACN,QAAS,mEACT,MAAO,CACH,QAAS,EAAY,KACrB,YACA,OAAQ,CACJ,QACA,YAEJ,QACA,mBACA,aACA,YAAa,EAAe,KAIxC,EAER,EAMA,OAAO,eAAe,EAAS,aAAc,CAAE,OAAO,GAEzD","file":"/npm/@promptbook/vercel@0.103.0-55/umd/index.umd.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@promptbook/vercel@0.103.0-55/umd/index.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function (global, factory) {\n    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('spacetrim'), require('crypto')) :\n    typeof define === 'function' && define.amd ? define(['exports', 'colors', 'spacetrim', 'crypto'], factory) :\n    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global[\"promptbook-vercel\"] = {}, global.colors, global.spaceTrim, global.crypto));\n})(this, (function (exports, colors, spaceTrim, crypto) { 'use strict';\n\n    function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\n    var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);\n    var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);\n\n    // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten\n    /**\n     * The version of the Book language\n     *\n     * @generated\n     * @see https://github.com/webgptorg/book\n     */\n    const BOOK_LANGUAGE_VERSION = '2.0.0';\n    /**\n     * The version of the Promptbook engine\n     *\n     * @generated\n     * @see https://github.com/webgptorg/promptbook\n     */\n    const PROMPTBOOK_ENGINE_VERSION = '0.103.0-55';\n    /**\n     * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine\n     * Note: [💞] Ignore a discrepancy between file name and entity name\n     */\n\n    /**\n     * Generates random token\n     *\n     * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic\n     * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)\n     *\n     * @private internal helper function\n     * @returns secure random token\n     */\n    function $randomToken(randomness) {\n        return crypto.randomBytes(randomness).toString('hex');\n    }\n    /**\n     * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package\n     * TODO: Maybe use nanoid instead https://github.com/ai/nanoid\n     */\n\n    /**\n     * This error indicates errors during the execution of the pipeline\n     *\n     * @public exported from `@promptbook/core`\n     */\n    class PipelineExecutionError extends Error {\n        constructor(message) {\n            // Added id parameter\n            super(message);\n            this.name = 'PipelineExecutionError';\n            // TODO: [🐙] DRY - Maybe $randomId\n            this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid similar char conflicts   */)}`;\n            Object.setPrototypeOf(this, PipelineExecutionError.prototype);\n        }\n    }\n    /**\n     * TODO: [🧠][🌂] Add id to all errors\n     */\n\n    /**\n     * Counts number of characters in the text\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function countCharacters(text) {\n        // Remove null characters\n        text = text.replace(/\\0/g, '');\n        // Replace emojis (and also ZWJ sequence) with hyphens\n        text = text.replace(/(\\p{Extended_Pictographic})\\p{Modifier_Symbol}/gu, '$1');\n        text = text.replace(/(\\p{Extended_Pictographic})[\\u{FE00}-\\u{FE0F}]/gu, '$1');\n        text = text.replace(/\\p{Extended_Pictographic}(\\u{200D}\\p{Extended_Pictographic})*/gu, '-');\n        return text.length;\n    }\n    /**\n     * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...\n     * TODO: [🧠][✌️] Make some Promptbook-native token system\n     */\n\n    /**\n     * Number of characters per standard line with 11pt Arial font size.\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    const CHARACTERS_PER_STANDARD_LINE = 63;\n    /**\n     * Number of lines per standard A4 page with 11pt Arial font size and standard margins and spacing.\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    const LINES_PER_STANDARD_PAGE = 44;\n    /**\n     * TODO: [🧠] Should be this `constants.ts` or `config.ts`?\n     * Note: [💞] Ignore a discrepancy between file name and entity name\n     */\n\n    /**\n     * Counts number of lines in the text\n     *\n     * Note: This does not check only for the presence of newlines, but also for the length of the standard line.\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function countLines(text) {\n        if (text === '') {\n            return 0;\n        }\n        text = text.replace('\\r\\n', '\\n');\n        text = text.replace('\\r', '\\n');\n        const lines = text.split('\\n');\n        return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);\n    }\n    /**\n     * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...\n     * TODO: [🧠][✌️] Make some Promptbook-native token system\n     */\n\n    /**\n     * Counts number of pages in the text\n     *\n     * Note: This does not check only for the count of newlines, but also for the length of the standard line and length of the standard page.\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function countPages(text) {\n        return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);\n    }\n    /**\n     * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...\n     * TODO: [🧠][✌️] Make some Promptbook-native token system\n     */\n\n    /**\n     * Counts number of paragraphs in the text\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function countParagraphs(text) {\n        return text.split(/\\n\\s*\\n/).filter((paragraph) => paragraph.trim() !== '').length;\n    }\n    /**\n     * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...\n     * TODO: [🧠][✌️] Make some Promptbook-native token system\n     */\n\n    /**\n     * Split text into sentences\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function splitIntoSentences(text) {\n        return text.split(/[.!?]+/).filter((sentence) => sentence.trim() !== '');\n    }\n    /**\n     * Counts number of sentences in the text\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function countSentences(text) {\n        return splitIntoSentences(text).length;\n    }\n    /**\n     * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...\n     * TODO: [🧠][✌️] Make some Promptbook-native token system\n     */\n\n    const defaultDiacriticsRemovalMap = [\n        {\n            base: 'A',\n            letters: '\\u0041\\u24B6\\uFF21\\u00C0\\u00C1\\u00C2\\u1EA6\\u1EA4\\u1EAA\\u1EA8\\u00C3\\u0100\\u0102\\u1EB0\\u1EAE\\u1EB4\\u1EB2\\u0226\\u01E0\\u00C4\\u01DE\\u1EA2\\u00C5\\u01FA\\u01CD\\u0200\\u0202\\u1EA0\\u1EAC\\u1EB6\\u1E00\\u0104\\u023A\\u2C6F',\n        },\n        { base: 'AA', letters: '\\uA732' },\n        { base: 'AE', letters: '\\u00C6\\u01FC\\u01E2' },\n        { base: 'AO', letters: '\\uA734' },\n        { base: 'AU', letters: '\\uA736' },\n        { base: 'AV', letters: '\\uA738\\uA73A' },\n        { base: 'AY', letters: '\\uA73C' },\n        {\n            base: 'B',\n            letters: '\\u0042\\u24B7\\uFF22\\u1E02\\u1E04\\u1E06\\u0243\\u0182\\u0181',\n        },\n        {\n            base: 'C',\n            letters: '\\u0043\\u24B8\\uFF23\\u0106\\u0108\\u010A\\u010C\\u00C7\\u1E08\\u0187\\u023B\\uA73E',\n        },\n        {\n            base: 'D',\n            letters: '\\u0044\\u24B9\\uFF24\\u1E0A\\u010E\\u1E0C\\u1E10\\u1E12\\u1E0E\\u0110\\u018B\\u018A\\u0189\\uA779\\u00D0',\n        },\n        { base: 'DZ', letters: '\\u01F1\\u01C4' },\n        { base: 'Dz', letters: '\\u01F2\\u01C5' },\n        {\n            base: 'E',\n            letters: '\\u0045\\u24BA\\uFF25\\u00C8\\u00C9\\u00CA\\u1EC0\\u1EBE\\u1EC4\\u1EC2\\u1EBC\\u0112\\u1E14\\u1E16\\u0114\\u0116\\u00CB\\u1EBA\\u011A\\u0204\\u0206\\u1EB8\\u1EC6\\u0228\\u1E1C\\u0118\\u1E18\\u1E1A\\u0190\\u018E',\n        },\n        { base: 'F', letters: '\\u0046\\u24BB\\uFF26\\u1E1E\\u0191\\uA77B' },\n        {\n            base: 'G',\n            letters: '\\u0047\\u24BC\\uFF27\\u01F4\\u011C\\u1E20\\u011E\\u0120\\u01E6\\u0122\\u01E4\\u0193\\uA7A0\\uA77D\\uA77E',\n        },\n        {\n            base: 'H',\n            letters: '\\u0048\\u24BD\\uFF28\\u0124\\u1E22\\u1E26\\u021E\\u1E24\\u1E28\\u1E2A\\u0126\\u2C67\\u2C75\\uA78D',\n        },\n        {\n            base: 'I',\n            letters: '\\u0049\\u24BE\\uFF29\\u00CC\\u00CD\\u00CE\\u0128\\u012A\\u012C\\u0130\\u00CF\\u1E2E\\u1EC8\\u01CF\\u0208\\u020A\\u1ECA\\u012E\\u1E2C\\u0197',\n        },\n        { base: 'J', letters: '\\u004A\\u24BF\\uFF2A\\u0134\\u0248' },\n        {\n            base: 'K',\n            letters: '\\u004B\\u24C0\\uFF2B\\u1E30\\u01E8\\u1E32\\u0136\\u1E34\\u0198\\u2C69\\uA740\\uA742\\uA744\\uA7A2',\n        },\n        {\n            base: 'L',\n            letters: '\\u004C\\u24C1\\uFF2C\\u013F\\u0139\\u013D\\u1E36\\u1E38\\u013B\\u1E3C\\u1E3A\\u0141\\u023D\\u2C62\\u2C60\\uA748\\uA746\\uA780',\n        },\n        { base: 'LJ', letters: '\\u01C7' },\n        { base: 'Lj', letters: '\\u01C8' },\n        { base: 'M', letters: '\\u004D\\u24C2\\uFF2D\\u1E3E\\u1E40\\u1E42\\u2C6E\\u019C' },\n        {\n            base: 'N',\n            letters: '\\u004E\\u24C3\\uFF2E\\u01F8\\u0143\\u00D1\\u1E44\\u0147\\u1E46\\u0145\\u1E4A\\u1E48\\u0220\\u019D\\uA790\\uA7A4',\n        },\n        { base: 'NJ', letters: '\\u01CA' },\n        { base: 'Nj', letters: '\\u01CB' },\n        {\n            base: 'O',\n            letters: '\\u004F\\u24C4\\uFF2F\\u00D2\\u00D3\\u00D4\\u1ED2\\u1ED0\\u1ED6\\u1ED4\\u00D5\\u1E4C\\u022C\\u1E4E\\u014C\\u1E50\\u1E52\\u014E\\u022E\\u0230\\u00D6\\u022A\\u1ECE\\u0150\\u01D1\\u020C\\u020E\\u01A0\\u1EDC\\u1EDA\\u1EE0\\u1EDE\\u1EE2\\u1ECC\\u1ED8\\u01EA\\u01EC\\u00D8\\u01FE\\u0186\\u019F\\uA74A\\uA74C',\n        },\n        { base: 'OI', letters: '\\u01A2' },\n        { base: 'OO', letters: '\\uA74E' },\n        { base: 'OU', letters: '\\u0222' },\n        { base: 'OE', letters: '\\u008C\\u0152' },\n        { base: 'oe', letters: '\\u009C\\u0153' },\n        {\n            base: 'P',\n            letters: '\\u0050\\u24C5\\uFF30\\u1E54\\u1E56\\u01A4\\u2C63\\uA750\\uA752\\uA754',\n        },\n        { base: 'Q', letters: '\\u0051\\u24C6\\uFF31\\uA756\\uA758\\u024A' },\n        {\n            base: 'R',\n            letters: '\\u0052\\u24C7\\uFF32\\u0154\\u1E58\\u0158\\u0210\\u0212\\u1E5A\\u1E5C\\u0156\\u1E5E\\u024C\\u2C64\\uA75A\\uA7A6\\uA782',\n        },\n        {\n            base: 'S',\n            letters: '\\u0053\\u24C8\\uFF33\\u1E9E\\u015A\\u1E64\\u015C\\u1E60\\u0160\\u1E66\\u1E62\\u1E68\\u0218\\u015E\\u2C7E\\uA7A8\\uA784',\n        },\n        {\n            base: 'T',\n            letters: '\\u0054\\u24C9\\uFF34\\u1E6A\\u0164\\u1E6C\\u021A\\u0162\\u1E70\\u1E6E\\u0166\\u01AC\\u01AE\\u023E\\uA786',\n        },\n        { base: 'TZ', letters: '\\uA728' },\n        {\n            base: 'U',\n            letters: '\\u0055\\u24CA\\uFF35\\u00D9\\u00DA\\u00DB\\u0168\\u1E78\\u016A\\u1E7A\\u016C\\u00DC\\u01DB\\u01D7\\u01D5\\u01D9\\u1EE6\\u016E\\u0170\\u01D3\\u0214\\u0216\\u01AF\\u1EEA\\u1EE8\\u1EEE\\u1EEC\\u1EF0\\u1EE4\\u1E72\\u0172\\u1E76\\u1E74\\u0244',\n        },\n        { base: 'V', letters: '\\u0056\\u24CB\\uFF36\\u1E7C\\u1E7E\\u01B2\\uA75E\\u0245' },\n        { base: 'VY', letters: '\\uA760' },\n        {\n            base: 'W',\n            letters: '\\u0057\\u24CC\\uFF37\\u1E80\\u1E82\\u0174\\u1E86\\u1E84\\u1E88\\u2C72',\n        },\n        { base: 'X', letters: '\\u0058\\u24CD\\uFF38\\u1E8A\\u1E8C' },\n        {\n            base: 'Y',\n            letters: '\\u0059\\u24CE\\uFF39\\u1EF2\\u00DD\\u0176\\u1EF8\\u0232\\u1E8E\\u0178\\u1EF6\\u1EF4\\u01B3\\u024E\\u1EFE',\n        },\n        {\n            base: 'Z',\n            letters: '\\u005A\\u24CF\\uFF3A\\u0179\\u1E90\\u017B\\u017D\\u1E92\\u1E94\\u01B5\\u0224\\u2C7F\\u2C6B\\uA762',\n        },\n        {\n            base: 'a',\n            letters: '\\u0061\\u24D0\\uFF41\\u1E9A\\u00E0\\u00E1\\u00E2\\u1EA7\\u1EA5\\u1EAB\\u1EA9\\u00E3\\u0101\\u0103\\u1EB1\\u1EAF\\u1EB5\\u1EB3\\u0227\\u01E1\\u00E4\\u01DF\\u1EA3\\u00E5\\u01FB\\u01CE\\u0201\\u0203\\u1EA1\\u1EAD\\u1EB7\\u1E01\\u0105\\u2C65\\u0250',\n        },\n        { base: 'aa', letters: '\\uA733' },\n        { base: 'ae', letters: '\\u00E6\\u01FD\\u01E3' },\n        { base: 'ao', letters: '\\uA735' },\n        { base: 'au', letters: '\\uA737' },\n        { base: 'av', letters: '\\uA739\\uA73B' },\n        { base: 'ay', letters: '\\uA73D' },\n        {\n            base: 'b',\n            letters: '\\u0062\\u24D1\\uFF42\\u1E03\\u1E05\\u1E07\\u0180\\u0183\\u0253',\n        },\n        {\n            base: 'c',\n            letters: '\\u0063\\u24D2\\uFF43\\u0107\\u0109\\u010B\\u010D\\u00E7\\u1E09\\u0188\\u023C\\uA73F\\u2184',\n        },\n        {\n            base: 'd',\n            letters: '\\u0064\\u24D3\\uFF44\\u1E0B\\u010F\\u1E0D\\u1E11\\u1E13\\u1E0F\\u0111\\u018C\\u0256\\u0257\\uA77A',\n        },\n        { base: 'dz', letters: '\\u01F3\\u01C6' },\n        {\n            base: 'e',\n            letters: '\\u0065\\u24D4\\uFF45\\u00E8\\u00E9\\u00EA\\u1EC1\\u1EBF\\u1EC5\\u1EC3\\u1EBD\\u0113\\u1E15\\u1E17\\u0115\\u0117\\u00EB\\u1EBB\\u011B\\u0205\\u0207\\u1EB9\\u1EC7\\u0229\\u1E1D\\u0119\\u1E19\\u1E1B\\u0247\\u025B\\u01DD',\n        },\n        { base: 'f', letters: '\\u0066\\u24D5\\uFF46\\u1E1F\\u0192\\uA77C' },\n        {\n            base: 'g',\n            letters: '\\u0067\\u24D6\\uFF47\\u01F5\\u011D\\u1E21\\u011F\\u0121\\u01E7\\u0123\\u01E5\\u0260\\uA7A1\\u1D79\\uA77F',\n        },\n        {\n            base: 'h',\n            letters: '\\u0068\\u24D7\\uFF48\\u0125\\u1E23\\u1E27\\u021F\\u1E25\\u1E29\\u1E2B\\u1E96\\u0127\\u2C68\\u2C76\\u0265',\n        },\n        { base: 'hv', letters: '\\u0195' },\n        {\n            base: 'i',\n            letters: '\\u0069\\u24D8\\uFF49\\u00EC\\u00ED\\u00EE\\u0129\\u012B\\u012D\\u00EF\\u1E2F\\u1EC9\\u01D0\\u0209\\u020B\\u1ECB\\u012F\\u1E2D\\u0268\\u0131',\n        },\n        { base: 'j', letters: '\\u006A\\u24D9\\uFF4A\\u0135\\u01F0\\u0249' },\n        {\n            base: 'k',\n            letters: '\\u006B\\u24DA\\uFF4B\\u1E31\\u01E9\\u1E33\\u0137\\u1E35\\u0199\\u2C6A\\uA741\\uA743\\uA745\\uA7A3',\n        },\n        {\n            base: 'l',\n            letters: '\\u006C\\u24DB\\uFF4C\\u0140\\u013A\\u013E\\u1E37\\u1E39\\u013C\\u1E3D\\u1E3B\\u017F\\u0142\\u019A\\u026B\\u2C61\\uA749\\uA781\\uA747',\n        },\n        { base: 'lj', letters: '\\u01C9' },\n        { base: 'm', letters: '\\u006D\\u24DC\\uFF4D\\u1E3F\\u1E41\\u1E43\\u0271\\u026F' },\n        {\n            base: 'n',\n            letters: '\\u006E\\u24DD\\uFF4E\\u01F9\\u0144\\u00F1\\u1E45\\u0148\\u1E47\\u0146\\u1E4B\\u1E49\\u019E\\u0272\\u0149\\uA791\\uA7A5',\n        },\n        { base: 'nj', letters: '\\u01CC' },\n        {\n            base: 'o',\n            letters: '\\u006F\\u24DE\\uFF4F\\u00F2\\u00F3\\u00F4\\u1ED3\\u1ED1\\u1ED7\\u1ED5\\u00F5\\u1E4D\\u022D\\u1E4F\\u014D\\u1E51\\u1E53\\u014F\\u022F\\u0231\\u00F6\\u022B\\u1ECF\\u0151\\u01D2\\u020D\\u020F\\u01A1\\u1EDD\\u1EDB\\u1EE1\\u1EDF\\u1EE3\\u1ECD\\u1ED9\\u01EB\\u01ED\\u00F8\\u01FF\\u0254\\uA74B\\uA74D\\u0275',\n        },\n        { base: 'oi', letters: '\\u01A3' },\n        { base: 'ou', letters: '\\u0223' },\n        { base: 'oo', letters: '\\uA74F' },\n        {\n            base: 'p',\n            letters: '\\u0070\\u24DF\\uFF50\\u1E55\\u1E57\\u01A5\\u1D7D\\uA751\\uA753\\uA755',\n        },\n        { base: 'q', letters: '\\u0071\\u24E0\\uFF51\\u024B\\uA757\\uA759' },\n        {\n            base: 'r',\n            letters: '\\u0072\\u24E1\\uFF52\\u0155\\u1E59\\u0159\\u0211\\u0213\\u1E5B\\u1E5D\\u0157\\u1E5F\\u024D\\u027D\\uA75B\\uA7A7\\uA783',\n        },\n        {\n            base: 's',\n            letters: '\\u0073\\u24E2\\uFF53\\u00DF\\u015B\\u1E65\\u015D\\u1E61\\u0161\\u1E67\\u1E63\\u1E69\\u0219\\u015F\\u023F\\uA7A9\\uA785\\u1E9B',\n        },\n        {\n            base: 't',\n            letters: '\\u0074\\u24E3\\uFF54\\u1E6B\\u1E97\\u0165\\u1E6D\\u021B\\u0163\\u1E71\\u1E6F\\u0167\\u01AD\\u0288\\u2C66\\uA787',\n        },\n        { base: 'tz', letters: '\\uA729' },\n        {\n            base: 'u',\n            letters: '\\u0075\\u24E4\\uFF55\\u00F9\\u00FA\\u00FB\\u0169\\u1E79\\u016B\\u1E7B\\u016D\\u00FC\\u01DC\\u01D8\\u01D6\\u01DA\\u1EE7\\u016F\\u0171\\u01D4\\u0215\\u0217\\u01B0\\u1EEB\\u1EE9\\u1EEF\\u1EED\\u1EF1\\u1EE5\\u1E73\\u0173\\u1E77\\u1E75\\u0289',\n        },\n        { base: 'v', letters: '\\u0076\\u24E5\\uFF56\\u1E7D\\u1E7F\\u028B\\uA75F\\u028C' },\n        { base: 'vy', letters: '\\uA761' },\n        {\n            base: 'w',\n            letters: '\\u0077\\u24E6\\uFF57\\u1E81\\u1E83\\u0175\\u1E87\\u1E85\\u1E98\\u1E89\\u2C73',\n        },\n        { base: 'x', letters: '\\u0078\\u24E7\\uFF58\\u1E8B\\u1E8D' },\n        {\n            base: 'y',\n            letters: '\\u0079\\u24E8\\uFF59\\u1EF3\\u00FD\\u0177\\u1EF9\\u0233\\u1E8F\\u00FF\\u1EF7\\u1E99\\u1EF5\\u01B4\\u024F\\u1EFF',\n        },\n        {\n            base: 'z',\n            letters: '\\u007A\\u24E9\\uFF5A\\u017A\\u1E91\\u017C\\u017E\\u1E93\\u1E95\\u01B6\\u0225\\u0240\\u2C6C\\uA763',\n        },\n    ];\n    /**\n     * Map of letters from diacritic variant to diacritless variant\n     * Contains lowercase and uppercase separatelly\n     *\n     * > \"á\" => \"a\"\n     * > \"ě\" => \"e\"\n     * > \"Ă\" => \"A\"\n     * > ...\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    const DIACRITIC_VARIANTS_LETTERS = {};\n    // tslint:disable-next-line: prefer-for-of\n    for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {\n        const letters = defaultDiacriticsRemovalMap[i].letters;\n        // tslint:disable-next-line: prefer-for-of\n        for (let j = 0; j < letters.length; j++) {\n            DIACRITIC_VARIANTS_LETTERS[letters[j]] = defaultDiacriticsRemovalMap[i].base;\n        }\n    }\n    // <- TODO: [🍓] Put to maker function to save execution time if not needed\n    /*\n      @see https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript\n       Licensed under the Apache License, Version 2.0 (the \"License\");\n       you may not use this file except in compliance with the License.\n       You may obtain a copy of the License at\n\n           http://www.apache.org/licenses/LICENSE-2.0\n\n       Unless required by applicable law or agreed to in writing, software\n       distributed under the License is distributed on an \"AS IS\" BASIS,\n       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n       See the License for the specific language governing permissions and\n       limitations under the License.\n    */\n\n    /**\n     * Removes diacritic marks (accents) from characters in a string.\n     *\n     * Note: [🔂] This function is idempotent.\n     *\n     * @param input The string containing diacritics to be normalized.\n     * @returns The string with diacritics removed or normalized.\n     * @public exported from `@promptbook/utils`\n     */\n    function removeDiacritics(input) {\n        /*eslint no-control-regex: \"off\"*/\n        return input.replace(/[^\\u0000-\\u007E]/g, (a) => {\n            return DIACRITIC_VARIANTS_LETTERS[a] || a;\n        });\n    }\n    /**\n     * TODO: [Ж] Variant for cyrillic (and in general non-latin) letters\n     */\n\n    /**\n     * Counts number of words in the text\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function countWords(text) {\n        text = text.replace(/[\\p{Extended_Pictographic}]/gu, 'a');\n        text = removeDiacritics(text);\n        // Add spaces before uppercase letters preceded by lowercase letters (for camelCase)\n        text = text.replace(/([a-z])([A-Z])/g, '$1 $2');\n        return text.split(/[^a-zа-я0-9]+/i).filter((word) => word.length > 0).length;\n    }\n    /**\n     * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...\n     * TODO: [🧠][✌️] Make some Promptbook-native token system\n     * TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well\n     */\n\n    /**\n     * Helper of usage compute\n     *\n     * @param content the content of prompt or response\n     * @returns part of UsageCounts\n     *\n     * @private internal utility of LlmExecutionTools\n     */\n    function computeUsageCounts(content) {\n        return {\n            charactersCount: { value: countCharacters(content) },\n            wordsCount: { value: countWords(content) },\n            sentencesCount: { value: countSentences(content) },\n            linesCount: { value: countLines(content) },\n            paragraphsCount: { value: countParagraphs(content) },\n            pagesCount: { value: countPages(content) },\n        };\n    }\n\n    /**\n     * Freezes the given object and all its nested objects recursively\n     *\n     * Note: `$` is used to indicate that this function is not a pure function - it mutates given object\n     * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object\n     *\n     * @returns The same object as the input, but deeply frozen\n     * @public exported from `@promptbook/utils`\n     */\n    function $deepFreeze(objectValue) {\n        if (Array.isArray(objectValue)) {\n            return Object.freeze(objectValue.map((item) => $deepFreeze(item)));\n        }\n        const propertyNames = Object.getOwnPropertyNames(objectValue);\n        for (const propertyName of propertyNames) {\n            const value = objectValue[propertyName];\n            if (value && typeof value === 'object') {\n                $deepFreeze(value);\n            }\n        }\n        Object.freeze(objectValue);\n        return objectValue;\n    }\n    /**\n     * TODO: [🧠] Is there a way how to meaningfully test this utility\n     */\n\n    /**\n     * Represents the uncertain value\n     *\n     * @public exported from `@promptbook/core`\n     */\n    const ZERO_VALUE = $deepFreeze({ value: 0 });\n    /**\n     * Represents the uncertain value\n     *\n     * @public exported from `@promptbook/core`\n     */\n    const UNCERTAIN_ZERO_VALUE = $deepFreeze({ value: 0, isUncertain: true });\n    /**\n     * Represents the usage with no resources consumed\n     *\n     * @public exported from `@promptbook/core`\n     */\n    $deepFreeze({\n        price: ZERO_VALUE,\n        input: {\n            tokensCount: ZERO_VALUE,\n            charactersCount: ZERO_VALUE,\n            wordsCount: ZERO_VALUE,\n            sentencesCount: ZERO_VALUE,\n            linesCount: ZERO_VALUE,\n            paragraphsCount: ZERO_VALUE,\n            pagesCount: ZERO_VALUE,\n        },\n        output: {\n            tokensCount: ZERO_VALUE,\n            charactersCount: ZERO_VALUE,\n            wordsCount: ZERO_VALUE,\n            sentencesCount: ZERO_VALUE,\n            linesCount: ZERO_VALUE,\n            paragraphsCount: ZERO_VALUE,\n            pagesCount: ZERO_VALUE,\n        },\n    });\n    /**\n     * Represents the usage with unknown resources consumed\n     *\n     * @public exported from `@promptbook/core`\n     */\n    $deepFreeze({\n        price: UNCERTAIN_ZERO_VALUE,\n        input: {\n            tokensCount: UNCERTAIN_ZERO_VALUE,\n            charactersCount: UNCERTAIN_ZERO_VALUE,\n            wordsCount: UNCERTAIN_ZERO_VALUE,\n            sentencesCount: UNCERTAIN_ZERO_VALUE,\n            linesCount: UNCERTAIN_ZERO_VALUE,\n            paragraphsCount: UNCERTAIN_ZERO_VALUE,\n            pagesCount: UNCERTAIN_ZERO_VALUE,\n        },\n        output: {\n            tokensCount: UNCERTAIN_ZERO_VALUE,\n            charactersCount: UNCERTAIN_ZERO_VALUE,\n            wordsCount: UNCERTAIN_ZERO_VALUE,\n            sentencesCount: UNCERTAIN_ZERO_VALUE,\n            linesCount: UNCERTAIN_ZERO_VALUE,\n            paragraphsCount: UNCERTAIN_ZERO_VALUE,\n            pagesCount: UNCERTAIN_ZERO_VALUE,\n        },\n    });\n    /**\n     * Note: [💞] Ignore a discrepancy between file name and entity name\n     */\n\n    /**\n     * Make UncertainNumber\n     *\n     * @param value value of the uncertain number, if `NaN` or `undefined`, it will be set to 0 and `isUncertain=true`\n     * @param isUncertain if `true`, the value is uncertain, otherwise depends on the value\n     *\n     * @private utility for initializating UncertainNumber\n     */\n    function uncertainNumber(value, isUncertain) {\n        if (value === null || value === undefined || Number.isNaN(value)) {\n            return UNCERTAIN_ZERO_VALUE;\n        }\n        if (isUncertain === true) {\n            return { value, isUncertain };\n        }\n        return { value };\n    }\n\n    /**\n     * Simple wrapper `new Date().toISOString()`\n     *\n     * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time\n     *\n     * @returns string_date branded type\n     * @public exported from `@promptbook/utils`\n     */\n    function $getCurrentDate() {\n        return new Date().toISOString();\n    }\n\n    /**\n     * @private util of `@promptbook/color`\n     * @de\n     */\n    class TakeChain {\n        constructor(value) {\n            this.value = value;\n        }\n        then(callback) {\n            const newValue = callback(this.value);\n            return take(newValue);\n        }\n    }\n\n    /**\n     * A function that takes an initial value and returns a proxy object with chainable methods.\n     *\n     * @param {*} initialValue - The initial value.\n     * @returns {Proxy<WithTake<TValue>>} - A proxy object with a `take` method.\n     *\n     * @private util of `@promptbook/color`\n     * @deprecated [🤡] Use some better functional library instead of `TakeChain`\n     */\n    function take(initialValue) {\n        if (initialValue instanceof TakeChain) {\n            return initialValue;\n        }\n        return new Proxy(new TakeChain(initialValue), {\n            get(target, property, receiver) {\n                if (Reflect.has(target, property)) {\n                    return Reflect.get(target, property, receiver);\n                }\n                else if (Reflect.has(initialValue, property)) {\n                    return Reflect.get(initialValue, property, receiver);\n                }\n                else {\n                    return undefined;\n                }\n            },\n        });\n    }\n\n    /**\n     * 🎨 List of all 140 color names which are supported by CSS\n     *\n     * @public exported from `@promptbook/color`\n     */\n    const CSS_COLORS = {\n        transparent: 'rgba(0,0,0,0)',\n        aliceblue: '#f0f8ff',\n        antiquewhite: '#faebd7',\n        aqua: '#00ffff',\n        aquamarine: '#7fffd4',\n        azure: '#f0ffff',\n        beige: '#f5f5dc',\n        bisque: '#ffe4c4',\n        black: '#000000',\n        blanchedalmond: '#ffebcd',\n        blue: '#0000ff',\n        blueviolet: '#8a2be2',\n        brown: '#a52a2a',\n        burlywood: '#deb887',\n        cadetblue: '#5f9ea0',\n        chartreuse: '#7fff00',\n        chocolate: '#d2691e',\n        coral: '#ff7f50',\n        cornflowerblue: '#6495ed',\n        cornsilk: '#fff8dc',\n        crimson: '#dc143c',\n        cyan: '#00ffff',\n        darkblue: '#00008b',\n        darkcyan: '#008b8b',\n        darkgoldenrod: '#b8860b',\n        darkgray: '#a9a9a9',\n        darkgrey: '#a9a9a9',\n        darkgreen: '#006400',\n        darkkhaki: '#bdb76b',\n        darkmagenta: '#8b008b',\n        darkolivegreen: '#556b2f',\n        darkorange: '#ff8c00',\n        darkorchid: '#9932cc',\n        darkred: '#8b0000',\n        darksalmon: '#e9967a',\n        darkseagreen: '#8fbc8f',\n        darkslateblue: '#483d8b',\n        darkslategray: '#2f4f4f',\n        darkslategrey: '#2f4f4f',\n        darkturquoise: '#00ced1',\n        darkviolet: '#9400d3',\n        deeppink: '#ff1493',\n        deepskyblue: '#00bfff',\n        dimgray: '#696969',\n        dimgrey: '#696969',\n        dodgerblue: '#1e90ff',\n        firebrick: '#b22222',\n        floralwhite: '#fffaf0',\n        forestgreen: '#228b22',\n        fuchsia: '#ff00ff',\n        gainsboro: '#dcdcdc',\n        ghostwhite: '#f8f8ff',\n        gold: '#ffd700',\n        goldenrod: '#daa520',\n        gray: '#808080',\n        grey: '#808080',\n        green: '#008000',\n        greenyellow: '#adff2f',\n        honeydew: '#f0fff0',\n        hotpink: '#ff69b4',\n        indianred: '#cd5c5c',\n        indigo: '#4b0082',\n        ivory: '#fffff0',\n        khaki: '#f0e68c',\n        lavender: '#e6e6fa',\n        lavenderblush: '#fff0f5',\n        lawngreen: '#7cfc00',\n        lemonchiffon: '#fffacd',\n        lightblue: '#add8e6',\n        lightcoral: '#f08080',\n        lightcyan: '#e0ffff',\n        lightgoldenrodyellow: '#fafad2',\n        lightgray: '#d3d3d3',\n        lightgrey: '#d3d3d3',\n        lightgreen: '#90ee90',\n        lightpink: '#ffb6c1',\n        lightsalmon: '#ffa07a',\n        lightseagreen: '#20b2aa',\n        lightskyblue: '#87cefa',\n        lightslategray: '#778899',\n        lightslategrey: '#778899',\n        lightsteelblue: '#b0c4de',\n        lightyellow: '#ffffe0',\n        lime: '#00ff00',\n        limegreen: '#32cd32',\n        linen: '#faf0e6',\n        magenta: '#ff00ff',\n        maroon: '#800000',\n        mediumaquamarine: '#66cdaa',\n        mediumblue: '#0000cd',\n        mediumorchid: '#ba55d3',\n        mediumpurple: '#9370db',\n        mediumseagreen: '#3cb371',\n        mediumslateblue: '#7b68ee',\n        mediumspringgreen: '#00fa9a',\n        mediumturquoise: '#48d1cc',\n        mediumvioletred: '#c71585',\n        midnightblue: '#191970',\n        mintcream: '#f5fffa',\n        mistyrose: '#ffe4e1',\n        moccasin: '#ffe4b5',\n        navajowhite: '#ffdead',\n        navy: '#000080',\n        oldlace: '#fdf5e6',\n        olive: '#808000',\n        olivedrab: '#6b8e23',\n        orange: '#ffa500',\n        orangered: '#ff4500',\n        orchid: '#da70d6',\n        palegoldenrod: '#eee8aa',\n        palegreen: '#98fb98',\n        paleturquoise: '#afeeee',\n        palevioletred: '#db7093',\n        papayawhip: '#ffefd5',\n        peachpuff: '#ffdab9',\n        peru: '#cd853f',\n        pink: '#ffc0cb',\n        plum: '#dda0dd',\n        powderblue: '#b0e0e6',\n        purple: '#800080',\n        rebeccapurple: '#663399',\n        red: '#ff0000',\n        rosybrown: '#bc8f8f',\n        royalblue: '#4169e1',\n        saddlebrown: '#8b4513',\n        salmon: '#fa8072',\n        sandybrown: '#f4a460',\n        seagreen: '#2e8b57',\n        seashell: '#fff5ee',\n        sienna: '#a0522d',\n        silver: '#c0c0c0',\n        skyblue: '#87ceeb',\n        slateblue: '#6a5acd',\n        slategray: '#708090',\n        slategrey: '#708090',\n        snow: '#fffafa',\n        springgreen: '#00ff7f',\n        steelblue: '#4682b4',\n        tan: '#d2b48c',\n        teal: '#008080',\n        thistle: '#d8bfd8',\n        tomato: '#ff6347',\n        turquoise: '#40e0d0',\n        violet: '#ee82ee',\n        wheat: '#f5deb3',\n        white: '#ffffff',\n        whitesmoke: '#f5f5f5',\n        yellow: '#ffff00',\n        yellowgreen: '#9acd32',\n    };\n    /**\n     * Note: [💞] Ignore a discrepancy between file name and entity name\n     */\n\n    /**\n     * Validates that a channel value is a valid number within the range of 0 to 255.\n     * Throws an error if the value is not valid.\n     *\n     * @param channelName - The name of the channel being validated.\n     * @param value - The value of the channel to validate.\n     * @throws Will throw an error if the value is not a valid channel number.\n     *\n     * @private util of `@promptbook/color`\n     */\n    function checkChannelValue(channelName, value) {\n        if (typeof value !== 'number') {\n            throw new Error(`${channelName} channel value is not number but ${typeof value}`);\n        }\n        if (isNaN(value)) {\n            throw new Error(`${channelName} channel value is NaN`);\n        }\n        if (Math.round(value) !== value) {\n            throw new Error(`${channelName} channel is not whole number, it is ${value}`);\n        }\n        if (value < 0) {\n            throw new Error(`${channelName} channel is lower than 0, it is ${value}`);\n        }\n        if (value > 255) {\n            throw new Error(`${channelName} channel is greater than 255, it is ${value}`);\n        }\n    }\n\n    /**\n     * Color object represents an RGB color with alpha channel\n     *\n     * Note: There is no fromObject/toObject because the most logical way to serialize color is as a hex string (#009edd)\n     *\n     * @public exported from `@promptbook/color`\n     */\n    class Color {\n        /**\n         * Creates a new Color instance from miscellaneous formats\n         * - It can receive Color instance and just return the same instance\n         * - It can receive color in string format for example `#009edd`, `rgb(0,158,221)`, `rgb(0%,62%,86.7%)`, `hsl(197.1,100%,43.3%)`\n         *\n         * Note: This is not including fromImage because detecting color from an image is heavy task which requires async stuff and we cannot safely determine with overloading if return value will be a promise\n         *\n         * @param color\n         * @returns Color object\n         */\n        static from(color) {\n            if (color instanceof Color) {\n                return take(color);\n            }\n            else if (Color.isColor(color)) {\n                return take(color);\n            }\n            else if (typeof color === 'string') {\n                return Color.fromString(color);\n            }\n            else {\n                console.error({ color });\n                throw new Error(`Can not create color from given object`);\n            }\n        }\n        /**\n         * Creates a new Color instance from miscellaneous string formats\n         *\n         * @param color as a string for example `#009edd`, `rgb(0,158,221)`, `rgb(0%,62%,86.7%)`, `hsl(197.1,100%,43.3%)`, `red`, `darkgrey`,...\n         * @returns Color object\n         */\n        static fromString(color) {\n            if (CSS_COLORS[color]) {\n                return Color.fromString(CSS_COLORS[color]);\n                // -----\n            }\n            else if (Color.isHexColorString(color)) {\n                return Color.fromHex(color);\n                // -----\n            }\n            else if (/^hsl\\(\\s*(\\d+)\\s*,\\s*(\\d+(?:\\.\\d+)?%)\\s*,\\s*(\\d+(?:\\.\\d+)?%)\\)$/.test(color)) {\n                return Color.fromHsl(color);\n                // -----\n            }\n            else if (/^rgb\\((\\s*[0-9-.%]+\\s*,?){3}\\)$/.test(color)) {\n                // TODO: [0] Should be fromRgbString and fromRgbaString one or two functions\n                return Color.fromRgbString(color);\n                // -----\n            }\n            else if (/^rgba\\((\\s*[0-9-.%]+\\s*,?){4}\\)$/.test(color)) {\n                return Color.fromRgbaString(color);\n                // -----\n            }\n            else {\n                throw new Error(`Can not create a new Color instance from string \"${color}\".`);\n            }\n        }\n        /**\n         * Gets common color\n         *\n         * @param key as a css string like `midnightblue`\n         * @returns Color object\n         */\n        static get(key) {\n            if (!CSS_COLORS[key]) {\n                throw new Error(`\"${key}\" is not a common css color.`);\n            }\n            return Color.fromString(CSS_COLORS[key]);\n        }\n        /**\n         * Creates a new Color instance from average color of given image\n         *\n         * @param image as a source for example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdjYJh39z8ABJgCe/ZvAS4AAAAASUVORK5CYII=`\n         * @returns Color object\n         */\n        static async fromImage(image) {\n            return Color.fromHex(`#009edd`);\n        }\n        /**\n         * Creates a new Color instance from color in hex format\n         *\n         * @param color in hex for example `#009edd`, `009edd`, `#555`,...\n         * @returns Color object\n         */\n        static fromHex(hex) {\n            const hexOriginal = hex;\n            if (hex.startsWith('#')) {\n                hex = hex.substring(1);\n            }\n            if (hex.length === 3) {\n                return Color.fromHex3(hex);\n            }\n            if (hex.length === 4) {\n                return Color.fromHex4(hex);\n            }\n            if (hex.length === 6) {\n                return Color.fromHex6(hex);\n            }\n            if (hex.length === 8) {\n                return Color.fromHex8(hex);\n            }\n            throw new Error(`Can not parse color from hex string \"${hexOriginal}\"`);\n        }\n        /**\n         * Creates a new Color instance from color in hex format with 3 color digits (without alpha channel)\n         *\n         * @param color in hex for example `09d`\n         * @returns Color object\n         */\n        static fromHex3(hex) {\n            const r = parseInt(hex.substr(0, 1), 16) * 16;\n            const g = parseInt(hex.substr(1, 1), 16) * 16;\n            const b = parseInt(hex.substr(2, 1), 16) * 16;\n            return take(new Color(r, g, b));\n        }\n        /**\n         * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)\n         *\n         * @param color in hex for example `09df`\n         * @returns Color object\n         */\n        static fromHex4(hex) {\n            const r = parseInt(hex.substr(0, 1), 16) * 16;\n            const g = parseInt(hex.substr(1, 1), 16) * 16;\n            const b = parseInt(hex.substr(2, 1), 16) * 16;\n            const a = parseInt(hex.substr(3, 1), 16) * 16;\n            return take(new Color(r, g, b, a));\n        }\n        /**\n         * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)\n         *\n         * @param color in hex for example `009edd`\n         * @returns Color object\n         */\n        static fromHex6(hex) {\n            const r = parseInt(hex.substr(0, 2), 16);\n            const g = parseInt(hex.substr(2, 2), 16);\n            const b = parseInt(hex.substr(4, 2), 16);\n            return take(new Color(r, g, b));\n        }\n        /**\n         * Creates a new Color instance from color in hex format with 8 color digits (with alpha channel)\n         *\n         * @param color in hex for example `009edd`\n         * @returns Color object\n         */\n        static fromHex8(hex) {\n            const r = parseInt(hex.substr(0, 2), 16);\n            const g = parseInt(hex.substr(2, 2), 16);\n            const b = parseInt(hex.substr(4, 2), 16);\n            const a = parseInt(hex.substr(6, 2), 16);\n            return take(new Color(r, g, b, a));\n        }\n        /**\n         * Creates a new Color instance from color in hsl format\n         *\n         * @param color as a hsl for example `hsl(197.1,100%,43.3%)`\n         * @returns Color object\n         */\n        static fromHsl(hsl) {\n            const match = hsl.match(/^hsl\\(\\s*([0-9.]+)\\s*,\\s*([0-9.]+)%\\s*,\\s*([0-9.]+)%\\s*\\)$/);\n            if (!match) {\n                throw new Error(`Invalid hsl string format: \"${hsl}\"`);\n            }\n            const h = parseFloat(match[1]);\n            const s = parseFloat(match[2]) / 100;\n            const l = parseFloat(match[3]) / 100;\n            // HSL to RGB conversion\n            const c = (1 - Math.abs(2 * l - 1)) * s;\n            const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n            const m = l - c / 2;\n            let r1 = 0, g1 = 0, b1 = 0;\n            if (h >= 0 && h < 60) {\n                r1 = c;\n                g1 = x;\n                b1 = 0;\n            }\n            else if (h >= 60 && h < 120) {\n                r1 = x;\n                g1 = c;\n                b1 = 0;\n            }\n            else if (h >= 120 && h < 180) {\n                r1 = 0;\n                g1 = c;\n                b1 = x;\n            }\n            else if (h >= 180 && h < 240) {\n                r1 = 0;\n                g1 = x;\n                b1 = c;\n            }\n            else if (h >= 240 && h < 300) {\n                r1 = x;\n                g1 = 0;\n                b1 = c;\n            }\n            else if (h >= 300 && h < 360) {\n                r1 = c;\n                g1 = 0;\n                b1 = x;\n            }\n            const r = Math.round((r1 + m) * 255);\n            const g = Math.round((g1 + m) * 255);\n            const b = Math.round((b1 + m) * 255);\n            return take(new Color(r, g, b));\n        }\n        /**\n         * Creates a new Color instance from color in rgb format\n         *\n         * @param color as a rgb for example `rgb(0,158,221)`, `rgb(0%,62%,86.7%)`\n         * @returns Color object\n         */\n        static fromRgbString(rgb) {\n            const match = rgb.match(/^rgb\\(\\s*([0-9.%-]+)\\s*,\\s*([0-9.%-]+)\\s*,\\s*([0-9.%-]+)\\s*\\)$/);\n            if (!match) {\n                throw new Error(`Invalid rgb string format: \"${rgb}\"`);\n            }\n            const parseChannel = (value) => {\n                if (value.endsWith('%')) {\n                    // Percentage value\n                    const percent = parseFloat(value);\n                    return Math.round((percent / 100) * 255);\n                }\n                else {\n                    // Numeric value\n                    return Math.round(parseFloat(value));\n                }\n            };\n            const r = parseChannel(match[1]);\n            const g = parseChannel(match[2]);\n            const b = parseChannel(match[3]);\n            return take(new Color(r, g, b));\n        }\n        /**\n         * Creates a new Color instance from color in rbga format\n         *\n         * @param color as a rgba for example `rgba(0,158,221,0.5)`, `rgb(0%,62%,86.7%,50%)`\n         * @returns Color object\n         */\n        static fromRgbaString(rgba) {\n            const match = rgba.match(/^rgba\\(\\s*([0-9.%-]+)\\s*,\\s*([0-9.%-]+)\\s*,\\s*([0-9.%-]+)\\s*,\\s*([0-9.%-]+)\\s*\\)$/);\n            if (!match) {\n                throw new Error(`Invalid rgba string format: \"${rgba}\"`);\n            }\n            const parseChannel = (value) => {\n                if (value.endsWith('%')) {\n                    const percent = parseFloat(value);\n                    return Math.round((percent / 100) * 255);\n                }\n                else {\n                    return Math.round(parseFloat(value));\n                }\n            };\n            const parseAlpha = (value) => {\n                if (value.endsWith('%')) {\n                    const percent = parseFloat(value);\n                    return Math.round((percent / 100) * 255);\n                }\n                else {\n                    const alphaFloat = parseFloat(value);\n                    // If alpha is between 0 and 1, treat as float\n                    if (alphaFloat <= 1) {\n                        return Math.round(alphaFloat * 255);\n                    }\n                    // Otherwise, treat as 0-255\n                    return Math.round(alphaFloat);\n                }\n            };\n            const r = parseChannel(match[1]);\n            const g = parseChannel(match[2]);\n            const b = parseChannel(match[3]);\n            const a = parseAlpha(match[4]);\n            return take(new Color(r, g, b, a));\n        }\n        /**\n         * Creates a new Color for color channels values\n         *\n         * @param red number from 0 to 255\n         * @param green number from 0 to 255\n         * @param blue number from 0 to 255\n         * @param alpha number from 0 (transparent) to 255 (opaque = default)\n         * @returns Color object\n         */\n        static fromValues(red, green, blue, alpha = 255) {\n            return take(new Color(red, green, blue, alpha));\n        }\n        /**\n         * Checks if the given value is a valid Color object.\n         *\n         * @param {unknown} value - The value to check.\n         * @return {value is WithTake<Color>} Returns true if the value is a valid Color object, false otherwise.\n         */\n        static isColor(value) {\n            if (typeof value !== 'object') {\n                return false;\n            }\n            if (value === null) {\n                return false;\n            }\n            if (typeof value.red !== 'number' ||\n                typeof value.green !== 'number' ||\n                typeof value.blue !== 'number' ||\n                typeof value.alpha !== 'number') {\n                return false;\n            }\n            if (typeof value.then !== 'function') {\n                return false;\n            }\n            return true;\n        }\n        /**\n         * Checks if the given value is a valid hex color string\n         *\n         * @param value - value to check\n         * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)\n         */\n        static isHexColorString(value) {\n            return (typeof value === 'string' &&\n                /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));\n        }\n        /**\n         * Creates new Color object\n         *\n         * Note: Consider using one of static methods like `from` or `fromString`\n         *\n         * @param red number from 0 to 255\n         * @param green number from 0 to 255\n         * @param blue number from 0 to 255\n         * @param alpha number from 0 (transparent) to 255 (opaque)\n         */\n        constructor(red, green, blue, alpha = 255) {\n            this.red = red;\n            this.green = green;\n            this.blue = blue;\n            this.alpha = alpha;\n            checkChannelValue('Red', red);\n            checkChannelValue('Green', green);\n            checkChannelValue('Blue', blue);\n            checkChannelValue('Alpha', alpha);\n        }\n        /**\n         * Shortcut for `red` property\n         * Number from 0 to 255\n         * @alias red\n         */\n        get r() {\n            return this.red;\n        }\n        /**\n         * Shortcut for `green` property\n         * Number from 0 to 255\n         * @alias green\n         */\n        get g() {\n            return this.green;\n        }\n        /**\n         * Shortcut for `blue` property\n         * Number from 0 to 255\n         * @alias blue\n         */\n        get b() {\n            return this.blue;\n        }\n        /**\n         * Shortcut for `alpha` property\n         * Number from 0 (transparent) to 255 (opaque)\n         * @alias alpha\n         */\n        get a() {\n            return this.alpha;\n        }\n        /**\n         * Shortcut for `alpha` property\n         * Number from 0 (transparent) to 255 (opaque)\n         * @alias alpha\n         */\n        get opacity() {\n            return this.alpha;\n        }\n        /**\n         * Shortcut for 1-`alpha` property\n         */\n        get transparency() {\n            return 255 - this.alpha;\n        }\n        clone() {\n            return take(new Color(this.red, this.green, this.blue, this.alpha));\n        }\n        toString() {\n            return this.toHex();\n        }\n        toHex() {\n            if (this.alpha === 255) {\n                return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue\n                .toString(16)\n                .padStart(2, '0')}`;\n            }\n            else {\n                return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue\n                .toString(16)\n                .padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;\n            }\n        }\n        toRgb() {\n            if (this.alpha === 255) {\n                return `rgb(${this.red}, ${this.green}, ${this.blue})`;\n            }\n            else {\n                return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;\n            }\n        }\n        toHsl() {\n            throw new Error(`Getting HSL is not implemented`);\n        }\n    }\n    /**\n     * TODO: [🥻] Split Color class and color type\n     * TODO: For each method a corresponding static method should be created\n     *       Like clone can be done by color.clone() OR Color.clone(color)\n     * TODO: Probably as an independent LIB OR add to LIB xyzt (ask @roseckyj)\n     * TODO: !! Transfer back to Collboard (whole directory)\n     * TODO: Maybe [🏌️‍♂️] change ACRY toString => (toHex) toRgb when there will be toRgb and toRgba united\n     * TODO: Convert getters to methods - getters only for values\n     * TODO: Write tests\n     * TODO: Getters for alpha, opacity, transparency, r, b, g, h, s, l, a,...\n     * TODO: [0] Should be fromRgbString and fromRgbaString one or two functions + one or two regex\n     * TODO: Use rgb, rgba, hsl for testing and parsing with the same regex\n     * TODO: Regex for rgb, rgba, hsl does not support all options like deg, rad, turn,...\n     * TODO: Convolution matrix\n     * TODO: Maybe connect with textures\n     */\n\n    /**\n     * Makes color transformer which returns a grayscale version of the color\n     *\n     * @param amount from 0 to 1\n     *\n     * @public exported from `@promptbook/color`\n     */\n    function grayscale(amount) {\n        return ({ red, green, blue, alpha }) => {\n            const average = (red + green + blue) / 3;\n            red = Math.round(average * amount + red * (1 - amount));\n            green = Math.round(average * amount + green * (1 - amount));\n            blue = Math.round(average * amount + blue * (1 - amount));\n            return Color.fromValues(red, green, blue, alpha);\n        };\n    }\n\n    /**\n     * Converts HSL values to RGB values\n     *\n     * @param hue [0-1]\n     * @param saturation [0-1]\n     * @param lightness [0-1]\n     * @returns [red, green, blue] [0-255]\n     *\n     * @private util of `@promptbook/color`\n     */\n    function hslToRgb(hue, saturation, lightness) {\n        let red;\n        let green;\n        let blue;\n        if (saturation === 0) {\n            // achromatic\n            red = lightness;\n            green = lightness;\n            blue = lightness;\n        }\n        else {\n            // TODO: Extract to separate function\n            const hue2rgb = (p, q, t) => {\n                if (t < 0)\n                    t += 1;\n                if (t > 1)\n                    t -= 1;\n                if (t < 1 / 6)\n                    return p + (q - p) * 6 * t;\n                if (t < 1 / 2)\n                    return q;\n                if (t < 2 / 3)\n                    return p + (q - p) * (2 / 3 - t) * 6;\n                return p;\n            };\n            const q = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;\n            const p = 2 * lightness - q;\n            red = hue2rgb(p, q, hue + 1 / 3);\n            green = hue2rgb(p, q, hue);\n            blue = hue2rgb(p, q, hue - 1 / 3);\n        }\n        return [Math.round(red * 255), Math.round(green * 255), Math.round(blue * 255)];\n    }\n    /**\n     * TODO: Properly name all used internal variables\n     */\n\n    /**\n     * Converts RGB values to HSL values\n     *\n     * @param red [0-255]\n     * @param green [0-255]\n     * @param blue [0-255]\n     * @returns [hue, saturation, lightness] [0-1]\n     *\n     * @private util of `@promptbook/color`\n     */\n    function rgbToHsl(red, green, blue) {\n        red /= 255;\n        green /= 255;\n        blue /= 255;\n        const max = Math.max(red, green, blue);\n        const min = Math.min(red, green, blue);\n        let hue;\n        let saturation;\n        const lightness = (max + min) / 2;\n        if (max === min) {\n            // achromatic\n            hue = 0;\n            saturation = 0;\n        }\n        else {\n            const d = max - min;\n            saturation = lightness > 0.5 ? d / (2 - max - min) : d / (max + min);\n            switch (max) {\n                case red:\n                    hue = (green - blue) / d + (green < blue ? 6 : 0);\n                    break;\n                case green:\n                    hue = (blue - red) / d + 2;\n                    break;\n                case blue:\n                    hue = (red - green) / d + 4;\n                    break;\n                default:\n                    hue = 0;\n            }\n            hue /= 6;\n        }\n        return [hue, saturation, lightness];\n    }\n    /**\n     * TODO: Properly name all used internal variables\n     */\n\n    /**\n     * Makes color transformer which lighten the given color\n     *\n     * @param amount from 0 to 1\n     *\n     * @public exported from `@promptbook/color`\n     */\n    function lighten(amount) {\n        return ({ red, green, blue, alpha }) => {\n            const [h, s, lInitial] = rgbToHsl(red, green, blue);\n            let l = lInitial + amount;\n            l = Math.max(0, Math.min(l, 1)); // Replace lodash clamp with Math.max and Math.min\n            const [r, g, b] = hslToRgb(h, s, l);\n            return Color.fromValues(r, g, b, alpha);\n        };\n    }\n    /**\n     * TODO: Maybe implement by mix+hsl\n     */\n\n    /**\n     * Makes color transformer which saturate the given color\n     *\n     * @param amount from -1 to 1\n     *\n     * @public exported from `@promptbook/color`\n     */\n    function saturate(amount) {\n        return ({ red, green, blue, alpha }) => {\n            const [h, sInitial, l] = rgbToHsl(red, green, blue);\n            let s = sInitial + amount;\n            s = Math.max(0, Math.min(s, 1));\n            const [r, g, b] = hslToRgb(h, s, l);\n            return Color.fromValues(r, g, b, alpha);\n        };\n    }\n    /**\n     * TODO: Maybe implement by mix+hsl\n     */\n\n    /**\n     * Name for the Promptbook\n     *\n     * TODO: [🗽] Unite branding and make single place for it\n     *\n     * @public exported from `@promptbook/core`\n     */\n    const NAME = `Promptbook`;\n    /**\n     * Email of the responsible person\n     *\n     * @public exported from `@promptbook/core`\n     */\n    const ADMIN_EMAIL = 'pavol@ptbk.io';\n    /**\n     * Name of the responsible person for the Promptbook on GitHub\n     *\n     * @public exported from `@promptbook/core`\n     */\n    const ADMIN_GITHUB_NAME = 'hejny';\n    //            <- TODO: [🐊] Pick the best claim\n    /**\n     * Color of the Promptbook\n     *\n     * TODO: [🗽] Unite branding and make single place for it\n     *\n     * @public exported from `@promptbook/core`\n     */\n    const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');\n    // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it\n    /**\n     * Colors for syntax highlighting in the `<BookEditor/>`\n     *\n     * TODO: [🗽] Unite branding and make single place for it\n     *\n     * @public exported from `@promptbook/core`\n     */\n    ({\n        TITLE: Color.fromHex('#244EA8'),\n        LINE: Color.fromHex('#eeeeee'),\n        SEPARATOR: Color.fromHex('#cccccc'),\n        COMMITMENT: Color.fromHex('#DA0F78'),\n        PARAMETER: Color.fromHex('#8e44ad'),\n    });\n    // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it\n    /**\n     * Chat color of the Promptbook (in chat)\n     *\n     * TODO: [🗽] Unite branding and make single place for it\n     *\n     * @public exported from `@promptbook/core`\n     */\n    PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));\n    // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it\n    /**\n     * Color of the user (in chat)\n     *\n     * TODO: [🗽] Unite branding and make single place for it\n     *\n     * @public exported from `@promptbook/core`\n     */\n    Color.fromHex('#1D4ED8');\n    // <- TODO: [🧠] Better system for generator warnings - not always \"code\" and \"by `@promptbook/cli`\"\n    /**\n     * The maximum number of iterations for a loops\n     *\n     * @private within the repository - too low-level in comparison with other `MAX_...`\n     */\n    const LOOP_LIMIT = 1000;\n    /**\n     * Strings to represent various values in the context of parameter values\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    const VALUE_STRINGS = {\n        empty: '(nothing; empty string)',\n        null: '(no value; null)',\n        undefined: '(unknown value; undefined)',\n        nan: '(not a number; NaN)',\n        infinity: '(infinity; ∞)',\n        negativeInfinity: '(negative infinity; -∞)',\n        unserializable: '(unserializable value)',\n        circular: '(circular JSON)',\n    };\n    /**\n     * Small number limit\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    const SMALL_NUMBER = 0.001;\n    // <- TODO: [🧜‍♂️]\n    /**\n     * Default settings for parsing and generating CSV files in Promptbook.\n     *\n     * @public exported from `@promptbook/core`\n     */\n    Object.freeze({\n        delimiter: ',',\n        quoteChar: '\"',\n        newline: '\\n',\n        skipEmptyLines: true,\n    });\n    /**\n     * API request timeout in milliseconds\n     * Can be overridden via API_REQUEST_TIMEOUT environment variable\n     *\n     * @public exported from `@promptbook/core`\n     */\n    parseInt(process.env.API_REQUEST_TIMEOUT || '90000');\n    /**\n     * Note: [💞] Ignore a discrepancy between file name and entity name\n     * TODO: [🧠][🧜‍♂️] Maybe join remoteServerUrl and path into single value\n     */\n\n    /**\n     * Orders JSON object by keys\n     *\n     * @returns The same type of object as the input re-ordered\n     * @public exported from `@promptbook/utils`\n     */\n    function orderJson(options) {\n        const { value, order } = options;\n        const orderedValue = {\n            ...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),\n            ...value,\n        };\n        return orderedValue;\n    }\n\n    /**\n     * Make error report URL for the given error\n     *\n     * @private private within the repository\n     */\n    function getErrorReportUrl(error) {\n        const report = {\n            title: `🐜 Error report from ${NAME}`,\n            body: spaceTrim__default[\"default\"]((block) => `\n\n\n            \\`${error.name || 'Error'}\\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.\n\n            \\`\\`\\`\n            ${block(error.message || '(no error message)')}\n            \\`\\`\\`\n\n\n            ## More info:\n\n            - **Promptbook engine version:** ${PROMPTBOOK_ENGINE_VERSION}\n            - **Book language version:** ${BOOK_LANGUAGE_VERSION}\n            - **Time:** ${new Date().toISOString()}\n\n            <details>\n            <summary>Stack trace:</summary>\n\n            ## Stack trace:\n\n            \\`\\`\\`stacktrace\n            ${block(error.stack || '(empty)')}\n            \\`\\`\\`\n            </details>\n\n        `),\n        };\n        const reportUrl = new URL(`https://github.com/webgptorg/promptbook/issues/new`);\n        reportUrl.searchParams.set('labels', 'bug');\n        reportUrl.searchParams.set('assignees', ADMIN_GITHUB_NAME);\n        reportUrl.searchParams.set('title', report.title);\n        reportUrl.searchParams.set('body', report.body);\n        return reportUrl;\n    }\n\n    /**\n     * This error type indicates that the error should not happen and its last check before crashing with some other error\n     *\n     * @public exported from `@promptbook/core`\n     */\n    class UnexpectedError extends Error {\n        constructor(message) {\n            super(spaceTrim.spaceTrim((block) => `\n                    ${block(message)}\n\n                    Note: This error should not happen.\n                    It's probably a bug in the pipeline collection\n\n                    Please report issue:\n                    ${block(getErrorReportUrl(new Error(message)).href)}\n\n                    Or contact us on ${ADMIN_EMAIL}\n\n                `));\n            this.name = 'UnexpectedError';\n            Object.setPrototypeOf(this, UnexpectedError.prototype);\n        }\n    }\n\n    /**\n     * This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`\n     *\n     * @public exported from `@promptbook/core`\n     */\n    class WrappedError extends Error {\n        constructor(whatWasThrown) {\n            const tag = `[🤮]`;\n            console.error(tag, whatWasThrown);\n            super(spaceTrim.spaceTrim(`\n                Non-Error object was thrown\n\n                Note: Look for ${tag} in the console for more details\n                Please report issue on ${ADMIN_EMAIL}\n            `));\n            this.name = 'WrappedError';\n            Object.setPrototypeOf(this, WrappedError.prototype);\n        }\n    }\n\n    /**\n     * Helper used in catch blocks to assert that the error is an instance of `Error`\n     *\n     * @param whatWasThrown Any object that was thrown\n     * @returns Nothing if the error is an instance of `Error`\n     * @throws `WrappedError` or `UnexpectedError` if the error is not standard\n     *\n     * @private within the repository\n     */\n    function assertsError(whatWasThrown) {\n        // Case 1: Handle error which was rethrown as `WrappedError`\n        if (whatWasThrown instanceof WrappedError) {\n            const wrappedError = whatWasThrown;\n            throw wrappedError;\n        }\n        // Case 2: Handle unexpected errors\n        if (whatWasThrown instanceof UnexpectedError) {\n            const unexpectedError = whatWasThrown;\n            throw unexpectedError;\n        }\n        // Case 3: Handle standard errors - keep them up to consumer\n        if (whatWasThrown instanceof Error) {\n            return;\n        }\n        // Case 4: Handle non-standard errors - wrap them into `WrappedError` and throw\n        throw new WrappedError(whatWasThrown);\n    }\n\n    /**\n     * Checks if the value is [🚉] serializable as JSON\n     * If not, throws an UnexpectedError with a rich error message and tracking\n     *\n     * - Almost all primitives are serializable BUT:\n     * - `undefined` is not serializable\n     * - `NaN` is not serializable\n     * - Objects and arrays are serializable if all their properties are serializable\n     * - Functions are not serializable\n     * - Circular references are not serializable\n     * - `Date` objects are not serializable\n     * - `Map` and `Set` objects are not serializable\n     * - `RegExp` objects are not serializable\n     * - `Error` objects are not serializable\n     * - `Symbol` objects are not serializable\n     * - And much more...\n     *\n     * @throws UnexpectedError if the value is not serializable as JSON\n     * @public exported from `@promptbook/utils`\n     */\n    function checkSerializableAsJson(options) {\n        const { value, name, message } = options;\n        if (value === undefined) {\n            throw new UnexpectedError(`${name} is undefined`);\n        }\n        else if (value === null) {\n            return;\n        }\n        else if (typeof value === 'boolean') {\n            return;\n        }\n        else if (typeof value === 'number' && !isNaN(value)) {\n            return;\n        }\n        else if (typeof value === 'string') {\n            return;\n        }\n        else if (typeof value === 'symbol') {\n            throw new UnexpectedError(`${name} is symbol`);\n        }\n        else if (typeof value === 'function') {\n            throw new UnexpectedError(`${name} is function`);\n        }\n        else if (typeof value === 'object' && Array.isArray(value)) {\n            for (let i = 0; i < value.length; i++) {\n                checkSerializableAsJson({ name: `${name}[${i}]`, value: value[i], message });\n            }\n        }\n        else if (typeof value === 'object') {\n            if (value instanceof Date) {\n                throw new UnexpectedError(spaceTrim__default[\"default\"]((block) => `\n                        \\`${name}\\` is Date\n\n                        Use \\`string_date_iso8601\\` instead\n\n                        Additional message for \\`${name}\\`:\n                        ${block(message || '(nothing)')}\n                    `));\n            }\n            else if (value instanceof Map) {\n                throw new UnexpectedError(`${name} is Map`);\n            }\n            else if (value instanceof Set) {\n                throw new UnexpectedError(`${name} is Set`);\n            }\n            else if (value instanceof RegExp) {\n                throw new UnexpectedError(`${name} is RegExp`);\n            }\n            else if (value instanceof Error) {\n                throw new UnexpectedError(spaceTrim__default[\"default\"]((block) => `\n                        \\`${name}\\` is unserialized Error\n\n                        Use function \\`serializeError\\`\n\n                        Additional message for \\`${name}\\`:\n                        ${block(message || '(nothing)')}\n\n                    `));\n            }\n            else {\n                for (const [subName, subValue] of Object.entries(value)) {\n                    if (subValue === undefined) {\n                        // Note: undefined in object is serializable - it is just omitted\n                        continue;\n                    }\n                    checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });\n                }\n                try {\n                    JSON.stringify(value); // <- TODO: [0]\n                }\n                catch (error) {\n                    assertsError(error);\n                    throw new UnexpectedError(spaceTrim__default[\"default\"]((block) => `\n                            \\`${name}\\` is not serializable\n\n                            ${block(error.stack || error.message)}\n\n                            Additional message for \\`${name}\\`:\n                            ${block(message || '(nothing)')}\n                        `));\n                }\n                /*\n                TODO: [0] Is there some more elegant way to check circular references?\n                const seen = new Set();\n                const stack = [{ value }];\n                while (stack.length > 0) {\n                    const { value } = stack.pop()!;\n                    if (typeof value === 'object' && value !== null) {\n                        if (seen.has(value)) {\n                            throw new UnexpectedError(`${name} has circular reference`);\n                        }\n                        seen.add(value);\n                        if (Array.isArray(value)) {\n                            stack.push(...value.map((value) => ({ value })));\n                        } else {\n                            stack.push(...Object.values(value).map((value) => ({ value })));\n                        }\n                    }\n                }\n                */\n                return;\n            }\n        }\n        else {\n            throw new UnexpectedError(spaceTrim__default[\"default\"]((block) => `\n                    \\`${name}\\` is unknown type\n\n                    Additional message for \\`${name}\\`:\n                    ${block(message || '(nothing)')}\n                `));\n        }\n    }\n    /**\n     * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`\n     * TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks\n     * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message\n     */\n\n    /**\n     * Creates a deep clone of the given object\n     *\n     * Note: [🔂] This function is idempotent.\n     * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.\n     *\n     * @param objectValue The object to clone.\n     * @returns A deep, writable clone of the input object.\n     * @public exported from `@promptbook/utils`\n     */\n    function deepClone(objectValue) {\n        return JSON.parse(JSON.stringify(objectValue));\n        /*\n        TODO: [🧠] Is there a better implementation?\n        > const propertyNames = Object.getOwnPropertyNames(objectValue);\n        > for (const propertyName of propertyNames) {\n        >     const value = (objectValue as chococake)[propertyName];\n        >     if (value && typeof value === 'object') {\n        >         deepClone(value);\n        >     }\n        > }\n        > return Object.assign({}, objectValue);\n        */\n    }\n    /**\n     * TODO: [🧠] Is there a way how to meaningfully test this utility\n     */\n\n    /**\n     * Utility to export a JSON object from a function\n     *\n     * 1) Checks if the value is serializable as JSON\n     * 2) Makes a deep clone of the object\n     * 2) Orders the object properties\n     * 2) Deeply freezes the cloned object\n     *\n     * Note: This function does not mutates the given object\n     *\n     * @returns The same type of object as the input but read-only and re-ordered\n     * @public exported from `@promptbook/utils`\n     */\n    function exportJson(options) {\n        const { name, value, order, message } = options;\n        checkSerializableAsJson({ name, value, message });\n        const orderedValue = \n        // TODO: Fix error \"Type instantiation is excessively deep and possibly infinite.\"\n        // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n        // @ts-ignore\n        order === undefined\n            ? deepClone(value)\n            : orderJson({\n                value: value,\n                // <- Note: checkSerializableAsJson asserts that the value is serializable as JSON\n                order: order,\n            });\n        $deepFreeze(orderedValue);\n        return orderedValue;\n    }\n    /**\n     * TODO: [🧠] Is there a way how to meaningfully test this utility\n     */\n\n    /**\n     * Nonce which is used for replacing things in strings\n     *\n     * @private within the repository\n     */\n    const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';\n    /**\n     * Placeholder value indicating a parameter is missing its value.\n     *\n     * @private within the repository\n     */\n    const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;\n    /**\n     * Placeholder value indicating a parameter is restricted and cannot be used directly.\n     *\n     * @private within the repository\n     */\n    const RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;\n    /**\n     * The names of the parameters that are reserved for special purposes\n     *\n     * @public exported from `@promptbook/core`\n     */\n    exportJson({\n        name: 'RESERVED_PARAMETER_NAMES',\n        message: `The names of the parameters that are reserved for special purposes`,\n        value: [\n            'content',\n            'context',\n            'knowledge',\n            'examples',\n            'modelName',\n            'currentDate',\n            // <- TODO: list here all command names\n            // <- TODO: Add more like 'date', 'modelName',...\n            // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter\n        ],\n    });\n    /**\n     * Note: [💞] Ignore a discrepancy between file name and entity name\n     */\n\n    /**\n     * This error type indicates that some limit was reached\n     *\n     * @public exported from `@promptbook/core`\n     */\n    class LimitReachedError extends Error {\n        constructor(message) {\n            super(message);\n            this.name = 'LimitReachedError';\n            Object.setPrototypeOf(this, LimitReachedError.prototype);\n        }\n    }\n\n    /**\n     * Format either small or big number\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function numberToString(value) {\n        if (value === 0) {\n            return '0';\n        }\n        else if (Number.isNaN(value)) {\n            return VALUE_STRINGS.nan;\n        }\n        else if (value === Infinity) {\n            return VALUE_STRINGS.infinity;\n        }\n        else if (value === -Infinity) {\n            return VALUE_STRINGS.negativeInfinity;\n        }\n        for (let exponent = 0; exponent < 15; exponent++) {\n            const factor = 10 ** exponent;\n            const valueRounded = Math.round(value * factor) / factor;\n            if (Math.abs(value - valueRounded) / value < SMALL_NUMBER) {\n                return valueRounded.toFixed(exponent);\n            }\n        }\n        return value.toString();\n    }\n\n    /**\n     * Function `valueToString` will convert the given value to string\n     * This is useful and used in the `templateParameters` function\n     *\n     * Note: This function is not just calling `toString` method\n     *       It's more complex and can handle this conversion specifically for LLM models\n     *       See `VALUE_STRINGS`\n     *\n     * Note: There are 2 similar functions\n     * - `valueToString` converts value to string for LLM models as human-readable string\n     * - `asSerializable` converts value to string to preserve full information to be able to convert it back\n     *\n     * @public exported from `@promptbook/utils`\n     */\n    function valueToString(value) {\n        try {\n            if (value === '') {\n                return VALUE_STRINGS.empty;\n            }\n            else if (value === null) {\n                return VALUE_STRINGS.null;\n            }\n            else if (value === undefined) {\n                return VALUE_STRINGS.undefined;\n            }\n            else if (typeof value === 'string') {\n                return value;\n            }\n            else if (typeof value === 'number') {\n                return numberToString(value);\n            }\n            else if (value instanceof Date) {\n                return value.toISOString();\n            }\n            else {\n                try {\n                    return JSON.stringify(value);\n                }\n                catch (error) {\n                    if (error instanceof TypeError && error.message.includes('circular structure')) {\n                        return VALUE_STRINGS.circular;\n                    }\n                    throw error;\n                }\n            }\n        }\n        catch (error) {\n            assertsError(error);\n            console.error(error);\n            return VALUE_STRINGS.unserializable;\n        }\n    }\n\n    /**\n     * Replaces parameters in template with values from parameters object\n     *\n     * Note: This function is not places strings into string,\n     *       It's more complex and can handle this operation specifically for LLM models\n     *\n     * @param template the template with parameters in {curly} braces\n     * @param parameters the object with parameters\n     * @returns the template with replaced parameters\n     * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened\n     * @public exported from `@promptbook/utils`\n     */\n    function templateParameters(template, parameters) {\n        for (const [parameterName, parameterValue] of Object.entries(parameters)) {\n            if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {\n                throw new UnexpectedError(`Parameter \\`{${parameterName}}\\` has missing value`);\n            }\n            else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {\n                // TODO: [🍵]\n                throw new UnexpectedError(`Parameter \\`{${parameterName}}\\` is restricted to use`);\n            }\n        }\n        let replacedTemplates = template;\n        let match;\n        let loopLimit = LOOP_LIMIT;\n        while ((match = /^(?<precol>.*){(?<parameterName>\\w+)}(.*)/m /* <- Not global */\n            .exec(replacedTemplates))) {\n            if (loopLimit-- < 0) {\n                throw new LimitReachedError('Loop limit reached during parameters replacement in `templateParameters`');\n            }\n            const precol = match.groups.precol;\n            const parameterName = match.groups.parameterName;\n            if (parameterName === '') {\n                // Note: Skip empty placeholders. It's used to avoid confusion with JSON-like strings\n                continue;\n            }\n            if (parameterName.indexOf('{') !== -1 || parameterName.indexOf('}') !== -1) {\n                throw new PipelineExecutionError('Parameter is already opened or not closed');\n            }\n            if (parameters[parameterName] === undefined) {\n                throw new PipelineExecutionError(`Parameter \\`{${parameterName}}\\` is not defined`);\n            }\n            let parameterValue = parameters[parameterName];\n            if (parameterValue === undefined) {\n                throw new PipelineExecutionError(`Parameter \\`{${parameterName}}\\` is not defined`);\n            }\n            parameterValue = valueToString(parameterValue);\n            // Escape curly braces in parameter values to prevent prompt-injection\n            parameterValue = parameterValue.replace(/[{}]/g, '\\\\$&');\n            if (parameterValue.includes('\\n') && /^\\s*\\W{0,3}\\s*$/.test(precol)) {\n                parameterValue = parameterValue\n                    .split('\\n')\n                    .map((line, index) => (index === 0 ? line : `${precol}${line}`))\n                    .join('\\n');\n            }\n            replacedTemplates =\n                replacedTemplates.substring(0, match.index + precol.length) +\n                    parameterValue +\n                    replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);\n        }\n        // [💫] Check if there are parameters that are not closed properly\n        if (/{\\w+$/.test(replacedTemplates)) {\n            throw new PipelineExecutionError('Parameter is not closed');\n        }\n        // [💫] Check if there are parameters that are not opened properly\n        if (/^\\w+}/.test(replacedTemplates)) {\n            throw new PipelineExecutionError('Parameter is not opened');\n        }\n        return replacedTemplates;\n    }\n\n    /**\n     * Function `asSerializable` will convert values which are not serializable to serializable values\n     * It walks deeply through the object and converts all values\n     *\n     * For example:\n     * - `Date` objects will be converted to string\n     *\n     * Note: There are 2 similar functions\n     * - `valueToString` converts value to string for LLM models as human-readable string\n     * - `asSerializable` converts value to string to preserve full information to be able to convert it back\n     *\n     * @private Internal helper function\n     */\n    function asSerializable(value) {\n        if (value instanceof Date) {\n            return value.toISOString();\n        }\n        else if (Array.isArray(value)) {\n            return value.map(asSerializable);\n        }\n        else if (value !== null && typeof value === 'object') {\n            const result = {};\n            for (const key in value) {\n                if (Object.prototype.hasOwnProperty.call(value, key)) {\n                    result[key] = asSerializable(value[key]);\n                }\n            }\n            return result;\n        }\n        else {\n            return value;\n        }\n    }\n\n    /**\n     * Profile for Vercel AI adapter\n     */\n    const VERCEL_PROVIDER_PROFILE = {\n        name: 'VERCEL',\n        fullname: 'Vercel AI',\n        color: '#000000',\n    };\n    /**\n     * Adapter which creates Promptbook execution tools from Vercel provider\n     *\n     * @public exported from `@promptbook/vercel`\n     */\n    function createExecutionToolsFromVercelProvider(options) {\n        let { title, description } = options;\n        const { vercelProvider, availableModels, userId, additionalChatSettings = {} } = options;\n        if (!/Vercel/i.test(title)) {\n            title = `${title} (through Vercel)`;\n            // <- TODO: [🧈] Maybe standartize the suffix\n        } /* not else */\n        if (description === undefined) {\n            description = `Implementation of ${title} through Vercel`;\n        } /* not else */\n        if (!/Vercel/i.test(description)) {\n            description = `${description} (through Vercel)`;\n            // <- TODO: [🧈] Maybe standartize the suffix\n        } /* not else */\n        return {\n            title,\n            description,\n            profile: VERCEL_PROVIDER_PROFILE,\n            checkConfiguration() {\n                // Note: There is no way how to check configuration of Vercel provider\n                return Promise.resolve();\n            },\n            async listModels() {\n                return availableModels;\n            },\n            async callChatModel(prompt) {\n                var _a;\n                const { content, parameters, modelRequirements } = prompt;\n                if (modelRequirements.modelVariant !== 'CHAT') {\n                    throw new PipelineExecutionError('Use callChatModel only for CHAT variant');\n                }\n                const modelName = modelRequirements.modelName ||\n                    ((_a = availableModels.find(({ modelVariant }) => modelVariant === 'CHAT')) === null || _a === void 0 ? void 0 : _a.modelName);\n                if (!modelName) {\n                    throw new PipelineExecutionError(spaceTrim__default[\"default\"](`\n                        Can not determine which model to use.\n\n                        You need to provide at least one of:\n                        1) In \\`createExecutionToolsFromVercelProvider\\` options, provide \\`availableModels\\` with at least one model\n                        2) In \\`prompt.modelRequirements\\`, provide \\`modelName\\` with the name of the model to use\n\n                    `));\n                }\n                const model = await vercelProvider.chat(modelName, {\n                    user: (userId === null || userId === void 0 ? void 0 : userId.toString()) || undefined,\n                    ...additionalChatSettings,\n                });\n                const rawPromptContent = templateParameters(content, { ...parameters, modelName });\n                // Support for passing a chat thread (multi-message conversation)\n                let promptMessages;\n                if ('thread' in prompt && Array.isArray(prompt.thread)) {\n                    promptMessages = prompt.thread.map((msg) => ({\n                        role: msg.role === 'assistant' ? 'assistant' : msg.role === 'system' ? 'system' : 'user',\n                        content: [\n                            {\n                                type: 'text',\n                                text: msg.content,\n                            },\n                        ],\n                    }));\n                }\n                else {\n                    promptMessages = [\n                        ...(modelRequirements.systemMessage === undefined\n                            ? []\n                            : [\n                                {\n                                    role: 'system',\n                                    content: modelRequirements.systemMessage,\n                                },\n                            ]),\n                        {\n                            role: 'user',\n                            content: [\n                                {\n                                    type: 'text',\n                                    text: rawPromptContent,\n                                },\n                            ],\n                        },\n                    ];\n                }\n                const rawRequest = {\n                    // <- TODO: [☂]\n                    inputFormat: 'messages',\n                    mode: {\n                        type: 'regular',\n                        tools: [\n                        /* <- TODO: Pass the tools */\n                        ],\n                    },\n                    prompt: promptMessages,\n                };\n                const start = $getCurrentDate();\n                if (options.isVerbose) {\n                    console.info(colors__default[\"default\"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));\n                }\n                const rawResponse = await (async () => await model.doGenerate(rawRequest))().catch((error) => {\n                    // <- Note: This weird structure is here to catch errors in both sync and async `doGenerate`\n                    if (options.isVerbose) {\n                        console.info(colors__default[\"default\"].bgRed('error'), error);\n                    }\n                    throw error;\n                });\n                await model.doGenerate(rawRequest);\n                if (options.isVerbose) {\n                    console.info(colors__default[\"default\"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));\n                }\n                if (rawResponse.text === undefined) {\n                    throw new PipelineExecutionError('No response message');\n                }\n                const complete = $getCurrentDate();\n                const usage = {\n                    price: UNCERTAIN_ZERO_VALUE,\n                    input: {\n                        tokensCount: uncertainNumber(rawResponse.usage.promptTokens),\n                        ...computeUsageCounts(rawPromptContent),\n                    },\n                    output: {\n                        tokensCount: uncertainNumber(rawResponse.usage.completionTokens),\n                        ...computeUsageCounts(rawResponse.text),\n                    },\n                };\n                return exportJson({\n                    name: 'promptResult',\n                    message: `Result of \\`createExecutionToolsFromVercelProvider.callChatModel\\``,\n                    value: {\n                        content: rawResponse.text,\n                        modelName,\n                        timing: {\n                            start,\n                            complete,\n                        },\n                        usage,\n                        rawPromptContent,\n                        rawRequest,\n                        rawResponse: asSerializable(rawResponse),\n                        // <- [🗯]\n                    },\n                });\n            },\n        };\n    }\n\n    exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;\n    exports.PROMPTBOOK_ENGINE_VERSION = PROMPTBOOK_ENGINE_VERSION;\n    exports.createExecutionToolsFromVercelProvider = createExecutionToolsFromVercelProvider;\n\n    Object.defineProperty(exports, '__esModule', { value: true });\n\n}));\n\n"]}