@ibiz-template-plugin/ai-chat 0.0.32 → 0.0.33

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/index.es.js CHANGED
@@ -3559,34 +3559,36 @@ class Ft {
3559
3559
  toolcalls: i.toolcalls
3560
3560
  };
3561
3561
  this.addMessage(s);
3562
- }), !0;
3562
+ }), await this.afterFecthHistory(), !0;
3563
3563
  }
3564
- if (await this.opts.history(this.context, this.params, {
3564
+ return await this.opts.history(this.context, this.params, {
3565
3565
  appDataEntityId: this.appDataEntityId,
3566
3566
  appendCurData: this.opts.appendCurData,
3567
3567
  sessionid: this.chatSessionid
3568
- })) {
3569
- if (this.opts.autoQuestion !== !1) {
3570
- const t = this.messages.value[this.messages.value.length - 1];
3571
- t.role === "USER" && (await this.opts.question(
3572
- this,
3573
- this.context,
3574
- this.params,
3575
- { appDataEntityId: this.appDataEntityId },
3576
- this.getMessages(),
3577
- this.chatSessionid
3578
- ), this.opts.action && await this.opts.action("question", t.content));
3579
- }
3580
- this.opts.appendCurContent && this.addMessage({
3581
- state: 30,
3582
- messageid: le(),
3583
- role: "USER",
3584
- type: "DEFAULT",
3585
- content: this.opts.appendCurContent,
3586
- completed: !0
3587
- });
3568
+ }) && await this.afterFecthHistory(), !0;
3569
+ }
3570
+ /**
3571
+ * 获取历史记录后续处理
3572
+ */
3573
+ async afterFecthHistory() {
3574
+ if (this.opts.appendCurContent && this.addMessage({
3575
+ state: 30,
3576
+ messageid: le(),
3577
+ role: "USER",
3578
+ type: "DEFAULT",
3579
+ content: this.opts.appendCurContent,
3580
+ completed: !0
3581
+ }), this.opts.autoQuestion !== !1) {
3582
+ const e = this.messages.value[this.messages.value.length - 1];
3583
+ e.role === "USER" && (await this.opts.question(
3584
+ this,
3585
+ this.context,
3586
+ this.params,
3587
+ { appDataEntityId: this.appDataEntityId },
3588
+ this.getMessages(),
3589
+ this.chatSessionid
3590
+ ), this.opts.action && await this.opts.action("question", e.content));
3588
3591
  }
3589
- return !0;
3590
3592
  }
