tt-pdf-generator 1.0.0
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/LICENSE +21 -0
- package/README.md +398 -0
- package/dist/package.json +45 -0
- package/dist/pdf-generator.browser.js +14 -0
- package/dist/pdf-generator.browser.js.map +7 -0
- package/dist/pdf-generator.d.ts +15 -0
- package/dist/pdf-generator.esm.js +14 -0
- package/dist/pdf-generator.esm.js.map +7 -0
- package/package.json +114 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 milad-a-kareem
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# TT PDF Generator
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/tt-pdf-generator)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
A powerful React-based PDF generation library for creating documents. Built with React-PDF, TypeScript, and modern web technologies.
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- 🚀 **Fast PDF Generation** - Built with React-PDF for optimal performance
|
|
12
|
+
- 🎨 **Template-Driven** - JSON-based templates for easy customization
|
|
13
|
+
- 🔧 **Component-Based** - Modular architecture with reusable components
|
|
14
|
+
- 📱 **Browser & Node.js** - Works in both environments
|
|
15
|
+
- 🎯 **TypeScript Support** - Full type definitions included
|
|
16
|
+
- 📦 **Multiple Formats** - IIFE, ES Modules, and CommonJS support
|
|
17
|
+
- 🎨 **Rich Components** - Text, Tables, Images, QR Codes, and more
|
|
18
|
+
- 🔒 **Secure** - No external dependencies bundled
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install tt-pdf-generator
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 🚀 Quick Start
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { generatePdf } from 'tt-pdf-generator';
|
|
32
|
+
|
|
33
|
+
const template = JSON.stringify({
|
|
34
|
+
components: [
|
|
35
|
+
{
|
|
36
|
+
type: 'Text',
|
|
37
|
+
props: {
|
|
38
|
+
children: 'Hello World!',
|
|
39
|
+
style: { fontSize: 24, textAlign: 'center' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const data = JSON.stringify({ name: 'John Doe' });
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const pdfBuffer = await generatePdf(template, data);
|
|
49
|
+
console.log('PDF generated successfully!');
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('PDF generation failed:', error);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Advanced Template
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const template = JSON.stringify({
|
|
59
|
+
fonts: [
|
|
60
|
+
{
|
|
61
|
+
family: 'Helvetica',
|
|
62
|
+
fonts: [
|
|
63
|
+
{
|
|
64
|
+
src: 'https://fonts.gstatic.com/s/helveticaneue/v70/1Ptsg8zYS_SKggPNyC0IT4ttDfA.ttf',
|
|
65
|
+
fontWeight: 400,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
components: [
|
|
71
|
+
{
|
|
72
|
+
type: 'Text',
|
|
73
|
+
props: {
|
|
74
|
+
children: '{{companyName}}',
|
|
75
|
+
style: { fontSize: 24, fontWeight: 'bold', textAlign: 'center' },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'Table',
|
|
80
|
+
props: {
|
|
81
|
+
data: [
|
|
82
|
+
['Name', 'Policy Number', 'Date'],
|
|
83
|
+
['{{customerName}}', '{{policyNumber}}', '{{date}}'],
|
|
84
|
+
],
|
|
85
|
+
style: { width: '100%', marginTop: 20 },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'QrCode',
|
|
90
|
+
props: {
|
|
91
|
+
value: '{{qrCodeData}}',
|
|
92
|
+
style: { width: 100, height: 100, marginTop: 20 },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 🔧 Usage Examples
|
|
100
|
+
|
|
101
|
+
### Browser Usage
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<!DOCTYPE html>
|
|
105
|
+
<html>
|
|
106
|
+
<head>
|
|
107
|
+
<title>PDF Generator</title>
|
|
108
|
+
</head>
|
|
109
|
+
<body>
|
|
110
|
+
<!-- Include React and React-PDF dependencies first -->
|
|
111
|
+
<script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
112
|
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
113
|
+
<script src="https://unpkg.com/@react-pdf/renderer@4.3.0/dist/react-pdf-renderer.umd.js"></script>
|
|
114
|
+
|
|
115
|
+
<!-- Include the PDF generator library -->
|
|
116
|
+
<script src="node_modules/tt-pdf-generator/dist/pdf-generator.browser.js"></script>
|
|
117
|
+
|
|
118
|
+
<script>
|
|
119
|
+
const { generatePdf } = PolicyPdfGenerator;
|
|
120
|
+
|
|
121
|
+
async function createPDF() {
|
|
122
|
+
const template = JSON.stringify({
|
|
123
|
+
components: [
|
|
124
|
+
{
|
|
125
|
+
type: 'Text',
|
|
126
|
+
props: {
|
|
127
|
+
children: 'Hello World',
|
|
128
|
+
style: { fontSize: 16 },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const data = JSON.stringify({ name: 'John' });
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
const pdfBuffer = await generatePdf(template, data);
|
|
138
|
+
|
|
139
|
+
// Download the PDF
|
|
140
|
+
const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
|
|
141
|
+
const url = URL.createObjectURL(blob);
|
|
142
|
+
const a = document.createElement('a');
|
|
143
|
+
a.href = url;
|
|
144
|
+
a.download = 'document.pdf';
|
|
145
|
+
a.click();
|
|
146
|
+
URL.revokeObjectURL(url);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.error('PDF generation failed:', error);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
createPDF();
|
|
153
|
+
</script>
|
|
154
|
+
</body>
|
|
155
|
+
</html>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Node.js Usage
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
const { generatePdf } = require('tt-pdf-generator');
|
|
162
|
+
const fs = require('fs');
|
|
163
|
+
|
|
164
|
+
async function createPDF() {
|
|
165
|
+
const template = JSON.stringify({
|
|
166
|
+
components: [
|
|
167
|
+
{
|
|
168
|
+
type: 'Text',
|
|
169
|
+
props: {
|
|
170
|
+
children: 'Hello World',
|
|
171
|
+
style: { fontSize: 16 },
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const data = JSON.stringify({ name: 'John' });
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
const pdfBuffer = await generatePdf(template, data);
|
|
181
|
+
|
|
182
|
+
// Save to file
|
|
183
|
+
fs.writeFileSync('output.pdf', pdfBuffer);
|
|
184
|
+
console.log('PDF generated successfully!');
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error('PDF generation failed:', error);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
createPDF();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### ES Modules
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
import { generatePdf } from 'tt-pdf-generator';
|
|
197
|
+
|
|
198
|
+
const template = JSON.stringify({
|
|
199
|
+
components: [
|
|
200
|
+
{
|
|
201
|
+
type: 'Text',
|
|
202
|
+
props: {
|
|
203
|
+
children: 'Hello World',
|
|
204
|
+
style: { fontSize: 16 },
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const data = JSON.stringify({ name: 'John' });
|
|
211
|
+
|
|
212
|
+
const pdfBuffer = await generatePdf(template, data);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 📚 API Reference
|
|
216
|
+
|
|
217
|
+
### `generatePdf(template, data)`
|
|
218
|
+
|
|
219
|
+
Generates a PDF document based on the provided template and data.
|
|
220
|
+
|
|
221
|
+
**Parameters:**
|
|
222
|
+
|
|
223
|
+
- `template` (string): JSON string containing the PDF template structure
|
|
224
|
+
- `data` (string): JSON string containing the data to populate the template
|
|
225
|
+
|
|
226
|
+
**Returns:**
|
|
227
|
+
|
|
228
|
+
- `Promise<Buffer>`: PDF buffer that can be saved to file or sent to browser
|
|
229
|
+
|
|
230
|
+
**Template Structure:**
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
interface Template {
|
|
234
|
+
fonts?: Font[];
|
|
235
|
+
components: Component[];
|
|
236
|
+
images?: Record<string, string>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface Component {
|
|
240
|
+
type: string;
|
|
241
|
+
props: Record<string, any>;
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## 🎨 Available Components
|
|
246
|
+
|
|
247
|
+
### Text Component
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"type": "Text",
|
|
252
|
+
"props": {
|
|
253
|
+
"children": "Your text here",
|
|
254
|
+
"style": {
|
|
255
|
+
"fontSize": 16,
|
|
256
|
+
"fontWeight": "bold",
|
|
257
|
+
"color": "#000000",
|
|
258
|
+
"textAlign": "center"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Table Component
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"type": "Table",
|
|
269
|
+
"props": {
|
|
270
|
+
"data": [
|
|
271
|
+
["Header 1", "Header 2"],
|
|
272
|
+
["Row 1 Col 1", "Row 1 Col 2"]
|
|
273
|
+
],
|
|
274
|
+
"style": {
|
|
275
|
+
"width": "100%"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Image Component
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
{
|
|
285
|
+
"type": "Image",
|
|
286
|
+
"props": {
|
|
287
|
+
"src": "https://example.com/image.png",
|
|
288
|
+
"style": {
|
|
289
|
+
"width": 200,
|
|
290
|
+
"height": 100
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### QR Code Component
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"type": "QrCode",
|
|
301
|
+
"props": {
|
|
302
|
+
"value": "https://example.com",
|
|
303
|
+
"style": {
|
|
304
|
+
"width": 100,
|
|
305
|
+
"height": 100
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## 🔧 Build & Development
|
|
312
|
+
|
|
313
|
+
### Build Commands
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Build all versions
|
|
317
|
+
npm run build:all
|
|
318
|
+
|
|
319
|
+
# Build browser version only
|
|
320
|
+
npm run build:browser
|
|
321
|
+
|
|
322
|
+
# Build ES module version only
|
|
323
|
+
npm run build:esm
|
|
324
|
+
|
|
325
|
+
# Build CLI version
|
|
326
|
+
npm run build:cli
|
|
327
|
+
|
|
328
|
+
# Clean build directory
|
|
329
|
+
npm run clean
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Development
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
# Install dependencies
|
|
336
|
+
npm install
|
|
337
|
+
|
|
338
|
+
# Start development server
|
|
339
|
+
npm run dev
|
|
340
|
+
|
|
341
|
+
# Type checking
|
|
342
|
+
npm run type-check
|
|
343
|
+
|
|
344
|
+
# Linting
|
|
345
|
+
npm run lint
|
|
346
|
+
|
|
347
|
+
# Format code
|
|
348
|
+
npm run format
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## 📋 Requirements
|
|
352
|
+
|
|
353
|
+
### Peer Dependencies
|
|
354
|
+
|
|
355
|
+
- React >= 18.0.0
|
|
356
|
+
- ReactDOM >= 18.0.0
|
|
357
|
+
- @react-pdf/renderer >= 4.0.0
|
|
358
|
+
|
|
359
|
+
### Browser Support
|
|
360
|
+
|
|
361
|
+
- Modern browsers with ES2020+ support
|
|
362
|
+
- ES Modules: Chrome 61+, Firefox 60+, Safari 10.1+
|
|
363
|
+
- IIFE: All browsers supporting ES5+
|
|
364
|
+
|
|
365
|
+
## 🚀 Performance
|
|
366
|
+
|
|
367
|
+
- **Bundle Size**: ~55KB minified
|
|
368
|
+
- **Memory Usage**: Optimized for large documents
|
|
369
|
+
- **Rendering Speed**: Fast PDF generation with React-PDF
|
|
370
|
+
- **Caching**: Built-in component caching for repeated elements
|
|
371
|
+
|
|
372
|
+
## 🤝 Contributing
|
|
373
|
+
|
|
374
|
+
1. Fork the repository
|
|
375
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
376
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
377
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
378
|
+
5. Open a Pull Request
|
|
379
|
+
|
|
380
|
+
## 📄 License
|
|
381
|
+
|
|
382
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
383
|
+
|
|
384
|
+
## 🆘 Support
|
|
385
|
+
|
|
386
|
+
- 📖 [Documentation](https://github.com/yourusername/tt-pdf-generator#readme)
|
|
387
|
+
- 🐛 [Issues](https://github.com/yourusername/tt-pdf-generator/issues)
|
|
388
|
+
- 💬 [Discussions](https://github.com/yourusername/tt-pdf-generator/discussions)
|
|
389
|
+
|
|
390
|
+
## 🙏 Acknowledgments
|
|
391
|
+
|
|
392
|
+
- Built with [React-PDF](https://react-pdf.org/)
|
|
393
|
+
- Powered by [esbuild](https://esbuild.github.io/)
|
|
394
|
+
- Styled with [Tailwind CSS](https://tailwindcss.com/)
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
Made with ❤️ by [milad-a-kareem](https://github.com/milad-a-kareem)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tt-pdf-generator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TTech pdf generator - A powerful React-based PDF generation library for creating documents",
|
|
5
|
+
"main": "pdf-generator.browser.js",
|
|
6
|
+
"module": "pdf-generator.esm.js",
|
|
7
|
+
"types": "pdf-generator.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./pdf-generator.esm.js",
|
|
11
|
+
"require": "./pdf-generator.browser.js",
|
|
12
|
+
"types": "./pdf-generator.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./browser": "./pdf-generator.browser.js",
|
|
15
|
+
"./esm": "./pdf-generator.esm.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"pdf-generator.browser.js",
|
|
19
|
+
"pdf-generator.esm.js",
|
|
20
|
+
"pdf-generator.d.ts",
|
|
21
|
+
"pdf-generator.browser.js.map",
|
|
22
|
+
"pdf-generator.esm.js.map"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"pdf",
|
|
26
|
+
"generator",
|
|
27
|
+
"react-pdf",
|
|
28
|
+
"browser",
|
|
29
|
+
"document",
|
|
30
|
+
"react",
|
|
31
|
+
"typescript"
|
|
32
|
+
],
|
|
33
|
+
"author": "milad-a-kareem",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": ">=18.0.0",
|
|
37
|
+
"react-dom": ">=18.0.0",
|
|
38
|
+
"@react-pdf/renderer": ">=4.0.0"
|
|
39
|
+
},
|
|
40
|
+
"browser": {
|
|
41
|
+
"fs": false,
|
|
42
|
+
"path": false,
|
|
43
|
+
"os": false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";var PolicyPdfGenerator=(()=>{var Dn=Object.create;var ge=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var $n=Object.getPrototypeOf,Un=Object.prototype.hasOwnProperty;var R=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),qn=(t,e)=>{for(var r in e)ge(t,r,{get:e[r],enumerable:!0})},Mt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _n(e))!Un.call(t,o)&&o!==r&&ge(t,o,{get:()=>e[o],enumerable:!(n=On(e,o))||n.enumerable});return t};var M=(t,e,r)=>(r=t!=null?Dn($n(t)):{},Mt(e||!t||!t.__esModule?ge(r,"default",{value:t,enumerable:!0}):r,t)),Vn=t=>Mt(ge({},"__esModule",{value:!0}),t);var Dt=p((di,Ft)=>{function zn(t){this.value=t,this.match=function(e){return this.value>=e.height}}function Hn(t){this.value=t,this.match=function(e){return this.value<e.height}}function Wn(t){this.value=t,this.match=function(e){return this.value>=e.width}}function Yn(t){this.value=t,this.match=function(e){return this.value<e.width}}function Jn(t){this.value=t,this.match=function(e){return this.value===e.orientation}}Ft.exports=function(e,r){switch(e){case"max-height":return new zn(r);case"min-height":return new Hn(r);case"max-width":return new Wn(r);case"min-width":return new Yn(r);case"orientation":return new Jn(r);default:throw new Error(r)}}});var _t=p((fi,Ot)=>{function Kn(t,e){this.left=t,this.right=e,this.match=function(r){return t.match(r)&&e.match(r)}}function Qn(t,e){this.left=t,this.right=e,this.match=function(r){return t.match(r)||e.match(r)}}Ot.exports=function(e,r,n){switch(e){case"and":return new Kn(r,n);case",":return new Qn(r,n);default:throw new Error(value)}}});var Vt=p((hi,qt)=>{var Gn=Dt(),Xn=_t(),$t=/[0-9]/,Ve=/[a-z|\-]/i,Zn=/\s/,Ut=/:/,eo=/,/,to=/and$/,ro=/@/;function no(t){for(var e=0,r=[];e<t.length;){var n=t[e];if(ro.test(n))for(n=t[++e];Ve.test(n)&&n!==void 0;)n=t[++e];if(Zn.test(n)||n===")"||n==="("){e++;continue}if(Ut.test(n)||eo.test(n)){e++,r.push({type:"operator",value:n});continue}if($t.test(n)){for(var o="";$t.test(n);)o+=n,n=t[++e];r.push({type:"number",value:o});continue}if(Ve.test(n)){for(var o="";Ve.test(n)&&n!==void 0;)o+=n,n=t[++e];to.test(o)?r.push({type:"operator",value:o}):r.push({type:"literal",value:o});continue}throw new TypeError("Tokenizer: I dont know what this character is: "+n)}return r}function oo(t){for(var e=[],r=[];t.length>0;){var n=t.shift();if(n.type==="number"||n.type==="literal"){e.push(n);continue}if(n.type==="operator"){if(Ut.test(n.value)){n={type:"query",key:e.pop(),value:t.shift()},e.push(n);continue}for(;r.length>0;)e.unshift(r.pop());r.push(n)}}for(;r.length>0;)e.unshift(r.pop());function o(){var i=e.shift();if(i.type==="number")return parseInt(i.value);if(i.type==="literal")return i.value;if(i.type==="operator"){var s=o(),a=o();return Xn(i.value,s,a)}if(i.type==="query"){var s=i.key.value,a=i.value.value;return Gn(s,a)}}return o()}qt.exports={parse:function(t){var e=no(t),r=oo(e);return r}}});var zt=p((pi,jt)=>{var so=Vt();jt.exports=function(t,e){var r={};return Object.keys(t).forEach(function(n){so.parse(n).match(e)&&Object.assign(r,t[n])}),r}});var Wt=p((gi,Ht)=>{var io=function(t,e,r){if(t==null)return[0,0,0];var n=(1-Math.abs(2*r-1))*e,o=t/60,i=n*(1-Math.abs(o%2-1));o=Math.floor(o);var s,a,l;o===0?(s=n,a=i,l=0):o===1?(s=i,a=n,l=0):o===2?(s=0,a=n,l=i):o===3?(s=0,a=i,l=n):o===4?(s=i,a=0,l=n):o===5&&(s=n,a=0,l=i);var u=r-n/2;return s+=u,a+=u,l+=u,[Math.abs(Math.round(s*255)),Math.abs(Math.round(a*255)),Math.abs(Math.round(l*255))]};Ht.exports=io});var Jt=p((mi,Yt)=>{var ao=Wt();function je(t,e){return t>e?e:t}function ze(t,e){return t<e?e:t}function lo(t){for(t=je(t,1e7),t=ze(t,-1e7);t<0;)t+=360;for(;t>359;)t-=360;return t}function co(t,e,r){t=lo(t),e=ze(je(e,100),0),r=ze(je(r,100),0),e/=100,r/=100;var n=ao(t,e,r);return"#"+n.map(function(o){return(256+o).toString(16).substr(-2)}).join("")}Yt.exports=co});var Qt=p((yi,Kt)=>{"use strict";Kt.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Xt=p((bi,Gt)=>{Gt.exports=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}});var tr=p((wi,er)=>{"use strict";var uo=Xt(),fo=Array.prototype.concat,ho=Array.prototype.slice,Zt=er.exports=function(e){for(var r=[],n=0,o=e.length;n<o;n++){var i=e[n];uo(i)?r=fo.call(r,ho.call(i)):r.push(i)}return r};Zt.wrap=function(t){return function(){return t(Zt(arguments))}}});var sr=p((Ci,or)=>{var se=Qt(),ie=tr(),rr=Object.hasOwnProperty,nr=Object.create(null);for(ye in se)rr.call(se,ye)&&(nr[se[ye]]=ye);var ye,v=or.exports={to:{},get:{}};v.get=function(t){var e=t.substring(0,3).toLowerCase(),r,n;switch(e){case"hsl":r=v.get.hsl(t),n="hsl";break;case"hwb":r=v.get.hwb(t),n="hwb";break;default:r=v.get.rgb(t),n="rgb";break}return r?{model:n,value:r}:null};v.get.rgb=function(t){if(!t)return null;var e=/^#([a-f0-9]{3,4})$/i,r=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,s=[0,0,0,1],a,l,u;if(a=t.match(r)){for(u=a[2],a=a[1],l=0;l<3;l++){var d=l*2;s[l]=parseInt(a.slice(d,d+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(a=t.match(e)){for(a=a[1],u=a[3],l=0;l<3;l++)s[l]=parseInt(a[l]+a[l],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(a=t.match(n)){for(l=0;l<3;l++)s[l]=parseInt(a[l+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=t.match(o)){for(l=0;l<3;l++)s[l]=Math.round(parseFloat(a[l+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=t.match(i))?a[1]==="transparent"?[0,0,0,0]:rr.call(se,a[1])?(s=se[a[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=O(s[l],0,255);return s[3]=O(s[3],0,1),s};v.get.hsl=function(t){if(!t)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=O(parseFloat(r[2]),0,100),s=O(parseFloat(r[3]),0,100),a=O(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};v.get.hwb=function(t){if(!t)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=O(parseFloat(r[2]),0,100),s=O(parseFloat(r[3]),0,100),a=O(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};v.to.hex=function(){var t=ie(arguments);return"#"+be(t[0])+be(t[1])+be(t[2])+(t[3]<1?be(Math.round(t[3]*255)):"")};v.to.rgb=function(){var t=ie(arguments);return t.length<4||t[3]===1?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"};v.to.rgb.percent=function(){var t=ie(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||t[3]===1?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"};v.to.hsl=function(){var t=ie(arguments);return t.length<4||t[3]===1?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"};v.to.hwb=function(){var t=ie(arguments),e="";return t.length>=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};v.to.keyword=function(t){return nr[t.slice(0,3)]};function O(t,e,r){return Math.min(Math.max(e,t),r)}function be(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}});var ar=p((Ei,ir)=>{var He=40,We=41,we=39,Ye=34,Je=92,G=47,Ke=44,Qe=58,Ce=42,po=117,go=85,mo=43,yo=/^[a-f0-9?-]+$/i;ir.exports=function(t){for(var e=[],r=t,n,o,i,s,a,l,u,d,c=0,f=r.charCodeAt(c),m=r.length,y=[{nodes:e}],g=0,h,S="",B="",P="";c<m;)if(f<=32){n=c;do n+=1,f=r.charCodeAt(n);while(f<=32);s=r.slice(c,n),i=e[e.length-1],f===We&&g?P=s:i&&i.type==="div"?(i.after=s,i.sourceEndIndex+=s.length):f===Ke||f===Qe||f===G&&r.charCodeAt(n+1)!==Ce&&(!h||h&&h.type==="function"&&h.value!=="calc")?B=s:e.push({type:"space",sourceIndex:c,sourceEndIndex:n,value:s}),c=n}else if(f===we||f===Ye){n=c,o=f===we?"'":'"',s={type:"string",sourceIndex:c,quote:o};do if(a=!1,n=r.indexOf(o,n+1),~n)for(l=n;r.charCodeAt(l-1)===Je;)l-=1,a=!a;else r+=o,n=r.length-1,s.unclosed=!0;while(a);s.value=r.slice(c+1,n),s.sourceEndIndex=s.unclosed?n:n+1,e.push(s),c=n+1,f=r.charCodeAt(c)}else if(f===G&&r.charCodeAt(c+1)===Ce)n=r.indexOf("*/",c),s={type:"comment",sourceIndex:c,sourceEndIndex:n+2},n===-1&&(s.unclosed=!0,n=r.length,s.sourceEndIndex=n),s.value=r.slice(c+2,n),e.push(s),c=n+2,f=r.charCodeAt(c);else if((f===G||f===Ce)&&h&&h.type==="function"&&h.value==="calc")s=r[c],e.push({type:"word",sourceIndex:c-B.length,sourceEndIndex:c+s.length,value:s}),c+=1,f=r.charCodeAt(c);else if(f===G||f===Ke||f===Qe)s=r[c],e.push({type:"div",sourceIndex:c-B.length,sourceEndIndex:c+s.length,value:s,before:B,after:""}),B="",c+=1,f=r.charCodeAt(c);else if(He===f){n=c;do n+=1,f=r.charCodeAt(n);while(f<=32);if(d=c,s={type:"function",sourceIndex:c-S.length,value:S,before:r.slice(d+1,n)},c=n,S==="url"&&f!==we&&f!==Ye){n-=1;do if(a=!1,n=r.indexOf(")",n+1),~n)for(l=n;r.charCodeAt(l-1)===Je;)l-=1,a=!a;else r+=")",n=r.length-1,s.unclosed=!0;while(a);u=n;do u-=1,f=r.charCodeAt(u);while(f<=32);d<u?(c!==u+1?s.nodes=[{type:"word",sourceIndex:c,sourceEndIndex:u+1,value:r.slice(c,u+1)}]:s.nodes=[],s.unclosed&&u+1!==n?(s.after="",s.nodes.push({type:"space",sourceIndex:u+1,sourceEndIndex:n,value:r.slice(u+1,n)})):(s.after=r.slice(u+1,n),s.sourceEndIndex=n)):(s.after="",s.nodes=[]),c=n+1,s.sourceEndIndex=s.unclosed?n:c,f=r.charCodeAt(c),e.push(s)}else g+=1,s.after="",s.sourceEndIndex=c+1,e.push(s),y.push(s),e=s.nodes=[],h=s;S=""}else if(We===f&&g)c+=1,f=r.charCodeAt(c),h.after=P,h.sourceEndIndex+=P.length,P="",g-=1,y[y.length-1].sourceEndIndex=c,y.pop(),h=y[g],e=h.nodes;else{n=c;do f===Je&&(n+=1),n+=1,f=r.charCodeAt(n);while(n<m&&!(f<=32||f===we||f===Ye||f===Ke||f===Qe||f===G||f===He||f===Ce&&h&&h.type==="function"&&h.value==="calc"||f===G&&h.type==="function"&&h.value==="calc"||f===We&&g));s=r.slice(c,n),He===f?S=s:(po===s.charCodeAt(0)||go===s.charCodeAt(0))&&mo===s.charCodeAt(1)&&yo.test(s.slice(2))?e.push({type:"unicode-range",sourceIndex:c,sourceEndIndex:n,value:s}):e.push({type:"word",sourceIndex:c,sourceEndIndex:n,value:s}),c=n}for(c=y.length-1;c;c-=1)y[c].unclosed=!0,y[c].sourceEndIndex=r.length;return y[0].nodes}});var cr=p((Ai,lr)=>{var Ee=45,Ae=43,Ge=46,bo=101,wo=69;function Co(t){var e=t.charCodeAt(0),r;if(e===Ae||e===Ee){if(r=t.charCodeAt(1),r>=48&&r<=57)return!0;var n=t.charCodeAt(2);return r===Ge&&n>=48&&n<=57}return e===Ge?(r=t.charCodeAt(1),r>=48&&r<=57):e>=48&&e<=57}lr.exports=function(t){var e=0,r=t.length,n,o,i;if(r===0||!Co(t))return!1;for(n=t.charCodeAt(e),(n===Ae||n===Ee)&&e++;e<r&&(n=t.charCodeAt(e),!(n<48||n>57));)e+=1;if(n=t.charCodeAt(e),o=t.charCodeAt(e+1),n===Ge&&o>=48&&o<=57)for(e+=2;e<r&&(n=t.charCodeAt(e),!(n<48||n>57));)e+=1;if(n=t.charCodeAt(e),o=t.charCodeAt(e+1),i=t.charCodeAt(e+2),(n===bo||n===wo)&&(o>=48&&o<=57||(o===Ae||o===Ee)&&i>=48&&i<=57))for(e+=o===Ae||o===Ee?3:2;e<r&&(n=t.charCodeAt(e),!(n<48||n>57));)e+=1;return{number:t.slice(0,e),unit:t.slice(e)}}});var Ar=p((Ii,Er)=>{Er.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var U=p(H=>{var ot,hs=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];H.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};H.getSymbolTotalCodewords=function(e){return hs[e]};H.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};H.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ot=e};H.isKanjiModeEnabled=function(){return typeof ot<"u"};H.toSJIS=function(e){return ot(e)}});var Ie=p(I=>{I.L={bit:1};I.M={bit:0};I.Q={bit:3};I.H={bit:2};function ps(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return I.L;case"m":case"medium":return I.M;case"q":case"quartile":return I.Q;case"h":case"high":return I.H;default:throw new Error("Unknown EC Level: "+t)}}I.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};I.from=function(e,r){if(I.isValid(e))return e;try{return ps(e)}catch{return r}}});var Sr=p((Mi,Tr)=>{function xr(){this.buffer=[],this.length=0}xr.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};Tr.exports=xr});var vr=p((Ni,Rr)=>{function ae(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}ae.prototype.set=function(t,e,r,n){let o=t*this.size+e;this.data[o]=r,n&&(this.reservedBit[o]=!0)};ae.prototype.get=function(t,e){return this.data[t*this.size+e]};ae.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};ae.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};Rr.exports=ae});var Ir=p(Be=>{var gs=U().getSymbolSize;Be.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=gs(e),o=n===145?26:Math.ceil((n-13)/(2*r-2))*2,i=[n-7];for(let s=1;s<r-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};Be.getPositions=function(e){let r=[],n=Be.getRowColCoords(e),o=n.length;for(let i=0;i<o;i++)for(let s=0;s<o;s++)i===0&&s===0||i===0&&s===o-1||i===o-1&&s===0||r.push([n[i],n[s]]);return r}});var Mr=p(Pr=>{var ms=U().getSymbolSize,Br=7;Pr.getPositions=function(e){let r=ms(e);return[[0,0],[r-Br,0],[0,r-Br]]}});var Nr=p(E=>{E.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var W={N1:3,N2:3,N3:40,N4:10};E.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};E.from=function(e){return E.isValid(e)?parseInt(e,10):void 0};E.getPenaltyN1=function(e){let r=e.size,n=0,o=0,i=0,s=null,a=null;for(let l=0;l<r;l++){o=i=0,s=a=null;for(let u=0;u<r;u++){let d=e.get(l,u);d===s?o++:(o>=5&&(n+=W.N1+(o-5)),s=d,o=1),d=e.get(u,l),d===a?i++:(i>=5&&(n+=W.N1+(i-5)),a=d,i=1)}o>=5&&(n+=W.N1+(o-5)),i>=5&&(n+=W.N1+(i-5))}return n};E.getPenaltyN2=function(e){let r=e.size,n=0;for(let o=0;o<r-1;o++)for(let i=0;i<r-1;i++){let s=e.get(o,i)+e.get(o,i+1)+e.get(o+1,i)+e.get(o+1,i+1);(s===4||s===0)&&n++}return n*W.N2};E.getPenaltyN3=function(e){let r=e.size,n=0,o=0,i=0;for(let s=0;s<r;s++){o=i=0;for(let a=0;a<r;a++)o=o<<1&2047|e.get(s,a),a>=10&&(o===1488||o===93)&&n++,i=i<<1&2047|e.get(a,s),a>=10&&(i===1488||i===93)&&n++}return n*W.N3};E.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let i=0;i<n;i++)r+=e.data[i];return Math.abs(Math.ceil(r*100/n/5)-10)*W.N4};function ys(t,e,r){switch(t){case E.Patterns.PATTERN000:return(e+r)%2===0;case E.Patterns.PATTERN001:return e%2===0;case E.Patterns.PATTERN010:return r%3===0;case E.Patterns.PATTERN011:return(e+r)%3===0;case E.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case E.Patterns.PATTERN101:return e*r%2+e*r%3===0;case E.Patterns.PATTERN110:return(e*r%2+e*r%3)%2===0;case E.Patterns.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}E.applyMask=function(e,r){let n=r.size;for(let o=0;o<n;o++)for(let i=0;i<n;i++)r.isReserved(i,o)||r.xor(i,o,ys(e,i,o))};E.getBestMask=function(e,r){let n=Object.keys(E.Patterns).length,o=0,i=1/0;for(let s=0;s<n;s++){r(s),E.applyMask(s,e);let a=E.getPenaltyN1(e)+E.getPenaltyN2(e)+E.getPenaltyN3(e)+E.getPenaltyN4(e);E.applyMask(s,e),a<i&&(i=a,o=s)}return o}});var it=p(st=>{var q=Ie(),Pe=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Me=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];st.getBlocksCount=function(e,r){switch(r){case q.L:return Pe[(e-1)*4+0];case q.M:return Pe[(e-1)*4+1];case q.Q:return Pe[(e-1)*4+2];case q.H:return Pe[(e-1)*4+3];default:return}};st.getTotalCodewordsCount=function(e,r){switch(r){case q.L:return Me[(e-1)*4+0];case q.M:return Me[(e-1)*4+1];case q.Q:return Me[(e-1)*4+2];case q.H:return Me[(e-1)*4+3];default:return}}});var kr=p(ke=>{var le=new Uint8Array(512),Ne=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)le[r]=e,Ne[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)le[r]=le[r-255]})();ke.log=function(e){if(e<1)throw new Error("log("+e+")");return Ne[e]};ke.exp=function(e){return le[e]};ke.mul=function(e,r){return e===0||r===0?0:le[Ne[e]+Ne[r]]}});var Lr=p(ce=>{var at=kr();ce.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<r.length;i++)n[o+i]^=at.mul(e[o],r[i]);return n};ce.mod=function(e,r){let n=new Uint8Array(e);for(;n.length-r.length>=0;){let o=n[0];for(let s=0;s<r.length;s++)n[s]^=at.mul(r[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};ce.generateECPolynomial=function(e){let r=new Uint8Array([1]);for(let n=0;n<e;n++)r=ce.mul(r,new Uint8Array([1,at.exp(n)]));return r}});var Or=p(($i,Dr)=>{var Fr=Lr();function lt(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}lt.prototype.initialize=function(e){this.degree=e,this.genPoly=Fr.generateECPolynomial(this.degree)};lt.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=Fr.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){let i=new Uint8Array(this.degree);return i.set(n,o),i}return n};Dr.exports=lt});var ct=p(_r=>{_r.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var ut=p(D=>{var $r="[0-9]+",bs="[A-Z $%*+\\-./:]+",ue="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ue=ue.replace(/u/g,"\\u");var ws="(?:(?![A-Z0-9 $%*+\\-./:]|"+ue+`)(?:.|[\r
|
|
2
|
+
]))+`;D.KANJI=new RegExp(ue,"g");D.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");D.BYTE=new RegExp(ws,"g");D.NUMERIC=new RegExp($r,"g");D.ALPHANUMERIC=new RegExp(bs,"g");var Cs=new RegExp("^"+ue+"$"),Es=new RegExp("^"+$r+"$"),As=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");D.testKanji=function(e){return Cs.test(e)};D.testNumeric=function(e){return Es.test(e)};D.testAlphanumeric=function(e){return As.test(e)}});var V=p(x=>{var xs=ct(),dt=ut();x.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};x.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};x.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};x.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};x.MIXED={bit:-1};x.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!xs.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};x.getBestModeForData=function(e){return dt.testNumeric(e)?x.NUMERIC:dt.testAlphanumeric(e)?x.ALPHANUMERIC:dt.testKanji(e)?x.KANJI:x.BYTE};x.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};x.isValid=function(e){return e&&e.bit&&e.ccBits};function Ts(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return x.NUMERIC;case"alphanumeric":return x.ALPHANUMERIC;case"kanji":return x.KANJI;case"byte":return x.BYTE;default:throw new Error("Unknown mode: "+t)}}x.from=function(e,r){if(x.isValid(e))return e;try{return Ts(e)}catch{return r}}});var zr=p(Y=>{var Le=U(),Ss=it(),Ur=Ie(),j=V(),ft=ct(),Vr=7973,qr=Le.getBCHDigit(Vr);function Rs(t,e,r){for(let n=1;n<=40;n++)if(e<=Y.getCapacity(n,r,t))return n}function jr(t,e){return j.getCharCountIndicator(t,e)+4}function vs(t,e){let r=0;return t.forEach(function(n){let o=jr(n.mode,e);r+=o+n.getBitsLength()}),r}function Is(t,e){for(let r=1;r<=40;r++)if(vs(t,r)<=Y.getCapacity(r,e,j.MIXED))return r}Y.from=function(e,r){return ft.isValid(e)?parseInt(e,10):r};Y.getCapacity=function(e,r,n){if(!ft.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=j.BYTE);let o=Le.getSymbolTotalCodewords(e),i=Ss.getTotalCodewordsCount(e,r),s=(o-i)*8;if(n===j.MIXED)return s;let a=s-jr(n,e);switch(n){case j.NUMERIC:return Math.floor(a/10*3);case j.ALPHANUMERIC:return Math.floor(a/11*2);case j.KANJI:return Math.floor(a/13);case j.BYTE:default:return Math.floor(a/8)}};Y.getBestVersionForData=function(e,r){let n,o=Ur.from(r,Ur.M);if(Array.isArray(e)){if(e.length>1)return Is(e,o);if(e.length===0)return 1;n=e[0]}else n=e;return Rs(n.mode,n.getLength(),o)};Y.getEncodedBits=function(e){if(!ft.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Le.getBCHDigit(r)-qr>=0;)r^=Vr<<Le.getBCHDigit(r)-qr;return e<<12|r}});var Jr=p(Yr=>{var ht=U(),Wr=1335,Bs=21522,Hr=ht.getBCHDigit(Wr);Yr.getEncodedBits=function(e,r){let n=e.bit<<3|r,o=n<<10;for(;ht.getBCHDigit(o)-Hr>=0;)o^=Wr<<ht.getBCHDigit(o)-Hr;return(n<<10|o)^Bs}});var Qr=p((Hi,Kr)=>{var Ps=V();function ee(t){this.mode=Ps.NUMERIC,this.data=t.toString()}ee.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};ee.prototype.getLength=function(){return this.data.length};ee.prototype.getBitsLength=function(){return ee.getBitsLength(this.data.length)};ee.prototype.write=function(e){let r,n,o;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),o=parseInt(n,10),e.put(o,10);let i=this.data.length-r;i>0&&(n=this.data.substr(r),o=parseInt(n,10),e.put(o,i*3+1))};Kr.exports=ee});var Xr=p((Wi,Gr)=>{var Ms=V(),pt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function te(t){this.mode=Ms.ALPHANUMERIC,this.data=t}te.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};te.prototype.getLength=function(){return this.data.length};te.prototype.getBitsLength=function(){return te.getBitsLength(this.data.length)};te.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=pt.indexOf(this.data[r])*45;n+=pt.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(pt.indexOf(this.data[r]),6)};Gr.exports=te});var en=p((Yi,Zr)=>{var Ns=V();function re(t){this.mode=Ns.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}re.getBitsLength=function(e){return e*8};re.prototype.getLength=function(){return this.data.length};re.prototype.getBitsLength=function(){return re.getBitsLength(this.data.length)};re.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};Zr.exports=re});var rn=p((Ji,tn)=>{var ks=V(),Ls=U();function ne(t){this.mode=ks.KANJI,this.data=t}ne.getBitsLength=function(e){return e*13};ne.prototype.getLength=function(){return this.data.length};ne.prototype.getBitsLength=function(){return ne.getBitsLength(this.data.length)};ne.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=Ls.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
|
+
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};tn.exports=ne});var nn=p((Ki,gt)=>{"use strict";var de={single_source_shortest_paths:function(t,e,r){var n={},o={};o[e]=0;var i=de.PriorityQueue.make();i.push(e,0);for(var s,a,l,u,d,c,f,m,y;!i.empty();){s=i.pop(),a=s.value,u=s.cost,d=t[a]||{};for(l in d)d.hasOwnProperty(l)&&(c=d[l],f=u+c,m=o[l],y=typeof o[l]>"u",(y||m>f)&&(o[l]=f,i.push(l,f),n[l]=a))}if(typeof r<"u"&&typeof o[r]>"u"){var g=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(g)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,o;n;)r.push(n),o=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=de.single_source_shortest_paths(t,e,r);return de.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=de.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof gt<"u"&&(gt.exports=de)});var fn=p(oe=>{var C=V(),an=Qr(),ln=Xr(),cn=en(),un=rn(),fe=ut(),Fe=U(),Fs=nn();function on(t){return unescape(encodeURIComponent(t)).length}function he(t,e,r){let n=[],o;for(;(o=t.exec(r))!==null;)n.push({data:o[0],index:o.index,mode:e,length:o[0].length});return n}function dn(t){let e=he(fe.NUMERIC,C.NUMERIC,t),r=he(fe.ALPHANUMERIC,C.ALPHANUMERIC,t),n,o;return Fe.isKanjiModeEnabled()?(n=he(fe.BYTE,C.BYTE,t),o=he(fe.KANJI,C.KANJI,t)):(n=he(fe.BYTE_KANJI,C.BYTE,t),o=[]),e.concat(r,n,o).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function mt(t,e){switch(e){case C.NUMERIC:return an.getBitsLength(t);case C.ALPHANUMERIC:return ln.getBitsLength(t);case C.KANJI:return un.getBitsLength(t);case C.BYTE:return cn.getBitsLength(t)}}function Ds(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function Os(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];switch(n.mode){case C.NUMERIC:e.push([n,{data:n.data,mode:C.ALPHANUMERIC,length:n.length},{data:n.data,mode:C.BYTE,length:n.length}]);break;case C.ALPHANUMERIC:e.push([n,{data:n.data,mode:C.BYTE,length:n.length}]);break;case C.KANJI:e.push([n,{data:n.data,mode:C.BYTE,length:on(n.data)}]);break;case C.BYTE:e.push([{data:n.data,mode:C.BYTE,length:on(n.data)}])}}return e}function _s(t,e){let r={},n={start:{}},o=["start"];for(let i=0;i<t.length;i++){let s=t[i],a=[];for(let l=0;l<s.length;l++){let u=s[l],d=""+i+l;a.push(d),r[d]={node:u,lastCount:0},n[d]={};for(let c=0;c<o.length;c++){let f=o[c];r[f]&&r[f].node.mode===u.mode?(n[f][d]=mt(r[f].lastCount+u.length,u.mode)-mt(r[f].lastCount,u.mode),r[f].lastCount+=u.length):(r[f]&&(r[f].lastCount=u.length),n[f][d]=mt(u.length,u.mode)+4+C.getCharCountIndicator(u.mode,e))}}o=a}for(let i=0;i<o.length;i++)n[o[i]].end=0;return{map:n,table:r}}function sn(t,e){let r,n=C.getBestModeForData(t);if(r=C.from(e,n),r!==C.BYTE&&r.bit<n.bit)throw new Error('"'+t+'" cannot be encoded with mode '+C.toString(r)+`.
|
|
4
|
+
Suggested mode is: `+C.toString(n));switch(r===C.KANJI&&!Fe.isKanjiModeEnabled()&&(r=C.BYTE),r){case C.NUMERIC:return new an(t);case C.ALPHANUMERIC:return new ln(t);case C.KANJI:return new un(t);case C.BYTE:return new cn(t)}}oe.fromArray=function(e){return e.reduce(function(r,n){return typeof n=="string"?r.push(sn(n,null)):n.data&&r.push(sn(n.data,n.mode)),r},[])};oe.fromString=function(e,r){let n=dn(e,Fe.isKanjiModeEnabled()),o=Os(n),i=_s(o,r),s=Fs.find_path(i.map,"start","end"),a=[];for(let l=1;l<s.length-1;l++)a.push(i.table[s[l]].node);return oe.fromArray(Ds(a))};oe.rawSplit=function(e){return oe.fromArray(dn(e,Fe.isKanjiModeEnabled()))}});var pn=p(hn=>{var Oe=U(),yt=Ie(),$s=Sr(),Us=vr(),qs=Ir(),Vs=Mr(),Ct=Nr(),Et=it(),js=Or(),De=zr(),zs=Jr(),Hs=V(),bt=fn();function Ws(t,e){let r=t.size,n=Vs.getPositions(e);for(let o=0;o<n.length;o++){let i=n[o][0],s=n[o][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(let l=-1;l<=7;l++)s+l<=-1||r<=s+l||(a>=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?t.set(i+a,s+l,!0,!0):t.set(i+a,s+l,!1,!0))}}function Ys(t){let e=t.size;for(let r=8;r<e-8;r++){let n=r%2===0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}function Js(t,e){let r=qs.getPositions(e);for(let n=0;n<r.length;n++){let o=r[n][0],i=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?t.set(o+s,i+a,!0,!0):t.set(o+s,i+a,!1,!0)}}function Ks(t,e){let r=t.size,n=De.getEncodedBits(e),o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+r-8-3,s=(n>>a&1)===1,t.set(o,i,s,!0),t.set(i,o,s,!0)}function wt(t,e,r){let n=t.size,o=zs.getEncodedBits(e,r),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(n-15+i,8,s,!0),i<8?t.set(8,n-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(n-8,8,1,!0)}function Qs(t,e){let r=t.size,n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!t.isReserved(o,a-l)){let u=!1;s<e.length&&(u=(e[s]>>>i&1)===1),t.set(o,a-l,u),i--,i===-1&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function Gs(t,e,r){let n=new $s;r.forEach(function(l){n.put(l.mode.bit,4),n.put(l.getLength(),Hs.getCharCountIndicator(l.mode,t)),l.write(n)});let o=Oe.getSymbolTotalCodewords(t),i=Et.getTotalCodewordsCount(t,e),s=(o-i)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let l=0;l<a;l++)n.put(l%2?17:236,8);return Xs(n,t,e)}function Xs(t,e,r){let n=Oe.getSymbolTotalCodewords(e),o=Et.getTotalCodewordsCount(e,r),i=n-o,s=Et.getBlocksCount(e,r),a=n%s,l=s-a,u=Math.floor(n/s),d=Math.floor(i/s),c=d+1,f=u-d,m=new js(f),y=0,g=new Array(s),h=new Array(s),S=0,B=new Uint8Array(t.buffer);for(let Q=0;Q<s;Q++){let qe=Q<l?d:c;g[Q]=B.slice(y,y+qe),h[Q]=m.encode(g[Q]),y+=qe,S=Math.max(S,qe)}let P=new Uint8Array(n),Pt=0,N,k;for(N=0;N<S;N++)for(k=0;k<s;k++)N<g[k].length&&(P[Pt++]=g[k][N]);for(N=0;N<f;N++)for(k=0;k<s;k++)P[Pt++]=h[k][N];return P}function Zs(t,e,r,n){let o;if(Array.isArray(t))o=bt.fromArray(t);else if(typeof t=="string"){let u=e;if(!u){let d=bt.rawSplit(t);u=De.getBestVersionForData(d,r)}o=bt.fromString(t,u||40)}else throw new Error("Invalid data");let i=De.getBestVersionForData(o,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=i;else if(e<i)throw new Error(`
|
|
5
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
+
Minimum version required to store current data is: `+i+`.
|
|
7
|
+
`);let s=Gs(e,r,o),a=Oe.getSymbolSize(e),l=new Us(a);return Ws(l,e),Ys(l),Js(l,e),wt(l,r,0),e>=7&&Ks(l,e),Qs(l,s),isNaN(n)&&(n=Ct.getBestMask(l,wt.bind(null,l,r))),Ct.applyMask(n,l),wt(l,r,n),{modules:l,version:e,errorCorrectionLevel:r,maskPattern:n,segments:o}}hn.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=yt.M,o,i;return typeof r<"u"&&(n=yt.from(r.errorCorrectionLevel,yt.M),o=De.from(r.version),i=Ct.from(r.maskPattern),r.toSJISFunc&&Oe.setToSJISFunction(r.toSJISFunc)),Zs(e,o,n,i)}});var At=p(J=>{function gn(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}J.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:gn(e.color.dark||"#000000ff"),light:gn(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};J.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};J.getImageWidth=function(e,r){let n=J.getScale(e,r);return Math.floor((e+r.margin*2)*n)};J.qrToImageData=function(e,r,n){let o=r.modules.size,i=r.modules.data,s=J.getScale(o,n),a=Math.floor((o+n.margin*2)*s),l=n.margin*s,u=[n.color.light,n.color.dark];for(let d=0;d<a;d++)for(let c=0;c<a;c++){let f=(d*a+c)*4,m=n.color.light;if(d>=l&&c>=l&&d<a-l&&c<a-l){let y=Math.floor((d-l)/s),g=Math.floor((c-l)/s);m=u[i[y*o+g]?1:0]}e[f++]=m.r,e[f++]=m.g,e[f++]=m.b,e[f]=m.a}}});var mn=p(_e=>{var xt=At();function ei(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function ti(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}_e.render=function(e,r,n){let o=n,i=r;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),r||(i=ti()),o=xt.getOptions(o);let s=xt.getImageWidth(e.modules.size,o),a=i.getContext("2d"),l=a.createImageData(s,s);return xt.qrToImageData(l.data,e,o),ei(a,i,s),a.putImageData(l,0,0),i};_e.renderToDataURL=function(e,r,n){let o=n;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),o||(o={});let i=_e.render(e,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var wn=p(bn=>{var ri=At();function yn(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Tt(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function ni(t,e,r){let n="",o=0,i=!1,s=0;for(let a=0;a<t.length;a++){let l=Math.floor(a%e),u=Math.floor(a/e);!l&&!i&&(i=!0),t[a]?(s++,a>0&&l>0&&t[a-1]||(n+=i?Tt("M",l+r,.5+u+r):Tt("m",o,0),o=0,i=!1),l+1<e&&t[a+1]||(n+=Tt("h",s),s=0)):o++}return n}bn.render=function(e,r,n){let o=ri.getOptions(r),i=e.modules.size,s=e.modules.data,a=i+o.margin*2,l=o.color.light.a?"<path "+yn(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",u="<path "+yn(o.color.dark,"stroke")+' d="'+ni(s,i,o.margin)+'"/>',d='viewBox="0 0 '+a+" "+a+'"',f='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+d+' shape-rendering="crispEdges">'+l+u+`</svg>
|
|
8
|
+
`;return typeof n=="function"&&n(null,f),f}});var En=p(pe=>{var oi=Ar(),St=pn(),Cn=mn(),si=wn();function Rt(t,e,r,n,o){let i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!oi())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=r,r=e,e=n=void 0):s===3&&(e.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=e,e=n=void 0):s===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(l,u){try{let d=St.create(r,n);l(t(d,e,n))}catch(d){u(d)}})}try{let l=St.create(r,n);o(null,t(l,e,n))}catch(l){o(l)}}pe.create=St.create;pe.toCanvas=Rt.bind(null,Cn.render);pe.toDataURL=Rt.bind(null,Cn.renderToDataURL);pe.toString=Rt.bind(null,function(t,e,r){return si.render(t,r)})});var li={};qn(li,{generatePdf:()=>ai});var Ln=R("@react-pdf/renderer"),Fn=M(R("react"));var Ue=R("@react-pdf/renderer");var Z=R("@react-pdf/renderer");var Nt=t=>Array.isArray(t)?t:[t],kt=(...t)=>(e,...r)=>{let n=e,o=t.slice().reverse();for(let i=0;i<o.length;i+=1){let s=o[i];n=s(n,...r)}return n};var jn=t=>/((-)?\d+\.?\d*)%/g.exec(`${t}`),Lt=t=>{let e=jn(t);if(e){let r=parseFloat(e[1]);return{percent:r/100,value:r}}return null};var me=t=>typeof t=="string"?Number.parseFloat(t):t;var Eo=M(zt(),1),pr=M(Jt(),1),Re=M(sr(),1),gr=M(ar(),1),mr=M(cr(),1),Ao=t=>t.filter(Boolean),xo=t=>t.reduce((e,r)=>{let n=Array.isArray(r)?tt(r):r;return Object.keys(n).forEach(o=>{n[o]!==null&&n[o]!==void 0&&(e[o]=n[o])}),e},{}),tt=kt(xo,Ao,Nt);var To=t=>/rgba?/g.test(t),So=t=>/hsla?/g.test(t),Ro=t=>{let e=Re.default.get.rgb(t);return Re.default.to.hex(e)},vo=t=>{let e=Re.default.get.hsl(t).map(Math.round);return(0,pr.default)(...e).toUpperCase()},yr=t=>To(t)?Ro(t):So(t)?vo(t):t,Io=t=>{if(typeof t=="number")return{value:t,unit:void 0};let e=/^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw|px|rem)?$/g.exec(t);return e?{value:parseFloat(e[1]),unit:e[2]||"pt"}:{value:t,unit:void 0}},T=(t,e)=>{let r=Io(e),n=72,o=t.dpi||72,i=1/25.4*n,s=1/2.54*n;if(typeof r.value!="number")return r.value;switch(r.unit){case"rem":return r.value*(t.remBase||18);case"in":return r.value*n;case"mm":return r.value*i;case"cm":return r.value*s;case"vh":return r.value*(t.height/100);case"vw":return r.value*(t.width/100);case"px":return Math.round(r.value*(n/o));default:return r.value}},_=(t,e)=>({[t]:me(e)}),A=(t,e,r)=>({[t]:T(r,e)}),F=(t,e)=>({[t]:yr(e)}),b=(t,e)=>({[t]:e}),Bo=/(-?\d+(\.\d+)?(in|mm|cm|pt|vw|vh|px|rem)?)\s(\S+)\s(.+)/,Po=t=>t.match(Bo)||[],L=(t,e,r)=>{let n=Po(`${e}`);if(n){let o=n[1]||e,i=n[4]||e,s=n[5]||e,a=i,l=s?yr(s):void 0,u=o?T(r,o):void 0;if(t.match(/(Top|Right|Bottom|Left)$/))return{[`${t}Color`]:l,[`${t}Style`]:a,[`${t}Width`]:u};if(t.match(/Color$/))return{borderTopColor:l,borderRightColor:l,borderBottomColor:l,borderLeftColor:l};if(t.match(/Style$/)){if(typeof a=="number")throw new Error(`Invalid border style: ${a}`);return{borderTopStyle:a,borderRightStyle:a,borderBottomStyle:a,borderLeftStyle:a}}if(t.match(/Width$/)){if(typeof u!="number")throw new Error(`Invalid border width: ${u}`);return{borderTopWidth:u,borderRightWidth:u,borderBottomWidth:u,borderLeftWidth:u}}if(t.match(/Radius$/)){let d=e?T(r,e):void 0;if(typeof d!="number")throw new Error(`Invalid border radius: ${d}`);return{borderTopLeftRadius:d,borderTopRightRadius:d,borderBottomRightRadius:d,borderBottomLeftRadius:d}}if(typeof u!="number")throw new Error(`Invalid border width: ${u}`);if(typeof a=="number")throw new Error(`Invalid border style: ${a}`);return{borderTopColor:l,borderTopStyle:a,borderTopWidth:u,borderRightColor:l,borderRightStyle:a,borderRightWidth:u,borderBottomColor:l,borderBottomStyle:a,borderBottomWidth:u,borderLeftColor:l,borderLeftStyle:a,borderLeftWidth:u}}return{[t]:e}},Mo={border:L,borderBottom:L,borderBottomColor:F,borderBottomLeftRadius:A,borderBottomRightRadius:A,borderBottomStyle:b,borderBottomWidth:A,borderColor:L,borderLeft:L,borderLeftColor:F,borderLeftStyle:b,borderLeftWidth:A,borderRadius:L,borderRight:L,borderRightColor:F,borderRightStyle:b,borderRightWidth:A,borderStyle:L,borderTop:L,borderTopColor:F,borderTopLeftRadius:A,borderTopRightRadius:A,borderTopStyle:b,borderTopWidth:A,borderWidth:L},No={backgroundColor:F,color:F,opacity:_},ko={height:A,maxHeight:A,maxWidth:A,minHeight:A,minWidth:A,width:A},Lo=[1,1,0],Fo=[1,1,"auto"],Do=(t,e,r)=>{let n=Lo,o=[];e==="auto"?n=Fo:o=`${e}`.split(" ");let i=me(o[0]||n[0]),s=me(o[1]||n[1]),a=T(r,o[2]||n[2]);return{flexGrow:i,flexShrink:s,flexBasis:a}},Oo={alignContent:b,alignItems:b,alignSelf:b,flex:Do,flexBasis:A,flexDirection:b,flexFlow:b,flexGrow:_,flexShrink:_,flexWrap:b,justifyContent:b,justifySelf:b},_o=(t,e,r)=>{let n=`${e}`.split(" "),o=T(r,n?.[0]||e),i=T(r,n?.[1]||e);return{rowGap:o,columnGap:i}},$o={gap:_o,columnGap:A,rowGap:A},Uo={aspectRatio:_,bottom:A,display:b,left:A,position:b,right:A,top:A,overflow:b,zIndex:_},qo="px,in,mm,cm,pt,%,vw,vh",Xe=(t,e)=>{let r=t.toString();console.error(`
|
|
9
|
+
@react-pdf/stylesheet parsing error:
|
|
10
|
+
${r}: ${e},
|
|
11
|
+
${" ".repeat(r.length+2)}^
|
|
12
|
+
Unsupported ${r} value format
|
|
13
|
+
`)},$=({expandsTo:t,maxValues:e=1,autoSupported:r=!1}={})=>(n,o,i)=>{let s=(0,gr.default)(`${o}`),a=[];for(let u=0;u<s.length;u++){let d=s[u];if(d.type==="function"||d.type==="string"||d.type==="div")return Xe(n,o),{};if(d.type==="word")if(d.value==="auto"&&r)a.push(d.value);else{let c=(0,mr.default)(d.value);if(c&&qo.includes(c.unit))a.push(d.value);else return Xe(n,o),{}}}if(a.length>e)return Xe(n,o),{};let l=T(i,a[0]);if(t){let u=T(i,a[1]||a[0]),d=T(i,a[2]||a[0]),c=T(i,a[3]||a[1]||a[0]);return t({first:l,second:u,third:d,fourth:c})}return{[n]:l}},Vo=$({expandsTo:({first:t,second:e,third:r,fourth:n})=>({marginTop:t,marginRight:e,marginBottom:r,marginLeft:n}),maxValues:4,autoSupported:!0}),jo=$({expandsTo:({first:t,second:e})=>({marginTop:t,marginBottom:e}),maxValues:2,autoSupported:!0}),zo=$({expandsTo:({first:t,second:e})=>({marginRight:t,marginLeft:e}),maxValues:2,autoSupported:!0}),xe=$({autoSupported:!0}),Ho={margin:Vo,marginBottom:xe,marginHorizontal:zo,marginLeft:xe,marginRight:xe,marginTop:xe,marginVertical:jo},Wo=$({expandsTo:({first:t,second:e,third:r,fourth:n})=>({paddingTop:t,paddingRight:e,paddingBottom:r,paddingLeft:n}),maxValues:4}),Yo=$({expandsTo:({first:t,second:e})=>({paddingTop:t,paddingBottom:e}),maxValues:2}),Jo=$({expandsTo:({first:t,second:e})=>({paddingRight:t,paddingLeft:e}),maxValues:2}),Te=$(),Ko={padding:Wo,paddingBottom:Te,paddingHorizontal:Jo,paddingLeft:Te,paddingRight:Te,paddingTop:Te,paddingVertical:Yo},X=t=>{switch(t){case"top":case"left":return"0%";case"right":case"bottom":return"100%";case"center":return"50%";default:return t}},Qo=(t,e,r)=>{let n=`${e}`.split(" "),o=X(T(r,n?.[0]||e)),i=X(T(r,n?.[1]||e));return{objectPositionX:o,objectPositionY:i}},ur=(t,e,r)=>({[t]:X(T(r,e))}),Go={objectPosition:Qo,objectPositionX:ur,objectPositionY:ur,objectFit:b},Xo=t=>typeof t=="number"?t:parseInt(t,10),Ze={thin:100,hairline:100,ultralight:200,extralight:200,light:300,normal:400,medium:500,semibold:600,demibold:600,bold:700,ultrabold:800,extrabold:800,heavy:900,black:900},Zo=t=>{if(!t)return Ze.normal;if(typeof t=="number")return t;let e=t.toLowerCase();return Ze[e]?Ze[e]:Xo(t)},es=(t,e)=>({[t]:Zo(e)}),ts=(t,e,r)=>{if(t==="")return t;let n=T(r,e.fontSize||18),o=T(r,t),{percent:i}=Lt(o)||{};return i?i*n:isNaN(t)?o:o*n},rs=(t,e,r,n)=>({[t]:ts(e,n,r)}),ns={direction:b,fontFamily:b,fontSize:A,fontStyle:b,fontWeight:es,letterSpacing:A,lineHeight:rs,maxLines:_,textAlign:b,textDecoration:b,textDecorationColor:F,textDecorationStyle:b,textIndent:b,textOverflow:b,textTransform:b,verticalAlign:b},os=t=>typeof t=="string"&&/^-?\d*\.?\d*$/.test(t),et=t=>typeof t!="string"?t:os(t)?parseFloat(t):t,ss=t=>{let e=t.trim().split(/\)[ ,]|\)/);if(e.length===1)return[[e[0],!0]];let r=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o){let[i,s]=o.split("("),a=s.indexOf(",")>=0?",":" ",l=s.split(a).map(u=>u.trim());r.push({operation:i.trim(),value:l})}}return r},Se=t=>{let e=/(-?\d*\.?\d*)(\w*)?/i,[,r,n]=e.exec(t),o=Number.parseFloat(r);return n==="rad"?o*180/Math.PI:o},is=({operation:t,value:e})=>{switch(t){case"scale":{let[r,n=r]=e.map(o=>Number.parseFloat(o));return{operation:"scale",value:[r,n]}}case"scaleX":return{operation:"scale",value:[Number.parseFloat(e),1]};case"scaleY":return{operation:"scale",value:[1,Number.parseFloat(e)]};case"rotate":return{operation:"rotate",value:[Se(e)]};case"translate":return{operation:"translate",value:e.map(r=>Number.parseFloat(r))};case"translateX":return{operation:"translate",value:[Number.parseFloat(e),0]};case"translateY":return{operation:"translate",value:[0,Number.parseFloat(e)]};case"skew":return{operation:"skew",value:e.map(Se)};case"skewX":return{operation:"skew",value:[Se(e),0]};case"skewY":return{operation:"skew",value:[0,Se(e)]};default:return{operation:t,value:e.map(r=>Number.parseFloat(r))}}},as=t=>t.map(e=>is(e)),dr=(t,e)=>typeof e!="string"?{[t]:e}:{[t]:as(ss(e))},fr={top:!0,bottom:!0},ls=(t,e)=>fr[t]?1:fr[e]?-1:0,cs=t=>!t||t.length===0?["center","center"]:(t.length===1?[t[0],"center"]:t).sort(ls),us=(t,e,r)=>{let n=`${e}`.split(" "),o=cs(n),i=T(r,o[0]),s=T(r,o[1]);return{transformOriginX:X(i)||et(i),transformOriginY:X(s)||et(s)}},hr=(t,e,r)=>{let n=T(r,e);return{[t]:X(n)||et(n)}},ds={transform:dr,gradientTransform:dr,transformOrigin:us,transformOriginX:hr,transformOriginY:hr},fs={fill:F,stroke:F,strokeDasharray:b,strokeWidth:A,fillOpacity:_,strokeOpacity:_,fillRule:b,textAnchor:b,strokeLinecap:b,strokeLinejoin:b,visibility:b,clipPath:b,dominantBaseline:b},Ti={...Mo,...No,...ko,...Oo,...$o,...Uo,...Ho,...Ko,...Go,...ns,...ds,...fs};var w=M(R("react"),1);function ve(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}var rt=w.default.createContext({style:{borderWidth:1}});function br(t){var{children:e,weightings:r,style:n,tdStyle:o,trStyle:i}=t,s=ve(t,["children","weightings","style","tdStyle","trStyle"]);let a=(0,w.useMemo)(()=>{let c=tt([{borderColor:"#000000",borderWidth:"1px",borderStyle:"solid"},...Array.isArray(n)?n:[n]]);if(typeof c.border=="string"){let[f,m,y]=c.border.split(/\s+/);c.borderWidth=Number.parseFloat(f),c.borderStyle=m,c.borderColor=y}else typeof c.border=="number"&&(c.borderWidth=c.border);return typeof c.borderWidth=="string"&&(c.borderWidth=Number.parseFloat(c.borderWidth)),c},[n]),l=(0,w.useMemo)(()=>{let c=[],f=m=>{w.default.Children.forEach(m,y=>{w.default.isValidElement(y)&&(y.type===w.default.Fragment?f(y.props.children):c.push(y))})};return f(e),c.map((m,y)=>w.default.cloneElement(m,{key:`table_row_${y}`,_firstRow:y===0,_lastRow:y===c.length-1}))},[e]),u=(0,w.useMemo)(()=>[{width:"100%"},...Array.isArray(n)?n:[n],a.borderStyle==="solid"?{border:"0px"}:void 0].filter(Boolean),[n]),d=(0,w.useMemo)(()=>({style:a,weightings:r,tdStyle:o,trStyle:i}),[a,r,o,i]);return w.default.createElement(rt.Provider,{value:d},w.default.createElement(Z.View,Object.assign({},s,{style:u}),l))}function nt(t){var{children:e,style:r,_firstRow:n,_lastRow:o}=t,i=ve(t,["children","style","_firstRow","_lastRow"]);let{trStyle:s,weightings:a}=(0,w.useContext)(rt),l=(0,w.useMemo)(()=>{var u,d;let c=[],f=g=>{w.default.Children.forEach(g,h=>{w.default.isValidElement(h)&&(h.type===w.default.Fragment?f(h.props.children):c.push(h))})};f(e);let m=[];for(let[g,h]of c.entries())!((u=h.props)===null||u===void 0)&&u.weighting?m.push((d=h.props)===null||d===void 0?void 0:d.weighting):m.push(a?.[g]);let y=(1-m.reduce((g,h)=>g+(h||0),0))/(c.length-m.filter(g=>typeof g=="number").length);return m=m.map(g=>g===void 0?y:g),c.map((g,h)=>w.default.cloneElement(g,{weighting:m[h],key:`table_col_${h}_cell`,_firstColumn:h===0,_lastColumn:h===c.length-1,_firstRow:n,_lastRow:o}))},[e,a,n,o]);return w.default.createElement(Z.View,Object.assign({},i,{style:[{display:"flex",flexDirection:"row"},...Array.isArray(s)?s:[s],...Array.isArray(r)?r:[r]]}),l)}function wr(t){var{children:e,style:r}=t,n=ve(t,["children","style"]);return w.default.createElement(nt,Object.assign({},n,{style:[{fontWeight:"bold"},...Array.isArray(r)?r:[r]]}),e)}function Cr(t){var{children:e,weighting:r,_firstColumn:n,_lastColumn:o,_firstRow:i,_lastRow:s}=t,a=ve(t,["children","weighting","_firstColumn","_lastColumn","_firstRow","_lastRow"]);let l=(0,w.useMemo)(()=>{let m=[],y=g=>{w.default.Children.forEach(g,h=>{w.default.isValidElement(h)&&h?.type===w.default.Fragment?y(h.props.children):m.push(h)})};return y(e),m.map((g,h)=>{let S=`table_cell_${h}_content`;return typeof g=="string"||typeof g=="number"?w.default.createElement(Z.Text,{key:S},g):g})},[e]),{tdStyle:u,style:d}=(0,w.useContext)(rt),c=-1*(d.borderWidth||0)+"px",f=(0,w.useMemo)(()=>d.borderStyle==="solid"?{borderTop:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderRight:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderBottom:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderLeft:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,margin:`${c} ${o?c:"0"} ${s?c:0} ${c}`}:{borderTop:i?void 0:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`,borderLeft:n?void 0:`${d.borderWidth||0}px ${d.borderStyle} ${d.borderColor}`},[d,n,o,i,i]);return w.default.createElement(Z.View,Object.assign({wrap:!0},a,{style:[Object.assign(Object.assign({},f),{flex:r??1,display:"flex",flexDirection:"row",alignItems:"center"}),...Array.isArray(u)?u:[u],...Array.isArray(a.style)?a.style:[a.style]]}),l)}var z=R("@react-pdf/renderer");var xn=M(En()),It=M(R("react")),Tn=async t=>{let e={margin:0,width:300,color:{dark:"#000",light:"#fff"}};return xn.default.toDataURL(t,e)};function K(t){let{componentData:e,components:r,data:n,allProps:o={},images:i={}}=t;if(o.key&&delete o.key,o.styles&&delete o.styles,o.index&&delete o.index,o.className&&delete o.className,o.children&&delete o.children,Array.isArray(e)&&e.length>0)return e.map((s,a)=>K({componentData:{...s,props:{...s.props,index:a}},components:r,data:n,allProps:{},images:i}));if(typeof e=="object"&&e!==null&&"type"in e&&Object.keys(r).includes(e.type)){let{type:s,props:a={},children:l,visible:u="true"}=e,d={...o,...a},c=r[s];if(!c)return console.warn(`Component type "${s}" not found in components object`),null;let f=null;l!==void 0&&(Array.isArray(l)?f=l.map((B,P)=>K({componentData:B,components:r,data:n,allProps:d,images:i})):typeof l=="object"&&l!==null&&"type"in l?f=K({componentData:l,components:r,data:n,allProps:d,images:i}):f=l);let m={...d,key:crypto.randomUUID()};s==="Map"&&(m.data=n,m.images=i);let{mappedChild:y,mappedIsVisible:g,...h}=Sn({...m,mappedChild:f,mappedIsVisible:u},n,i);return Rn(g)?It.default.createElement(c,h,y):null}return e}function vt(t){let{componentData:e,components:r,data:n,allProps:o={},images:i={}}=t;if(o.key&&delete o.key,o.styles&&delete o.styles,o.index&&delete o.index,o.className&&delete o.className,o.children&&delete o.children,Array.isArray(e)&&e.length>0)return e.map((s,a)=>vt({componentData:{...s,props:{...s.props,index:a}},components:r,data:n,allProps:{},images:i}));if(typeof e=="object"&&e!==null&&"type"in e&&Object.keys(r).includes(e.type)){let{type:s,props:a={},children:l,visible:u="true"}=e,d={...o,...a},c=r[s];if(!c)return console.warn(`Component type "${s}" not found in components object`),null;let f=null;l!==void 0&&(Array.isArray(l)?f=l.map((B,P)=>vt({componentData:B,components:r,data:n,allProps:d,images:i})):typeof l=="object"&&l!==null&&"type"in l?f=vt({componentData:l,components:r,data:n,allProps:d,images:i}):f=l);let m={...d,key:crypto.randomUUID()};s==="Map"&&(m.data=n,m.images=i);let{mappedChild:y,mappedIsVisible:g,...h}=Sn({...m,mappedChild:f,mappedIsVisible:u},n,i);return Rn(g)?It.default.createElement(c,h,y):null}return e}var Sn=(t,e,r)=>{let n={$data:e,$props:t,$images:r},o=/\{\{([^}]+)\}\}/g,i=s=>{let a=Array.from(s.matchAll(o));if(a.length===0)return s;if(a.length===1&&a[0][0]===s){let l=a[0][1].trim(),u=An({obj:n,path:l});return u!==void 0?u:s}return a.reduce((l,u)=>{let d=u[1].trim(),c=An({obj:n,path:d}),f=c!==void 0?String(c):u[0];return l.replace(u[0],f)},s)};return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,typeof a=="string"?i(a):a]))},Bt=t=>{try{return JSON.parse(t)}catch{return null}};function An({obj:t,path:e}){let r=e.split(".").filter(o=>o.length>0),n=t;for(let o of r){if(n==null||!(o in n))return;n=n[o]}return typeof n=="object"?JSON.stringify(n):n}function Rn(code){try{let result=eval(code);return typeof result=="boolean"?result:!1}catch(t){return console.error(`Error evaluating code "${code}":`,t),!1}}function na(t){return new Promise((e,r)=>{let n=new FileReader;n.onload=function(o){let i=o.target?.result;typeof i=="string"?e(i):r(new Error("File content is not a string"))},n.onerror=function(o){r(o)},n.readAsDataURL(t)})}var vn=({items:t,component:e,data:r={},images:n={},itemKeyWord:o="item"})=>{let i=JSON.parse(t);if(!Array.isArray(i))return null;let s=i.map((a,l)=>({...e,props:{...e.props,[o]:a,[`${o}Index`]:l}}));return K({componentData:s,components:$e,data:r,allProps:{},images:n})};var In=R("@react-pdf/renderer"),Bn=M(R("react"));var Mn=R("react/jsx-runtime"),ii=t=>{let{qrCodeText:e,...r}=t,n=Bn.default.useMemo(async()=>await Tn(e),[e]);return(0,Mn.jsx)(In.Image,{src:n,...r})},Pn=ii;var $e={Page:z.Page,View:z.View,Text:z.Text,Image:z.Image,Table:br,TH:wr,TR:nt,TD:Cr,QrCode:Pn,Map:vn};var kn=R("react/jsx-runtime"),Nn=({data:t,template:e})=>{let r=Bt(e),n=Bt(t);(r?.fonts||[]).forEach(l=>{Ue.Font.register(l)});let i=r?.components||[],s=r?.images||{},a=K({componentData:i,components:$e,data:n||{},allProps:{},images:s});return(0,kn.jsx)(Ue.Document,{children:a})};async function ai(t,e){try{let r=Fn.default.createElement(Nn,{data:e,template:t});return await(0,Ln.renderToBuffer)(r)}catch(r){let n=r instanceof Error?r.message:"Unknown error";throw new Error(`PDF generation failed: ${n}`)}}return Vn(li);})();
|
|
14
|
+
//# sourceMappingURL=pdf-generator.browser.js.map
|