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