xq-slide-captcha 1.0.0 → 1.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/README.md +20 -4
- package/dist/css/xq-slide-captcha.css +1 -1
- package/dist/css/xq-slide-captcha.min.css +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -1
- package/dist/js/xq-slide-captcha.js +97 -37
- package/dist/js/xq-slide-captcha.min.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,11 +56,14 @@ import 'xq-slide-captcha/dist/css/xq-slide-captcha.min.css';
|
|
|
56
56
|
<link rel="stylesheet" href="/static/xq-slide-captcha/css/xq-slide-captcha.min.css" />
|
|
57
57
|
</head>
|
|
58
58
|
<body>
|
|
59
|
-
<form action="/login" method="post"
|
|
59
|
+
<form action="/login" method="post"><!-- 不要加 novalidate -->
|
|
60
60
|
<input name="username" />
|
|
61
61
|
<input name="password" type="password" />
|
|
62
62
|
<!-- 触发元素:点击后弹出滑动拼图验证码 -->
|
|
63
63
|
<div class="xq-captcha"></div>
|
|
64
|
+
<!-- 守卫输入框:未通过验证时由浏览器原生拦截提交 -->
|
|
65
|
+
<input type="text" name="xq_captcha_token" class="xq-captcha-guard visually-hidden"
|
|
66
|
+
tabindex="-1" autocomplete="off" data-xq-guard-text="请先完成人机验证" />
|
|
64
67
|
<button type="submit">登录</button>
|
|
65
68
|
</form>
|
|
66
69
|
|
|
@@ -83,7 +86,7 @@ import 'xq-slide-captcha/dist/css/xq-slide-captcha.min.css';
|
|
|
83
86
|
</html>
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
路径按实际静态目录调整。脚本方式下**不用设置 `transport`**:全局实例的默认传输层就是内置 `FetchTransport`,会请求上面的 `dataUrl` / `checkUrl`(默认即 xq-app-admin
|
|
89
|
+
路径按实际静态目录调整。脚本方式下**不用设置 `transport`**:全局实例的默认传输层就是内置 `FetchTransport`,会请求上面的 `dataUrl` / `checkUrl`(默认即 xq-app-admin 的两个地址)。要自定义传输层请用模块方式传入。验证通过后组件会写入令牌字段,由后端二次校验;令牌字段支持「宿主页静态守卫」和「组件动态插入」两种模式,见下方「表单提交守卫」。要自定义实例可用模块方式的 `installGlobal()`。
|
|
87
90
|
|
|
88
91
|
## 集成到宿主页面
|
|
89
92
|
|
|
@@ -93,10 +96,22 @@ import 'xq-slide-captcha/dist/css/xq-slide-captcha.min.css';
|
|
|
93
96
|
<input name="password" type="password" />
|
|
94
97
|
<!-- 触发元素:统一使用 .xq-captcha,可匹配多个 -->
|
|
95
98
|
<div class="xq-captcha"></div>
|
|
99
|
+
<!-- 可选:静态守卫输入框,启用 HTML5 原生拦截(推荐) -->
|
|
100
|
+
<input type="text" name="xq_captcha_token" class="xq-captcha-guard visually-hidden"
|
|
101
|
+
tabindex="-1" autocomplete="off" data-xq-guard-text="请先完成人机验证" />
|
|
96
102
|
<button type="submit">登录</button>
|
|
97
103
|
</form>
|
|
98
104
|
```
|
|
99
105
|
|
|
106
|
+
### 表单提交守卫
|
|
107
|
+
|
|
108
|
+
组件本身不拦截表单提交。若希望「验证没通过时表单提交不了、并给出原生提示」,在表单里预置上面的守卫输入框即可——它用 Bootstrap `visually-hidden` 隐藏但可聚焦,组件通过 `setCustomValidity` 控制它:未通过时带上 `data-xq-guard-text` 的提示让浏览器拦截提交,通过后清空提示并写入令牌。要点:
|
|
109
|
+
|
|
110
|
+
- **表单不要加 `novalidate`**,否则原生验证失效。
|
|
111
|
+
- 守卫输入框按 `inputName`(默认 `xq_captcha_token`)在触发器所属表单内查找,多实例各自在自己的表单里不会串写。
|
|
112
|
+
- `backend_only` 模式通过后无令牌,守卫仍会放行,但不写值;安全仍然靠后端会话校验兜底。
|
|
113
|
+
- 若页面不放守卫输入框,组件回退到旧行为:通过时动态插入 `type=hidden` 字段,不提供原生拦截——此时请自行在 submit 里用 `captcha.result()` 判断,并由后端二次校验兜底。
|
|
114
|
+
|
|
100
115
|
```ts
|
|
101
116
|
import { SlideCaptcha } from 'xq-slide-captcha';
|
|
102
117
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
@@ -135,8 +150,9 @@ captcha
|
|
|
135
150
|
| `showClose` | `true` | 是否显示关闭按钮 |
|
|
136
151
|
| `showRefresh` | `true` | 是否显示刷新按钮 |
|
|
137
152
|
| `theme` | `auto` | `auto` / `light` / `dark` |
|
|
138
|
-
| `inputName` | `xq_captcha_token` |
|
|
139
|
-
| `autoInsertInput` | `true` |
|
|
153
|
+
| `inputName` | `xq_captcha_token` | 令牌字段名,守卫输入框与动态输入框都用它;**留空则不写入** |
|
|
154
|
+
| `autoInsertInput` | `true` | 回退模式下是否自动插入 `type=hidden` 输入框(守卫模式不受此影响) |
|
|
155
|
+
| `guardText` | `请先完成人机验证` | 守卫输入框未通过时的提示;页面元素的 `data-xq-guard-text` 优先 |
|
|
140
156
|
| `timeout` | `10000` | 请求超时毫秒数 |
|
|
141
157
|
| `copyright` | `{ text: '© xqkeji.cn', url: 'https://xqkeji.cn/', title: 'xqkeji.cn' }` | 弹窗底部版权行 |
|
|
142
158
|
| `transport` | 内置 `FetchTransport` | 自定义传输层,演示页注入本地模拟后端时使用 |
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* xq-slide-captcha v1.
|
|
2
|
+
* xq-slide-captcha v1.1.0 (https://xqkeji.cn/demo/xq-slide-captcha)
|
|
3
3
|
* Author xqkeji.cn
|
|
4
4
|
* LICENSE AGPL-3.0-only
|
|
5
5
|
* Copyright 2026 xqkeji.cn
|
|
@@ -775,6 +775,10 @@ class SlideBehaviour extends xqCaptchaCore.CaptchaBehaviour {
|
|
|
775
775
|
const image = await loadImage(data.image_base64);
|
|
776
776
|
this.canvas.setVisible(true);
|
|
777
777
|
this.canvas.measure();
|
|
778
|
+
this.ctx.state.maxOffset = Math.max(
|
|
779
|
+
0,
|
|
780
|
+
Math.round((this.ctx.state.imgWidth - this.ctx.state.markWidth) * this.ctx.state.scale)
|
|
781
|
+
);
|
|
778
782
|
this.canvas.drawBackground(image);
|
|
779
783
|
this.canvas.clearMark();
|
|
780
784
|
this.layer.setImage(image);
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* xq-slide-captcha v1.
|
|
2
|
+
* xq-slide-captcha v1.1.0 (https://xqkeji.cn/demo/xq-slide-captcha)
|
|
3
3
|
* Author xqkeji.cn
|
|
4
4
|
* LICENSE AGPL-3.0-only
|
|
5
5
|
* Copyright 2026 xqkeji.cn
|
|
@@ -772,6 +772,10 @@ class SlideBehaviour extends CaptchaBehaviour {
|
|
|
772
772
|
const image = await loadImage(data.image_base64);
|
|
773
773
|
this.canvas.setVisible(true);
|
|
774
774
|
this.canvas.measure();
|
|
775
|
+
this.ctx.state.maxOffset = Math.max(
|
|
776
|
+
0,
|
|
777
|
+
Math.round((this.ctx.state.imgWidth - this.ctx.state.markWidth) * this.ctx.state.scale)
|
|
778
|
+
);
|
|
775
779
|
this.canvas.drawBackground(image);
|
|
776
780
|
this.canvas.clearMark();
|
|
777
781
|
this.layer.setImage(image);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* xq-slide-captcha v1.
|
|
2
|
+
* xq-slide-captcha v1.1.0 (https://xqkeji.cn/demo/xq-slide-captcha)
|
|
3
3
|
* Author xqkeji.cn
|
|
4
4
|
* LICENSE AGPL-3.0-only
|
|
5
5
|
* Copyright 2026 xqkeji.cn
|
|
@@ -1502,6 +1502,7 @@
|
|
|
1502
1502
|
theme: "auto",
|
|
1503
1503
|
inputName: "xq_captcha_token",
|
|
1504
1504
|
autoInsertInput: true,
|
|
1505
|
+
guardText: "\u8BF7\u5148\u5B8C\u6210\u4EBA\u673A\u9A8C\u8BC1",
|
|
1505
1506
|
timeout: 1e4,
|
|
1506
1507
|
copyright: {
|
|
1507
1508
|
text: "\xA9 xqkeji.cn",
|
|
@@ -1610,7 +1611,14 @@
|
|
|
1610
1611
|
this.outcome = outcome;
|
|
1611
1612
|
}
|
|
1612
1613
|
submit(data) {
|
|
1613
|
-
this.transport.request("POST", this.options.checkUrl, data).then((body) =>
|
|
1614
|
+
this.transport.request("POST", this.options.checkUrl, data).then((body) => {
|
|
1615
|
+
const result = parseCheckResponse(body, this.options.failText);
|
|
1616
|
+
if (result.success) {
|
|
1617
|
+
this.outcome.onSuccess(result);
|
|
1618
|
+
} else {
|
|
1619
|
+
this.outcome.onFailure(result.message || this.options.failText);
|
|
1620
|
+
}
|
|
1621
|
+
}).catch((error) => {
|
|
1614
1622
|
this.outcome.onFailure(failureMessage(error, this.options.failText));
|
|
1615
1623
|
});
|
|
1616
1624
|
}
|
|
@@ -1623,46 +1631,95 @@
|
|
|
1623
1631
|
this.dom = dom;
|
|
1624
1632
|
this.options = options;
|
|
1625
1633
|
this.form = null;
|
|
1634
|
+
this.guard = null;
|
|
1635
|
+
this.fallback = null;
|
|
1626
1636
|
}
|
|
1637
|
+
/** 初始化:解析目标元素,并把守卫设为“未通过”状态以拦截提交。 */
|
|
1638
|
+
mount() {
|
|
1639
|
+
this.resolve();
|
|
1640
|
+
this.block();
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* 未通过验证:守卫模式下写入自定义提示让浏览器拦截提交;
|
|
1644
|
+
* 回退模式下移除动态字段,保持原有无令牌语义。
|
|
1645
|
+
*/
|
|
1646
|
+
block() {
|
|
1647
|
+
if (this.guard) {
|
|
1648
|
+
this.guard.value = "";
|
|
1649
|
+
this.guard.setCustomValidity(this.guardText());
|
|
1650
|
+
} else if (this.fallback) {
|
|
1651
|
+
this.fallback.remove();
|
|
1652
|
+
this.fallback = null;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* 验证通过:守卫模式下清空提示放行并写入令牌;回退模式下动态插入字段。
|
|
1657
|
+
* backend_only 无令牌时,守卫只放行不写值,回退模式不插入字段。
|
|
1658
|
+
*/
|
|
1627
1659
|
sync(token) {
|
|
1628
|
-
|
|
1629
|
-
|
|
1660
|
+
if (this.guard) {
|
|
1661
|
+
this.guard.value = token ?? "";
|
|
1662
|
+
this.guard.setCustomValidity("");
|
|
1630
1663
|
return;
|
|
1631
1664
|
}
|
|
1632
|
-
const
|
|
1633
|
-
if (
|
|
1634
|
-
this.form = trigger.closest("form");
|
|
1635
|
-
}
|
|
1636
|
-
const scope = this.form ?? document;
|
|
1637
|
-
const existing = this.find(name, scope);
|
|
1638
|
-
if (!token) {
|
|
1639
|
-
existing?.remove();
|
|
1640
|
-
return;
|
|
1641
|
-
}
|
|
1642
|
-
if (existing) {
|
|
1643
|
-
existing.value = token;
|
|
1665
|
+
const name = this.options.inputName;
|
|
1666
|
+
if (!name || !token || !this.options.autoInsertInput) {
|
|
1644
1667
|
return;
|
|
1645
1668
|
}
|
|
1646
|
-
if (!
|
|
1669
|
+
if (!this.fallback) {
|
|
1670
|
+
const trigger = this.dom.queryGlobal(this.options.handleDom);
|
|
1671
|
+
if (!trigger) {
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
const input = document.createElement("input");
|
|
1675
|
+
input.type = "hidden";
|
|
1676
|
+
input.name = name;
|
|
1677
|
+
input.value = token;
|
|
1678
|
+
this.fallback = input;
|
|
1679
|
+
if (this.form) {
|
|
1680
|
+
this.form.append(input);
|
|
1681
|
+
} else {
|
|
1682
|
+
trigger.parentNode?.insertBefore(input, trigger.nextSibling);
|
|
1683
|
+
}
|
|
1647
1684
|
return;
|
|
1648
1685
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
if (this.
|
|
1654
|
-
this.
|
|
1655
|
-
|
|
1656
|
-
|
|
1686
|
+
this.fallback.value = token;
|
|
1687
|
+
}
|
|
1688
|
+
/** 销毁时:清空守卫提示并移除动态字段,不删除宿主的静态元素。 */
|
|
1689
|
+
dispose() {
|
|
1690
|
+
if (this.guard) {
|
|
1691
|
+
this.guard.value = "";
|
|
1692
|
+
this.guard.setCustomValidity("");
|
|
1693
|
+
this.guard = null;
|
|
1657
1694
|
}
|
|
1695
|
+
this.fallback?.remove();
|
|
1696
|
+
this.fallback = null;
|
|
1697
|
+
this.form = null;
|
|
1658
1698
|
}
|
|
1699
|
+
/** 兼容旧调用:等同 block(),保留 remove 方法名避免外部破坏。 */
|
|
1659
1700
|
remove() {
|
|
1660
|
-
|
|
1661
|
-
|
|
1701
|
+
this.block();
|
|
1702
|
+
}
|
|
1703
|
+
/** 在触发器所属表单内解析静态守卫元素;找不到则不启用守卫模式。 */
|
|
1704
|
+
resolve() {
|
|
1705
|
+
const name = this.options.inputName;
|
|
1706
|
+
if (!name) {
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
const trigger = this.dom.queryGlobal(this.options.handleDom);
|
|
1710
|
+
if (trigger) {
|
|
1711
|
+
this.form = trigger.closest("form");
|
|
1712
|
+
}
|
|
1713
|
+
const scope = this.form ?? document;
|
|
1714
|
+
const candidate = scope.querySelector(
|
|
1715
|
+
`input[name="${CSS.escape(name)}"]`
|
|
1716
|
+
);
|
|
1717
|
+
if (candidate && candidate.type !== "hidden") {
|
|
1718
|
+
this.guard = candidate;
|
|
1662
1719
|
}
|
|
1663
1720
|
}
|
|
1664
|
-
|
|
1665
|
-
return
|
|
1721
|
+
guardText() {
|
|
1722
|
+
return this.guard?.dataset.xqGuardText || this.options.guardText;
|
|
1666
1723
|
}
|
|
1667
1724
|
};
|
|
1668
1725
|
var OK_VISIBLE_MS = 3e3;
|
|
@@ -2016,6 +2073,7 @@
|
|
|
2016
2073
|
this.bindTools();
|
|
2017
2074
|
this.trigger.bind(() => this.show());
|
|
2018
2075
|
this.bindFormError();
|
|
2076
|
+
this.hiddenInput.mount();
|
|
2019
2077
|
return this;
|
|
2020
2078
|
}
|
|
2021
2079
|
/** 类型特有工具按钮绑定(滑动包还需绑定关闭按钮)。 */
|
|
@@ -2034,7 +2092,7 @@
|
|
|
2034
2092
|
this.clearTimers();
|
|
2035
2093
|
this.state.beginRound();
|
|
2036
2094
|
this.behaviour.resetForShow();
|
|
2037
|
-
this.hiddenInput.
|
|
2095
|
+
this.hiddenInput.block();
|
|
2038
2096
|
this.trigger.showPlaceholder();
|
|
2039
2097
|
this.message.hideOk();
|
|
2040
2098
|
this.modal.open();
|
|
@@ -2058,7 +2116,7 @@
|
|
|
2058
2116
|
this.hide();
|
|
2059
2117
|
this.clearTimers();
|
|
2060
2118
|
this.state.beginRound();
|
|
2061
|
-
this.hiddenInput.
|
|
2119
|
+
this.hiddenInput.block();
|
|
2062
2120
|
this.trigger.showPlaceholder();
|
|
2063
2121
|
this.refresh();
|
|
2064
2122
|
this.callbacks.emit("reset");
|
|
@@ -2113,7 +2171,7 @@
|
|
|
2113
2171
|
this.message.dispose();
|
|
2114
2172
|
this.theme.dispose();
|
|
2115
2173
|
this.modal.dispose();
|
|
2116
|
-
this.hiddenInput.
|
|
2174
|
+
this.hiddenInput.dispose();
|
|
2117
2175
|
if (this.formErrorHandler) {
|
|
2118
2176
|
document.removeEventListener(FORM_ERROR_EVENT, this.formErrorHandler);
|
|
2119
2177
|
this.formErrorHandler = null;
|
|
@@ -2133,9 +2191,7 @@
|
|
|
2133
2191
|
}
|
|
2134
2192
|
this.trigger.showSuccess();
|
|
2135
2193
|
this.message.show(this.options.successText, true);
|
|
2136
|
-
|
|
2137
|
-
this.hiddenInput.sync(this.getToken());
|
|
2138
|
-
}
|
|
2194
|
+
this.hiddenInput.sync(this.getToken());
|
|
2139
2195
|
this.clearSuccessTimer();
|
|
2140
2196
|
this.successHideTimer = window.setTimeout(() => {
|
|
2141
2197
|
this.successHideTimer = null;
|
|
@@ -2147,7 +2203,7 @@
|
|
|
2147
2203
|
this.state.busy = false;
|
|
2148
2204
|
this.state.passed = false;
|
|
2149
2205
|
this.state.token = null;
|
|
2150
|
-
this.hiddenInput.
|
|
2206
|
+
this.hiddenInput.block();
|
|
2151
2207
|
this.behaviour.markFailures();
|
|
2152
2208
|
this.modal.shake();
|
|
2153
2209
|
this.message.show(message, false);
|
|
@@ -2994,6 +3050,10 @@
|
|
|
2994
3050
|
const image = await loadImage(data.image_base64);
|
|
2995
3051
|
this.canvas.setVisible(true);
|
|
2996
3052
|
this.canvas.measure();
|
|
3053
|
+
this.ctx.state.maxOffset = Math.max(
|
|
3054
|
+
0,
|
|
3055
|
+
Math.round((this.ctx.state.imgWidth - this.ctx.state.markWidth) * this.ctx.state.scale)
|
|
3056
|
+
);
|
|
2997
3057
|
this.canvas.drawBackground(image);
|
|
2998
3058
|
this.canvas.clearMark();
|
|
2999
3059
|
this.layer.setImage(image);
|
|
@@ -3140,7 +3200,7 @@ bootstrap/js/dist/modal.js:
|
|
|
3140
3200
|
xq-captcha-core/dist/logic.mjs:
|
|
3141
3201
|
xq-captcha-core/dist/index.mjs:
|
|
3142
3202
|
(*!
|
|
3143
|
-
* xq-captcha-core v1.
|
|
3203
|
+
* xq-captcha-core v1.1.0 (https://xqkeji.cn/)
|
|
3144
3204
|
* Author xqkeji.cn
|
|
3145
3205
|
* LICENSE AGPL-3.0-only
|
|
3146
3206
|
* Copyright 2026 xqkeji.cn
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* xq-slide-captcha v1.
|
|
2
|
+
* xq-slide-captcha v1.1.0 (https://xqkeji.cn/demo/xq-slide-captcha)
|
|
3
3
|
* Author xqkeji.cn
|
|
4
4
|
* LICENSE AGPL-3.0-only
|
|
5
5
|
* Copyright 2026 xqkeji.cn
|
|
6
6
|
*/
|
|
7
|
-
"use strict";(()=>{var i=Object.create;var r=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var n=Object.getPrototypeOf;var l=Object.prototype.hasOwnProperty;var t=(e,s)=>function t(){return s||(0,e[a(e)[0]])((s={exports:{}}).exports,s),s.exports};var c=(e,s,i,n)=>{if(s&&typeof s==="object"||typeof s==="function"){for(let t of a(s))if(!l.call(e,t)&&t!==i)r(e,t,{get:()=>s[t],enumerable:!(n=o(s,t))||n.enumerable})}return e};var e=(t,e,s)=>(s=t!=null?i(n(t)):{},c(e||!t||!t.__esModule?r(s,"default",{value:t,enumerable:true}):s,t));var h=t({"node_modules/bootstrap/js/dist/dom/data.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e():typeof define==="function"&&define.amd?define(e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Data=e())})(s,function(){"use strict";const n=new Map;const t={set(t,e,s){if(!n.has(t)){n.set(t,new Map)}const i=n.get(t);if(!i.has(e)&&i.size!==0){console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(i.keys())[0]}.`);return}i.set(e,s)},get(t,e){if(n.has(t)){return n.get(t).get(e)||null}return null},remove(t,e){if(!n.has(t)){return}const s=n.get(t);s.delete(e);if(s.size===0){n.delete(t)}}};return t})}});var d=t({"node_modules/bootstrap/js/dist/util/index.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?e(s):typeof define==="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.Index={}))})(s,function(t){"use strict";const e=1e6;const r=1e3;const a="transitionend";const s=t=>{if(t&&window.CSS&&window.CSS.escape){t=t.replace(/#([^\s"#']+)/g,(t,e)=>`#${CSS.escape(e)}`)}return t};const i=t=>{if(t===null||t===void 0){return`${t}`}return Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase()};const n=t=>{do{t+=Math.floor(Math.random()*e)}while(document.getElementById(t));return t};const l=t=>{if(!t){return 0}let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e);const n=Number.parseFloat(s);if(!i&&!n){return 0}e=e.split(",")[0];s=s.split(",")[0];return(Number.parseFloat(e)+Number.parseFloat(s))*r};const c=t=>{t.dispatchEvent(new Event(a))};const o=t=>{if(!t||typeof t!=="object"){return false}if(typeof t.jquery!=="undefined"){t=t[0]}return typeof t.nodeType!=="undefined"};const h=t=>{if(o(t)){return t.jquery?t[0]:t}if(typeof t==="string"&&t.length>0){return document.querySelector(s(t))}return null};const d=t=>{if(!o(t)||t.getClientRects().length===0){return false}const e=getComputedStyle(t).getPropertyValue("visibility")==="visible";const s=t.closest("details:not([open])");if(!s){return e}if(s!==t){const i=t.closest("summary");if(i&&i.parentNode!==s){return false}if(i===null){return false}}return e};const u=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE){return true}if(t.classList.contains("disabled")){return true}if(typeof t.disabled!=="undefined"){return t.disabled}return t.hasAttribute("disabled")&&t.getAttribute("disabled")!=="false"};const f=t=>{if(!document.documentElement.attachShadow){return null}if(typeof t.getRootNode==="function"){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}if(t instanceof ShadowRoot){return t}if(!t.parentNode){return null}return f(t.parentNode)};const m=()=>{};const p=t=>{t.offsetHeight};const g=()=>{if(window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")){return window.jQuery}return null};const b=[];const y=t=>{if(document.readyState==="loading"){if(!b.length){document.addEventListener("DOMContentLoaded",()=>{for(const t of b){t()}})}b.push(t)}else{t()}};const v=()=>document.documentElement.dir==="rtl";const w=i=>{y(()=>{const t=g();if(t){const e=i.NAME;const s=t.fn[e];t.fn[e]=i.jQueryInterface;t.fn[e].Constructor=i;t.fn[e].noConflict=()=>{t.fn[e]=s;return i.jQueryInterface}}})};const k=(t,e=[],s=t)=>{return typeof t==="function"?t.call(...e):s};const _=(e,s,t=true)=>{if(!t){k(e);return}const i=5;const n=l(s)+i;let r=false;const o=({target:t})=>{if(t!==s){return}r=true;s.removeEventListener(a,o);k(e)};s.addEventListener(a,o);setTimeout(()=>{if(!r){c(s)}},n)};const x=(t,e,s,i)=>{const n=t.length;let r=t.indexOf(e);if(r===-1){return!s&&i?t[n-1]:t[0]}r+=s?1:-1;if(i){r=(r+n)%n}return t[Math.max(0,Math.min(r,n-1))]};t.defineJQueryPlugin=w;t.execute=k;t.executeAfterTransition=_;t.findShadowRoot=f;t.getElement=h;t.getNextActiveElement=x;t.getTransitionDurationFromElement=l;t.getUID=n;t.getjQuery=g;t.isDisabled=u;t.isElement=o;t.isRTL=v;t.isVisible=d;t.noop=m;t.onDOMContentLoaded=y;t.parseSelector=s;t.reflow=p;t.toType=i;t.triggerTransitionEnd=c;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})}});var u=t({"node_modules/bootstrap/js/dist/dom/event-handler.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(d()):typeof define==="function"&&define.amd?define(["../util/index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.EventHandler=e(t.Index))})(s,function(d){"use strict";const m=/[^.]*(?=\..*)\.|.*/;const e=/\..*/;const p=/::\d+$/;const s={};let i=1;const g={mouseenter:"mouseover",mouseleave:"mouseout"};const o=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function b(t,e){return e&&`${e}::${i++}`||t.uidEvent||i++}function y(t){const e=b(t);t.uidEvent=e;s[e]=s[e]||{};return s[e]}function v(s,i){return function t(e){f(e,{delegateTarget:s});if(t.oneOff){l.off(s,e.type,i)}return i.apply(s,[e])}}function w(r,o,a){return function e(s){const i=r.querySelectorAll(o);for(let{target:t}=s;t&&t!==this;t=t.parentNode){for(const n of i){if(n!==t){continue}f(s,{delegateTarget:t});if(e.oneOff){l.off(r,s.type,o,a)}return a.apply(t,[s])}}}}function k(t,e,s=null){return Object.values(t).find(t=>t.callable===e&&t.delegationSelector===s)}function _(t,e,s){const i=typeof e==="string";const n=i?s:e||s;let r=u(t);if(!o.has(r)){r=t}return[i,n,r]}function n(t,e,s,i,n){if(typeof e!=="string"||!t){return}let[r,o,a]=_(e,s,i);if(e in g){const f=e=>{return function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget)){return e.call(this,t)}}};o=f(o)}const l=y(t);const c=l[a]||(l[a]={});const h=k(c,o,r?s:null);if(h){h.oneOff=h.oneOff&&n;return}const d=b(o,e.replace(m,""));const u=r?w(t,s,o):v(t,o);u.delegationSelector=r?s:null;u.callable=o;u.oneOff=n;u.uidEvent=d;c[d]=u;t.addEventListener(a,u,r)}function x(t,e,s,i,n){const r=k(e[s],i,n);if(!r){return}t.removeEventListener(s,r,Boolean(n));delete e[s][r.uidEvent]}function E(t,e,s,i){const n=e[s]||{};for(const[r,o]of Object.entries(n)){if(r.includes(i)){x(t,e,s,o.callable,o.delegationSelector)}}}function u(t){t=t.replace(e,"");return g[t]||t}const l={on(t,e,s,i){n(t,e,s,i,false)},one(t,e,s,i){n(t,e,s,i,true)},off(t,e,s,i){if(typeof e!=="string"||!t){return}const[n,r,o]=_(e,s,i);const a=o!==e;const l=y(t);const c=l[o]||{};const h=e.startsWith(".");if(typeof r!=="undefined"){if(!Object.keys(c).length){return}x(t,l,o,r,n?s:null);return}if(h){for(const d of Object.keys(l)){E(t,l,d,e.slice(1))}}for(const[u,f]of Object.entries(c)){const m=u.replace(p,"");if(!a||e.includes(m)){x(t,l,o,f.callable,f.delegationSelector)}}},trigger(t,e,s){if(typeof e!=="string"||!t){return null}const i=d.getjQuery();const n=u(e);const r=e!==n;let o=null;let a=true;let l=true;let c=false;if(r&&i){o=i.Event(e,s);i(t).trigger(o);a=!o.isPropagationStopped();l=!o.isImmediatePropagationStopped();c=o.isDefaultPrevented()}const h=f(new Event(e,{bubbles:a,cancelable:true}),s);if(c){h.preventDefault()}if(l){t.dispatchEvent(h)}if(h.defaultPrevented&&o){o.preventDefault()}return h}};function f(e,t={}){for(const[s,i]of Object.entries(t)){try{e[s]=i}catch(t){Object.defineProperty(e,s,{configurable:true,get(){return i}})}}return e}return l})}});var f=t({"node_modules/bootstrap/js/dist/dom/manipulator.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e():typeof define==="function"&&define.amd?define(e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Manipulator=e())})(s,function(){"use strict";function n(e){if(e==="true"){return true}if(e==="false"){return false}if(e===Number(e).toString()){return Number(e)}if(e===""||e==="null"){return null}if(typeof e!=="string"){return e}try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function i(t){return t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}const t={setDataAttribute(t,e,s){t.setAttribute(`data-bs-${i(e)}`,s)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${i(e)}`)},getDataAttributes(e){if(!e){return{}}const s={};const t=Object.keys(e.dataset).filter(t=>t.startsWith("bs")&&!t.startsWith("bsConfig"));for(const i of t){let t=i.replace(/^bs/,"");t=t.charAt(0).toLowerCase()+t.slice(1);s[t]=n(e.dataset[i])}return s},getDataAttribute(t,e){return n(t.getAttribute(`data-bs-${i(e)}`))}};return t})}});var m=t({"node_modules/bootstrap/js/dist/util/config.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(f(),d()):typeof define==="function"&&define.amd?define(["../dom/manipulator","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Config=e(t.Manipulator,t.Index))})(s,function(i,o){"use strict";class t{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){t=this._mergeConfigObj(t);t=this._configAfterMerge(t);this._typeCheckConfig(t);return t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const s=o.isElement(e)?i.getDataAttribute(e,"config"):{};return{...this.constructor.Default,...typeof s==="object"?s:{},...o.isElement(e)?i.getDataAttributes(e):{},...typeof t==="object"?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const[s,i]of Object.entries(e)){const n=t[s];const r=o.isElement(n)?"element":o.toType(n);if(!new RegExp(i).test(r)){throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${s}" provided type "${r}" but expected type "${i}".`)}}}}return t})}});var p=t({"node_modules/bootstrap/js/dist/base-component.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(h(),u(),m(),d()):typeof define==="function"&&define.amd?define(["./dom/data","./dom/event-handler","./util/config","./util/index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.BaseComponent=e(t.Data,t.EventHandler,t.Config,t.Index))})(s,function(s,e,t,i){"use strict";const n="5.3.9";class r extends t{constructor(t,e){super();t=i.getElement(t);if(!t){return}this._element=t;this._config=this._getConfig(e);s.set(this._element,this.constructor.DATA_KEY,this)}dispose(){s.remove(this._element,this.constructor.DATA_KEY);e.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this)){this[t]=null}}_queueCallback(t,e,s=true){i.executeAfterTransition(t,e,s)}_getConfig(t){t=this._mergeConfigObj(t,this._element);t=this._configAfterMerge(t);this._typeCheckConfig(t);return t}static getInstance(t){return s.get(i.getElement(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,typeof e==="object"?e:null)}static get VERSION(){return n}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}return r})}});var g=t({"node_modules/bootstrap/js/dist/dom/selector-engine.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(d()):typeof define==="function"&&define.amd?define(["../util/index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.SelectorEngine=e(t.Index))})(s,function(i){"use strict";const s=e=>{let s=e.getAttribute("data-bs-target");if(!s||s==="#"){let t=e.getAttribute("href");if(!t||!t.includes("#")&&!t.startsWith(".")){return null}if(t.includes("#")&&!t.startsWith("#")){t=`#${t.split("#")[1]}`}s=t&&t!=="#"?t.trim():null}return s?s.split(",").map(t=>i.parseSelector(t)).join(","):null};const n={find(t,e=document.documentElement){return[].concat(...Element.prototype.querySelectorAll.call(e,t))},findOne(t,e=document.documentElement){return Element.prototype.querySelector.call(e,t)},children(t,e){return[].concat(...t.children).filter(t=>t.matches(e))},parents(t,e){const s=[];let i=t.parentNode.closest(e);while(i){s.push(i);i=i.parentNode.closest(e)}return s},prev(t,e){let s=t.previousElementSibling;while(s){if(s.matches(e)){return[s]}s=s.previousElementSibling}return[]},next(t,e){let s=t.nextElementSibling;while(s){if(s.matches(e)){return[s]}s=s.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(t=>`${t}:not([tabindex^="-"])`).join(",");return this.find(e,t).filter(t=>!i.isDisabled(t)&&i.isVisible(t))},getSelectorFromElement(t){const e=s(t);if(e){return n.findOne(e)?e:null}return null},getElementFromSelector(t){const e=s(t);return e?n.findOne(e):null},getMultipleElementsFromSelector(t){const e=s(t);return e?n.find(e):[]}};return n})}});var b=t({"node_modules/bootstrap/js/dist/util/backdrop.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(u(),m(),d()):typeof define==="function"&&define.amd?define(["../dom/event-handler","./config","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Backdrop=e(t.EventHandler,t.Config,t.Index))})(s,function(e,t,s){"use strict";const i="backdrop";const n="fade";const r="show";const o=`mousedown.bs.${i}`;const a={className:"modal-backdrop",clickCallback:null,isAnimated:false,isVisible:true,rootElement:"body"};const l={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class c extends t{constructor(t){super();this._config=this._getConfig(t);this._isAppended=false;this._element=null}static get Default(){return a}static get DefaultType(){return l}static get NAME(){return i}show(t){if(!this._config.isVisible){s.execute(t);return}this._append();const e=this._getElement();if(this._config.isAnimated){s.reflow(e)}e.classList.add(r);this._emulateAnimation(()=>{s.execute(t)})}hide(t){if(!this._config.isVisible){s.execute(t);return}this._getElement().classList.remove(r);this._emulateAnimation(()=>{this.dispose();s.execute(t)})}dispose(){if(!this._isAppended){return}e.off(this._element,o);this._element.remove();this._isAppended=false}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className;if(this._config.isAnimated){t.classList.add(n)}this._element=t}return this._element}_configAfterMerge(t){t.rootElement=s.getElement(t.rootElement);return t}_append(){if(this._isAppended){return}const t=this._getElement();this._config.rootElement.append(t);e.on(t,o,()=>{s.execute(this._config.clickCallback)});this._isAppended=true}_emulateAnimation(t){s.executeAfterTransition(t,this._getElement(),this._config.isAnimated)}}return c})}});var y=t({"node_modules/bootstrap/js/dist/util/component-functions.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?e(s,u(),g(),d()):typeof define==="function"&&define.amd?define(["exports","../dom/event-handler","../dom/selector-engine","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.ComponentFunctions={},t.EventHandler,t.SelectorEngine,t.Index))})(s,function(t,e,o,a){"use strict";const s=(i,n="hide")=>{const t=`click.dismiss${i.EVENT_KEY}`;const r=i.NAME;e.on(document,t,`[data-bs-dismiss="${r}"]`,function(t){if(["A","AREA"].includes(this.tagName)){t.preventDefault()}if(a.isDisabled(this)){return}const e=o.getElementFromSelector(this)||this.closest(`.${r}`);const s=i.getOrCreateInstance(e);s[n]()})};t.enableDismissTrigger=s;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})}});var v=t({"node_modules/bootstrap/js/dist/util/focustrap.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(u(),g(),m()):typeof define==="function"&&define.amd?define(["../dom/event-handler","../dom/selector-engine","./config"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Focustrap=e(t.EventHandler,t.SelectorEngine,t.Config))})(s,function(t,i,e){"use strict";const s="focustrap";const n="bs.focustrap";const r=`.${n}`;const o=`focusin${r}`;const a=`keydown.tab${r}`;const l="Tab";const c="forward";const h="backward";const d={autofocus:true,trapElement:null};const u={autofocus:"boolean",trapElement:"element"};class f extends e{constructor(t){super();this._config=this._getConfig(t);this._isActive=false;this._lastTabNavDirection=null}static get Default(){return d}static get DefaultType(){return u}static get NAME(){return s}activate(){if(this._isActive){return}if(this._config.autofocus){this._config.trapElement.focus()}t.off(document,r);t.on(document,o,t=>this._handleFocusin(t));t.on(document,a,t=>this._handleKeydown(t));this._isActive=true}deactivate(){if(!this._isActive){return}this._isActive=false;t.off(document,r)}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target)){return}const s=i.focusableChildren(e);if(s.length===0){e.focus()}else if(this._lastTabNavDirection===h){s[s.length-1].focus()}else{s[0].focus()}}_handleKeydown(t){if(t.key!==l){return}this._lastTabNavDirection=t.shiftKey?h:c}}return f})}});var N=t({"node_modules/bootstrap/js/dist/util/scrollbar.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(f(),g(),d()):typeof define==="function"&&define.amd?define(["../dom/manipulator","../dom/selector-engine","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Scrollbar=e(t.Manipulator,t.SelectorEngine,t.Index))})(s,function(i,n,r){"use strict";const t=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";const s=".sticky-top";const o="padding-right";const a="margin-right";class e{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const e=this.getWidth();this._disableOverFlow();this._setElementAttributes(this._element,o,t=>t+e);this._setElementAttributes(t,o,t=>t+e);this._setElementAttributes(s,a,t=>t-e)}reset(){this._resetElementAttributes(this._element,"overflow");this._resetElementAttributes(this._element,o);this._resetElementAttributes(t,o);this._resetElementAttributes(s,a)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow");this._element.style.overflow="hidden"}_setElementAttributes(t,s,i){const n=this.getWidth();const e=t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n){return}this._saveInitialAttribute(t,s);const e=window.getComputedStyle(t).getPropertyValue(s);t.style.setProperty(s,`${i(Number.parseFloat(e))}px`)};this._applyManipulationCallback(t,e)}_saveInitialAttribute(t,e){const s=t.style.getPropertyValue(e);if(s){i.setDataAttribute(t,e,s)}}_resetElementAttributes(t,s){const e=t=>{const e=i.getDataAttribute(t,s);if(e===null){t.style.removeProperty(s);return}i.removeDataAttribute(t,s);t.style.setProperty(s,e)};this._applyManipulationCallback(t,e)}_applyManipulationCallback(t,e){if(r.isElement(t)){e(t);return}for(const s of n.find(t,this._element)){e(s)}}}return e})}});var $=t({"node_modules/bootstrap/js/dist/modal.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(p(),u(),g(),b(),y(),v(),d(),N()):typeof define==="function"&&define.amd?define(["./base-component","./dom/event-handler","./dom/selector-engine","./util/backdrop","./util/component-functions","./util/focustrap","./util/index","./util/scrollbar"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Modal=e(t.BaseComponent,t.EventHandler,t.SelectorEngine,t.Backdrop,t.ComponentFunctions,t.Focustrap,t.Index,t.Scrollbar))})(s,function(t,n,r,e,s,i,o,a){"use strict";const l="modal";const c="bs.modal";const h=`.${c}`;const d=".data-api";const u="Escape";const f=`hide${h}`;const m=`hidePrevented${h}`;const p=`hidden${h}`;const g=`show${h}`;const b=`shown${h}`;const y=`resize${h}`;const v=`click.dismiss${h}`;const w=`mousedown.dismiss${h}`;const k=`keydown.dismiss${h}`;const _=`click${h}${d}`;const x="modal-open";const E="fade";const T="show";const S="modal-static";const C=".modal.show";const A=".modal-dialog";const q=".modal-body";const j='[data-bs-toggle="modal"]';const O={backdrop:true,focus:true,keyboard:true};const L={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class D extends t{constructor(t,e){super(t,e);this._dialog=r.findOne(A,this._element);this._backdrop=this._initializeBackDrop();this._focustrap=this._initializeFocusTrap();this._isShown=false;this._isTransitioning=false;this._scrollBar=new a;this._addEventListeners()}static get Default(){return O}static get DefaultType(){return L}static get NAME(){return l}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown||this._isTransitioning){return}const e=n.trigger(this._element,g,{relatedTarget:t});if(e.defaultPrevented){return}this._isShown=true;this._isTransitioning=true;this._scrollBar.hide();document.body.classList.add(x);this._adjustDialog();this._backdrop.show(()=>this._showElement(t))}hide(){if(!this._isShown||this._isTransitioning){return}const t=n.trigger(this._element,f);if(t.defaultPrevented){return}this._isShown=false;this._isTransitioning=true;this._focustrap.deactivate();this._element.classList.remove(T);this._queueCallback(()=>this._hideModal(),this._element,this._isAnimated())}dispose(){n.off(window,h);n.off(this._dialog,h);this._backdrop.dispose();this._focustrap.deactivate();super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new e({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new i({trapElement:this._element})}_showElement(t){if(!document.body.contains(this._element)){document.body.append(this._element)}this._element.style.display="block";this._element.removeAttribute("aria-hidden");this._element.setAttribute("aria-modal",true);this._element.setAttribute("role","dialog");this._element.scrollTop=0;const e=r.findOne(q,this._dialog);if(e){e.scrollTop=0}o.reflow(this._element);this._element.classList.add(T);const s=()=>{if(this._config.focus){this._focustrap.activate()}this._isTransitioning=false;n.trigger(this._element,b,{relatedTarget:t})};this._queueCallback(s,this._dialog,this._isAnimated())}_addEventListeners(){n.on(this._element,k,t=>{if(t.key!==u){return}if(this._config.keyboard){this.hide();return}this._triggerBackdropTransition()});n.on(window,y,()=>{if(this._isShown&&!this._isTransitioning){this._adjustDialog()}});n.on(this._element,w,e=>{n.one(this._element,v,t=>{if(this._element!==e.target||this._element!==t.target){return}if(this._config.backdrop==="static"){this._triggerBackdropTransition();return}if(this._config.backdrop){this.hide()}})})}_hideModal(){this._element.style.display="none";this._element.setAttribute("aria-hidden",true);this._element.removeAttribute("aria-modal");this._element.removeAttribute("role");this._isTransitioning=false;this._backdrop.hide(()=>{document.body.classList.remove(x);this._resetAdjustments();this._scrollBar.reset();n.trigger(this._element,p)})}_isAnimated(){return this._element.classList.contains(E)}_triggerBackdropTransition(){const t=n.trigger(this._element,m);if(t.defaultPrevented){return}const e=this._element.scrollHeight>document.documentElement.clientHeight;const s=this._element.style.overflowY;if(s==="hidden"||this._element.classList.contains(S)){return}if(!e){this._element.style.overflowY="hidden"}this._element.classList.add(S);this._queueCallback(()=>{this._element.classList.remove(S);this._queueCallback(()=>{this._element.style.overflowY=s},this._dialog)},this._dialog);this._element.focus()}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight;const e=this._scrollBar.getWidth();const s=e>0;if(s&&!t){const i=o.isRTL()?"paddingLeft":"paddingRight";this._element.style[i]=`${e}px`}if(!s&&t){const i=o.isRTL()?"paddingRight":"paddingLeft";this._element.style[i]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="";this._element.style.paddingRight=""}static jQueryInterface(e,s){return this.each(function(){const t=D.getOrCreateInstance(this,e);if(typeof e!=="string"){return}if(typeof t[e]==="undefined"){throw new TypeError(`No method named "${e}"`)}t[e](s)})}}n.on(document,_,j,function(t){const e=r.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)){t.preventDefault()}n.one(e,g,t=>{if(t.defaultPrevented){return}n.one(e,p,()=>{if(o.isVisible(this)){this.focus()}})});const s=r.findOne(C);if(s){D.getInstance(s).hide()}const i=D.getOrCreateInstance(e);i.toggle(this)});s.enableDismissTrigger(D);o.defineJQueryPlugin(D);return D})}});var R=class{constructor(t){this.logPrefix=t;this.handlers=new Map}set(t,e){this.handlers.set(t,e)}emit(e,...t){const s=this.handlers.get(e);if(!s){return}try{s(...t)}catch(t){console.error(`${this.logPrefix}: ${e} \u56DE\u8C03\u629B\u51FA\u5F02\u5E38`,t)}}};var w=class{constructor(t,e,s){this.options=t;this.transport=e;this.expectedType=s}async load(){const t=await this.transport.request("GET",this.options.dataUrl);const e=JSON.parse(t);if(!F(e,this.expectedType)){throw new Error("验证码数据格式不正确")}return e}};function F(t,e){return typeof t==="object"&&t!==null&&typeof t.success==="boolean"&&(t.type===e||t.type===null)&&typeof t.image_base64==="string"}var H=class{constructor(){this.cache=new Map;this.root=document}setRoot(t){if(this.root!==t){this.root=t;this.cache.clear()}}query(t){const e=this.cache.get(t);if(e?.isConnected){return e}const s=this.root.querySelector(t);if(s){this.cache.set(t,s)}else{this.cache.delete(t)}return s}queryAll(t){return Array.from(this.root.querySelectorAll(t))}queryGlobal(t){return document.querySelector(t)}queryAllGlobal(t){return Array.from(document.querySelectorAll(t))}};var k=class extends Error{constructor(t,e){super(`captcha request failed: ${t}`);this.status=t;this.body=e;this.name="HttpError"}};var B=class{constructor(t){this.timeout=t}async request(t,e,s){const i=new AbortController;const n=setTimeout(()=>i.abort(),this.timeout);let r=e;let o;if(s){const l=new URLSearchParams(s).toString();if(t==="GET"){r+=(e.includes("?")?"&":"?")+l}else{o=l}}const a={Accept:"application/json, text/plain, */*"};if(o!==void 0){a["Content-Type"]="application/x-www-form-urlencoded"}try{const c=await fetch(r,{method:t,body:o,headers:a,signal:i.signal,credentials:"same-origin"});const h=await c.text();if(!c.ok){throw new k(c.status,h)}return h}catch(t){if(t instanceof k){throw t}throw new k(i.signal.aborted?-1:0,"")}finally{clearTimeout(n)}}};var P={handleDom:".xq-captcha",dataUrl:"/admin/user/captchadata",checkUrl:"/admin/user/captchacheck",placeholder:"点击按钮进行验证",successText:"✓ 验证成功",failText:"验证失败,请重试",showClose:true,showRefresh:true,showRipple:true,theme:"auto",inputName:"xq_captcha_token",autoInsertInput:true,timeout:1e4,copyright:{text:"© xqkeji.cn",url:"https://xqkeji.cn/",title:"xqkeji.cn"}};function _(t,e={}){return{...t,...e,copyright:{...t.copyright,...e.copyright}}}function x(t){return t.transport??new B(t.timeout)}var U=class{constructor(t){this.type=t;this.imgWidth=240;this.imgHeight=150;this.scale=1;this.invScale=1;this.imgLoaded=false;this.busy=false;this.passed=false;this.token=null;this.markWidth=50;this.markTopY=0;this.markOffset=0;this.maxOffset=0;this.moving=false;this.rafId=null;this.charCount=4}beginRound(){this.passed=false;this.token=null;this.busy=false;this.imgLoaded=false}beginRefresh(){this.imgLoaded=false;this.busy=false}cancelFrame(){if(this.rafId!==null){cancelAnimationFrame(this.rafId);this.rafId=null}}};var W=new Set(["ok",'"ok"',"true","1"]);function E(t){return typeof t==="string"&&t!==""?t:null}function Y(t,e){let s;try{s=JSON.parse(t)}catch{s=null}if(typeof s!=="object"||s===null){return{success:W.has(t.trim().toLowerCase()),token:null,message:e}}const i=s;return{success:i.success===true||i.code===200||i.status==="ok"||i.status==="success",token:E(i.token),message:E(i.message)??E(i.error)??e}}function K(t,e){if(!(t instanceof k)){return e}if(t.status===-1){return"请求超时,请重试"}if(t.status===0){return"网络错误,请检查网络连接"}try{const s=JSON.parse(t.body);if(typeof s==="object"&&s!==null){const i=s;const n=E(i.message)??E(i.error);if(n){return n}}}catch{}return t.body?t.body.slice(0,100):e}var T=class{constructor(t,e,s){this.options=t;this.transport=e;this.outcome=s}submit(t){this.transport.request("POST",this.options.checkUrl,t).then(t=>this.outcome.onSuccess(Y(t,this.options.failText))).catch(t=>{this.outcome.onFailure(K(t,this.options.failText))})}};var s=e($(),1);var V=class{constructor(t,e){this.dom=t;this.options=e;this.form=null}sync(t){const e=this.options.inputName;if(!e){return}const s=this.dom.queryGlobal(this.options.handleDom);if(s){this.form=s.closest("form")}const i=this.form??document;const n=this.find(e,i);if(!t){n?.remove();return}if(n){n.value=t;return}if(!s){return}const r=document.createElement("input");r.type="hidden";r.name=e;r.value=t;if(this.form){this.form.append(r)}else{s.parentNode?.insertBefore(r,s.nextSibling)}}remove(){if(this.options.inputName){this.find(this.options.inputName,this.form??document)?.remove()}}find(t,e){return e.querySelector(`input[name="${CSS.escape(t)}"]`)}};var z=3e3;var Q=2e3;var G=150;var J=class{constructor(t,e){this.dom=t;this.selectors=e;this.timers=[]}show(t,e){this.clearTimers();const s=this.dom.query(e?this.selectors.msgOk:this.selectors.msgError);const i=this.dom.query(e?this.selectors.msgError:this.selectors.msgOk);if(i){i.classList.remove("show");i.hidden=true}if(!s){return}s.textContent=t;s.hidden=false;void s.offsetWidth;s.classList.add("show");this.timers.push(window.setTimeout(()=>{s.classList.remove("show");this.timers.push(window.setTimeout(()=>{s.hidden=true},G))},e?z:Q))}hideOk(){const t=this.dom.query(this.selectors.msgOk);if(t){t.classList.remove("show");t.hidden=true}}dispose(){this.clearTimers()}clearTimers(){for(const t of this.timers){clearTimeout(t)}this.timers=[]}};var X=500;var Z=class{constructor(t,e,s,i,n={}){this.dom=t;this.modalSelector=e;this.contentSelector=s;this.shakeClass=i;this.hooks=n;this.instance=null;this.shakeTimer=null;this.hideHandler=null;this.shownHandler=null;this.programmatic=false}get element(){return this.dom.queryGlobal(this.modalSelector)}mount(){const t=this.element;if(!t){return}if(this.shownHandler){t.removeEventListener("shown.bs.modal",this.shownHandler)}this.shownHandler=()=>this.hooks.onShown?.();t.addEventListener("shown.bs.modal",this.shownHandler);if(!this.instance){this.instance=s.default.getOrCreateInstance(t,{backdrop:true,keyboard:true,focus:true})}if(!this.hideHandler){this.hideHandler=()=>{if(!this.programmatic){this.hooks.onUserClose?.()}this.programmatic=false};t.addEventListener("hide.bs.modal",this.hideHandler)}}open(){this.ensureInstance().show()}close(){const t=this.element;if(!t||!s.default.getInstance(t)){return}this.programmatic=true;this.instance?.hide()}setType(t){this.element?.setAttribute("data-xq-captcha-type",t)}shake(){const t=this.dom.query(this.contentSelector);if(!t){return}t.classList.add(this.shakeClass);this.clearShakeTimer();this.shakeTimer=window.setTimeout(()=>{t.classList.remove(this.shakeClass);this.shakeTimer=null},X)}dispose(){this.clearShakeTimer();const t=this.element;if(!t){this.instance=null;return}if(this.hideHandler){t.removeEventListener("hide.bs.modal",this.hideHandler)}if(this.shownHandler){t.removeEventListener("shown.bs.modal",this.shownHandler)}const e=()=>{this.instance?.dispose();t.remove();this.instance=null;this.sweepBackdrop()};if(this.instance&&t.classList.contains("show")){t.addEventListener("hidden.bs.modal",e,{once:true});this.instance.hide();window.setTimeout(()=>{if(this.instance){e()}},600)}else{e()}}ensureInstance(){if(this.instance){return this.instance}const t=this.element;this.instance=t?s.default.getOrCreateInstance(t):null;return this.instance}sweepBackdrop(){if(document.querySelector(".modal.show")){return}for(const t of document.querySelectorAll(".modal-backdrop")){t.remove()}document.body.classList.remove("modal-open");document.body.style.removeProperty("padding-right")}clearShakeTimer(){if(this.shakeTimer!==null){clearTimeout(this.shakeTimer);this.shakeTimer=null}}};var tt=class{constructor(t,e){this.dom=t;this.modalSelector=e;this.current="auto";this.media=null;this.onSystemChange=()=>{if(this.current==="auto"){this.write(this.resolve())}}}apply(t){this.current=t||"auto";if(this.current==="auto"){this.media??(this.media=window.matchMedia("(prefers-color-scheme: dark)"));this.media.addEventListener("change",this.onSystemChange)}else{this.media?.removeEventListener("change",this.onSystemChange)}this.write(this.resolve())}dispose(){this.media?.removeEventListener("change",this.onSystemChange);this.media=null}resolve(){if(this.current==="light"||this.current==="dark"){return this.current}return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}write(t){this.dom.queryGlobal(this.modalSelector)?.setAttribute("data-bs-theme",t)}};var et=class{constructor(t,e,s,i){this.dom=t;this.options=e;this.classes=s;this.triggerSelector=i;this.bound=new Set;this.handler=null;this.useBtnSuccess=false}bind(t){this.detach();this.handler=t;for(const e of this.nodes()){e.classList.add("btn","btn-outline-primary");this.render(e,this.options.placeholder,this.options.showRipple);this.bound.add(e);e.addEventListener("click",t)}}detach(){if(this.handler){for(const t of this.bound){t.removeEventListener("click",this.handler)}}this.bound.clear();this.handler=null}showPlaceholder(){this.renderAll(this.options.placeholder,this.options.showRipple)}showSuccess(){this.renderAll(this.options.successText,false)}showFail(){this.renderAll(this.options.failText,false)}setSuccessStyle(t){this.useBtnSuccess=t}renderAll(t,e){for(const s of this.nodes()){this.render(s,t,e)}}render(t,e,s){t.textContent=e;t.classList.remove(this.classes.verified,"btn-success");t.classList.toggle(this.classes.ripple,s);if(this.useBtnSuccess){t.classList.add("btn-success");t.classList.remove("btn-outline-primary")}}nodes(){return this.dom.queryAllGlobal(this.options.handleDom||this.triggerSelector)}};var st=2e3;var it=1200;var S="xq.form.error";var nt=class{bindContext(t){this.ctx=t;this.onContextReady()}onContextReady(){}};var rt=class{constructor(t,e,s={}){this.behaviour=t;this.hooks=e;this.successHideTimer=null;this.failRefreshTimer=null;this.formErrorHandler=null;this.outcome={onSuccess:t=>this.handleSuccess(t),onFailure:t=>this.handleFail(t)};this.options=_(e.defaultOptions,s);this.dom=new H;this.state=new U(e.type);this.callbacks=new R(e.logPrefix);t.bindContext({dom:this.dom,state:this.state,options:this.options,type:e.type,submit:t=>this.submit(t),emitRefresh:()=>this.emitRefresh()});this.modal=new Z(this.dom,e.modalSelector,e.contentSelector,e.shakeClass,{onUserClose:e.useModalCloseHook?()=>{this.callbacks.emit("close");this.callbacks.emit("hide")}:void 0,onShown:()=>this.behaviour.onModalShown?.()});this.message=new J(this.dom,e.messageSelectors);this.theme=new tt(this.dom,e.modalSelector);this.trigger=new et(this.dom,this.options,e.triggerClasses,e.triggerSelector);this.trigger.setSuccessStyle(e.type==="click");this.hiddenInput=new V(this.dom,this.options);this.transport=x(this.options);this.dataClient=new w(this.options,this.transport,e.type);this.submitter=new T(this.options,this.transport,this.outcome)}init(t){if(t){Object.assign(this.options,_(this.hooks.defaultOptions,t));this.transport=x(this.options);this.dataClient=new w(this.options,this.transport,this.hooks.type);this.submitter=new T(this.options,this.transport,this.outcome)}this.dom.setRoot(this.behaviour.buildModal(this.options));this.modal.mount();this.theme.apply(this.options.theme);this.modal.setType(this.hooks.type);this.behaviour.attachInteraction();this.bindTools();this.trigger.bind(()=>this.show());this.bindFormError();return this}bindTools(){}bindButton(t,e,s="xqCaptchaBound"){const i=this.dom.query(t);if(!i||i.dataset[s]==="1"){return}i.dataset[s]="1";i.addEventListener("click",e)}show(){this.clearTimers();this.state.beginRound();this.behaviour.resetForShow();this.hiddenInput.remove();this.trigger.showPlaceholder();this.message.hideOk();this.modal.open();this.refresh();this.callbacks.emit("show")}hide(){this.behaviour.suspendInteraction();this.modal.close();this.callbacks.emit("hide")}refresh(){this.clearFailTimer();this.state.beginRefresh();this.behaviour.prepareRefresh();this.dataClient.load().then(t=>this.behaviour.applyData(t)).catch(t=>{console.error(`${this.hooks.logPrefix}: \u83B7\u53D6\u9A8C\u8BC1\u7801\u5931\u8D25`,t)})}reset(){this.hide();this.clearTimers();this.state.beginRound();this.hiddenInput.remove();this.trigger.showPlaceholder();this.refresh();this.callbacks.emit("reset");return this}result(){return this.state.passed}getToken(){return this.state.token}getCaptchaType(){return this.state.type}setTheme(t){this.options.theme=t||"auto";this.theme.apply(this.options.theme);return this}onSuccess(t){this.callbacks.set("success",t);return this}onFail(t){this.callbacks.set("fail",t);return this}onClose(t){this.callbacks.set("close",t);return this}onShow(t){this.callbacks.set("show",t);return this}onHide(t){this.callbacks.set("hide",t);return this}onRefresh(t){this.callbacks.set("refresh",t);return this}onReset(t){this.callbacks.set("reset",t);return this}dispose(){this.clearTimers();this.behaviour.detachInteraction();this.trigger.detach();this.message.dispose();this.theme.dispose();this.modal.dispose();this.hiddenInput.remove();if(this.formErrorHandler){document.removeEventListener(S,this.formErrorHandler);this.formErrorHandler=null}}submit(t){this.submitter.submit(t)}emitRefresh(){this.callbacks.emit("refresh",this.hooks.type,false)}handleSuccess(t){this.state.busy=false;this.state.passed=true;if(t.token){this.state.token=t.token}this.trigger.showSuccess();this.message.show(this.options.successText,true);if(this.options.autoInsertInput){this.hiddenInput.sync(this.getToken())}this.clearSuccessTimer();this.successHideTimer=window.setTimeout(()=>{this.successHideTimer=null;this.hide()},st);this.callbacks.emit("success",this.getToken())}handleFail(t){this.state.busy=false;this.state.passed=false;this.state.token=null;this.hiddenInput.remove();this.behaviour.markFailures();this.modal.shake();this.message.show(t,false);this.trigger.showFail();this.callbacks.emit("fail",t);this.clearFailTimer();this.failRefreshTimer=window.setTimeout(()=>{this.failRefreshTimer=null;this.behaviour.beforeFailRefresh();this.state.busy=false;this.refresh()},it)}bindFormError(){if(this.formErrorHandler){return}this.formErrorHandler=t=>{const e=t.target;if(!(e instanceof Element)||!e.querySelector(this.options.handleDom)){return}try{this.reset()}catch(t){console.error(`${this.hooks.logPrefix}: \u8868\u5355\u5931\u8D25\u590D\u4F4D\u5F02\u5E38`,t)}};document.addEventListener(S,this.formErrorHandler)}clearTimers(){this.clearSuccessTimer();this.clearFailTimer()}clearSuccessTimer(){if(this.successHideTimer!==null){clearTimeout(this.successHideTimer);this.successHideTimer=null}}clearFailTimer(){if(this.failRefreshTimer!==null){clearTimeout(this.failRefreshTimer);this.failRefreshTimer=null}}};var ot={...P,slideText:"拖动左边滑块完成上方拼图"};function at(t={}){return _(ot,t)}var C={trigger:".xq-captcha",modal:"#xq-slide-captcha-modal",dialog:".xq-captcha-dialog",content:".xq-captcha-content",loading:".xq-captcha-loading",canvasWrap:".xq-captcha-canvas-wrap",bgCanvas:".xq-captcha-bg-canvas",markCanvas:".xq-captcha-mark-canvas",msgError:".xq-captcha-alert-error",msgOk:".xq-captcha-alert-success",slideArea:".xq-captcha-slide-area",slideBlock:".xq-captcha-slide-block",slideText:".xq-captcha-slide-hint",close:".xq-captcha-close",refresh:".xq-captcha-refresh",copyright:".xq-captcha-copyright",progressBar:".xq-captcha-progress-bar"};var A={ripple:"xq-captcha-ripple",verified:"xq-captcha-verified",dragging:"xq-captcha-dragging",shake:"xq-captcha-shake",loadingError:"xq-captcha-loading-error",hidden:"d-none"};var q="xqCaptchaBound";function j(t,e=false){return t.getContext("2d",{willReadFrequently:e})}var lt=class{constructor(t,e){this.dom=t;this.state=e}dom;state;get bg(){return this.dom.query(C.bgCanvas)}get mark(){return this.dom.query(C.markCanvas)}resize(t,e){for(const s of[this.bg,this.mark]){if(s){s.width=t;s.height=e}}}clear(){for(const t of[this.bg,this.mark]){const e=t&&j(t);if(t&&e){e.clearRect(0,0,t.width,t.height)}}}clearMark(){const t=this.mark;const e=t&&j(t);if(t&&e){e.clearRect(0,0,t.width,t.height)}}setVisible(t){for(const e of[this.bg,this.mark]){if(e){e.style.display=t?"block":"none"}}}measure(){const t=this.bg;if(!t||t.width<=0){return}const e=this.dom.query(C.canvasWrap);const s=e?.getBoundingClientRect().width||t.getBoundingClientRect().width||t.width;this.state.scale=s/t.width;this.state.invScale=t.width/s}drawBackground(t){const e=this.bg;const s=e&&j(e);if(!e||!s){return}const{imgWidth:i,imgHeight:n}=this.state;s.drawImage(t,0,0,i,n,0,0,i,n)}};function ct(i){return new Promise((t,e)=>{const s=new Image;s.onload=()=>t(s);s.onerror=()=>e(new Error("验证码图片加载失败"));s.src=i})}var ht=77;var dt=150;var ut=29;var O=1;var L=5;var ft=5;var mt=15;var pt=class{constructor(t,e){this.canvas=t;this.state=e}canvas;state;image=null;prepared=null;reset(){this.image=null;this.prepared=null}setImage(t){this.image=t;this.prepared=null;if(this.state.type==="slide"){this.prepare(t)}}draw(){if(this.state.type!=="slide"){return}const t=this.canvas.mark;const e=t&&j(t,true);if(!t||!e){return}e.clearRect(0,0,t.width,t.height);const s=this.state.markOffset*this.state.invScale;const i=Math.min(this.state.markWidth,t.width-s);if(i<=0){return}const n=this.state.imgHeight;if(this.prepared){e.drawImage(this.prepared,0,0,i,n,s,0,i,n)}else if(this.image){e.drawImage(this.image,0,n,i,n,s,0,i,n)}}prepare(t){const e=this.state.markWidth;const s=this.state.imgHeight;const i=document.createElement("canvas");i.width=e;i.height=s;const n=j(i,true);if(!n){return}n.drawImage(t,0,s,e,s,0,0,e,s);try{const r=n.getImageData(0,0,e,s);gt(r.data,e,s);n.putImageData(r,0,0)}catch(t){console.warn("xq-slide-captcha: 滑块图层抠图失败,回退到原图",t)}this.prepared=i}};function gt(s,i,t){for(let e=0;e<t;e++){const n=bt(s,i,e);const r=yt(n);for(let t=0;t<i;t++){const o=Math.max(0,n[t]-r);const a=Math.max(0,Math.min(255,Math.round((o-ft)/mt*255)));const l=(e*i+t)*4;if(a<s[l+3]){s[l+3]=a}}}}function bt(n,r,o){const t=new Float32Array(r);for(let i=0;i<r;i++){let e=0;let s=0;for(let t=-O;t<=O;t++){const a=i+t;if(a<0||a>=r){continue}const l=(o*r+a)*4;e+=(n[l]*ht+n[l+1]*dt+n[l+2]*ut)/256;s++}t[i]=s>0?e/s:0}return t}function yt(e){let s=Number.POSITIVE_INFINITY;const i=e.length-1;for(let t=0;t<L;t++){const n=Math.min(i,Math.round(t*i/(L-1)));s=Math.min(s,e[n]??0)}return Number.isFinite(s)?s:0}var vt=class{constructor(t,e,s){this.target=t;this.enabled=e;this.callbacks=s}target;enabled;callbacks;dragging=false;onDown=t=>{if(this.dragging||!this.enabled()){return}if(t.cancelable){t.preventDefault()}this.dragging=true;this.bindDocument();this.callbacks.onStart(t.clientX,t.clientY)};onMove=t=>{if(!this.dragging){return}if(t.cancelable){t.preventDefault()}this.callbacks.onMove(t.clientX,t.clientY)};onUp=t=>{if(!this.dragging){return}if(t.cancelable){t.preventDefault()}this.stop();this.callbacks.onEnd()};onCancel=()=>{if(!this.dragging){return}this.stop();this.callbacks.onCancel()};attach(){this.target.addEventListener("pointerdown",this.onDown)}detach(){this.target.removeEventListener("pointerdown",this.onDown);this.stop()}cancel(){this.stop()}stop(){this.dragging=false;this.unbindDocument()}bindDocument(){document.addEventListener("pointermove",this.onMove,{passive:false});document.addEventListener("pointerup",this.onUp,{passive:false});document.addEventListener("pointercancel",this.onCancel)}unbindDocument(){document.removeEventListener("pointermove",this.onMove);document.removeEventListener("pointerup",this.onUp);document.removeEventListener("pointercancel",this.onCancel)}};var wt=4;var kt=12;var _t={ArrowLeft:-1,Left:-1,ArrowRight:1,Right:1};var D={Home:"start",End:"end"};var xt=class{constructor(t,e,s){this.target=t;this.state=e;this.callbacks=s}target;state;callbacks;keyUp=null;onKeyDown=t=>{if(!this.enabled()){return}const e=t.shiftKey?kt:wt;const s=_t[t.key];let i=null;if(s!==void 0){i=this.state.markOffset+s*e}else if(Object.prototype.hasOwnProperty.call(D,t.key)){i=D[t.key]==="start"?0:this.state.maxOffset}if(i===null){return}t.preventDefault();this.callbacks.onOffset(Math.max(0,Math.min(i,this.state.maxOffset)));this.listenKeyUp()};attach(){this.target.addEventListener("keydown",this.onKeyDown)}detach(){this.target.removeEventListener("keydown",this.onKeyDown);this.clearKeyUp()}cancelCommit(){this.clearKeyUp()}listenKeyUp(){if(this.keyUp){return}const t=()=>{this.clearKeyUp();if(this.enabled()){this.callbacks.onCommit()}};this.keyUp=t;document.addEventListener("keyup",t)}clearKeyUp(){if(this.keyUp){document.removeEventListener("keyup",this.keyUp);this.keyUp=null}}enabled(){return this.state.type==="slide"&&this.state.imgLoaded&&!this.state.busy}};var Et=class{points=[];start=0;get samples(){return this.points}get started(){return this.start>0}begin(){this.points=[];this.start=Date.now()}record(t,e){this.points.push({x:Math.round(t),y:Math.round(e),t:Date.now()-this.start})}reset(){this.points=[];this.start=0}};var Tt=class{constructor(t,e,s,i){this.dom=t;this.state=e;this.layer=s;this.onCommit=i}dom;state;layer;onCommit;recorder=new Et;drag=null;keyboard=null;startClientX=0;startClientY=0;get track(){return this.recorder.samples}attach(){const t=this.block;if(!t){return}this.detach();this.drag=new vt(t,()=>this.enabled(),{onStart:(t,e)=>this.start(t,e),onMove:(t,e)=>this.move(t,e),onEnd:()=>this.submit(),onCancel:()=>this.abort()});this.keyboard=new xt(t,this.state,{onOffset:t=>this.keyMove(t),onCommit:()=>this.submit()});this.drag.attach();this.keyboard.attach()}detach(){this.drag?.detach();this.keyboard?.detach();this.drag=null;this.keyboard=null}reset(){this.recorder.reset();this.state.markOffset=0;this.paint()}suspend(){this.drag?.cancel();this.keyboard?.cancelCommit();this.state.cancelFrame();this.state.moving=false;this.block?.classList.remove(A.dragging)}start(t,e){this.startClientX=t;this.startClientY=e;this.state.busy=true;this.state.moving=true;this.recorder.begin();this.block?.classList.add(A.dragging)}move(t,e){const s=Math.max(0,Math.min(t-this.startClientX,this.state.maxOffset));const i=this.state.scale>0?1/this.state.scale:1;this.recorder.record(s*i,this.state.markTopY+(e-this.startClientY)*i);if(s===this.state.markOffset){return}this.state.markOffset=s;this.state.cancelFrame();this.state.rafId=requestAnimationFrame(()=>{this.paint();this.state.rafId=null})}keyMove(t){if(!this.recorder.started){this.recorder.begin()}this.recorder.record(t*this.state.invScale,this.state.markTopY);this.state.markOffset=t;this.paint()}submit(){this.state.cancelFrame();this.state.moving=false;this.state.busy=true;this.block?.classList.remove(A.dragging);this.paint();this.onCommit(Math.round(this.state.markOffset*this.state.invScale),this.recorder.samples)}abort(){this.state.cancelFrame();this.state.moving=false;this.state.busy=false;this.block?.classList.remove(A.dragging);this.reset()}paint(){const t=this.block;const e=this.state.markOffset;const s=this.state.maxOffset;const i=s>0?Math.round(e/s*100):0;if(t){t.style.transform=`translateX(${e}px)`;t.setAttribute("aria-valuenow",String(i))}const n=this.dom.query(C.progressBar);if(n){n.style.width=`${i}%`;n.setAttribute("aria-valuenow",String(i))}this.layer.draw()}enabled(){return this.state.type==="slide"&&this.state.imgLoaded&&!this.state.busy}get block(){return this.dom.query(C.slideBlock)}};var St=class{constructor(t,e){this.dom=t;this.options=e}dom;options;forSlide(){const t=this.dom.query(C.slideText);if(!t){return}t.textContent=this.options.slideText;t.removeAttribute("style");t.classList.remove("d-none")}};var Ct=class{constructor(t){this.dom=t}dom;show(){const t=this.element;if(!t){return}const e=document.createElement("div");e.className="spinner-border text-primary";e.setAttribute("role","status");const s=document.createElement("span");s.className="visually-hidden";s.textContent="加载中";e.append(s);const i=document.createElement("span");i.textContent="加载中...";t.replaceChildren(e,i);t.classList.remove(A.loadingError);t.classList.remove(A.hidden)}hide(){const t=this.element;if(!t){return}t.replaceChildren();t.classList.remove(A.loadingError);t.classList.add(A.hidden)}fail(){const t=this.element;if(!t){return}const e=document.createElement("div");e.className="text-danger small fw-semibold text-center";e.append("加载失败",document.createElement("br"),"请刷新重试");t.replaceChildren(e);t.classList.add(A.loadingError);t.classList.remove(A.hidden)}get element(){return this.dom.query(C.loading)}};function M(t,e="",s={}){const i=document.createElement(t);if(e){i.className=e}for(const[n,r]of Object.entries(s)){i.setAttribute(n,r)}return i}function At(t){const e=document.querySelector(C.modal);if(e){return e}const s=M("div","modal fade xq-captcha-modal",{id:"xq-slide-captcha-modal","data-xq-captcha-kind":"slide",role:"dialog","aria-modal":"true","aria-label":"人机验证","aria-hidden":"true",tabindex:"-1"});const i=M("div","modal-dialog modal-dialog-centered xq-captcha-dialog");const n=M("div","modal-content xq-captcha-content");const r=M("div","modal-header");const o=M("h5","modal-title h6");o.textContent="安全验证";r.append(o);if(t.showClose){const v=M("button","btn-close xq-captcha-close",{type:"button","aria-label":"关闭"});r.append(v)}n.append(r);const a=M("div","modal-body");const l=M("div",`${C.canvasWrap.slice(1)} position-relative w-100 overflow-hidden rounded border`);const c=M("div",`${C.loading.slice(1)} position-absolute top-0 start-0 w-100 h-100 z-3 d-flex flex-column align-items-center justify-content-center gap-2`);l.append(c);l.append(M("canvas",`${C.bgCanvas.slice(1)} position-relative z-1 d-block w-100 h-auto border-0`,{width:"240",height:"150","aria-label":"验证码图片"}));l.append(M("canvas",`${C.markCanvas.slice(1)} position-absolute top-0 start-0 w-100 h-100 z-2 pe-none`,{width:"240",height:"150"}));a.append(l);const h=M("div","alert alert-danger fade xq-captcha-alert-error",{role:"alert"});const d=M("div","alert alert-success fade xq-captcha-alert-success",{role:"status"});h.style.display="none";d.style.display="none";a.append(h,d);const u=M("div",`${C.slideArea.slice(1)} position-relative w-100 overflow-hidden rounded-pill border`);const f=M("button",`btn btn-primary rounded-circle d-flex align-items-center justify-content-center p-0 user-select-none ${C.slideBlock.slice(1)}`,{type:"button",tabindex:"0",role:"slider","aria-label":"拖动滑块完成拼图","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":"0"});const m=M("span",`${C.slideText.slice(1)} d-flex align-items-center justify-content-center pe-none user-select-none`);m.textContent=t.slideText;const p=M("div","progress xq-captcha-progress");const g=M("div",`progress-bar ${C.progressBar.slice(1)}`,{role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":"0"});p.append(g);u.append(f,m,p);a.append(u);n.append(a);const b=M("div","modal-footer");const y=M("a",`${C.copyright.slice(1)} link-secondary small`,{href:t.copyright.url,target:"_blank",rel:"noopener noreferrer",title:t.copyright.title});y.textContent=t.copyright.text;b.append(y);if(t.showRefresh){const w=M("button",`btn btn-outline-secondary btn-sm ${C.refresh.slice(1)}`,{type:"button","aria-label":"刷新验证码"});w.textContent="刷新";b.append(w)}n.append(b);i.append(n);s.append(i);document.body.append(s);return s}var qt={logPrefix:"xq-slide-captcha",type:"slide",defaultOptions:at({}),modalSelector:C.modal,contentSelector:C.content,shakeClass:"xq-captcha-shake",messageSelectors:{msgOk:C.msgOk,msgError:C.msgError},triggerClasses:{ripple:"xq-captcha-ripple",verified:"xq-captcha-verified"},triggerSelector:C.trigger};var jt=class extends nt{canvas;layer;slider;hint;loading;onContextReady(){this.canvas=new lt(this.ctx.dom,this.ctx.state);this.layer=new pt(this.canvas,this.ctx.state);this.hint=new St(this.ctx.dom,this.ctx.options);this.loading=new Ct(this.ctx.dom);this.slider=new Tt(this.ctx.dom,this.ctx.state,this.layer,(t,e)=>{this.ctx.submit({captcha_r:String(t),slide_track:JSON.stringify(e)})})}buildModal(t){return At(t)}attachInteraction(){this.slider.attach()}detachInteraction(){this.slider.detach()}resetForShow(){this.slider.suspend();this.slider.reset()}suspendInteraction(){this.slider.suspend()}prepareRefresh(){this.slider.reset();this.layer.reset();this.canvas.setVisible(false);this.canvas.clear();this.loading.show()}async applyData(t){this.ctx.state.imgWidth=t.bg_width||240;this.ctx.state.imgHeight=t.bg_height||150;this.ctx.state.markWidth=t.mark_width||50;this.ctx.state.markTopY=typeof t.pos_y==="number"?t.pos_y:0;this.hint.forSlide();this.canvas.resize(this.ctx.state.imgWidth,this.ctx.state.imgHeight);this.ctx.emitRefresh();try{const e=await ct(t.image_base64);this.canvas.setVisible(true);this.canvas.measure();this.canvas.drawBackground(e);this.canvas.clearMark();this.layer.setImage(e);this.ctx.state.imgLoaded=true;this.loading.hide();this.slider.reset()}catch(t){console.error("xq-slide-captcha: 验证码图片加载失败",t);this.loading.fail()}}markFailures(){}beforeFailRefresh(){}onModalShown(){this.canvas.measure();this.layer.draw()}get track(){return this.slider.track}};var Ot=class extends rt{slideBehaviour;constructor(t={}){const e=new jt;super(e,qt,t);this.slideBehaviour=e}init(t){return super.init(t)}getSlideTrack(){return this.slideBehaviour.track}bindTools(){this.bindButton(C.close,()=>{this.callbacks.emit("close");this.hide()},q);this.bindButton(C.refresh,()=>this.refresh(),q)}};var I=new Ot;function Lt(t=I){window.xqSlideCaptcha=t;return t}if(typeof window!=="undefined"){window.xqSlideCaptcha=I}})();
|
|
7
|
+
"use strict";(()=>{var i=Object.create;var r=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var n=Object.getPrototypeOf;var l=Object.prototype.hasOwnProperty;var t=(e,s)=>function t(){return s||(0,e[a(e)[0]])((s={exports:{}}).exports,s),s.exports};var c=(e,s,i,n)=>{if(s&&typeof s==="object"||typeof s==="function"){for(let t of a(s))if(!l.call(e,t)&&t!==i)r(e,t,{get:()=>s[t],enumerable:!(n=o(s,t))||n.enumerable})}return e};var e=(t,e,s)=>(s=t!=null?i(n(t)):{},c(e||!t||!t.__esModule?r(s,"default",{value:t,enumerable:true}):s,t));var h=t({"node_modules/bootstrap/js/dist/dom/data.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e():typeof define==="function"&&define.amd?define(e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Data=e())})(s,function(){"use strict";const n=new Map;const t={set(t,e,s){if(!n.has(t)){n.set(t,new Map)}const i=n.get(t);if(!i.has(e)&&i.size!==0){console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(i.keys())[0]}.`);return}i.set(e,s)},get(t,e){if(n.has(t)){return n.get(t).get(e)||null}return null},remove(t,e){if(!n.has(t)){return}const s=n.get(t);s.delete(e);if(s.size===0){n.delete(t)}}};return t})}});var d=t({"node_modules/bootstrap/js/dist/util/index.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?e(s):typeof define==="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.Index={}))})(s,function(t){"use strict";const e=1e6;const r=1e3;const a="transitionend";const s=t=>{if(t&&window.CSS&&window.CSS.escape){t=t.replace(/#([^\s"#']+)/g,(t,e)=>`#${CSS.escape(e)}`)}return t};const i=t=>{if(t===null||t===void 0){return`${t}`}return Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase()};const n=t=>{do{t+=Math.floor(Math.random()*e)}while(document.getElementById(t));return t};const l=t=>{if(!t){return 0}let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e);const n=Number.parseFloat(s);if(!i&&!n){return 0}e=e.split(",")[0];s=s.split(",")[0];return(Number.parseFloat(e)+Number.parseFloat(s))*r};const c=t=>{t.dispatchEvent(new Event(a))};const o=t=>{if(!t||typeof t!=="object"){return false}if(typeof t.jquery!=="undefined"){t=t[0]}return typeof t.nodeType!=="undefined"};const h=t=>{if(o(t)){return t.jquery?t[0]:t}if(typeof t==="string"&&t.length>0){return document.querySelector(s(t))}return null};const d=t=>{if(!o(t)||t.getClientRects().length===0){return false}const e=getComputedStyle(t).getPropertyValue("visibility")==="visible";const s=t.closest("details:not([open])");if(!s){return e}if(s!==t){const i=t.closest("summary");if(i&&i.parentNode!==s){return false}if(i===null){return false}}return e};const u=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE){return true}if(t.classList.contains("disabled")){return true}if(typeof t.disabled!=="undefined"){return t.disabled}return t.hasAttribute("disabled")&&t.getAttribute("disabled")!=="false"};const f=t=>{if(!document.documentElement.attachShadow){return null}if(typeof t.getRootNode==="function"){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}if(t instanceof ShadowRoot){return t}if(!t.parentNode){return null}return f(t.parentNode)};const m=()=>{};const p=t=>{t.offsetHeight};const g=()=>{if(window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")){return window.jQuery}return null};const b=[];const y=t=>{if(document.readyState==="loading"){if(!b.length){document.addEventListener("DOMContentLoaded",()=>{for(const t of b){t()}})}b.push(t)}else{t()}};const v=()=>document.documentElement.dir==="rtl";const w=i=>{y(()=>{const t=g();if(t){const e=i.NAME;const s=t.fn[e];t.fn[e]=i.jQueryInterface;t.fn[e].Constructor=i;t.fn[e].noConflict=()=>{t.fn[e]=s;return i.jQueryInterface}}})};const k=(t,e=[],s=t)=>{return typeof t==="function"?t.call(...e):s};const _=(e,s,t=true)=>{if(!t){k(e);return}const i=5;const n=l(s)+i;let r=false;const o=({target:t})=>{if(t!==s){return}r=true;s.removeEventListener(a,o);k(e)};s.addEventListener(a,o);setTimeout(()=>{if(!r){c(s)}},n)};const x=(t,e,s,i)=>{const n=t.length;let r=t.indexOf(e);if(r===-1){return!s&&i?t[n-1]:t[0]}r+=s?1:-1;if(i){r=(r+n)%n}return t[Math.max(0,Math.min(r,n-1))]};t.defineJQueryPlugin=w;t.execute=k;t.executeAfterTransition=_;t.findShadowRoot=f;t.getElement=h;t.getNextActiveElement=x;t.getTransitionDurationFromElement=l;t.getUID=n;t.getjQuery=g;t.isDisabled=u;t.isElement=o;t.isRTL=v;t.isVisible=d;t.noop=m;t.onDOMContentLoaded=y;t.parseSelector=s;t.reflow=p;t.toType=i;t.triggerTransitionEnd=c;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})}});var u=t({"node_modules/bootstrap/js/dist/dom/event-handler.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(d()):typeof define==="function"&&define.amd?define(["../util/index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.EventHandler=e(t.Index))})(s,function(d){"use strict";const m=/[^.]*(?=\..*)\.|.*/;const e=/\..*/;const p=/::\d+$/;const s={};let i=1;const g={mouseenter:"mouseover",mouseleave:"mouseout"};const o=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function b(t,e){return e&&`${e}::${i++}`||t.uidEvent||i++}function y(t){const e=b(t);t.uidEvent=e;s[e]=s[e]||{};return s[e]}function v(s,i){return function t(e){f(e,{delegateTarget:s});if(t.oneOff){l.off(s,e.type,i)}return i.apply(s,[e])}}function w(r,o,a){return function e(s){const i=r.querySelectorAll(o);for(let{target:t}=s;t&&t!==this;t=t.parentNode){for(const n of i){if(n!==t){continue}f(s,{delegateTarget:t});if(e.oneOff){l.off(r,s.type,o,a)}return a.apply(t,[s])}}}}function k(t,e,s=null){return Object.values(t).find(t=>t.callable===e&&t.delegationSelector===s)}function _(t,e,s){const i=typeof e==="string";const n=i?s:e||s;let r=u(t);if(!o.has(r)){r=t}return[i,n,r]}function n(t,e,s,i,n){if(typeof e!=="string"||!t){return}let[r,o,a]=_(e,s,i);if(e in g){const f=e=>{return function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget)){return e.call(this,t)}}};o=f(o)}const l=y(t);const c=l[a]||(l[a]={});const h=k(c,o,r?s:null);if(h){h.oneOff=h.oneOff&&n;return}const d=b(o,e.replace(m,""));const u=r?w(t,s,o):v(t,o);u.delegationSelector=r?s:null;u.callable=o;u.oneOff=n;u.uidEvent=d;c[d]=u;t.addEventListener(a,u,r)}function x(t,e,s,i,n){const r=k(e[s],i,n);if(!r){return}t.removeEventListener(s,r,Boolean(n));delete e[s][r.uidEvent]}function E(t,e,s,i){const n=e[s]||{};for(const[r,o]of Object.entries(n)){if(r.includes(i)){x(t,e,s,o.callable,o.delegationSelector)}}}function u(t){t=t.replace(e,"");return g[t]||t}const l={on(t,e,s,i){n(t,e,s,i,false)},one(t,e,s,i){n(t,e,s,i,true)},off(t,e,s,i){if(typeof e!=="string"||!t){return}const[n,r,o]=_(e,s,i);const a=o!==e;const l=y(t);const c=l[o]||{};const h=e.startsWith(".");if(typeof r!=="undefined"){if(!Object.keys(c).length){return}x(t,l,o,r,n?s:null);return}if(h){for(const d of Object.keys(l)){E(t,l,d,e.slice(1))}}for(const[u,f]of Object.entries(c)){const m=u.replace(p,"");if(!a||e.includes(m)){x(t,l,o,f.callable,f.delegationSelector)}}},trigger(t,e,s){if(typeof e!=="string"||!t){return null}const i=d.getjQuery();const n=u(e);const r=e!==n;let o=null;let a=true;let l=true;let c=false;if(r&&i){o=i.Event(e,s);i(t).trigger(o);a=!o.isPropagationStopped();l=!o.isImmediatePropagationStopped();c=o.isDefaultPrevented()}const h=f(new Event(e,{bubbles:a,cancelable:true}),s);if(c){h.preventDefault()}if(l){t.dispatchEvent(h)}if(h.defaultPrevented&&o){o.preventDefault()}return h}};function f(e,t={}){for(const[s,i]of Object.entries(t)){try{e[s]=i}catch(t){Object.defineProperty(e,s,{configurable:true,get(){return i}})}}return e}return l})}});var f=t({"node_modules/bootstrap/js/dist/dom/manipulator.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e():typeof define==="function"&&define.amd?define(e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Manipulator=e())})(s,function(){"use strict";function n(e){if(e==="true"){return true}if(e==="false"){return false}if(e===Number(e).toString()){return Number(e)}if(e===""||e==="null"){return null}if(typeof e!=="string"){return e}try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function i(t){return t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}const t={setDataAttribute(t,e,s){t.setAttribute(`data-bs-${i(e)}`,s)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${i(e)}`)},getDataAttributes(e){if(!e){return{}}const s={};const t=Object.keys(e.dataset).filter(t=>t.startsWith("bs")&&!t.startsWith("bsConfig"));for(const i of t){let t=i.replace(/^bs/,"");t=t.charAt(0).toLowerCase()+t.slice(1);s[t]=n(e.dataset[i])}return s},getDataAttribute(t,e){return n(t.getAttribute(`data-bs-${i(e)}`))}};return t})}});var m=t({"node_modules/bootstrap/js/dist/util/config.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(f(),d()):typeof define==="function"&&define.amd?define(["../dom/manipulator","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Config=e(t.Manipulator,t.Index))})(s,function(i,o){"use strict";class t{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){t=this._mergeConfigObj(t);t=this._configAfterMerge(t);this._typeCheckConfig(t);return t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const s=o.isElement(e)?i.getDataAttribute(e,"config"):{};return{...this.constructor.Default,...typeof s==="object"?s:{},...o.isElement(e)?i.getDataAttributes(e):{},...typeof t==="object"?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const[s,i]of Object.entries(e)){const n=t[s];const r=o.isElement(n)?"element":o.toType(n);if(!new RegExp(i).test(r)){throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${s}" provided type "${r}" but expected type "${i}".`)}}}}return t})}});var p=t({"node_modules/bootstrap/js/dist/base-component.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(h(),u(),m(),d()):typeof define==="function"&&define.amd?define(["./dom/data","./dom/event-handler","./util/config","./util/index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.BaseComponent=e(t.Data,t.EventHandler,t.Config,t.Index))})(s,function(s,e,t,i){"use strict";const n="5.3.9";class r extends t{constructor(t,e){super();t=i.getElement(t);if(!t){return}this._element=t;this._config=this._getConfig(e);s.set(this._element,this.constructor.DATA_KEY,this)}dispose(){s.remove(this._element,this.constructor.DATA_KEY);e.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this)){this[t]=null}}_queueCallback(t,e,s=true){i.executeAfterTransition(t,e,s)}_getConfig(t){t=this._mergeConfigObj(t,this._element);t=this._configAfterMerge(t);this._typeCheckConfig(t);return t}static getInstance(t){return s.get(i.getElement(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,typeof e==="object"?e:null)}static get VERSION(){return n}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}return r})}});var g=t({"node_modules/bootstrap/js/dist/dom/selector-engine.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(d()):typeof define==="function"&&define.amd?define(["../util/index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.SelectorEngine=e(t.Index))})(s,function(i){"use strict";const s=e=>{let s=e.getAttribute("data-bs-target");if(!s||s==="#"){let t=e.getAttribute("href");if(!t||!t.includes("#")&&!t.startsWith(".")){return null}if(t.includes("#")&&!t.startsWith("#")){t=`#${t.split("#")[1]}`}s=t&&t!=="#"?t.trim():null}return s?s.split(",").map(t=>i.parseSelector(t)).join(","):null};const n={find(t,e=document.documentElement){return[].concat(...Element.prototype.querySelectorAll.call(e,t))},findOne(t,e=document.documentElement){return Element.prototype.querySelector.call(e,t)},children(t,e){return[].concat(...t.children).filter(t=>t.matches(e))},parents(t,e){const s=[];let i=t.parentNode.closest(e);while(i){s.push(i);i=i.parentNode.closest(e)}return s},prev(t,e){let s=t.previousElementSibling;while(s){if(s.matches(e)){return[s]}s=s.previousElementSibling}return[]},next(t,e){let s=t.nextElementSibling;while(s){if(s.matches(e)){return[s]}s=s.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(t=>`${t}:not([tabindex^="-"])`).join(",");return this.find(e,t).filter(t=>!i.isDisabled(t)&&i.isVisible(t))},getSelectorFromElement(t){const e=s(t);if(e){return n.findOne(e)?e:null}return null},getElementFromSelector(t){const e=s(t);return e?n.findOne(e):null},getMultipleElementsFromSelector(t){const e=s(t);return e?n.find(e):[]}};return n})}});var b=t({"node_modules/bootstrap/js/dist/util/backdrop.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(u(),m(),d()):typeof define==="function"&&define.amd?define(["../dom/event-handler","./config","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Backdrop=e(t.EventHandler,t.Config,t.Index))})(s,function(e,t,s){"use strict";const i="backdrop";const n="fade";const r="show";const o=`mousedown.bs.${i}`;const a={className:"modal-backdrop",clickCallback:null,isAnimated:false,isVisible:true,rootElement:"body"};const l={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class c extends t{constructor(t){super();this._config=this._getConfig(t);this._isAppended=false;this._element=null}static get Default(){return a}static get DefaultType(){return l}static get NAME(){return i}show(t){if(!this._config.isVisible){s.execute(t);return}this._append();const e=this._getElement();if(this._config.isAnimated){s.reflow(e)}e.classList.add(r);this._emulateAnimation(()=>{s.execute(t)})}hide(t){if(!this._config.isVisible){s.execute(t);return}this._getElement().classList.remove(r);this._emulateAnimation(()=>{this.dispose();s.execute(t)})}dispose(){if(!this._isAppended){return}e.off(this._element,o);this._element.remove();this._isAppended=false}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className;if(this._config.isAnimated){t.classList.add(n)}this._element=t}return this._element}_configAfterMerge(t){t.rootElement=s.getElement(t.rootElement);return t}_append(){if(this._isAppended){return}const t=this._getElement();this._config.rootElement.append(t);e.on(t,o,()=>{s.execute(this._config.clickCallback)});this._isAppended=true}_emulateAnimation(t){s.executeAfterTransition(t,this._getElement(),this._config.isAnimated)}}return c})}});var y=t({"node_modules/bootstrap/js/dist/util/component-functions.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?e(s,u(),g(),d()):typeof define==="function"&&define.amd?define(["exports","../dom/event-handler","../dom/selector-engine","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.ComponentFunctions={},t.EventHandler,t.SelectorEngine,t.Index))})(s,function(t,e,o,a){"use strict";const s=(i,n="hide")=>{const t=`click.dismiss${i.EVENT_KEY}`;const r=i.NAME;e.on(document,t,`[data-bs-dismiss="${r}"]`,function(t){if(["A","AREA"].includes(this.tagName)){t.preventDefault()}if(a.isDisabled(this)){return}const e=o.getElementFromSelector(this)||this.closest(`.${r}`);const s=i.getOrCreateInstance(e);s[n]()})};t.enableDismissTrigger=s;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})}});var v=t({"node_modules/bootstrap/js/dist/util/focustrap.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(u(),g(),m()):typeof define==="function"&&define.amd?define(["../dom/event-handler","../dom/selector-engine","./config"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Focustrap=e(t.EventHandler,t.SelectorEngine,t.Config))})(s,function(t,i,e){"use strict";const s="focustrap";const n="bs.focustrap";const r=`.${n}`;const o=`focusin${r}`;const a=`keydown.tab${r}`;const l="Tab";const c="forward";const h="backward";const d={autofocus:true,trapElement:null};const u={autofocus:"boolean",trapElement:"element"};class f extends e{constructor(t){super();this._config=this._getConfig(t);this._isActive=false;this._lastTabNavDirection=null}static get Default(){return d}static get DefaultType(){return u}static get NAME(){return s}activate(){if(this._isActive){return}if(this._config.autofocus){this._config.trapElement.focus()}t.off(document,r);t.on(document,o,t=>this._handleFocusin(t));t.on(document,a,t=>this._handleKeydown(t));this._isActive=true}deactivate(){if(!this._isActive){return}this._isActive=false;t.off(document,r)}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target)){return}const s=i.focusableChildren(e);if(s.length===0){e.focus()}else if(this._lastTabNavDirection===h){s[s.length-1].focus()}else{s[0].focus()}}_handleKeydown(t){if(t.key!==l){return}this._lastTabNavDirection=t.shiftKey?h:c}}return f})}});var N=t({"node_modules/bootstrap/js/dist/util/scrollbar.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(f(),g(),d()):typeof define==="function"&&define.amd?define(["../dom/manipulator","../dom/selector-engine","./index"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Scrollbar=e(t.Manipulator,t.SelectorEngine,t.Index))})(s,function(i,n,r){"use strict";const t=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";const s=".sticky-top";const o="padding-right";const a="margin-right";class e{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const e=this.getWidth();this._disableOverFlow();this._setElementAttributes(this._element,o,t=>t+e);this._setElementAttributes(t,o,t=>t+e);this._setElementAttributes(s,a,t=>t-e)}reset(){this._resetElementAttributes(this._element,"overflow");this._resetElementAttributes(this._element,o);this._resetElementAttributes(t,o);this._resetElementAttributes(s,a)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow");this._element.style.overflow="hidden"}_setElementAttributes(t,s,i){const n=this.getWidth();const e=t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n){return}this._saveInitialAttribute(t,s);const e=window.getComputedStyle(t).getPropertyValue(s);t.style.setProperty(s,`${i(Number.parseFloat(e))}px`)};this._applyManipulationCallback(t,e)}_saveInitialAttribute(t,e){const s=t.style.getPropertyValue(e);if(s){i.setDataAttribute(t,e,s)}}_resetElementAttributes(t,s){const e=t=>{const e=i.getDataAttribute(t,s);if(e===null){t.style.removeProperty(s);return}i.removeDataAttribute(t,s);t.style.setProperty(s,e)};this._applyManipulationCallback(t,e)}_applyManipulationCallback(t,e){if(r.isElement(t)){e(t);return}for(const s of n.find(t,this._element)){e(s)}}}return e})}});var $=t({"node_modules/bootstrap/js/dist/modal.js"(s,i){(function(t,e){typeof s==="object"&&typeof i!=="undefined"?i.exports=e(p(),u(),g(),b(),y(),v(),d(),N()):typeof define==="function"&&define.amd?define(["./base-component","./dom/event-handler","./dom/selector-engine","./util/backdrop","./util/component-functions","./util/focustrap","./util/index","./util/scrollbar"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,t.Modal=e(t.BaseComponent,t.EventHandler,t.SelectorEngine,t.Backdrop,t.ComponentFunctions,t.Focustrap,t.Index,t.Scrollbar))})(s,function(t,n,r,e,s,i,o,a){"use strict";const l="modal";const c="bs.modal";const h=`.${c}`;const d=".data-api";const u="Escape";const f=`hide${h}`;const m=`hidePrevented${h}`;const p=`hidden${h}`;const g=`show${h}`;const b=`shown${h}`;const y=`resize${h}`;const v=`click.dismiss${h}`;const w=`mousedown.dismiss${h}`;const k=`keydown.dismiss${h}`;const _=`click${h}${d}`;const x="modal-open";const E="fade";const T="show";const S="modal-static";const C=".modal.show";const A=".modal-dialog";const q=".modal-body";const j='[data-bs-toggle="modal"]';const O={backdrop:true,focus:true,keyboard:true};const L={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class D extends t{constructor(t,e){super(t,e);this._dialog=r.findOne(A,this._element);this._backdrop=this._initializeBackDrop();this._focustrap=this._initializeFocusTrap();this._isShown=false;this._isTransitioning=false;this._scrollBar=new a;this._addEventListeners()}static get Default(){return O}static get DefaultType(){return L}static get NAME(){return l}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){if(this._isShown||this._isTransitioning){return}const e=n.trigger(this._element,g,{relatedTarget:t});if(e.defaultPrevented){return}this._isShown=true;this._isTransitioning=true;this._scrollBar.hide();document.body.classList.add(x);this._adjustDialog();this._backdrop.show(()=>this._showElement(t))}hide(){if(!this._isShown||this._isTransitioning){return}const t=n.trigger(this._element,f);if(t.defaultPrevented){return}this._isShown=false;this._isTransitioning=true;this._focustrap.deactivate();this._element.classList.remove(T);this._queueCallback(()=>this._hideModal(),this._element,this._isAnimated())}dispose(){n.off(window,h);n.off(this._dialog,h);this._backdrop.dispose();this._focustrap.deactivate();super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new e({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new i({trapElement:this._element})}_showElement(t){if(!document.body.contains(this._element)){document.body.append(this._element)}this._element.style.display="block";this._element.removeAttribute("aria-hidden");this._element.setAttribute("aria-modal",true);this._element.setAttribute("role","dialog");this._element.scrollTop=0;const e=r.findOne(q,this._dialog);if(e){e.scrollTop=0}o.reflow(this._element);this._element.classList.add(T);const s=()=>{if(this._config.focus){this._focustrap.activate()}this._isTransitioning=false;n.trigger(this._element,b,{relatedTarget:t})};this._queueCallback(s,this._dialog,this._isAnimated())}_addEventListeners(){n.on(this._element,k,t=>{if(t.key!==u){return}if(this._config.keyboard){this.hide();return}this._triggerBackdropTransition()});n.on(window,y,()=>{if(this._isShown&&!this._isTransitioning){this._adjustDialog()}});n.on(this._element,w,e=>{n.one(this._element,v,t=>{if(this._element!==e.target||this._element!==t.target){return}if(this._config.backdrop==="static"){this._triggerBackdropTransition();return}if(this._config.backdrop){this.hide()}})})}_hideModal(){this._element.style.display="none";this._element.setAttribute("aria-hidden",true);this._element.removeAttribute("aria-modal");this._element.removeAttribute("role");this._isTransitioning=false;this._backdrop.hide(()=>{document.body.classList.remove(x);this._resetAdjustments();this._scrollBar.reset();n.trigger(this._element,p)})}_isAnimated(){return this._element.classList.contains(E)}_triggerBackdropTransition(){const t=n.trigger(this._element,m);if(t.defaultPrevented){return}const e=this._element.scrollHeight>document.documentElement.clientHeight;const s=this._element.style.overflowY;if(s==="hidden"||this._element.classList.contains(S)){return}if(!e){this._element.style.overflowY="hidden"}this._element.classList.add(S);this._queueCallback(()=>{this._element.classList.remove(S);this._queueCallback(()=>{this._element.style.overflowY=s},this._dialog)},this._dialog);this._element.focus()}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight;const e=this._scrollBar.getWidth();const s=e>0;if(s&&!t){const i=o.isRTL()?"paddingLeft":"paddingRight";this._element.style[i]=`${e}px`}if(!s&&t){const i=o.isRTL()?"paddingRight":"paddingLeft";this._element.style[i]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="";this._element.style.paddingRight=""}static jQueryInterface(e,s){return this.each(function(){const t=D.getOrCreateInstance(this,e);if(typeof e!=="string"){return}if(typeof t[e]==="undefined"){throw new TypeError(`No method named "${e}"`)}t[e](s)})}}n.on(document,_,j,function(t){const e=r.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)){t.preventDefault()}n.one(e,g,t=>{if(t.defaultPrevented){return}n.one(e,p,()=>{if(o.isVisible(this)){this.focus()}})});const s=r.findOne(C);if(s){D.getInstance(s).hide()}const i=D.getOrCreateInstance(e);i.toggle(this)});s.enableDismissTrigger(D);o.defineJQueryPlugin(D);return D})}});var R=class{constructor(t){this.logPrefix=t;this.handlers=new Map}set(t,e){this.handlers.set(t,e)}emit(e,...t){const s=this.handlers.get(e);if(!s){return}try{s(...t)}catch(t){console.error(`${this.logPrefix}: ${e} \u56DE\u8C03\u629B\u51FA\u5F02\u5E38`,t)}}};var w=class{constructor(t,e,s){this.options=t;this.transport=e;this.expectedType=s}async load(){const t=await this.transport.request("GET",this.options.dataUrl);const e=JSON.parse(t);if(!F(e,this.expectedType)){throw new Error("验证码数据格式不正确")}return e}};function F(t,e){return typeof t==="object"&&t!==null&&typeof t.success==="boolean"&&(t.type===e||t.type===null)&&typeof t.image_base64==="string"}var H=class{constructor(){this.cache=new Map;this.root=document}setRoot(t){if(this.root!==t){this.root=t;this.cache.clear()}}query(t){const e=this.cache.get(t);if(e?.isConnected){return e}const s=this.root.querySelector(t);if(s){this.cache.set(t,s)}else{this.cache.delete(t)}return s}queryAll(t){return Array.from(this.root.querySelectorAll(t))}queryGlobal(t){return document.querySelector(t)}queryAllGlobal(t){return Array.from(document.querySelectorAll(t))}};var k=class extends Error{constructor(t,e){super(`captcha request failed: ${t}`);this.status=t;this.body=e;this.name="HttpError"}};var B=class{constructor(t){this.timeout=t}async request(t,e,s){const i=new AbortController;const n=setTimeout(()=>i.abort(),this.timeout);let r=e;let o;if(s){const l=new URLSearchParams(s).toString();if(t==="GET"){r+=(e.includes("?")?"&":"?")+l}else{o=l}}const a={Accept:"application/json, text/plain, */*"};if(o!==void 0){a["Content-Type"]="application/x-www-form-urlencoded"}try{const c=await fetch(r,{method:t,body:o,headers:a,signal:i.signal,credentials:"same-origin"});const h=await c.text();if(!c.ok){throw new k(c.status,h)}return h}catch(t){if(t instanceof k){throw t}throw new k(i.signal.aborted?-1:0,"")}finally{clearTimeout(n)}}};var P={handleDom:".xq-captcha",dataUrl:"/admin/user/captchadata",checkUrl:"/admin/user/captchacheck",placeholder:"点击按钮进行验证",successText:"✓ 验证成功",failText:"验证失败,请重试",showClose:true,showRefresh:true,showRipple:true,theme:"auto",inputName:"xq_captcha_token",autoInsertInput:true,guardText:"请先完成人机验证",timeout:1e4,copyright:{text:"© xqkeji.cn",url:"https://xqkeji.cn/",title:"xqkeji.cn"}};function _(t,e={}){return{...t,...e,copyright:{...t.copyright,...e.copyright}}}function x(t){return t.transport??new B(t.timeout)}var W=class{constructor(t){this.type=t;this.imgWidth=240;this.imgHeight=150;this.scale=1;this.invScale=1;this.imgLoaded=false;this.busy=false;this.passed=false;this.token=null;this.markWidth=50;this.markTopY=0;this.markOffset=0;this.maxOffset=0;this.moving=false;this.rafId=null;this.charCount=4}beginRound(){this.passed=false;this.token=null;this.busy=false;this.imgLoaded=false}beginRefresh(){this.imgLoaded=false;this.busy=false}cancelFrame(){if(this.rafId!==null){cancelAnimationFrame(this.rafId);this.rafId=null}}};var U=new Set(["ok",'"ok"',"true","1"]);function E(t){return typeof t==="string"&&t!==""?t:null}function V(t,e){let s;try{s=JSON.parse(t)}catch{s=null}if(typeof s!=="object"||s===null){return{success:U.has(t.trim().toLowerCase()),token:null,message:e}}const i=s;return{success:i.success===true||i.code===200||i.status==="ok"||i.status==="success",token:E(i.token),message:E(i.message)??E(i.error)??e}}function Y(t,e){if(!(t instanceof k)){return e}if(t.status===-1){return"请求超时,请重试"}if(t.status===0){return"网络错误,请检查网络连接"}try{const s=JSON.parse(t.body);if(typeof s==="object"&&s!==null){const i=s;const n=E(i.message)??E(i.error);if(n){return n}}}catch{}return t.body?t.body.slice(0,100):e}var T=class{constructor(t,e,s){this.options=t;this.transport=e;this.outcome=s}submit(t){this.transport.request("POST",this.options.checkUrl,t).then(t=>{const e=V(t,this.options.failText);if(e.success){this.outcome.onSuccess(e)}else{this.outcome.onFailure(e.message||this.options.failText)}}).catch(t=>{this.outcome.onFailure(Y(t,this.options.failText))})}};var s=e($(),1);var K=class{constructor(t,e){this.dom=t;this.options=e;this.form=null;this.guard=null;this.fallback=null}mount(){this.resolve();this.block()}block(){if(this.guard){this.guard.value="";this.guard.setCustomValidity(this.guardText())}else if(this.fallback){this.fallback.remove();this.fallback=null}}sync(t){if(this.guard){this.guard.value=t??"";this.guard.setCustomValidity("");return}const e=this.options.inputName;if(!e||!t||!this.options.autoInsertInput){return}if(!this.fallback){const s=this.dom.queryGlobal(this.options.handleDom);if(!s){return}const i=document.createElement("input");i.type="hidden";i.name=e;i.value=t;this.fallback=i;if(this.form){this.form.append(i)}else{s.parentNode?.insertBefore(i,s.nextSibling)}return}this.fallback.value=t}dispose(){if(this.guard){this.guard.value="";this.guard.setCustomValidity("");this.guard=null}this.fallback?.remove();this.fallback=null;this.form=null}remove(){this.block()}resolve(){const t=this.options.inputName;if(!t){return}const e=this.dom.queryGlobal(this.options.handleDom);if(e){this.form=e.closest("form")}const s=this.form??document;const i=s.querySelector(`input[name="${CSS.escape(t)}"]`);if(i&&i.type!=="hidden"){this.guard=i}}guardText(){return this.guard?.dataset.xqGuardText||this.options.guardText}};var z=3e3;var G=2e3;var Q=150;var J=class{constructor(t,e){this.dom=t;this.selectors=e;this.timers=[]}show(t,e){this.clearTimers();const s=this.dom.query(e?this.selectors.msgOk:this.selectors.msgError);const i=this.dom.query(e?this.selectors.msgError:this.selectors.msgOk);if(i){i.classList.remove("show");i.hidden=true}if(!s){return}s.textContent=t;s.hidden=false;void s.offsetWidth;s.classList.add("show");this.timers.push(window.setTimeout(()=>{s.classList.remove("show");this.timers.push(window.setTimeout(()=>{s.hidden=true},Q))},e?z:G))}hideOk(){const t=this.dom.query(this.selectors.msgOk);if(t){t.classList.remove("show");t.hidden=true}}dispose(){this.clearTimers()}clearTimers(){for(const t of this.timers){clearTimeout(t)}this.timers=[]}};var X=500;var Z=class{constructor(t,e,s,i,n={}){this.dom=t;this.modalSelector=e;this.contentSelector=s;this.shakeClass=i;this.hooks=n;this.instance=null;this.shakeTimer=null;this.hideHandler=null;this.shownHandler=null;this.programmatic=false}get element(){return this.dom.queryGlobal(this.modalSelector)}mount(){const t=this.element;if(!t){return}if(this.shownHandler){t.removeEventListener("shown.bs.modal",this.shownHandler)}this.shownHandler=()=>this.hooks.onShown?.();t.addEventListener("shown.bs.modal",this.shownHandler);if(!this.instance){this.instance=s.default.getOrCreateInstance(t,{backdrop:true,keyboard:true,focus:true})}if(!this.hideHandler){this.hideHandler=()=>{if(!this.programmatic){this.hooks.onUserClose?.()}this.programmatic=false};t.addEventListener("hide.bs.modal",this.hideHandler)}}open(){this.ensureInstance().show()}close(){const t=this.element;if(!t||!s.default.getInstance(t)){return}this.programmatic=true;this.instance?.hide()}setType(t){this.element?.setAttribute("data-xq-captcha-type",t)}shake(){const t=this.dom.query(this.contentSelector);if(!t){return}t.classList.add(this.shakeClass);this.clearShakeTimer();this.shakeTimer=window.setTimeout(()=>{t.classList.remove(this.shakeClass);this.shakeTimer=null},X)}dispose(){this.clearShakeTimer();const t=this.element;if(!t){this.instance=null;return}if(this.hideHandler){t.removeEventListener("hide.bs.modal",this.hideHandler)}if(this.shownHandler){t.removeEventListener("shown.bs.modal",this.shownHandler)}const e=()=>{this.instance?.dispose();t.remove();this.instance=null;this.sweepBackdrop()};if(this.instance&&t.classList.contains("show")){t.addEventListener("hidden.bs.modal",e,{once:true});this.instance.hide();window.setTimeout(()=>{if(this.instance){e()}},600)}else{e()}}ensureInstance(){if(this.instance){return this.instance}const t=this.element;this.instance=t?s.default.getOrCreateInstance(t):null;return this.instance}sweepBackdrop(){if(document.querySelector(".modal.show")){return}for(const t of document.querySelectorAll(".modal-backdrop")){t.remove()}document.body.classList.remove("modal-open");document.body.style.removeProperty("padding-right")}clearShakeTimer(){if(this.shakeTimer!==null){clearTimeout(this.shakeTimer);this.shakeTimer=null}}};var tt=class{constructor(t,e){this.dom=t;this.modalSelector=e;this.current="auto";this.media=null;this.onSystemChange=()=>{if(this.current==="auto"){this.write(this.resolve())}}}apply(t){this.current=t||"auto";if(this.current==="auto"){this.media??(this.media=window.matchMedia("(prefers-color-scheme: dark)"));this.media.addEventListener("change",this.onSystemChange)}else{this.media?.removeEventListener("change",this.onSystemChange)}this.write(this.resolve())}dispose(){this.media?.removeEventListener("change",this.onSystemChange);this.media=null}resolve(){if(this.current==="light"||this.current==="dark"){return this.current}return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}write(t){this.dom.queryGlobal(this.modalSelector)?.setAttribute("data-bs-theme",t)}};var et=class{constructor(t,e,s,i){this.dom=t;this.options=e;this.classes=s;this.triggerSelector=i;this.bound=new Set;this.handler=null;this.useBtnSuccess=false}bind(t){this.detach();this.handler=t;for(const e of this.nodes()){e.classList.add("btn","btn-outline-primary");this.render(e,this.options.placeholder,this.options.showRipple);this.bound.add(e);e.addEventListener("click",t)}}detach(){if(this.handler){for(const t of this.bound){t.removeEventListener("click",this.handler)}}this.bound.clear();this.handler=null}showPlaceholder(){this.renderAll(this.options.placeholder,this.options.showRipple)}showSuccess(){this.renderAll(this.options.successText,false)}showFail(){this.renderAll(this.options.failText,false)}setSuccessStyle(t){this.useBtnSuccess=t}renderAll(t,e){for(const s of this.nodes()){this.render(s,t,e)}}render(t,e,s){t.textContent=e;t.classList.remove(this.classes.verified,"btn-success");t.classList.toggle(this.classes.ripple,s);if(this.useBtnSuccess){t.classList.add("btn-success");t.classList.remove("btn-outline-primary")}}nodes(){return this.dom.queryAllGlobal(this.options.handleDom||this.triggerSelector)}};var st=2e3;var it=1200;var S="xq.form.error";var nt=class{bindContext(t){this.ctx=t;this.onContextReady()}onContextReady(){}};var rt=class{constructor(t,e,s={}){this.behaviour=t;this.hooks=e;this.successHideTimer=null;this.failRefreshTimer=null;this.formErrorHandler=null;this.outcome={onSuccess:t=>this.handleSuccess(t),onFailure:t=>this.handleFail(t)};this.options=_(e.defaultOptions,s);this.dom=new H;this.state=new W(e.type);this.callbacks=new R(e.logPrefix);t.bindContext({dom:this.dom,state:this.state,options:this.options,type:e.type,submit:t=>this.submit(t),emitRefresh:()=>this.emitRefresh()});this.modal=new Z(this.dom,e.modalSelector,e.contentSelector,e.shakeClass,{onUserClose:e.useModalCloseHook?()=>{this.callbacks.emit("close");this.callbacks.emit("hide")}:void 0,onShown:()=>this.behaviour.onModalShown?.()});this.message=new J(this.dom,e.messageSelectors);this.theme=new tt(this.dom,e.modalSelector);this.trigger=new et(this.dom,this.options,e.triggerClasses,e.triggerSelector);this.trigger.setSuccessStyle(e.type==="click");this.hiddenInput=new K(this.dom,this.options);this.transport=x(this.options);this.dataClient=new w(this.options,this.transport,e.type);this.submitter=new T(this.options,this.transport,this.outcome)}init(t){if(t){Object.assign(this.options,_(this.hooks.defaultOptions,t));this.transport=x(this.options);this.dataClient=new w(this.options,this.transport,this.hooks.type);this.submitter=new T(this.options,this.transport,this.outcome)}this.dom.setRoot(this.behaviour.buildModal(this.options));this.modal.mount();this.theme.apply(this.options.theme);this.modal.setType(this.hooks.type);this.behaviour.attachInteraction();this.bindTools();this.trigger.bind(()=>this.show());this.bindFormError();this.hiddenInput.mount();return this}bindTools(){}bindButton(t,e,s="xqCaptchaBound"){const i=this.dom.query(t);if(!i||i.dataset[s]==="1"){return}i.dataset[s]="1";i.addEventListener("click",e)}show(){this.clearTimers();this.state.beginRound();this.behaviour.resetForShow();this.hiddenInput.block();this.trigger.showPlaceholder();this.message.hideOk();this.modal.open();this.refresh();this.callbacks.emit("show")}hide(){this.behaviour.suspendInteraction();this.modal.close();this.callbacks.emit("hide")}refresh(){this.clearFailTimer();this.state.beginRefresh();this.behaviour.prepareRefresh();this.dataClient.load().then(t=>this.behaviour.applyData(t)).catch(t=>{console.error(`${this.hooks.logPrefix}: \u83B7\u53D6\u9A8C\u8BC1\u7801\u5931\u8D25`,t)})}reset(){this.hide();this.clearTimers();this.state.beginRound();this.hiddenInput.block();this.trigger.showPlaceholder();this.refresh();this.callbacks.emit("reset");return this}result(){return this.state.passed}getToken(){return this.state.token}getCaptchaType(){return this.state.type}setTheme(t){this.options.theme=t||"auto";this.theme.apply(this.options.theme);return this}onSuccess(t){this.callbacks.set("success",t);return this}onFail(t){this.callbacks.set("fail",t);return this}onClose(t){this.callbacks.set("close",t);return this}onShow(t){this.callbacks.set("show",t);return this}onHide(t){this.callbacks.set("hide",t);return this}onRefresh(t){this.callbacks.set("refresh",t);return this}onReset(t){this.callbacks.set("reset",t);return this}dispose(){this.clearTimers();this.behaviour.detachInteraction();this.trigger.detach();this.message.dispose();this.theme.dispose();this.modal.dispose();this.hiddenInput.dispose();if(this.formErrorHandler){document.removeEventListener(S,this.formErrorHandler);this.formErrorHandler=null}}submit(t){this.submitter.submit(t)}emitRefresh(){this.callbacks.emit("refresh",this.hooks.type,false)}handleSuccess(t){this.state.busy=false;this.state.passed=true;if(t.token){this.state.token=t.token}this.trigger.showSuccess();this.message.show(this.options.successText,true);this.hiddenInput.sync(this.getToken());this.clearSuccessTimer();this.successHideTimer=window.setTimeout(()=>{this.successHideTimer=null;this.hide()},st);this.callbacks.emit("success",this.getToken())}handleFail(t){this.state.busy=false;this.state.passed=false;this.state.token=null;this.hiddenInput.block();this.behaviour.markFailures();this.modal.shake();this.message.show(t,false);this.trigger.showFail();this.callbacks.emit("fail",t);this.clearFailTimer();this.failRefreshTimer=window.setTimeout(()=>{this.failRefreshTimer=null;this.behaviour.beforeFailRefresh();this.state.busy=false;this.refresh()},it)}bindFormError(){if(this.formErrorHandler){return}this.formErrorHandler=t=>{const e=t.target;if(!(e instanceof Element)||!e.querySelector(this.options.handleDom)){return}try{this.reset()}catch(t){console.error(`${this.hooks.logPrefix}: \u8868\u5355\u5931\u8D25\u590D\u4F4D\u5F02\u5E38`,t)}};document.addEventListener(S,this.formErrorHandler)}clearTimers(){this.clearSuccessTimer();this.clearFailTimer()}clearSuccessTimer(){if(this.successHideTimer!==null){clearTimeout(this.successHideTimer);this.successHideTimer=null}}clearFailTimer(){if(this.failRefreshTimer!==null){clearTimeout(this.failRefreshTimer);this.failRefreshTimer=null}}};var ot={...P,slideText:"拖动左边滑块完成上方拼图"};function at(t={}){return _(ot,t)}var C={trigger:".xq-captcha",modal:"#xq-slide-captcha-modal",dialog:".xq-captcha-dialog",content:".xq-captcha-content",loading:".xq-captcha-loading",canvasWrap:".xq-captcha-canvas-wrap",bgCanvas:".xq-captcha-bg-canvas",markCanvas:".xq-captcha-mark-canvas",msgError:".xq-captcha-alert-error",msgOk:".xq-captcha-alert-success",slideArea:".xq-captcha-slide-area",slideBlock:".xq-captcha-slide-block",slideText:".xq-captcha-slide-hint",close:".xq-captcha-close",refresh:".xq-captcha-refresh",copyright:".xq-captcha-copyright",progressBar:".xq-captcha-progress-bar"};var A={ripple:"xq-captcha-ripple",verified:"xq-captcha-verified",dragging:"xq-captcha-dragging",shake:"xq-captcha-shake",loadingError:"xq-captcha-loading-error",hidden:"d-none"};var q="xqCaptchaBound";function j(t,e=false){return t.getContext("2d",{willReadFrequently:e})}var lt=class{constructor(t,e){this.dom=t;this.state=e}dom;state;get bg(){return this.dom.query(C.bgCanvas)}get mark(){return this.dom.query(C.markCanvas)}resize(t,e){for(const s of[this.bg,this.mark]){if(s){s.width=t;s.height=e}}}clear(){for(const t of[this.bg,this.mark]){const e=t&&j(t);if(t&&e){e.clearRect(0,0,t.width,t.height)}}}clearMark(){const t=this.mark;const e=t&&j(t);if(t&&e){e.clearRect(0,0,t.width,t.height)}}setVisible(t){for(const e of[this.bg,this.mark]){if(e){e.style.display=t?"block":"none"}}}measure(){const t=this.bg;if(!t||t.width<=0){return}const e=this.dom.query(C.canvasWrap);const s=e?.getBoundingClientRect().width||t.getBoundingClientRect().width||t.width;this.state.scale=s/t.width;this.state.invScale=t.width/s}drawBackground(t){const e=this.bg;const s=e&&j(e);if(!e||!s){return}const{imgWidth:i,imgHeight:n}=this.state;s.drawImage(t,0,0,i,n,0,0,i,n)}};function ct(i){return new Promise((t,e)=>{const s=new Image;s.onload=()=>t(s);s.onerror=()=>e(new Error("验证码图片加载失败"));s.src=i})}var ht=77;var dt=150;var ut=29;var O=1;var L=5;var ft=5;var mt=15;var pt=class{constructor(t,e){this.canvas=t;this.state=e}canvas;state;image=null;prepared=null;reset(){this.image=null;this.prepared=null}setImage(t){this.image=t;this.prepared=null;if(this.state.type==="slide"){this.prepare(t)}}draw(){if(this.state.type!=="slide"){return}const t=this.canvas.mark;const e=t&&j(t,true);if(!t||!e){return}e.clearRect(0,0,t.width,t.height);const s=this.state.markOffset*this.state.invScale;const i=Math.min(this.state.markWidth,t.width-s);if(i<=0){return}const n=this.state.imgHeight;if(this.prepared){e.drawImage(this.prepared,0,0,i,n,s,0,i,n)}else if(this.image){e.drawImage(this.image,0,n,i,n,s,0,i,n)}}prepare(t){const e=this.state.markWidth;const s=this.state.imgHeight;const i=document.createElement("canvas");i.width=e;i.height=s;const n=j(i,true);if(!n){return}n.drawImage(t,0,s,e,s,0,0,e,s);try{const r=n.getImageData(0,0,e,s);gt(r.data,e,s);n.putImageData(r,0,0)}catch(t){console.warn("xq-slide-captcha: 滑块图层抠图失败,回退到原图",t)}this.prepared=i}};function gt(s,i,t){for(let e=0;e<t;e++){const n=bt(s,i,e);const r=yt(n);for(let t=0;t<i;t++){const o=Math.max(0,n[t]-r);const a=Math.max(0,Math.min(255,Math.round((o-ft)/mt*255)));const l=(e*i+t)*4;if(a<s[l+3]){s[l+3]=a}}}}function bt(n,r,o){const t=new Float32Array(r);for(let i=0;i<r;i++){let e=0;let s=0;for(let t=-O;t<=O;t++){const a=i+t;if(a<0||a>=r){continue}const l=(o*r+a)*4;e+=(n[l]*ht+n[l+1]*dt+n[l+2]*ut)/256;s++}t[i]=s>0?e/s:0}return t}function yt(e){let s=Number.POSITIVE_INFINITY;const i=e.length-1;for(let t=0;t<L;t++){const n=Math.min(i,Math.round(t*i/(L-1)));s=Math.min(s,e[n]??0)}return Number.isFinite(s)?s:0}var vt=class{constructor(t,e,s){this.target=t;this.enabled=e;this.callbacks=s}target;enabled;callbacks;dragging=false;onDown=t=>{if(this.dragging||!this.enabled()){return}if(t.cancelable){t.preventDefault()}this.dragging=true;this.bindDocument();this.callbacks.onStart(t.clientX,t.clientY)};onMove=t=>{if(!this.dragging){return}if(t.cancelable){t.preventDefault()}this.callbacks.onMove(t.clientX,t.clientY)};onUp=t=>{if(!this.dragging){return}if(t.cancelable){t.preventDefault()}this.stop();this.callbacks.onEnd()};onCancel=()=>{if(!this.dragging){return}this.stop();this.callbacks.onCancel()};attach(){this.target.addEventListener("pointerdown",this.onDown)}detach(){this.target.removeEventListener("pointerdown",this.onDown);this.stop()}cancel(){this.stop()}stop(){this.dragging=false;this.unbindDocument()}bindDocument(){document.addEventListener("pointermove",this.onMove,{passive:false});document.addEventListener("pointerup",this.onUp,{passive:false});document.addEventListener("pointercancel",this.onCancel)}unbindDocument(){document.removeEventListener("pointermove",this.onMove);document.removeEventListener("pointerup",this.onUp);document.removeEventListener("pointercancel",this.onCancel)}};var wt=4;var kt=12;var _t={ArrowLeft:-1,Left:-1,ArrowRight:1,Right:1};var D={Home:"start",End:"end"};var xt=class{constructor(t,e,s){this.target=t;this.state=e;this.callbacks=s}target;state;callbacks;keyUp=null;onKeyDown=t=>{if(!this.enabled()){return}const e=t.shiftKey?kt:wt;const s=_t[t.key];let i=null;if(s!==void 0){i=this.state.markOffset+s*e}else if(Object.prototype.hasOwnProperty.call(D,t.key)){i=D[t.key]==="start"?0:this.state.maxOffset}if(i===null){return}t.preventDefault();this.callbacks.onOffset(Math.max(0,Math.min(i,this.state.maxOffset)));this.listenKeyUp()};attach(){this.target.addEventListener("keydown",this.onKeyDown)}detach(){this.target.removeEventListener("keydown",this.onKeyDown);this.clearKeyUp()}cancelCommit(){this.clearKeyUp()}listenKeyUp(){if(this.keyUp){return}const t=()=>{this.clearKeyUp();if(this.enabled()){this.callbacks.onCommit()}};this.keyUp=t;document.addEventListener("keyup",t)}clearKeyUp(){if(this.keyUp){document.removeEventListener("keyup",this.keyUp);this.keyUp=null}}enabled(){return this.state.type==="slide"&&this.state.imgLoaded&&!this.state.busy}};var Et=class{points=[];start=0;get samples(){return this.points}get started(){return this.start>0}begin(){this.points=[];this.start=Date.now()}record(t,e){this.points.push({x:Math.round(t),y:Math.round(e),t:Date.now()-this.start})}reset(){this.points=[];this.start=0}};var Tt=class{constructor(t,e,s,i){this.dom=t;this.state=e;this.layer=s;this.onCommit=i}dom;state;layer;onCommit;recorder=new Et;drag=null;keyboard=null;startClientX=0;startClientY=0;get track(){return this.recorder.samples}attach(){const t=this.block;if(!t){return}this.detach();this.drag=new vt(t,()=>this.enabled(),{onStart:(t,e)=>this.start(t,e),onMove:(t,e)=>this.move(t,e),onEnd:()=>this.submit(),onCancel:()=>this.abort()});this.keyboard=new xt(t,this.state,{onOffset:t=>this.keyMove(t),onCommit:()=>this.submit()});this.drag.attach();this.keyboard.attach()}detach(){this.drag?.detach();this.keyboard?.detach();this.drag=null;this.keyboard=null}reset(){this.recorder.reset();this.state.markOffset=0;this.paint()}suspend(){this.drag?.cancel();this.keyboard?.cancelCommit();this.state.cancelFrame();this.state.moving=false;this.block?.classList.remove(A.dragging)}start(t,e){this.startClientX=t;this.startClientY=e;this.state.busy=true;this.state.moving=true;this.recorder.begin();this.block?.classList.add(A.dragging)}move(t,e){const s=Math.max(0,Math.min(t-this.startClientX,this.state.maxOffset));const i=this.state.scale>0?1/this.state.scale:1;this.recorder.record(s*i,this.state.markTopY+(e-this.startClientY)*i);if(s===this.state.markOffset){return}this.state.markOffset=s;this.state.cancelFrame();this.state.rafId=requestAnimationFrame(()=>{this.paint();this.state.rafId=null})}keyMove(t){if(!this.recorder.started){this.recorder.begin()}this.recorder.record(t*this.state.invScale,this.state.markTopY);this.state.markOffset=t;this.paint()}submit(){this.state.cancelFrame();this.state.moving=false;this.state.busy=true;this.block?.classList.remove(A.dragging);this.paint();this.onCommit(Math.round(this.state.markOffset*this.state.invScale),this.recorder.samples)}abort(){this.state.cancelFrame();this.state.moving=false;this.state.busy=false;this.block?.classList.remove(A.dragging);this.reset()}paint(){const t=this.block;const e=this.state.markOffset;const s=this.state.maxOffset;const i=s>0?Math.round(e/s*100):0;if(t){t.style.transform=`translateX(${e}px)`;t.setAttribute("aria-valuenow",String(i))}const n=this.dom.query(C.progressBar);if(n){n.style.width=`${i}%`;n.setAttribute("aria-valuenow",String(i))}this.layer.draw()}enabled(){return this.state.type==="slide"&&this.state.imgLoaded&&!this.state.busy}get block(){return this.dom.query(C.slideBlock)}};var St=class{constructor(t,e){this.dom=t;this.options=e}dom;options;forSlide(){const t=this.dom.query(C.slideText);if(!t){return}t.textContent=this.options.slideText;t.removeAttribute("style");t.classList.remove("d-none")}};var Ct=class{constructor(t){this.dom=t}dom;show(){const t=this.element;if(!t){return}const e=document.createElement("div");e.className="spinner-border text-primary";e.setAttribute("role","status");const s=document.createElement("span");s.className="visually-hidden";s.textContent="加载中";e.append(s);const i=document.createElement("span");i.textContent="加载中...";t.replaceChildren(e,i);t.classList.remove(A.loadingError);t.classList.remove(A.hidden)}hide(){const t=this.element;if(!t){return}t.replaceChildren();t.classList.remove(A.loadingError);t.classList.add(A.hidden)}fail(){const t=this.element;if(!t){return}const e=document.createElement("div");e.className="text-danger small fw-semibold text-center";e.append("加载失败",document.createElement("br"),"请刷新重试");t.replaceChildren(e);t.classList.add(A.loadingError);t.classList.remove(A.hidden)}get element(){return this.dom.query(C.loading)}};function M(t,e="",s={}){const i=document.createElement(t);if(e){i.className=e}for(const[n,r]of Object.entries(s)){i.setAttribute(n,r)}return i}function At(t){const e=document.querySelector(C.modal);if(e){return e}const s=M("div","modal fade xq-captcha-modal",{id:"xq-slide-captcha-modal","data-xq-captcha-kind":"slide",role:"dialog","aria-modal":"true","aria-label":"人机验证","aria-hidden":"true",tabindex:"-1"});const i=M("div","modal-dialog modal-dialog-centered xq-captcha-dialog");const n=M("div","modal-content xq-captcha-content");const r=M("div","modal-header");const o=M("h5","modal-title h6");o.textContent="安全验证";r.append(o);if(t.showClose){const v=M("button","btn-close xq-captcha-close",{type:"button","aria-label":"关闭"});r.append(v)}n.append(r);const a=M("div","modal-body");const l=M("div",`${C.canvasWrap.slice(1)} position-relative w-100 overflow-hidden rounded border`);const c=M("div",`${C.loading.slice(1)} position-absolute top-0 start-0 w-100 h-100 z-3 d-flex flex-column align-items-center justify-content-center gap-2`);l.append(c);l.append(M("canvas",`${C.bgCanvas.slice(1)} position-relative z-1 d-block w-100 h-auto border-0`,{width:"240",height:"150","aria-label":"验证码图片"}));l.append(M("canvas",`${C.markCanvas.slice(1)} position-absolute top-0 start-0 w-100 h-100 z-2 pe-none`,{width:"240",height:"150"}));a.append(l);const h=M("div","alert alert-danger fade xq-captcha-alert-error",{role:"alert"});const d=M("div","alert alert-success fade xq-captcha-alert-success",{role:"status"});h.style.display="none";d.style.display="none";a.append(h,d);const u=M("div",`${C.slideArea.slice(1)} position-relative w-100 overflow-hidden rounded-pill border`);const f=M("button",`btn btn-primary rounded-circle d-flex align-items-center justify-content-center p-0 user-select-none ${C.slideBlock.slice(1)}`,{type:"button",tabindex:"0",role:"slider","aria-label":"拖动滑块完成拼图","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":"0"});const m=M("span",`${C.slideText.slice(1)} d-flex align-items-center justify-content-center pe-none user-select-none`);m.textContent=t.slideText;const p=M("div","progress xq-captcha-progress");const g=M("div",`progress-bar ${C.progressBar.slice(1)}`,{role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":"0"});p.append(g);u.append(f,m,p);a.append(u);n.append(a);const b=M("div","modal-footer");const y=M("a",`${C.copyright.slice(1)} link-secondary small`,{href:t.copyright.url,target:"_blank",rel:"noopener noreferrer",title:t.copyright.title});y.textContent=t.copyright.text;b.append(y);if(t.showRefresh){const w=M("button",`btn btn-outline-secondary btn-sm ${C.refresh.slice(1)}`,{type:"button","aria-label":"刷新验证码"});w.textContent="刷新";b.append(w)}n.append(b);i.append(n);s.append(i);document.body.append(s);return s}var qt={logPrefix:"xq-slide-captcha",type:"slide",defaultOptions:at({}),modalSelector:C.modal,contentSelector:C.content,shakeClass:"xq-captcha-shake",messageSelectors:{msgOk:C.msgOk,msgError:C.msgError},triggerClasses:{ripple:"xq-captcha-ripple",verified:"xq-captcha-verified"},triggerSelector:C.trigger};var jt=class extends nt{canvas;layer;slider;hint;loading;onContextReady(){this.canvas=new lt(this.ctx.dom,this.ctx.state);this.layer=new pt(this.canvas,this.ctx.state);this.hint=new St(this.ctx.dom,this.ctx.options);this.loading=new Ct(this.ctx.dom);this.slider=new Tt(this.ctx.dom,this.ctx.state,this.layer,(t,e)=>{this.ctx.submit({captcha_r:String(t),slide_track:JSON.stringify(e)})})}buildModal(t){return At(t)}attachInteraction(){this.slider.attach()}detachInteraction(){this.slider.detach()}resetForShow(){this.slider.suspend();this.slider.reset()}suspendInteraction(){this.slider.suspend()}prepareRefresh(){this.slider.reset();this.layer.reset();this.canvas.setVisible(false);this.canvas.clear();this.loading.show()}async applyData(t){this.ctx.state.imgWidth=t.bg_width||240;this.ctx.state.imgHeight=t.bg_height||150;this.ctx.state.markWidth=t.mark_width||50;this.ctx.state.markTopY=typeof t.pos_y==="number"?t.pos_y:0;this.hint.forSlide();this.canvas.resize(this.ctx.state.imgWidth,this.ctx.state.imgHeight);this.ctx.emitRefresh();try{const e=await ct(t.image_base64);this.canvas.setVisible(true);this.canvas.measure();this.ctx.state.maxOffset=Math.max(0,Math.round((this.ctx.state.imgWidth-this.ctx.state.markWidth)*this.ctx.state.scale));this.canvas.drawBackground(e);this.canvas.clearMark();this.layer.setImage(e);this.ctx.state.imgLoaded=true;this.loading.hide();this.slider.reset()}catch(t){console.error("xq-slide-captcha: 验证码图片加载失败",t);this.loading.fail()}}markFailures(){}beforeFailRefresh(){}onModalShown(){this.canvas.measure();this.layer.draw()}get track(){return this.slider.track}};var Ot=class extends rt{slideBehaviour;constructor(t={}){const e=new jt;super(e,qt,t);this.slideBehaviour=e}init(t){return super.init(t)}getSlideTrack(){return this.slideBehaviour.track}bindTools(){this.bindButton(C.close,()=>{this.callbacks.emit("close");this.hide()},q);this.bindButton(C.refresh,()=>this.refresh(),q)}};var I=new Ot;function Lt(t=I){window.xqSlideCaptcha=t;return t}if(typeof window!=="undefined"){window.xqSlideCaptcha=I}})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xq-slide-captcha",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "滑动拼图验证码前端组件(TypeScript + SCSS),配套 xqkeji/xq-app-admin 的 captchadata / captchacheck 接口",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"homepage": "https://xqkeji.cn/demo/xq-slide-captcha",
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"bootstrap": "^5.3.3",
|
|
47
|
-
"xq-captcha-core": "^1.
|
|
47
|
+
"xq-captcha-core": "^1.1.0",
|
|
48
48
|
"xq-util": "^1.0.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|