go-captcha-vue 2.0.2 → 2.0.3

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.
Files changed (31) hide show
  1. package/README.md +41 -4
  2. package/dist/components/button/index.vue.d.ts +3 -6
  3. package/dist/components/click/hooks/handler.d.ts +5 -1
  4. package/dist/components/click/index.vue.d.ts +9 -6
  5. package/dist/components/click/meta/config.d.ts +2 -0
  6. package/dist/components/click/meta/data.d.ts +1 -1
  7. package/dist/components/click/meta/event.d.ts +2 -3
  8. package/dist/components/click/meta/expose.d.ts +11 -0
  9. package/dist/components/rotate/hooks/handler.d.ts +7 -1
  10. package/dist/components/rotate/index.vue.d.ts +9 -6
  11. package/dist/components/rotate/meta/config.d.ts +2 -0
  12. package/dist/components/rotate/meta/data.d.ts +1 -0
  13. package/dist/components/rotate/meta/event.d.ts +1 -1
  14. package/dist/components/rotate/meta/expose.d.ts +11 -0
  15. package/dist/components/slide/hooks/handler.d.ts +7 -1
  16. package/dist/components/slide/index.vue.d.ts +9 -6
  17. package/dist/components/slide/meta/config.d.ts +2 -0
  18. package/dist/components/slide/meta/data.d.ts +1 -0
  19. package/dist/components/slide/meta/event.d.ts +1 -1
  20. package/dist/components/slide/meta/expose.d.ts +11 -0
  21. package/dist/components/slide-region/hooks/handler.d.ts +7 -1
  22. package/dist/components/slide-region/index.vue.d.ts +9 -6
  23. package/dist/components/slide-region/meta/config.d.ts +2 -0
  24. package/dist/components/slide-region/meta/data.d.ts +1 -0
  25. package/dist/components/slide-region/meta/event.d.ts +1 -1
  26. package/dist/components/slide-region/meta/expose.d.ts +11 -0
  27. package/dist/go-captcha-vue.es.js +747 -591
  28. package/dist/go-captcha-vue.umd.js +8 -8
  29. package/dist/index.d.ts +4 -2
  30. package/dist/style.css +1 -1
  31. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { defineComponent as X, openBlock as w, createElementBlock as C, mergeProps as I, createElementVNode as c, reactive as ne, toRaw as me, ref as z, watch as K, computed as P, normalizeClass as j, normalizeStyle as _, toDisplayString as U, withDirectives as V, unref as a, vShow as N, createVNode as D, Fragment as pe, renderList as _e, onMounted as ie, nextTick as ae, toRefs as Ee, createBlock as O, createCommentVNode as be } from "vue";
