nv-img-barcode-bw 1.0.1
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/DEPS/html2canvas.min.js +20 -0
- package/DEPS/jsbarcode.min.js +2 -0
- package/DEPS/zxing.js +1 -0
- package/DIST/nv-img-barcode-bw.full.js +3173 -0
- package/DIST/nv-img-barcode-bw.js +265 -0
- package/TEST/api.html +1132 -0
- package/TEST/code128-VS-ean128.html +501 -0
- package/TEST/gs1-VS-nongs1.html +208 -0
- package/TEST/index.html +746 -0
- package/TEST/tst.html +950 -0
- package/TOOL/api.tmpl.html +867 -0
- package/TOOL/cli-creat-dist.js +5 -0
- package/TOOL/cli-creat-html.js +13 -0
- package/TOOL/index.tmpl.html +481 -0
- package/cfg.js +56 -0
- package/com.sh +5 -0
- package/css.js +170 -0
- package/decd.js +270 -0
- package/eng.js +589 -0
- package/index.js +366 -0
- package/package.json +17 -0
- package/ui.js +36 -0
package/TEST/index.html
ADDED
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>BarcodeButton 测试页面</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
16
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
17
|
+
min-height: 100vh;
|
|
18
|
+
padding: 20px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.container {
|
|
22
|
+
max-width: 800px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
background: white;
|
|
25
|
+
padding: 40px;
|
|
26
|
+
border-radius: 20px;
|
|
27
|
+
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
header {
|
|
31
|
+
text-align: center;
|
|
32
|
+
margin-bottom: 40px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h1 {
|
|
36
|
+
color: #333;
|
|
37
|
+
font-size: 2.5rem;
|
|
38
|
+
margin-bottom: 10px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.subtitle {
|
|
42
|
+
color: #666;
|
|
43
|
+
font-size: 1.1rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.input-form {
|
|
47
|
+
background: #f8f9fa;
|
|
48
|
+
padding: 30px;
|
|
49
|
+
border-radius: 12px;
|
|
50
|
+
margin-bottom: 30px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.form-title {
|
|
54
|
+
color: #4a5568;
|
|
55
|
+
margin-bottom: 20px;
|
|
56
|
+
font-size: 1.4rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.form-group {
|
|
60
|
+
margin-bottom: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.form-group label {
|
|
64
|
+
display: block;
|
|
65
|
+
margin-bottom: 8px;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
color: #4a5568;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.form-control {
|
|
71
|
+
width: 100%;
|
|
72
|
+
padding: 12px;
|
|
73
|
+
border: 2px solid #e2e8f0;
|
|
74
|
+
border-radius: 8px;
|
|
75
|
+
font-size: 16px;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.form-control:focus {
|
|
80
|
+
outline: none;
|
|
81
|
+
border-color: #667eea;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.form-row {
|
|
85
|
+
display: grid;
|
|
86
|
+
grid-template-columns: 1fr 1fr;
|
|
87
|
+
gap: 20px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.color-input-wrapper {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 10px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.color-input {
|
|
97
|
+
width: 60px;
|
|
98
|
+
height: 50px;
|
|
99
|
+
padding: 0;
|
|
100
|
+
border: 2px solid #e2e8f0;
|
|
101
|
+
border-radius: 8px;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.color-value {
|
|
106
|
+
flex: 1;
|
|
107
|
+
padding: 12px;
|
|
108
|
+
background: white;
|
|
109
|
+
border: 2px solid #e2e8f0;
|
|
110
|
+
border-radius: 8px;
|
|
111
|
+
font-family: 'Courier New', monospace;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.generate-btn {
|
|
115
|
+
width: 100%;
|
|
116
|
+
padding: 15px;
|
|
117
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
118
|
+
color: white;
|
|
119
|
+
border: none;
|
|
120
|
+
border-radius: 8px;
|
|
121
|
+
font-size: 18px;
|
|
122
|
+
font-weight: 600;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
margin-top: 10px;
|
|
125
|
+
transition: all 0.3s;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.generate-btn:hover {
|
|
129
|
+
transform: translateY(-2px);
|
|
130
|
+
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.preview-section {
|
|
134
|
+
background: #f8f9fa;
|
|
135
|
+
padding: 30px;
|
|
136
|
+
border-radius: 12px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.preview-title {
|
|
140
|
+
color: #4a5568;
|
|
141
|
+
margin-bottom: 20px;
|
|
142
|
+
font-size: 1.4rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.preview-grid {
|
|
146
|
+
display: grid;
|
|
147
|
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
148
|
+
gap: 20px;
|
|
149
|
+
margin-top: 20px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.preview-item {
|
|
153
|
+
text-align: center;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.preview-label {
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
color: #4a5568;
|
|
159
|
+
margin-bottom: 10px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.examples-section {
|
|
163
|
+
margin-top: 40px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.examples-title {
|
|
167
|
+
color: #4a5568;
|
|
168
|
+
margin-bottom: 20px;
|
|
169
|
+
font-size: 1.4rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.examples-grid {
|
|
173
|
+
display: grid;
|
|
174
|
+
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
175
|
+
gap: 20px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.example-item {
|
|
179
|
+
background: #f8f9fa;
|
|
180
|
+
padding: 20px;
|
|
181
|
+
border-radius: 8px;
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
transition: all 0.3s;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.example-item:hover {
|
|
187
|
+
transform: translateY(-3px);
|
|
188
|
+
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.example-content {
|
|
192
|
+
font-weight: 600;
|
|
193
|
+
margin-bottom: 10px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.example-description {
|
|
197
|
+
color: #718096;
|
|
198
|
+
font-size: 14px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.dynamic-barcode {
|
|
202
|
+
margin-top: 30px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.alert {
|
|
206
|
+
position: fixed;
|
|
207
|
+
top: 20px;
|
|
208
|
+
right: 20px;
|
|
209
|
+
padding: 12px 20px;
|
|
210
|
+
border-radius: 8px;
|
|
211
|
+
background: #38a169;
|
|
212
|
+
color: white;
|
|
213
|
+
font-weight: 500;
|
|
214
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
215
|
+
z-index: 1000;
|
|
216
|
+
display: none;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.alert.show {
|
|
220
|
+
display: block;
|
|
221
|
+
animation: slideIn 0.3s ease;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@keyframes slideIn {
|
|
225
|
+
from { transform: translateX(100%); opacity: 0; }
|
|
226
|
+
to { transform: translateX(0); opacity: 1; }
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
footer {
|
|
230
|
+
text-align: center;
|
|
231
|
+
margin-top: 40px;
|
|
232
|
+
padding-top: 20px;
|
|
233
|
+
border-top: 1px solid #e2e8f0;
|
|
234
|
+
color: #718096;
|
|
235
|
+
}
|
|
236
|
+
</style>
|
|
237
|
+
</head>
|
|
238
|
+
<body>
|
|
239
|
+
<div class="container">
|
|
240
|
+
<header>
|
|
241
|
+
<h1>📊 BarcodeButton 测试页面</h1>
|
|
242
|
+
<p class="subtitle">在下方输入条形码信息,点击生成按钮查看效果</p>
|
|
243
|
+
</header>
|
|
244
|
+
|
|
245
|
+
<div class="input-form">
|
|
246
|
+
<h2 class="form-title">🔧 自定义条形码生成</h2>
|
|
247
|
+
|
|
248
|
+
<div class="form-group">
|
|
249
|
+
<label for="barcode-input">条形码内容:</label>
|
|
250
|
+
<input type="text" id="barcode-input" class="form-control"
|
|
251
|
+
placeholder="输入条形码内容(支持中文、英文、数字)"
|
|
252
|
+
value="123456789012">
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
<div class="form-row">
|
|
256
|
+
<div class="form-group">
|
|
257
|
+
<label for="format-select">编码格式:</label>
|
|
258
|
+
<select id="format-select" class="form-control">
|
|
259
|
+
<option value="CODE128" selected>CODE128(通用格式)</option>
|
|
260
|
+
<option value="EAN13">EAN13(商品条码)</option>
|
|
261
|
+
<option value="EAN8">EAN8</option>
|
|
262
|
+
<option value="UPC">UPC(北美商品码)</option>
|
|
263
|
+
<option value="CODE39">CODE39</option>
|
|
264
|
+
<option value="ITF14">ITF14(物流包装)</option>
|
|
265
|
+
<option value="MSI">MSI(库存管理)</option>
|
|
266
|
+
<option value="pharmacode">Pharmacode(药品码)</option>
|
|
267
|
+
</select>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
<div class="form-group">
|
|
271
|
+
<label for="color-input">线条颜色:</label>
|
|
272
|
+
<div class="color-input-wrapper">
|
|
273
|
+
<input type="color" id="color-input" class="color-input" value="#000000">
|
|
274
|
+
<input type="text" id="color-value" class="color-value" value="#000000">
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<button class="generate-btn" id="generate-btn">
|
|
280
|
+
🎯 生成条形码
|
|
281
|
+
</button>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div class="preview-section">
|
|
285
|
+
<h2 class="preview-title">🔍 条形码预览</h2>
|
|
286
|
+
<div id="barcode-preview"></div>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
<div class="dynamic-barcode">
|
|
290
|
+
<h2 class="preview-title">📦 动态生成的条形码</h2>
|
|
291
|
+
<p style="color: #666; margin-bottom: 20px;">以下是通过JavaScript动态创建的条形码按钮:</p>
|
|
292
|
+
<div id="dynamic-barcodes"></div>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<div class="examples-section">
|
|
296
|
+
<h2 class="examples-title">🎯 示例条形码</h2>
|
|
297
|
+
<p style="color: #666; margin-bottom: 20px;">点击下方示例快速生成条形码:</p>
|
|
298
|
+
|
|
299
|
+
<div class="examples-grid">
|
|
300
|
+
<div class="example-item" data-code="123456789012" data-format="EAN13" data-color="#e53e3e">
|
|
301
|
+
<div class="example-content">123456789012</div>
|
|
302
|
+
<div class="example-description">EAN13 商品条码</div>
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<div class="example-item" data-code="PRODUCT-2024-001" data-format="CODE128" data-color="#38a169">
|
|
306
|
+
<div class="example-content">PRODUCT-2024-001</div>
|
|
307
|
+
<div class="example-description">产品编码</div>
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div class="example-item" data-code="微信扫码测试" data-format="CODE128" data-color="#805ad5">
|
|
311
|
+
<div class="example-content">微信扫码测试</div>
|
|
312
|
+
<div class="example-description">中文内容</div>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<div class="example-item" data-code="ORDER-789-ABC" data-format="CODE39" data-color="#d69e2e">
|
|
316
|
+
<div class="example-content">ORDER-789-ABC</div>
|
|
317
|
+
<div class="example-description">订单编码</div>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<footer>
|
|
323
|
+
<p>BarcodeButton 组件测试页面 | 点击生成按钮查看条形码弹窗,支持PNG/SVG下载</p>
|
|
324
|
+
</footer>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<div class="alert" id="alert"></div>
|
|
328
|
+
|
|
329
|
+
<script>
|
|
330
|
+
// 动态创建BarcodeButton组件
|
|
331
|
+
class DynamicBarcodeButton extends HTMLElement {
|
|
332
|
+
constructor(code, format, lineColor, text, bgColor) {
|
|
333
|
+
super();
|
|
334
|
+
this.code = code;
|
|
335
|
+
this.format = format;
|
|
336
|
+
this.lineColor = lineColor;
|
|
337
|
+
this.text = text;
|
|
338
|
+
this.bgColor = bgColor;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
connectedCallback() {
|
|
342
|
+
this.innerHTML = `
|
|
343
|
+
<nv-barcode-button
|
|
344
|
+
code="${this.code}"
|
|
345
|
+
format="${this.format}"
|
|
346
|
+
line-color="${this.lineColor}"
|
|
347
|
+
text="${this.text}"
|
|
348
|
+
bg-color="${this.bgColor}"
|
|
349
|
+
></nv-barcode-button>
|
|
350
|
+
`;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
customElements.define('dynamic-barcode', DynamicBarcodeButton);
|
|
354
|
+
</script>
|
|
355
|
+
|
|
356
|
+
<!-- 引入BarcodeButton组件 -->
|
|
357
|
+
<script>var nvimgbarcode=(()=>{var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ue=w((yr,de)=>{var A={"00":{name:"SSCC",length:18,format:"numeric",desc:"\u7269\u6D41\u5355\u5143\u6807\u8BC6\u7B26"},"01":{name:"GTIN",length:14,format:"numeric",desc:"\u5168\u7403\u8D38\u6613\u9879\u76EE\u4EE3\u7801"},"02":{name:"CONTENT_GTIN",length:14,format:"numeric",desc:"\u7269\u6D41\u5355\u5143\u5185\u8D38\u6613\u9879\u76EEGTIN"},10:{name:"BATCH",length:20,format:"alphanumeric",desc:"\u6279\u53F7"},11:{name:"PROD_DATE",length:6,format:"date",desc:"\u751F\u4EA7\u65E5\u671F(YYMMDD)"},12:{name:"DUE_DATE",length:6,format:"date",desc:"\u4ED8\u6B3E\u622A\u6B62\u65E5\u671F(YYMMDD)"},13:{name:"PACK_DATE",length:6,format:"date",desc:"\u5305\u88C5\u65E5\u671F(YYMMDD)"},15:{name:"BEST_BEFORE",length:6,format:"date",desc:"\u4FDD\u8D28\u671F(YYMMDD)"},16:{name:"SELL_BY",length:6,format:"date",desc:"\u9500\u552E\u65E5\u671F(YYMMDD)"},17:{name:"EXPIRY",length:6,format:"date",desc:"\u6709\u6548\u671F(YYMMDD)"},19:{name:"EXPIRY_ALT",length:6,format:"date",desc:"\u8FC7\u671F\u65E5\u671F(YYMMDD)"},20:{name:"VARIANT",length:2,format:"numeric",desc:"\u5305\u88C5\u5185\u90E8\u6807\u8BC6"},21:{name:"SERIAL",length:20,format:"alphanumeric",desc:"\u5E8F\u5217\u53F7"},22:{name:"MEDICAL_DATA",length:20,format:"alphanumeric",desc:"\u533B\u7597\u4EA7\u54C1\u9644\u52A0\u6570\u636E"},23:{name:"LOT_GROUP",length:20,format:"alphanumeric",desc:"\u7EC4\u53F7"},30:{name:"VAR_COUNT",length:8,format:"numeric",desc:"\u53EF\u53D8\u6570\u91CF"},3100:{name:"NET_WEIGHT_0",length:6,format:"numeric",decimal:0,unit:"kg",desc:"\u51C0\u91CD(kg)\u6574\u6570"},3101:{name:"NET_WEIGHT_1",length:6,format:"numeric",decimal:1,unit:"kg",desc:"\u51C0\u91CD(kg)1\u4F4D\u5C0F\u6570"},3102:{name:"NET_WEIGHT_2",length:6,format:"numeric",decimal:2,unit:"kg",desc:"\u51C0\u91CD(kg)2\u4F4D\u5C0F\u6570"},3103:{name:"NET_WEIGHT_3",length:6,format:"numeric",decimal:3,unit:"kg",desc:"\u51C0\u91CD(kg)3\u4F4D\u5C0F\u6570"},3104:{name:"NET_WEIGHT_4",length:6,format:"numeric",decimal:4,unit:"kg",desc:"\u51C0\u91CD(kg)4\u4F4D\u5C0F\u6570"},3105:{name:"NET_WEIGHT_5",length:6,format:"numeric",decimal:5,unit:"kg",desc:"\u51C0\u91CD(kg)5\u4F4D\u5C0F\u6570"},3110:{name:"LENGTH_0",length:6,format:"numeric",decimal:0,unit:"m",desc:"\u957F\u5EA6(m)\u6574\u6570"},3111:{name:"LENGTH_1",length:6,format:"numeric",decimal:1,unit:"m",desc:"\u957F\u5EA6(m)1\u4F4D\u5C0F\u6570"},3112:{name:"LENGTH_2",length:6,format:"numeric",decimal:2,unit:"m",desc:"\u957F\u5EA6(m)2\u4F4D\u5C0F\u6570"},3113:{name:"LENGTH_3",length:6,format:"numeric",decimal:3,unit:"m",desc:"\u957F\u5EA6(m)3\u4F4D\u5C0F\u6570"},3114:{name:"LENGTH_4",length:6,format:"numeric",decimal:4,unit:"m",desc:"\u957F\u5EA6(m)4\u4F4D\u5C0F\u6570"},3115:{name:"LENGTH_5",length:6,format:"numeric",decimal:5,unit:"m",desc:"\u957F\u5EA6(m)5\u4F4D\u5C0F\u6570"},3120:{name:"WIDTH_0",length:6,format:"numeric",decimal:0,unit:"m",desc:"\u5BBD\u5EA6(m)\u6574\u6570"},3121:{name:"WIDTH_1",length:6,format:"numeric",decimal:1,unit:"m",desc:"\u5BBD\u5EA6(m)1\u4F4D\u5C0F\u6570"},3122:{name:"WIDTH_2",length:6,format:"numeric",decimal:2,unit:"m",desc:"\u5BBD\u5EA6(m)2\u4F4D\u5C0F\u6570"},3123:{name:"WIDTH_3",length:6,format:"numeric",decimal:3,unit:"m",desc:"\u5BBD\u5EA6(m)3\u4F4D\u5C0F\u6570"},3124:{name:"WIDTH_4",length:6,format:"numeric",decimal:4,unit:"m",desc:"\u5BBD\u5EA6(m)4\u4F4D\u5C0F\u6570"},3125:{name:"WIDTH_5",length:6,format:"numeric",decimal:5,unit:"m",desc:"\u5BBD\u5EA6(m)5\u4F4D\u5C0F\u6570"},3130:{name:"HEIGHT_0",length:6,format:"numeric",decimal:0,unit:"m",desc:"\u9AD8\u5EA6(m)\u6574\u6570"},3131:{name:"HEIGHT_1",length:6,format:"numeric",decimal:1,unit:"m",desc:"\u9AD8\u5EA6(m)1\u4F4D\u5C0F\u6570"},3132:{name:"HEIGHT_2",length:6,format:"numeric",decimal:2,unit:"m",desc:"\u9AD8\u5EA6(m)2\u4F4D\u5C0F\u6570"},3133:{name:"HEIGHT_3",length:6,format:"numeric",decimal:3,unit:"m",desc:"\u9AD8\u5EA6(m)3\u4F4D\u5C0F\u6570"},3134:{name:"HEIGHT_4",length:6,format:"numeric",decimal:4,unit:"m",desc:"\u9AD8\u5EA6(m)4\u4F4D\u5C0F\u6570"},3135:{name:"HEIGHT_5",length:6,format:"numeric",decimal:5,unit:"m",desc:"\u9AD8\u5EA6(m)5\u4F4D\u5C0F\u6570"},3140:{name:"AREA_0",length:6,format:"numeric",decimal:0,unit:"m\xB2",desc:"\u9762\u79EF(m\xB2)\u6574\u6570"},3141:{name:"AREA_1",length:6,format:"numeric",decimal:1,unit:"m\xB2",desc:"\u9762\u79EF(m\xB2)1\u4F4D\u5C0F\u6570"},3142:{name:"AREA_2",length:6,format:"numeric",decimal:2,unit:"m\xB2",desc:"\u9762\u79EF(m\xB2)2\u4F4D\u5C0F\u6570"},3143:{name:"AREA_3",length:6,format:"numeric",decimal:3,unit:"m\xB2",desc:"\u9762\u79EF(m\xB2)3\u4F4D\u5C0F\u6570"},3144:{name:"AREA_4",length:6,format:"numeric",decimal:4,unit:"m\xB2",desc:"\u9762\u79EF(m\xB2)4\u4F4D\u5C0F\u6570"},3145:{name:"AREA_5",length:6,format:"numeric",decimal:5,unit:"m\xB2",desc:"\u9762\u79EF(m\xB2)5\u4F4D\u5C0F\u6570"},3150:{name:"NET_VOLUME_L_0",length:6,format:"numeric",decimal:0,unit:"l",desc:"\u51C0\u5BB9\u79EF(l)\u6574\u6570"},3151:{name:"NET_VOLUME_L_1",length:6,format:"numeric",decimal:1,unit:"l",desc:"\u51C0\u5BB9\u79EF(l)1\u4F4D\u5C0F\u6570"},3152:{name:"NET_VOLUME_L_2",length:6,format:"numeric",decimal:2,unit:"l",desc:"\u51C0\u5BB9\u79EF(l)2\u4F4D\u5C0F\u6570"},3153:{name:"NET_VOLUME_L_3",length:6,format:"numeric",decimal:3,unit:"l",desc:"\u51C0\u5BB9\u79EF(l)3\u4F4D\u5C0F\u6570"},3154:{name:"NET_VOLUME_L_4",length:6,format:"numeric",decimal:4,unit:"l",desc:"\u51C0\u5BB9\u79EF(l)4\u4F4D\u5C0F\u6570"},3155:{name:"NET_VOLUME_L_5",length:6,format:"numeric",decimal:5,unit:"l",desc:"\u51C0\u5BB9\u79EF(l)5\u4F4D\u5C0F\u6570"},3160:{name:"NET_VOLUME_M3_0",length:6,format:"numeric",decimal:0,unit:"m\xB3",desc:"\u51C0\u4F53\u79EF(m\xB3)\u6574\u6570"},3161:{name:"NET_VOLUME_M3_1",length:6,format:"numeric",decimal:1,unit:"m\xB3",desc:"\u51C0\u4F53\u79EF(m\xB3)1\u4F4D\u5C0F\u6570"},3162:{name:"NET_VOLUME_M3_2",length:6,format:"numeric",decimal:2,unit:"m\xB3",desc:"\u51C0\u4F53\u79EF(m\xB3)2\u4F4D\u5C0F\u6570"},3163:{name:"NET_VOLUME_M3_3",length:6,format:"numeric",decimal:3,unit:"m\xB3",desc:"\u51C0\u4F53\u79EF(m\xB3)3\u4F4D\u5C0F\u6570"},3164:{name:"NET_VOLUME_M3_4",length:6,format:"numeric",decimal:4,unit:"m\xB3",desc:"\u51C0\u4F53\u79EF(m\xB3)4\u4F4D\u5C0F\u6570"},3165:{name:"NET_VOLUME_M3_5",length:6,format:"numeric",decimal:5,unit:"m\xB3",desc:"\u51C0\u4F53\u79EF(m\xB3)5\u4F4D\u5C0F\u6570"},3200:{name:"NET_WEIGHT_LB_0",length:6,format:"numeric",decimal:0,unit:"lb",desc:"\u51C0\u91CD(lb)\u6574\u6570"},3201:{name:"NET_WEIGHT_LB_1",length:6,format:"numeric",decimal:1,unit:"lb",desc:"\u51C0\u91CD(lb)1\u4F4D\u5C0F\u6570"},3202:{name:"NET_WEIGHT_LB_2",length:6,format:"numeric",decimal:2,unit:"lb",desc:"\u51C0\u91CD(lb)2\u4F4D\u5C0F\u6570"},3203:{name:"NET_WEIGHT_LB_3",length:6,format:"numeric",decimal:3,unit:"lb",desc:"\u51C0\u91CD(lb)3\u4F4D\u5C0F\u6570"},3204:{name:"NET_WEIGHT_LB_4",length:6,format:"numeric",decimal:4,unit:"lb",desc:"\u51C0\u91CD(lb)4\u4F4D\u5C0F\u6570"},3205:{name:"NET_WEIGHT_LB_5",length:6,format:"numeric",decimal:5,unit:"lb",desc:"\u51C0\u91CD(lb)5\u4F4D\u5C0F\u6570"},3300:{name:"GROSS_WEIGHT_0",length:6,format:"numeric",decimal:0,unit:"kg",desc:"\u6BDB\u91CD(kg)\u6574\u6570"},3301:{name:"GROSS_WEIGHT_1",length:6,format:"numeric",decimal:1,unit:"kg",desc:"\u6BDB\u91CD(kg)1\u4F4D\u5C0F\u6570"},3302:{name:"GROSS_WEIGHT_2",length:6,format:"numeric",decimal:2,unit:"kg",desc:"\u6BDB\u91CD(kg)2\u4F4D\u5C0F\u6570"},3303:{name:"GROSS_WEIGHT_3",length:6,format:"numeric",decimal:3,unit:"kg",desc:"\u6BDB\u91CD(kg)3\u4F4D\u5C0F\u6570"},3304:{name:"GROSS_WEIGHT_4",length:6,format:"numeric",decimal:4,unit:"kg",desc:"\u6BDB\u91CD(kg)4\u4F4D\u5C0F\u6570"},3305:{name:"GROSS_WEIGHT_5",length:6,format:"numeric",decimal:5,unit:"kg",desc:"\u6BDB\u91CD(kg)5\u4F4D\u5C0F\u6570"},37:{name:"COUNT",length:8,format:"numeric",desc:"\u7269\u6D41\u5355\u5143\u5185\u5546\u54C1\u6570\u91CF"},90:{name:"INTERNAL_1",length:30,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E490"},91:{name:"INTERNAL_2",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E491"},92:{name:"INTERNAL_3",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E492"},93:{name:"INTERNAL_4",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E493"},94:{name:"INTERNAL_5",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E494"},95:{name:"INTERNAL_6",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E495"},96:{name:"INTERNAL_7",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E496"},97:{name:"INTERNAL_8",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E497"},98:{name:"INTERNAL_9",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E498"},99:{name:"INTERNAL_10",length:90,format:"alphanumeric",desc:"\u81EA\u5B9A\u4E499"}},ae=/^[A-Za-z0-9 !"*+,\-.\/:;=?_\x23\x24]+$/,yt=/^(\d{2})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,Et=e=>{let t=new Date(e),n=t.getFullYear()%100,r=t.getMonth()+1,i=t.getDate();return[n.toString().padStart(2,"0"),r.toString().padStart(2,"0"),i.toString().padStart(2,"0")].join("")},vt=e=>{let n=String(e).split("."),r=null,i=parseInt(n[0]||"0",10);i!==0&&(r=i);let s=null;if(n[1]&&n[1]!=="0"){let a=n[1].replace(/0+$/,"");a&&a!=="0"&&(s=parseInt(a,10))}return[r,s]},se=(e,t)=>{let n=Number(t);return Object.is(n,NaN)?[!1,`${e.desc} \u5FC5\u987B\u662F\u6574\u6570\u6570\u5B57`]:n<0?[!1,"\u4E0D\u53EF\u4E3A\u8D1F\u6570"]:n<=Number.MAX_SAFE_INTEGER?parseInt(n)===n?(t=String(n),t.length<=e.length?(t="0".repeat(e.length-t.length)+t,[!0,t]):[!1,`${e.desc} \u957F\u5EA6\u6700\u591A ${e.length}`]):[!1,`${e.desc} \u5FC5\u987B\u662F\u6574\u6570\u6570\u5B57`]:(n=BigInt(t),t=String(n),t.length<=e.length?(t="0".repeat(e.length-t.length)+t,[!0,t]):[!1,`${e.desc} \u957F\u5EA6\u6700\u591A ${e.length}`])},oe=(e,t)=>{e=String(e);let n=A[e];if(n===void 0)return[!1,"\u975E\u6CD5AI"];if(n.format==="numeric"){if(n.decimal===void 0||n.decimal===0)return se(n,t);{let r=Number(t),[i,s]=vt(r);if(i===null)return s===null?[!0,"0".repeat(n.length)]:(s="0."+String(s),s=Number(s),s=s*10**n.decimal,s=String(s),s="0".repeat(n.length-s.length)+s,[!0,s]);if(s===null)return se(n,i);{let a=String(i).length,o=n.length-n.decimal;if(a>o)return[!1,`${n.desc} \u957F\u5EA6\u6700\u591A ${n.length}`];{let c=String(i).padStart(o,"0"),_=String(s).padEnd(n.decimal,"0").substring(0,n.decimal);return[!0,c+_]}}}}else return n.format==="date"?typeof t=="number"?[!0,Et(t)]:(t=String(t),yt.test(t)?[!0,t]:[!1,`${n.desc} \u5FC5\u9700\u5339\u914D YYMMDD`]):(t=String(t),ae.test(t)?n.length>=t.length?[!0,t]:[!1,`${n.desc} \u957F\u5EA6\u5FC5\u9700 <= ${n.length}`]:[!1,`${n.desc} \u5FC5\u9700\u5339\u914D /^[A-Za-z0-9 !"%&'()*+,-./:;<=>?_]+$/`])},C={\u7269\u6D41\u5355\u5143\u6807\u8BC6\u7B26:"00",\u7269\u6D41\u5355\u5143:"00",\u8FD0\u8F93\u5305\u88C5\u4EE3\u7801:"00",\u6258\u76D8\u4EE3\u7801:"00",\u5546\u54C1\u6761\u7801:"01",\u5546\u54C1\u4EE3\u7801:"01",\u4EA7\u54C1\u4EE3\u7801:"01",\u6279\u6B21:"10",\u6279\u53F7:"10",lot:"10",batch:"10",\u751F\u4EA7\u65E5\u671F:"11",\u5236\u9020\u65E5\u671F:"11",\u4FDD\u8D28\u671F:"15",\u4FDD\u9C9C\u671F:"15",\u6709\u6548\u671F:"17",\u5230\u671F\u65E5:"17",\u6570\u91CF:"30",\u4EF6\u6570:"30",quantity:"30",\u7269\u6D41\u5355\u5143\u5185\u5546\u54C1\u6570\u91CF:"37",\u6574\u7BB1\u6570\u91CF:"37",\u5E8F\u5217\u53F7:"21",\u6D41\u6C34\u53F7:"21",serial:"21",\u51C0\u91CD:"3100",\u91CD\u91CF:"3100",\u6BDB\u91CD:"3300",\u603B\u91CD:"3300",\u957F\u5EA6:"3110",\u957F:"3110",\u5BBD\u5EA6:"3120",\u5BBD:"3120",\u9AD8\u5EA6:"3130",\u9AD8:"3130",\u9762\u79EF:"3140",\u4F53\u79EF:"3160",\u5BB9\u79EF:"3150",\u5BB9\u91CF:"3150",\u5305\u88C5\u5185\u90E8\u6807\u8BC6:"20",\u5305\u88C5\u6807\u8BC6:"20",\u533B\u7597:"22",\u836F\u54C1:"22",\u7EC4\u53F7:"23",\u5206\u7EC4:"23"},S={},x={},le=()=>{S={},x={};for(let e in A){x[e]=e,S[e]=[e];let t=A[e],n=A[e],r=n.name.toLowerCase();x[r]=e;{let i=n.desc.replace("(m)","\u7C73").replace("(m\xB2)","\u5E73").replace("(m\xB3)","\u65B9").replace("(lb)","\u78C5").replace("(kg)","\u516C\u65A4").replace("(l)","\u5347").replace(/[\(\)]/g,"").trim().toLowerCase();x[i]=e,S[e].push(i)}}};le();var F,W=()=>{le();for(let e in C){let t=C[e];A[t]&&(x[e.toLowerCase()]=t,S[t].push(e.toLowerCase()))}F=Object.keys(x)};W();var L=e=>(e=String(e).toLowerCase(),x[e]),Ct=e=>S[e],O=(e,t)=>{let n=L(e);if(!n)return[null,L];let[r,i]=oe(n,t);return r?[!0,`(${n})${i}`]:[!1,i]},z=e=>{let t=[],n=[],r=()=>{for(let a=90;a<=99;++a)if(!s.has(a))return s.add(a),a;return null},i=e.length,s=new Set;if(i===0)n.push("\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A");else{i%2===0||e.push(void 0);for(let a=0;a<e.length;a+=2){let o=e[a],c=e[a+1];if(c!==void 0){let[_,l]=O(o,c);if(_===null){let u=r();if(u!==null){let[g,f]=O(u,c);g?(t.push(f),C[String(o).toLowerCase()]=u,W()):n.push(`${o} : ${l}`)}else n.push(`${o} \u4E0D\u662F\u5408\u6CD5AI \u5E76\u4E14 90-99 \u52A8\u6001ai \u90FD\u5DF2\u5360\u7528`)}else if(_===!0){t.push(l);let u=Number(L(o));u>=90&&u<=99&&s.add(u)}else n.push(`${o} : ${l}`)}else n.push(`${o} : "\u503C\u4E0D\u80FD\u4E3A\u7A7A"`)}}return[t,n]},At=(...e)=>{if(e.length===0)return null;if(e.length===1){let t=e[0];Array.isArray(e[0])||(t=Object.entries(e[0]).flat());let[n,r]=z(t),i=n.join("");return i===""?null:i}else{let[t,n]=z(e),r=t.join("");return r===""?null:r}},Tt=(e,t={})=>{let{strict:n=!0,useChineseKeys:r=!0,includeMeta:i=!1,parseAll:s=!0}=t;if(!e||typeof e!="string")return[!1,"\u8F93\u5165\u5FC5\u987B\u662F\u5B57\u7B26\u4E32"];if(e=e.trim(),e==="")return[!1,"\u8F93\u5165\u5B57\u7B26\u4E32\u4E0D\u80FD\u4E3A\u7A7A"];if(!/^(?:\(\d{2,4}\)[^()]*)+$/.test(e)&&n)return[!1,"\u65E0\u6548\u7684GS1\u683C\u5F0F"];let a={},o=[],c=[],_=e.match(/\((\d{2,4})\)([^()]*)/g)||[];if(_.length===0)return[!1,"\u672A\u627E\u5230\u6709\u6548\u7684GS1\u5B57\u6BB5"];for(let l of _){let u=l.match(/\((\d{2,4})\)([^()]*)/);if(!u){c.push(`\u65E0\u6CD5\u89E3\u6790\u6BB5: ${l}`);continue}let g=u[1],f=u[2],d=A[g],h=f,m=!0,p=null;if(d)try{if(d.length&&(d.format==="numeric"||d.format==="date"?f.length!==d.length&&(m=!1,p=`\u957F\u5EA6\u5E94\u4E3A${d.length}\u4F4D\uFF0C\u5B9E\u9645\u4E3A${f.length}\u4F4D`):d.format==="alphanumeric"&&f.length>d.length&&(m=!1,p=`\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7${d.length}\u4F4D\uFF0C\u5B9E\u9645\u4E3A${f.length}\u4F4D`)),d.format==="numeric")if(!/^\d+$/.test(f))m=!1,p="\u6570\u503C\u5B57\u6BB5\u5FC5\u987B\u4E3A\u7EAF\u6570\u5B57";else if(d.decimal>0){let y=parseInt(f,10)/Math.pow(10,d.decimal);h=Number(y.toFixed(d.decimal))}else h=parseInt(f,10),isNaN(h)&&(m=!1,p="\u65E0\u6548\u7684\u6574\u6570\u503C");else d.format==="date"?/^\d{6}$/.test(f)||(m=!1,p="\u65E5\u671F\u5FC5\u987B\u662F6\u4F4D\u6570\u5B57"):d.format==="alphanumeric"&&(ae.test(f)||c.push(`AI(${g}) \u5305\u542B\u4E0D\u5141\u8BB8\u7684\u5B57\u7B26`));if(!m&&n){o.push(`AI(${g}) ${d.desc||d.name}: ${p}`);continue}let b;r&&d.desc?(b=d.desc.replace(/\([^)]*\)/g,"").replace("m\xB2","\u5E73").replace("m\xB3","\u65B9").replace("kg","\u516C\u65A4").replace("lb","\u78C5").replace("L","\u5347").replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g,"").trim(),b===""&&(b=d.name?d.name.toLowerCase():g)):b=d.name?d.name.toLowerCase():g,(m||!n)&&(a[b]=h),i&&(a[`${b}_ai`]=g,a[`${b}_raw`]=f,m||(a[`${b}_error`]=p))}catch(b){let y=`AI(${g}) \u89E3\u6790\u9519\u8BEF: ${b.message}`;n?o.push(y):c.push(y)}else s?(a[`ai_${g}`]=f,c.push(`\u672A\u77E5AI\u4EE3\u7801: ${g}`)):c.push(`\u8DF3\u8FC7\u672A\u77E5AI\u4EE3\u7801: ${g}`)}if(o.length>0){let l=o.join("; ");return c.length>0?[!1,`${l} (\u8B66\u544A: ${c.join("; ")})`]:[!1,l]}if(i){let l={};c.length>0&&(l.warnings=c),Object.keys(a).length>0&&(l.fieldCount=Object.keys(a).filter(u=>!u.endsWith("_ai")&&!u.endsWith("_raw")&&!u.endsWith("_error")).length),a._meta=l}else c.length>0&&console.warn("GS1\u89E3\u6790\u8B66\u544A:",c.join("; "));return[!0,a]},ce=(e=!1,t=!1)=>{let n=[];if(e&&t?n=Object.keys(x):e?n=Object.keys(x).filter(o=>/[\u4e00-\u9fa5]/.test(o)||C[o]&&/[\u4e00-\u9fa5]/.test(Object.keys(C).find(c=>C[c]===C[o]))):t?n=Object.keys(x).filter(o=>/^[a-zA-Z]/.test(o)&&!/[\u4e00-\u9fa5]/.test(o)&&!/^\d+$/.test(o)):n=Object.keys(x),n.length===0)return null;let r=n[Math.floor(Math.random()*n.length)],i=x[r],s=A[i];if(!s)return null;let a;switch(s.format){case"numeric":if(s.decimal>0){let d=Math.pow(10,s.length-s.decimal)-1,h=Math.floor(Math.random()*d),m=Math.floor(Math.random()*Math.pow(10,s.decimal));a=h+m/Math.pow(10,s.decimal),a=Number(a.toFixed(s.decimal))}else{let d=Math.pow(10,s.length)-1;a=Math.floor(Math.random()*d)}break;case"date":let o=new Date,c=new Date(o.getTime()+Math.random()*2*365*24*60*60*1e3),_=c.getFullYear()%100,l=c.getMonth()+1,u=c.getDate();a=`${_.toString().padStart(2,"0")}${l.toString().padStart(2,"0")}${u.toString().padStart(2,"0")}`;break;case"alphanumeric":let g=Math.floor(Math.random()*s.length)+1,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";a="";for(let d=0;d<g;d++)a+=f[Math.floor(Math.random()*f.length)];break;default:a=""}return{name:r,ai:i,value:a,spec:s}},Nt=(e=5,t=1,n={})=>{t=t<1?1:t,e=e>t?e:t;let{onlyChineseName:r=!1,onlyEnglishName:i=!1,includeCustomAI:s=!1,uniqueAI:a=!0,maxTotalLength:o=48,returnObject:c=!1}=n,_=Math.floor(Math.random()*(e-t+1))+t,l=[],u=new Set,g=0;for(let h=0;h<_;h++){let m,p=0,b=20;do{if(m=ce(r,i),p++,!m)break;if(!s&&/^9[0-9]$/.test(m.ai)||a&&u.has(m.ai))continue;let y=`(${m.ai})${m.value}`.length;if(!(g+y>o))break}while(p<b);if(!m||p>=b)break;u.add(m.ai),g+=`(${m.ai})${m.value}`.length,l.push(m)}if(l.length===0)return c?{success:!1,error:"\u672A\u80FD\u751F\u6210\u4EFB\u4F55\u5B57\u6BB5"}:null;let f=[];for(let h of l){let m=O(h.name,h.value);m&&f.push(m)}if(f.length===0)return c?{success:!1,error:"\u6240\u6709\u5B57\u6BB5\u7F16\u7801\u5931\u8D25"}:null;let d=f.filter(h=>h[0]).map(h=>h[1]).join("");return c?{success:!0,gs1:d,fields:l,count:l.length,length:d.length,withinLengthLimit:d.length<=o}:d};de.exports={get GS1_AI_SPECS(){return A},get ALIAS(){return C},set ALIAS(e){C=e,W()},get NAME_TO_AI(){return x},get AI_TO_NAMES(){return S},get FIXED_NAMES(){return F},validate_and_fmt_ai_value:oe,name_to_ai:L,ai_to_names:Ct,encd_one:O,_encd:z,encd:At,decd:Tt,list_names:()=>F,look_requirements:e=>A[L(e)],rand_one:ce,rand:Nt}});var me=w((Er,fe)=>{var St=ue();fe.exports={gs1:St}});var Y=w((vr,xe)=>{var{gs1:$}=me();async function V(e,t){return window[t]?!0:new Promise((n,r)=>{let i=document.createElement("script");i.src=e,i.onload=()=>n(!0),i.onerror=()=>r(new Error("Failed to load JsBarcode")),i.async=!0,document.head.appendChild(i)})}async function he(e="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"){return await V(e,"JsBarcode")}async function q(e="https://html2canvas.hertzen.com/dist/html2canvas.min.js"){return await V(e,"html2canvas")}async function It(e="https://cdn.jsdelivr.net/npm/quagga@0.12.1/dist/quagga.min.js"){return await V(e,"ZXing")}var Lt=102;async function T(e,t={}){let r={...{format:"CODE128",ean128:!0,width:10,height:100,lineColor:"#000000",background:"#ffffff",displayValue:!1,fontSize:20,margin:30},...t};return console.log({opts:r}),r.format.toLowerCase()==="code128"&&r.ean128!==!1&&(r.ean128=!0),window.JsBarcode||await he(),new Promise((i,s)=>{try{let a=document.createElementNS("http://www.w3.org/2000/svg","svg"),o="temp-str2svg-"+Date.now();a.id=o,a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),JsBarcode(`#${o}`,e,r);let c=a.outerHTML;a.remove(),i(c)}catch(a){s(a)}})}async function ge(e,t={}){try{let n=await T(e,t);return await D(n,t.background)}catch(n){throw n}}function pe(e){let t=ZXing.BarcodeFormat;if(!e)return[t.CODE_128,t.EAN_13,t.EAN_8,t.CODE_39,t.CODE_93,t.CODABAR,t.UPC_A,t.UPC_E,t.ITF,t.QR_CODE,t.DATA_MATRIX,t.PDF_417,t.AZTEC];let n=e.toLowerCase().trim();return n.includes("ean")&&n.includes("128")||n==="ean128"?[t.CODE_128]:n.includes("code")&&n.includes("128")||n==="code128"?[t.CODE_128]:n.includes("ean")&&n.includes("13")||n==="ean13"?[t.EAN_13]:n.includes("ean")&&n.includes("8")||n==="ean8"?[t.EAN_8]:n.includes("upc")?[t.UPC_A,t.UPC_E]:n.includes("code")&&n.includes("39")||n==="code39"?[t.CODE_39]:n.includes("codabar")||n.includes("nw-7")?[t.CODABAR]:n.includes("2of5")||n.includes("2/5")||n.includes("25")?[t.ITF]:n.includes("code")&&n.includes("93")||n==="code93"?[t.CODE_93]:n.includes("qr")||n.includes("qrcode")||n.includes("\u4E8C\u7EF4\u7801")?[t.QR_CODE]:[t.CODE_128,t.EAN_13,t.EAN_8,t.CODE_39,t.CODE_93,t.CODABAR,t.UPC_A,t.UPC_E,t.ITF,t.QR_CODE]}async function k(e,t="CODE128"){return new Promise((n,r)=>{try{let i="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e),s=new Image;s.onload=()=>{try{let o=document.createElement("canvas"),c=o.getContext("2d");o.width=s.width*4,o.height=s.height*4,c.setTransform(4,0,0,4,0,0),c.fillStyle="#fff",c.fillRect(0,0,o.width,o.height),c.imageSmoothingEnabled=!1,c.drawImage(s,0,0);let _=c.getImageData(0,0,o.width,o.height),l=new Uint8ClampedArray(o.width*o.height);for(let p=0,b=0;p<_.data.length;p+=4,b++){let y=_.data[p],wt=_.data[p+1],xt=_.data[p+2];l[b]=(y*299+wt*587+xt*114)/1e3}let u=new ZXing.RGBLuminanceSource(l,o.width,o.height),g=new ZXing.BinaryBitmap(new ZXing.HybridBinarizer(u)),f=new ZXing.MultiFormatReader,d=new Map;d.set(ZXing.DecodeHintType.POSSIBLE_FORMATS,pe(t)),d.set(ZXing.DecodeHintType.TRY_HARDER,!0),f.setHints(d);let m=f.decode(g).getText();t.toUpperCase()==="CODE128"&&m.includes("\xF1")&&(m=m.replace(/\u00f1/g,"")),n(m)}catch(a){console.error(a),r(new Error("\u65E0\u6CD5\u89E3\u7801\u6761\u7801"))}},s.onerror=a=>{console.error(a),r(new Error("SVG \u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},s.src=i}catch(i){console.error(i),r(new Error("\u5904\u7406 SVG \u5F02\u5E38"))}})}async function M(e){return new Promise((t,n)=>{let r=new Image;r.onload=async()=>{try{window.html2canvas||await q();let i=document.createElement("canvas");i.width=r.width,i.height=r.height,i.getContext("2d").drawImage(r,0,0);let a=await _e(e),o=await k(a);t(o)}catch(i){n(i)}},r.onerror=()=>n(new Error("Failed to load PNG image")),r.src=e})}async function _e(e){return new Promise((t,n)=>{let r=new Image;r.onload=async()=>{try{window.html2canvas||await q();let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let s=i.getContext("2d");s.drawImage(r,0,0);let a=s.getImageData(0,0,i.width,i.height),o=await M(e);if(o&&!o.startsWith("[")&&!o.endsWith("]")){let c=await T(o,{width:2,height:r.height*.7,displayValue:!1});t(c)}else{let c=`
|
|
358
|
+
<svg width="${i.width}" height="${i.height}"
|
|
359
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
360
|
+
<rect width="100%" height="100%" fill="white"/>
|
|
361
|
+
<text x="50%" y="50%"
|
|
362
|
+
text-anchor="middle"
|
|
363
|
+
dominant-baseline="middle"
|
|
364
|
+
font-family="Arial"
|
|
365
|
+
font-size="20"
|
|
366
|
+
fill="black">
|
|
367
|
+
\u65E0\u6CD5\u89E3\u7801\u6761\u5F62\u7801
|
|
368
|
+
</text>
|
|
369
|
+
</svg>
|
|
370
|
+
`;t(c)}}catch(i){n(i)}},r.onerror=()=>n(new Error("Failed to load PNG image")),r.src=e})}function D(e,t={}){return new Promise((n,r)=>{try{let{width:i=null,height:s=null,scale:a=1,backgroundColor:o="white",quality:c=1,mimeType:_="image/png"}=t,l=new Image,g=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;l.onload=function(){let f=document.createElement("canvas"),d=f.getContext("2d"),h=l.width,m=l.height;i&&s?(h=i,m=s):i?(m=l.height*i/l.width,h=i):s?(h=l.width*s/l.height,m=s):a!==1&&(h=l.width*a,m=l.height*a),f.width=h,f.height=m,d.fillStyle=o,d.fillRect(0,0,h,m),d.drawImage(l,0,0,h,m);let p=f.toDataURL(_,c);f.toBlob(function(b){n({dataUrl:p,blob:b,width:h,height:m,imageData:d.getImageData(0,0,h,m),originalSize:{width:l.width,height:l.height},canvas:f})},_,c)},l.onerror=()=>r(new Error("SVG\u52A0\u8F7D\u5931\u8D25")),l.src=g}catch(i){r(i)}})}function $t(e){if(e.length!==12||!/^\d+$/.test(e))throw new Error("\u8BF7\u8F93\u516512\u4F4D\u6570\u5B57\u5B57\u7B26\u4E32");let t=0;for(let r=0;r<e.length;r++){let i=parseInt(e[r]);(r+1)%2===1?t+=i*1:t+=i*3}return(10-t%10)%10}function be(e,t="CODE128"){if(!e||typeof e!="string")return{valid:!1,error:"\u5185\u5BB9\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32"};let r={EAN13:i=>{if(i.length!==13||!/^\d+$/.test(i))return!1;let s=0;for(let o=0;o<12;o++){let c=parseInt(i[o]);s+=c*(o%2===0?1:3)}return(10-s%10)%10===parseInt(i[12])},EAN8:i=>i.length!==8?!1:/^\d+$/.test(i),UPC:i=>i.length!==12?!1:/^\d+$/.test(i),CODE128:i=>i.length>0&&i.length<256,CODE39:i=>/^[A-Z0-9\-\. \$/+%]+$/.test(i)}[t];return r?{valid:r(e),error:r(e)?null:`\u5185\u5BB9\u4E0D\u7B26\u5408 ${t} \u683C\u5F0F\u8981\u6C42`}:{valid:!0,error:null}}async function Ot(e,t="auto"){try{if(t==="svg"||t==="auto"&&e.includes("<svg")){let n=await k(e),r=await T(n),i=await D(r);return{type:"svg",text:n,svg:e,png:i,width:300,height:100}}else if(t==="png"||t==="auto"&&e.startsWith("data:image/png")){let n=await M(e),r=await T(n);return{type:"png",text:n,svg:r,png:e,width:300,height:100}}else if(t==="text"||t==="auto"&&typeof e=="string"){let n=be(e);if(!n.valid)throw new Error(n.error);let r=await T(e),i=await D(r);return{type:"text",text:e,svg:r,png:i,width:300,height:100}}else throw new Error("\u4E0D\u652F\u6301\u7684\u6761\u5F62\u7801\u6570\u636E\u7C7B\u578B")}catch(n){throw n}}var we={format:"CODE128",ean128:!0,width:2,height:100,lineColor:"#000000",background:"#ffffff",displayValue:!0,fontSize:20,margin:10},Dt=(...e)=>T($.encd(...e),we),kt=(...e)=>ge($.encd(...e),we),Mt=e=>$.decd(k(e)),Rt=e=>$.decd(M(e));xe.exports={loadJsBarcode:he,loadHtml2Canvas:q,loadZXing:It,FNC1_IF_USING_CODE128_AND_EAN128:Lt,str2svg:T,str2png:ge,getZXingFormatsByType:pe,svg2str:k,png2str:M,png2svg:_e,svg2png:D,calcEAN13CheckDigit:$t,validateBarcodeContent:be,getBarcodeInfo:Ot,encd_to_gs1_svg:Dt,encd_to_gs1_png:kt,decd_fr_gs1_svg:Mt,decd_fr_gs1_png:Rt,gs1:$}});var Ee=w((Cr,ye)=>{var{svg2str:Bt}=Y();ye.exports=async(e=null,t=null,n=!1)=>{let r="",i="unknown",s=0;async function a(l,u=""){return new Promise((g,f)=>{let d=new FileReader,h=new Image;if(d.onload=m=>{h.onload=()=>{let p=`
|
|
371
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
372
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
373
|
+
width="${h.width}"
|
|
374
|
+
height="${h.height}"
|
|
375
|
+
viewBox="0 0 ${h.width} ${h.height}">
|
|
376
|
+
<image xlink:href="${m.target.result}"
|
|
377
|
+
width="${h.width}"
|
|
378
|
+
height="${h.height}"
|
|
379
|
+
preserveAspectRatio="none"/>
|
|
380
|
+
</svg>`;g(p)},h.onerror=()=>f(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")),h.src=m.target.result},d.onerror=()=>f(new Error("\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25")),l instanceof Blob||l instanceof File)d.readAsDataURL(l);else if(l instanceof ArrayBuffer){let m=new Blob([l],{type:u||"image/png"});d.readAsDataURL(m)}else if(ArrayBuffer.isView(l)){let m=new Blob([l],{type:u||"image/png"});d.readAsDataURL(m)}else f(new Error("\u4E0D\u652F\u6301\u7684\u56FE\u7247\u6E90\u7C7B\u578B"))})}async function o(l){return new Promise((u,g)=>{let f=new FileReader;f.onload=d=>u(d.target.result),f.onerror=()=>g(new Error("\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25")),f.readAsText(l)})}async function c(){if(!window.showOpenFilePicker)throw new Error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 showOpenFilePicker API");try{let[l]=await window.showOpenFilePicker({types:[{description:"\u56FE\u7247\u6587\u4EF6",accept:{"image/*":[".png",".jpg",".jpeg",".webp",".gif",".bmp",".svg"]}}],multiple:!1}),u=await l.getFile();return i=u.name,s=u.size,u.type==="image/svg+xml"||u.name.endsWith(".svg")?await o(u):await a(u)}catch(l){throw l.name==="AbortError"?new Error("\u7528\u6237\u53D6\u6D88\u9009\u62E9"):l}}function _(l){return new Promise(u=>{let g=document.createElement("div");g.style.cssText=`
|
|
381
|
+
position: fixed;
|
|
382
|
+
top: 0;
|
|
383
|
+
left: 0;
|
|
384
|
+
width: 100%;
|
|
385
|
+
height: 100%;
|
|
386
|
+
background: rgba(0,0,0,0.5);
|
|
387
|
+
display: flex;
|
|
388
|
+
justify-content: center;
|
|
389
|
+
align-items: center;
|
|
390
|
+
z-index: 10000;
|
|
391
|
+
`;let f=document.createElement("div");f.style.cssText=`
|
|
392
|
+
background: white;
|
|
393
|
+
padding: 20px;
|
|
394
|
+
border-radius: 8px;
|
|
395
|
+
box-shadow: 0 4px 20px rgba(0,0,0,0.2);
|
|
396
|
+
min-width: 300px;
|
|
397
|
+
max-width: 500px;
|
|
398
|
+
max-height: 80vh;
|
|
399
|
+
overflow-y: auto;
|
|
400
|
+
`;let d=document.createElement("h3");d.textContent="\u89E3\u7801\u7ED3\u679C",d.style.cssText="margin: 0 0 15px 0; color: #333;";let h=document.createElement("textarea");h.value=l,h.style.cssText=`
|
|
401
|
+
width: 100%;
|
|
402
|
+
min-height: 100px;
|
|
403
|
+
padding: 10px;
|
|
404
|
+
border: 1px solid #ddd;
|
|
405
|
+
border-radius: 4px;
|
|
406
|
+
font-family: monospace;
|
|
407
|
+
font-size: 14px;
|
|
408
|
+
resize: vertical;
|
|
409
|
+
margin-bottom: 15px;
|
|
410
|
+
box-sizing: border-box;
|
|
411
|
+
`;let m=document.createElement("div");m.style.cssText="display: flex; justify-content: flex-end; gap: 10px;";let p=document.createElement("button");p.textContent="\u590D\u5236",p.style.cssText=`
|
|
412
|
+
background: #1890ff;
|
|
413
|
+
color: white;
|
|
414
|
+
border: none;
|
|
415
|
+
padding: 8px 20px;
|
|
416
|
+
border-radius: 4px;
|
|
417
|
+
cursor: pointer;
|
|
418
|
+
font-size: 14px;
|
|
419
|
+
`;let b=document.createElement("button");b.textContent="\u5173\u95ED",b.style.cssText=`
|
|
420
|
+
background: #f5f5f5;
|
|
421
|
+
color: #333;
|
|
422
|
+
border: 1px solid #d9d9d9;
|
|
423
|
+
padding: 8px 20px;
|
|
424
|
+
border-radius: 4px;
|
|
425
|
+
cursor: pointer;
|
|
426
|
+
font-size: 14px;
|
|
427
|
+
`,p.onclick=()=>{h.select(),document.execCommand("copy");let y=p.textContent;p.textContent="\u5DF2\u590D\u5236!",p.style.background="#52c41a",setTimeout(()=>{p.textContent=y,p.style.background="#1890ff"},2e3)},b.onclick=()=>{document.body.removeChild(g),u()},f.appendChild(d),f.appendChild(h),m.appendChild(p),m.appendChild(b),f.appendChild(m),g.appendChild(f),document.body.appendChild(g),g.onclick=y=>{y.target===g&&(document.body.removeChild(g),u())},h.select()})}try{if(e instanceof HTMLInputElement&&e.type==="file"){if(!e.files||e.files.length===0)throw new Error("\u8BF7\u5148\u9009\u62E9\u6587\u4EF6");let u=e.files[0];i=u.name,s=u.size,u.type==="image/svg+xml"||u.name.endsWith(".svg")?r=await o(u):r=await a(u)}else e instanceof Blob?(i=e.name||"blob",s=e.size,e.type==="image/svg+xml"?r=await o(e):r=await a(e)):e instanceof ArrayBuffer?(i="arraybuffer",s=e.byteLength,r=await a(e)):ArrayBuffer.isView(e)?(i="typedarray",s=e.byteLength,r=await a(e)):typeof e=="string"?r=e:r=await c();let l=await Bt(r,t);return n&&await _(l),[!0,l]}catch(l){return alert(`\u89E3\u7801\u5931\u8D25: ${l.message}`),console.error("\u89E3\u7801\u5931\u8D25:",l),[!1,l]}}});var Z=w((Ar,Te)=>{var ve=(e,t=void 0)=>e===t?e:!e,Ce=(e,t,n=void 0)=>e===!1||t===!1?!1:e===n||t===n?n:!0,Ae=(e,t,n=void 0)=>e===!0||t===!0?!0:e===n||t===n?n:!1,Pt=(e,t=void 0)=>ve(e[0]),Ht=(e,t=void 0)=>{let n=e[0];if(n===!1)return!1;for(let r=1;r<e.length;r++){let i=e[r];if(i===!1)return!1;n=Ce(n,i)}return n},Gt=(e,t=void 0)=>{let n=e[0];if(n===!0)return!0;for(let r=1;r<e.length;r++){let i=e[r];if(i===!0)return!0;n=Ae(n,i)}return n};Te.exports={_not1:ve,_and2:Ce,_or2:Ae,not:Pt,and:Ht,or:Gt}});var Oe=w((Tr,$e)=>{var X=e=>e==="true"||e==="t"||e==="1"||e==="yes"||e==="tru"||e==="y"||e==="\u771F"||e==="\u662F",Ne=e=>X(e.toLowerCase()),Se=e=>e===!0||e===1,jt=e=>Se(e)||Ne(e),Ie=e=>e==="false"||e==="f"||e==="0"||e==="no"||e==="fls"||e==="n"||e==="not"||e==="\u5047"||e==="\u5426"||e==="\u975E",J=e=>e===!1||e===0,Ut=e=>J(e)||is_false_str(e),Le=e=>e==="undefined"||e==="-1"||e==="u"||e==="undef"||e==="unknown"||e==="maybe"||e==="noexist"||e==="nonexist"||e==="empty"||e==="\u65E0"||e==="\u7A7A",Ft=e=>e===void 0||e===-1,zt=e=>J(e)||is_false_str(e),Wt=e=>typeof e=="string"?(e=e.toLowerCase(),X(e)?!0:Ie(e)?!1:Le(e)?void 0:null):e===!1||e===!0||e===void 0?e:e===1?!0:e===0?!1:e===-1?void 0:null;$e.exports={is_true_lower_str:X,is_true_str:Ne,is_true_val:Se,is_true:jt,is_false_lower_str:Ie,is_false_val:J,is_false:Ut,is_undef_lower_str:Le,is_undef_val:Ft,is_undef:zt,translate:Wt}});var Ue=w((Nr,je)=>{var B=Symbol.for("hole"),Q=Symbol.for("noexist"),De=e=>Number.isInteger(e),Vt={noexist_is_not_assignable:"noexist_is_not_assignable"},R=e=>e.length-1;function ke(e,t){if(t>=0&&t<e.length)return t}function qt(e,t){if(e.indexOf(t)>=0)return t}function Yt(e,t){let n=t.i,r=t.v;if(ke(e,n)!==void 0)return e[n]===r?t:void 0}function Zt(e,...t){return e.filter((n,r)=>t.includes(r))}function Xt(e,...t){return e.filter((n,r)=>!t.includes(r))}function Jt(e,t){return e.filter((n,r)=>r%t===0)}function Qt(e,t,n=!0){let r=e.toString(2),i=Array.from(r).map(a=>parseInt(a));t=t===void 0?i.length:t;let s=t-i.length;if(s>0){let a=Array.from({length:s}).map(o=>0);return n?a.concat(i):i.concat(a)}else return n?i.slice(0,t):i.slice(-s)}function Kt(e,t){if(e.length===t.length){for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}else return!1}function en(...e){let t=Array.from({length:e[0].length});return t=t.map((n,r)=>{let i={};return e.forEach((s,a)=>{i[a]=s[r]}),i}),t}function tn(e,t){return t<0?t%e.length+e.length:t>=e.length?e.length-1:t}function P(e){let t=e.length;return t===0?[]:t%2?[(t-1)/2]:[t/2-1,t/2]}function Me(e){return P(e)[0]}function Re(e){let t=P(e);return t.length<2?t[0]:t[1]}function nn(e){let t=P(e),n=[];return t.forEach(r=>{n.push(e[r])}),n}function rn(e){let t=Me(e);return e[t]}function sn(e){let t=Re(e);return e[t]}function an(e){return new Map(Object.entries(e))}function on(e){let t=new WeakMap;for(let n=0;n<e.length;n++)t.set(e[n],n);return t}function Be(e,t){let n=B;return e.forEach((r,i)=>{i===t&&(n=i)}),n==B}function ln(e){return e.map((t,n)=>n).filter(t=>t!==void 0)}function cn(e){let t=get_ary_nonhole_indexes(e),n=[];for(let r=0;r<e.length;r++)t.includes(r)||n.push(r);return n}function dn(e){return get_ary_nonhole_indexes(e).length!==e.length}function un(e,t=void 0){let n=get_ary_nonhole_indexes(e);for(let r=0;r<e.length;r++)n.includes(r)||(e[r]=t);return e}function fn(e,t){let n=0;for(let r of e)r===t&&(n=n+1);return n}function K(e,t){return e.toString()===t&&e>=0&&e<2**32-1}function mn(e){let t=parseInt(e);return K(t,e)}function Pe(e,t,n){let[r,i]=[0,e.length];return n>=r&&n<i?Be(e,n)?B:Reflect.get(e,t):Q}function ee(e,t){let n=parseInt(t);return K(n,t)?Pe(e,t,n):Reflect.get(e,t)}function hn(e,t){return typeof t=="string"?ee(e,t):De(t)?Pe(e,t,t):Reflect.get(e,t)}function gn(e){return new Proxy(e,{get:function(n,r,i){return ee(n,r)}})}var He={index_not_in_range:new Error("index_not_in_range")};function Ge(e,t,n,r){let[i,s]=[0,e.length];if(n>=i&&n<s){if(r===Q)throw Vt.noexist_is_not_assignable;return Reflect.set(e,t,r)}else throw He.index_not_in_range}function te(e,t,n){let r=parseInt(t);K(r,t)?Ge(e,t,r,n):Reflect.set(e,t,n)}function pn(e,t,n){typeof t=="string"?te(e,t,n):De(t)?Ge(e,t,t,n):Reflect.set(e,t,n)}function _n(e){return new Proxy(e,{set:function(n,r,i,s){te(n,r,i)}})}function bn(e){return new Proxy(e,{get:function(n,r,i){return ee(n,r)},set:function(n,r,i,s){te(n,r,i)}})}var wn=(e,t,n)=>{for(let r of n)t=e(t,r);return t},xn=(e,t,n)=>{let r=t.length-1;for(let i=r-1;i>-1;i--)n=e(t[i],n);return n};function yn(e,t){return e.filter((n,r)=>t.includes(r))}function En(e,t,n=!0){return e.length===0?n:e.every(t)}var vn=(e,t)=>e.length>t.length?[t,e]:[e,t],Cn=(e,t)=>e[0]>t[0]?[t,e]:[e,t],An=(e,t)=>e[1]>t[1]?[t,e]:[e,t],Tn=(e,t)=>{let[n,r]=e,[i,s]=t;return r<=i?null:i>=n?r<=s?[i,r]:[i,s]:r<=s?[n,r]:s<=n?null:[n,s]},H=(e,t)=>{let[n,r]=e,[i,s]=t;return r===i?[10,e,t]:r<i?[1,e,[r,i],t]:i===n?s<r?[-12,[i,s],[s,r]]:s===r?[0,e]:[12,e,[r,s]]:i>n?s<r?[-13,[n,i],t,[s,r]]:s===r?[-14,[n,i],t]:[11,[n,i],[i,r],[r,s]]:s<n?[2,t,[s,n],e]:s===n?[-10,t,e]:s<r?[-11,[i,n],[n,s],[s,r]]:s===r?[14,[i,n],e]:[13,[i,n],[n,s],[s,r]]};H.SEG_TYPES={overlap:0,fst0:101,fst1:102,fst:103,snd0:201,snd1:202,snd:203};H.SHAPE_TYPES={overlap:0,fst_other_snd:1,snd_other_fst:2,fst_snd:10,fst0_overlap_snd1:11,fst_snd1:12,snd0_fst_snd1:13,snd0_fst:14,snd_fst:-10,snd0_overlap_fst1:-11,snd_fst1:-12,fst0_snd_fst1:-13,fst0_snd:-14};H.F={0:e=>[e[1],e[1]],1:e=>[e[1],e[3]],2:e=>[e[3],e[1]],10:e=>[e[1],e[2]],11:e=>[[e[1][0],e[2][1]],[e[2][0],e[3][1]]],12:e=>[e[1],[e[1][0],e[2][1]]],13:e=>[e[2],[e[1][0],e[3][1]]],14:e=>[e[2],[e[1][0],e[2][1]]],"-10":e=>[e[2],e[1]],"-11":e=>[[e[2][0],e[3][1]],[e[1][0],e[2][1]]],"-12":e=>[[e[1][0],e[2][1]],e[1]],"-13":e=>[[e[1][0],e[3][1]],e[2]],"-14":e=>[[e[1][0],e[2][1]],e[2]]};var Nn=(e,t)=>{let[n,r]=e,[i,s]=t;return!(r<=i||s<=n)},Sn=(e,t)=>{let[n,r]=e,[i,s]=t;return Math.min(r-n,s-i)};je.exports={eq:Kt,bin:Qt,clear:e=>e.splice(0,1/0),head:e=>e[0],tail:e=>e.slice(1),mid:e=>e.slice(1,R(e)),init:e=>e.slice(0,R(e)),lsti:R,lst:e=>e[R(e)],slst:(e,t)=>{e[e[__l]-1]=t},uniform_index:tn,validate_index:ke,validate_value:qt,validate_vi:Yt,some:Zt,some_not:Xt,interval:Jt,odd:e=>e.filter((t,n)=>n%2),even:e=>e.filter((t,n)=>!(n%2)),freq:fn,combine:en,mid_index_pair:P,mid_index_left:Me,mid_index_right:Re,mid_value_pair:nn,mid_value_left:rn,mid_value_right:sn,ibfr:(e,t,n)=>(e.splice(t,0,n),e),iaft:(e,t,n)=>(e.splice(t+1,0,n),e),rm:(e,t)=>{let n=e[t];return e.splice(t,1),n},rplc:(e,t,n)=>e[t]=n,cp:e=>e.slice(0),to_map:an,to_wmap:on,is_hole_element_at:Be,get_nonhole_indexes:ln,get_hole_indexes:cn,has_hole:dn,fill_hole:un,is_index:mn,ERROR_DICT:He,safe_get:hn,creat_safe_getter_proxy:gn,safe_set:pn,creat_safe_setter_proxy:_n,creat_safe_gsetter_proxy:bn,hole:B,noexist:Q,foldl:wn,foldr:xn,islct:yn,every:En,sort_2rng_via_length:vn,sort_2rng_via_si:Cn,sort_2rng_via_ei:An,split_2rng:H,get_overlap_of_2rng:Tn,is_2rng_overlap:Nn,get_min_length_of_2rng:Sn}});var Ve=w((Sr,We)=>{var In=Ue(),I=Symbol("dummy");function*Ln(e){for(let t=0;t<2**e.length;t++){let n=In.bin(t,e.length).reverse();yield e.filter((i,s)=>n[s]===1)}}function $n(e){return e.cache.filter(t=>t===I).length===0}function On(e){return e.depth===0}function Dn(e){let t=Array.from({length:e.length}).map(i=>I),n=Object.entries(e).map(i=>[parseInt(i[0]),{origi:parseInt(i[0]),cachei:null,origv:i[1]}]);return{desc:Object.fromEntries(n),cache:t,ctrl:null,depth:0}}function kn(e){let t=e.cache.indexOf(I);return t>=0?(e.ctrl=e.desc[e.depth],e.ctrl.cachei=t,e.cache[t]=e.ctrl,e.depth=e.depth+1,e):null}function Fe(e){if(On(e))return null;{let t=e.ctrl.origi-1,n=t>=0?e.desc[t]:null,r=e.ctrl.cachei;return e.cache[r]=I,e.ctrl.cachei=null,e.ctrl=n,e.depth=e.depth-1,e}}function Mn(e){if(e.ctrl===null)return null;let n=e.ctrl.cachei+1,r=!1;for(;n<e.cache.length;)if(e.cache[n]===I){r=!0;break}else n=n+1;return r?n:null}function ze(e){let t=Mn(e);return t!==null?(e.cache[e.ctrl.cachei]=I,e.cache[t]=e.ctrl,e.ctrl.cachei=t,e):null}function Rn(e){let t=Fe(e);for(;t!==null;){let n=ze(t);if(n!==null)return n;t=Fe(t)}return t}function Bn(e){let t=kn(e);if(t!==null)return t;{let n=ze(e);return n!==null?n:Rn(e)}}function*Pn(e){let t=Dn(e);for(;t!==null;)$n(t)&&(yield t.cache.map(n=>n.origv)),t=Bn(t)}We.exports={comb:Ln,perm:Pn}});var Ze=w((Ir,Ye)=>{var{_and2:Hn,_or2:Gn}=Z(),E=e=>e===void 0?"U":e===!0?"T":"F",qe=(e,t,n,r)=>{let i;e==="*"?i=Hn:i=Gn;let s=E(i(t,t)),a=E(i(t,n)),o=E(i(t,r)),c=E(i(n,t)),_=E(i(n,n)),l=E(i(n,r)),u=E(i(r,t)),g=E(i(r,n)),f=E(i(r,r));return t=E(t),n=E(n),r=E(r),` ${e} | ${t} | ${n} | ${r}
|
|
428
|
+
---------------
|
|
429
|
+
${t} | ${s} | ${a} | ${o}
|
|
430
|
+
---------------
|
|
431
|
+
${n} | ${c} | ${_} | ${l}
|
|
432
|
+
---------------
|
|
433
|
+
${r} | ${u} | ${g} | ${f}
|
|
434
|
+
---------------`},{perm:jn,comb:Un}=Ve();function Fn(){let e=["*","+"].concat(Array.from(jn([!0,!1,void 0])));return e=Array.from(Un(e)),e=e.filter(t=>t.length===2&&typeof t[0]=="string"),e.shift(),e=e.map(t=>t.flat()),e}var ne=Fn();ne=ne.map(e=>qe(...e));function zn(){let e=ne.join(`
|
|
435
|
+
|
|
436
|
+
`);console.log(e)}Ye.exports={_TEM:qe,show_all:zn}});var Je=w((Lr,Xe)=>{Xe.exports={calc:Z(),trans:Oe(),repr:Ze()}});var lt=w(($r,ot)=>{var{translate:Qe}=Je().trans,N=e=>{let t=e.split("-");if(t.length===1)return e;let n=t[0];for(let r=1;r<t.length;++r)n+=t[r][0].toUpperCase()+t[r].slice(1);return n},rt=(e,t)=>{let n=N(t);Object.defineProperty(e,n,{get:()=>Qe(e.getAttribute(t))===!0,set:r=>{Qe(r)===!0?e.setAttribute(t,"true"):e.setAttribute(t,"false")}})},it=(e,t)=>{let n=N(t);Object.defineProperty(e,n,{get:()=>{var i;let r=e.getAttribute(t);return r==null||r==="undefined"||r==="null"?(i=e==null?void 0:e.defaults)==null?void 0:i[n]:String(r)},set:r=>{var i;r==null||r==="undefined"||r==="null"?e.setAttribute(t,(i=e==null?void 0:e.defaults)==null?void 0:i[n]):e.setAttribute(t,String(val))}})},st=(e,t)=>{let n=N(t);Object.defineProperty(e,n,{get:()=>{var i,s;let r=e.getAttribute(t);if(r==null||r==="undefined"||r==="null")return(i=e==null?void 0:e.defaults)==null?void 0:i[n];{let a=Number(r);return isNaN(a)?/^([0-9]+[\.]?[0-9]*)([a-zA-Z]+)$/.test(String(a))?a:(s=e==null?void 0:e.defaults)==null?void 0:s[n]:a}},set:r=>{var i,s;if(r==null||r==="undefined"||r==="null")e.setAttribute(t,(i=e==null?void 0:e.defaults)==null?void 0:i[n]);else{let a=Number(r);isNaN(a)?/^([0-9]+[\.]?[0-9]*)([a-zA-Z]+)$/.test(String(a))?e.setAttribute(t,String(a)):e.setAttribute(t,(s=e==null?void 0:e.defaults)==null?void 0:s[n]):e.setAttribute(t,String(a))}}})},at=(e,t)=>{let n=N(t);Object.defineProperty(e,n,{get:()=>{var i;let r=e.getAttribute(t);return r==null||r==="undefined"||r==="null"?(i=e==null?void 0:e.defaults)==null?void 0:i[n]:JSON.parse(r)},set:r=>{var i;r==null||r==="undefined"||r==="null"?e.setAttribute(t,(i=e==null?void 0:e.defaults)==null?void 0:i[n]):e.setAttribute(t,JSON.stringify(r))}})},re=(e,t)=>new Promise((n,r)=>{let i=document.createElement("script");i.src=e,i.onload=()=>n(!0),i.onerror=()=>n(!1),i.async=!0,document.head.appendChild(i)}),ie=e=>window[e]!==void 0,Wn=(e,t,n,r,i,s={})=>{if(n==="num"){let a=Number(r);isNaN(a)?/^([0-9]+[\.]?[0-9]*)([a-zA-Z]+|%)$/.test(String(a))&&e.style.setProperty(`--${t}`,String(a)):e.style.setProperty(`--${t}`,String(a)+"px")}else e.style.setProperty(`--${t}`,v)},Vn=async(e,t,n,r,i,s)=>{let{impt_name:a}=s;return ie(a)?[!0,window[a]]:await re(r,a)?[!0,window[a]]:[!1,a,e[i]]},Ke=async(e,t)=>{let n=[];for(let r in t){let i=t[r];if(i.action==="load_script"){let s=i.extra.impt_name,a=i.accessor_name;ie(s)?n.push([!0,window[s]]):n.push(re(e[a],s).then(o=>o?[!0,window[s]]:[!1,s,e[a]]).catch(o=>[!1,s,e[a]]))}}return await Promise.all(n)},et={none:(e,t,n,r,i,s={})=>{},auto:(e,t,n,r,i,s={})=>{},extn:(e,t,n,r,i,s={})=>{},set_style_prop:Wn,load_script:Vn},tt=(e,t)=>{for(let n in t){let r=N(n),i=t[n];i.type==="bool"?(rt(e,n),e.defaults[r]=i.dflt):i.type==="json"?(at(e,n),e.defaults[r]=i.dflt):i.type==="num"?(st(e,n),e.defaults[r]=i.dflt):(it(e,n),e.defaults[r]=i.dflt)}},nt=async(e,t,n,r,i)=>{let{action:s,type:a,accessor_name:o,extra:c}=t[r];if(typeof s=="string")return e[s](n,r,a,i,o,c);if(typeof s=="function")return s(n,r,a,i,o,c)};ot.exports=(e,t)=>{for(let r in et)e[r]===void 0&&(e[r]=et[r]);for(let r in t)t[r].attr=r,t[r].accessor_name=N(r),t[r].extra||(t[r].extra={});return{init_dflts_and_rtrn_attr_change_executor:r=>(tt(r,t),(i,s)=>nt(e,t,r,i,s)),creat_load_libs:r=>()=>Ke(r,t),attr_to_accessor_name:N,def_bool_accessor:rt,def_str_accessor:it,def_num_accessor:st,def_json_accessor:at,is_script_loaded:ie,load_script:re,init_dflts:tt,exec_when_attr_change:nt,load_all_libs:Ke}}});var ut=w((Or,G)=>{var qn=lt(),ct={},dt={"jsbarcode-src":{type:"str",dflt:"https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js",action:"load_script",extra:{impt_name:"JsBarcode"}},"html2canvas-src":{type:"str",dflt:"https://html2canvas.hertzen.com/dist/html2canvas.min.js",action:"load_script",extra:{impt_name:"html2canvas"}},"zxing-src":{type:"str",dflt:"https://unpkg.com/@zxing/library@0.21.3/umd/index.min.js",action:"load_script",extra:{impt_name:"Quagga"}},"auto-destroy":{type:"bool",dflt:!1,action:"none"},code:{type:"str",dflt:"",action:"none"},format:{type:"str",dflt:"CODE128",action:"none"},ean128:{type:"bool",dflt:!0,action:"none"},"hide-button":{type:"bool",dflt:!1,action:"auto"},"barcode-btn-text":{type:"str",dflt:"\u751F\u6210\u6761\u5F62\u7801",action:(e,t,n,r,i,s)=>{let a=e.shadowRoot.querySelector("#bacode-btn");a.innerText=r}},"barcode-container-background":{type:"str",dflt:"#ffffff",action:"set_style_prop"},"barcode-btn-background":{type:"str",dflt:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",action:"set_style_prop"},"barcode-btn-color":{type:"str",dflt:"#ffffff",action:"set_style_prop"},"barcode-btn-border-radius":{type:"num",dflt:8,action:"set_style_prop"},"barcode-btn-font-size":{type:"num",dflt:16,action:"set_style_prop"},"barcode-show-text":{type:"bool",dflt:!0,action:"extn"},"barcode-width":{type:"num",dflt:2,action:"extn"},"barcode-height":{type:"num",dflt:100,action:"extn"},"barcode-line-color":{type:"str",dflt:"#000000",action:"extn"},"barcode-font-size":{type:"num",dflt:20,action:"extn"},"barcode-margin":{type:"num",dflt:10,action:"extn"}};G.exports=qn(ct,dt);G.exports.ACTIONS=ct;G.exports.ATTRS=dt});var ht=w((Dr,mt)=>{var ft={success:"#38a169",error:"#e53e3e",warning:"#d69e2e",loading:"#3182ce",info:"#667eea"},Yn=e=>`
|
|
437
|
+
position: fixed;
|
|
438
|
+
top: 20px;
|
|
439
|
+
right: 20px;
|
|
440
|
+
background: ${ft[e]||ft.info};
|
|
441
|
+
color: white;
|
|
442
|
+
padding: 12px 20px;
|
|
443
|
+
border-radius: 8px;
|
|
444
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
445
|
+
z-index: 10001;
|
|
446
|
+
font-weight: 500;
|
|
447
|
+
`,Zn=(e,t="info")=>{let n=document.createElement("div");n.style.cssText=Yn(t),n.textContent=e,document.body.appendChild(n),setTimeout(()=>{document.body.contains(n)&&document.body.removeChild(n)},3e3)};mt.exports={simple_alert:Zn}});var pt=w((kr,gt)=>{gt.exports=`
|
|
448
|
+
<style>
|
|
449
|
+
:host {
|
|
450
|
+
display:inline-block;
|
|
451
|
+
overflow: hidden;
|
|
452
|
+
vertical-align: top;
|
|
453
|
+
}
|
|
454
|
+
:host([hide-button="true"]) {
|
|
455
|
+
/* 1. \u7EDD\u5BF9\u5B9A\u4F4D\u8131\u79BB\u6587\u6863\u6D41\uFF0C\u4E0D\u5360\u4F4D */
|
|
456
|
+
position: absolute;
|
|
457
|
+
/* 2. \u7F29\u5230\u65E0\u9650\u5C0F */
|
|
458
|
+
width: 0 !important;
|
|
459
|
+
height: 0 !important;
|
|
460
|
+
}
|
|
461
|
+
.barcode-btn {
|
|
462
|
+
padding: 12px 24px;
|
|
463
|
+
background: var(--barcode-btn-background);
|
|
464
|
+
color: var(--barcode-btn-color);
|
|
465
|
+
border: none;
|
|
466
|
+
border-radius: var(--barcode-btn-border-radius);
|
|
467
|
+
font-size: var(--barcode-btn-font-size);
|
|
468
|
+
font-weight: 600;
|
|
469
|
+
cursor: pointer;
|
|
470
|
+
transition: all 0.3s ease;
|
|
471
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
472
|
+
display: inline-flex;
|
|
473
|
+
align-items: center;
|
|
474
|
+
justify-content: center;
|
|
475
|
+
gap: 8px;
|
|
476
|
+
}
|
|
477
|
+
.barcode-btn:hover {
|
|
478
|
+
transform: translateY(-2px);
|
|
479
|
+
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
480
|
+
}
|
|
481
|
+
.barcode-btn:active {
|
|
482
|
+
transform: translateY(0);
|
|
483
|
+
}
|
|
484
|
+
.barcode-btn:disabled {
|
|
485
|
+
opacity: 0.6;
|
|
486
|
+
cursor: not-allowed;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
.loading {
|
|
491
|
+
display: inline-block;
|
|
492
|
+
width: 20px;
|
|
493
|
+
height: 20px;
|
|
494
|
+
border: 3px solid rgba(255,255,255,0.3);
|
|
495
|
+
border-top: 3px solid var(--barcode-btn-color);
|
|
496
|
+
border-radius: 50%;
|
|
497
|
+
animation: spin 1s linear infinite;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
@keyframes spin {
|
|
501
|
+
0% { transform: rotate(0deg); }
|
|
502
|
+
100% { transform: rotate(360deg); }
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/* \u5F39\u7A97\u6837\u5F0F */
|
|
506
|
+
.barcode-popup {
|
|
507
|
+
position: fixed;
|
|
508
|
+
top: 0;
|
|
509
|
+
left: 0;
|
|
510
|
+
right: 0;
|
|
511
|
+
bottom: 0;
|
|
512
|
+
background: rgba(0,0,0,0.8);
|
|
513
|
+
display: flex;
|
|
514
|
+
align-items: center;
|
|
515
|
+
justify-content: center;
|
|
516
|
+
z-index: 10000;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.popup-content {
|
|
520
|
+
background: white;
|
|
521
|
+
padding: 30px;
|
|
522
|
+
border-radius: 15px;
|
|
523
|
+
max-width: 90%;
|
|
524
|
+
max-height: 90%;
|
|
525
|
+
overflow: auto;
|
|
526
|
+
text-align: center;
|
|
527
|
+
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
|
528
|
+
position: relative;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.popup-close {
|
|
532
|
+
position: absolute;
|
|
533
|
+
top: 15px;
|
|
534
|
+
right: 15px;
|
|
535
|
+
background: none;
|
|
536
|
+
border: none;
|
|
537
|
+
font-size: 28px;
|
|
538
|
+
color: #666;
|
|
539
|
+
cursor: pointer;
|
|
540
|
+
padding: 5px;
|
|
541
|
+
line-height: 1;
|
|
542
|
+
width: 40px;
|
|
543
|
+
height: 40px;
|
|
544
|
+
display: flex;
|
|
545
|
+
align-items: center;
|
|
546
|
+
justify-content: center;
|
|
547
|
+
border-radius: 50%;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.popup-close:hover {
|
|
551
|
+
background: #f7fafc;
|
|
552
|
+
color: #e53e3e;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.barcode-container {
|
|
556
|
+
margin: 20px 0;
|
|
557
|
+
padding: 20px;
|
|
558
|
+
background: var(--barcode-container-background);
|
|
559
|
+
border-radius: 8px;
|
|
560
|
+
display: inline-block;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.barcode-image {
|
|
564
|
+
max-width: 100%;
|
|
565
|
+
max-height: 300px;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.popup-info {
|
|
569
|
+
margin: 20px 0;
|
|
570
|
+
padding: 15px;
|
|
571
|
+
background: #f7fafc;
|
|
572
|
+
border-radius: 8px;
|
|
573
|
+
text-align: left;
|
|
574
|
+
}
|
|
575
|
+
.barcode-line-color {
|
|
576
|
+
color: var(--barcode-line-color);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
.popup-actions {
|
|
581
|
+
display: flex;
|
|
582
|
+
gap: 10px;
|
|
583
|
+
justify-content: center;
|
|
584
|
+
margin-top: 20px;
|
|
585
|
+
flex-wrap: wrap;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.action-btn {
|
|
589
|
+
padding: 10px 20px;
|
|
590
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
591
|
+
color: white;
|
|
592
|
+
border: none;
|
|
593
|
+
border-radius: 6px;
|
|
594
|
+
font-size: 14px;
|
|
595
|
+
font-weight: 600;
|
|
596
|
+
cursor: pointer;
|
|
597
|
+
transition: all 0.3s;
|
|
598
|
+
display: flex;
|
|
599
|
+
align-items: center;
|
|
600
|
+
gap: 8px;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.action-btn:hover {
|
|
604
|
+
transform: translateY(-2px);
|
|
605
|
+
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.action-btn.secondary {
|
|
609
|
+
background: linear-gradient(135deg, #4fd1c7 0%, #319795 100%);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.action-btn.tertiary {
|
|
613
|
+
background: linear-gradient(135deg, #fc8181 0%, #c53030 100%);
|
|
614
|
+
}
|
|
615
|
+
</style>
|
|
616
|
+
`});var wr=w((Br,bt)=>{var{str2svg:Xn,str2png:Jn,svg2str:Qn,png2str:Kn,png2svg:er,svg2png:tr,loadJsBarcode:nr,loadHtml2Canvas:rr,loadZXing:ir,validateBarcodeContent:sr,getBarcodeInfo:ar,encd_to_gs1_svg:or,encd_to_gs1_png:lr,decd_fr_gs1_svg:cr,decd_fr_gs1_png:dr,getZXingFormatsByType:Mr,gs1:_t}=Y(),ur=Ee(),{is_script_loaded:fr,init_dflts_and_rtrn_attr_change_executor:mr,creat_load_libs:hr,ACTIONS:Rr,ATTRS:gr}=ut(),j=ht(),pr=pt(),U=class extends HTMLElement{static get observedAttributes(){return Object.keys(gr)}constructor(){super(),this.attachShadow({mode:"open"}),this.defaults={},this.attr_change_executor=mr(this),this.load_libs=hr(this),this.render()}connectedCallback(){this.load_libs().then(t=>{for(let r of t)if(!r[0]){j.simple_alert(`\u4ECE ${r[2]} \u52A0\u8F7D${r[1]} \u5931\u8D25`);return}let n=this.shadowRoot.querySelector(".barcode-btn");n&&n.addEventListener("click",this.handleClick.bind(this)),this.dispatchEvent(new CustomEvent("nv-img-barcode-loaded",{bubbles:!0,composed:!0,detail:{element:this}}))})}disconnectedCallback(){let t=this.shadowRoot.querySelector(".barcode-btn");t&&t.removeEventListener("click",this.handleClick.bind(this))}attributeChangedCallback(t,n,r){n!==r&&this.attr_change_executor(t,r)}render(){let t=pr,n=`<button id="bacode-btn" class="barcode-btn">${this.barcodeBtnText}</button>`;this.shadowRoot.innerHTML=t+n}async handleClick(){if(!this.code||this.code.trim()===""){j.simple_alert("\u8BF7\u8BBE\u7F6E\u6761\u5F62\u7801\u5185\u5BB9","error");return}try{window.JsBarcode||(j.simple_alert("\u6B63\u5728\u52A0\u8F7D\u6761\u5F62\u7801\u5E93...","loading"),await load_libs()),await this.showBarcodePopup()}catch(t){j.simple_alert(`\u751F\u6210\u5931\u8D25: ${t.message}`,"error")}}getBarcodeOptions(){return{format:this.format,ean128:this.ean128,width:this.barcodeWidth,height:this.barcodeHeight,lineColor:this.barcodeLineColor,background:this.barcodeContainerBackground,fontSize:this.barcodeFontSize,margin:this.barcodeMargin,displayValue:this.barcodeShowText,valid:t=>{t||console.warn("\u6761\u5F62\u7801\u5185\u5BB9\u53EF\u80FD\u4E0D\u7B26\u5408\u683C\u5F0F\u8981\u6C42")}}}async generateBarcode(){return fr("JsBarcode"),new Promise((t,n)=>{try{let r=document.createElementNS("http://www.w3.org/2000/svg","svg"),i="temp-barcode-"+Date.now();r.id=i,r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r),JsBarcode(`#${i}`,this.code,this.getBarcodeOptions());let s=r.outerHTML;this.svgToPng(s).then(a=>{r.remove(),t({svg:s,png:a,options:this.getBarcodeOptions(),code:this.code})}).catch(n)}catch(r){n(r)}})}async svgToPng(t){return new Promise((n,r)=>{let i=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),s=URL.createObjectURL(i),a=new Image;a.onload=()=>{let o=document.createElement("canvas");o.width=a.width,o.height=a.height;let c=o.getContext("2d");this.barcodeContainerBackground!=="transparent"&&(c.fillStyle=this.barcodeContainerBackground,c.fillRect(0,0,o.width,o.height)),c.drawImage(a,0,0),o.toBlob(_=>{URL.revokeObjectURL(s);let l=new FileReader;l.onloadend=()=>{n(l.result)},l.readAsDataURL(_)},"image/png")},a.onerror=r,a.src=s})}async showBarcodePopup(){let t=await this.generateBarcode();this.showPopup(t)}showPopup(t){let n=this.shadowRoot.querySelector(".barcode-popup");n&&n.remove();let r=document.createElement("div");r.className="barcode-popup";let i=document.createElement("div");i.className="popup-content";let s=document.createElement("button");s.className="popup-close",s.innerHTML="×",s.onclick=()=>{r.remove(),this.autoDestroy&&this.remove()};let a=document.createElement("h3");a.textContent="\u{1F4CA} \u751F\u6210\u7684\u6761\u5F62\u7801",a.style.cssText="margin-bottom: 20px; color: #2d3748; margin-top: 0;";let o=document.createElement("div");o.className="barcode-container";let c=document.createElement("img");c.src=t.png,c.className="barcode-image",c.alt=`\u6761\u5F62\u7801: ${this.code}`,o.appendChild(c);let _=document.createElement("div");_.className="popup-info",_.innerHTML=`
|
|
617
|
+
<p><strong>\u6761\u5F62\u7801\u5185\u5BB9:</strong> ${this.code}</p>
|
|
618
|
+
<p><strong>\u7F16\u7801\u683C\u5F0F:</strong> ${this.format}</p>
|
|
619
|
+
<p><strong>\u6761\u7801\u5C3A\u5BF8:</strong> ${this.barcodeWidth}\xD7${this.barcodeHeight}px</p>
|
|
620
|
+
<p><strong>\u7EBF\u6761\u989C\u8272:</strong> <span class="barcode-line-color">${this.barcodeLineColor}</span></p>
|
|
621
|
+
`;let l=document.createElement("div");l.className="popup-actions";let u=document.createElement("button");u.className="action-btn",u.innerHTML="\u{1F4BE} \u4E0B\u8F7DPNG",u.onclick=()=>this.downloadPNG(t.png);let g=document.createElement("button");g.className="action-btn secondary",g.innerHTML="\u{1F4C1} \u4E0B\u8F7DSVG",g.onclick=()=>this.downloadSVG(t.svg);let f=document.createElement("button");f.className="action-btn tertiary",f.innerHTML="\u5173\u95ED\u7A97\u53E3",f.onclick=()=>{if(r.remove(),this.autoDestroy)try{this.remove()}catch{}},l.appendChild(u),l.appendChild(g),l.appendChild(f),i.appendChild(s),i.appendChild(a),i.appendChild(o),i.appendChild(_),i.appendChild(l),r.appendChild(i),this.shadowRoot.appendChild(r)}downloadPNG(t){let n=document.createElement("a");n.href=t,n.download=`barcode-${this.code.replace(/[^a-z0-9]/gi,"-")}-${Date.now()}.png`,document.body.appendChild(n),n.click(),document.body.removeChild(n)}downloadSVG(t){let n=new Blob([t],{type:"image/svg+xml"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=`barcode-${this.code.replace(/[^a-z0-9]/gi,"-")}-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}};customElements.define("nv-barcode-button",U);var _r=async(e,t="CODE128",n=!0,r="once")=>{let i=document.createElement("nv-barcode-button");return i.autoDestroy=!0,i.hideButton=!0,i.setAttribute("code",e),i.setAttribute("format",t),i.setAttribute("ean128",n),i.setAttribute("type",r),document.body.appendChild(i),await new Promise(s=>setTimeout(s,100)),await i.showBarcodePopup(),i},br=async(e=null,t="CODE_128",n=!1)=>{(t.toLowerCase()==="code128"||t.toLowerCase()==="ean128")&&(t="CODE_128");let[r,i]=await ur(e,t,n);if(r){let s=_t.decd(i);if(s[0]){let a=s[1];return a.raw=i,a.is_gs1=!0,[!0,Object.values(a).join(""),a]}else return[!0,i,{is_gs1:!1}]}else return[!1,i]};bt.exports={BarcodeButton:U,once:_r,str2svg:Xn,str2png:Jn,svg2str:Qn,png2str:Kn,png2svg:er,svg2png:tr,loadJsBarcode:nr,loadHtml2Canvas:rr,loadZXing:ir,validateBarcodeContent:sr,getBarcodeInfo:ar,encd_to_gs1_svg:or,encd_to_gs1_png:lr,decd_fr_gs1_svg:cr,decd_fr_gs1_png:dr,gs1:_t,decd:br}});return wr();})();
|
|
622
|
+
</script>
|
|
623
|
+
|
|
624
|
+
<script>
|
|
625
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
626
|
+
// DOM元素
|
|
627
|
+
const barcodeInput = document.getElementById('barcode-input');
|
|
628
|
+
const formatSelect = document.getElementById('format-select');
|
|
629
|
+
const colorInput = document.getElementById('color-input');
|
|
630
|
+
const colorValue = document.getElementById('color-value');
|
|
631
|
+
const generateBtn = document.getElementById('generate-btn');
|
|
632
|
+
const barcodePreview = document.getElementById('barcode-preview');
|
|
633
|
+
const dynamicBarcodes = document.getElementById('dynamic-barcodes');
|
|
634
|
+
const alertDiv = document.getElementById('alert');
|
|
635
|
+
const exampleItems = document.querySelectorAll('.example-item');
|
|
636
|
+
|
|
637
|
+
// 显示提示
|
|
638
|
+
function showAlert(message, type = 'success') {
|
|
639
|
+
const colors = {
|
|
640
|
+
success: '#38a169',
|
|
641
|
+
error: '#e53e3e',
|
|
642
|
+
warning: '#d69e2e',
|
|
643
|
+
info: '#667eea'
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
alertDiv.textContent = message;
|
|
647
|
+
alertDiv.style.background = colors[type] || colors.success;
|
|
648
|
+
alertDiv.classList.add('show');
|
|
649
|
+
|
|
650
|
+
setTimeout(() => {
|
|
651
|
+
alertDiv.classList.remove('show');
|
|
652
|
+
}, 3000);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// 颜色选择器同步
|
|
656
|
+
colorInput.addEventListener('input', function() {
|
|
657
|
+
colorValue.value = this.value;
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
colorValue.addEventListener('input', function() {
|
|
661
|
+
const value = this.value;
|
|
662
|
+
if (value.match(/^#[0-9A-F]{6}$/i)) {
|
|
663
|
+
colorInput.value = value;
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// 生成条形码
|
|
668
|
+
generateBtn.addEventListener('click', function() {
|
|
669
|
+
const code = barcodeInput.value.trim();
|
|
670
|
+
const format = formatSelect.value;
|
|
671
|
+
const lineColor = colorInput.value;
|
|
672
|
+
|
|
673
|
+
if (!code) {
|
|
674
|
+
showAlert('请输入条形码内容', 'error');
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// 移除之前的预览
|
|
679
|
+
barcodePreview.innerHTML = '';
|
|
680
|
+
|
|
681
|
+
// 创建新的条形码按钮
|
|
682
|
+
const barcodeBtn = document.createElement('nv-barcode-button');
|
|
683
|
+
barcodeBtn.setAttribute('code', code);
|
|
684
|
+
barcodeBtn.setAttribute('format', format);
|
|
685
|
+
barcodeBtn.setAttribute('line-color', lineColor);
|
|
686
|
+
barcodeBtn.setAttribute('text', '查看条形码');
|
|
687
|
+
barcodeBtn.setAttribute('bg-color', 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)');
|
|
688
|
+
barcodeBtn.setAttribute('width', '2');
|
|
689
|
+
barcodeBtn.setAttribute('height', '100');
|
|
690
|
+
barcodeBtn.setAttribute('background-color', '#ffffff');
|
|
691
|
+
barcodeBtn.setAttribute('show-text', 'true');
|
|
692
|
+
barcodeBtn.setAttribute('font-size', '20');
|
|
693
|
+
barcodeBtn.setAttribute('margin', '10');
|
|
694
|
+
|
|
695
|
+
barcodePreview.appendChild(barcodeBtn);
|
|
696
|
+
|
|
697
|
+
showAlert('已生成条形码按钮,点击"查看条形码"预览');
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
// 示例点击
|
|
701
|
+
exampleItems.forEach(item => {
|
|
702
|
+
item.addEventListener('click', function() {
|
|
703
|
+
const code = this.dataset.code;
|
|
704
|
+
const format = this.dataset.format;
|
|
705
|
+
const color = this.dataset.color;
|
|
706
|
+
|
|
707
|
+
barcodeInput.value = code;
|
|
708
|
+
formatSelect.value = format;
|
|
709
|
+
colorInput.value = color;
|
|
710
|
+
colorValue.value = color;
|
|
711
|
+
|
|
712
|
+
// 自动触发生成
|
|
713
|
+
generateBtn.click();
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// 动态创建一些示例条形码
|
|
718
|
+
const dynamicExamples = [
|
|
719
|
+
{ code: 'TEST-001', format: 'CODE128', color: '#e53e3e', text: '测试1', bgColor: 'linear-gradient(135deg, #e53e3e 0%, #c53030 100%)' },
|
|
720
|
+
{ code: '4567890123', format: 'EAN8', color: '#38a169', text: '测试2', bgColor: 'linear-gradient(135deg, #38a169 0%, #276749 100%)' },
|
|
721
|
+
{ code: 'ABC123XYZ', format: 'CODE39', color: '#805ad5', text: '测试3', bgColor: 'linear-gradient(135deg, #805ad5 0%, #6b46c1 100%)' },
|
|
722
|
+
{ code: 'HELLO-WORLD', format: 'CODE128', color: '#d69e2e', text: '测试4', bgColor: 'linear-gradient(135deg, #d69e2e 0%, #b7791f 100%)' }
|
|
723
|
+
];
|
|
724
|
+
|
|
725
|
+
dynamicExamples.forEach(example => {
|
|
726
|
+
const dynamicBtn = document.createElement('dynamic-barcode');
|
|
727
|
+
dynamicBtn.code = example.code;
|
|
728
|
+
dynamicBtn.format = example.format;
|
|
729
|
+
dynamicBtn.lineColor = example.color;
|
|
730
|
+
dynamicBtn.text = example.text;
|
|
731
|
+
dynamicBtn.bgColor = example.bgColor;
|
|
732
|
+
dynamicBarcodes.appendChild(dynamicBtn);
|
|
733
|
+
|
|
734
|
+
// 添加一些间距
|
|
735
|
+
const br = document.createElement('br');
|
|
736
|
+
dynamicBarcodes.appendChild(br);
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
// 初始生成一个示例
|
|
740
|
+
setTimeout(() => {
|
|
741
|
+
generateBtn.click();
|
|
742
|
+
}, 500);
|
|
743
|
+
});
|
|
744
|
+
</script>
|
|
745
|
+
</body>
|
|
746
|
+
</html>
|