ilx1-x-tool 1.2.2 → 1.2.4

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/README.md CHANGED
@@ -19,6 +19,7 @@ import { xxx } from 'ilx1-x-tool'
19
19
  ### 图像数据处理工具 (imageData.ts)
20
20
 
21
21
  #### 配置接口
22
+
22
23
  - `IConfig` - 图像数据处理配置接口
23
24
  - `reverseValue: number` - 反转数值 (0:反转数值)
24
25
  - `modMode: number` - 取模方式 (0:逐行,1:逐列,2:列行,3:行列)
@@ -26,9 +27,11 @@ import { xxx } from 'ilx1-x-tool'
26
27
  - `outputMode: number` - 输出模式 (0:十六进制数组,1:字节数组)
27
28
 
28
29
  #### 图像处理主对象
30
+
29
31
  - `ImageToHexArray` - 图像处理工具函数库主对象
30
32
 
31
33
  #### 主要功能函数
34
+
32
35
  - `generate(picData: string, thresholdData: number, config: number[]): Promise<Uint8Array>` - 生成十六进制数组
33
36
  - `picData`: base64图像数据
34
37
  - `thresholdData`: 阈值
@@ -49,6 +52,7 @@ import { xxx } from 'ilx1-x-tool'
49
52
  - 返回:RGB565格式的字节数组
50
53
 
51
54
  #### 取模函数
55
+
52
56
  - `ImageSamplingRow(unpackedBuffer: number[], width: number, height: number, config: number[]): Uint8Array` - 逐行式取模 (从左到右,从上到下)
53
57
  - `unpackedBuffer`: 解压后的像素缓冲区
54
58
  - `width`: 图像宽度
@@ -78,6 +82,7 @@ import { xxx } from 'ilx1-x-tool'
78
82
  - 返回:取模后的字节数组
79
83
 
80
84
  #### 图像转换函数
85
+
81
86
  - `base64ToImageData(base64Data: string): Promise<ImageData>` - base64 转 ImageData 对象
82
87
  - `base64Data`: base64编码的图像数据
83
88
  - 返回:ImageData对象
@@ -97,6 +102,7 @@ import { xxx } from 'ilx1-x-tool'
97
102
  - 返回:base64编码的缩放后图像
98
103
 
99
104
  #### 数据格式转换函数
105
+
100
106
  - `arrayToHex(array: Uint8Array): string` - Uint8Array 转十六进制字符串
101
107
  - `array`: 字节数组
102
108
  - 返回:十六进制字符串
@@ -111,6 +117,7 @@ import { xxx } from 'ilx1-x-tool'
111
117
  - 返回:预览字符串
112
118
 
113
119
  #### 辅助函数
120
+
114
121
  - `createImageData(width: number, height: number, data: Uint8ClampedArray = null): ImageData` - 创建图像数据对象(兼容性函数)
115
122
  - `width`: 图像宽度
116
123
  - `height`: 图像高度
@@ -126,66 +133,64 @@ import { xxx } from 'ilx1-x-tool'
126
133
  ### 颜色工具 (color.ts)
127
134
 
128
135
  #### 颜色解析与转换
136
+
129
137
  - `parseColorString(str: string): ParsedColor | null` - 解析颜色字符串(支持 rgb/rgba/hsv/hsl 格式)
130
138
  - `str`: 待解析的颜色字符串(如 "hsl(120, 100%, 50%)"、"hsla(240, 50%, 70%, 0.8)")
131
-
132
139
  - `hslToRgb(hsl: ParsedHSL | ParsedHSLA | null): ParsedColor | null` - HSL 转 RGB 颜色转换
133
140
  - `hsl`: HSL 颜色对象(分量范围 0-255)
134
-
135
141
  - `rgbToHsl(rgb: ParsedRGB | ParsedRGBA | null): ParsedColor | null` - RGB 转 HSL 颜色转换
136
142
  - `rgb`: RGB 颜色对象(分量范围 0-255)
137
-
138
143
  - `hsvToHsl(hsv: ParsedHSV): ParsedColor` - HSV 转 HSL 颜色转换
139
144
  - `hsv`: HSV 颜色对象(分量范围 0-255)
140
-
141
145
  - `hslToHsv(hsl: ParsedHSL): ParsedColor` - HSL 转 HSV 颜色转换
142
146
  - `hsl`: HSL 颜色对象(分量范围 0-255)
143
147
 
144
148
  ### 数据处理工具 (data.ts)
145
149
 
146
150
  #### 字节序处理
151
+
147
152
  - `Endianness` - 字节序枚举(LITTLE: 'little', BIG: 'big')
148
153
 
149
154
  #### 数字与字节数组转换
155
+
150
156
  - `numToBytes(number: number, byteCount: number, endian: Endianness = Endianness.BIG): number[]` - 将数字转换为指定字节序的字节数组
151
157
  - `number`: 待转换的数字(自动截断为无符号整数)
152
158
  - `byteCount`: 目标字节长度(必须为正整数)
153
159
  - `endian`: 字节序(默认大端)
154
-
155
160
  - `bytesToNum(bytes: number[], endian: Endianness = Endianness.BIG): number` - 将任意长度的字节数组转换为数字(支持不同字节序)
156
161
  - `bytes`: 字节数组
157
162
  - `endian`: 字节序(默认小端)
158
-
159
163
  - `numToBits16(number: number, endian: Endianness = Endianness.BIG): [number, number]` - 将数字转换为16位无符号整数的指定字节序字节数组(固定2字节)
160
164
  - `number`: 待转换的数字(自动截断为16位无符号整数范围)
