ilx1-x-tool 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -308,172 +308,182 @@ interface IConfig {
308
308
  /********************************************************************************
309
309
  * @brief: 图像处理工具函数库主对象
310
310
  ********************************************************************************/
311
- declare const ImageToHexArray: {
312
- /********************************************************************************
313
- * @brief: 生成十六进制数组
314
- * @param {string} picData - base64图像数据
315
- * @param {number} thresholdData - 阈值
316
- * @param {Array} config - 配置数组
317
- * @return {Promise<Array|Uint8Array>} 十六进制数组
318
- ********************************************************************************/
319
- generate: (picData: string, thresholdData: number, config: number[]) => Promise<Uint8Array>;
320
- /********************************************************************************
321
- * @brief: ImageData 对象转 hexArray
322
- * @param {ImageData} imageData - 图像数据对象
323
- * @param {number} threshold - 阈值
324
- * @param {Array} config - 配置数组
325
- * @return {Uint8Array} 处理后的字节数组
326
- ********************************************************************************/
327
- imageDataToHexArray: (imageData: ImageData, threshold: number, config: number[]) => Uint8Array;
328
- /********************************************************************************
329
- * @brief: 彩色图像取模 (RGB565格式)
330
- * @param {Uint8ClampedArray} pixels - 像素数组
331
- * @param {number} width - 图像宽度
332
- * @param {number} height - 图像高度
333
- * @param {Array} config - 配置数组
334
- * @return {Uint8Array} RGB565格式的字节数组
335
- ********************************************************************************/
336
- colorImageSampling: (pixels: Uint8ClampedArray, width: number, height: number, config: number[]) => Uint8Array;
337
- /********************************************************************************
338
- * @brief: 逐行式取模 (从左到右,从上到下)
339
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
340
- * @param {number} width - 图像宽度
341
- * @param {number} height - 图像高度
342
- * @param {Array} config - 配置数组
343
- * @return {Uint8Array} 取模后的字节数组
344
- ********************************************************************************/
345
- ImageSamplingRow: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
346
- /********************************************************************************
347
- * @brief: 逐列式取模 (从上到下,从左到右)
348
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
349
- * @param {number} width - 图像宽度
350
- * @param {number} height - 图像高度
351
- * @param {Array} config - 配置数组
352
- * @return {Uint8Array} 取模后的字节数组
353
- ********************************************************************************/
354
- ImageSamplingCol: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
355
- /********************************************************************************
356
- * @brief: 列行式取模 (先列后行)
357
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
358
- * @param {number} width - 图像宽度
359
- * @param {number} height - 图像高度
360
- * @param {Array} config - 配置数组
361
- * @return {Uint8Array} 取模后的字节数组
362
- ********************************************************************************/
363
- ImageSamplingColRow: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
364
- /********************************************************************************
365
- * @brief: 行列式取模 (先行后列)
366
- * @param {Array} unpackedBuffer - 解压后的像素缓冲区
367
- * @param {number} width - 图像宽度
368
- * @param {number} height - 图像高度
369
- * @param {Array} config - 配置数组
370
- * @return {Uint8Array} 取模后的字节数组
371
- ********************************************************************************/
372
- ImageSamplingRowCol: (unpackedBuffer: number[], width: number, height: number, config: number[]) => Uint8Array;
373
- /********************************************************************************
374
- * @brief: base64 ImageData 对象
375
- * @param {string} base64Data - base64编码的图像数据
376
- * @return {Promise<ImageData>} ImageData对象
377
- ********************************************************************************/
378
- base64ToImageData: (base64Data: string) => Promise<ImageData>;
379
- /********************************************************************************
380
- * @brief: 使用 Konva.js 缩放图像
381
- * @param {number} width - 目标宽度
382
- * @param {number} height - 目标高度
383
- * @param {HTMLImageElement} image - 源图像对象
384
- * @param {boolean} colorMode - 是否转换为灰度
385
- * @return {Promise<string>} base64编码的缩放后图像
386
- ********************************************************************************/
387
- resizeImageWithKonva: (width: number, height: number, image: HTMLImageElement, colorMode: boolean) => Promise<string>;
388
- /********************************************************************************
389
- * @brief: 使用 Canvas API 缩放图像 (Konva不可用时的备选方案)
390
- * @param {number} width - 目标宽度
391
- * @param {number} height - 目标高度
392
- * @param {HTMLImageElement} image - 源图像对象
393
- * @param {boolean} colorMode - 是否转换为灰度
394
- * @return {Promise<string>} base64编码的缩放后图像
395
- ********************************************************************************/
396
- resizeImageWithCanvas: (width: any, height: any, image: any, colorMode: any) => Promise<unknown>;
397
- /********************************************************************************
398
- * @brief: Uint8Array 转十六进制字符串
399
- * @param {Uint8Array} array - 字节数组
400
- * @return {string} 十六进制字符串
401
- ********************************************************************************/
402
- arrayToHex: (array: any) => string;
403
- /********************************************************************************
404
- * @brief: 十六进制数据加 '0x' 前缀
405
- * @param {string} hex - 十六进制字符串
406
- * @return {Array<string>} 带0x前缀的十六进制数组
407
- ********************************************************************************/
408
- hex2hex: (hex: string) => Array<string>;
409
- /********************************************************************************
410
- * @brief: 生成取模预览 (0=白点, 1=黑点)
411
- * @param {Uint8Array} unpackedBuffer - 解压后的像素缓冲区
412
- * @param {number} width - 图像宽度
413
- * @return {string} 预览字符串
414
- ********************************************************************************/
415
- generatePreview: (unpackedBuffer: Uint8Array, width: number) => string;
416
- /********************************************************************************
417
- * @brief: 创建图像数据对象(兼容性函数)
418
- * @param {number} width - 图像宽度
419
- * @param {number} height - 图像高度
420
- * @param {Uint8ClampedArray} data - 像素数据
421
- * @return {ImageData} ImageData对象
422
- ********************************************************************************/
423
- createImageData: (width: number, height: number, data?: Uint8ClampedArray) => ImageData;
424
- /********************************************************************************
425
- * @brief: 将字节数组格式化为可读字符串
426
- * @param {Uint8Array|Array} hexArray - 十六进制数组
427
- * @param {number} format - 输出格式 (0=带0x前缀, 1=原始数组)
428
- * @param {number} lineBreak - 每行显示的字节数
429
- * @return {string} 格式化后的字符串
430
- ********************************************************************************/
431
- formatHexOutput: (hexArray: Uint8Array | Array<string>, format?: number, lineBreak?: number) => string;
432
- /********************************************************************************
433
- * @brief: 计算输出字节数
434
- * @param {Uint8Array|Array} hexArray - 十六进制数组
435
- * @return {Object} 包含字节数和KB数的对象
436
- ********************************************************************************/
437
- calculateOutputSize: (hexArray: Uint8Array | Array<string>) => {
438
- bytes: number;
439
- kilobytes: number;
440
- formatted: string;
441
- };
442
- /********************************************************************************
443
- * @brief: 获取取模方式描述
444
- * @param {number} mode - 取模方式代码
445
- * @return {string} 取模方式描述
446
- ********************************************************************************/
447
- getSamplingModeDescription: (mode: number) => string;
448
- /********************************************************************************
449
- * @brief: 获取配置数组的默认值
450
- * @param: 无
451
- * @return {Array} 默认配置数组
452
- ********************************************************************************/
453
- getDefaultConfig: () => number[];
311
+ /********************************************************************************
312
+ * @brief: 生成十六进制数组
313
+ * @param {string} picData - base64图像数据
314
+ * @param {number} thresholdData - 阈值
315
+ * @param {Array} config - 配置数组
316
+ * @return {Promise<Array|Uint8Array>} 十六进制数组
317
+ ********************************************************************************/
318
+ declare function generate(picData: string, thresholdData: number, config: number[]): Promise<Uint8Array | string[]>;
319
+ /********************************************************************************
320
+ * @brief: ImageData 对象转 hexArray
321
+ * @param {ImageData} imageData - 图像数据对象
322
+ * @param {number} threshold - 阈值
323
+ * @param {Array} config - 配置数组
324
+ * @return {Uint8Array} 处理后的字节数组
325
+ ********************************************************************************/
326
+ declare function imageDataToHexArray(imageData: ImageData, threshold: number, config: number[]): Uint8Array;
327
+ /********************************************************************************
328
+ * @brief: 彩色图像取模 (RGB565格式)
329
+ * @param {Uint8ClampedArray} pixels - 像素数组
330
+ * @param {number} width - 图像宽度
331
+ * @param {number} height - 图像高度
332
+ * @param {Array} config - 配置数组
333
+ * @return {Uint8Array} RGB565格式的字节数组
334
+ ********************************************************************************/
335
+ declare function colorImageSampling(pixels: Uint8ClampedArray, width: number, height: number, config: number[]): Uint8Array;
336
+ /********************************************************************************
337
+ * @brief: 逐行式取模 (从左到右,从上到下)
338
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
339
+ * @param {number} width - 图像宽度
340
+ * @param {number} height - 图像高度
341
+ * @param {Array} config - 配置数组
342
+ * @return {Uint8Array} 取模后的字节数组
343
+ ********************************************************************************/
344
+ declare function ImageSamplingRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
345
+ /********************************************************************************
346
+ * @brief: 逐列式取模 (从上到下,从左到右)
347
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
348
+ * @param {number} width - 图像宽度
349
+ * @param {number} height - 图像高度
350
+ * @param {Array} config - 配置数组
351
+ * @return {Uint8Array} 取模后的字节数组
352
+ ********************************************************************************/
353
+ declare function ImageSamplingCol(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
354
+ /********************************************************************************
355
+ * @brief: 列行式取模 (先列后行)
356
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
357
+ * @param {number} width - 图像宽度
358
+ * @param {number} height - 图像高度
359
+ * @param {Array} config - 配置数组
360
+ * @return {Uint8Array} 取模后的字节数组
361
+ ********************************************************************************/
362
+ declare function ImageSamplingColRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
363
+ /********************************************************************************
364
+ * @brief: 行列式取模 (先行后列)
365
+ * @param {Array} unpackedBuffer - 解压后的像素缓冲区
366
+ * @param {number} width - 图像宽度
367
+ * @param {number} height - 图像高度
368
+ * @param {Array} config - 配置数组
369
+ * @return {Uint8Array} 取模后的字节数组
370
+ ********************************************************************************/
371
+ declare function ImageSamplingRowCol(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array;
372
+ /********************************************************************************
373
+ * @brief: base64 转 ImageData 对象
374
+ * @param {string} base64Data - base64编码的图像数据
375
+ * @return {Promise<ImageData>} ImageData对象
376
+ ********************************************************************************/
377
+ declare function base64ToImageData(base64Data: string): Promise<ImageData>;
378
+ /********************************************************************************
379
+ * @brief: 调整图像大小
380
+ ********************************************************************************/
381
+ declare function resizeImage(width: number, height: number, imageSource: string | HTMLImageElement, colorMode: boolean): Promise<string>;
382
+ /********************************************************************************
383
+ * @brief: base64 Image 对象
384
+ * @param {string} base64
385
+ * @return {*}
386
+ ********************************************************************************/
387
+ declare const base64ToImage: (base64: string) => Promise<HTMLImageElement>;
388
+ /********************************************************************************
389
+ * @brief: 使用 Konva.js 缩放图像
390
+ * @param {number} width - 目标宽度
391
+ * @param {number} height - 目标高度
392
+ * @param {HTMLImageElement} image - 源图像对象
393
+ * @param {boolean} colorMode - 是否转换为灰度
394
+ * @return {Promise<string>} base64编码的缩放后图像
395
+ ********************************************************************************/
396
+ declare function resizeImageWithKonva(width: number, height: number, image: HTMLImageElement, colorMode: boolean): Promise<string>;
397
+ /********************************************************************************
398
+ * @brief: 使用 Canvas API 缩放图像 (Konva不可用时的备选方案)
399
+ * @param {number} width - 目标宽度
400
+ * @param {number} height - 目标高度
401
+ * @param {HTMLImageElement} image - 源图像对象
402
+ * @param {boolean} colorMode - 是否转换为灰度
403
+ * @return {Promise<string>} base64编码的缩放后图像
404
+ ********************************************************************************/
405
+ declare function resizeImageWithCanvas(width: any, height: any, image: any, colorMode: any): Promise<string>;
406
+ /********************************************************************************
407
+ * @brief: Uint8Array 转十六进制字符串
408
+ * @param {Uint8Array} array - 字节数组
409
+ * @return {string} 十六进制字符串
410
+ ********************************************************************************/
411
+ declare function arrayToHex(array: any): string;
412
+ /********************************************************************************
413
+ * @brief: 十六进制数据加 '0x' 前缀
414
+ * @param {string} hex - 十六进制字符串
415
+ * @return {Array<string>} 带0x前缀的十六进制数组
416
+ ********************************************************************************/
417
+ declare function hex2hex(hex: string): Array<string>;
418
+ /********************************************************************************
419
+ * @brief: 生成取模预览 (0=白点, 1=黑点)
420
+ * @param {Uint8Array} unpackedBuffer - 解压后的像素缓冲区
421
+ * @param {number} width - 图像宽度
422
+ * @return {string} 预览字符串
423
+ ********************************************************************************/
424
+ declare function generatePreview(unpackedBuffer: Uint8Array, width: number): string;
425
+ /********************************************************************************
426
+ * @brief: 创建图像数据对象(兼容性函数)
427
+ * @param {number} width - 图像宽度
428
+ * @param {number} height - 图像高度
429
+ * @param {Uint8ClampedArray} data - 像素数据
430
+ * @return {ImageData} ImageData对象
431
+ ********************************************************************************/
432
+ declare function createImageData(width: number, height: number, data?: Uint8ClampedArray): ImageData;
433
+ /********************************************************************************
434
+ * @brief: 将字节数组格式化为可读字符串
435
+ * @param {Uint8Array|Array} hexArray - 十六进制数组
436
+ * @param {number} format - 输出格式 (0=带0x前缀, 1=原始数组)
437
+ * @param {number} lineBreak - 每行显示的字节数
438
+ * @return {string} 格式化后的字符串
439
+ ********************************************************************************/
440
+ declare function formatHexOutput(hexArray: Uint8Array | Array<string>, format?: number, lineBreak?: number): string;
441
+ /********************************************************************************
442
+ * @brief: 计算输出字节数
443
+ * @param {Uint8Array|Array} hexArray - 十六进制数组
444
+ * @return {Object} 包含字节数和KB数的对象
445
+ ********************************************************************************/
446
+ declare function calculateOutputSize(hexArray: Uint8Array | Array<string>): {
447
+ bytes: number;
448
+ kilobytes: number;
449
+ formatted: string;
454
450
  };
455
451
  /********************************************************************************
456
- * @brief: 为了方便使用,单独导出每个函数
452
+ * @brief: 获取取模方式描述
453
+ * @param {number} mode - 取模方式代码
454
+ * @return {string} 取模方式描述
455
+ ********************************************************************************/
456
+ declare function getSamplingModeDescription(mode: number): string;
457
+ /********************************************************************************
458
+ * @brief: 获取配置数组的默认值
457
459
  * @param: 无
458
- * @return: 函数引用
459
- ********************************************************************************/
460
- declare const generate: any;
461
- declare const imageDataToHexArray: any;
462
- declare const colorImageSampling: any;
463
- declare const ImageSamplingRow: any;
464
- declare const ImageSamplingCol: any;
465
- declare const ImageSamplingColRow: any;
466
- declare const ImageSamplingRowCol: any;
467
- declare const base64ToImageData: any;
468
- declare const resizeImageWithKonva: any;
469
- declare const resizeImageWithCanvas: any;
470
- declare const arrayToHex: any;
471
- declare const hex2hex: any;
472
- declare const generatePreview: any;
473
- declare const createImageData: any;
474
- declare const formatHexOutput: any;
475
- declare const calculateOutputSize: any;
476
- declare const getSamplingModeDescription: any;
477
- declare const getDefaultConfig: any;
460
+ * @return {Array} 默认配置数组
461
+ ********************************************************************************/
462
+ declare function getDefaultConfig(): number[];
463
+ /********************************************************************************
464
+ * @brief: 图像处理工具函数库主对象(为了向后兼容)
465
+ ********************************************************************************/
466
+ declare const ImageToHexArray: {
467
+ generate: typeof generate;
468
+ imageDataToHexArray: typeof imageDataToHexArray;
469
+ colorImageSampling: typeof colorImageSampling;
470
+ ImageSamplingRow: typeof ImageSamplingRow;
471
+ ImageSamplingCol: typeof ImageSamplingCol;
472
+ ImageSamplingColRow: typeof ImageSamplingColRow;
473
+ ImageSamplingRowCol: typeof ImageSamplingRowCol;
474
+ base64ToImageData: typeof base64ToImageData;
475
+ resizeImage: typeof resizeImage;
476
+ base64ToImage: (base64: string) => Promise<HTMLImageElement>;
477
+ resizeImageWithKonva: typeof resizeImageWithKonva;
478
+ resizeImageWithCanvas: typeof resizeImageWithCanvas;
479
+ arrayToHex: typeof arrayToHex;
480
+ hex2hex: typeof hex2hex;
481
+ generatePreview: typeof generatePreview;
482
+ createImageData: typeof createImageData;
483
+ formatHexOutput: typeof formatHexOutput;
484
+ calculateOutputSize: typeof calculateOutputSize;
485
+ getSamplingModeDescription: typeof getSamplingModeDescription;
486
+ getDefaultConfig: typeof getDefaultConfig;
487
+ };
478
488
 
479
- export { type ConsoleType, Endianness, type Hex, type IConfig, ImageSamplingCol, ImageSamplingColRow, ImageSamplingRow, ImageSamplingRowCol, ImageToHexArray, type LoggerConfig, type ParsedColor, type ParsedHSL, type ParsedHSLA, type ParsedHSV, type ParsedRGB, type ParsedRGBA, type Result, arrayToHex, asciiArrToNum, base64ToImageData, bits16ToNum, bytesToNum, calculateOutputSize, closeAllNativePopover, closePopoverByID, colorImageSampling, compressJsonGzip, createImageData, debug, decompressJsonGzip, disableAllLogs, enableAllLogs, error, errorResult, formatHexOutput, generate, generatePreview, getDefaultConfig, getHIDCodeMapStr, getHIDCodeMapStrNum, getSamplingModeDescription, hex2hex, hidKeyCode, hslToHsv, hslToRgb, hsvToHsl, imageDataToHexArray, info, isImageValid, isShowPopover, log, numToAsciiArr, numToBits16, numToBytes, parseColorString, resetLoggerConfig, resizeImageWithCanvas, resizeImageWithKonva, rgbToHsl, setLoggerConfig, successResult, warn };
489
+ export { type ConsoleType, Endianness, type Hex, type IConfig, ImageSamplingCol, ImageSamplingColRow, ImageSamplingRow, ImageSamplingRowCol, ImageToHexArray, type LoggerConfig, type ParsedColor, type ParsedHSL, type ParsedHSLA, type ParsedHSV, type ParsedRGB, type ParsedRGBA, type Result, arrayToHex, asciiArrToNum, base64ToImage, base64ToImageData, bits16ToNum, bytesToNum, calculateOutputSize, closeAllNativePopover, closePopoverByID, colorImageSampling, compressJsonGzip, createImageData, debug, decompressJsonGzip, disableAllLogs, enableAllLogs, error, errorResult, formatHexOutput, generate, generatePreview, getDefaultConfig, getHIDCodeMapStr, getHIDCodeMapStrNum, getSamplingModeDescription, hex2hex, hidKeyCode, hslToHsv, hslToRgb, hsvToHsl, imageDataToHexArray, info, isImageValid, isShowPopover, log, numToAsciiArr, numToBits16, numToBytes, parseColorString, resetLoggerConfig, resizeImage, resizeImageWithCanvas, resizeImageWithKonva, rgbToHsl, setLoggerConfig, successResult, warn };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var A=Object.create;var S=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var r in t)S(e,r,{get:t[r],enumerable:!0})},C=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D(t))!O.call(e,a)&&a!==r&&S(e,a,{get:()=>t[a],enumerable:!(n=P(t,a))||n.enumerable});return e};var U=(e,t,r)=>(r=e!=null?A(M(e)):{},C(t||!e||!e.__esModule?S(r,"default",{value:e,enumerable:!0}):r,e)),H=e=>C(S({},"__esModule",{value:!0}),e);var Me={};F(Me,{Endianness:()=>y,ImageSamplingCol:()=>we,ImageSamplingColRow:()=>ye,ImageSamplingRow:()=>ke,ImageSamplingRowCol:()=>be,ImageToHexArray:()=>d,arrayToHex:()=>Ee,asciiArrToNum:()=>Z,base64ToImageData:()=>ve,bits16ToNum:()=>X,bytesToNum:()=>q,calculateOutputSize:()=>Ae,closeAllNativePopover:()=>$,closePopoverByID:()=>_,colorImageSampling:()=>xe,compressJsonGzip:()=>B,createImageData:()=>Ce,debug:()=>ue,decompressJsonGzip:()=>W,disableAllLogs:()=>he,enableAllLogs:()=>fe,error:()=>ce,errorResult:()=>j,formatHexOutput:()=>Le,generate:()=>me,generatePreview:()=>Te,getDefaultConfig:()=>De,getHIDCodeMapStr:()=>G,getHIDCodeMapStrNum:()=>N,getSamplingModeDescription:()=>Pe,hex2hex:()=>Ie,hidKeyCode:()=>I,hslToHsv:()=>ae,hslToRgb:()=>te,hsvToHsl:()=>ne,imageDataToHexArray:()=>pe,info:()=>le,isImageValid:()=>z,isShowPopover:()=>V,log:()=>ie,numToAsciiArr:()=>Y,numToBits16:()=>Q,numToBytes:()=>J,parseColorString:()=>ee,resetLoggerConfig:()=>ge,resizeImageWithCanvas:()=>Re,resizeImageWithKonva:()=>Se,rgbToHsl:()=>re,setLoggerConfig:()=>T,successResult:()=>K,warn:()=>de});module.exports=H(Me);var I=[{key:0,word:"a",dec:"4",hex:"04",kind:1,value:4,aliases:["A"]},{key:2,word:"b",dec:"5",hex:"05",kind:1,value:5,aliases:["B"]},{key:4,word:"c",dec:"6",hex:"06",kind:1,value:6,aliases:["C"]},{key:6,word:"d",dec:"7",hex:"07",kind:1,value:7,aliases:["D"]},{key:8,word:"e",dec:"8",hex:"08",kind:1,value:8,aliases:["E"]},{key:10,word:"f",dec:"9",hex:"09",kind:1,value:9,aliases:["F"]},{key:12,word:"g",dec:"10",hex:"0A",kind:1,value:10,aliases:["G"]},{key:14,word:"h",dec:"11",hex:"0B",kind:1,value:11,aliases:["H"]},{key:16,word:"i",dec:"12",hex:"0C",kind:1,value:12,aliases:["I"]},{key:18,word:"j",dec:"13",hex:"0D",kind:1,value:13,aliases:["J"]},{key:20,word:"k",dec:"14",hex:"0E",kind:1,value:14,aliases:["K"]},{key:22,word:"l",dec:"15",hex:"0F",kind:1,value:15,aliases:["L"]},{key:24,word:"m",dec:"16",hex:"10",kind:1,value:16,aliases:["M"]},{key:26,word:"n",dec:"17",hex:"11",kind:1,value:17,aliases:["N"]},{key:28,word:"o",dec:"18",hex:"12",kind:1,value:18,aliases:["O"]},{key:30,word:"p",dec:"19",hex:"13",kind:1,value:19,aliases:["P"]},{key:32,word:"q",dec:"20",hex:"14",kind:1,value:20,aliases:["Q"]},{key:34,word:"r",dec:"21",hex:"15",kind:1,value:21,aliases:["R"]},{key:36,word:"s",dec:"22",hex:"16",kind:1,value:22,aliases:["S"]},{key:38,word:"t",dec:"23",hex:"17",kind:1,value:23,aliases:["T"]},{key:40,word:"u",dec:"24",hex:"18",kind:1,value:24,aliases:["U"]},{key:42,word:"v",dec:"25",hex:"19",kind:1,value:25,aliases:["V"]},{key:44,word:"w",dec:"26",hex:"1A",kind:1,value:26,aliases:["W"]},{key:46,word:"x",dec:"27",hex:"1B",kind:1,value:27,aliases:["X"]},{key:48,word:"y",dec:"28",hex:"1C",kind:1,value:28,aliases:["Y"]},{key:50,word:"z",dec:"29",hex:"1D",kind:1,value:29,aliases:["Z"]},{key:52,word:"1",dec:"30",hex:"1E",kind:1,value:30,aliases:["!","1!"]},{key:54,word:"2",dec:"31",hex:"1F",kind:1,value:31,aliases:["@","2@"]},{key:56,word:"3",dec:"32",hex:"20",kind:1,value:32,aliases:["#","3#"]},{key:58,word:"4",dec:"33",hex:"21",kind:1,value:33,aliases:["$","4$"]},{key:60,word:"5",dec:"34",hex:"22",kind:1,value:34,aliases:["%","5%"]},{key:62,word:"6",dec:"35",hex:"23",kind:1,value:35,aliases:["^","6^"]},{key:64,word:"7",dec:"36",hex:"24",kind:1,value:36,aliases:["&","7&"]},{key:66,word:"8",dec:"37",hex:"25",kind:1,value:37,aliases:["*","8*"]},{key:68,word:"9",dec:"38",hex:"26",kind:1,value:38,aliases:["(","9("]},{key:70,word:"0",dec:"39",hex:"27",kind:1,value:39,aliases:[")","0)"]},{key:77,word:"-",dec:"45",hex:"2D",kind:1,value:45,aliases:["_","-_"]},{key:79,word:"=",dec:"46",hex:"2E",kind:1,value:46,aliases:["+","=+"]},{key:81,word:"[",dec:"47",hex:"2F",kind:1,value:47,aliases:["{","[{"]},{key:83,word:"]",dec:"48",hex:"30",kind:1,value:48,aliases:["}","}]"]},{key:85,word:"\\",dec:"49",hex:"31",kind:1,value:49,aliases:["|","\\|"]},{key:87,word:"`",dec:"50",hex:"32",kind:1,value:50,aliases:["~","`~"]},{key:89,word:";",dec:"51",hex:"33",kind:1,value:51,aliases:[":",";:"]},{key:91,word:"'",dec:"52",hex:"34",kind:1,value:52,aliases:['"',`'"`]},{key:95,word:",",dec:"54",hex:"36",kind:1,value:54,aliases:["<",",<"]},{key:97,word:".",dec:"55",hex:"37",kind:1,value:55,aliases:[">",".>"]},{key:99,word:"/",dec:"56",hex:"38",kind:1,value:56,aliases:["?","/?"]},{key:72,word:"Enter",dec:"40",hex:"28",kind:1,value:40,aliases:["enter","ENTER"]},{key:73,word:"Escape",dec:"41",hex:"29",kind:1,value:41,aliases:["escape","ESCAPE"]},{key:74,word:"Backspace",dec:"42",hex:"2A",kind:1,value:42,aliases:["backspace","backSpace","BACKSPACE","Back Space","BACK SPACE","back space"]},{key:75,word:"Tab",dec:"43",hex:"2B",kind:1,value:43,aliases:["tab","TAB"]},{key:76,word:" ",dec:"44",hex:"2C",kind:1,value:44,aliases:["Space","SPACE","space"]},{key:101,word:"CapsLock",dec:"57",hex:"39",kind:1,value:57,aliases:["capsLock","capslock","CAPSLOCK","Caps Lock","CAPS LOCK","caps lock"]},{key:102,word:"F1",dec:"58",hex:"3A",kind:1,value:58,aliases:["f1","f 1"]},{key:103,word:"F2",dec:"59",hex:"3B",kind:1,value:59,aliases:["f2","f 2"]},{key:104,word:"F3",dec:"60",hex:"3C",kind:1,value:60,aliases:["f3","f 3"]},{key:105,word:"F4",dec:"61",hex:"3D",kind:1,value:61,aliases:["f4","f 4"]},{key:106,word:"F5",dec:"62",hex:"3E",kind:1,value:62,aliases:["f5","f 5"]},{key:107,word:"F6",dec:"63",hex:"3F",kind:1,value:63,aliases:["f6","f 6"]},{key:108,word:"F7",dec:"64",hex:"40",kind:1,value:64,aliases:["f7","f 7"]},{key:109,word:"F8",dec:"65",hex:"41",kind:1,value:65,aliases:["f8","f 8"]},{key:110,word:"F9",dec:"66",hex:"42",kind:1,value:66,aliases:["f9","f 9"]},{key:111,word:"F10",dec:"67",hex:"43",kind:1,value:67,aliases:["f10","f 10"]},{key:112,word:"F11",dec:"68",hex:"44",kind:1,value:68,aliases:["f11","f 11"]},{key:113,word:"F12",dec:"69",hex:"45",kind:1,value:69,aliases:["f12","f 12"]},{key:114,word:"PrintScreen",dec:"70",hex:"46",kind:1,value:70,aliases:["printScreen","printscreen","PRINTSCREEN","Print Screen","PRINT SCREEN","print screen"]},{key:115,word:"ScrollLock",dec:"71",hex:"47",kind:1,value:71,aliases:["scrollLock","scrolllock","SCROLLLOCK","Scroll Lock","SCROLL LOCK","scroll lock"]},{key:116,word:"Pause",dec:"72",hex:"48",kind:1,value:72,aliases:["pause","PAUSE"]},{key:117,word:"Insert",dec:"73",hex:"49",kind:1,value:73,aliases:["insert","INSERT"]},{key:118,word:"Home",dec:"74",hex:"4A",kind:1,value:74,aliases:["home","HOME"]},{key:119,word:"PageUp",dec:"75",hex:"4B",kind:1,value:75,aliases:["pageUp","pageup","PAGEUP","Page Up","PAGE UP","page up"]},{key:120,word:"DeleteForward",dec:"76",hex:"4C",kind:1,value:76,aliases:["deleteForward","deleteforward","DELETEFORWARD","Delete Forward","DELETE FORWARD","delete forward","Delete","DELETE","delete"]},{key:121,word:"End",dec:"77",hex:"4D",kind:1,value:77,aliases:["end","END"]},{key:122,word:"PageDown",dec:"78",hex:"4E",kind:1,value:78,aliases:["pageDown","pagedown","PAGEDOWN","Page Down","PAGE DOWN","page down"]},{key:123,word:"ArrowRight",dec:"79",hex:"4F",kind:1,value:79,aliases:["arrowRight","arrowright","ARROWRIGHT","Arrow Right","ARROW RIGHT","arrow right"]},{key:124,word:"ArrowLeft",dec:"80",hex:"50",kind:1,value:80,aliases:["arrowLeft","arrowleft","ARROWLEFT","Arrow Left","ARROW LEFT","arrow left"]},{key:125,word:"ArrowDown",dec:"81",hex:"51",kind:1,value:81,aliases:["arrowDown","arrowdown","ARROWDOWN","Arrow Down","ARROW DOWN","arrow down"]},{key:126,word:"ArrowUp",dec:"82",hex:"52",kind:1,value:82,aliases:["arrowUp","arrowup","ARROWUP","Arrow Up","ARROW UP","arrow up"]},{key:127,word:"NumLock",dec:"83",hex:"53",kind:1,value:83,aliases:["numLock","numlock","NUMLOCK","Num Lock","NUM LOCK","num lock"]},{key:128,word:"Clear",dec:"83",hex:"53",kind:1,value:83,aliases:["clear","CLEAR"]},{key:160,word:"F13",dec:"104",hex:"68",kind:0,value:104,aliases:["f13","f 13"]},{key:161,word:"F14",dec:"105",hex:"69",kind:0,value:105,aliases:["f14","f 14"]},{key:162,word:"F15",dec:"106",hex:"6A",kind:0,value:106,aliases:["f15","f 15"]},{key:163,word:"F16",dec:"107",hex:"6B",kind:0,value:107,aliases:["f16","f 16"]},{key:164,word:"LeftControl",dec:"224",hex:"E0",kind:0,value:224,aliases:["leftControl","leftcontrol","LEFTCONTROL","Left Control","LEFT CONTROL","left control","control","CONTROL","ctrl","CTRL"]},{key:165,word:"LeftShift",dec:"225",hex:"E1",kind:0,value:225,aliases:["leftShift","leftshift","LEFTSHIFT","Left Shift","LEFT SHIFT","left shift","shift","SHIFT"]},{key:166,word:"LeftAlt",dec:"226",hex:"E2",kind:0,value:226,aliases:["leftAlt","leftalt","LEFTALT","Left Alt","LEFT ALT","left alt","alt","ALT"]},{key:167,word:"LeftGUI",dec:"227",hex:"E3",kind:0,value:227,aliases:["leftGUI","leftgui","LEFTGUI","Left GUI","LEFT GUI","left gui","gui","GUI","meta","META"]},{key:168,word:"RightControl",dec:"228",hex:"E4",kind:0,value:228,aliases:["rightControl","rightcontrol","RIGHTCONTROL","Right Control","RIGHT CONTROL","right control","RightCtrl","rightCtrl","rightctrl","RIGHTCTRL","Right Ctrl","RIGHT CTRL","right ctrl"]},{key:169,word:"RightShift",dec:"229",hex:"E5",kind:0,value:229,aliases:["rightShift","rightshift","RIGHTSHIFT","Right Shift","RIGHT SHIFT","right shift"]},{key:170,word:"RightAlt",dec:"230",hex:"E6",kind:0,value:230,aliases:["rightAlt","rightalt","RIGHTALT","Right Alt","RIGHT ALT","right alt"]},{key:171,word:"RightGUI",dec:"231",hex:"E7",kind:0,value:231,aliases:["rightGUI","rightgui","RIGHTGUI","Right GUI","Right Gui","RIGHT GUI","right gui"]}],G=()=>I.reduce((e,t)=>(e.set(t.word,t),t.aliases&&t.aliases.length>0&&t.aliases.forEach(r=>{e.set(r,t)}),e),new Map),N=()=>I.reduce((e,t)=>e.set(t.value,t),new Map);var R=require("fflate"),B=e=>{let t=JSON.stringify(e),r=new TextEncoder().encode(t),n=new Uint8Array((0,R.gzipSync)(r));return new Blob([n],{type:"application/gzip"})},W=async e=>{let t=await e.arrayBuffer(),r=(0,R.gunzipSync)(new Uint8Array(t)),n=new TextDecoder().decode(r);return JSON.parse(n)};function V(e){let t=document.getElementById(e);return t&&window.getComputedStyle(t).display!=="none"&&t.getAttribute("aria-hidden")!=="true"}var _=e=>{document.querySelector(`#${e}`)?.hidePopover?.()},$=()=>{document.querySelectorAll("[popover]").forEach(t=>{t?.hidePopover?.()})};function z(e){return new Promise(t=>{let r=new Image;r.src=typeof e=="string"?e:URL.createObjectURL(e),r.onload=()=>t(!0),r.onerror=()=>t(!1)})}function K(e=null,t="",r=0){return{success:!0,code:r,message:t,data:e}}function j(e,t=-1,r=null){return{success:!1,code:t,message:e,data:r}}var y={LITTLE:"little",BIG:"big"},J=(e,t,r=y.BIG)=>{if(!Number.isInteger(t)||t<=0)throw new Error("Byte count must be a positive integer.");let n=e>>>0,a=new Array(t);for(let o=0;o<t;o++){let s=r===y.LITTLE?o*8:(t-1-o)*8;a[o]=n>>s&255}return a},q=(e,t=y.BIG)=>{let r=0;if(t===y.LITTLE)for(let n=0;n<e.length;n++)r|=(e[n]&255)<<n*8;else for(let n=0;n<e.length;n++)r|=(e[n]&255)<<(e.length-1-n)*8;return r},Q=(e,t=y.BIG)=>{let r=e&65535;return t===y.LITTLE?[r&255,r>>8&255]:[r>>8&255,r&255]},X=(e,t=y.BIG)=>{if(e.length!==2)throw new Error("Input array must have exactly 2 elements");return t===y.LITTLE?e[1]<<8|e[0]:e[0]<<8|e[1]},Y=e=>Math.abs(e).toString().split("").map(t=>t.charCodeAt(0)),Z=e=>Number(String.fromCharCode(...e));var p=(e,t,r)=>Math.min(Math.max(e,t),r);function ee(e){let t=m=>{let x=m.endsWith("%"),k=parseFloat(m.replace("%",""));return x?Math.round(p(k/100,0,1)*255):p(Math.round(k),0,255)},r=m=>{let x=m.endsWith("%"),k=parseFloat(m.replace("%",""));return p(x?k/100:k,0,1)},n=m=>{if(!m.endsWith("%"))return 0;let x=parseFloat(m.replace("%",""));return p(x/100,0,1)},a=/^rgb\(\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,o=e.match(a);if(o){let[,m,,x,,k]=o;return{type:"rgb",r:t(m),g:t(x),b:t(k)}}let s=/^rgba\(\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,u=e.match(s);if(u){let[,m,,x,,k,,E]=u;return{type:"rgba",r:t(m),g:t(x),b:t(k),a:r(E)}}let g=/^hsv\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*\)$/i,i=e.match(g);if(i){let[,m,,x,,k]=i;return{type:"hsv",h:p(parseFloat(m),0,360),s:n(x),v:n(k)}}let l=/^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*\)$/i,c=e.match(l);if(c){let[,m,,x,,k]=c;return{type:"hsl",h:p(parseFloat(m),0,360),s:n(x),l:n(k)}}let f=/^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,h=e.match(f);if(h){let[,m,,x,,k,,E]=h;return{type:"hsla",h:p(parseFloat(m),0,360),s:n(x),l:n(k),a:r(E)}}return null}function te(e){let t=p(e.h,0,360)/360,r=p(e.s,0,1),n=p(e.l,0,1),a=0,o=0,s=0;if(r===0)a=o=s=n;else{let u=(l,c,f)=>(f<0&&(f+=1),f>1&&(f-=1),f<.16666666666666666?l+(c-l)*6*f:f<.5?c:f<.6666666666666666?l+(c-l)*(.6666666666666666-f)*6:l),g=n<.5?n*(1+r):n+r-n*r,i=2*n-g;a=u(i,g,t+1/3),o=u(i,g,t),s=u(i,g,t-1/3)}return{type:"rgb",r:Math.round(a*255),g:Math.round(o*255),b:Math.round(s*255)}}function re(e){let t=p(e.r,0,255)/255,r=p(e.g,0,255)/255,n=p(e.b,0,255)/255,a=Math.max(t,r,n),o=Math.min(t,r,n),s=a-o,u=(a+o)/2,g=0;s!==0&&(g=s/(1-Math.abs(2*u-1)));let i=0;if(s!==0){switch(a){case t:i=(r-n)/s%6;break;case r:i=(n-t)/s+2;break;case n:i=(t-r)/s+4;break}i=Math.round(i*60),i<0&&(i+=360)}return{type:"hsl",h:p(i,0,360),s:p(g,0,1),l:p(u,0,1)}}function ne(e){let{h:t,s:r,v:n}=e,a;r===0?a=n:a=(2-r)*n/2,a=Math.max(0,Math.min(1,a));let o;return a===0||a===1?o=0:(o=r*n/(1-Math.abs(2*a-1)),o=Math.max(0,Math.min(1,o))),{type:"hsl",h:Math.max(0,Math.min(360,t)),s:o,l:a}}function ae(e){let{h:t,s:r,l:n}=e,a=n+r*Math.min(n,1-n),o=Math.max(0,Math.min(1,a)),s;return o===0?s=0:(s=2*(1-n/o),s=Math.max(0,Math.min(1,s))),{type:"hsv",h:Math.max(0,Math.min(360,t)),s,v:o}}var oe=typeof window<"u",se=()=>typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="development":oe&&window.__ENV__?.MODE?window.__ENV__.MODE==="development":!0,L={enable:se(),reserveTypes:["error"],prefix:"[iLx1-tool]"},w={...L},v=e=>w.enable?!0:w.reserveTypes.includes(e),ie=(...e)=>{v("log")&&console.log(`${w.prefix} [LOG]`,...e)},le=(...e)=>{v("info")&&console.info(`${w.prefix} [INFO]`,...e)},de=(...e)=>{v("warn")&&console.warn(`${w.prefix} [WARN]`,...e)},ce=(...e)=>{v("error")&&console.error(`${w.prefix} [ERROR]`,...e)},ue=(...e)=>{v("debug")&&console.debug(`${w.prefix} [DEBUG]`,...e)},T=e=>{w={...w,...e}},ge=()=>{w={...L}},fe=()=>{T({enable:!0,reserveTypes:["log","info","warn","error","debug"]})},he=()=>{T({enable:!1,reserveTypes:[]})};var b=U(require("konva")),d={generate:async function(e,t,r){try{let n=await this.base64ToImageData(e),a=this.imageDataToHexArray(n,t,r);return r[3]===0?this.hex2hex(this.arrayToHex(a)):a}catch(n){throw console.error("\u751F\u6210\u5341\u516D\u8FDB\u5236\u6570\u7EC4\u65F6\u51FA\u9519:",n),n}},imageDataToHexArray:function(e,t,r){let n=e.data,a=e.height,o=e.width,s=n.length;if(r[4]==1){let u=[];for(let c=0;c<s;c+=4){let h=n[c]*.299+n[c+1]*.587+n[c+2]*.114>t?1:0;u[c/4]=h}let i=r[1],l;switch(i){case 0:l=this.ImageSamplingRow;break;case 1:l=this.ImageSamplingCol;break;case 2:l=this.ImageSamplingColRow;break;case 3:l=this.ImageSamplingRowCol;break;default:l=this.ImageSamplingRow}if(typeof l!="function")throw new Error(`\u53D6\u6A21\u51FD\u6570\u672A\u5B9A\u4E49\uFF0CsamplingMode: ${i}`);return l.call(this,u,o,a,r)}else return this.colorImageSampling(n,o,a,r)},colorImageSampling:function(e,t,r,n){let a=new Uint8Array(t*r*2),o=0,s=0;for(;o<a.length&&s<e.length;){let u=e[s],g=e[s+1],i=e[s+2],l=u>>3&31,c=g>>2&63,f=i>>3&31,h=l<<11|c<<5|f;a[o]=h>>8&255,a[o+1]=h&255,(n[0]==0||n[2]==1)&&(a[o]=~a[o]&255,a[o+1]=~a[o+1]&255),o+=2,s+=4}return a},ImageSamplingRow:function(e,t,r,n){let a=Math.ceil(t/8),o=new Uint8Array(a*r);for(let s=0;s<e.length;s++){let u=s%t,i=Math.floor(s/t),l=u%8,c=1<<l;n[2]!=0&&(c=1<<7-l);let f=i*a+Math.floor(u/8),h=e[s];n[0]!==0&&(h=h===0?1:0),h===0?o[f]|=c:o[f]&=~c}return o},ImageSamplingCol:function(e,t,r,n){let a=Math.ceil(r/8),o=new Uint8Array(a*t);for(let s=0;s<e.length;s++){let u=s%t,g=Math.floor(s/t),i=u,l=g%8,c=1<<l;n[2]!=0&&(c=1<<7-l);let f=i*a+Math.floor(g/8),h=e[s];n[0]!==0&&(h=h===0?1:0),h===0?o[f]|=c:o[f]&=~c}return o},ImageSamplingColRow:function(e,t,r,n){let a=Math.ceil(r/8),o=new Uint8Array(a*t);for(let s=0;s<e.length;s++){let u=s%t,g=Math.floor(s/t),i=Math.floor(g/8),l=g%8,c=1<<l;n[2]!=0&&(c=1<<7-l);let f=u+i*t,h=e[s];n[0]!==0&&(h=h===0?1:0),h===0?o[f]|=c:o[f]&=~c}return o},ImageSamplingRowCol:function(e,t,r,n){let a=Math.ceil(t/8),o=new Uint8Array(a*r);for(let s=0;s<e.length;s++){let u=s%t,g=Math.floor(s/t),i=Math.floor(u/8),l=u%8,c=1<<l;n[2]!=0&&(c=1<<7-l);let f=i*r+g,h=e[s];n[0]!==0&&(h=h===0?1:0),h===0?o[f]|=c:o[f]&=~c}return o},base64ToImageData:function(e){return new Promise((t,r)=>{let n=new Image;n.crossOrigin="anonymous",n.src=e,n.onload=()=>{try{let a=document.createElement("canvas");a.width=n.width,a.height=n.height;let o=a.getContext("2d");o.drawImage(n,0,0);let s=o.getImageData(0,0,a.width,a.height);t(s)}catch(a){r(new Error(`\u8F6C\u6362\u56FE\u50CF\u6570\u636E\u5931\u8D25: ${a.message}`))}},n.onerror=()=>{r(new Error("\u52A0\u8F7D\u56FE\u50CF\u5931\u8D25"))},n.src=e})},resizeImageWithKonva:async function(e,t,r,n){if(e===0||t===0)throw new Error("\u5BBD\u5EA6\u548C\u9AD8\u5EA6\u4E0D\u80FD\u4E3A0");if(!r)throw new Error("\u56FE\u50CF\u5BF9\u8C61\u4E0D\u80FD\u4E3A\u7A7A");return new Promise(a=>{if(typeof b.default>"u"){this.resizeImageWithCanvas(e,t,r,n).then(a).catch(()=>{let i=document.createElement("canvas");i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0),a(i.toDataURL("image/png"))});return}let o=new b.default.Stage({container:document.createElement("div"),width:e,height:t}),s=new b.default.Layer;o.add(s);let u=new b.default.Image({image:r,width:e,height:t});n&&u.filters([b.default.Filters.Grayscale]),s.add(u),s.batchDraw();let g=o.toDataURL({mimeType:"image/png",quality:1,pixelRatio:1});o.destroy(),a(g)})},resizeImageWithCanvas:async function(e,t,r,n){return new Promise(a=>{let o=document.createElement("canvas");o.width=e,o.height=t;let s=o.getContext("2d");if(s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high",s.drawImage(r,0,0,e,t),n){let g=s.getImageData(0,0,e,t),i=g.data;for(let l=0;l<i.length;l+=4){let c=i[l]*.299+i[l+1]*.587+i[l+2]*.114;i[l]=i[l+1]=i[l+2]=c}s.putImageData(g,0,0)}let u=o.toDataURL("image/png");a(u)})},arrayToHex:function(e){return!e||e.length===0?"":Array.from(e).map(t=>Number(t).toString(16).padStart(2,"0")).join("")},hex2hex:function(e){if(!e||e.length===0)return[];let t=[];for(let r=0;r<e.length;r+=2)t.push("0x"+e.substring(r,r+2));return t},generatePreview:function(e,t){if(!e||e.length===0)return"";let r="";for(let n=0;n<e.length;n++)r+=e[n]===0?"0":"1",(n+1)%t===0&&(r+=`
2
- `);return r},createImageData:function(e,t,r=null){let n=document.createElement("canvas");n.width=e,n.height=t;let a=n.getContext("2d");if(r){let o=a.createImageData(e,t);return o.data.set(r),o}else return a.createImageData(e,t)},formatHexOutput:function(e,t=0,r=16){if(!e||e.length===0)return"\u65E0\u6570\u636E";let n="";if(t===0&&Array.isArray(e))for(let a=0;a<e.length;a++)n+=e[a]+", ",(a+1)%r===0&&(n+=`
3
- `);else if(e instanceof Uint8Array)for(let a=0;a<e.length;a++)n+=e[a].toString(16).padStart(2,"0")+" ",(a+1)%r===0&&(n+=`
4
- `);else n=e.toString();return n},calculateOutputSize:function(e){let t=0;(Array.isArray(e)||e instanceof Uint8Array)&&(t=e.length);let r=t/1024;return{bytes:t,kilobytes:r,formatted:`${t} \u5B57\u8282 (${r.toFixed(2)} KB)`}},getSamplingModeDescription:function(e){return{0:"\u9010\u884C\u5F0F (\u4ECE\u5DE6\u5230\u53F3\uFF0C\u4ECE\u4E0A\u5230\u4E0B)",1:"\u9010\u5217\u5F0F (\u4ECE\u4E0A\u5230\u4E0B\uFF0C\u4ECE\u5DE6\u5230\u53F3)",2:"\u5217\u884C\u5F0F (\u5148\u5217\u540E\u884C)",3:"\u884C\u5217\u5F0F (\u5148\u884C\u540E\u5217)"}[e]||"\u672A\u77E5\u53D6\u6A21\u65B9\u5F0F"},getDefaultConfig:function(){return[0,0,0,0,1]}},me=d.generate.bind(d),pe=d.imageDataToHexArray.bind(d),xe=d.colorImageSampling.bind(d),ke=d.ImageSamplingRow.bind(d),we=d.ImageSamplingCol.bind(d),ye=d.ImageSamplingColRow.bind(d),be=d.ImageSamplingRowCol.bind(d),ve=d.base64ToImageData.bind(d),Se=d.resizeImageWithKonva.bind(d),Re=d.resizeImageWithCanvas.bind(d),Ee=d.arrayToHex.bind(d),Ie=d.hex2hex.bind(d),Te=d.generatePreview.bind(d),Ce=d.createImageData.bind(d),Le=d.formatHexOutput.bind(d),Ae=d.calculateOutputSize.bind(d),Pe=d.getSamplingModeDescription.bind(d),De=d.getDefaultConfig.bind(d);0&&(module.exports={Endianness,ImageSamplingCol,ImageSamplingColRow,ImageSamplingRow,ImageSamplingRowCol,ImageToHexArray,arrayToHex,asciiArrToNum,base64ToImageData,bits16ToNum,bytesToNum,calculateOutputSize,closeAllNativePopover,closePopoverByID,colorImageSampling,compressJsonGzip,createImageData,debug,decompressJsonGzip,disableAllLogs,enableAllLogs,error,errorResult,formatHexOutput,generate,generatePreview,getDefaultConfig,getHIDCodeMapStr,getHIDCodeMapStrNum,getSamplingModeDescription,hex2hex,hidKeyCode,hslToHsv,hslToRgb,hsvToHsl,imageDataToHexArray,info,isImageValid,isShowPopover,log,numToAsciiArr,numToBits16,numToBytes,parseColorString,resetLoggerConfig,resizeImageWithCanvas,resizeImageWithKonva,rgbToHsl,setLoggerConfig,successResult,warn});
1
+ var q=Object.create;var v=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=(e,r)=>{for(var n in r)v(e,n,{get:r[n],enumerable:!0})},N=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of X(r))!Z.call(e,o)&&o!==n&&v(e,o,{get:()=>r[o],enumerable:!(t=Q(r,o))||t.enumerable});return e};var re=(e,r,n)=>(n=e!=null?q(Y(e)):{},N(r||!e||!e.__esModule?v(n,"default",{value:e,enumerable:!0}):n,e)),te=e=>N(v({},"__esModule",{value:!0}),e);var Oe={};ee(Oe,{Endianness:()=>w,ImageSamplingCol:()=>C,ImageSamplingColRow:()=>P,ImageSamplingRow:()=>L,ImageSamplingRowCol:()=>M,ImageToHexArray:()=>Fe,arrayToHex:()=>H,asciiArrToNum:()=>xe,base64ToImage:()=>F,base64ToImageData:()=>D,bits16ToNum:()=>pe,bytesToNum:()=>ge,calculateOutputSize:()=>z,closeAllNativePopover:()=>de,closePopoverByID:()=>le,colorImageSampling:()=>S,compressJsonGzip:()=>ae,createImageData:()=>$,debug:()=>Ce,decompressJsonGzip:()=>se,disableAllLogs:()=>De,enableAllLogs:()=>Me,error:()=>Se,errorResult:()=>fe,formatHexOutput:()=>K,generate:()=>W,generatePreview:()=>_,getDefaultConfig:()=>J,getHIDCodeMapStr:()=>ne,getHIDCodeMapStrNum:()=>oe,getSamplingModeDescription:()=>j,hex2hex:()=>G,hidKeyCode:()=>R,hslToHsv:()=>Ee,hslToRgb:()=>ye,hsvToHsl:()=>ve,imageDataToHexArray:()=>I,info:()=>Ae,isImageValid:()=>ce,isShowPopover:()=>ie,log:()=>Re,numToAsciiArr:()=>ke,numToBits16:()=>me,numToBytes:()=>he,parseColorString:()=>we,resetLoggerConfig:()=>Pe,resizeImage:()=>V,resizeImageWithCanvas:()=>U,resizeImageWithKonva:()=>O,rgbToHsl:()=>be,setLoggerConfig:()=>A,successResult:()=>ue,warn:()=>Ie});module.exports=te(Oe);var R=[{key:0,word:"a",dec:"4",hex:"04",kind:1,value:4,aliases:["A"]},{key:2,word:"b",dec:"5",hex:"05",kind:1,value:5,aliases:["B"]},{key:4,word:"c",dec:"6",hex:"06",kind:1,value:6,aliases:["C"]},{key:6,word:"d",dec:"7",hex:"07",kind:1,value:7,aliases:["D"]},{key:8,word:"e",dec:"8",hex:"08",kind:1,value:8,aliases:["E"]},{key:10,word:"f",dec:"9",hex:"09",kind:1,value:9,aliases:["F"]},{key:12,word:"g",dec:"10",hex:"0A",kind:1,value:10,aliases:["G"]},{key:14,word:"h",dec:"11",hex:"0B",kind:1,value:11,aliases:["H"]},{key:16,word:"i",dec:"12",hex:"0C",kind:1,value:12,aliases:["I"]},{key:18,word:"j",dec:"13",hex:"0D",kind:1,value:13,aliases:["J"]},{key:20,word:"k",dec:"14",hex:"0E",kind:1,value:14,aliases:["K"]},{key:22,word:"l",dec:"15",hex:"0F",kind:1,value:15,aliases:["L"]},{key:24,word:"m",dec:"16",hex:"10",kind:1,value:16,aliases:["M"]},{key:26,word:"n",dec:"17",hex:"11",kind:1,value:17,aliases:["N"]},{key:28,word:"o",dec:"18",hex:"12",kind:1,value:18,aliases:["O"]},{key:30,word:"p",dec:"19",hex:"13",kind:1,value:19,aliases:["P"]},{key:32,word:"q",dec:"20",hex:"14",kind:1,value:20,aliases:["Q"]},{key:34,word:"r",dec:"21",hex:"15",kind:1,value:21,aliases:["R"]},{key:36,word:"s",dec:"22",hex:"16",kind:1,value:22,aliases:["S"]},{key:38,word:"t",dec:"23",hex:"17",kind:1,value:23,aliases:["T"]},{key:40,word:"u",dec:"24",hex:"18",kind:1,value:24,aliases:["U"]},{key:42,word:"v",dec:"25",hex:"19",kind:1,value:25,aliases:["V"]},{key:44,word:"w",dec:"26",hex:"1A",kind:1,value:26,aliases:["W"]},{key:46,word:"x",dec:"27",hex:"1B",kind:1,value:27,aliases:["X"]},{key:48,word:"y",dec:"28",hex:"1C",kind:1,value:28,aliases:["Y"]},{key:50,word:"z",dec:"29",hex:"1D",kind:1,value:29,aliases:["Z"]},{key:52,word:"1",dec:"30",hex:"1E",kind:1,value:30,aliases:["!","1!"]},{key:54,word:"2",dec:"31",hex:"1F",kind:1,value:31,aliases:["@","2@"]},{key:56,word:"3",dec:"32",hex:"20",kind:1,value:32,aliases:["#","3#"]},{key:58,word:"4",dec:"33",hex:"21",kind:1,value:33,aliases:["$","4$"]},{key:60,word:"5",dec:"34",hex:"22",kind:1,value:34,aliases:["%","5%"]},{key:62,word:"6",dec:"35",hex:"23",kind:1,value:35,aliases:["^","6^"]},{key:64,word:"7",dec:"36",hex:"24",kind:1,value:36,aliases:["&","7&"]},{key:66,word:"8",dec:"37",hex:"25",kind:1,value:37,aliases:["*","8*"]},{key:68,word:"9",dec:"38",hex:"26",kind:1,value:38,aliases:["(","9("]},{key:70,word:"0",dec:"39",hex:"27",kind:1,value:39,aliases:[")","0)"]},{key:77,word:"-",dec:"45",hex:"2D",kind:1,value:45,aliases:["_","-_"]},{key:79,word:"=",dec:"46",hex:"2E",kind:1,value:46,aliases:["+","=+"]},{key:81,word:"[",dec:"47",hex:"2F",kind:1,value:47,aliases:["{","[{"]},{key:83,word:"]",dec:"48",hex:"30",kind:1,value:48,aliases:["}","}]"]},{key:85,word:"\\",dec:"49",hex:"31",kind:1,value:49,aliases:["|","\\|"]},{key:87,word:"`",dec:"50",hex:"32",kind:1,value:50,aliases:["~","`~"]},{key:89,word:";",dec:"51",hex:"33",kind:1,value:51,aliases:[":",";:"]},{key:91,word:"'",dec:"52",hex:"34",kind:1,value:52,aliases:['"',`'"`]},{key:95,word:",",dec:"54",hex:"36",kind:1,value:54,aliases:["<",",<"]},{key:97,word:".",dec:"55",hex:"37",kind:1,value:55,aliases:[">",".>"]},{key:99,word:"/",dec:"56",hex:"38",kind:1,value:56,aliases:["?","/?"]},{key:72,word:"Enter",dec:"40",hex:"28",kind:1,value:40,aliases:["enter","ENTER"]},{key:73,word:"Escape",dec:"41",hex:"29",kind:1,value:41,aliases:["escape","ESCAPE"]},{key:74,word:"Backspace",dec:"42",hex:"2A",kind:1,value:42,aliases:["backspace","backSpace","BACKSPACE","Back Space","BACK SPACE","back space"]},{key:75,word:"Tab",dec:"43",hex:"2B",kind:1,value:43,aliases:["tab","TAB"]},{key:76,word:" ",dec:"44",hex:"2C",kind:1,value:44,aliases:["Space","SPACE","space"]},{key:101,word:"CapsLock",dec:"57",hex:"39",kind:1,value:57,aliases:["capsLock","capslock","CAPSLOCK","Caps Lock","CAPS LOCK","caps lock"]},{key:102,word:"F1",dec:"58",hex:"3A",kind:1,value:58,aliases:["f1","f 1"]},{key:103,word:"F2",dec:"59",hex:"3B",kind:1,value:59,aliases:["f2","f 2"]},{key:104,word:"F3",dec:"60",hex:"3C",kind:1,value:60,aliases:["f3","f 3"]},{key:105,word:"F4",dec:"61",hex:"3D",kind:1,value:61,aliases:["f4","f 4"]},{key:106,word:"F5",dec:"62",hex:"3E",kind:1,value:62,aliases:["f5","f 5"]},{key:107,word:"F6",dec:"63",hex:"3F",kind:1,value:63,aliases:["f6","f 6"]},{key:108,word:"F7",dec:"64",hex:"40",kind:1,value:64,aliases:["f7","f 7"]},{key:109,word:"F8",dec:"65",hex:"41",kind:1,value:65,aliases:["f8","f 8"]},{key:110,word:"F9",dec:"66",hex:"42",kind:1,value:66,aliases:["f9","f 9"]},{key:111,word:"F10",dec:"67",hex:"43",kind:1,value:67,aliases:["f10","f 10"]},{key:112,word:"F11",dec:"68",hex:"44",kind:1,value:68,aliases:["f11","f 11"]},{key:113,word:"F12",dec:"69",hex:"45",kind:1,value:69,aliases:["f12","f 12"]},{key:114,word:"PrintScreen",dec:"70",hex:"46",kind:1,value:70,aliases:["printScreen","printscreen","PRINTSCREEN","Print Screen","PRINT SCREEN","print screen"]},{key:115,word:"ScrollLock",dec:"71",hex:"47",kind:1,value:71,aliases:["scrollLock","scrolllock","SCROLLLOCK","Scroll Lock","SCROLL LOCK","scroll lock"]},{key:116,word:"Pause",dec:"72",hex:"48",kind:1,value:72,aliases:["pause","PAUSE"]},{key:117,word:"Insert",dec:"73",hex:"49",kind:1,value:73,aliases:["insert","INSERT"]},{key:118,word:"Home",dec:"74",hex:"4A",kind:1,value:74,aliases:["home","HOME"]},{key:119,word:"PageUp",dec:"75",hex:"4B",kind:1,value:75,aliases:["pageUp","pageup","PAGEUP","Page Up","PAGE UP","page up"]},{key:120,word:"DeleteForward",dec:"76",hex:"4C",kind:1,value:76,aliases:["deleteForward","deleteforward","DELETEFORWARD","Delete Forward","DELETE FORWARD","delete forward","Delete","DELETE","delete"]},{key:121,word:"End",dec:"77",hex:"4D",kind:1,value:77,aliases:["end","END"]},{key:122,word:"PageDown",dec:"78",hex:"4E",kind:1,value:78,aliases:["pageDown","pagedown","PAGEDOWN","Page Down","PAGE DOWN","page down"]},{key:123,word:"ArrowRight",dec:"79",hex:"4F",kind:1,value:79,aliases:["arrowRight","arrowright","ARROWRIGHT","Arrow Right","ARROW RIGHT","arrow right"]},{key:124,word:"ArrowLeft",dec:"80",hex:"50",kind:1,value:80,aliases:["arrowLeft","arrowleft","ARROWLEFT","Arrow Left","ARROW LEFT","arrow left"]},{key:125,word:"ArrowDown",dec:"81",hex:"51",kind:1,value:81,aliases:["arrowDown","arrowdown","ARROWDOWN","Arrow Down","ARROW DOWN","arrow down"]},{key:126,word:"ArrowUp",dec:"82",hex:"52",kind:1,value:82,aliases:["arrowUp","arrowup","ARROWUP","Arrow Up","ARROW UP","arrow up"]},{key:127,word:"NumLock",dec:"83",hex:"53",kind:1,value:83,aliases:["numLock","numlock","NUMLOCK","Num Lock","NUM LOCK","num lock"]},{key:128,word:"Clear",dec:"83",hex:"53",kind:1,value:83,aliases:["clear","CLEAR"]},{key:160,word:"F13",dec:"104",hex:"68",kind:0,value:104,aliases:["f13","f 13"]},{key:161,word:"F14",dec:"105",hex:"69",kind:0,value:105,aliases:["f14","f 14"]},{key:162,word:"F15",dec:"106",hex:"6A",kind:0,value:106,aliases:["f15","f 15"]},{key:163,word:"F16",dec:"107",hex:"6B",kind:0,value:107,aliases:["f16","f 16"]},{key:164,word:"LeftControl",dec:"224",hex:"E0",kind:0,value:224,aliases:["leftControl","leftcontrol","LEFTCONTROL","Left Control","LEFT CONTROL","left control","control","CONTROL","ctrl","CTRL"]},{key:165,word:"LeftShift",dec:"225",hex:"E1",kind:0,value:225,aliases:["leftShift","leftshift","LEFTSHIFT","Left Shift","LEFT SHIFT","left shift","shift","SHIFT"]},{key:166,word:"LeftAlt",dec:"226",hex:"E2",kind:0,value:226,aliases:["leftAlt","leftalt","LEFTALT","Left Alt","LEFT ALT","left alt","alt","ALT"]},{key:167,word:"LeftGUI",dec:"227",hex:"E3",kind:0,value:227,aliases:["leftGUI","leftgui","LEFTGUI","Left GUI","LEFT GUI","left gui","gui","GUI","meta","META"]},{key:168,word:"RightControl",dec:"228",hex:"E4",kind:0,value:228,aliases:["rightControl","rightcontrol","RIGHTCONTROL","Right Control","RIGHT CONTROL","right control","RightCtrl","rightCtrl","rightctrl","RIGHTCTRL","Right Ctrl","RIGHT CTRL","right ctrl"]},{key:169,word:"RightShift",dec:"229",hex:"E5",kind:0,value:229,aliases:["rightShift","rightshift","RIGHTSHIFT","Right Shift","RIGHT SHIFT","right shift"]},{key:170,word:"RightAlt",dec:"230",hex:"E6",kind:0,value:230,aliases:["rightAlt","rightalt","RIGHTALT","Right Alt","RIGHT ALT","right alt"]},{key:171,word:"RightGUI",dec:"231",hex:"E7",kind:0,value:231,aliases:["rightGUI","rightgui","RIGHTGUI","Right GUI","Right Gui","RIGHT GUI","right gui"]}],ne=()=>R.reduce((e,r)=>(e.set(r.word,r),r.aliases&&r.aliases.length>0&&r.aliases.forEach(n=>{e.set(n,r)}),e),new Map),oe=()=>R.reduce((e,r)=>e.set(r.value,r),new Map);var E=require("fflate"),ae=e=>{let r=JSON.stringify(e),n=new TextEncoder().encode(r),t=new Uint8Array((0,E.gzipSync)(n));return new Blob([t],{type:"application/gzip"})},se=async e=>{let r=await e.arrayBuffer(),n=(0,E.gunzipSync)(new Uint8Array(r)),t=new TextDecoder().decode(n);return JSON.parse(t)};function ie(e){let r=document.getElementById(e);return r&&window.getComputedStyle(r).display!=="none"&&r.getAttribute("aria-hidden")!=="true"}var le=e=>{document.querySelector(`#${e}`)?.hidePopover?.()},de=()=>{document.querySelectorAll("[popover]").forEach(r=>{r?.hidePopover?.()})};function ce(e){return new Promise(r=>{let n=new Image;n.src=typeof e=="string"?e:URL.createObjectURL(e),n.onload=()=>r(!0),n.onerror=()=>r(!1)})}function ue(e=null,r="",n=0){return{success:!0,code:n,message:r,data:e}}function fe(e,r=-1,n=null){return{success:!1,code:r,message:e,data:n}}var w={LITTLE:"little",BIG:"big"},he=(e,r,n=w.BIG)=>{if(!Number.isInteger(r)||r<=0)throw new Error("Byte count must be a positive integer.");let t=e>>>0,o=new Array(r);for(let a=0;a<r;a++){let s=n===w.LITTLE?a*8:(r-1-a)*8;o[a]=t>>s&255}return o},ge=(e,r=w.BIG)=>{let n=0;if(r===w.LITTLE)for(let t=0;t<e.length;t++)n|=(e[t]&255)<<t*8;else for(let t=0;t<e.length;t++)n|=(e[t]&255)<<(e.length-1-t)*8;return n},me=(e,r=w.BIG)=>{let n=e&65535;return r===w.LITTLE?[n&255,n>>8&255]:[n>>8&255,n&255]},pe=(e,r=w.BIG)=>{if(e.length!==2)throw new Error("Input array must have exactly 2 elements");return r===w.LITTLE?e[1]<<8|e[0]:e[0]<<8|e[1]},ke=e=>Math.abs(e).toString().split("").map(r=>r.charCodeAt(0)),xe=e=>Number(String.fromCharCode(...e));var m=(e,r,n)=>Math.min(Math.max(e,r),n);function we(e){let r=g=>{let p=g.endsWith("%"),k=parseFloat(g.replace("%",""));return p?Math.round(m(k/100,0,1)*255):m(Math.round(k),0,255)},n=g=>{let p=g.endsWith("%"),k=parseFloat(g.replace("%",""));return m(p?k/100:k,0,1)},t=g=>{if(!g.endsWith("%"))return 0;let p=parseFloat(g.replace("%",""));return m(p/100,0,1)},o=/^rgb\(\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,a=e.match(o);if(a){let[,g,,p,,k]=a;return{type:"rgb",r:r(g),g:r(p),b:r(k)}}let s=/^rgba\(\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,l=e.match(s);if(l){let[,g,,p,,k,,T]=l;return{type:"rgba",r:r(g),g:r(p),b:r(k),a:n(T)}}let d=/^hsv\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*\)$/i,i=e.match(d);if(i){let[,g,,p,,k]=i;return{type:"hsv",h:m(parseFloat(g),0,360),s:t(p),v:t(k)}}let c=/^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*\)$/i,u=e.match(c);if(u){let[,g,,p,,k]=u;return{type:"hsl",h:m(parseFloat(g),0,360),s:t(p),l:t(k)}}let f=/^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,h=e.match(f);if(h){let[,g,,p,,k,,T]=h;return{type:"hsla",h:m(parseFloat(g),0,360),s:t(p),l:t(k),a:n(T)}}return null}function ye(e){let r=m(e.h,0,360)/360,n=m(e.s,0,1),t=m(e.l,0,1),o=0,a=0,s=0;if(n===0)o=a=s=t;else{let l=(c,u,f)=>(f<0&&(f+=1),f>1&&(f-=1),f<.16666666666666666?c+(u-c)*6*f:f<.5?u:f<.6666666666666666?c+(u-c)*(.6666666666666666-f)*6:c),d=t<.5?t*(1+n):t+n-t*n,i=2*t-d;o=l(i,d,r+1/3),a=l(i,d,r),s=l(i,d,r-1/3)}return{type:"rgb",r:Math.round(o*255),g:Math.round(a*255),b:Math.round(s*255)}}function be(e){let r=m(e.r,0,255)/255,n=m(e.g,0,255)/255,t=m(e.b,0,255)/255,o=Math.max(r,n,t),a=Math.min(r,n,t),s=o-a,l=(o+a)/2,d=0;s!==0&&(d=s/(1-Math.abs(2*l-1)));let i=0;if(s!==0){switch(o){case r:i=(n-t)/s%6;break;case n:i=(t-r)/s+2;break;case t:i=(r-n)/s+4;break}i=Math.round(i*60),i<0&&(i+=360)}return{type:"hsl",h:m(i,0,360),s:m(d,0,1),l:m(l,0,1)}}function ve(e){let{h:r,s:n,v:t}=e,o;n===0?o=t:o=(2-n)*t/2,o=Math.max(0,Math.min(1,o));let a;return o===0||o===1?a=0:(a=n*t/(1-Math.abs(2*o-1)),a=Math.max(0,Math.min(1,a))),{type:"hsl",h:Math.max(0,Math.min(360,r)),s:a,l:o}}function Ee(e){let{h:r,s:n,l:t}=e,o=t+n*Math.min(t,1-t),a=Math.max(0,Math.min(1,o)),s;return a===0?s=0:(s=2*(1-t/a),s=Math.max(0,Math.min(1,s))),{type:"hsv",h:Math.max(0,Math.min(360,r)),s,v:a}}var Le=typeof window<"u",Te=()=>typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="development":Le&&window.__ENV__?.MODE?window.__ENV__.MODE==="development":!0,B={enable:Te(),reserveTypes:["error"],prefix:"[iLx1-tool]"},x={...B},b=e=>x.enable?!0:x.reserveTypes.includes(e),Re=(...e)=>{b("log")&&console.log(`${x.prefix} [LOG]`,...e)},Ae=(...e)=>{b("info")&&console.info(`${x.prefix} [INFO]`,...e)},Ie=(...e)=>{b("warn")&&console.warn(`${x.prefix} [WARN]`,...e)},Se=(...e)=>{b("error")&&console.error(`${x.prefix} [ERROR]`,...e)},Ce=(...e)=>{b("debug")&&console.debug(`${x.prefix} [DEBUG]`,...e)},A=e=>{x={...x,...e}},Pe=()=>{x={...B}},Me=()=>{A({enable:!0,reserveTypes:["log","info","warn","error","debug"]})},De=()=>{A({enable:!1,reserveTypes:[]})};var y=re(require("konva"));async function W(e,r,n){try{let t=await D(e),o=I(t,r,n);return n[3]===0?G(H(o)):o}catch(t){throw console.error("\u751F\u6210\u5341\u516D\u8FDB\u5236\u6570\u7EC4\u65F6\u51FA\u9519:",t),t}}function I(e,r,n){let t=e.data,o=e.height,a=e.width,s=t.length;if(n[4]==1){let l=[];for(let u=0;u<s;u+=4){let h=t[u]*.299+t[u+1]*.587+t[u+2]*.114>r?1:0;l[u/4]=h}let i=n[1],c;switch(i){case 0:c=L;break;case 1:c=C;break;case 2:c=P;break;case 3:c=M;break;default:c=L}if(typeof c!="function")throw new Error(`\u53D6\u6A21\u51FD\u6570\u672A\u5B9A\u4E49\uFF0CsamplingMode: ${i}`);return c.call(this,l,a,o,n)}else return S(t,a,o,n)}function S(e,r,n,t){let o=new Uint8Array(r*n*2),a=0,s=0;for(;a<o.length&&s<e.length;){let l=e[s],d=e[s+1],i=e[s+2],c=l>>3&31,u=d>>2&63,f=i>>3&31,h=c<<11|u<<5|f;o[a]=h>>8&255,o[a+1]=h&255,(t[0]==0||t[2]==1)&&(o[a]=~o[a]&255,o[a+1]=~o[a+1]&255),a+=2,s+=4}return o}function L(e,r,n,t){let o=Math.ceil(r/8),a=new Uint8Array(o*n);for(let s=0;s<e.length;s++){let l=s%r,i=Math.floor(s/r),c=l%8,u=1<<c;t[2]!=0&&(u=1<<7-c);let f=i*o+Math.floor(l/8),h=e[s];t[0]!==0&&(h=h===0?1:0),h===0?a[f]|=u:a[f]&=~u}return a}function C(e,r,n,t){let o=Math.ceil(n/8),a=new Uint8Array(o*r);for(let s=0;s<e.length;s++){let l=s%r,d=Math.floor(s/r),i=l,c=d%8,u=1<<c;t[2]!=0&&(u=1<<7-c);let f=i*o+Math.floor(d/8),h=e[s];t[0]!==0&&(h=h===0?1:0),h===0?a[f]|=u:a[f]&=~u}return a}function P(e,r,n,t){let o=Math.ceil(n/8),a=new Uint8Array(o*r);for(let s=0;s<e.length;s++){let l=s%r,d=Math.floor(s/r),i=Math.floor(d/8),c=d%8,u=1<<c;t[2]!=0&&(u=1<<7-c);let f=l+i*r,h=e[s];t[0]!==0&&(h=h===0?1:0),h===0?a[f]|=u:a[f]&=~u}return a}function M(e,r,n,t){let o=Math.ceil(r/8),a=new Uint8Array(o*n);for(let s=0;s<e.length;s++){let l=s%r,d=Math.floor(s/r),i=Math.floor(l/8),c=l%8,u=1<<c;t[2]!=0&&(u=1<<7-c);let f=i*n+d,h=e[s];t[0]!==0&&(h=h===0?1:0),h===0?a[f]|=u:a[f]&=~u}return a}function D(e){return new Promise((r,n)=>{let t=new Image;t.crossOrigin="anonymous",t.src=e,t.onload=()=>{try{let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let a=o.getContext("2d");a.drawImage(t,0,0);let s=a.getImageData(0,0,o.width,o.height);r(s)}catch(o){n(new Error(`\u8F6C\u6362\u56FE\u50CF\u6570\u636E\u5931\u8D25: ${o.message}`))}},t.onerror=()=>{n(new Error("\u52A0\u8F7D\u56FE\u50CF\u5931\u8D25"))},t.src=e})}async function V(e,r,n,t){if(e===0||r===0)throw new Error("\u5BBD\u5EA6\u548C\u9AD8\u5EA6\u4E0D\u80FD\u4E3A0");if(!n)throw new Error("\u56FE\u50CF\u5BF9\u8C61\u4E0D\u80FD\u4E3A\u7A7A");let o;if(typeof n=="string"&&n.startsWith("data:image/"))o=await F(n);else if(n instanceof HTMLImageElement)o=n;else throw new Error("imageSource\u5FC5\u987B\u662F\u6709\u6548\u7684\u56FE\u7247base64\u5B57\u7B26\u4E32\u6216HTMLImageElement\u5BF9\u8C61");return typeof y.default>"u"?U(e,r,o,t).catch(()=>{let a=document.createElement("canvas");return a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),a.toDataURL("image/png")}):O(e,r,o,t)}var F=async e=>{if(!e.startsWith("data:image/"))throw new Error("\u4F20\u5165\u7684base64\u4E0D\u662F\u6709\u6548\u7684\u56FE\u7247\u683C\u5F0F");return new Promise((r,n)=>{let t=new Image;t.crossOrigin="anonymous",t.onload=()=>r(t),t.onerror=o=>n(new Error("base64\u56FE\u7247\u52A0\u8F7D\u5931\u8D25\uFF1A"+o)),t.src=e})};async function O(e,r,n,t){if(e===0||r===0)throw new Error("\u5BBD\u5EA6\u548C\u9AD8\u5EA6\u4E0D\u80FD\u4E3A0");if(!n)throw new Error("\u56FE\u50CF\u5BF9\u8C61\u4E0D\u80FD\u4E3A\u7A7A");return new Promise(o=>{if(typeof y.default>"u")throw new Error("Konva.js \u672A\u52A0\u8F7D\uFF0C\u65E0\u6CD5\u8FDB\u884C\u56FE\u50CF\u7F29\u653E");let a=new y.default.Stage({container:document.createElement("div"),width:e,height:r}),s=new y.default.Layer;a.add(s);let l=new y.default.Image({image:n,width:e,height:r});t&&(l.cache(),l.filters([y.default.Filters.Grayscale])),s.add(l),s.draw();let d=a.toDataURL({mimeType:"image/png",quality:1,pixelRatio:1});a.destroy(),o(d)})}async function U(e,r,n,t){let o=document.createElement("canvas");o.width=e,o.height=r;let a=o.getContext("2d");if(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(n,0,0,e,r),t){let l=a.getImageData(0,0,e,r),d=l.data;for(let i=0;i<d.length;i+=4){let c=d[i]*.299+d[i+1]*.587+d[i+2]*.114;d[i]=d[i+1]=d[i+2]=c}a.putImageData(l,0,0)}return o.toDataURL("image/png")}function H(e){return!e||e.length===0?"":Array.from(e).map(r=>Number(r).toString(16).padStart(2,"0")).join("")}function G(e){if(!e||e.length===0)return[];let r=[];for(let n=0;n<e.length;n+=2)r.push("0x"+e.substring(n,n+2));return r}function _(e,r){if(!e||e.length===0)return"";let n="";for(let t=0;t<e.length;t++)n+=e[t]===0?"0":"1",(t+1)%r===0&&(n+=`
2
+ `);return n}function $(e,r,n=null){let t=document.createElement("canvas");t.width=e,t.height=r;let o=t.getContext("2d");if(n){let a=o.createImageData(e,r);return a.data.set(n),a}else return o.createImageData(e,r)}function K(e,r=0,n=16){if(!e||e.length===0)return"\u65E0\u6570\u636E";let t="";if(r===0&&Array.isArray(e))for(let o=0;o<e.length;o++)t+=e[o]+", ",(o+1)%n===0&&(t+=`
3
+ `);else if(e instanceof Uint8Array)for(let o=0;o<e.length;o++)t+=e[o].toString(16).padStart(2,"0")+" ",(o+1)%n===0&&(t+=`
4
+ `);else t=e.toString();return t}function z(e){let r=0;(Array.isArray(e)||e instanceof Uint8Array)&&(r=e.length);let n=r/1024;return{bytes:r,kilobytes:n,formatted:`${r} \u5B57\u8282 (${n.toFixed(2)} KB)`}}function j(e){return{0:"\u9010\u884C\u5F0F (\u4ECE\u5DE6\u5230\u53F3\uFF0C\u4ECE\u4E0A\u5230\u4E0B)",1:"\u9010\u5217\u5F0F (\u4ECE\u4E0A\u5230\u4E0B\uFF0C\u4ECE\u5DE6\u5230\u53F3)",2:"\u5217\u884C\u5F0F (\u5148\u5217\u540E\u884C)",3:"\u884C\u5217\u5F0F (\u5148\u884C\u540E\u5217)"}[e]||"\u672A\u77E5\u53D6\u6A21\u65B9\u5F0F"}function J(){return[0,0,0,0,1]}var Fe={generate:W,imageDataToHexArray:I,colorImageSampling:S,ImageSamplingRow:L,ImageSamplingCol:C,ImageSamplingColRow:P,ImageSamplingRowCol:M,base64ToImageData:D,resizeImage:V,base64ToImage:F,resizeImageWithKonva:O,resizeImageWithCanvas:U,arrayToHex:H,hex2hex:G,generatePreview:_,createImageData:$,formatHexOutput:K,calculateOutputSize:z,getSamplingModeDescription:j,getDefaultConfig:J};0&&(module.exports={Endianness,ImageSamplingCol,ImageSamplingColRow,ImageSamplingRow,ImageSamplingRowCol,ImageToHexArray,arrayToHex,asciiArrToNum,base64ToImage,base64ToImageData,bits16ToNum,bytesToNum,calculateOutputSize,closeAllNativePopover,closePopoverByID,colorImageSampling,compressJsonGzip,createImageData,debug,decompressJsonGzip,disableAllLogs,enableAllLogs,error,errorResult,formatHexOutput,generate,generatePreview,getDefaultConfig,getHIDCodeMapStr,getHIDCodeMapStrNum,getSamplingModeDescription,hex2hex,hidKeyCode,hslToHsv,hslToRgb,hsvToHsl,imageDataToHexArray,info,isImageValid,isShowPopover,log,numToAsciiArr,numToBits16,numToBytes,parseColorString,resetLoggerConfig,resizeImage,resizeImageWithCanvas,resizeImageWithKonva,rgbToHsl,setLoggerConfig,successResult,warn});
5
5
  //# sourceMappingURL=index.js.map