@smartdoca/doca-easy-qrcode-plugin 0.1.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 +17 -0
- package/THIRD_PARTY_NOTICES.txt +140 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +439 -0
- package/manifest.json +7 -0
- package/package.json +36 -0
- package/web/index.d.ts +4 -0
- package/web/index.js +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Doca Everyday Plugins contributors
|
|
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,17 @@
|
|
|
1
|
+
# 链接二维码 / QR code
|
|
2
|
+
|
|
3
|
+
npm 包:`@smartdoca/doca-easy-qrcode-plugin`。入口使用二维码 SVG 图标。
|
|
4
|
+
|
|
5
|
+
插件 ID:`doca.everyday.qrcode`。主页入口卡片、全局更多菜单、文档工具栏均点击后打开二维码弹框卡片。
|
|
6
|
+
|
|
7
|
+
弹框打开时读取当前完整页面 URL,包括查询参数和 Doca 哈希路由。编辑链接后自动实时更新二维码,无需点击生成按钮;输入期间保留上一张预览,并禁用旧结果的复制/下载。输入不完整或无效时明确提示,修正后自动更新。
|
|
8
|
+
|
|
9
|
+
输入框右侧的刷新图标将链接恢复为当前页面并重新生成。二维码下方提供“下载 PNG”和“复制图片”;复制写入 PNG 图片到剪贴板,成功后通过宿主轻量消息提示“图片已复制”。图片复制使用浏览器 Clipboard API,需要支持图片复制的浏览器及安全上下文;拒绝权限或不可用时提示失败并保留下载入口。[Clipboard API 文档](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write)
|
|
10
|
+
|
|
11
|
+
使用 QRCode 库在浏览器本地生成,保留白色安全边距和 M 级纠错。链接不会上传;只支持不含账号密码的 HTTP(S) URL,过长链接明确报错。扫码访问原页面仍需对应 Doca 权限。
|
|
12
|
+
|
|
13
|
+
使用 SDK 的 `host.ui.openView` 打开弹框。主页入口与弹框内容是独立视图;没有业务持久化、外部 API 或文件库写入,卸载为空操作。
|
|
14
|
+
|
|
15
|
+
版本 0.1.0,`sdkRange: "^0.1.9"`、`doca.storage: "host"`、`dataVersion: "2"`。随包提供服务端和 Web 入口 `.d.ts`。
|
|
16
|
+
|
|
17
|
+
在仓库根目录执行 `npm run build --workspace qrcode`、`node scripts/release.mjs qrcode`。发布脚本拒绝覆盖同版本归档,旧 2.0.0 包保持不变。
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
@deepseek-ai/cordis@4.0.4 (MIT)
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021-present Shigma
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
--------------------
|
|
26
|
+
|
|
27
|
+
@deepseek-ai/cosmokit@1.8.5 (MIT)
|
|
28
|
+
MIT License
|
|
29
|
+
|
|
30
|
+
Copyright (c) 2021-present Shigma
|
|
31
|
+
|
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
in the Software without restriction, including without limitation the rights
|
|
35
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
furnished to do so, subject to the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
--------------------
|
|
52
|
+
|
|
53
|
+
@smartdoca/plugin-contracts@0.1.7 (MIT)
|
|
54
|
+
MIT License
|
|
55
|
+
|
|
56
|
+
Copyright (c) 2026 smartdoca
|
|
57
|
+
|
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
59
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
60
|
+
in the Software without restriction, including without limitation the rights
|
|
61
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
62
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
63
|
+
furnished to do so, subject to the following conditions:
|
|
64
|
+
|
|
65
|
+
The above copyright notice and this permission notice shall be included in all
|
|
66
|
+
copies or substantial portions of the Software.
|
|
67
|
+
|
|
68
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
69
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
70
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
71
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
72
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
73
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
74
|
+
SOFTWARE.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
--------------------
|
|
78
|
+
|
|
79
|
+
@smartdoca/plugin-sdk@0.1.9 (MIT)
|
|
80
|
+
MIT License
|
|
81
|
+
|
|
82
|
+
Copyright (c) 2026 smartdoca
|
|
83
|
+
|
|
84
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
85
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
86
|
+
in the Software without restriction, including without limitation the rights
|
|
87
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
88
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
89
|
+
furnished to do so, subject to the following conditions:
|
|
90
|
+
|
|
91
|
+
The above copyright notice and this permission notice shall be included in all
|
|
92
|
+
copies or substantial portions of the Software.
|
|
93
|
+
|
|
94
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
95
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
96
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
97
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
98
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
99
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
100
|
+
SOFTWARE.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
--------------------
|
|
104
|
+
|
|
105
|
+
dijkstrajs@1.0.3 (MIT)
|
|
106
|
+
```
|
|
107
|
+
Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
|
|
108
|
+
|
|
109
|
+
Copyright (C) 2008
|
|
110
|
+
Wyatt Baldwin <self@wyattbaldwin.com>
|
|
111
|
+
All rights reserved
|
|
112
|
+
|
|
113
|
+
Licensed under the MIT license.
|
|
114
|
+
|
|
115
|
+
http://www.opensource.org/licenses/mit-license.php
|
|
116
|
+
|
|
117
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
118
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
119
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
120
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
121
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
122
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
123
|
+
THE SOFTWARE.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
--------------------
|
|
128
|
+
|
|
129
|
+
qrcode@1.5.4 (MIT)
|
|
130
|
+
The MIT License (MIT)
|
|
131
|
+
|
|
132
|
+
Copyright (c) 2012 Ryan Day
|
|
133
|
+
|
|
134
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
135
|
+
|
|
136
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
137
|
+
|
|
138
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
139
|
+
|
|
140
|
+
|
package/dist/server.d.ts
ADDED
package/dist/server.js
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
// node_modules/@smartdoca/plugin-sdk/node_modules/@smartdoca/plugin-contracts/dist/editor-elements.js
|
|
2
|
+
var PLUGIN_ELEMENT_BYTES = 32 * 1024;
|
|
3
|
+
|
|
4
|
+
// node_modules/@smartdoca/plugin-sdk/node_modules/@smartdoca/plugin-contracts/dist/index.js
|
|
5
|
+
var PluginContractError = class extends Error {
|
|
6
|
+
code;
|
|
7
|
+
path;
|
|
8
|
+
name = "PluginContractError";
|
|
9
|
+
constructor(code, message, path = "$") {
|
|
10
|
+
super(`${path}: ${message}`);
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.path = path;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var identifierPattern = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;
|
|
16
|
+
var configKeyPattern = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
17
|
+
var semverPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
18
|
+
var dependencyRangePattern = /^(?:\*|[\^~]?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)$/;
|
|
19
|
+
function fail(code, path, message) {
|
|
20
|
+
throw new PluginContractError(code, message, path);
|
|
21
|
+
}
|
|
22
|
+
function isRecord(value) {
|
|
23
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
24
|
+
return false;
|
|
25
|
+
const prototype = Object.getPrototypeOf(value);
|
|
26
|
+
return prototype === Object.prototype || prototype === null;
|
|
27
|
+
}
|
|
28
|
+
function objectAt(value, path, code) {
|
|
29
|
+
if (!isRecord(value))
|
|
30
|
+
fail(code, path, "expected an object");
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
function allowedKeys(value, allowed, path, code) {
|
|
34
|
+
const set = new Set(allowed);
|
|
35
|
+
const unexpected = Object.keys(value).find((key) => !set.has(key));
|
|
36
|
+
if (unexpected)
|
|
37
|
+
fail(code, `${path}.${unexpected}`, "unknown field");
|
|
38
|
+
}
|
|
39
|
+
function stringAt(value, path, code, options = {}) {
|
|
40
|
+
if (typeof value !== "string" || options.nonempty && value.trim().length === 0)
|
|
41
|
+
fail(code, path, "expected a non-empty string");
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function finiteAt(value, path, code) {
|
|
45
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
46
|
+
fail(code, path, "expected a finite number");
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
function nonNegativeIntegerAt(value, path, code) {
|
|
50
|
+
const number = finiteAt(value, path, code);
|
|
51
|
+
if (!Number.isInteger(number) || number < 0)
|
|
52
|
+
fail(code, path, "expected a non-negative integer");
|
|
53
|
+
return number;
|
|
54
|
+
}
|
|
55
|
+
function optionalDescription(value, path, code) {
|
|
56
|
+
if (value.description !== void 0)
|
|
57
|
+
stringAt(value.description, `${path}.description`, code, {
|
|
58
|
+
nonempty: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function assertConfigSchema(value, path) {
|
|
62
|
+
const schema = objectAt(value, path, "INVALID_MANIFEST");
|
|
63
|
+
const type = stringAt(schema.type, `${path}.type`, "INVALID_MANIFEST");
|
|
64
|
+
const common = ["type", "description", "default"];
|
|
65
|
+
optionalDescription(schema, path, "INVALID_MANIFEST");
|
|
66
|
+
if (type === "string") {
|
|
67
|
+
allowedKeys(schema, [...common, "enum", "minLength", "maxLength", "pattern"], path, "INVALID_MANIFEST");
|
|
68
|
+
if (schema.enum !== void 0) {
|
|
69
|
+
if (!Array.isArray(schema.enum) || schema.enum.some((item) => typeof item !== "string"))
|
|
70
|
+
fail("INVALID_MANIFEST", `${path}.enum`, "expected string array");
|
|
71
|
+
if (new Set(schema.enum).size !== schema.enum.length)
|
|
72
|
+
fail("INVALID_MANIFEST", `${path}.enum`, "contains duplicate values");
|
|
73
|
+
}
|
|
74
|
+
const min = schema.minLength === void 0 ? void 0 : nonNegativeIntegerAt(schema.minLength, `${path}.minLength`, "INVALID_MANIFEST");
|
|
75
|
+
const max = schema.maxLength === void 0 ? void 0 : nonNegativeIntegerAt(schema.maxLength, `${path}.maxLength`, "INVALID_MANIFEST");
|
|
76
|
+
if (min !== void 0 && max !== void 0 && min > max)
|
|
77
|
+
fail("INVALID_MANIFEST", path, "minLength cannot exceed maxLength");
|
|
78
|
+
if (schema.pattern !== void 0) {
|
|
79
|
+
const pattern = stringAt(schema.pattern, `${path}.pattern`, "INVALID_MANIFEST");
|
|
80
|
+
try {
|
|
81
|
+
new RegExp(pattern);
|
|
82
|
+
} catch {
|
|
83
|
+
fail("INVALID_MANIFEST", `${path}.pattern`, "invalid regular expression");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} else if (type === "number" || type === "integer") {
|
|
87
|
+
allowedKeys(schema, [...common, "minimum", "maximum"], path, "INVALID_MANIFEST");
|
|
88
|
+
const minimum = schema.minimum === void 0 ? void 0 : finiteAt(schema.minimum, `${path}.minimum`, "INVALID_MANIFEST");
|
|
89
|
+
const maximum = schema.maximum === void 0 ? void 0 : finiteAt(schema.maximum, `${path}.maximum`, "INVALID_MANIFEST");
|
|
90
|
+
if (minimum !== void 0 && maximum !== void 0 && minimum > maximum)
|
|
91
|
+
fail("INVALID_MANIFEST", path, "minimum cannot exceed maximum");
|
|
92
|
+
} else if (type === "boolean" || type === "null") {
|
|
93
|
+
allowedKeys(schema, common, path, "INVALID_MANIFEST");
|
|
94
|
+
} else if (type === "array") {
|
|
95
|
+
allowedKeys(schema, [...common, "items", "minItems", "maxItems"], path, "INVALID_MANIFEST");
|
|
96
|
+
assertConfigSchema(schema.items, `${path}.items`);
|
|
97
|
+
const min = schema.minItems === void 0 ? void 0 : nonNegativeIntegerAt(schema.minItems, `${path}.minItems`, "INVALID_MANIFEST");
|
|
98
|
+
const max = schema.maxItems === void 0 ? void 0 : nonNegativeIntegerAt(schema.maxItems, `${path}.maxItems`, "INVALID_MANIFEST");
|
|
99
|
+
if (min !== void 0 && max !== void 0 && min > max)
|
|
100
|
+
fail("INVALID_MANIFEST", path, "minItems cannot exceed maxItems");
|
|
101
|
+
} else if (type === "object") {
|
|
102
|
+
allowedKeys(schema, [...common, "properties", "required", "additionalProperties"], path, "INVALID_MANIFEST");
|
|
103
|
+
const properties = schema.properties === void 0 ? {} : objectAt(schema.properties, `${path}.properties`, "INVALID_MANIFEST");
|
|
104
|
+
for (const [key, child] of Object.entries(properties)) {
|
|
105
|
+
if (!configKeyPattern.test(key))
|
|
106
|
+
fail("INVALID_MANIFEST", `${path}.properties.${key}`, "property names must be stable alphanumeric identifiers");
|
|
107
|
+
assertConfigSchema(child, `${path}.properties.${key}`);
|
|
108
|
+
}
|
|
109
|
+
if (schema.required !== void 0) {
|
|
110
|
+
if (!Array.isArray(schema.required) || schema.required.some((item) => typeof item !== "string"))
|
|
111
|
+
fail("INVALID_MANIFEST", `${path}.required`, "expected string array");
|
|
112
|
+
if (new Set(schema.required).size !== schema.required.length)
|
|
113
|
+
fail("INVALID_MANIFEST", `${path}.required`, "contains duplicate values");
|
|
114
|
+
for (const key of schema.required)
|
|
115
|
+
if (!Object.hasOwn(properties, key))
|
|
116
|
+
fail("INVALID_MANIFEST", `${path}.required`, `unknown required property ${key}`);
|
|
117
|
+
}
|
|
118
|
+
if (schema.additionalProperties !== void 0 && typeof schema.additionalProperties !== "boolean")
|
|
119
|
+
fail("INVALID_MANIFEST", `${path}.additionalProperties`, "expected boolean");
|
|
120
|
+
} else {
|
|
121
|
+
fail("INVALID_MANIFEST", `${path}.type`, `unsupported configuration type ${String(type)}`);
|
|
122
|
+
}
|
|
123
|
+
if (schema.default !== void 0)
|
|
124
|
+
readConfigValue(schema, schema.default, `${path}.default`, "INVALID_MANIFEST");
|
|
125
|
+
return schema;
|
|
126
|
+
}
|
|
127
|
+
function readJson(value, path, code) {
|
|
128
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
129
|
+
return value;
|
|
130
|
+
if (typeof value === "number") {
|
|
131
|
+
if (!Number.isFinite(value))
|
|
132
|
+
fail(code, path, "numbers must be finite");
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
if (Array.isArray(value))
|
|
136
|
+
return value.map((item, index) => readJson(item, `${path}[${index}]`, code));
|
|
137
|
+
const object = objectAt(value, path, code);
|
|
138
|
+
return Object.fromEntries(Object.entries(object).map(([key, item]) => [
|
|
139
|
+
key,
|
|
140
|
+
readJson(item, `${path}.${key}`, code)
|
|
141
|
+
]));
|
|
142
|
+
}
|
|
143
|
+
function readConfigValue(schema, input, path, code = "INVALID_CONFIG") {
|
|
144
|
+
if (input === void 0) {
|
|
145
|
+
if (schema.default !== void 0)
|
|
146
|
+
return readConfigValue(schema, schema.default, path, code);
|
|
147
|
+
fail(code, path, "value is required");
|
|
148
|
+
}
|
|
149
|
+
if (schema.type === "string") {
|
|
150
|
+
if (typeof input !== "string")
|
|
151
|
+
fail(code, path, "expected string");
|
|
152
|
+
if (schema.minLength !== void 0 && input.length < schema.minLength)
|
|
153
|
+
fail(code, path, `must contain at least ${schema.minLength} characters`);
|
|
154
|
+
if (schema.maxLength !== void 0 && input.length > schema.maxLength)
|
|
155
|
+
fail(code, path, `must contain at most ${schema.maxLength} characters`);
|
|
156
|
+
if (schema.enum && !schema.enum.includes(input))
|
|
157
|
+
fail(code, path, "is not an allowed value");
|
|
158
|
+
if (schema.pattern && !new RegExp(schema.pattern).test(input))
|
|
159
|
+
fail(code, path, "does not match the required pattern");
|
|
160
|
+
return input;
|
|
161
|
+
}
|
|
162
|
+
if (schema.type === "number" || schema.type === "integer") {
|
|
163
|
+
if (typeof input !== "number" || !Number.isFinite(input))
|
|
164
|
+
fail(code, path, "expected finite number");
|
|
165
|
+
if (schema.type === "integer" && !Number.isInteger(input))
|
|
166
|
+
fail(code, path, "expected integer");
|
|
167
|
+
if (schema.minimum !== void 0 && input < schema.minimum)
|
|
168
|
+
fail(code, path, `must be at least ${schema.minimum}`);
|
|
169
|
+
if (schema.maximum !== void 0 && input > schema.maximum)
|
|
170
|
+
fail(code, path, `must be at most ${schema.maximum}`);
|
|
171
|
+
return input;
|
|
172
|
+
}
|
|
173
|
+
if (schema.type === "boolean") {
|
|
174
|
+
if (typeof input !== "boolean")
|
|
175
|
+
fail(code, path, "expected boolean");
|
|
176
|
+
return input;
|
|
177
|
+
}
|
|
178
|
+
if (schema.type === "null") {
|
|
179
|
+
if (input !== null)
|
|
180
|
+
fail(code, path, "expected null");
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
if (schema.type === "array") {
|
|
184
|
+
if (!Array.isArray(input))
|
|
185
|
+
fail(code, path, "expected array");
|
|
186
|
+
if (schema.minItems !== void 0 && input.length < schema.minItems)
|
|
187
|
+
fail(code, path, `must contain at least ${schema.minItems} items`);
|
|
188
|
+
if (schema.maxItems !== void 0 && input.length > schema.maxItems)
|
|
189
|
+
fail(code, path, `must contain at most ${schema.maxItems} items`);
|
|
190
|
+
return input.map((item, index) => readConfigValue(schema.items, item, `${path}[${index}]`, code));
|
|
191
|
+
}
|
|
192
|
+
const objectSchema = schema;
|
|
193
|
+
const inputObject = objectAt(input, path, code);
|
|
194
|
+
const properties = objectSchema.properties ?? {};
|
|
195
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
196
|
+
for (const [key, child] of Object.entries(properties)) {
|
|
197
|
+
if (Object.hasOwn(inputObject, key))
|
|
198
|
+
result[key] = readConfigValue(child, inputObject[key], `${path}.${key}`, code);
|
|
199
|
+
else if (child.default !== void 0)
|
|
200
|
+
result[key] = readConfigValue(child, child.default, `${path}.${key}`, code);
|
|
201
|
+
else if (objectSchema.required?.includes(key))
|
|
202
|
+
fail(code, `${path}.${key}`, "value is required");
|
|
203
|
+
}
|
|
204
|
+
for (const [key, value] of Object.entries(inputObject)) {
|
|
205
|
+
if (Object.hasOwn(properties, key))
|
|
206
|
+
continue;
|
|
207
|
+
if (!objectSchema.additionalProperties)
|
|
208
|
+
fail(code, `${path}.${key}`, "unknown configuration field");
|
|
209
|
+
result[key] = readJson(value, `${path}.${key}`, code);
|
|
210
|
+
}
|
|
211
|
+
return { ...result };
|
|
212
|
+
}
|
|
213
|
+
function validatePluginManifest(input) {
|
|
214
|
+
const manifest = objectAt(input, "$", "INVALID_MANIFEST");
|
|
215
|
+
allowedKeys(manifest, [
|
|
216
|
+
"schemaVersion",
|
|
217
|
+
"id",
|
|
218
|
+
"version",
|
|
219
|
+
"sdkRange",
|
|
220
|
+
"displayName",
|
|
221
|
+
"description",
|
|
222
|
+
"dependencies",
|
|
223
|
+
"config",
|
|
224
|
+
"contributions"
|
|
225
|
+
], "$", "INVALID_MANIFEST");
|
|
226
|
+
if (manifest.schemaVersion !== 1)
|
|
227
|
+
fail("INVALID_MANIFEST", "$.schemaVersion", "only schema version 1 is supported");
|
|
228
|
+
const id = stringAt(manifest.id, "$.id", "INVALID_MANIFEST", {
|
|
229
|
+
nonempty: true
|
|
230
|
+
});
|
|
231
|
+
if (!identifierPattern.test(id))
|
|
232
|
+
fail("INVALID_MANIFEST", "$.id", "expected a stable lowercase dotted or dashed identifier");
|
|
233
|
+
const version = stringAt(manifest.version, "$.version", "INVALID_MANIFEST", {
|
|
234
|
+
nonempty: true
|
|
235
|
+
});
|
|
236
|
+
if (!semverPattern.test(version))
|
|
237
|
+
fail("INVALID_MANIFEST", "$.version", "expected a semantic version");
|
|
238
|
+
if (manifest.sdkRange !== void 0) {
|
|
239
|
+
const sdkRange = stringAt(manifest.sdkRange, "$.sdkRange", "INVALID_MANIFEST", { nonempty: true });
|
|
240
|
+
if (!dependencyRangePattern.test(sdkRange))
|
|
241
|
+
fail("INVALID_MANIFEST", "$.sdkRange", "unsupported semantic version range");
|
|
242
|
+
}
|
|
243
|
+
stringAt(manifest.displayName, "$.displayName", "INVALID_MANIFEST", {
|
|
244
|
+
nonempty: true
|
|
245
|
+
});
|
|
246
|
+
if (manifest.description !== void 0)
|
|
247
|
+
stringAt(manifest.description, "$.description", "INVALID_MANIFEST", {
|
|
248
|
+
nonempty: true
|
|
249
|
+
});
|
|
250
|
+
if (manifest.dependencies !== void 0 && !Array.isArray(manifest.dependencies))
|
|
251
|
+
fail("INVALID_MANIFEST", "$.dependencies", "expected an array");
|
|
252
|
+
const seenDependencies = /* @__PURE__ */ new Set();
|
|
253
|
+
const dependencies = (manifest.dependencies ?? []).map((inputDependency, index) => {
|
|
254
|
+
const path = `$.dependencies[${index}]`;
|
|
255
|
+
const dependency = objectAt(inputDependency, path, "INVALID_MANIFEST");
|
|
256
|
+
allowedKeys(dependency, ["id", "range", "optional"], path, "INVALID_MANIFEST");
|
|
257
|
+
const dependencyId = stringAt(dependency.id, `${path}.id`, "INVALID_MANIFEST", { nonempty: true });
|
|
258
|
+
if (!identifierPattern.test(dependencyId))
|
|
259
|
+
fail("INVALID_MANIFEST", `${path}.id`, "invalid plugin identifier");
|
|
260
|
+
if (dependencyId === id)
|
|
261
|
+
fail("INVALID_MANIFEST", `${path}.id`, "plugin cannot depend on itself");
|
|
262
|
+
if (seenDependencies.has(dependencyId))
|
|
263
|
+
fail("INVALID_MANIFEST", `${path}.id`, "duplicate dependency");
|
|
264
|
+
seenDependencies.add(dependencyId);
|
|
265
|
+
const range = stringAt(dependency.range, `${path}.range`, "INVALID_MANIFEST", { nonempty: true });
|
|
266
|
+
if (!dependencyRangePattern.test(range))
|
|
267
|
+
fail("INVALID_MANIFEST", `${path}.range`, "unsupported semantic version range");
|
|
268
|
+
if (dependency.optional !== void 0 && typeof dependency.optional !== "boolean")
|
|
269
|
+
fail("INVALID_MANIFEST", `${path}.optional`, "expected boolean");
|
|
270
|
+
return {
|
|
271
|
+
id: dependencyId,
|
|
272
|
+
range,
|
|
273
|
+
...dependency.optional === void 0 ? {} : { optional: dependency.optional }
|
|
274
|
+
};
|
|
275
|
+
});
|
|
276
|
+
const config = manifest.config === void 0 ? void 0 : structuredClone(assertConfigSchema(manifest.config, "$.config"));
|
|
277
|
+
if (config && config.type !== "object")
|
|
278
|
+
fail("INVALID_MANIFEST", "$.config", "plugin config root must be an object");
|
|
279
|
+
if (manifest.contributions !== void 0 && !Array.isArray(manifest.contributions))
|
|
280
|
+
fail("INVALID_MANIFEST", "$.contributions", "expected an array");
|
|
281
|
+
const contributionIds = /* @__PURE__ */ new Set();
|
|
282
|
+
const contributions = (manifest.contributions ?? []).map((inputContribution, index) => {
|
|
283
|
+
const path = `$.contributions[${index}]`;
|
|
284
|
+
const contribution = objectAt(inputContribution, path, "INVALID_MANIFEST");
|
|
285
|
+
allowedKeys(contribution, ["id", "kind", "target"], path, "INVALID_MANIFEST");
|
|
286
|
+
const contributionId = stringAt(contribution.id, `${path}.id`, "INVALID_MANIFEST", { nonempty: true });
|
|
287
|
+
if (!identifierPattern.test(contributionId))
|
|
288
|
+
fail("INVALID_MANIFEST", `${path}.id`, "invalid contribution identifier");
|
|
289
|
+
if (!contributionId.startsWith(`${id}.`))
|
|
290
|
+
fail("INVALID_MANIFEST", `${path}.id`, `contribution must use the "${id}." namespace`);
|
|
291
|
+
if (contributionIds.has(contributionId))
|
|
292
|
+
fail("INVALID_MANIFEST", `${path}.id`, "duplicate contribution identifier");
|
|
293
|
+
contributionIds.add(contributionId);
|
|
294
|
+
const kind = stringAt(contribution.kind, `${path}.kind`, "INVALID_MANIFEST", { nonempty: true });
|
|
295
|
+
if (contribution.target !== void 0 && !["server", "web", "mobile"].includes(contribution.target))
|
|
296
|
+
fail("INVALID_MANIFEST", `${path}.target`, "expected server, web, or mobile");
|
|
297
|
+
return {
|
|
298
|
+
id: contributionId,
|
|
299
|
+
kind,
|
|
300
|
+
...contribution.target === void 0 ? {} : {
|
|
301
|
+
target: contribution.target
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
});
|
|
305
|
+
return {
|
|
306
|
+
schemaVersion: 1,
|
|
307
|
+
id,
|
|
308
|
+
version,
|
|
309
|
+
...manifest.sdkRange === void 0 ? {} : { sdkRange: manifest.sdkRange },
|
|
310
|
+
displayName: manifest.displayName,
|
|
311
|
+
...manifest.description === void 0 ? {} : { description: manifest.description },
|
|
312
|
+
...dependencies.length ? { dependencies } : {},
|
|
313
|
+
...config ? { config } : {},
|
|
314
|
+
...contributions.length ? { contributions } : {}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// node_modules/@smartdoca/plugin-sdk/package.json
|
|
319
|
+
var package_default = {
|
|
320
|
+
name: "@smartdoca/plugin-sdk",
|
|
321
|
+
version: "0.1.9",
|
|
322
|
+
license: "MIT",
|
|
323
|
+
type: "module",
|
|
324
|
+
exports: {
|
|
325
|
+
".": {
|
|
326
|
+
types: "./dist/index.d.ts",
|
|
327
|
+
import: "./dist/index.js"
|
|
328
|
+
},
|
|
329
|
+
"./version": {
|
|
330
|
+
types: "./dist/version.d.ts",
|
|
331
|
+
import: "./dist/version.js"
|
|
332
|
+
},
|
|
333
|
+
"./testing": {
|
|
334
|
+
types: "./dist/testing.d.ts",
|
|
335
|
+
import: "./dist/testing.js"
|
|
336
|
+
},
|
|
337
|
+
"./platform": {
|
|
338
|
+
types: "./dist/platform.d.ts",
|
|
339
|
+
import: "./dist/platform.js"
|
|
340
|
+
},
|
|
341
|
+
"./files": {
|
|
342
|
+
types: "./dist/files.d.ts",
|
|
343
|
+
import: "./dist/files.js"
|
|
344
|
+
},
|
|
345
|
+
"./ai": {
|
|
346
|
+
types: "./dist/ai.d.ts",
|
|
347
|
+
import: "./dist/ai.js"
|
|
348
|
+
},
|
|
349
|
+
"./search": {
|
|
350
|
+
types: "./dist/search.d.ts",
|
|
351
|
+
import: "./dist/search.js"
|
|
352
|
+
},
|
|
353
|
+
"./knowledge": {
|
|
354
|
+
types: "./dist/knowledge.d.ts",
|
|
355
|
+
import: "./dist/knowledge.js"
|
|
356
|
+
},
|
|
357
|
+
"./web": {
|
|
358
|
+
types: "./dist/web.d.ts",
|
|
359
|
+
import: "./dist/web.js"
|
|
360
|
+
},
|
|
361
|
+
"./content": {
|
|
362
|
+
types: "./dist/content.d.ts",
|
|
363
|
+
import: "./dist/content.js"
|
|
364
|
+
},
|
|
365
|
+
"./documents": {
|
|
366
|
+
types: "./dist/documents.d.ts",
|
|
367
|
+
import: "./dist/documents.js"
|
|
368
|
+
},
|
|
369
|
+
"./native": {
|
|
370
|
+
types: "./dist/native.d.ts",
|
|
371
|
+
import: "./dist/native.js"
|
|
372
|
+
},
|
|
373
|
+
"./creation-resources": {
|
|
374
|
+
types: "./dist/creation-resources.d.ts",
|
|
375
|
+
import: "./dist/creation-resources.js"
|
|
376
|
+
},
|
|
377
|
+
"./editor-elements": {
|
|
378
|
+
types: "./dist/editor-elements.d.ts",
|
|
379
|
+
import: "./dist/editor-elements.js"
|
|
380
|
+
},
|
|
381
|
+
"./storage": {
|
|
382
|
+
types: "./dist/storage.d.ts",
|
|
383
|
+
import: "./dist/storage.js"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
dependencies: {
|
|
387
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
388
|
+
"@smartdoca/plugin-contracts": "0.1.7",
|
|
389
|
+
"@smartdoca/files-capability": "0.1.1",
|
|
390
|
+
"@smartdoca/search-host": "0.1.1",
|
|
391
|
+
"@smartdoca/knowledge-capability": "0.1.1",
|
|
392
|
+
"@smartdoca/web-plugin-registry": "0.1.3"
|
|
393
|
+
},
|
|
394
|
+
files: [
|
|
395
|
+
"dist"
|
|
396
|
+
],
|
|
397
|
+
publishConfig: {
|
|
398
|
+
access: "public"
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// node_modules/@smartdoca/plugin-sdk/dist/version.js
|
|
403
|
+
var PLUGIN_SDK_VERSION = package_default.version;
|
|
404
|
+
|
|
405
|
+
// node_modules/@smartdoca/plugin-sdk/dist/index.js
|
|
406
|
+
var contractIdentifier = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;
|
|
407
|
+
function assertIdentifier(value, kind) {
|
|
408
|
+
if (!contractIdentifier.test(value))
|
|
409
|
+
throw new PluginContractError("INVALID_MANIFEST", `${kind} must be a stable lowercase dotted or dashed identifier`, value || "$");
|
|
410
|
+
}
|
|
411
|
+
function definePlugin(plugin) {
|
|
412
|
+
const manifest = validatePluginManifest(plugin.manifest);
|
|
413
|
+
const required = plugin.injections?.required ?? [];
|
|
414
|
+
const optional = plugin.injections?.optional ?? [];
|
|
415
|
+
const seen = /* @__PURE__ */ new Set();
|
|
416
|
+
for (const token of [...required, ...optional]) {
|
|
417
|
+
assertIdentifier(token.id, "service identifier");
|
|
418
|
+
if (seen.has(token.id))
|
|
419
|
+
throw new PluginContractError("INVALID_MANIFEST", `service ${token.id} is declared more than once`, `${manifest.id}.injections`);
|
|
420
|
+
seen.add(token.id);
|
|
421
|
+
}
|
|
422
|
+
return Object.freeze({ ...plugin, manifest });
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// qrcode/manifest.json
|
|
426
|
+
var manifest_default = {
|
|
427
|
+
schemaVersion: 1,
|
|
428
|
+
id: "doca.everyday.qrcode",
|
|
429
|
+
version: "0.1.0",
|
|
430
|
+
displayName: "QR code / \u4E8C\u7EF4\u7801",
|
|
431
|
+
sdkRange: "^0.1.9"
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
// qrcode/src/server.ts
|
|
435
|
+
var server_default = () => definePlugin({ manifest: validatePluginManifest(manifest_default), uninstall() {
|
|
436
|
+
} });
|
|
437
|
+
export {
|
|
438
|
+
server_default as default
|
|
439
|
+
};
|
package/manifest.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smartdoca/doca-easy-qrcode-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "二维码 / QR code",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.13.0"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"manifest.json",
|
|
12
|
+
"dist/server.js",
|
|
13
|
+
"dist/server.d.ts",
|
|
14
|
+
"web/index.js",
|
|
15
|
+
"web/index.d.ts",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"THIRD_PARTY_NOTICES.txt"
|
|
19
|
+
],
|
|
20
|
+
"doca": {
|
|
21
|
+
"dataVersion": "2",
|
|
22
|
+
"storage": "host",
|
|
23
|
+
"manifest": "./manifest.json",
|
|
24
|
+
"server": "./dist/server.js",
|
|
25
|
+
"web": {
|
|
26
|
+
"directory": "./web",
|
|
27
|
+
"entry": "./index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"main": "./dist/server.js",
|
|
35
|
+
"types": "./dist/server.d.ts"
|
|
36
|
+
}
|
package/web/index.d.ts
ADDED
package/web/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var Qt=Object.create;var Ve=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Gt=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty;var f=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var Zt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Yt(e))!Wt.call(r,o)&&o!==t&&Ve(r,o,{get:()=>e[o],enumerable:!(n=jt(e,o))||n.enumerable});return r};var Xt=(r,e,t)=>(t=r!=null?Qt(Gt(r)):{},Zt(e||!r||!r.__esModule?Ve(t,"default",{value:r,enumerable:!0}):t,r));var Oe=f((Wr,Je)=>{Je.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var U=f(F=>{var ye,er=[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];F.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};F.getSymbolTotalCodewords=function(e){return er[e]};F.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};F.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ye=e};F.isKanjiModeEnabled=function(){return typeof ye<"u"};F.toSJIS=function(e){return ye(e)}});var se=f(S=>{S.L={bit:1};S.M={bit:0};S.Q={bit:3};S.H={bit:2};function tr(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return S.L;case"m":case"medium":return S.M;case"q":case"quartile":return S.Q;case"h":case"high":return S.H;default:throw new Error("Unknown EC Level: "+r)}}S.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};S.from=function(e,t){if(S.isValid(e))return e;try{return tr(e)}catch{return t}}});var Qe=f((en,$e)=>{function Ke(){this.buffer=[],this.length=0}Ke.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};$e.exports=Ke});var Ye=f((tn,je)=>{function G(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}G.prototype.set=function(r,e,t,n){let o=r*this.size+e;this.data[o]=t,n&&(this.reservedBit[o]=!0)};G.prototype.get=function(r,e){return this.data[r*this.size+e]};G.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};G.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};je.exports=G});var Ge=f(ae=>{var rr=U().getSymbolSize;ae.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=rr(e),o=n===145?26:Math.ceil((n-13)/(2*t-2))*2,i=[n-7];for(let s=1;s<t-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};ae.getPositions=function(e){let t=[],n=ae.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||t.push([n[i],n[s]]);return t}});var Xe=f(Ze=>{var nr=U().getSymbolSize,We=7;Ze.getPositions=function(e){let t=nr(e);return[[0,0],[t-We,0],[0,t-We]]}});var et=f(g=>{g.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var H={N1:3,N2:3,N3:40,N4:10};g.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};g.from=function(e){return g.isValid(e)?parseInt(e,10):void 0};g.getPenaltyN1=function(e){let t=e.size,n=0,o=0,i=0,s=null,a=null;for(let l=0;l<t;l++){o=i=0,s=a=null;for(let u=0;u<t;u++){let c=e.get(l,u);c===s?o++:(o>=5&&(n+=H.N1+(o-5)),s=c,o=1),c=e.get(u,l),c===a?i++:(i>=5&&(n+=H.N1+(i-5)),a=c,i=1)}o>=5&&(n+=H.N1+(o-5)),i>=5&&(n+=H.N1+(i-5))}return n};g.getPenaltyN2=function(e){let t=e.size,n=0;for(let o=0;o<t-1;o++)for(let i=0;i<t-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*H.N2};g.getPenaltyN3=function(e){let t=e.size,n=0,o=0,i=0;for(let s=0;s<t;s++){o=i=0;for(let a=0;a<t;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*H.N3};g.getPenaltyN4=function(e){let t=0,n=e.data.length;for(let i=0;i<n;i++)t+=e.data[i];return Math.abs(Math.ceil(t*100/n/5)-10)*H.N4};function or(r,e,t){switch(r){case g.Patterns.PATTERN000:return(e+t)%2===0;case g.Patterns.PATTERN001:return e%2===0;case g.Patterns.PATTERN010:return t%3===0;case g.Patterns.PATTERN011:return(e+t)%3===0;case g.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case g.Patterns.PATTERN101:return e*t%2+e*t%3===0;case g.Patterns.PATTERN110:return(e*t%2+e*t%3)%2===0;case g.Patterns.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}g.applyMask=function(e,t){let n=t.size;for(let o=0;o<n;o++)for(let i=0;i<n;i++)t.isReserved(i,o)||t.xor(i,o,or(e,i,o))};g.getBestMask=function(e,t){let n=Object.keys(g.Patterns).length,o=0,i=1/0;for(let s=0;s<n;s++){t(s),g.applyMask(s,e);let a=g.getPenaltyN1(e)+g.getPenaltyN2(e)+g.getPenaltyN3(e)+g.getPenaltyN4(e);g.applyMask(s,e),a<i&&(i=a,o=s)}return o}});var xe=f(be=>{var z=se(),le=[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],ue=[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];be.getBlocksCount=function(e,t){switch(t){case z.L:return le[(e-1)*4+0];case z.M:return le[(e-1)*4+1];case z.Q:return le[(e-1)*4+2];case z.H:return le[(e-1)*4+3];default:return}};be.getTotalCodewordsCount=function(e,t){switch(t){case z.L:return ue[(e-1)*4+0];case z.M:return ue[(e-1)*4+1];case z.Q:return ue[(e-1)*4+2];case z.H:return ue[(e-1)*4+3];default:return}}});var tt=f(de=>{var W=new Uint8Array(512),ce=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)W[t]=e,ce[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)W[t]=W[t-255]})();de.log=function(e){if(e<1)throw new Error("log("+e+")");return ce[e]};de.exp=function(e){return W[e]};de.mul=function(e,t){return e===0||t===0?0:W[ce[e]+ce[t]]}});var rt=f(Z=>{var Ee=tt();Z.mul=function(e,t){let n=new Uint8Array(e.length+t.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<t.length;i++)n[o+i]^=Ee.mul(e[o],t[i]);return n};Z.mod=function(e,t){let n=new Uint8Array(e);for(;n.length-t.length>=0;){let o=n[0];for(let s=0;s<t.length;s++)n[s]^=Ee.mul(t[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};Z.generateECPolynomial=function(e){let t=new Uint8Array([1]);for(let n=0;n<e;n++)t=Z.mul(t,new Uint8Array([1,Ee.exp(n)]));return t}});var it=f((un,ot)=>{var nt=rt();function Ce(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Ce.prototype.initialize=function(e){this.degree=e,this.genPoly=nt.generateECPolynomial(this.degree)};Ce.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let n=nt.mod(t,this.genPoly),o=this.degree-n.length;if(o>0){let i=new Uint8Array(this.degree);return i.set(n,o),i}return n};ot.exports=Ce});var ve=f(st=>{st.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var Ne=f(q=>{var at="[0-9]+",ir="[A-Z $%*+\\-./:]+",X="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";X=X.replace(/u/g,"\\u");var sr="(?:(?![A-Z0-9 $%*+\\-./:]|"+X+`)(?:.|[\r
|
|
2
|
+
]))+`;q.KANJI=new RegExp(X,"g");q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");q.BYTE=new RegExp(sr,"g");q.NUMERIC=new RegExp(at,"g");q.ALPHANUMERIC=new RegExp(ir,"g");var ar=new RegExp("^"+X+"$"),lr=new RegExp("^"+at+"$"),ur=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");q.testKanji=function(e){return ar.test(e)};q.testNumeric=function(e){return lr.test(e)};q.testAlphanumeric=function(e){return ur.test(e)}});var _=f(y=>{var cr=ve(),Be=Ne();y.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};y.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};y.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};y.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};y.MIXED={bit:-1};y.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!cr.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};y.getBestModeForData=function(e){return Be.testNumeric(e)?y.NUMERIC:Be.testAlphanumeric(e)?y.ALPHANUMERIC:Be.testKanji(e)?y.KANJI:y.BYTE};y.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};y.isValid=function(e){return e&&e.bit&&e.ccBits};function dr(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return y.NUMERIC;case"alphanumeric":return y.ALPHANUMERIC;case"kanji":return y.KANJI;case"byte":return y.BYTE;default:throw new Error("Unknown mode: "+r)}}y.from=function(e,t){if(y.isValid(e))return e;try{return dr(e)}catch{return t}}});var pt=f(V=>{var pe=U(),pr=xe(),lt=se(),D=_(),Te=ve(),ct=7973,ut=pe.getBCHDigit(ct);function fr(r,e,t){for(let n=1;n<=40;n++)if(e<=V.getCapacity(n,t,r))return n}function dt(r,e){return D.getCharCountIndicator(r,e)+4}function gr(r,e){let t=0;return r.forEach(function(n){let o=dt(n.mode,e);t+=o+n.getBitsLength()}),t}function hr(r,e){for(let t=1;t<=40;t++)if(gr(r,t)<=V.getCapacity(t,e,D.MIXED))return t}V.from=function(e,t){return Te.isValid(e)?parseInt(e,10):t};V.getCapacity=function(e,t,n){if(!Te.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=D.BYTE);let o=pe.getSymbolTotalCodewords(e),i=pr.getTotalCodewordsCount(e,t),s=(o-i)*8;if(n===D.MIXED)return s;let a=s-dt(n,e);switch(n){case D.NUMERIC:return Math.floor(a/10*3);case D.ALPHANUMERIC:return Math.floor(a/11*2);case D.KANJI:return Math.floor(a/13);case D.BYTE:default:return Math.floor(a/8)}};V.getBestVersionForData=function(e,t){let n,o=lt.from(t,lt.M);if(Array.isArray(e)){if(e.length>1)return hr(e,o);if(e.length===0)return 1;n=e[0]}else n=e;return fr(n.mode,n.getLength(),o)};V.getEncodedBits=function(e){if(!Te.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;pe.getBCHDigit(t)-ut>=0;)t^=ct<<pe.getBCHDigit(t)-ut;return e<<12|t}});var mt=f(ht=>{var Se=U(),gt=1335,mr=21522,ft=Se.getBCHDigit(gt);ht.getEncodedBits=function(e,t){let n=e.bit<<3|t,o=n<<10;for(;Se.getBCHDigit(o)-ft>=0;)o^=gt<<Se.getBCHDigit(o)-ft;return(n<<10|o)^mr}});var yt=f((hn,wt)=>{var wr=_();function O(r){this.mode=wr.NUMERIC,this.data=r.toString()}O.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};O.prototype.getLength=function(){return this.data.length};O.prototype.getBitsLength=function(){return O.getBitsLength(this.data.length)};O.prototype.write=function(e){let t,n,o;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),o=parseInt(n,10),e.put(o,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),o=parseInt(n,10),e.put(o,i*3+1))};wt.exports=O});var xt=f((mn,bt)=>{var yr=_(),Ae=["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 K(r){this.mode=yr.ALPHANUMERIC,this.data=r}K.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};K.prototype.getLength=function(){return this.data.length};K.prototype.getBitsLength=function(){return K.getBitsLength(this.data.length)};K.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=Ae.indexOf(this.data[t])*45;n+=Ae.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(Ae.indexOf(this.data[t]),6)};bt.exports=K});var Ct=f((wn,Et)=>{var br=_();function $(r){this.mode=br.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}$.getBitsLength=function(e){return e*8};$.prototype.getLength=function(){return this.data.length};$.prototype.getBitsLength=function(){return $.getBitsLength(this.data.length)};$.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};Et.exports=$});var Nt=f((yn,vt)=>{var xr=_(),Er=U();function Q(r){this.mode=xr.KANJI,this.data=r}Q.getBitsLength=function(e){return e*13};Q.prototype.getLength=function(){return this.data.length};Q.prototype.getBitsLength=function(){return Q.getBitsLength(this.data.length)};Q.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=Er.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
|
+
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};vt.exports=Q});var Bt=f((bn,Ie)=>{"use strict";var ee={single_source_shortest_paths:function(r,e,t){var n={},o={};o[e]=0;var i=ee.PriorityQueue.make();i.push(e,0);for(var s,a,l,u,c,m,d,B,x;!i.empty();){s=i.pop(),a=s.value,u=s.cost,c=r[a]||{};for(l in c)c.hasOwnProperty(l)&&(m=c[l],d=u+m,B=o[l],x=typeof o[l]>"u",(x||B>d)&&(o[l]=d,i.push(l,d),n[l]=a))}if(typeof t<"u"&&typeof o[t]>"u"){var C=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(C)}return n},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],n=e,o;n;)t.push(n),o=r[n],n=r[n];return t.reverse(),t},find_path:function(r,e,t){var n=ee.single_source_shortest_paths(r,e,t);return ee.extract_shortest_path_from_predecessor_list(n,t)},PriorityQueue:{make:function(r){var e=ee.PriorityQueue,t={},n;r=r||{};for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Ie<"u"&&(Ie.exports=ee)});var Lt=f(j=>{var p=_(),At=yt(),It=xt(),Pt=Ct(),Mt=Nt(),te=Ne(),fe=U(),Cr=Bt();function Tt(r){return unescape(encodeURIComponent(r)).length}function re(r,e,t){let n=[],o;for(;(o=r.exec(t))!==null;)n.push({data:o[0],index:o.index,mode:e,length:o[0].length});return n}function kt(r){let e=re(te.NUMERIC,p.NUMERIC,r),t=re(te.ALPHANUMERIC,p.ALPHANUMERIC,r),n,o;return fe.isKanjiModeEnabled()?(n=re(te.BYTE,p.BYTE,r),o=re(te.KANJI,p.KANJI,r)):(n=re(te.BYTE_KANJI,p.BYTE,r),o=[]),e.concat(t,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 Pe(r,e){switch(e){case p.NUMERIC:return At.getBitsLength(r);case p.ALPHANUMERIC:return It.getBitsLength(r);case p.KANJI:return Mt.getBitsLength(r);case p.BYTE:return Pt.getBitsLength(r)}}function vr(r){return r.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function Nr(r){let e=[];for(let t=0;t<r.length;t++){let n=r[t];switch(n.mode){case p.NUMERIC:e.push([n,{data:n.data,mode:p.ALPHANUMERIC,length:n.length},{data:n.data,mode:p.BYTE,length:n.length}]);break;case p.ALPHANUMERIC:e.push([n,{data:n.data,mode:p.BYTE,length:n.length}]);break;case p.KANJI:e.push([n,{data:n.data,mode:p.BYTE,length:Tt(n.data)}]);break;case p.BYTE:e.push([{data:n.data,mode:p.BYTE,length:Tt(n.data)}])}}return e}function Br(r,e){let t={},n={start:{}},o=["start"];for(let i=0;i<r.length;i++){let s=r[i],a=[];for(let l=0;l<s.length;l++){let u=s[l],c=""+i+l;a.push(c),t[c]={node:u,lastCount:0},n[c]={};for(let m=0;m<o.length;m++){let d=o[m];t[d]&&t[d].node.mode===u.mode?(n[d][c]=Pe(t[d].lastCount+u.length,u.mode)-Pe(t[d].lastCount,u.mode),t[d].lastCount+=u.length):(t[d]&&(t[d].lastCount=u.length),n[d][c]=Pe(u.length,u.mode)+4+p.getCharCountIndicator(u.mode,e))}}o=a}for(let i=0;i<o.length;i++)n[o[i]].end=0;return{map:n,table:t}}function St(r,e){let t,n=p.getBestModeForData(r);if(t=p.from(e,n),t!==p.BYTE&&t.bit<n.bit)throw new Error('"'+r+'" cannot be encoded with mode '+p.toString(t)+`.
|
|
4
|
+
Suggested mode is: `+p.toString(n));switch(t===p.KANJI&&!fe.isKanjiModeEnabled()&&(t=p.BYTE),t){case p.NUMERIC:return new At(r);case p.ALPHANUMERIC:return new It(r);case p.KANJI:return new Mt(r);case p.BYTE:return new Pt(r)}}j.fromArray=function(e){return e.reduce(function(t,n){return typeof n=="string"?t.push(St(n,null)):n.data&&t.push(St(n.data,n.mode)),t},[])};j.fromString=function(e,t){let n=kt(e,fe.isKanjiModeEnabled()),o=Nr(n),i=Br(o,t),s=Cr.find_path(i.map,"start","end"),a=[];for(let l=1;l<s.length-1;l++)a.push(i.table[s[l]].node);return j.fromArray(vr(a))};j.rawSplit=function(e){return j.fromArray(kt(e,fe.isKanjiModeEnabled()))}});var Rt=f(qt=>{var he=U(),Me=se(),Tr=Qe(),Sr=Ye(),Ar=Ge(),Ir=Xe(),qe=et(),Re=xe(),Pr=it(),ge=pt(),Mr=mt(),kr=_(),ke=Lt();function Lr(r,e){let t=r.size,n=Ir.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||t<=i+a))for(let l=-1;l<=7;l++)s+l<=-1||t<=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?r.set(i+a,s+l,!0,!0):r.set(i+a,s+l,!1,!0))}}function qr(r){let e=r.size;for(let t=8;t<e-8;t++){let n=t%2===0;r.set(t,6,n,!0),r.set(6,t,n,!0)}}function Rr(r,e){let t=Ar.getPositions(e);for(let n=0;n<t.length;n++){let o=t[n][0],i=t[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?r.set(o+s,i+a,!0,!0):r.set(o+s,i+a,!1,!0)}}function Ur(r,e){let t=r.size,n=ge.getEncodedBits(e),o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+t-8-3,s=(n>>a&1)===1,r.set(o,i,s,!0),r.set(i,o,s,!0)}function Le(r,e,t){let n=r.size,o=Mr.getEncodedBits(e,t),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?r.set(i,8,s,!0):i<8?r.set(i+1,8,s,!0):r.set(n-15+i,8,s,!0),i<8?r.set(8,n-i-1,s,!0):i<9?r.set(8,15-i-1+1,s,!0):r.set(8,15-i-1,s,!0);r.set(n-8,8,1,!0)}function zr(r,e){let t=r.size,n=-1,o=t-1,i=7,s=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!r.isReserved(o,a-l)){let u=!1;s<e.length&&(u=(e[s]>>>i&1)===1),r.set(o,a-l,u),i--,i===-1&&(s++,i=7)}if(o+=n,o<0||t<=o){o-=n,n=-n;break}}}function _r(r,e,t){let n=new Tr;t.forEach(function(l){n.put(l.mode.bit,4),n.put(l.getLength(),kr.getCharCountIndicator(l.mode,r)),l.write(n)});let o=he.getSymbolTotalCodewords(r),i=Re.getTotalCodewordsCount(r,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 Dr(n,r,e)}function Dr(r,e,t){let n=he.getSymbolTotalCodewords(e),o=Re.getTotalCodewordsCount(e,t),i=n-o,s=Re.getBlocksCount(e,t),a=n%s,l=s-a,u=Math.floor(n/s),c=Math.floor(i/s),m=c+1,d=u-c,B=new Pr(d),x=0,C=new Array(s),A=new Array(s),b=0,R=new Uint8Array(r.buffer);for(let k=0;k<s;k++){let w=k<l?c:m;C[k]=R.slice(x,x+w),A[k]=B.encode(C[k]),x+=w,b=Math.max(b,w)}let P=new Uint8Array(n),M=0,v,E;for(v=0;v<b;v++)for(E=0;E<s;E++)v<C[E].length&&(P[M++]=C[E][v]);for(v=0;v<d;v++)for(E=0;E<s;E++)P[M++]=A[E][v];return P}function Fr(r,e,t,n){let o;if(Array.isArray(r))o=ke.fromArray(r);else if(typeof r=="string"){let u=e;if(!u){let c=ke.rawSplit(r);u=ge.getBestVersionForData(c,t)}o=ke.fromString(r,u||40)}else throw new Error("Invalid data");let i=ge.getBestVersionForData(o,t);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=_r(e,t,o),a=he.getSymbolSize(e),l=new Sr(a);return Lr(l,e),qr(l),Rr(l,e),Le(l,t,0),e>=7&&Ur(l,e),zr(l,s),isNaN(n)&&(n=qe.getBestMask(l,Le.bind(null,l,t))),qe.applyMask(n,l),Le(l,t,n),{modules:l,version:e,errorCorrectionLevel:t,maskPattern:n,segments:o}}qt.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let n=Me.M,o,i;return typeof t<"u"&&(n=Me.from(t.errorCorrectionLevel,Me.M),o=ge.from(t.version),i=qe.from(t.maskPattern),t.toSJISFunc&&he.setToSJISFunction(t.toSJISFunc)),Fr(e,o,n,i)}});var Ue=f(J=>{function Ut(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(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 t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}J.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=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:t,color:{dark:Ut(e.color.dark||"#000000ff"),light:Ut(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};J.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};J.getImageWidth=function(e,t){let n=J.getScale(e,t);return Math.floor((e+t.margin*2)*n)};J.qrToImageData=function(e,t,n){let o=t.modules.size,i=t.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 c=0;c<a;c++)for(let m=0;m<a;m++){let d=(c*a+m)*4,B=n.color.light;if(c>=l&&m>=l&&c<a-l&&m<a-l){let x=Math.floor((c-l)/s),C=Math.floor((m-l)/s);B=u[i[x*o+C]?1:0]}e[d++]=B.r,e[d++]=B.g,e[d++]=B.b,e[d]=B.a}}});var zt=f(me=>{var ze=Ue();function Hr(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function Vr(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}me.render=function(e,t,n){let o=n,i=t;typeof o>"u"&&(!t||!t.getContext)&&(o=t,t=void 0),t||(i=Vr()),o=ze.getOptions(o);let s=ze.getImageWidth(e.modules.size,o),a=i.getContext("2d"),l=a.createImageData(s,s);return ze.qrToImageData(l.data,e,o),Hr(a,i,s),a.putImageData(l,0,0),i};me.renderToDataURL=function(e,t,n){let o=n;typeof o>"u"&&(!t||!t.getContext)&&(o=t,t=void 0),o||(o={});let i=me.render(e,t,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var Ft=f(Dt=>{var Jr=Ue();function _t(r,e){let t=r.a/255,n=e+'="'+r.hex+'"';return t<1?n+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':n}function _e(r,e,t){let n=r+e;return typeof t<"u"&&(n+=" "+t),n}function Or(r,e,t){let n="",o=0,i=!1,s=0;for(let a=0;a<r.length;a++){let l=Math.floor(a%e),u=Math.floor(a/e);!l&&!i&&(i=!0),r[a]?(s++,a>0&&l>0&&r[a-1]||(n+=i?_e("M",l+t,.5+u+t):_e("m",o,0),o=0,i=!1),l+1<e&&r[a+1]||(n+=_e("h",s),s=0)):o++}return n}Dt.render=function(e,t,n){let o=Jr.getOptions(t),i=e.modules.size,s=e.modules.data,a=i+o.margin*2,l=o.color.light.a?"<path "+_t(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",u="<path "+_t(o.color.dark,"stroke")+' d="'+Or(s,i,o.margin)+'"/>',c='viewBox="0 0 '+a+" "+a+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+c+' shape-rendering="crispEdges">'+l+u+`</svg>
|
|
8
|
+
`;return typeof n=="function"&&n(null,d),d}});var Vt=f(ne=>{var Kr=Oe(),De=Rt(),Ht=zt(),$r=Ft();function Fe(r,e,t,n,o){let i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!Kr())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=t,t=e,e=n=void 0):s===3&&(e.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=t,t=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(t=e,e=n=void 0):s===2&&!e.getContext&&(n=t,t=e,e=void 0),new Promise(function(l,u){try{let c=De.create(t,n);l(r(c,e,n))}catch(c){u(c)}})}try{let l=De.create(t,n);o(null,r(l,e,n))}catch(l){o(l)}}ne.create=De.create;ne.toCanvas=Fe.bind(null,Ht.render);ne.toDataURL=Fe.bind(null,Ht.renderToDataURL);ne.toString=Fe.bind(null,function(r,e,t){return $r.render(r,t)})});var $t=Xt(Vt(),1);var Jt=`.ep-root{--ep-bg:#fff;--ep-ink:#172c39;--ep-muted:#6c7e89;--ep-line:#e4e9eb;--ep-soft:#f4f7f7;--ep-accent:#157a70;--ep-tint:#e7f4ef;box-sizing:border-box;background:var(--ep-bg);color:var(--ep-ink);font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC",sans-serif;border:1px solid var(--ep-line);border-radius:20px;padding:24px;min-width:0;width:100%;text-align:left;container-type:inline-size}
|
|
9
|
+
.ep-root[data-theme=soft]{--ep-bg:#f8faf8;--ep-soft:#edf3ee}.ep-root *{box-sizing:border-box}.ep-root h1,.ep-root h2,.ep-root h3,.ep-root p{margin:0}.ep-root h1{font-size:30px;line-height:1.3;letter-spacing:-1px}.ep-root h2{font-size:22px;letter-spacing:-.6px}.ep-root h3{font-size:16px}.ep-root button,.ep-root input,.ep-root textarea,.ep-root select{font:inherit}.ep-root button{cursor:pointer}.ep-root button:disabled{cursor:default;opacity:.5}.ep-root button:focus-visible,.ep-root input:focus-visible,.ep-root textarea:focus-visible,.ep-root select:focus-visible{outline:3px solid #5bbaad;outline-offset:3px}.ep-root input,.ep-root textarea,.ep-root select{border:1px solid var(--ep-line);border-radius:11px;padding:10px 12px;background:var(--ep-bg);color:var(--ep-ink);min-width:0}.ep-root textarea{resize:vertical;width:100%;min-height:140px}.ep-root a{color:var(--ep-accent)}
|
|
10
|
+
.ep-root a.ep-button{color:white;text-decoration:none}
|
|
11
|
+
.ep-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:22px}.ep-kicker{color:var(--ep-muted);font-size:10px;letter-spacing:2px;font-weight:700;text-transform:uppercase;margin-bottom:6px}.ep-muted{color:var(--ep-muted);font-size:12px}.ep-actions,.ep-row{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.ep-between{justify-content:space-between}.ep-button{border:0;border-radius:11px;padding:10px 16px;background:var(--ep-accent);color:white;font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:6px}.ep-button.secondary{background:var(--ep-soft);color:var(--ep-ink)}.ep-button.ghost{background:transparent;color:var(--ep-muted);border:1px solid var(--ep-line)}.ep-button.small{padding:6px 10px;font-size:12px}.ep-search{display:flex;gap:9px;margin:14px 0}.ep-search input{flex:1}.ep-box{padding:16px;background:var(--ep-soft);border-radius:13px}.ep-error{color:#a23d36;background:#fff0ee;border:1px solid #f1d1cb;padding:12px;border-radius:12px;margin:12px 0;white-space:pre-wrap}.ep-empty{padding:25px 10px;text-align:center;color:var(--ep-muted)}.ep-loading{min-height:100px;display:grid;place-items:center;color:var(--ep-muted)}.ep-foot{border-top:1px solid var(--ep-line);margin-top:18px;padding-top:13px;display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;color:var(--ep-muted);font-size:11px}.ep-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.ep-tag{display:inline-block;border-radius:6px;padding:2px 7px;background:var(--ep-tint);color:var(--ep-accent);font-size:11px}.ep-tabs{display:flex;gap:6px;margin:15px 0;flex-wrap:wrap}.ep-tabs button{border:0;border-radius:9px;padding:8px 13px;background:var(--ep-soft);color:var(--ep-muted)}.ep-tabs button.active{background:var(--ep-ink);color:white}.ep-divider{border:0;border-top:1px solid var(--ep-line);margin:20px 0}.ep-page{max-width:1180px;margin:24px auto;padding:32px}.ep-list{list-style:none;margin:12px 0;padding:0}.ep-list li{border-bottom:1px solid var(--ep-line);padding:10px 0}.ep-result-button{display:block;width:100%;border:0;border-bottom:1px solid var(--ep-line);background:transparent;text-align:left;padding:12px;color:var(--ep-ink)}.ep-result-button:hover{background:var(--ep-soft)}.ep-field{display:grid;gap:5px;font-size:12px;color:var(--ep-muted)}.ep-alert{font-size:12px;color:var(--ep-muted);padding:10px 0}.ep-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
|
|
12
|
+
@container (max-width:420px){.ep-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ep-head{align-items:flex-start}.ep-root h1{font-size:24px}}
|
|
13
|
+
@media(max-width:600px){.ep-root{padding:18px;border-radius:15px}.ep-page{margin:12px;padding:20px}.ep-search{flex-wrap:wrap}.ep-search input{min-width:160px}}
|
|
14
|
+
@media(prefers-reduced-motion:reduce){.ep-root *{animation:none!important;transition:none!important}}
|
|
15
|
+
`;var oe=(r,e,t)=>r==="zh"?e:t;function Ot(r,e){let t=r.React;function n({children:i,className:s=""}){let a=r.useEnvironment();return t.createElement("section",{className:`ep-root ${s}`,"data-theme":a.theme,lang:a.locale==="zh"?"zh-CN":"en"},t.createElement("style",null,Jt),i)}function o(i,s,a){let l=r.useEnvironment().locale,[u,c]=t.useState(s),[m,d]=t.useState(!1),[B,x]=t.useState(""),C=t.useRef({value:s,revision:0}),A=t.useRef(!1),b=t.useRef(!1),R=t.useRef(async()=>{}),P=t.useRef(null),M=t.useRef(""),v=t.useRef(null),E=w=>{if(!Number.isInteger(w.revision)||w.revision<0||(w.revision===0?w.value!==null:!a(w.value)))throw Error(oe(l,"\u4FDD\u5B58\u7684\u8BBE\u7F6E\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002","Saved settings could not be read. Contact your administrator."));let h=w.revision===0?s:w.value;JSON.stringify(C.current.value)!==JSON.stringify(h)&&c(h),C.current={value:h,revision:w.revision}};return t.useEffect(()=>{b.current=!0;let w,h=null,N=async(Y=!1)=>{if(A.current||!b.current)return;v.current?.abort();let ie=new AbortController;v.current=ie;try{let we=await r.request(`/preferences?name=${encodeURIComponent(i)}`,{signal:ie.signal});!ie.signal.aborted&&b.current&&(E(we),d(!0),Y||x(""))}catch(we){!ie.signal.aborted&&b.current&&(d(!1),x(we.message))}};R.current=N;let I=Y=>{Y.detail===M.current&&N()},L=()=>{document.visibilityState==="visible"&&N()};return window.addEventListener("doca.everyday.preference",I),document.addEventListener("visibilitychange",L),r.platform.users.me().then(async Y=>{b.current&&(M.current=`${e}:${Y.id}:${i}`,typeof BroadcastChannel<"u"&&(h=new BroadcastChannel(`doca.everyday.${M.current}`),P.current=h,h.onmessage=()=>{N()}),await N(),b.current&&(w=window.setInterval(L,15e3)))}).catch(()=>{b.current&&x(oe(l,"\u65E0\u6CD5\u8F7D\u5165\u5F53\u524D\u7528\u6237\u8BBE\u7F6E\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u540E\u91CD\u8BD5\u3002","Could not load your settings. Sign in again."))}),()=>{b.current=!1,v.current?.abort(),clearInterval(w),h?.close(),P.current=null,window.removeEventListener("doca.everyday.preference",I),document.removeEventListener("visibilitychange",L)}},[i]),[u,async w=>{if(!m||A.current||!b.current)return!1;let h=typeof w=="function"?w(C.current.value):w;if(!a(h))throw Error("Invalid preference");if(JSON.stringify(h)===JSON.stringify(C.current.value))return!0;A.current=!0,d(!1),v.current?.abort();let N=new AbortController;v.current=N;let I=!1;try{let L=await r.request("/preferences",{method:"POST",signal:N.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:h,revision:C.current.revision})});b.current&&!N.signal.aborted&&(E(L),x(""),I=!0)}catch(L){b.current&&!N.signal.aborted&&x(L.message)}finally{A.current=!1,b.current&&(I?(d(!0),window.dispatchEvent(new CustomEvent("doca.everyday.preference",{detail:M.current})),P.current?.postMessage("reload")):await R.current(!0))}return I},m,B]}return{Frame:n,usePreference:o}}function Kt(r){let e=r.trim();if(!e||e.length>1800)throw Error("\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC7 1800 \u4E2A\u5B57\u7B26\u7684\u94FE\u63A5\u3002");let t;try{t=new URL(e)}catch{throw Error("\u8BF7\u8F93\u5165\u5B8C\u6574\u94FE\u63A5\uFF0C\u4EE5 https:// \u6216 http:// \u5F00\u5934\u3002")}if(!["https:","http:"].includes(t.protocol)||!t.hostname||t.username||t.password)throw Error("\u4EC5\u652F\u6301\u4E0D\u542B\u8D26\u53F7\u5BC6\u7801\u7684 HTTP / HTTPS \u94FE\u63A5\u3002");let n=t.href;if(new TextEncoder().encode(n).byteLength>2200)throw Error("\u94FE\u63A5\u8FC7\u957F\uFF0C\u65E0\u6CD5\u751F\u6210\u6613\u626B\u63CF\u7684\u4E8C\u7EF4\u7801\u3002");return n}var T={schemaVersion:1,id:"doca.everyday.qrcode",version:"0.1.0",displayName:"QR code / \u4E8C\u7EF4\u7801",sdkRange:"^0.1.9"};var He=`.qrcode-card{max-width:510px}.qrcode-actions{margin-top:15px;justify-content:center}.qrcode-actions a{text-decoration:none;color:white}.qrcode-image{margin:22px auto 12px;padding:14px;border:1px solid var(--ep-line);border-radius:16px;width:270px;max-width:100%;background:white}.qrcode-image img{display:block;width:100%;height:auto;image-rendering:pixelated}.qrcode-url{font-size:11px;color:var(--ep-muted);word-break:break-all;text-align:center;max-height:65px;overflow:auto}
|
|
16
|
+
.qrcode-entry-symbol{display:grid;place-items:center;width:54px;height:54px;flex-shrink:0;border-radius:17px;background:var(--ep-tint);color:var(--ep-accent)}.qrcode-entry-symbol svg{display:block;width:32px;height:32px}.qrcode-placeholder svg{display:block;width:64px;height:64px}.qrcode-entry .ep-button{width:100%}
|
|
17
|
+
.qrcode-input-row{display:flex;gap:8px;align-items:center}.qrcode-input-row input{flex:1;width:0}.qrcode-input-row .qrcode-refresh{width:42px;height:42px;padding:0;display:flex;align-items:center;justify-content:center;flex:0 0 42px}.qrcode-refresh svg{display:block;width:20px;height:20px;flex:0 0 20px}.qrcode-refresh:active{transform:rotate(25deg)}.qrcode-feedback{min-height:26px;padding-top:5px}.qrcode-feedback .ep-error{margin:0}.qrcode-image{margin-top:10px}.qrcode-image[data-pending=true]{opacity:.65}.qrcode-actions a[aria-disabled=true]{opacity:.5;pointer-events:none}.qrcode-placeholder{width:270px;height:270px;max-width:100%;margin:10px auto 12px;display:grid;place-items:center;font-size:64px;color:var(--ep-line);border:1px solid var(--ep-line);border-radius:16px}
|
|
18
|
+
|
|
19
|
+
.qrcode-refresh-wrap{position:relative;display:flex;flex:0 0 42px}.qrcode-refresh-tooltip{position:absolute;bottom:calc(100% + 8px);right:0;z-index:3;background:#172c39;color:#fff;padding:6px 10px;border-radius:7px;font-size:11px;line-height:1.5;white-space:nowrap;box-shadow:0 4px 12px #172c3926;pointer-events:none;visibility:hidden;opacity:0;transition:opacity .12s}.qrcode-refresh-tooltip::after{content:"";position:absolute;top:100%;right:17px;border:4px solid transparent;border-top-color:#172c39}.qrcode-refresh-wrap:hover .qrcode-refresh-tooltip,.qrcode-refresh-wrap:focus-within .qrcode-refresh-tooltip{visibility:visible;opacity:1}
|
|
20
|
+
`;var Un=async r=>{let e=r.React,{Frame:t}=Ot(r,T.id),n=`${T.id}.card`,o=`${T.id}.entry`;function i(){return e.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("rect",{x:"3",y:"3",width:"6",height:"6",rx:".6"}),e.createElement("rect",{x:"15",y:"3",width:"6",height:"6",rx:".6"}),e.createElement("rect",{x:"3",y:"15",width:"6",height:"6",rx:".6"}),e.createElement("path",{d:"M12 3v6M3 12h6M12 12h3v3h3v3h3v3h-6v-3M12 18v3M21 12v3"}),e.createElement("path",{d:"M5 5h2v2H5zM17 5h2v2h-2zM5 17h2v2H5z",fill:"currentColor",stroke:"none"}))}function s({context:l}){let u=r.useEnvironment().locale,c=(m,d)=>oe(u,m,d);return e.createElement(t,{className:"qrcode-entry"},e.createElement("style",null,He),e.createElement("header",{className:"ep-head"},e.createElement("div",null,e.createElement("div",{className:"ep-kicker"},"SHARE / SCAN & GO"),e.createElement("h2",null,c("\u4E8C\u7EF4\u7801","QR code")),e.createElement("p",{className:"ep-muted"},c("\u626B\u7801\u6253\u5F00\u5F53\u524D\u9875\u9762\uFF0C\u6216\u5206\u4EAB\u4EFB\u610F\u94FE\u63A5","Scan this page or share any link"))),e.createElement("span",{className:"qrcode-entry-symbol","aria-hidden":"true"},e.createElement(i,null))),e.createElement("button",{className:"ep-button",onClick:()=>r.ui.openView({viewId:n,presentation:"dialog",context:l})},c("\u6253\u5F00\u4E8C\u7EF4\u7801","Open QR code")))}function a(){let l=r.useEnvironment().locale,u=(h,N)=>oe(l,h,N),[c,m]=e.useState(window.location.href),[d,B]=e.useState({input:"",encoded:"",image:""}),[x,C]=e.useState(""),[A,b]=e.useState(!0),[R,P]=e.useState(!1),[M,v]=e.useState(0);e.useEffect(()=>{let h=!0;b(!0),C("");let N=window.setTimeout(()=>{(async()=>{try{let I=Kt(c),L=await $t.default.toDataURL(I,{width:640,margin:4,errorCorrectionLevel:"M",color:{dark:"#172c39",light:"#ffffff"}});h&&B({input:c,encoded:I,image:L})}catch(I){h&&C(I.message)}finally{h&&b(!1)}})()},100);return()=>{h=!1,window.clearTimeout(N)}},[c,M]);let E=!!d.image&&!A&&!x&&d.input===c;async function k(){if(!(!E||R)){P(!0);try{if(!navigator.clipboard?.write||typeof ClipboardItem>"u")throw Error();let h=fetch(d.image).then(N=>N.blob());await navigator.clipboard.write([new ClipboardItem({"image/png":h})]),r.toast(u("\u56FE\u7247\u5DF2\u590D\u5236","Image copied"),"success")}catch{r.toast(u("\u590D\u5236\u56FE\u7247\u5931\u8D25\uFF0C\u8BF7\u5141\u8BB8\u526A\u8D34\u677F\u8BBF\u95EE\u6216\u4E0B\u8F7D PNG\u3002","Could not copy the image. Allow clipboard access or download the PNG."),"warning")}finally{P(!1)}}}function w(){m(window.location.href),v(h=>h+1)}return e.createElement(t,{className:"qrcode-card"},e.createElement("style",null,He),e.createElement("header",{className:"ep-head"},e.createElement("div",null,e.createElement("div",{className:"ep-kicker"},"SHARE / SCAN & GO"),e.createElement("h2",null,u("\u94FE\u63A5\u4E8C\u7EF4\u7801","Link QR code"))),e.createElement("span",{className:"ep-tag"},u("\u672C\u5730\u751F\u6210","Generated locally"))),e.createElement("div",{className:"ep-field"},e.createElement("label",{htmlFor:`${n}.url`},u("\u7F51\u9875\u94FE\u63A5","Page URL")),e.createElement("div",{className:"qrcode-input-row"},e.createElement("input",{id:`${n}.url`,value:c,type:"url",maxLength:1800,onChange:h=>m(h.target.value),placeholder:"https://example.com"}),e.createElement("span",{className:"qrcode-refresh-wrap"},e.createElement("button",{className:"ep-button secondary qrcode-refresh",type:"button",onClick:w,"aria-label":u("\u5237\u65B0\u4E3A\u5F53\u524D\u9875\u9762","Use current page URL"),"aria-describedby":`${n}.refresh-tip`},e.createElement("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M20 4v5h-5"}),e.createElement("path",{d:"M20 12a8 8 0 1 1-2.35-5.65L20 9"}))),e.createElement("span",{className:"qrcode-refresh-tooltip",id:`${n}.refresh-tip`,role:"tooltip"},u("\u5237\u65B0\u4E3A\u5F53\u524D\u9875\u9762\u94FE\u63A5","Use the current page URL"))))),e.createElement("div",{className:"qrcode-feedback","aria-live":"polite"},x?e.createElement("p",{className:"ep-error",role:"alert"},x):A&&e.createElement("p",{className:"ep-muted"},u("\u6B63\u5728\u66F4\u65B0\u4E8C\u7EF4\u7801\u2026","Updating QR code\u2026"))),d.image?e.createElement(e.Fragment,null,e.createElement("div",{className:"qrcode-image","aria-busy":A,"data-pending":!E},e.createElement("img",{width:"240",height:"240",alt:u("\u94FE\u63A5\u4E8C\u7EF4\u7801","QR code for the link"),src:d.image})),e.createElement("p",{className:"qrcode-url"},d.encoded),e.createElement("div",{className:"ep-actions qrcode-actions"},e.createElement("a",{className:"ep-button",href:E?d.image:void 0,"aria-disabled":!E,download:"doca-qrcode.png"},u("\u4E0B\u8F7D PNG","Download PNG")),e.createElement("button",{className:"ep-button ghost",disabled:!E||R,onClick:()=>{k()}},R?u("\u590D\u5236\u4E2D\u2026","Copying\u2026"):u("\u590D\u5236\u56FE\u7247","Copy image")))):e.createElement("div",{className:"qrcode-placeholder","aria-hidden":"true"},e.createElement(i,null)),e.createElement("footer",{className:"ep-foot"},e.createElement("span",null,u("\u94FE\u63A5\u5728\u5F53\u524D\u6D4F\u89C8\u5668\u751F\u6210\uFF0C\u4E0D\u4F1A\u4E0A\u4F20\u3002","The link stays in your browser.")),e.createElement("span",null,u("\u8BBF\u95EE\u539F\u9875\u9762\u4ECD\u9700\u76F8\u5E94\u6743\u9650\u3002","Original page permissions still apply."))))}return{manifest:{pluginId:T.id,version:T.version,targets:["web"]},views:[{id:o,pluginId:T.id,title:{zh:"\u4E8C\u7EF4\u7801",en:"QR code"},supportedContexts:["home"],render:l=>e.createElement(s,{context:l})},{id:n,pluginId:T.id,title:{zh:"\u4E8C\u7EF4\u7801",en:"QR code"},supportedContexts:["home","global","document"],render:()=>e.createElement(a,null)}],placements:[{id:`${T.id}.home-entry`,pluginId:T.id,slot:"home.cards",viewId:o},{id:`${T.id}.global-tool`,pluginId:T.id,slot:"global.more",viewId:n,presentation:"dialog"},{id:`${T.id}.document-tool`,pluginId:T.id,slot:"document.toolbar",viewId:n,presentation:"dialog"}]}};export{Un as default};
|