161
165
  - `endian`: 字节序(默认小端)
162
-
163
166
  - `bits16ToNum(bytes: [number, number], endian: Endianness = Endianness.BIG): number` - 将16位字节数组转换为数字
164
167
  - `bytes`: 长度为2的字节数组
165
168
  - `endian`: 字节序(默认小端)
166
169
 
167
170
  #### ASCII 码转换
171
+
168
172
  - `numToAsciiArr(n: number): number[]` - 将数字转换为ASCII码值数组(每个数字转换为其对应的ASCII码)
169
173
  - `n`: 待转换的数字(自动取绝对值)
170
-
171
174
  - `asciiArrToNum(ascii: number[]): number` - 将ASCII码值数组转换为对应的数字
172
175
  - `ascii`: ASCII码值数组(每个元素为0-255的整数)
173
176
 
174
177
  ### Gzip 压缩工具 (gzip.ts)
175
178
 
176
179
  #### JSON 压缩与解压
180
+
177
181
  - `compressJsonGzip(data: any): Blob` - gzip 压缩 JSON 数据(转成 Blob,适合导出)
178
182
  - `data`: 待压缩的 JSON 数据
179
-
180
183
  - `decompressJsonGzip(file: File): Promise<any>` - 解压 gzip 格式的 JSON 文件
181
184
  - `file`: 待解压的 gzip 文件
182
185
 
183
186
  ### HID 键码工具 (hidKeyCode.ts)
184
187
 
185
188
  #### 键码映射
189
+
186
190
  - `hidKeyCode` - HID 键码数组,包含各种按键的键码信息
187
191
 
188
192
  #### 键码映射获取
193
+
189
194
  - `getHIDCodeMapStr(): Map<string, (typeof hidKeyCode)[0]>` - 获取 HID 键码映射(主键名 + 别名)
190
195
 
191
196
  - `getHIDCodeMapStrNum(): Map<number, (typeof hidKeyCode)[0]>` - 获取 HID 键码映射(value 映射)
@@ -193,11 +198,11 @@ import { xxx } from 'ilx1-x-tool'
193
198
  ### 结果工具 (result.ts)
194
199
 
195
200
  #### 结果对象创建
201
+
196
202
  - `successResult<T = unknown>(data: T = null as unknown as T, message: string = '', code: number = 0): Result<T>` - 创建成功的结果对象
197
203
  - `data`: 业务数据(可选,默认 null)
198
204
  - `message`: 成功信息(可选,默认空字符串)
199
205
  - `code`: 成功状态码(可选,默认 0)
200
-
201
206
  - `errorResult<T = unknown>(message: string, code: number = -1, data: T = null as unknown as T): Result<T>` - 创建失败的结果对象
202
207
  - `message`: 错误信息(必选)
203
208
  - `code`: 错误码(可选,默认 -1)
@@ -206,35 +211,37 @@ import { xxx } from 'ilx1-x-tool'
206
211
  ### 常用工具 (usual.ts)
207
212
 
208
213
  #### UI 相关
214
+
209
215
  - `isShowPopover(popId: string): boolean` - 判断 popover 是否显示
210
216
  - `popId`: popover 元素的 ID
217
+ - `closePopoverByID(id: string): void` - 关闭指定 ID 的 popover
218
+ - `id`: popover 元素的 ID
219
+ - `closeAllNativePopover(): void` - 关闭页面所有原生 popover
211
220
 
212
221
  #### 图片处理
222
+
213
223
  - `isImageValid(src: string | File): Promise<boolean>` - 判断图片是否有效
214
224
  - `src`: 图片 URL 或 File 对象
215
225
 
216
226
  ### 调试工具 (debug.ts)
217
227
 
218
228
  #### 日志输出函数
229
+
219
230
  - `log(...args: any[]): void` - 封装 console.log 方法(可开关控制)
220
231
  - `args`: 日志打印参数(任意数量、任意类型)
221
-
222
232
  - `info(...args: any[]): void` - 封装 console.info 方法(可开关控制)
223
233
  - `args`: 日志打印参数(任意数量、任意类型)
224
-
225
234
  - `warn(...args: any[]): void` - 封装 console.warn 方法(可开关控制)
226
235
  - `args`: 日志打印参数(任意数量、任意类型)
227
-
228
236
  - `error(...args: any[]): void` - 封装 console.error 方法(可开关控制,默认生产环境保留)
229
237
  - `args`: 日志打印参数(任意数量、任意类型)
230
-
231
238
  - `debug(...args: any[]): void` - 封装 console.debug 方法(可开关控制)
232
239
  - `args`: 日志打印参数(任意数量、任意类型)
233
240
 
234
241
  #### 配置控制函数
242
+
235
243
  - `setLoggerConfig(config: Partial<LoggerConfig>): void` - 动态修改日志工具配置
236
244
  - `config`: 要修改的配置项(可选,无需传全部)
237
-
238
245
  - `resetLoggerConfig(): void` - 重置日志工具配置为默认值
239
246
 
240
247
  - `enableAllLogs(): void` - 强制开启所有日志(临时调试用)
@@ -242,6 +249,7 @@ import { xxx } from 'ilx1-x-tool'
242
249
  - `disableAllLogs(): void` - 强制关闭所有日志(紧急生产环境用)
243
250
 
244
251
  #### 类型定义
252
+
245
253
  - `ConsoleType` - 日志类型枚举('log' | 'info' | 'warn' | 'error' | 'debug')
246
254
  - `LoggerConfig` - 日志工具配置项接口
247
255
  - `enable`: 是否开启调试模式(true=输出日志,false=关闭日志)
