@glodon-aiot/embed 1.4.6-beta.0 → 1.4.6-shapshot.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/dist/embed.js +223 -76
- package/dist/embed.umd.cjs +72 -7
- package/dist/src/utils/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/embed.js
CHANGED
|
@@ -1,116 +1,263 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".handler-btn{width:100%;height:100%}.handler-btn .minify-btn{width:10px;height:10px;background:rgba(0,0,0,.3);display:none;border-radius:5px;font-size:8px;text-align:center;position:absolute;left:0;top:0;line-height:10px}.handler-btn .minify-btn:hover,.handler-btn .minify-btn:active{background:rgba(0,0,0,.6)}.handler-btn .action-btn:has(.minify-right)+.minify-btn{display:none}.handler-btn:hover,.handler-btn:hover .minify-btn{display:block}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
const
|
|
2
|
+
const U = `<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26" fill="none">
|
|
3
3
|
<path d="M21.4914 2.03125H10.482C8.45078 2.03125 6.78516 3.69687 6.78516 5.76875V14.1781C6.78516 16.25 8.45078 17.9156 10.482 17.9156H16.982L19.582 20.3125C20.3133 21.0031 21.5727 20.5156 21.5727 19.5V17.875C23.5633 17.875 25.1883 16.2094 25.1883 14.1781V5.76875C25.1883 3.69687 23.5227 2.03125 21.4914 2.03125Z" fill="#9C24F2"/>
|
|
4
4
|
<path d="M15.5187 5.36249H4.50937C2.47812 5.36249 0.8125 7.02811 0.8125 9.09999V17.5094C0.8125 19.5406 2.4375 21.2062 4.42812 21.2469V22.8719C4.42812 23.8875 5.6875 24.375 6.41875 23.6844L9.01875 21.2875H15.5187C17.55 21.2875 19.2156 19.6219 19.2156 17.55V9.09999C19.2156 7.02811 17.55 5.36249 15.5187 5.36249Z" fill="#C47DFF"/>
|
|
5
5
|
<path d="M10.5619 11.7406H5.72754C5.28066 11.7406 4.91504 11.375 4.91504 10.9281V10.6844C4.91504 10.2375 5.28066 9.87189 5.72754 9.87189H10.5619C11.0088 9.87189 11.3744 10.2375 11.3744 10.6844V10.9281C11.3744 11.375 11.0088 11.7406 10.5619 11.7406ZM13.3244 15.6H5.72754C5.28066 15.6 4.91504 15.2344 4.91504 14.7875V14.5438C4.91504 14.0969 5.28066 13.7313 5.72754 13.7313H13.2838C13.7307 13.7313 14.0963 14.0969 14.0963 14.5438V14.7875C14.1369 15.2344 13.7713 15.6 13.3244 15.6Z" fill="white"/>
|
|
6
|
-
</svg>`,
|
|
7
|
-
let
|
|
8
|
-
function
|
|
9
|
-
t.addEventListener ? t.addEventListener(
|
|
10
|
-
return
|
|
6
|
+
</svg>`, X = '<svg t="1728647045306" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2120" width="16" height="16"><path d="M489.344 705.28L148.032 363.968l45.248-45.248L512 637.44l318.72-318.72 45.248 45.248-341.376 341.312a32 32 0 0 1-45.248 0z" p-id="2121"></path></svg>', Y = '<svg t="1728647093338" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2262" width="16" height="16"><path d="M534.656 318.72l341.312 341.312-45.248 45.248L512 386.56 193.28 705.28l-45.248-45.248L489.408 318.72a32 32 0 0 1 45.248 0z" p-id="2263"></path></svg>', j = '<svg t="1728647153848" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1960" width="16" height="16"><path d="M318.72 489.344L660.032 148.032l45.248 45.248L386.56 512l318.72 318.72-45.248 45.248-341.312-341.376a32 32 0 0 1 0-45.248z" p-id="1961"></path></svg>', O = '<svg t="1728647222368" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1851" width="16" height="16"><path d="M705.28 534.656L363.968 875.968l-45.248-45.248L637.44 512l-318.72-318.72 45.248-45.248 341.312 341.376a32 32 0 0 1 0 45.248z" p-id="1852"></path></svg>', A = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="12" height="12" viewBox="0 0 12 12"><defs><clipPath id="master_svg0_804_137003"><rect x="0" y="0" width="12" height="12" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_804_137003)"><g><path d="M11.45450115625,0.95450129625L11.45450115625,3.72159265625C11.45450115625,3.94752715625,11.27134515625,4.13068345625,11.04541015625,4.13068345625C10.81947615625,4.13068345625,10.63632015625,3.94752715625,10.63632015625,3.72159265625L10.63632015625,1.94177405625L7.47377395625,5.10431955625C7.31430575625,5.26444385625,7.05506035625,5.26444385625,6.89559225625,5.10431955625C6.73570915625,4.94453855625,6.73570915625,4.68537375625,6.89559225625,4.52559235625L10.05759235625,1.36359214625L8.27832035625,1.36359214625C8.05238535625,1.36344140625,7.86935135625,1.18016290625,7.86950205625,0.95422825625C7.86965325625,0.72829346625,8.05293175625,0.5452595055,8.27886585625,0.54541029036046L11.04541215625,0.54541029036046C11.27134615625,0.54541069269186,11.45450215625,0.72856677625,11.45450115625,0.95450129625ZM4.52668335625,6.89504765625L1.36359226625,10.05759335625L1.36359226625,8.27722935625C1.36344152625,8.05129435625,1.18016302625,7.86826035625,0.95422839625,7.86841155625C0.72829367625,7.86856225625,0.54525968432,8.05184075625,0.54541046917439,8.277775256249999L0.54541046917439,11.04541215625C0.5454104244709,11.27134715625,0.7285666362500001,11.45450315625,0.95450132625,11.45450315625L3.72213765625,11.45450315625C3.94807245625,11.45450315625,4.13122845625,11.27134715625,4.13122845625,11.04541215625C4.13122845625,10.81947715625,3.94807245625,10.63632115625,3.72213765625,10.63632115625L1.94231965625,10.63632115625L5.10541055625,7.47323035625C5.26984695625,7.31426045625,5.27200695625,7.05135485625,5.11020465625,6.88970465625C4.94840235625,6.72805495625,4.68549825625,6.73046255625,4.52668335625,6.89504765625ZM1.94231965625,1.36359214625L3.72268345625,1.36359214625C3.94867345625,1.36351954625,4.13179345625,1.18021839625,4.131643056250001,0.95422860625C4.13149265625,0.72823870625,3.94812775625,0.54518176614,3.72213795625,0.54541037976743L0.95450144625,0.54541037976743C0.72856671625,0.54541033506395,0.54541051387787,0.72856655625,0.54541055858135,0.95450129625L0.54541055858135,3.72159265625C0.54548856616,3.94747205625,0.72862192625,4.13054225625,0.95450144625,4.13054225625C1.18038099625,4.13054225625,1.36351430625,3.94747205625,1.36359244625,3.72159265625L1.36359244625,1.94177405625L4.52668335625,5.10431955625C4.68615195625,5.26444335625,4.94539685625,5.26444335625,5.10486505625,5.10431955625C5.26474855625,4.94453855625,5.26474855625,4.68537375625,5.10486505625,4.52559235625L1.94231965625,1.36359214625ZM11.04541115625,7.86868385625C10.81947715625,7.86868335625,10.63632015625,8.05183935625,10.63632015625,8.277775256249999L10.63632015625,10.05813885625L7.47377395625,6.89504765625C7.31399915625,6.73502585625,7.05472185625,6.73492575625,6.89482305625,6.89482405625C6.73492525625,7.05472275625,6.73502535625,7.31400015625,6.89504715625,7.47377495625L10.05759235625,10.63686515625L8.27832035625,10.63686515625C8.04667905625,10.62855915625,7.85441495625,10.81417615625,7.85456945625,11.04596715625C7.85472395625,11.27775715625,8.04723545625,11.46311715625,8.27886535625,11.45450215625L11.04541115625,11.45450215625C11.27134615625,11.45450215625,11.45450215625,11.27134615625,11.45450215625,11.04541115625L11.45450215625,8.27777435625C11.45450115625,8.05183935625,11.27134615625,7.86868335625,11.04541115625,7.86868385625Z" fill="#6F6F6F" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>', K = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><defs><clipPath id="master_svg0_804_137006"><rect x="0" y="0" width="16" height="16" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_804_137006)"><g transform="matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,6.067118670641264,-7.980327525384439)"><path d="M12.166666984558105,16.53280909375L12.166666984558105,3.33349609375L13.166666984558105,3.33349609375L13.166666984558105,16.53280909375L12.166666984558105,16.53280909375Z" fill-rule="evenodd" fill="#6F6F6F" fill-opacity="1"/></g><g transform="matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,3.3334484688798227,-1.3806642348668277)"><path d="M16.532646492279053,3.83349609375L3.3333334922790527,3.83349609375L3.3333334922790527,2.83349609375L16.532646492279053,2.83349609375L16.532646492279053,3.83349609375Z" fill-rule="evenodd" fill="#6F6F6F" fill-opacity="1"/></g></g></svg>';
|
|
7
|
+
let $ = !1;
|
|
8
|
+
function r(t, x, c) {
|
|
9
|
+
t.addEventListener ? t.addEventListener(x, c, !1) : t.attachEvent("on" + x, function(d) {
|
|
10
|
+
return c.call(t, d);
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
let
|
|
15
|
-
n = n || event,
|
|
16
|
-
},
|
|
17
|
-
if (!
|
|
13
|
+
const q = (t, x) => {
|
|
14
|
+
let c, d, m, u, s, f, a, l, v, o, y, k = function(n) {
|
|
15
|
+
n = n || event, c = n.currentTarget.offsetLeft, d = n.currentTarget.offsetTop, m = n.clientX, u = n.clientY, s = !0, f = 0, a = document.documentElement.clientWidth, l = 0, v = document.documentElement.clientHeight, o = t.offsetHeight, y = t.offsetWidth, n.stopPropagation(), n.preventDefault();
|
|
16
|
+
}, w = function(n) {
|
|
17
|
+
if (!s)
|
|
18
18
|
return;
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
o = t.offsetHeight, y = t.offsetWidth;
|
|
20
|
+
const S = document.getElementById("ai-chat-window-ele");
|
|
21
|
+
S && S.style && S.style.display !== "none" && (S.style.display = "none"), $ = !0, n = n || event;
|
|
22
|
+
let h = n.clientX, M = n.clientY, I = c + (h - m), b = d + (M - u), D = I, H = I + y, L = b, i = b + o;
|
|
23
|
+
a - H < 0 ? (I = a - y + 20, x("right")) : x(""), D - f < 0 && (I = f), L - l < 0 ? b = l : v - i < 0 && (b = v - o), t.style.left = I + "px", t.style.top = b + "px";
|
|
24
|
+
}, e = function(n) {
|
|
25
|
+
s = !1, t.releaseCapture && t.releaseCapture(), setTimeout(() => {
|
|
26
|
+
$ = !1;
|
|
27
27
|
}, 100);
|
|
28
|
-
},
|
|
28
|
+
}, z = function(n) {
|
|
29
29
|
n = n || event, n.preventDefault ? n.preventDefault() : n.returnValue = !1, t.setCapture && t.setCapture();
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
},
|
|
31
|
+
r(t, "mousedown", k), r(t, "mousedown", z), r(document, "mousemove", w), r(document, "mouseup", e);
|
|
32
|
+
}, W = (t, x, c, d) => {
|
|
33
|
+
const m = window.innerHeight || document.documentElement.clientHeight, u = window.innerWidth || document.documentElement.clientWidth, s = x.getBoundingClientRect(), f = s.top, a = m - s.bottom, l = s.left, v = u - s.right;
|
|
34
|
+
s.top > parseInt(c.toString()) && s.left > parseInt(d.toString()) && (t.style.top = "", t.style.right = s.width + 24 + "px", t.style.bottom = "0px", t.style.left = ""), s.top < parseInt(c.toString()) && s.left > parseInt(d.toString()) && (t.style.top = "0px", t.style.right = s.width + 24 + "px", t.style.bottom = "", t.style.left = ""), s.top > parseInt(c.toString()) && s.left < parseInt(d.toString()) && (t.style.top = "", t.style.right = "", t.style.bottom = "0px", t.style.left = s.width + 24 + "px"), s.top < parseInt(c.toString()) && s.left < parseInt(d.toString()) && (t.style.top = "0px", t.style.right = "", t.style.bottom = "", t.style.left = s.width + 24 + "px"), l >= v ? (t.style.right = s.width + 24 + "px", t.style.left = "") : (t.style.right = "", t.style.left = s.width + 24 + "px");
|
|
35
|
+
const o = f < parseInt(c.toString()), y = a < parseInt(c.toString());
|
|
36
|
+
o && y && (f >= a ? t.style.top = -f + "px" : t.style.top = -(parseInt(c.toString()) - a - s.height) + "px");
|
|
37
|
+
}, F = (t, x = 300, c = 800, d = "right") => {
|
|
38
|
+
var m, u;
|
|
39
|
+
let s = !1, f, a;
|
|
40
|
+
console.log("direction", d), document.getElementById("window-resize-handle") && ((m = document.getElementById("window-resize-handle")) === null || m === void 0 || m.remove()), document.getElementById("resize-overlay") && ((u = document.getElementById("resize-overlay")) === null || u === void 0 || u.remove());
|
|
41
|
+
const l = document.createElement("div");
|
|
42
|
+
l.id = "window-resize-handle", l.className = "resize-handle";
|
|
43
|
+
const v = d === "left" ? "left: 0;" : "right: 0;";
|
|
44
|
+
l.style.cssText = `
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
${v}
|
|
48
|
+
width: 8px;
|
|
49
|
+
height: 100%;
|
|
50
|
+
cursor: ew-resize;
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
z-index: 100;
|
|
53
|
+
`;
|
|
54
|
+
const o = document.createElement("div");
|
|
55
|
+
o.id = "resize-overlay", o.className = "resize-overlay", o.style.cssText = `
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 0;
|
|
58
|
+
${v}
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 100%;
|
|
61
|
+
cursor: ew-resize;
|
|
62
|
+
background-color: transparent;
|
|
63
|
+
z-index: -1;
|
|
64
|
+
`, t.appendChild(l), l.appendChild(o);
|
|
65
|
+
const y = (e) => {
|
|
66
|
+
e.stopPropagation(), e.preventDefault(), s = !0, f = e.clientX, a = t.offsetWidth, l.style.backgroundColor = "rgb(234, 212, 255)", o.style.backgroundColor = "rgba(0, 0, 0, 0.05)", o.style.display = "block";
|
|
67
|
+
}, k = (e) => {
|
|
68
|
+
if (e.stopPropagation(), e.preventDefault(), !s)
|
|
69
|
+
return;
|
|
70
|
+
const z = e.clientX - f;
|
|
71
|
+
let n = d === "left" ? a - z : a + z;
|
|
72
|
+
n = Math.max(x, Math.min(c, n)), o.style.width = n + "px", t.style.width = n + "px", window.sessionStorage.setItem("chat_w", n + "px"), o.style.display = "block";
|
|
73
|
+
}, w = (e) => {
|
|
74
|
+
e.stopPropagation(), e.preventDefault(), s = !1, l.style.backgroundColor = "transparent", o.style.backgroundColor = "transparent", o.style.display = "none";
|
|
75
|
+
};
|
|
76
|
+
r(l, "click", (e) => e.stopPropagation()), r(l, "mousedown", y), r(o, "click", (e) => e.stopPropagation()), r(o, "mousedown", y), r(document, "mousemove", k), r(document, "mouseup", w), r(document, "mouseleave", w);
|
|
77
|
+
}, Z = (t, x = 300, c = 800, d = "top") => {
|
|
78
|
+
var m, u;
|
|
79
|
+
let s = !1, f, a;
|
|
80
|
+
console.log("direction", d), document.getElementById("window-resize-handle-vertical") && ((m = document.getElementById("window-resize-handle-vertical")) === null || m === void 0 || m.remove()), document.getElementById("resize-overlay-vertical") && ((u = document.getElementById("resize-overlay-vertical")) === null || u === void 0 || u.remove());
|
|
81
|
+
const l = document.createElement("div");
|
|
82
|
+
l.id = "window-resize-handle-vertical", l.className = "resize-handle-vertical";
|
|
83
|
+
const v = d === "top" ? "top: 0;" : "bottom: 0;";
|
|
84
|
+
l.style.cssText = `
|
|
85
|
+
position: absolute;
|
|
86
|
+
left: 0;
|
|
87
|
+
right: 0;
|
|
88
|
+
${v}
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 8px;
|
|
91
|
+
cursor: ns-resize;
|
|
92
|
+
background-color: transparent;
|
|
93
|
+
z-index: 1000;
|
|
94
|
+
`;
|
|
95
|
+
const o = document.createElement("div");
|
|
96
|
+
o.id = "resize-overlay-vertical", o.className = "resize-overlay-vertical", o.style.cssText = `
|
|
97
|
+
position: absolute;
|
|
98
|
+
left: 0;
|
|
99
|
+
${v}
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
cursor: ns-resize;
|
|
103
|
+
background-color: transparent;
|
|
104
|
+
z-index: 10;
|
|
105
|
+
`, t.appendChild(l), l.appendChild(o);
|
|
106
|
+
const y = (e) => {
|
|
107
|
+
e.stopPropagation(), e.preventDefault(), s = !0, f = e.clientY, a = t.offsetHeight, l.style.backgroundColor = "rgb(234, 212, 255)", o.style.backgroundColor = "rgba(0, 0, 0, 0.05)", o.style.display = "block";
|
|
108
|
+
}, k = (e) => {
|
|
109
|
+
if (e.stopPropagation(), e.preventDefault(), !s)
|
|
110
|
+
return;
|
|
111
|
+
const z = e.clientY - f;
|
|
112
|
+
let n = d === "top" ? a - z : a + z;
|
|
113
|
+
n = Math.max(x, Math.min(c, n)), o.style.height = n + "px", t.style.height = n + "px", window.sessionStorage.setItem("chat_h", n + "px"), o.style.display = "block";
|
|
114
|
+
}, w = (e) => {
|
|
115
|
+
e.stopPropagation(), e.preventDefault(), s = !1, l.style.backgroundColor = "transparent", o.style.backgroundColor = "transparent", o.style.display = "none";
|
|
116
|
+
};
|
|
117
|
+
r(l, "click", (e) => e.stopPropagation()), r(l, "mousedown", y), r(o, "click", (e) => e.stopPropagation()), r(o, "mousedown", y), r(document, "mousemove", k), r(document, "mouseup", w), r(document, "mouseleave", w);
|
|
118
|
+
}, N = () => {
|
|
33
119
|
const t = window.chatConfig;
|
|
34
120
|
if (!t)
|
|
35
121
|
return;
|
|
36
|
-
const c = t.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
t.type;
|
|
40
|
-
const b = t.header, l = t.iconContainerStyle, g = r ? "cvforcepd" : "cvforce", m = window.location.hash.includes("/embed/application") || window.location.hash.includes("/agent/application") || window.location.hash.includes("/aecpilot/application");
|
|
41
|
-
if (c) {
|
|
42
|
-
if (m)
|
|
122
|
+
const x = t.token, c = t.iconUrl, d = t.isMaximizeVisible, m = t.isCloseVisible, u = t.isDev, s = t.isTest, f = t.header, a = t.iconContainerStyle, l = u ? "cvforcepd" : "cvforce", v = window.location.hash.includes("/embed/application") || window.location.hash.includes("/agent/application") || window.location.hash.includes("/aecpilot/application");
|
|
123
|
+
if (x) {
|
|
124
|
+
if (v)
|
|
43
125
|
return;
|
|
44
|
-
const
|
|
126
|
+
const o = t.url, y = window.sessionStorage.getItem("chat_w") || t.width || "380px", k = window.sessionStorage.getItem("chat_h") || t.height || "600px", w = (t == null ? void 0 : t.minWidth) || "300px", e = t.maxWidth || "800px";
|
|
127
|
+
window.sessionStorage.setItem("chat_w", y), window.sessionStorage.setItem("chat_h", k);
|
|
128
|
+
const z = u || s ? "aiot-dev" : "copilot", n = t.baseUrl || `https://${z}.glodon.com`, S = c ? `<img style='width: 100%' src='${c}' />` : U;
|
|
45
129
|
if (!document.getElementById("ai-chat-pannel-ele")) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
if (typeof
|
|
51
|
-
|
|
52
|
-
else if (typeof
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
},
|
|
57
|
-
|
|
130
|
+
const h = document.createElement("div");
|
|
131
|
+
h.id = "ai-chat-pannel-ele";
|
|
132
|
+
const M = "box-sizing: border-box; position: fixed; bottom: 72px; right: 24px; width: 40px; height: 40px; border-radius: 50%; background-color: #fff; filter: drop-shadow(0px 1px 10px rgba(0, 0, 0, 0.05)) drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.08)) drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.12)); cursor: pointer; z-index: 2147483647;";
|
|
133
|
+
if (a) {
|
|
134
|
+
if (typeof a == "string")
|
|
135
|
+
h.style.cssText = M + a;
|
|
136
|
+
else if (typeof a == "object") {
|
|
137
|
+
const L = Object.entries(a).reduce((i, [g, C]) => {
|
|
138
|
+
const _ = g.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
139
|
+
return i += `${_}:${C};`, i;
|
|
140
|
+
}, M);
|
|
141
|
+
h.style.cssText = L;
|
|
58
142
|
}
|
|
59
143
|
} else
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
let
|
|
67
|
-
switch (
|
|
144
|
+
h.style.cssText = M;
|
|
145
|
+
const I = document.createElement("div");
|
|
146
|
+
I.className = "handler-btn";
|
|
147
|
+
const b = document.createElement("div");
|
|
148
|
+
b.className = "action-btn", b.style.cssText = "display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;box-sizing: border-box; padding: 6px;", b.innerHTML = S, I.appendChild(b);
|
|
149
|
+
const D = (L) => {
|
|
150
|
+
let i;
|
|
151
|
+
switch (L) {
|
|
68
152
|
case "left":
|
|
69
|
-
|
|
153
|
+
i = O;
|
|
70
154
|
break;
|
|
71
155
|
case "right":
|
|
72
|
-
|
|
156
|
+
i = j;
|
|
73
157
|
break;
|
|
74
158
|
case "top":
|
|
75
|
-
|
|
159
|
+
i = X;
|
|
76
160
|
break;
|
|
77
161
|
case "bottom":
|
|
78
|
-
|
|
162
|
+
i = Y;
|
|
79
163
|
break;
|
|
80
164
|
default:
|
|
81
|
-
|
|
165
|
+
i = S;
|
|
82
166
|
}
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
if (
|
|
167
|
+
b.innerHTML = L ? `<div class="minify-${L}" style="display: flex;left: 2px;position: absolute;">${i}</div>` : i;
|
|
168
|
+
}, H = document.createElement("div");
|
|
169
|
+
H.innerHTML = "x", H.className = "minify-btn", H.addEventListener("click", (L) => {
|
|
170
|
+
h.style.left = document.body.clientWidth - parseInt(h.style.width) / 2 + "px", D("right");
|
|
171
|
+
const i = document.getElementById("ai-chat-window-ele");
|
|
172
|
+
i && i.style && i.style.display !== "none" && (i.style.display = "none"), L.stopPropagation();
|
|
173
|
+
}), I.appendChild(H), h.appendChild(I), document.body.appendChild(h), h.addEventListener("click", function(L) {
|
|
174
|
+
if ($)
|
|
91
175
|
return;
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
|
|
176
|
+
const i = document.getElementById("ai-chat-window-ele");
|
|
177
|
+
if (i)
|
|
178
|
+
if (i.style.display === "none") {
|
|
179
|
+
i.style.display = "block", W(i, h, parseInt(i.style.height), parseInt(i.style.width));
|
|
180
|
+
const C = (parseInt(i.style.left) || 0) > 0 ? "right" : "left";
|
|
181
|
+
F(i, parseInt(w.toString()), parseInt(e.toString()), C);
|
|
182
|
+
const V = i.style.top ? "bottom" : "top";
|
|
183
|
+
Z(i, parseInt(w.toString()), parseInt(e.toString()), V);
|
|
184
|
+
} else
|
|
185
|
+
i.style.display = "none";
|
|
95
186
|
else {
|
|
96
|
-
const
|
|
97
|
-
|
|
187
|
+
const g = document.createElement("div");
|
|
188
|
+
g.onclick = (p) => {
|
|
189
|
+
p.stopPropagation(), p.preventDefault();
|
|
190
|
+
}, g.id = "ai-chat-window-ele", g.style.cssText = `
|
|
98
191
|
border: none;
|
|
99
192
|
position: absolute;
|
|
100
|
-
${o.top < Number(p) ? "top: 55px;" : "bottom: 55px;"}
|
|
101
|
-
${o.left < Number(f) ? "left: 0;" : "right: 0;"}
|
|
102
193
|
border-radius: 4px;
|
|
103
|
-
width: ${
|
|
104
|
-
height: ${
|
|
194
|
+
width: ${y};
|
|
195
|
+
height: ${k};
|
|
105
196
|
box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.05), 0px 4px 5px 0px rgba(0, 0, 0, 0.08), 0px 2px 4px -1px rgba(0, 0, 0, 0.12);
|
|
106
197
|
user-select: none;
|
|
107
198
|
background: #fff;
|
|
108
|
-
z-index: 2147483647
|
|
199
|
+
z-index: 2147483647;
|
|
200
|
+
`;
|
|
201
|
+
const C = document.createElement("iframe");
|
|
202
|
+
g.appendChild(C), C.id = "ai-chat-window-iframe-ele", C.src = o || `${n}/portal/_/${l}/fe/embedaecpilot/?token=${x}${f === !1 ? "&header=false" : ""}&t=${Date.now()}`, C.width = "100%", C.height = "100%", C.style.border = "none", C.allowFullscreen = !0, h.appendChild(g), W(g, h, parseInt(g.style.height), parseInt(g.style.width));
|
|
203
|
+
const V = (parseInt(g.style.left) || 0) > 0 ? "right" : "left";
|
|
204
|
+
F(g, parseInt(w.toString()), parseInt(e.toString()), V);
|
|
205
|
+
const R = g.style.top ? "bottom" : "top";
|
|
206
|
+
Z(g, parseInt(w.toString()), parseInt(e.toString()), R);
|
|
207
|
+
const P = document.createElement("div");
|
|
208
|
+
P.style.cssText = `
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: 16px;
|
|
211
|
+
right: 16px;
|
|
212
|
+
display: flex;
|
|
213
|
+
z-index: 10;
|
|
214
|
+
|
|
215
|
+
`, P.onclick = (p) => {
|
|
216
|
+
p.stopPropagation(), p.preventDefault();
|
|
217
|
+
};
|
|
218
|
+
const B = document.createElement("div");
|
|
219
|
+
B.style.cssText = `
|
|
220
|
+
width: 24px;
|
|
221
|
+
height: 24px;
|
|
222
|
+
border: none;
|
|
223
|
+
border-radius: 4px;
|
|
224
|
+
cursor: pointer;
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
background-color: white;
|
|
229
|
+
margin-right: 8px;
|
|
230
|
+
`, B.innerHTML = A, B.onclick = (p) => {
|
|
231
|
+
p.stopPropagation(), p.preventDefault(), g.style.width = "800px", window.sessionStorage.setItem("chat_w", "800px"), g.style.height = "600px", window.sessionStorage.setItem("chat_h", "600px");
|
|
232
|
+
};
|
|
233
|
+
const T = document.createElement("div");
|
|
234
|
+
T.style.cssText = `
|
|
235
|
+
width: 24px;
|
|
236
|
+
height: 24px;
|
|
237
|
+
border: none;
|
|
238
|
+
border-radius: 4px;
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
justify-content: center;
|
|
243
|
+
color: white;
|
|
244
|
+
background-color: white;
|
|
245
|
+
`, T.innerHTML = K, T.onclick = (p) => {
|
|
246
|
+
p.stopPropagation(), p.preventDefault();
|
|
247
|
+
const E = document.getElementById("ai-chat-window-ele");
|
|
248
|
+
E && E.style && E.style.display !== "none" && (E.style.display = "none");
|
|
249
|
+
}, r(P, "mousedown", (p) => {
|
|
250
|
+
p.stopPropagation(), p.preventDefault();
|
|
251
|
+
}), r(B, "mousedown", (p) => {
|
|
252
|
+
p.stopPropagation(), p.preventDefault();
|
|
253
|
+
}), r(T, "mousedown", (p) => {
|
|
254
|
+
p.stopPropagation(), p.preventDefault();
|
|
255
|
+
}), d && P.appendChild(B), m && P.appendChild(T), (d || m) && g.appendChild(P);
|
|
109
256
|
}
|
|
110
|
-
|
|
111
|
-
}),
|
|
257
|
+
b.innerHTML = S, parseInt(h.style.left) + parseInt(h.style.width) > document.body.clientWidth && (h.style.left = "");
|
|
258
|
+
}), q(h, D);
|
|
112
259
|
}
|
|
113
260
|
} else
|
|
114
261
|
console.error("请配置token和applicationId");
|
|
115
262
|
};
|
|
116
|
-
document.readyState == "complete" ?
|
|
263
|
+
document.readyState == "complete" ? N() : document.body.onload = N;
|
package/dist/embed.umd.cjs
CHANGED
|
@@ -1,17 +1,82 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".handler-btn{width:100%;height:100%}.handler-btn .minify-btn{width:10px;height:10px;background:rgba(0,0,0,.3);display:none;border-radius:5px;font-size:8px;text-align:center;position:absolute;left:0;top:0;line-height:10px}.handler-btn .minify-btn:hover,.handler-btn .minify-btn:active{background:rgba(0,0,0,.6)}.handler-btn .action-btn:has(.minify-right)+.minify-btn{display:none}.handler-btn:hover,.handler-btn:hover .minify-btn{display:block}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
(function(
|
|
2
|
+
(function(D){typeof define=="function"&&define.amd?define(D):D()})(function(){"use strict";const D=`<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26" fill="none">
|
|
3
3
|
<path d="M21.4914 2.03125H10.482C8.45078 2.03125 6.78516 3.69687 6.78516 5.76875V14.1781C6.78516 16.25 8.45078 17.9156 10.482 17.9156H16.982L19.582 20.3125C20.3133 21.0031 21.5727 20.5156 21.5727 19.5V17.875C23.5633 17.875 25.1883 16.2094 25.1883 14.1781V5.76875C25.1883 3.69687 23.5227 2.03125 21.4914 2.03125Z" fill="#9C24F2"/>
|
|
4
4
|
<path d="M15.5187 5.36249H4.50937C2.47812 5.36249 0.8125 7.02811 0.8125 9.09999V17.5094C0.8125 19.5406 2.4375 21.2062 4.42812 21.2469V22.8719C4.42812 23.8875 5.6875 24.375 6.41875 23.6844L9.01875 21.2875H15.5187C17.55 21.2875 19.2156 19.6219 19.2156 17.55V9.09999C19.2156 7.02811 17.55 5.36249 15.5187 5.36249Z" fill="#C47DFF"/>
|
|
5
5
|
<path d="M10.5619 11.7406H5.72754C5.28066 11.7406 4.91504 11.375 4.91504 10.9281V10.6844C4.91504 10.2375 5.28066 9.87189 5.72754 9.87189H10.5619C11.0088 9.87189 11.3744 10.2375 11.3744 10.6844V10.9281C11.3744 11.375 11.0088 11.7406 10.5619 11.7406ZM13.3244 15.6H5.72754C5.28066 15.6 4.91504 15.2344 4.91504 14.7875V14.5438C4.91504 14.0969 5.28066 13.7313 5.72754 13.7313H13.2838C13.7307 13.7313 14.0963 14.0969 14.0963 14.5438V14.7875C14.1369 15.2344 13.7713 15.6 13.3244 15.6Z" fill="white"/>
|
|
6
|
-
</svg>`,
|
|
6
|
+
</svg>`,U='<svg t="1728647045306" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2120" width="16" height="16"><path d="M489.344 705.28L148.032 363.968l45.248-45.248L512 637.44l318.72-318.72 45.248 45.248-341.376 341.312a32 32 0 0 1-45.248 0z" p-id="2121"></path></svg>',X='<svg t="1728647093338" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2262" width="16" height="16"><path d="M534.656 318.72l341.312 341.312-45.248 45.248L512 386.56 193.28 705.28l-45.248-45.248L489.408 318.72a32 32 0 0 1 45.248 0z" p-id="2263"></path></svg>',Y='<svg t="1728647153848" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1960" width="16" height="16"><path d="M318.72 489.344L660.032 148.032l45.248 45.248L386.56 512l318.72 318.72-45.248 45.248-341.312-341.376a32 32 0 0 1 0-45.248z" p-id="1961"></path></svg>',j='<svg t="1728647222368" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1851" width="16" height="16"><path d="M705.28 534.656L363.968 875.968l-45.248-45.248L637.44 512l-318.72-318.72 45.248-45.248 341.312 341.376a32 32 0 0 1 0 45.248z" p-id="1852"></path></svg>',O='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="12" height="12" viewBox="0 0 12 12"><defs><clipPath id="master_svg0_804_137003"><rect x="0" y="0" width="12" height="12" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_804_137003)"><g><path d="M11.45450115625,0.95450129625L11.45450115625,3.72159265625C11.45450115625,3.94752715625,11.27134515625,4.13068345625,11.04541015625,4.13068345625C10.81947615625,4.13068345625,10.63632015625,3.94752715625,10.63632015625,3.72159265625L10.63632015625,1.94177405625L7.47377395625,5.10431955625C7.31430575625,5.26444385625,7.05506035625,5.26444385625,6.89559225625,5.10431955625C6.73570915625,4.94453855625,6.73570915625,4.68537375625,6.89559225625,4.52559235625L10.05759235625,1.36359214625L8.27832035625,1.36359214625C8.05238535625,1.36344140625,7.86935135625,1.18016290625,7.86950205625,0.95422825625C7.86965325625,0.72829346625,8.05293175625,0.5452595055,8.27886585625,0.54541029036046L11.04541215625,0.54541029036046C11.27134615625,0.54541069269186,11.45450215625,0.72856677625,11.45450115625,0.95450129625ZM4.52668335625,6.89504765625L1.36359226625,10.05759335625L1.36359226625,8.27722935625C1.36344152625,8.05129435625,1.18016302625,7.86826035625,0.95422839625,7.86841155625C0.72829367625,7.86856225625,0.54525968432,8.05184075625,0.54541046917439,8.277775256249999L0.54541046917439,11.04541215625C0.5454104244709,11.27134715625,0.7285666362500001,11.45450315625,0.95450132625,11.45450315625L3.72213765625,11.45450315625C3.94807245625,11.45450315625,4.13122845625,11.27134715625,4.13122845625,11.04541215625C4.13122845625,10.81947715625,3.94807245625,10.63632115625,3.72213765625,10.63632115625L1.94231965625,10.63632115625L5.10541055625,7.47323035625C5.26984695625,7.31426045625,5.27200695625,7.05135485625,5.11020465625,6.88970465625C4.94840235625,6.72805495625,4.68549825625,6.73046255625,4.52668335625,6.89504765625ZM1.94231965625,1.36359214625L3.72268345625,1.36359214625C3.94867345625,1.36351954625,4.13179345625,1.18021839625,4.131643056250001,0.95422860625C4.13149265625,0.72823870625,3.94812775625,0.54518176614,3.72213795625,0.54541037976743L0.95450144625,0.54541037976743C0.72856671625,0.54541033506395,0.54541051387787,0.72856655625,0.54541055858135,0.95450129625L0.54541055858135,3.72159265625C0.54548856616,3.94747205625,0.72862192625,4.13054225625,0.95450144625,4.13054225625C1.18038099625,4.13054225625,1.36351430625,3.94747205625,1.36359244625,3.72159265625L1.36359244625,1.94177405625L4.52668335625,5.10431955625C4.68615195625,5.26444335625,4.94539685625,5.26444335625,5.10486505625,5.10431955625C5.26474855625,4.94453855625,5.26474855625,4.68537375625,5.10486505625,4.52559235625L1.94231965625,1.36359214625ZM11.04541115625,7.86868385625C10.81947715625,7.86868335625,10.63632015625,8.05183935625,10.63632015625,8.277775256249999L10.63632015625,10.05813885625L7.47377395625,6.89504765625C7.31399915625,6.73502585625,7.05472185625,6.73492575625,6.89482305625,6.89482405625C6.73492525625,7.05472275625,6.73502535625,7.31400015625,6.89504715625,7.47377495625L10.05759235625,10.63686515625L8.27832035625,10.63686515625C8.04667905625,10.62855915625,7.85441495625,10.81417615625,7.85456945625,11.04596715625C7.85472395625,11.27775715625,8.04723545625,11.46311715625,8.27886535625,11.45450215625L11.04541115625,11.45450215625C11.27134615625,11.45450215625,11.45450215625,11.27134615625,11.45450215625,11.04541115625L11.45450215625,8.27777435625C11.45450115625,8.05183935625,11.27134615625,7.86868335625,11.04541115625,7.86868385625Z" fill="#6F6F6F" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>',A='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><defs><clipPath id="master_svg0_804_137006"><rect x="0" y="0" width="16" height="16" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_804_137006)"><g transform="matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,6.067118670641264,-7.980327525384439)"><path d="M12.166666984558105,16.53280909375L12.166666984558105,3.33349609375L13.166666984558105,3.33349609375L13.166666984558105,16.53280909375L12.166666984558105,16.53280909375Z" fill-rule="evenodd" fill="#6F6F6F" fill-opacity="1"/></g><g transform="matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,3.3334484688798227,-1.3806642348668277)"><path d="M16.532646492279053,3.83349609375L3.3333334922790527,3.83349609375L3.3333334922790527,2.83349609375L16.532646492279053,2.83349609375L16.532646492279053,3.83349609375Z" fill-rule="evenodd" fill="#6F6F6F" fill-opacity="1"/></g></g></svg>',G="";let V=!1;function a(t,x,c){t.addEventListener?t.addEventListener(x,c,!1):t.attachEvent("on"+x,function(d){return c.call(t,d)})}const K=(t,x)=>{let c,d,m,u,s,f,r,l,v,o,y,k=function(n){n=n||event,c=n.currentTarget.offsetLeft,d=n.currentTarget.offsetTop,m=n.clientX,u=n.clientY,s=!0,f=0,r=document.documentElement.clientWidth,l=0,v=document.documentElement.clientHeight,o=t.offsetHeight,y=t.offsetWidth,n.stopPropagation(),n.preventDefault()},w=function(n){if(!s)return;o=t.offsetHeight,y=t.offsetWidth;const S=document.getElementById("ai-chat-window-ele");S&&S.style&&S.style.display!=="none"&&(S.style.display="none"),V=!0,n=n||event;let h=n.clientX,M=n.clientY,I=c+(h-m),b=d+(M-u),E=I,H=I+y,L=b,i=b+o;r-H<0?(I=r-y+20,x("right")):x(""),E-f<0&&(I=f),L-l<0?b=l:v-i<0&&(b=v-o),t.style.left=I+"px",t.style.top=b+"px"},e=function(n){s=!1,t.releaseCapture&&t.releaseCapture(),setTimeout(()=>{V=!1},100)},z=function(n){n=n||event,n.preventDefault?n.preventDefault():n.returnValue=!1,t.setCapture&&t.setCapture()};a(t,"mousedown",k),a(t,"mousedown",z),a(document,"mousemove",w),a(document,"mouseup",e)},F=(t,x,c,d)=>{const m=window.innerHeight||document.documentElement.clientHeight,u=window.innerWidth||document.documentElement.clientWidth,s=x.getBoundingClientRect(),f=s.top,r=m-s.bottom,l=s.left,v=u-s.right;s.top>parseInt(c.toString())&&s.left>parseInt(d.toString())&&(t.style.top="",t.style.right=s.width+24+"px",t.style.bottom="0px",t.style.left=""),s.top<parseInt(c.toString())&&s.left>parseInt(d.toString())&&(t.style.top="0px",t.style.right=s.width+24+"px",t.style.bottom="",t.style.left=""),s.top>parseInt(c.toString())&&s.left<parseInt(d.toString())&&(t.style.top="",t.style.right="",t.style.bottom="0px",t.style.left=s.width+24+"px"),s.top<parseInt(c.toString())&&s.left<parseInt(d.toString())&&(t.style.top="0px",t.style.right="",t.style.bottom="",t.style.left=s.width+24+"px"),l>=v?(t.style.right=s.width+24+"px",t.style.left=""):(t.style.right="",t.style.left=s.width+24+"px");const o=f<parseInt(c.toString()),y=r<parseInt(c.toString());o&&y&&(f>=r?t.style.top=-f+"px":t.style.top=-(parseInt(c.toString())-r-s.height)+"px")},Z=(t,x=300,c=800,d="right")=>{var m,u;let s=!1,f,r;console.log("direction",d),document.getElementById("window-resize-handle")&&((m=document.getElementById("window-resize-handle"))===null||m===void 0||m.remove()),document.getElementById("resize-overlay")&&((u=document.getElementById("resize-overlay"))===null||u===void 0||u.remove());const l=document.createElement("div");l.id="window-resize-handle",l.className="resize-handle";const v=d==="left"?"left: 0;":"right: 0;";l.style.cssText=`
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0;
|
|
9
|
+
${v}
|
|
10
|
+
width: 8px;
|
|
11
|
+
height: 100%;
|
|
12
|
+
cursor: ew-resize;
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
z-index: 100;
|
|
15
|
+
`;const o=document.createElement("div");o.id="resize-overlay",o.className="resize-overlay",o.style.cssText=`
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 0;
|
|
18
|
+
${v}
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
cursor: ew-resize;
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
z-index: -1;
|
|
24
|
+
`,t.appendChild(l),l.appendChild(o);const y=e=>{e.stopPropagation(),e.preventDefault(),s=!0,f=e.clientX,r=t.offsetWidth,l.style.backgroundColor="rgb(234, 212, 255)",o.style.backgroundColor="rgba(0, 0, 0, 0.05)",o.style.display="block"},k=e=>{if(e.stopPropagation(),e.preventDefault(),!s)return;const z=e.clientX-f;let n=d==="left"?r-z:r+z;n=Math.max(x,Math.min(c,n)),o.style.width=n+"px",t.style.width=n+"px",window.sessionStorage.setItem("chat_w",n+"px"),o.style.display="block"},w=e=>{e.stopPropagation(),e.preventDefault(),s=!1,l.style.backgroundColor="transparent",o.style.backgroundColor="transparent",o.style.display="none"};a(l,"click",e=>e.stopPropagation()),a(l,"mousedown",y),a(o,"click",e=>e.stopPropagation()),a(o,"mousedown",y),a(document,"mousemove",k),a(document,"mouseup",w),a(document,"mouseleave",w)},N=(t,x=300,c=800,d="top")=>{var m,u;let s=!1,f,r;console.log("direction",d),document.getElementById("window-resize-handle-vertical")&&((m=document.getElementById("window-resize-handle-vertical"))===null||m===void 0||m.remove()),document.getElementById("resize-overlay-vertical")&&((u=document.getElementById("resize-overlay-vertical"))===null||u===void 0||u.remove());const l=document.createElement("div");l.id="window-resize-handle-vertical",l.className="resize-handle-vertical";const v=d==="top"?"top: 0;":"bottom: 0;";l.style.cssText=`
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
${v}
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 8px;
|
|
31
|
+
cursor: ns-resize;
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
z-index: 1000;
|
|
34
|
+
`;const o=document.createElement("div");o.id="resize-overlay-vertical",o.className="resize-overlay-vertical",o.style.cssText=`
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 0;
|
|
37
|
+
${v}
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
cursor: ns-resize;
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
z-index: 10;
|
|
43
|
+
`,t.appendChild(l),l.appendChild(o);const y=e=>{e.stopPropagation(),e.preventDefault(),s=!0,f=e.clientY,r=t.offsetHeight,l.style.backgroundColor="rgb(234, 212, 255)",o.style.backgroundColor="rgba(0, 0, 0, 0.05)",o.style.display="block"},k=e=>{if(e.stopPropagation(),e.preventDefault(),!s)return;const z=e.clientY-f;let n=d==="top"?r-z:r+z;n=Math.max(x,Math.min(c,n)),o.style.height=n+"px",t.style.height=n+"px",window.sessionStorage.setItem("chat_h",n+"px"),o.style.display="block"},w=e=>{e.stopPropagation(),e.preventDefault(),s=!1,l.style.backgroundColor="transparent",o.style.backgroundColor="transparent",o.style.display="none"};a(l,"click",e=>e.stopPropagation()),a(l,"mousedown",y),a(o,"click",e=>e.stopPropagation()),a(o,"mousedown",y),a(document,"mousemove",k),a(document,"mouseup",w),a(document,"mouseleave",w)},R=()=>{const t=window.chatConfig;if(!t)return;const x=t.token,c=t.iconUrl,d=t.isMaximizeVisible,m=t.isCloseVisible,u=t.isDev,s=t.isTest,f=t.header,r=t.iconContainerStyle,l=u?"cvforcepd":"cvforce",v=window.location.hash.includes("/embed/application")||window.location.hash.includes("/agent/application")||window.location.hash.includes("/aecpilot/application");if(x){if(v)return;const o=t.url,y=window.sessionStorage.getItem("chat_w")||t.width||"380px",k=window.sessionStorage.getItem("chat_h")||t.height||"600px",w=(t==null?void 0:t.minWidth)||"300px",e=t.maxWidth||"800px";window.sessionStorage.setItem("chat_w",y),window.sessionStorage.setItem("chat_h",k);const z=u||s?"aiot-dev":"copilot",n=t.baseUrl||`https://${z}.glodon.com`,S=c?`<img style='width: 100%' src='${c}' />`:D;if(!document.getElementById("ai-chat-pannel-ele")){const h=document.createElement("div");h.id="ai-chat-pannel-ele";const M="box-sizing: border-box; position: fixed; bottom: 72px; right: 24px; width: 40px; height: 40px; border-radius: 50%; background-color: #fff; filter: drop-shadow(0px 1px 10px rgba(0, 0, 0, 0.05)) drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.08)) drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.12)); cursor: pointer; z-index: 2147483647;";if(r){if(typeof r=="string")h.style.cssText=M+r;else if(typeof r=="object"){const L=Object.entries(r).reduce((i,[g,C])=>{const $=g.replace(/([A-Z])/g,"-$1").toLowerCase();return i+=`${$}:${C};`,i},M);h.style.cssText=L}}else h.style.cssText=M;const I=document.createElement("div");I.className="handler-btn";const b=document.createElement("div");b.className="action-btn",b.style.cssText="display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;box-sizing: border-box; padding: 6px;",b.innerHTML=S,I.appendChild(b);const E=L=>{let i;switch(L){case"left":i=j;break;case"right":i=Y;break;case"top":i=U;break;case"bottom":i=X;break;default:i=S}b.innerHTML=L?`<div class="minify-${L}" style="display: flex;left: 2px;position: absolute;">${i}</div>`:i},H=document.createElement("div");H.innerHTML="x",H.className="minify-btn",H.addEventListener("click",L=>{h.style.left=document.body.clientWidth-parseInt(h.style.width)/2+"px",E("right");const i=document.getElementById("ai-chat-window-ele");i&&i.style&&i.style.display!=="none"&&(i.style.display="none"),L.stopPropagation()}),I.appendChild(H),h.appendChild(I),document.body.appendChild(h),h.addEventListener("click",function(L){if(V)return;const i=document.getElementById("ai-chat-window-ele");if(i)if(i.style.display==="none"){i.style.display="block",F(i,h,parseInt(i.style.height),parseInt(i.style.width));const C=(parseInt(i.style.left)||0)>0?"right":"left";Z(i,parseInt(w.toString()),parseInt(e.toString()),C);const W=i.style.top?"bottom":"top";N(i,parseInt(w.toString()),parseInt(e.toString()),W)}else i.style.display="none";else{const g=document.createElement("div");g.onclick=p=>{p.stopPropagation(),p.preventDefault()},g.id="ai-chat-window-ele",g.style.cssText=`
|
|
7
44
|
border: none;
|
|
8
45
|
position: absolute;
|
|
9
|
-
${o.top<Number(p)?"top: 55px;":"bottom: 55px;"}
|
|
10
|
-
${o.left<Number(f)?"left: 0;":"right: 0;"}
|
|
11
46
|
border-radius: 4px;
|
|
12
|
-
width: ${
|
|
13
|
-
height: ${
|
|
47
|
+
width: ${y};
|
|
48
|
+
height: ${k};
|
|
14
49
|
box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.05), 0px 4px 5px 0px rgba(0, 0, 0, 0.08), 0px 2px 4px -1px rgba(0, 0, 0, 0.12);
|
|
15
50
|
user-select: none;
|
|
16
51
|
background: #fff;
|
|
17
|
-
z-index: 2147483647
|
|
52
|
+
z-index: 2147483647;
|
|
53
|
+
`;const C=document.createElement("iframe");g.appendChild(C),C.id="ai-chat-window-iframe-ele",C.src=o||`${n}/portal/_/${l}/fe/embedaecpilot/?token=${x}${f===!1?"&header=false":""}&t=${Date.now()}`,C.width="100%",C.height="100%",C.style.border="none",C.allowFullscreen=!0,h.appendChild(g),F(g,h,parseInt(g.style.height),parseInt(g.style.width));const W=(parseInt(g.style.left)||0)>0?"right":"left";Z(g,parseInt(w.toString()),parseInt(e.toString()),W);const q=g.style.top?"bottom":"top";N(g,parseInt(w.toString()),parseInt(e.toString()),q);const P=document.createElement("div");P.style.cssText=`
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 16px;
|
|
56
|
+
right: 16px;
|
|
57
|
+
display: flex;
|
|
58
|
+
z-index: 10;
|
|
59
|
+
|
|
60
|
+
`,P.onclick=p=>{p.stopPropagation(),p.preventDefault()};const B=document.createElement("div");B.style.cssText=`
|
|
61
|
+
width: 24px;
|
|
62
|
+
height: 24px;
|
|
63
|
+
border: none;
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
background-color: white;
|
|
70
|
+
margin-right: 8px;
|
|
71
|
+
`,B.innerHTML=O,B.onclick=p=>{p.stopPropagation(),p.preventDefault(),g.style.width="800px",window.sessionStorage.setItem("chat_w","800px"),g.style.height="600px",window.sessionStorage.setItem("chat_h","600px")};const T=document.createElement("div");T.style.cssText=`
|
|
72
|
+
width: 24px;
|
|
73
|
+
height: 24px;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
color: white;
|
|
81
|
+
background-color: white;
|
|
82
|
+
`,T.innerHTML=A,T.onclick=p=>{p.stopPropagation(),p.preventDefault();const _=document.getElementById("ai-chat-window-ele");_&&_.style&&_.style.display!=="none"&&(_.style.display="none")},a(P,"mousedown",p=>{p.stopPropagation(),p.preventDefault()}),a(B,"mousedown",p=>{p.stopPropagation(),p.preventDefault()}),a(T,"mousedown",p=>{p.stopPropagation(),p.preventDefault()}),d&&P.appendChild(B),m&&P.appendChild(T),(d||m)&&g.appendChild(P)}b.innerHTML=S,parseInt(h.style.left)+parseInt(h.style.width)>document.body.clientWidth&&(h.style.left="")}),K(h,E)}}else console.error("请配置token和applicationId")};document.readyState=="complete"?R():document.body.onload=R});
|
|
@@ -3,3 +3,5 @@ export declare const minifyIconTop = "<svg t=\"1728647045306\" class=\"icon\" vi
|
|
|
3
3
|
export declare const minifyIconBottom = "<svg t=\"1728647093338\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2262\" width=\"16\" height=\"16\"><path d=\"M534.656 318.72l341.312 341.312-45.248 45.248L512 386.56 193.28 705.28l-45.248-45.248L489.408 318.72a32 32 0 0 1 45.248 0z\" p-id=\"2263\"></path></svg>";
|
|
4
4
|
export declare const minifyIconRight = "<svg t=\"1728647153848\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1960\" width=\"16\" height=\"16\"><path d=\"M318.72 489.344L660.032 148.032l45.248 45.248L386.56 512l318.72 318.72-45.248 45.248-341.312-341.376a32 32 0 0 1 0-45.248z\" p-id=\"1961\"></path></svg>";
|
|
5
5
|
export declare const minifyIconLeft = "<svg t=\"1728647222368\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1851\" width=\"16\" height=\"16\"><path d=\"M705.28 534.656L363.968 875.968l-45.248-45.248L637.44 512l-318.72-318.72 45.248-45.248 341.312 341.376a32 32 0 0 1 0 45.248z\" p-id=\"1852\"></path></svg>";
|
|
6
|
+
export declare const maximizeIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" fill=\"none\" version=\"1.1\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\"><defs><clipPath id=\"master_svg0_804_137003\"><rect x=\"0\" y=\"0\" width=\"12\" height=\"12\" rx=\"0\"/></clipPath></defs><g clip-path=\"url(#master_svg0_804_137003)\"><g><path d=\"M11.45450115625,0.95450129625L11.45450115625,3.72159265625C11.45450115625,3.94752715625,11.27134515625,4.13068345625,11.04541015625,4.13068345625C10.81947615625,4.13068345625,10.63632015625,3.94752715625,10.63632015625,3.72159265625L10.63632015625,1.94177405625L7.47377395625,5.10431955625C7.31430575625,5.26444385625,7.05506035625,5.26444385625,6.89559225625,5.10431955625C6.73570915625,4.94453855625,6.73570915625,4.68537375625,6.89559225625,4.52559235625L10.05759235625,1.36359214625L8.27832035625,1.36359214625C8.05238535625,1.36344140625,7.86935135625,1.18016290625,7.86950205625,0.95422825625C7.86965325625,0.72829346625,8.05293175625,0.5452595055,8.27886585625,0.54541029036046L11.04541215625,0.54541029036046C11.27134615625,0.54541069269186,11.45450215625,0.72856677625,11.45450115625,0.95450129625ZM4.52668335625,6.89504765625L1.36359226625,10.05759335625L1.36359226625,8.27722935625C1.36344152625,8.05129435625,1.18016302625,7.86826035625,0.95422839625,7.86841155625C0.72829367625,7.86856225625,0.54525968432,8.05184075625,0.54541046917439,8.277775256249999L0.54541046917439,11.04541215625C0.5454104244709,11.27134715625,0.7285666362500001,11.45450315625,0.95450132625,11.45450315625L3.72213765625,11.45450315625C3.94807245625,11.45450315625,4.13122845625,11.27134715625,4.13122845625,11.04541215625C4.13122845625,10.81947715625,3.94807245625,10.63632115625,3.72213765625,10.63632115625L1.94231965625,10.63632115625L5.10541055625,7.47323035625C5.26984695625,7.31426045625,5.27200695625,7.05135485625,5.11020465625,6.88970465625C4.94840235625,6.72805495625,4.68549825625,6.73046255625,4.52668335625,6.89504765625ZM1.94231965625,1.36359214625L3.72268345625,1.36359214625C3.94867345625,1.36351954625,4.13179345625,1.18021839625,4.131643056250001,0.95422860625C4.13149265625,0.72823870625,3.94812775625,0.54518176614,3.72213795625,0.54541037976743L0.95450144625,0.54541037976743C0.72856671625,0.54541033506395,0.54541051387787,0.72856655625,0.54541055858135,0.95450129625L0.54541055858135,3.72159265625C0.54548856616,3.94747205625,0.72862192625,4.13054225625,0.95450144625,4.13054225625C1.18038099625,4.13054225625,1.36351430625,3.94747205625,1.36359244625,3.72159265625L1.36359244625,1.94177405625L4.52668335625,5.10431955625C4.68615195625,5.26444335625,4.94539685625,5.26444335625,5.10486505625,5.10431955625C5.26474855625,4.94453855625,5.26474855625,4.68537375625,5.10486505625,4.52559235625L1.94231965625,1.36359214625ZM11.04541115625,7.86868385625C10.81947715625,7.86868335625,10.63632015625,8.05183935625,10.63632015625,8.277775256249999L10.63632015625,10.05813885625L7.47377395625,6.89504765625C7.31399915625,6.73502585625,7.05472185625,6.73492575625,6.89482305625,6.89482405625C6.73492525625,7.05472275625,6.73502535625,7.31400015625,6.89504715625,7.47377495625L10.05759235625,10.63686515625L8.27832035625,10.63686515625C8.04667905625,10.62855915625,7.85441495625,10.81417615625,7.85456945625,11.04596715625C7.85472395625,11.27775715625,8.04723545625,11.46311715625,8.27886535625,11.45450215625L11.04541115625,11.45450215625C11.27134615625,11.45450215625,11.45450215625,11.27134615625,11.45450215625,11.04541115625L11.45450215625,8.27777435625C11.45450115625,8.05183935625,11.27134615625,7.86868335625,11.04541115625,7.86868385625Z\" fill=\"#6F6F6F\" fill-opacity=\"1\" style=\"mix-blend-mode:passthrough\"/></g></g></svg>";
|
|
7
|
+
export declare const closeIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" fill=\"none\" version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><defs><clipPath id=\"master_svg0_804_137006\"><rect x=\"0\" y=\"0\" width=\"16\" height=\"16\" rx=\"0\"/></clipPath></defs><g clip-path=\"url(#master_svg0_804_137006)\"><g transform=\"matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,6.067118670641264,-7.980327525384439)\"><path d=\"M12.166666984558105,16.53280909375L12.166666984558105,3.33349609375L13.166666984558105,3.33349609375L13.166666984558105,16.53280909375L12.166666984558105,16.53280909375Z\" fill-rule=\"evenodd\" fill=\"#6F6F6F\" fill-opacity=\"1\"/></g><g transform=\"matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,3.3334484688798227,-1.3806642348668277)\"><path d=\"M16.532646492279053,3.83349609375L3.3333334922790527,3.83349609375L3.3333334922790527,2.83349609375L16.532646492279053,2.83349609375L16.532646492279053,3.83349609375Z\" fill-rule=\"evenodd\" fill=\"#6F6F6F\" fill-opacity=\"1\"/></g></g></svg>";
|