3591
3593
  /**
3592
3594
  * 更新数据到indexdb
@@ -1 +1 @@
1
- !function(){function e(e,i,o){return i=n(i),function(e,t){if(t&&("object"==w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,t()?Reflect.construct(i,o||[],n(e).constructor):i.apply(e,o))}function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t=function(){return!!e})()}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function r(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r,a,c=[],s=!0,l=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(i=r.call(n)).done)&&(c.push(i.value),c.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function r(n,i,o,r){var s=i&&i.prototype instanceof c?i:c,l=Object.create(s.prototype);return h(l,"_invoke",function(n,i,o){var r,c,s,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return r=t,c=0,s=e,h.n=n,a}};function f(n,i){for(c=n,s=i,t=0;!d&&l&&!o&&t<u.length;t++){var o,r=u[t],f=h.p,p=r[2];n>3?(o=p===i)&&(s=r[(c=r[4])?5:(c=3,3)],r[4]=r[5]=e):r[0]<=f&&((o=n<2&&f<r[1])?(c=0,h.v=i,h.n=r[1]):f<p&&(o=n<3||r[0]>i||i>p)&&(r[4]=n,r[5]=i,h.n=p,c=0))}if(o||n>1)return a;throw d=!0,i}return function(o,u,p){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,p),c=u,s=p;(t=c<2?e:s)||!d;){r||(c?c<3?(c>1&&(h.n=-1),f(c,s)):h.n=s:h.v=s);try{if(l=2,r){if(c||(o="next"),t=r[o]){if(!(t=t.call(r,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=r.return)&&t.call(r),c<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),c=1);r=e}else if((t=(d=h.n<0)?s:n.call(i,h))!==a)break}catch(t){r=e,c=1,s=t}finally{l=1}}return{value:t,done:d}}}(n,o,r),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(h(t={},i,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,h(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,h(f,"constructor",l),h(l,"constructor",s),s.displayName="GeneratorFunction",h(l,o,"GeneratorFunction"),h(f),h(f,o,"Generator"),h(f,i,function(){return this}),h(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:r,m:p}})()}function h(e,t,n,i){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}h=function(e,t,n,i){function r(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(r("next",0),r("throw",1),r("return",2))},h(e,t,n,i)}function f(e,t,n,i,o,r,a){try{var c=e[r](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(i,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){var r=e.apply(t,n);function a(e){f(r,i,o,a,c,"next",e)}function c(e){f(r,i,o,a,c,"throw",e)}a(void 0)})}}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,y(i.key),i)}}function _(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){var t=function(e,t){if("object"!=w(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=w(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==w(t)?t:t+""}function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}System.register(["interactjs","cherry-markdown","qx-util"],function(t,n){"use strict";var o,s,l;return{setters:[function(e){o=e.default},function(e){s=e.default},function(e){l=e.QXEvent}],execute:function(){var n,h,f,m,y,b,k,C,x,T,N,S,E,A={},M=[],O=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I=Array.isArray;function L(e,t){for(var n in t)e[n]=t[n];return e}function D(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,i){var o,r,a,c={};for(a in t)"key"==a?o=t[a]:"ref"==a?r=t[a]:c[a]=t[a];if(arguments.length>2&&(c.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===c[a]&&(c[a]=e.defaultProps[a]);return P(e,c,o,r,null)}function P(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++f:o,__i:-1,__u:0};return null==o&&null!=h.vnode&&h.vnode(r),r}function B(e){return e.children}function H(e,t){this.props=e,this.context=t}function j(e,t){if(null==t)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?j(e):null}function F(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return F(e)}}function U(e){(!e.__d&&(e.__d=!0)&&y.push(e)&&!W.__r++||b!=h.debounceRendering)&&((b=h.debounceRendering)||k)(W)}function W(){for(var e,t,n,i,o,r,a,c=1;y.length;)y.length>c&&y.sort(C),e=y.shift(),c=y.length,e.__d&&(n=void 0,i=void 0,o=(i=(t=e).__v).__e,r=[],a=[],t.__P&&((n=L({},i)).__v=i.__v+1,h.vnode&&h.vnode(n),J(t.__P,n,i,t.__n,t.__P.namespaceURI,32&i.__u?[o]:null,r,null==o?j(i):o,!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,K(r,n,a),i.__e=i.__=null,n.__e!=o&&F(n)));W.__r=0}function R(e,t,n,i,o,r,a,c,s,l,u){var d,h,f,p,v,m,_,g=i&&i.__k||M,y=t.length;for(s=function(e,t,n,i,o){var r,a,c,s,l,u=n.length,d=u,h=0;for(e.__k=new Array(o),r=0;r<o;r++)null!=(a=t[r])&&"boolean"!=typeof a&&"function"!=typeof a?(s=r+h,(a=e.__k[r]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?P(null,a,null,null,null):I(a)?P(B,{children:a},null,null,null):null==a.constructor&&a.__b>0?P(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,c=null,-1!=(l=a.__i=$(a,n,s,d))&&(d--,(c=n[l])&&(c.__u|=2)),null==c||null==c.__v?(-1==l&&(o>u?h--:o<u&&h++),"function"!=typeof a.type&&(a.__u|=4)):l!=s&&(l==s-1?h--:l==s+1?h++:(l>s?h--:h++,a.__u|=4))):e.__k[r]=null;if(d)for(r=0;r<u;r++)null!=(c=n[r])&&!(2&c.__u)&&(c.__e==i&&(i=j(c)),ne(c,c));return i}(n,t,g,s,y),d=0;d<y;d++)null!=(f=n.__k[d])&&(h=-1==f.__i?A:g[f.__i]||A,f.__i=d,m=J(e,f,h,o,r,a,c,s,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&te(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==v&&null!=p&&(v=p),(_=!!(4&f.__u))||h.__k===f.__k?s=V(f,s,e,_):"function"==typeof f.type&&void 0!==m?s=m:p&&(s=p.nextSibling),f.__u&=-7);return n.__e=v,s}function V(e,t,n,i){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=V(o[r],t,n,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=j(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function q(e,t){return t=t||[],null==e||"boolean"==typeof e||(I(e)?e.some(function(e){q(e,t)}):t.push(e)),t}function $(e,t,n,i){var o,r,a,c=e.key,s=e.type,l=t[n],u=null!=l&&!(2&l.__u);if(null===l&&null==e.key||u&&c==l.key&&s==l.type)return n;if(i>(u?1:0))for(o=n-1,r=n+1;o>=0||r<t.length;)if(null!=(l=t[a=o>=0?o--:r++])&&!(2&l.__u)&&c==l.key&&s==l.type)return a;return-1}function Y(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||O.test(t)?n:n+"px"}function X(e,t,n,i,o){var r,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Y(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Y(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(x,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n.u=i.u:(n.u=T,e.addEventListener(t,r?S:N,r)):e.removeEventListener(t,r?S:N,r);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Z(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=T++;else if(t.t<n.u)return;return n(h.event?h.event(t):t)}}}function J(e,t,n,i,o,r,a,c,s,l){var u,d,f,p,v,m,_,g,y,w,b,k,C,x,T,N,S,E=t.type;if(null!=t.constructor)return null;128&n.__u&&(s=!!(32&n.__u),r=[c=t.__e=n.__e]),(u=h.__b)&&u(t);e:if("function"==typeof E)try{if(g=t.props,y="prototype"in E&&E.prototype.render,w=(u=E.contextType)&&i[u.__c],b=u?w?w.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new E(g,b):(t.__c=d=new H(g,b),d.constructor=E,d.render=ie),w&&w.sub(d),d.props=g,d.state||(d.state={}),d.context=b,d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=E.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=L({},d.__s)),L(d.__s,E.getDerivedStateFromProps(g,d.__s))),p=d.props,v=d.state,d.__v=t,f)y&&null==E.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==E.getDerivedStateFromProps&&g!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(g,b),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(g,d.__s,b)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=g,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(g,d.__s,b),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,v,m)})}if(d.context=b,d.props=g,d.__P=e,d.__e=!1,C=h.__r,x=0,y){for(d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do{d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++x<25);d.state=d.__s,null!=d.getChildContext&&(i=L(L({},i),d.getChildContext())),y&&!f&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(p,v)),N=u,null!=u&&u.type===B&&null==u.key&&(N=Q(u.props.children)),c=R(e,I(N)?N:[N],t,n,i,o,r,a,c,s,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(e){if(t.__v=null,s||null!=r)if(e.then){for(t.__u|=s?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;r[r.indexOf(c)]=null,t.__e=c}else{for(S=r.length;S--;)D(r[S]);G(t)}else t.__e=n.__e,t.__k=n.__k,e.then||G(t);h.__e(e,t,n)}else null==r&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ee(n.__e,t,n,i,o,r,a,s,l);return(u=h.diffed)&&u(t),128&t.__u?void 0:c}function G(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(G)}function K(e,t,n){for(var i=0;i<n.length;i++)te(n[i],n[++i],n[++i]);h.__c&&h.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){h.__e(e,t.__v)}})}function Q(e){return"object"!=w(e)||null==e||e.__b&&e.__b>0?e:I(e)?e.map(Q):L({},e)}function ee(e,t,i,o,r,a,c,s,l){var u,d,f,p,v,m,_,g=i.props,y=t.props,w=t.type;if("svg"==w?r="http://www.w3.org/2000/svg":"math"==w?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=a)for(u=0;u<a.length;u++)if((v=a[u])&&"setAttribute"in v==!!w&&(w?v.localName==w:3==v.nodeType)){e=v,a[u]=null;break}if(null==e){if(null==w)return document.createTextNode(y);e=document.createElementNS(r,w,y.is&&y),s&&(h.__m&&h.__m(t,a),s=!1),a=null}if(null==w)g===y||s&&e.data==y||(e.data=y);else{if(a=a&&n.call(e.childNodes),g=i.props||A,!s&&null!=a)for(g={},u=0;u<e.attributes.length;u++)g[(v=e.attributes[u]).name]=v.value;for(u in g)if(v=g[u],"children"==u);else if("dangerouslySetInnerHTML"==u)f=v;else if(!(u in y)){if("value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y)continue;X(e,u,null,v,r)}for(u in y)v=y[u],"children"==u?p=v:"dangerouslySetInnerHTML"==u?d=v:"value"==u?m=v:"checked"==u?_=v:s&&"function"!=typeof v||g[u]===v||X(e,u,v,g[u],r);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=""),R("template"==t.type?e.content:e,I(p)?p:[p],t,i,o,"foreignObject"==w?"http://www.w3.org/1999/xhtml":r,a,c,a?a[0]:i.__k&&j(i,0),s,l),null!=a)for(u=a.length;u--;)D(a[u]);s||(u="value","progress"==w&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[u]||"progress"==w&&!m||"option"==w&&m!=g[u])&&X(e,u,m,g[u],r),u="checked",null!=_&&_!=e[u]&&X(e,u,_,g[u],r))}return e}function te(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){h.__e(e,n)}}function ne(e,t,n){var i,o;if(h.unmount&&h.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||te(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){h.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&ne(i[o],t,n||"function"!=typeof e.type);n||D(e.__e),e.__c=e.__=e.__e=void 0}function ie(e,t,n){return this.constructor(e,n)}function oe(e,t,i){var o,r,a,c;t==document&&(t=document.documentElement),h.__&&h.__(e,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,a=[],c=[],J(t,e=(!o&&i||t).__k=z(B,null,[e]),r||A,A,t.namespaceURI,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,a,!o&&i?i:r?r.__e:t.firstChild,o,c),K(a,e,c)}n=M.slice,h={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},f=0,m=function(e){return null!=e&&null==e.constructor},H.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=L({},this.state),"function"==typeof e&&(e=e(L({},n),this.props)),e&&L(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),U(this))},H.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),U(this))},H.prototype.render=B,y=[],k="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,C=function(e,t){return e.__v.__b-t.__v.__b},W.__r=0,x=/(PointerCapture)$|Capture$/i,T=0,N=Z(!1),S=Z(!0),E=0;var re=0;function ae(e,t,n,i,o,r){t||(t={});var a,c,s=t;if("ref"in s)for(c in s={},t)"ref"==c?a=t[c]:s[c]=t[c];var l={type:e,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--re,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===s[c]&&(s[c]=a[c]);return h.vnode&&h.vnode(l),l}function ce(e,t,n,i,o){var r="".concat(e,"-").concat(t);return n&&(r+="-".concat(n)),i&&(r+="__".concat(i)),o&&(r+="--".concat(o)),r}var se=function(){return _(function e(t,n){v(this,e),g(this,"namespace",void 0),this.block=t,this.namespace=n||"ibiz"},[{key:"b",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ce(this.namespace,this.block,e,"","")}},{key:"e",value:function(e){return e?ce(this.namespace,this.block,"",e,""):""}},{key:"m",value:function(e){return e?ce(this.namespace,this.block,"","",e):""}},{key:"be",value:function(e,t){return e&&t?ce(this.namespace,this.block,e,t,""):""}},{key:"em",value:function(e,t){return e&&t?ce(this.namespace,this.block,"",e,t):""}},{key:"bm",value:function(e,t){return e&&t?ce(this.namespace,this.block,e,"",t):""}},{key:"bem",value:function(e,t,n){return e&&t&&n?ce(this.namespace,this.block,e,t,n):""}},{key:"is",value:function(e,t){return e&&t?"".concat("is-").concat(e):""}},{key:"cssVar",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t}},{key:"cssVarBlock",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t}},{key:"cssVarName",value:function(e){return"--".concat(this.namespace,"-").concat(e)}},{key:"cssVarBlockName",value:function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)}}])}();function le(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function ue(e,t){for(var n,i="",o=0,r=-1,a=0,c=0;c<=e.length;++c){if(c<e.length)n=e.charCodeAt(c);else{if(47===n)break;n=47}if(47===n){if(r===c-1||1===a);else if(r!==c-1&&2===a){if(i.length<2||2!==o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var s=i.lastIndexOf("/");if(s!==i.length-1){-1===s?(i="",o=0):o=(i=i.slice(0,s)).length-1-i.lastIndexOf("/"),r=c,a=0;continue}}else if(2===i.length||1===i.length){i="",o=0,r=c,a=0;continue}t&&(i.length>0?i+="/..":i="..",o=2)}else i.length>0?i+="/"+e.slice(r+1,c):i=e.slice(r+1,c),o=c-r-1;r=c,a=0}else 46===n&&-1!==a?++a:a=-1}return i}var de={resolve:function(){for(var e,t="",n=!1,i=arguments.length-1;i>=-1&&!n;i--){var o;i>=0?o=arguments[i]:(void 0===e&&(e=process.cwd()),o=e),le(o),0!==o.length&&(t=o+"/"+t,n=47===o.charCodeAt(0))}return t=ue(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(le(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=ue(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return le(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];le(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":de.normalize(e)},relative:function(e,t){if(le(e),le(t),e===t)return"";if((e=de.resolve(e))===(t=de.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,o=i-n,r=1;r<t.length&&47===t.charCodeAt(r);++r);for(var a=t.length-r,c=o<a?o:a,s=-1,l=0;l<=c;++l){if(l===c){if(a>c){if(47===t.charCodeAt(r+l))return t.slice(r+l+1);if(0===l)return t.slice(r+l)}else o>c&&(47===e.charCodeAt(n+l)?s=l:0===l&&(s=0));break}var u=e.charCodeAt(n+l);if(u!==t.charCodeAt(r+l))break;47===u&&(s=l)}var d="";for(l=n+s+1;l<=i;++l)l!==i&&47!==e.charCodeAt(l)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(r+s):(r+=s,47===t.charCodeAt(r)&&++r,t.slice(r))},_makeLong:function(e){return e},dirname:function(e){if(le(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,o=!0,r=e.length-1;r>=1;--r)if(47===(t=e.charCodeAt(r))){if(!o){i=r;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');le(e);var n,i=0,o=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,c=-1;for(n=e.length-1;n>=0;--n){var s=e.charCodeAt(n);if(47===s){if(!r){i=n+1;break}}else-1===c&&(r=!1,c=n+1),a>=0&&(s===t.charCodeAt(a)?-1===--a&&(o=n):(a=-1,o=c))}return i===o?o=c:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!r){i=n+1;break}}else-1===o&&(r=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){le(e);for(var t=-1,n=0,i=-1,o=!0,r=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===i&&(o=!1,i=a+1),46===c?-1===t?t=a:1!==r&&(r=1):-1!==t&&(r=-1);else if(!o){n=a+1;break}}return-1===t||-1===i||0===r||1===r&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!==w(e))throw new TypeError('The "pathObject" argument must be of type Object. Received type '+w(e));return function(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+e+i:i}("/",e)},parse:function(e){le(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),o=47===i;o?(t.root="/",n=1):n=0;for(var r=-1,a=0,c=-1,s=!0,l=e.length-1,u=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===c&&(s=!1,c=l+1),46===i?-1===r?r=l:1!==u&&(u=1):-1!==r&&(u=-1);else if(!s){a=l+1;break}return-1===r||-1===c||0===u||1===u&&r===c-1&&r===a+1?-1!==c&&(t.base=t.name=0===a&&o?e.slice(1,c):e.slice(a,c)):(0===a&&o?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(a,r),t.base=e.slice(a,c)),t.ext=e.slice(r,c)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};function he(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function fe(){return"".concat(he()+he(),"-").concat(he(),"-").concat(he(),"-").concat(he(),"-").concat(he()).concat(he()).concat(he())}de.posix=de;var pe=/<svg\b[^>]*>[\s\S]*?<\/svg>/;function ve(e){return pe.test(e)}var me=function(){return _(function e(){v(this,e)},null,[{key:"copy",value:function(e){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=e,this.inputElement.select(),document.execCommand("copy")}}])}();g(me,"inputElement",null);var _e=function(){function e(){v(this,e)}return _(e,null,[{key:"checkDataBaseExists",value:(u=p(d().m(function e(t){var n,i;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,indexedDB.databases();case 1:return n=e.v,e.a(2,n.some(function(e){return e.name===t}));case 2:return e.p=2,i=e.v,console.error("检查数据库是否存在时出错:",i),e.a(2,!1)}},e,null,[[0,2]])})),function(e){return u.apply(this,arguments)})},{key:"deleteDatabase",value:(l=p(d().m(function t(n){var i,o;return d().w(function(t){for(;;)if(0===t.n)return e.lastLink&&(null===(i=(o=e.lastLink).close)||void 0===i||i.call(o)),t.a(2,new Promise(function(e,t){var i=indexedDB.deleteDatabase(n);i.onsuccess=function(){e(!0)},i.onerror=function(){e(!1)},i.onblocked=function(){console.warn("删除数据库 ".concat(n," 被阻塞,可能有其他连接正在使用该数据库。")),t(new Error("删除数据库 ".concat(n," 被阻塞")))}}))},t)})),function(e){return l.apply(this,arguments)})},{key:"checkTableExists",value:(s=p(d().m(function t(n,i){return d().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.checkDataBaseExists(n);case 1:if(t.v){t.n=2;break}return t.a(2,!1);case 2:return t.a(2,new Promise(function(t,o){var r=indexedDB.open(n);r.onupgradeneeded=function(t){e.db=t.target.result,e.version=e.db.version},r.onsuccess=function(n){e.db=n.target.result,e.lastLink=r.result;var o=e.db.objectStoreNames.contains(i);r.result.close(),t(o)},r.onerror=function(e){o(e.target.error)}}))}},t)})),function(e,t){return s.apply(this,arguments)})},{key:"createTable",value:(c=p(d().m(function t(n,i,o){var r,a=arguments;return d().w(function(t){for(;;)if(0===t.n)return r=a.length>3&&void 0!==a[3]&&a[3],t.a(2,new Promise(function(t){var a,c;e.version+=1,e.lastLink&&(null===(a=(c=e.lastLink).close)||void 0===a||a.call(c));var s=indexedDB.open(n,e.version);s.onupgradeneeded=function(t){if(e.db=t.target.result,!e.db.objectStoreNames.contains(i)){var n={};o?n.keyPath=o:r&&(n.autoIncrement=!0),e.db.createObjectStore(i,n)}},s.onsuccess=function(){e.lastLink=s.result,s.result.close(),t(!0)},s.onerror=function(){t(!1)}}))},t)})),function(e,t,n){return c.apply(this,arguments)})},{key:"deleteTable",value:(a=p(d().m(function t(n,i){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){var o,r;e.version+=1,e.lastLink&&(null===(o=(r=e.lastLink).close)||void 0===o||o.call(r));var a=indexedDB.open(n,e.version);a.onupgradeneeded=function(t){e.db=t.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)&&e.db.deleteObjectStore(i)},a.onsuccess=function(n){e.db=n.target.result,e.lastLink=a.result,a.result.close(),t(!0)},a.onerror=function(){a.result.close(),t(!1)}}))},t)})),function(e,t){return a.apply(this,arguments)})},{key:"addData",value:(r=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var r=e.db.transaction([i],"readwrite").objectStore(i).add(o);r.onsuccess=function(e){t(o)},r.onerror=function(){t(null)}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,n){return r.apply(this,arguments)})},{key:"deleteData",value:(o=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var r=e.db.transaction([i],"readwrite").objectStore(i).delete(o);r.onsuccess=function(e){t(!0)},r.onerror=function(){t(!1)}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,n){return o.apply(this,arguments)})},{key:"updateData",value:(i=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var r=e.db.transaction([i],"readwrite").objectStore(i).put(o);r.onsuccess=function(e){t(o)},r.onerror=function(){t(o)}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,n){return i.apply(this,arguments)})},{key:"getData",value:(n=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var c=e.db.transaction([i],"readonly").objectStore(i).get(o);c.onsuccess=function(e){t(c.result)},c.onerror=function(){r(new Error("未找到数据".concat(o)))}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,i){return n.apply(this,arguments)})},{key:"getAllData",value:(t=p(d().m(function t(n,i){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var r=indexedDB.open(n);r.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=r.result,e.db.objectStoreNames.contains(i)){var o=e.db.transaction([i],"readonly").objectStore(i).getAll();o.onsuccess=function(e){t(o.result)},o.onerror=function(){t([])}}r.result.close()},r.onerror=function(){r.result.close(),o()}}))},t)})),function(e,n){return t.apply(this,arguments)})}]);var t,n,i,o,r,a,c,s,l,u}();g(_e,"version",1),g(_e,"db",null),g(_e,"lastLink",void 0);var ge=function(){return _(function e(t){v(this,e),g(this,"options",void 0),this.options=u({multiple:!0,accept:"*/*",maxSize:5242880},t)},[{key:"openFilePicker",value:function(){var e=this,t=document.createElement("input");t.type="file",t.multiple=this.options.multiple,t.accept=this.options.accept||"",t.onchange=function(t){var n=Array.from(t.target.files||[]);e.handleFiles(n)},t.click()}},{key:"handleFiles",value:(t=p(d().m(function e(t){var n,i,o,r=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(0!==t.length){e.n=1;break}return e.a(2);case 1:return o=t.filter(function(e){var t,n;return!(r.options.maxSize&&e.size>r.options.maxSize&&(null===(t=(n=r.options).onError)||void 0===t||t.call(n,new Error("文件大小超过限制 (".concat(r.formatSize(e.size)," > ").concat(r.formatSize(r.options.maxSize),")")),e),1))}),null===(n=(i=this.options).onSelect)||void 0===n||n.call(i,o),e.n=2,Promise.all(o.map(function(e){return r.processFile(e)}));case 2:return e.a(2)}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"processFile",value:(e=p(d().m(function e(t){var n,i,o,r,a,c,s,l,u,h=this;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a=function(e){var n,i;null===(n=(i=h.options).onProgress)||void 0===n||n.call(i,t,e)},e.n=1,this.options.onUpload(t,a);case 1:c=e.v,null===(n=(i=this.options).onProgress)||void 0===n||n.call(i,t,100),null===(o=(r=this.options).onSuccess)||void 0===o||o.call(r,c,t),e.n=3;break;case 2:e.p=2,u=e.v,null===(s=(l=this.options).onError)||void 0===s||s.call(l,u instanceof Error?u:new Error("上传失败"),t);case 3:return e.a(2)}},e,this,[[0,2]])})),function(t){return e.apply(this,arguments)})},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(2)," ").concat(["B","KB","MB","GB"][t])}}]);var e,t}(),ye=function(){return _(function e(){v(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("resource")).map(function(e){var n=e.getAttribute("type")||"",i=e.querySelector("data"),o=e.querySelector("metadata");try{var r=t.getCdataContent(i),a=t.getCdataContent(o),c=r?JSON.parse(r):{},s=a?JSON.parse(a):{};return{id:c.id,type:n,data:c,metadata:s}}catch(fi){throw new Error("XML 解析错误: ".concat(fi.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<resources\b[^>]*>[\s\S]*?<\/resources>/i.exec(e);if(!t)return{resources:[],remainingText:e,hasResources:!1};var n=a(t,1)[0],i=t.index,o=i+n.length,r=(e.slice(0,i)+e.slice(o)).replace(/\n/g,"");try{return{resources:this.parse(n),remainingText:r,hasResources:!0}}catch(c){return{resources:[],remainingText:r,hasResources:!0,error:"资源解析失败: ".concat(c.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("resources");n.setAttribute("version","1.0");var i=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(i(1)));var o=t.createElement("resource");o.setAttribute("type",e.type),o.setAttribute("version","1.0");var r=function(e,n){var o=t.createElement(e);o.appendChild(t.createTextNode(i(2)));var r=t.createCDATASection(JSON.stringify(n));return o.appendChild(r),o.appendChild(t.createTextNode(i(1))),o};o.appendChild(t.createTextNode(i(2))),o.appendChild(r("data",e.data)),o.appendChild(t.createTextNode(i(2))),o.appendChild(r("metadata",e.metadata)),o.appendChild(t.createTextNode(i(1))),n.appendChild(o)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}(),we=function(){return _(function e(){v(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("suggestion")).map(function(e){var n=e.getAttribute("type")||"",i=e.querySelector("data"),o=e.querySelector("metadata");try{var r=t.getCdataContent(i),a=t.getCdataContent(o);return{type:n,data:r?JSON.parse(r):{},metadata:a?JSON.parse(a):{}}}catch(fi){throw new Error("XML 解析错误: ".concat(fi.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<suggestions\b[^>]*>[\s\S]*?<\/suggestions>/i.exec(e);if(!t)return{suggestions:[],remainingText:e,hasSuggestions:!1};var n=a(t,1)[0],i=t.index,o=i+n.length,r=(e.slice(0,i)+e.slice(o)).replace(/\n/g,"");try{return{suggestions:this.parse(n),remainingText:r,hasSuggestions:!0}}catch(c){return{suggestions:[],remainingText:r,hasSuggestions:!0,error:"资源解析失败: ".concat(c.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("suggestions");n.setAttribute("version","1.0");var i=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(i(1)));var o=t.createElement("suggestion");o.setAttribute("type",e.type),o.setAttribute("version","1.0");var r=function(e,n){var o=t.createElement(e);o.appendChild(t.createTextNode(i(2)));var r=t.createCDATASection(JSON.stringify(n));return o.appendChild(r),o.appendChild(t.createTextNode(i(1))),o};o.appendChild(t.createTextNode(i(2))),o.appendChild(r("data",e.data)),o.appendChild(t.createTextNode(i(2))),o.appendChild(r("metadata",e.metadata)),o.appendChild(t.createTextNode(i(1))),n.appendChild(o)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}();function be(e){return e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1}function ke(e,t,n,i){var o=e/window.innerWidth,r=t/window.innerHeight;return{x:Math.max(0,Math.min(o,1-n)),y:Math.max(0,Math.min(r,1-i))}}function Ce(e){for(var t=0,n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return Math.abs(t).toString(36).toUpperCase()}function xe(e){for(var t=2166136261,n=0;n<e.length;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return Math.abs(t).toString(36).toUpperCase()}function Te(e){for(var t=5381,n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return Math.abs(t).toString(36).toUpperCase()}function Ne(e){return e.replace(/[^A-Z0-9]/g,"")}function Se(e,t){switch(t){case"fnv1a":return xe(e);case"djb2":return Te(e);case"combined":return function(e){for(var t=Ce(e)+xe(e)+Te(e),n="",i=0;i<e.length%10+10;i++){var o=7*i%t.length;n+=t.charAt(o)}return n.toUpperCase()}(e);default:return Ce(e)}}function Ee(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:36;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:36,n=Ne(e);if(n.length>=t)return n.substring(0,t);for(var i=n;i.length<t;)i+=Ne(Se(i,"combined"));return i.substring(0,t)}(Se(e,"combined"),t)}var Ae,Me,Oe,Ie,Le=function(){return _(function e(){v(this,e)},null,[{key:"parse",value:function(e){var t,n=new RegExp("<tool_call>\\s*({[\\s\\S]*?})\\s*</tool_call>","g"),i=[],o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}(e.matchAll(n));try{for(o.s();!(t=o.n()).done;){var r=t.value;try{var a=JSON.parse(r[1]),s={name:a.name,parameters:a.parameters,error:a.error||!1};a.result&&Object.assign(s,{result:a.result}),i.push(s)}catch(fi){console.error("解析工具调用失败:",fi)}}}catch(l){o.e(l)}finally{o.f()}return i}}])}(),De=0,ze=[],Pe=h,Be=Pe.__b,He=Pe.__r,je=Pe.diffed,Fe=Pe.__c,Ue=Pe.unmount,We=Pe.__;function Re(e,t){Pe.__h&&Pe.__h(Me,e,De||t),De=0;var n=Me.__H||(Me.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Ve(e){return De=1,function(e,t,n){var i=Re(Ae++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):nt(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Me,!Me.__f)){var o=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter(function(e){return!!e.__c});if(o.every(function(e){return!e.__N}))return!r||r.call(this,e,t,n);var a=i.__c.props!==e;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),r&&r.call(this,e,t,n)||a};Me.__f=!0;var r=Me.shouldComponentUpdate,a=Me.componentWillUpdate;Me.componentWillUpdate=function(e,t,n){if(this.__e){var i=r;r=void 0,o(e,t,n),r=i}a&&a.call(this,e,t,n)},Me.shouldComponentUpdate=o}return i.__N||i.__}(nt,e)}function qe(e,t){var n=Re(Ae++,3);!Pe.__s&&tt(n.__H,t)&&(n.__=e,n.u=t,Me.__H.__h.push(n))}function $e(e){return De=5,Ye(function(){return{current:e}},[])}function Ye(e,t){var n=Re(Ae++,7);return tt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Xe(e,t){return De=8,Ye(function(){return e},t)}function Ze(e){var t=Me.context[e.__c],n=Re(Ae++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Me)),t.props.value):e.__}function Je(){for(var e;e=ze.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Qe),e.__H.__h.forEach(et),e.__H.__h=[]}catch(pi){e.__H.__h=[],Pe.__e(pi,e.__v)}}Pe.__b=function(e){Me=null,Be&&Be(e)},Pe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),We&&We(e,t)},Pe.__r=function(e){He&&He(e),Ae=0;var t=(Me=e.__c).__H;t&&(Oe===Me?(t.__h=[],Me.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Qe),t.__h.forEach(et),t.__h=[],Ae=0)),Oe=Me},Pe.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ze.push(t)&&Ie===Pe.requestAnimationFrame||((Ie=Pe.requestAnimationFrame)||Ke)(Je)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Oe=Me=null},Pe.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Qe),e.__h=e.__h.filter(function(e){return!e.__||et(e)})}catch(mi){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Pe.__e(mi,e.__v)}}),Fe&&Fe(e,t)},Pe.unmount=function(e){Ue&&Ue(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Qe(e)}catch(e){t=e}}),n.__H=void 0,t&&Pe.__e(t,n.__v))};var Ge="function"==typeof requestAnimationFrame;function Ke(e){var t,n=function(){clearTimeout(i),Ge&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Ge&&(t=requestAnimationFrame(n))}function Qe(e){var t=Me,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Me=t}function et(e){var t=Me;e.__c=e.__(),Me=t}function tt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function nt(e,t){return"function"==typeof t?t(e):t}var it=Symbol.for("preact-signals");function ot(){if(ut>1)ut--;else{for(var e,t=!1;void 0!==lt;){var n=lt;for(lt=void 0,dt++;void 0!==n;){var i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&mt(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=i}}if(dt=0,ut--,t)throw e}}var rt=void 0;function at(e){var t=rt;rt=void 0;try{return e()}finally{rt=t}}var ct,st,lt=void 0,ut=0,dt=0,ht=0;function ft(e){if(void 0!==rt){var t=e.n;if(void 0===t||t.t!==rt)return t={i:0,S:e,p:rt.s,n:void 0,t:rt,e:void 0,x:void 0,r:t},void 0!==rt.s&&(rt.s.n=t),rt.s=t,e.n=t,32&rt.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=rt.s,t.n=void 0,rt.s.n=t,rt.s=t),t}}function pt(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function vt(e,t){return new pt(e,t)}function mt(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function _t(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function gt(e){for(var t=e.s,n=void 0;void 0!==t;){var i=t.p;-1===t.i?(t.S.U(t),void 0!==i&&(i.n=t.n),void 0!==t.n&&(t.n.p=i)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=i}e.s=n}function yt(e,t){pt.call(this,void 0),this.x=e,this.s=void 0,this.g=ht-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function wt(e,t){return new yt(e,t)}function bt(e){var t=e.u;if(e.u=void 0,"function"==typeof t){ut++;var n=rt;rt=void 0;try{t()}catch(pi){throw e.f&=-2,e.f|=8,kt(e),pi}finally{rt=n,ot()}}}function kt(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,bt(e)}function Ct(e){if(rt!==this)throw new Error("Out-of-order effect");gt(this),rt=e,this.f&=-2,8&this.f&&kt(this),ot()}function xt(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Tt(e,t){var n=new xt(e,t);try{n.c()}catch(e){throw n.d(),e}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Nt(e,t){h[e]=t.bind(null,h[e]||function(){})}function St(e){st&&st(),st=e&&e.S()}function Et(e){var t=this,n=e.data,i=Mt(n);i.value=n;var o=Ye(function(){for(var e=t.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return t.__$u.c=function(){var e,n=t.__$u.S(),i=o.value;n(),m(i)||3!==(null==(e=t.base)?void 0:e.nodeType)?(t.__$f|=1,t.setState({})):t.base.data=i},wt(function(){var e=i.value.value;return 0===e?0:!0===e?"":e||""})},[]);return o.value}function At(e,t,n,i){var o=t in e&&void 0===e.ownerSVGElement,r=vt(n);return{o:function(e,t){r.value=e,i=t},d:Tt(function(){var n=r.value.value;i[t]!==n&&(i[t]=n,o?e[t]=n:n?e.setAttribute(t,n):e.removeAttribute(t))})}}function Mt(e){return Ye(function(){return vt(e)},[])}function Ot(e){var t=$e(e);return t.current=e,ct.__$f|=4,Ye(function(){return wt(function(){return t.current()})},[])}pt.prototype.brand=it,pt.prototype.h=function(){return!0},pt.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:at(function(){var e;null==(e=t.W)||e.call(t)}))},pt.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,i=e.x;void 0!==n&&(n.x=i,e.e=void 0),void 0!==i&&(i.e=n,e.x=void 0),e===this.t&&(this.t=i,void 0===i&&at(function(){var e;null==(e=t.Z)||e.call(t)}))}},pt.prototype.subscribe=function(e){var t=this;return Tt(function(){var n=t.value,i=rt;rt=void 0;try{e(n)}finally{rt=i}},{name:"sub"})},pt.prototype.valueOf=function(){return this.value},pt.prototype.toString=function(){return this.value+""},pt.prototype.toJSON=function(){return this.value},pt.prototype.peek=function(){var e=rt;rt=void 0;try{return this.value}finally{rt=e}},Object.defineProperty(pt.prototype,"value",{get:function(){var e=ft(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(dt>100)throw new Error("Cycle detected");this.v=e,this.i++,ht++,ut++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{ot()}}}}),yt.prototype=new pt,yt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===ht)return!0;if(this.g=ht,this.f|=1,this.i>0&&!mt(this))return this.f&=-2,!0;var e=rt;try{_t(this),rt=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return rt=e,gt(this),this.f&=-2,!0},yt.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}pt.prototype.S.call(this,e)},yt.prototype.U=function(e){if(void 0!==this.t&&(pt.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},yt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(yt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ft(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),xt.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},xt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,bt(this),_t(this),ut++;var e=rt;return rt=this,Ct.bind(this,e)},xt.prototype.N=function(){2&this.f||(this.f|=2,this.o=lt,lt=this)},xt.prototype.d=function(){this.f|=8,1&this.f||kt(this)},xt.prototype.dispose=function(){this.d()},Et.displayName="_st",Object.defineProperties(pt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Et},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),Nt("__b",function(e,t){if("string"==typeof t.type){var n,i=t.props;for(var o in i)if("children"!==o){var r=i[o];r instanceof pt&&(n||(t.__np=n={}),n[o]=r,i[o]=r.peek())}}e(t)}),Nt("__r",function(e,t){St();var n,i=t.__c;i&&(i.__$f&=-2,void 0===(n=i.__$u)&&(i.__$u=n=function(){var e;return Tt(function(){e=this}),e.c=function(){i.__$f|=1,i.setState({})},e}())),ct=i,St(n),e(t)}),Nt("__e",function(e,t,n,i){St(),ct=void 0,e(t,n,i)}),Nt("diffed",function(e,t){var n;if(St(),ct=void 0,"string"==typeof t.type&&(n=t.__e)){var i=t.__np,o=t.props;if(i){var r=n.U;if(r)for(var a in r){var c=r[a];void 0===c||a in i||(c.d(),r[a]=void 0)}else n.U=r={};for(var s in i){var l=r[s],u=i[s];void 0===l?(l=At(n,s,u,o),r[s]=l):l.o(u,o)}}}e(t)}),Nt("unmount",function(e,t){if("string"==typeof t.type){var n=t.__e;if(n){var i=n.U;if(i)for(var o in n.U=void 0,i){var r=i[o];r&&r.d()}}}else{var a=t.__c;if(a){var c=a.__$u;c&&(a.__$u=void 0,c.d())}}e(t)}),Nt("__h",function(e,t,n,i){(i<3||9===i)&&(t.__$f|=2),e(t,n,i)}),H.prototype.shouldComponentUpdate=function(e,t){var n=this.__$u,i=n&&void 0!==n.s;for(var o in t)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(i||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(i||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var r in e)if("__source"!==r&&e[r]!==this.props[r])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};var It=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M843.904 783.573333 783.573333 843.904 512.042667 572.373333 240.512 843.904 180.181333 783.573333 451.712 512.042667 180.181333 240.512 240.512 180.181333 512.042667 451.712 783.573333 180.181333 843.904 240.512 572.373333 512.042667 843.904 783.573333Z"})})},Lt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M900.64 379.808l-263.072-256.032c-36.448-35.328-105.76-35.392-142.304 0.096l-327.04 319.904c-56.416 54.72-70.72 76.704-70.72 150.976l0 143.936c0 132.768 26.976 192 186.912 192l131.872 0c81.12 0 128.448-46.656 193.952-111.264l290.016-297.696c18.592-17.984 29.248-43.968 29.248-71.264C929.504 423.36 918.976 397.6 900.64 379.808zM323.008 786.752c-52.928 0-96-43.072-96-96s43.072-96 96-96 96 43.072 96 96S375.936 786.752 323.008 786.752z"})})},Dt=function(e){return ae("svg",{viewBox:"0 0 1024 1024",id:"send",className:e.className,version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-0.9 3.7-0.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 0.7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-0.8 4.2-2.6 5-5 1.4-4.2-0.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})},zt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M962 197.61H747v-60c0-55.14-44.86-100-100-100H377c-55.14 0-100 44.86-100 100v60H62c-11.05 0-20 8.95-20 20s8.95 20 20 20h60v630.57c0 66.17 53.83 120 120 120h540c66.17 0 120-53.83 120-120V237.61h60c11.05 0 20-8.95 20-20s-8.95-20-20-20zM637.34 457.66v260c0 12.01-10.72 21.63-23.06 19.77-9.84-1.48-16.94-10.25-16.94-20.2V458.09c0-9.95 7.1-18.72 16.94-20.2 12.34-1.86 23.06 7.76 23.06 19.77z m-210.68 0v260c0 11-9 20-20 20s-20-9-20-20v-260c0-11 9-20 20-20s20 9 20 20zM317 137.61c0-33.08 26.92-60 60-60h270c33.08 0 60 26.92 60 60v60H317v-60z"})})},Pt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M511.582491 63.413262C265.134543 63.413262 64.62588 263.921925 64.62588 510.369873s200.508663 446.957635 446.957635 446.957635 446.957635-200.508663 446.957635-446.957635S758.031463 63.413262 511.582491 63.413262zM509.001713 751.859903c-98.517781 0-182.467775-62.623269-214.771505-150.056598l0.327458-0.134053c-2.007727-4.036943-3.38305-8.422833-3.38305-13.237489 0-16.647145 13.494339-30.142507 30.142507-30.142507 13.389962 0 24.358781 8.877181 28.2893 20.955264l0.422625-0.172939c23.269983 65.442478 85.645612 112.503307 158.972665 112.503307 93.106538 0 168.845523-75.738985 168.845523-168.845523s-75.738985-168.845523-168.845523-168.845523c-20.432355 0-39.874149 3.980661-58.013275 10.66899l21.248953 40.742936c2.486634 2.677992 4.0175 6.2831 4.0175 10.243295 0 8.417717-8.404414 14.921851-15.365966 15.07023-0.102331 0-0.206708 0-0.309038 0-0.220011 0-0.427742 0-0.647753-0.013303l-150.579507-6.463202c-5.372358-0.234337-10.229992-3.310396-12.716626-8.093329-2.486634-4.76963-2.236947-10.509355 0.647753-15.055904l80.890308-127.179564c2.8847-4.533246 8.006348-7.151887 13.365402-6.960529 5.372358 0.234337 10.227945 3.312442 12.71458 8.095375l18.580171 35.625382c26.629497-10.855232 55.683207-16.963347 86.168522-16.963347 126.338407 0 229.130537 102.791108 229.130537 229.130537S635.340119 751.859903 509.001713 751.859903z"})})},Bt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M891.072 822.144V167.36a34.432 34.432 0 0 0-34.432-34.432H201.856C201.856 94.848 232.704 64 270.784 64h620.288C929.152 64 960 94.848 960 132.928v620.288c0 38.08-30.848 68.928-68.928 68.928z m-68.928-551.36v620.288c0 38.08-30.848 68.928-68.928 68.928H132.928A68.928 68.928 0 0 1 64 891.072V270.784c0-38.08 30.848-68.928 68.928-68.928h620.288c38.08 0 68.928 30.848 68.928 68.928z m-137.856 137.856H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z m0 206.72H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z"})})},Ht=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M547.4 197.4v46l200.3 0.1L546.1 444l32.4 32.6 201.9-200.7v200.9h46V197.5zM471.4 584.4l-32.6-32.6L243.6 747V547.9h-46v278.7h279v-46H275z"})})},jt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M544 480V282.944h52.224l0.064 107.968L763.072 224l36.928 36.928-166.976 166.976 108.032-0.128V480H544zM260.928 800l-36.928-36.928 166.912-166.784-107.968-0.064V544H480v197.056h-52.224l0.064-107.968L260.928 800z"})})},Ft=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M960 544H64a32 32 0 1 1 0-64h896a32 32 0 1 1 0 64"})})},Ut=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[ae("path",{d:"M481.0752 263.3728l50.9952 1.024 1.8432-105.8816-50.9952-0.8192z"}),ae("path",{d:"M486.441426 180.895362a66.56 66.56 0 1 0 42.091944-126.290153 66.56 66.56 0 1 0-42.091944 126.290153Z"}),ae("path",{d:"M138.8544 664.3712c-52.8384 0-95.8464-43.008-95.8464-95.8464s43.008-95.8464 95.8464-95.8464M880.0256 472.6784c52.8384 0 95.8464 43.008 95.8464 95.8464s-43.008 95.8464-95.8464 95.8464"}),ae("path",{d:"M507.4944 220.5696c-220.16 0-398.7456 162.816-398.7456 363.7248s178.5856 363.7248 398.7456 363.7248 398.7456-162.816 398.7456-363.7248-178.5856-363.7248-398.7456-363.7248z m0 559.9232c-166.2976 0-301.2608-100.5568-301.2608-224.4608s134.9632-224.4608 301.2608-224.4608S808.7552 432.128 808.7552 556.032 673.792 780.4928 507.4944 780.4928z"}),ae("path",{d:"M319.6928 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"}),ae("path",{d:"M617.472 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"})]})},Wt=function(){return ae("svg",{viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ae("path",{d:"M5.856 17.121a.979.979 0 0 1-.327-.06.839.839 0 0 1-.283-.177.739.739 0 0 1-.187-.255.724.724 0 0 1-.07-.303l-.02-1.609a4.663 4.663 0 0 1-1.446-.455 4.252 4.252 0 0 1-.637-.401c-.199-.146-.385-.31-.553-.492a4.442 4.442 0 0 1-.45-.577 4.303 4.303 0 0 1-.327-.637 3.823 3.823 0 0 1-.206-.686 3.729 3.729 0 0 1-.064-.704V6.478c0-.261.025-.516.077-.771a4.43 4.43 0 0 1 .244-.747 4.062 4.062 0 0 1 .932-1.28c.2-.183.418-.347.65-.493.23-.145.482-.267.739-.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.167.061-.328.14-.482.237-.148.091-.29.2-.418.316a2.897 2.897 0 0 0-.347.388c-.097.14-.187.286-.257.444a2.473 2.473 0 0 0-.206.977v4.287c0 .17.013.333.051.503a2.549 2.549 0 0 0 .772 1.33 2.721 2.721 0 0 0 .913.559c.167.066.347.115.527.152.18.03.36.048.546.048a.904.904 0 0 1 .61.23.848.848 0 0 1 .194.262.84.84 0 0 1 .07.303l.007.99 1.915-1.293a2.877 2.877 0 0 1 1.64-.492h2.372c.186 0 .366-.018.54-.048.18-.03.353-.08.52-.146.168-.067.329-.146.483-.237.148-.091.29-.2.418-.316.128-.121.244-.249.347-.388a2.8 2.8 0 0 0 .257-.444 2.47 2.47 0 0 0 .206-.977V8.585a.646.646 0 0 1 .225-.492.679.679 0 0 1 .244-.152.814.814 0 0 1 .585 0c.09.03.174.085.244.152a.657.657 0 0 1 .225.492V10.8c0 .261-.032.516-.083.771a4.192 4.192 0 0 1-.245.74c-.109.244-.244.468-.398.687a3.735 3.735 0 0 1-.534.6c-.2.183-.418.347-.65.493a4.134 4.134 0 0 1-.738.364 4.7 4.7 0 0 1-.81.225c-.27.054-.553.079-.836.079h-1.877c-.604 0-1.144.164-1.633.491l-2.54 1.713a.913.913 0 0 1-.514.157z",fill:"currentColor"}),ae("path",{d:"M15.866 4.125h-4.174c-.41 0-.741.313-.741.7 0 .387.332.7.741.7h4.174c.41 0 .742-.313.742-.7 0-.387-.332-.7-.742-.7z",fill:"currentColor"}),ae("path",{d:"M14.537 2.932c0-.396-.34-.717-.759-.717s-.758.32-.758.717v3.786c0 .396.34.717.758.717.42 0 .76-.321.76-.717V2.932z",fill:"currentColor"})]})},Rt=function(){return ae("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:ae("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})})},Vt=function(){var e=1e3,t=140,n=250,i=.8;return ae("svg",{fill:"currentColor",viewBox:"0 0 ".concat(e," ").concat(e),xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:Array.from({length:4}).map(function(e,o){return ae("rect",{fill:"currentColor",rx:70,ry:70,height:n,width:t,x:o*(440/3+t),y:375,children:[ae("animate",{attributeName:"height",values:"".concat(n,"; ").concat(500,"; ").concat(n),keyTimes:"0; 0.5; 1",dur:"".concat(i,"s"),begin:"".concat(.2*o,"s"),repeatCount:"indefinite"}),ae("animate",{attributeName:"y",values:"".concat(375,"; ").concat(250,"; ").concat(375),keyTimes:"0; 0.5; 1",dur:"".concat(i,"s"),begin:"".concat(.2*o,"s"),repeatCount:"indefinite"})]},o)})})},qt=function(e){return ae("svg",{className:e.className,onClick:e.onClick,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M128 384a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m768 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m-372.4288 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z"})})},$t=function(e){return ae("svg",{className:e.className,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M498.33984 607.8464c-10.99776-32.9728-50.09408-73.5232-82.6368-85.74976L150.9376 422.8096c-38.54336-14.4384-36.98688-69.46816 2.27328-81.73568L844.92288 124.90752c33.30048-10.40384 64.57344 20.8896 54.1696 54.1696L682.92608 870.78912a43.2128 43.2128 0 0 1-81.36704 3.25632 121682.5344 121682.5344 0 0 1-103.2192-266.19904z"})})},Yt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M972.657609 209.348408C987.158609 209.36839 998.930114 197.571202 998.949999 182.99865 998.969882 168.426097 987.230618 156.59651 972.729617 156.576528L32.457975 155.280806C17.956974 155.260823 6.18547 167.058012 6.165585 181.630564 6.1457 196.203116 17.884965 208.032703 32.385966 208.052686L972.657609 209.348408ZM180.466902 992.356169 180.466902 1019.014859 206.993296 1018.74074 833.361858 1012.267947 859.348284 1011.999407 859.348284 985.883377 859.348284 289.397297C859.348284 274.824732 847.59289 263.011332 833.091874 263.011332 818.590859 263.011332 806.835465 274.824732 806.835465 289.397297L806.835465 985.883377 832.82189 959.498805 206.453329 965.971599 232.979723 992.356169 232.979723 282.67005C232.979723 268.097483 221.224329 256.284085 206.723313 256.284085 192.222298 256.284085 180.466902 268.097483 180.466902 282.67005L180.466902 992.356169ZM656.410257 847.079027C656.410257 861.651593 668.165651 873.464992 682.666667 873.464992 697.167682 873.464992 708.923076 861.651593 708.923076 847.079027L708.923076 372.131659C708.923076 357.559091 697.167682 345.745694 682.666667 345.745694 668.165651 345.745694 656.410257 357.559091 656.410257 372.131659L656.410257 847.079027ZM341.333333 847.079027C341.333333 861.651593 353.08873 873.464992 367.589743 873.464992 382.090758 873.464992 393.846155 861.651593 393.846155 847.079027L393.846155 372.131659C393.846155 357.559091 382.090758 345.745694 367.589743 345.745694 353.08873 345.745694 341.333333 357.559091 341.333333 372.131659L341.333333 847.079027ZM498.871795 847.079027C498.871795 861.651593 510.627189 873.464992 525.128205 873.464992 539.62922 873.464992 551.384614 861.651593 551.384614 847.079027L551.384614 372.131659C551.384614 357.559091 539.62922 345.745694 525.128205 345.745694 510.627189 345.745694 498.871795 357.559091 498.871795 372.131659L498.871795 847.079027ZM392.147755 116.721777C392.147755 102.063669 403.758665 90.363507 418.40134 90.363507L622.925796 90.363507C637.408947 90.363507 649.179381 102.1619 649.179381 116.549585L649.179381 171.644875 701.692203 171.644875 701.692203 116.549585C701.692203 72.986607 666.38105 37.591577 622.925796 37.591577L418.40134 37.591577C374.724427 37.591577 339.634933 72.950804 339.634933 116.721777L339.634933 165.310801 392.147755 165.310801 392.147755 116.721777Z"})})},Xt=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:ae("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 184l144 144 144-144"})})},Zt=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:"".concat(e.className," icon"),viewBox:"0 0 512 512",children:ae("path",{d:"M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm108.25 138.29l-134.4 160a16 16 0 01-12 5.71h-.27a16 16 0 01-11.89-5.3l-57.6-64a16 16 0 1123.78-21.4l45.29 50.32 122.59-145.91a16 16 0 0124.5 20.58z"})})},Jt=function(e){return ae("svg",{className:e.className,width:"16",height:"16",viewBox:"0 0 50 50",xmlns:"http://www.w3.org/2000/svg",children:ae("circle",{cx:"25",cy:"25",r:"20",stroke:"currentColor",strokeWidth:"5",fill:"none",strokeDasharray:"31.415, 31.415",strokeLinecap:"round",children:ae("animateTransform",{attributeName:"transform",type:"rotate",from:"0 25 25",to:"360 25 25",dur:"1s",repeatCount:"indefinite"})})})},Gt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M704 256v490.666667a170.666667 170.666667 0 0 1-170.666667 170.666666 170.666667 170.666667 0 0 1-170.666666-170.666666V213.333333A106.666667 106.666667 0 0 1 469.333333 106.666667 106.666667 106.666667 0 0 1 576 213.333333v448a42.666667 42.666667 0 0 1-42.666667 42.666667 42.666667 42.666667 0 0 1-42.666666-42.666667V256H426.666667v405.333333a106.666667 106.666667 0 0 0 106.666666 106.666667 106.666667 106.666667 0 0 0 106.666667-106.666667V213.333333a170.666667 170.666667 0 0 0-170.666667-170.666666 170.666667 170.666667 0 0 0-170.666666 170.666666v533.333334a234.666667 234.666667 0 0 0 234.666666 234.666666 234.666667 234.666667 0 0 0 234.666667-234.666666V256h-64z"})})},Kt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[ae("path",{d:"M842.666667 285.866667l-187.733334-187.733334c-14.933333-14.933333-32-21.333333-53.333333-21.333333H234.666667C194.133333 74.666667 160 108.8 160 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h554.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666V337.066667c0-19.2-8.533333-38.4-21.333333-51.2z m-44.8 44.8c-2.133333 2.133333-4.266667 0-8.533334 0h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667V149.333333c0-2.133333 0-6.4-2.133333-8.533333 0 0 2.133333 0 2.133333 2.133333l189.866667 187.733334z m-8.533334 554.666666H234.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h311.466666c-2.133333 4.266667-2.133333 6.4-2.133333 10.666666v170.666667c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c4.266667 0 6.4 0 10.666667-2.133334V874.666667c0 6.4-4.266667 10.666667-10.666667 10.666666z",fill:"currentColor"}),ae("path",{d:"M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z",fill:"currentColor"})]})},Qt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M557.248 511.68l135.776-135.744-45.248-45.28L512 466.432l-135.776-135.776-45.248 45.28 135.776 135.744-135.776 135.776 45.248 45.248L512 556.928l135.776 135.776 45.248-45.248-135.776-135.776zM512 64c247.136 0 448 200.864 448 448s-200.864 448-448 448S64 759.136 64 512 264.864 64 512 64z",fill:"currentColor"})})},en=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M512.43945313 904.51953125c-6.06445313 0-12.12890625-1.58203125-17.57812501-4.74609375L136.70703125 689.71484375c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867188-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l76.37695313-44.91210938L136.97070312 540.125c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867187-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l73.38867187-43.15429688-73.125-42.890625C126.51171875 387.81054687 120.0078125 376.38476562 120.0078125 364.08007812c0-12.3046875 6.50390625-23.73046875 17.13867188-29.97070312L495.828125 122.99609375c10.8984375-6.41601563 24.34570313-6.41601563 35.24414063 0l358.15429687 210.05859375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-73.38867188 43.15429688 73.12500001 42.890625c10.63476563 6.24023438 17.13867188 17.66601563 17.13867187 29.97070312s-6.50390625 23.73046875-17.13867187 29.97070313L812.5859375 583.89453125l76.11328125 44.6484375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-358.59375 211.2890625c-5.44921875 3.1640625-11.6015625 4.74609375-17.66601563 4.74609375zM223.015625 659.65625l289.42382813 169.8046875 290.12695312-170.77148438-58.44726563-34.27734374L530.28125 750.18359375a34.67285156 34.67285156 0 0 1-35.24414063 0L281.7265625 625.02734375 223.015625 659.65625z m76.90429688-104.58984375l212.69531249 124.8046875 290.12695313-170.77148438-55.546875-32.60742187-216.65039063 127.6171875a34.67285156 34.67285156 0 0 1-35.24414062 0L279.00195312 477.28320312l-55.81054687 32.78320313 75.49804688 44.296875c0.43945313 0.26367188 0.79101563 0.52734375 1.23046874 0.703125z m-2.81250001-147.83203125l215.68359376 126.5625 216.12304687-127.17773438c0.3515625-0.26367188 0.703125-0.43945313 1.0546875-0.61523437l72.86132813-42.890625-289.33593751-169.8046875-290.12695312 170.68359375 72.59765625 42.62695313c0.43945313 0.17578125 0.79101563 0.43945313 1.14257813 0.61523437z"})})},tn=function(e){return ae("svg",{className:e.className,id:"stop",viewBox:"0 0 1025 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[ae("path",{d:"M512.268258 1022.835842c-68.658678 0-135.399619-13.564433-198.369591-40.316509-60.752236-25.809077-115.373446-62.712976-162.346233-109.685763-46.971763-46.971763-83.875662-101.592974-109.685763-162.346233C15.115619 647.517366 1.551186 580.777449 1.551186 512.118771S15.115619 376.719151 41.866671 313.74918c25.810101-60.752236 62.714-115.373446 109.685763-162.346233 46.972787-46.971763 101.593997-83.875662 162.346233-109.685763 62.969971-26.751052 129.710912-40.315485 198.369591-40.315485s135.398595 13.564433 198.368567 40.315485c60.752236 25.810101 115.373446 62.714 162.346233 109.685763 46.971763 46.972787 83.875662 101.593997 109.685763 162.346233 26.752076 62.969971 40.316509 129.710912 40.316509 198.369591s-13.564433 135.398595-40.316509 198.368567c-25.809077 60.75326-62.712976 115.37447-109.685763 162.346233-46.971763 46.972787-101.592974 83.876686-162.346233 109.685763C647.666853 1009.27141 580.925912 1022.835842 512.268258 1022.835842zM512.268258 50.548195c-62.018782 0-122.293887 12.247716-179.152287 36.403219-54.923257 23.333323-104.317532 56.709936-146.810821 99.204249s-75.870926 91.888588-99.204249 146.810821c-24.155503 56.8584-36.403219 117.133505-36.403219 179.152287 0 62.017758 12.247716 122.292863 36.403219 179.152287 23.333323 54.923257 56.709936 104.317532 99.204249 146.811845 42.493289 42.493289 91.888588 75.870926 146.810821 99.204249 56.8584 24.155503 117.133505 36.403219 179.152287 36.403219 62.017758 0 122.292863-12.247716 179.152287-36.403219 54.923257-23.333323 104.317532-56.71096 146.811845-99.204249 42.493289-42.494313 75.870926-91.888588 99.204249-146.811845 24.155503-56.8584 36.403219-117.133505 36.403219-179.152287s-12.247716-122.293887-36.403219-179.152287c-23.334347-54.923257-56.71096-104.317532-99.205273-146.810821-42.493289-42.493289-91.887565-75.870926-146.810821-99.204249C634.561121 62.795911 574.286016 50.548195 512.268258 50.548195z",fill:"currentColor"}),ae("path",{d:"M655.434047 694.244421 367.12637 694.244421c-21.046987 0-38.170445-17.123458-38.170445-38.170445L328.955925 367.766298c0-21.046987 17.123458-38.170445 38.170445-38.170445l288.307678 0c21.048011 0 38.170445 17.123458 38.170445 38.170445l0 288.307678C693.604492 677.120962 676.482058 694.244421 655.434047 694.244421zM380.150191 643.050154l262.260035 0L642.410226 380.79012 380.150191 380.79012 380.150191 643.050154z",fill:"currentColor"})]})},nn=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:ae("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})})},on=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[ae("path",{d:"M394.688 126.208a32 32 0 0 1 32-32h170.688a32 32 0 0 1 32 32v138.624h288a32 32 0 0 1 32 32v170.688a32 32 0 0 1-32 32H106.688a32 32 0 0 1-32-32V296.832a32 32 0 0 1 32-32h288V126.208z m64 32v138.624a32 32 0 0 1-32 32h-288v106.688h746.688V328.832h-288a32 32 0 0 1-32-32V158.208H458.688z"}),ae("path",{d:"M138.688 469.376a32 32 0 0 1 32-32h682.688a32 32 0 0 1 32 32v384a32 32 0 0 1-32 32H170.688a32 32 0 0 1-32-32v-384z m64 32v320h618.688v-320H202.688z"}),ae("path",{d:"M341.376 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32zM512 691.2a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0v-128a32 32 0 0 1 32-32zM682.688 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32z"})]})},rn=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M843.251 424.407l43.828-74.898c10.194-17.946 32.596-22.158 48.956-11.598 16.298 10.499 23.44 32.658 14.223 49.566l-113.11 195.212-61.164-40.044-126.418-82.285c-16.115-11.598-20.632-34.428-10.194-51.702 9.705-17.397 31.009-23.501 47.857-13.734l89.67 59.028C748.576 295.547 615.81 180.667 461.008 180.667c-177.387 0-320.042 148.758-320.042 331.335 0 183.613 143.692 331.334 319.981 331.334 107.861 0.184 208.58-56.158 268.034-149.858 1.099-1.038 1.099-2.075 2.075-2.075 6.348-9.949 17.092-15.871 28.568-15.81 19.35 0 35.648 16.848 35.648 36.93 0 7.508-2.137 14.833-6.104 21.059-72.823 114.698-196.066 183.675-328.099 183.614-216.088 0-391.4-181.478-391.4-405.195 0-223.718 175.312-405.195 391.339-405.195 183.125-0.427 342.016 131.606 382.243 317.601z"})})},an=function(){return ae("svg",{version:"1.1",className:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M627.498667 55.168l170.666666 170.666667a42.624 42.624 0 0 1 0 60.330666l-469.333333 469.333334A42.538667 42.538667 0 0 1 298.666667 768H128a42.666667 42.666667 0 0 1-42.666667-42.666667v-170.666666c0-11.306667 4.48-22.186667 12.501334-30.165334l469.333333-469.333333a42.624 42.624 0 0 1 60.330667 0zM896 896a42.666667 42.666667 0 0 1 0 85.333333H128a42.666667 42.666667 0 0 1 0-85.333333h768zM597.333333 145.664l-426.666666 426.666667V682.666667h110.336l426.666666-426.666667L597.333333 145.664z"})})},cn=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:ae("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M184 112l144 144-144 144"})})},sn=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M896 870.4l-128-128c55.467-68.267 89.6-149.333 89.6-238.933 0-98.134-38.4-192-110.933-264.534-149.334-149.333-384-149.333-533.334-4.266-145.066 145.066-145.066 384 0 529.066 72.534 72.534 166.4 110.934 264.534 110.934 89.6 0 174.933-29.867 238.933-89.6l128 128c4.267 4.266 12.8 8.533 21.333 8.533s17.067-4.267 21.334-8.533c17.066-8.534 17.066-29.867 8.533-42.667zM260.267 721.067c-119.467-123.734-119.467-320 0-439.467 59.733-59.733 140.8-89.6 217.6-89.6 81.066 0 157.866 29.867 217.6 89.6 59.733 59.733 89.6 136.533 89.6 217.6 0 81.067-34.134 162.133-89.6 217.6-55.467 59.733-132.267 93.867-217.6 93.867-81.067 0-157.867-34.134-217.6-89.6z"})})},ln=function(e){var t=e.items,n=Mt([]),i=new se("chat-thought-chain"),o=Mt([]);qe(function(){o.value=t.filter(function(e){return e.description}),o.value.length>0&&o.value.forEach(function(e,t){e.done&&(n.value=[].concat(r(n.value),[t]))})},[t]);return 0===o.value.length?null:ae("div",{className:"".concat(i.b()," ").concat(i.is("single",1===o.value.length)),children:o.value.map(function(e,t){if(e.description){var o=n.value.includes(t);return ae("div",{className:"".concat(i.e("item")," ").concat(i.is("collapsed",o)),children:[ae("div",{className:i.e("item-icon"),children:e.icon||ae("span",{children:t})}),ae("div",{className:i.e("item-content"),children:[ae("div",{className:i.e("item-title"),onClick:function(){return function(e){n.value.includes(e)?n.value=n.value.filter(function(t){return t!==e}):n.value=[].concat(r(n.value),[e])}(t)},children:[e.title,ae(Xt,{className:i.e("icon")})]}),ae("div",{className:i.e("item-description"),children:e.description})]})]},t)}})})},un=function(e){var t=e.items,n=e.onItemClick,i=new se("chat-suggestions");return ae("div",{className:"".concat(i.b()),children:t.map(function(e,t){return ae("div",{className:"".concat(i.e("item")," ").concat(i.is("action","action"===e.type)),onClick:function(t){return function(e,t){null==n||n(e,t)}(e,t)},title:e.metadata.content_name,children:[e.metadata.content_name,ae(cn,{className:"".concat(i.e("item-icon"))})]},t)})})},dn=function(e){var t,n=new se("chat-tool-call-item"),i=Mt(!1),o=Mt(!1),a=fe();qe(function(){return function(){t&&clearTimeout(t)}},[]);var c=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=document.getElementById(e);o&&(o.innerHTML="",i.value&&s(t,n).forEach(function(e,t){var n=document.createElement("div");n.className="code-line";var i=document.createElement("span");i&&(i.className="line-number",i.textContent=(t+1).toString(),n.appendChild(i),n.innerHTML+=e,o.appendChild(n))}))},s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=" ".repeat(t),i=[];if(Array.isArray(e)){if(0===e.length)return["".concat(n,'<span class="array">[]</span>')];i.push("".concat(n,'<span class="array">[</span>')),e.forEach(function(n,o){var a=s(n,t+1),c=o<e.length-1?",":"";"object"===w(n)&&null!==n?(i.push.apply(i,r(a.slice(0,-1))),i.push("".concat(a[a.length-1]).concat(c))):i.push("".concat(a[0]).concat(c))}),i.push("".concat(n,'<span class="array">]</span>'))}else if("object"===w(e)&&null!==e){var o=Object.keys(e);if(0===o.length)return["".concat(n,'<span class="property">{}</span>')];i.push("".concat(n,'<span class="property">{</span>')),o.forEach(function(a,c){var u=e[a],d=c<o.length-1?",":"",h='<span class="json-key">"'.concat(a,'":</span>');if("object"===w(u)&&null!==u){var f=s(u,t+1);i.push("".concat(n," ").concat(h," ").concat(f[0].trim())),f.length>1&&(i.push.apply(i,r(f.slice(1,-1))),i.push("".concat(f[f.length-1]).concat(d)))}else{var p=l(u);i.push("".concat(n," ").concat(h," ").concat(p).concat(d))}}),i.push("".concat(n,'<span class="property">}</span>'))}else i.push("".concat(n).concat(l(e)));return i},l=function(e){return"string"==typeof e?e.includes("Failed")||e.includes("Error")||e.includes("ERR_")?'<span class="error">"'.concat(e,'"</span>'):'<span class="string">"'.concat(e,'"</span>'):"number"==typeof e?'<span class="number">'.concat(e,"</span>"):"boolean"==typeof e?'<span class="boolean">'.concat(e,"</span>"):null===e?'<span class="null">null</span>':""};return ae("div",{className:"".concat(n.b()),children:[ae("div",{className:n.e("header"),onClick:function(){return i.value=!i.value,void c("code-block-".concat(a),e.item)},children:[ae("div",{className:n.e("header-left"),children:[ae("div",{className:n.em("header-left","caption"),children:e.item.name}),ae("div",{className:n.em("header-left","desc"),children:e.item.parameters.desc})]}),ae("div",{className:n.e("header-right"),children:[e.item.error&&ae("span",{style:"color: red;",children:"发生错误"}),e.item.error&&ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"red",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",children:[ae("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),ae("path",{d:"M12 9v4"}),ae("path",{d:"M12 17h.01"})]}),ae("span",{className:n.e("copy"),title:"复制",children:o.value?ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgb(0, 185, 107)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-check","aria-hidden":"true",style:"margin-left: 6px;",onClick:function(e){return e.stopPropagation()},children:ae("path",{d:"M20 6 9 17l-5-5"})}):ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",onClick:function(n){return function(n){n.stopPropagation(),t&&clearTimeout(t),o.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),t=setTimeout(function(){o.value=!1},2e3)}(n)},children:[ae("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),ae("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}),ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{"margin-left":" 6px",transform:i.value?"rotate(90deg)":"rotate(0deg)"},children:ae("path",{d:"m9 18 6-6-6-6"})})]})]}),ae("div",{className:n.e("content"),id:"code-block-".concat(a)})]})},hn=function(e){var t=e.items,n=new se("chat-tool-call"),i=Mt([]),o=Mt(!1),r=Mt(!1);qe(function(){i.value=t.filter(function(e){return e}),r.value=t.length>4},[t]);var a=Ot(function(){return r.value&&!o.value?i.value.slice(0,4):i.value});return ae("div",{className:"".concat(n.b()),children:[a.value.map(function(e,t){return ae(dn,{item:e},t)}),r.value&&ae("div",{className:n.e("toggle"),onClick:function(){o.value=!o.value},children:o.value?"收起工具调用":"展开全部 ".concat(i.value.length," 个工具调用")})]})},fn=new se("markdown-message"),pn=function(e){var t=e.message,n=e.size,i=Mt(fe()),o=Mt(null),r=Ye(function(){return 20===t.state&&!0!==t.completed},[t.state,t.completed]),a=Ye(function(){return 20===t.state&&!0===t.completed},[t.state,t.completed]),c=Mt({title:"",description:"",icon:ae(Jt,{})}),l=Mt({hasSuggestions:!1,suggestions:[]}),u=function(e){e&&e.length>0?l.value={hasSuggestions:!0,suggestions:e}:l.value={hasSuggestions:!1,suggestions:[]}},d=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),i="",o="",r=!1;return-1===n?(r=!1,i=e.slice(t+7),o=""):(r=!0,i=e.slice(t+7,n),o=e.slice(n+8)),{isThoughtCompleted:r,thoughtContent:i,answerContent:o}};return qe(function(){if(n>=0&&o.value){if(-1!==t.content.indexOf("<think>")){var e=d(t.content),i=e.isThoughtCompleted,r=e.thoughtContent,a=e.answerContent;i?(c.value.icon=ae(Zt,{}),c.value.title="思考完成"):!0===t.completed?(c.value.icon=ae(Zt,{}),c.value.title="思考已停止"):(c.value.icon=ae(Jt,{}),c.value.title="思考中..."),c.value.description=r||"",o.value.setMarkdown(a||"")}else if(-1!==t.content.indexOf("<tool_call>")){var s=t.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim();o.value.setMarkdown(s||"")}else o.value.setMarkdown(t.content||"");u(t.suggestions)}},[t,n]),qe(function(){var e="";if(-1!==t.content.indexOf("<think>")){var n=d(t.content),r=n.isThoughtCompleted,a=n.thoughtContent,l=n.answerContent;c.value={title:r?"思考完成":!0===t.completed?"思考已停止":"思考中...",description:a||"",icon:r||!0===t.completed?ae(Zt,{}):ae(Jt,{})},l&&(e=l)}else e=-1!==t.content.indexOf("<tool_call>")?t.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim():t.content;u(t.suggestions),o.value=new s({id:i,value:e||"",editor:{defaultModel:"previewOnly"},themeSettings:{mainTheme:"dark",codeBlockTheme:"dark"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}})},[]),ae("div",{className:"".concat(fn.b()," ").concat(fn.is("loading",r)),children:[ae("div",{className:fn.b("header"),children:[ae("div",{className:fn.be("header","caption"),children:"AI "}),e.children,a?ae("div",{className:fn.be("header","timeout"),children:"请求超时"}):null]}),ae("div",{className:"".concat(fn.b("content")," pre-wrap-container"),children:[ae(ln,{items:[c.value]}),t.toolcalls&&t.toolcalls.length>0?ae(hn,{items:t.toolcalls||[]}):null,ae("div",{id:i})]}),ae("div",{className:fn.b("footer"),children:l.value.hasSuggestions?ae(un,{items:l.value.suggestions,onItemClick:function(t,n){!function(t,n){e.controller.handleSuggestionClick(e.message,t,n)}(t,n)}}):null})]})},vn=new se("ossfile-material"),mn=function(e){var t=Ot(function(){return e.material.data.name}),n=Ot(function(){return e.material.metadata.size}),i=Ot(function(){var t=e.material.metadata.state;return"successed"===t?"上传成功":"uploading"===t?"上传中":"failed"===t?"上传失败":"未知状态"}),o=Ot(function(){switch(e.material.metadata.state){case"successed":return"#1890ff";case"uploading":return"#52c41a";default:return"#ff4d4f"}});return ae("div",{className:vn.b(),children:[ae("div",{className:vn.b("left"),children:ae(Kt,{})}),ae("div",{className:vn.b("right"),children:[ae("div",{className:vn.e("name"),title:t,children:t}),ae("div",{className:vn.e("metadata"),children:[ae("div",{children:[n,"B"]}),ae("div",{style:{color:o.value},children:i})]})]})]})},_n=new se("common-material"),gn=function(e){var t,n,i,o,r=null===(t=e.controller.opts.questionToolbarItems)||void 0===t?void 0:t.find(function(t){return t.id===e.material.metadata.actionId}),a=Ot(function(){return e.material.metadata.name});return ae("div",{className:_n.b(),children:[ae("div",{className:_n.b("left"),children:r&&r.icon?"function"==typeof r.icon?r.icon():(null===(n=r.icon)||void 0===n?void 0:n.showIcon)&&ae(B,{children:null!==(i=r.icon)&&void 0!==i&&i.cssClass?ae("i",{className:r.icon.cssClass}):null!==(o=r.icon)&&void 0!==o&&o.imagePath?ve(r.icon.imagePath)?ae("div",{dangerouslySetInnerHTML:{__html:r.icon.imagePath}}):ae("img",{src:r.icon.imagePath}):null}):ae(en,{})}),ae("div",{className:_n.b("right"),children:[ae("div",{className:_n.e("name"),title:a,children:a}),ae("div",{className:_n.e("metadata"),children:ae("div",{children:(null==r?void 0:r.label)||"素材资源"})})]})]})},yn=new se("chat-input-material-item"),wn=function(e){var t=e.material,n=null;if("ossfile"===t.type)n=mn;else n=gn;return ae("div",{className:"".concat(yn.b()," ").concat(yn.is("disabled",e.disabled)),children:[ae("div",{className:yn.e("icon"),onClick:function(){e.controller.deleteMaterial(t)},children:ae(Qt,{})}),z(n,{material:t,controller:e.controller})]})},bn=new se("user-message-question"),kn=function(e){var t=Mt(fe()),n=Mt(null),i=Ot(function(){return e.message.content}),o=Ot(function(){return ye.parseMixedContent(i.value)});return qe(function(){n.value=new s({id:t,value:o.value.remainingText||"",editor:{defaultModel:"previewOnly"},themeSettings:{mainTheme:"dark",codeBlockTheme:"dark"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}})},[o.value.remainingText]),ae("div",{className:bn.b(),children:[ae("div",{className:bn.e("user-header"),children:[e.children,ae("div",{className:bn.e("user"),children:"我"})]}),ae("div",{className:bn.e("content"),children:ae("div",{className:bn.em("content","body"),children:[o.value.hasResources&&ae("div",{className:bn.em("content","material"),children:o.value.resources.map(function(t){return ae(wn,{material:t,disabled:!0,controller:e.controller},t.id)})}),ae("div",{className:"pre-wrap-container",children:ae("div",{id:t})})]})})]})},Cn=new se("error-message"),xn=function(e){var t=Ot(function(){return e.message.content});return ae("div",{className:Cn.b(),children:[ae("div",{className:Cn.b("header"),children:[ae("div",{className:Cn.be("header","caption"),children:"AI "}),e.children]}),ae("div",{className:"".concat(Cn.e("content")," pre-wrap-container"),children:ae("span",{children:t})})]})},Tn=new se("unknown-message"),Nn=function(e){return ae("div",{className:Tn.b(),children:ae("div",{className:"".concat(Tn.e("content")," pre-wrap-container"),children:["暂未支持的消息类型: ",e.message.type]})})},Sn=new se("chat-message-item"),En=function(e){var t=e.message,n=e.size,i=null;switch(t.type){case"DEFAULT":i="ASSISTANT"===t.role?pn:kn;break;case"ERROR":i=xn;break;default:i=Nn}return ae("div",{className:Sn.b(),children:z(i,{size:n,message:t,controller:e.controller,children:e.children})})},An=function(){return _(function e(t){v(this,e),g(this,"toolcalls",[]),g(this,"allcontent",""),this.msg=t,this.toolcalls=t.toolcalls||[],this.allcontent=t.content},[{key:"messageid",get:function(){return this.msg.messageid}},{key:"state",get:function(){return this.msg.state}},{key:"role",get:function(){return this.msg.role}},{key:"type",get:function(){return this.msg.type}},{key:"realcontent",get:function(){var e=this.msg.content;if(-1!==e.indexOf("<think>")&&-1===e.indexOf("</think>"))return"";if(-1!==(e=e.replace(/<think>[^]*?<\/think>/g,"").trim()).indexOf("<tool_call>")&&-1===e.indexOf("</tool_call>"))return"";if(-1!==(e=e.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim()).indexOf("<resources>")&&-1===e.indexOf("</resources>"))return"";var t=(e=e.replace(/<resources>[^]*?<\/resources>/g,"").trim()).indexOf("<suggestions>");return-1!==t&&(e=e.substring(0,t).trim()),e}},{key:"content",get:function(){return this.msg.content}},{key:"completed",get:function(){return this.msg.completed}},{key:"suggestions",get:function(){return this.msg.suggestions}},{key:"_origin",get:function(){return this.msg}},{key:"update",value:function(e){e.content||(e.content=""),this.allcontent+=e.content,-1!==e.content.indexOf("<think>")&&this.msg.content&&(this.msg.content=""),this.msg.content+=e.content,this.computeToolCalls()}},{key:"replace",value:function(e){this.msg=e}},{key:"updateCompleted",value:function(e){this.msg.completed=e}},{key:"computeToolCalls",value:function(){this.toolcalls=Le.parse(this.allcontent)}}])}(),Mn=function(){return _(function e(t){v(this,e),this.data=t},[{key:"appid",get:function(){return this.data.appid}},{key:"id",get:function(){return this.data.id}},{key:"type",get:function(){return this.data.type}},{key:"caption",get:function(){return this.data.caption}},{key:"sourceCaption",get:function(){return this.data.sourceCaption||this.caption}},{key:"url",get:function(){return this.data.url}},{key:"aiChat",get:function(){return this.data.aiChat}}])}(),On=function(){return _(function e(t){v(this,e),this.material=t},[{key:"id",get:function(){return this.material.id}},{key:"type",get:function(){return this.material.type}},{key:"metadata",get:function(){return this.material.metadata}},{key:"data",get:function(){return this.material.data}}])}(),In=new se("chat-toolbar-item"),Ln=function(e){var t,n,i,o=e.model,r=e.data,c=e.className,s=e.disabled,l=void 0!==s&&s,u=e.buttonType,d=void 0===u?"default":u,h=e.onClick,f=a(Ve(!1),2),p=f[0],v=f[1],m=$e(null),_=function(e){return"function"==typeof e.hidden?e.hidden(r):!0===e.hidden};if(_(o))return ae(B,{});var g=function(e){return!!l||("function"==typeof e.disabled?e.disabled(r):!0===e.disabled)},y=function(e){var t,n,i,o;return"function"==typeof e.icon?e.icon():null!==(t=e.icon)&&void 0!==t&&t.showIcon&&null!==(n=e.icon)&&void 0!==n&&n.cssClass?ae("i",{className:e.icon.cssClass}):null!==(i=e.icon)&&void 0!==i&&i.showIcon&&null!==(o=e.icon)&&void 0!==o&&o.imagePath?ve(e.icon.imagePath)?ae("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):ae("img",{src:e.icon.imagePath}):void 0},w=function(e,t){g(t)||(v(!1),h(e,t))};return qe(function(){var e=function(e){m.current&&m.current.contains(e.target)||v(!1)};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[p]),ae("div",{className:"".concat(In.b()," ").concat(In.b(d)," ").concat(o.customClass||""," ").concat(c||""," ").concat(In.is("disabled",g(o))," ").concat(In.is("more",!(null===(t=o.children)||void 0===t||!t.length))),children:[ae("div",{title:o.title,className:In.e("content"),onClick:function(e){return w(e,o)},children:[ae("div",{className:In.em("content","icon"),children:y(o)}),ae("div",{className:In.em("content","label"),children:o.label})]}),(null===(n=o.children)||void 0===n?void 0:n.length)&&ae("div",{title:"更多",className:In.e("more"),onClick:function(e){g(o)||v(!0)},children:ae("i",{"aria-hidden":"true",className:"fa fa-angle-down ".concat(In.em("more","icon"))})}),p&&ae("div",{ref:m,className:In.b("dropdown"),children:null===(i=o.children)||void 0===i?void 0:i.map(function(e,t){if(!_(e))return ae("div",{title:e.title,onClick:function(t){return w(t,e)},className:"".concat(In.be("dropdown","item")," ").concat(e.customClass||""," ").concat(In.is("disabled",g(e))),children:[ae("div",{className:In.bem("dropdown","item","icon"),children:y(e)}),ae("div",{className:In.bem("dropdown","item","label"),children:e.label})]},t)})})]})},Dn=new se("chat-toolbar"),zn=function(e){var t=e.controller,n=e.items,i=void 0===n?[]:n,o=e.data,a=e.type,c=e.className,s=e.mode,l=Ze(Fi),d=[],h=[{label:"重置对话",title:"重置对话",icon:function(){return ae(rn,{})},onClick:function(){t.resetTopic()},children:[{label:"清空对话",title:"清空对话",icon:function(){return ae(on,{})},onClick:function(){t.clearTopic()}},{label:"新建对话",title:"新建对话",hidden:"TOPIC"!==s,icon:function(){return ae(Wt,{})},onClick:function(){l.newTopic&&l.newTopic()}}]}],f=[{label:"刷新",title:"刷新",icon:function(){return ae(Pt,{})},onClick:function(){t.refreshMessage(o)}},{label:"删除",title:"删除",icon:function(){return ae(zt,{})},onClick:function(){t.deleteMessage(o)}},{label:"复制",title:"复制",icon:function(){return ae(Bt,{})},onClick:function(){t.copyMessage(o)}}];l.enableBackFill&&f.unshift.apply(f,[{label:"回填",title:"回填",icon:function(){return ae(Lt,{})},onClick:function(){t.backfill(o)}}]);var p=[{label:"刷新",title:"刷新",icon:function(){return ae(Pt,{})},onClick:function(){t.refreshMessage(o,!0)}}];if("content"===a)switch(o.type){case"DEFAULT":d="ASSISTANT"===o.role?[].concat(f,r(i)):[].concat(p);break;case"ERROR":d=[].concat(f,r(i))}else d=[].concat(h,r(i));var v=function(n,i){var r=u({},o);if(o instanceof An?(Object.assign(r,{topic:t.topic}),r.msg.realcontent=o.realcontent):(r.data||(r.data={}),Object.assign(r.data,{messages:t.messages.value})),i.onClick&&"function"==typeof i.onClick)i.onClick(n,i,t.context,t.params,r);else{var a=e.controller.opts.extendToolbarClick;a&&"function"==typeof a&&a(n,i,t.context,t.params,r)}},m=Ye(function(){return"content"===a&&20===(null==o?void 0:o.state)&&!0!==(null==o?void 0:o.completed)},[null==o?void 0:o.state,null==o?void 0:o.completed]);return ae("div",{className:"".concat(Dn.b()," ").concat(c||""),children:d.map(function(e,t){return ae(Ln,{data:o,model:e,disabled:m,buttonType:"content"===a?"circle":"default",onClick:v.bind(void 0)},t)})})};var Pn=function(e){var t=Mt(!1),n=Mt({}),i=new se("chat-back-bottom"),o=Mt(null),r=function(){if(o.value){var n=e.visibilityHeight||200,i=o.value.scrollHeight-o.value.scrollTop-o.value.offsetHeight;t.value=i>=n}},a=function(e,t){var n=null;return function(){for(var i=this,o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];n||(n=setTimeout(function(){e.apply(i,r),n=null},t))}}(r,300);return Ye(function(){n.value={right:"".concat(e.right,"px"),bottom:"".concat(e.bottom,"px")}},[e.right,e.bottom]),qe(function(){if(e.target){var t,n=null!==(t=document.querySelector(e.target))&&void 0!==t?t:void 0;n&&(o.value=n,n.addEventListener("scroll",a),r())}},[]),ae("div",{className:"".concat(i.b()," ").concat(i.is("visible",t.value)),style:n.value,onClick:function(){var t;o.value&&(o.value.scrollTo({top:o.value.scrollHeight,behavior:"smooth"}),null===(t=e.onClick)||void 0===t||t.call(e))},children:ae(nn,{className:i.e("icon")})})},Bn=new se("chat-messages"),Hn=function(e){var t=$e(null),n=a(Ve(!0),2),i=n[0],o=n[1],r=$e(!1),c=e.controller.messages;qe(function(){var e;i&&((e=t.current)&&(r.current=!0,e.scrollTo({top:e.scrollHeight,behavior:"auto"}),setTimeout(function(){r.current=!1},500)))},[c.value]);return ae("div",{ref:t,className:Bn.b(),onScroll:function(){if(!r.current&&t.current){var e=t.current,n=e.scrollTop,i=e.scrollHeight,a=e.clientHeight;o(i-(n+a)<50)}},children:[c.value.map(function(t){var n,i=(null===(n=t.content)||void 0===n?void 0:n.length)||0;return"SYSTEM"!==t.role?ae(En,{size:i,message:t,controller:e.controller,children:ae(zn,{type:"content",mode:"DEFAULT",data:t,items:e.toolbarItems,controller:e.controller})},t.messageid):null}),ae(Pn,{right:20,bottom:14,target:".".concat(Bn.b()),onClick:function(){r.current=!0,o(!0)}})]})};function jn(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function Fn(e,t){this.props=e,this.context=t}(Fn.prototype=new H).isPureReactComponent=!0,Fn.prototype.shouldComponentUpdate=function(e,t){return jn(this.props,e)||jn(this.state,t)};var Un=h.__b;h.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Un&&Un(e)};var Wn=h.__e;h.__e=function(e,t,n,i){if(e.then)for(var o,r=t;r=r.__;)if((o=r.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);Wn(e,t,n,i)};var Rn=h.unmount;function Vn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var n in t)e[n]=t[n];return e}({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Vn(e,t,n)})),e}function qn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return qn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function $n(){this.__u=0,this.o=null,this.__b=null}function Yn(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Xn(){this.i=null,this.l=null}h.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Rn&&Rn(e)},($n.prototype=new H).__c=function(e,t){var n=t.__c,i=this;null==i.o&&(i.o=[]),i.o.push(n);var o=Yn(i.__v),r=!1,a=function(){r||(r=!0,n.__R=null,o?o(c):c())};n.__R=a;var c=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=qn(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.o.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(a,a)},$n.prototype.componentWillUnmount=function(){this.o=[]},$n.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=Vn(this.__b,n,i.__O=i.__P)}this.__b=null}var o=t.__a&&z(B,null,e.fallback);return o&&(o.__u&=-33),[z(B,null,t.__a?null:e.children),o]};var Zn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Jn(e){return this.getChildContext=function(){return e.context},e.children}function Gn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){oe(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var i=t.__v;null!==i&&!i.__m&&null!==i.__;)i=i.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:i.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}oe(z(Jn,{context:t.context},e.__v),t.v)}function Kn(e,t){var n=z(Gn,{__v:e,h:t});return n.containerInfo=t,n}(Xn.prototype=new H).__a=function(e){var t=this,n=Yn(t.__v),i=t.l.get(e);return i[0]++,function(o){var r=function(){t.props.revealOrder?(i.push(o),Zn(t,e,i)):o()};n?n(r):r()}},Xn.prototype.render=function(e){this.i=null,this.l=new Map;var t=q(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Xn.prototype.componentDidUpdate=Xn.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Zn(e,n,t)})};var Qn="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ei=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ti=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ni=/[A-Z0-9]/g,ii="undefined"!=typeof document,oi=function(e){return("undefined"!=typeof Symbol&&"symbol"==w(Symbol())?/fil|che|rad/:/fil|che|ra/).test(e)};H.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(H.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ri=h.event;function ai(){}function ci(){return this.cancelBubble}function si(){return this.defaultPrevented}h.event=function(e){return ri&&(e=ri(e)),e.persist=ai,e.isPropagationStopped=ci,e.isDefaultPrevented=si,e.nativeEvent=e};var li={enumerable:!1,configurable:!0,get:function(){return this.class}},ui=h.vnode;h.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={},o=-1===n.indexOf("-");for(var r in t){var a=t[r];if(!("value"===r&&"defaultValue"in t&&null==a||ii&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var c=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===a?a="":"translate"===c&&"no"===a?a=!1:"o"===c[0]&&"n"===c[1]?"ondoubleclick"===c?r="ondblclick":"onchange"!==c||"input"!==n&&"textarea"!==n||oi(t.type)?"onfocus"===c?r="onfocusin":"onblur"===c?r="onfocusout":ti.test(r)&&(r=c):c=r="oninput":o&&ei.test(r)?r=r.replace(ni,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===c&&i[r=c]&&(r="oninputCapture"),i[r]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=q(t.children).forEach(function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)})),"select"==n&&null!=i.defaultValue&&(i.value=q(t.children).forEach(function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value})),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",li)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=Qn,ui&&ui(e)};var di=h.__r;h.__r=function(e){di&&di(e),e.__c};var hi=h.diffed;h.diffed=function(e){hi&&hi(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var fi=new Map;function pi(e){var t=fi.get(e);t&&t.destroy()}function vi(e){var t=fi.get(e);t&&t.update()}var mi=null;"undefined"==typeof window?((mi=function(e){return e}).destroy=function(e){return e},mi.update=function(e){return e}):((mi=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!fi.has(e)){var t,n=null,i=window.getComputedStyle(e),o=(t=e.value,function(){a({testForHeightReduction:""===t||!e.value.startsWith(t),restoreTextAlign:null}),t=e.value}),r=function(t){e.removeEventListener("autosize:destroy",r),e.removeEventListener("autosize:update",c),e.removeEventListener("input",o),window.removeEventListener("resize",c),Object.keys(t).forEach(function(n){return e.style[n]=t[n]}),fi.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,textAlign:e.style.textAlign,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",r),e.addEventListener("autosize:update",c),e.addEventListener("input",o),window.addEventListener("resize",c),e.style.overflowX="hidden",e.style.wordWrap="break-word",fi.set(e,{destroy:r,update:c}),c()}function a(t){var o,r,c=t.restoreTextAlign,s=void 0===c?null:c,l=t.testForHeightReduction,u=void 0===l||l,d=i.overflowY;if(0!==e.scrollHeight&&("vertical"===i.resize?e.style.resize="none":"both"===i.resize&&(e.style.resize="horizontal"),u&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],n=e[1];t.style.scrollBehavior="auto",t.scrollTop=n,t.style.scrollBehavior=null})}}(e),e.style.height=""),r="content-box"===i.boxSizing?e.scrollHeight-(parseFloat(i.paddingTop)+parseFloat(i.paddingBottom)):e.scrollHeight+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),"none"!==i.maxHeight&&r>parseFloat(i.maxHeight)?("hidden"===i.overflowY&&(e.style.overflow="scroll"),r=parseFloat(i.maxHeight)):"hidden"!==i.overflowY&&(e.style.overflow="hidden"),e.style.height=r+"px",s&&(e.style.textAlign=s),o&&o(),n!==r&&(e.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),n=r),d!==i.overflow&&!s)){var h=i.textAlign;"hidden"===i.overflow&&(e.style.textAlign="start"===h?"end":"start"),a({restoreTextAlign:h,testForHeightReduction:!0})}}function c(){a({testForHeightReduction:!0,restoreTextAlign:null})}}(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],pi),e},mi.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],vi),e});var _i=mi,gi=function(e){return e.STYLE_CACHE="ai-chat-style-cache",e.MINIMIZE_STYLY_CHCHE="ai-chat-minimize-style-cache",e.DATA_BASE_NAME="ibiz-chat",e.DATA_TABLE_NAME="history-message",e.DATA_TABLE_KEY_NAME="id",e}(gi||{}),yi=function(){return _(function e(t){v(this,e),g(this,"evt",new l),g(this,"messages",vt([])),g(this,"materials",vt([])),g(this,"input",vt("")),g(this,"isLoading",vt(!1)),g(this,"context",void 0),g(this,"params",void 0),g(this,"appDataEntityId",void 0),g(this,"topicId",void 0),g(this,"topic",void 0),g(this,"chatSessionid",""),this.opts=t,this.context=t.context,this.params=t.params,this.appDataEntityId=t.appDataEntityId,this.topicId=t.topicId,this.topic=t.topic,this.topicId?this.chatSessionid=Ee(this.topicId):this.chatSessionid=Ee(fe()),this.fecthHistory()},[{key:"fecthHistory",value:(m=p(d().m(function e(){var t,n,i=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(!this.topicId){e.n=2;break}return e.n=1,_e.getData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,this.topicId);case 1:if(!((t=e.v)&&t.data&&t.data.length>0)){e.n=2;break}return t.data.forEach(function(e){var t={messageid:e.messageid,state:e.state,type:e.type,role:e.role,content:e.content,suggestions:e.suggestions,completed:!0,toolcalls:e.toolcalls};i.addMessage(t)}),e.a(2,!0);case 2:return e.n=3,this.opts.history(this.context,this.params,{appDataEntityId:this.appDataEntityId,appendCurData:this.opts.appendCurData,sessionid:this.chatSessionid});case 3:if(!e.v){e.n=6;break}if(!1===this.opts.autoQuestion){e.n=5;break}if("USER"!==(n=this.messages.value[this.messages.value.length-1]).role){e.n=5;break}return e.n=4,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 4:if(!this.opts.action){e.n=5;break}return e.n=5,this.opts.action("question",n.content);case 5:this.opts.appendCurContent&&this.addMessage({state:30,messageid:fe(),role:"USER",type:"DEFAULT",content:this.opts.appendCurContent,completed:!0});case 6:return e.a(2,!0)}},e,this)})),function(){return m.apply(this,arguments)})},{key:"asyncToIndexDB",value:(f=p(d().m(function e(){var t;return d().w(function(e){for(;;)switch(e.n){case 0:if(this.topicId){e.n=1;break}return e.a(2);case 1:return t={id:this.topicId,data:this.messages.value.map(function(e){return u(u({},e._origin),{},{toolcalls:e.toolcalls})}),timestamp:(new Date).getTime()},e.n=2,_e.updateData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,t);case 2:return e.a(2)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"setInput",value:function(e){this.input.value=e||""}},{key:"addMessage",value:function(e){var t=this.messages.value.find(function(t){return t.messageid===e.messageid});t?(t.update(e),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(e)]),this.asyncToIndexDB()}},{key:"completeMessage",value:(h=p(d().m(function e(t,n){var i,o;return d().w(function(e){for(;;)switch(e.n){case 0:if(!(i=this.messages.value.find(function(e){return e.messageid===t}))){e.n=1;break}return i.updateCompleted(n),this.messages.value=r(this.messages.value),e.n=1,this.asyncToIndexDB();case 1:!0===this.opts.autoFill&&"ASSISTANT"===(o=i||this.messages.value[this.messages.value.length-1]).role&&30===o.state&&this.backfill(o),this.evt.emit("onCompleteMessage",{messageid:t,completed:n});case 2:return e.a(2)}},e,this)})),function(e,t){return h.apply(this,arguments)})},{key:"replaceMessage",value:function(e){var t=this,n=this.messages.value.findIndex(function(t){return t.messageid===e.messageid});-1!==n?(this.messages.value[n].replace(e),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(e)]),this.asyncToIndexDB(),"DEFAULT"===e.type&&this.opts.recommendPrompt&&this.opts.recommendPrompt(this.context,this.params,{appDataEntityId:this.appDataEntityId,message:{messages:[e],sessionid:this.chatSessionid}}).then(function(n){n&&n.content&&t.updateRecommendPrompt(e,n.content)})}},{key:"stopMessage",value:(s=p(d().m(function e(t){var n,i;return d().w(function(e){for(;;)switch(e.n){case 0:return-1!==(n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))?(i=this.messages.value[n],t.content=i.content,this.messages.value[n].replace(t),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(t)]),e.n=1,this.asyncToIndexDB();case 1:return e.a(2)}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"stringlyMaterialResource",value:function(){var e="",t=[];return this.materials.value&&this.materials.value.length>0&&(this.materials.value.forEach(function(e){if("ossfile"===e.type){var n=e.metadata;n.state&&"successed"===n.state&&t.push(e)}else t.push(e)}),this.materials.value=[]),t&&t.length>0&&(e=ye.stringify(t)),e}},{key:"getMessages",value:function(){var e=this.messages.value.filter(function(e){return"ERROR"!==e.type}).map(function(e){return e._origin});return e.forEach(function(e){e.content=e.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim()}),e}},{key:"question",value:(c=p(d().m(function e(t){var n,i=this;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.isLoading.value=!0,this.messages.value.forEach(function(e,t){var n=e._origin;n.suggestions&&(n.suggestions=void 0,i.messages.value[t].replace(n))}),this.messages.value=r(this.messages.value),this.asyncToIndexDB(),(n=this.stringlyMaterialResource())?n+="\n".concat(t):n=t,this.addMessage({state:30,messageid:fe(),role:"USER",type:"DEFAULT",content:n}),e.n=1,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 1:this.opts.action&&this.opts.action("question",t),this.isLoading.value=!1;case 2:return e.p=2,this.isLoading.value=!1,e.f(2);case 3:return e.a(2)}},e,this,[[0,,2,3]])})),function(e){return c.apply(this,arguments)})},{key:"abortQuestion",value:(a=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.opts.abortQuestion(this);case 1:return e.p=1,this.isLoading.value=!1,e.f(1);case 2:return e.a(2)}},e,this,[[0,,1,2]])})),function(){return a.apply(this,arguments)})},{key:"backfill",value:function(e){this.opts.action&&this.opts.action("backfill",e)}},{key:"deleteMessage",value:function(e){var t=this.messages.value.findIndex(function(t){return t.messageid===e.messageid});-1!==t&&(this.messages.value.splice(t,1),this.messages.value=r(this.messages.value)),this.asyncToIndexDB(),this.opts.action&&this.opts.action("deletemsg",e)}},{key:"refreshMessage",value:(o=p(d().m(function e(t){var n,i,o,a=arguments;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=a.length>1&&void 0!==a[1]&&a[1],this.isLoading.value=!0,e.p=1,i=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}),!n){e.n=3;break}return this.messages.value.splice(i+1,this.messages.value.length-i-1),this.messages.value=r(this.messages.value),e.n=2,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 2:e.n=6;break;case 3:if(i!==this.messages.value.length-1){e.n=5;break}return this.messages.value.pop(),this.messages.value=r(this.messages.value),e.n=4,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 4:e.n=6;break;case 5:o=this.messages.value[i-1].content,this.messages.value.splice(i-1,2),this.question(o);case 6:this.asyncToIndexDB(),this.opts.action&&this.opts.action("refreshmsg",t);case 7:return e.p=7,this.isLoading.value=!1,e.f(7);case 8:return e.a(2)}},e,this,[[1,,7,8]])})),function(e){return o.apply(this,arguments)})},{key:"copyMessage",value:function(e){var t=e.realcontent;me.copy(t),this.opts.action&&this.opts.action("copymsg",e)}},{key:"resetTopic",value:(i=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.abortQuestion();case 1:if(!this.topicId){e.n=2;break}return e.n=2,_e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,this.topicId);case 2:this.messages.value=[],this.opts.history(this.context,this.params,{appDataEntityId:this.appDataEntityId,appendCurData:this.opts.appendCurData,sessionid:this.chatSessionid});case 3:return e.a(2)}},e,this)})),function(){return i.apply(this,arguments)})},{key:"clearTopic",value:(n=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.abortQuestion();case 1:if(!this.topicId){e.n=2;break}return e.n=2,_e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,this.topicId);case 2:this.messages.value=[];case 3:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})},{key:"addMaterial",value:function(e){var t=this.materials.value.find(function(t){return t.id===e.id});this.materials.value=t?r(this.materials.value):[].concat(r(this.materials.value),[new On(e)])}},{key:"replaceMaterial",value:function(e,t){var n=this.materials.value.findIndex(function(t){return t.id===e});-1!==n?(this.materials.value[n]=new On(t),this.materials.value=r(this.materials.value)):this.materials.value=[].concat(r(this.materials.value),[new On(t)])}},{key:"deleteMaterial",value:function(e){var t=this.materials.value.findIndex(function(t){return t.id===e.id});-1!==t&&(this.materials.value.splice(t,1),this.materials.value=r(this.materials.value))}},{key:"updateRecommendPrompt",value:function(e,t){if(t){var n=this.messages.value.findIndex(function(t){return t.messageid===e.messageid}),i=we.parseMixedContent(t).suggestions;i&&i.length>0&&(e.suggestions=i,-1!==n?(this.messages.value[n].replace(e),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(e)]),this.asyncToIndexDB())}}},{key:"handleSuggestionClick",value:(t=p(d().m(function e(t,n,i){var o,a,c,s,l,h;return d().w(function(e){for(;;)switch(e.n){case 0:-1!==(o=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))&&((a=this.messages.value[o]._origin).suggestions=void 0,this.messages.value[o].replace(a),this.messages.value=r(this.messages.value)),this.asyncToIndexDB(),c=n.type,h=c,e.n="action"===h?1:"raw"===h?4:6;break;case 1:if(!this.opts.extendToolbarClick){e.n=3;break}if(s=n.data.actionid){e.n=2;break}throw new Error("actionid不能为空");case 2:return l=u({},t),Object.assign(l,{topic:this.topic}),l.msg.realcontent=t.realcontent,e.n=3,this.opts.extendToolbarClick(i,{id:s,appId:this.context.srfappid},this.context,this.params,l);case 3:case 5:return e.a(3,7);case 4:return e.n=5,this.question(n.data.content);case 6:throw new Error("不支持".concat(c,"推荐类型"));case 7:return e.a(2)}},e,this)})),function(e,n,i){return t.apply(this,arguments)})},{key:"destroyed",value:(e=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:this.evt.reset();case 1:return e.a(2)}},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t,n,i,o,a,c,s,h,f,m}(),wi=function(){return _(function e(t){v(this,e),g(this,"topics",vt([])),g(this,"activedTopic",vt(void 0)),g(this,"currentTopicOptions",void 0),this.chat=t},[{key:"fetchHistory",value:(c=p(d().m(function e(t){var n,i,o=this;return d().w(function(e){for(;;)switch(e.n){case 0:return n=t.configService(t.appid,"aitopics",t.type),e.n=1,n.load();case 1:(i=e.v)&&i.length>0&&i.forEach(function(e){o.topics.value=[].concat(r(o.topics.value),[new Mn(e)])});case 2:return e.a(2)}},e)})),function(e){return c.apply(this,arguments)})},{key:"updateCurrentTopic",value:(a=p(d().m(function e(t){var n,i,o,a;return d().w(function(e){for(;;)switch(e.n){case 0:return this.currentTopicOptions=t,n=this.topics.value.findIndex(function(e){return e.id===t.id}),i=new Mn(t),-1!==n?this.topics.value.splice(n,1,new Mn(t)):this.topics.value=[].concat(r(this.topics.value),[new Mn(t)]),o=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),a=t.configService(t.appid,"aitopics",t.type),e.n=1,null==a?void 0:a.save(o);case 1:this.activedTopic.value=i;case 2:return e.a(2)}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"removeTopic",value:(o=p(d().m(function e(t,n,i,o,a){var c,s,l,u,h;return d().w(function(e){for(;;)switch(e.n){case 0:if(s=!0,!t.beforeDelete){e.n=2;break}return e.n=1,t.beforeDelete(n,i,o,a);case 1:s=e.v;case 2:if(s){e.n=3;break}return e.a(2);case 3:return-1!==(l=this.topics.value.findIndex(function(e){return e.id===o.id}))&&(this.topics.value.splice(l,1),this.topics.value=r(this.topics.value)),u=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),h=t.configService(t.appid,"aitopics",t.type),e.n=4,null==h?void 0:h.save(u);case 4:return e.n=5,_e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,o.id);case 5:this.topics.value.length>0&&o.id===(null===(c=this.activedTopic.value)||void 0===c?void 0:c.id)&&this.handleTopicChange(this.topics.value[0]);case 6:return e.a(2)}},e,this)})),function(e,t,n,i,r){return o.apply(this,arguments)})},{key:"updateTopic",value:(i=p(d().m(function e(t,n){var i,o;return d().w(function(e){for(;;)switch(e.n){case 0:return i=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),o=t.configService(t.appid,"aitopics",t.type),e.n=1,null==o?void 0:o.save(i);case 1:return e.a(2)}},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"handleTopicChange",value:function(e){var t;(null===(t=this.activedTopic.value)||void 0===t?void 0:t.id)!==e.id&&(this.activedTopic.value=e,this.chat.switchAiChatController(e))}},{key:"handleTopicAction",value:(n=p(d().m(function e(t,n,i){var o,r,a,c,s,l;return d().w(function(e){for(;;)switch(e.n){case 0:if(o=this.topics.value.find(function(e){return e.id===n.id}),!(this.currentTopicOptions&&o&&o.aiChat)){e.n=4;break}if(c=o.aiChat,s=c.context,l=c.params,"DELETE"!==t){e.n=2;break}return e.n=1,this.removeTopic(this.currentTopicOptions,s,l,o,i);case 1:e.n=3;break;case 2:if("RENAME"!==t){e.n=3;break}return e.n=3,this.updateTopic(this.currentTopicOptions,n);case 3:null===(r=(a=this.currentTopicOptions).action)||void 0===r||r.call(a,t,s,l,n,i);case 4:return e.a(2)}},e,this)})),function(e,t,i){return n.apply(this,arguments)})},{key:"newTopic",value:(t=p(d().m(function e(){var t,n,i,o,a,c,s,l,u;return d().w(function(e){for(;;)switch(e.n){case 0:if(i=this.activedTopic.value){e.n=1;break}return e.a(2);case 1:return o=i.id.split("@")[0],a=this.topics.value.filter(function(e){return e.id.startsWith(o)}),c={appid:i.appid,id:"".concat(o,"@").concat(Date.now()),type:i.type,caption:"".concat(null===(t=i.sourceCaption)||void 0===t?void 0:t.split("_")[0],"_").concat(a.length),sourceCaption:i.sourceCaption,url:i.url,aiChat:i.aiChat},s=new Mn(c),this.topics.value=[].concat(r(this.topics.value),[s]),l=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),u=null===(n=this.currentTopicOptions)||void 0===n?void 0:n.configService(c.appid,"aitopics",c.type),e.n=2,null==u?void 0:u.save(l);case 2:this.handleTopicChange(s);case 3:return e.a(2)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"clearTopic",value:(e=p(d().m(function e(){var t,n,i,o,r,a=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(n=this.topics.value.find(function(e){var t;return e.id===(null===(t=a.activedTopic.value)||void 0===t?void 0:t.id)}),this.currentTopicOptions&&n){e.n=1;break}return e.a(2);case 1:if(i=!0,!this.currentTopicOptions.beforeDelete){e.n=3;break}return e.n=2,this.currentTopicOptions.beforeDelete(n.aiChat.context,n.aiChat.params,n,void 0,!0);case 2:i=e.v;case 3:if(i){e.n=4;break}return e.a(2);case 4:return e.n=5,Promise.all(this.topics.value.map(function(e){if(e.id!==(null==n?void 0:n.id))return _e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,e.id)}));case 5:return this.topics.value=n?[n]:[],o=null===(t=this.currentTopicOptions)||void 0===t?void 0:t.configService(this.currentTopicOptions.appid,"aitopics",this.currentTopicOptions.type),r=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),e.n=6,null==o?void 0:o.save(r);case 6:return e.a(2)}},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t,n,i,o,a,c}(),bi=_(function e(t){v(this,e),this.aiChat=t}),ki=function(t){function n(){return v(this,n),e(this,n,arguments)}return i(n,t),_(n,[{key:"excuteAction",value:(o=p(d().m(function e(t,n){var i,o,r,a;return d().w(function(e){for(;;)switch(e.n){case 0:if(!n||!n.onClick||"function"!=typeof n.onClick){e.n=2;break}return e.n=1,n.onClick(t,n,this.aiChat.context,this.aiChat.params);case 1:i=e.v,e.n=5;break;case 2:if(!(o=this.aiChat.opts.extendToolbarClick)){e.n=4;break}return e.n=3,o(t,n,this.aiChat.context,this.aiChat.params,{});case 3:i=e.v,e.n=5;break;case 4:console.error("未找到扩展工具栏点击事件");case 5:i&&i.data&&i.data.length>0&&(r=i.data[0],a={id:r.id,type:r.type,data:r.data||{},metadata:r.metadata||{}},n.id&&Object.assign(a.metadata,{actionId:n.id}),this.aiChat.addMaterial(a));case 6:return e.a(2)}},e,this)})),function(e,t){return o.apply(this,arguments)})}]);var o}(bi),Ci=function(t){function n(){return v(this,n),e(this,n,arguments)}return i(n,t),_(n,[{key:"excuteAction",value:(o=p(d().m(function e(t,n){var i,o,r,a,c,s,l,u,h,f,v=this;return d().w(function(e){for(;;)switch(e.n){case 0:i=this.aiChat.opts.uploader,o=i.multiple,r=i.accept,a=i.maxSize,c=i.onSelect,s=i.onUpload,l=i.onSuccess,u=i.onError,h=i.onProgress,f={multiple:o||!0,accept:r||"*/*",maxSize:a||5242880,onSelect:function(e){null==c||c(e),e.length>0&&e.forEach(function(e){var t=v.buildMaterialObject(e);Object.assign(t.metadata,{state:"uploading"}),v.aiChat.addMaterial(t)})},onUpload:function(){var e=p(d().m(function e(t,n){return d().w(function(e){for(;;)if(0===e.n)return e.a(2,s(t,n,{context:v.aiChat.context,params:v.aiChat.params}))},e)}));return function(t,n){return e.apply(this,arguments)}}(),onSuccess:function(e,t){var n={id:e.id,type:"ossfile",data:{id:e.id,name:e.name},metadata:{ext:e.ext,fileext:e.fileext,fileid:e.fileid,filename:e.filename,size:e.size,filesize:e.filesize,state:"successed"}};v.aiChat.replaceMaterial(t.name,n),null==l||l(e,t)},onError:function(e,t){var n=v.buildMaterialObject(t);Object.assign(n.metadata,{state:"failed"}),v.aiChat.replaceMaterial(t.name,n),null==u||u(e,t)},onProgress:function(e,t){null==h||h(e,t)}},new ge(f).openFilePicker();case 1:return e.a(2)}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"buildMaterialObject",value:function(e){return{id:e.name,type:"ossfile",data:{name:e.name,id:e.name},metadata:{size:e.size,type:e.type,lastModified:e.lastModified}}}}]);var o}(bi),xi=function(){return _(function e(){v(this,e)},null,[{key:"getMaterialHelper",value:function(e,t){return"ossfile"===e?new Ci(t):new ki(t)}}])}(),Ti=function(){return _(function e(){v(this,e),g(this,"container",void 0),g(this,"mode","DEFAULT"),g(this,"isMountedAiTopic",!1),g(this,"backupChatOptions",void 0),g(this,"aiTopic",void 0),g(this,"aiTopicMap",new Map),this.aiTopic=new wi(this)},[{key:"aiChat",get:function(){var e;return this.aiTopicMap.get("".concat(null===(e=this.aiTopic.activedTopic.value)||void 0===e?void 0:e.id))}},{key:"initIndexDB",value:(t=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,_e.checkTableExists(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME);case 1:if(e.v){e.n=2;break}return e.n=2,_e.createTable(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,gi.DATA_TABLE_KEY_NAME,!1);case 2:return e.a(2)}},e)})),function(){return t.apply(this,arguments)})},{key:"create",value:(e=p(d().m(function e(t){var n,i,o,r,a,c,s=this;return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.initIndexDB();case 1:if(this.backupChatOptions=t,this.close(),this.container=document.createElement("div"),this.container.classList.add("ibiz-ai-chat"),document.body.appendChild(this.container),r=t.chatOptions,!t.mode||"TOPIC"!==t.mode){e.n=5;break}if(this.isMountedAiTopic){e.n=3;break}return e.n=2,this.aiTopic.fetchHistory(t.topicOptions);case 2:this.isMountedAiTopic=!0;case 3:return a=t.topicOptions,Object.assign(a,{aiChat:{caption:r.caption,context:r.context,params:r.params,appDataEntityId:r.appDataEntityId,contentToolbarItems:r.contentToolbarItems,footerToolbarItems:r.footerToolbarItems,questionToolbarItems:r.questionToolbarItems,otherToolbarItems:r.otherToolbarItems,appendCurData:r.appendCurData,appendCurContent:r.appendCurContent}}),e.n=4,this.aiTopic.updateCurrentTopic(a);case 4:e.n=6;break;case 5:this.aiTopic.activedTopic.value=void 0;case 6:return Object.assign(r,{topicId:null===(n=a)||void 0===n?void 0:n.id,topic:a}),c=new yi(r),this.aiTopicMap.set("".concat(null===(i=a)||void 0===i?void 0:i.id),c),oe(z(Ui,{aiChat:c,aiTopic:this.aiTopic,mode:t.mode?t.mode:"DEFAULT",containerOptions:t.containerOptions,caption:t.mode&&"TOPIC"===t.mode?"AI助手":r.caption,enableBackFill:null===(o=t.containerOptions)||void 0===o?void 0:o.enableBackFill,contentToolbarItems:r.contentToolbarItems,footerToolbarItems:r.footerToolbarItems,questionToolbarItems:r.questionToolbarItems,autoClose:r.autoClose,openMode:r.openMode,close:function(){s.close(),r.closed&&r.closed(r.context,r.params)},fullscreen:function(e){r.fullscreen&&r.fullscreen(e,r.context,r.params)},minimize:function(e){r.minimize&&r.minimize(e,r.context,r.params)}}),this.container),e.a(2,c)}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"switchAiChatController",value:function(e){var t,n,i,o,r,a=this,c=u({},this.backupChatOptions.chatOptions);(e.aiChat&&Object.assign(c,{caption:e.aiChat.caption,context:e.aiChat.context,params:e.aiChat.params,contentToolbarItems:e.aiChat.contentToolbarItems,footerToolbarItems:e.aiChat.footerToolbarItems,questionToolbarItems:e.aiChat.questionToolbarItems,otherToolbarItems:e.aiChat.otherToolbarItems,appendCurData:e.aiChat.appendCurData,appendCurContent:e.aiChat.appendCurContent,appDataEntityId:e.aiChat.appDataEntityId,topicId:e.id,topic:e,extendToolbarClick:this.backupChatOptions.chatOptions.extendToolbarClick,recommendPrompt:this.backupChatOptions.chatOptions.recommendPrompt}),this.aiTopicMap.has("".concat(e.id))?t=this.aiTopicMap.get("".concat(e.id)):(t=new yi(c),this.aiTopicMap.set("".concat(e.id),t)),this.container)&&(oe(null,this.container),oe(z(Ui,{aiChat:t,aiTopic:this.aiTopic,mode:null!==(n=this.backupChatOptions)&&void 0!==n&&n.mode?this.backupChatOptions.mode:"DEFAULT",containerOptions:null===(i=this.backupChatOptions)||void 0===i?void 0:i.containerOptions,caption:null!==(o=this.backupChatOptions)&&void 0!==o&&o.mode&&"TOPIC"===this.backupChatOptions.mode?"AI助手":c.caption,enableBackFill:null===(r=this.backupChatOptions)||void 0===r||null===(r=r.containerOptions)||void 0===r?void 0:r.enableBackFill,contentToolbarItems:c.contentToolbarItems,footerToolbarItems:c.footerToolbarItems,questionToolbarItems:c.questionToolbarItems,close:function(){a.close(),c.closed&&c.closed(c.context,c.params)},fullscreen:function(e){c.fullscreen&&c.fullscreen(e,c.context,c.params)},minimize:function(e){c.minimize&&c.minimize(e,c.context,c.params)}}),this.container))}},{key:"hidden",value:function(){this.container&&(this.container.style.display="none")}},{key:"show",value:function(){this.container&&(this.container.style.display="flex")}},{key:"close",value:function(){this.container&&(oe(null,this.container),this.container.remove(),this.container=void 0),this.aiTopicMap.forEach(function(e){e.destroyed()})}}]);var e,t}(),Ni=(t("chat",new Ti),new se("chat-input-material")),Si=function(e){var t=e.controller.materials;return ae("div",{className:Ni.b(),children:t.value.map(function(t){return ae(wn,{material:t,disabled:!1,controller:e.controller},t.id)})})},Ei=function(e){var t=e.children,n=e.actions,i=e.content,o=e.position,r=void 0===o?"bottom":o,c=e.isOpen,s=e.onToggleOpen,l=e.onAction,d=new se("pop"),h=Ze(Fi),f=a(Ve(c||!1),2),p=f[0],v=f[1],m=$e(null),_=$e(null);qe(function(){void 0!==c&&v(c)},[c]),qe(function(){return _.current||(_.current=document.createElement("div"),_.current.className=d.b("content-container"),document.body.appendChild(_.current)),function(){_.current&&document.body.removeChild(_.current)}},[]),qe(function(){var e=function(e){!m.current||m.current.contains(e.target)||e.target.closest(".".concat(d.b()))||e.target.closest(".ibiz-quick-edit")||e.target.closest(".ibiz-picker__transfer")||(v(!1),null==s||s(!1))};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[p,s]);return ae("span",{className:"".concat(d.b("trigger-container")),children:[ae("span",{className:"".concat(d.b("trigger-element")),ref:m,onClick:function(e){e.stopPropagation();var t=!p;v(t),null==s||s(t)},children:t}),p&&_.current&&Kn(ae("div",{className:"".concat(d.b()," pop-").concat(r),style:function(){if(!m.current)return{};var e=m.current.getBoundingClientRect(),t={position:"absolute",zIndex:h.zIndex+1},n={bottom:{top:e.bottom+window.scrollY,left:e.left+window.scrollX},top:{bottom:window.innerHeight-e.top+window.scrollY,left:e.left+window.scrollX},left:{top:e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX},right:{top:e.top+window.scrollY,left:e.right+window.scrollX},"top-left":{bottom:window.innerHeight-e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX}};return u(u({},t),n[r])}(),children:i||(null==n?void 0:n.map(function(e){return ae("div",{title:e.caption,className:d.e("item"),onMouseDown:function(t){t.stopPropagation(),null==l||l(e.id,t)},children:[e.icon,ae("div",{className:d.em("item","caption"),children:e.caption})]},e.id)}))}),_.current)]})},Ai=new se("chat-input"),Mi=window.SpeechRecognition||window.webkitSpeechRecognition,Oi=function(e){var t,n=a(Ve(!1),2),i=n[0],o=n[1],r=$e(null),c=e.controller.input,s=Mt(!1),l=$e();Mi&&!l.current&&(l.current=new Mi,l.current.onstart=function(){s.value=!0},l.current.onend=function(){s.value=!1},l.current.onresult=function(e){var t,n=null===(t=e.results)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.transcript;n&&(c.value="".concat(c.value).concat(n))});var u=Xe(function(e){c.value=e.target.value},[c]),h=Ot(function(){return c.value.length<=0});qe(function(){return r.current&&_i(r.current),function(){r.current&&_i.destroy(r.current)}},[r]);var f=Xe(p(d().m(function t(){var n,i,o;return d().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,n=c.value,c.value="",t.n=1,e.controller.question(n);case 1:t.n=3;break;case 2:t.p=2,o=t.v,console.error(o);case 3:return t.p=3,null===(i=r.current)||void 0===i||i.focus(),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])})),[c]),v=Xe(p(d().m(function t(){return d().w(function(t){for(;;)switch(t.n){case 0:try{e.controller.abortQuestion()}catch(n){console.error(n)}case 1:return t.a(2)}},t)})),[c]),m=function(){var t=p(d().m(function t(n){var i;return d().w(function(t){for(;;)switch(t.n){case 0:return i=xi.getMaterialHelper("ossfile",e.controller),t.n=1,i.excuteAction(n);case 1:o(!1);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),_=function(){var t=p(d().m(function t(n,i){var r;return d().w(function(t){for(;;)switch(t.n){case 0:return r=xi.getMaterialHelper("common",e.controller),t.n=1,r.excuteAction(n,i);case 1:o(!1);case 2:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}();return ae("div",{className:Ai.b("wrapper"),children:[ae("div",{className:Ai.b("material-wrapper"),children:ae(Si,{controller:e.controller})}),ae("div",{className:Ai.b("main-wrapper"),children:[ae("textarea",{className:Ai.e("textarea"),type:"text",rows:6,autoCorrect:"off",autoCapitalize:"off",autoComplete:"off",value:c,onInput:u,onKeyDown:function(e){"Enter"!==e.code||e.isComposing||(e.stopPropagation(),!1===e.shiftKey&&f())},ref:r,disabled:e.controller.isLoading.value}),ae("div",{className:Ai.b("action-wrapper"),children:[ae("div",{className:"".concat(Ai.be("action-wrapper","action-item")," ").concat(Ai.is("disabled",e.controller.isLoading.value)),title:"上传资料",children:ae(Ei,{content:ae("div",{className:Ai.b("pop-actions"),children:[ae("div",{className:Ai.b("pop-action-item"),onClick:function(e){m(e)},children:[ae("span",{className:Ai.b("pop-action-item-icon"),children:ae(Kt,{})}),ae("span",{className:Ai.b("pop-action-item-title"),children:"文件资料"})]}),null===(t=e.questionToolbarItems)||void 0===t?void 0:t.map(function(e){var t,n,i;return ae("div",{className:Ai.b("pop-action-item"),onClick:function(t){_(t,e)},children:[ae("span",{className:Ai.b("pop-action-item-icon"),children:"function"==typeof e.icon?e.icon():(null===(t=e.icon)||void 0===t?void 0:t.showIcon)&&ae(B,{children:null!==(n=e.icon)&&void 0!==n&&n.cssClass?ae("i",{className:e.icon.cssClass}):null!==(i=e.icon)&&void 0!==i&&i.imagePath?ve(e.icon.imagePath)?ae("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):ae("img",{src:e.icon.imagePath}):null})}),ae("span",{className:Ai.b("pop-action-item-title"),children:e.label})]},e.id)})]}),position:"top-left",isOpen:i,onToggleOpen:o,children:ae(Gt,{})})}),ae("div",{title:s.value?"语音输入中...":"语音输入",className:"".concat(Ai.be("action-wrapper","action-item")," ").concat(Ai.is("disabled",e.controller.isLoading.value)),onClick:function(){l.current&&!s.value&&l.current.start()},children:s.value?ae(Vt,{}):ae(Rt,{})}),e.controller.isLoading.value?ae("div",{title:"停止生成",className:"".concat(Ai.be("action-wrapper","action-item")),onClick:v,children:ae(tn,{})}):ae("div",{title:"发送消息",className:"".concat(Ai.be("action-wrapper","action-item")," ").concat(Ai.is("disabled",h.value)),onClick:f,children:ae(Dt,{})})]})]})]})},Ii=new se("chat-topic-item"),Li=function(e){var t=e.controller,n=e.topic,i=e.onClick,o=e.onAction,r=$e(null),c=Ot(function(){var e;return(null===(e=t.activedTopic.value)||void 0===e?void 0:e.id)===n.id}),s=a(Ve(!1),2),l=s[0],u=s[1],d=Mt(!1);return ae("div",{className:"".concat(Ii.b()," ").concat(Ii.is("active",c.value)," ").concat(Ii.is("edit",d.value)),onClick:i.bind(void 0),children:[ae("div",{className:Ii.e("caption"),title:n.caption,children:d.value?ae("input",{ref:r,value:n.caption,onBlur:function(e){e.stopPropagation(),d.value=!1,o("RENAME",e)},onKeyDown:function(e){e.stopPropagation(),"Enter"===e.key&&(d.value=!1)},onClick:function(e){return e.stopPropagation()},onChange:function(e){return(t=e).stopPropagation(),void(n.data.caption=null===(i=t.target)||void 0===i?void 0:i.value);var t,i},className:Ii.em("caption","editor")}):ae("span",{className:Ii.em("caption","text"),children:n.caption})}),!d.value&&ae("div",{className:Ii.e("icon"),children:[ae("span",{title:"跳转主视图",className:Ii.em("icon","item"),onClick:function(e){e.stopPropagation(),o("LINK",e)}.bind(void 0),children:ae($t,{className:Ii.b("link-icon")})}),c.value?null:ae(Ei,{actions:[{id:"RENAME",caption:"重命名",icon:ae(an,{})},{id:"DELETE",caption:"删除话题",icon:ae(Yt,{})}],position:"bottom",isOpen:l,onToggleOpen:u,onAction:function(e,t){"DELETE"===e?o("DELETE",t):"RENAME"===e&&(d.value=!0,setTimeout(function(){var e;null===(e=r.current)||void 0===e||e.focus()},100)),u(!1)}.bind(void 0),children:ae("span",{className:Ii.em("icon","item"),title:"更多",children:ae(qt,{className:Ii.e("more-icon")})})})]})]})},Di=new se("chat-search"),zi=function(e){var t=e.className,n=e.value,i=e.placeholder,o=e.onChange,r=a(Ve(!1),2),c=r[0],s=r[1],l=function(e){var t;e.stopPropagation(),null==o||o(null===(t=e.target)||void 0===t?void 0:t.value)};return ae("div",{className:"".concat(Di.b()," ").concat(Di.is("focus",c)," ").concat(t||""),children:[ae("div",{className:Di.e("prefix"),children:ae(sn,{})}),ae("input",{value:n,className:Di.e("inner"),placeholder:i,onFocus:function(){return s(!0)},onBlur:function(){return s(!1)},onChange:function(e){return l(e)}})]})},Pi=new se("chat-topics"),Bi=function(e){var t=$e(null),n=Mt(void 0),i=Mt([]);qe(function(){i.value=e.controller.topics.value.filter(function(e){var t,i;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(i=n.value)||void 0===i?void 0:i.trim().toLowerCase())||"")})},[e.controller.topics.value]);return qe(function(){var e=t.current;if(e){var n=e.querySelector(".ibiz-chat-topic-item.is-active");null==n||n.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e.controller.activedTopic.value]),ae("div",{className:Pi.b(),children:[ae("div",{className:Pi.e("header"),children:ae(zi,{value:n.value,placeholder:"搜索话题",onChange:function(t){n.value=t,i.value=e.controller.topics.value.filter(function(e){var t,i;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(i=n.value)||void 0===i?void 0:i.trim().toLowerCase())||"")})}.bind(void 0)})}),ae("div",{ref:t,className:Pi.e("main"),children:i.value&&i.value.length>0?i.value.map(function(t){return ae(Li,{topic:t,controller:e.controller,onClick:function(){return function(t){e.controller.handleTopicChange(t)}(t)},onAction:function(n,i){return function(t,n,i){e.controller.handleTopicAction(t,n,i)}(n,t,i)}},t.id)}):ae("div",{className:Pi.e("empty"),children:"暂无话题"})}),ae("div",{className:Pi.e("footer"),children:ae("div",{title:"清空会话",className:Pi.e("action"),onClick:function(){return e.controller.clearTopic()},children:[ae(Yt,{}),ae("span",{children:"清空会话"})]})})]})},Hi=new se("chat-minimize"),ji=function(e){var t=$e(null),n=a(Ve(""),2),i=n[0],o=n[1],r=a(Ve(0),2),c=r[0],s=r[1],l=$e(!1),u={x:(window.innerWidth-86)/window.innerWidth,y:(window.innerHeight-86)/window.innerHeight},d=Ot(function(){var t=e.controller.messages.value[e.controller.messages.value.length-1];return!!t&&("ASSISTANT"===t.role&&20===t.state&&!0!==t.completed)}),h=Ot(function(){var t="";if(!d.value)return o(""),s(0),t;var n=e.controller.messages.value[e.controller.messages.value.length-1];if(t=n.content,-1!==n.content.indexOf("<think>")){var i=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),i="",o="";return-1===n?(i=e.slice(t+7),o=""):(i=e.slice(t+7,n),o=e.slice(n+8)),{thoughtContent:i,answerContent:o}}(n.content);t=i.thoughtContent+i.answerContent}return t}),f=function(){Object.assign(t.current.style,{left:"".concat(100*u.x,"%"),top:"".concat(100*u.y,"%")}),localStorage.setItem(gi.MINIMIZE_STYLY_CHCHE,JSON.stringify(u))};return qe(function(){var e,n=localStorage.getItem(gi.MINIMIZE_STYLY_CHCHE);if(n){var i=JSON.parse(n);be(i)&&Object.assign(u,i)}f(),(e=t.current)&&(e.onmousedown=function(t){document.body.style.userSelect="none";var n=t.clientX-e.offsetLeft,i=t.clientY-e.offsetTop,o=Date.now(),r=function(e){var t=56/window.innerWidth,o=56/window.innerHeight,r=ke(e.clientX-n,e.clientY-i,t,o),a=r.x,c=r.y;Object.assign(u,{x:a,y:c}),requestAnimationFrame(function(){f()})},a=function(){var e=Date.now();l.current=e-o>300,document.body.style.userSelect="",document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)})},[]),qe(function(){if(c<h.value.length){var e=setTimeout(function(){o(function(e){return e+h.value[c]}),s(function(e){return e+1})},100);return function(){return clearTimeout(e)}}},[c,h.value]),ae("div",{ref:t,title:e.title,className:"".concat(Hi.b()," ").concat(Hi.is("hidden",!e.isMinimize)," ").concat(Hi.is("show-halo",d.value)),onClick:function(){l.current||e.onClick()},children:ae("div",{className:"".concat(Hi.e("content")," ").concat(Hi.is("show-border",!d.value)),children:[i&&ae("div",{className:"".concat(Hi.em("content","popover")),children:ae("div",{className:"typewriter",children:i})}),ae(Ut,{})]})})},Fi=function(e){function t(e){var n,i;return this.getChildContext||(n=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,U(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+E++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({zIndex:10,enableBackFill:!0,newTopic:function(){}}),Ui=function(t){function n(t){var i,o,r,a,c;return v(this,n),g(c=e(this,n,[t]),"ns",new se("chat-container")),g(c,"containerRef",{current:null}),g(c,"dragHandle",{current:null}),g(c,"data",{side:{y:0,height:1,width:750/window.innerWidth,x:(window.innerWidth-750)/window.innerWidth},window:{y:0,width:750/window.innerWidth,height:750/window.innerHeight,x:(window.innerWidth-750)/window.innerWidth},minWidth:500,minHeight:300,showMode:"side"}),g(c,"disabled",!1),g(c,"isDragging",!1),g(c,"containerContext",{zIndex:(null===(i=c.props.containerOptions)||void 0===i?void 0:i.zIndex)||10,enableBackFill:void 0===(null===(o=c.props)||void 0===o?void 0:o.enableBackFill)||null===(null===(r=c.props)||void 0===r?void 0:r.enableBackFill)||(null===(a=c.props)||void 0===a?void 0:a.enableBackFill),newTopic:function(){c.props.aiTopic.newTopic()}}),c.state={isFullScreen:!1,isMinimize:!("minimize"!==(null==t?void 0:t.openMode)&&"autoexpand"!==(null==t?void 0:t.openMode))},null==t||t.aiChat.evt.on("onCompleteMessage",function(){if(t.autoClose){var e=t.autoClose,n=e.mode,i=e.duration,o=void 0===i?3:i;switch(n){case"minimize":c.minimize();break;case"close":c.close();break;case"closetime":setTimeout(function(){c.close()},1e3*o)}}"autoexpand"===t.openMode&&c.exitMinimize()}),c}return i(n,t),_(n,[{key:"calcWindowStyle",value:function(){var e,t="window"===this.data.showMode?this.data.window:this.data.side;return{left:"".concat(100*t.x,"%"),top:"".concat(100*t.y,"%"),width:"".concat(100*t.width,"%"),height:"".concat(100*t.height,"%"),minWidth:"".concat(this.data.minWidth,"px"),minHeight:"".concat(this.data.minHeight,"px"),"z-index":(null===(e=this.props.containerOptions)||void 0===e||null===(e=e.zIndex)||void 0===e?void 0:e.toString())||"10"}}},{key:"calcSideModeStyle",value:function(e){Object.assign(this.data,{side:{y:0,x:"left"===e?0:(window.innerWidth-750)/window.innerWidth,height:1,width:750/window.innerWidth},showMode:"side"})}},{key:"setStyle",value:function(){Object.assign(this.containerRef.current.style,this.calcWindowStyle()),localStorage.setItem(gi.STYLE_CACHE,JSON.stringify(this.data))}},{key:"snapToEdge",value:function(){var e=20/window.innerWidth,t=20/window.innerHeight,n=this.data.window,i=n.x,o=n.y,r=n.width,a=n.height;i<e||i+r>1-e?this.calcSideModeStyle(i<e?"left":"right"):(o<t&&(this.data.window.y=0),o+a>1-t&&(this.data.window.y=1-a)),this.setStyle()}},{key:"registerDragDialog",value:function(){var e=this;this.dragHandle.current.onmousedown=function(t){if(!e.state.isFullScreen){document.body.style.userSelect="none";var n=t.clientX-e.containerRef.current.offsetLeft,i=t.clientY-e.containerRef.current.offsetTop,o=function(t){if(!e.disabled){e.data.showMode="window";var o=ke(t.clientX-n,t.clientY-i,e.data.window.width,e.data.window.height),r=o.x,a=o.y;Object.assign(e.data.window,{x:r,y:a}),e.setStyle()}},r=function(){document.body.style.userSelect="",document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),e.disabled||e.snapToEdge()};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}}}},{key:"registerDragDialogBorder",value:function(){var e=this;o(this.containerRef.current).resizable({edges:{top:!0,right:!0,bottom:!0,left:!0},margin:6,modifiers:[o.modifiers.restrictEdges({outer:document.body}),o.modifiers.restrictSize({min:{width:this.data.minWidth,height:this.data.minHeight}})],inertia:!0,listeners:{move:function(t){if(!e.state.isFullScreen){var n="side"===e.data.showMode?e.data.side:e.data.window;n.x=t.rect.left/window.innerWidth,n.y=t.rect.top/window.innerHeight,n.width=t.rect.width/window.innerWidth,n.height=t.rect.height/window.innerHeight,e.setStyle()}},start:function(){e.disabled=!0,document.body.style.userSelect="none"},end:function(){e.disabled=!1,document.body.style.userSelect=""}}})}},{key:"handleFullScreenChange",value:function(){this.setState({isFullScreen:null!==document.fullscreenElement})}},{key:"componentDidMount",value:function(){this.handleFullScreenChange=this.handleFullScreenChange.bind(this);var e=localStorage.getItem(gi.STYLE_CACHE);if(e){var t=JSON.parse(e);t.side&&be(t.side)&&t.window&&be(t.window)&&Object.assign(this.data,t)}this.setStyle(),this.registerDragDialog(),this.registerDragDialogBorder(),document.addEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"close",value:function(){this.props.close()}},{key:"fullScreen",value:function(){var e=this.containerRef.current;e&&(e.requestFullscreen(),this.props.fullscreen(!0))}},{key:"closeFullScreen",value:function(){var e;this.state.isFullScreen&&(null===(e=document)||void 0===e||e.exitFullscreen(),this.props.fullscreen(!1),this.setStyle())}},{key:"minimize",value:function(){this.closeFullScreen(),this.setState({isMinimize:!0}),this.props.minimize(!0)}},{key:"exitMinimize",value:function(){this.setState({isMinimize:!1}),this.props.minimize(!1)}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"render",value:function(){return ae(Fi.Provider,{value:this.containerContext,children:ae("div",{className:"".concat(this.ns.b()),children:[ae("div",{className:"".concat(this.ns.e("dialog")," ").concat(this.ns.is("full-screen",this.state.isFullScreen)," ").concat(this.ns.is("hidden",this.state.isMinimize)),ref:this.containerRef,children:[ae("div",{ref:this.dragHandle,className:this.ns.b("header"),children:[ae("div",{className:this.ns.b("header-caption"),children:this.props.caption||"AI助手"}),ae("div",{className:this.ns.b("header-action-wrapper"),children:[ae("div",{title:"最小化",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","minimize")),onMouseDown:this.stopPropagation.bind(this),onClick:this.minimize.bind(this),children:ae(Ft,{})}),this.state.isFullScreen?ae("div",{title:"退出全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","close-full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.closeFullScreen.bind(this),children:ae(jt,{})}):ae("div",{title:"全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.fullScreen.bind(this),children:ae(Ht,{})}),ae("div",{title:"关闭",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","action-close")),onMouseDown:this.stopPropagation.bind(this),onClick:this.close.bind(this),children:ae(It,{})})]})]}),"TOPIC"===this.props.mode?ae("div",{className:"".concat(this.ns.b("main")),children:[ae("div",{className:"".concat(this.ns.be("main","left")),children:ae(Bi,{controller:this.props.aiTopic})}),ae("div",{className:"".concat(this.ns.be("main","right")),children:[ae("div",{className:this.ns.b("content"),children:ae(Hn,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),ae(zn,{type:"footer",mode:this.props.mode,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),ae("div",{className:this.ns.b("footer"),children:ae(Oi,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}):ae("div",{className:"".concat(this.ns.be("main","default")),children:[ae("div",{className:this.ns.b("content"),children:ae(Hn,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),ae(zn,{type:"footer",mode:this.props.mode,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),ae("div",{className:this.ns.b("footer"),children:ae(Oi,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}),ae(ji,{title:this.props.caption||"AI助手",controller:this.props.aiChat,isMinimize:this.state.isMinimize,onClick:this.exitMinimize.bind(this)})]})})}}])}(H);t("ChatContainer",Ui)}}})}();
1
+ !function(){function e(e,i,o){return i=n(i),function(e,t){if(t&&("object"==w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,t()?Reflect.construct(i,o||[],n(e).constructor):i.apply(e,o))}function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t=function(){return!!e})()}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function r(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r,a,c=[],s=!0,l=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(i=r.call(n)).done)&&(c.push(i.value),c.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function r(n,i,o,r){var s=i&&i.prototype instanceof c?i:c,l=Object.create(s.prototype);return h(l,"_invoke",function(n,i,o){var r,c,s,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return r=t,c=0,s=e,h.n=n,a}};function f(n,i){for(c=n,s=i,t=0;!d&&l&&!o&&t<u.length;t++){var o,r=u[t],f=h.p,p=r[2];n>3?(o=p===i)&&(s=r[(c=r[4])?5:(c=3,3)],r[4]=r[5]=e):r[0]<=f&&((o=n<2&&f<r[1])?(c=0,h.v=i,h.n=r[1]):f<p&&(o=n<3||r[0]>i||i>p)&&(r[4]=n,r[5]=i,h.n=p,c=0))}if(o||n>1)return a;throw d=!0,i}return function(o,u,p){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,p),c=u,s=p;(t=c<2?e:s)||!d;){r||(c?c<3?(c>1&&(h.n=-1),f(c,s)):h.n=s:h.v=s);try{if(l=2,r){if(c||(o="next"),t=r[o]){if(!(t=t.call(r,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=r.return)&&t.call(r),c<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),c=1);r=e}else if((t=(d=h.n<0)?s:n.call(i,h))!==a)break}catch(t){r=e,c=1,s=t}finally{l=1}}return{value:t,done:d}}}(n,o,r),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(h(t={},i,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,h(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,h(f,"constructor",l),h(l,"constructor",s),s.displayName="GeneratorFunction",h(l,o,"GeneratorFunction"),h(f),h(f,o,"Generator"),h(f,i,function(){return this}),h(f,"toString",function(){return"[object Generator]"}),(d=function(){return{w:r,m:p}})()}function h(e,t,n,i){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}h=function(e,t,n,i){function r(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(r("next",0),r("throw",1),r("return",2))},h(e,t,n,i)}function f(e,t,n,i,o,r,a){try{var c=e[r](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(i,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){var r=e.apply(t,n);function a(e){f(r,i,o,a,c,"next",e)}function c(e){f(r,i,o,a,c,"throw",e)}a(void 0)})}}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,y(i.key),i)}}function _(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){var t=function(e,t){if("object"!=w(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=w(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==w(t)?t:t+""}function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}System.register(["interactjs","cherry-markdown","qx-util"],function(t,n){"use strict";var o,s,l;return{setters:[function(e){o=e.default},function(e){s=e.default},function(e){l=e.QXEvent}],execute:function(){var n,h,f,m,y,b,k,C,x,T,N,S,E,A={},M=[],O=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I=Array.isArray;function L(e,t){for(var n in t)e[n]=t[n];return e}function D(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,i){var o,r,a,c={};for(a in t)"key"==a?o=t[a]:"ref"==a?r=t[a]:c[a]=t[a];if(arguments.length>2&&(c.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===c[a]&&(c[a]=e.defaultProps[a]);return P(e,c,o,r,null)}function P(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++f:o,__i:-1,__u:0};return null==o&&null!=h.vnode&&h.vnode(r),r}function B(e){return e.children}function H(e,t){this.props=e,this.context=t}function j(e,t){if(null==t)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?j(e):null}function F(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return F(e)}}function U(e){(!e.__d&&(e.__d=!0)&&y.push(e)&&!W.__r++||b!=h.debounceRendering)&&((b=h.debounceRendering)||k)(W)}function W(){for(var e,t,n,i,o,r,a,c=1;y.length;)y.length>c&&y.sort(C),e=y.shift(),c=y.length,e.__d&&(n=void 0,i=void 0,o=(i=(t=e).__v).__e,r=[],a=[],t.__P&&((n=L({},i)).__v=i.__v+1,h.vnode&&h.vnode(n),J(t.__P,n,i,t.__n,t.__P.namespaceURI,32&i.__u?[o]:null,r,null==o?j(i):o,!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,K(r,n,a),i.__e=i.__=null,n.__e!=o&&F(n)));W.__r=0}function R(e,t,n,i,o,r,a,c,s,l,u){var d,h,f,p,v,m,_,g=i&&i.__k||M,y=t.length;for(s=function(e,t,n,i,o){var r,a,c,s,l,u=n.length,d=u,h=0;for(e.__k=new Array(o),r=0;r<o;r++)null!=(a=t[r])&&"boolean"!=typeof a&&"function"!=typeof a?(s=r+h,(a=e.__k[r]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?P(null,a,null,null,null):I(a)?P(B,{children:a},null,null,null):null==a.constructor&&a.__b>0?P(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,c=null,-1!=(l=a.__i=$(a,n,s,d))&&(d--,(c=n[l])&&(c.__u|=2)),null==c||null==c.__v?(-1==l&&(o>u?h--:o<u&&h++),"function"!=typeof a.type&&(a.__u|=4)):l!=s&&(l==s-1?h--:l==s+1?h++:(l>s?h--:h++,a.__u|=4))):e.__k[r]=null;if(d)for(r=0;r<u;r++)null!=(c=n[r])&&!(2&c.__u)&&(c.__e==i&&(i=j(c)),ne(c,c));return i}(n,t,g,s,y),d=0;d<y;d++)null!=(f=n.__k[d])&&(h=-1==f.__i?A:g[f.__i]||A,f.__i=d,m=J(e,f,h,o,r,a,c,s,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&te(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==v&&null!=p&&(v=p),(_=!!(4&f.__u))||h.__k===f.__k?s=V(f,s,e,_):"function"==typeof f.type&&void 0!==m?s=m:p&&(s=p.nextSibling),f.__u&=-7);return n.__e=v,s}function V(e,t,n,i){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=V(o[r],t,n,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=j(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function q(e,t){return t=t||[],null==e||"boolean"==typeof e||(I(e)?e.some(function(e){q(e,t)}):t.push(e)),t}function $(e,t,n,i){var o,r,a,c=e.key,s=e.type,l=t[n],u=null!=l&&!(2&l.__u);if(null===l&&null==e.key||u&&c==l.key&&s==l.type)return n;if(i>(u?1:0))for(o=n-1,r=n+1;o>=0||r<t.length;)if(null!=(l=t[a=o>=0?o--:r++])&&!(2&l.__u)&&c==l.key&&s==l.type)return a;return-1}function Y(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||O.test(t)?n:n+"px"}function X(e,t,n,i,o){var r,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Y(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Y(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(x,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n.u=i.u:(n.u=T,e.addEventListener(t,r?S:N,r)):e.removeEventListener(t,r?S:N,r);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Z(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=T++;else if(t.t<n.u)return;return n(h.event?h.event(t):t)}}}function J(e,t,n,i,o,r,a,c,s,l){var u,d,f,p,v,m,_,g,y,w,b,k,C,x,T,N,S,E=t.type;if(null!=t.constructor)return null;128&n.__u&&(s=!!(32&n.__u),r=[c=t.__e=n.__e]),(u=h.__b)&&u(t);e:if("function"==typeof E)try{if(g=t.props,y="prototype"in E&&E.prototype.render,w=(u=E.contextType)&&i[u.__c],b=u?w?w.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new E(g,b):(t.__c=d=new H(g,b),d.constructor=E,d.render=ie),w&&w.sub(d),d.props=g,d.state||(d.state={}),d.context=b,d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=E.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=L({},d.__s)),L(d.__s,E.getDerivedStateFromProps(g,d.__s))),p=d.props,v=d.state,d.__v=t,f)y&&null==E.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==E.getDerivedStateFromProps&&g!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(g,b),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(g,d.__s,b)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=g,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(g,d.__s,b),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,v,m)})}if(d.context=b,d.props=g,d.__P=e,d.__e=!1,C=h.__r,x=0,y){for(d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do{d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++x<25);d.state=d.__s,null!=d.getChildContext&&(i=L(L({},i),d.getChildContext())),y&&!f&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(p,v)),N=u,null!=u&&u.type===B&&null==u.key&&(N=Q(u.props.children)),c=R(e,I(N)?N:[N],t,n,i,o,r,a,c,s,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(e){if(t.__v=null,s||null!=r)if(e.then){for(t.__u|=s?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;r[r.indexOf(c)]=null,t.__e=c}else{for(S=r.length;S--;)D(r[S]);G(t)}else t.__e=n.__e,t.__k=n.__k,e.then||G(t);h.__e(e,t,n)}else null==r&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ee(n.__e,t,n,i,o,r,a,s,l);return(u=h.diffed)&&u(t),128&t.__u?void 0:c}function G(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(G)}function K(e,t,n){for(var i=0;i<n.length;i++)te(n[i],n[++i],n[++i]);h.__c&&h.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){h.__e(e,t.__v)}})}function Q(e){return"object"!=w(e)||null==e||e.__b&&e.__b>0?e:I(e)?e.map(Q):L({},e)}function ee(e,t,i,o,r,a,c,s,l){var u,d,f,p,v,m,_,g=i.props,y=t.props,w=t.type;if("svg"==w?r="http://www.w3.org/2000/svg":"math"==w?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),null!=a)for(u=0;u<a.length;u++)if((v=a[u])&&"setAttribute"in v==!!w&&(w?v.localName==w:3==v.nodeType)){e=v,a[u]=null;break}if(null==e){if(null==w)return document.createTextNode(y);e=document.createElementNS(r,w,y.is&&y),s&&(h.__m&&h.__m(t,a),s=!1),a=null}if(null==w)g===y||s&&e.data==y||(e.data=y);else{if(a=a&&n.call(e.childNodes),g=i.props||A,!s&&null!=a)for(g={},u=0;u<e.attributes.length;u++)g[(v=e.attributes[u]).name]=v.value;for(u in g)if(v=g[u],"children"==u);else if("dangerouslySetInnerHTML"==u)f=v;else if(!(u in y)){if("value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y)continue;X(e,u,null,v,r)}for(u in y)v=y[u],"children"==u?p=v:"dangerouslySetInnerHTML"==u?d=v:"value"==u?m=v:"checked"==u?_=v:s&&"function"!=typeof v||g[u]===v||X(e,u,v,g[u],r);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=""),R("template"==t.type?e.content:e,I(p)?p:[p],t,i,o,"foreignObject"==w?"http://www.w3.org/1999/xhtml":r,a,c,a?a[0]:i.__k&&j(i,0),s,l),null!=a)for(u=a.length;u--;)D(a[u]);s||(u="value","progress"==w&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[u]||"progress"==w&&!m||"option"==w&&m!=g[u])&&X(e,u,m,g[u],r),u="checked",null!=_&&_!=e[u]&&X(e,u,_,g[u],r))}return e}function te(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){h.__e(e,n)}}function ne(e,t,n){var i,o;if(h.unmount&&h.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||te(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){h.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&ne(i[o],t,n||"function"!=typeof e.type);n||D(e.__e),e.__c=e.__=e.__e=void 0}function ie(e,t,n){return this.constructor(e,n)}function oe(e,t,i){var o,r,a,c;t==document&&(t=document.documentElement),h.__&&h.__(e,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,a=[],c=[],J(t,e=(!o&&i||t).__k=z(B,null,[e]),r||A,A,t.namespaceURI,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,a,!o&&i?i:r?r.__e:t.firstChild,o,c),K(a,e,c)}n=M.slice,h={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},f=0,m=function(e){return null!=e&&null==e.constructor},H.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=L({},this.state),"function"==typeof e&&(e=e(L({},n),this.props)),e&&L(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),U(this))},H.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),U(this))},H.prototype.render=B,y=[],k="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,C=function(e,t){return e.__v.__b-t.__v.__b},W.__r=0,x=/(PointerCapture)$|Capture$/i,T=0,N=Z(!1),S=Z(!0),E=0;var re=0;function ae(e,t,n,i,o,r){t||(t={});var a,c,s=t;if("ref"in s)for(c in s={},t)"ref"==c?a=t[c]:s[c]=t[c];var l={type:e,props:s,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--re,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===s[c]&&(s[c]=a[c]);return h.vnode&&h.vnode(l),l}function ce(e,t,n,i,o){var r="".concat(e,"-").concat(t);return n&&(r+="-".concat(n)),i&&(r+="__".concat(i)),o&&(r+="--".concat(o)),r}var se=function(){return _(function e(t,n){v(this,e),g(this,"namespace",void 0),this.block=t,this.namespace=n||"ibiz"},[{key:"b",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ce(this.namespace,this.block,e,"","")}},{key:"e",value:function(e){return e?ce(this.namespace,this.block,"",e,""):""}},{key:"m",value:function(e){return e?ce(this.namespace,this.block,"","",e):""}},{key:"be",value:function(e,t){return e&&t?ce(this.namespace,this.block,e,t,""):""}},{key:"em",value:function(e,t){return e&&t?ce(this.namespace,this.block,"",e,t):""}},{key:"bm",value:function(e,t){return e&&t?ce(this.namespace,this.block,e,"",t):""}},{key:"bem",value:function(e,t,n){return e&&t&&n?ce(this.namespace,this.block,e,t,n):""}},{key:"is",value:function(e,t){return e&&t?"".concat("is-").concat(e):""}},{key:"cssVar",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t}},{key:"cssVarBlock",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t}},{key:"cssVarName",value:function(e){return"--".concat(this.namespace,"-").concat(e)}},{key:"cssVarBlockName",value:function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)}}])}();function le(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function ue(e,t){for(var n,i="",o=0,r=-1,a=0,c=0;c<=e.length;++c){if(c<e.length)n=e.charCodeAt(c);else{if(47===n)break;n=47}if(47===n){if(r===c-1||1===a);else if(r!==c-1&&2===a){if(i.length<2||2!==o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var s=i.lastIndexOf("/");if(s!==i.length-1){-1===s?(i="",o=0):o=(i=i.slice(0,s)).length-1-i.lastIndexOf("/"),r=c,a=0;continue}}else if(2===i.length||1===i.length){i="",o=0,r=c,a=0;continue}t&&(i.length>0?i+="/..":i="..",o=2)}else i.length>0?i+="/"+e.slice(r+1,c):i=e.slice(r+1,c),o=c-r-1;r=c,a=0}else 46===n&&-1!==a?++a:a=-1}return i}var de={resolve:function(){for(var e,t="",n=!1,i=arguments.length-1;i>=-1&&!n;i--){var o;i>=0?o=arguments[i]:(void 0===e&&(e=process.cwd()),o=e),le(o),0!==o.length&&(t=o+"/"+t,n=47===o.charCodeAt(0))}return t=ue(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(le(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=ue(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return le(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];le(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":de.normalize(e)},relative:function(e,t){if(le(e),le(t),e===t)return"";if((e=de.resolve(e))===(t=de.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,o=i-n,r=1;r<t.length&&47===t.charCodeAt(r);++r);for(var a=t.length-r,c=o<a?o:a,s=-1,l=0;l<=c;++l){if(l===c){if(a>c){if(47===t.charCodeAt(r+l))return t.slice(r+l+1);if(0===l)return t.slice(r+l)}else o>c&&(47===e.charCodeAt(n+l)?s=l:0===l&&(s=0));break}var u=e.charCodeAt(n+l);if(u!==t.charCodeAt(r+l))break;47===u&&(s=l)}var d="";for(l=n+s+1;l<=i;++l)l!==i&&47!==e.charCodeAt(l)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(r+s):(r+=s,47===t.charCodeAt(r)&&++r,t.slice(r))},_makeLong:function(e){return e},dirname:function(e){if(le(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,i=-1,o=!0,r=e.length-1;r>=1;--r)if(47===(t=e.charCodeAt(r))){if(!o){i=r;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');le(e);var n,i=0,o=-1,r=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,c=-1;for(n=e.length-1;n>=0;--n){var s=e.charCodeAt(n);if(47===s){if(!r){i=n+1;break}}else-1===c&&(r=!1,c=n+1),a>=0&&(s===t.charCodeAt(a)?-1===--a&&(o=n):(a=-1,o=c))}return i===o?o=c:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!r){i=n+1;break}}else-1===o&&(r=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){le(e);for(var t=-1,n=0,i=-1,o=!0,r=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===i&&(o=!1,i=a+1),46===c?-1===t?t=a:1!==r&&(r=1):-1!==t&&(r=-1);else if(!o){n=a+1;break}}return-1===t||-1===i||0===r||1===r&&t===i-1&&t===n+1?"":e.slice(t,i)},format:function(e){if(null===e||"object"!==w(e))throw new TypeError('The "pathObject" argument must be of type Object. Received type '+w(e));return function(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+e+i:i}("/",e)},parse:function(e){le(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,i=e.charCodeAt(0),o=47===i;o?(t.root="/",n=1):n=0;for(var r=-1,a=0,c=-1,s=!0,l=e.length-1,u=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===c&&(s=!1,c=l+1),46===i?-1===r?r=l:1!==u&&(u=1):-1!==r&&(u=-1);else if(!s){a=l+1;break}return-1===r||-1===c||0===u||1===u&&r===c-1&&r===a+1?-1!==c&&(t.base=t.name=0===a&&o?e.slice(1,c):e.slice(a,c)):(0===a&&o?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(a,r),t.base=e.slice(a,c)),t.ext=e.slice(r,c)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};function he(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function fe(){return"".concat(he()+he(),"-").concat(he(),"-").concat(he(),"-").concat(he(),"-").concat(he()).concat(he()).concat(he())}de.posix=de;var pe=/<svg\b[^>]*>[\s\S]*?<\/svg>/;function ve(e){return pe.test(e)}var me=function(){return _(function e(){v(this,e)},null,[{key:"copy",value:function(e){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=e,this.inputElement.select(),document.execCommand("copy")}}])}();g(me,"inputElement",null);var _e=function(){function e(){v(this,e)}return _(e,null,[{key:"checkDataBaseExists",value:(u=p(d().m(function e(t){var n,i;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,indexedDB.databases();case 1:return n=e.v,e.a(2,n.some(function(e){return e.name===t}));case 2:return e.p=2,i=e.v,console.error("检查数据库是否存在时出错:",i),e.a(2,!1)}},e,null,[[0,2]])})),function(e){return u.apply(this,arguments)})},{key:"deleteDatabase",value:(l=p(d().m(function t(n){var i,o;return d().w(function(t){for(;;)if(0===t.n)return e.lastLink&&(null===(i=(o=e.lastLink).close)||void 0===i||i.call(o)),t.a(2,new Promise(function(e,t){var i=indexedDB.deleteDatabase(n);i.onsuccess=function(){e(!0)},i.onerror=function(){e(!1)},i.onblocked=function(){console.warn("删除数据库 ".concat(n," 被阻塞,可能有其他连接正在使用该数据库。")),t(new Error("删除数据库 ".concat(n," 被阻塞")))}}))},t)})),function(e){return l.apply(this,arguments)})},{key:"checkTableExists",value:(s=p(d().m(function t(n,i){return d().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.checkDataBaseExists(n);case 1:if(t.v){t.n=2;break}return t.a(2,!1);case 2:return t.a(2,new Promise(function(t,o){var r=indexedDB.open(n);r.onupgradeneeded=function(t){e.db=t.target.result,e.version=e.db.version},r.onsuccess=function(n){e.db=n.target.result,e.lastLink=r.result;var o=e.db.objectStoreNames.contains(i);r.result.close(),t(o)},r.onerror=function(e){o(e.target.error)}}))}},t)})),function(e,t){return s.apply(this,arguments)})},{key:"createTable",value:(c=p(d().m(function t(n,i,o){var r,a=arguments;return d().w(function(t){for(;;)if(0===t.n)return r=a.length>3&&void 0!==a[3]&&a[3],t.a(2,new Promise(function(t){var a,c;e.version+=1,e.lastLink&&(null===(a=(c=e.lastLink).close)||void 0===a||a.call(c));var s=indexedDB.open(n,e.version);s.onupgradeneeded=function(t){if(e.db=t.target.result,!e.db.objectStoreNames.contains(i)){var n={};o?n.keyPath=o:r&&(n.autoIncrement=!0),e.db.createObjectStore(i,n)}},s.onsuccess=function(){e.lastLink=s.result,s.result.close(),t(!0)},s.onerror=function(){t(!1)}}))},t)})),function(e,t,n){return c.apply(this,arguments)})},{key:"deleteTable",value:(a=p(d().m(function t(n,i){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){var o,r;e.version+=1,e.lastLink&&(null===(o=(r=e.lastLink).close)||void 0===o||o.call(r));var a=indexedDB.open(n,e.version);a.onupgradeneeded=function(t){e.db=t.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)&&e.db.deleteObjectStore(i)},a.onsuccess=function(n){e.db=n.target.result,e.lastLink=a.result,a.result.close(),t(!0)},a.onerror=function(){a.result.close(),t(!1)}}))},t)})),function(e,t){return a.apply(this,arguments)})},{key:"addData",value:(r=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var r=e.db.transaction([i],"readwrite").objectStore(i).add(o);r.onsuccess=function(e){t(o)},r.onerror=function(){t(null)}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,n){return r.apply(this,arguments)})},{key:"deleteData",value:(o=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var r=e.db.transaction([i],"readwrite").objectStore(i).delete(o);r.onsuccess=function(e){t(!0)},r.onerror=function(){t(!1)}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,n){return o.apply(this,arguments)})},{key:"updateData",value:(i=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var r=e.db.transaction([i],"readwrite").objectStore(i).put(o);r.onsuccess=function(e){t(o)},r.onerror=function(){t(o)}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,n){return i.apply(this,arguments)})},{key:"getData",value:(n=p(d().m(function t(n,i,o){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(i)){var c=e.db.transaction([i],"readonly").objectStore(i).get(o);c.onsuccess=function(e){t(c.result)},c.onerror=function(){r(new Error("未找到数据".concat(o)))}}a.result.close()},a.onerror=function(){a.result.close(),r()}}))},t)})),function(e,t,i){return n.apply(this,arguments)})},{key:"getAllData",value:(t=p(d().m(function t(n,i){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var r=indexedDB.open(n);r.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=r.result,e.db.objectStoreNames.contains(i)){var o=e.db.transaction([i],"readonly").objectStore(i).getAll();o.onsuccess=function(e){t(o.result)},o.onerror=function(){t([])}}r.result.close()},r.onerror=function(){r.result.close(),o()}}))},t)})),function(e,n){return t.apply(this,arguments)})}]);var t,n,i,o,r,a,c,s,l,u}();g(_e,"version",1),g(_e,"db",null),g(_e,"lastLink",void 0);var ge=function(){return _(function e(t){v(this,e),g(this,"options",void 0),this.options=u({multiple:!0,accept:"*/*",maxSize:5242880},t)},[{key:"openFilePicker",value:function(){var e=this,t=document.createElement("input");t.type="file",t.multiple=this.options.multiple,t.accept=this.options.accept||"",t.onchange=function(t){var n=Array.from(t.target.files||[]);e.handleFiles(n)},t.click()}},{key:"handleFiles",value:(t=p(d().m(function e(t){var n,i,o,r=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(0!==t.length){e.n=1;break}return e.a(2);case 1:return o=t.filter(function(e){var t,n;return!(r.options.maxSize&&e.size>r.options.maxSize&&(null===(t=(n=r.options).onError)||void 0===t||t.call(n,new Error("文件大小超过限制 (".concat(r.formatSize(e.size)," > ").concat(r.formatSize(r.options.maxSize),")")),e),1))}),null===(n=(i=this.options).onSelect)||void 0===n||n.call(i,o),e.n=2,Promise.all(o.map(function(e){return r.processFile(e)}));case 2:return e.a(2)}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"processFile",value:(e=p(d().m(function e(t){var n,i,o,r,a,c,s,l,u,h=this;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a=function(e){var n,i;null===(n=(i=h.options).onProgress)||void 0===n||n.call(i,t,e)},e.n=1,this.options.onUpload(t,a);case 1:c=e.v,null===(n=(i=this.options).onProgress)||void 0===n||n.call(i,t,100),null===(o=(r=this.options).onSuccess)||void 0===o||o.call(r,c,t),e.n=3;break;case 2:e.p=2,u=e.v,null===(s=(l=this.options).onError)||void 0===s||s.call(l,u instanceof Error?u:new Error("上传失败"),t);case 3:return e.a(2)}},e,this,[[0,2]])})),function(t){return e.apply(this,arguments)})},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(2)," ").concat(["B","KB","MB","GB"][t])}}]);var e,t}(),ye=function(){return _(function e(){v(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("resource")).map(function(e){var n=e.getAttribute("type")||"",i=e.querySelector("data"),o=e.querySelector("metadata");try{var r=t.getCdataContent(i),a=t.getCdataContent(o),c=r?JSON.parse(r):{},s=a?JSON.parse(a):{};return{id:c.id,type:n,data:c,metadata:s}}catch(fi){throw new Error("XML 解析错误: ".concat(fi.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<resources\b[^>]*>[\s\S]*?<\/resources>/i.exec(e);if(!t)return{resources:[],remainingText:e,hasResources:!1};var n=a(t,1)[0],i=t.index,o=i+n.length,r=(e.slice(0,i)+e.slice(o)).replace(/\n/g,"");try{return{resources:this.parse(n),remainingText:r,hasResources:!0}}catch(c){return{resources:[],remainingText:r,hasResources:!0,error:"资源解析失败: ".concat(c.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("resources");n.setAttribute("version","1.0");var i=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(i(1)));var o=t.createElement("resource");o.setAttribute("type",e.type),o.setAttribute("version","1.0");var r=function(e,n){var o=t.createElement(e);o.appendChild(t.createTextNode(i(2)));var r=t.createCDATASection(JSON.stringify(n));return o.appendChild(r),o.appendChild(t.createTextNode(i(1))),o};o.appendChild(t.createTextNode(i(2))),o.appendChild(r("data",e.data)),o.appendChild(t.createTextNode(i(2))),o.appendChild(r("metadata",e.metadata)),o.appendChild(t.createTextNode(i(1))),n.appendChild(o)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}(),we=function(){return _(function e(){v(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("suggestion")).map(function(e){var n=e.getAttribute("type")||"",i=e.querySelector("data"),o=e.querySelector("metadata");try{var r=t.getCdataContent(i),a=t.getCdataContent(o);return{type:n,data:r?JSON.parse(r):{},metadata:a?JSON.parse(a):{}}}catch(fi){throw new Error("XML 解析错误: ".concat(fi.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<suggestions\b[^>]*>[\s\S]*?<\/suggestions>/i.exec(e);if(!t)return{suggestions:[],remainingText:e,hasSuggestions:!1};var n=a(t,1)[0],i=t.index,o=i+n.length,r=(e.slice(0,i)+e.slice(o)).replace(/\n/g,"");try{return{suggestions:this.parse(n),remainingText:r,hasSuggestions:!0}}catch(c){return{suggestions:[],remainingText:r,hasSuggestions:!0,error:"资源解析失败: ".concat(c.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("suggestions");n.setAttribute("version","1.0");var i=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(i(1)));var o=t.createElement("suggestion");o.setAttribute("type",e.type),o.setAttribute("version","1.0");var r=function(e,n){var o=t.createElement(e);o.appendChild(t.createTextNode(i(2)));var r=t.createCDATASection(JSON.stringify(n));return o.appendChild(r),o.appendChild(t.createTextNode(i(1))),o};o.appendChild(t.createTextNode(i(2))),o.appendChild(r("data",e.data)),o.appendChild(t.createTextNode(i(2))),o.appendChild(r("metadata",e.metadata)),o.appendChild(t.createTextNode(i(1))),n.appendChild(o)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}();function be(e){return e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1}function ke(e,t,n,i){var o=e/window.innerWidth,r=t/window.innerHeight;return{x:Math.max(0,Math.min(o,1-n)),y:Math.max(0,Math.min(r,1-i))}}function Ce(e){for(var t=0,n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return Math.abs(t).toString(36).toUpperCase()}function xe(e){for(var t=2166136261,n=0;n<e.length;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return Math.abs(t).toString(36).toUpperCase()}function Te(e){for(var t=5381,n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return Math.abs(t).toString(36).toUpperCase()}function Ne(e){return e.replace(/[^A-Z0-9]/g,"")}function Se(e,t){switch(t){case"fnv1a":return xe(e);case"djb2":return Te(e);case"combined":return function(e){for(var t=Ce(e)+xe(e)+Te(e),n="",i=0;i<e.length%10+10;i++){var o=7*i%t.length;n+=t.charAt(o)}return n.toUpperCase()}(e);default:return Ce(e)}}function Ee(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:36;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:36,n=Ne(e);if(n.length>=t)return n.substring(0,t);for(var i=n;i.length<t;)i+=Ne(Se(i,"combined"));return i.substring(0,t)}(Se(e,"combined"),t)}var Ae,Me,Oe,Ie,Le=function(){return _(function e(){v(this,e)},null,[{key:"parse",value:function(e){var t,n=new RegExp("<tool_call>\\s*({[\\s\\S]*?})\\s*</tool_call>","g"),i=[],o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}(e.matchAll(n));try{for(o.s();!(t=o.n()).done;){var r=t.value;try{var a=JSON.parse(r[1]),s={name:a.name,parameters:a.parameters,error:a.error||!1};a.result&&Object.assign(s,{result:a.result}),i.push(s)}catch(fi){console.error("解析工具调用失败:",fi)}}}catch(l){o.e(l)}finally{o.f()}return i}}])}(),De=0,ze=[],Pe=h,Be=Pe.__b,He=Pe.__r,je=Pe.diffed,Fe=Pe.__c,Ue=Pe.unmount,We=Pe.__;function Re(e,t){Pe.__h&&Pe.__h(Me,e,De||t),De=0;var n=Me.__H||(Me.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Ve(e){return De=1,function(e,t,n){var i=Re(Ae++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):nt(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Me,!Me.__f)){var o=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter(function(e){return!!e.__c});if(o.every(function(e){return!e.__N}))return!r||r.call(this,e,t,n);var a=i.__c.props!==e;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),r&&r.call(this,e,t,n)||a};Me.__f=!0;var r=Me.shouldComponentUpdate,a=Me.componentWillUpdate;Me.componentWillUpdate=function(e,t,n){if(this.__e){var i=r;r=void 0,o(e,t,n),r=i}a&&a.call(this,e,t,n)},Me.shouldComponentUpdate=o}return i.__N||i.__}(nt,e)}function qe(e,t){var n=Re(Ae++,3);!Pe.__s&&tt(n.__H,t)&&(n.__=e,n.u=t,Me.__H.__h.push(n))}function $e(e){return De=5,Ye(function(){return{current:e}},[])}function Ye(e,t){var n=Re(Ae++,7);return tt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Xe(e,t){return De=8,Ye(function(){return e},t)}function Ze(e){var t=Me.context[e.__c],n=Re(Ae++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Me)),t.props.value):e.__}function Je(){for(var e;e=ze.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Qe),e.__H.__h.forEach(et),e.__H.__h=[]}catch(pi){e.__H.__h=[],Pe.__e(pi,e.__v)}}Pe.__b=function(e){Me=null,Be&&Be(e)},Pe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),We&&We(e,t)},Pe.__r=function(e){He&&He(e),Ae=0;var t=(Me=e.__c).__H;t&&(Oe===Me?(t.__h=[],Me.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Qe),t.__h.forEach(et),t.__h=[],Ae=0)),Oe=Me},Pe.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ze.push(t)&&Ie===Pe.requestAnimationFrame||((Ie=Pe.requestAnimationFrame)||Ke)(Je)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Oe=Me=null},Pe.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Qe),e.__h=e.__h.filter(function(e){return!e.__||et(e)})}catch(mi){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Pe.__e(mi,e.__v)}}),Fe&&Fe(e,t)},Pe.unmount=function(e){Ue&&Ue(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Qe(e)}catch(e){t=e}}),n.__H=void 0,t&&Pe.__e(t,n.__v))};var Ge="function"==typeof requestAnimationFrame;function Ke(e){var t,n=function(){clearTimeout(i),Ge&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Ge&&(t=requestAnimationFrame(n))}function Qe(e){var t=Me,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Me=t}function et(e){var t=Me;e.__c=e.__(),Me=t}function tt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function nt(e,t){return"function"==typeof t?t(e):t}var it=Symbol.for("preact-signals");function ot(){if(ut>1)ut--;else{for(var e,t=!1;void 0!==lt;){var n=lt;for(lt=void 0,dt++;void 0!==n;){var i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&mt(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=i}}if(dt=0,ut--,t)throw e}}var rt=void 0;function at(e){var t=rt;rt=void 0;try{return e()}finally{rt=t}}var ct,st,lt=void 0,ut=0,dt=0,ht=0;function ft(e){if(void 0!==rt){var t=e.n;if(void 0===t||t.t!==rt)return t={i:0,S:e,p:rt.s,n:void 0,t:rt,e:void 0,x:void 0,r:t},void 0!==rt.s&&(rt.s.n=t),rt.s=t,e.n=t,32&rt.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=rt.s,t.n=void 0,rt.s.n=t,rt.s=t),t}}function pt(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function vt(e,t){return new pt(e,t)}function mt(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function _t(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function gt(e){for(var t=e.s,n=void 0;void 0!==t;){var i=t.p;-1===t.i?(t.S.U(t),void 0!==i&&(i.n=t.n),void 0!==t.n&&(t.n.p=i)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=i}e.s=n}function yt(e,t){pt.call(this,void 0),this.x=e,this.s=void 0,this.g=ht-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function wt(e,t){return new yt(e,t)}function bt(e){var t=e.u;if(e.u=void 0,"function"==typeof t){ut++;var n=rt;rt=void 0;try{t()}catch(pi){throw e.f&=-2,e.f|=8,kt(e),pi}finally{rt=n,ot()}}}function kt(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,bt(e)}function Ct(e){if(rt!==this)throw new Error("Out-of-order effect");gt(this),rt=e,this.f&=-2,8&this.f&&kt(this),ot()}function xt(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Tt(e,t){var n=new xt(e,t);try{n.c()}catch(e){throw n.d(),e}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Nt(e,t){h[e]=t.bind(null,h[e]||function(){})}function St(e){st&&st(),st=e&&e.S()}function Et(e){var t=this,n=e.data,i=Mt(n);i.value=n;var o=Ye(function(){for(var e=t.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return t.__$u.c=function(){var e,n=t.__$u.S(),i=o.value;n(),m(i)||3!==(null==(e=t.base)?void 0:e.nodeType)?(t.__$f|=1,t.setState({})):t.base.data=i},wt(function(){var e=i.value.value;return 0===e?0:!0===e?"":e||""})},[]);return o.value}function At(e,t,n,i){var o=t in e&&void 0===e.ownerSVGElement,r=vt(n);return{o:function(e,t){r.value=e,i=t},d:Tt(function(){var n=r.value.value;i[t]!==n&&(i[t]=n,o?e[t]=n:n?e.setAttribute(t,n):e.removeAttribute(t))})}}function Mt(e){return Ye(function(){return vt(e)},[])}function Ot(e){var t=$e(e);return t.current=e,ct.__$f|=4,Ye(function(){return wt(function(){return t.current()})},[])}pt.prototype.brand=it,pt.prototype.h=function(){return!0},pt.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:at(function(){var e;null==(e=t.W)||e.call(t)}))},pt.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,i=e.x;void 0!==n&&(n.x=i,e.e=void 0),void 0!==i&&(i.e=n,e.x=void 0),e===this.t&&(this.t=i,void 0===i&&at(function(){var e;null==(e=t.Z)||e.call(t)}))}},pt.prototype.subscribe=function(e){var t=this;return Tt(function(){var n=t.value,i=rt;rt=void 0;try{e(n)}finally{rt=i}},{name:"sub"})},pt.prototype.valueOf=function(){return this.value},pt.prototype.toString=function(){return this.value+""},pt.prototype.toJSON=function(){return this.value},pt.prototype.peek=function(){var e=rt;rt=void 0;try{return this.value}finally{rt=e}},Object.defineProperty(pt.prototype,"value",{get:function(){var e=ft(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(dt>100)throw new Error("Cycle detected");this.v=e,this.i++,ht++,ut++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{ot()}}}}),yt.prototype=new pt,yt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===ht)return!0;if(this.g=ht,this.f|=1,this.i>0&&!mt(this))return this.f&=-2,!0;var e=rt;try{_t(this),rt=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return rt=e,gt(this),this.f&=-2,!0},yt.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}pt.prototype.S.call(this,e)},yt.prototype.U=function(e){if(void 0!==this.t&&(pt.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},yt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(yt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ft(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),xt.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},xt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,bt(this),_t(this),ut++;var e=rt;return rt=this,Ct.bind(this,e)},xt.prototype.N=function(){2&this.f||(this.f|=2,this.o=lt,lt=this)},xt.prototype.d=function(){this.f|=8,1&this.f||kt(this)},xt.prototype.dispose=function(){this.d()},Et.displayName="_st",Object.defineProperties(pt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Et},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),Nt("__b",function(e,t){if("string"==typeof t.type){var n,i=t.props;for(var o in i)if("children"!==o){var r=i[o];r instanceof pt&&(n||(t.__np=n={}),n[o]=r,i[o]=r.peek())}}e(t)}),Nt("__r",function(e,t){St();var n,i=t.__c;i&&(i.__$f&=-2,void 0===(n=i.__$u)&&(i.__$u=n=function(){var e;return Tt(function(){e=this}),e.c=function(){i.__$f|=1,i.setState({})},e}())),ct=i,St(n),e(t)}),Nt("__e",function(e,t,n,i){St(),ct=void 0,e(t,n,i)}),Nt("diffed",function(e,t){var n;if(St(),ct=void 0,"string"==typeof t.type&&(n=t.__e)){var i=t.__np,o=t.props;if(i){var r=n.U;if(r)for(var a in r){var c=r[a];void 0===c||a in i||(c.d(),r[a]=void 0)}else n.U=r={};for(var s in i){var l=r[s],u=i[s];void 0===l?(l=At(n,s,u,o),r[s]=l):l.o(u,o)}}}e(t)}),Nt("unmount",function(e,t){if("string"==typeof t.type){var n=t.__e;if(n){var i=n.U;if(i)for(var o in n.U=void 0,i){var r=i[o];r&&r.d()}}}else{var a=t.__c;if(a){var c=a.__$u;c&&(a.__$u=void 0,c.d())}}e(t)}),Nt("__h",function(e,t,n,i){(i<3||9===i)&&(t.__$f|=2),e(t,n,i)}),H.prototype.shouldComponentUpdate=function(e,t){var n=this.__$u,i=n&&void 0!==n.s;for(var o in t)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(i||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(i||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var r in e)if("__source"!==r&&e[r]!==this.props[r])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};var It=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M843.904 783.573333 783.573333 843.904 512.042667 572.373333 240.512 843.904 180.181333 783.573333 451.712 512.042667 180.181333 240.512 240.512 180.181333 512.042667 451.712 783.573333 180.181333 843.904 240.512 572.373333 512.042667 843.904 783.573333Z"})})},Lt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M900.64 379.808l-263.072-256.032c-36.448-35.328-105.76-35.392-142.304 0.096l-327.04 319.904c-56.416 54.72-70.72 76.704-70.72 150.976l0 143.936c0 132.768 26.976 192 186.912 192l131.872 0c81.12 0 128.448-46.656 193.952-111.264l290.016-297.696c18.592-17.984 29.248-43.968 29.248-71.264C929.504 423.36 918.976 397.6 900.64 379.808zM323.008 786.752c-52.928 0-96-43.072-96-96s43.072-96 96-96 96 43.072 96 96S375.936 786.752 323.008 786.752z"})})},Dt=function(e){return ae("svg",{viewBox:"0 0 1024 1024",id:"send",className:e.className,version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-0.9 3.7-0.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 0.7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-0.8 4.2-2.6 5-5 1.4-4.2-0.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})},zt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M962 197.61H747v-60c0-55.14-44.86-100-100-100H377c-55.14 0-100 44.86-100 100v60H62c-11.05 0-20 8.95-20 20s8.95 20 20 20h60v630.57c0 66.17 53.83 120 120 120h540c66.17 0 120-53.83 120-120V237.61h60c11.05 0 20-8.95 20-20s-8.95-20-20-20zM637.34 457.66v260c0 12.01-10.72 21.63-23.06 19.77-9.84-1.48-16.94-10.25-16.94-20.2V458.09c0-9.95 7.1-18.72 16.94-20.2 12.34-1.86 23.06 7.76 23.06 19.77z m-210.68 0v260c0 11-9 20-20 20s-20-9-20-20v-260c0-11 9-20 20-20s20 9 20 20zM317 137.61c0-33.08 26.92-60 60-60h270c33.08 0 60 26.92 60 60v60H317v-60z"})})},Pt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M511.582491 63.413262C265.134543 63.413262 64.62588 263.921925 64.62588 510.369873s200.508663 446.957635 446.957635 446.957635 446.957635-200.508663 446.957635-446.957635S758.031463 63.413262 511.582491 63.413262zM509.001713 751.859903c-98.517781 0-182.467775-62.623269-214.771505-150.056598l0.327458-0.134053c-2.007727-4.036943-3.38305-8.422833-3.38305-13.237489 0-16.647145 13.494339-30.142507 30.142507-30.142507 13.389962 0 24.358781 8.877181 28.2893 20.955264l0.422625-0.172939c23.269983 65.442478 85.645612 112.503307 158.972665 112.503307 93.106538 0 168.845523-75.738985 168.845523-168.845523s-75.738985-168.845523-168.845523-168.845523c-20.432355 0-39.874149 3.980661-58.013275 10.66899l21.248953 40.742936c2.486634 2.677992 4.0175 6.2831 4.0175 10.243295 0 8.417717-8.404414 14.921851-15.365966 15.07023-0.102331 0-0.206708 0-0.309038 0-0.220011 0-0.427742 0-0.647753-0.013303l-150.579507-6.463202c-5.372358-0.234337-10.229992-3.310396-12.716626-8.093329-2.486634-4.76963-2.236947-10.509355 0.647753-15.055904l80.890308-127.179564c2.8847-4.533246 8.006348-7.151887 13.365402-6.960529 5.372358 0.234337 10.227945 3.312442 12.71458 8.095375l18.580171 35.625382c26.629497-10.855232 55.683207-16.963347 86.168522-16.963347 126.338407 0 229.130537 102.791108 229.130537 229.130537S635.340119 751.859903 509.001713 751.859903z"})})},Bt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M891.072 822.144V167.36a34.432 34.432 0 0 0-34.432-34.432H201.856C201.856 94.848 232.704 64 270.784 64h620.288C929.152 64 960 94.848 960 132.928v620.288c0 38.08-30.848 68.928-68.928 68.928z m-68.928-551.36v620.288c0 38.08-30.848 68.928-68.928 68.928H132.928A68.928 68.928 0 0 1 64 891.072V270.784c0-38.08 30.848-68.928 68.928-68.928h620.288c38.08 0 68.928 30.848 68.928 68.928z m-137.856 137.856H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z m0 206.72H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z"})})},Ht=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M547.4 197.4v46l200.3 0.1L546.1 444l32.4 32.6 201.9-200.7v200.9h46V197.5zM471.4 584.4l-32.6-32.6L243.6 747V547.9h-46v278.7h279v-46H275z"})})},jt=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M544 480V282.944h52.224l0.064 107.968L763.072 224l36.928 36.928-166.976 166.976 108.032-0.128V480H544zM260.928 800l-36.928-36.928 166.912-166.784-107.968-0.064V544H480v197.056h-52.224l0.064-107.968L260.928 800z"})})},Ft=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M960 544H64a32 32 0 1 1 0-64h896a32 32 0 1 1 0 64"})})},Ut=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[ae("path",{d:"M481.0752 263.3728l50.9952 1.024 1.8432-105.8816-50.9952-0.8192z"}),ae("path",{d:"M486.441426 180.895362a66.56 66.56 0 1 0 42.091944-126.290153 66.56 66.56 0 1 0-42.091944 126.290153Z"}),ae("path",{d:"M138.8544 664.3712c-52.8384 0-95.8464-43.008-95.8464-95.8464s43.008-95.8464 95.8464-95.8464M880.0256 472.6784c52.8384 0 95.8464 43.008 95.8464 95.8464s-43.008 95.8464-95.8464 95.8464"}),ae("path",{d:"M507.4944 220.5696c-220.16 0-398.7456 162.816-398.7456 363.7248s178.5856 363.7248 398.7456 363.7248 398.7456-162.816 398.7456-363.7248-178.5856-363.7248-398.7456-363.7248z m0 559.9232c-166.2976 0-301.2608-100.5568-301.2608-224.4608s134.9632-224.4608 301.2608-224.4608S808.7552 432.128 808.7552 556.032 673.792 780.4928 507.4944 780.4928z"}),ae("path",{d:"M319.6928 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"}),ae("path",{d:"M617.472 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"})]})},Wt=function(){return ae("svg",{viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ae("path",{d:"M5.856 17.121a.979.979 0 0 1-.327-.06.839.839 0 0 1-.283-.177.739.739 0 0 1-.187-.255.724.724 0 0 1-.07-.303l-.02-1.609a4.663 4.663 0 0 1-1.446-.455 4.252 4.252 0 0 1-.637-.401c-.199-.146-.385-.31-.553-.492a4.442 4.442 0 0 1-.45-.577 4.303 4.303 0 0 1-.327-.637 3.823 3.823 0 0 1-.206-.686 3.729 3.729 0 0 1-.064-.704V6.478c0-.261.025-.516.077-.771a4.43 4.43 0 0 1 .244-.747 4.062 4.062 0 0 1 .932-1.28c.2-.183.418-.347.65-.493.23-.145.482-.267.739-.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.167.061-.328.14-.482.237-.148.091-.29.2-.418.316a2.897 2.897 0 0 0-.347.388c-.097.14-.187.286-.257.444a2.473 2.473 0 0 0-.206.977v4.287c0 .17.013.333.051.503a2.549 2.549 0 0 0 .772 1.33 2.721 2.721 0 0 0 .913.559c.167.066.347.115.527.152.18.03.36.048.546.048a.904.904 0 0 1 .61.23.848.848 0 0 1 .194.262.84.84 0 0 1 .07.303l.007.99 1.915-1.293a2.877 2.877 0 0 1 1.64-.492h2.372c.186 0 .366-.018.54-.048.18-.03.353-.08.52-.146.168-.067.329-.146.483-.237.148-.091.29-.2.418-.316.128-.121.244-.249.347-.388a2.8 2.8 0 0 0 .257-.444 2.47 2.47 0 0 0 .206-.977V8.585a.646.646 0 0 1 .225-.492.679.679 0 0 1 .244-.152.814.814 0 0 1 .585 0c.09.03.174.085.244.152a.657.657 0 0 1 .225.492V10.8c0 .261-.032.516-.083.771a4.192 4.192 0 0 1-.245.74c-.109.244-.244.468-.398.687a3.735 3.735 0 0 1-.534.6c-.2.183-.418.347-.65.493a4.134 4.134 0 0 1-.738.364 4.7 4.7 0 0 1-.81.225c-.27.054-.553.079-.836.079h-1.877c-.604 0-1.144.164-1.633.491l-2.54 1.713a.913.913 0 0 1-.514.157z",fill:"currentColor"}),ae("path",{d:"M15.866 4.125h-4.174c-.41 0-.741.313-.741.7 0 .387.332.7.741.7h4.174c.41 0 .742-.313.742-.7 0-.387-.332-.7-.742-.7z",fill:"currentColor"}),ae("path",{d:"M14.537 2.932c0-.396-.34-.717-.759-.717s-.758.32-.758.717v3.786c0 .396.34.717.758.717.42 0 .76-.321.76-.717V2.932z",fill:"currentColor"})]})},Rt=function(){return ae("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:ae("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})})},Vt=function(){var e=1e3,t=140,n=250,i=.8;return ae("svg",{fill:"currentColor",viewBox:"0 0 ".concat(e," ").concat(e),xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:Array.from({length:4}).map(function(e,o){return ae("rect",{fill:"currentColor",rx:70,ry:70,height:n,width:t,x:o*(440/3+t),y:375,children:[ae("animate",{attributeName:"height",values:"".concat(n,"; ").concat(500,"; ").concat(n),keyTimes:"0; 0.5; 1",dur:"".concat(i,"s"),begin:"".concat(.2*o,"s"),repeatCount:"indefinite"}),ae("animate",{attributeName:"y",values:"".concat(375,"; ").concat(250,"; ").concat(375),keyTimes:"0; 0.5; 1",dur:"".concat(i,"s"),begin:"".concat(.2*o,"s"),repeatCount:"indefinite"})]},o)})})},qt=function(e){return ae("svg",{className:e.className,onClick:e.onClick,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M128 384a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m768 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m-372.4288 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z"})})},$t=function(e){return ae("svg",{className:e.className,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M498.33984 607.8464c-10.99776-32.9728-50.09408-73.5232-82.6368-85.74976L150.9376 422.8096c-38.54336-14.4384-36.98688-69.46816 2.27328-81.73568L844.92288 124.90752c33.30048-10.40384 64.57344 20.8896 54.1696 54.1696L682.92608 870.78912a43.2128 43.2128 0 0 1-81.36704 3.25632 121682.5344 121682.5344 0 0 1-103.2192-266.19904z"})})},Yt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M972.657609 209.348408C987.158609 209.36839 998.930114 197.571202 998.949999 182.99865 998.969882 168.426097 987.230618 156.59651 972.729617 156.576528L32.457975 155.280806C17.956974 155.260823 6.18547 167.058012 6.165585 181.630564 6.1457 196.203116 17.884965 208.032703 32.385966 208.052686L972.657609 209.348408ZM180.466902 992.356169 180.466902 1019.014859 206.993296 1018.74074 833.361858 1012.267947 859.348284 1011.999407 859.348284 985.883377 859.348284 289.397297C859.348284 274.824732 847.59289 263.011332 833.091874 263.011332 818.590859 263.011332 806.835465 274.824732 806.835465 289.397297L806.835465 985.883377 832.82189 959.498805 206.453329 965.971599 232.979723 992.356169 232.979723 282.67005C232.979723 268.097483 221.224329 256.284085 206.723313 256.284085 192.222298 256.284085 180.466902 268.097483 180.466902 282.67005L180.466902 992.356169ZM656.410257 847.079027C656.410257 861.651593 668.165651 873.464992 682.666667 873.464992 697.167682 873.464992 708.923076 861.651593 708.923076 847.079027L708.923076 372.131659C708.923076 357.559091 697.167682 345.745694 682.666667 345.745694 668.165651 345.745694 656.410257 357.559091 656.410257 372.131659L656.410257 847.079027ZM341.333333 847.079027C341.333333 861.651593 353.08873 873.464992 367.589743 873.464992 382.090758 873.464992 393.846155 861.651593 393.846155 847.079027L393.846155 372.131659C393.846155 357.559091 382.090758 345.745694 367.589743 345.745694 353.08873 345.745694 341.333333 357.559091 341.333333 372.131659L341.333333 847.079027ZM498.871795 847.079027C498.871795 861.651593 510.627189 873.464992 525.128205 873.464992 539.62922 873.464992 551.384614 861.651593 551.384614 847.079027L551.384614 372.131659C551.384614 357.559091 539.62922 345.745694 525.128205 345.745694 510.627189 345.745694 498.871795 357.559091 498.871795 372.131659L498.871795 847.079027ZM392.147755 116.721777C392.147755 102.063669 403.758665 90.363507 418.40134 90.363507L622.925796 90.363507C637.408947 90.363507 649.179381 102.1619 649.179381 116.549585L649.179381 171.644875 701.692203 171.644875 701.692203 116.549585C701.692203 72.986607 666.38105 37.591577 622.925796 37.591577L418.40134 37.591577C374.724427 37.591577 339.634933 72.950804 339.634933 116.721777L339.634933 165.310801 392.147755 165.310801 392.147755 116.721777Z"})})},Xt=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:ae("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 184l144 144 144-144"})})},Zt=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:"".concat(e.className," icon"),viewBox:"0 0 512 512",children:ae("path",{d:"M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm108.25 138.29l-134.4 160a16 16 0 01-12 5.71h-.27a16 16 0 01-11.89-5.3l-57.6-64a16 16 0 1123.78-21.4l45.29 50.32 122.59-145.91a16 16 0 0124.5 20.58z"})})},Jt=function(e){return ae("svg",{className:e.className,width:"16",height:"16",viewBox:"0 0 50 50",xmlns:"http://www.w3.org/2000/svg",children:ae("circle",{cx:"25",cy:"25",r:"20",stroke:"currentColor",strokeWidth:"5",fill:"none",strokeDasharray:"31.415, 31.415",strokeLinecap:"round",children:ae("animateTransform",{attributeName:"transform",type:"rotate",from:"0 25 25",to:"360 25 25",dur:"1s",repeatCount:"indefinite"})})})},Gt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M704 256v490.666667a170.666667 170.666667 0 0 1-170.666667 170.666666 170.666667 170.666667 0 0 1-170.666666-170.666666V213.333333A106.666667 106.666667 0 0 1 469.333333 106.666667 106.666667 106.666667 0 0 1 576 213.333333v448a42.666667 42.666667 0 0 1-42.666667 42.666667 42.666667 42.666667 0 0 1-42.666666-42.666667V256H426.666667v405.333333a106.666667 106.666667 0 0 0 106.666666 106.666667 106.666667 106.666667 0 0 0 106.666667-106.666667V213.333333a170.666667 170.666667 0 0 0-170.666667-170.666666 170.666667 170.666667 0 0 0-170.666666 170.666666v533.333334a234.666667 234.666667 0 0 0 234.666666 234.666666 234.666667 234.666667 0 0 0 234.666667-234.666666V256h-64z"})})},Kt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[ae("path",{d:"M842.666667 285.866667l-187.733334-187.733334c-14.933333-14.933333-32-21.333333-53.333333-21.333333H234.666667C194.133333 74.666667 160 108.8 160 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h554.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666V337.066667c0-19.2-8.533333-38.4-21.333333-51.2z m-44.8 44.8c-2.133333 2.133333-4.266667 0-8.533334 0h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667V149.333333c0-2.133333 0-6.4-2.133333-8.533333 0 0 2.133333 0 2.133333 2.133333l189.866667 187.733334z m-8.533334 554.666666H234.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h311.466666c-2.133333 4.266667-2.133333 6.4-2.133333 10.666666v170.666667c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c4.266667 0 6.4 0 10.666667-2.133334V874.666667c0 6.4-4.266667 10.666667-10.666667 10.666666z",fill:"currentColor"}),ae("path",{d:"M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z",fill:"currentColor"})]})},Qt=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M557.248 511.68l135.776-135.744-45.248-45.28L512 466.432l-135.776-135.776-45.248 45.28 135.776 135.744-135.776 135.776 45.248 45.248L512 556.928l135.776 135.776 45.248-45.248-135.776-135.776zM512 64c247.136 0 448 200.864 448 448s-200.864 448-448 448S64 759.136 64 512 264.864 64 512 64z",fill:"currentColor"})})},en=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M512.43945313 904.51953125c-6.06445313 0-12.12890625-1.58203125-17.57812501-4.74609375L136.70703125 689.71484375c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867188-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l76.37695313-44.91210938L136.97070312 540.125c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867187-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l73.38867187-43.15429688-73.125-42.890625C126.51171875 387.81054687 120.0078125 376.38476562 120.0078125 364.08007812c0-12.3046875 6.50390625-23.73046875 17.13867188-29.97070312L495.828125 122.99609375c10.8984375-6.41601563 24.34570313-6.41601563 35.24414063 0l358.15429687 210.05859375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-73.38867188 43.15429688 73.12500001 42.890625c10.63476563 6.24023438 17.13867188 17.66601563 17.13867187 29.97070312s-6.50390625 23.73046875-17.13867187 29.97070313L812.5859375 583.89453125l76.11328125 44.6484375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-358.59375 211.2890625c-5.44921875 3.1640625-11.6015625 4.74609375-17.66601563 4.74609375zM223.015625 659.65625l289.42382813 169.8046875 290.12695312-170.77148438-58.44726563-34.27734374L530.28125 750.18359375a34.67285156 34.67285156 0 0 1-35.24414063 0L281.7265625 625.02734375 223.015625 659.65625z m76.90429688-104.58984375l212.69531249 124.8046875 290.12695313-170.77148438-55.546875-32.60742187-216.65039063 127.6171875a34.67285156 34.67285156 0 0 1-35.24414062 0L279.00195312 477.28320312l-55.81054687 32.78320313 75.49804688 44.296875c0.43945313 0.26367188 0.79101563 0.52734375 1.23046874 0.703125z m-2.81250001-147.83203125l215.68359376 126.5625 216.12304687-127.17773438c0.3515625-0.26367188 0.703125-0.43945313 1.0546875-0.61523437l72.86132813-42.890625-289.33593751-169.8046875-290.12695312 170.68359375 72.59765625 42.62695313c0.43945313 0.17578125 0.79101563 0.43945313 1.14257813 0.61523437z"})})},tn=function(e){return ae("svg",{className:e.className,id:"stop",viewBox:"0 0 1025 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[ae("path",{d:"M512.268258 1022.835842c-68.658678 0-135.399619-13.564433-198.369591-40.316509-60.752236-25.809077-115.373446-62.712976-162.346233-109.685763-46.971763-46.971763-83.875662-101.592974-109.685763-162.346233C15.115619 647.517366 1.551186 580.777449 1.551186 512.118771S15.115619 376.719151 41.866671 313.74918c25.810101-60.752236 62.714-115.373446 109.685763-162.346233 46.972787-46.971763 101.593997-83.875662 162.346233-109.685763 62.969971-26.751052 129.710912-40.315485 198.369591-40.315485s135.398595 13.564433 198.368567 40.315485c60.752236 25.810101 115.373446 62.714 162.346233 109.685763 46.971763 46.972787 83.875662 101.593997 109.685763 162.346233 26.752076 62.969971 40.316509 129.710912 40.316509 198.369591s-13.564433 135.398595-40.316509 198.368567c-25.809077 60.75326-62.712976 115.37447-109.685763 162.346233-46.971763 46.972787-101.592974 83.876686-162.346233 109.685763C647.666853 1009.27141 580.925912 1022.835842 512.268258 1022.835842zM512.268258 50.548195c-62.018782 0-122.293887 12.247716-179.152287 36.403219-54.923257 23.333323-104.317532 56.709936-146.810821 99.204249s-75.870926 91.888588-99.204249 146.810821c-24.155503 56.8584-36.403219 117.133505-36.403219 179.152287 0 62.017758 12.247716 122.292863 36.403219 179.152287 23.333323 54.923257 56.709936 104.317532 99.204249 146.811845 42.493289 42.493289 91.888588 75.870926 146.810821 99.204249 56.8584 24.155503 117.133505 36.403219 179.152287 36.403219 62.017758 0 122.292863-12.247716 179.152287-36.403219 54.923257-23.333323 104.317532-56.71096 146.811845-99.204249 42.493289-42.494313 75.870926-91.888588 99.204249-146.811845 24.155503-56.8584 36.403219-117.133505 36.403219-179.152287s-12.247716-122.293887-36.403219-179.152287c-23.334347-54.923257-56.71096-104.317532-99.205273-146.810821-42.493289-42.493289-91.887565-75.870926-146.810821-99.204249C634.561121 62.795911 574.286016 50.548195 512.268258 50.548195z",fill:"currentColor"}),ae("path",{d:"M655.434047 694.244421 367.12637 694.244421c-21.046987 0-38.170445-17.123458-38.170445-38.170445L328.955925 367.766298c0-21.046987 17.123458-38.170445 38.170445-38.170445l288.307678 0c21.048011 0 38.170445 17.123458 38.170445 38.170445l0 288.307678C693.604492 677.120962 676.482058 694.244421 655.434047 694.244421zM380.150191 643.050154l262.260035 0L642.410226 380.79012 380.150191 380.79012 380.150191 643.050154z",fill:"currentColor"})]})},nn=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:ae("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})})},on=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[ae("path",{d:"M394.688 126.208a32 32 0 0 1 32-32h170.688a32 32 0 0 1 32 32v138.624h288a32 32 0 0 1 32 32v170.688a32 32 0 0 1-32 32H106.688a32 32 0 0 1-32-32V296.832a32 32 0 0 1 32-32h288V126.208z m64 32v138.624a32 32 0 0 1-32 32h-288v106.688h746.688V328.832h-288a32 32 0 0 1-32-32V158.208H458.688z"}),ae("path",{d:"M138.688 469.376a32 32 0 0 1 32-32h682.688a32 32 0 0 1 32 32v384a32 32 0 0 1-32 32H170.688a32 32 0 0 1-32-32v-384z m64 32v320h618.688v-320H202.688z"}),ae("path",{d:"M341.376 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32zM512 691.2a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0v-128a32 32 0 0 1 32-32zM682.688 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32z"})]})},rn=function(){return ae("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:ae("path",{d:"M843.251 424.407l43.828-74.898c10.194-17.946 32.596-22.158 48.956-11.598 16.298 10.499 23.44 32.658 14.223 49.566l-113.11 195.212-61.164-40.044-126.418-82.285c-16.115-11.598-20.632-34.428-10.194-51.702 9.705-17.397 31.009-23.501 47.857-13.734l89.67 59.028C748.576 295.547 615.81 180.667 461.008 180.667c-177.387 0-320.042 148.758-320.042 331.335 0 183.613 143.692 331.334 319.981 331.334 107.861 0.184 208.58-56.158 268.034-149.858 1.099-1.038 1.099-2.075 2.075-2.075 6.348-9.949 17.092-15.871 28.568-15.81 19.35 0 35.648 16.848 35.648 36.93 0 7.508-2.137 14.833-6.104 21.059-72.823 114.698-196.066 183.675-328.099 183.614-216.088 0-391.4-181.478-391.4-405.195 0-223.718 175.312-405.195 391.339-405.195 183.125-0.427 342.016 131.606 382.243 317.601z"})})},an=function(){return ae("svg",{version:"1.1",className:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M627.498667 55.168l170.666666 170.666667a42.624 42.624 0 0 1 0 60.330666l-469.333333 469.333334A42.538667 42.538667 0 0 1 298.666667 768H128a42.666667 42.666667 0 0 1-42.666667-42.666667v-170.666666c0-11.306667 4.48-22.186667 12.501334-30.165334l469.333333-469.333333a42.624 42.624 0 0 1 60.330667 0zM896 896a42.666667 42.666667 0 0 1 0 85.333333H128a42.666667 42.666667 0 0 1 0-85.333333h768zM597.333333 145.664l-426.666666 426.666667V682.666667h110.336l426.666666-426.666667L597.333333 145.664z"})})},cn=function(e){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:ae("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M184 112l144 144-144 144"})})},sn=function(){return ae("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:ae("path",{d:"M896 870.4l-128-128c55.467-68.267 89.6-149.333 89.6-238.933 0-98.134-38.4-192-110.933-264.534-149.334-149.333-384-149.333-533.334-4.266-145.066 145.066-145.066 384 0 529.066 72.534 72.534 166.4 110.934 264.534 110.934 89.6 0 174.933-29.867 238.933-89.6l128 128c4.267 4.266 12.8 8.533 21.333 8.533s17.067-4.267 21.334-8.533c17.066-8.534 17.066-29.867 8.533-42.667zM260.267 721.067c-119.467-123.734-119.467-320 0-439.467 59.733-59.733 140.8-89.6 217.6-89.6 81.066 0 157.866 29.867 217.6 89.6 59.733 59.733 89.6 136.533 89.6 217.6 0 81.067-34.134 162.133-89.6 217.6-55.467 59.733-132.267 93.867-217.6 93.867-81.067 0-157.867-34.134-217.6-89.6z"})})},ln=function(e){var t=e.items,n=Mt([]),i=new se("chat-thought-chain"),o=Mt([]);qe(function(){o.value=t.filter(function(e){return e.description}),o.value.length>0&&o.value.forEach(function(e,t){e.done&&(n.value=[].concat(r(n.value),[t]))})},[t]);return 0===o.value.length?null:ae("div",{className:"".concat(i.b()," ").concat(i.is("single",1===o.value.length)),children:o.value.map(function(e,t){if(e.description){var o=n.value.includes(t);return ae("div",{className:"".concat(i.e("item")," ").concat(i.is("collapsed",o)),children:[ae("div",{className:i.e("item-icon"),children:e.icon||ae("span",{children:t})}),ae("div",{className:i.e("item-content"),children:[ae("div",{className:i.e("item-title"),onClick:function(){return function(e){n.value.includes(e)?n.value=n.value.filter(function(t){return t!==e}):n.value=[].concat(r(n.value),[e])}(t)},children:[e.title,ae(Xt,{className:i.e("icon")})]}),ae("div",{className:i.e("item-description"),children:e.description})]})]},t)}})})},un=function(e){var t=e.items,n=e.onItemClick,i=new se("chat-suggestions");return ae("div",{className:"".concat(i.b()),children:t.map(function(e,t){return ae("div",{className:"".concat(i.e("item")," ").concat(i.is("action","action"===e.type)),onClick:function(t){return function(e,t){null==n||n(e,t)}(e,t)},title:e.metadata.content_name,children:[e.metadata.content_name,ae(cn,{className:"".concat(i.e("item-icon"))})]},t)})})},dn=function(e){var t,n=new se("chat-tool-call-item"),i=Mt(!1),o=Mt(!1),a=fe();qe(function(){return function(){t&&clearTimeout(t)}},[]);var c=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=document.getElementById(e);o&&(o.innerHTML="",i.value&&s(t,n).forEach(function(e,t){var n=document.createElement("div");n.className="code-line";var i=document.createElement("span");i&&(i.className="line-number",i.textContent=(t+1).toString(),n.appendChild(i),n.innerHTML+=e,o.appendChild(n))}))},s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=" ".repeat(t),i=[];if(Array.isArray(e)){if(0===e.length)return["".concat(n,'<span class="array">[]</span>')];i.push("".concat(n,'<span class="array">[</span>')),e.forEach(function(n,o){var a=s(n,t+1),c=o<e.length-1?",":"";"object"===w(n)&&null!==n?(i.push.apply(i,r(a.slice(0,-1))),i.push("".concat(a[a.length-1]).concat(c))):i.push("".concat(a[0]).concat(c))}),i.push("".concat(n,'<span class="array">]</span>'))}else if("object"===w(e)&&null!==e){var o=Object.keys(e);if(0===o.length)return["".concat(n,'<span class="property">{}</span>')];i.push("".concat(n,'<span class="property">{</span>')),o.forEach(function(a,c){var u=e[a],d=c<o.length-1?",":"",h='<span class="json-key">"'.concat(a,'":</span>');if("object"===w(u)&&null!==u){var f=s(u,t+1);i.push("".concat(n," ").concat(h," ").concat(f[0].trim())),f.length>1&&(i.push.apply(i,r(f.slice(1,-1))),i.push("".concat(f[f.length-1]).concat(d)))}else{var p=l(u);i.push("".concat(n," ").concat(h," ").concat(p).concat(d))}}),i.push("".concat(n,'<span class="property">}</span>'))}else i.push("".concat(n).concat(l(e)));return i},l=function(e){return"string"==typeof e?e.includes("Failed")||e.includes("Error")||e.includes("ERR_")?'<span class="error">"'.concat(e,'"</span>'):'<span class="string">"'.concat(e,'"</span>'):"number"==typeof e?'<span class="number">'.concat(e,"</span>"):"boolean"==typeof e?'<span class="boolean">'.concat(e,"</span>"):null===e?'<span class="null">null</span>':""};return ae("div",{className:"".concat(n.b()),children:[ae("div",{className:n.e("header"),onClick:function(){return i.value=!i.value,void c("code-block-".concat(a),e.item)},children:[ae("div",{className:n.e("header-left"),children:[ae("div",{className:n.em("header-left","caption"),children:e.item.name}),ae("div",{className:n.em("header-left","desc"),children:e.item.parameters.desc})]}),ae("div",{className:n.e("header-right"),children:[e.item.error&&ae("span",{style:"color: red;",children:"发生错误"}),e.item.error&&ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"red",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",children:[ae("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),ae("path",{d:"M12 9v4"}),ae("path",{d:"M12 17h.01"})]}),ae("span",{className:n.e("copy"),title:"复制",children:o.value?ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgb(0, 185, 107)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-check","aria-hidden":"true",style:"margin-left: 6px;",onClick:function(e){return e.stopPropagation()},children:ae("path",{d:"M20 6 9 17l-5-5"})}):ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",onClick:function(n){return function(n){n.stopPropagation(),t&&clearTimeout(t),o.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),t=setTimeout(function(){o.value=!1},2e3)}(n)},children:[ae("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),ae("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}),ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{"margin-left":" 6px",transform:i.value?"rotate(90deg)":"rotate(0deg)"},children:ae("path",{d:"m9 18 6-6-6-6"})})]})]}),ae("div",{className:n.e("content"),id:"code-block-".concat(a)})]})},hn=function(e){var t=e.items,n=new se("chat-tool-call"),i=Mt([]),o=Mt(!1),r=Mt(!1);qe(function(){i.value=t.filter(function(e){return e}),r.value=t.length>4},[t]);var a=Ot(function(){return r.value&&!o.value?i.value.slice(0,4):i.value});return ae("div",{className:"".concat(n.b()),children:[a.value.map(function(e,t){return ae(dn,{item:e},t)}),r.value&&ae("div",{className:n.e("toggle"),onClick:function(){o.value=!o.value},children:o.value?"收起工具调用":"展开全部 ".concat(i.value.length," 个工具调用")})]})},fn=new se("markdown-message"),pn=function(e){var t=e.message,n=e.size,i=Mt(fe()),o=Mt(null),r=Ye(function(){return 20===t.state&&!0!==t.completed},[t.state,t.completed]),a=Ye(function(){return 20===t.state&&!0===t.completed},[t.state,t.completed]),c=Mt({title:"",description:"",icon:ae(Jt,{})}),l=Mt({hasSuggestions:!1,suggestions:[]}),u=function(e){e&&e.length>0?l.value={hasSuggestions:!0,suggestions:e}:l.value={hasSuggestions:!1,suggestions:[]}},d=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),i="",o="",r=!1;return-1===n?(r=!1,i=e.slice(t+7),o=""):(r=!0,i=e.slice(t+7,n),o=e.slice(n+8)),{isThoughtCompleted:r,thoughtContent:i,answerContent:o}};return qe(function(){if(n>=0&&o.value){if(-1!==t.content.indexOf("<think>")){var e=d(t.content),i=e.isThoughtCompleted,r=e.thoughtContent,a=e.answerContent;i?(c.value.icon=ae(Zt,{}),c.value.title="思考完成"):!0===t.completed?(c.value.icon=ae(Zt,{}),c.value.title="思考已停止"):(c.value.icon=ae(Jt,{}),c.value.title="思考中..."),c.value.description=r||"",o.value.setMarkdown(a||"")}else if(-1!==t.content.indexOf("<tool_call>")){var s=t.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim();o.value.setMarkdown(s||"")}else o.value.setMarkdown(t.content||"");u(t.suggestions)}},[t,n]),qe(function(){var e="";if(-1!==t.content.indexOf("<think>")){var n=d(t.content),r=n.isThoughtCompleted,a=n.thoughtContent,l=n.answerContent;c.value={title:r?"思考完成":!0===t.completed?"思考已停止":"思考中...",description:a||"",icon:r||!0===t.completed?ae(Zt,{}):ae(Jt,{})},l&&(e=l)}else e=-1!==t.content.indexOf("<tool_call>")?t.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim():t.content;u(t.suggestions),o.value=new s({id:i,value:e||"",editor:{defaultModel:"previewOnly"},themeSettings:{mainTheme:"dark",codeBlockTheme:"dark"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}})},[]),ae("div",{className:"".concat(fn.b()," ").concat(fn.is("loading",r)),children:[ae("div",{className:fn.b("header"),children:[ae("div",{className:fn.be("header","caption"),children:"AI "}),e.children,a?ae("div",{className:fn.be("header","timeout"),children:"请求超时"}):null]}),ae("div",{className:"".concat(fn.b("content")," pre-wrap-container"),children:[ae(ln,{items:[c.value]}),t.toolcalls&&t.toolcalls.length>0?ae(hn,{items:t.toolcalls||[]}):null,ae("div",{id:i})]}),ae("div",{className:fn.b("footer"),children:l.value.hasSuggestions?ae(un,{items:l.value.suggestions,onItemClick:function(t,n){!function(t,n){e.controller.handleSuggestionClick(e.message,t,n)}(t,n)}}):null})]})},vn=new se("ossfile-material"),mn=function(e){var t=Ot(function(){return e.material.data.name}),n=Ot(function(){return e.material.metadata.size}),i=Ot(function(){var t=e.material.metadata.state;return"successed"===t?"上传成功":"uploading"===t?"上传中":"failed"===t?"上传失败":"未知状态"}),o=Ot(function(){switch(e.material.metadata.state){case"successed":return"#1890ff";case"uploading":return"#52c41a";default:return"#ff4d4f"}});return ae("div",{className:vn.b(),children:[ae("div",{className:vn.b("left"),children:ae(Kt,{})}),ae("div",{className:vn.b("right"),children:[ae("div",{className:vn.e("name"),title:t,children:t}),ae("div",{className:vn.e("metadata"),children:[ae("div",{children:[n,"B"]}),ae("div",{style:{color:o.value},children:i})]})]})]})},_n=new se("common-material"),gn=function(e){var t,n,i,o,r=null===(t=e.controller.opts.questionToolbarItems)||void 0===t?void 0:t.find(function(t){return t.id===e.material.metadata.actionId}),a=Ot(function(){return e.material.metadata.name});return ae("div",{className:_n.b(),children:[ae("div",{className:_n.b("left"),children:r&&r.icon?"function"==typeof r.icon?r.icon():(null===(n=r.icon)||void 0===n?void 0:n.showIcon)&&ae(B,{children:null!==(i=r.icon)&&void 0!==i&&i.cssClass?ae("i",{className:r.icon.cssClass}):null!==(o=r.icon)&&void 0!==o&&o.imagePath?ve(r.icon.imagePath)?ae("div",{dangerouslySetInnerHTML:{__html:r.icon.imagePath}}):ae("img",{src:r.icon.imagePath}):null}):ae(en,{})}),ae("div",{className:_n.b("right"),children:[ae("div",{className:_n.e("name"),title:a,children:a}),ae("div",{className:_n.e("metadata"),children:ae("div",{children:(null==r?void 0:r.label)||"素材资源"})})]})]})},yn=new se("chat-input-material-item"),wn=function(e){var t=e.material,n=null;if("ossfile"===t.type)n=mn;else n=gn;return ae("div",{className:"".concat(yn.b()," ").concat(yn.is("disabled",e.disabled)),children:[ae("div",{className:yn.e("icon"),onClick:function(){e.controller.deleteMaterial(t)},children:ae(Qt,{})}),z(n,{material:t,controller:e.controller})]})},bn=new se("user-message-question"),kn=function(e){var t=Mt(fe()),n=Mt(null),i=Ot(function(){return e.message.content}),o=Ot(function(){return ye.parseMixedContent(i.value)});return qe(function(){n.value=new s({id:t,value:o.value.remainingText||"",editor:{defaultModel:"previewOnly"},themeSettings:{mainTheme:"dark",codeBlockTheme:"dark"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}})},[o.value.remainingText]),ae("div",{className:bn.b(),children:[ae("div",{className:bn.e("user-header"),children:[e.children,ae("div",{className:bn.e("user"),children:"我"})]}),ae("div",{className:bn.e("content"),children:ae("div",{className:bn.em("content","body"),children:[o.value.hasResources&&ae("div",{className:bn.em("content","material"),children:o.value.resources.map(function(t){return ae(wn,{material:t,disabled:!0,controller:e.controller},t.id)})}),ae("div",{className:"pre-wrap-container",children:ae("div",{id:t})})]})})]})},Cn=new se("error-message"),xn=function(e){var t=Ot(function(){return e.message.content});return ae("div",{className:Cn.b(),children:[ae("div",{className:Cn.b("header"),children:[ae("div",{className:Cn.be("header","caption"),children:"AI "}),e.children]}),ae("div",{className:"".concat(Cn.e("content")," pre-wrap-container"),children:ae("span",{children:t})})]})},Tn=new se("unknown-message"),Nn=function(e){return ae("div",{className:Tn.b(),children:ae("div",{className:"".concat(Tn.e("content")," pre-wrap-container"),children:["暂未支持的消息类型: ",e.message.type]})})},Sn=new se("chat-message-item"),En=function(e){var t=e.message,n=e.size,i=null;switch(t.type){case"DEFAULT":i="ASSISTANT"===t.role?pn:kn;break;case"ERROR":i=xn;break;default:i=Nn}return ae("div",{className:Sn.b(),children:z(i,{size:n,message:t,controller:e.controller,children:e.children})})},An=function(){return _(function e(t){v(this,e),g(this,"toolcalls",[]),g(this,"allcontent",""),this.msg=t,this.toolcalls=t.toolcalls||[],this.allcontent=t.content},[{key:"messageid",get:function(){return this.msg.messageid}},{key:"state",get:function(){return this.msg.state}},{key:"role",get:function(){return this.msg.role}},{key:"type",get:function(){return this.msg.type}},{key:"realcontent",get:function(){var e=this.msg.content;if(-1!==e.indexOf("<think>")&&-1===e.indexOf("</think>"))return"";if(-1!==(e=e.replace(/<think>[^]*?<\/think>/g,"").trim()).indexOf("<tool_call>")&&-1===e.indexOf("</tool_call>"))return"";if(-1!==(e=e.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim()).indexOf("<resources>")&&-1===e.indexOf("</resources>"))return"";var t=(e=e.replace(/<resources>[^]*?<\/resources>/g,"").trim()).indexOf("<suggestions>");return-1!==t&&(e=e.substring(0,t).trim()),e}},{key:"content",get:function(){return this.msg.content}},{key:"completed",get:function(){return this.msg.completed}},{key:"suggestions",get:function(){return this.msg.suggestions}},{key:"_origin",get:function(){return this.msg}},{key:"update",value:function(e){e.content||(e.content=""),this.allcontent+=e.content,-1!==e.content.indexOf("<think>")&&this.msg.content&&(this.msg.content=""),this.msg.content+=e.content,this.computeToolCalls()}},{key:"replace",value:function(e){this.msg=e}},{key:"updateCompleted",value:function(e){this.msg.completed=e}},{key:"computeToolCalls",value:function(){this.toolcalls=Le.parse(this.allcontent)}}])}(),Mn=function(){return _(function e(t){v(this,e),this.data=t},[{key:"appid",get:function(){return this.data.appid}},{key:"id",get:function(){return this.data.id}},{key:"type",get:function(){return this.data.type}},{key:"caption",get:function(){return this.data.caption}},{key:"sourceCaption",get:function(){return this.data.sourceCaption||this.caption}},{key:"url",get:function(){return this.data.url}},{key:"aiChat",get:function(){return this.data.aiChat}}])}(),On=function(){return _(function e(t){v(this,e),this.material=t},[{key:"id",get:function(){return this.material.id}},{key:"type",get:function(){return this.material.type}},{key:"metadata",get:function(){return this.material.metadata}},{key:"data",get:function(){return this.material.data}}])}(),In=new se("chat-toolbar-item"),Ln=function(e){var t,n,i,o=e.model,r=e.data,c=e.className,s=e.disabled,l=void 0!==s&&s,u=e.buttonType,d=void 0===u?"default":u,h=e.onClick,f=a(Ve(!1),2),p=f[0],v=f[1],m=$e(null),_=function(e){return"function"==typeof e.hidden?e.hidden(r):!0===e.hidden};if(_(o))return ae(B,{});var g=function(e){return!!l||("function"==typeof e.disabled?e.disabled(r):!0===e.disabled)},y=function(e){var t,n,i,o;return"function"==typeof e.icon?e.icon():null!==(t=e.icon)&&void 0!==t&&t.showIcon&&null!==(n=e.icon)&&void 0!==n&&n.cssClass?ae("i",{className:e.icon.cssClass}):null!==(i=e.icon)&&void 0!==i&&i.showIcon&&null!==(o=e.icon)&&void 0!==o&&o.imagePath?ve(e.icon.imagePath)?ae("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):ae("img",{src:e.icon.imagePath}):void 0},w=function(e,t){g(t)||(v(!1),h(e,t))};return qe(function(){var e=function(e){m.current&&m.current.contains(e.target)||v(!1)};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[p]),ae("div",{className:"".concat(In.b()," ").concat(In.b(d)," ").concat(o.customClass||""," ").concat(c||""," ").concat(In.is("disabled",g(o))," ").concat(In.is("more",!(null===(t=o.children)||void 0===t||!t.length))),children:[ae("div",{title:o.title,className:In.e("content"),onClick:function(e){return w(e,o)},children:[ae("div",{className:In.em("content","icon"),children:y(o)}),ae("div",{className:In.em("content","label"),children:o.label})]}),(null===(n=o.children)||void 0===n?void 0:n.length)&&ae("div",{title:"更多",className:In.e("more"),onClick:function(e){g(o)||v(!0)},children:ae("i",{"aria-hidden":"true",className:"fa fa-angle-down ".concat(In.em("more","icon"))})}),p&&ae("div",{ref:m,className:In.b("dropdown"),children:null===(i=o.children)||void 0===i?void 0:i.map(function(e,t){if(!_(e))return ae("div",{title:e.title,onClick:function(t){return w(t,e)},className:"".concat(In.be("dropdown","item")," ").concat(e.customClass||""," ").concat(In.is("disabled",g(e))),children:[ae("div",{className:In.bem("dropdown","item","icon"),children:y(e)}),ae("div",{className:In.bem("dropdown","item","label"),children:e.label})]},t)})})]})},Dn=new se("chat-toolbar"),zn=function(e){var t=e.controller,n=e.items,i=void 0===n?[]:n,o=e.data,a=e.type,c=e.className,s=e.mode,l=Ze(Fi),d=[],h=[{label:"重置对话",title:"重置对话",icon:function(){return ae(rn,{})},onClick:function(){t.resetTopic()},children:[{label:"清空对话",title:"清空对话",icon:function(){return ae(on,{})},onClick:function(){t.clearTopic()}},{label:"新建对话",title:"新建对话",hidden:"TOPIC"!==s,icon:function(){return ae(Wt,{})},onClick:function(){l.newTopic&&l.newTopic()}}]}],f=[{label:"刷新",title:"刷新",icon:function(){return ae(Pt,{})},onClick:function(){t.refreshMessage(o)}},{label:"删除",title:"删除",icon:function(){return ae(zt,{})},onClick:function(){t.deleteMessage(o)}},{label:"复制",title:"复制",icon:function(){return ae(Bt,{})},onClick:function(){t.copyMessage(o)}}];l.enableBackFill&&f.unshift.apply(f,[{label:"回填",title:"回填",icon:function(){return ae(Lt,{})},onClick:function(){t.backfill(o)}}]);var p=[{label:"刷新",title:"刷新",icon:function(){return ae(Pt,{})},onClick:function(){t.refreshMessage(o,!0)}}];if("content"===a)switch(o.type){case"DEFAULT":d="ASSISTANT"===o.role?[].concat(f,r(i)):[].concat(p);break;case"ERROR":d=[].concat(f,r(i))}else d=[].concat(h,r(i));var v=function(n,i){var r=u({},o);if(o instanceof An?(Object.assign(r,{topic:t.topic}),r.msg.realcontent=o.realcontent):(r.data||(r.data={}),Object.assign(r.data,{messages:t.messages.value})),i.onClick&&"function"==typeof i.onClick)i.onClick(n,i,t.context,t.params,r);else{var a=e.controller.opts.extendToolbarClick;a&&"function"==typeof a&&a(n,i,t.context,t.params,r)}},m=Ye(function(){return"content"===a&&20===(null==o?void 0:o.state)&&!0!==(null==o?void 0:o.completed)},[null==o?void 0:o.state,null==o?void 0:o.completed]);return ae("div",{className:"".concat(Dn.b()," ").concat(c||""),children:d.map(function(e,t){return ae(Ln,{data:o,model:e,disabled:m,buttonType:"content"===a?"circle":"default",onClick:v.bind(void 0)},t)})})};var Pn=function(e){var t=Mt(!1),n=Mt({}),i=new se("chat-back-bottom"),o=Mt(null),r=function(){if(o.value){var n=e.visibilityHeight||200,i=o.value.scrollHeight-o.value.scrollTop-o.value.offsetHeight;t.value=i>=n}},a=function(e,t){var n=null;return function(){for(var i=this,o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];n||(n=setTimeout(function(){e.apply(i,r),n=null},t))}}(r,300);return Ye(function(){n.value={right:"".concat(e.right,"px"),bottom:"".concat(e.bottom,"px")}},[e.right,e.bottom]),qe(function(){if(e.target){var t,n=null!==(t=document.querySelector(e.target))&&void 0!==t?t:void 0;n&&(o.value=n,n.addEventListener("scroll",a),r())}},[]),ae("div",{className:"".concat(i.b()," ").concat(i.is("visible",t.value)),style:n.value,onClick:function(){var t;o.value&&(o.value.scrollTo({top:o.value.scrollHeight,behavior:"smooth"}),null===(t=e.onClick)||void 0===t||t.call(e))},children:ae(nn,{className:i.e("icon")})})},Bn=new se("chat-messages"),Hn=function(e){var t=$e(null),n=a(Ve(!0),2),i=n[0],o=n[1],r=$e(!1),c=e.controller.messages;qe(function(){var e;i&&((e=t.current)&&(r.current=!0,e.scrollTo({top:e.scrollHeight,behavior:"auto"}),setTimeout(function(){r.current=!1},500)))},[c.value]);return ae("div",{ref:t,className:Bn.b(),onScroll:function(){if(!r.current&&t.current){var e=t.current,n=e.scrollTop,i=e.scrollHeight,a=e.clientHeight;o(i-(n+a)<50)}},children:[c.value.map(function(t){var n,i=(null===(n=t.content)||void 0===n?void 0:n.length)||0;return"SYSTEM"!==t.role?ae(En,{size:i,message:t,controller:e.controller,children:ae(zn,{type:"content",mode:"DEFAULT",data:t,items:e.toolbarItems,controller:e.controller})},t.messageid):null}),ae(Pn,{right:20,bottom:14,target:".".concat(Bn.b()),onClick:function(){r.current=!0,o(!0)}})]})};function jn(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function Fn(e,t){this.props=e,this.context=t}(Fn.prototype=new H).isPureReactComponent=!0,Fn.prototype.shouldComponentUpdate=function(e,t){return jn(this.props,e)||jn(this.state,t)};var Un=h.__b;h.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Un&&Un(e)};var Wn=h.__e;h.__e=function(e,t,n,i){if(e.then)for(var o,r=t;r=r.__;)if((o=r.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);Wn(e,t,n,i)};var Rn=h.unmount;function Vn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var n in t)e[n]=t[n];return e}({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Vn(e,t,n)})),e}function qn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return qn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function $n(){this.__u=0,this.o=null,this.__b=null}function Yn(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Xn(){this.i=null,this.l=null}h.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Rn&&Rn(e)},($n.prototype=new H).__c=function(e,t){var n=t.__c,i=this;null==i.o&&(i.o=[]),i.o.push(n);var o=Yn(i.__v),r=!1,a=function(){r||(r=!0,n.__R=null,o?o(c):c())};n.__R=a;var c=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=qn(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.o.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(a,a)},$n.prototype.componentWillUnmount=function(){this.o=[]},$n.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=Vn(this.__b,n,i.__O=i.__P)}this.__b=null}var o=t.__a&&z(B,null,e.fallback);return o&&(o.__u&=-33),[z(B,null,t.__a?null:e.children),o]};var Zn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Jn(e){return this.getChildContext=function(){return e.context},e.children}function Gn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){oe(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var i=t.__v;null!==i&&!i.__m&&null!==i.__;)i=i.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:i.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}oe(z(Jn,{context:t.context},e.__v),t.v)}function Kn(e,t){var n=z(Gn,{__v:e,h:t});return n.containerInfo=t,n}(Xn.prototype=new H).__a=function(e){var t=this,n=Yn(t.__v),i=t.l.get(e);return i[0]++,function(o){var r=function(){t.props.revealOrder?(i.push(o),Zn(t,e,i)):o()};n?n(r):r()}},Xn.prototype.render=function(e){this.i=null,this.l=new Map;var t=q(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Xn.prototype.componentDidUpdate=Xn.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Zn(e,n,t)})};var Qn="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ei=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ti=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ni=/[A-Z0-9]/g,ii="undefined"!=typeof document,oi=function(e){return("undefined"!=typeof Symbol&&"symbol"==w(Symbol())?/fil|che|rad/:/fil|che|ra/).test(e)};H.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(H.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ri=h.event;function ai(){}function ci(){return this.cancelBubble}function si(){return this.defaultPrevented}h.event=function(e){return ri&&(e=ri(e)),e.persist=ai,e.isPropagationStopped=ci,e.isDefaultPrevented=si,e.nativeEvent=e};var li={enumerable:!1,configurable:!0,get:function(){return this.class}},ui=h.vnode;h.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={},o=-1===n.indexOf("-");for(var r in t){var a=t[r];if(!("value"===r&&"defaultValue"in t&&null==a||ii&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var c=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===a?a="":"translate"===c&&"no"===a?a=!1:"o"===c[0]&&"n"===c[1]?"ondoubleclick"===c?r="ondblclick":"onchange"!==c||"input"!==n&&"textarea"!==n||oi(t.type)?"onfocus"===c?r="onfocusin":"onblur"===c?r="onfocusout":ti.test(r)&&(r=c):c=r="oninput":o&&ei.test(r)?r=r.replace(ni,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===c&&i[r=c]&&(r="oninputCapture"),i[r]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=q(t.children).forEach(function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)})),"select"==n&&null!=i.defaultValue&&(i.value=q(t.children).forEach(function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value})),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",li)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=Qn,ui&&ui(e)};var di=h.__r;h.__r=function(e){di&&di(e),e.__c};var hi=h.diffed;h.diffed=function(e){hi&&hi(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var fi=new Map;function pi(e){var t=fi.get(e);t&&t.destroy()}function vi(e){var t=fi.get(e);t&&t.update()}var mi=null;"undefined"==typeof window?((mi=function(e){return e}).destroy=function(e){return e},mi.update=function(e){return e}):((mi=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!fi.has(e)){var t,n=null,i=window.getComputedStyle(e),o=(t=e.value,function(){a({testForHeightReduction:""===t||!e.value.startsWith(t),restoreTextAlign:null}),t=e.value}),r=function(t){e.removeEventListener("autosize:destroy",r),e.removeEventListener("autosize:update",c),e.removeEventListener("input",o),window.removeEventListener("resize",c),Object.keys(t).forEach(function(n){return e.style[n]=t[n]}),fi.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,textAlign:e.style.textAlign,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",r),e.addEventListener("autosize:update",c),e.addEventListener("input",o),window.addEventListener("resize",c),e.style.overflowX="hidden",e.style.wordWrap="break-word",fi.set(e,{destroy:r,update:c}),c()}function a(t){var o,r,c=t.restoreTextAlign,s=void 0===c?null:c,l=t.testForHeightReduction,u=void 0===l||l,d=i.overflowY;if(0!==e.scrollHeight&&("vertical"===i.resize?e.style.resize="none":"both"===i.resize&&(e.style.resize="horizontal"),u&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach(function(e){var t=e[0],n=e[1];t.style.scrollBehavior="auto",t.scrollTop=n,t.style.scrollBehavior=null})}}(e),e.style.height=""),r="content-box"===i.boxSizing?e.scrollHeight-(parseFloat(i.paddingTop)+parseFloat(i.paddingBottom)):e.scrollHeight+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),"none"!==i.maxHeight&&r>parseFloat(i.maxHeight)?("hidden"===i.overflowY&&(e.style.overflow="scroll"),r=parseFloat(i.maxHeight)):"hidden"!==i.overflowY&&(e.style.overflow="hidden"),e.style.height=r+"px",s&&(e.style.textAlign=s),o&&o(),n!==r&&(e.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),n=r),d!==i.overflow&&!s)){var h=i.textAlign;"hidden"===i.overflow&&(e.style.textAlign="start"===h?"end":"start"),a({restoreTextAlign:h,testForHeightReduction:!0})}}function c(){a({testForHeightReduction:!0,restoreTextAlign:null})}}(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],pi),e},mi.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],vi),e});var _i=mi,gi=function(e){return e.STYLE_CACHE="ai-chat-style-cache",e.MINIMIZE_STYLY_CHCHE="ai-chat-minimize-style-cache",e.DATA_BASE_NAME="ibiz-chat",e.DATA_TABLE_NAME="history-message",e.DATA_TABLE_KEY_NAME="id",e}(gi||{}),yi=function(){return _(function e(t){v(this,e),g(this,"evt",new l),g(this,"messages",vt([])),g(this,"materials",vt([])),g(this,"input",vt("")),g(this,"isLoading",vt(!1)),g(this,"context",void 0),g(this,"params",void 0),g(this,"appDataEntityId",void 0),g(this,"topicId",void 0),g(this,"topic",void 0),g(this,"chatSessionid",""),this.opts=t,this.context=t.context,this.params=t.params,this.appDataEntityId=t.appDataEntityId,this.topicId=t.topicId,this.topic=t.topic,this.topicId?this.chatSessionid=Ee(this.topicId):this.chatSessionid=Ee(fe()),this.fecthHistory()},[{key:"fecthHistory",value:(y=p(d().m(function e(){var t,n=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(!this.topicId){e.n=3;break}return e.n=1,_e.getData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,this.topicId);case 1:if(!((t=e.v)&&t.data&&t.data.length>0)){e.n=3;break}return t.data.forEach(function(e){var t={messageid:e.messageid,state:e.state,type:e.type,role:e.role,content:e.content,suggestions:e.suggestions,completed:!0,toolcalls:e.toolcalls};n.addMessage(t)}),e.n=2,this.afterFecthHistory();case 2:case 5:return e.a(2,!0);case 3:return e.n=4,this.opts.history(this.context,this.params,{appDataEntityId:this.appDataEntityId,appendCurData:this.opts.appendCurData,sessionid:this.chatSessionid});case 4:if(!e.v){e.n=5;break}return e.n=5,this.afterFecthHistory()}},e,this)})),function(){return y.apply(this,arguments)})},{key:"afterFecthHistory",value:(m=p(d().m(function e(){var t;return d().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.appendCurContent&&this.addMessage({state:30,messageid:fe(),role:"USER",type:"DEFAULT",content:this.opts.appendCurContent,completed:!0}),!1===this.opts.autoQuestion){e.n=2;break}if("USER"!==(t=this.messages.value[this.messages.value.length-1]).role){e.n=2;break}return e.n=1,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 1:if(!this.opts.action){e.n=2;break}return e.n=2,this.opts.action("question",t.content);case 2:return e.a(2)}},e,this)})),function(){return m.apply(this,arguments)})},{key:"asyncToIndexDB",value:(f=p(d().m(function e(){var t;return d().w(function(e){for(;;)switch(e.n){case 0:if(this.topicId){e.n=1;break}return e.a(2);case 1:return t={id:this.topicId,data:this.messages.value.map(function(e){return u(u({},e._origin),{},{toolcalls:e.toolcalls})}),timestamp:(new Date).getTime()},e.n=2,_e.updateData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,t);case 2:return e.a(2)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"setInput",value:function(e){this.input.value=e||""}},{key:"addMessage",value:function(e){var t=this.messages.value.find(function(t){return t.messageid===e.messageid});t?(t.update(e),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(e)]),this.asyncToIndexDB()}},{key:"completeMessage",value:(h=p(d().m(function e(t,n){var i,o;return d().w(function(e){for(;;)switch(e.n){case 0:if(!(i=this.messages.value.find(function(e){return e.messageid===t}))){e.n=1;break}return i.updateCompleted(n),this.messages.value=r(this.messages.value),e.n=1,this.asyncToIndexDB();case 1:!0===this.opts.autoFill&&"ASSISTANT"===(o=i||this.messages.value[this.messages.value.length-1]).role&&30===o.state&&this.backfill(o),this.evt.emit("onCompleteMessage",{messageid:t,completed:n});case 2:return e.a(2)}},e,this)})),function(e,t){return h.apply(this,arguments)})},{key:"replaceMessage",value:function(e){var t=this,n=this.messages.value.findIndex(function(t){return t.messageid===e.messageid});-1!==n?(this.messages.value[n].replace(e),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(e)]),this.asyncToIndexDB(),"DEFAULT"===e.type&&this.opts.recommendPrompt&&this.opts.recommendPrompt(this.context,this.params,{appDataEntityId:this.appDataEntityId,message:{messages:[e],sessionid:this.chatSessionid}}).then(function(n){n&&n.content&&t.updateRecommendPrompt(e,n.content)})}},{key:"stopMessage",value:(s=p(d().m(function e(t){var n,i;return d().w(function(e){for(;;)switch(e.n){case 0:return-1!==(n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))?(i=this.messages.value[n],t.content=i.content,this.messages.value[n].replace(t),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(t)]),e.n=1,this.asyncToIndexDB();case 1:return e.a(2)}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"stringlyMaterialResource",value:function(){var e="",t=[];return this.materials.value&&this.materials.value.length>0&&(this.materials.value.forEach(function(e){if("ossfile"===e.type){var n=e.metadata;n.state&&"successed"===n.state&&t.push(e)}else t.push(e)}),this.materials.value=[]),t&&t.length>0&&(e=ye.stringify(t)),e}},{key:"getMessages",value:function(){var e=this.messages.value.filter(function(e){return"ERROR"!==e.type}).map(function(e){return e._origin});return e.forEach(function(e){e.content=e.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim()}),e}},{key:"question",value:(c=p(d().m(function e(t){var n,i=this;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.isLoading.value=!0,this.messages.value.forEach(function(e,t){var n=e._origin;n.suggestions&&(n.suggestions=void 0,i.messages.value[t].replace(n))}),this.messages.value=r(this.messages.value),this.asyncToIndexDB(),(n=this.stringlyMaterialResource())?n+="\n".concat(t):n=t,this.addMessage({state:30,messageid:fe(),role:"USER",type:"DEFAULT",content:n}),e.n=1,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 1:this.opts.action&&this.opts.action("question",t),this.isLoading.value=!1;case 2:return e.p=2,this.isLoading.value=!1,e.f(2);case 3:return e.a(2)}},e,this,[[0,,2,3]])})),function(e){return c.apply(this,arguments)})},{key:"abortQuestion",value:(a=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.opts.abortQuestion(this);case 1:return e.p=1,this.isLoading.value=!1,e.f(1);case 2:return e.a(2)}},e,this,[[0,,1,2]])})),function(){return a.apply(this,arguments)})},{key:"backfill",value:function(e){this.opts.action&&this.opts.action("backfill",e)}},{key:"deleteMessage",value:function(e){var t=this.messages.value.findIndex(function(t){return t.messageid===e.messageid});-1!==t&&(this.messages.value.splice(t,1),this.messages.value=r(this.messages.value)),this.asyncToIndexDB(),this.opts.action&&this.opts.action("deletemsg",e)}},{key:"refreshMessage",value:(o=p(d().m(function e(t){var n,i,o,a=arguments;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=a.length>1&&void 0!==a[1]&&a[1],this.isLoading.value=!0,e.p=1,i=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}),!n){e.n=3;break}return this.messages.value.splice(i+1,this.messages.value.length-i-1),this.messages.value=r(this.messages.value),e.n=2,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 2:e.n=6;break;case 3:if(i!==this.messages.value.length-1){e.n=5;break}return this.messages.value.pop(),this.messages.value=r(this.messages.value),e.n=4,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid);case 4:e.n=6;break;case 5:o=this.messages.value[i-1].content,this.messages.value.splice(i-1,2),this.question(o);case 6:this.asyncToIndexDB(),this.opts.action&&this.opts.action("refreshmsg",t);case 7:return e.p=7,this.isLoading.value=!1,e.f(7);case 8:return e.a(2)}},e,this,[[1,,7,8]])})),function(e){return o.apply(this,arguments)})},{key:"copyMessage",value:function(e){var t=e.realcontent;me.copy(t),this.opts.action&&this.opts.action("copymsg",e)}},{key:"resetTopic",value:(i=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.abortQuestion();case 1:if(!this.topicId){e.n=2;break}return e.n=2,_e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,this.topicId);case 2:this.messages.value=[],this.opts.history(this.context,this.params,{appDataEntityId:this.appDataEntityId,appendCurData:this.opts.appendCurData,sessionid:this.chatSessionid});case 3:return e.a(2)}},e,this)})),function(){return i.apply(this,arguments)})},{key:"clearTopic",value:(n=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.abortQuestion();case 1:if(!this.topicId){e.n=2;break}return e.n=2,_e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,this.topicId);case 2:this.messages.value=[];case 3:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})},{key:"addMaterial",value:function(e){var t=this.materials.value.find(function(t){return t.id===e.id});this.materials.value=t?r(this.materials.value):[].concat(r(this.materials.value),[new On(e)])}},{key:"replaceMaterial",value:function(e,t){var n=this.materials.value.findIndex(function(t){return t.id===e});-1!==n?(this.materials.value[n]=new On(t),this.materials.value=r(this.materials.value)):this.materials.value=[].concat(r(this.materials.value),[new On(t)])}},{key:"deleteMaterial",value:function(e){var t=this.materials.value.findIndex(function(t){return t.id===e.id});-1!==t&&(this.materials.value.splice(t,1),this.materials.value=r(this.materials.value))}},{key:"updateRecommendPrompt",value:function(e,t){if(t){var n=this.messages.value.findIndex(function(t){return t.messageid===e.messageid}),i=we.parseMixedContent(t).suggestions;i&&i.length>0&&(e.suggestions=i,-1!==n?(this.messages.value[n].replace(e),this.messages.value=r(this.messages.value)):this.messages.value=[].concat(r(this.messages.value),[new An(e)]),this.asyncToIndexDB())}}},{key:"handleSuggestionClick",value:(t=p(d().m(function e(t,n,i){var o,a,c,s,l,h;return d().w(function(e){for(;;)switch(e.n){case 0:-1!==(o=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))&&((a=this.messages.value[o]._origin).suggestions=void 0,this.messages.value[o].replace(a),this.messages.value=r(this.messages.value)),this.asyncToIndexDB(),c=n.type,h=c,e.n="action"===h?1:"raw"===h?4:6;break;case 1:if(!this.opts.extendToolbarClick){e.n=3;break}if(s=n.data.actionid){e.n=2;break}throw new Error("actionid不能为空");case 2:return l=u({},t),Object.assign(l,{topic:this.topic}),l.msg.realcontent=t.realcontent,e.n=3,this.opts.extendToolbarClick(i,{id:s,appId:this.context.srfappid},this.context,this.params,l);case 3:case 5:return e.a(3,7);case 4:return e.n=5,this.question(n.data.content);case 6:throw new Error("不支持".concat(c,"推荐类型"));case 7:return e.a(2)}},e,this)})),function(e,n,i){return t.apply(this,arguments)})},{key:"destroyed",value:(e=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:this.evt.reset();case 1:return e.a(2)}},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t,n,i,o,a,c,s,h,f,m,y}(),wi=function(){return _(function e(t){v(this,e),g(this,"topics",vt([])),g(this,"activedTopic",vt(void 0)),g(this,"currentTopicOptions",void 0),this.chat=t},[{key:"fetchHistory",value:(c=p(d().m(function e(t){var n,i,o=this;return d().w(function(e){for(;;)switch(e.n){case 0:return n=t.configService(t.appid,"aitopics",t.type),e.n=1,n.load();case 1:(i=e.v)&&i.length>0&&i.forEach(function(e){o.topics.value=[].concat(r(o.topics.value),[new Mn(e)])});case 2:return e.a(2)}},e)})),function(e){return c.apply(this,arguments)})},{key:"updateCurrentTopic",value:(a=p(d().m(function e(t){var n,i,o,a;return d().w(function(e){for(;;)switch(e.n){case 0:return this.currentTopicOptions=t,n=this.topics.value.findIndex(function(e){return e.id===t.id}),i=new Mn(t),-1!==n?this.topics.value.splice(n,1,new Mn(t)):this.topics.value=[].concat(r(this.topics.value),[new Mn(t)]),o=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),a=t.configService(t.appid,"aitopics",t.type),e.n=1,null==a?void 0:a.save(o);case 1:this.activedTopic.value=i;case 2:return e.a(2)}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"removeTopic",value:(o=p(d().m(function e(t,n,i,o,a){var c,s,l,u,h;return d().w(function(e){for(;;)switch(e.n){case 0:if(s=!0,!t.beforeDelete){e.n=2;break}return e.n=1,t.beforeDelete(n,i,o,a);case 1:s=e.v;case 2:if(s){e.n=3;break}return e.a(2);case 3:return-1!==(l=this.topics.value.findIndex(function(e){return e.id===o.id}))&&(this.topics.value.splice(l,1),this.topics.value=r(this.topics.value)),u=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),h=t.configService(t.appid,"aitopics",t.type),e.n=4,null==h?void 0:h.save(u);case 4:return e.n=5,_e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,o.id);case 5:this.topics.value.length>0&&o.id===(null===(c=this.activedTopic.value)||void 0===c?void 0:c.id)&&this.handleTopicChange(this.topics.value[0]);case 6:return e.a(2)}},e,this)})),function(e,t,n,i,r){return o.apply(this,arguments)})},{key:"updateTopic",value:(i=p(d().m(function e(t,n){var i,o;return d().w(function(e){for(;;)switch(e.n){case 0:return i=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),o=t.configService(t.appid,"aitopics",t.type),e.n=1,null==o?void 0:o.save(i);case 1:return e.a(2)}},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"handleTopicChange",value:function(e){var t;(null===(t=this.activedTopic.value)||void 0===t?void 0:t.id)!==e.id&&(this.activedTopic.value=e,this.chat.switchAiChatController(e))}},{key:"handleTopicAction",value:(n=p(d().m(function e(t,n,i){var o,r,a,c,s,l;return d().w(function(e){for(;;)switch(e.n){case 0:if(o=this.topics.value.find(function(e){return e.id===n.id}),!(this.currentTopicOptions&&o&&o.aiChat)){e.n=4;break}if(c=o.aiChat,s=c.context,l=c.params,"DELETE"!==t){e.n=2;break}return e.n=1,this.removeTopic(this.currentTopicOptions,s,l,o,i);case 1:e.n=3;break;case 2:if("RENAME"!==t){e.n=3;break}return e.n=3,this.updateTopic(this.currentTopicOptions,n);case 3:null===(r=(a=this.currentTopicOptions).action)||void 0===r||r.call(a,t,s,l,n,i);case 4:return e.a(2)}},e,this)})),function(e,t,i){return n.apply(this,arguments)})},{key:"newTopic",value:(t=p(d().m(function e(){var t,n,i,o,a,c,s,l,u;return d().w(function(e){for(;;)switch(e.n){case 0:if(i=this.activedTopic.value){e.n=1;break}return e.a(2);case 1:return o=i.id.split("@")[0],a=this.topics.value.filter(function(e){return e.id.startsWith(o)}),c={appid:i.appid,id:"".concat(o,"@").concat(Date.now()),type:i.type,caption:"".concat(null===(t=i.sourceCaption)||void 0===t?void 0:t.split("_")[0],"_").concat(a.length),sourceCaption:i.sourceCaption,url:i.url,aiChat:i.aiChat},s=new Mn(c),this.topics.value=[].concat(r(this.topics.value),[s]),l=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),u=null===(n=this.currentTopicOptions)||void 0===n?void 0:n.configService(c.appid,"aitopics",c.type),e.n=2,null==u?void 0:u.save(l);case 2:this.handleTopicChange(s);case 3:return e.a(2)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"clearTopic",value:(e=p(d().m(function e(){var t,n,i,o,r,a=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(n=this.topics.value.find(function(e){var t;return e.id===(null===(t=a.activedTopic.value)||void 0===t?void 0:t.id)}),this.currentTopicOptions&&n){e.n=1;break}return e.a(2);case 1:if(i=!0,!this.currentTopicOptions.beforeDelete){e.n=3;break}return e.n=2,this.currentTopicOptions.beforeDelete(n.aiChat.context,n.aiChat.params,n,void 0,!0);case 2:i=e.v;case 3:if(i){e.n=4;break}return e.a(2);case 4:return e.n=5,Promise.all(this.topics.value.map(function(e){if(e.id!==(null==n?void 0:n.id))return _e.deleteData(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,e.id)}));case 5:return this.topics.value=n?[n]:[],o=null===(t=this.currentTopicOptions)||void 0===t?void 0:t.configService(this.currentTopicOptions.appid,"aitopics",this.currentTopicOptions.type),r=this.topics.value.map(function(e){return{appid:e.appid,id:e.id,type:e.type,caption:e.caption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat}}),e.n=6,null==o?void 0:o.save(r);case 6:return e.a(2)}},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t,n,i,o,a,c}(),bi=_(function e(t){v(this,e),this.aiChat=t}),ki=function(t){function n(){return v(this,n),e(this,n,arguments)}return i(n,t),_(n,[{key:"excuteAction",value:(o=p(d().m(function e(t,n){var i,o,r,a;return d().w(function(e){for(;;)switch(e.n){case 0:if(!n||!n.onClick||"function"!=typeof n.onClick){e.n=2;break}return e.n=1,n.onClick(t,n,this.aiChat.context,this.aiChat.params);case 1:i=e.v,e.n=5;break;case 2:if(!(o=this.aiChat.opts.extendToolbarClick)){e.n=4;break}return e.n=3,o(t,n,this.aiChat.context,this.aiChat.params,{});case 3:i=e.v,e.n=5;break;case 4:console.error("未找到扩展工具栏点击事件");case 5:i&&i.data&&i.data.length>0&&(r=i.data[0],a={id:r.id,type:r.type,data:r.data||{},metadata:r.metadata||{}},n.id&&Object.assign(a.metadata,{actionId:n.id}),this.aiChat.addMaterial(a));case 6:return e.a(2)}},e,this)})),function(e,t){return o.apply(this,arguments)})}]);var o}(bi),Ci=function(t){function n(){return v(this,n),e(this,n,arguments)}return i(n,t),_(n,[{key:"excuteAction",value:(o=p(d().m(function e(t,n){var i,o,r,a,c,s,l,u,h,f,v=this;return d().w(function(e){for(;;)switch(e.n){case 0:i=this.aiChat.opts.uploader,o=i.multiple,r=i.accept,a=i.maxSize,c=i.onSelect,s=i.onUpload,l=i.onSuccess,u=i.onError,h=i.onProgress,f={multiple:o||!0,accept:r||"*/*",maxSize:a||5242880,onSelect:function(e){null==c||c(e),e.length>0&&e.forEach(function(e){var t=v.buildMaterialObject(e);Object.assign(t.metadata,{state:"uploading"}),v.aiChat.addMaterial(t)})},onUpload:function(){var e=p(d().m(function e(t,n){return d().w(function(e){for(;;)if(0===e.n)return e.a(2,s(t,n,{context:v.aiChat.context,params:v.aiChat.params}))},e)}));return function(t,n){return e.apply(this,arguments)}}(),onSuccess:function(e,t){var n={id:e.id,type:"ossfile",data:{id:e.id,name:e.name},metadata:{ext:e.ext,fileext:e.fileext,fileid:e.fileid,filename:e.filename,size:e.size,filesize:e.filesize,state:"successed"}};v.aiChat.replaceMaterial(t.name,n),null==l||l(e,t)},onError:function(e,t){var n=v.buildMaterialObject(t);Object.assign(n.metadata,{state:"failed"}),v.aiChat.replaceMaterial(t.name,n),null==u||u(e,t)},onProgress:function(e,t){null==h||h(e,t)}},new ge(f).openFilePicker();case 1:return e.a(2)}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"buildMaterialObject",value:function(e){return{id:e.name,type:"ossfile",data:{name:e.name,id:e.name},metadata:{size:e.size,type:e.type,lastModified:e.lastModified}}}}]);var o}(bi),xi=function(){return _(function e(){v(this,e)},null,[{key:"getMaterialHelper",value:function(e,t){return"ossfile"===e?new Ci(t):new ki(t)}}])}(),Ti=function(){return _(function e(){v(this,e),g(this,"container",void 0),g(this,"mode","DEFAULT"),g(this,"isMountedAiTopic",!1),g(this,"backupChatOptions",void 0),g(this,"aiTopic",void 0),g(this,"aiTopicMap",new Map),this.aiTopic=new wi(this)},[{key:"aiChat",get:function(){var e;return this.aiTopicMap.get("".concat(null===(e=this.aiTopic.activedTopic.value)||void 0===e?void 0:e.id))}},{key:"initIndexDB",value:(t=p(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,_e.checkTableExists(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME);case 1:if(e.v){e.n=2;break}return e.n=2,_e.createTable(gi.DATA_BASE_NAME,gi.DATA_TABLE_NAME,gi.DATA_TABLE_KEY_NAME,!1);case 2:return e.a(2)}},e)})),function(){return t.apply(this,arguments)})},{key:"create",value:(e=p(d().m(function e(t){var n,i,o,r,a,c,s=this;return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.initIndexDB();case 1:if(this.backupChatOptions=t,this.close(),this.container=document.createElement("div"),this.container.classList.add("ibiz-ai-chat"),document.body.appendChild(this.container),r=t.chatOptions,!t.mode||"TOPIC"!==t.mode){e.n=5;break}if(this.isMountedAiTopic){e.n=3;break}return e.n=2,this.aiTopic.fetchHistory(t.topicOptions);case 2:this.isMountedAiTopic=!0;case 3:return a=t.topicOptions,Object.assign(a,{aiChat:{caption:r.caption,context:r.context,params:r.params,appDataEntityId:r.appDataEntityId,contentToolbarItems:r.contentToolbarItems,footerToolbarItems:r.footerToolbarItems,questionToolbarItems:r.questionToolbarItems,otherToolbarItems:r.otherToolbarItems,appendCurData:r.appendCurData,appendCurContent:r.appendCurContent}}),e.n=4,this.aiTopic.updateCurrentTopic(a);case 4:e.n=6;break;case 5:this.aiTopic.activedTopic.value=void 0;case 6:return Object.assign(r,{topicId:null===(n=a)||void 0===n?void 0:n.id,topic:a}),c=new yi(r),this.aiTopicMap.set("".concat(null===(i=a)||void 0===i?void 0:i.id),c),oe(z(Ui,{aiChat:c,aiTopic:this.aiTopic,mode:t.mode?t.mode:"DEFAULT",containerOptions:t.containerOptions,caption:t.mode&&"TOPIC"===t.mode?"AI助手":r.caption,enableBackFill:null===(o=t.containerOptions)||void 0===o?void 0:o.enableBackFill,contentToolbarItems:r.contentToolbarItems,footerToolbarItems:r.footerToolbarItems,questionToolbarItems:r.questionToolbarItems,autoClose:r.autoClose,openMode:r.openMode,close:function(){s.close(),r.closed&&r.closed(r.context,r.params)},fullscreen:function(e){r.fullscreen&&r.fullscreen(e,r.context,r.params)},minimize:function(e){r.minimize&&r.minimize(e,r.context,r.params)}}),this.container),e.a(2,c)}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"switchAiChatController",value:function(e){var t,n,i,o,r,a=this,c=u({},this.backupChatOptions.chatOptions);(e.aiChat&&Object.assign(c,{caption:e.aiChat.caption,context:e.aiChat.context,params:e.aiChat.params,contentToolbarItems:e.aiChat.contentToolbarItems,footerToolbarItems:e.aiChat.footerToolbarItems,questionToolbarItems:e.aiChat.questionToolbarItems,otherToolbarItems:e.aiChat.otherToolbarItems,appendCurData:e.aiChat.appendCurData,appendCurContent:e.aiChat.appendCurContent,appDataEntityId:e.aiChat.appDataEntityId,topicId:e.id,topic:e,extendToolbarClick:this.backupChatOptions.chatOptions.extendToolbarClick,recommendPrompt:this.backupChatOptions.chatOptions.recommendPrompt}),this.aiTopicMap.has("".concat(e.id))?t=this.aiTopicMap.get("".concat(e.id)):(t=new yi(c),this.aiTopicMap.set("".concat(e.id),t)),this.container)&&(oe(null,this.container),oe(z(Ui,{aiChat:t,aiTopic:this.aiTopic,mode:null!==(n=this.backupChatOptions)&&void 0!==n&&n.mode?this.backupChatOptions.mode:"DEFAULT",containerOptions:null===(i=this.backupChatOptions)||void 0===i?void 0:i.containerOptions,caption:null!==(o=this.backupChatOptions)&&void 0!==o&&o.mode&&"TOPIC"===this.backupChatOptions.mode?"AI助手":c.caption,enableBackFill:null===(r=this.backupChatOptions)||void 0===r||null===(r=r.containerOptions)||void 0===r?void 0:r.enableBackFill,contentToolbarItems:c.contentToolbarItems,footerToolbarItems:c.footerToolbarItems,questionToolbarItems:c.questionToolbarItems,close:function(){a.close(),c.closed&&c.closed(c.context,c.params)},fullscreen:function(e){c.fullscreen&&c.fullscreen(e,c.context,c.params)},minimize:function(e){c.minimize&&c.minimize(e,c.context,c.params)}}),this.container))}},{key:"hidden",value:function(){this.container&&(this.container.style.display="none")}},{key:"show",value:function(){this.container&&(this.container.style.display="flex")}},{key:"close",value:function(){this.container&&(oe(null,this.container),this.container.remove(),this.container=void 0),this.aiTopicMap.forEach(function(e){e.destroyed()})}}]);var e,t}(),Ni=(t("chat",new Ti),new se("chat-input-material")),Si=function(e){var t=e.controller.materials;return ae("div",{className:Ni.b(),children:t.value.map(function(t){return ae(wn,{material:t,disabled:!1,controller:e.controller},t.id)})})},Ei=function(e){var t=e.children,n=e.actions,i=e.content,o=e.position,r=void 0===o?"bottom":o,c=e.isOpen,s=e.onToggleOpen,l=e.onAction,d=new se("pop"),h=Ze(Fi),f=a(Ve(c||!1),2),p=f[0],v=f[1],m=$e(null),_=$e(null);qe(function(){void 0!==c&&v(c)},[c]),qe(function(){return _.current||(_.current=document.createElement("div"),_.current.className=d.b("content-container"),document.body.appendChild(_.current)),function(){_.current&&document.body.removeChild(_.current)}},[]),qe(function(){var e=function(e){!m.current||m.current.contains(e.target)||e.target.closest(".".concat(d.b()))||e.target.closest(".ibiz-quick-edit")||e.target.closest(".ibiz-picker__transfer")||(v(!1),null==s||s(!1))};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[p,s]);return ae("span",{className:"".concat(d.b("trigger-container")),children:[ae("span",{className:"".concat(d.b("trigger-element")),ref:m,onClick:function(e){e.stopPropagation();var t=!p;v(t),null==s||s(t)},children:t}),p&&_.current&&Kn(ae("div",{className:"".concat(d.b()," pop-").concat(r),style:function(){if(!m.current)return{};var e=m.current.getBoundingClientRect(),t={position:"absolute",zIndex:h.zIndex+1},n={bottom:{top:e.bottom+window.scrollY,left:e.left+window.scrollX},top:{bottom:window.innerHeight-e.top+window.scrollY,left:e.left+window.scrollX},left:{top:e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX},right:{top:e.top+window.scrollY,left:e.right+window.scrollX},"top-left":{bottom:window.innerHeight-e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX}};return u(u({},t),n[r])}(),children:i||(null==n?void 0:n.map(function(e){return ae("div",{title:e.caption,className:d.e("item"),onMouseDown:function(t){t.stopPropagation(),null==l||l(e.id,t)},children:[e.icon,ae("div",{className:d.em("item","caption"),children:e.caption})]},e.id)}))}),_.current)]})},Ai=new se("chat-input"),Mi=window.SpeechRecognition||window.webkitSpeechRecognition,Oi=function(e){var t,n=a(Ve(!1),2),i=n[0],o=n[1],r=$e(null),c=e.controller.input,s=Mt(!1),l=$e();Mi&&!l.current&&(l.current=new Mi,l.current.onstart=function(){s.value=!0},l.current.onend=function(){s.value=!1},l.current.onresult=function(e){var t,n=null===(t=e.results)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.transcript;n&&(c.value="".concat(c.value).concat(n))});var u=Xe(function(e){c.value=e.target.value},[c]),h=Ot(function(){return c.value.length<=0});qe(function(){return r.current&&_i(r.current),function(){r.current&&_i.destroy(r.current)}},[r]);var f=Xe(p(d().m(function t(){var n,i,o;return d().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,n=c.value,c.value="",t.n=1,e.controller.question(n);case 1:t.n=3;break;case 2:t.p=2,o=t.v,console.error(o);case 3:return t.p=3,null===(i=r.current)||void 0===i||i.focus(),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])})),[c]),v=Xe(p(d().m(function t(){return d().w(function(t){for(;;)switch(t.n){case 0:try{e.controller.abortQuestion()}catch(n){console.error(n)}case 1:return t.a(2)}},t)})),[c]),m=function(){var t=p(d().m(function t(n){var i;return d().w(function(t){for(;;)switch(t.n){case 0:return i=xi.getMaterialHelper("ossfile",e.controller),t.n=1,i.excuteAction(n);case 1:o(!1);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),_=function(){var t=p(d().m(function t(n,i){var r;return d().w(function(t){for(;;)switch(t.n){case 0:return r=xi.getMaterialHelper("common",e.controller),t.n=1,r.excuteAction(n,i);case 1:o(!1);case 2:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}();return ae("div",{className:Ai.b("wrapper"),children:[ae("div",{className:Ai.b("material-wrapper"),children:ae(Si,{controller:e.controller})}),ae("div",{className:Ai.b("main-wrapper"),children:[ae("textarea",{className:Ai.e("textarea"),type:"text",rows:6,autoCorrect:"off",autoCapitalize:"off",autoComplete:"off",value:c,onInput:u,onKeyDown:function(e){"Enter"!==e.code||e.isComposing||(e.stopPropagation(),!1===e.shiftKey&&f())},ref:r,disabled:e.controller.isLoading.value}),ae("div",{className:Ai.b("action-wrapper"),children:[ae("div",{className:"".concat(Ai.be("action-wrapper","action-item")," ").concat(Ai.is("disabled",e.controller.isLoading.value)),title:"上传资料",children:ae(Ei,{content:ae("div",{className:Ai.b("pop-actions"),children:[ae("div",{className:Ai.b("pop-action-item"),onClick:function(e){m(e)},children:[ae("span",{className:Ai.b("pop-action-item-icon"),children:ae(Kt,{})}),ae("span",{className:Ai.b("pop-action-item-title"),children:"文件资料"})]}),null===(t=e.questionToolbarItems)||void 0===t?void 0:t.map(function(e){var t,n,i;return ae("div",{className:Ai.b("pop-action-item"),onClick:function(t){_(t,e)},children:[ae("span",{className:Ai.b("pop-action-item-icon"),children:"function"==typeof e.icon?e.icon():(null===(t=e.icon)||void 0===t?void 0:t.showIcon)&&ae(B,{children:null!==(n=e.icon)&&void 0!==n&&n.cssClass?ae("i",{className:e.icon.cssClass}):null!==(i=e.icon)&&void 0!==i&&i.imagePath?ve(e.icon.imagePath)?ae("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):ae("img",{src:e.icon.imagePath}):null})}),ae("span",{className:Ai.b("pop-action-item-title"),children:e.label})]},e.id)})]}),position:"top-left",isOpen:i,onToggleOpen:o,children:ae(Gt,{})})}),ae("div",{title:s.value?"语音输入中...":"语音输入",className:"".concat(Ai.be("action-wrapper","action-item")," ").concat(Ai.is("disabled",e.controller.isLoading.value)),onClick:function(){l.current&&!s.value&&l.current.start()},children:s.value?ae(Vt,{}):ae(Rt,{})}),e.controller.isLoading.value?ae("div",{title:"停止生成",className:"".concat(Ai.be("action-wrapper","action-item")),onClick:v,children:ae(tn,{})}):ae("div",{title:"发送消息",className:"".concat(Ai.be("action-wrapper","action-item")," ").concat(Ai.is("disabled",h.value)),onClick:f,children:ae(Dt,{})})]})]})]})},Ii=new se("chat-topic-item"),Li=function(e){var t=e.controller,n=e.topic,i=e.onClick,o=e.onAction,r=$e(null),c=Ot(function(){var e;return(null===(e=t.activedTopic.value)||void 0===e?void 0:e.id)===n.id}),s=a(Ve(!1),2),l=s[0],u=s[1],d=Mt(!1);return ae("div",{className:"".concat(Ii.b()," ").concat(Ii.is("active",c.value)," ").concat(Ii.is("edit",d.value)),onClick:i.bind(void 0),children:[ae("div",{className:Ii.e("caption"),title:n.caption,children:d.value?ae("input",{ref:r,value:n.caption,onBlur:function(e){e.stopPropagation(),d.value=!1,o("RENAME",e)},onKeyDown:function(e){e.stopPropagation(),"Enter"===e.key&&(d.value=!1)},onClick:function(e){return e.stopPropagation()},onChange:function(e){return(t=e).stopPropagation(),void(n.data.caption=null===(i=t.target)||void 0===i?void 0:i.value);var t,i},className:Ii.em("caption","editor")}):ae("span",{className:Ii.em("caption","text"),children:n.caption})}),!d.value&&ae("div",{className:Ii.e("icon"),children:[ae("span",{title:"跳转主视图",className:Ii.em("icon","item"),onClick:function(e){e.stopPropagation(),o("LINK",e)}.bind(void 0),children:ae($t,{className:Ii.b("link-icon")})}),c.value?null:ae(Ei,{actions:[{id:"RENAME",caption:"重命名",icon:ae(an,{})},{id:"DELETE",caption:"删除话题",icon:ae(Yt,{})}],position:"bottom",isOpen:l,onToggleOpen:u,onAction:function(e,t){"DELETE"===e?o("DELETE",t):"RENAME"===e&&(d.value=!0,setTimeout(function(){var e;null===(e=r.current)||void 0===e||e.focus()},100)),u(!1)}.bind(void 0),children:ae("span",{className:Ii.em("icon","item"),title:"更多",children:ae(qt,{className:Ii.e("more-icon")})})})]})]})},Di=new se("chat-search"),zi=function(e){var t=e.className,n=e.value,i=e.placeholder,o=e.onChange,r=a(Ve(!1),2),c=r[0],s=r[1],l=function(e){var t;e.stopPropagation(),null==o||o(null===(t=e.target)||void 0===t?void 0:t.value)};return ae("div",{className:"".concat(Di.b()," ").concat(Di.is("focus",c)," ").concat(t||""),children:[ae("div",{className:Di.e("prefix"),children:ae(sn,{})}),ae("input",{value:n,className:Di.e("inner"),placeholder:i,onFocus:function(){return s(!0)},onBlur:function(){return s(!1)},onChange:function(e){return l(e)}})]})},Pi=new se("chat-topics"),Bi=function(e){var t=$e(null),n=Mt(void 0),i=Mt([]);qe(function(){i.value=e.controller.topics.value.filter(function(e){var t,i;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(i=n.value)||void 0===i?void 0:i.trim().toLowerCase())||"")})},[e.controller.topics.value]);return qe(function(){var e=t.current;if(e){var n=e.querySelector(".ibiz-chat-topic-item.is-active");null==n||n.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e.controller.activedTopic.value]),ae("div",{className:Pi.b(),children:[ae("div",{className:Pi.e("header"),children:ae(zi,{value:n.value,placeholder:"搜索话题",onChange:function(t){n.value=t,i.value=e.controller.topics.value.filter(function(e){var t,i;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(i=n.value)||void 0===i?void 0:i.trim().toLowerCase())||"")})}.bind(void 0)})}),ae("div",{ref:t,className:Pi.e("main"),children:i.value&&i.value.length>0?i.value.map(function(t){return ae(Li,{topic:t,controller:e.controller,onClick:function(){return function(t){e.controller.handleTopicChange(t)}(t)},onAction:function(n,i){return function(t,n,i){e.controller.handleTopicAction(t,n,i)}(n,t,i)}},t.id)}):ae("div",{className:Pi.e("empty"),children:"暂无话题"})}),ae("div",{className:Pi.e("footer"),children:ae("div",{title:"清空会话",className:Pi.e("action"),onClick:function(){return e.controller.clearTopic()},children:[ae(Yt,{}),ae("span",{children:"清空会话"})]})})]})},Hi=new se("chat-minimize"),ji=function(e){var t=$e(null),n=a(Ve(""),2),i=n[0],o=n[1],r=a(Ve(0),2),c=r[0],s=r[1],l=$e(!1),u={x:(window.innerWidth-86)/window.innerWidth,y:(window.innerHeight-86)/window.innerHeight},d=Ot(function(){var t=e.controller.messages.value[e.controller.messages.value.length-1];return!!t&&("ASSISTANT"===t.role&&20===t.state&&!0!==t.completed)}),h=Ot(function(){var t="";if(!d.value)return o(""),s(0),t;var n=e.controller.messages.value[e.controller.messages.value.length-1];if(t=n.content,-1!==n.content.indexOf("<think>")){var i=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),i="",o="";return-1===n?(i=e.slice(t+7),o=""):(i=e.slice(t+7,n),o=e.slice(n+8)),{thoughtContent:i,answerContent:o}}(n.content);t=i.thoughtContent+i.answerContent}return t}),f=function(){Object.assign(t.current.style,{left:"".concat(100*u.x,"%"),top:"".concat(100*u.y,"%")}),localStorage.setItem(gi.MINIMIZE_STYLY_CHCHE,JSON.stringify(u))};return qe(function(){var e,n=localStorage.getItem(gi.MINIMIZE_STYLY_CHCHE);if(n){var i=JSON.parse(n);be(i)&&Object.assign(u,i)}f(),(e=t.current)&&(e.onmousedown=function(t){document.body.style.userSelect="none";var n=t.clientX-e.offsetLeft,i=t.clientY-e.offsetTop,o=Date.now(),r=function(e){var t=56/window.innerWidth,o=56/window.innerHeight,r=ke(e.clientX-n,e.clientY-i,t,o),a=r.x,c=r.y;Object.assign(u,{x:a,y:c}),requestAnimationFrame(function(){f()})},a=function(){var e=Date.now();l.current=e-o>300,document.body.style.userSelect="",document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)})},[]),qe(function(){if(c<h.value.length){var e=setTimeout(function(){o(function(e){return e+h.value[c]}),s(function(e){return e+1})},100);return function(){return clearTimeout(e)}}},[c,h.value]),ae("div",{ref:t,title:e.title,className:"".concat(Hi.b()," ").concat(Hi.is("hidden",!e.isMinimize)," ").concat(Hi.is("show-halo",d.value)),onClick:function(){l.current||e.onClick()},children:ae("div",{className:"".concat(Hi.e("content")," ").concat(Hi.is("show-border",!d.value)),children:[i&&ae("div",{className:"".concat(Hi.em("content","popover")),children:ae("div",{className:"typewriter",children:i})}),ae(Ut,{})]})})},Fi=function(e){function t(e){var n,i;return this.getChildContext||(n=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,U(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+E++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({zIndex:10,enableBackFill:!0,newTopic:function(){}}),Ui=function(t){function n(t){var i,o,r,a,c;return v(this,n),g(c=e(this,n,[t]),"ns",new se("chat-container")),g(c,"containerRef",{current:null}),g(c,"dragHandle",{current:null}),g(c,"data",{side:{y:0,height:1,width:750/window.innerWidth,x:(window.innerWidth-750)/window.innerWidth},window:{y:0,width:750/window.innerWidth,height:750/window.innerHeight,x:(window.innerWidth-750)/window.innerWidth},minWidth:500,minHeight:300,showMode:"side"}),g(c,"disabled",!1),g(c,"isDragging",!1),g(c,"containerContext",{zIndex:(null===(i=c.props.containerOptions)||void 0===i?void 0:i.zIndex)||10,enableBackFill:void 0===(null===(o=c.props)||void 0===o?void 0:o.enableBackFill)||null===(null===(r=c.props)||void 0===r?void 0:r.enableBackFill)||(null===(a=c.props)||void 0===a?void 0:a.enableBackFill),newTopic:function(){c.props.aiTopic.newTopic()}}),c.state={isFullScreen:!1,isMinimize:!("minimize"!==(null==t?void 0:t.openMode)&&"autoexpand"!==(null==t?void 0:t.openMode))},null==t||t.aiChat.evt.on("onCompleteMessage",function(){if(t.autoClose){var e=t.autoClose,n=e.mode,i=e.duration,o=void 0===i?3:i;switch(n){case"minimize":c.minimize();break;case"close":c.close();break;case"closetime":setTimeout(function(){c.close()},1e3*o)}}"autoexpand"===t.openMode&&c.exitMinimize()}),c}return i(n,t),_(n,[{key:"calcWindowStyle",value:function(){var e,t="window"===this.data.showMode?this.data.window:this.data.side;return{left:"".concat(100*t.x,"%"),top:"".concat(100*t.y,"%"),width:"".concat(100*t.width,"%"),height:"".concat(100*t.height,"%"),minWidth:"".concat(this.data.minWidth,"px"),minHeight:"".concat(this.data.minHeight,"px"),"z-index":(null===(e=this.props.containerOptions)||void 0===e||null===(e=e.zIndex)||void 0===e?void 0:e.toString())||"10"}}},{key:"calcSideModeStyle",value:function(e){Object.assign(this.data,{side:{y:0,x:"left"===e?0:(window.innerWidth-750)/window.innerWidth,height:1,width:750/window.innerWidth},showMode:"side"})}},{key:"setStyle",value:function(){Object.assign(this.containerRef.current.style,this.calcWindowStyle()),localStorage.setItem(gi.STYLE_CACHE,JSON.stringify(this.data))}},{key:"snapToEdge",value:function(){var e=20/window.innerWidth,t=20/window.innerHeight,n=this.data.window,i=n.x,o=n.y,r=n.width,a=n.height;i<e||i+r>1-e?this.calcSideModeStyle(i<e?"left":"right"):(o<t&&(this.data.window.y=0),o+a>1-t&&(this.data.window.y=1-a)),this.setStyle()}},{key:"registerDragDialog",value:function(){var e=this;this.dragHandle.current.onmousedown=function(t){if(!e.state.isFullScreen){document.body.style.userSelect="none";var n=t.clientX-e.containerRef.current.offsetLeft,i=t.clientY-e.containerRef.current.offsetTop,o=function(t){if(!e.disabled){e.data.showMode="window";var o=ke(t.clientX-n,t.clientY-i,e.data.window.width,e.data.window.height),r=o.x,a=o.y;Object.assign(e.data.window,{x:r,y:a}),e.setStyle()}},r=function(){document.body.style.userSelect="",document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),e.disabled||e.snapToEdge()};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}}}},{key:"registerDragDialogBorder",value:function(){var e=this;o(this.containerRef.current).resizable({edges:{top:!0,right:!0,bottom:!0,left:!0},margin:6,modifiers:[o.modifiers.restrictEdges({outer:document.body}),o.modifiers.restrictSize({min:{width:this.data.minWidth,height:this.data.minHeight}})],inertia:!0,listeners:{move:function(t){if(!e.state.isFullScreen){var n="side"===e.data.showMode?e.data.side:e.data.window;n.x=t.rect.left/window.innerWidth,n.y=t.rect.top/window.innerHeight,n.width=t.rect.width/window.innerWidth,n.height=t.rect.height/window.innerHeight,e.setStyle()}},start:function(){e.disabled=!0,document.body.style.userSelect="none"},end:function(){e.disabled=!1,document.body.style.userSelect=""}}})}},{key:"handleFullScreenChange",value:function(){this.setState({isFullScreen:null!==document.fullscreenElement})}},{key:"componentDidMount",value:function(){this.handleFullScreenChange=this.handleFullScreenChange.bind(this);var e=localStorage.getItem(gi.STYLE_CACHE);if(e){var t=JSON.parse(e);t.side&&be(t.side)&&t.window&&be(t.window)&&Object.assign(this.data,t)}this.setStyle(),this.registerDragDialog(),this.registerDragDialogBorder(),document.addEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"close",value:function(){this.props.close()}},{key:"fullScreen",value:function(){var e=this.containerRef.current;e&&(e.requestFullscreen(),this.props.fullscreen(!0))}},{key:"closeFullScreen",value:function(){var e;this.state.isFullScreen&&(null===(e=document)||void 0===e||e.exitFullscreen(),this.props.fullscreen(!1),this.setStyle())}},{key:"minimize",value:function(){this.closeFullScreen(),this.setState({isMinimize:!0}),this.props.minimize(!0)}},{key:"exitMinimize",value:function(){this.setState({isMinimize:!1}),this.props.minimize(!1)}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"render",value:function(){return ae(Fi.Provider,{value:this.containerContext,children:ae("div",{className:"".concat(this.ns.b()),children:[ae("div",{className:"".concat(this.ns.e("dialog")," ").concat(this.ns.is("full-screen",this.state.isFullScreen)," ").concat(this.ns.is("hidden",this.state.isMinimize)),ref:this.containerRef,children:[ae("div",{ref:this.dragHandle,className:this.ns.b("header"),children:[ae("div",{className:this.ns.b("header-caption"),children:this.props.caption||"AI助手"}),ae("div",{className:this.ns.b("header-action-wrapper"),children:[ae("div",{title:"最小化",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","minimize")),onMouseDown:this.stopPropagation.bind(this),onClick:this.minimize.bind(this),children:ae(Ft,{})}),this.state.isFullScreen?ae("div",{title:"退出全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","close-full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.closeFullScreen.bind(this),children:ae(jt,{})}):ae("div",{title:"全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.fullScreen.bind(this),children:ae(Ht,{})}),ae("div",{title:"关闭",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","action-close")),onMouseDown:this.stopPropagation.bind(this),onClick:this.close.bind(this),children:ae(It,{})})]})]}),"TOPIC"===this.props.mode?ae("div",{className:"".concat(this.ns.b("main")),children:[ae("div",{className:"".concat(this.ns.be("main","left")),children:ae(Bi,{controller:this.props.aiTopic})}),ae("div",{className:"".concat(this.ns.be("main","right")),children:[ae("div",{className:this.ns.b("content"),children:ae(Hn,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),ae(zn,{type:"footer",mode:this.props.mode,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),ae("div",{className:this.ns.b("footer"),children:ae(Oi,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}):ae("div",{className:"".concat(this.ns.be("main","default")),children:[ae("div",{className:this.ns.b("content"),children:ae(Hn,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),ae(zn,{type:"footer",mode:this.props.mode,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),ae("div",{className:this.ns.b("footer"),children:ae(Oi,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}),ae(ji,{title:this.props.caption||"AI助手",controller:this.props.aiChat,isMinimize:this.state.isMinimize,onClick:this.exitMinimize.bind(this)})]})})}}])}(H);t("ChatContainer",Ui)}}})}();
@@ -114,6 +114,10 @@ export declare class AiChatController {
114
114
  * @return {*} {Promise<boolean>}
115
115
  */
116
116
  fecthHistory(): Promise<boolean>;
117
+ /**
118
+ * 获取历史记录后续处理
119
+ */
120
+ private afterFecthHistory;
117
121
  /**
118
122
  * 更新数据到indexdb
119
123
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "iBiz AI交互框插件",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",