@@ -260,4 +268,4 @@ npm run build
260
268
 
261
269
  ## 许可证
262
270
 
263
- MIT
271
+ MIT
package/dist/index.d.mts CHANGED
@@ -66,65 +66,26 @@ interface LoggerConfig {
66
66
  prefix: string;
67
67
  }
68
68
 
69
- declare const hidKeyCode: ({
69
+ interface HIDKey {
70
70
  key: number;
71
71
  word: string;
72
72
  dec: string;
73
73
  hex: string;
74
74
  kind: number;
75
75
  value: number;
76
- aliases: string[];
77
- } | {
78
- key: number;
79
- word: string;
80
- dec: string;
81
- hex: string;
82
- kind: number;
83
- value: number;
84
- aliases?: undefined;
85
- })[];
76
+ aliases?: string[];
77
+ }
78
+ declare const hidKeyCode: HIDKey[];
86
79
  /********************************************************************************
87
80
  * @brief: 获取 HID 键码映射(主键名 + 别名)
88
81
  * @return {*}
89
82
  ********************************************************************************/
90
- declare const getHIDCodeMapStr: () => Map<string, {
91
- key: number;
92
- word: string;
93
- dec: string;
94
- hex: string;
95
- kind: number;
96
- value: number;
97
- aliases: string[];
98
- } | {
99
- key: number;
100
- word: string;
101
- dec: string;
102
- hex: string;
103
- kind: number;
104
- value: number;
105
- aliases?: undefined;
106
- }>;
83
+ declare const getHIDCodeMapStr: () => Map<string, HIDKey>;
107
84
  /********************************************************************************
108
85
  * @brief: 获取 HID 键码映射(value 映射)
109
86
  * @return {*}
110
87
  ********************************************************************************/
111
- declare const getHIDCodeMapStrNum: () => Map<number, {
112
- key: number;
113
- word: string;
114
- dec: string;
115
- hex: string;
116
- kind: number;
117
- value: number;
118
- aliases: string[];
119
- } | {
120
- key: number;
121
- word: string;
122
- dec: string;
123
- hex: string;
124
- kind: number;
125
- value: number;
126
- aliases?: undefined;
127
- }>;
88
+ declare const getHIDCodeMapStrNum: () => Map<number, HIDKey>;
128
89
 
129
90
  /********************************************************************************
130
91
  * @brief: gzip 压缩 JSON 数据(转成 Blob,适合导出)
@@ -324,10 +285,17 @@ declare const enableAllLogs: () => void;
324
285
  ********************************************************************************/
325
286
  declare const disableAllLogs: () => void;
326
287
 
288
+ /********************************************************************************
289
+ * @brief: 图像数据处理配置接口
290
+ ********************************************************************************/
291
+ interface IConfig {
292
+ reverseValue: number;
293
+ modMode: number;
294
+ reverseBit: number;
295
+ outputMode: number;
296
+ }
327
297
  /********************************************************************************
328
298
  * @brief: 图像处理工具函数库主对象
329
- * @param: 无
330
- * @return: ImageToHexArray 对象
331
299
  ********************************************************************************/
