wi-chat 0.6.1 → 0.6.2
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 +273 -261
- package/dist/core/useChat.d.ts +61 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -33
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +6 -6
- package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +6 -6
- package/dist/mobile-ui/index.cjs +1 -1
- package/dist/mobile-ui/index.js +104 -104
- package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +5 -5
- package/dist/page-context/index.js +2 -4
- package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +1 -7
- package/dist/parser/answerCom/actionExecute/clarification.d.ts +15 -3
- package/dist/parser/answerCom/actionExecute/constants.d.ts +10 -0
- package/dist/parser/answerCom/actionExecute/parseCollectClarifications.d.ts +3 -2
- package/dist/parser/answerCom/actionExecute/parseHostAction.d.ts +3 -2
- package/dist/parser/answerCom/actionExecute/types.d.ts +3 -3
- package/dist/parser/index.cjs +2 -2
- package/dist/parser/index.d.ts +2 -2
- package/dist/parser/index.js +216 -258
- package/dist/parser/registry.d.ts +1 -1
- package/dist/renderers/aiAnswer/AiAnswerBubble.vue.d.ts +4 -4
- package/dist/renderers/clarification/ClarificationCard.vue.d.ts +3 -3
- package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +4 -4
- package/dist/renderers/hostAction/HostActionStatus.vue.d.ts +3 -3
- package/dist/renderers/iframePage/IframePage.vue.d.ts +3 -3
- package/dist/renderers/index.cjs +1 -1
- package/dist/renderers/index.js +484 -498
- package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +3 -3
- package/dist/renderers/outputFile/OutputFile.vue.d.ts +3 -3
- package/dist/renderers/style.css +1 -1
- package/dist/request/index.cjs +2 -2
- package/dist/request/index.js +6 -13
- package/dist/request/ws.d.ts +3 -3
- package/dist/right-panel/RightPanel.vue.d.ts +6 -6
- package/dist/right-panel/RightPanelIcon.vue.d.ts +4 -4
- package/dist/right-panel/RightPanelTabs.vue.d.ts +5 -5
- package/dist/right-panel/index.cjs +1 -1
- package/dist/right-panel/index.js +397 -416
- package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +4 -4
- package/dist/right-panel/panels/web/WebPanel.vue.d.ts +3 -3
- package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +3 -3
- package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +5 -5
- package/dist/theme/index.js +2 -4
- package/dist/tools/index.cjs +2 -2
- package/dist/tools/index.js +10 -19
- package/dist/tools/markdown/MarkdownContent.vue.d.ts +5 -5
- package/dist/tools/useAutoScroll.d.ts +3 -3
- package/dist/web-ui/attach/AttachmentCard.vue.d.ts +6 -6
- package/dist/web-ui/attach/AttachmentList.vue.d.ts +6 -6
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +6 -6
- package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +6 -6
- package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +5 -5
- package/dist/web-ui/index.cjs +1 -1
- package/dist/web-ui/index.js +630 -635
- package/dist/web-ui/inputbox/Inputbox.vue.d.ts +7 -7
- package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +4 -4
- package/package.json +2 -1
package/dist/parser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const k = () => ({
|
|
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), ne = (e = "", t = "") => ({
|
|
5
5
|
id: e,
|
|
6
6
|
question: t,
|
|
7
7
|
answer: { reports: [] }
|
|
@@ -10,62 +10,56 @@ const x = () => ({
|
|
|
10
10
|
"knowledge_stream",
|
|
11
11
|
"knowledge_stream_result",
|
|
12
12
|
"knowledge_stream_end"
|
|
13
|
-
],
|
|
14
|
-
var
|
|
15
|
-
if (!e.mode || !re.includes(e.mode))
|
|
16
|
-
return !1;
|
|
13
|
+
], H = (e, t, n, r) => {
|
|
14
|
+
var l;
|
|
15
|
+
if (!e.mode || !re.includes(e.mode)) return !1;
|
|
17
16
|
if (e.mode === "knowledge_stream_result" || e.mode === "knowledge_stream_end")
|
|
18
17
|
return !0;
|
|
19
|
-
const o = r == null ? void 0 : r.beforeKnowledgeRender, s = (
|
|
18
|
+
const o = r == null ? void 0 : r.beforeKnowledgeRender, s = (u) => o ? o(u) : u;
|
|
20
19
|
if (e.mode === "knowledge_stream_begin") {
|
|
21
|
-
const
|
|
22
|
-
return (
|
|
20
|
+
const u = t.at(-1);
|
|
21
|
+
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(k()), !0);
|
|
23
22
|
}
|
|
24
|
-
if (e.mode !== "knowledge_stream")
|
|
25
|
-
return !1;
|
|
23
|
+
if (e.mode !== "knowledge_stream") return !1;
|
|
26
24
|
let i = t.at(-1);
|
|
27
|
-
i && !i.answer_type ? i =
|
|
25
|
+
i && !i.answer_type ? i = P(i) : (!i || i.answer_type !== "knowledge_stream_result") && (i = k(), t.push(i)), i.values = (l = i.values) != null && l.length ? i.values : [{ answer: "" }];
|
|
28
26
|
const a = i.values[i.values.length - 1], c = `${a.raw ?? ""}${e.value || ""}`;
|
|
29
27
|
return a.raw = c, a.answer = s(c), !0;
|
|
30
28
|
}, oe = (e, t) => {
|
|
31
|
-
if (Array.isArray(e.values) && e.values.length)
|
|
32
|
-
return e;
|
|
29
|
+
if (Array.isArray(e.values) && e.values.length) return e;
|
|
33
30
|
const n = t == null ? void 0 : t.beforeKnowledgeRender, r = (s) => n ? n(s) : s;
|
|
34
31
|
let o = [];
|
|
35
32
|
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
33
|
}, se = {
|
|
37
34
|
id: "knowledge_stream",
|
|
38
35
|
answerType: "knowledge_stream_result",
|
|
39
|
-
applyChunk:
|
|
36
|
+
applyChunk: H,
|
|
40
37
|
normalizeReport: oe
|
|
41
|
-
},
|
|
42
|
-
if (!
|
|
43
|
-
return !1;
|
|
38
|
+
}, D = ["begin", "begin_stream", "send_stream", "end_stream"], ie = (e, t) => {
|
|
39
|
+
if (!D.includes(e.mode || "")) return !1;
|
|
44
40
|
let n = t.at(-1);
|
|
45
41
|
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
42
|
}, ae = (e) => {
|
|
47
43
|
const t = [];
|
|
48
44
|
let n = "", r = !1;
|
|
49
45
|
for (const o of (e.exec_process ?? []).filter(
|
|
50
|
-
(s) =>
|
|
46
|
+
(s) => D.includes(s.mode || "")
|
|
51
47
|
)) {
|
|
52
48
|
const s = typeof o.value == "string" ? o.value : "";
|
|
53
49
|
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
50
|
}
|
|
55
51
|
return r && n.trim() && t.push(n.trim()), t;
|
|
56
|
-
},
|
|
52
|
+
}, B = (e) => {
|
|
57
53
|
var t;
|
|
58
54
|
return (((t = e.answer) == null ? void 0 : t.reports) ?? []).flatMap(ae);
|
|
59
55
|
}, ce = {
|
|
60
56
|
id: "deep_thinking",
|
|
61
57
|
applyChunk: ie
|
|
62
|
-
}, D = '/**\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', le = "iframe-resizer/child 5.1.5", st = D, S = `<script>${D}<\/script>`, ue = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), B = (e) => {
|
|
63
|
-
if (!e || typeof e != "object")
|
|
64
|
-
return {};
|
|
58
|
+
}, U = '/**\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', le = "iframe-resizer/child 5.1.5", st = U, A = `<script>${U}<\/script>`, ue = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), W = (e) => {
|
|
59
|
+
if (!e || typeof e != "object") return {};
|
|
65
60
|
const t = e.values, n = (s) => {
|
|
66
61
|
const i = t && typeof t == "object" ? t[s] : void 0;
|
|
67
|
-
if (typeof i == "string" && i)
|
|
68
|
-
return i;
|
|
62
|
+
if (typeof i == "string" && i) return i;
|
|
69
63
|
const a = e[s];
|
|
70
64
|
return typeof a == "string" && a ? a : void 0;
|
|
71
65
|
}, r = n("url"), o = n("srcdoc");
|
|
@@ -73,71 +67,59 @@ const x = () => ({
|
|
|
73
67
|
...r ? { url: r } : {},
|
|
74
68
|
...o ? { srcdoc: o } : {}
|
|
75
69
|
};
|
|
76
|
-
},
|
|
77
|
-
if (e.mode !== "result" || ue(e.value) !== "url")
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc = U(t.srcdoc)), e.values = t), e;
|
|
86
|
-
}, pe = {
|
|
70
|
+
}, q = (e) => e && (e.includes("</head>") ? e.replace("</head>", `${A}</head>`) : e.includes("<body") ? e.replace("<body", `${A}<body`) : A + e), de = (e) => !e || typeof e != "object" || Array.isArray(e) || !e.url && !e.srcdoc ? !1 : !e.srcdoc || e.srcdoc.includes(le), fe = (e, t) => {
|
|
71
|
+
if (e.mode !== "result" || ue(e.value) !== "url") return !1;
|
|
72
|
+
const n = W(e.value);
|
|
73
|
+
return !n.url && !n.srcdoc || (n.srcdoc && (n.srcdoc = q(n.srcdoc)), t.push({ answer_type: "url", values: n })), !0;
|
|
74
|
+
}, pe = (e) => {
|
|
75
|
+
if (de(e.values)) return e;
|
|
76
|
+
const t = W(e);
|
|
77
|
+
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc = q(t.srcdoc)), e.values = t), e;
|
|
78
|
+
}, me = {
|
|
87
79
|
id: "iframe_page",
|
|
88
80
|
answerType: "url",
|
|
89
81
|
applyChunk: fe,
|
|
90
|
-
normalizeReport:
|
|
91
|
-
},
|
|
92
|
-
if (!e || typeof e != "object" || Array.isArray(e))
|
|
93
|
-
return;
|
|
82
|
+
normalizeReport: pe
|
|
83
|
+
}, T = "recordset", ye = ["cols", "values", "chart", "title", "max_cols", "parent_link_col", "agent_key"], he = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), v = (e) => !!e && typeof e == "object" && !Array.isArray(e) && (Array.isArray(e.cols) || Array.isArray(e.values)), ge = (e) => {
|
|
84
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
94
85
|
const t = e.values;
|
|
95
|
-
if (v(t))
|
|
96
|
-
|
|
97
|
-
if (v(e))
|
|
98
|
-
return e;
|
|
86
|
+
if (v(t)) return t;
|
|
87
|
+
if (v(e)) return e;
|
|
99
88
|
}, we = (e, t) => {
|
|
100
|
-
if (e.mode !== "result" || he(e.value) !==
|
|
101
|
-
return !1;
|
|
89
|
+
if (e.mode !== "result" || he(e.value) !== T) return !1;
|
|
102
90
|
const n = ge(e.value);
|
|
103
|
-
return n && t.push({ answer_type:
|
|
91
|
+
return n && t.push({ answer_type: T, values: n }), !0;
|
|
104
92
|
}, be = (e) => {
|
|
105
|
-
if (v(e.values))
|
|
106
|
-
return e;
|
|
93
|
+
if (v(e.values)) return e;
|
|
107
94
|
const t = e;
|
|
108
|
-
if (!v(t))
|
|
109
|
-
return e;
|
|
95
|
+
if (!v(t)) return e;
|
|
110
96
|
const n = {};
|
|
111
97
|
for (const r of ye)
|
|
112
98
|
n[r] = t[r];
|
|
113
99
|
return e.values = n, e;
|
|
114
100
|
}, ve = {
|
|
115
101
|
id: "recordset",
|
|
116
|
-
answerType:
|
|
102
|
+
answerType: T,
|
|
117
103
|
applyChunk: we,
|
|
118
104
|
normalizeReport: be
|
|
119
105
|
}, _ = "output_file", _e = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), b = (e, t) => {
|
|
120
|
-
if (!e || typeof e != "object")
|
|
121
|
-
return;
|
|
106
|
+
if (!e || typeof e != "object") return;
|
|
122
107
|
const n = e[t];
|
|
123
108
|
return typeof n == "string" && n ? n : void 0;
|
|
124
|
-
},
|
|
125
|
-
if (!e || typeof e != "object")
|
|
126
|
-
return {};
|
|
109
|
+
}, X = (e) => {
|
|
110
|
+
if (!e || typeof e != "object") return {};
|
|
127
111
|
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
112
|
return {
|
|
129
113
|
...n ? { file_id: n } : {},
|
|
130
114
|
...r ? { file_name: r } : {}
|
|
131
115
|
};
|
|
132
116
|
}, ze = (e, t) => {
|
|
133
|
-
if (e.mode !== "result" || _e(e.value) !== _)
|
|
134
|
-
|
|
135
|
-
const n = W(e.value);
|
|
117
|
+
if (e.mode !== "result" || _e(e.value) !== _) return !1;
|
|
118
|
+
const n = X(e.value);
|
|
136
119
|
return !n.file_id && !n.file_name || t.push({ answer_type: _, values: n }), !0;
|
|
137
120
|
}, Ee = (e) => {
|
|
138
|
-
const t =
|
|
139
|
-
if (!t.file_id && !t.file_name)
|
|
140
|
-
return e;
|
|
121
|
+
const t = X(e);
|
|
122
|
+
if (!t.file_id && !t.file_name) return e;
|
|
141
123
|
const n = e.values && typeof e.values == "object" && !Array.isArray(e.values) ? e.values : {};
|
|
142
124
|
return (!t.file_id || n.file_id) && (!t.file_name || n.file_name) || (e.values = { ...n, ...t }), e;
|
|
143
125
|
}, Se = {
|
|
@@ -145,13 +127,12 @@ const x = () => ({
|
|
|
145
127
|
answerType: _,
|
|
146
128
|
applyChunk: ze,
|
|
147
129
|
normalizeReport: Ee
|
|
148
|
-
},
|
|
130
|
+
}, g = (e) => ({
|
|
149
131
|
success: !1,
|
|
150
132
|
message: e,
|
|
151
133
|
data: null
|
|
152
134
|
}), Ae = (e) => {
|
|
153
|
-
if (typeof e != "string")
|
|
154
|
-
return e;
|
|
135
|
+
if (typeof e != "string") return e;
|
|
155
136
|
try {
|
|
156
137
|
return JSON.parse(e);
|
|
157
138
|
} catch {
|
|
@@ -159,11 +140,9 @@ const x = () => ({
|
|
|
159
140
|
}
|
|
160
141
|
}, Ce = (e) => {
|
|
161
142
|
const t = Ae(e);
|
|
162
|
-
if (!t || typeof t != "object")
|
|
163
|
-
throw new Error("执行指令格式无效");
|
|
143
|
+
if (!t || typeof t != "object") throw new Error("执行指令格式无效");
|
|
164
144
|
const { type: n, executor: r, action: o } = t;
|
|
165
|
-
if (n !== "action_execute")
|
|
166
|
-
throw new Error(`不支持的指令类型:${String(n ?? "")}`);
|
|
145
|
+
if (n !== "action_execute") throw new Error(`不支持的指令类型:${String(n ?? "")}`);
|
|
167
146
|
if (r !== "host" && r !== "agent")
|
|
168
147
|
throw new Error(`不支持的执行端:${String(r ?? "")}`);
|
|
169
148
|
if (!o || typeof o != "object" || typeof o.name != "string" || !o.name.trim())
|
|
@@ -180,9 +159,9 @@ const x = () => ({
|
|
|
180
159
|
};
|
|
181
160
|
}, Te = (e, t = "执行端未返回有效的执行结果") => {
|
|
182
161
|
if (!e || typeof e != "object")
|
|
183
|
-
return
|
|
162
|
+
return g(t);
|
|
184
163
|
const n = e;
|
|
185
|
-
return typeof n.success != "boolean" ?
|
|
164
|
+
return typeof n.success != "boolean" ? g("执行端返回的 success 必须是布尔值") : {
|
|
186
165
|
success: n.success,
|
|
187
166
|
message: typeof n.message == "string" ? n.message : n.success ? "操作成功" : "操作失败",
|
|
188
167
|
data: Object.prototype.hasOwnProperty.call(n, "data") ? n.data ?? null : null
|
|
@@ -201,13 +180,9 @@ const x = () => ({
|
|
|
201
180
|
data: e
|
|
202
181
|
};
|
|
203
182
|
}
|
|
204
|
-
return
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
arguments: e.arguments
|
|
208
|
-
}), Re = (e) => typeof e.reply_id == "string" || typeof e.reply_id == "number" ? e.reply_id : void 0, q = (e) => {
|
|
209
|
-
if ((e == null ? void 0 : e.mode) !== "front_reply")
|
|
210
|
-
return { kind: "ignored" };
|
|
183
|
+
return g("系统操作返回了无法识别的报文帧");
|
|
184
|
+
}, Re = (e) => typeof e.reply_id == "string" || typeof e.reply_id == "number" ? e.reply_id : void 0, K = (e) => {
|
|
185
|
+
if ((e == null ? void 0 : e.mode) !== "front_reply") return { kind: "ignored" };
|
|
211
186
|
const t = Re(e), n = e.values ?? e.value;
|
|
212
187
|
let r = n;
|
|
213
188
|
if (typeof n == "string")
|
|
@@ -227,9 +202,9 @@ const x = () => ({
|
|
|
227
202
|
error: o instanceof Error ? o : new Error("执行指令解析失败")
|
|
228
203
|
};
|
|
229
204
|
}
|
|
230
|
-
}, $e = ["single_select", "multi_select", "date", "text"], y = /* @__PURE__ */ new Map();
|
|
231
|
-
let
|
|
232
|
-
const w = (e) => !!e && typeof e == "object" && !Array.isArray(e),
|
|
205
|
+
}, $ = "collect_clarifications", I = "host_action", $e = ["single_select", "multi_select", "date", "text"], y = /* @__PURE__ */ new Map();
|
|
206
|
+
let M = 0;
|
|
207
|
+
const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), h = (e) => typeof e == "string" && e.trim() ? e : void 0, Ie = (e, t) => {
|
|
233
208
|
if (!Array.isArray(e) || e.length === 0)
|
|
234
209
|
throw new Error(`确认项 ${t} 缺少可选项`);
|
|
235
210
|
return e.map((n, r) => {
|
|
@@ -243,10 +218,8 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
243
218
|
};
|
|
244
219
|
});
|
|
245
220
|
}, je = (e) => {
|
|
246
|
-
if (e === void 0)
|
|
247
|
-
|
|
248
|
-
if (!w(e))
|
|
249
|
-
throw new Error("确认项的 binding 必须是对象");
|
|
221
|
+
if (e === void 0) return;
|
|
222
|
+
if (!w(e)) throw new Error("确认项的 binding 必须是对象");
|
|
250
223
|
const t = {};
|
|
251
224
|
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;
|
|
252
225
|
}, xe = (e, t) => {
|
|
@@ -254,7 +227,7 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
254
227
|
throw new Error(`确认项 ${t} 的 input.type 无效`);
|
|
255
228
|
const n = e.type, r = {
|
|
256
229
|
type: n,
|
|
257
|
-
placeholder:
|
|
230
|
+
placeholder: h(e.placeholder)
|
|
258
231
|
};
|
|
259
232
|
if ((n === "single_select" || n === "multi_select") && (r.options = Ie(e.options, t)), n === "date") {
|
|
260
233
|
if (e.format !== void 0 && e.format !== "YYYY-MM-DD")
|
|
@@ -262,10 +235,9 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
262
235
|
r.format = "YYYY-MM-DD";
|
|
263
236
|
}
|
|
264
237
|
if (e.textInput !== void 0) {
|
|
265
|
-
if (!w(e.textInput))
|
|
266
|
-
throw new Error(`确认项 ${t} 的 textInput 必须是对象`);
|
|
238
|
+
if (!w(e.textInput)) throw new Error(`确认项 ${t} 的 textInput 必须是对象`);
|
|
267
239
|
r.textInput = {
|
|
268
|
-
placeholder:
|
|
240
|
+
placeholder: h(e.textInput.placeholder)
|
|
269
241
|
};
|
|
270
242
|
}
|
|
271
243
|
return r;
|
|
@@ -273,19 +245,15 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
273
245
|
if (!Array.isArray(e.items) || e.items.length === 0)
|
|
274
246
|
throw new Error("collect_clarifications 至少需要一个确认项");
|
|
275
247
|
const t = /* @__PURE__ */ new Set(), n = e.items.map((r, o) => {
|
|
276
|
-
if (!w(r))
|
|
277
|
-
throw new Error(`第 ${o + 1} 个确认项格式无效`);
|
|
248
|
+
if (!w(r)) throw new Error(`第 ${o + 1} 个确认项格式无效`);
|
|
278
249
|
const s = typeof r.id == "string" ? r.id.trim() : "", i = typeof r.question == "string" ? r.question.trim() : "";
|
|
279
|
-
if (!s)
|
|
280
|
-
|
|
281
|
-
if (
|
|
282
|
-
throw new Error(`确认项 id 重复:${s}`);
|
|
283
|
-
if (!i)
|
|
284
|
-
throw new Error(`确认项 ${s} 缺少 question`);
|
|
250
|
+
if (!s) throw new Error(`第 ${o + 1} 个确认项缺少 id`);
|
|
251
|
+
if (t.has(s)) throw new Error(`确认项 id 重复:${s}`);
|
|
252
|
+
if (!i) throw new Error(`确认项 ${s} 缺少 question`);
|
|
285
253
|
return t.add(s), {
|
|
286
254
|
id: s,
|
|
287
255
|
question: i,
|
|
288
|
-
description:
|
|
256
|
+
description: h(r.description),
|
|
289
257
|
required: r.required !== !1,
|
|
290
258
|
default: r.default,
|
|
291
259
|
binding: je(r.binding),
|
|
@@ -293,25 +261,26 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
293
261
|
};
|
|
294
262
|
});
|
|
295
263
|
return {
|
|
296
|
-
title:
|
|
297
|
-
description:
|
|
264
|
+
title: h(e.title) ?? "需要你确认几项信息",
|
|
265
|
+
description: h(e.description) ?? "请补充以下信息,我会据此继续完成操作。",
|
|
298
266
|
items: n
|
|
299
267
|
};
|
|
300
|
-
}, ke = (e) => e !== void 0 ? String(e) : (
|
|
268
|
+
}, ke = (e) => e !== void 0 ? String(e) : (M += 1, `clarification-${Date.now()}-${M}`), Pe = (e) => {
|
|
301
269
|
y.set(e.reportId, e);
|
|
302
|
-
},
|
|
303
|
-
const n = e.reports.findIndex(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
270
|
+
}, at = (e) => y.has(e), E = (e, t) => {
|
|
271
|
+
const n = e.reports.findIndex(
|
|
272
|
+
(r) => {
|
|
273
|
+
var o;
|
|
274
|
+
return r.answer_type === $ && ((o = r.values) == null ? void 0 : o.requestId) === e.reportId;
|
|
275
|
+
}
|
|
276
|
+
);
|
|
307
277
|
n < 0 || e.reports.splice(n, 1, {
|
|
308
278
|
...e.reports[n],
|
|
309
279
|
values: { ...e.reports[n].values, ...t }
|
|
310
280
|
});
|
|
311
|
-
},
|
|
281
|
+
}, V = (e, t) => {
|
|
312
282
|
var n;
|
|
313
|
-
if (!e.reply)
|
|
314
|
-
return !1;
|
|
283
|
+
if (!e.reply) return !1;
|
|
315
284
|
try {
|
|
316
285
|
return e.reply({
|
|
317
286
|
type: "wait_reply",
|
|
@@ -321,148 +290,147 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
321
290
|
} catch (r) {
|
|
322
291
|
return (n = e.onError) == null || n.call(e, r), !1;
|
|
323
292
|
}
|
|
324
|
-
},
|
|
293
|
+
}, ct = (e, t) => {
|
|
325
294
|
const n = y.get(e);
|
|
326
|
-
if (!n)
|
|
327
|
-
return !1;
|
|
295
|
+
if (!n) return !1;
|
|
328
296
|
y.delete(e);
|
|
329
|
-
const r =
|
|
297
|
+
const r = V(n, {
|
|
330
298
|
success: !0,
|
|
331
299
|
message: "用户已提交补充信息",
|
|
332
300
|
data: { answers: t }
|
|
333
301
|
});
|
|
334
|
-
return
|
|
302
|
+
return E(n, {
|
|
335
303
|
status: "submitted",
|
|
336
304
|
resultMessage: r ? "补充信息已提交" : "补充信息已提交,但结果回传失败(连接已关闭)",
|
|
337
305
|
answers: t
|
|
338
306
|
}), !0;
|
|
339
|
-
},
|
|
307
|
+
}, lt = (e) => {
|
|
340
308
|
const t = y.get(e);
|
|
341
|
-
if (!t)
|
|
342
|
-
return !1;
|
|
309
|
+
if (!t) return !1;
|
|
343
310
|
y.delete(e);
|
|
344
|
-
const n =
|
|
311
|
+
const n = V(t, {
|
|
345
312
|
success: !1,
|
|
346
313
|
message: "用户取消了补充信息",
|
|
347
314
|
data: null
|
|
348
315
|
});
|
|
349
|
-
return
|
|
316
|
+
return E(t, {
|
|
350
317
|
status: "cancelled",
|
|
351
318
|
resultMessage: n ? "已取消补充信息" : "已取消补充信息,但结果回传失败(连接已关闭)"
|
|
352
319
|
}), !0;
|
|
353
|
-
},
|
|
354
|
-
y.forEach((
|
|
355
|
-
|
|
320
|
+
}, ut = (e) => {
|
|
321
|
+
y.forEach((t, n) => {
|
|
322
|
+
e && t.reply !== e || (E(t, {
|
|
356
323
|
status: "expired",
|
|
357
324
|
resultMessage: "本次补充信息已失效(回答已结束)"
|
|
358
|
-
});
|
|
359
|
-
})
|
|
360
|
-
},
|
|
325
|
+
}), y.delete(n));
|
|
326
|
+
});
|
|
327
|
+
}, dt = (e) => {
|
|
328
|
+
y.forEach((t, n) => {
|
|
329
|
+
t.reply === e && (E(t, {
|
|
330
|
+
status: "expired",
|
|
331
|
+
resultMessage: "本次补充信息已失效(连接已关闭)"
|
|
332
|
+
}), y.delete(n));
|
|
333
|
+
});
|
|
334
|
+
}, Y = (e, t, n) => {
|
|
361
335
|
var r;
|
|
362
|
-
if (!(e != null && e.reply))
|
|
363
|
-
return !1;
|
|
336
|
+
if (!(e != null && e.reply)) return !1;
|
|
364
337
|
try {
|
|
365
338
|
const o = { type: "wait_reply", reply_id: t, values: n };
|
|
366
339
|
return e.reply(o) !== !1;
|
|
367
340
|
} catch (o) {
|
|
368
341
|
return (r = e.onError) == null || r.call(e, o), !1;
|
|
369
342
|
}
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
},
|
|
373
|
-
var
|
|
374
|
-
const o =
|
|
375
|
-
if (o.kind !== "ok")
|
|
376
|
-
return !1;
|
|
343
|
+
}, R = (e, t, n) => {
|
|
344
|
+
Y(e, t, g(n));
|
|
345
|
+
}, Me = (e, t, n, r) => {
|
|
346
|
+
var p;
|
|
347
|
+
const o = K(e);
|
|
348
|
+
if (o.kind !== "ok") return !1;
|
|
377
349
|
const { command: s, replyId: i } = o;
|
|
378
|
-
if (s.executor !== "agent" || s.action.name !== "collect_clarifications")
|
|
379
|
-
return !1;
|
|
350
|
+
if (s.executor !== "agent" || s.action.name !== "collect_clarifications") return !1;
|
|
380
351
|
const a = r == null ? void 0 : r.actionExecute;
|
|
381
352
|
let c;
|
|
382
353
|
try {
|
|
383
354
|
c = Oe(s.action.arguments);
|
|
384
355
|
} catch (d) {
|
|
385
|
-
return (
|
|
356
|
+
return (p = a == null ? void 0 : a.onError) == null || p.call(a, d), R(a, i, d instanceof Error ? d.message : "确认项参数无效"), !0;
|
|
386
357
|
}
|
|
387
|
-
const
|
|
388
|
-
requestId:
|
|
358
|
+
const l = ke(i), u = {
|
|
359
|
+
requestId: l,
|
|
389
360
|
...c,
|
|
390
361
|
status: "pending",
|
|
391
362
|
resultMessage: ""
|
|
392
363
|
};
|
|
393
364
|
return Pe({
|
|
394
|
-
reportId:
|
|
365
|
+
reportId: l,
|
|
395
366
|
replyId: i,
|
|
396
367
|
reports: t,
|
|
397
368
|
reply: a == null ? void 0 : a.reply,
|
|
398
369
|
onError: a == null ? void 0 : a.onError
|
|
399
|
-
}), t.push({ answer_type:
|
|
370
|
+
}), t.push({ answer_type: $, values: u }), !0;
|
|
400
371
|
}, Ne = (e) => {
|
|
401
372
|
const t = e.values;
|
|
402
373
|
!t || typeof t != "object" || t.status === "pending" && (t.status = "expired", t.resultMessage = "本次补充信息已失效(回答已结束)");
|
|
403
374
|
}, Le = {
|
|
404
375
|
id: "collect_clarifications",
|
|
405
|
-
answerType:
|
|
376
|
+
answerType: $,
|
|
406
377
|
applyChunk: Me,
|
|
407
378
|
normalizeReport: Ne
|
|
408
|
-
}
|
|
409
|
-
let
|
|
410
|
-
const He = (e) => e !== void 0 ? String(e) : (
|
|
379
|
+
};
|
|
380
|
+
let N = 0;
|
|
381
|
+
const He = (e) => e !== void 0 ? String(e) : (N += 1, `host-action-${Date.now()}-${N}`), De = (e, t, n) => {
|
|
411
382
|
const r = e.findIndex((o) => {
|
|
412
383
|
var s;
|
|
413
|
-
return o.answer_type ===
|
|
384
|
+
return o.answer_type === I && ((s = o.values) == null ? void 0 : s.id) === t;
|
|
414
385
|
});
|
|
415
386
|
r < 0 || e.splice(r, 1, {
|
|
416
387
|
...e[r],
|
|
417
388
|
values: { ...e[r].values, ...n }
|
|
418
389
|
});
|
|
419
|
-
}, Be = async (e, t, n, r, o) => {
|
|
420
|
-
var
|
|
421
|
-
let
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
} catch (c) {
|
|
428
|
-
(i = o.onError) == null || i.call(o, c), s = h(c instanceof Error ? c.message : `${e.name} 执行失败`);
|
|
429
|
-
}
|
|
390
|
+
}, Be = async (e, t, n, r, o, s) => {
|
|
391
|
+
var a, c;
|
|
392
|
+
let i;
|
|
393
|
+
try {
|
|
394
|
+
i = Te(await s(e), `宿主未返回 ${e.name} 的执行结果`);
|
|
395
|
+
} catch (l) {
|
|
396
|
+
(a = o.onError) == null || a.call(o, l), i = g(l instanceof Error ? l.message : `${e.name} 执行失败`);
|
|
397
|
+
}
|
|
430
398
|
De(r, t, {
|
|
431
|
-
status:
|
|
432
|
-
message:
|
|
433
|
-
data:
|
|
434
|
-
}),
|
|
399
|
+
status: i.success ? "success" : "error",
|
|
400
|
+
message: i.message,
|
|
401
|
+
data: i.data ?? void 0
|
|
402
|
+
}), Y(o, n, i) || (c = o.onError) == null || c.call(o, new Error(`${e.name} 已执行,但 wait_reply 回传失败(连接已关闭)`));
|
|
435
403
|
}, Ue = (e, t, n, r) => {
|
|
436
|
-
var
|
|
437
|
-
const o =
|
|
438
|
-
if (o.kind === "ignored")
|
|
439
|
-
return !1;
|
|
404
|
+
var u;
|
|
405
|
+
const o = K(e);
|
|
406
|
+
if (o.kind === "ignored") return !1;
|
|
440
407
|
const s = r == null ? void 0 : r.actionExecute;
|
|
441
408
|
if (o.kind === "invalid")
|
|
442
|
-
return
|
|
409
|
+
return s != null && s.reply ? ((u = s.onError) == null || u.call(s, o.error), R(s, o.replyId, o.error.message), !0) : !1;
|
|
443
410
|
const { command: i, replyId: a } = o;
|
|
444
|
-
if (i.executor !== "host")
|
|
445
|
-
|
|
446
|
-
|
|
411
|
+
if (i.executor !== "host") return !1;
|
|
412
|
+
if (!(s != null && s.execute))
|
|
413
|
+
return s != null && s.reply ? (R(s, a, "当前页面不支持该操作"), !0) : !1;
|
|
414
|
+
const c = He(a), l = {
|
|
447
415
|
id: c,
|
|
448
416
|
name: i.action.name,
|
|
449
417
|
arguments: i.action.arguments,
|
|
450
418
|
status: "running",
|
|
451
419
|
message: "执行中…"
|
|
452
420
|
};
|
|
453
|
-
return t.push({ answer_type:
|
|
421
|
+
return t.push({ answer_type: I, values: l }), Be(i.action, c, a, t, s, s.execute), !0;
|
|
454
422
|
}, We = (e) => {
|
|
455
423
|
const t = e.values;
|
|
456
424
|
!t || typeof t != "object" || t.status === "running" && (t.status = "unknown", t.message = "执行状态未知(回答已结束)");
|
|
457
425
|
}, qe = {
|
|
458
426
|
id: "host_action",
|
|
459
|
-
answerType:
|
|
427
|
+
answerType: I,
|
|
460
428
|
applyChunk: Ue,
|
|
461
429
|
normalizeReport: We
|
|
462
430
|
}, z = [
|
|
463
431
|
ce,
|
|
464
432
|
se,
|
|
465
|
-
|
|
433
|
+
me,
|
|
466
434
|
ve,
|
|
467
435
|
Se,
|
|
468
436
|
// action_execute 按执行端拆成两个 parser,各自只认自己那一种组合(其余 return false)
|
|
@@ -474,8 +442,7 @@ const He = (e) => e !== void 0 ? String(e) : (P += 1, `host-action-${Date.now()}
|
|
|
474
442
|
}, ft = (e, t, n) => {
|
|
475
443
|
var i;
|
|
476
444
|
const r = (i = e.answer) == null ? void 0 : i.reports;
|
|
477
|
-
if (!r)
|
|
478
|
-
return [];
|
|
445
|
+
if (!r) return [];
|
|
479
446
|
const o = new Set(
|
|
480
447
|
((n == null ? void 0 : n.parsers) ?? []).filter((a) => a.applyChunk && a.answerType).map((a) => a.answerType)
|
|
481
448
|
), s = [];
|
|
@@ -485,8 +452,7 @@ const He = (e) => e !== void 0 ? String(e) : (P += 1, `host-action-${Date.now()}
|
|
|
485
452
|
}, Ke = (e, t) => {
|
|
486
453
|
var s;
|
|
487
454
|
const n = e.answer_type;
|
|
488
|
-
if (!n)
|
|
489
|
-
return;
|
|
455
|
+
if (!n) return;
|
|
490
456
|
const o = ((t == null ? void 0 : t.parsers) ?? []).find((i) => i.answerType === n && !!i.normalizeReport) ?? z.find((i) => i.answerType === n && !!i.normalizeReport);
|
|
491
457
|
(s = o == null ? void 0 : o.normalizeReport) == null || s.call(o, e, t);
|
|
492
458
|
}, G = (e, t = "", n = "", r) => {
|
|
@@ -499,16 +465,15 @@ const He = (e) => e !== void 0 ? String(e) : (P += 1, `host-action-${Date.now()}
|
|
|
499
465
|
return a;
|
|
500
466
|
}
|
|
501
467
|
const s = ne(t, n);
|
|
502
|
-
return typeof o == "string" &&
|
|
503
|
-
},
|
|
468
|
+
return typeof o == "string" && H({ mode: "knowledge_stream", value: o }, s.answer.reports, s, r), s;
|
|
469
|
+
}, pt = {
|
|
504
470
|
User: "user",
|
|
505
471
|
Assistant: "assistant"
|
|
506
472
|
};
|
|
507
473
|
let Ve = 0;
|
|
508
474
|
const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
509
475
|
const t = e.trim();
|
|
510
|
-
if (!t || t === "[DONE]")
|
|
511
|
-
return null;
|
|
476
|
+
if (!t || t === "[DONE]") return null;
|
|
512
477
|
const n = t.replace(/^data:\s*/, "");
|
|
513
478
|
try {
|
|
514
479
|
return JSON.parse(n);
|
|
@@ -532,13 +497,12 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
532
497
|
return e = "", t ? [t] : [];
|
|
533
498
|
}
|
|
534
499
|
};
|
|
535
|
-
}, Je = 30, Ze = /[A-Za-z]:[\\/][^\s"'`,。;;、,()()【】\[\]<>|?*]*/g, Qe = /\\\\[^\s"'`,。;;、,()()【】\[\]<>|?*]+/g, Fe = /(^|[\s"'`((【\[::,,、])((?:\/[^\s"'`,。;;、,()()【】\[\]<>|?*\/]+){2,})/g, et = /^(?:请帮忙|请帮我|帮我看看|帮我把|帮我|帮忙|请把|麻烦你|麻烦|劳驾|请你|请问|帮(?!助))\s*[::,,、\-—]?\s*/,
|
|
500
|
+
}, Je = 30, Ze = /[A-Za-z]:[\\/][^\s"'`,。;;、,()()【】\[\]<>|?*]*/g, Qe = /\\\\[^\s"'`,。;;、,()()【】\[\]<>|?*]+/g, Fe = /(^|[\s"'`((【\[::,,、])((?:\/[^\s"'`,。;;、,()()【】\[\]<>|?*\/]+){2,})/g, et = /^(?:请帮忙|请帮我|帮我看看|帮我把|帮我|帮忙|请把|麻烦你|麻烦|劳驾|请你|请问|帮(?!助))\s*[::,,、\-—]?\s*/, C = (e) => {
|
|
536
501
|
const t = e.split(/[\\/]+/).filter(Boolean);
|
|
537
502
|
return t.length ? t[t.length - 1] : "";
|
|
538
|
-
}, tt = (e) => e.replace(Qe, (t) =>
|
|
503
|
+
}, tt = (e) => e.replace(Qe, (t) => C(t)).replace(Ze, (t) => C(t)).replace(Fe, (t, n, r) => n + C(r)), mt = (e) => {
|
|
539
504
|
let t = String(e ?? "").replace(/\r\n|\r|\n/g, " ").replace(/\s+/g, " ").trim();
|
|
540
|
-
if (!t)
|
|
541
|
-
return "";
|
|
505
|
+
if (!t) return "";
|
|
542
506
|
t = tt(t).replace(/\s+/g, " ").trim();
|
|
543
507
|
let n = "";
|
|
544
508
|
for (; n !== t; )
|
|
@@ -552,8 +516,7 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
552
516
|
try {
|
|
553
517
|
for (; ; ) {
|
|
554
518
|
const { done: i, value: a } = await n.read();
|
|
555
|
-
if (i)
|
|
556
|
-
break;
|
|
519
|
+
if (i) break;
|
|
557
520
|
o.push(r.decode(a, { stream: !0 })).forEach(s);
|
|
558
521
|
}
|
|
559
522
|
o.flush().forEach(s);
|
|
@@ -563,21 +526,19 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
563
526
|
} finally {
|
|
564
527
|
n.releaseLock();
|
|
565
528
|
}
|
|
566
|
-
},
|
|
529
|
+
}, S = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"]), Z = (e) => !e || isNaN(e) ? "" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, ht = (e) => {
|
|
567
530
|
var r;
|
|
568
|
-
if (e.type && e.type !== "file")
|
|
569
|
-
return !1;
|
|
531
|
+
if (e.type && e.type !== "file") return !1;
|
|
570
532
|
const t = e.attachContent || {};
|
|
571
|
-
if (t.groupType === "image")
|
|
572
|
-
return !0;
|
|
533
|
+
if (t.groupType === "image") return !0;
|
|
573
534
|
const n = (t.suffix || ((r = e.name) != null && r.includes(".") ? e.name.split(".").pop() : "") || "").toLowerCase();
|
|
574
|
-
return !!(
|
|
535
|
+
return !!(S.has(n) || t.raw && typeof t.raw.type == "string" && t.raw.type.startsWith("image/"));
|
|
575
536
|
}, nt = (e, t, n) => e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") ? e : `${(t || "").replace(/\/$/, "")}${n}?file_id=${e}`, rt = (e, t = "", n) => e ? n ? n(e) : nt(e, t, "/file/download_file") : "", gt = (e, t = "", n) => {
|
|
576
537
|
const r = e.attachContent || {};
|
|
577
538
|
return r.url ? r.url : typeof r.fileContent == "string" && r.fileContent.startsWith("data:image/") ? r.fileContent : r.fileId ? rt(r.fileId, t, n) : "";
|
|
578
|
-
},
|
|
539
|
+
}, L = (e) => {
|
|
579
540
|
var a;
|
|
580
|
-
const t = (e == null ? void 0 : e.name) || "", n = t.includes(".") && ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "", r =
|
|
541
|
+
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/");
|
|
581
542
|
let o;
|
|
582
543
|
if (r && typeof window < "u" && typeof URL < "u" && e instanceof Blob)
|
|
583
544
|
try {
|
|
@@ -601,7 +562,7 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
601
562
|
};
|
|
602
563
|
}, Q = (e) => {
|
|
603
564
|
var s;
|
|
604
|
-
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 =
|
|
565
|
+
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() : "";
|
|
605
566
|
return {
|
|
606
567
|
type: "file",
|
|
607
568
|
name: t,
|
|
@@ -623,14 +584,14 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
623
584
|
if (!e)
|
|
624
585
|
return { type: "file", name: "", description: "", attachContent: {} };
|
|
625
586
|
if (typeof Blob < "u" && e instanceof Blob)
|
|
626
|
-
return
|
|
587
|
+
return L(e);
|
|
627
588
|
if (typeof e == "object" && e.attachContent) {
|
|
628
589
|
const s = e.type || "file", i = e.name || e.attachContent.file_name || e.attachContent.name || "";
|
|
629
590
|
let a = e.description || "";
|
|
630
591
|
const c = { ...e.attachContent };
|
|
631
|
-
if (s === "file" && (!c.suffix && i.includes(".") && (c.suffix = ((r = i.split(".").pop()) == null ? void 0 : r.toLowerCase()) || ""), (c.groupType === "image" || c.suffix &&
|
|
632
|
-
const
|
|
633
|
-
a = [c.suffix ? c.suffix.toUpperCase() : "",
|
|
592
|
+
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)) {
|
|
593
|
+
const u = typeof c.size == "number" ? Z(c.size) : c.size || "";
|
|
594
|
+
a = [c.suffix ? c.suffix.toUpperCase() : "", u].filter(Boolean).join(" · ");
|
|
634
595
|
}
|
|
635
596
|
return {
|
|
636
597
|
...e,
|
|
@@ -643,7 +604,7 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
643
604
|
if (e.file_id || e.fileId)
|
|
644
605
|
return Q(e);
|
|
645
606
|
if (e.raw && typeof Blob < "u" && e.raw instanceof Blob) {
|
|
646
|
-
const s =
|
|
607
|
+
const s = L(e.raw);
|
|
647
608
|
return {
|
|
648
609
|
...s,
|
|
649
610
|
...e,
|
|
@@ -666,8 +627,7 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
666
627
|
};
|
|
667
628
|
}, F = (e) => ot(e), bt = async (e) => [...(await e.getHistoryGroups()).groups ?? []].sort((r, o) => String(o.create_time ?? "").localeCompare(String(r.create_time ?? ""))), vt = async (e, t) => {
|
|
668
629
|
const n = await e.createHistoryGroup(t), r = (n == null ? void 0 : n.group_id) ?? (n == null ? void 0 : n.history_group_id) ?? "";
|
|
669
|
-
if (!r)
|
|
670
|
-
throw new Error("创建对话分组失败");
|
|
630
|
+
if (!r) throw new Error("创建对话分组失败");
|
|
671
631
|
return r;
|
|
672
632
|
}, _t = (e, t) => e.deleteHistoryGroup(t), zt = (e, t, n) => e.setHistoryGroupTitle(t, n), ee = 5, te = async (e, t, n) => {
|
|
673
633
|
const r = new Array(e.length);
|
|
@@ -680,133 +640,131 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
680
640
|
});
|
|
681
641
|
return await Promise.all(s), r;
|
|
682
642
|
}, Et = async (e, t, n = 10, r = 0, o) => {
|
|
683
|
-
if (!t)
|
|
684
|
-
|
|
685
|
-
const i = [...await e.getHistoryDetail(t, r, n)].sort((u, l) => String(u.create_time || "").localeCompare(String(l.create_time || ""))), a = await te(i, ee, async (u) => {
|
|
643
|
+
if (!t) return [];
|
|
644
|
+
const i = [...await e.getHistoryDetail(t, r, n)].sort((l, u) => String(l.create_time || "").localeCompare(String(u.create_time || ""))), a = await te(i, ee, async (l) => {
|
|
686
645
|
try {
|
|
687
|
-
return await e.getHistoryAnswer(
|
|
646
|
+
return await e.getHistoryAnswer(l.history_id || "");
|
|
688
647
|
} catch {
|
|
689
648
|
return null;
|
|
690
649
|
}
|
|
691
650
|
}), c = [];
|
|
692
|
-
return i.forEach((
|
|
693
|
-
const
|
|
651
|
+
return i.forEach((l, u) => {
|
|
652
|
+
const p = l.history_id || J("h"), d = a[u], f = d != null ? F(d) : [];
|
|
694
653
|
if (c.push({
|
|
695
|
-
id:
|
|
696
|
-
historyId:
|
|
654
|
+
id: p,
|
|
655
|
+
historyId: l.history_id,
|
|
697
656
|
role: "user",
|
|
698
|
-
content:
|
|
657
|
+
content: l.question ?? "",
|
|
699
658
|
attachments: f.length > 0 ? f : void 0
|
|
700
659
|
}), d != null) {
|
|
701
|
-
const
|
|
660
|
+
const m = G(d, p, l.question ?? "", o);
|
|
702
661
|
c.push({
|
|
703
|
-
id: `${
|
|
704
|
-
historyId:
|
|
662
|
+
id: `${p}-answer`,
|
|
663
|
+
historyId: l.history_id,
|
|
705
664
|
role: "assistant",
|
|
706
|
-
answer:
|
|
665
|
+
answer: m,
|
|
707
666
|
error: !1,
|
|
708
667
|
stopped: !1,
|
|
709
|
-
thinking: { steps:
|
|
668
|
+
thinking: { steps: B(m), expanded: !1 }
|
|
710
669
|
});
|
|
711
670
|
}
|
|
712
671
|
}), c;
|
|
713
672
|
}, St = async (e, t, n = 10, r, o = 0, s) => {
|
|
714
673
|
if (!t)
|
|
715
674
|
return r == null || r({ type: "users", users: [] }), [];
|
|
716
|
-
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 || J("h")),
|
|
675
|
+
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 || J("h")), l = a.map((d, f) => ({
|
|
717
676
|
id: c[f],
|
|
718
677
|
historyId: d.history_id,
|
|
719
678
|
role: "user",
|
|
720
679
|
content: d.question ?? ""
|
|
721
680
|
}));
|
|
722
|
-
r == null || r({ type: "users", users:
|
|
723
|
-
const
|
|
681
|
+
r == null || r({ type: "users", users: l });
|
|
682
|
+
const u = new Array(a.length).fill(null);
|
|
724
683
|
await te(a, ee, async (d, f) => {
|
|
725
|
-
let
|
|
684
|
+
let m = null;
|
|
726
685
|
try {
|
|
727
|
-
|
|
686
|
+
m = await e.getHistoryAnswer(d.history_id || "");
|
|
728
687
|
} catch {
|
|
729
|
-
|
|
688
|
+
m = null;
|
|
730
689
|
}
|
|
731
|
-
if (
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
const I = G(p, c[f], d.question ?? "", s), j = {
|
|
690
|
+
if (m == null) return;
|
|
691
|
+
const j = F(m);
|
|
692
|
+
j.length > 0 && (l[f].attachments = j);
|
|
693
|
+
const x = G(m, c[f], d.question ?? "", s), O = {
|
|
736
694
|
id: `${c[f]}-answer`,
|
|
737
695
|
historyId: d.history_id,
|
|
738
696
|
role: "assistant",
|
|
739
|
-
answer:
|
|
697
|
+
answer: x,
|
|
740
698
|
error: !1,
|
|
741
699
|
stopped: !1,
|
|
742
|
-
thinking: { steps:
|
|
700
|
+
thinking: { steps: B(x), expanded: !1 }
|
|
743
701
|
};
|
|
744
|
-
|
|
702
|
+
u[f] = O, r == null || r({
|
|
745
703
|
type: "assistant",
|
|
746
704
|
index: f,
|
|
747
|
-
user:
|
|
748
|
-
assistant:
|
|
705
|
+
user: l[f],
|
|
706
|
+
assistant: O
|
|
749
707
|
});
|
|
750
708
|
});
|
|
751
|
-
const
|
|
709
|
+
const p = [];
|
|
752
710
|
return a.forEach((d, f) => {
|
|
753
|
-
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
}),
|
|
711
|
+
p.push(l[f]);
|
|
712
|
+
const m = u[f];
|
|
713
|
+
m && p.push(m);
|
|
714
|
+
}), p;
|
|
757
715
|
};
|
|
758
716
|
export {
|
|
759
717
|
Je as CHAT_TITLE_MAX_LENGTH,
|
|
760
|
-
|
|
761
|
-
|
|
718
|
+
$ as COLLECT_CLARIFICATIONS_ANSWER_TYPE,
|
|
719
|
+
I as HOST_ACTION_ANSWER_TYPE,
|
|
762
720
|
st as IFRAME_RESIZER_CHILD_SCRIPT,
|
|
763
|
-
|
|
721
|
+
S as IMAGE_EXTENSIONS,
|
|
764
722
|
_ as OUTPUT_FILE_ANSWER_TYPE,
|
|
765
|
-
|
|
766
|
-
|
|
723
|
+
T as RECORDSET_ANSWER_TYPE,
|
|
724
|
+
pt as RoleEnum,
|
|
767
725
|
ft as applyAnswerChunk,
|
|
768
726
|
Me as applyCollectClarificationsChunk,
|
|
769
727
|
ie as applyDeepThinkingChunk,
|
|
770
728
|
Ue as applyHostActionChunk,
|
|
771
729
|
fe as applyIframePageChunk,
|
|
772
|
-
|
|
730
|
+
H as applyKnowledgeStreamChunk,
|
|
773
731
|
ze as applyOutputFileChunk,
|
|
774
732
|
we as applyRecordsetChunk,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
733
|
+
mt as buildChatTitle,
|
|
734
|
+
lt as cancelClarification,
|
|
735
|
+
ut as clearPendingClarifications,
|
|
778
736
|
Le as collectClarificationsParser,
|
|
779
737
|
ae as collectDeepThinkingSteps,
|
|
780
|
-
|
|
738
|
+
B as collectThinkingSteps,
|
|
781
739
|
yt as consumeStream,
|
|
782
740
|
ne as createEmptyAnswerValues,
|
|
783
|
-
|
|
741
|
+
g as createFailureResult,
|
|
784
742
|
vt as createHistoryGroup,
|
|
785
743
|
Ge as createLineSplitter,
|
|
786
744
|
ce as deepThinkingParser,
|
|
787
745
|
_t as deleteHistoryGroup,
|
|
746
|
+
dt as expirePendingClarificationsForReply,
|
|
788
747
|
F as extractAttachmentsFromHistory,
|
|
789
748
|
ot as extractHistoryAttachments,
|
|
790
749
|
Z as formatFileSize,
|
|
791
750
|
bt as getHistoryGroups,
|
|
792
|
-
|
|
751
|
+
at as hasPendingClarification,
|
|
793
752
|
qe as hostActionParser,
|
|
794
|
-
|
|
795
|
-
|
|
753
|
+
me as iframePageParser,
|
|
754
|
+
q as injectIframeResizerScript,
|
|
796
755
|
ht as isImageAttachment,
|
|
797
756
|
se as knowledgeStreamParser,
|
|
798
757
|
Et as loadGroupMessages,
|
|
799
758
|
St as loadGroupMessagesByStep,
|
|
800
759
|
ke as nextClarificationRequestId,
|
|
801
760
|
J as nextLocalMessageId,
|
|
802
|
-
at as normalizeActionDefinition,
|
|
803
761
|
Te as normalizeActionResult,
|
|
804
762
|
G as normalizeAnswer,
|
|
805
763
|
Ke as normalizeAnswerReport,
|
|
806
764
|
wt as normalizeAttachment,
|
|
807
765
|
Ne as normalizeCollectClarificationsReport,
|
|
808
766
|
We as normalizeHostActionReport,
|
|
809
|
-
|
|
767
|
+
pe as normalizeIframePageReport,
|
|
810
768
|
oe as normalizeKnowledgeStreamReport,
|
|
811
769
|
Ee as normalizeOutputFileReport,
|
|
812
770
|
be as normalizeRecordsetReport,
|
|
@@ -814,10 +772,10 @@ export {
|
|
|
814
772
|
Ce as parseActionExecuteCommand,
|
|
815
773
|
Oe as parseClarificationArguments,
|
|
816
774
|
Q as parseHistoryAttachment,
|
|
817
|
-
|
|
775
|
+
L as parseRealtimeAttachment,
|
|
818
776
|
Ye as parseSseLine,
|
|
819
|
-
|
|
820
|
-
|
|
777
|
+
K as readFrontReplyAction,
|
|
778
|
+
X as readOutputFilePayload,
|
|
821
779
|
ge as readRecordsetPayload,
|
|
822
780
|
ve as recordsetParser,
|
|
823
781
|
Pe as registerClarification,
|
|
@@ -825,7 +783,7 @@ export {
|
|
|
825
783
|
gt as resolveAttachPreviewUrl,
|
|
826
784
|
nt as resolveRemoteFileUrl,
|
|
827
785
|
zt as setHistoryGroupTitle,
|
|
828
|
-
|
|
786
|
+
ct as submitClarification,
|
|
829
787
|
it as wrapActionFrame
|
|
830
788
|
};
|
|
831
789
|
//# sourceMappingURL=index.js.map
|