{"version":3,"file":"index.umd.production.min.cjs","sources":["../src/utils.ts","../src/split.ts","../src/parser.ts","../src/png.ts","../src/handler.ts","../src/types.ts","../src/index.ts"],"sourcesContent":["import { crlf } from 'crlf-normalize';\nimport { IBuffer } from './types';\n\nexport function inputToBytes(png: IBuffer | string)\n{\n\t/**\n\t * if (typeof Buffer !== 'undefined' && Buffer.isBuffer(png))\n\t *   {\n\t *     bytes = Uint8Array.from(png)\n\t *     bin_str = png.toString()\n\t *   }\n\t *   else if (png instanceof Uint8Array)\n\t *   {\n\t *     bytes = png\n\t *     bin_str = png.toString()\n\t *   }\n\t */\n\tif (typeof Buffer !== 'undefined' && Buffer.isBuffer(png) || png instanceof Uint8Array)\n\t{\n\t\treturn png\n\t}\n\n\t/**\n\t * bin_str = atob(png.slice(0, 8192))\n\t * bytes = Uint8Array.from(bin_str, c => c.charCodeAt(0))\n\t */\n\treturn Uint8Array.from(atob(png.slice(0, 8192)), c => c.charCodeAt(0))\n}\n\n/**\n * get int32 from png compensating for endianness\n */\nexport function i32(a: IBuffer, i: number)\n{\n\treturn new Uint32Array(new Uint8Array([...a.slice(i, i + 4)].reverse()).buffer)[0];\n}\n\nexport function _normalizeInputRaw(raw_info: string)\n{\n\traw_info = crlf(raw_info)\n\t\t.replace(/[ \\t\\xa0]+(?=\\n)/g, '')\n\t\t.replace(/\\n{3,}/g, '\\n\\n')\n\t\t.replace(/^[\\r\\n]+|[\\s\\r\\n]+$/g, '')\n\t;\n\n\treturn raw_info\n}\n\nexport function _isInfoLine(line: string)\n{\n\treturn line.startsWith('Steps: ')\n}\n","/**\n * \\n\n */\nexport const RE_LINE_SPLIT_BASE = /\\r?\\n/;\n/**\n * ```\n * \\x00\\x00\\x00\\n\n * \\u200b\\u200b\\u200b\\n zero-width space\n * ```\n */\nexport const RE_LINE_SPLIT_PLUS = /(?:\\x00\\x00\\x00|\\u200b\\u200b\\u200b)\\r?\\n/;\n\n/**\n * Splits a raw string into an array of lines.\n *\n * @param raw_info - The raw string to split into lines.\n * @returns An array of lines extracted from the raw string.\n *\n * @example\n * ```typescript\n * const rawInfo = \"line1\\nline2\\r\\nline3\";\n * const lines = _splitRawToLines(rawInfo);\n * console.log(lines); // Output: [\"line1\", \"line2\", \"line3\"]\n * ```\n */\nexport function _splitRawToLines(raw_info: string)\n{\n\treturn raw_info.split(_isRawVersionPlus(raw_info) ? RE_LINE_SPLIT_PLUS : RE_LINE_SPLIT_BASE)\n}\n\n/**\n * Checks if the given raw string is in \"\\x00\\x00\\x00\\n\" format.\n *\n * @see https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15713\n *\n * @param raw_info - The raw string to check.\n * @returns A boolean indicating whether the raw string is in \"\\x00\\x00\\x00\\n\" format.\n *\n * @example\n * ```typescript\n * const rawInfo = \"line1\\nline2\\x00\\x00\\x00\\r\\nline3\";\n * const isPlusFormat = _isRawVersionPlus(rawInfo);\n * console.log(isPlusFormat); // Output: true\n * ```\n */\nexport function _isRawVersionPlus(raw_info: string)\n{\n\treturn RE_LINE_SPLIT_PLUS.test(raw_info)\n}\n","import { splitSmartly } from 'split-smartly2';\nimport { _isRawVersionPlus, _splitRawToLines } from './split';\nimport { _isInfoLine, _normalizeInputRaw } from './utils';\n\n/**\n * `${key}: ${value}`\n */\nexport function _parseLine(line: string)\n{\n\tconst [, key, value] = line.match(/^([^:]+)\\s*:\\s*(.*)$/);\n\treturn [key, value] as const\n}\n\n/**\n * Parses an info line into key-value pairs.\n *\n * @param infoline - The info line to parse.\n * @returns An array of tuples, where each tuple contains a key-value pair.\n *\n * @remarks\n * This function uses the `splitSmartly` function from the 'split-smartly2' package to split the info line into key-value pairs.\n * The info line is expected to be in the format `${key}: ${value}`, separated by commas.\n * The `splitSmartly` function is configured to handle nested brackets and trim separators.\n *\n * @example\n * ```typescript\n * const infoLine = 'key1: value1, key2: value2, key3: value3';\n * const result = _parseInfoLine(infoLine);\n * // result: [['key1', 'value1'], ['key2', 'value2'], ['key3', 'value3']]\n * ```\n */\nexport function _parseInfoLine(infoline: string)\n{\n\treturn [..._parseInfoLineGenerator(infoline)]\n}\n\nexport function* _parseInfoLineGenerator(infoline: string)\n{\n\tinfoline = _normalizeInputRaw(infoline);\n\n\tconst entries = splitSmartly(infoline, [','], {\n\t\tbrackets: true,\n\t\ttrimSeparators: true,\n\t}) as string[];\n\n\t//let list: (readonly [string, string])[] = [];\n\n\tfor (let line of entries)\n\t{\n\t\t/**\n\t\t * avoid empty line\n\t\t */\n\t\tif (line?.length)\n\t\t{\n\t\t\tconst entry = _parseLine(line);\n\t\t\tyield entry\n\t\t}\n\t}\n\n\treturn void 0 as void\n}\n\n/**\n * Extracts prompt, negative prompt, info line, and extra info from a raw info string.\n *\n * @param raw_info - The raw info string to extract data from.\n * @returns An object containing the extracted prompt, negative prompt, info line, extra info, and the original lines.\n *\n * @throws Will throw a TypeError if the raw info string is in Plus version and contains more than 3 lines.\n *\n * @remarks\n * This function first checks if the raw info string is in Plus version using the `_isRawVersionPlus` function.\n * It then splits the raw info string into lines using the `_splitRawToLines` function.\n * Depending on the version, it extracts the prompt, negative prompt, info line, and extra info.\n * If the raw info string is in Plus version, it follows a specific order to extract the data.\n * If the raw info string is not in Plus version, it uses the `findIndex` method to find the indices of the negative prompt and steps,\n * and then extracts the data accordingly.\n * Finally, it returns an object containing the extracted data and the original lines.\n *\n * @example\n * ```typescript\n * const rawInfo = 'Prompt:...\\nNegative prompt:...\\nSteps:...';\n * const result = extractPromptAndInfoFromRaw(rawInfo);\n * // result: {\n * //   prompt: '...',\n * //   negative_prompt: '...',\n * //   infoline: 'Steps:...',\n * //   infoline_extra: [],\n * //   lines_raw: ['Prompt:...', 'Negative prompt:...', 'Steps:...'],\n * // }\n * ```\n */\nexport function extractPromptAndInfoFromRaw(raw_info: string)\n{\n\traw_info = _normalizeInputRaw(raw_info);\n\n\tconst isPlus = _isRawVersionPlus(raw_info);\n\tlet lines = _splitRawToLines(raw_info);\n\n\tlet prompt: string = '';\n\tlet negative_prompt: string = '';\n\tlet infoline: string = '';\n\tlet infoline_extra: string[] = [];\n\n\tconst lines_raw = lines.slice();\n\n\tif (lines.length)\n\t{\n\t\tif (isPlus)\n\t\t{\n\t\t\tconst line_len = lines.length;\n\n\t\t\tif (line_len > 3)\n\t\t\t{\n\t\t\t\tthrow new TypeError()\n\t\t\t}\n\n\t\t\tlet line = lines.pop();\n\n\t\t\tif (line_len === 2)\n\t\t\t{\n\t\t\t\tlet _ls = line.split('\\n');\n\n\t\t\t\tif (_ls.length > 1 && _isInfoLine(_ls[_ls.length - 1]))\n\t\t\t\t{\n\t\t\t\t\tline = _ls.pop();\n\t\t\t\t\tlines.push(_ls.join('\\n'));\n\t\t\t\t}\n\t\t\t\tconsole.dir(line.split('\\n'))\n\t\t\t}\n\n\t\t\tif (_isInfoLine(line))\n\t\t\t{\n\t\t\t\tinfoline = line;\n\t\t\t\tline = void 0\n\t\t\t}\n\n\t\t\tline ??= lines.pop();\n\n\t\t\tif (line.startsWith('Negative prompt: '))\n\t\t\t{\n\t\t\t\tnegative_prompt = line.slice('Negative prompt: '.length);\n\t\t\t\tline = void 0\n\t\t\t}\n\n\t\t\tline ??= lines.pop();\n\n\t\t\tprompt = line;\n\n\t\t\tif (lines.length)\n\t\t\t{\n\t\t\t\tthrow new TypeError()\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlet line = lines[lines.length - 1];\n\t\t\tif (line.startsWith('Steps: '))\n\t\t\t{\n\t\t\t\tinfoline = lines.pop();\n\t\t\t\tline = void 0\n\t\t\t}\n\n\t\t\tif (lines.length)\n\t\t\t{\n\t\t\t\tlet idx = -1;\n\t\t\t\tfor (let i = lines.length - 1; i >= 0; i--)\n\t\t\t\t{\n\t\t\t\t\tline = lines[i];\n\t\t\t\t\tif (line.startsWith('Negative prompt: '))\n\t\t\t\t\t{\n\t\t\t\t\t\tidx = i;\n\t\t\t\t\t\tlines[i] = line.slice('Negative prompt: '.length);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (idx !== -1)\n\t\t\t\t{\n\t\t\t\t\tnegative_prompt = lines.splice(idx).join('\\n');\n\t\t\t\t}\n\n\t\t\t\tprompt = lines.join('\\n');\n\t\t\t}\n\t\t}\n\n\t\tprompt = prompt.replace(/\\x00\\x00\\x00/g, '');\n\t\tnegative_prompt = negative_prompt.replace(/\\x00\\x00\\x00/g, '');\n\t}\n\n\treturn {\n\t\tprompt,\n\t\tnegative_prompt,\n\t\tinfoline,\n\t\tinfoline_extra,\n\t\tlines_raw,\n\t}\n}\n","import { i32 } from './utils';\n\nconst BYTES_pngmagic = '137,80,78,71,13,10,26,10';\nconst BYTES_tEXt = Uint8Array.from('tEXt', c => c.charCodeAt(0)).join(',');\n\nconst OFFSET_parameters = \"parameters\\u0000\".length\n\nexport function uint8arrayToString(uint8array: Uint8Array)\n{\n\treturn new TextDecoder().decode(uint8array)\n}\n\n/**\n * ```\n * new TextEncoder().encode(inputString)\n * String.fromCharCode(...raw_info)\n * ```\n */\nexport function stringToUint8Array(inputString: string)\n{\n\treturn new TextEncoder().encode(inputString);\n}\n\n/**\n * Extracts raw data from a PNG byte array.\n *\n * @param bytes - The Uint8Array containing the PNG data.\n * @returns An object containing the width, height, and raw_info extracted from the PNG data,\n *          or `undefined` if the PNG data does not contain a valid tEXt chunk.\n */\nexport function extractRawFromBytes(bytes: Uint8Array)\n{\n\t// Check if the bytes represent a valid PNG file by comparing the magic number\n\tconst pngmagic = bytes.slice(0, 8).join(',') === BYTES_pngmagic\n\tif (!pngmagic) return undefined\n\n\t// Extract the width, height, and IHDR size from the PNG data\n\tconst [ihdrSize, width, height] = [i32(bytes, 8), i32(bytes, 16), i32(bytes, 20)];\n\n\t// Calculate the offset of the tEXt chunk in the PNG data\n\tconst txtOffset = 8 + ihdrSize + 12;\n\n\t// Check if the tEXt chunk is present by comparing the chunk type\n\tif (bytes.slice(txtOffset + 4, txtOffset + 8).join(',') !== BYTES_tEXt) return undefined\n\n\t// Extract the size of the tEXt chunk data\n\tconst txtSize = i32(bytes, txtOffset);\n\n\t// Extract the raw_info data from the tEXt chunk\n\tconst raw_info = bytes.slice(txtOffset + 8 + OFFSET_parameters, txtOffset + 8 + txtSize);\n\n\t// Convert the raw_info data to a string\n\tconst raw_info_str = uint8arrayToString(raw_info);\n\n\t// Return the extracted data\n\treturn {\n\t\twidth,\n\t\theight,\n\t\traw_info: raw_info_str,\n\t}\n}\n","import { IOptionsInfoparser } from './index';\n\nexport function keyToSnakeStyle1(key: string)\n{\n\treturn key.toLowerCase().replace(/ /g, '_')\n}\n\nexport function handleInfoEntries(entries: Iterable<readonly [string, string]>, opts?: IOptionsInfoparser)\n{\n\treturn [...handleInfoEntriesGenerator(entries, opts)]\n}\n\nexport function* handleInfoEntriesGenerator(entries: Iterable<readonly [string, string]>, opts?: IOptionsInfoparser)\n{\n\tfor (const entry of entries)\n\t{\n\t\tyield handleInfoEntry(entry, opts)\n\t}\n}\n\nexport function handleInfoEntry(entry: readonly [string, string], opts?: IOptionsInfoparser)\n{\n\tconst cast_to_snake = opts?.cast_to_snake;\n\tconst re = /^0\\d/;\n\n\tlet [key, value] = entry;\n\n\tconst asNum = parseFloat(value);\n\tconst isNotNum = (re.test(value)) || isNaN(asNum) || ((value as any as number) - asNum) !== 0;\n\n\tif (cast_to_snake) key = keyToSnakeStyle1(key)\n\n\tconst out = [key, isNotNum ? value : asNum] as const;\n\treturn out\n}\n","\nexport const enum EnumInfoKey\n{\n\tprompt = 'prompt',\n\tnegative_prompt = 'negative_prompt',\n}\n\nexport type IBuffer = Uint8Array | Buffer;\n","import { inputToBytes } from './utils';\nimport { _parseInfoLineGenerator, extractPromptAndInfoFromRaw } from './parser';\nimport { extractRawFromBytes } from './png';\nimport { handleInfoEntriesGenerator } from './handler';\nimport { EnumInfoKey, IBuffer } from './types';\n\nexport * from './handler';\nexport * from './parser';\nexport * from './png';\nexport * from './split';\nexport * from './types';\nexport * from './utils';\n\nexport interface IOptionsInfoparser\n{\n\tcast_to_snake?: boolean;\n\t/**\n\t * If true, prompt and negative_prompt are included in the input\n\t */\n\tisIncludePrompts?: boolean;\n}\n\nexport interface IRecordInfo\n{\n\t[EnumInfoKey.prompt]: string;\n\t[EnumInfoKey.negative_prompt]: string;\n\n\t[k: string]: string | number;\n}\n\n/**\n * Parses raw info line and returns an object with the extracted data.\n *\n * @param line - The raw info line to parse.\n * @param opts - Optional parameters.\n * @param opts.cast_to_snake - If true, keys will be converted to snake_case. Default is false.\n * @param opts.isIncludePrompts - If true, prompt and negative_prompt will be included in the result. Default is false.\n *\n * @returns An object containing the extracted data.\n *\n * @example\n * ```typescript\n * const rawInfo = \"my prompt, Negative prompt: my negative prompt, width: 512, height: 512\";\n * const parsedData = parseFromRawInfo(rawInfo, { isIncludePrompts: true });\n * console.log(parsedData);\n * // Output: { prompt: 'my prompt', Negative prompt: 'my negative prompt', width: 512, height: 512 }\n * ```\n */\nexport function parseFromRawInfo(line: string, opts?: IOptionsInfoparser)\n{\n\treturn Object.fromEntries([...parseFromRawInfoGenerator(line, opts)]) as IRecordInfo\n}\n\nexport function* parseFromRawInfoGenerator(line: string, opts?: IOptionsInfoparser): Generator<readonly [string, string | number] | readonly [EnumInfoKey, string], void, void>\n{\n\tif (opts?.isIncludePrompts)\n\t{\n\t\tconst {\n\t\t\tprompt,\n\t\t\tnegative_prompt,\n\t\t\tinfoline,\n\t\t} = extractPromptAndInfoFromRaw(line);\n\n\t\tyield [EnumInfoKey.prompt as const, prompt] as const\n\t\tyield [EnumInfoKey.negative_prompt as const, negative_prompt] as const;\n\t\tline = infoline;\n\t}\n\n\tyield* handleInfoEntriesGenerator(_parseInfoLineGenerator(line), opts)\n}\n\n/**\n * @example\n * import fs from 'fs/promises'\n * import parseFromImageBuffer from '@bluelovers/auto1111-pnginfo'\n *\n * const file = await fs.readFile('generate_waifu.png')\n * const info = parseFromImageBuffer(file)\n *\n * console.log(info)\n */\nexport function parseFromImageBuffer(png: IBuffer | string, cast_to_snake = false)\n{\n\tlet bytes = inputToBytes(png) as Uint8Array;\n\n\tconst raw = extractRawFromBytes(bytes);\n\tif (!raw) return;\n\n\tconst {\n\t\traw_info,\n\t\twidth,\n\t\theight,\n\t} = raw;\n\n\tconst {\n\t\tprompt,\n\t\tnegative_prompt,\n\t\tinfoline,\n\t\tinfoline_extra,\n\t\t//lines_raw,\n\t} = extractPromptAndInfoFromRaw(raw_info as any)\n\n\tlet data = parseFromRawInfo(infoline, {\n\t\tcast_to_snake,\n\t});\n\n\tlet output = {\n\t\tmetadata: {\n\t\t\twidth,\n\t\t\theight,\n\t\t\textra: infoline_extra,\n\t\t\traw_info,\n\t\t},\n\t\tpnginfo: {\n\t\t\tprompt,\n\t\t\tnegative_prompt,\n\t\t\t...data,\n\t\t},\n\t}\n\n\treturn output\n}\n\nexport default parseFromImageBuffer\n"],"names":["inputToBytes","png","Buffer","isBuffer","Uint8Array","from","atob","slice","c","charCodeAt","i32","a","i","Uint32Array","reverse","buffer","_normalizeInputRaw","raw_info","crlf","replace","_isInfoLine","line","startsWith","RE_LINE_SPLIT_BASE","RE_LINE_SPLIT_PLUS","_splitRawToLines","split","_isRawVersionPlus","test","_parseLine","key","value","match","_parseInfoLineGenerator","infoline","entries","splitSmartly","brackets","trimSeparators","length","entry","extractPromptAndInfoFromRaw","isPlus","lines","prompt","negative_prompt","lines_raw","_line","_line2","line_len","TypeError","pop","_ls","push","join","console","dir","idx","splice","infoline_extra","BYTES_pngmagic","BYTES_tEXt","OFFSET_parameters","uint8arrayToString","uint8array","TextDecoder","decode","extractRawFromBytes","bytes","ihdrSize","width","height","txtOffset","txtSize","keyToSnakeStyle1","toLowerCase","handleInfoEntriesGenerator","opts","handleInfoEntry","cast_to_snake","asNum","parseFloat","isNotNum","isNaN","EnumInfoKey","parseFromRawInfo","Object","fromEntries","parseFromRawInfoGenerator","isIncludePrompts","parseFromImageBuffer","raw","metadata","extra","pnginfo","exports","_parseInfoLine","handleInfoEntries","stringToUint8Array","inputString","TextEncoder","encode"],"m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