332
300
  declare const ImageToHexArray: {
333
301
  /********************************************************************************
@@ -497,4 +465,4 @@ declare const calculateOutputSize: any;
497
465
  declare const getSamplingModeDescription: any;
498
466
  declare const getDefaultConfig: any;
499
467
 
500
- export { type ConsoleType, Endianness, type Hex, 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, 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 };
468
+ 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, 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 };
package/dist/index.d.ts CHANGED
@@ -66,65 +66,26 @@ interface LoggerConfig {
66
66
  prefix: string;
67
67
  }
68
68
 
69
- declare const hidKeyCode: ({
69
+ interface HIDKey {
70
70
  key: number;
71
71
  word: string;
72
72
  dec: string;
73
73
  hex: string;
74
74
  kind: number;
75
75
  value: number;
76
- aliases: string[];
77
- } | {
78
- key: number;
79
- word: string;
80
- dec: string;
81
- hex: string;
82
- kind: number;
83
- value: number;
84
- aliases?: undefined;
85
- })[];
76
+ aliases?: string[];
77
+ }
78
+ declare const hidKeyCode: HIDKey[];
86
79
  /********************************************************************************
87
80
  * @brief: 获取 HID 键码映射(主键名 + 别名)
88
81
  * @return {*}
89
82
  ********************************************************************************/
90
- declare const getHIDCodeMapStr: () => Map<string, {
91
- key: number;
92
- word: string;
93
- dec: string;
94
- hex: string;
95
- kind: number;
96
- value: number;
97
- aliases: string[];
98
- } | {
99
- key: number;
100
- word: string;
101
- dec: string;
102
- hex: string;
103
- kind: number;
104
- value: number;
105
- aliases?: undefined;
106
- }>;
83
+ declare const getHIDCodeMapStr: () => Map<string, HIDKey>;
107
84
  /********************************************************************************
108
85
  * @brief: 获取 HID 键码映射(value 映射)
109
86
  * @return {*}
110
87
  ********************************************************************************/
111
- declare const getHIDCodeMapStrNum: () => Map<number, {
112
- key: number;
113
- word: string;
114
- dec: string;
115
- hex: string;
116
- kind: number;
117
- value: number;
118
- aliases: string[];
119
- } | {
120
- key: number;
121
- word: string;
122
- dec: string;
123
- hex: string;
124
- kind: number;
125
- value: number;
126
- aliases?: undefined;
127
- }>;
88
+ declare const getHIDCodeMapStrNum: () => Map<number, HIDKey>;
128
89
 
129
90
  /********************************************************************************
130
91
  * @brief: gzip 压缩 JSON 数据(转成 Blob,适合导出)
@@ -324,10 +285,17 @@ declare const enableAllLogs: () => void;
324
285
  ********************************************************************************/
325
286
  declare const disableAllLogs: () => void;
326
287
 
288
+ /********************************************************************************
289
+ * @brief: 图像数据处理配置接口
290
+ ********************************************************************************/
291
+ interface IConfig {
292
+ reverseValue: number;
293
+ modMode: number;
294
+ reverseBit: number;
295
+ outputMode: number;
296
+ }
327
297
  /********************************************************************************
328
298
  * @brief: 图像处理工具函数库主对象
329
- * @param: 无
330
- * @return: ImageToHexArray 对象
331
299
  ********************************************************************************/
332
300
  declare const ImageToHexArray: {
333
301
  /********************************************************************************
@@ -497,4 +465,4 @@ declare const calculateOutputSize: any;
497
465
  declare const getSamplingModeDescription: any;
498
466
  declare const getDefaultConfig: any;
499
467
 
500
- export { type ConsoleType, Endianness, type Hex, 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, 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 };
468
+ 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, 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 };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var D=Object.create;var S=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var U=(e,n)=>{for(var t in n)S(e,t,{get:n[t],enumerable:!0})},A=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of L(n))!F.call(e,o)&&o!==t&&S(e,o,{get:()=>n[o],enumerable:!(r=R(n,o))||r.enumerable});return e};var H=(e,n,t)=>(t=e!=null?D(P(e)):{},A(n||!e||!e.__esModule?S(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>A(S({},"__esModule",{value:!0}),e);var Re={};U(Re,{Endianness:()=>w,ImageSamplingCol:()=>pe,ImageSamplingColRow:()=>ye,ImageSamplingRow:()=>xe,ImageSamplingRowCol:()=>ke,ImageToHexArray:()=>l,arrayToHex:()=>Se,asciiArrToNum:()=>X,base64ToImageData:()=>we,bits16ToNum:()=>Q,bytesToNum:()=>J,calculateOutputSize:()=>Ae,colorImageSampling:()=>fe,compressJsonGzip:()=>G,createImageData:()=>Ee,debug:()=>le,decompressJsonGzip:()=>_,disableAllLogs:()=>me,enableAllLogs:()=>ue,error:()=>de,errorResult:()=>W,formatHexOutput:()=>Me,generate:()=>ge,generatePreview:()=>Ce,getDefaultConfig:()=>De,getHIDCodeMapStr:()=>N,getHIDCodeMapStrNum:()=>B,getSamplingModeDescription:()=>Te,hex2hex:()=>Ie,hidKeyCode:()=>E,hslToHsv:()=>te,hslToRgb:()=>Z,hsvToHsl:()=>ne,imageDataToHexArray:()=>he,info:()=>se,isImageValid:()=>z,isShowPopover:()=>V,log:()=>ae,numToAsciiArr:()=>q,numToBits16:()=>K,numToBytes:()=>j,parseColorString:()=>Y,resetLoggerConfig:()=>ce,resizeImageWithCanvas:()=>ve,resizeImageWithKonva:()=>be,rgbToHsl:()=>ee,setLoggerConfig:()=>M,successResult:()=>$,warn:()=>ie});module.exports=O(Re);var E=[{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},{key:73,word:"Escape",dec:"41",hex:"29",kind:1,value:41},{key:74,word:"Backspace",dec:"42",hex:"2A",kind:1,value:42},{key:75,word:"Tab",dec:"43",hex:"2B",kind:1,value:43},{key:76,word:" ",dec:"44",hex:"2C",kind:1,value:44},{key:101,word:"CapsLock",dec:"57",hex:"39",kind:1,value:57},{key:102,word:"F1",dec:"58",hex:"3A",kind:1,value:58},{key:103,word:"F2",dec:"59",hex:"3B",kind:1,value:59},{key:104,word:"F3",dec:"60",hex:"3C",kind:1,value:60},{key:105,word:"F4",dec:"61",hex:"3D",kind:1,value:61},{key:106,word:"F5",dec:"62",hex:"3E",kind:1,value:62},{key:107,word:"F6",dec:"63",hex:"3F",kind:1,value:63},{key:108,word:"F7",dec:"64",hex:"40",kind:1,value:64},{key:109,word:"F8",dec:"65",hex:"41",kind:1,value:65},{key:110,word:"F9",dec:"66",hex:"42",kind:1,value:66},{key:111,word:"F10",dec:"67",hex:"43",kind:1,value:67},{key:112,word:"F11",dec:"68",hex:"44",kind:1,value:68},{key:113,word:"F12",dec:"69",hex:"45",kind:1,value:69},{key:114,word:"PrintScreen",dec:"70",hex:"46",kind:1,value:70},{key:115,word:"ScrollLock",dec:"71",hex:"47",kind:1,value:71},{key:116,word:"Pause",dec:"72",hex:"48",kind:1,value:72},{key:117,word:"Insert",dec:"73",hex:"49",kind:1,value:73},{key:118,word:"Home",dec:"74",hex:"4A",kind:1,value:74},{key:119,word:"PageUp",dec:"75",hex:"4B",kind:1,value:75},{key:120,word:"DeleteForward",dec:"76",hex:"4C",kind:1,value:76},{key:121,word:"End",dec:"77",hex:"4D",kind:1,value:77},{key:122,word:"PageDown",dec:"78",hex:"4E",kind:1,value:78},{key:123,word:"ArrowRight",dec:"79",hex:"4F",kind:1,value:79},{key:124,word:"ArrowLeft",dec:"80",hex:"50",kind:1,value:80},{key:125,word:"ArrowDown",dec:"81",hex:"51",kind:1,value:81},{key:126,word:"ArrowUp",dec:"82",hex:"52",kind:1,value:82},{key:127,word:"NumLock",dec:"83",hex:"53",kind:1,value:83},{key:128,word:"Clear",dec:"83",hex:"53",kind:1,value:83},{key:160,word:"F13",dec:"104",hex:"68",kind:0,value:104},{key:161,word:"F14",dec:"105",hex:"69",kind:0,value:105},{key:162,word:"F15",dec:"106",hex:"6A",kind:0,value:106},{key:163,word:"F16",dec:"107",hex:"6B",kind:0,value:107},{key:164,word:"LeftControl",dec:"224",hex:"E0",kind:0,value:224},{key:165,word:"LeftShift",dec:"225",hex:"E1",kind:0,value:225},{key:166,word:"LeftAlt",dec:"226",hex:"E2",kind:0,value:226},{key:167,word:"LeftGUI",dec:"227",hex:"E3",kind:0,value:227},{key:168,word:"RightControl",dec:"228",hex:"E4",kind:0,value:228},{key:169,word:"RightShift",dec:"229",hex:"E5",kind:0,value:229},{key:170,word:"RightAlt",dec:"230",hex:"E6",kind:0,value:230},{key:171,word:"RightGUI",dec:"231",hex:"E7",kind:0,value:231}],N=()=>E.reduce((e,n)=>(e.set(n.word,n),n.aliases&&n.aliases.length>0&&n.aliases.forEach(t=>{e.set(t,n)}),e),new Map),B=()=>E.reduce((e,n)=>e.set(n.value,n),new Map);var I=require("fflate"),G=e=>{let n=JSON.stringify(e),t=new TextEncoder().encode(n),r=new Uint8Array((0,I.gzipSync)(t));return new Blob([r],{type:"application/gzip"})},_=async e=>{let n=await e.arrayBuffer(),t=(0,I.gunzipSync)(new Uint8Array(n)),r=new TextDecoder().decode(t);return JSON.parse(r)};function V(e){let n=document.getElementById(e);return n&&window.getComputedStyle(n).display!=="none"&&n.getAttribute("aria-hidden")!=="true"}function z(e){return new Promise(n=>{let t=new Image;t.src=typeof e=="string"?e:URL.createObjectURL(e),t.onload=()=>n(!0),t.onerror=()=>n(!1)})}function $(e=null,n="",t=0){return{success:!0,code:t,message:n,data:e}}function W(e,n=-1,t=null){return{success:!1,code:n,message:e,data:t}}var w={LITTLE:"little",BIG:"big"},j=(e,n,t=w.BIG)=>{if(!Number.isInteger(n)||n<=0)throw new Error("Byte count must be a positive integer.");let r=e>>>0,o=new Array(n);for(let a=0;a<n;a++){let s=t===w.LITTLE?a*8:(n-1-a)*8;o[a]=r>>s&255}return o},J=(e,n=w.BIG)=>{let t=0;if(n===w.LITTLE)for(let r=0;r<e.length;r++)t|=(e[r]&255)<<r*8;else for(let r=0;r<e.length;r++)t|=(e[r]&255)<<(e.length-1-r)*8;return t},K=(e,n=w.BIG)=>{let t=e&65535;return n===w.LITTLE?[t&255,t>>8&255]:[t>>8&255,t&255]},Q=(e,n=w.BIG)=>{if(e.length!==2)throw new Error("Input array must have exactly 2 elements");return n===w.LITTLE?e[1]<<8|e[0]:e[0]<<8|e[1]},q=e=>Math.abs(e).toString().split("").map(n=>n.charCodeAt(0)),X=e=>Number(String.fromCharCode(...e));var x=(e,n,t)=>Math.min(Math.max(e,n),t);function Y(e){let n=f=>{let p=f.endsWith("%"),y=parseFloat(f.replace("%",""));return p?Math.round(x(y/100,0,1)*255):x(Math.round(y),0,255)},t=f=>{let p=f.endsWith("%"),y=parseFloat(f.replace("%",""));return x(p?y/100:y,0,1)},r=f=>{if(!f.endsWith("%"))return 0;let p=parseFloat(f.replace("%",""));return x(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[,f,,p,,y]=a;return{type:"rgb",r:n(f),g:n(p),b:n(y)}}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[,f,,p,,y,,C]=u;return{type:"rgba",r:n(f),g:n(p),b:n(y),a:t(C)}}let m=/^hsv\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*\)$/i,i=e.match(m);if(i){let[,f,,p,,y]=i;return{type:"hsv",h:x(parseFloat(f),0,360),s:r(p),v:r(y)}}let d=/^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*\)$/i,c=e.match(d);if(c){let[,f,,p,,y]=c;return{type:"hsl",h:x(parseFloat(f),0,360),s:r(p),l:r(y)}}let g=/^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i,h=e.match(g);if(h){let[,f,,p,,y,,C]=h;return{type:"hsla",h:x(parseFloat(f),0,360),s:r(p),l:r(y),a:t(C)}}return null}function Z(e){let n=x(e.h,0,360)/360,t=x(e.s,0,1),r=x(e.l,0,1),o=0,a=0,s=0;if(t===0)o=a=s=r;else{let u=(d,c,g)=>(g<0&&(g+=1),g>1&&(g-=1),g<.16666666666666666?d+(c-d)*6*g:g<.5?c:g<.6666666666666666?d+(c-d)*(.6666666666666666-g)*6:d),m=r<.5?r*(1+t):r+t-r*t,i=2*r-m;o=u(i,m,n+1/3),a=u(i,m,n),s=u(i,m,n-1/3)}return{type:"rgb",r:Math.round(o*255),g:Math.round(a*255),b:Math.round(s*255)}}function ee(e){let n=x(e.r,0,255)/255,t=x(e.g,0,255)/255,r=x(e.b,0,255)/255,o=Math.max(n,t,r),a=Math.min(n,t,r),s=o-a,u=(o+a)/2,m=0;s!==0&&(m=s/(1-Math.abs(2*u-1)));let i=0;if(s!==0){switch(o){case n:i=(t-r)/s%6;break;case t:i=(r-n)/s+2;break;case r:i=(n-t)/s+4;break}i=Math.round(i*60),i<0&&(i+=360)}return{type:"hsl",h:x(i,0,360),s:x(m,0,1),l:x(u,0,1)}}function ne(e){let{h:n,s:t,v:r}=e,o;t===0?o=r:o=(2-t)*r/2,o=Math.max(0,Math.min(1,o));let a;return o===0||o===1?a=0:(a=t*r/(1-Math.abs(2*o-1)),a=Math.max(0,Math.min(1,a))),{type:"hsl",h:Math.max(0,Math.min(360,n)),s:a,l:o}}function te(e){let{h:n,s:t,l:r}=e,o=r+t*Math.min(r,1-r),a=Math.max(0,Math.min(1,o)),s;return a===0?s=0:(s=2*(1-r/a),s=Math.max(0,Math.min(1,s))),{type:"hsv",h:Math.max(0,Math.min(360,n)),s,v:a}}var re=typeof window<"u",oe=()=>typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="development":re&&window.__ENV__?.MODE?window.__ENV__.MODE==="development":!0,T={enable:oe(),reserveTypes:["error"],prefix:"[iLx1-tool]"},k={...T},v=e=>k.enable?!0:k.reserveTypes.includes(e),ae=(...e)=>{v("log")&&console.log(`${k.prefix} [LOG]`,...e)},se=(...e)=>{v("info")&&console.info(`${k.prefix} [INFO]`,...e)},ie=(...e)=>{v("warn")&&console.warn(`${k.prefix} [WARN]`,...e)},de=(...e)=>{v("error")&&console.error(`${k.prefix} [ERROR]`,...e)},le=(...e)=>{v("debug")&&console.debug(`${k.prefix} [DEBUG]`,...e)},M=e=>{k={...k,...e}},ce=()=>{k={...T}},ue=()=>{M({enable:!0,reserveTypes:["log","info","warn","error","debug"]})},me=()=>{M({enable:!1,reserveTypes:[]})};var b=H(require("konva")),l={generate:async function(e,n,t){try{let r=await this.base64ToImageData(e),o=this.imageDataToHexArray(r,n,t);return t[3]===0?this.hex2hex(this.arrayToHex(o)):o}catch(r){throw console.error("\u751F\u6210\u5341\u516D\u8FDB\u5236\u6570\u7EC4\u65F6\u51FA\u9519:",r),r}},imageDataToHexArray:function(e,n,t){let r=e.data,o=e.height,a=e.width,s=r.length;if(t[4]==1){let u=[];for(let c=0;c<s;c+=4){let h=r[c]*.299+r[c+1]*.587+r[c+2]*.114>n?1:0;u[c/4]=h}let i=t[1],d;switch(i){case 0:d=this.ImageSamplingRow;break;case 1:d=this.ImageSamplingCol;break;case 2:d=this.ImageSamplingColRow;break;case 3:d=this.ImageSamplingRowCol;break;default:d=this.ImageSamplingRow}if(typeof d!="function")throw new Error(`\u53D6\u6A21\u51FD\u6570\u672A\u5B9A\u4E49\uFF0CsamplingMode: ${i}`);return d.call(this,u,a,o,t)}else return this.colorImageSampling(r,a,o,t)},colorImageSampling:function(e,n,t,r){let o=new Uint8Array(n*t*2),a=0,s=0;for(;a<o.length&&s<e.length;){let u=e[s],m=e[s+1],i=e[s+2],d=u>>3&31,c=m>>2&63,g=i>>3&31,h=d<<11|c<<5|g;o[a]=h>>8&255,o[a+1]=h&255,(r[0]==0||r[2]==1)&&(o[a]=~o[a]&255,o[a+1]=~o[a+1]&255),a+=2,s+=4}return o},ImageSamplingRow:function(e,n,t,r){let o=Math.ceil(n/8),a=new Uint8Array(o*t);for(let s=0;s<e.length;s++){let u=s%n,i=Math.floor(s/n),d=u%8,c=1<<d;r[2]!=0&&(c=1<<7-d);let g=i*o+Math.floor(u/8),h=e[s];r[0]!==0&&(h=h===0?1:0),h===0?a[g]|=c:a[g]&=~c}return a},ImageSamplingCol:function(e,n,t,r){let o=Math.ceil(t/8),a=new Uint8Array(o*n);for(let s=0;s<e.length;s++){let u=s%n,m=Math.floor(s/n),i=u,d=m%8,c=1<<d;r[2]!=0&&(c=1<<7-d);let g=i*o+Math.floor(m/8),h=e[s];r[0]!==0&&(h=h===0?1:0),h===0?a[g]|=c:a[g]&=~c}return a},ImageSamplingColRow:function(e,n,t,r){let o=Math.ceil(t/8),a=new Uint8Array(o*n);for(let s=0;s<e.length;s++){let u=s%n,m=Math.floor(s/n),i=Math.floor(m/8),d=m%8,c=1<<d;r[2]!=0&&(c=1<<7-d);let g=u+i*n,h=e[s];r[0]!==0&&(h=h===0?1:0),h===0?a[g]|=c:a[g]&=~c}return a},ImageSamplingRowCol:function(e,n,t,r){let o=Math.ceil(n/8),a=new Uint8Array(o*t);for(let s=0;s<e.length;s++){let u=s%n,m=Math.floor(s/n),i=Math.floor(u/8),d=u%8,c=1<<d;r[2]!=0&&(c=1<<7-d);let g=i*t+m,h=e[s];r[0]!==0&&(h=h===0?1:0),h===0?a[g]|=c:a[g]&=~c}return a},base64ToImageData:function(e){return new Promise((n,t)=>{let r=new Image;r.crossOrigin="anonymous",r.src=e,r.onload=()=>{try{let o=document.createElement("canvas");o.width=r.width,o.height=r.height;let a=o.getContext("2d");a.drawImage(r,0,0);let s=a.getImageData(0,0,o.width,o.height);n(s)}catch(o){t(new Error(`\u8F6C\u6362\u56FE\u50CF\u6570\u636E\u5931\u8D25: ${o.message}`))}},r.onerror=()=>{t(new Error("\u52A0\u8F7D\u56FE\u50CF\u5931\u8D25"))},r.src=e})},resizeImageWithKonva:async function(e,n,t,r){if(e===0||n===0)throw new Error("\u5BBD\u5EA6\u548C\u9AD8\u5EA6\u4E0D\u80FD\u4E3A0");if(!t)throw new Error("\u56FE\u50CF\u5BF9\u8C61\u4E0D\u80FD\u4E3A\u7A7A");return new Promise(o=>{if(typeof b.default>"u"){this.resizeImageWithCanvas(e,n,t,r).then(o).catch(()=>{let i=document.createElement("canvas");i.width=t.width,i.height=t.height,i.getContext("2d").drawImage(t,0,0),o(i.toDataURL("image/png"))});return}let a=new b.default.Stage({container:document.createElement("div"),width:e,height:n}),s=new b.default.Layer;a.add(s);let u=new b.default.Image({image:t,width:e,height:n});r&&u.filters([b.default.Filters.Grayscale]),s.add(u),s.batchDraw();let m=a.toDataURL({mimeType:"image/png",quality:1,pixelRatio:1});a.destroy(),o(m)})},resizeImageWithCanvas:async function(e,n,t,r){return new Promise(o=>{let a=document.createElement("canvas");a.width=e,a.height=n;let s=a.getContext("2d");if(s.imageSmoothingEnabled=!0,s.imageSmoothingQuality="high",s.drawImage(t,0,0,e,n),r){let m=s.getImageData(0,0,e,n),i=m.data;for(let d=0;d<i.length;d+=4){let c=i[d]*.299+i[d+1]*.587+i[d+2]*.114;i[d]=i[d+1]=i[d+2]=c}s.putImageData(m,0,0)}let u=a.toDataURL("image/png");o(u)})},arrayToHex:function(e){return!e||e.length===0?"":Array.from(e).map(n=>Number(n).toString(16).padStart(2,"0")).join("")},hex2hex:function(e){if(!e||e.length===0)return[];let n=[];for(let t=0;t<e.length;t+=2)n.push("0x"+e.substring(t,t+2));return n},generatePreview:function(e,n){if(!e||e.length===0)return"";let t="";for(let r=0;r<e.length;r++)t+=e[r]===0?"0":"1",(r+1)%n===0&&(t+=`
2
- `);return t},createImageData:function(e,n,t=null){let r=document.createElement("canvas");r.width=e,r.height=n;let o=r.getContext("2d");if(t){let a=o.createImageData(e,n);return a.data.set(t),a}else return o.createImageData(e,n)},formatHexOutput:function(e,n=0,t=16){if(!e||e.length===0)return"\u65E0\u6570\u636E";let r="";if(n===0&&Array.isArray(e))for(let o=0;o<e.length;o++)r+=e[o]+", ",(o+1)%t===0&&(r+=`
3
- `);else if(e instanceof Uint8Array)for(let o=0;o<e.length;o++)r+=e[o].toString(16).padStart(2,"0")+" ",(o+1)%t===0&&(r+=`
4
- `);else r=e.toString();return r},calculateOutputSize:function(e){let n=0;(Array.isArray(e)||e instanceof Uint8Array)&&(n=e.length);let t=n/1024;return{bytes:n,kilobytes:t,formatted:`${n} \u5B57\u8282 (${t.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]}},ge=l.generate.bind(l),he=l.imageDataToHexArray.bind(l),fe=l.colorImageSampling.bind(l),xe=l.ImageSamplingRow.bind(l),pe=l.ImageSamplingCol.bind(l),ye=l.ImageSamplingColRow.bind(l),ke=l.ImageSamplingRowCol.bind(l),we=l.base64ToImageData.bind(l),be=l.resizeImageWithKonva.bind(l),ve=l.resizeImageWithCanvas.bind(l),Se=l.arrayToHex.bind(l),Ie=l.hex2hex.bind(l),Ce=l.generatePreview.bind(l),Ee=l.createImageData.bind(l),Me=l.formatHexOutput.bind(l),Ae=l.calculateOutputSize.bind(l),Te=l.getSamplingModeDescription.bind(l),De=l.getDefaultConfig.bind(l);0&&(module.exports={Endianness,ImageSamplingCol,ImageSamplingColRow,ImageSamplingRow,ImageSamplingRowCol,ImageToHexArray,arrayToHex,asciiArrToNum,base64ToImageData,bits16ToNum,bytesToNum,calculateOutputSize,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 A=Object.create;var S=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var P=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 P(t))!O.call(e,a)&&a!==r&&S(e,a,{get:()=>t[a],enumerable:!(n=D(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 De={};F(De,{Endianness:()=>y,ImageSamplingCol:()=>xe,ImageSamplingColRow:()=>ke,ImageSamplingRow:()=>pe,ImageSamplingRowCol:()=>we,ImageToHexArray:()=>d,arrayToHex:()=>Se,asciiArrToNum:()=>X,base64ToImageData:()=>ye,bits16ToNum:()=>Q,bytesToNum:()=>j,calculateOutputSize:()=>Ce,colorImageSampling:()=>me,compressJsonGzip:()=>W,createImageData:()=>Te,debug:()=>de,decompressJsonGzip:()=>B,disableAllLogs:()=>ge,enableAllLogs:()=>ue,error:()=>le,errorResult:()=>$,formatHexOutput:()=>Ee,generate:()=>fe,generatePreview:()=>Ie,getDefaultConfig:()=>Ae,getHIDCodeMapStr:()=>G,getHIDCodeMapStrNum:()=>N,getSamplingModeDescription:()=>Le,hex2hex:()=>Re,hidKeyCode:()=>T,hslToHsv:()=>re,hslToRgb:()=>Z,hsvToHsl:()=>te,imageDataToHexArray:()=>he,info:()=>se,isImageValid:()=>_,isShowPopover:()=>V,log:()=>oe,numToAsciiArr:()=>q,numToBits16:()=>J,numToBytes:()=>K,parseColorString:()=>Y,resetLoggerConfig:()=>ce,resizeImageWithCanvas:()=>ve,resizeImageWithKonva:()=>be,rgbToHsl:()=>ee,setLoggerConfig:()=>E,successResult:()=>z,warn:()=>ie});module.exports=H(De);var T=[{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=()=>T.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=()=>T.reduce((e,t)=>e.set(t.value,t),new Map);var R=require("fflate"),W=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"})},B=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"}function _(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 z(e=null,t="",r=0){return{success:!0,code:r,message:t,data:e}}function $(e,t=-1,r=null){return{success:!1,code:t,message:e,data:r}}var y={LITTLE:"little",BIG:"big"},K=(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},j=(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},J=(e,t=y.BIG)=>{let r=e&65535;return t===y.LITTLE?[r&255,r>>8&255]:[r>>8&255,r&255]},Q=(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]},q=e=>Math.abs(e).toString().split("").map(t=>t.charCodeAt(0)),X=e=>Number(String.fromCharCode(...e));var p=(e,t,r)=>Math.min(Math.max(e,t),r);function Y(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,,I]=u;return{type:"rgba",r:t(m),g:t(x),b:t(k),a:r(I)}}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,,I]=h;return{type:"hsla",h:p(parseFloat(m),0,360),s:n(x),l:n(k),a:r(I)}}return null}function Z(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 ee(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 te(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 re(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 ne=typeof window<"u",ae=()=>typeof process<"u"&&process.env?.NODE_ENV?process.env.NODE_ENV==="development":ne&&window.__ENV__?.MODE?window.__ENV__.MODE==="development":!0,L={enable:ae(),reserveTypes:["error"],prefix:"[iLx1-tool]"},w={...L},v=e=>w.enable?!0:w.reserveTypes.includes(e),oe=(...e)=>{v("log")&&console.log(`${w.prefix} [LOG]`,...e)},se=(...e)=>{v("info")&&console.info(`${w.prefix} [INFO]`,...e)},ie=(...e)=>{v("warn")&&console.warn(`${w.prefix} [WARN]`,...e)},le=(...e)=>{v("error")&&console.error(`${w.prefix} [ERROR]`,...e)},de=(...e)=>{v("debug")&&console.debug(`${w.prefix} [DEBUG]`,...e)},E=e=>{w={...w,...e}},ce=()=>{w={...L}},ue=()=>{E({enable:!0,reserveTypes:["log","info","warn","error","debug"]})},ge=()=>{E({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]}},fe=d.generate.bind(d),he=d.imageDataToHexArray.bind(d),me=d.colorImageSampling.bind(d),pe=d.ImageSamplingRow.bind(d),xe=d.ImageSamplingCol.bind(d),ke=d.ImageSamplingColRow.bind(d),we=d.ImageSamplingRowCol.bind(d),ye=d.base64ToImageData.bind(d),be=d.resizeImageWithKonva.bind(d),ve=d.resizeImageWithCanvas.bind(d),Se=d.arrayToHex.bind(d),Re=d.hex2hex.bind(d),Ie=d.generatePreview.bind(d),Te=d.createImageData.bind(d),Ee=d.formatHexOutput.bind(d),Ce=d.calculateOutputSize.bind(d),Le=d.getSamplingModeDescription.bind(d),Ae=d.getDefaultConfig.bind(d);0&&(module.exports={Endianness,ImageSamplingCol,ImageSamplingColRow,ImageSamplingRow,ImageSamplingRowCol,ImageToHexArray,arrayToHex,asciiArrToNum,base64ToImageData,bits16ToNum,bytesToNum,calculateOutputSize,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});
5
5
  //# sourceMappingURL=index.js.map