2
- const re = () => ({
1
+ import { defineComponent as U, openBlock as z, createElementBlock as Y, mergeProps as oe, createElementVNode as o, reactive as B, toRaw as I, watch as F, computed as x, withDirectives as K, normalizeClass as se, normalizeStyle as D, toDisplayString as ie, vShow as Q, createVNode as A, unref as v, Fragment as De, renderList as $e, ref as ee, onMounted as pe, nextTick as _e, toRefs as ze, createBlock as ae, createCommentVNode as Ce } from "vue";
2
+ const we = () => ({
3
3
  width: 300,
4
4
  height: 220,
5
5
  thumbWidth: 150,
@@ -8,32 +8,34 @@ const re = () => ({
8
8
  horizontalPadding: 12,
9
9
  showTheme: !0,
10
10
  title: "请在下图依次点击",
11
- buttonText: "确认"
12
- }), we = /* @__PURE__ */ c("path", { d: `M100.1,189.9C100.1,189.9,100,189.9,100.1,189.9c-49.7,0-90-40.4-90-89.9c0-49.6,40.4-89.9,89.9-89.9
11
+ buttonText: "确认",
12
+ iconSize: 22,
13
+ dotSize: 24
14
+ }), Se = /* @__PURE__ */ o("path", { d: `M100.1,189.9C100.1,189.9,100,189.9,100.1,189.9c-49.7,0-90-40.4-90-89.9c0-49.6,40.4-89.9,89.9-89.9
13
15
  c49.6,0,89.9,40.4,89.9,89.9c0,18.2-5.4,35.7-15.6,50.7c-1.5,2.1-3.6,3.4-6.1,3.9c-2.5,0.4-5-0.1-7-1.6c-4.2-3-5.3-8.6-2.4-12.9
14
16
  c8.1-11.9,12.4-25.7,12.4-40.1c0-39.2-31.9-71.1-71.1-71.1c-39.2,0-71.1,31.9-71.1,71.1c0,39.2,31.9,71.1,71.1,71.1
15
17
  c7.7,0,15.3-1.2,22.6-3.6c2.4-0.8,4.9-0.6,7.2,0.5c2.2,1.1,3.9,3.1,4.7,5.5c1.6,4.9-1,10.2-5.9,11.9
16
18
  C119.3,188.4,109.8,189.9,100.1,189.9z M73,136.4C73,136.4,73,136.4,73,136.4c-2.5,0-4.9-1-6.7-2.8c-3.7-3.7-3.7-9.6,0-13.3
17
19
  L86.7,100L66.4,79.7c-3.7-3.7-3.7-9.6,0-13.3c3.7-3.7,9.6-3.7,13.3,0L100,86.7l20.3-20.3c1.8-1.8,4.1-2.8,6.7-2.8c0,0,0,0,0,0
18
20
  c2.5,0,4.9,1,6.7,2.8c1.8,1.8,2.8,4.1,2.8,6.7c0,2.5-1,4.9-2.8,6.7L113.3,100l20.3,20.3c3.7,3.7,3.7,9.6,0,13.3
19
- c-3.7,3.7-9.6,3.7-13.3,0L100,113.3l-20.3,20.3C77.9,135.4,75.5,136.4,73,136.4z` }, null, -1), xe = [
20
- we
21
- ], ce = /* @__PURE__ */ X({
21
+ c-3.7,3.7-9.6,3.7-13.3,0L100,113.3l-20.3,20.3C77.9,135.4,75.5,136.4,73,136.4z` }, null, -1), Be = [
22
+ Se
23
+ ], ge = /* @__PURE__ */ U({
22
24
  __name: "close-icon",
23
25
  emits: ["click"],
24
- setup(l, { emit: n }) {
25
- const t = n;
26
- function s(e) {
27
- t("click", e);
26
+ setup(n, { emit: t }) {
27
+ const a = t;
28
+ function r(i) {
29
+ a("click", i);
28
30
  }
29
- return (e, i) => (w(), C("svg", I({
31
+ return (i, m) => (z(), Y("svg", oe({
30
32
  xmlns: "http://www.w3.org/2000/svg",
31
33
  viewBox: "0 0 200 200",
32
34
  width: "20",
33
35
  height: "20"
34
- }, e.$attrs, { onClick: s }), xe, 16));
36
+ }, i.$attrs, { onClick: r }), Be, 16));
35
37
  }
36
- }), Le = /* @__PURE__ */ c("path", { d: `M135,149.9c-10.7,7.6-23.2,11.4-36,11.2c-1.7,0-3.4-0.1-5-0.3c-0.7-0.1-1.4-0.2-2-0.3c-1.3-0.2-2.6-0.4-3.9-0.6
38
+ }), Te = /* @__PURE__ */ o("path", { d: `M135,149.9c-10.7,7.6-23.2,11.4-36,11.2c-1.7,0-3.4-0.1-5-0.3c-0.7-0.1-1.4-0.2-2-0.3c-1.3-0.2-2.6-0.4-3.9-0.6
37
39
  c-0.8-0.2-1.6-0.4-2.3-0.5c-1.2-0.3-2.5-0.6-3.7-1c-0.6-0.2-1.2-0.4-1.7-0.6c-1.4-0.5-2.8-1-4.2-1.5c-0.3-0.1-0.6-0.3-0.9-0.4
38
40
  c-1.6-0.7-3.2-1.4-4.7-2.3c-0.1,0-0.1-0.1-0.2-0.1c-5.1-2.9-9.8-6.4-14-10.6c-0.1-0.1-0.1-0.1-0.2-0.2c-1.3-1.3-2.5-2.7-3.7-4.1
39
41
  c-0.2-0.3-0.5-0.6-0.7-0.9c-8.4-10.6-13.5-24.1-13.5-38.8h14.3c0.4,0,0.7-0.2,0.9-0.5c0.2-0.3,0.2-0.8,0-1.1L29.5,60.9
@@ -50,29 +52,29 @@ const re = () => ({
50
52
  c0.6,0.1,1.3,0.3,1.9,0.4c1.4,0.3,2.8,0.7,4.2,1.1c0.4,0.1,0.9,0.3,1.3,0.4c1.6,0.5,3.1,1.1,4.6,1.7c0.2,0.1,0.3,0.1,0.5,0.2
51
53
  c9,3.9,17,10,23.2,17.6c0,0,0.1,0.1,0.1,0.2c8.7,10.7,14,24.5,14,39.4H147c-0.4,0-0.7,0.2-0.9,0.5c-0.2,0.3-0.2,0.8,0,1.1l24,36.4
52
54
  c0.2,0.3,0.5,0.5,0.9,0.5c0.4,0,0.7-0.2,0.9-0.5l23.9-36.4c0.2-0.3,0.2-0.7,0-1.1c-0.2-0.3-0.5-0.5-0.9-0.5L180.6,98.9L180.6,98.9
53
- L180.6,98.9z` }, null, -1), ke = [
54
- Le
55
- ], se = /* @__PURE__ */ X({
55
+ L180.6,98.9z` }, null, -1), Pe = [
56
+ Te
57
+ ], fe = /* @__PURE__ */ U({
56
58
  __name: "refresh-icon",
57
59
  emits: ["click"],
58
- setup(l, { emit: n }) {
59
- const t = n;
60
- function s(e) {
61
- t("click", e);
60
+ setup(n, { emit: t }) {
61
+ const a = t;
62
+ function r(i) {
63
+ a("click", i);
62
64
  }
63
- return (e, i) => (w(), C("svg", I({
65
+ return (i, m) => (z(), Y("svg", oe({
64
66
  xmlns: "http://www.w3.org/2000/svg",
65
67
  viewBox: "0 0 200 200",
66
68
  width: "20",
67
69
  height: "20"
68
- }, e.$attrs, { onClick: s }), ke, 16));
70
+ }, i.$attrs, { onClick: r }), Pe, 16));
69
71
  }
70
- }), ye = /* @__PURE__ */ c("circle", {
72
+ }), Xe = /* @__PURE__ */ o("circle", {
71
73
  cx: "50",
72
74
  cy: "36.8101",
73
75
  r: "10"
74
76
  }, [
75
- /* @__PURE__ */ c("animate", {
77
+ /* @__PURE__ */ o("animate", {
76
78
  attributeName: "cy",
77
79
  dur: "1s",
78
80
  repeatCount: "indefinite",
@@ -81,164 +83,190 @@ const re = () => ({
81
83
  keyTimes: "0;0.5;1",
82
84
  values: "23;77;23"
83
85
  })
84
- ], -1), $e = [
85
- ye
86
- ], le = /* @__PURE__ */ X({
86
+ ], -1), We = [
87
+ Xe
88
+ ], ve = /* @__PURE__ */ U({
87
89
  __name: "loading-icon",
88
90
  emits: ["click"],
89
- setup(l, { emit: n }) {
90
- const t = n;
91
- function s(e) {
92
- t("click", e);
91
+ setup(n, { emit: t }) {
92
+ const a = t;
93
+ function r(i) {
94
+ a("click", i);
93
95
  }
94
- return (e, i) => (w(), C("svg", I({
96
+ return (i, m) => (z(), Y("svg", oe({
95
97
  xmlns: "http://www.w3.org/2000/svg",
96
98
  viewBox: "0 0 100 100",
97
99
  preserveAspectRatio: "xMidYMid",
98
100
  width: "84",
99
101
  height: "84"
100
- }, e.$attrs, { onClick: s }), $e, 16));
102
+ }, i.$attrs, { onClick: r }), We, 16));
101
103
  }
102
104
  });
103
- function Ce(l) {
104
- let n = 0, t = 0;
105
- if (l.getBoundingClientRect) {
106
- const s = l.getBoundingClientRect(), e = document.documentElement;
107
- n = s.left + Math.max(e.scrollLeft, document.body.scrollLeft) - e.clientLeft, t = s.top + Math.max(e.scrollTop, document.body.scrollTop) - e.clientTop;
105
+ function Me(n) {
106
+ let t = 0, a = 0;
107
+ if (n.getBoundingClientRect) {
108
+ const r = n.getBoundingClientRect(), i = document.documentElement;
109
+ t = r.left + Math.max(i.scrollLeft, document.body.scrollLeft) - i.clientLeft, a = r.top + Math.max(i.scrollTop, document.body.scrollTop) - i.clientTop;
108
110
  } else
109
- for (; l !== document.body; )
110
- n += l.offsetLeft, t += l.offsetTop, l = l.offsetParent;
111
+ for (; n !== document.body; )
112
+ t += n.offsetLeft, a += n.offsetTop, n = n.offsetParent;
111
113
  return {
112
- domX: n,
113
- domY: t
114
+ domX: t,
115
+ domY: a
114
116
  };
115
117
  }
116
- function ue(l, n) {
117
- let t = n.relatedTarget;
118
+ function be(n, t) {
119
+ let a = t.relatedTarget;
118
120
  try {
119
- for (; t && t !== l; )
120
- t = t.parentNode;
121
- } catch (s) {
122
- console.warn(s);
121
+ for (; a && a !== n; )
122
+ a = a.parentNode;
123
+ } catch (r) {
124
+ console.warn(r);
123
125
  }
124
- return t !== l;
126
+ return a !== n;
125
127
  }
126
- function Te(l, n) {
127
- const t = ne({ list: [] });
128
+ function Fe(n, t, a) {
129
+ const r = B({ list: [] }), i = (s) => {
130
+ const p = s.currentTarget, b = Me(p), l = s.pageX || s.clientX, _ = s.pageY || s.clientY, g = b.domX, S = b.domY, L = l - g, h = _ - S, f = parseInt(L.toString()), w = parseInt(h.toString()), T = /* @__PURE__ */ new Date(), q = r.list.length;
131
+ return r.list.push({ key: T.getTime(), index: q + 1, x: f, y: w }), t.click && t.click(f, w), s.cancelBubble = !0, s.preventDefault(), !1;
132
+ }, m = (s) => (t.confirm && t.confirm(I(r.list), () => {
133
+ y();
134
+ }), s.cancelBubble = !0, s.preventDefault(), !1), c = (s) => (e(), s.cancelBubble = !0, s.preventDefault(), !1), u = (s) => (d(), s.cancelBubble = !0, s.preventDefault(), !1), e = () => {
135
+ t.close && t.close(), y();
136
+ }, d = () => {
137
+ t.refresh && t.refresh(), y();
138
+ }, y = () => {
139
+ r.list = [];
140
+ };
128
141
  return {
129
- dots: t,
130
- clickEvent: (o) => {
131
- const x = o.currentTarget, u = Ce(x), m = o.pageX || o.clientX, r = o.pageY || o.clientY, v = u.domX, E = u.domY, b = m - v, g = r - E, p = parseInt(b.toString()), L = parseInt(g.toString()), $ = /* @__PURE__ */ new Date(), M = t.list.length, T = t.list;
132
- return T.push({ key: $.getTime(), index: M + 1, x: p, y: L }), t.list = T, n.click && n.click(p, L), o.cancelBubble = !0, o.preventDefault(), !1;
142
+ dots: r,
143
+ clickEvent: i,
144
+ confirmEvent: m,
145
+ closeEvent: c,
146
+ refreshEvent: u,
147
+ resetData: y,
148
+ clearData: () => {
149
+ y(), a && a();
133
150
  },
134
- confirmEvent: (o) => (n.confirm && n.confirm(me(t.list), () => {
135
- t.list = [];
136
- }), o.cancelBubble = !0, o.preventDefault(), !1),
137
- closeEvent: (o) => (n.close && n.close(), t.list = [], o.cancelBubble = !0, o.preventDefault(), !1),
138
- refreshEvent: (o) => (n.refresh && n.refresh(), t.list = [], o.cancelBubble = !0, o.preventDefault(), !1)
151
+ refresh: d,
152
+ close: e
139
153
  };
140
154
  }
141
- const De = { class: "gc-header" }, Pe = ["src"], ze = { class: "gc-loading" }, Xe = ["src"], Me = { class: "gc-dots" }, Se = { class: "gc-footer" }, Be = { class: "gc-icon-block gc-icon-block2" }, We = { class: "gc-button-block" }, Q = /* @__PURE__ */ X({
155
+ const Re = { class: "gc-header" }, Ye = ["src"], He = { class: "gc-loading" }, Oe = ["src"], je = { class: "gc-dots" }, Ae = { class: "gc-footer" }, Ie = { class: "gc-icon-block gc-icon-block2" }, Ve = { class: "gc-button-block" }, le = /* @__PURE__ */ U({
142
156
  __name: "index",
143
157
  props: {
144
- config: { default: re },
158
+ config: { default: we },
145
159
  events: { default: () => ({}) },
146
160
  data: { default: () => ({}) }
147
161
  },
148
- setup(l) {
149
- const n = l, { data: t, events: s } = n, e = z({
150
- ...re(),
151
- ...n.config
152
- });
153
- K(() => n.config, () => {
154
- e.value = {
155
- ...e.value,
156
- ...n.config
162
+ setup(n, { expose: t }) {
163
+ const a = n, { data: r, events: i, config: m } = a, c = B({ ...I(r) }), u = B({ ...I(i) }), e = B({ ...we(), ...I(m) });
164
+ F(() => a.data, (l, _) => {
165
+ Object.assign(c, l);
166
+ }, { deep: !0 }), F(() => a.events, (l, _) => {
167
+ Object.assign(u, l);
168
+ }, { deep: !0 }), F(() => a.config, (l, _) => {
169
+ Object.assign(e, l);
170
+ }, { deep: !0 });
171
+ const d = Fe(c, u, () => {
172
+ c.thumb = "", c.image = "";
173
+ }), y = x(() => {
174
+ const l = e.horizontalPadding || 0, _ = e.verticalPadding || 0;
175
+ return {
176
+ width: (e.width || 0) + l * 2 + (e.showTheme ? 2 : 0) + "px",
177
+ paddingLeft: l + "px",
178
+ paddingRight: l + "px",
179
+ paddingTop: _ + "px",
180
+ paddingBottom: _ + "px"
157
181
  };
158
- });
159
- const i = Te(t, s), d = e.value.horizontalPadding || 0, o = e.value.verticalPadding || 0, x = (e.value.width || 0) + d * 2 + (e.value.showTheme ? 2 : 0), u = i.dots, m = P(() => ({
160
- width: x + "px",
161
- paddingLeft: d + "px",
162
- paddingRight: d + "px",
163
- paddingTop: o + "px",
164
- paddingBottom: o + "px"
165
- })), r = P(() => ({
166
- width: e.value.thumbWidth + "px",
167
- height: e.value.thumbHeight + "px"
168
- })), v = P(() => ({
169
- width: e.value.width + "px",
170
- height: e.value.height + "px"
171
- }));
172
- return (E, b) => (w(), C("div", {
173
- class: j(`go-captcha gc-wrapper ${e.value.showTheme ? "gc-theme" : ""}`),
174
- style: _(m.value)
182
+ }), E = x(() => ({
183
+ width: e.thumbWidth + "px",
184
+ height: e.thumbHeight + "px"
185
+ })), s = x(() => ({
186
+ width: e.width + "px",
187
+ height: e.height + "px"
188
+ })), p = x(() => c.image != "" || c.thumb != ""), b = x(() => (e.width || 0) > 0 || (e.height || 0) > 0);
189
+ return t({
190
+ reset: d.resetData,
191
+ clear: d.clearData,
192
+ refresh: d.refresh,
193
+ close: d.close
194
+ }), (l, _) => K((z(), Y("div", {
195
+ class: se(`go-captcha gc-wrapper ${e.showTheme && "gc-theme"}`),
196
+ style: D(y.value)
175
197
  }, [
176
- c("div", De, [
177
- c("span", null, U(e.value.title), 1),
178
- V(c("img", {
179
- style: _(r.value),
180
- src: a(t).thumb,
181
- alt: "..."
182
- }, null, 12, Pe), [
183
- [N, a(t).thumb !== ""]
198
+ o("div", Re, [
199
+ o("span", null, ie(e.title), 1),
200
+ K(o("img", {
201
+ style: D(E.value),
202
+ src: c.thumb,
203
+ alt: ""
204
+ }, null, 12, Ye), [
205
+ [Q, p.value]
184
206
  ])
185
207
  ]),
186
- c("div", {
208
+ o("div", {
187
209
  class: "gc-body",
188
- style: _(v.value)
210
+ style: D(s.value)
189
211
  }, [
190
- c("div", ze, [
191
- D(le)
212
+ o("div", He, [
213
+ A(ve)
192
214
  ]),
193
- V(c("img", {
194
- style: _(v.value),
215
+ K(o("img", {
216
+ style: D(s.value),
195
217
  class: "gc-picture",
196
- src: a(t).image,
197
- alt: "...",
198
- onClick: b[0] || (b[0] = //@ts-ignore
199
- (...g) => a(i).clickEvent && a(i).clickEvent(...g))
200
- }, null, 12, Xe), [
201
- [N, a(t).image !== ""]
218
+ src: c.image,
219
+ onClick: _[0] || (_[0] = //@ts-ignore
220
+ (...g) => v(d).clickEvent && v(d).clickEvent(...g)),
221
+ alt: ""
222
+ }, null, 12, Oe), [
223
+ [Q, p.value]
202
224
  ]),
203
- c("div", Me, [
204
- (w(!0), C(pe, null, _e(a(u).list, (g) => (w(), C("div", {
225
+ o("div", je, [
226
+ (z(!0), Y(De, null, $e(v(d).dots.list, (g) => (z(), Y("div", {
205
227
  class: "gc-dot",
206
228
  key: `${g.key + "-" + g.index}`,
207
- style: _({
208
- top: g.y - 11 + "px",
209
- left: g.x - 11 + "px"
229
+ style: D({
230
+ width: e.dotSize + "px",
231
+ height: e.dotSize + "px",
232
+ borderRadius: e.dotSize + "px",
233
+ top: g.y - (e.dotSize || 1) / 2 - 1 + "px",
234
+ left: g.x - (e.dotSize || 1) / 2 - 1 + "px"
210
235
  })
211
- }, U(g.index), 5))), 128))
236
+ }, ie(g.index), 5))), 128))
212
237
  ])
213
238
  ], 4),
214
- c("div", Se, [
215
- c("div", Be, [
216
- D(ce, {
217
- width: 22,
218
- height: 22,
219
- onClick: a(i).closeEvent
220
- }, null, 8, ["onClick"]),
221
- D(se, {
222
- width: 22,
223
- height: 22,
224
- onClick: a(i).refreshEvent
225
- }, null, 8, ["onClick"])
239
+ o("div", Ae, [
240
+ o("div", Ie, [
241
+ A(ge, {
242
+ width: e.iconSize,
243
+ height: e.iconSize,
244
+ onClick: v(d).closeEvent
245
+ }, null, 8, ["width", "height", "onClick"]),
246
+ A(fe, {
247
+ width: e.iconSize,
248
+ height: e.iconSize,
249
+ onClick: v(d).refreshEvent
250
+ }, null, 8, ["width", "height", "onClick"])
226
251
  ]),
227
- c("div", We, [
228
- c("button", {
229
- onClick: b[1] || (b[1] = //@ts-ignore
230
- (...g) => a(i).confirmEvent && a(i).confirmEvent(...g))
231
- }, U(e.value.buttonText), 1)
252
+ o("div", Ve, [
253
+ o("button", {
254
+ class: se(!p.value && "disabled"),
255
+ onClick: _[1] || (_[1] = //@ts-ignore
256
+ (...g) => v(d).confirmEvent && v(d).confirmEvent(...g))
257
+ }, ie(e.buttonText), 3)
232
258
  ])
233
259
  ])
234
- ], 6));
260
+ ], 6)), [
261
+ [Q, b.value]
262
+ ]);
235
263
  }
236
264
  });
237
- Q.name = "gocaptcha-click";
238
- Q.install = function(l) {
239
- l.component("gocaptcha-click", Q);
265
+ le.name = "gocaptcha-click";
266
+ le.install = function(n) {
267
+ n.component("gocaptcha-click", le);
240
268
  };
241
- const de = () => ({
269
+ const xe = () => ({
242
270
  width: 300,
243
271
  height: 220,
244
272
  thumbWidth: 150,
@@ -246,664 +274,792 @@ const de = () => ({
246
274
  verticalPadding: 16,
247
275
  horizontalPadding: 12,
248
276
  showTheme: !0,
249
- title: "请拖动滑块完成拼图"
250
- }), Ye = /* @__PURE__ */ c("path", { d: `M131.6,116.3c0,0-75.6,0-109.7,0c-9.1,0-16.2-7.4-16.2-16.2c0-9.1,7.4-16.2,16.2-16.2c28.7,0,109.7,0,109.7,0
277
+ title: "请拖动滑块完成拼图",
278
+ iconSize: 22,
279
+ scope: !0
280
+ }), Ne = /* @__PURE__ */ o("path", { d: `M131.6,116.3c0,0-75.6,0-109.7,0c-9.1,0-16.2-7.4-16.2-16.2c0-9.1,7.4-16.2,16.2-16.2c28.7,0,109.7,0,109.7,0
251
281
  s-5.4-5.4-30.4-30.7c-6.4-6.4-6.4-16.7,0-23.1s16.7-6.4,23.1,0l58.4,58.4c6.4,6.4,6.4,16.7,0,23.1c0,0-32.9,32.9-57.9,57.9
252
- c-6.4,6.4-16.7,6.4-23.1,0c-6.4-6.4-6.4-16.7,0-23.1C121.8,126.2,131.6,116.3,131.6,116.3z` }, null, -1), He = [
253
- Ye
254
- ], fe = /* @__PURE__ */ X({
282
+ c-6.4,6.4-16.7,6.4-23.1,0c-6.4-6.4-6.4-16.7,0-23.1C121.8,126.2,131.6,116.3,131.6,116.3z` }, null, -1), Ue = [
283
+ Ne
284
+ ], ye = /* @__PURE__ */ U({
255
285
  __name: "arrows-icon",
256
286
  emits: ["click"],
257
- setup(l, { emit: n }) {
258
- const t = n;
259
- function s(e) {
260
- t("click", e);
287
+ setup(n, { emit: t }) {
288
+ const a = t;
289
+ function r(i) {
290
+ a("click", i);
261
291
  }
262
- return (e, i) => (w(), C("svg", I({
292
+ return (i, m) => (z(), Y("svg", oe({
263
293
  xmlns: "http://www.w3.org/2000/svg",
264
294
  viewBox: "0 0 200 200",
265
295
  width: "20",
266
296
  height: "20"
267
- }, e.$attrs, { onClick: s }), He, 16));
297
+ }, i.$attrs, { onClick: r }), Ue, 16));
268
298
  }
299
+ }), qe = () => ({
300
+ thumbX: 0,
301
+ thumbY: 0,
302
+ thumbWidth: 0,
303
+ thumbHeight: 0,
304
+ image: "",
305
+ thumb: ""
269
306
  });
270
- function Fe(l, n, t, s, e, i) {
271
- const d = ne({ dragLeft: 0, thumbLeft: l.thumbX || 0 }), o = () => {
272
- d.dragLeft = 0, d.thumbLeft = 0;
307
+ function Ge(n, t, a, r, i, m, c, u, e) {
308
+ const d = B({ dragLeft: 0, thumbLeft: n.thumbX || 0, isFreeze: !1 });
309
+ F(() => n, (g, S) => {
310
+ d.isFreeze || (d.thumbLeft = g.thumbX || 0);
311
+ }, { deep: !0 });
312
+ const y = (g) => {
313
+ const S = g.touches && g.touches[0], L = c.value.offsetLeft, h = i.value.offsetWidth, f = c.value.offsetWidth, w = h - f, T = m.value.offsetWidth, q = m.value.offsetLeft, te = h - T, G = (h - (T + q)) / w;
314
+ let V = !1, P = null, Z = 0, H = 0;
315
+ S ? Z = S.pageX - L : Z = g.clientX - L;
316
+ const R = (W) => {
317
+ V = !0;
318
+ const J = W.touches && W.touches[0];
319
+ let M = 0;
320
+ J ? M = J.pageX - Z : M = W.clientX - Z;
321
+ let ke = q + M * G;
322
+ if (M >= w) {
323
+ d.dragLeft = w, d.thumbLeft = H = te;
324
+ return;
325
+ }
326
+ if (M <= 0) {
327
+ d.dragLeft = 0, d.thumbLeft = H = q;
328
+ return;
329
+ }
330
+ d.dragLeft = M, d.thumbLeft = H = ke, t.move && t.move(H, n.thumbY || 0), W.cancelBubble = !0, W.preventDefault();
331
+ }, N = (W) => {
332
+ be(u.value, W) && V && (X(), !(H < 0) && (V = !1, t.confirm && t.confirm({ x: parseInt(H.toString()), y: n.thumbY || 0 }, () => {
333
+ l();
334
+ }), W.cancelBubble = !0, W.preventDefault()));
335
+ }, O = (W) => {
336
+ P = W;
337
+ }, j = () => {
338
+ P = null;
339
+ }, ce = (W) => {
340
+ P && (N(P), X());
341
+ }, k = a.scope, $ = k ? r.value : u.value, C = k ? r.value : document.body, X = () => {
342
+ C.removeEventListener("mousemove", R, !1), C.removeEventListener("touchmove", R, { passive: !1 }), $.removeEventListener("mouseup", N, !1), $.removeEventListener("mouseenter", j, !1), $.removeEventListener("mouseleave", O, !1), $.removeEventListener("touchend", N, !1), C.removeEventListener("mouseleave", N, !1), C.removeEventListener("mouseup", ce, !1), d.isFreeze = !1;
343
+ };
344
+ d.isFreeze = !0, C.addEventListener("mousemove", R, !1), C.addEventListener("touchmove", R, { passive: !1 }), $.addEventListener("mouseup", N, !1), $.addEventListener("mouseenter", j, !1), $.addEventListener("mouseleave", O, !1), $.addEventListener("touchend", N, !1), C.addEventListener("mouseleave", N, !1), C.addEventListener("mouseup", ce, !1);
345
+ }, E = (g) => (p(), g.cancelBubble = !0, g.preventDefault(), !1), s = (g) => (b(), g.cancelBubble = !0, g.preventDefault(), !1), p = () => {
346
+ t && t.close && t.close(), l();
347
+ }, b = () => {
348
+ t && t.refresh && t.refresh(), l();
349
+ }, l = () => {
350
+ d.dragLeft = 0, d.thumbLeft = n.thumbX || 0;
273
351
  };
274
352
  return {
275
353
  state: d,
276
- dragEvent: (r) => {
277
- const v = r.touches && r.touches[0], E = e.value.offsetLeft, b = t.value.offsetWidth, g = e.value.offsetWidth, p = b - g, L = l.thumbX || 0, $ = s.value.offsetWidth, M = g - $, T = (p - L + M) / p;
278
- let k = !1, S = null, Y = 0, H = 0;
279
- v ? Y = v.pageX - E : Y = r.clientX - E;
280
- const B = (f) => {
281
- k = !0;
282
- const G = f.touches && f.touches[0];
283
- let y = 0;
284
- if (G ? y = G.pageX - Y : y = f.clientX - Y, y >= p) {
285
- d.dragLeft = p;
286
- return;
287
- }
288
- if (y <= 0) {
289
- d.dragLeft = 0;
290
- return;
291
- }
292
- d.dragLeft = y, H = L + y * T, d.thumbLeft = H, n.move && n.move(H, l.thumbY || 0), f.cancelBubble = !0, f.preventDefault();
293
- }, h = (f) => {
294
- ue(i.value, f) && k && (k = !1, J(), n.confirm && n.confirm({ x: parseInt(H.toString()), y: l.thumbY || 0 }, () => {
295
- o();
296
- }), f.cancelBubble = !0, f.preventDefault());
297
- }, A = (f) => {
298
- S = f;
299
- }, W = () => {
300
- S = null;
301
- }, q = (f) => {
302
- S && (h(S), J());
303
- }, J = () => {
304
- i.value.removeEventListener("mousemove", B, !1), i.value.removeEventListener("touchmove", B, { passive: !1 }), i.value.removeEventListener("mouseup", h, !1), i.value.removeEventListener("mouseenter", W, !1), i.value.removeEventListener("mouseleave", A, !1), i.value.removeEventListener("touchend", h, !1), document.body.removeEventListener("mouseleave", h, !1), document.body.removeEventListener("mouseup", q, !1);
305
- };
306
- i.value.addEventListener("mousemove", B, !1), i.value.addEventListener("touchmove", B, { passive: !1 }), i.value.addEventListener("mouseup", h, !1), i.value.addEventListener("mouseenter", W, !1), i.value.addEventListener("mouseleave", A, !1), i.value.addEventListener("touchend", h, !1), document.body.addEventListener("mouseleave", h, !1), document.body.addEventListener("mouseup", q, !1);
354
+ dragEvent: y,
355
+ closeEvent: E,
356
+ refreshEvent: s,
357
+ resetData: l,
358
+ clearData: () => {
359
+ e && e(), l();
307
360
  },
308
- closeEvent: (r) => (n && n.close && n.close(), o(), r.cancelBubble = !0, r.preventDefault(), !1),
309
- refreshEvent: (r) => (n && n.refresh && n.refresh(), o(), r.cancelBubble = !0, r.preventDefault(), !1)
361
+ refresh: b,
362
+ close: p
310
363
  };
311
364
  }
312
- const Ae = { class: "gc-header" }, Ve = { class: "gc-icon-block" }, Ne = { class: "gc-loading" }, Ie = ["src"], Ue = ["src"], Ge = { class: "gc-footer" }, je = /* @__PURE__ */ c("div", { class: "gc-drag-line" }, null, -1), Z = /* @__PURE__ */ X({
365
+ const Je = { class: "gc-header" }, Ke = { class: "gc-icon-block" }, Qe = { class: "gc-loading" }, Ze = ["src"], et = ["src"], tt = { class: "gc-footer" }, nt = /* @__PURE__ */ o("div", { class: "gc-drag-line" }, null, -1), re = /* @__PURE__ */ U({
313
366
  __name: "index",
314
367
  props: {
315
- config: { default: de },
368
+ config: { default: xe },
316
369
  events: { default: () => ({}) },
317
370
  data: { default: () => ({}) }
318
371
  },
319
- setup(l) {
320
- const n = l, { data: t, events: s } = n, e = z({
321
- ...de(),
322
- ...n.config
323
- });
324
- K(() => n.config, () => {
325
- e.value = {
326
- ...e.value,
327
- ...n.config
372
+ setup(n, { expose: t }) {
373
+ const a = n, { data: r, events: i, config: m } = a, c = B({ ...qe(), ...I(r) }), u = B({ ...I(i) }), e = B({ ...xe(), ...I(m) });
374
+ F(() => a.data, (f, w) => {
375
+ Object.assign(c, f);
376
+ }, { deep: !0 }), F(() => a.events, (f, w) => {
377
+ Object.assign(u, f);
378
+ }, { deep: !0 }), F(() => a.config, (f, w) => {
379
+ Object.assign(e, f);
380
+ }, { deep: !0 });
381
+ const d = ee(null), y = ee(null), E = ee(null), s = ee(null), p = ee(null), b = Ge(
382
+ c,
383
+ u,
384
+ e,
385
+ d,
386
+ E,
387
+ p,
388
+ s,
389
+ y,
390
+ () => {
391
+ c.thumb = "", c.image = "", c.thumbX = 0, c.thumbY = 0, c.thumbWidth = 0, c.thumbHeight = 0;
392
+ }
393
+ ), l = x(() => {
394
+ const f = e.horizontalPadding || 0, w = e.verticalPadding || 0;
395
+ return {
396
+ width: (e.width || 0) + f * 2 + (e.showTheme ? 2 : 0) + "px",
397
+ paddingLeft: f + "px",
398
+ paddingRight: f + "px",
399
+ paddingTop: w + "px",
400
+ paddingBottom: w + "px"
328
401
  };
329
- });
330
- const i = z(null), d = z(null), o = z(null), x = z(null), u = Fe(t, s, d, x, o, i), m = e.value.horizontalPadding || 0, r = e.value.verticalPadding || 0, v = (e.value.width || 0) + m * 2 + (e.value.showTheme ? 2 : 0), E = P(() => ({
331
- width: v + "px",
332
- paddingLeft: m + "px",
333
- paddingRight: m + "px",
334
- paddingTop: r + "px",
335
- paddingBottom: r + "px"
336
- })), b = P(() => ({
337
- width: t.thumbWidth + "px",
338
- height: t.thumbHeight + "px",
339
- top: t.thumbY + "px",
340
- left: u.state.thumbLeft + "px"
341
- })), g = P(() => ({
342
- width: e.value.width + "px",
343
- height: e.value.height + "px"
344
- }));
345
- return ie(async () => {
346
- await ae(), o.value && o.value.addEventListener("dragstart", (p) => p.preventDefault());
347
- }), (p, L) => (w(), C("div", {
348
- class: j(`go-captcha gc-wrapper ${e.value.showTheme ? "gc-theme" : ""}`),
349
- style: _(E.value)
402
+ }), _ = x(() => ({
403
+ width: c.thumbWidth + "px",
404
+ height: c.thumbHeight + "px",
405
+ top: c.thumbY + "px",
406
+ left: b.state.thumbLeft + "px"
407
+ })), g = x(() => ({
408
+ width: e.width + "px",
409
+ height: e.height + "px"
410
+ })), S = x(() => c.image != ""), L = x(() => c.thumb != ""), h = x(() => (e.width || 0) > 0 || (e.height || 0) > 0);
411
+ return pe(async () => {
412
+ await _e(), s.value && s.value.addEventListener("dragstart", (f) => f.preventDefault());
413
+ }), t({
414
+ reset: b.resetData,
415
+ clear: b.clearData,
416
+ refresh: b.refresh,
417
+ close: b.close
418
+ }), (f, w) => K((z(), Y("div", {
419
+ class: se(`go-captcha gc-wrapper ${e.showTheme && "gc-theme"}`),
420
+ style: D(l.value),
421
+ ref_key: "rootRef",
422
+ ref: d
350
423
  }, [
351
- c("div", Ae, [
352
- c("span", null, U(e.value.title), 1),
353
- c("div", Ve, [
354
- D(ce, {
355
- width: 22,
356
- height: 22,
357
- onClick: a(u).closeEvent
358
- }, null, 8, ["onClick"]),
359
- D(se, {
360
- width: 22,
361
- height: 22,
362
- onClick: a(u).refreshEvent
363
- }, null, 8, ["onClick"])
424
+ o("div", Je, [
425
+ o("span", null, ie(e.title), 1),
426
+ o("div", Ke, [
427
+ A(ge, {
428
+ width: e.iconSize,
429
+ height: e.iconSize,
430
+ onClick: v(b).closeEvent
431
+ }, null, 8, ["width", "height", "onClick"]),
432
+ A(fe, {
433
+ width: e.iconSize,
434
+ height: e.iconSize,
435
+ onClick: v(b).refreshEvent
436
+ }, null, 8, ["width", "height", "onClick"])
364
437
  ])
365
438
  ]),
366
- c("div", {
439
+ o("div", {
367
440
  class: "gc-body",
368
441
  ref_key: "containerRef",
369
- ref: d,
370
- style: _(g.value)
442
+ ref: E,
443
+ style: D(g.value)
371
444
  }, [
372
- c("div", Ne, [
373
- D(le)
445
+ o("div", Qe, [
446
+ A(ve)
374
447
  ]),
375
- V(c("img", {
448
+ K(o("img", {
376
449
  class: "gc-picture",
377
- style: _(g.value),
378
- src: a(t).image,
379
- alt: "..."
380
- }, null, 12, Ie), [
381
- [N, a(t).image !== ""]
450
+ style: D(g.value),
451
+ src: c.image,
452
+ alt: ""
453
+ }, null, 12, Ze), [
454
+ [Q, S.value]
382
455
  ]),
383
- c("div", {
456
+ o("div", {
384
457
  class: "gc-tile",
385
458
  ref_key: "tileRef",
386
- ref: x,
387
- style: _(b.value)
459
+ ref: p,
460
+ style: D(_.value)
388
461
  }, [
389
- V(c("img", {
390
- src: a(t).thumb,
391
- alt: "..."
392
- }, null, 8, Ue), [
393
- [N, a(t).thumb !== ""]
462
+ K(o("img", {
463
+ src: c.thumb,
464
+ alt: ""
465
+ }, null, 8, et), [
466
+ [Q, L.value]
394
467
  ])
395
468
  ], 4)
396
469
  ], 4),
397
- c("div", Ge, [
398
- c("div", {
470
+ o("div", tt, [
471
+ o("div", {
399
472
  class: "gc-drag-slide-bar",
400
473
  ref_key: "dragBarRef",
401
- ref: i
474
+ ref: y
402
475
  }, [
403
- je,
404
- c("div", {
405
- class: "gc-drag-block",
476
+ nt,
477
+ o("div", {
478
+ class: se(["gc-drag-block", !S.value && "disabled"]),
406
479
  ref_key: "dragBlockRef",
407
- ref: o,
408
- onMousedown: L[1] || (L[1] = //@ts-ignore
409
- (...$) => a(u).dragEvent && a(u).dragEvent(...$)),
410
- style: _({ left: a(u).state.dragLeft + "px" })
480
+ ref: s,
481
+ onMousedown: w[1] || (w[1] = //@ts-ignore
482
+ (...T) => v(b).dragEvent && v(b).dragEvent(...T)),
483
+ style: D({ left: v(b).state.dragLeft + "px" })
411
484
  }, [
412
- c("div", {
413
- class: "drag-block-inline",
414
- onTouchstart: L[0] || (L[0] = //@ts-ignore
415
- (...$) => a(u).dragEvent && a(u).dragEvent(...$))
485
+ o("div", {
486
+ class: "gc-drag-block-inline",
487
+ onTouchstart: w[0] || (w[0] = //@ts-ignore
488
+ (...T) => v(b).dragEvent && v(b).dragEvent(...T))
416
489
  }, [
417
- D(fe)
490
+ A(ye)
418
491
  ], 32)
419
- ], 36)
492
+ ], 38)
420
493
  ], 512)
421
494
  ])
422
- ], 6));
495
+ ], 6)), [
496
+ [Q, h.value]
497
+ ]);
423
498
  }
424
499
  });
425
- Z.name = "gocaptcha-slide";
426
- Z.install = function(l) {
427
- l.component("gocaptcha-slide", Z);
500
+ re.name = "gocaptcha-slide";
501
+ re.install = function(n) {
502
+ n.component("gocaptcha-slide", re);
428
503
  };
429
- const ve = () => ({
504
+ const Ee = () => ({
430
505
  width: 300,
431
506
  height: 220,
432
507
  verticalPadding: 16,
433
508
  horizontalPadding: 12,
434
509
  showTheme: !0,
435
- title: "请拖拽贴图完成拼图"
510
+ title: "请拖拽贴图完成拼图",
511
+ iconSize: 22,
512
+ scope: !0
513
+ }), st = () => ({
514
+ thumbX: 0,
515
+ thumbY: 0,
516
+ thumbWidth: 0,
517
+ thumbHeight: 0,
518
+ image: "",
519
+ thumb: ""
436
520
  });
437
- function qe(l, n, t, s) {
438
- const e = ne({ x: l.thumbX || 0, y: l.thumbY || 0 }), i = () => {
439
- e.x = l.thumbX || 0, e.y = l.thumbY || 0;
521
+ function ct(n, t, a, r, i, m, c) {
522
+ const u = B({ x: n.thumbX || 0, y: n.thumbY || 0, isFreeze: !1 });
523
+ F(() => n, (l, _) => {
524
+ u.isFreeze || (u.x = l.thumbX || 0, u.y = l.thumbY || 0);
525
+ }, { deep: !0 });
526
+ const e = (l) => {
527
+ const _ = l.touches && l.touches[0], g = m.value.offsetLeft, S = m.value.offsetTop, L = i.value.offsetWidth, h = i.value.offsetHeight, f = m.value.offsetWidth, w = m.value.offsetHeight, T = L - f, q = h - w;
528
+ let te = !1, ne = null, G = 0, V = 0, P = 0, Z = 0;
529
+ _ ? (G = _.pageX - g, V = _.pageY - S) : (G = l.clientX - g, V = l.clientY - S);
530
+ const H = (X) => {
531
+ te = !0;
532
+ const W = X.touches && X.touches[0];
533
+ let J = 0, M = 0;
534
+ W ? (J = W.pageX - G, M = W.pageY - V) : (J = X.clientX - G, M = X.clientY - V), J <= 0 && (J = 0), M <= 0 && (M = 0), J >= T && (J = T), M >= q && (M = q), u.x = J, u.y = M, P = J, Z = M, t.move && t.move(J, M), X.cancelBubble = !0, X.preventDefault();
535
+ }, R = (X) => {
536
+ be(i.value, X) && te && (te = !1, C(), !(P < 0 || Z < 0) && (t.confirm && t.confirm({ x: P, y: Z }, () => {
537
+ p();
538
+ }), X.cancelBubble = !0, X.preventDefault()));
539
+ }, N = (X) => {
540
+ ne = X;
541
+ }, O = () => {
542
+ ne = null;
543
+ }, j = (X) => {
544
+ ne && (R(ne), C());
545
+ }, ce = a.scope, k = ce ? r.value : i.value, $ = ce ? r.value : document.body, C = () => {
546
+ $.removeEventListener("mousemove", H, !1), $.removeEventListener("touchmove", H, { passive: !1 }), k.removeEventListener("mouseup", R, !1), k.removeEventListener("mouseenter", O, !1), k.removeEventListener("mouseleave", N, !1), k.removeEventListener("touchend", R, !1), $.removeEventListener("mouseleave", R, !1), $.removeEventListener("mouseup", j, !1), u.isFreeze = !1;
547
+ };
548
+ u.isFreeze = !0, $.addEventListener("mousemove", H, !1), $.addEventListener("touchmove", H, { passive: !1 }), k.addEventListener("mouseup", R, !1), k.addEventListener("mouseenter", O, !1), k.addEventListener("mouseleave", N, !1), k.addEventListener("touchend", R, !1), $.addEventListener("mouseleave", R, !1), $.addEventListener("mouseup", j, !1);
549
+ }, d = (l) => (E(), l.cancelBubble = !0, l.preventDefault(), !1), y = (l) => (s(), l.cancelBubble = !0, l.preventDefault(), !1), E = () => {
550
+ t && t.close && t.close(), p();
551
+ }, s = () => {
552
+ t && t.refresh && t.refresh(), p();
553
+ }, p = () => {
554
+ u.x = n.thumbX || 0, u.y = n.thumbY || 0;
440
555
  };
441
556
  return {
442
- state: e,
443
- dragEvent: (u) => {
444
- const m = u.touches && u.touches[0], r = s.value.offsetLeft, v = s.value.offsetTop, E = t.value.offsetWidth, b = t.value.offsetHeight, g = s.value.offsetWidth, p = s.value.offsetHeight, L = E - g, $ = b - p;
445
- let M = !1, T = null, k = 0, S = 0, Y = 0, H = 0;
446
- m ? (k = m.pageX - r, S = m.pageY - v) : (k = u.clientX - r, S = u.clientY - v);
447
- const B = (f) => {
448
- M = !0;
449
- const G = f.touches && f.touches[0];
450
- let y = 0, F = 0;
451
- G ? (y = G.pageX - k, F = G.pageY - S) : (y = f.clientX - k, F = f.clientY - S), y <= 0 && (y = 0), F <= 0 && (F = 0), y >= L && (y = L), F >= $ && (F = $), e.x = y, e.y = F, Y = y, H = F, n.move && n.move(y, F), f.cancelBubble = !0, f.preventDefault();
452
- }, h = (f) => {
453
- ue(t.value, f) && M && (M = !1, J(), n.confirm && n.confirm({ x: Y, y: H }, () => {
454
- i();
455
- }), f.cancelBubble = !0, f.preventDefault());
456
- }, A = (f) => {
457
- T = f;
458
- }, W = () => {
459
- T = null;
460
- }, q = (f) => {
461
- T && (h(T), J());
462
- }, J = () => {
463
- t.value.removeEventListener("mousemove", B, !1), t.value.removeEventListener("touchmove", B, { passive: !1 }), t.value.removeEventListener("mouseup", h, !1), t.value.removeEventListener("mouseenter", W, !1), t.value.removeEventListener("mouseleave", A, !1), t.value.removeEventListener("touchend", h, !1), document.body.removeEventListener("mouseleave", h, !1), document.body.removeEventListener("mouseup", q, !1);
464
- };
465
- t.value.addEventListener("mousemove", B, !1), t.value.addEventListener("touchmove", B, { passive: !1 }), t.value.addEventListener("mouseup", h, !1), t.value.addEventListener("mouseenter", W, !1), t.value.addEventListener("mouseleave", A, !1), t.value.addEventListener("touchend", h, !1), document.body.addEventListener("mouseleave", h, !1), document.body.addEventListener("mouseup", q, !1);
557
+ state: u,
558
+ dragEvent: e,
559
+ closeEvent: d,
560
+ refreshEvent: y,
561
+ resetData: p,
562
+ clearData: () => {
563
+ c && c(), p();
466
564
  },
467
- closeEvent: (u) => (n && n.close && n.close(), i(), u.cancelBubble = !0, u.preventDefault(), !1),
468
- refreshEvent: (u) => (n && n.refresh && n.refresh(), i(), u.cancelBubble = !0, u.preventDefault(), !1)
565
+ refresh: s,
566
+ close: E
469
567
  };
470
568
  }
471
- const Je = { class: "gc-header gc-header2" }, Ke = { class: "gc-loading" }, Oe = ["src"], Qe = ["src"], Ze = { class: "gc-footer" }, Re = { class: "gc-icon-block" }, R = /* @__PURE__ */ X({
569
+ const ot = { class: "gc-header gc-header2" }, it = { class: "gc-loading" }, at = ["src"], lt = ["src"], rt = { class: "gc-footer" }, ut = { class: "gc-icon-block" }, ue = /* @__PURE__ */ U({
472
570
  __name: "index",
473
571
  props: {
474
- config: { default: ve },
572
+ config: { default: Ee },
475
573
  events: { default: () => ({}) },
476
574
  data: { default: () => ({}) }
477
575
  },
478
- setup(l) {
479
- const n = l, { data: t, events: s } = n, e = z({
480
- ...ve(),
481
- ...n.config
482
- });
483
- K(() => n.config, () => {
484
- e.value = {
485
- ...e.value,
486
- ...n.config
576
+ setup(n, { expose: t }) {
577
+ const a = n, { data: r, events: i, config: m } = a, c = B({ ...st(), ...I(r) }), u = B({ ...I(i) }), e = B({ ...Ee(), ...I(m) });
578
+ F(() => a.data, (L, h) => {
579
+ Object.assign(c, L);
580
+ }, { deep: !0 }), F(() => a.events, (L, h) => {
581
+ Object.assign(u, L);
582
+ }, { deep: !0 }), F(() => a.config, (L, h) => {
583
+ Object.assign(e, L);
584
+ }, { deep: !0 });
585
+ const d = ee(null), y = ee(null), E = ee(null), s = ct(
586
+ c,
587
+ u,
588
+ e,
589
+ d,
590
+ y,
591
+ E,
592
+ () => {
593
+ c.thumb = "", c.image = "", c.thumbX = 0, c.thumbY = 0, c.thumbWidth = 0, c.thumbHeight = 0;
594
+ }
595
+ ), p = x(() => {
596
+ const L = e.horizontalPadding || 0, h = e.verticalPadding || 0;
597
+ return {
598
+ width: (e.width || 0) + L * 2 + (e.showTheme ? 2 : 0) + "px",
599
+ paddingLeft: L + "px",
600
+ paddingRight: L + "px",
601
+ paddingTop: h + "px",
602
+ paddingBottom: h + "px"
487
603
  };
488
- });
489
- const i = z(null), d = z(null), o = qe(t, s, i, d), x = e.value.horizontalPadding || 0, u = e.value.verticalPadding || 0;
490
- let m = (e.value.width || 0) + x * 2 + (e.value.showTheme ? 2 : 0);
491
- const r = P(() => ({
492
- width: m + "px",
493
- paddingLeft: x + "px",
494
- paddingRight: x + "px",
495
- paddingTop: u + "px",
496
- paddingBottom: u + "px"
497
- })), v = P(() => ({
498
- width: t.thumbWidth + "px",
499
- height: t.thumbHeight + "px",
500
- top: o.state.y + "px",
501
- left: o.state.x + "px"
502
- })), E = P(() => ({
503
- width: e.value.width + "px",
504
- height: e.value.height + "px"
505
- }));
506
- return ie(async () => {
507
- await ae(), d.value && d.value.addEventListener("dragstart", (b) => b.preventDefault());
508
- }), (b, g) => (w(), C("div", {
509
- class: j(`go-captcha gc-wrapper ${e.value.showTheme ? "gc-theme" : ""}`),
510
- style: _(r.value)
604
+ }), b = x(() => ({
605
+ width: c.thumbWidth + "px",
606
+ height: c.thumbHeight + "px",
607
+ top: s.state.y + "px",
608
+ left: s.state.x + "px"
609
+ })), l = x(() => ({
610
+ width: e.width + "px",
611
+ height: e.height + "px"
612
+ })), _ = x(() => c.image != ""), g = x(() => c.thumb != ""), S = x(() => (e.width || 0) > 0 || (e.height || 0) > 0);
613
+ return pe(async () => {
614
+ await _e(), E.value && E.value.addEventListener("dragstart", (L) => L.preventDefault());
615
+ }), t({
616
+ reset: s.resetData,
617
+ clear: s.clearData,
618
+ refresh: s.refresh,
619
+ close: s.close
620
+ }), (L, h) => K((z(), Y("div", {
621
+ class: se(`go-captcha gc-wrapper ${e.showTheme && "gc-theme"}`),
622
+ style: D(p.value),
623
+ ref_key: "rootRef",
624
+ ref: d
511
625
  }, [
512
- c("div", Je, [
513
- c("span", null, U(e.value.title), 1)
626
+ o("div", ot, [
627
+ o("span", null, ie(e.title), 1)
514
628
  ]),
515
- c("div", {
629
+ o("div", {
516
630
  class: "gc-body",
517
631
  ref_key: "containerRef",
518
- ref: i,
519
- style: _(E.value)
632
+ ref: y,
633
+ style: D(l.value)
520
634
  }, [
521
- c("div", Ke, [
522
- D(le)
635
+ o("div", it, [
636
+ A(ve)
523
637
  ]),
524
- V(c("img", {
638
+ K(o("img", {
525
639
  class: "gc-picture",
526
- style: _(E.value),
527
- src: a(t).image,
528
- alt: "..."
529
- }, null, 12, Oe), [
530
- [N, a(t).image !== ""]
640
+ style: D(l.value),
641
+ src: c.image,
642
+ alt: ""
643
+ }, null, 12, at), [
644
+ [Q, _.value]
531
645
  ]),
532
- c("div", {
646
+ o("div", {
533
647
  class: "gc-tile",
534
648
  ref_key: "tileRef",
535
- ref: d,
536
- style: _(v.value),
537
- onMousedown: g[0] || (g[0] = //@ts-ignore
538
- (...p) => a(o).dragEvent && a(o).dragEvent(...p)),
539
- onTouchstart: g[1] || (g[1] = //@ts-ignore
540
- (...p) => a(o).dragEvent && a(o).dragEvent(...p))
649
+ ref: E,
650
+ style: D(b.value),
651
+ onMousedown: h[0] || (h[0] = //@ts-ignore
652
+ (...f) => v(s).dragEvent && v(s).dragEvent(...f)),
653
+ onTouchstart: h[1] || (h[1] = //@ts-ignore
654
+ (...f) => v(s).dragEvent && v(s).dragEvent(...f))
541
655
  }, [
542
- V(c("img", {
543
- src: a(t).thumb,
544
- alt: "..."
545
- }, null, 8, Qe), [
546
- [N, a(t).thumb !== ""]
656
+ K(o("img", {
657
+ src: c.thumb,
658
+ alt: ""
659
+ }, null, 8, lt), [
660
+ [Q, g.value]
547
661
  ])
548
662
  ], 36)
549
663
  ], 4),
550
- c("div", Ze, [
551
- c("div", Re, [
552
- D(ce, {
553
- width: 22,
554
- height: 22,
555
- onClick: a(o).closeEvent
556
- }, null, 8, ["onClick"]),
557
- D(se, {
558
- width: 22,
559
- height: 22,
560
- onClick: a(o).refreshEvent
561
- }, null, 8, ["onClick"])
664
+ o("div", rt, [
665
+ o("div", ut, [
666
+ A(ge, {
667
+ width: e.iconSize,
668
+ height: e.iconSize,
669
+ onClick: v(s).closeEvent
670
+ }, null, 8, ["width", "height", "onClick"]),
671
+ A(fe, {
672
+ width: e.iconSize,
673
+ height: e.iconSize,
674
+ onClick: v(s).refreshEvent
675
+ }, null, 8, ["width", "height", "onClick"])
562
676
  ])
563
677
  ])
564
- ], 6));
678
+ ], 6)), [
679
+ [Q, S.value]
680
+ ]);
565
681
  }
566
682
  });
567
- R.name = "gocaptcha-slide-region";
568
- R.install = function(l) {
569
- l.component("gocaptcha-slide-region", R);
683
+ ue.name = "gocaptcha-slide-region";
684
+ ue.install = function(n) {
685
+ n.component("gocaptcha-slide-region", ue);
570
686
  };
571
- const oe = () => ({
687
+ const me = () => ({
572
688
  width: 300,
573
689
  height: 220,
574
690
  size: 220,
575
691
  verticalPadding: 16,
576
692
  horizontalPadding: 12,
577
693
  showTheme: !0,
578
- title: "请拖动滑块完成拼图"
694
+ title: "请拖动滑块完成拼图",
695
+ iconSize: 22,
696
+ scope: !0
697
+ }), dt = () => ({
698
+ angle: 0,
699
+ image: "",
700
+ thumb: ""
579
701
  });
580
- function et(l, n, t, s) {
581
- const e = ne({ dragLeft: 0, thumbAngle: l.angle || 0 }), i = () => {
582
- e.dragLeft = 0, e.thumbAngle = 0;
702
+ function ht(n, t, a, r, i, m, c) {
703
+ const u = B({ dragLeft: 0, thumbAngle: n.angle || 0, isFreeze: !1 });
704
+ F(() => n, (l, _) => {
705
+ u.isFreeze || (u.thumbAngle = l.angle || 0);
706
+ }, { deep: !0 });
707
+ const e = (l) => {
708
+ const _ = l.touches && l.touches[0], g = i.value.offsetLeft, S = m.value.offsetWidth, L = i.value.offsetWidth, h = S - L, f = 360, w = (f - n.angle) / h;
709
+ let T = 0, q = !1, te = null, ne = 0, G = 0;
710
+ _ ? ne = _.pageX - g : ne = l.clientX - g;
711
+ const V = (k) => {
712
+ q = !0;
713
+ const $ = k.touches && k.touches[0];
714
+ let C = 0;
715
+ if ($ ? C = $.pageX - ne : C = k.clientX - ne, T = n.angle + C * w, C >= h) {
716
+ u.dragLeft = h, u.thumbAngle = G = f;
717
+ return;
718
+ }
719
+ if (C <= 0) {
720
+ u.dragLeft = 0, u.thumbAngle = G = n.angle;
721
+ return;
722
+ }
723
+ u.dragLeft = C, u.thumbAngle = G = T, t.rotate && t.rotate(T), k.cancelBubble = !0, k.preventDefault();
724
+ }, P = (k) => {
725
+ be(m.value, k) && q && (ce(), !(G < 0) && (q = !1, t.confirm && t.confirm(parseInt(G.toString()), () => {
726
+ p();
727
+ }), k.cancelBubble = !0, k.preventDefault()));
728
+ }, Z = (k) => {
729
+ te = k;
730
+ }, H = () => {
731
+ te = null;
732
+ }, R = (k) => {
733
+ te && (P(te), ce());
734
+ }, N = a.scope, O = N ? r.value : m.value, j = N ? r.value : document.body, ce = () => {
735
+ j.removeEventListener("mousemove", V, !1), j.removeEventListener("touchmove", V, { passive: !1 }), O.removeEventListener("mouseup", P, !1), O.removeEventListener("mouseenter", H, !1), O.removeEventListener("mouseleave", Z, !1), O.removeEventListener("touchend", P, !1), j.removeEventListener("mouseleave", P, !1), j.removeEventListener("mouseup", R, !1), u.isFreeze = !1;
736
+ };
737
+ u.isFreeze = !0, j.addEventListener("mousemove", V, !1), j.addEventListener("touchmove", V, { passive: !1 }), O.addEventListener("mouseup", P, !1), O.addEventListener("mouseenter", H, !1), O.addEventListener("mouseleave", Z, !1), O.addEventListener("touchend", P, !1), j.addEventListener("mouseleave", P, !1), j.addEventListener("mouseup", R, !1);
738
+ }, d = (l) => (E(), l.cancelBubble = !0, l.preventDefault(), !1), y = (l) => (s(), l.cancelBubble = !0, l.preventDefault(), !1), E = () => {
739
+ t && t.close && t.close(), p();
740
+ }, s = () => {
741
+ t && t.refresh && t.refresh(), p();
742
+ }, p = () => {
743
+ u.dragLeft = 0, u.thumbAngle = n.angle;
583
744
  };
584
745
  return {
585
- state: e,
586
- dragEvent: (u) => {
587
- const m = u.touches && u.touches[0], r = t.value.offsetLeft, v = s.value.offsetWidth, E = t.value.offsetWidth, b = v - E, g = 360 / b;
588
- let p = 0, L = !1, $ = null, M = 0;
589
- m ? M = m.pageX - r : M = u.clientX - r;
590
- const T = (h) => {
591
- L = !0;
592
- const A = h.touches && h.touches[0];
593
- let W = 0;
594
- if (A ? W = A.pageX - M : W = h.clientX - M, W >= b) {
595
- e.dragLeft = b;
596
- return;
597
- }
598
- if (W <= 0) {
599
- e.dragLeft = 0;
600
- return;
601
- }
602
- e.dragLeft = W, p = W * g, e.thumbAngle = p, n.rotate && n.rotate(p), h.cancelBubble = !0, h.preventDefault();
603
- }, k = (h) => {
604
- ue(s.value, h) && L && (B(), L = !1, n.confirm && n.confirm(parseInt(p.toString()), () => {
605
- i();
606
- }), h.cancelBubble = !0, h.preventDefault());
607
- }, S = (h) => {
608
- $ = h;
609
- }, Y = () => {
610
- $ = null;
611
- }, H = (h) => {
612
- $ && (k($), B());
613
- }, B = () => {
614
- s.value.removeEventListener("mousemove", T, !1), s.value.removeEventListener("touchmove", T, { passive: !1 }), s.value.removeEventListener("mouseup", k, !1), s.value.removeEventListener("mouseenter", Y, !1), s.value.removeEventListener("mouseleave", S, !1), s.value.removeEventListener("touchend", k, !1), document.body.removeEventListener("mouseleave", k, !1), document.body.removeEventListener("mouseup", H, !1);
615
- };
616
- s.value.addEventListener("mousemove", T, !1), s.value.addEventListener("touchmove", T, { passive: !1 }), s.value.addEventListener("mouseup", k, !1), s.value.addEventListener("mouseenter", Y, !1), s.value.addEventListener("mouseleave", S, !1), s.value.addEventListener("touchend", k, !1), document.body.addEventListener("mouseleave", k, !1), document.body.addEventListener("mouseup", H, !1);
746
+ state: u,
747
+ dragEvent: e,
748
+ closeEvent: d,
749
+ refreshEvent: y,
750
+ resetData: p,
751
+ clearData: () => {
752
+ c && c(), p();
617
753
  },
618
- closeEvent: (u) => (n && n.close && n.close(), i(), u.cancelBubble = !0, u.preventDefault(), !1),
619
- refreshEvent: (u) => (n && n.refresh && n.refresh(), i(), u.cancelBubble = !0, u.preventDefault(), !1)
754
+ refresh: s,
755
+ close: E
620
756
  };
621
757
  }
622
- const tt = { class: "gc-header" }, nt = { class: "gc-icon-block" }, ct = { class: "gc-loading" }, st = ["src"], lt = /* @__PURE__ */ c("div", { class: "gc-round" }, null, -1), ot = { class: "gc-thumb gc-rotate-thumb" }, it = ["src"], at = { class: "gc-footer" }, ut = /* @__PURE__ */ c("div", { class: "gc-drag-line" }, null, -1), ee = /* @__PURE__ */ X({
758
+ const gt = { class: "gc-header" }, ft = { class: "gc-icon-block" }, vt = { class: "gc-loading" }, mt = ["src"], pt = /* @__PURE__ */ o("div", { class: "gc-round" }, null, -1), _t = { class: "gc-thumb gc-rotate-thumb" }, bt = ["src"], wt = { class: "gc-footer" }, xt = /* @__PURE__ */ o("div", { class: "gc-drag-line" }, null, -1), de = /* @__PURE__ */ U({
623
759
  __name: "index",
624
760
  props: {
625
- config: { default: oe },
761
+ config: { default: me },
626
762
  events: { default: () => ({}) },
627
763
  data: { default: () => ({}) }
628
764
  },
629
- setup(l) {
630
- const n = l, { data: t, events: s } = n, e = z({
631
- ...oe(),
632
- ...n.config
633
- });
634
- K(() => n.config, () => {
635
- e.value = {
636
- ...e.value,
637
- ...n.config
638
- };
639
- });
640
- const i = z(null), d = z(null), o = et(t, s, d, i), x = P(() => {
641
- const r = e.value.horizontalPadding || 0, v = e.value.verticalPadding || 0;
765
+ setup(n, { expose: t }) {
766
+ const a = n, { data: r, events: i, config: m } = a, c = B({ ...dt(), ...I(r) }), u = B({ ...I(i) }), e = B({ ...me(), ...I(m) });
767
+ F(() => a.data, (h, f) => {
768
+ Object.assign(c, h);
769
+ }, { deep: !0 }), F(() => a.events, (h, f) => {
770
+ Object.assign(u, h);
771
+ }, { deep: !0 }), F(() => a.config, (h, f) => {
772
+ Object.assign(e, h);
773
+ }, { deep: !0 });
774
+ const d = ee(null), y = ee(null), E = ee(null), s = ht(
775
+ c,
776
+ u,
777
+ e,
778
+ d,
779
+ E,
780
+ y,
781
+ () => {
782
+ c.thumb = "", c.image = "", c.angle = 0;
783
+ }
784
+ ), p = x(() => {
785
+ const h = e.horizontalPadding || 0, f = e.verticalPadding || 0;
642
786
  return {
643
- width: (e.value.width || 0) + r * 2 + (e.value.showTheme ? 2 : 0) + "px",
644
- paddingLeft: r + "px",
645
- paddingRight: r + "px",
646
- paddingTop: v + "px",
647
- paddingBottom: v + "px"
787
+ width: (e.width || 0) + h * 2 + (e.showTheme ? 2 : 0) + "px",
788
+ paddingLeft: h + "px",
789
+ paddingRight: h + "px",
790
+ paddingTop: f + "px",
791
+ paddingBottom: f + "px"
648
792
  };
649
- }), u = P(() => ({
650
- transform: `rotate(${o.state.thumbAngle}deg)`
651
- })), m = P(() => {
652
- var v;
653
- const r = (((v = e.value) == null ? void 0 : v.size) || 0) > 0 ? e.value.size : oe().size;
793
+ }), b = x(() => ({
794
+ transform: `rotate(${s.state.thumbAngle}deg)`
795
+ })), l = x(() => ({
796
+ width: e.width + "px",
797
+ height: e.height + "px"
798
+ })), _ = x(() => {
799
+ const h = (e.size || 0) > 0 ? e.size : me().size;
654
800
  return {
655
- width: r + "px",
656
- height: r + "px"
801
+ width: h + "px",
802
+ height: h + "px"
657
803
  };
658
- });
659
- return ie(async () => {
660
- await ae(), d.value && d.value.addEventListener("dragstart", (r) => r.preventDefault());
661
- }), (r, v) => (w(), C("div", {
662
- class: j(`go-captcha gc-wrapper ${e.value.showTheme ? "gc-theme" : ""}`),
663
- style: _(x.value)
804
+ }), g = x(() => c.image != ""), S = x(() => c.thumb != ""), L = x(() => (e.width || 0) > 0 || (e.height || 0) > 0);
805
+ return pe(async () => {
806
+ await _e(), E.value && E.value.addEventListener("dragstart", (h) => h.preventDefault());
807
+ }), t({
808
+ reset: s.resetData,
809
+ clear: s.clearData,
810
+ refresh: s.refresh,
811
+ close: s.close
812
+ }), (h, f) => K((z(), Y("div", {
813
+ class: se(`go-captcha gc-wrapper ${e.showTheme && "gc-theme"}`),
814
+ style: D(p.value),
815
+ ref_key: "rootRef",
816
+ ref: d
664
817
  }, [
665
- c("div", tt, [
666
- c("span", null, U(e.value.title), 1),
667
- c("div", nt, [
668
- D(ce, {
669
- width: 22,
670
- height: 22,
671
- onClick: a(o).closeEvent
672
- }, null, 8, ["onClick"]),
673
- D(se, {
674
- width: 22,
675
- height: 22,
676
- onClick: a(o).refreshEvent
677
- }, null, 8, ["onClick"])
818
+ o("div", gt, [
819
+ o("span", null, ie(e.title), 1),
820
+ o("div", ft, [
821
+ A(ge, {
822
+ width: e.iconSize,
823
+ height: e.iconSize,
824
+ onClick: v(s).closeEvent
825
+ }, null, 8, ["width", "height", "onClick"]),
826
+ A(fe, {
827
+ width: e.iconSize,
828
+ height: e.iconSize,
829
+ onClick: v(s).refreshEvent
830
+ }, null, 8, ["width", "height", "onClick"])
678
831
  ])
679
832
  ]),
680
- c("div", {
833
+ o("div", {
681
834
  class: "gc-body gc-rotate-body",
682
835
  ref: "containerRef",
683
- style: _(m.value)
836
+ style: D(l.value)
684
837
  }, [
685
- c("div", ct, [
686
- D(le)
687
- ]),
688
- c("div", {
689
- class: "gc-picture gc-rotate-picture",
690
- style: _(m.value)
838
+ o("div", {
839
+ class: "gc-body-inner",
840
+ style: D(_.value)
691
841
  }, [
692
- V(c("img", {
693
- src: a(t).image,
694
- alt: "..."
695
- }, null, 8, st), [
696
- [N, a(t).image !== ""]
842
+ o("div", vt, [
843
+ A(ve)
697
844
  ]),
698
- lt
699
- ], 4),
700
- c("div", ot, [
701
- c("div", {
702
- class: "gc-rotate-thumb-block",
703
- style: _(u.value)
845
+ o("div", {
846
+ class: "gc-picture gc-rotate-picture",
847
+ style: D(_.value)
704
848
  }, [
705
- V(c("img", {
706
- src: a(t).thumb,
707
- alt: "..."
708
- }, null, 8, it), [
709
- [N, a(t).thumb !== ""]
710
- ])
711
- ], 4)
712
- ])
849
+ K(o("img", {
850
+ src: c.image,
851
+ alt: ""
852
+ }, null, 8, mt), [
853
+ [Q, g.value]
854
+ ]),
855
+ pt
856
+ ], 4),
857
+ o("div", _t, [
858
+ o("div", {
859
+ class: "gc-rotate-thumb-block",
860
+ style: D(b.value)
861
+ }, [
862
+ K(o("img", {
863
+ src: c.thumb,
864
+ alt: ""
865
+ }, null, 8, bt), [
866
+ [Q, S.value]
867
+ ])
868
+ ], 4)
869
+ ])
870
+ ], 4)
713
871
  ], 4),
714
- c("div", at, [
715
- c("div", {
872
+ o("div", wt, [
873
+ o("div", {
716
874
  class: "gc-drag-slide-bar",
717
875
  ref_key: "dragBarRef",
718
- ref: i
876
+ ref: y
719
877
  }, [
720
- ut,
721
- c("div", {
722
- class: "gc-drag-block",
878
+ xt,
879
+ o("div", {
880
+ class: se(["gc-drag-block", !g.value && "disabled"]),
723
881
  ref_key: "dragBlockRef",
724
- ref: d,
725
- onMousedown: v[1] || (v[1] = //@ts-ignore
726
- (...E) => a(o).dragEvent && a(o).dragEvent(...E)),
727
- style: _({ left: a(o).state.dragLeft + "px" })
882
+ ref: E,
883
+ onMousedown: f[1] || (f[1] = //@ts-ignore
884
+ (...w) => v(s).dragEvent && v(s).dragEvent(...w)),
885
+ style: D({ left: v(s).state.dragLeft + "px" })
728
886
  }, [
729
- c("div", {
730
- class: "drag-block-inline",
731
- onTouchstart: v[0] || (v[0] = //@ts-ignore
732
- (...E) => a(o).dragEvent && a(o).dragEvent(...E))
887
+ o("div", {
888
+ class: "gc-drag-block-inline",
889
+ onTouchstart: f[0] || (f[0] = //@ts-ignore
890
+ (...w) => v(s).dragEvent && v(s).dragEvent(...w))
733
891
  }, [
734
- D(fe)
892
+ A(ye)
735
893
  ], 32)
736
- ], 36)
894
+ ], 38)
737
895
  ], 512)
738
896
  ])
739
- ], 6));
897
+ ], 6)), [
898
+ [Q, L.value]
899
+ ]);
740
900
  }
741
901
  });
742
- ee.name = "gocaptcha-rotate";
743
- ee.install = function(l) {
744
- l.component("gocaptcha-rotate", ee);
902
+ de.name = "gocaptcha-rotate";
903
+ de.install = function(n) {
904
+ n.component("gocaptcha-rotate", de);
745
905
  };
746
- const rt = /* @__PURE__ */ c("circle", {
906
+ const Et = /* @__PURE__ */ o("circle", {
747
907
  fill: "#3E7CFF",
748
908
  cx: "100",
749
909
  cy: "100",
750
910
  r: "96.3"
751
- }, null, -1), dt = /* @__PURE__ */ c("path", {
911
+ }, null, -1), Lt = /* @__PURE__ */ o("path", {
752
912
  fill: "#FFFFFF",
753
913
  d: `M140.8,64.4l-39.6-11.9h-2.4L59.2,64.4c-1.6,0.8-2.8,2.4-2.8,4v24.1c0,25.3,15.8,45.9,42.3,54.6
754
914
  c0.4,0,0.8,0.4,1.2,0.4c0.4,0,0.8,0,1.2-0.4c26.5-8.7,42.3-28.9,42.3-54.6V68.3C143.5,66.8,142.3,65.2,140.8,64.4z`
755
- }, null, -1), vt = [
756
- rt,
757
- dt
758
- ], ht = /* @__PURE__ */ X({
915
+ }, null, -1), yt = [
916
+ Et,
917
+ Lt
918
+ ], kt = /* @__PURE__ */ U({
759
919
  __name: "btn-default-icon",
760
920
  emits: ["click"],
761
- setup(l, { emit: n }) {
762
- const t = n;
763
- function s(e) {
764
- t("click", e);
921
+ setup(n, { emit: t }) {
922
+ const a = t;
923
+ function r(i) {
924
+ a("click", i);
765
925
  }
766
- return (e, i) => (w(), C("svg", I({
926
+ return (i, m) => (z(), Y("svg", oe({
767
927
  xmlns: "http://www.w3.org/2000/svg",
768
928
  viewBox: "0 0 200 200",
769
929
  width: "20",
770
930
  height: "20"
771
- }, e.$attrs, { onClick: s }), vt, 16));
931
+ }, i.$attrs, { onClick: r }), yt, 16));
772
932
  }
773
- }), gt = /* @__PURE__ */ c("path", {
933
+ }), Dt = /* @__PURE__ */ o("path", {
774
934
  fill: "#FFA000",
775
935
  d: `M184,26.6L102.4,2.1h-4.9L16,26.6c-3.3,1.6-5.7,4.9-5.7,8.2v49.8c0,52.2,32.6,94.7,87.3,112.6
776
936
  c0.8,0,1.6,0.8,2.4,0.8s1.6,0,2.4-0.8c54.7-18,87.3-59.6,87.3-112.6V34.7C189.8,31.5,187.3,28.2,184,26.6z M107.3,109.1
777
937
  c-0.5,5.4-3.9,7.9-7.3,7.9c-2.5,0,0,0,0,0c-3.2-0.6-5.7-2-6.8-7.4l-4.4-50.9c0-5.1,6.2-9.7,11.5-9.7c5.3,0,11,4.7,11,9.9
778
938
  L107.3,109.1z M109.3,133.3c0,5.1-4.2,9.3-9.3,9.3c-5.1,0-9.3-4.2-9.3-9.3c0-5.1,4.2-9.3,9.3-9.3C105.1,124,109.3,128.1,109.3,133.3
779
939
  z`
780
- }, null, -1), ft = [
781
- gt
782
- ], mt = /* @__PURE__ */ X({
940
+ }, null, -1), $t = [
941
+ Dt
942
+ ], zt = /* @__PURE__ */ U({
783
943
  __name: "btn-warn-icon",
784
944
  emits: ["click"],
785
- setup(l, { emit: n }) {
786
- const t = n;
787
- function s(e) {
788
- t("click", e);
945
+ setup(n, { emit: t }) {
946
+ const a = t;
947
+ function r(i) {
948
+ a("click", i);
789
949
  }
790
- return (e, i) => (w(), C("svg", I({
950
+ return (i, m) => (z(), Y("svg", oe({
791
951
  xmlns: "http://www.w3.org/2000/svg",
792
952
  viewBox: "0 0 200 200",
793
953
  width: "20",
794
954
  height: "20"
795
- }, e.$attrs, { onClick: s }), ft, 16));
955
+ }, i.$attrs, { onClick: r }), $t, 16));
796
956
  }
797
- }), pt = /* @__PURE__ */ c("path", {
957
+ }), Ct = /* @__PURE__ */ o("path", {
798
958
  fill: "#ED4630",
799
959
  d: `M184,26.6L102.4,2.1h-4.9L16,26.6c-3.3,1.6-5.7,4.9-5.7,8.2v49.8c0,52.2,32.6,94.7,87.3,112.6
800
960
  c0.8,0,1.6,0.8,2.4,0.8s1.6,0,2.4-0.8c54.7-18,87.3-59.6,87.3-112.6V34.7C189.8,31.5,187.3,28.2,184,26.6z M134.5,123.1
801
961
  c3.1,3.1,3.1,8.2,0,11.3c-1.6,1.6-3.6,2.3-5.7,2.3s-4.1-0.8-5.7-2.3L100,111.3l-23.1,23.1c-1.6,1.6-3.6,2.3-5.7,2.3
802
962
  c-2,0-4.1-0.8-5.7-2.3c-3.1-3.1-3.1-8.2,0-11.3L88.7,100L65.5,76.9c-3.1-3.1-3.1-8.2,0-11.3c3.1-3.1,8.2-3.1,11.3,0L100,88.7
803
963
  l23.1-23.1c3.1-3.1,8.2-3.1,11.3,0c3.1,3.1,3.1,8.2,0,11.3L111.3,100L134.5,123.1z`
804
- }, null, -1), _t = [
805
- pt
806
- ], Et = /* @__PURE__ */ X({
964
+ }, null, -1), St = [
965
+ Ct
966
+ ], Bt = /* @__PURE__ */ U({
807
967
  __name: "btn-error-icon",
808
968
  emits: ["click"],
809
- setup(l, { emit: n }) {
810
- const t = n;
811
- function s(e) {
812
- t("click", e);
969
+ setup(n, { emit: t }) {
970
+ const a = t;
971
+ function r(i) {
972
+ a("click", i);
813
973
  }
814
- return (e, i) => (w(), C("svg", I({
974
+ return (i, m) => (z(), Y("svg", oe({
815
975
  xmlns: "http://www.w3.org/2000/svg",
816
976
  viewBox: "0 0 200 200",
817
977
  width: "20",
818
978
  height: "20"
819
- }, e.$attrs, { onClick: s }), _t, 16));
979
+ }, i.$attrs, { onClick: r }), St, 16));
820
980
  }
821
- }), bt = /* @__PURE__ */ c("path", {
981
+ }), Tt = /* @__PURE__ */ o("path", {
822
982
  fill: "#5EAA2F",
823
983
  d: `M183.3,27.2L102.4,2.9h-4.9L16.7,27.2C13.4,28.8,11,32,11,35.3v49.4c0,51.8,32.4,93.9,86.6,111.7
824
984
  c0.8,0,1.6,0.8,2.4,0.8c0.8,0,1.6,0,2.4-0.8c54.2-17.8,86.6-59.1,86.6-111.7V35.3C189,32,186.6,28.8,183.3,27.2z M146.1,81.4
825
985
  l-48.5,48.5c-1.6,1.6-3.2,2.4-5.7,2.4c-2.4,0-4-0.8-5.7-2.4L62,105.7c-3.2-3.2-3.2-8.1,0-11.3c3.2-3.2,8.1-3.2,11.3,0l18.6,18.6
826
986
  l42.9-42.9c3.2-3.2,8.1-3.2,11.3,0C149.4,73.3,149.4,78.2,146.1,81.4L146.1,81.4z`
827
- }, null, -1), wt = [
828
- bt
829
- ], xt = /* @__PURE__ */ X({
987
+ }, null, -1), Pt = [
988
+ Tt
989
+ ], Xt = /* @__PURE__ */ U({
830
990
  __name: "btn-success-icon",
831
991
  emits: ["click"],
832
- setup(l, { emit: n }) {
833
- const t = n;
834
- function s(e) {
835
- t("click", e);
992
+ setup(n, { emit: t }) {
993
+ const a = t;
994
+ function r(i) {
995
+ a("click", i);
836
996
  }
837
- return (e, i) => (w(), C("svg", I({
997
+ return (i, m) => (z(), Y("svg", oe({
838
998
  xmlns: "http://www.w3.org/2000/svg",
839
999
  viewBox: "0 0 200 200",
840
1000
  width: "20",
841
1001
  height: "20"
842
- }, e.$attrs, { onClick: s }), wt, 16));
1002
+ }, i.$attrs, { onClick: r }), Pt, 16));
843
1003
  }
844
- }), he = () => ({
1004
+ }), Le = () => ({
845
1005
  width: 330,
846
1006
  height: 44,
847
1007
  verticalPadding: 12,
848
1008
  horizontalPadding: 16
849
- }), te = /* @__PURE__ */ X({
1009
+ }), he = /* @__PURE__ */ U({
850
1010
  __name: "index",
851
1011
  props: {
852
- config: { default: he },
1012
+ config: { default: Le },
853
1013
  clickEvent: {},
854
1014
  disabled: { type: Boolean, default: !1 },
855
1015
  type: { default: "default" },
856
1016
  title: { default: "点击按键进行验证" }
857
1017
  },
858
1018
  emits: ["click-event"],
859
- setup(l, { emit: n }) {
860
- const t = l, { type: s, title: e, disabled: i } = Ee(t), d = z({
861
- ...he(),
862
- ...t.config
863
- });
864
- K(() => t.config, () => {
865
- d.value = {
866
- ...d.value,
867
- ...t.config
868
- };
869
- });
870
- const o = P(() => ["go-captcha", "gc-btn-block", `gc-${s.value}`, i.value ? "gc-disabled" : ""]), x = P(() => ({
871
- width: d.value.width + "px",
872
- height: d.value.height + "px",
873
- paddingLeft: d.value.horizontalPadding + "px",
874
- paddingRight: d.value.horizontalPadding + "px",
875
- paddingTop: d.value.verticalPadding + "px",
876
- paddingBottom: d.value.verticalPadding + "px"
877
- })), u = n;
878
- function m(r) {
879
- u("click-event", r);
1019
+ setup(n, { emit: t }) {
1020
+ const a = n, { type: r, title: i, disabled: m, config: c } = ze(a), u = B({ ...Le(), ...I(c) });
1021
+ F(() => a.config, (s, p) => {
1022
+ Object.assign(u, s);
1023
+ }, { deep: !0 });
1024
+ const e = x(() => ["go-captcha", "gc-btn-block", `gc-${r.value}`, m.value ? "gc-disabled" : ""]), d = x(() => ({
1025
+ width: u.width + "px",
1026
+ height: u.height + "px",
1027
+ paddingLeft: u.horizontalPadding + "px",
1028
+ paddingRight: u.horizontalPadding + "px",
1029
+ paddingTop: u.verticalPadding + "px",
1030
+ paddingBottom: u.verticalPadding + "px"
1031
+ })), y = t;
1032
+ function E(s) {
1033
+ y("click-event", s);
880
1034
  }
881
- return (r, v) => (w(), C("div", {
882
- class: j(o.value),
883
- style: _(x.value),
884
- onClick: m
1035
+ return (s, p) => (z(), Y("div", {
1036
+ class: se(e.value),
1037
+ style: D(d.value),
1038
+ onClick: E
885
1039
  }, [
886
- c("div", {
887
- class: j(a(s) === "default" ? "gc-ripple" : "")
1040
+ o("div", {
1041
+ class: se(v(r) === "default" ? "gc-ripple" : "")
888
1042
  }, [
889
- a(s) === "default" ? (w(), O(ht, { key: 0 })) : a(s) === "warn" ? (w(), O(mt, { key: 1 })) : a(s) === "error" ? (w(), O(Et, { key: 2 })) : a(s) === "success" ? (w(), O(xt, { key: 3 })) : be("", !0)
1043
+ v(r) === "default" ? (z(), ae(kt, { key: 0 })) : v(r) === "warn" ? (z(), ae(zt, { key: 1 })) : v(r) === "error" ? (z(), ae(Bt, { key: 2 })) : v(r) === "success" ? (z(), ae(Xt, { key: 3 })) : Ce("", !0)
890
1044
  ], 2),
891
- c("span", null, U(a(e)), 1)
1045
+ o("span", null, ie(v(i)), 1)
892
1046
  ], 6));
893
1047
  }
894
1048
  });
895
- te.name = "gocaptcha-button";
896
- te.install = function(l) {
897
- l.component("gocaptcha-button", te);
1049
+ he.name = "gocaptcha-button";
1050
+ he.install = function(n) {
1051
+ n.component("gocaptcha-button", he);
898
1052
  };
899
- const ge = "go_captcha_installed", kt = (l) => {
900
- l[ge] || (l[ge] = !0, [Q, Z, R, ee, te].map((n) => l.use(n)));
1053
+ const Mt = {
1054
+ install(n) {
1055
+ le.install(n), re.install(n), ue.install(n), de.install(n), he.install(n);
1056
+ }
901
1057
  };
902
1058
  export {
903
- te as Button,
904
- Q as Click,
905
- ee as Rotate,
906
- Z as Slide,
907
- R as SlideRegion,
908
- kt as default
1059
+ he as Button,
1060
+ le as Click,
1061
+ de as Rotate,
1062
+ re as Slide,
1063
+ ue as SlideRegion,
1064
+ Mt as default
909
1065
  };