wi-chat 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +129 -123
- package/dist/core/useChat.d.ts +11 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +102 -74
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
- package/dist/mobile-ui/index.cjs +1 -1
- package/dist/mobile-ui/index.d.ts +1 -1
- package/dist/mobile-ui/index.js +26 -25
- package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
- package/dist/page-context/extArgs.d.ts +46 -0
- package/dist/page-context/index.cjs +2 -0
- package/dist/page-context/index.d.ts +18 -0
- package/dist/page-context/index.js +48 -0
- package/dist/page-context/state.d.ts +10 -0
- package/dist/page-context/types.d.ts +218 -0
- package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
- package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
- package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
- package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
- package/dist/parser/index.cjs +2 -2
- package/dist/parser/index.d.ts +9 -0
- package/dist/parser/index.js +537 -251
- package/dist/parser/registry.d.ts +8 -1
- package/dist/parser/title.d.ts +27 -0
- package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
- package/dist/renderers/index.cjs +1 -1
- package/dist/renderers/index.d.ts +1 -0
- package/dist/renderers/index.js +641 -354
- package/dist/renderers/style.css +1 -1
- package/dist/right-panel/RightPanel.vue.d.ts +43 -0
- package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
- package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
- package/dist/right-panel/icons.d.ts +48 -0
- package/dist/right-panel/index.cjs +2 -0
- package/dist/right-panel/index.d.ts +43 -0
- package/dist/right-panel/index.js +1004 -0
- package/dist/right-panel/panels/index.d.ts +7 -0
- package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
- package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
- package/dist/right-panel/panels/newtab/index.d.ts +4 -0
- package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
- package/dist/right-panel/panels/web/index.d.ts +4 -0
- package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
- package/dist/right-panel/registry.d.ts +24 -0
- package/dist/right-panel/runtime.d.ts +45 -0
- package/dist/right-panel/scope.d.ts +34 -0
- package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
- package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
- package/dist/right-panel/style.css +1 -0
- package/dist/right-panel/types.d.ts +363 -0
- package/dist/right-panel/useRightPanel.d.ts +39 -0
- package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +182 -162
- package/dist/tools/markdown/index.d.ts +1 -1
- package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
- package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +3 -3
- package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
- package/dist/web-ui/index.cjs +1 -1
- package/dist/web-ui/index.d.ts +1 -1
- package/dist/web-ui/index.js +301 -295
- package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
- package/dist/web-ui/style.css +1 -1
- package/package.json +13 -6
package/dist/parser/index.js
CHANGED
|
@@ -1,194 +1,450 @@
|
|
|
1
|
-
const
|
|
1
|
+
const O = () => ({
|
|
2
2
|
answer_type: "knowledge_stream_result",
|
|
3
3
|
values: [{ answer: "" }]
|
|
4
|
-
}),
|
|
4
|
+
}), P = (e) => (e.answer_type = "knowledge_stream_result", (!Array.isArray(e.values) || !e.values.length) && (e.values = [{ answer: "" }]), e), F = (e = "", t = "") => ({
|
|
5
5
|
id: e,
|
|
6
6
|
question: t,
|
|
7
7
|
answer: { reports: [] }
|
|
8
|
-
}),
|
|
8
|
+
}), ee = [
|
|
9
9
|
"knowledge_stream_begin",
|
|
10
10
|
"knowledge_stream",
|
|
11
11
|
"knowledge_stream_result",
|
|
12
12
|
"knowledge_stream_end"
|
|
13
|
-
],
|
|
14
|
-
var
|
|
15
|
-
if (!e.mode || !
|
|
13
|
+
], N = (e, t, n, r) => {
|
|
14
|
+
var l;
|
|
15
|
+
if (!e.mode || !ee.includes(e.mode))
|
|
16
16
|
return !1;
|
|
17
17
|
if (e.mode === "knowledge_stream_result" || e.mode === "knowledge_stream_end")
|
|
18
18
|
return !0;
|
|
19
|
-
const
|
|
19
|
+
const o = r == null ? void 0 : r.beforeKnowledgeRender, s = (u) => o ? o(u) : u;
|
|
20
20
|
if (e.mode === "knowledge_stream_begin") {
|
|
21
|
-
const
|
|
22
|
-
return (
|
|
21
|
+
const u = t.at(-1);
|
|
22
|
+
return (u == null ? void 0 : u.answer_type) === "knowledge_stream_result" ? (u.values = u.values ?? [], u.values.push({ answer: "" }), !0) : u && !u.answer_type ? (P(u), !0) : (t.push(O()), !0);
|
|
23
23
|
}
|
|
24
24
|
if (e.mode !== "knowledge_stream")
|
|
25
25
|
return !1;
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
const a =
|
|
29
|
-
return a.raw = c, a.answer =
|
|
30
|
-
},
|
|
26
|
+
let i = t.at(-1);
|
|
27
|
+
i && !i.answer_type ? i = P(i) : (!i || i.answer_type !== "knowledge_stream_result") && (i = O(), t.push(i)), i.values = (l = i.values) != null && l.length ? i.values : [{ answer: "" }];
|
|
28
|
+
const a = i.values[i.values.length - 1], c = `${a.raw ?? ""}${e.value || ""}`;
|
|
29
|
+
return a.raw = c, a.answer = s(c), !0;
|
|
30
|
+
}, te = (e, t) => {
|
|
31
31
|
if (Array.isArray(e.values) && e.values.length)
|
|
32
32
|
return e;
|
|
33
|
-
const n = t == null ? void 0 : t.beforeKnowledgeRender,
|
|
34
|
-
let
|
|
35
|
-
return Array.isArray(e.knowledge) && (
|
|
36
|
-
},
|
|
33
|
+
const n = t == null ? void 0 : t.beforeKnowledgeRender, r = (s) => n ? n(s) : s;
|
|
34
|
+
let o = [];
|
|
35
|
+
return Array.isArray(e.knowledge) && (o = e.knowledge.map((s) => typeof s == "string" ? s : s == null ? void 0 : s.answer).filter((s) => typeof s == "string" && s !== "")), o.length === 0 && typeof e.answer == "string" && e.answer !== "" && (o = [e.answer]), o.length && (e.values = o.map((s) => ({ answer: r(s), raw: s }))), e;
|
|
36
|
+
}, ne = {
|
|
37
37
|
id: "knowledge_stream",
|
|
38
38
|
answerType: "knowledge_stream_result",
|
|
39
|
-
applyChunk:
|
|
40
|
-
normalizeReport:
|
|
41
|
-
},
|
|
42
|
-
if (!
|
|
39
|
+
applyChunk: N,
|
|
40
|
+
normalizeReport: te
|
|
41
|
+
}, L = ["begin", "begin_stream", "send_stream", "end_stream"], re = (e, t) => {
|
|
42
|
+
if (!L.includes(e.mode || ""))
|
|
43
43
|
return !1;
|
|
44
44
|
let n = t.at(-1);
|
|
45
45
|
return (!n || n.answer_type) && (n = { exec_process: [] }, t.push(n)), n.exec_process = n.exec_process ?? [], n.exec_process.push({ mode: e.mode, type: e.type, value: e.value }), !0;
|
|
46
|
-
},
|
|
46
|
+
}, oe = (e) => {
|
|
47
47
|
const t = [];
|
|
48
|
-
let n = "",
|
|
49
|
-
for (const
|
|
50
|
-
(
|
|
48
|
+
let n = "", r = !1;
|
|
49
|
+
for (const o of (e.exec_process ?? []).filter(
|
|
50
|
+
(s) => L.includes(s.mode || "")
|
|
51
51
|
)) {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const s = typeof o.value == "string" ? o.value : "";
|
|
53
|
+
o.mode === "begin" ? (r && n.trim() && t.push(n.trim()), r = !1, n = "", s.trim() && t.push(s.trim())) : o.mode === "begin_stream" ? (r && n.trim() && t.push(n.trim()), r = !0, n = s) : o.mode === "send_stream" && r ? n += s : o.mode === "end_stream" && r && (n += s, n.trim() && t.push(n.trim()), r = !1, n = "");
|
|
54
54
|
}
|
|
55
|
-
return
|
|
56
|
-
},
|
|
55
|
+
return r && n.trim() && t.push(n.trim()), t;
|
|
56
|
+
}, R = (e) => {
|
|
57
57
|
var t;
|
|
58
|
-
return (((t = e.answer) == null ? void 0 : t.reports) ?? []).flatMap(
|
|
59
|
-
},
|
|
58
|
+
return (((t = e.answer) == null ? void 0 : t.reports) ?? []).flatMap(oe);
|
|
59
|
+
}, se = {
|
|
60
60
|
id: "deep_thinking",
|
|
61
|
-
applyChunk:
|
|
62
|
-
}, $ = '/**\n * Skipped minification because the original files appears to be already minified.\n * Original file: /npm/@iframe-resizer/child@5.1.5/index.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n/*!\n * @preserve\n * \n * @module iframe-resizer/child 5.1.5 (umd) - 2024-07-09\n *\n * @license GPL-3.0 for non-commercial use only.\n * For commercial use, you must purchase a license from\n * https://iframe-resizer.com/pricing\n * \n * @desciption Keep same and cross domain iFrames sized to their content \n *\n * @author David J. Bradshaw <info@iframe-resizer.com>\n * \n * @see {@link https://iframe-resizer.com}\n * \n * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.\n */\n\n\n!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.1.5",t=10,n="data-iframe-size",o=(e,t,n,o)=>e.addEventListener(t,n,o||!1),i=(e,t,n)=>e.removeEventListener(t,n,!1),r=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const a=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(r[e]),l={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},c={height:()=>(de("Custom height calculation function not defined"),He.auto()),width:()=>(de("Custom width calculation function not defined"),Ue.auto())},s={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},u=128,d={},m="checkVisibility"in window,f="auto",p="[iFrameSizer]",h=p.length,y={max:1,min:1,bodyScroll:1,documentElementScroll:1},g=["body"],v="scroll";let b,w,z=!0,S="",$=0,j="",E=null,P="",O=!0,M=!1,A=null,C=!0,T=!1,k=1,I=f,x=!0,N="",R={},B=!0,q=!1,L=0,W=!1,D="",H="child",U=null,F=!1,V="",J=window.parent,Z="*",Q=0,X=!1,Y="",G=1,K=v,_=window,ee=()=>{de("onMessage function not defined")},te=()=>{},ne=null,oe=null;const ie=e=>""!=`${e}`&&void 0!==e,re=new WeakSet,ae=e=>"object"==typeof e&&re.add(e);function le(e){switch(!0){case!ie(e):return"";case ie(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ie(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ie(e.className)?`.${e.className}`:"")}}function ce(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\\n"," ")}...`:e}const se=(...e)=>[`[iframe-resizer][${D}]`,...e].join(" "),ue=(...e)=>console?.info(se(...e)),de=(...e)=>console?.warn(se(...e)),me=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\\n").replaceAll("<rb>","\x1B[31;1m").replaceAll("</>","\x1B[m").replaceAll("<b>","\x1B[1m").replaceAll("<i>","\x1B[3m").replaceAll("<u>","\x1B[4m")):e(t.replaceAll("<br>","\\n").replaceAll(/<[/a-z]+>/gi,"")))(se)(...e)),fe=e=>me(e);function pe(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=N.slice(h).split(":");D=t[0],$=void 0===t[1]?$:Number(t[1]),M=void 0===t[2]?M:e(t[2]),q=void 0===t[3]?q:e(t[3]),z=void 0===t[6]?z:e(t[6]),j=t[7],I=void 0===t[8]?I:t[8],S=t[9],P=t[10],Q=void 0===t[11]?Q:Number(t[11]),R.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],K=void 0===t[14]?K:t[14],W=void 0===t[15]?W:e(t[15]),b=void 0===t[16]?b:Number(t[16]),w=void 0===t[17]?w:Number(t[17]),O=void 0===t[18]?O:e(t[18]),t[19],Y=t[20]||Y,L=void 0===t[21]?L:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;ee=e?.onMessage||ee,te=e?.onReady||te,"number"==typeof e?.offset&&(O&&(b=e?.offset),M&&(w=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(V=e.sizeSelector),Z=e?.targetOrigin||Z,I=e?.heightCalculationMethod||I,K=e?.widthCalculationMethod||K}function t(e,t){return"function"==typeof e&&(c[t]=e,e="custom"),e}if(1===L)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),I=t(I,"height"),K=t(K,"width"))}(),function(){void 0===j&&(j=`${$}px`);he("margin",function(e,t){t.includes("-")&&(de(`Negative CSS value ignored for ${e}`),t="");return t}("margin",j))}(),he("background",S),he("padding",P),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),ye(),L<0?fe(`${a(L+2)}${a(2)}`):Y.codePointAt(0)>4||L<2&&fe(a(3)),function(){if(!Y||""===Y||"false"===Y)return void me("<rb>Legacy version detected on parent page</>\\n\\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\\n\\nSee <u>https://iframe-resizer.com/setup/</> for more details.\\n");Y!==e&&me(`<rb>Version mismatch</>\\n\\nThe parent and child pages are running different versions of <i>iframe resizer</>.\\n\\nParent page: ${Y} - Child page: ${e}.\\n`)}(),ze(),Se(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.setAttribute(n,null)}));t("data-iframe-height"),t("data-iframe-width"),e&&me("<rb>Deprecated Attributes</>\\n \\nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),document.querySelectorAll(`[${n}]`).length>0&&("auto"===I&&(I="autoOverflow"),"auto"===K&&(K="autoOverflow")),be(),function(){if(1===L)return;_.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===z?(z=!0,$e()):!1===e&&!0===z&&(z=!1,ve("remove"),U?.disconnect(),E?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(z)),z),close(){Xe(0,0,"close")},getId:()=>D,getPageInfo(e){if("function"==typeof e)return ne=e,Xe(0,0,"pageInfo"),void me("<rb>Deprecated Method</>\\n \\nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n");ne=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return oe=e,Xe(0,0,"parentInfo"),()=>{oe=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){me("<rb>Renamed Method</>\\n \\nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\\n"),this.getParentProps(e)},moveToAnchor(e){R.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){I=e,ze()},setWidthCalculationMethod(e){K=e,Se()},setTargetOrigin(e){Z=e},resize(e,t){Ve("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){me("<rb>Deprecated Method</>\\n \\nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n"),this.resize(e,t)}}),_.parentIFrame=_.parentIframe}(),function(){if(!0!==W)return;function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){o(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),$e(),R=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function i(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&o(e,"click",t)}document.querySelectorAll(\'a[href^="#"]\').forEach(e)}function l(){o(window,"hashchange",r)}function c(){setTimeout(r,u)}function s(){a(),l(),c()}R.enable&&(1===L?me("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:i}}(),ae(document.documentElement),ae(document.body),Ve("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),te(),B=!1}function he(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ye(){""!==V&&document.querySelectorAll(V).forEach((e=>{e.dataset.iframeSize=!0}))}function ge(e){({add(t){function n(){Ve(e.eventName,e.eventType)}d[t]=n,o(window,t,n,{passive:!0})},remove(e){const t=d[e];delete d[e],i(window,e,t)}})[e.method](e.eventName)}function ve(e){ge({method:e,eventType:"After Print",eventName:"afterprint"}),ge({method:e,eventType:"Before Print",eventName:"beforeprint"}),ge({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function be(){const e=document.querySelectorAll(`[${n}]`);T=e.length>0,A=T?e:Re(document)()}function we(e,t,n,o){return t!==e&&(e in n||(de(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in s&&me(`<rb>Deprecated ${o}CalculationMethod (${e})</>\\n\\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function ze(){I=we(I,f,He,"height")}function Se(){K=we(K,v,Ue,"width")}function $e(){!0===z&&(ve("add"),E=function(){function e(e){e.forEach(Te),ye(),be()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),U=new ResizeObserver(Ee),Ce(window.document))}let je;function Ee(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;je=()=>Ve("resizeObserver",`Resize Observed: ${le(t)}`),setTimeout((()=>{je&&je(),je=void 0}),0)}const Pe=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Oe=()=>[...Re(document)()].filter(Pe),Me=new WeakSet;function Ae(e){e&&(Me.has(e)||(U.observe(e),Me.add(e)))}function Ce(e){[...Oe(),...g.flatMap((t=>e.querySelector(t)))].forEach(Ae)}function Te(e){"childList"===e.type&&Ce(e.target)}let ke=4,Ie=4;function xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=A.length,r=document.documentElement,a=T?0:document.documentElement.getBoundingClientRect().bottom,c=performance.now();var s;A.forEach((t=>{T||!m||t.checkVisibility(l)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>a&&(a=o,r=t)):i-=1})),c=performance.now()-c,i>1&&(s=r,re.has(s)||(ae(s),ue(`\\nHeight calculated from: ${le(s)} (${ce(s)})`)));const u=`\\nParsed ${i} element${1===i?"":"s"} in ${c.toPrecision(3)}ms\\n${t} ${T?"tagged ":""}element found at: ${a}px\\nPosition calculated from HTML element: ${le(r)} (${ce(r,100)})`;return c<4||i<99||T||B||ke<c&&ke<Ie&&(ke=1.2*c,me(`<rb>Performance Warning</>\\n\\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\\n${u}`)),Ie=c,a}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Re=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)");let Be=!1;function qe({ceilBoundingSize:e,dimension:t,getDimension:n,isHeight:o,scrollSize:i}){if(!Be)return Be=!0,n.taggedElement();const r=o?"bottom":"right";return me(`<rb>Detected content overflowing html element</>\\n \\nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${r} margin, and position of every visible HTML element will have a performance impact on more complex pages. \\n\\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \\n \\nWhen present the ${r} margin of the ${o?"lowest":"right most"} element with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\\n\\nMore info: https://iframe-resizer.com/performance.\\n\\n(Page size: ${i} > document size: ${e})`),o?I="autoOverflow":K="autoOverflow",n.taggedElement()}const Le={height:0,width:0},We={height:0,width:0};function De(e,t){function n(){return We[i]=r,Le[i]=c,r}const o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===We[i]&&0===Le[i]:if(e.taggedElement(!0)<=a)return n();break;case X&&r===We[i]&&c===Le[i]:return Math.max(r,c);case 0===r:return c;case!t&&r!==We[i]&&c<=Le[i]:return n();case!o:return t?e.taggedElement():qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c});case!t&&r<We[i]:case c===l||c===a:case r>c:return n();case!t:return qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const He={enabled:()=>O,getOffset:()=>b,type:"height",auto:()=>De(He,!1),autoOverflow:()=>De(He,!0),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>c.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ne(He)),min:()=>Math.min(...Ne(He)),grow:()=>He.max(),lowestElement:()=>xe("bottom"),taggedElement:()=>xe("bottom")},Ue={enabled:()=>M,getOffset:()=>w,type:"width",auto:()=>De(Ue,!1),autoOverflow:()=>De(Ue,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>c.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ne(Ue)),min:()=>Math.min(...Ne(Ue)),rightMostElement:()=>xe("right"),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>xe("right")};function Fe(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Q);return r=void 0===n?He[I]():n,a=void 0===o?Ue[K]():o,O&&e(k,r)||M&&e(G,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(O&&I in y||M&&K in y)&&Qe():(Je(),k=r,G=a,Xe(k,G,e,i))}function Ve(e,t,n,o,i){document.hidden||Fe(e,0,n,o,i)}function Je(){X||(X=!0,requestAnimationFrame((()=>{X=!1})))}function Ze(e){k=He[I](),G=Ue[K](),Xe(k,G,e)}function Qe(e){const t=I;I=f,Je(),Ze("reset"),I=t}function Xe(e,t,n,o,i){L<-1||(void 0!==i||(i=Z),function(){const r=`${D}:${`${e+(b||0)}:${t+(w||0)}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(p+r):J.postMessage(p+r,i)}())}function Ye(e){const t={init:function(){N=e.data,J=e.source,pe(),C=!1,setTimeout((()=>{x=!1}),u)},reset(){x||Ze("resetPage")},resize(){Ve("resizeParent")},moveToAnchor(){R.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ne?ne(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();oe?oe(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();ee(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};p===`${e.data}`.slice(0,h)&&(!1!==C?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||de(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),o(window,"message",Ye),o(window,"readystatechange",Ge),Ge())}));\n', J = "iframe-resizer/child 5.1.5", be = $, v = `<script>${$}<\/script>`, Y = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), k = (e) => {
|
|
61
|
+
applyChunk: re
|
|
62
|
+
}, H = '/**\n * Skipped minification because the original files appears to be already minified.\n * Original file: /npm/@iframe-resizer/child@5.1.5/index.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n/*!\n * @preserve\n * \n * @module iframe-resizer/child 5.1.5 (umd) - 2024-07-09\n *\n * @license GPL-3.0 for non-commercial use only.\n * For commercial use, you must purchase a license from\n * https://iframe-resizer.com/pricing\n * \n * @desciption Keep same and cross domain iFrames sized to their content \n *\n * @author David J. Bradshaw <info@iframe-resizer.com>\n * \n * @see {@link https://iframe-resizer.com}\n * \n * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.\n */\n\n\n!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.1.5",t=10,n="data-iframe-size",o=(e,t,n,o)=>e.addEventListener(t,n,o||!1),i=(e,t,n)=>e.removeEventListener(t,n,!1),r=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const a=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(r[e]),l={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},c={height:()=>(de("Custom height calculation function not defined"),He.auto()),width:()=>(de("Custom width calculation function not defined"),Ue.auto())},s={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},u=128,d={},m="checkVisibility"in window,f="auto",p="[iFrameSizer]",h=p.length,y={max:1,min:1,bodyScroll:1,documentElementScroll:1},g=["body"],v="scroll";let b,w,z=!0,S="",$=0,j="",E=null,P="",O=!0,M=!1,A=null,C=!0,T=!1,k=1,I=f,x=!0,N="",R={},B=!0,q=!1,L=0,W=!1,D="",H="child",U=null,F=!1,V="",J=window.parent,Z="*",Q=0,X=!1,Y="",G=1,K=v,_=window,ee=()=>{de("onMessage function not defined")},te=()=>{},ne=null,oe=null;const ie=e=>""!=`${e}`&&void 0!==e,re=new WeakSet,ae=e=>"object"==typeof e&&re.add(e);function le(e){switch(!0){case!ie(e):return"";case ie(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ie(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ie(e.className)?`.${e.className}`:"")}}function ce(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\\n"," ")}...`:e}const se=(...e)=>[`[iframe-resizer][${D}]`,...e].join(" "),ue=(...e)=>console?.info(se(...e)),de=(...e)=>console?.warn(se(...e)),me=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\\n").replaceAll("<rb>","\x1B[31;1m").replaceAll("</>","\x1B[m").replaceAll("<b>","\x1B[1m").replaceAll("<i>","\x1B[3m").replaceAll("<u>","\x1B[4m")):e(t.replaceAll("<br>","\\n").replaceAll(/<[/a-z]+>/gi,"")))(se)(...e)),fe=e=>me(e);function pe(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=N.slice(h).split(":");D=t[0],$=void 0===t[1]?$:Number(t[1]),M=void 0===t[2]?M:e(t[2]),q=void 0===t[3]?q:e(t[3]),z=void 0===t[6]?z:e(t[6]),j=t[7],I=void 0===t[8]?I:t[8],S=t[9],P=t[10],Q=void 0===t[11]?Q:Number(t[11]),R.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],K=void 0===t[14]?K:t[14],W=void 0===t[15]?W:e(t[15]),b=void 0===t[16]?b:Number(t[16]),w=void 0===t[17]?w:Number(t[17]),O=void 0===t[18]?O:e(t[18]),t[19],Y=t[20]||Y,L=void 0===t[21]?L:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;ee=e?.onMessage||ee,te=e?.onReady||te,"number"==typeof e?.offset&&(O&&(b=e?.offset),M&&(w=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(V=e.sizeSelector),Z=e?.targetOrigin||Z,I=e?.heightCalculationMethod||I,K=e?.widthCalculationMethod||K}function t(e,t){return"function"==typeof e&&(c[t]=e,e="custom"),e}if(1===L)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),I=t(I,"height"),K=t(K,"width"))}(),function(){void 0===j&&(j=`${$}px`);he("margin",function(e,t){t.includes("-")&&(de(`Negative CSS value ignored for ${e}`),t="");return t}("margin",j))}(),he("background",S),he("padding",P),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),ye(),L<0?fe(`${a(L+2)}${a(2)}`):Y.codePointAt(0)>4||L<2&&fe(a(3)),function(){if(!Y||""===Y||"false"===Y)return void me("<rb>Legacy version detected on parent page</>\\n\\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\\n\\nSee <u>https://iframe-resizer.com/setup/</> for more details.\\n");Y!==e&&me(`<rb>Version mismatch</>\\n\\nThe parent and child pages are running different versions of <i>iframe resizer</>.\\n\\nParent page: ${Y} - Child page: ${e}.\\n`)}(),ze(),Se(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.setAttribute(n,null)}));t("data-iframe-height"),t("data-iframe-width"),e&&me("<rb>Deprecated Attributes</>\\n \\nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),document.querySelectorAll(`[${n}]`).length>0&&("auto"===I&&(I="autoOverflow"),"auto"===K&&(K="autoOverflow")),be(),function(){if(1===L)return;_.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===z?(z=!0,$e()):!1===e&&!0===z&&(z=!1,ve("remove"),U?.disconnect(),E?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(z)),z),close(){Xe(0,0,"close")},getId:()=>D,getPageInfo(e){if("function"==typeof e)return ne=e,Xe(0,0,"pageInfo"),void me("<rb>Deprecated Method</>\\n \\nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n");ne=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return oe=e,Xe(0,0,"parentInfo"),()=>{oe=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){me("<rb>Renamed Method</>\\n \\nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\\n"),this.getParentProps(e)},moveToAnchor(e){R.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){I=e,ze()},setWidthCalculationMethod(e){K=e,Se()},setTargetOrigin(e){Z=e},resize(e,t){Ve("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){me("<rb>Deprecated Method</>\\n \\nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n"),this.resize(e,t)}}),_.parentIFrame=_.parentIframe}(),function(){if(!0!==W)return;function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){o(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),$e(),R=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function i(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&o(e,"click",t)}document.querySelectorAll(\'a[href^="#"]\').forEach(e)}function l(){o(window,"hashchange",r)}function c(){setTimeout(r,u)}function s(){a(),l(),c()}R.enable&&(1===L?me("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:i}}(),ae(document.documentElement),ae(document.body),Ve("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),te(),B=!1}function he(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ye(){""!==V&&document.querySelectorAll(V).forEach((e=>{e.dataset.iframeSize=!0}))}function ge(e){({add(t){function n(){Ve(e.eventName,e.eventType)}d[t]=n,o(window,t,n,{passive:!0})},remove(e){const t=d[e];delete d[e],i(window,e,t)}})[e.method](e.eventName)}function ve(e){ge({method:e,eventType:"After Print",eventName:"afterprint"}),ge({method:e,eventType:"Before Print",eventName:"beforeprint"}),ge({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function be(){const e=document.querySelectorAll(`[${n}]`);T=e.length>0,A=T?e:Re(document)()}function we(e,t,n,o){return t!==e&&(e in n||(de(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in s&&me(`<rb>Deprecated ${o}CalculationMethod (${e})</>\\n\\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function ze(){I=we(I,f,He,"height")}function Se(){K=we(K,v,Ue,"width")}function $e(){!0===z&&(ve("add"),E=function(){function e(e){e.forEach(Te),ye(),be()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),U=new ResizeObserver(Ee),Ce(window.document))}let je;function Ee(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;je=()=>Ve("resizeObserver",`Resize Observed: ${le(t)}`),setTimeout((()=>{je&&je(),je=void 0}),0)}const Pe=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Oe=()=>[...Re(document)()].filter(Pe),Me=new WeakSet;function Ae(e){e&&(Me.has(e)||(U.observe(e),Me.add(e)))}function Ce(e){[...Oe(),...g.flatMap((t=>e.querySelector(t)))].forEach(Ae)}function Te(e){"childList"===e.type&&Ce(e.target)}let ke=4,Ie=4;function xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=A.length,r=document.documentElement,a=T?0:document.documentElement.getBoundingClientRect().bottom,c=performance.now();var s;A.forEach((t=>{T||!m||t.checkVisibility(l)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>a&&(a=o,r=t)):i-=1})),c=performance.now()-c,i>1&&(s=r,re.has(s)||(ae(s),ue(`\\nHeight calculated from: ${le(s)} (${ce(s)})`)));const u=`\\nParsed ${i} element${1===i?"":"s"} in ${c.toPrecision(3)}ms\\n${t} ${T?"tagged ":""}element found at: ${a}px\\nPosition calculated from HTML element: ${le(r)} (${ce(r,100)})`;return c<4||i<99||T||B||ke<c&&ke<Ie&&(ke=1.2*c,me(`<rb>Performance Warning</>\\n\\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\\n${u}`)),Ie=c,a}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Re=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)");let Be=!1;function qe({ceilBoundingSize:e,dimension:t,getDimension:n,isHeight:o,scrollSize:i}){if(!Be)return Be=!0,n.taggedElement();const r=o?"bottom":"right";return me(`<rb>Detected content overflowing html element</>\\n \\nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${r} margin, and position of every visible HTML element will have a performance impact on more complex pages. \\n\\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \\n \\nWhen present the ${r} margin of the ${o?"lowest":"right most"} element with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\\n\\nMore info: https://iframe-resizer.com/performance.\\n\\n(Page size: ${i} > document size: ${e})`),o?I="autoOverflow":K="autoOverflow",n.taggedElement()}const Le={height:0,width:0},We={height:0,width:0};function De(e,t){function n(){return We[i]=r,Le[i]=c,r}const o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===We[i]&&0===Le[i]:if(e.taggedElement(!0)<=a)return n();break;case X&&r===We[i]&&c===Le[i]:return Math.max(r,c);case 0===r:return c;case!t&&r!==We[i]&&c<=Le[i]:return n();case!o:return t?e.taggedElement():qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c});case!t&&r<We[i]:case c===l||c===a:case r>c:return n();case!t:return qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const He={enabled:()=>O,getOffset:()=>b,type:"height",auto:()=>De(He,!1),autoOverflow:()=>De(He,!0),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>c.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ne(He)),min:()=>Math.min(...Ne(He)),grow:()=>He.max(),lowestElement:()=>xe("bottom"),taggedElement:()=>xe("bottom")},Ue={enabled:()=>M,getOffset:()=>w,type:"width",auto:()=>De(Ue,!1),autoOverflow:()=>De(Ue,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>c.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ne(Ue)),min:()=>Math.min(...Ne(Ue)),rightMostElement:()=>xe("right"),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>xe("right")};function Fe(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Q);return r=void 0===n?He[I]():n,a=void 0===o?Ue[K]():o,O&&e(k,r)||M&&e(G,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(O&&I in y||M&&K in y)&&Qe():(Je(),k=r,G=a,Xe(k,G,e,i))}function Ve(e,t,n,o,i){document.hidden||Fe(e,0,n,o,i)}function Je(){X||(X=!0,requestAnimationFrame((()=>{X=!1})))}function Ze(e){k=He[I](),G=Ue[K](),Xe(k,G,e)}function Qe(e){const t=I;I=f,Je(),Ze("reset"),I=t}function Xe(e,t,n,o,i){L<-1||(void 0!==i||(i=Z),function(){const r=`${D}:${`${e+(b||0)}:${t+(w||0)}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(p+r):J.postMessage(p+r,i)}())}function Ye(e){const t={init:function(){N=e.data,J=e.source,pe(),C=!1,setTimeout((()=>{x=!1}),u)},reset(){x||Ze("resetPage")},resize(){Ve("resizeParent")},moveToAnchor(){R.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ne?ne(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();oe?oe(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();ee(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};p===`${e.data}`.slice(0,h)&&(!1!==C?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||de(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),o(window,"message",Ye),o(window,"readystatechange",Ge),Ge())}));\n', ie = "iframe-resizer/child 5.1.5", Ze = H, A = `<script>${H}<\/script>`, ae = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), D = (e) => {
|
|
63
63
|
if (!e || typeof e != "object")
|
|
64
64
|
return {};
|
|
65
|
-
const t = e.values, n = (
|
|
66
|
-
const
|
|
67
|
-
if (typeof
|
|
68
|
-
return
|
|
69
|
-
const a = e[
|
|
65
|
+
const t = e.values, n = (s) => {
|
|
66
|
+
const i = t && typeof t == "object" ? t[s] : void 0;
|
|
67
|
+
if (typeof i == "string" && i)
|
|
68
|
+
return i;
|
|
69
|
+
const a = e[s];
|
|
70
70
|
return typeof a == "string" && a ? a : void 0;
|
|
71
|
-
},
|
|
71
|
+
}, r = n("url"), o = n("srcdoc");
|
|
72
72
|
return {
|
|
73
|
-
...
|
|
74
|
-
...
|
|
73
|
+
...r ? { url: r } : {},
|
|
74
|
+
...o ? { srcdoc: o } : {}
|
|
75
75
|
};
|
|
76
|
-
},
|
|
77
|
-
if (e.mode !== "result" ||
|
|
76
|
+
}, B = (e) => e && (e.includes("</head>") ? e.replace("</head>", `${A}</head>`) : e.includes("<body") ? e.replace("<body", `${A}<body`) : A + e), ce = (e) => !e || typeof e != "object" || Array.isArray(e) || !e.url && !e.srcdoc ? !1 : !e.srcdoc || e.srcdoc.includes(ie), le = (e, t) => {
|
|
77
|
+
if (e.mode !== "result" || ae(e.value) !== "url")
|
|
78
78
|
return !1;
|
|
79
|
-
const n =
|
|
80
|
-
return !n.url && !n.srcdoc || (n.srcdoc && (n.srcdoc =
|
|
81
|
-
},
|
|
82
|
-
if (
|
|
79
|
+
const n = D(e.value);
|
|
80
|
+
return !n.url && !n.srcdoc || (n.srcdoc && (n.srcdoc = B(n.srcdoc)), t.push({ answer_type: "url", values: n })), !0;
|
|
81
|
+
}, ue = (e) => {
|
|
82
|
+
if (ce(e.values))
|
|
83
83
|
return e;
|
|
84
|
-
const t =
|
|
85
|
-
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc =
|
|
86
|
-
},
|
|
84
|
+
const t = D(e);
|
|
85
|
+
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc = B(t.srcdoc)), e.values = t), e;
|
|
86
|
+
}, de = {
|
|
87
87
|
id: "iframe_page",
|
|
88
88
|
answerType: "url",
|
|
89
|
-
applyChunk:
|
|
90
|
-
normalizeReport:
|
|
91
|
-
},
|
|
89
|
+
applyChunk: le,
|
|
90
|
+
normalizeReport: ue
|
|
91
|
+
}, T = "recordset", fe = ["cols", "values", "chart", "title", "max_cols", "parent_link_col", "agent_key"], me = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), z = (e) => !!e && typeof e == "object" && !Array.isArray(e) && (Array.isArray(e.cols) || Array.isArray(e.values)), pe = (e) => {
|
|
92
92
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
93
93
|
return;
|
|
94
94
|
const t = e.values;
|
|
95
|
-
if (
|
|
95
|
+
if (z(t))
|
|
96
96
|
return t;
|
|
97
|
-
if (
|
|
97
|
+
if (z(e))
|
|
98
98
|
return e;
|
|
99
|
-
},
|
|
100
|
-
if (e.mode !== "result" ||
|
|
99
|
+
}, he = (e, t) => {
|
|
100
|
+
if (e.mode !== "result" || me(e.value) !== T)
|
|
101
101
|
return !1;
|
|
102
|
-
const n =
|
|
103
|
-
return n && t.push({ answer_type:
|
|
104
|
-
},
|
|
105
|
-
if (
|
|
102
|
+
const n = pe(e.value);
|
|
103
|
+
return n && t.push({ answer_type: T, values: n }), !0;
|
|
104
|
+
}, ye = (e) => {
|
|
105
|
+
if (z(e.values))
|
|
106
106
|
return e;
|
|
107
107
|
const t = e;
|
|
108
|
-
if (!
|
|
108
|
+
if (!z(t))
|
|
109
109
|
return e;
|
|
110
110
|
const n = {};
|
|
111
|
-
for (const
|
|
112
|
-
n[
|
|
111
|
+
for (const r of fe)
|
|
112
|
+
n[r] = t[r];
|
|
113
113
|
return e.values = n, e;
|
|
114
|
-
},
|
|
114
|
+
}, ge = {
|
|
115
115
|
id: "recordset",
|
|
116
|
-
answerType:
|
|
117
|
-
applyChunk:
|
|
118
|
-
normalizeReport:
|
|
119
|
-
},
|
|
116
|
+
answerType: T,
|
|
117
|
+
applyChunk: he,
|
|
118
|
+
normalizeReport: ye
|
|
119
|
+
}, _ = "output_file", we = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), b = (e, t) => {
|
|
120
120
|
if (!e || typeof e != "object")
|
|
121
121
|
return;
|
|
122
122
|
const n = e[t];
|
|
123
123
|
return typeof n == "string" && n ? n : void 0;
|
|
124
|
-
},
|
|
124
|
+
}, U = (e) => {
|
|
125
125
|
if (!e || typeof e != "object")
|
|
126
126
|
return {};
|
|
127
|
-
const t = e.values && typeof e.values == "object" ? e.values : void 0, n =
|
|
127
|
+
const t = e.values && typeof e.values == "object" ? e.values : void 0, n = b(t, "file_id") ?? b(e, "file_id"), r = b(t, "file_name") ?? b(e, "file_name");
|
|
128
128
|
return {
|
|
129
129
|
...n ? { file_id: n } : {},
|
|
130
|
-
...
|
|
130
|
+
...r ? { file_name: r } : {}
|
|
131
131
|
};
|
|
132
|
-
},
|
|
133
|
-
if (e.mode !== "result" ||
|
|
132
|
+
}, be = (e, t) => {
|
|
133
|
+
if (e.mode !== "result" || we(e.value) !== _)
|
|
134
134
|
return !1;
|
|
135
|
-
const n =
|
|
136
|
-
return !n.file_id && !n.file_name || t.push({ answer_type:
|
|
137
|
-
},
|
|
138
|
-
const t =
|
|
135
|
+
const n = U(e.value);
|
|
136
|
+
return !n.file_id && !n.file_name || t.push({ answer_type: _, values: n }), !0;
|
|
137
|
+
}, ve = (e) => {
|
|
138
|
+
const t = U(e);
|
|
139
139
|
if (!t.file_id && !t.file_name)
|
|
140
140
|
return e;
|
|
141
141
|
const n = e.values && typeof e.values == "object" && !Array.isArray(e.values) ? e.values : {};
|
|
142
142
|
return (!t.file_id || n.file_id) && (!t.file_name || n.file_name) || (e.values = { ...n, ...t }), e;
|
|
143
|
-
},
|
|
144
|
-
id:
|
|
145
|
-
answerType:
|
|
146
|
-
applyChunk:
|
|
147
|
-
normalizeReport:
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
143
|
+
}, ze = {
|
|
144
|
+
id: _,
|
|
145
|
+
answerType: _,
|
|
146
|
+
applyChunk: be,
|
|
147
|
+
normalizeReport: ve
|
|
148
|
+
}, g = (e) => ({
|
|
149
|
+
success: !1,
|
|
150
|
+
message: e,
|
|
151
|
+
data: null
|
|
152
|
+
}), _e = (e) => {
|
|
153
|
+
if (typeof e != "string")
|
|
154
|
+
return e;
|
|
155
|
+
try {
|
|
156
|
+
return JSON.parse(e);
|
|
157
|
+
} catch {
|
|
158
|
+
throw new Error("执行指令不是合法的 JSON");
|
|
159
|
+
}
|
|
160
|
+
}, Ee = (e) => {
|
|
161
|
+
const t = _e(e);
|
|
162
|
+
if (!t || typeof t != "object")
|
|
163
|
+
throw new Error("执行指令格式无效");
|
|
164
|
+
const { type: n, executor: r, action: o } = t;
|
|
165
|
+
if (n !== "action_execute")
|
|
166
|
+
throw new Error(`不支持的指令类型:${String(n ?? "")}`);
|
|
167
|
+
if (r !== "host" && r !== "agent")
|
|
168
|
+
throw new Error(`不支持的执行端:${String(r ?? "")}`);
|
|
169
|
+
if (!o || typeof o != "object" || typeof o.name != "string" || !o.name.trim())
|
|
170
|
+
throw new Error("执行指令缺少合法的 action.name");
|
|
171
|
+
if (!o.arguments || typeof o.arguments != "object" || Array.isArray(o.arguments))
|
|
172
|
+
throw new Error("执行指令的 action.arguments 必须是对象");
|
|
173
|
+
return {
|
|
174
|
+
type: n,
|
|
175
|
+
executor: r,
|
|
176
|
+
action: {
|
|
177
|
+
name: o.name,
|
|
178
|
+
arguments: o.arguments
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}, Se = (e, t = "执行端未返回有效的执行结果") => {
|
|
182
|
+
if (!e || typeof e != "object")
|
|
183
|
+
return g(t);
|
|
184
|
+
const n = e;
|
|
185
|
+
return typeof n.success != "boolean" ? g("执行端返回的 success 必须是布尔值") : {
|
|
186
|
+
success: n.success,
|
|
187
|
+
message: typeof n.message == "string" ? n.message : n.success ? "操作成功" : "操作失败",
|
|
188
|
+
data: Object.prototype.hasOwnProperty.call(n, "data") ? n.data ?? null : null
|
|
189
|
+
};
|
|
190
|
+
}, Qe = (e) => {
|
|
191
|
+
if (e && typeof e == "object") {
|
|
192
|
+
const t = e;
|
|
193
|
+
if (typeof t.success == "boolean")
|
|
194
|
+
return e;
|
|
195
|
+
if (t.json_ok === !0)
|
|
196
|
+
return { success: !0, message: "操作成功", data: e };
|
|
197
|
+
if (t.json_ok === !1)
|
|
198
|
+
return {
|
|
199
|
+
success: !1,
|
|
200
|
+
message: typeof t.error == "string" ? t.error : "操作失败",
|
|
201
|
+
data: e
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return g("系统操作返回了无法识别的报文帧");
|
|
205
|
+
}, Fe = (e) => ({
|
|
206
|
+
name: e.name,
|
|
207
|
+
arguments: e.arguments
|
|
208
|
+
}), Ae = ["single_select", "multi_select", "date", "text"], h = /* @__PURE__ */ new Map();
|
|
209
|
+
let M = 0;
|
|
210
|
+
const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), y = (e) => typeof e == "string" && e.trim() ? e : void 0, Ce = (e, t) => {
|
|
211
|
+
if (!Array.isArray(e) || e.length === 0)
|
|
212
|
+
throw new Error(`确认项 ${t} 缺少可选项`);
|
|
213
|
+
return e.map((n, r) => {
|
|
214
|
+
if (!w(n) || typeof n.label != "string" || !n.label.trim())
|
|
215
|
+
throw new Error(`确认项 ${t} 的第 ${r + 1} 个选项格式无效`);
|
|
216
|
+
if (!Object.prototype.hasOwnProperty.call(n, "value"))
|
|
217
|
+
throw new Error(`确认项 ${t} 的第 ${r + 1} 个选项缺少 value`);
|
|
218
|
+
return {
|
|
219
|
+
label: n.label,
|
|
220
|
+
value: n.value
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
}, Te = (e) => {
|
|
224
|
+
if (e === void 0)
|
|
225
|
+
return;
|
|
226
|
+
if (!w(e))
|
|
227
|
+
throw new Error("确认项的 binding 必须是对象");
|
|
228
|
+
const t = {};
|
|
229
|
+
return typeof e.actionIndex == "number" && (t.actionIndex = e.actionIndex), typeof e.actionName == "string" && (t.actionName = e.actionName), typeof e.parameterPath == "string" && (t.parameterPath = e.parameterPath), t;
|
|
230
|
+
}, $e = (e, t) => {
|
|
231
|
+
if (!w(e) || !Ae.includes(e.type))
|
|
232
|
+
throw new Error(`确认项 ${t} 的 input.type 无效`);
|
|
233
|
+
const n = e.type, r = {
|
|
234
|
+
type: n,
|
|
235
|
+
placeholder: y(e.placeholder)
|
|
236
|
+
};
|
|
237
|
+
if ((n === "single_select" || n === "multi_select") && (r.options = Ce(e.options, t)), n === "date") {
|
|
238
|
+
if (e.format !== void 0 && e.format !== "YYYY-MM-DD")
|
|
239
|
+
throw new Error(`确认项 ${t} 暂不支持日期格式 ${String(e.format)}`);
|
|
240
|
+
r.format = "YYYY-MM-DD";
|
|
241
|
+
}
|
|
242
|
+
if (e.textInput !== void 0) {
|
|
243
|
+
if (!w(e.textInput))
|
|
244
|
+
throw new Error(`确认项 ${t} 的 textInput 必须是对象`);
|
|
245
|
+
r.textInput = {
|
|
246
|
+
placeholder: y(e.textInput.placeholder)
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return r;
|
|
250
|
+
}, je = (e) => {
|
|
251
|
+
if (!Array.isArray(e.items) || e.items.length === 0)
|
|
252
|
+
throw new Error("collect_clarifications 至少需要一个确认项");
|
|
253
|
+
const t = /* @__PURE__ */ new Set(), n = e.items.map((r, o) => {
|
|
254
|
+
if (!w(r))
|
|
255
|
+
throw new Error(`第 ${o + 1} 个确认项格式无效`);
|
|
256
|
+
const s = typeof r.id == "string" ? r.id.trim() : "", i = typeof r.question == "string" ? r.question.trim() : "";
|
|
257
|
+
if (!s)
|
|
258
|
+
throw new Error(`第 ${o + 1} 个确认项缺少 id`);
|
|
259
|
+
if (t.has(s))
|
|
260
|
+
throw new Error(`确认项 id 重复:${s}`);
|
|
261
|
+
if (!i)
|
|
262
|
+
throw new Error(`确认项 ${s} 缺少 question`);
|
|
263
|
+
return t.add(s), {
|
|
264
|
+
id: s,
|
|
265
|
+
question: i,
|
|
266
|
+
description: y(r.description),
|
|
267
|
+
required: r.required !== !1,
|
|
268
|
+
default: r.default,
|
|
269
|
+
binding: Te(r.binding),
|
|
270
|
+
input: $e(r.input, s)
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
return {
|
|
274
|
+
title: y(e.title) ?? "需要你确认几项信息",
|
|
275
|
+
description: y(e.description) ?? "请补充以下信息,我会据此继续完成操作。",
|
|
276
|
+
items: n
|
|
277
|
+
};
|
|
278
|
+
}, Ie = (e) => e !== void 0 ? String(e) : (M += 1, `clarification-${Date.now()}-${M}`), xe = (e) => {
|
|
279
|
+
h.set(e.reportId, e);
|
|
280
|
+
}, et = (e) => h.has(e), $ = (e, t) => {
|
|
281
|
+
const n = e.reports.findIndex((r) => {
|
|
282
|
+
var o;
|
|
283
|
+
return ((o = r.values) == null ? void 0 : o.requestId) === e.reportId;
|
|
284
|
+
});
|
|
285
|
+
n < 0 || e.reports.splice(n, 1, {
|
|
286
|
+
...e.reports[n],
|
|
287
|
+
values: { ...e.reports[n].values, ...t }
|
|
288
|
+
});
|
|
289
|
+
}, W = (e, t) => {
|
|
290
|
+
var n;
|
|
291
|
+
if (!e.reply)
|
|
292
|
+
return !1;
|
|
293
|
+
try {
|
|
294
|
+
return e.reply({
|
|
295
|
+
type: "wait_reply",
|
|
296
|
+
reply_id: e.replyId,
|
|
297
|
+
values: t
|
|
298
|
+
}) !== !1;
|
|
299
|
+
} catch (r) {
|
|
300
|
+
return (n = e.onError) == null || n.call(e, r), !1;
|
|
301
|
+
}
|
|
302
|
+
}, tt = (e, t) => {
|
|
303
|
+
const n = h.get(e);
|
|
304
|
+
if (!n)
|
|
305
|
+
return !1;
|
|
306
|
+
h.delete(e);
|
|
307
|
+
const r = W(n, {
|
|
308
|
+
success: !0,
|
|
309
|
+
message: "用户已提交补充信息",
|
|
310
|
+
data: { answers: t }
|
|
311
|
+
});
|
|
312
|
+
return $(n, {
|
|
313
|
+
status: "submitted",
|
|
314
|
+
resultMessage: r ? "补充信息已提交" : "补充信息已提交,但结果回传失败(连接已关闭)",
|
|
315
|
+
answers: t
|
|
316
|
+
}), !0;
|
|
317
|
+
}, nt = (e) => {
|
|
318
|
+
const t = h.get(e);
|
|
319
|
+
if (!t)
|
|
320
|
+
return !1;
|
|
321
|
+
h.delete(e);
|
|
322
|
+
const n = W(t, {
|
|
323
|
+
success: !1,
|
|
324
|
+
message: "用户取消了补充信息",
|
|
325
|
+
data: null
|
|
326
|
+
});
|
|
327
|
+
return $(t, {
|
|
328
|
+
status: "cancelled",
|
|
329
|
+
resultMessage: n ? "已取消补充信息" : "已取消补充信息,但结果回传失败(连接已关闭)"
|
|
330
|
+
}), !0;
|
|
331
|
+
}, rt = () => {
|
|
332
|
+
h.forEach((e) => {
|
|
333
|
+
$(e, {
|
|
334
|
+
status: "expired",
|
|
335
|
+
resultMessage: "本次补充信息已失效(回答已结束)"
|
|
336
|
+
});
|
|
337
|
+
}), h.clear();
|
|
338
|
+
}, q = "collect_clarifications", Oe = ["collect_clarifications"], X = (e, t, n) => {
|
|
339
|
+
var r;
|
|
340
|
+
if (!(e != null && e.reply))
|
|
341
|
+
return !1;
|
|
342
|
+
try {
|
|
343
|
+
const o = { type: "wait_reply", reply_id: t, values: n };
|
|
344
|
+
return e.reply(o) !== !1;
|
|
345
|
+
} catch (o) {
|
|
346
|
+
return (r = e.onError) == null || r.call(e, o), !1;
|
|
347
|
+
}
|
|
348
|
+
}, v = (e, t, n) => {
|
|
349
|
+
X(e, t, g(n));
|
|
350
|
+
}, Pe = async (e, t, n) => {
|
|
351
|
+
var o, s, i;
|
|
352
|
+
let r;
|
|
353
|
+
try {
|
|
354
|
+
const a = await ((o = n == null ? void 0 : n.execute) == null ? void 0 : o.call(n, e));
|
|
355
|
+
r = Se(a, `宿主未返回 ${e.name} 的执行结果`);
|
|
356
|
+
} catch (a) {
|
|
357
|
+
(s = n == null ? void 0 : n.onError) == null || s.call(n, a), r = g(a instanceof Error ? a.message : `${e.name} 执行失败`);
|
|
358
|
+
}
|
|
359
|
+
X(n, t, r) || (i = n == null ? void 0 : n.onError) == null || i.call(n, new Error(`${e.name} 已执行,但 wait_reply 回传失败(连接已关闭)`));
|
|
360
|
+
}, Me = (e, t, n, r) => {
|
|
361
|
+
var a, c;
|
|
362
|
+
if (e.mode !== "front_reply")
|
|
363
|
+
return !1;
|
|
364
|
+
const o = r == null ? void 0 : r.frontReply, s = typeof e.reply_id == "string" || typeof e.reply_id == "number" ? e.reply_id : void 0;
|
|
365
|
+
let i;
|
|
366
|
+
try {
|
|
367
|
+
i = Ee(e.values ?? e.value);
|
|
368
|
+
} catch (l) {
|
|
369
|
+
return (a = o == null ? void 0 : o.onError) == null || a.call(o, l), v(o, s, l instanceof Error ? l.message : "执行指令解析失败"), !0;
|
|
370
|
+
}
|
|
371
|
+
if (i.executor === "agent") {
|
|
372
|
+
if (!Oe.includes(i.action.name))
|
|
373
|
+
return v(o, s, `暂不支持的 Agent 操作:${i.action.name}`), !0;
|
|
374
|
+
let l;
|
|
375
|
+
try {
|
|
376
|
+
l = je(i.action.arguments);
|
|
377
|
+
} catch (d) {
|
|
378
|
+
return (c = o == null ? void 0 : o.onError) == null || c.call(o, d), v(o, s, d instanceof Error ? d.message : "确认项参数无效"), !0;
|
|
379
|
+
}
|
|
380
|
+
const u = Ie(s), p = {
|
|
381
|
+
requestId: u,
|
|
382
|
+
...l,
|
|
383
|
+
status: "pending",
|
|
384
|
+
resultMessage: ""
|
|
385
|
+
};
|
|
386
|
+
return xe({
|
|
387
|
+
reportId: u,
|
|
388
|
+
replyId: s,
|
|
389
|
+
reports: t,
|
|
390
|
+
reply: o == null ? void 0 : o.reply,
|
|
391
|
+
onError: o == null ? void 0 : o.onError
|
|
392
|
+
}), t.push({ answer_type: q, values: p }), !0;
|
|
393
|
+
}
|
|
394
|
+
return o != null && o.execute ? (Pe(i.action, s, o), !0) : (v(o, s, `宿主未注入执行器,无法执行:${i.action.name}`), !0);
|
|
395
|
+
}, ke = (e) => {
|
|
396
|
+
const t = e.values;
|
|
397
|
+
!t || typeof t != "object" || t.status === "pending" && (t.status = "expired", t.resultMessage = "本次补充信息已失效(回答已结束)");
|
|
398
|
+
}, Ne = {
|
|
399
|
+
id: "action_execute",
|
|
400
|
+
answerType: q,
|
|
401
|
+
applyChunk: Me,
|
|
402
|
+
normalizeReport: ke
|
|
403
|
+
}, E = [
|
|
152
404
|
se,
|
|
153
|
-
|
|
154
|
-
|
|
405
|
+
ne,
|
|
406
|
+
de,
|
|
407
|
+
ge,
|
|
408
|
+
ze,
|
|
409
|
+
Ne
|
|
410
|
+
], Le = (e) => {
|
|
155
411
|
const t = (e == null ? void 0 : e.parsers) ?? [];
|
|
156
|
-
return t.length ? [...
|
|
157
|
-
},
|
|
158
|
-
var
|
|
159
|
-
const
|
|
160
|
-
if (!
|
|
412
|
+
return t.length ? [...E, ...t] : E;
|
|
413
|
+
}, ot = (e, t, n) => {
|
|
414
|
+
var i;
|
|
415
|
+
const r = (i = e.answer) == null ? void 0 : i.reports;
|
|
416
|
+
if (!r)
|
|
161
417
|
return [];
|
|
162
|
-
const
|
|
418
|
+
const o = new Set(
|
|
163
419
|
((n == null ? void 0 : n.parsers) ?? []).filter((a) => a.applyChunk && a.answerType).map((a) => a.answerType)
|
|
164
|
-
),
|
|
165
|
-
for (const a of
|
|
166
|
-
a.applyChunk && (
|
|
167
|
-
return
|
|
168
|
-
},
|
|
169
|
-
var
|
|
420
|
+
), s = [];
|
|
421
|
+
for (const a of Le(n))
|
|
422
|
+
a.applyChunk && (E.includes(a) && a.answerType && o.has(a.answerType) || a.applyChunk(t, r, e, n) && s.push(a.id));
|
|
423
|
+
return s;
|
|
424
|
+
}, Re = (e, t) => {
|
|
425
|
+
var s;
|
|
170
426
|
const n = e.answer_type;
|
|
171
427
|
if (!n)
|
|
172
428
|
return;
|
|
173
|
-
const
|
|
174
|
-
(
|
|
175
|
-
},
|
|
176
|
-
var
|
|
177
|
-
const
|
|
178
|
-
if ((
|
|
179
|
-
const a =
|
|
429
|
+
const o = ((t == null ? void 0 : t.parsers) ?? []).find((i) => i.answerType === n && !!i.normalizeReport) ?? E.find((i) => i.answerType === n && !!i.normalizeReport);
|
|
430
|
+
(s = o == null ? void 0 : o.normalizeReport) == null || s.call(o, e, t);
|
|
431
|
+
}, K = (e, t = "", n = "", r) => {
|
|
432
|
+
var i;
|
|
433
|
+
const o = (e == null ? void 0 : e.values) ?? e;
|
|
434
|
+
if ((i = o == null ? void 0 : o.answer) != null && i.reports) {
|
|
435
|
+
const a = o;
|
|
180
436
|
for (const c of a.answer.reports)
|
|
181
|
-
|
|
437
|
+
Re(c, r);
|
|
182
438
|
return a;
|
|
183
439
|
}
|
|
184
|
-
const
|
|
185
|
-
return typeof
|
|
186
|
-
},
|
|
440
|
+
const s = F(t, n);
|
|
441
|
+
return typeof o == "string" && N({ mode: "knowledge_stream", value: o }, s.answer.reports, s, r), s;
|
|
442
|
+
}, st = {
|
|
187
443
|
User: "user",
|
|
188
444
|
Assistant: "assistant"
|
|
189
445
|
};
|
|
190
|
-
let
|
|
191
|
-
const
|
|
446
|
+
let He = 0;
|
|
447
|
+
const V = (e = "msg") => `${e}-${++He}`, De = (e) => {
|
|
192
448
|
const t = e.trim();
|
|
193
449
|
if (!t || t === "[DONE]")
|
|
194
450
|
return null;
|
|
@@ -202,7 +458,7 @@ const P = (e = "msg") => `${e}-${++me}`, pe = (e) => {
|
|
|
202
458
|
return null;
|
|
203
459
|
}
|
|
204
460
|
}
|
|
205
|
-
},
|
|
461
|
+
}, Be = () => {
|
|
206
462
|
let e = "";
|
|
207
463
|
return {
|
|
208
464
|
push(t) {
|
|
@@ -215,116 +471,128 @@ const P = (e = "msg") => `${e}-${++me}`, pe = (e) => {
|
|
|
215
471
|
return e = "", t ? [t] : [];
|
|
216
472
|
}
|
|
217
473
|
};
|
|
218
|
-
},
|
|
219
|
-
const
|
|
220
|
-
|
|
474
|
+
}, Ue = 30, We = /[A-Za-z]:[\\/][^\s"'`,。;;、,()()【】\[\]<>|?*]*/g, qe = /\\\\[^\s"'`,。;;、,()()【】\[\]<>|?*]+/g, Xe = /(^|[\s"'`((【\[::,,、])((?:\/[^\s"'`,。;;、,()()【】\[\]<>|?*\/]+){2,})/g, Ke = /^(?:请帮忙|请帮我|帮我看看|帮我把|帮我|帮忙|请把|麻烦你|麻烦|劳驾|请你|请问|帮(?!助))\s*[::,,、\-—]?\s*/, C = (e) => {
|
|
475
|
+
const t = e.split(/[\\/]+/).filter(Boolean);
|
|
476
|
+
return t.length ? t[t.length - 1] : "";
|
|
477
|
+
}, Ve = (e) => e.replace(qe, (t) => C(t)).replace(We, (t) => C(t)).replace(Xe, (t, n, r) => n + C(r)), it = (e) => {
|
|
478
|
+
let t = String(e ?? "").replace(/\r\n|\r|\n/g, " ").replace(/\s+/g, " ").trim();
|
|
479
|
+
if (!t)
|
|
480
|
+
return "";
|
|
481
|
+
t = Ve(t).replace(/\s+/g, " ").trim();
|
|
482
|
+
let n = "";
|
|
483
|
+
for (; n !== t; )
|
|
484
|
+
n = t, t = t.replace(Ke, "").trim(), t = t.replace(/^[::,,、\-—\s]+/, "").trim();
|
|
485
|
+
return t.slice(0, Ue);
|
|
486
|
+
}, at = async (e, t) => {
|
|
487
|
+
const n = e.getReader(), r = new TextDecoder(), o = Be(), s = (i) => {
|
|
488
|
+
const a = De(i);
|
|
221
489
|
a && t(a);
|
|
222
490
|
};
|
|
223
491
|
try {
|
|
224
492
|
for (; ; ) {
|
|
225
|
-
const { done:
|
|
226
|
-
if (
|
|
493
|
+
const { done: i, value: a } = await n.read();
|
|
494
|
+
if (i)
|
|
227
495
|
break;
|
|
228
|
-
|
|
496
|
+
o.push(r.decode(a, { stream: !0 })).forEach(s);
|
|
229
497
|
}
|
|
230
|
-
|
|
231
|
-
} catch (
|
|
498
|
+
o.flush().forEach(s);
|
|
499
|
+
} catch (i) {
|
|
232
500
|
throw await n.cancel().catch(() => {
|
|
233
|
-
}),
|
|
501
|
+
}), i;
|
|
234
502
|
} finally {
|
|
235
503
|
n.releaseLock();
|
|
236
504
|
}
|
|
237
|
-
},
|
|
238
|
-
var
|
|
505
|
+
}, S = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"]), G = (e) => !e || isNaN(e) ? "" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, ct = (e) => {
|
|
506
|
+
var r;
|
|
239
507
|
if (e.type && e.type !== "file")
|
|
240
508
|
return !1;
|
|
241
509
|
const t = e.attachContent || {};
|
|
242
510
|
if (t.groupType === "image")
|
|
243
511
|
return !0;
|
|
244
|
-
const n = (t.suffix || ((
|
|
245
|
-
return !!(
|
|
246
|
-
},
|
|
247
|
-
const
|
|
248
|
-
return
|
|
249
|
-
},
|
|
512
|
+
const n = (t.suffix || ((r = e.name) != null && r.includes(".") ? e.name.split(".").pop() : "") || "").toLowerCase();
|
|
513
|
+
return !!(S.has(n) || t.raw && typeof t.raw.type == "string" && t.raw.type.startsWith("image/"));
|
|
514
|
+
}, Ge = (e, t, n) => e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") ? e : `${(t || "").replace(/\/$/, "")}${n}?file_id=${e}`, Ye = (e, t = "", n) => e ? n ? n(e) : Ge(e, t, "/file/download_file") : "", lt = (e, t = "", n) => {
|
|
515
|
+
const r = e.attachContent || {};
|
|
516
|
+
return r.url ? r.url : typeof r.fileContent == "string" && r.fileContent.startsWith("data:image/") ? r.fileContent : r.fileId ? Ye(r.fileId, t, n) : "";
|
|
517
|
+
}, k = (e) => {
|
|
250
518
|
var a;
|
|
251
|
-
const t = (e == null ? void 0 : e.name) || "", n = t.includes(".") && ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "",
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
519
|
+
const t = (e == null ? void 0 : e.name) || "", n = t.includes(".") && ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "", r = S.has(n) || (e == null ? void 0 : e.type) && typeof e.type == "string" && e.type.startsWith("image/");
|
|
520
|
+
let o;
|
|
521
|
+
if (r && typeof window < "u" && typeof URL < "u" && e instanceof Blob)
|
|
254
522
|
try {
|
|
255
|
-
|
|
523
|
+
o = URL.createObjectURL(e);
|
|
256
524
|
} catch {
|
|
257
|
-
|
|
525
|
+
o = void 0;
|
|
258
526
|
}
|
|
259
|
-
const
|
|
527
|
+
const s = G(e == null ? void 0 : e.size), i = [n.toUpperCase(), s].filter(Boolean).join(" · ");
|
|
260
528
|
return {
|
|
261
529
|
type: "file",
|
|
262
530
|
name: t,
|
|
263
|
-
description:
|
|
531
|
+
description: i,
|
|
264
532
|
attachContent: {
|
|
265
533
|
file_name: t,
|
|
266
534
|
size: e == null ? void 0 : e.size,
|
|
267
535
|
suffix: n,
|
|
268
536
|
raw: e,
|
|
269
|
-
url:
|
|
270
|
-
groupType:
|
|
537
|
+
url: o,
|
|
538
|
+
groupType: r ? "image" : "file"
|
|
271
539
|
}
|
|
272
540
|
};
|
|
273
|
-
},
|
|
274
|
-
var
|
|
275
|
-
const t = (e == null ? void 0 : e.file_name) ?? (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.title) ?? "", n = t.includes(".") && ((
|
|
541
|
+
}, Y = (e) => {
|
|
542
|
+
var s;
|
|
543
|
+
const t = (e == null ? void 0 : e.file_name) ?? (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.title) ?? "", n = t.includes(".") && ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "", r = S.has(n) || (e == null ? void 0 : e.groupType) === "image", o = n ? n.toUpperCase() : "";
|
|
276
544
|
return {
|
|
277
545
|
type: "file",
|
|
278
546
|
name: t,
|
|
279
|
-
description:
|
|
547
|
+
description: o,
|
|
280
548
|
attachContent: {
|
|
281
549
|
file_name: (e == null ? void 0 : e.file_name) ?? t,
|
|
282
550
|
fileId: (e == null ? void 0 : e.file_id) ?? (e == null ? void 0 : e.id),
|
|
283
551
|
fileContent: e == null ? void 0 : e.file_content,
|
|
284
552
|
suffix: n,
|
|
285
|
-
groupType:
|
|
553
|
+
groupType: r ? "image" : "file"
|
|
286
554
|
}
|
|
287
555
|
};
|
|
288
|
-
},
|
|
289
|
-
var
|
|
290
|
-
const t = (e == null ? void 0 : e.values) ?? e, n = ((
|
|
291
|
-
return !Array.isArray(n) || n.length === 0 ? [] : n.map((a) =>
|
|
292
|
-
},
|
|
293
|
-
var
|
|
556
|
+
}, Je = (e) => {
|
|
557
|
+
var r, o, s, i;
|
|
558
|
+
const t = (e == null ? void 0 : e.values) ?? e, n = ((r = t == null ? void 0 : t.attach) == null ? void 0 : r.files) ?? ((s = (o = t == null ? void 0 : t.answer) == null ? void 0 : o.attach) == null ? void 0 : s.files) ?? (t == null ? void 0 : t.attach_files) ?? ((i = t == null ? void 0 : t.answer) == null ? void 0 : i.attach_files) ?? [];
|
|
559
|
+
return !Array.isArray(n) || n.length === 0 ? [] : n.map((a) => Y(a));
|
|
560
|
+
}, ut = (e) => {
|
|
561
|
+
var r, o;
|
|
294
562
|
if (!e)
|
|
295
563
|
return { type: "file", name: "", description: "", attachContent: {} };
|
|
296
564
|
if (typeof Blob < "u" && e instanceof Blob)
|
|
297
|
-
return
|
|
565
|
+
return k(e);
|
|
298
566
|
if (typeof e == "object" && e.attachContent) {
|
|
299
|
-
const
|
|
567
|
+
const s = e.type || "file", i = e.name || e.attachContent.file_name || e.attachContent.name || "";
|
|
300
568
|
let a = e.description || "";
|
|
301
569
|
const c = { ...e.attachContent };
|
|
302
|
-
if (
|
|
303
|
-
const
|
|
304
|
-
a = [c.suffix ? c.suffix.toUpperCase() : "",
|
|
570
|
+
if (s === "file" && (!c.suffix && i.includes(".") && (c.suffix = ((r = i.split(".").pop()) == null ? void 0 : r.toLowerCase()) || ""), (c.groupType === "image" || c.suffix && S.has(c.suffix.toLowerCase()) || c.raw && typeof c.raw.type == "string" && c.raw.type.startsWith("image/")) && (c.groupType = "image"), !a)) {
|
|
571
|
+
const u = typeof c.size == "number" ? G(c.size) : c.size || "";
|
|
572
|
+
a = [c.suffix ? c.suffix.toUpperCase() : "", u].filter(Boolean).join(" · ");
|
|
305
573
|
}
|
|
306
574
|
return {
|
|
307
575
|
...e,
|
|
308
|
-
type:
|
|
309
|
-
name:
|
|
576
|
+
type: s,
|
|
577
|
+
name: i,
|
|
310
578
|
description: a,
|
|
311
579
|
attachContent: c
|
|
312
580
|
};
|
|
313
581
|
}
|
|
314
582
|
if (e.file_id || e.fileId)
|
|
315
|
-
return
|
|
583
|
+
return Y(e);
|
|
316
584
|
if (e.raw && typeof Blob < "u" && e.raw instanceof Blob) {
|
|
317
|
-
const
|
|
585
|
+
const s = k(e.raw);
|
|
318
586
|
return {
|
|
319
|
-
...
|
|
587
|
+
...s,
|
|
320
588
|
...e,
|
|
321
589
|
attachContent: {
|
|
322
|
-
...
|
|
590
|
+
...s.attachContent,
|
|
323
591
|
...e.attachContent
|
|
324
592
|
}
|
|
325
593
|
};
|
|
326
594
|
}
|
|
327
|
-
const t = e.name || e.title || "", n = t.includes(".") && ((
|
|
595
|
+
const t = e.name || e.title || "", n = t.includes(".") && ((o = t.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
|
|
328
596
|
return {
|
|
329
597
|
type: e.type || "file",
|
|
330
598
|
name: t,
|
|
@@ -335,64 +603,64 @@ const P = (e = "msg") => `${e}-${++me}`, pe = (e) => {
|
|
|
335
603
|
...e
|
|
336
604
|
}
|
|
337
605
|
};
|
|
338
|
-
},
|
|
339
|
-
const n = await e.createHistoryGroup(t),
|
|
340
|
-
if (!
|
|
606
|
+
}, J = (e) => Je(e), dt = async (e) => [...(await e.getHistoryGroups()).groups ?? []].sort((r, o) => String(o.create_time ?? "").localeCompare(String(r.create_time ?? ""))), ft = async (e, t) => {
|
|
607
|
+
const n = await e.createHistoryGroup(t), r = (n == null ? void 0 : n.group_id) ?? (n == null ? void 0 : n.history_group_id) ?? "";
|
|
608
|
+
if (!r)
|
|
341
609
|
throw new Error("创建对话分组失败");
|
|
342
|
-
return
|
|
343
|
-
},
|
|
344
|
-
const
|
|
345
|
-
let
|
|
346
|
-
const
|
|
347
|
-
for (;
|
|
348
|
-
const
|
|
349
|
-
|
|
610
|
+
return r;
|
|
611
|
+
}, mt = (e, t) => e.deleteHistoryGroup(t), pt = (e, t, n) => e.setHistoryGroupTitle(t, n), Z = 5, Q = async (e, t, n) => {
|
|
612
|
+
const r = new Array(e.length);
|
|
613
|
+
let o = 0;
|
|
614
|
+
const s = Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
615
|
+
for (; o < e.length; ) {
|
|
616
|
+
const i = o++;
|
|
617
|
+
r[i] = await n(e[i], i);
|
|
350
618
|
}
|
|
351
619
|
});
|
|
352
|
-
return await Promise.all(
|
|
353
|
-
},
|
|
620
|
+
return await Promise.all(s), r;
|
|
621
|
+
}, ht = async (e, t, n = 10, r = 0, o) => {
|
|
354
622
|
if (!t)
|
|
355
623
|
return [];
|
|
356
|
-
const
|
|
624
|
+
const i = [...await e.getHistoryDetail(t, r, n)].sort((l, u) => String(l.create_time || "").localeCompare(String(u.create_time || ""))), a = await Q(i, Z, async (l) => {
|
|
357
625
|
try {
|
|
358
|
-
return await e.getHistoryAnswer(
|
|
626
|
+
return await e.getHistoryAnswer(l.history_id || "");
|
|
359
627
|
} catch {
|
|
360
628
|
return null;
|
|
361
629
|
}
|
|
362
630
|
}), c = [];
|
|
363
|
-
return
|
|
364
|
-
const p =
|
|
631
|
+
return i.forEach((l, u) => {
|
|
632
|
+
const p = l.history_id || V("h"), d = a[u], f = d != null ? J(d) : [];
|
|
365
633
|
if (c.push({
|
|
366
634
|
id: p,
|
|
367
|
-
historyId:
|
|
635
|
+
historyId: l.history_id,
|
|
368
636
|
role: "user",
|
|
369
|
-
content:
|
|
637
|
+
content: l.question ?? "",
|
|
370
638
|
attachments: f.length > 0 ? f : void 0
|
|
371
639
|
}), d != null) {
|
|
372
|
-
const m =
|
|
640
|
+
const m = K(d, p, l.question ?? "", o);
|
|
373
641
|
c.push({
|
|
374
642
|
id: `${p}-answer`,
|
|
375
|
-
historyId:
|
|
643
|
+
historyId: l.history_id,
|
|
376
644
|
role: "assistant",
|
|
377
645
|
answer: m,
|
|
378
646
|
error: !1,
|
|
379
647
|
stopped: !1,
|
|
380
|
-
thinking: { steps:
|
|
648
|
+
thinking: { steps: R(m), expanded: !1 }
|
|
381
649
|
});
|
|
382
650
|
}
|
|
383
651
|
}), c;
|
|
384
|
-
},
|
|
652
|
+
}, yt = async (e, t, n = 10, r, o = 0, s) => {
|
|
385
653
|
if (!t)
|
|
386
|
-
return
|
|
387
|
-
const a = [...await e.getHistoryDetail(t,
|
|
654
|
+
return r == null || r({ type: "users", users: [] }), [];
|
|
655
|
+
const a = [...await e.getHistoryDetail(t, o, n)].sort((d, f) => String(d.create_time || "").localeCompare(String(f.create_time || ""))), c = a.map((d) => d.history_id || V("h")), l = a.map((d, f) => ({
|
|
388
656
|
id: c[f],
|
|
389
657
|
historyId: d.history_id,
|
|
390
658
|
role: "user",
|
|
391
659
|
content: d.question ?? ""
|
|
392
660
|
}));
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
await
|
|
661
|
+
r == null || r({ type: "users", users: l });
|
|
662
|
+
const u = new Array(a.length).fill(null);
|
|
663
|
+
await Q(a, Z, async (d, f) => {
|
|
396
664
|
let m = null;
|
|
397
665
|
try {
|
|
398
666
|
m = await e.getHistoryAnswer(d.history_id || "");
|
|
@@ -401,79 +669,97 @@ const P = (e = "msg") => `${e}-${++me}`, pe = (e) => {
|
|
|
401
669
|
}
|
|
402
670
|
if (m == null)
|
|
403
671
|
return;
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
const
|
|
672
|
+
const j = J(m);
|
|
673
|
+
j.length > 0 && (l[f].attachments = j);
|
|
674
|
+
const I = K(m, c[f], d.question ?? "", s), x = {
|
|
407
675
|
id: `${c[f]}-answer`,
|
|
408
676
|
historyId: d.history_id,
|
|
409
677
|
role: "assistant",
|
|
410
|
-
answer:
|
|
678
|
+
answer: I,
|
|
411
679
|
error: !1,
|
|
412
680
|
stopped: !1,
|
|
413
|
-
thinking: { steps: I
|
|
681
|
+
thinking: { steps: R(I), expanded: !1 }
|
|
414
682
|
};
|
|
415
|
-
|
|
683
|
+
u[f] = x, r == null || r({
|
|
416
684
|
type: "assistant",
|
|
417
685
|
index: f,
|
|
418
|
-
user:
|
|
419
|
-
assistant:
|
|
686
|
+
user: l[f],
|
|
687
|
+
assistant: x
|
|
420
688
|
});
|
|
421
689
|
});
|
|
422
690
|
const p = [];
|
|
423
691
|
return a.forEach((d, f) => {
|
|
424
|
-
p.push(
|
|
425
|
-
const m =
|
|
692
|
+
p.push(l[f]);
|
|
693
|
+
const m = u[f];
|
|
426
694
|
m && p.push(m);
|
|
427
695
|
}), p;
|
|
428
696
|
};
|
|
429
697
|
export {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
re as
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
698
|
+
q as ACTION_EXECUTE_ANSWER_TYPE,
|
|
699
|
+
Ue as CHAT_TITLE_MAX_LENGTH,
|
|
700
|
+
Ze as IFRAME_RESIZER_CHILD_SCRIPT,
|
|
701
|
+
S as IMAGE_EXTENSIONS,
|
|
702
|
+
_ as OUTPUT_FILE_ANSWER_TYPE,
|
|
703
|
+
T as RECORDSET_ANSWER_TYPE,
|
|
704
|
+
st as RoleEnum,
|
|
705
|
+
Ne as actionExecuteParser,
|
|
706
|
+
Me as applyActionExecuteChunk,
|
|
707
|
+
ot as applyAnswerChunk,
|
|
708
|
+
re as applyDeepThinkingChunk,
|
|
709
|
+
le as applyIframePageChunk,
|
|
710
|
+
N as applyKnowledgeStreamChunk,
|
|
711
|
+
be as applyOutputFileChunk,
|
|
712
|
+
he as applyRecordsetChunk,
|
|
713
|
+
it as buildChatTitle,
|
|
714
|
+
nt as cancelClarification,
|
|
715
|
+
rt as clearPendingClarifications,
|
|
716
|
+
oe as collectDeepThinkingSteps,
|
|
717
|
+
R as collectThinkingSteps,
|
|
718
|
+
at as consumeStream,
|
|
719
|
+
F as createEmptyAnswerValues,
|
|
720
|
+
g as createFailureResult,
|
|
721
|
+
ft as createHistoryGroup,
|
|
722
|
+
Be as createLineSplitter,
|
|
723
|
+
se as deepThinkingParser,
|
|
724
|
+
mt as deleteHistoryGroup,
|
|
725
|
+
J as extractAttachmentsFromHistory,
|
|
726
|
+
Je as extractHistoryAttachments,
|
|
727
|
+
G as formatFileSize,
|
|
728
|
+
dt as getHistoryGroups,
|
|
729
|
+
et as hasPendingClarification,
|
|
730
|
+
de as iframePageParser,
|
|
731
|
+
B as injectIframeResizerScript,
|
|
732
|
+
ct as isImageAttachment,
|
|
733
|
+
ne as knowledgeStreamParser,
|
|
734
|
+
ht as loadGroupMessages,
|
|
735
|
+
yt as loadGroupMessagesByStep,
|
|
736
|
+
Ie as nextClarificationRequestId,
|
|
737
|
+
V as nextLocalMessageId,
|
|
738
|
+
Fe as normalizeActionDefinition,
|
|
739
|
+
ke as normalizeActionExecuteReport,
|
|
740
|
+
Se as normalizeActionResult,
|
|
741
|
+
K as normalizeAnswer,
|
|
742
|
+
Re as normalizeAnswerReport,
|
|
743
|
+
ut as normalizeAttachment,
|
|
744
|
+
ue as normalizeIframePageReport,
|
|
745
|
+
te as normalizeKnowledgeStreamReport,
|
|
746
|
+
ve as normalizeOutputFileReport,
|
|
747
|
+
ye as normalizeRecordsetReport,
|
|
748
|
+
ze as outputFileParser,
|
|
749
|
+
Ee as parseActionExecuteCommand,
|
|
750
|
+
je as parseClarificationArguments,
|
|
751
|
+
Y as parseHistoryAttachment,
|
|
752
|
+
k as parseRealtimeAttachment,
|
|
753
|
+
De as parseSseLine,
|
|
754
|
+
U as readOutputFilePayload,
|
|
755
|
+
pe as readRecordsetPayload,
|
|
756
|
+
ge as recordsetParser,
|
|
757
|
+
xe as registerClarification,
|
|
758
|
+
Ye as resolveAttachDownloadUrl,
|
|
759
|
+
lt as resolveAttachPreviewUrl,
|
|
760
|
+
Ge as resolveRemoteFileUrl,
|
|
761
|
+
pt as setHistoryGroupTitle,
|
|
762
|
+
tt as submitClarification,
|
|
763
|
+
Qe as wrapActionFrame
|
|
478
764
|
};
|
|
479
765
|
//# sourceMappingURL=index.js.map
|