yl-ai-modal 1.0.9 → 1.0.10
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 +2 -0
- package/dist/yl-ai-modal.css +1 -1
- package/dist/yl-ai-modal.es.js +205 -195
- package/dist/yl-ai-modal.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/yl-ai-modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ai-dialog[data-v-bba24a59]{border:none;width:100%;height:100%}.ai-human[data-v-bba24a59]{position:absolute;left:0;bottom:0;background-size:contain!important;transform:translate(-100%);cursor:move}.ai-dialog-feed[data-v-bba24a59]{height:100%;overflow:hidden;box-sizing:border-box;box-shadow:0 0 12px #9797974d;border-radius:16px;background-color:#fff}.ai-dialog-iframe[data-v-bba24a59]{display:block;width:100%;height:100%;border:none}.vdr{touch-action:none;position:absolute;box-sizing:border-box;border:1px dashed black}.handle{box-sizing:border-box;position:absolute;width:10px;height:10px;background:#eee;border:1px solid #333}.handle-tl{top:-10px;left:-10px;cursor:nw-resize}.handle-tm{top:-10px;left:50%;margin-left:-5px;cursor:n-resize}.handle-tr{top:-10px;right:-10px;cursor:ne-resize}.handle-ml{top:50%;margin-top:-5px;left:-10px;cursor:w-resize}.handle-mr{top:50%;margin-top:-5px;right:-10px;cursor:e-resize}.handle-bl{bottom:-10px;left:-10px;cursor:sw-resize}.handle-bm{bottom:-10px;left:50%;margin-left:-5px;cursor:s-resize}.handle-br{bottom:-10px;right:-10px;cursor:se-resize}@media only screen and (max-width:768px){[class*=handle-]:before{content:"";inset:-10px;position:absolute}}.fade-enter-active[data-v-
|
|
1
|
+
.ai-dialog[data-v-bba24a59]{border:none;width:100%;height:100%}.ai-human[data-v-bba24a59]{position:absolute;left:0;bottom:0;background-size:contain!important;transform:translate(-100%);cursor:move}.ai-dialog-feed[data-v-bba24a59]{height:100%;overflow:hidden;box-sizing:border-box;box-shadow:0 0 12px #9797974d;border-radius:16px;background-color:#fff}.ai-dialog-iframe[data-v-bba24a59]{display:block;width:100%;height:100%;border:none}.vdr{touch-action:none;position:absolute;box-sizing:border-box;border:1px dashed black}.handle{box-sizing:border-box;position:absolute;width:10px;height:10px;background:#eee;border:1px solid #333}.handle-tl{top:-10px;left:-10px;cursor:nw-resize}.handle-tm{top:-10px;left:50%;margin-left:-5px;cursor:n-resize}.handle-tr{top:-10px;right:-10px;cursor:ne-resize}.handle-ml{top:50%;margin-top:-5px;left:-10px;cursor:w-resize}.handle-mr{top:50%;margin-top:-5px;right:-10px;cursor:e-resize}.handle-bl{bottom:-10px;left:-10px;cursor:sw-resize}.handle-bm{bottom:-10px;left:50%;margin-left:-5px;cursor:s-resize}.handle-br{bottom:-10px;right:-10px;cursor:se-resize}@media only screen and (max-width:768px){[class*=handle-]:before{content:"";inset:-10px;position:absolute}}.fade-enter-active[data-v-fd6bf392],.fade-leave-active[data-v-fd6bf392]{transition:opacity .3s ease}.fade-enter-from[data-v-fd6bf392],.fade-leave-to[data-v-fd6bf392]{opacity:0}.dialog-vdr[data-v-fd6bf392]{border:none;left:0;top:0;display:flex;align-items:flex-end;pointer-events:none}.yl-ai-modal[data-v-fd6bf392],.ai-human[data-v-fd6bf392],.icon-close[data-v-fd6bf392]{pointer-events:auto}.yl-ai-modal[data-v-fd6bf392]{flex:0 0 400px;height:100%}.icon-close[data-v-fd6bf392]{position:absolute;right:0;top:0;width:40px;height:40px;cursor:pointer;background:#0000001a url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABZ0lEQVR4AaSVQW7CMBBFk+x6hp6m6gap4hQVS86AOAPb9hSoEpuql2nP0GX631CDgXg8DmjGcezJe4kdlGEcx5XyW/mmfOju/MFQwoK5GsTbKB+Vr8q9JmdL/q/diwML5gbBQQMpntWZJcngMISxOCBYq/upTEFBk6QAh7ke+r7/FXmpZEAHi7DEgS9h8wQdHWGbJTW4mJ0J6LRKInC4JwEnUUkUDvNCwEBN0gKHdyNg0JF8aJ7kJVDXgpfDNtTOrppJATUFyZPmSB0sXDgVRQGTmeSL86tkrHjnqdYVpKJ7jq4g29B8WZKPseo/vijI4PmGsixkkjDnSiYFBTgb+iIySV9dC1dyI3DgtqHZxockF4Ia3O5XTYvkJIjCxbeISkzQCjeDmoiEbzKfSD5zbJYus2B9bc3tzGlqEp5gp+tnwXWdhSPZIVhY1bEJ3/mx/NwWJAsEW5X9KN+VoWVR3WRkElgwt38AAAD//5QocPkAAAAGSURBVAMAQOLr9fdNGykAAAAASUVORK5CYII=) no-repeat center;border-radius:0 16px;background-size:12px;transition:all .3s}.icon-close[data-v-fd6bf392]:hover{opacity:.7}.ai-human[data-v-fd6bf392]{width:120px;height:120px;flex:none;background-size:contain!important;cursor:move}
|
package/dist/yl-ai-modal.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useAttrs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { useAttrs as Vt, reactive as Rt, onBeforeMount as St, onMounted as V, nextTick as N, openBlock as W, createElementBlock as L, createElementVNode as $, watch as it, getCurrentInstance as B, getCurrentScope as At, hasInjectionContext as Mt, inject as Q, computed as I, toValue as H, shallowRef as C, watchEffect as Ut, unref as nt, normalizeClass as mt, normalizeStyle as J, Fragment as Ft, renderList as jt, withModifiers as gt, renderSlot as q, ref as T, useTemplateRef as pt, createBlock as Yt, withCtx as ft, createVNode as kt, Transition as Xt, withDirectives as Zt, createTextVNode as Kt, toDisplayString as Gt, vShow as Qt, createCommentVNode as Jt, isVNode as Wt, render as vt, h as qt } from "vue";
|
|
2
|
+
import te from "axios";
|
|
3
|
+
const st = te.create({
|
|
4
4
|
timeout: 6e3
|
|
5
5
|
// 请求超时时间
|
|
6
|
-
}),
|
|
6
|
+
}), Ht = (t) => {
|
|
7
7
|
if (t.response) {
|
|
8
8
|
const e = localStorage.getItem("token");
|
|
9
9
|
t.response.status == 401 && e && (localStorage.remove("token"), setTimeout(() => {
|
|
@@ -12,30 +12,30 @@ const nt = Jt.create({
|
|
|
12
12
|
}
|
|
13
13
|
return Promise.reject(t);
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
st.interceptors.request.use((t) => {
|
|
16
16
|
const e = localStorage.getItem("token");
|
|
17
17
|
return e && (t.headers.token = e), t;
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
const
|
|
18
|
+
}, Ht);
|
|
19
|
+
st.interceptors.response.use((t) => t.data, Ht);
|
|
20
|
+
const Ct = (t, e) => {
|
|
21
21
|
const i = t.__vccOpts || t;
|
|
22
22
|
for (const [n, s] of e)
|
|
23
23
|
i[n] = s;
|
|
24
24
|
return i;
|
|
25
|
-
},
|
|
25
|
+
}, ee = { class: "ai-dialog" }, ie = { class: "ai-dialog-feed" }, ne = ["src"], se = {
|
|
26
26
|
__name: "index",
|
|
27
27
|
setup(t) {
|
|
28
|
-
const e =
|
|
28
|
+
const e = Vt(), i = Rt({
|
|
29
29
|
baseUrl: "",
|
|
30
30
|
url: ""
|
|
31
31
|
}), n = async () => {
|
|
32
32
|
if (i.baseUrl)
|
|
33
|
-
return (await
|
|
33
|
+
return (await st.post(i.baseUrl + "/api/v1/user/login", {
|
|
34
34
|
username: "clare",
|
|
35
35
|
password: "Zz12345678"
|
|
36
36
|
}))?.data;
|
|
37
37
|
};
|
|
38
|
-
return
|
|
38
|
+
return St(async () => {
|
|
39
39
|
let s = e.url;
|
|
40
40
|
const o = new URL(s);
|
|
41
41
|
i.baseUrl = o.origin;
|
|
@@ -47,108 +47,108 @@ const kt = (t, e) => {
|
|
|
47
47
|
}), V(() => {
|
|
48
48
|
N(() => {
|
|
49
49
|
});
|
|
50
|
-
}), (s, o) => (
|
|
51
|
-
$("div",
|
|
50
|
+
}), (s, o) => (W(), L("div", ee, [
|
|
51
|
+
$("div", ie, [
|
|
52
52
|
$("iframe", {
|
|
53
53
|
class: "ai-dialog-iframe",
|
|
54
54
|
src: i.url
|
|
55
|
-
}, null, 8,
|
|
55
|
+
}, null, 8, ne)
|
|
56
56
|
])
|
|
57
57
|
]));
|
|
58
58
|
}
|
|
59
|
-
},
|
|
59
|
+
}, oe = /* @__PURE__ */ Ct(se, [["__scopeId", "data-v-bba24a59"]]);
|
|
60
60
|
process.env.NODE_ENV !== "production" && Object.freeze({});
|
|
61
61
|
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
62
|
-
const
|
|
62
|
+
const tt = (t) => typeof t == "function", ae = (t) => typeof t == "string", X = /* @__PURE__ */ new WeakMap(), he = /* @__NO_SIDE_EFFECTS__ */ (...t) => {
|
|
63
63
|
var e;
|
|
64
|
-
const i = t[0], n = (e = B()) === null || e === void 0 ? void 0 : e.proxy, s = n ??
|
|
65
|
-
if (s == null && !
|
|
66
|
-
return s &&
|
|
67
|
-
},
|
|
64
|
+
const i = t[0], n = (e = B()) === null || e === void 0 ? void 0 : e.proxy, s = n ?? At();
|
|
65
|
+
if (s == null && !Mt()) throw new Error("injectLocal must be called in setup");
|
|
66
|
+
return s && X.has(s) && i in X.get(s) ? X.get(s)[i] : Q(...t);
|
|
67
|
+
}, re = typeof window < "u" && typeof document < "u";
|
|
68
68
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
69
|
-
const
|
|
70
|
-
function
|
|
69
|
+
const le = Object.prototype.toString, ue = (t) => le.call(t) === "[object Object]";
|
|
70
|
+
function bt(t) {
|
|
71
71
|
return t.endsWith("rem") ? Number.parseFloat(t) * 16 : Number.parseFloat(t);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Z(t) {
|
|
74
74
|
return Array.isArray(t) ? t : [t];
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function ce(t) {
|
|
77
77
|
return B();
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
79
|
+
function de(t, e = !0, i) {
|
|
80
|
+
ce() ? V(t, i) : e ? t() : N(t);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
return
|
|
82
|
+
function me(t, e, i) {
|
|
83
|
+
return it(t, e, {
|
|
84
84
|
...i,
|
|
85
85
|
immediate: !0
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
function
|
|
88
|
+
const ot = re ? window : void 0;
|
|
89
|
+
function ge(t) {
|
|
90
90
|
var e;
|
|
91
|
-
const i =
|
|
91
|
+
const i = H(t);
|
|
92
92
|
return (e = i?.$el) !== null && e !== void 0 ? e : i;
|
|
93
93
|
}
|
|
94
94
|
function _(...t) {
|
|
95
95
|
const e = (n, s, o, a) => (n.addEventListener(s, o, a), () => n.removeEventListener(s, o, a)), i = I(() => {
|
|
96
|
-
const n =
|
|
96
|
+
const n = Z(H(t[0])).filter((s) => s != null);
|
|
97
97
|
return n.every((s) => typeof s != "string") ? n : void 0;
|
|
98
98
|
});
|
|
99
|
-
return
|
|
99
|
+
return me(() => {
|
|
100
100
|
var n, s;
|
|
101
101
|
return [
|
|
102
|
-
(n = (s = i.value) === null || s === void 0 ? void 0 : s.map((o) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
(n = (s = i.value) === null || s === void 0 ? void 0 : s.map((o) => ge(o))) !== null && n !== void 0 ? n : [ot].filter((o) => o != null),
|
|
103
|
+
Z(H(i.value ? t[1] : t[0])),
|
|
104
|
+
Z(nt(i.value ? t[2] : t[1])),
|
|
105
|
+
H(i.value ? t[3] : t[2])
|
|
106
106
|
];
|
|
107
107
|
}, ([n, s, o, a], l, u) => {
|
|
108
108
|
if (!n?.length || !s?.length || !o?.length) return;
|
|
109
|
-
const r =
|
|
109
|
+
const r = ue(a) ? { ...a } : a, d = n.flatMap((c) => s.flatMap((m) => o.map((h) => e(c, m, h, r))));
|
|
110
110
|
u(() => {
|
|
111
111
|
d.forEach((c) => c());
|
|
112
112
|
});
|
|
113
113
|
}, { flush: "post" });
|
|
114
114
|
}
|
|
115
115
|
// @__NO_SIDE_EFFECTS__
|
|
116
|
-
function
|
|
116
|
+
function pe() {
|
|
117
117
|
const t = C(!1), e = B();
|
|
118
118
|
return e && V(() => {
|
|
119
119
|
t.value = !0;
|
|
120
120
|
}, e), t;
|
|
121
121
|
}
|
|
122
122
|
// @__NO_SIDE_EFFECTS__
|
|
123
|
-
function
|
|
124
|
-
const e = /* @__PURE__ */
|
|
123
|
+
function fe(t) {
|
|
124
|
+
const e = /* @__PURE__ */ pe();
|
|
125
125
|
return I(() => (e.value, !!t()));
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const ve = /* @__PURE__ */ Symbol("vueuse-ssr-width");
|
|
128
128
|
// @__NO_SIDE_EFFECTS__
|
|
129
|
-
function
|
|
130
|
-
const t =
|
|
129
|
+
function be() {
|
|
130
|
+
const t = Mt() ? /* @__PURE__ */ he(ve, null) : null;
|
|
131
131
|
return typeof t == "number" ? t : void 0;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
const { window: i =
|
|
133
|
+
function we(t, e = {}) {
|
|
134
|
+
const { window: i = ot, ssrWidth: n = /* @__PURE__ */ be() } = e, s = /* @__PURE__ */ fe(() => i && "matchMedia" in i && typeof i.matchMedia == "function"), o = C(typeof n == "number"), a = C(), l = C(!1), u = (r) => {
|
|
135
135
|
l.value = r.matches;
|
|
136
136
|
};
|
|
137
|
-
return
|
|
137
|
+
return Ut(() => {
|
|
138
138
|
if (o.value) {
|
|
139
|
-
o.value = !s.value, l.value =
|
|
139
|
+
o.value = !s.value, l.value = H(t).split(",").some((r) => {
|
|
140
140
|
const d = r.includes("not all"), c = r.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = r.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
141
141
|
let h = !!(c || m);
|
|
142
|
-
return c && h && (h = n >=
|
|
142
|
+
return c && h && (h = n >= bt(c[1])), m && h && (h = n <= bt(m[1])), d ? !h : h;
|
|
143
143
|
});
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
s.value && (a.value = i.matchMedia(
|
|
146
|
+
s.value && (a.value = i.matchMedia(H(t)), l.value = a.value.matches);
|
|
147
147
|
}), _(a, "change", u, { passive: !0 }), I(() => l.value);
|
|
148
148
|
}
|
|
149
149
|
// @__NO_SIDE_EFFECTS__
|
|
150
|
-
function
|
|
151
|
-
const { window: e =
|
|
150
|
+
function ye(t = {}) {
|
|
151
|
+
const { window: e = ot, initialWidth: i = Number.POSITIVE_INFINITY, initialHeight: n = Number.POSITIVE_INFINITY, listenOrientation: s = !0, includeScrollbar: o = !0, type: a = "inner" } = t, l = C(i), u = C(n), r = () => {
|
|
152
152
|
if (e) if (a === "outer")
|
|
153
153
|
l.value = e.outerWidth, u.value = e.outerHeight;
|
|
154
154
|
else if (a === "visual" && e.visualViewport) {
|
|
@@ -156,30 +156,30 @@ function be(t = {}) {
|
|
|
156
156
|
l.value = Math.round(c * h), u.value = Math.round(m * h);
|
|
157
157
|
} else o ? (l.value = e.innerWidth, u.value = e.innerHeight) : (l.value = e.document.documentElement.clientWidth, u.value = e.document.documentElement.clientHeight);
|
|
158
158
|
};
|
|
159
|
-
r(),
|
|
159
|
+
r(), de(r);
|
|
160
160
|
const d = { passive: !0 };
|
|
161
|
-
return _("resize", r, d), e && a === "visual" && e.visualViewport && _(e.visualViewport, "resize", r, d), s &&
|
|
161
|
+
return _("resize", r, d), e && a === "visual" && e.visualViewport && _(e.visualViewport, "resize", r, d), s && it(we("(orientation: portrait)"), () => r()), {
|
|
162
162
|
width: l,
|
|
163
163
|
height: u
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function wt(t) {
|
|
167
167
|
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Function]";
|
|
168
168
|
}
|
|
169
169
|
function M(t, e, i, n = 1) {
|
|
170
170
|
const [s, o] = typeof n == "number" ? [n, n] : n, a = Math.round(e / s / t[0]) * t[0], l = Math.round(i / o / t[1]) * t[1];
|
|
171
171
|
return [a, l];
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function K(t, e, i) {
|
|
174
174
|
return t - e - i;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function G(t, e, i) {
|
|
177
177
|
return t - e - i;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function v(t, e, i) {
|
|
180
180
|
return e !== null && t < e ? e : i !== null && i < t ? i : t;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function yt(t, e, i) {
|
|
183
183
|
let n = t;
|
|
184
184
|
const s = [
|
|
185
185
|
"matches",
|
|
@@ -187,8 +187,8 @@ function vt(t, e, i) {
|
|
|
187
187
|
"mozMatchesSelector",
|
|
188
188
|
"msMatchesSelector",
|
|
189
189
|
"oMatchesSelector"
|
|
190
|
-
].find((o) =>
|
|
191
|
-
if (!
|
|
190
|
+
].find((o) => wt(n[o]));
|
|
191
|
+
if (!wt(n[s]))
|
|
192
192
|
return !1;
|
|
193
193
|
do {
|
|
194
194
|
if (n[s](e))
|
|
@@ -199,20 +199,20 @@ function vt(t, e, i) {
|
|
|
199
199
|
} while (n);
|
|
200
200
|
return !1;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function xe(t) {
|
|
203
203
|
const e = window.getComputedStyle(t);
|
|
204
204
|
return [
|
|
205
205
|
parseFloat(e.getPropertyValue("width"), 10),
|
|
206
206
|
parseFloat(e.getPropertyValue("height"), 10)
|
|
207
207
|
];
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function S(t, e, i) {
|
|
210
210
|
t && (t.attachEvent ? t.attachEvent("on" + e, i) : t.addEventListener ? t.addEventListener(e, i, !0) : t["on" + e] = i);
|
|
211
211
|
}
|
|
212
212
|
function b(t, e, i) {
|
|
213
213
|
t && (t.detachEvent ? t.detachEvent("on" + e, i) : t.removeEventListener ? t.removeEventListener(e, i, !0) : t["on" + e] = null);
|
|
214
214
|
}
|
|
215
|
-
const
|
|
215
|
+
const ze = (t, e) => {
|
|
216
216
|
const i = t.__vccOpts || t;
|
|
217
217
|
for (const [n, s] of e)
|
|
218
218
|
i[n] = s;
|
|
@@ -228,19 +228,19 @@ const ye = (t, e) => {
|
|
|
228
228
|
move: "touchmove",
|
|
229
229
|
stop: "touchend"
|
|
230
230
|
}
|
|
231
|
-
},
|
|
231
|
+
}, Re = {
|
|
232
232
|
userSelect: "none",
|
|
233
233
|
MozUserSelect: "none",
|
|
234
234
|
WebkitUserSelect: "none",
|
|
235
235
|
MsUserSelect: "none"
|
|
236
|
-
},
|
|
236
|
+
}, Se = {
|
|
237
237
|
userSelect: "auto",
|
|
238
238
|
MozUserSelect: "auto",
|
|
239
239
|
WebkitUserSelect: "auto",
|
|
240
240
|
MsUserSelect: "auto"
|
|
241
241
|
};
|
|
242
242
|
let w = D.mouse;
|
|
243
|
-
const
|
|
243
|
+
const Me = {
|
|
244
244
|
replace: !0,
|
|
245
245
|
name: "vue-draggable-resizable",
|
|
246
246
|
props: {
|
|
@@ -423,8 +423,8 @@ const Re = {
|
|
|
423
423
|
this.enableNativeDrag || (this.$el.ondragstart = () => !1);
|
|
424
424
|
const [t, e] = this.getParentSize();
|
|
425
425
|
this.parentWidth = t, this.parentHeight = e;
|
|
426
|
-
const [i, n] =
|
|
427
|
-
this.aspectFactor = (this.w !== "auto" ? this.w : i) / (this.h !== "auto" ? this.h : n), this.width = this.w !== "auto" ? this.w : i, this.height = this.h !== "auto" ? this.h : n, this.right = this.parentWidth - this.width - this.left, this.bottom = this.parentHeight - this.height - this.top, this.active && this.$emit("activated"),
|
|
426
|
+
const [i, n] = xe(this.$el);
|
|
427
|
+
this.aspectFactor = (this.w !== "auto" ? this.w : i) / (this.h !== "auto" ? this.h : n), this.width = this.w !== "auto" ? this.w : i, this.height = this.h !== "auto" ? this.h : n, this.right = this.parentWidth - this.width - this.left, this.bottom = this.parentHeight - this.height - this.top, this.active && this.$emit("activated"), S(document.documentElement, "mousedown", this.deselect), S(document.documentElement, "touchend touchcancel", this.deselect), S(window, "resize", this.checkParentSize);
|
|
428
428
|
},
|
|
429
429
|
beforeUnmount: function() {
|
|
430
430
|
b(document.documentElement, "mousedown", this.deselect), b(document.documentElement, "touchstart", this.handleUp), b(document.documentElement, "mousemove", this.move), b(document.documentElement, "touchmove", this.move), b(document.documentElement, "mouseup", this.handleUp), b(document.documentElement, "touchend touchcancel", this.deselect), b(window, "resize", this.checkParentSize);
|
|
@@ -471,11 +471,11 @@ const Re = {
|
|
|
471
471
|
if (this.$el.contains(e)) {
|
|
472
472
|
if (this.onDragStart(t) === !1)
|
|
473
473
|
return;
|
|
474
|
-
if (this.dragHandle && !
|
|
474
|
+
if (this.dragHandle && !yt(e, this.dragHandle, this.$el) || this.dragCancel && yt(e, this.dragCancel, this.$el)) {
|
|
475
475
|
this.dragging = !1;
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
this.enabled || (this.enabled = !0, this.$emit("activated"), this.$emit("update:active", !0)), this.draggable && (this.dragEnable = !0), this.mouseClickPosition.mouseX = t.touches ? t.touches[0].pageX : t.pageX, this.mouseClickPosition.mouseY = t.touches ? t.touches[0].pageY : t.pageY, this.mouseClickPosition.left = this.left, this.mouseClickPosition.right = this.right, this.mouseClickPosition.top = this.top, this.mouseClickPosition.bottom = this.bottom, this.parent && (this.bounds = this.calcDragLimits()),
|
|
478
|
+
this.enabled || (this.enabled = !0, this.$emit("activated"), this.$emit("update:active", !0)), this.draggable && (this.dragEnable = !0), this.mouseClickPosition.mouseX = t.touches ? t.touches[0].pageX : t.pageX, this.mouseClickPosition.mouseY = t.touches ? t.touches[0].pageY : t.pageY, this.mouseClickPosition.left = this.left, this.mouseClickPosition.right = this.right, this.mouseClickPosition.top = this.top, this.mouseClickPosition.bottom = this.bottom, this.parent && (this.bounds = this.calcDragLimits()), S(document.documentElement, w.move, this.move), S(document.documentElement, w.stop, this.handleUp);
|
|
479
479
|
}
|
|
480
480
|
},
|
|
481
481
|
calcDragLimits() {
|
|
@@ -498,7 +498,7 @@ const Re = {
|
|
|
498
498
|
w = D.touch, this.handleDown(t, e);
|
|
499
499
|
},
|
|
500
500
|
handleDown(t, e) {
|
|
501
|
-
e instanceof MouseEvent && e.which !== 1 || this.onResizeStart(t, e) !== !1 && (e.stopPropagation && e.stopPropagation(), this.lockAspectRatio && !t.includes("m") ? this.handle = "m" + t.substring(1) : this.handle = t, this.resizeEnable = !0, this.mouseClickPosition.mouseX = e.touches ? e.touches[0].pageX : e.pageX, this.mouseClickPosition.mouseY = e.touches ? e.touches[0].pageY : e.pageY, this.mouseClickPosition.left = this.left, this.mouseClickPosition.right = this.right, this.mouseClickPosition.top = this.top, this.mouseClickPosition.bottom = this.bottom, this.bounds = this.calcResizeLimits(),
|
|
501
|
+
e instanceof MouseEvent && e.which !== 1 || this.onResizeStart(t, e) !== !1 && (e.stopPropagation && e.stopPropagation(), this.lockAspectRatio && !t.includes("m") ? this.handle = "m" + t.substring(1) : this.handle = t, this.resizeEnable = !0, this.mouseClickPosition.mouseX = e.touches ? e.touches[0].pageX : e.pageX, this.mouseClickPosition.mouseY = e.touches ? e.touches[0].pageY : e.pageY, this.mouseClickPosition.left = this.left, this.mouseClickPosition.right = this.right, this.mouseClickPosition.top = this.top, this.mouseClickPosition.bottom = this.bottom, this.bounds = this.calcResizeLimits(), S(document.documentElement, w.move, this.handleResize), S(document.documentElement, w.stop, this.handleUp));
|
|
502
502
|
},
|
|
503
503
|
calcResizeLimits() {
|
|
504
504
|
let t = this.minW, e = this.minH, i = this.maxW, n = this.maxH;
|
|
@@ -520,18 +520,18 @@ const Re = {
|
|
|
520
520
|
this.resizing ? this.handleResize(t) : this.dragEnable && this.handleDrag(t);
|
|
521
521
|
},
|
|
522
522
|
handleDrag(t) {
|
|
523
|
-
const e = this.axis, i = this.grid, n = this.bounds, s = this.mouseClickPosition, o = e && e !== "y" ? s.mouseX - (t.touches ? t.touches[0].pageX : t.pageX) : 0, a = e && e !== "x" ? s.mouseY - (t.touches ? t.touches[0].pageY : t.pageY) : 0, [l, u] = M(i, o, a, this.scale), r =
|
|
523
|
+
const e = this.axis, i = this.grid, n = this.bounds, s = this.mouseClickPosition, o = e && e !== "y" ? s.mouseX - (t.touches ? t.touches[0].pageX : t.pageX) : 0, a = e && e !== "x" ? s.mouseY - (t.touches ? t.touches[0].pageY : t.pageY) : 0, [l, u] = M(i, o, a, this.scale), r = v(s.left - l, n.minLeft, n.maxLeft), d = v(s.top - u, n.minTop, n.maxTop);
|
|
524
524
|
if (this.onDrag(r, d) === !1)
|
|
525
525
|
return;
|
|
526
|
-
const c =
|
|
526
|
+
const c = v(s.right + l, n.minRight, n.maxRight), m = v(s.bottom + u, n.minBottom, n.maxBottom);
|
|
527
527
|
this.left = r, this.top = d, this.right = c, this.bottom = m, this.$emit("dragging", this.left, this.top), this.dragging = !0;
|
|
528
528
|
},
|
|
529
529
|
moveHorizontally(t) {
|
|
530
|
-
const [e] = M(this.grid, t, this.top, 1), i =
|
|
530
|
+
const [e] = M(this.grid, t, this.top, 1), i = v(e, this.bounds.minLeft, this.bounds.maxLeft);
|
|
531
531
|
this.left = i, this.right = this.parentWidth - this.width - i;
|
|
532
532
|
},
|
|
533
533
|
moveVertically(t) {
|
|
534
|
-
const [e, i] = M(this.grid, this.left, t, 1), n =
|
|
534
|
+
const [e, i] = M(this.grid, this.left, t, 1), n = v(i, this.bounds.minTop, this.bounds.maxTop);
|
|
535
535
|
this.top = n, this.bottom = this.parentHeight - this.height - n;
|
|
536
536
|
},
|
|
537
537
|
handleResize(t) {
|
|
@@ -539,46 +539,46 @@ const Re = {
|
|
|
539
539
|
const o = this.mouseClickPosition, a = this.aspectFactor, l = o.mouseX - (t.touches ? t.touches[0].pageX : t.pageX), u = o.mouseY - (t.touches ? t.touches[0].pageY : t.pageY);
|
|
540
540
|
!this.widthTouched && l && (this.widthTouched = !0), !this.heightTouched && u && (this.heightTouched = !0);
|
|
541
541
|
const [r, d] = M(this.grid, l, u, this.scale);
|
|
542
|
-
this.handle.includes("b") ? (s =
|
|
542
|
+
this.handle.includes("b") ? (s = v(
|
|
543
543
|
o.bottom + d,
|
|
544
544
|
this.bounds.minBottom,
|
|
545
545
|
this.bounds.maxBottom
|
|
546
|
-
), this.lockAspectRatio && this.resizingOnY && (n = this.right - (this.bottom - s) * a)) : this.handle.includes("t") && (i =
|
|
546
|
+
), this.lockAspectRatio && this.resizingOnY && (n = this.right - (this.bottom - s) * a)) : this.handle.includes("t") && (i = v(
|
|
547
547
|
o.top - d,
|
|
548
548
|
this.bounds.minTop,
|
|
549
549
|
this.bounds.maxTop
|
|
550
|
-
), this.lockAspectRatio && this.resizingOnY && (e = this.left - (this.top - i) * a)), this.handle.includes("r") ? (n =
|
|
550
|
+
), this.lockAspectRatio && this.resizingOnY && (e = this.left - (this.top - i) * a)), this.handle.includes("r") ? (n = v(
|
|
551
551
|
o.right + r,
|
|
552
552
|
this.bounds.minRight,
|
|
553
553
|
this.bounds.maxRight
|
|
554
|
-
), this.lockAspectRatio && this.resizingOnX && (s = this.bottom - (this.right - n) / a)) : this.handle.includes("l") && (e =
|
|
554
|
+
), this.lockAspectRatio && this.resizingOnX && (s = this.bottom - (this.right - n) / a)) : this.handle.includes("l") && (e = v(
|
|
555
555
|
o.left - r,
|
|
556
556
|
this.bounds.minLeft,
|
|
557
557
|
this.bounds.maxLeft
|
|
558
558
|
), this.lockAspectRatio && this.resizingOnX && (i = this.top - (this.left - e) / a));
|
|
559
|
-
const c =
|
|
559
|
+
const c = K(this.parentWidth, e, n), m = G(this.parentHeight, i, s);
|
|
560
560
|
this.onResize(this.handle, e, i, c, m) !== !1 && (this.left = e, this.top = i, this.right = n, this.bottom = s, this.width = c, this.height = m, this.$emit("resizing", this.left, this.top, this.width, this.height), this.resizing = !0);
|
|
561
561
|
},
|
|
562
562
|
changeWidth(t) {
|
|
563
|
-
const [e] = M(this.grid, t, 0, 1), i =
|
|
563
|
+
const [e] = M(this.grid, t, 0, 1), i = v(
|
|
564
564
|
this.parentWidth - e - this.left,
|
|
565
565
|
this.bounds.minRight,
|
|
566
566
|
this.bounds.maxRight
|
|
567
567
|
);
|
|
568
568
|
let n = this.bottom;
|
|
569
569
|
this.lockAspectRatio && (n = this.bottom - (this.right - i) / this.aspectFactor);
|
|
570
|
-
const s =
|
|
570
|
+
const s = K(this.parentWidth, this.left, i), o = G(this.parentHeight, this.top, n);
|
|
571
571
|
this.right = i, this.bottom = n, this.width = s, this.height = o;
|
|
572
572
|
},
|
|
573
573
|
changeHeight(t) {
|
|
574
|
-
const [e, i] = M(this.grid, 0, t, 1), n =
|
|
574
|
+
const [e, i] = M(this.grid, 0, t, 1), n = v(
|
|
575
575
|
this.parentHeight - i - this.top,
|
|
576
576
|
this.bounds.minBottom,
|
|
577
577
|
this.bounds.maxBottom
|
|
578
578
|
);
|
|
579
579
|
let s = this.right;
|
|
580
580
|
this.lockAspectRatio && (s = this.right - (this.bottom - n) * this.aspectFactor);
|
|
581
|
-
const o =
|
|
581
|
+
const o = K(this.parentWidth, this.left, s), a = G(this.parentHeight, this.top, n);
|
|
582
582
|
this.right = s, this.bottom = n, this.width = o, this.height = a;
|
|
583
583
|
},
|
|
584
584
|
handleUp(t) {
|
|
@@ -592,7 +592,7 @@ const Re = {
|
|
|
592
592
|
width: this.computedWidth,
|
|
593
593
|
height: this.computedHeight,
|
|
594
594
|
zIndex: this.zIndex,
|
|
595
|
-
...this.dragging && this.disableUserSelect ?
|
|
595
|
+
...this.dragging && this.disableUserSelect ? Re : Se
|
|
596
596
|
};
|
|
597
597
|
},
|
|
598
598
|
actualHandles() {
|
|
@@ -649,11 +649,11 @@ const Re = {
|
|
|
649
649
|
this.resizing || this.dragging || (this.parent && (this.bounds = this.calcResizeLimits()), this.changeHeight(t));
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
},
|
|
653
|
-
function
|
|
654
|
-
return
|
|
655
|
-
style:
|
|
656
|
-
class:
|
|
652
|
+
}, ke = ["onMousedown", "onTouchstart"];
|
|
653
|
+
function We(t, e, i, n, s, o) {
|
|
654
|
+
return W(), L("div", {
|
|
655
|
+
style: J(o.style),
|
|
656
|
+
class: mt([{
|
|
657
657
|
[i.classNameActive]: t.enabled,
|
|
658
658
|
[i.classNameDragging]: t.dragging,
|
|
659
659
|
[i.classNameResizing]: t.resizing,
|
|
@@ -663,28 +663,28 @@ function Me(t, e, i, n, s, o) {
|
|
|
663
663
|
onMousedown: e[0] || (e[0] = (...a) => o.elementMouseDown && o.elementMouseDown(...a)),
|
|
664
664
|
onTouchstart: e[1] || (e[1] = (...a) => o.elementTouchDown && o.elementTouchDown(...a))
|
|
665
665
|
}, [
|
|
666
|
-
(
|
|
666
|
+
(W(!0), L(Ft, null, jt(o.actualHandles, (a) => (W(), L("div", {
|
|
667
667
|
key: a,
|
|
668
|
-
class:
|
|
669
|
-
style:
|
|
670
|
-
onMousedown:
|
|
671
|
-
onTouchstart:
|
|
668
|
+
class: mt([i.classNameHandle, i.classNameHandle + "-" + a]),
|
|
669
|
+
style: J({ display: t.enabled ? "block" : "none" }),
|
|
670
|
+
onMousedown: gt((l) => o.handleDown(a, l), ["stop", "prevent"]),
|
|
671
|
+
onTouchstart: gt((l) => o.handleTouchDown(a, l), ["stop", "prevent"])
|
|
672
672
|
}, [
|
|
673
|
-
|
|
674
|
-
], 46,
|
|
675
|
-
|
|
673
|
+
q(t.$slots, a)
|
|
674
|
+
], 46, ke))), 128)),
|
|
675
|
+
q(t.$slots, "default")
|
|
676
676
|
], 38);
|
|
677
677
|
}
|
|
678
|
-
const
|
|
679
|
-
function
|
|
680
|
-
|
|
678
|
+
const It = /* @__PURE__ */ ze(Me, [["render", We]]);
|
|
679
|
+
function et(t) {
|
|
680
|
+
et.installed || (et.installed = !0, t.component("VueDraggableResizable", It));
|
|
681
681
|
}
|
|
682
|
-
const
|
|
683
|
-
install:
|
|
682
|
+
const He = {
|
|
683
|
+
install: et
|
|
684
684
|
};
|
|
685
685
|
let O = null;
|
|
686
686
|
typeof window < "u" ? O = window.Vue : typeof global < "u" && (O = global.Vue);
|
|
687
|
-
O && O.use(
|
|
687
|
+
O && O.use(He);
|
|
688
688
|
const k = {
|
|
689
689
|
duration: 3e3,
|
|
690
690
|
message: "",
|
|
@@ -692,7 +692,7 @@ const k = {
|
|
|
692
692
|
showClose: !1,
|
|
693
693
|
placement: void 0,
|
|
694
694
|
zIndex: 2e3
|
|
695
|
-
},
|
|
695
|
+
}, Ce = {
|
|
696
696
|
/**
|
|
697
697
|
* @description display duration, millisecond. If set to 0, it will not turn off automatically
|
|
698
698
|
*/
|
|
@@ -728,115 +728,125 @@ const k = {
|
|
|
728
728
|
type: Number,
|
|
729
729
|
default: k.zIndex
|
|
730
730
|
}
|
|
731
|
-
},
|
|
731
|
+
}, xt = {
|
|
732
732
|
current: 0
|
|
733
|
-
},
|
|
734
|
-
const e = B() ?
|
|
733
|
+
}, zt = T(0), Ie = 2e3, Ee = /* @__PURE__ */ Symbol("elZIndexContextKey"), Te = /* @__PURE__ */ Symbol("zIndexContextKey"), Ne = (t) => {
|
|
734
|
+
const e = B() ? Q(Ee, xt) : xt, i = B() ? Q(Te, void 0) : void 0, n = I(() => nt(i) || Ie), s = I(() => n.value + zt.value);
|
|
735
735
|
return {
|
|
736
736
|
initialZIndex: n,
|
|
737
737
|
currentZIndex: s,
|
|
738
|
-
nextZIndex: () => (e.current++,
|
|
738
|
+
nextZIndex: () => (e.current++, zt.value = e.current, s.value)
|
|
739
739
|
};
|
|
740
|
-
},
|
|
740
|
+
}, Le = { class: "yl-ai-modal" }, Be = 400, De = /* @__PURE__ */ Object.assign({
|
|
741
741
|
name: "InstanceConstructor"
|
|
742
742
|
}, {
|
|
743
743
|
__name: "instanceConstructor",
|
|
744
|
-
props:
|
|
744
|
+
props: Ce,
|
|
745
745
|
emits: ["destroy"],
|
|
746
746
|
setup(t, { expose: e, emit: i }) {
|
|
747
|
-
const n = T(!1), s = t, o = i, a = T(!1), { currentZIndex: l, nextZIndex: u } =
|
|
747
|
+
const n = T(!1), s = t, o = i, a = T(!1), { currentZIndex: l, nextZIndex: u } = Ne();
|
|
748
748
|
T(0);
|
|
749
|
-
const r =
|
|
749
|
+
const r = Rt({
|
|
750
750
|
x: 0,
|
|
751
751
|
y: 0,
|
|
752
752
|
w: 0.01,
|
|
753
753
|
height: 0.01,
|
|
754
754
|
z: 2e3,
|
|
755
755
|
ironManIndex: 0
|
|
756
|
-
}), d = new URL("./assets/iron-man/01.gif", import.meta.url).href, c = new URL("./assets/iron-man/02.gif", import.meta.url).href, m = new URL("./assets/iron-man/03.gif", import.meta.url).href, h = new URL("./assets/iron-man/04.gif", import.meta.url).href,
|
|
757
|
-
let
|
|
758
|
-
const
|
|
759
|
-
background: `url(${
|
|
756
|
+
}), d = new URL("./assets/iron-man/01.gif", import.meta.url).href, c = new URL("./assets/iron-man/02.gif", import.meta.url).href, m = new URL("./assets/iron-man/03.gif", import.meta.url).href, h = new URL("./assets/iron-man/04.gif", import.meta.url).href, Et = new URL("./assets/iron-man/05.gif", import.meta.url).href, Tt = new URL("./assets/iron-man/06.gif", import.meta.url).href;
|
|
757
|
+
let ht = [d, c, m, h, Et, Tt];
|
|
758
|
+
const Nt = I(() => ({
|
|
759
|
+
background: `url(${ht[r.ironManIndex]}) no-repeat center`
|
|
760
760
|
}));
|
|
761
761
|
setInterval(() => {
|
|
762
|
-
r.ironManIndex = (r.ironManIndex + 1) %
|
|
762
|
+
r.ironManIndex = (r.ironManIndex + 1) % ht.length;
|
|
763
763
|
}, 2e3);
|
|
764
|
-
const A =
|
|
764
|
+
const A = pt("vueDraggableResizableRef"), U = () => {
|
|
765
765
|
A.value && A.value.checkParentSize();
|
|
766
|
-
}, E =
|
|
767
|
-
const g = E.value.getBoundingClientRect(), { width:
|
|
766
|
+
}, E = pt("aiHuman"), rt = () => {
|
|
767
|
+
const g = E.value.getBoundingClientRect(), { width: p, height: f } = g, x = Be + p, z = window.innerWidth, R = window.innerHeight, dt = Math.round(R * 0.8), _t = z - x - 16, Ot = (R - dt) / 2;
|
|
768
768
|
return {
|
|
769
|
-
w:
|
|
770
|
-
x:
|
|
771
|
-
y:
|
|
772
|
-
height:
|
|
769
|
+
w: x,
|
|
770
|
+
x: _t,
|
|
771
|
+
y: Ot,
|
|
772
|
+
height: dt
|
|
773
773
|
};
|
|
774
|
-
}, { height:
|
|
775
|
-
|
|
774
|
+
}, { width: lt, height: ut } = /* @__PURE__ */ ye({});
|
|
775
|
+
it([ut, lt], () => {
|
|
776
|
+
if (n.value)
|
|
777
|
+
Y();
|
|
778
|
+
else {
|
|
779
|
+
const { w: g, height: p, x: f, y } = r;
|
|
780
|
+
(g + f > lt.value || p + y > ut.value) && ct();
|
|
781
|
+
}
|
|
776
782
|
});
|
|
777
783
|
function F() {
|
|
778
784
|
n.value = !1, N(() => {
|
|
779
785
|
a.value || s.onClose?.();
|
|
780
786
|
});
|
|
781
787
|
}
|
|
782
|
-
const j = T(!1),
|
|
788
|
+
const j = T(!1), Lt = (g) => {
|
|
783
789
|
j.value = !0;
|
|
784
|
-
},
|
|
785
|
-
r.x = g, r.y =
|
|
786
|
-
},
|
|
790
|
+
}, Bt = (g, p) => {
|
|
791
|
+
r.x = g, r.y = p;
|
|
792
|
+
}, Dt = () => {
|
|
787
793
|
j.value = !1;
|
|
788
|
-
},
|
|
794
|
+
}, Y = () => {
|
|
789
795
|
if (j.value) return;
|
|
790
|
-
const g = E.value.getBoundingClientRect(), { width:
|
|
791
|
-
let
|
|
792
|
-
n.value || (
|
|
793
|
-
let
|
|
794
|
-
r.x +
|
|
795
|
-
x:
|
|
796
|
-
y:
|
|
796
|
+
const g = E.value.getBoundingClientRect(), { width: p, height: f } = g, { w: y, height: x } = rt();
|
|
797
|
+
let z = r.y;
|
|
798
|
+
n.value || (z = r.y + f - x, r.y + f <= x && (z = 0)), n.value = !0;
|
|
799
|
+
let R = r.x;
|
|
800
|
+
r.x + y >= window.innerWidth && (R = window.innerWidth - y), Object.assign(r, {
|
|
801
|
+
x: R,
|
|
802
|
+
y: z
|
|
797
803
|
}), U(), N(() => {
|
|
798
804
|
Object.assign(r, {
|
|
799
|
-
w:
|
|
800
|
-
height:
|
|
805
|
+
w: y,
|
|
806
|
+
height: x
|
|
801
807
|
}), U();
|
|
802
808
|
});
|
|
803
|
-
},
|
|
804
|
-
const g = E.value.getBoundingClientRect(), { width:
|
|
809
|
+
}, Pt = () => {
|
|
810
|
+
const g = E.value.getBoundingClientRect(), { width: p, height: f } = g;
|
|
805
811
|
Object.assign(r, {
|
|
806
|
-
w:
|
|
807
|
-
height:
|
|
808
|
-
y: r.y + r.height -
|
|
812
|
+
w: p,
|
|
813
|
+
height: f,
|
|
814
|
+
y: r.y + r.height - f
|
|
809
815
|
});
|
|
810
816
|
};
|
|
811
|
-
|
|
812
|
-
})
|
|
813
|
-
|
|
814
|
-
|
|
817
|
+
St(() => {
|
|
818
|
+
});
|
|
819
|
+
function ct() {
|
|
820
|
+
N(() => {
|
|
821
|
+
const g = E.value.getBoundingClientRect(), { width: p, height: f } = g, { height: y, x, y: z } = rt(), R = l.value;
|
|
815
822
|
Object.assign(r, {
|
|
816
|
-
w:
|
|
817
|
-
height:
|
|
818
|
-
x
|
|
819
|
-
y:
|
|
820
|
-
z
|
|
823
|
+
w: p,
|
|
824
|
+
height: f,
|
|
825
|
+
x,
|
|
826
|
+
y: z + y - f,
|
|
827
|
+
z: R
|
|
821
828
|
}), U();
|
|
822
829
|
});
|
|
830
|
+
}
|
|
831
|
+
V(() => {
|
|
832
|
+
u(), ct();
|
|
823
833
|
});
|
|
824
|
-
function
|
|
834
|
+
function $t(g) {
|
|
825
835
|
(g.keyCode === 27 || g.key === "Escape") && F();
|
|
826
836
|
}
|
|
827
|
-
return _(document, "keydown",
|
|
828
|
-
show:
|
|
837
|
+
return _(document, "keydown", $t), e({
|
|
838
|
+
show: Y,
|
|
829
839
|
close: F,
|
|
830
840
|
destroy: () => {
|
|
831
841
|
o("destroy");
|
|
832
842
|
}
|
|
833
|
-
}), (g,
|
|
843
|
+
}), (g, p) => (W(), Yt(nt(It), {
|
|
834
844
|
class: "dialog-vdr",
|
|
835
845
|
ref_key: "vueDraggableResizableRef",
|
|
836
846
|
ref: A,
|
|
837
|
-
onDrag:
|
|
838
|
-
onDragStop:
|
|
839
|
-
onClick:
|
|
847
|
+
onDrag: Lt,
|
|
848
|
+
onDragStop: Bt,
|
|
849
|
+
onClick: Dt,
|
|
840
850
|
x: r.x,
|
|
841
851
|
y: r.y,
|
|
842
852
|
z: r.z,
|
|
@@ -846,69 +856,69 @@ const k = {
|
|
|
846
856
|
resizable: !1,
|
|
847
857
|
"drag-handle": ".yl-ai-human"
|
|
848
858
|
}, {
|
|
849
|
-
default:
|
|
859
|
+
default: ft(() => [
|
|
850
860
|
$("div", {
|
|
851
861
|
ref_key: "aiHuman",
|
|
852
862
|
ref: E,
|
|
853
863
|
class: "yl-ai-human ai-human",
|
|
854
|
-
style:
|
|
855
|
-
onClick:
|
|
864
|
+
style: J(Nt.value),
|
|
865
|
+
onClick: Y
|
|
856
866
|
}, null, 4),
|
|
857
|
-
|
|
867
|
+
kt(Xt, {
|
|
858
868
|
name: "fade",
|
|
859
|
-
onBeforeEnter:
|
|
869
|
+
onBeforeEnter: p[0] || (p[0] = (f) => a.value = !0),
|
|
860
870
|
onBeforeLeave: g.onClose,
|
|
861
|
-
onAfterLeave:
|
|
871
|
+
onAfterLeave: Pt
|
|
862
872
|
}, {
|
|
863
|
-
default:
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
873
|
+
default: ft(() => [
|
|
874
|
+
Zt($("div", Le, [
|
|
875
|
+
q(g.$slots, "default", {}, () => [
|
|
876
|
+
Kt(Gt(g.message), 1)
|
|
867
877
|
], !0)
|
|
868
878
|
], 512), [
|
|
869
|
-
[
|
|
879
|
+
[Qt, n.value]
|
|
870
880
|
])
|
|
871
881
|
]),
|
|
872
882
|
_: 3
|
|
873
883
|
}, 8, ["onBeforeLeave"]),
|
|
874
|
-
n.value ? (
|
|
884
|
+
n.value ? (W(), L("div", {
|
|
875
885
|
key: 0,
|
|
876
886
|
class: "icon-close",
|
|
877
887
|
onClick: F
|
|
878
|
-
})) :
|
|
888
|
+
})) : Jt("", !0)
|
|
879
889
|
]),
|
|
880
890
|
_: 3
|
|
881
891
|
}, 8, ["x", "y", "z", "w", "h"]));
|
|
882
892
|
}
|
|
883
|
-
}),
|
|
893
|
+
}), Pe = /* @__PURE__ */ Ct(De, [["__scopeId", "data-v-fd6bf392"]]);
|
|
884
894
|
let P = null;
|
|
885
|
-
const
|
|
895
|
+
const $e = (t) => {
|
|
886
896
|
let e;
|
|
887
|
-
return !t ||
|
|
897
|
+
return !t || ae(t) || Wt(t) || tt(t) ? e = { message: t } : e = t, {
|
|
888
898
|
...k,
|
|
889
899
|
...e
|
|
890
900
|
};
|
|
891
|
-
},
|
|
901
|
+
}, _e = (t) => {
|
|
892
902
|
const { handler: e } = t;
|
|
893
903
|
e.close();
|
|
894
|
-
},
|
|
904
|
+
}, Oe = ({ appendTo: t = document.body, ...e }, i) => {
|
|
895
905
|
const n = e.onClose, s = document.createElement("div"), o = {
|
|
896
906
|
...e,
|
|
897
907
|
onClose: () => {
|
|
898
|
-
n?.(),
|
|
908
|
+
n?.(), _e(r);
|
|
899
909
|
},
|
|
900
910
|
onDestroy: () => {
|
|
901
|
-
P = null,
|
|
911
|
+
P = null, vt(null, s);
|
|
902
912
|
}
|
|
903
|
-
}, a =
|
|
904
|
-
|
|
913
|
+
}, a = kt(
|
|
914
|
+
Pe,
|
|
905
915
|
o,
|
|
906
|
-
|
|
916
|
+
tt(o.message) || Wt(o.message) ? {
|
|
907
917
|
// 插槽默认名称是 default
|
|
908
|
-
default:
|
|
918
|
+
default: tt(o.message) ? o.message : () => o.message
|
|
909
919
|
} : null
|
|
910
920
|
);
|
|
911
|
-
a.appContext = i ||
|
|
921
|
+
a.appContext = i || at._context, vt(a, s), t.appendChild(s.firstElementChild);
|
|
912
922
|
const l = a.component, r = {
|
|
913
923
|
vnode: a,
|
|
914
924
|
vm: l,
|
|
@@ -928,16 +938,16 @@ const De = (t) => {
|
|
|
928
938
|
props: a.component.props
|
|
929
939
|
};
|
|
930
940
|
return r;
|
|
931
|
-
},
|
|
941
|
+
}, at = (t = {}, e) => {
|
|
932
942
|
if (P)
|
|
933
943
|
return P.handler;
|
|
934
|
-
const i =
|
|
944
|
+
const i = $e(t), n = Oe(i, e);
|
|
935
945
|
return P = n, n.handler;
|
|
936
946
|
};
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
message:
|
|
947
|
+
at._context = null;
|
|
948
|
+
const Fe = (t = {}) => at({
|
|
949
|
+
message: qt(oe, t)
|
|
940
950
|
});
|
|
941
951
|
export {
|
|
942
|
-
|
|
952
|
+
Fe as default
|
|
943
953
|
};
|
package/dist/yl-ai-modal.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(o,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["vue","axios"],T):(o=typeof globalThis<"u"?globalThis:o||self,o["yl-ai-modal"]=T(o.Vue,o.axios))})(this,(function(o,T){"use strict";var f=typeof document<"u"?document.currentScript:null;const B=T.create({timeout:6e3}),Z=t=>{if(t.response){const e=localStorage.getItem("token");t.response.status==401&&e&&(localStorage.remove("token"),setTimeout(()=>{window.location.reload()},1500))}return Promise.reject(t)};B.interceptors.request.use(t=>{const e=localStorage.getItem("token");return e&&(t.headers.token=e),t},Z),B.interceptors.response.use(t=>t.data,Z);const q=(t,e)=>{const i=t.__vccOpts||t;for(const[n,s]of e)i[n]=s;return i},at={class:"ai-dialog"},ht={class:"ai-dialog-feed"},rt=["src"],lt=q({__name:"index",setup(t){const e=o.useAttrs(),i=o.reactive({baseUrl:"",url:""}),n=async()=>{if(i.baseUrl)return(await B.post(i.baseUrl+"/api/v1/user/login",{username:"clare",password:"Zz12345678"}))?.data};return o.onBeforeMount(async()=>{let s=e.url;const a=new URL(s);i.baseUrl=a.origin;let h=a.href;h.endsWith("/")&&(h=h.slice(0,-1));let c=await n();const d=new URLSearchParams(c).toString();i.url=h+`?${d}`}),o.onMounted(()=>{o.nextTick(()=>{})}),(s,a)=>(o.openBlock(),o.createElementBlock("div",at,[o.createElementVNode("div",ht,[o.createElementVNode("iframe",{class:"ai-dialog-iframe",src:i.url},null,8,rt)])]))}},[["__scopeId","data-v-bba24a59"]]);process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const U=t=>typeof t=="function",ct=t=>typeof t=="string",_=new WeakMap,dt=(...t)=>{var e;const i=t[0],n=(e=o.getCurrentInstance())===null||e===void 0?void 0:e.proxy,s=n??o.getCurrentScope();if(s==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return s&&_.has(s)&&i in _.get(s)?_.get(s)[i]:o.inject(...t)},ut=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const mt=Object.prototype.toString,gt=t=>mt.call(t)==="[object Object]";function K(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function D(t){return Array.isArray(t)?t:[t]}function ft(t){return o.getCurrentInstance()}function pt(t,e=!0,i){ft()?o.onMounted(t,i):e?t():o.nextTick(t)}function bt(t,e,i){return o.watch(t,e,{...i,immediate:!0})}const P=ut?window:void 0;function yt(t){var e;const i=o.toValue(t);return(e=i?.$el)!==null&&e!==void 0?e:i}function L(...t){const e=(n,s,a,h)=>(n.addEventListener(s,a,h),()=>n.removeEventListener(s,a,h)),i=o.computed(()=>{const n=D(o.toValue(t[0])).filter(s=>s!=null);return n.every(s=>typeof s!="string")?n:void 0});return bt(()=>{var n,s;return[(n=(s=i.value)===null||s===void 0?void 0:s.map(a=>yt(a)))!==null&&n!==void 0?n:[P].filter(a=>a!=null),D(o.toValue(i.value?t[1]:t[0])),D(o.unref(i.value?t[2]:t[1])),o.toValue(i.value?t[3]:t[2])]},([n,s,a,h],c,d)=>{if(!n?.length||!s?.length||!a?.length)return;const l=gt(h)?{...h}:h,m=n.flatMap(u=>s.flatMap(g=>a.map(r=>e(u,g,r,l))));d(()=>{m.forEach(u=>u())})},{flush:"post"})}function wt(){const t=o.shallowRef(!1),e=o.getCurrentInstance();return e&&o.onMounted(()=>{t.value=!0},e),t}function xt(t){const e=wt();return o.computed(()=>(e.value,!!t()))}const Rt=Symbol("vueuse-ssr-width");function zt(){const t=o.hasInjectionContext()?dt(Rt,null):null;return typeof t=="number"?t:void 0}function St(t,e={}){const{window:i=P,ssrWidth:n=zt()}=e,s=xt(()=>i&&"matchMedia"in i&&typeof i.matchMedia=="function"),a=o.shallowRef(typeof n=="number"),h=o.shallowRef(),c=o.shallowRef(!1),d=l=>{c.value=l.matches};return o.watchEffect(()=>{if(a.value){a.value=!s.value,c.value=o.toValue(t).split(",").some(l=>{const m=l.includes("not all"),u=l.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),g=l.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let r=!!(u||g);return u&&r&&(r=n>=K(u[1])),g&&r&&(r=n<=K(g[1])),m?!r:r});return}s.value&&(h.value=i.matchMedia(o.toValue(t)),c.value=h.value.matches)}),L(h,"change",d,{passive:!0}),o.computed(()=>c.value)}function vt(t={}){const{window:e=P,initialWidth:i=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:a=!0,type:h="inner"}=t,c=o.shallowRef(i),d=o.shallowRef(n),l=()=>{if(e)if(h==="outer")c.value=e.outerWidth,d.value=e.outerHeight;else if(h==="visual"&&e.visualViewport){const{width:u,height:g,scale:r}=e.visualViewport;c.value=Math.round(u*r),d.value=Math.round(g*r)}else a?(c.value=e.innerWidth,d.value=e.innerHeight):(c.value=e.document.documentElement.clientWidth,d.value=e.document.documentElement.clientHeight)};l(),pt(l);const m={passive:!0};return L("resize",l,m),e&&h==="visual"&&e.visualViewport&&L(e.visualViewport,"resize",l,m),s&&o.watch(St("(orientation: portrait)"),()=>l()),{width:c,height:d}}function G(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Function]"}function M(t,e,i,n=1){const[s,a]=typeof n=="number"?[n,n]:n,h=Math.round(e/s/t[0])*t[0],c=Math.round(i/a/t[1])*t[1];return[h,c]}function V(t,e,i){return t-e-i}function $(t,e,i){return t-e-i}function b(t,e,i){return e!==null&&t<e?e:i!==null&&i<t?i:t}function Q(t,e,i){let n=t;const s=["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"].find(a=>G(n[a]));if(!G(n[s]))return!1;do{if(n[s](e))return!0;if(n===i)return!1;n=n.parentNode}while(n);return!1}function Ct(t){const e=window.getComputedStyle(t);return[parseFloat(e.getPropertyValue("width"),10),parseFloat(e.getPropertyValue("height"),10)]}function S(t,e,i){t&&(t.attachEvent?t.attachEvent("on"+e,i):t.addEventListener?t.addEventListener(e,i,!0):t["on"+e]=i)}function x(t,e,i){t&&(t.detachEvent?t.detachEvent("on"+e,i):t.removeEventListener?t.removeEventListener(e,i,!0):t["on"+e]=null)}const Mt=(t,e)=>{const i=t.__vccOpts||t;for(const[n,s]of e)i[n]=s;return i},N={mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"},touch:{start:"touchstart",move:"touchmove",stop:"touchend"}},It={userSelect:"none",MozUserSelect:"none",WebkitUserSelect:"none",MsUserSelect:"none"},kt={userSelect:"auto",MozUserSelect:"auto",WebkitUserSelect:"auto",MsUserSelect:"auto"};let R=N.mouse;const Tt={replace:!0,name:"vue-draggable-resizable",props:{className:{type:String,default:"vdr"},classNameDraggable:{type:String,default:"draggable"},classNameResizable:{type:String,default:"resizable"},classNameDragging:{type:String,default:"dragging"},classNameResizing:{type:String,default:"resizing"},classNameActive:{type:String,default:"active"},classNameHandle:{type:String,default:"handle"},disableUserSelect:{type:Boolean,default:!0},enableNativeDrag:{type:Boolean,default:!1},preventDeactivation:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},lockAspectRatio:{type:Boolean,default:!1},w:{type:[Number,String],default:200,validator:t=>typeof t=="number"?t>0:t==="auto"},h:{type:[Number,String],default:200,validator:t=>typeof t=="number"?t>0:t==="auto"},minWidth:{type:Number,default:0,validator:t=>t>=0},minHeight:{type:Number,default:0,validator:t=>t>=0},maxWidth:{type:Number,default:null,validator:t=>t>=0},maxHeight:{type:Number,default:null,validator:t=>t>=0},x:{type:Number,default:0},y:{type:Number,default:0},z:{type:[String,Number],default:"auto",validator:t=>typeof t=="string"?t==="auto":t>=0},handles:{type:Array,default:()=>["tl","tm","tr","mr","br","bm","bl","ml"],validator:t=>{const e=new Set(["tl","tm","tr","mr","br","bm","bl","ml"]);return new Set(t.filter(i=>e.has(i))).size===t.length}},dragHandle:{type:String,default:null},dragCancel:{type:String,default:null},axis:{type:String,default:"both",validator:t=>["x","y","both"].includes(t)},grid:{type:Array,default:()=>[1,1]},parent:{type:Boolean,default:!1},scale:{type:[Number,Array],default:1,validator:t=>typeof t=="number"?t>0:t.length===2&&t[0]>0&&t[1]>0},onDragStart:{type:Function,default:()=>!0},onDrag:{type:Function,default:()=>!0},onResizeStart:{type:Function,default:()=>!0},onResize:{type:Function,default:()=>!0}},data:function(){return{left:this.x,top:this.y,right:null,bottom:null,width:null,height:null,widthTouched:!1,heightTouched:!1,aspectFactor:null,parentWidth:null,parentHeight:null,handle:null,enabled:this.active,resizing:!1,dragging:!1,dragEnable:!1,resizeEnable:!1,zIndex:this.z}},created:function(){this.maxWidth&&this.minWidth>this.maxWidth&&console.warn("[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth"),this.maxHeight&&this.minHeight>this.maxHeight&&console.warn("[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight"),this.resetBoundsAndMouseState()},mounted:function(){this.enableNativeDrag||(this.$el.ondragstart=()=>!1);const[t,e]=this.getParentSize();this.parentWidth=t,this.parentHeight=e;const[i,n]=Ct(this.$el);this.aspectFactor=(this.w!=="auto"?this.w:i)/(this.h!=="auto"?this.h:n),this.width=this.w!=="auto"?this.w:i,this.height=this.h!=="auto"?this.h:n,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top,this.active&&this.$emit("activated"),S(document.documentElement,"mousedown",this.deselect),S(document.documentElement,"touchend touchcancel",this.deselect),S(window,"resize",this.checkParentSize)},beforeUnmount:function(){x(document.documentElement,"mousedown",this.deselect),x(document.documentElement,"touchstart",this.handleUp),x(document.documentElement,"mousemove",this.move),x(document.documentElement,"touchmove",this.move),x(document.documentElement,"mouseup",this.handleUp),x(document.documentElement,"touchend touchcancel",this.deselect),x(window,"resize",this.checkParentSize)},methods:{resetBoundsAndMouseState(){this.mouseClickPosition={mouseX:0,mouseY:0,x:0,y:0,w:0,h:0},this.bounds={minLeft:null,maxLeft:null,minRight:null,maxRight:null,minTop:null,maxTop:null,minBottom:null,maxBottom:null}},checkParentSize(){if(this.parent){const[t,e]=this.getParentSize();this.parentWidth=t,this.parentHeight=e,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top}},getParentSize(){if(this.parent){const t=window.getComputedStyle(this.$el.parentNode,null);return[parseInt(t.getPropertyValue("width"),10),parseInt(t.getPropertyValue("height"),10)]}return[null,null]},elementTouchDown(t){R=N.touch,this.elementDown(t)},elementMouseDown(t){R=N.mouse,this.elementDown(t)},elementDown(t){if(t instanceof MouseEvent&&t.button!==0)return;const e=t.target||t.srcElement;if(this.$el.contains(e)){if(this.onDragStart(t)===!1)return;if(this.dragHandle&&!Q(e,this.dragHandle,this.$el)||this.dragCancel&&Q(e,this.dragCancel,this.$el)){this.dragging=!1;return}this.enabled||(this.enabled=!0,this.$emit("activated"),this.$emit("update:active",!0)),this.draggable&&(this.dragEnable=!0),this.mouseClickPosition.mouseX=t.touches?t.touches[0].pageX:t.pageX,this.mouseClickPosition.mouseY=t.touches?t.touches[0].pageY:t.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.parent&&(this.bounds=this.calcDragLimits()),S(document.documentElement,R.move,this.move),S(document.documentElement,R.stop,this.handleUp)}},calcDragLimits(){return{minLeft:this.left%this.grid[0],maxLeft:Math.floor((this.parentWidth-this.width-this.left)/this.grid[0])*this.grid[0]+this.left,minRight:this.right%this.grid[0],maxRight:Math.floor((this.parentWidth-this.width-this.right)/this.grid[0])*this.grid[0]+this.right,minTop:this.top%this.grid[1],maxTop:Math.floor((this.parentHeight-this.height-this.top)/this.grid[1])*this.grid[1]+this.top,minBottom:this.bottom%this.grid[1],maxBottom:Math.floor((this.parentHeight-this.height-this.bottom)/this.grid[1])*this.grid[1]+this.bottom}},deselect(t){const e=t.target||t.srcElement,i=new RegExp(this.className+"-([trmbl]{2})","");!this.$el.contains(e)&&!i.test(e.className)&&(this.enabled&&!this.preventDeactivation&&(this.enabled=!1,this.$emit("deactivated"),this.$emit("update:active",!1)),x(document.documentElement,R.move,this.handleResize)),this.resetBoundsAndMouseState()},handleTouchDown(t,e){R=N.touch,this.handleDown(t,e)},handleDown(t,e){e instanceof MouseEvent&&e.which!==1||this.onResizeStart(t,e)!==!1&&(e.stopPropagation&&e.stopPropagation(),this.lockAspectRatio&&!t.includes("m")?this.handle="m"+t.substring(1):this.handle=t,this.resizeEnable=!0,this.mouseClickPosition.mouseX=e.touches?e.touches[0].pageX:e.pageX,this.mouseClickPosition.mouseY=e.touches?e.touches[0].pageY:e.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.bounds=this.calcResizeLimits(),S(document.documentElement,R.move,this.handleResize),S(document.documentElement,R.stop,this.handleUp))},calcResizeLimits(){let t=this.minW,e=this.minH,i=this.maxW,n=this.maxH;const s=this.aspectFactor,[a,h]=this.grid,c=this.width,d=this.height,l=this.left,m=this.top,u=this.right,g=this.bottom;this.lockAspectRatio&&(t/e>s?e=t/s:t=s*e,i&&n?(i=Math.min(i,s*n),n=Math.min(n,i/s)):i?n=i/s:n&&(i=s*n)),i=i-i%a,n=n-n%h;const r={minLeft:null,maxLeft:null,minTop:null,maxTop:null,minRight:null,maxRight:null,minBottom:null,maxBottom:null};return this.parent?(r.minLeft=l%a,r.maxLeft=l+Math.floor((c-t)/a)*a,r.minTop=m%h,r.maxTop=m+Math.floor((d-e)/h)*h,r.minRight=u%a,r.maxRight=u+Math.floor((c-t)/a)*a,r.minBottom=g%h,r.maxBottom=g+Math.floor((d-e)/h)*h,i&&(r.minLeft=Math.max(r.minLeft,this.parentWidth-u-i),r.minRight=Math.max(r.minRight,this.parentWidth-l-i)),n&&(r.minTop=Math.max(r.minTop,this.parentHeight-g-n),r.minBottom=Math.max(r.minBottom,this.parentHeight-m-n)),this.lockAspectRatio&&(r.minLeft=Math.max(r.minLeft,l-m*s),r.minTop=Math.max(r.minTop,m-l/s),r.minRight=Math.max(r.minRight,u-g*s),r.minBottom=Math.max(r.minBottom,g-u/s))):(r.minLeft=null,r.maxLeft=l+Math.floor((c-t)/a)*a,r.minTop=null,r.maxTop=m+Math.floor((d-e)/h)*h,r.minRight=null,r.maxRight=u+Math.floor((c-t)/a)*a,r.minBottom=null,r.maxBottom=g+Math.floor((d-e)/h)*h,i&&(r.minLeft=-(u+i),r.minRight=-(l+i)),n&&(r.minTop=-(g+n),r.minBottom=-(m+n)),this.lockAspectRatio&&i&&n&&(r.minLeft=Math.min(r.minLeft,-(u+i)),r.minTop=Math.min(r.minTop,-(n+g)),r.minRight=Math.min(r.minRight,-l-i),r.minBottom=Math.min(r.minBottom,-m-n))),r},move(t){this.resizing?this.handleResize(t):this.dragEnable&&this.handleDrag(t)},handleDrag(t){const e=this.axis,i=this.grid,n=this.bounds,s=this.mouseClickPosition,a=e&&e!=="y"?s.mouseX-(t.touches?t.touches[0].pageX:t.pageX):0,h=e&&e!=="x"?s.mouseY-(t.touches?t.touches[0].pageY:t.pageY):0,[c,d]=M(i,a,h,this.scale),l=b(s.left-c,n.minLeft,n.maxLeft),m=b(s.top-d,n.minTop,n.maxTop);if(this.onDrag(l,m)===!1)return;const u=b(s.right+c,n.minRight,n.maxRight),g=b(s.bottom+d,n.minBottom,n.maxBottom);this.left=l,this.top=m,this.right=u,this.bottom=g,this.$emit("dragging",this.left,this.top),this.dragging=!0},moveHorizontally(t){const[e]=M(this.grid,t,this.top,1),i=b(e,this.bounds.minLeft,this.bounds.maxLeft);this.left=i,this.right=this.parentWidth-this.width-i},moveVertically(t){const[e,i]=M(this.grid,this.left,t,1),n=b(i,this.bounds.minTop,this.bounds.maxTop);this.top=n,this.bottom=this.parentHeight-this.height-n},handleResize(t){let e=this.left,i=this.top,n=this.right,s=this.bottom;const a=this.mouseClickPosition,h=this.aspectFactor,c=a.mouseX-(t.touches?t.touches[0].pageX:t.pageX),d=a.mouseY-(t.touches?t.touches[0].pageY:t.pageY);!this.widthTouched&&c&&(this.widthTouched=!0),!this.heightTouched&&d&&(this.heightTouched=!0);const[l,m]=M(this.grid,c,d,this.scale);this.handle.includes("b")?(s=b(a.bottom+m,this.bounds.minBottom,this.bounds.maxBottom),this.lockAspectRatio&&this.resizingOnY&&(n=this.right-(this.bottom-s)*h)):this.handle.includes("t")&&(i=b(a.top-m,this.bounds.minTop,this.bounds.maxTop),this.lockAspectRatio&&this.resizingOnY&&(e=this.left-(this.top-i)*h)),this.handle.includes("r")?(n=b(a.right+l,this.bounds.minRight,this.bounds.maxRight),this.lockAspectRatio&&this.resizingOnX&&(s=this.bottom-(this.right-n)/h)):this.handle.includes("l")&&(e=b(a.left-l,this.bounds.minLeft,this.bounds.maxLeft),this.lockAspectRatio&&this.resizingOnX&&(i=this.top-(this.left-e)/h));const u=V(this.parentWidth,e,n),g=$(this.parentHeight,i,s);this.onResize(this.handle,e,i,u,g)!==!1&&(this.left=e,this.top=i,this.right=n,this.bottom=s,this.width=u,this.height=g,this.$emit("resizing",this.left,this.top,this.width,this.height),this.resizing=!0)},changeWidth(t){const[e]=M(this.grid,t,0,1),i=b(this.parentWidth-e-this.left,this.bounds.minRight,this.bounds.maxRight);let n=this.bottom;this.lockAspectRatio&&(n=this.bottom-(this.right-i)/this.aspectFactor);const s=V(this.parentWidth,this.left,i),a=$(this.parentHeight,this.top,n);this.right=i,this.bottom=n,this.width=s,this.height=a},changeHeight(t){const[e,i]=M(this.grid,0,t,1),n=b(this.parentHeight-i-this.top,this.bounds.minBottom,this.bounds.maxBottom);let s=this.right;this.lockAspectRatio&&(s=this.right-(this.bottom-n)*this.aspectFactor);const a=V(this.parentWidth,this.left,s),h=$(this.parentHeight,this.top,n);this.right=s,this.bottom=n,this.width=a,this.height=h},handleUp(t){this.handle=null,this.resetBoundsAndMouseState(),this.dragEnable=!1,this.resizeEnable=!1,this.resizing&&(this.resizing=!1,this.$emit("resizeStop",this.left,this.top,this.width,this.height)),this.dragging&&(this.dragging=!1,this.$emit("dragStop",this.left,this.top)),x(document.documentElement,R.move,this.handleResize)}},computed:{style(){return{transform:`translate(${this.left}px, ${this.top}px)`,width:this.computedWidth,height:this.computedHeight,zIndex:this.zIndex,...this.dragging&&this.disableUserSelect?It:kt}},actualHandles(){return this.resizable?this.handles:[]},computedWidth(){return this.w==="auto"&&!this.widthTouched?"auto":this.width+"px"},computedHeight(){return this.h==="auto"&&!this.heightTouched?"auto":this.height+"px"},minW(){return this.minWidth},minH(){return this.minHeight},maxW(){return this.maxWidth},maxH(){return this.maxHeight},resizingOnX(){return!!this.handle&&(this.handle.includes("l")||this.handle.includes("r"))},resizingOnY(){return!!this.handle&&(this.handle.includes("t")||this.handle.includes("b"))},isCornerHandle(){return!!this.handle&&["tl","tr","br","bl"].includes(this.handle)}},watch:{active(t){this.enabled=t,t?this.$emit("activated"):this.$emit("deactivated")},z(t){(t>=0||t==="auto")&&(this.zIndex=t)},x(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveHorizontally(t))},y(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveVertically(t))},lockAspectRatio(t){t?this.aspectFactor=this.width/this.height:this.aspectFactor=void 0},w(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeWidth(t))},h(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeHeight(t))}}},Et=["onMousedown","onTouchstart"];function Lt(t,e,i,n,s,a){return o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle(a.style),class:o.normalizeClass([{[i.classNameActive]:t.enabled,[i.classNameDragging]:t.dragging,[i.classNameResizing]:t.resizing,[i.classNameDraggable]:i.draggable,[i.classNameResizable]:i.resizable},i.className]),onMousedown:e[0]||(e[0]=(...h)=>a.elementMouseDown&&a.elementMouseDown(...h)),onTouchstart:e[1]||(e[1]=(...h)=>a.elementTouchDown&&a.elementTouchDown(...h))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.actualHandles,h=>(o.openBlock(),o.createElementBlock("div",{key:h,class:o.normalizeClass([i.classNameHandle,i.classNameHandle+"-"+h]),style:o.normalizeStyle({display:t.enabled?"block":"none"}),onMousedown:o.withModifiers(c=>a.handleDown(h,c),["stop","prevent"]),onTouchstart:o.withModifiers(c=>a.handleTouchDown(h,c),["stop","prevent"])},[o.renderSlot(t.$slots,h)],46,Et))),128)),o.renderSlot(t.$slots,"default")],38)}const J=Mt(Tt,[["render",Lt]]);function j(t){j.installed||(j.installed=!0,t.component("VueDraggableResizable",J))}const Nt={install:j};let H=null;typeof window<"u"?H=window.Vue:typeof global<"u"&&(H=global.Vue),H&&H.use(Nt);const I={duration:3e3,message:"",onClose:void 0,showClose:!1,placement:void 0,zIndex:2e3},Ht={duration:{type:Number,default:I.duration},message:{type:[String,Object,Function],default:I.message},onClose:{type:Function,default:I.onClose},showClose:{type:Boolean,default:I.showClose},zIndex:{type:Number,default:I.zIndex}},tt={current:0},et=o.ref(0),Wt=2e3,Bt=Symbol("elZIndexContextKey"),Ut=Symbol("zIndexContextKey"),_t=t=>{const e=o.getCurrentInstance()?o.inject(Bt,tt):tt,i=o.getCurrentInstance()?o.inject(Ut,void 0):void 0,n=o.computed(()=>o.unref(i)||Wt),s=o.computed(()=>n.value+et.value);return{initialZIndex:n,currentZIndex:s,nextZIndex:()=>(e.current++,et.value=e.current,s.value)}},Dt={class:"yl-ai-modal"},Pt=400,Vt=q(Object.assign({name:"InstanceConstructor"},{__name:"instanceConstructor",props:Ht,emits:["destroy"],setup(t,{expose:e,emit:i}){const n=o.ref(!1),s=t,a=i,h=o.ref(!1),{currentZIndex:c,nextZIndex:d}=_t();o.ref(0);const l=o.reactive({x:0,y:0,w:.01,height:.01,z:2e3,ironManIndex:0}),m=new URL("./assets/iron-man/01.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,u=new URL("./assets/iron-man/02.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,g=new URL("./assets/iron-man/03.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,r=new URL("./assets/iron-man/04.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,Ot=new URL("./assets/iron-man/05.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,At=new URL("./assets/iron-man/06.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href;let it=[m,u,g,r,Ot,At];const Yt=o.computed(()=>({background:`url(${it[l.ironManIndex]}) no-repeat center`}));setInterval(()=>{l.ironManIndex=(l.ironManIndex+1)%it.length},2e3);const O=o.useTemplateRef("vueDraggableResizableRef"),A=()=>{O.value&&O.value.checkParentSize()},E=o.useTemplateRef("aiHuman"),nt=()=>{const p=E.value.getBoundingClientRect(),{width:y,height:w}=p,z=Pt+y,v=window.innerWidth,C=window.innerHeight,st=Math.round(C*.8),Jt=v-z-16,te=(C-st)/2;return{w:z,x:Jt,y:te,height:st}},{height:Xt}=vt({});o.watch(Xt,p=>{});function Y(){n.value=!1,o.nextTick(()=>{h.value||s.onClose?.()})}const X=o.ref(!1),Zt=p=>{X.value=!0},qt=(p,y)=>{l.x=p,l.y=y},Kt=()=>{X.value=!1},ot=()=>{if(X.value)return;const p=E.value.getBoundingClientRect(),{width:y,height:w}=p,{w:k,height:z}=nt();let v=l.y;n.value||(v=l.y+w-z,l.y+w<=z&&(v=0)),n.value=!0;let C=l.x;l.x+k>=window.innerWidth&&(C=window.innerWidth-k),Object.assign(l,{x:C,y:v}),A(),o.nextTick(()=>{Object.assign(l,{w:k,height:z}),A()})},Gt=()=>{const p=E.value.getBoundingClientRect(),{width:y,height:w}=p;Object.assign(l,{w:y,height:w,y:l.y+l.height-w})};o.onBeforeMount(()=>{}),o.onMounted(()=>{d(),o.nextTick(()=>{const p=E.value.getBoundingClientRect(),{width:y,height:w}=p,{height:k,x:z,y:v}=nt(),C=c.value;Object.assign(l,{w:y,height:w,x:z,y:v+k-w,z:C}),A()})});function Qt(p){(p.keyCode===27||p.key==="Escape")&&Y()}return L(document,"keydown",Qt),e({show:ot,close:Y,destroy:()=>{a("destroy")}}),(p,y)=>(o.openBlock(),o.createBlock(o.unref(J),{class:"dialog-vdr",ref_key:"vueDraggableResizableRef",ref:O,onDrag:Zt,onDragStop:qt,onClick:Kt,x:l.x,y:l.y,z:l.z,w:l.w,h:l.height,parent:!0,resizable:!1,"drag-handle":".yl-ai-human"},{default:o.withCtx(()=>[o.createElementVNode("div",{ref_key:"aiHuman",ref:E,class:"yl-ai-human ai-human",style:o.normalizeStyle(Yt.value),onClick:ot},null,4),o.createVNode(o.Transition,{name:"fade",onBeforeEnter:y[0]||(y[0]=w=>h.value=!0),onBeforeLeave:p.onClose,onAfterLeave:Gt},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",Dt,[o.renderSlot(p.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(p.message),1)],!0)],512),[[o.vShow,n.value]])]),_:3},8,["onBeforeLeave"]),n.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"icon-close",onClick:Y})):o.createCommentVNode("",!0)]),_:3},8,["x","y","z","w","h"]))}}),[["__scopeId","data-v-ca6e8485"]]);let W=null;const $t=t=>{let e;return!t||ct(t)||o.isVNode(t)||U(t)?e={message:t}:e=t,{...I,...e}},jt=t=>{const{handler:e}=t;e.close()},Ft=({appendTo:t=document.body,...e},i)=>{const n=e.onClose,s=document.createElement("div"),a={...e,onClose:()=>{n?.(),jt(l)},onDestroy:()=>{W=null,o.render(null,s)}},h=o.createVNode(Vt,a,U(a.message)||o.isVNode(a.message)?{default:U(a.message)?a.message:()=>a.message}:null);h.appContext=i||F._context,o.render(h,s),t.appendChild(s.firstElementChild);const c=h.component,l={vnode:h,vm:c,handler:{close:()=>{c.exposed?.close()},destroy:()=>{c.exposed?.destroy()},open:()=>{c.exposed?.show()}},props:h.component.props};return l},F=(t={},e)=>{if(W)return W.handler;const i=$t(t),n=Ft(i,e);return W=n,n.handler};return F._context=null,(t={})=>F({message:o.h(lt,t)})}));
|
|
1
|
+
(function(o,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["vue","axios"],T):(o=typeof globalThis<"u"?globalThis:o||self,o["yl-ai-modal"]=T(o.Vue,o.axios))})(this,(function(o,T){"use strict";var p=typeof document<"u"?document.currentScript:null;const B=T.create({timeout:6e3}),q=t=>{if(t.response){const e=localStorage.getItem("token");t.response.status==401&&e&&(localStorage.remove("token"),setTimeout(()=>{window.location.reload()},1500))}return Promise.reject(t)};B.interceptors.request.use(t=>{const e=localStorage.getItem("token");return e&&(t.headers.token=e),t},q),B.interceptors.response.use(t=>t.data,q);const K=(t,e)=>{const i=t.__vccOpts||t;for(const[n,s]of e)i[n]=s;return i},lt={class:"ai-dialog"},ct={class:"ai-dialog-feed"},dt=["src"],ut=K({__name:"index",setup(t){const e=o.useAttrs(),i=o.reactive({baseUrl:"",url:""}),n=async()=>{if(i.baseUrl)return(await B.post(i.baseUrl+"/api/v1/user/login",{username:"clare",password:"Zz12345678"}))?.data};return o.onBeforeMount(async()=>{let s=e.url;const a=new URL(s);i.baseUrl=a.origin;let h=a.href;h.endsWith("/")&&(h=h.slice(0,-1));let c=await n();const d=new URLSearchParams(c).toString();i.url=h+`?${d}`}),o.onMounted(()=>{o.nextTick(()=>{})}),(s,a)=>(o.openBlock(),o.createElementBlock("div",lt,[o.createElementVNode("div",ct,[o.createElementVNode("iframe",{class:"ai-dialog-iframe",src:i.url},null,8,dt)])]))}},[["__scopeId","data-v-bba24a59"]]);process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const U=t=>typeof t=="function",mt=t=>typeof t=="string",_=new WeakMap,gt=(...t)=>{var e;const i=t[0],n=(e=o.getCurrentInstance())===null||e===void 0?void 0:e.proxy,s=n??o.getCurrentScope();if(s==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return s&&_.has(s)&&i in _.get(s)?_.get(s)[i]:o.inject(...t)},ft=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const pt=Object.prototype.toString,bt=t=>pt.call(t)==="[object Object]";function G(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function D(t){return Array.isArray(t)?t:[t]}function yt(t){return o.getCurrentInstance()}function wt(t,e=!0,i){yt()?o.onMounted(t,i):e?t():o.nextTick(t)}function xt(t,e,i){return o.watch(t,e,{...i,immediate:!0})}const P=ft?window:void 0;function Rt(t){var e;const i=o.toValue(t);return(e=i?.$el)!==null&&e!==void 0?e:i}function L(...t){const e=(n,s,a,h)=>(n.addEventListener(s,a,h),()=>n.removeEventListener(s,a,h)),i=o.computed(()=>{const n=D(o.toValue(t[0])).filter(s=>s!=null);return n.every(s=>typeof s!="string")?n:void 0});return xt(()=>{var n,s;return[(n=(s=i.value)===null||s===void 0?void 0:s.map(a=>Rt(a)))!==null&&n!==void 0?n:[P].filter(a=>a!=null),D(o.toValue(i.value?t[1]:t[0])),D(o.unref(i.value?t[2]:t[1])),o.toValue(i.value?t[3]:t[2])]},([n,s,a,h],c,d)=>{if(!n?.length||!s?.length||!a?.length)return;const l=bt(h)?{...h}:h,m=n.flatMap(u=>s.flatMap(g=>a.map(r=>e(u,g,r,l))));d(()=>{m.forEach(u=>u())})},{flush:"post"})}function zt(){const t=o.shallowRef(!1),e=o.getCurrentInstance();return e&&o.onMounted(()=>{t.value=!0},e),t}function St(t){const e=zt();return o.computed(()=>(e.value,!!t()))}const vt=Symbol("vueuse-ssr-width");function Ct(){const t=o.hasInjectionContext()?gt(vt,null):null;return typeof t=="number"?t:void 0}function Mt(t,e={}){const{window:i=P,ssrWidth:n=Ct()}=e,s=St(()=>i&&"matchMedia"in i&&typeof i.matchMedia=="function"),a=o.shallowRef(typeof n=="number"),h=o.shallowRef(),c=o.shallowRef(!1),d=l=>{c.value=l.matches};return o.watchEffect(()=>{if(a.value){a.value=!s.value,c.value=o.toValue(t).split(",").some(l=>{const m=l.includes("not all"),u=l.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),g=l.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let r=!!(u||g);return u&&r&&(r=n>=G(u[1])),g&&r&&(r=n<=G(g[1])),m?!r:r});return}s.value&&(h.value=i.matchMedia(o.toValue(t)),c.value=h.value.matches)}),L(h,"change",d,{passive:!0}),o.computed(()=>c.value)}function It(t={}){const{window:e=P,initialWidth:i=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:a=!0,type:h="inner"}=t,c=o.shallowRef(i),d=o.shallowRef(n),l=()=>{if(e)if(h==="outer")c.value=e.outerWidth,d.value=e.outerHeight;else if(h==="visual"&&e.visualViewport){const{width:u,height:g,scale:r}=e.visualViewport;c.value=Math.round(u*r),d.value=Math.round(g*r)}else a?(c.value=e.innerWidth,d.value=e.innerHeight):(c.value=e.document.documentElement.clientWidth,d.value=e.document.documentElement.clientHeight)};l(),wt(l);const m={passive:!0};return L("resize",l,m),e&&h==="visual"&&e.visualViewport&&L(e.visualViewport,"resize",l,m),s&&o.watch(Mt("(orientation: portrait)"),()=>l()),{width:c,height:d}}function Q(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Function]"}function I(t,e,i,n=1){const[s,a]=typeof n=="number"?[n,n]:n,h=Math.round(e/s/t[0])*t[0],c=Math.round(i/a/t[1])*t[1];return[h,c]}function V(t,e,i){return t-e-i}function $(t,e,i){return t-e-i}function y(t,e,i){return e!==null&&t<e?e:i!==null&&i<t?i:t}function J(t,e,i){let n=t;const s=["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"].find(a=>Q(n[a]));if(!Q(n[s]))return!1;do{if(n[s](e))return!0;if(n===i)return!1;n=n.parentNode}while(n);return!1}function kt(t){const e=window.getComputedStyle(t);return[parseFloat(e.getPropertyValue("width"),10),parseFloat(e.getPropertyValue("height"),10)]}function v(t,e,i){t&&(t.attachEvent?t.attachEvent("on"+e,i):t.addEventListener?t.addEventListener(e,i,!0):t["on"+e]=i)}function x(t,e,i){t&&(t.detachEvent?t.detachEvent("on"+e,i):t.removeEventListener?t.removeEventListener(e,i,!0):t["on"+e]=null)}const Tt=(t,e)=>{const i=t.__vccOpts||t;for(const[n,s]of e)i[n]=s;return i},N={mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"},touch:{start:"touchstart",move:"touchmove",stop:"touchend"}},Et={userSelect:"none",MozUserSelect:"none",WebkitUserSelect:"none",MsUserSelect:"none"},Lt={userSelect:"auto",MozUserSelect:"auto",WebkitUserSelect:"auto",MsUserSelect:"auto"};let R=N.mouse;const Nt={replace:!0,name:"vue-draggable-resizable",props:{className:{type:String,default:"vdr"},classNameDraggable:{type:String,default:"draggable"},classNameResizable:{type:String,default:"resizable"},classNameDragging:{type:String,default:"dragging"},classNameResizing:{type:String,default:"resizing"},classNameActive:{type:String,default:"active"},classNameHandle:{type:String,default:"handle"},disableUserSelect:{type:Boolean,default:!0},enableNativeDrag:{type:Boolean,default:!1},preventDeactivation:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},lockAspectRatio:{type:Boolean,default:!1},w:{type:[Number,String],default:200,validator:t=>typeof t=="number"?t>0:t==="auto"},h:{type:[Number,String],default:200,validator:t=>typeof t=="number"?t>0:t==="auto"},minWidth:{type:Number,default:0,validator:t=>t>=0},minHeight:{type:Number,default:0,validator:t=>t>=0},maxWidth:{type:Number,default:null,validator:t=>t>=0},maxHeight:{type:Number,default:null,validator:t=>t>=0},x:{type:Number,default:0},y:{type:Number,default:0},z:{type:[String,Number],default:"auto",validator:t=>typeof t=="string"?t==="auto":t>=0},handles:{type:Array,default:()=>["tl","tm","tr","mr","br","bm","bl","ml"],validator:t=>{const e=new Set(["tl","tm","tr","mr","br","bm","bl","ml"]);return new Set(t.filter(i=>e.has(i))).size===t.length}},dragHandle:{type:String,default:null},dragCancel:{type:String,default:null},axis:{type:String,default:"both",validator:t=>["x","y","both"].includes(t)},grid:{type:Array,default:()=>[1,1]},parent:{type:Boolean,default:!1},scale:{type:[Number,Array],default:1,validator:t=>typeof t=="number"?t>0:t.length===2&&t[0]>0&&t[1]>0},onDragStart:{type:Function,default:()=>!0},onDrag:{type:Function,default:()=>!0},onResizeStart:{type:Function,default:()=>!0},onResize:{type:Function,default:()=>!0}},data:function(){return{left:this.x,top:this.y,right:null,bottom:null,width:null,height:null,widthTouched:!1,heightTouched:!1,aspectFactor:null,parentWidth:null,parentHeight:null,handle:null,enabled:this.active,resizing:!1,dragging:!1,dragEnable:!1,resizeEnable:!1,zIndex:this.z}},created:function(){this.maxWidth&&this.minWidth>this.maxWidth&&console.warn("[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth"),this.maxHeight&&this.minHeight>this.maxHeight&&console.warn("[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight"),this.resetBoundsAndMouseState()},mounted:function(){this.enableNativeDrag||(this.$el.ondragstart=()=>!1);const[t,e]=this.getParentSize();this.parentWidth=t,this.parentHeight=e;const[i,n]=kt(this.$el);this.aspectFactor=(this.w!=="auto"?this.w:i)/(this.h!=="auto"?this.h:n),this.width=this.w!=="auto"?this.w:i,this.height=this.h!=="auto"?this.h:n,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top,this.active&&this.$emit("activated"),v(document.documentElement,"mousedown",this.deselect),v(document.documentElement,"touchend touchcancel",this.deselect),v(window,"resize",this.checkParentSize)},beforeUnmount:function(){x(document.documentElement,"mousedown",this.deselect),x(document.documentElement,"touchstart",this.handleUp),x(document.documentElement,"mousemove",this.move),x(document.documentElement,"touchmove",this.move),x(document.documentElement,"mouseup",this.handleUp),x(document.documentElement,"touchend touchcancel",this.deselect),x(window,"resize",this.checkParentSize)},methods:{resetBoundsAndMouseState(){this.mouseClickPosition={mouseX:0,mouseY:0,x:0,y:0,w:0,h:0},this.bounds={minLeft:null,maxLeft:null,minRight:null,maxRight:null,minTop:null,maxTop:null,minBottom:null,maxBottom:null}},checkParentSize(){if(this.parent){const[t,e]=this.getParentSize();this.parentWidth=t,this.parentHeight=e,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top}},getParentSize(){if(this.parent){const t=window.getComputedStyle(this.$el.parentNode,null);return[parseInt(t.getPropertyValue("width"),10),parseInt(t.getPropertyValue("height"),10)]}return[null,null]},elementTouchDown(t){R=N.touch,this.elementDown(t)},elementMouseDown(t){R=N.mouse,this.elementDown(t)},elementDown(t){if(t instanceof MouseEvent&&t.button!==0)return;const e=t.target||t.srcElement;if(this.$el.contains(e)){if(this.onDragStart(t)===!1)return;if(this.dragHandle&&!J(e,this.dragHandle,this.$el)||this.dragCancel&&J(e,this.dragCancel,this.$el)){this.dragging=!1;return}this.enabled||(this.enabled=!0,this.$emit("activated"),this.$emit("update:active",!0)),this.draggable&&(this.dragEnable=!0),this.mouseClickPosition.mouseX=t.touches?t.touches[0].pageX:t.pageX,this.mouseClickPosition.mouseY=t.touches?t.touches[0].pageY:t.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.parent&&(this.bounds=this.calcDragLimits()),v(document.documentElement,R.move,this.move),v(document.documentElement,R.stop,this.handleUp)}},calcDragLimits(){return{minLeft:this.left%this.grid[0],maxLeft:Math.floor((this.parentWidth-this.width-this.left)/this.grid[0])*this.grid[0]+this.left,minRight:this.right%this.grid[0],maxRight:Math.floor((this.parentWidth-this.width-this.right)/this.grid[0])*this.grid[0]+this.right,minTop:this.top%this.grid[1],maxTop:Math.floor((this.parentHeight-this.height-this.top)/this.grid[1])*this.grid[1]+this.top,minBottom:this.bottom%this.grid[1],maxBottom:Math.floor((this.parentHeight-this.height-this.bottom)/this.grid[1])*this.grid[1]+this.bottom}},deselect(t){const e=t.target||t.srcElement,i=new RegExp(this.className+"-([trmbl]{2})","");!this.$el.contains(e)&&!i.test(e.className)&&(this.enabled&&!this.preventDeactivation&&(this.enabled=!1,this.$emit("deactivated"),this.$emit("update:active",!1)),x(document.documentElement,R.move,this.handleResize)),this.resetBoundsAndMouseState()},handleTouchDown(t,e){R=N.touch,this.handleDown(t,e)},handleDown(t,e){e instanceof MouseEvent&&e.which!==1||this.onResizeStart(t,e)!==!1&&(e.stopPropagation&&e.stopPropagation(),this.lockAspectRatio&&!t.includes("m")?this.handle="m"+t.substring(1):this.handle=t,this.resizeEnable=!0,this.mouseClickPosition.mouseX=e.touches?e.touches[0].pageX:e.pageX,this.mouseClickPosition.mouseY=e.touches?e.touches[0].pageY:e.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.bounds=this.calcResizeLimits(),v(document.documentElement,R.move,this.handleResize),v(document.documentElement,R.stop,this.handleUp))},calcResizeLimits(){let t=this.minW,e=this.minH,i=this.maxW,n=this.maxH;const s=this.aspectFactor,[a,h]=this.grid,c=this.width,d=this.height,l=this.left,m=this.top,u=this.right,g=this.bottom;this.lockAspectRatio&&(t/e>s?e=t/s:t=s*e,i&&n?(i=Math.min(i,s*n),n=Math.min(n,i/s)):i?n=i/s:n&&(i=s*n)),i=i-i%a,n=n-n%h;const r={minLeft:null,maxLeft:null,minTop:null,maxTop:null,minRight:null,maxRight:null,minBottom:null,maxBottom:null};return this.parent?(r.minLeft=l%a,r.maxLeft=l+Math.floor((c-t)/a)*a,r.minTop=m%h,r.maxTop=m+Math.floor((d-e)/h)*h,r.minRight=u%a,r.maxRight=u+Math.floor((c-t)/a)*a,r.minBottom=g%h,r.maxBottom=g+Math.floor((d-e)/h)*h,i&&(r.minLeft=Math.max(r.minLeft,this.parentWidth-u-i),r.minRight=Math.max(r.minRight,this.parentWidth-l-i)),n&&(r.minTop=Math.max(r.minTop,this.parentHeight-g-n),r.minBottom=Math.max(r.minBottom,this.parentHeight-m-n)),this.lockAspectRatio&&(r.minLeft=Math.max(r.minLeft,l-m*s),r.minTop=Math.max(r.minTop,m-l/s),r.minRight=Math.max(r.minRight,u-g*s),r.minBottom=Math.max(r.minBottom,g-u/s))):(r.minLeft=null,r.maxLeft=l+Math.floor((c-t)/a)*a,r.minTop=null,r.maxTop=m+Math.floor((d-e)/h)*h,r.minRight=null,r.maxRight=u+Math.floor((c-t)/a)*a,r.minBottom=null,r.maxBottom=g+Math.floor((d-e)/h)*h,i&&(r.minLeft=-(u+i),r.minRight=-(l+i)),n&&(r.minTop=-(g+n),r.minBottom=-(m+n)),this.lockAspectRatio&&i&&n&&(r.minLeft=Math.min(r.minLeft,-(u+i)),r.minTop=Math.min(r.minTop,-(n+g)),r.minRight=Math.min(r.minRight,-l-i),r.minBottom=Math.min(r.minBottom,-m-n))),r},move(t){this.resizing?this.handleResize(t):this.dragEnable&&this.handleDrag(t)},handleDrag(t){const e=this.axis,i=this.grid,n=this.bounds,s=this.mouseClickPosition,a=e&&e!=="y"?s.mouseX-(t.touches?t.touches[0].pageX:t.pageX):0,h=e&&e!=="x"?s.mouseY-(t.touches?t.touches[0].pageY:t.pageY):0,[c,d]=I(i,a,h,this.scale),l=y(s.left-c,n.minLeft,n.maxLeft),m=y(s.top-d,n.minTop,n.maxTop);if(this.onDrag(l,m)===!1)return;const u=y(s.right+c,n.minRight,n.maxRight),g=y(s.bottom+d,n.minBottom,n.maxBottom);this.left=l,this.top=m,this.right=u,this.bottom=g,this.$emit("dragging",this.left,this.top),this.dragging=!0},moveHorizontally(t){const[e]=I(this.grid,t,this.top,1),i=y(e,this.bounds.minLeft,this.bounds.maxLeft);this.left=i,this.right=this.parentWidth-this.width-i},moveVertically(t){const[e,i]=I(this.grid,this.left,t,1),n=y(i,this.bounds.minTop,this.bounds.maxTop);this.top=n,this.bottom=this.parentHeight-this.height-n},handleResize(t){let e=this.left,i=this.top,n=this.right,s=this.bottom;const a=this.mouseClickPosition,h=this.aspectFactor,c=a.mouseX-(t.touches?t.touches[0].pageX:t.pageX),d=a.mouseY-(t.touches?t.touches[0].pageY:t.pageY);!this.widthTouched&&c&&(this.widthTouched=!0),!this.heightTouched&&d&&(this.heightTouched=!0);const[l,m]=I(this.grid,c,d,this.scale);this.handle.includes("b")?(s=y(a.bottom+m,this.bounds.minBottom,this.bounds.maxBottom),this.lockAspectRatio&&this.resizingOnY&&(n=this.right-(this.bottom-s)*h)):this.handle.includes("t")&&(i=y(a.top-m,this.bounds.minTop,this.bounds.maxTop),this.lockAspectRatio&&this.resizingOnY&&(e=this.left-(this.top-i)*h)),this.handle.includes("r")?(n=y(a.right+l,this.bounds.minRight,this.bounds.maxRight),this.lockAspectRatio&&this.resizingOnX&&(s=this.bottom-(this.right-n)/h)):this.handle.includes("l")&&(e=y(a.left-l,this.bounds.minLeft,this.bounds.maxLeft),this.lockAspectRatio&&this.resizingOnX&&(i=this.top-(this.left-e)/h));const u=V(this.parentWidth,e,n),g=$(this.parentHeight,i,s);this.onResize(this.handle,e,i,u,g)!==!1&&(this.left=e,this.top=i,this.right=n,this.bottom=s,this.width=u,this.height=g,this.$emit("resizing",this.left,this.top,this.width,this.height),this.resizing=!0)},changeWidth(t){const[e]=I(this.grid,t,0,1),i=y(this.parentWidth-e-this.left,this.bounds.minRight,this.bounds.maxRight);let n=this.bottom;this.lockAspectRatio&&(n=this.bottom-(this.right-i)/this.aspectFactor);const s=V(this.parentWidth,this.left,i),a=$(this.parentHeight,this.top,n);this.right=i,this.bottom=n,this.width=s,this.height=a},changeHeight(t){const[e,i]=I(this.grid,0,t,1),n=y(this.parentHeight-i-this.top,this.bounds.minBottom,this.bounds.maxBottom);let s=this.right;this.lockAspectRatio&&(s=this.right-(this.bottom-n)*this.aspectFactor);const a=V(this.parentWidth,this.left,s),h=$(this.parentHeight,this.top,n);this.right=s,this.bottom=n,this.width=a,this.height=h},handleUp(t){this.handle=null,this.resetBoundsAndMouseState(),this.dragEnable=!1,this.resizeEnable=!1,this.resizing&&(this.resizing=!1,this.$emit("resizeStop",this.left,this.top,this.width,this.height)),this.dragging&&(this.dragging=!1,this.$emit("dragStop",this.left,this.top)),x(document.documentElement,R.move,this.handleResize)}},computed:{style(){return{transform:`translate(${this.left}px, ${this.top}px)`,width:this.computedWidth,height:this.computedHeight,zIndex:this.zIndex,...this.dragging&&this.disableUserSelect?Et:Lt}},actualHandles(){return this.resizable?this.handles:[]},computedWidth(){return this.w==="auto"&&!this.widthTouched?"auto":this.width+"px"},computedHeight(){return this.h==="auto"&&!this.heightTouched?"auto":this.height+"px"},minW(){return this.minWidth},minH(){return this.minHeight},maxW(){return this.maxWidth},maxH(){return this.maxHeight},resizingOnX(){return!!this.handle&&(this.handle.includes("l")||this.handle.includes("r"))},resizingOnY(){return!!this.handle&&(this.handle.includes("t")||this.handle.includes("b"))},isCornerHandle(){return!!this.handle&&["tl","tr","br","bl"].includes(this.handle)}},watch:{active(t){this.enabled=t,t?this.$emit("activated"):this.$emit("deactivated")},z(t){(t>=0||t==="auto")&&(this.zIndex=t)},x(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveHorizontally(t))},y(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveVertically(t))},lockAspectRatio(t){t?this.aspectFactor=this.width/this.height:this.aspectFactor=void 0},w(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeWidth(t))},h(t){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeHeight(t))}}},Wt=["onMousedown","onTouchstart"];function Ht(t,e,i,n,s,a){return o.openBlock(),o.createElementBlock("div",{style:o.normalizeStyle(a.style),class:o.normalizeClass([{[i.classNameActive]:t.enabled,[i.classNameDragging]:t.dragging,[i.classNameResizing]:t.resizing,[i.classNameDraggable]:i.draggable,[i.classNameResizable]:i.resizable},i.className]),onMousedown:e[0]||(e[0]=(...h)=>a.elementMouseDown&&a.elementMouseDown(...h)),onTouchstart:e[1]||(e[1]=(...h)=>a.elementTouchDown&&a.elementTouchDown(...h))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.actualHandles,h=>(o.openBlock(),o.createElementBlock("div",{key:h,class:o.normalizeClass([i.classNameHandle,i.classNameHandle+"-"+h]),style:o.normalizeStyle({display:t.enabled?"block":"none"}),onMousedown:o.withModifiers(c=>a.handleDown(h,c),["stop","prevent"]),onTouchstart:o.withModifiers(c=>a.handleTouchDown(h,c),["stop","prevent"])},[o.renderSlot(t.$slots,h)],46,Wt))),128)),o.renderSlot(t.$slots,"default")],38)}const tt=Tt(Nt,[["render",Ht]]);function j(t){j.installed||(j.installed=!0,t.component("VueDraggableResizable",tt))}const Bt={install:j};let W=null;typeof window<"u"?W=window.Vue:typeof global<"u"&&(W=global.Vue),W&&W.use(Bt);const k={duration:3e3,message:"",onClose:void 0,showClose:!1,placement:void 0,zIndex:2e3},Ut={duration:{type:Number,default:k.duration},message:{type:[String,Object,Function],default:k.message},onClose:{type:Function,default:k.onClose},showClose:{type:Boolean,default:k.showClose},zIndex:{type:Number,default:k.zIndex}},et={current:0},it=o.ref(0),_t=2e3,Dt=Symbol("elZIndexContextKey"),Pt=Symbol("zIndexContextKey"),Vt=t=>{const e=o.getCurrentInstance()?o.inject(Dt,et):et,i=o.getCurrentInstance()?o.inject(Pt,void 0):void 0,n=o.computed(()=>o.unref(i)||_t),s=o.computed(()=>n.value+it.value);return{initialZIndex:n,currentZIndex:s,nextZIndex:()=>(e.current++,it.value=e.current,s.value)}},$t={class:"yl-ai-modal"},jt=400,Ft=K(Object.assign({name:"InstanceConstructor"},{__name:"instanceConstructor",props:Ut,emits:["destroy"],setup(t,{expose:e,emit:i}){const n=o.ref(!1),s=t,a=i,h=o.ref(!1),{currentZIndex:c,nextZIndex:d}=Vt();o.ref(0);const l=o.reactive({x:0,y:0,w:.01,height:.01,z:2e3,ironManIndex:0}),m=new URL("./assets/iron-man/01.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,u=new URL("./assets/iron-man/02.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,g=new URL("./assets/iron-man/03.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,r=new URL("./assets/iron-man/04.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,Xt=new URL("./assets/iron-man/05.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href,Zt=new URL("./assets/iron-man/06.gif",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("yl-ai-modal.umd.js",document.baseURI).href).href;let nt=[m,u,g,r,Xt,Zt];const qt=o.computed(()=>({background:`url(${nt[l.ironManIndex]}) no-repeat center`}));setInterval(()=>{l.ironManIndex=(l.ironManIndex+1)%nt.length},2e3);const O=o.useTemplateRef("vueDraggableResizableRef"),A=()=>{O.value&&O.value.checkParentSize()},E=o.useTemplateRef("aiHuman"),ot=()=>{const f=E.value.getBoundingClientRect(),{width:b,height:w}=f,S=jt+b,C=window.innerWidth,M=window.innerHeight,rt=Math.round(M*.8),ee=C-S-16,ie=(M-rt)/2;return{w:S,x:ee,y:ie,height:rt}},{width:st,height:at}=It({});o.watch([at,st],()=>{if(n.value)Z();else{const{w:f,height:b,x:w,y:z}=l;(f+w>st.value||b+z>at.value)&&ht()}});function Y(){n.value=!1,o.nextTick(()=>{h.value||s.onClose?.()})}const X=o.ref(!1),Kt=f=>{X.value=!0},Gt=(f,b)=>{l.x=f,l.y=b},Qt=()=>{X.value=!1},Z=()=>{if(X.value)return;const f=E.value.getBoundingClientRect(),{width:b,height:w}=f,{w:z,height:S}=ot();let C=l.y;n.value||(C=l.y+w-S,l.y+w<=S&&(C=0)),n.value=!0;let M=l.x;l.x+z>=window.innerWidth&&(M=window.innerWidth-z),Object.assign(l,{x:M,y:C}),A(),o.nextTick(()=>{Object.assign(l,{w:z,height:S}),A()})},Jt=()=>{const f=E.value.getBoundingClientRect(),{width:b,height:w}=f;Object.assign(l,{w:b,height:w,y:l.y+l.height-w})};o.onBeforeMount(()=>{});function ht(){o.nextTick(()=>{const f=E.value.getBoundingClientRect(),{width:b,height:w}=f,{height:z,x:S,y:C}=ot(),M=c.value;Object.assign(l,{w:b,height:w,x:S,y:C+z-w,z:M}),A()})}o.onMounted(()=>{d(),ht()});function te(f){(f.keyCode===27||f.key==="Escape")&&Y()}return L(document,"keydown",te),e({show:Z,close:Y,destroy:()=>{a("destroy")}}),(f,b)=>(o.openBlock(),o.createBlock(o.unref(tt),{class:"dialog-vdr",ref_key:"vueDraggableResizableRef",ref:O,onDrag:Kt,onDragStop:Gt,onClick:Qt,x:l.x,y:l.y,z:l.z,w:l.w,h:l.height,parent:!0,resizable:!1,"drag-handle":".yl-ai-human"},{default:o.withCtx(()=>[o.createElementVNode("div",{ref_key:"aiHuman",ref:E,class:"yl-ai-human ai-human",style:o.normalizeStyle(qt.value),onClick:Z},null,4),o.createVNode(o.Transition,{name:"fade",onBeforeEnter:b[0]||(b[0]=w=>h.value=!0),onBeforeLeave:f.onClose,onAfterLeave:Jt},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",$t,[o.renderSlot(f.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(f.message),1)],!0)],512),[[o.vShow,n.value]])]),_:3},8,["onBeforeLeave"]),n.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"icon-close",onClick:Y})):o.createCommentVNode("",!0)]),_:3},8,["x","y","z","w","h"]))}}),[["__scopeId","data-v-fd6bf392"]]);let H=null;const Ot=t=>{let e;return!t||mt(t)||o.isVNode(t)||U(t)?e={message:t}:e=t,{...k,...e}},At=t=>{const{handler:e}=t;e.close()},Yt=({appendTo:t=document.body,...e},i)=>{const n=e.onClose,s=document.createElement("div"),a={...e,onClose:()=>{n?.(),At(l)},onDestroy:()=>{H=null,o.render(null,s)}},h=o.createVNode(Ft,a,U(a.message)||o.isVNode(a.message)?{default:U(a.message)?a.message:()=>a.message}:null);h.appContext=i||F._context,o.render(h,s),t.appendChild(s.firstElementChild);const c=h.component,l={vnode:h,vm:c,handler:{close:()=>{c.exposed?.close()},destroy:()=>{c.exposed?.destroy()},open:()=>{c.exposed?.show()}},props:h.component.props};return l},F=(t={},e)=>{if(H)return H.handler;const i=Ot(t),n=Yt(i,e);return H=n,n.handler};return F._context=null,(t={})=>F({message:o.h(ut,t)})}));
|