@sy-design/svelte 1.0.3 → 1.0.5

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.
@@ -4589,7 +4589,7 @@ function rl(s) {
4589
4589
  props: {
4590
4590
  zIndex: (
4591
4591
  /*mergedOptions*/
4592
- s[3].zIndex ?? 1e3
4592
+ s[3].zIndex || 1e3
4593
4593
  ),
4594
4594
  sessionId: (
4595
4595
  /*currentSessionId*/
@@ -4607,7 +4607,7 @@ function rl(s) {
4607
4607
  const o = {};
4608
4608
  i[0] & /*mergedOptions*/
4609
4609
  8 && (o.zIndex = /*mergedOptions*/
4610
- n[3].zIndex ?? 1e3), i[0] & /*currentSessionId*/
4610
+ n[3].zIndex || 1e3), i[0] & /*currentSessionId*/
4611
4611
  512 && (o.sessionId = /*currentSessionId*/
4612
4612
  n[9]), e.$set(o);
4613
4613
  },
@@ -4640,7 +4640,7 @@ function al(s) {
4640
4640
  ),
4641
4641
  zIndex: (
4642
4642
  /*mergedOptions*/
4643
- s[3].zIndex ?? 1e3
4643
+ s[3].zIndex || 1e3
4644
4644
  )
4645
4645
  }
4646
4646
  }), {
@@ -4656,7 +4656,7 @@ function al(s) {
4656
4656
  256 && (o.onClose = /*func*/
4657
4657
  n[26]), i[0] & /*mergedOptions*/
4658
4658
  8 && (o.zIndex = /*mergedOptions*/
4659
- n[3].zIndex ?? 1e3), e.$set(o);
4659
+ n[3].zIndex || 1e3), e.$set(o);
4660
4660
  },
4661
4661
  i(n) {
4662
4662
  t || (Ce(e.$$.fragment, n), t = !0);
@@ -4684,7 +4684,7 @@ function cl(s) {
4684
4684
  s[2]
4685
4685
  ), N(t, "width", n), r(a, "d", "M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"), r(a, "fill", "#6F8698"), r(c, "d", "M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"), r(c, "fill", "#3677FF"), r(u, "d", "M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"), r(u, "fill", "#D0D5F1"), r(h, "d", "M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"), r(h, "fill", "#3677FF"), r(p, "d", "M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"), r(p, "fill", "#FFFFFF"), r(g, "d", "M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"), r(g, "fill", "#FFFFFF"), r(d, "d", "M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"), r(d, "fill", "#8896A4"), r(l, "class", "sy-assistant-icon"), r(l, "viewBox", "0 0 1024 1024"), r(l, "version", "1.1"), r(l, "xmlns", "http://www.w3.org/2000/svg"), r(l, "width", "32"), r(l, "height", "32"), r(l, "fill", "currentColor"), r(l, "aria-label", "助手图标"), r(o, "class", "sy-assistant-floating-button svelte-1dubpto"), r(o, "aria-label", "打开助手"), r(o, "style", w = /*buttonStyle*/
4686
4686
  s[10] + " z-index: " + /*mergedOptions*/
4687
- ((s[3].zIndex ?? 1e3) + 1) + ";"), r(e, "class", "sy-assistant-container sy-assistant-theme svelte-1dubpto"), Q(
4687
+ ((s[3].zIndex || 1e3) + 1) + ";"), r(e, "class", "sy-assistant-container sy-assistant-theme svelte-1dubpto"), Q(
4688
4688
  e,
4689
4689
  "fullscreen",
4690
4690
  /*isFullscreen*/
@@ -4726,7 +4726,7 @@ function cl(s) {
4726
4726
  e,
4727
4727
  "z-index",
4728
4728
  /*mergedOptions*/
4729
- s[3].zIndex ?? 1e3
4729
+ s[3].zIndex || 1e3
4730
4730
  );
4731
4731
  },
4732
4732
  m(_, k) {
@@ -4759,7 +4759,7 @@ function cl(s) {
4759
4759
  _[12]}px`) && N(t, "width", n), (!E || k[0] & /*buttonStyle, mergedOptions*/
4760
4760
  1032 && w !== (w = /*buttonStyle*/
4761
4761
  _[10] + " z-index: " + /*mergedOptions*/
4762
- ((_[3].zIndex ?? 1e3) + 1) + ";")) && r(o, "style", w), (!E || k[0] & /*isFullscreen*/
4762
+ ((_[3].zIndex || 1e3) + 1) + ";")) && r(o, "style", w), (!E || k[0] & /*isFullscreen*/
4763
4763
  4) && Q(
4764
4764
  e,
4765
4765
  "fullscreen",
@@ -4809,7 +4809,7 @@ function cl(s) {
4809
4809
  e,
4810
4810
  "z-index",
4811
4811
  /*mergedOptions*/
4812
- _[3].zIndex ?? 1e3
4812
+ _[3].zIndex || 1e3
4813
4813
  );
4814
4814
  },
4815
4815
  i(_) {
@@ -4904,8 +4904,8 @@ function ul(s, e, t) {
4904
4904
  t(2, P = !P), P ? (I.width || (I = {
4905
4905
  width: u.width,
4906
4906
  height: u.height,
4907
- right: ((O = u.defaultPosition) == null ? void 0 : O.right) ?? ue,
4908
- bottom: ((ee = u.defaultPosition) == null ? void 0 : ee.bottom) ?? ue
4907
+ right: ((O = u.defaultPosition) == null ? void 0 : O.right) || ue,
4908
+ bottom: ((ee = u.defaultPosition) == null ? void 0 : ee.bottom) || ue
4909
4909
  }), B && t(7, B = !1), t(20, p = {
4910
4910
  ...n,
4911
4911
  width: window.innerWidth,
@@ -4916,7 +4916,7 @@ function ul(s, e, t) {
4916
4916
  width: u.width,
4917
4917
  height: u.height,
4918
4918
  drawerWidth: u.drawerWidth
4919
- }), t(0, S = ((F = u.defaultPosition) == null ? void 0 : F.right) ?? ue), t(1, b = ((X = u.defaultPosition) == null ? void 0 : X.bottom) ?? ue));
4919
+ }), t(0, S = ((F = u.defaultPosition) == null ? void 0 : F.right) || ue), t(1, b = ((X = u.defaultPosition) == null ? void 0 : X.bottom) || ue));
4920
4920
  }
4921
4921
  function Ue(O) {
4922
4922
  P || fe(O);
@@ -4938,7 +4938,7 @@ function ul(s, e, t) {
4938
4938
  width: u.width,
4939
4939
  height: u.height,
4940
4940
  drawerWidth: u.drawerWidth
4941
- }), t(0, S = ((O = u.defaultPosition) == null ? void 0 : O.right) ?? ue), t(1, b = ((ee = u.defaultPosition) == null ? void 0 : ee.bottom) ?? ue));
4941
+ }), t(0, S = ((O = u.defaultPosition) == null ? void 0 : O.right) || ue), t(1, b = ((ee = u.defaultPosition) == null ? void 0 : ee.bottom) || ue));
4942
4942
  }
4943
4943
  function de(O) {
4944
4944
  t(8, Z = !1);
@@ -45,4 +45,4 @@ ${e}</tr>
45
45
  `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}switch(o.type){case"escape":{const l=o;n+=t.text(l.text);break}case"html":{const l=o;n+=t.html(l.text);break}case"link":{const l=o;n+=t.link(l.href,l.title,this.parseInline(l.tokens,t));break}case"image":{const l=o;n+=t.image(l.href,l.title,l.text);break}case"strong":{const l=o;n+=t.strong(this.parseInline(l.tokens,t));break}case"em":{const l=o;n+=t.em(this.parseInline(l.tokens,t));break}case"codespan":{const l=o;n+=t.codespan(l.text);break}case"br":{n+=t.br();break}case"del":{const l=o;n+=t.del(this.parseInline(l.tokens,t));break}case"text":{const l=o;n+=t.text(l.text);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class Tt{constructor(e){ne(this,"options");this.options=e||Je}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}ne(Tt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class co{constructor(...e){oi(this,tt);ne(this,"defaults",hn());ne(this,"options",this.setOptions);ne(this,"parse",$t(this,tt,Nn).call(this,Ne.lex,Pe.parse));ne(this,"parseInline",$t(this,tt,Nn).call(this,Ne.lexInline,Pe.parseInline));ne(this,"Parser",Pe);ne(this,"Renderer",Ut);ne(this,"TextRenderer",bn);ne(this,"Lexer",Ne);ne(this,"Tokenizer",Pt);ne(this,"Hooks",Tt);this.use(...e)}walkTokens(e,t){var i,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const a=l;for(const c of a.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of a.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const a=l;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=l;(o=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=t.renderers[o.name];l?t.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=l.apply(this,a)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),i.extensions=t),n.renderer){const o=this.defaults.renderer||new Ut(this.defaults);for(const l in n.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.renderer[a],u=o[a];o[a]=(...p)=>{let h=c.apply(o,p);return h===!1&&(h=u.apply(o,p)),h||""}}i.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Pt(this.defaults);for(const l in n.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const a=l,c=n.tokenizer[a],u=o[a];o[a]=(...p)=>{let h=c.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}i.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new Tt;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.hooks[a],u=o[a];Tt.passThroughHooks.has(l)?o[a]=p=>{if(this.defaults.async)return Promise.resolve(c.call(o,p)).then(g=>u.call(o,g));const h=c.call(o,p);return u.call(o,h)}:o[a]=(...p)=>{let h=c.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}i.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(l.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ne.lex(e,t??this.defaults)}parser(e,t){return Pe.parse(e,t??this.defaults)}}tt=new WeakSet,Nn=function(e,t){return(n,i)=>{const o={...i},l={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const a=$t(this,tt,li).call(this,!!l.silent,!!l.async);if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(c=>e(c,l)).then(c=>l.hooks?l.hooks.processAllTokens(c):c).then(c=>l.walkTokens?Promise.all(this.walkTokens(c,l.walkTokens)).then(()=>c):c).then(c=>t(c,l)).then(c=>l.hooks?l.hooks.postprocess(c):c).catch(a);try{l.hooks&&(n=l.hooks.preprocess(n));let c=e(n,l);l.hooks&&(c=l.hooks.processAllTokens(c)),l.walkTokens&&this.walkTokens(c,l.walkTokens);let u=t(c,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(c){return a(c)}}},li=function(e,t){return n=>{if(n.message+=`
46
46
  Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Re(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const $e=new co;function J(s,e){return $e.parse(s,e)}J.options=J.setOptions=function(s){return $e.setOptions(s),J.defaults=$e.defaults,Kn(J.defaults),J},J.getDefaults=hn,J.defaults=Je,J.use=function(...s){return $e.use(...s),J.defaults=$e.defaults,Kn(J.defaults),J},J.walkTokens=function(s,e){return $e.walkTokens(s,e)},J.parseInline=$e.parseInline,J.Parser=Pe,J.parser=Pe.parse,J.Renderer=Ut,J.TextRenderer=bn,J.Lexer=Ne,J.lexer=Ne.lex,J.Tokenizer=Pt,J.Hooks=Tt,J.parse=J,J.options,J.setOptions,J.use,J.walkTokens,J.parseInline,Pe.parse,Ne.lex;/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:ps,setPrototypeOf:hs,isFrozen:uo,getPrototypeOf:fo,getOwnPropertyDescriptor:po}=Object;let{freeze:ye,seal:Oe,create:ds}=Object,{apply:yn,construct:Tn}=typeof Reflect<"u"&&Reflect;ye||(ye=function(e){return e}),Oe||(Oe=function(e){return e}),yn||(yn=function(e,t,n){return e.apply(t,n)}),Tn||(Tn=function(e,t){return new e(...t)});const jt=Ie(Array.prototype.forEach),gs=Ie(Array.prototype.pop),vt=Ie(Array.prototype.push),Wt=Ie(String.prototype.toLowerCase),vn=Ie(String.prototype.toString),ms=Ie(String.prototype.match),Et=Ie(String.prototype.replace),ho=Ie(String.prototype.indexOf),go=Ie(String.prototype.trim),De=Ie(Object.prototype.hasOwnProperty),Te=Ie(RegExp.prototype.test),St=mo(TypeError);function Ie(s){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return yn(s,e,n)}}function mo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Tn(s,t)}}function q(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wt;hs&&hs(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(uo(e)||(e[n]=o),i=o)}s[i]=!0}return s}function wo(s){for(let e=0;e<s.length;e++)De(s,e)||(s[e]=null);return s}function et(s){const e=ds(null);for(const[t,n]of ps(s))De(s,t)&&(Array.isArray(n)?e[t]=wo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=et(n):e[t]=n);return e}function At(s,e){for(;s!==null;){const n=po(s,e);if(n){if(n.get)return Ie(n.get);if(typeof n.value=="function")return Ie(n.value)}s=fo(s)}function t(){return null}return t}const ws=ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),En=ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Sn=ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ko=ye(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),An=ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_o=ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ks=ye(["#text"]),_s=ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xn=ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),bs=ye(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Gt=ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),bo=Oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yo=Oe(/<%[\w\W]*|[\w\W]*%>/gm),To=Oe(/\$\{[\w\W]*}/gm),vo=Oe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Eo=Oe(/^aria-[\-\w]+$/),ys=Oe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),So=Oe(/^(?:\w+script|data):/i),Ao=Oe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ts=Oe(/^html$/i),xo=Oe(/^[a-z][.\w]*(-[.\w]+)+$/i);var vs=Object.freeze({__proto__:null,ARIA_ATTR:Eo,ATTR_WHITESPACE:Ao,CUSTOM_ELEMENT:xo,DATA_ATTR:vo,DOCTYPE_NAME:Ts,ERB_EXPR:yo,IS_ALLOWED_URI:ys,IS_SCRIPT_OR_DATA:So,MUSTACHE_EXPR:bo,TMPLIT_EXPR:To});const xt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ro=function(){return typeof window>"u"?null:window},Io=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Es=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ss(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ro();const e=D=>Ss(D);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==xt.document)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:p=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:h,DOMParser:g,trustedTypes:d}=s,w=c.prototype,E=At(w,"cloneNode"),z=At(w,"remove"),M=At(w,"nextSibling"),y=At(w,"childNodes"),_=At(w,"parentNode");if(typeof l=="function"){const D=t.createElement("template");D.content&&D.content.ownerDocument&&(t=D.content.ownerDocument)}let k,S="";const{implementation:b,createNodeIterator:A,createDocumentFragment:C,getElementsByTagName:R}=t,{importNode:P}=n;let I=Es();e.isSupported=typeof ps=="function"&&typeof _=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:X,TMPLIT_EXPR:Y,DATA_ATTR:ae,ARIA_ATTR:ce,IS_SCRIPT_OR_DATA:he,ATTR_WHITESPACE:Ee,CUSTOM_ELEMENT:ue}=vs;let{IS_ALLOWED_URI:Fe}=vs,ie=null;const Ge=q({},[...ws,...En,...Sn,...An,...ks]);let se=null;const ke=q({},[..._s,...xn,...bs,...Gt]);let ee=Object.seal(ds(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Se=null,_e=null,qe=!0,O=!0,te=!1,F=!0,V=!1,ze=!0,Ce=!1,Xe=!1,nt=!1,Ve=!1,pt=!1,ht=!1,Yt=!0,Zt=!1;const Cn="user-content-";let Rt=!0,st=!1,T={},j=null;const oe=q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pe=null;const He=q({},["audio","video","img","source","image","track"]);let Qe=null;const Be=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xt="http://www.w3.org/1998/Math/MathML",Vt="http://www.w3.org/2000/svg",Ye="http://www.w3.org/1999/xhtml";let dt=Ye,Ln=!1,Mn=null;const nl=q({},[Xt,Vt,Ye],vn);let Qt=q({},["mi","mo","mn","ms","mtext"]),Kt=q({},["annotation-xml"]);const sl=q({},["title","style","font","a","script"]);let It=null;const il=["application/xhtml+xml","text/html"],ol="text/html";let de=null,gt=null;const ll=t.createElement("form"),Ys=function(f){return f instanceof RegExp||f instanceof Function},On=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(gt&&gt===f)){if((!f||typeof f!="object")&&(f={}),f=et(f),It=il.indexOf(f.PARSER_MEDIA_TYPE)===-1?ol:f.PARSER_MEDIA_TYPE,de=It==="application/xhtml+xml"?vn:Wt,ie=De(f,"ALLOWED_TAGS")?q({},f.ALLOWED_TAGS,de):Ge,se=De(f,"ALLOWED_ATTR")?q({},f.ALLOWED_ATTR,de):ke,Mn=De(f,"ALLOWED_NAMESPACES")?q({},f.ALLOWED_NAMESPACES,vn):nl,Qe=De(f,"ADD_URI_SAFE_ATTR")?q(et(Be),f.ADD_URI_SAFE_ATTR,de):Be,pe=De(f,"ADD_DATA_URI_TAGS")?q(et(He),f.ADD_DATA_URI_TAGS,de):He,j=De(f,"FORBID_CONTENTS")?q({},f.FORBID_CONTENTS,de):oe,Se=De(f,"FORBID_TAGS")?q({},f.FORBID_TAGS,de):{},_e=De(f,"FORBID_ATTR")?q({},f.FORBID_ATTR,de):{},T=De(f,"USE_PROFILES")?f.USE_PROFILES:!1,qe=f.ALLOW_ARIA_ATTR!==!1,O=f.ALLOW_DATA_ATTR!==!1,te=f.ALLOW_UNKNOWN_PROTOCOLS||!1,F=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=f.SAFE_FOR_TEMPLATES||!1,ze=f.SAFE_FOR_XML!==!1,Ce=f.WHOLE_DOCUMENT||!1,Ve=f.RETURN_DOM||!1,pt=f.RETURN_DOM_FRAGMENT||!1,ht=f.RETURN_TRUSTED_TYPE||!1,nt=f.FORCE_BODY||!1,Yt=f.SANITIZE_DOM!==!1,Zt=f.SANITIZE_NAMED_PROPS||!1,Rt=f.KEEP_CONTENT!==!1,st=f.IN_PLACE||!1,Fe=f.ALLOWED_URI_REGEXP||ys,dt=f.NAMESPACE||Ye,Qt=f.MATHML_TEXT_INTEGRATION_POINTS||Qt,Kt=f.HTML_INTEGRATION_POINTS||Kt,ee=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&Ys(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&Ys(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(O=!1),pt&&(Ve=!0),T&&(ie=q({},ks),se=[],T.html===!0&&(q(ie,ws),q(se,_s)),T.svg===!0&&(q(ie,En),q(se,xn),q(se,Gt)),T.svgFilters===!0&&(q(ie,Sn),q(se,xn),q(se,Gt)),T.mathMl===!0&&(q(ie,An),q(se,bs),q(se,Gt))),f.ADD_TAGS&&(ie===Ge&&(ie=et(ie)),q(ie,f.ADD_TAGS,de)),f.ADD_ATTR&&(se===ke&&(se=et(se)),q(se,f.ADD_ATTR,de)),f.ADD_URI_SAFE_ATTR&&q(Qe,f.ADD_URI_SAFE_ATTR,de),f.FORBID_CONTENTS&&(j===oe&&(j=et(j)),q(j,f.FORBID_CONTENTS,de)),Rt&&(ie["#text"]=!0),Ce&&q(ie,["html","head","body"]),ie.table&&(q(ie,["tbody"]),delete Se.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,S=k.createHTML("")}else k===void 0&&(k=Io(d,i)),k!==null&&typeof S=="string"&&(S=k.createHTML(""));ye&&ye(f),gt=f}},Zs=q({},[...En,...Sn,...ko]),Xs=q({},[...An,..._o]),rl=function(f){let v=_(f);(!v||!v.tagName)&&(v={namespaceURI:dt,tagName:"template"});const L=Wt(f.tagName),le=Wt(v.tagName);return Mn[f.namespaceURI]?f.namespaceURI===Vt?v.namespaceURI===Ye?L==="svg":v.namespaceURI===Xt?L==="svg"&&(le==="annotation-xml"||Qt[le]):!!Zs[L]:f.namespaceURI===Xt?v.namespaceURI===Ye?L==="math":v.namespaceURI===Vt?L==="math"&&Kt[le]:!!Xs[L]:f.namespaceURI===Ye?v.namespaceURI===Vt&&!Kt[le]||v.namespaceURI===Xt&&!Qt[le]?!1:!Xs[L]&&(sl[L]||!Zs[L]):!!(It==="application/xhtml+xml"&&Mn[f.namespaceURI]):!1},Ue=function(f){vt(e.removed,{element:f});try{_(f).removeChild(f)}catch{z(f)}},Jt=function(f,v){try{vt(e.removed,{attribute:v.getAttributeNode(f),from:v})}catch{vt(e.removed,{attribute:null,from:v})}if(v.removeAttribute(f),f==="is")if(Ve||pt)try{Ue(v)}catch{}else try{v.setAttribute(f,"")}catch{}},Vs=function(f){let v=null,L=null;if(nt)f="<remove></remove>"+f;else{const ge=ms(f,/^[\r\n\t ]+/);L=ge&&ge[0]}It==="application/xhtml+xml"&&dt===Ye&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const le=k?k.createHTML(f):f;if(dt===Ye)try{v=new g().parseFromString(le,It)}catch{}if(!v||!v.documentElement){v=b.createDocument(dt,"template",null);try{v.documentElement.innerHTML=Ln?S:le}catch{}}const be=v.body||v.documentElement;return f&&L&&be.insertBefore(t.createTextNode(L),be.childNodes[0]||null),dt===Ye?R.call(v,Ce?"html":"body")[0]:Ce?v.documentElement:be},Qs=function(f){return A.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Dn=function(f){return f instanceof h&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof p)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},Ks=function(f){return typeof a=="function"&&f instanceof a};function Ze(D,f,v){jt(D,L=>{L.call(e,f,v,gt)})}const Js=function(f){let v=null;if(Ze(I.beforeSanitizeElements,f,null),Dn(f))return Ue(f),!0;const L=de(f.nodeName);if(Ze(I.uponSanitizeElement,f,{tagName:L,allowedTags:ie}),f.hasChildNodes()&&!Ks(f.firstElementChild)&&Te(/<[/\w]/g,f.innerHTML)&&Te(/<[/\w]/g,f.textContent)||f.nodeType===xt.progressingInstruction||ze&&f.nodeType===xt.comment&&Te(/<[/\w]/g,f.data))return Ue(f),!0;if(!ie[L]||Se[L]){if(!Se[L]&&ei(L)&&(ee.tagNameCheck instanceof RegExp&&Te(ee.tagNameCheck,L)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(L)))return!1;if(Rt&&!j[L]){const le=_(f)||f.parentNode,be=y(f)||f.childNodes;if(be&&le){const ge=be.length;for(let Ae=ge-1;Ae>=0;--Ae){const je=E(be[Ae],!0);je.__removalCount=(f.__removalCount||0)+1,le.insertBefore(je,M(f))}}}return Ue(f),!0}return f instanceof c&&!rl(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&Te(/<\/no(script|embed|frames)/i,f.innerHTML)?(Ue(f),!0):(V&&f.nodeType===xt.text&&(v=f.textContent,jt([B,X,Y],le=>{v=Et(v,le," ")}),f.textContent!==v&&(vt(e.removed,{element:f.cloneNode()}),f.textContent=v)),Ze(I.afterSanitizeElements,f,null),!1)},$s=function(f,v,L){if(Yt&&(v==="id"||v==="name")&&(L in t||L in ll))return!1;if(!(O&&!_e[v]&&Te(ae,v))){if(!(qe&&Te(ce,v))){if(!se[v]||_e[v]){if(!(ei(f)&&(ee.tagNameCheck instanceof RegExp&&Te(ee.tagNameCheck,f)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(f))&&(ee.attributeNameCheck instanceof RegExp&&Te(ee.attributeNameCheck,v)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(v))||v==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&Te(ee.tagNameCheck,L)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(L))))return!1}else if(!Qe[v]){if(!Te(Fe,Et(L,Ee,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&f!=="script"&&ho(L,"data:")===0&&pe[f])){if(!(te&&!Te(he,Et(L,Ee,"")))){if(L)return!1}}}}}}return!0},ei=function(f){return f!=="annotation-xml"&&ms(f,ue)},ti=function(f){Ze(I.beforeSanitizeAttributes,f,null);const{attributes:v}=f;if(!v||Dn(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let le=v.length;for(;le--;){const be=v[le],{name:ge,namespaceURI:Ae,value:je}=be,zt=de(ge);let ve=ge==="value"?je:go(je);if(L.attrName=zt,L.attrValue=ve,L.keepAttr=!0,L.forceKeepAttr=void 0,Ze(I.uponSanitizeAttribute,f,L),ve=L.attrValue,Zt&&(zt==="id"||zt==="name")&&(Jt(ge,f),ve=Cn+ve),ze&&Te(/((--!?|])>)|<\/(style|title)/i,ve)){Jt(ge,f);continue}if(L.forceKeepAttr||(Jt(ge,f),!L.keepAttr))continue;if(!F&&Te(/\/>/i,ve)){Jt(ge,f);continue}V&&jt([B,X,Y],si=>{ve=Et(ve,si," ")});const ni=de(f.nodeName);if($s(ni,zt,ve)){if(k&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Ae)switch(d.getAttributeType(ni,zt)){case"TrustedHTML":{ve=k.createHTML(ve);break}case"TrustedScriptURL":{ve=k.createScriptURL(ve);break}}try{Ae?f.setAttributeNS(Ae,ge,ve):f.setAttribute(ge,ve),Dn(f)?Ue(f):gs(e.removed)}catch{}}}Ze(I.afterSanitizeAttributes,f,null)},al=function D(f){let v=null;const L=Qs(f);for(Ze(I.beforeSanitizeShadowDOM,f,null);v=L.nextNode();)Ze(I.uponSanitizeShadowNode,v,null),Js(v),ti(v),v.content instanceof o&&D(v.content);Ze(I.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(D){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,L=null,le=null,be=null;if(Ln=!D,Ln&&(D="<!-->"),typeof D!="string"&&!Ks(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw St("dirty is not a string, aborting")}else throw St("toString is not a function");if(!e.isSupported)return D;if(Xe||On(f),e.removed=[],typeof D=="string"&&(st=!1),st){if(D.nodeName){const je=de(D.nodeName);if(!ie[je]||Se[je])throw St("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof a)v=Vs("<!---->"),L=v.ownerDocument.importNode(D,!0),L.nodeType===xt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?v=L:v.appendChild(L);else{if(!Ve&&!V&&!Ce&&D.indexOf("<")===-1)return k&&ht?k.createHTML(D):D;if(v=Vs(D),!v)return Ve?null:ht?S:""}v&&nt&&Ue(v.firstChild);const ge=Qs(st?D:v);for(;le=ge.nextNode();)Js(le),ti(le),le.content instanceof o&&al(le.content);if(st)return D;if(Ve){if(pt)for(be=C.call(v.ownerDocument);v.firstChild;)be.appendChild(v.firstChild);else be=v;return(se.shadowroot||se.shadowrootmode)&&(be=P.call(n,be,!0)),be}let Ae=Ce?v.outerHTML:v.innerHTML;return Ce&&ie["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&Te(Ts,v.ownerDocument.doctype.name)&&(Ae="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
47
47
  `+Ae),V&&jt([B,X,Y],je=>{Ae=Et(Ae,je," ")}),k&&ht?k.createHTML(Ae):Ae},e.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};On(D),Xe=!0},e.clearConfig=function(){gt=null,Xe=!1},e.isValidAttribute=function(D,f,v){gt||On({});const L=de(D),le=de(f);return $s(L,le,v)},e.addHook=function(D,f){typeof f=="function"&&vt(I[D],f)},e.removeHook=function(D){return gs(I[D])},e.removeHooks=function(D){I[D]=[]},e.removeAllHooks=function(){I=Es()},e}var As=Ss();function xs(s,e,t){const n=s.slice();return n[24]=e[t],n}function Rs(s){let e,t=s[9].text+"",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),N(e,"left",s[9].x+"px"),N(e,"top",s[9].y+"px"),N(e,"z-index",s[3]+3)},m(i,o){W(i,e,o),m(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&Le(n,t),o&512&&N(e,"left",i[9].x+"px"),o&512&&N(e,"top",i[9].y+"px"),o&8&&N(e,"z-index",i[3]+3)},d(i){i&&U(e)}}}function zo(s){let e=[],t=new Map,n,i,o=ut(s[0]);const l=c=>c[24].id;for(let c=0;c<o.length;c+=1){let u=xs(s,o,c),p=l(u);t.set(p,e[c]=Is(p,u))}let a=s[5]&&zs();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=G(),a&&a.c(),i=Lt()},m(c,u){for(let p=0;p<e.length;p+=1)e[p]&&e[p].m(c,u);W(c,n,u),a&&a.m(c,u),W(c,i,u)},p(c,u){u&8261&&(o=ut(c[0]),e=Zn(e,u,l,1,c,o,t,n.parentNode,Yn,Is,n,xs)),c[5]?a||(a=zs(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},d(c){c&&(U(n),U(i));for(let u=0;u<e.length;u+=1)e[u].d(c);a&&a.d(c)}}}function Co(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){W(i,e,o),m(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Le(n,t)},d(i){i&&U(e)}}}function Is(s,e){let t,n,i,o,l=e[24].title+"",a,c,u,p=Ls(e[24].timestamp)+"",h,g,d,w,E,z,M,y,_,k,S;function b(){return e[17](e[24])}function A(...C){return e[18](e[24],...C)}return{key:s,first:null,c(){t=x("div"),n=x("button"),i=x("div"),o=x("div"),a=we(l),c=G(),u=x("div"),h=we(p),g=G(),d=x("button"),w=Q("svg"),E=Q("path"),z=Q("path"),M=Q("path"),r(o,"class","sy-session-title svelte-1g6fj9a"),r(u,"class","sy-session-time svelte-1g6fj9a"),r(i,"class","sy-session-info svelte-1g6fj9a"),r(n,"class","sy-session-select svelte-1g6fj9a"),r(E,"d","M3 6h18"),r(z,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),r(M,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),r(w,"xmlns","http://www.w3.org/2000/svg"),r(w,"width","16"),r(w,"height","16"),r(w,"viewBox","0 0 24 24"),r(w,"fill","none"),r(w,"stroke","currentColor"),r(w,"stroke-width","2"),r(w,"stroke-linecap","round"),r(w,"stroke-linejoin","round"),r(d,"class","sy-session-delete svelte-1g6fj9a"),d.disabled=y=e[6]===e[24].id,r(d,"aria-label","删除会话"),r(t,"class","sy-session-item svelte-1g6fj9a"),r(t,"data-session-id",_=e[24].id),K(t,"deleting",e[24].deleting),this.first=t},m(C,R){W(C,t,R),m(t,n),m(n,i),m(i,o),m(o,a),m(i,c),m(i,u),m(u,h),m(t,g),m(t,d),m(d,w),m(w,E),m(w,z),m(w,M),k||(S=[H(n,"click",b),H(d,"click",A)],k=!0)},p(C,R){e=C,R&1&&l!==(l=e[24].title+"")&&Le(a,l),R&1&&p!==(p=Ls(e[24].timestamp)+"")&&Le(h,p),R&65&&y!==(y=e[6]===e[24].id)&&(d.disabled=y),R&1&&_!==(_=e[24].id)&&r(t,"data-session-id",_),R&1&&K(t,"deleting",e[24].deleting)},d(C){C&&U(t),k=!1,me(S)}}}function zs(s){let e;return{c(){e=x("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',r(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Cs(s){let e,t,n,i,o,l,a,c,u;return{c(){e=x("div"),t=x("div"),t.textContent="确认删除此会话?",n=G(),i=x("div"),o=x("button"),o.textContent="取消",l=G(),a=x("button"),a.textContent="删除",r(t,"class","sy-session-confirm-content svelte-1g6fj9a"),r(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),r(a,"class","sy-session-confirm-delete svelte-1g6fj9a"),r(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),r(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),N(e,"left",s[8].x+"px"),N(e,"top",s[8].y+"px"),N(e,"z-index",s[3]+3)},m(p,h){W(p,e,h),m(e,t),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[H(o,"click",s[19]),H(a,"click",s[14])],c=!0)},p(p,h){h&256&&N(e,"left",p[8].x+"px"),h&256&&N(e,"top",p[8].y+"px"),h&8&&N(e,"z-index",p[3]+3)},d(p){p&&U(e),c=!1,me(u)}}}function Lo(s){let e,t,n,i,o,l,a,c,u,p,h,g,d,w,E,z,M,y,_,k=s[9]&&Rs(s);function S(R,P){return R[0].length===0?Co:zo}let b=S(s),A=b(s),C=s[7]&&Cs(s);return{c(){e=x("div"),t=x("div"),n=x("h2"),n.textContent="历史会话",i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',l=G(),a=x("div"),c=x("input"),u=G(),p=Q("svg"),h=Q("circle"),g=Q("line"),d=G(),k&&k.c(),w=G(),E=x("div"),A.c(),z=G(),C&&C.c(),M=Lt(),r(n,"class","svelte-1g6fj9a"),r(o,"class","sy-session-close svelte-1g6fj9a"),r(o,"aria-label","关闭历史会话"),r(t,"class","sy-session-header svelte-1g6fj9a"),r(c,"type","text"),r(c,"class","sy-session-search-input svelte-1g6fj9a"),r(c,"placeholder","搜索历史会话..."),r(h,"cx","11"),r(h,"cy","11"),r(h,"r","8"),r(g,"x1","21"),r(g,"y1","21"),r(g,"x2","16.65"),r(g,"y2","16.65"),r(p,"class","sy-session-search-icon svelte-1g6fj9a"),r(p,"xmlns","http://www.w3.org/2000/svg"),r(p,"width","16"),r(p,"height","16"),r(p,"viewBox","0 0 24 24"),r(p,"fill","none"),r(p,"stroke","currentColor"),r(p,"stroke-width","2"),r(p,"stroke-linecap","round"),r(p,"stroke-linejoin","round"),r(a,"class","sy-session-search svelte-1g6fj9a"),r(E,"class","sy-session-list svelte-1g6fj9a"),r(e,"class","sy-session-history svelte-1g6fj9a"),N(e,"z-index",s[3]+2)},m(R,P){W(R,e,P),m(e,t),m(t,n),m(t,i),m(t,o),m(e,l),m(e,a),m(a,c),ot(c,s[4]),m(a,u),m(a,p),m(p,h),m(p,g),m(e,d),k&&k.m(e,null),m(e,w),m(e,E),A.m(E,null),W(R,z,P),C&&C.m(R,P),W(R,M,P),y||(_=[H(o,"click",function(){en(s[1])&&s[1].apply(this,arguments)}),H(o,"mouseenter",s[15]),H(o,"mouseleave",s[12]),H(c,"input",s[16]),H(E,"scroll",s[10])],y=!0)},p(R,[P]){s=R,P&16&&c.value!==s[4]&&ot(c,s[4]),s[9]?k?k.p(s,P):(k=Rs(s),k.c(),k.m(e,w)):k&&(k.d(1),k=null),b===(b=S(s))&&A?A.p(s,P):(A.d(1),A=b(s),A&&(A.c(),A.m(E,null))),P&8&&N(e,"z-index",s[3]+2),s[7]?C?C.p(s,P):(C=Cs(s),C.c(),C.m(M.parentNode,M)):C&&(C.d(1),C=null)},i:Z,o:Z,d(R){R&&(U(e),U(z),U(M)),k&&k.d(),A.d(),C&&C.d(R),y=!1,me(_)}}}const Rn=10;function Ls(s){return new Date(s).toLocaleString()}function Mo(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:o}=e,{zIndex:l}=e,a=!1,c=!0,u=0,p="",h=null,g=null,d={x:0,y:0};async function w(){if(!(a||!c)){t(5,a=!0);try{const I=await fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({start:u,length:Rn,keyword:p})});if(!I.ok)throw new Error("Failed to load sessions");const B=await I.json();if(B.code===0){const X=B.data.sessionList.map(Y=>({id:Y.session_id,title:Y.name,timestamp:new Date(Y.createDate).getTime()}));t(0,n=[...n,...X]),u+=Rn,c=X.length===Rn}}catch(I){console.error("Failed to load sessions:",I)}finally{t(5,a=!1)}}}function E(I){const B=I.target,{scrollTop:X,scrollHeight:Y,clientHeight:ae}=B;Y-X-ae<50&&w()}Wn(()=>{w()});let z=null;function M(I,B){const Y=I.currentTarget.getBoundingClientRect();t(9,z={text:B,x:Y.left+Y.width/2,y:Y.bottom+8})}function y(){t(9,z=null)}function _(I,B){const Y=I.currentTarget.getBoundingClientRect();t(8,d={x:Y.left-16,y:Y.top+Y.height/2}),t(7,g=B)}async function k(I){if(I&&!h)try{t(6,h=I),t(7,g=null);const B=document.querySelector(`[data-session-id="${I}"]`);B&&B.classList.add("deleting"),await new Promise(ae=>setTimeout(ae,300));const X=await fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:I})});if(!X.ok)throw new Error("Delete request failed");const Y=await X.json();if(Y.code===0&&Y.data.respCode===0)t(0,n=n.map(ae=>({...ae,deleting:ae.id===I}))),setTimeout(()=>{t(0,n=n.filter(ae=>!ae.deleting))},300);else throw new Error("Delete failed: "+Y.message)}catch(B){console.error("Failed to delete session:",B);const X=document.querySelector(`[data-session-id="${I}"]`);X&&X.classList.remove("deleting")}finally{t(6,h=null)}}function S(){g&&k(g)}const b=I=>M(I,"关闭历史会话");function A(){p=this.value,t(4,p)}const C=I=>o(I.id),R=(I,B)=>_(B,I.id),P=()=>t(7,g=null);return s.$$set=I=>{"sessions"in I&&t(0,n=I.sessions),"onClose"in I&&t(1,i=I.onClose),"onSelect"in I&&t(2,o=I.onSelect),"zIndex"in I&&t(3,l=I.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&p!==void 0&&(t(0,n=[]),u=0,c=!0,w())},[n,i,o,l,p,a,h,g,d,z,E,M,y,_,S,b,A,C,R,P]}class Ms extends un{constructor(e){super(),cn(this,e,Mo,Lo,Ct,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function Os(s,e,t){const n=s.slice();return n[60]=e[t],n[61]=e,n[62]=t,n}function Ds(s,e,t){const n=s.slice();return n[63]=e[t],n[65]=t,n}function Oo(s){let e,t=[],n=new Map,i=ut(s[3]);const o=l=>l[60].id;for(let l=0;l<i.length;l+=1){let a=Os(s,i,l),c=o(a);n.set(c,t[l]=js(c,a))}return{c(){e=x("div");for(let l=0;l<t.length;l+=1)t[l].c();r(e,"class","sy-assistant-message-list svelte-46wzni")},m(l,a){W(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[46](e)},p(l,a){a[0]&267665145&&(i=ut(l[3]),t=Zn(t,a,o,1,l,i,n,e,Yn,js,null,Os))},i:Z,o:Z,d(l){l&&U(e);for(let a=0;a<t.length;a+=1)t[a].d();s[46](null)}}}function Do(s){let e,t;return e=new Ms({props:{sessions:s[16],onClose:s[29],onSelect:s[30],zIndex:s[0]}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&65536&&(o.sessions=n[16]),i[0]&1&&(o.zIndex=n[0]),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function No(s){let e;return{c(){e=x("div"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></svg>',r(e,"class","sy-assistant-avatar user svelte-46wzni")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Po(s){let e;return{c(){e=x("div"),e.innerHTML='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor"><path d="M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z" fill="#6F8698"></path><path d="M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z" fill="#3677FF"></path><path d="M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z" fill="#D0D5F1"></path><path d="M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z" fill="#3677FF"></path><path d="M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z" fill="#8896A4"></path></svg>',r(e,"class","sy-assistant-avatar assistant svelte-46wzni")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Fo(s){let e,t=s[18](s[60].content)+"";return{c(){e=x("div"),r(e,"class","markdown-content svelte-46wzni")},m(n,i){W(n,e,i),e.innerHTML=t},p(n,i){i[0]&8&&t!==(t=n[18](n[60].content)+"")&&(e.innerHTML=t)},d(n){n&&U(e)}}}function Ho(s){let e;return{c(){e=x("span"),e.innerHTML='<span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span>',r(e,"class","sy-assistant-loading svelte-46wzni")},m(t,n){W(t,e,n)},p:Z,d(t){t&&U(e)}}}function Ns(s){let e,t=ut(s[60].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=Hs(Ds(s,t,i));return{c(){e=x("div");for(let i=0;i<n.length;i+=1)n[i].c();r(e,"class","sy-assistant-attachments svelte-46wzni")},m(i,o){W(i,e,o);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(e,null)},p(i,o){if(o[0]&3145849){t=ut(i[60].attachments);let l;for(l=0;l<t.length;l+=1){const a=Ds(i,t,l);n[l]?n[l].p(a,o):(n[l]=Hs(a),n[l].c(),n[l].m(e,null))}for(;l<n.length;l+=1)n[l].d(1);n.length=t.length}},d(i){i&&U(e),ui(n,i)}}}function Ps(s){let e,t,n;function i(...o){return s[33](s[63],...o)}return{c(){e=x("button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',r(e,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(e,"aria-label","查看详情")},m(o,l){W(o,e,l),t||(n=[H(e,"mouseenter",i),H(e,"mouseleave",s[21])],t=!0)},p(o,l){s=o},d(o){o&&U(e),t=!1,me(n)}}}function Fs(s){let e,t=s[4].replace(/\n/g,"<br>")+"",n,i;return{c(){e=x("div"),r(e,"class","sy-assistant-tooltip svelte-46wzni"),r(e,"role","tooltip"),N(e,"left",s[5].x+"px"),N(e,"top",s[5].y+"px"),N(e,"z-index",s[0]+3),K(e,"align-right",s[5].alignRight)},m(o,l){W(o,e,l),e.innerHTML=t,n||(i=[H(e,"mouseenter",s[35]),H(e,"mouseleave",s[36])],n=!0)},p(o,l){l[0]&16&&t!==(t=o[4].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&32&&N(e,"left",o[5].x+"px"),l[0]&32&&N(e,"top",o[5].y+"px"),l[0]&1&&N(e,"z-index",o[0]+3),l[0]&32&&K(e,"align-right",o[5].alignRight)},d(o){o&&U(e),n=!1,me(i)}}}function Hs(s){let e,t,n,i,o,l,a,c,u,p=qt(s[63].content_title).name+"",h,g,d,w=qt(s[63].content_title).ext+"",E,z,M,y,_,k,S,b,A,C,R=s[63].tips&&Ps(s);function P(){return s[34](s[63])}let I=s[4]&&Fs(s);return{c(){e=x("div"),t=x("div"),n=x("div"),i=Q("svg"),o=Q("path"),l=Q("polyline"),a=G(),c=x("div"),u=x("span"),h=we(p),g=G(),d=x("span"),E=we(w),M=G(),y=x("div"),R&&R.c(),_=G(),k=x("button"),k.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>',S=G(),I&&I.c(),b=G(),r(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),r(l,"points","13 2 13 9 20 9"),r(i,"xmlns","http://www.w3.org/2000/svg"),r(i,"width","16"),r(i,"height","16"),r(i,"viewBox","0 0 24 24"),r(i,"fill","none"),r(i,"stroke","currentColor"),r(i,"stroke-width","2"),r(i,"stroke-linecap","round"),r(i,"stroke-linejoin","round"),r(u,"class","sy-assistant-filename svelte-46wzni"),r(d,"class","sy-assistant-attachment-ext svelte-46wzni"),r(c,"class","sy-assistant-attachment-name svelte-46wzni"),r(c,"title",z=s[63].content_title),r(n,"class","sy-assistant-attachment-title svelte-46wzni"),r(k,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(k,"aria-label","下载文件"),r(y,"class","sy-assistant-attachment-actions svelte-46wzni"),r(t,"class","sy-assistant-attachment-header svelte-46wzni"),r(e,"class","sy-assistant-attachment svelte-46wzni")},m(B,X){W(B,e,X),m(e,t),m(t,n),m(n,i),m(i,o),m(i,l),m(n,a),m(n,c),m(c,u),m(u,h),m(c,g),m(c,d),m(d,E),m(t,M),m(t,y),R&&R.m(y,null),m(y,_),m(y,k),m(e,S),I&&I.m(e,null),m(e,b),A||(C=H(k,"click",P),A=!0)},p(B,X){s=B,X[0]&8&&p!==(p=qt(s[63].content_title).name+"")&&Le(h,p),X[0]&8&&w!==(w=qt(s[63].content_title).ext+"")&&Le(E,w),X[0]&8&&z!==(z=s[63].content_title)&&r(c,"title",z),s[63].tips?R?R.p(s,X):(R=Ps(s),R.c(),R.m(y,_)):R&&(R.d(1),R=null),s[4]?I?I.p(s,X):(I=Fs(s),I.c(),I.m(e,b)):I&&(I.d(1),I=null)},d(B){B&&U(e),R&&R.d(),I&&I.d(),A=!1,C()}}}function Bs(s){let e,t,n,i,o,l,a,c,u,p,h;function g(b,A){return b[9][b[60].id]?Uo:Bo}let d=g(s),w=d(s);function E(){return s[37](s[60])}function z(...b){return s[38](s[60],...b)}function M(){return s[39](s[60])}function y(...b){return s[40](s[60],...b)}function _(...b){return s[41](s[60],...b)}function k(...b){return s[42](s[60],...b)}let S=s[12]&&s[10][s[60].id]==="dislike"&&Us(s);return{c(){e=x("div"),t=x("button"),w.c(),i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',l=G(),a=x("button"),a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h3a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-3"></path></svg>',c=G(),S&&S.c(),u=Lt(),r(t,"class","sy-assistant-action-button svelte-46wzni"),r(t,"aria-label",n=s[9][s[60].id]?"已复制":"复制内容"),K(t,"copied",s[9][s[60].id]),r(o,"class","sy-assistant-action-button svelte-46wzni"),r(o,"aria-label","点赞"),K(o,"active",s[10][s[60].id]==="like"),r(a,"class","sy-assistant-action-button svelte-46wzni"),r(a,"aria-label","点踩"),K(a,"active",s[10][s[60].id]==="dislike"),r(e,"class","sy-assistant-message-actions svelte-46wzni")},m(b,A){W(b,e,A),m(e,t),w.m(t,null),m(e,i),m(e,o),m(e,l),m(e,a),W(b,c,A),S&&S.m(b,A),W(b,u,A),p||(h=[H(t,"click",E),H(t,"mouseenter",z),H(t,"mouseleave",s[27]),H(o,"click",M),H(o,"mouseenter",y),H(o,"mouseleave",s[27]),H(a,"click",_),H(a,"mouseenter",k),H(a,"mouseleave",s[27])],p=!0)},p(b,A){s=b,d!==(d=g(s))&&(w.d(1),w=d(s),w&&(w.c(),w.m(t,null))),A[0]&520&&n!==(n=s[9][s[60].id]?"已复制":"复制内容")&&r(t,"aria-label",n),A[0]&520&&K(t,"copied",s[9][s[60].id]),A[0]&1032&&K(o,"active",s[10][s[60].id]==="like"),A[0]&1032&&K(a,"active",s[10][s[60].id]==="dislike"),s[12]&&s[10][s[60].id]==="dislike"?S?S.p(s,A):(S=Us(s),S.c(),S.m(u.parentNode,u)):S&&(S.d(1),S=null)},d(b){b&&(U(e),U(c),U(u)),w.d(),S&&S.d(b),p=!1,me(h)}}}function Bo(s){let e,t,n;return{c(){e=Q("svg"),t=Q("rect"),n=Q("path"),r(t,"x","9"),r(t,"y","9"),r(t,"width","13"),r(t,"height","13"),r(t,"rx","2"),r(t,"ry","2"),r(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(i,o){W(i,e,o),m(e,t),m(e,n)},d(i){i&&U(e)}}}function Uo(s){let e,t;return{c(){e=Q("svg"),t=Q("polyline"),r(t,"points","20 6 9 17 4 12"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(n,i){W(n,e,i),m(e,t)},d(n){n&&U(e)}}}function Us(s){let e,t,n,i,o,l,a,c,u;function p(){s[43].call(t,s[60])}function h(){return s[44](s[60])}function g(){return s[45](s[60])}return{c(){e=x("div"),t=x("textarea"),n=G(),i=x("div"),o=x("button"),o.textContent="取消",l=G(),a=x("button"),a.textContent="提交",r(t,"class","sy-assistant-dislike-input svelte-46wzni"),r(t,"placeholder","请输入您的反馈意见..."),r(o,"class","sy-assistant-popup-cancel svelte-46wzni"),r(a,"class","sy-assistant-popup-submit svelte-46wzni"),r(i,"class","sy-assistant-popup-actions svelte-46wzni"),r(e,"class","sy-assistant-dislike-popup svelte-46wzni"),N(e,"left",s[13].x+"px"),N(e,"top",s[13].y+"px"),N(e,"z-index",s[0]+3)},m(d,w){W(d,e,w),m(e,t),ot(t,s[11][s[60].id]),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[H(t,"input",p),H(o,"click",h),H(a,"click",g)],c=!0)},p(d,w){s=d,w[0]&2056&&ot(t,s[11][s[60].id]),w[0]&8192&&N(e,"left",s[13].x+"px"),w[0]&8192&&N(e,"top",s[13].y+"px"),w[0]&1&&N(e,"z-index",s[0]+3)},d(d){d&&U(e),c=!1,me(u)}}}function js(s,e){let t,n,i,o,l,a,c,u,p=new Date(e[60].timestamp).toLocaleTimeString()+"",h,g;function d(S,b){return S[60].type==="assistant"?Po:No}let w=d(e),E=w(e);function z(S,b){return S[7]&&S[60].id===S[3][S[3].length-1].id&&S[60].type==="assistant"&&!S[60].content?Ho:Fo}let M=z(e),y=M(e),_=e[60].attachments&&Ns(e),k=e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]&&Bs(e);return{key:s,first:null,c(){t=x("div"),E.c(),n=G(),i=x("div"),o=x("div"),y.c(),l=G(),_&&_.c(),a=G(),k&&k.c(),c=G(),u=x("div"),h=we(p),g=G(),r(o,"class","sy-assistant-message-content svelte-46wzni"),r(u,"class","sy-assistant-message-time svelte-46wzni"),r(i,"class","sy-assistant-message-bubble svelte-46wzni"),r(t,"class","sy-assistant-message svelte-46wzni"),K(t,"user",e[60].type==="user"),this.first=t},m(S,b){W(S,t,b),E.m(t,null),m(t,n),m(t,i),m(i,o),y.m(o,null),m(o,l),_&&_.m(o,null),m(o,a),k&&k.m(o,null),m(i,c),m(i,u),m(u,h),m(t,g)},p(S,b){e=S,w!==(w=d(e))&&(E.d(1),E=w(e),E&&(E.c(),E.m(t,n))),M===(M=z(e))&&y?y.p(e,b):(y.d(1),y=M(e),y&&(y.c(),y.m(o,l))),e[60].attachments?_?_.p(e,b):(_=Ns(e),_.c(),_.m(o,a)):_&&(_.d(1),_=null),e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]?k?k.p(e,b):(k=Bs(e),k.c(),k.m(o,null)):k&&(k.d(1),k=null),b[0]&8&&p!==(p=new Date(e[60].timestamp).toLocaleTimeString()+"")&&Le(h,p),b[0]&8&&K(t,"user",e[60].type==="user")},d(S){S&&U(t),E.d(),y.d(),_&&_.d(),k&&k.d()}}}function Ws(s){let e,t,n,i,o,l,a,c,u,p,h,g,d,w,E,z,M,y,_,k,S,b,A,C;return{c(){e=x("div"),t=x("div"),n=x("button"),n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',l=G(),a=x("div"),c=x("div"),u=x("div"),p=x("div"),h=x("textarea"),g=G(),d=x("div"),w=we(s[2]),E=we("/"),z=we(In),M=G(),y=x("button"),_=Q("svg"),k=Q("line"),S=Q("polygon"),r(n,"class","sy-assistant-icon-button svelte-46wzni"),r(n,"aria-label","历史会话"),r(o,"class","sy-assistant-icon-button svelte-46wzni"),r(o,"aria-label","新建会话"),r(t,"class","sy-assistant-chat-actions svelte-46wzni"),r(e,"class","sy-assistant-chat-footer svelte-46wzni"),r(h,"class","sy-assistant-textarea svelte-46wzni"),r(h,"placeholder","输入您的问题..."),r(h,"maxlength",In),r(h,"rows","3"),r(d,"class","sy-assistant-char-count svelte-46wzni"),K(d,"over-limit",s[17]),r(p,"class","sy-assistant-textarea-container svelte-46wzni"),r(u,"class","sy-assistant-input-wrapper svelte-46wzni"),r(k,"x1","22"),r(k,"y1","2"),r(k,"x2","11"),r(k,"y2","13"),r(S,"points","22 2 15 22 11 13 2 9 22 2"),r(_,"xmlns","http://www.w3.org/2000/svg"),r(_,"width","20"),r(_,"height","20"),r(_,"viewBox","0 0 24 24"),r(_,"fill","none"),r(_,"stroke","currentColor"),r(_,"stroke-width","2"),r(_,"stroke-linecap","round"),r(_,"stroke-linejoin","round"),r(y,"class","sy-assistant-send-button svelte-46wzni"),y.disabled=b=!s[1].trim()||s[17],r(y,"aria-label","发送消息"),r(c,"class","sy-assistant-input-container svelte-46wzni"),r(a,"class","sy-assistant-input-area svelte-46wzni")},m(R,P){W(R,e,P),m(e,t),m(t,n),m(t,i),m(t,o),W(R,l,P),W(R,a,P),m(a,c),m(c,u),m(u,p),m(p,h),ot(h,s[1]),m(p,g),m(p,d),m(d,w),m(d,E),m(d,z),m(c,M),m(c,y),m(y,_),m(_,k),m(_,S),A||(C=[H(n,"click",s[28]),H(n,"mouseenter",s[47]),H(n,"mouseleave",s[27]),H(n,"blur",s[27]),H(o,"click",s[31]),H(o,"mouseenter",s[48]),H(o,"mouseleave",s[27]),H(h,"input",s[49]),H(h,"keydown",s[50]),H(y,"click",s[19]),H(y,"mouseenter",s[51]),H(y,"mouseleave",s[27])],A=!0)},p(R,P){P[0]&2&&ot(h,R[1]),P[0]&4&&Le(w,R[2]),P[0]&131072&&K(d,"over-limit",R[17]),P[0]&131074&&b!==(b=!R[1].trim()||R[17])&&(y.disabled=b)},d(R){R&&(U(e),U(l),U(a)),A=!1,me(C)}}}function Gs(s){let e,t=s[14].text+"",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-assistant-button-tooltip svelte-46wzni"),N(e,"left",s[14].x+"px"),N(e,"top",s[14].y+"px")},m(i,o){W(i,e,o),m(e,n)},p(i,o){o[0]&16384&&t!==(t=i[14].text+"")&&Le(n,t),o[0]&16384&&N(e,"left",i[14].x+"px"),o[0]&16384&&N(e,"top",i[14].y+"px")},d(i){i&&U(e)}}}function jo(s){let e,t,n,i,o,l,a;const c=[Do,Oo],u=[];function p(d,w){return d[15]?0:1}t=p(s),n=u[t]=c[t](s);let h=!s[15]&&Ws(s),g=s[14]&&Gs(s);return{c(){e=x("div"),n.c(),i=G(),h&&h.c(),o=G(),g&&g.c(),l=Lt(),r(e,"class","sy-assistant-chat-container svelte-46wzni"),N(e,"z-index",s[0]+2)},m(d,w){W(d,e,w),u[t].m(e,null),m(e,i),h&&h.m(e,null),s[52](e),W(d,o,w),g&&g.m(d,w),W(d,l,w),a=!0},p(d,w){let E=t;t=p(d),t===E?u[t].p(d,w):(ln(),We(u[E],1,1,()=>{u[E]=null}),rn(),n=u[t],n?n.p(d,w):(n=u[t]=c[t](d),n.c()),Me(n,1),n.m(e,i)),d[15]?h&&(h.d(1),h=null):h?h.p(d,w):(h=Ws(d),h.c(),h.m(e,null)),(!a||w[0]&1)&&N(e,"z-index",d[0]+2),d[14]?g?g.p(d,w):(g=Gs(d),g.c(),g.m(l.parentNode,l)):g&&(g.d(1),g=null)},i(d){a||(Me(n),a=!0)},o(d){We(n),a=!1},d(d){d&&(U(e),U(o),U(l)),u[t].d(),h&&h.d(),s[52](null),g&&g.d(d)}}}let In=500;function Wo(s){const e=s.match(/source#\[(.*)\]#source/);if(e)try{return JSON.parse(`[${e[1]}]`)}catch(t){console.error("Failed to parse attachments:",t)}return null}function qt(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}async function Go(s,e){try{const t=await fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({fileName:s,fileUrl:e})});if(!t.ok)throw new Error("Download failed");const n=t.headers.get("content-type")||"application/octet-stream",i=await t.blob(),o=window.URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=s,document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(o),document.body.removeChild(l)}catch(t){console.error("Failed to download file:",t)}}function qo(s,e,t){let n,i,o="",l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],a="",c=null,u=null,p={x:0,y:0,alignRight:!1},h=null,g=!1;J.setOptions({breaks:!0,gfm:!0});function d(T){try{const j=J(T);return As.sanitize(j)}catch(j){console.warn("Markdown parsing failed, fallback to HTML:",j);try{const oe=T.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return As.sanitize(oe)}catch(oe){return console.error("HTML fallback failed:",oe),T}}}let w;function E(T=!1){w&&w.scrollTo({top:w.scrollHeight,behavior:T?"smooth":"auto"})}pi(()=>{E(!1)});let{sessionId:z}=e;async function M(){if(!o.trim()||i)return;if(!z){console.error("No session ID available");return}const T={id:Date.now().toString(),type:"user",content:o.trim(),timestamp:Date.now()};t(3,l=[...l,T]);const j=o.trim();t(1,o="");const oe=(Date.now()+1).toString();a="",t(3,l=[...l,{id:oe,type:"assistant",content:"",timestamp:Date.now()}]),t(7,g=!0),c&&c.abort(),c=new AbortController;try{await Ri("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:Date.now().toString(),keyword:j,flowId:"1"}),signal:c.signal,onmessage(pe){try{const He=pe.data;if(He){const Qe=Wo(He);Qe?(t(3,l=l.map(Be=>Be.id===oe?{...Be,attachments:Qe}:Be)),E(!0)):(a+=He,t(3,l=l.map(Be=>Be.id===oe?{...Be,content:a}:Be)),E(!1))}}catch(He){console.error("Failed to process SSE message:",He)}},onerror(pe){console.error("SSE error:",pe),c=null,t(7,g=!1)},onclose(){c=null,t(7,g=!1)}})}catch(pe){console.error("Failed to send message:",pe),t(7,g=!1)}}function y(T,j,oe){const pe=oe.getBoundingClientRect(),He=w.getBoundingClientRect(),Qe=pe.left<He.width/2;t(4,u=j),t(5,p={x:pe.left,y:pe.top+pe.height/2,alignRight:Qe})}function _(){t(6,h=setTimeout(()=>{t(4,u=null),t(6,h=null)},200))}hi(()=>{c&&c.abort(),h&&clearTimeout(h)});let k={};async function S(T,j){try{const oe=j.replace(/<br\s*\/?>/g,`
48
- `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();await navigator.clipboard.writeText(oe),t(9,k[T]=!0,k),setTimeout(()=>{t(9,k[T]=!1,k),t(9,k)},1500)}catch(oe){console.error("Failed to copy:",oe)}}let b={},A={},C=!1;async function R(T,j){if(b[T]===j){t(10,b[T]=null,b),t(10,b);return}if(t(10,b[T]=j,b),t(10,b),j==="like")try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(oe){console.error("Failed to send feedback:",oe),t(10,b[T]=null,b),t(10,b)}else t(12,C=!0)}async function P(T){var j;if((j=A[T])!=null&&j.trim())try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"0",feedBackContent:A[T]})})).ok)throw new Error("Feedback failed");t(12,C=!1),t(11,A[T]="",A),t(11,A)}catch(oe){console.error("Failed to send feedback:",oe),t(10,b[T]=null,b),t(10,b)}}let I={x:0,y:0};function B(T,j){const pe=T.currentTarget.getBoundingClientRect();t(13,I={x:pe.left-290,y:pe.top-160}),R(j,"dislike")}let X=null;function Y(T,j){const pe=T.currentTarget.getBoundingClientRect();t(14,X={text:j,x:pe.left+pe.width/2,y:pe.top-8})}function ae(){t(14,X=null)}let ce=!1,he=[],Ee=Date.now().toString();function ue(){ae(),t(15,ce=!0)}function Fe(){ae(),t(15,ce=!1)}function ie(T){Ee=T,t(15,ce=!1)}async function Ge(){const T=await se();if(!T){console.error("Failed to create new session");return}Ee=T,t(3,l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")}async function se(){try{const T=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!T.ok)throw new Error("Failed to get session ID");const j=await T.json();if(j.code===0)return Ee=j.data.sessionId,Ee;throw new Error(j.message||"Failed to get session ID")}catch(T){return console.error("Failed to get session ID:",T),null}}let{zIndex:ke}=e;const ee=(T,j)=>y(j,T.tips,j.currentTarget),Se=T=>Go(T.content_title,T.link),_e=()=>{h&&(clearTimeout(h),t(6,h=null))},qe=()=>{t(4,u=null)},O=T=>S(T.id,T.content),te=(T,j)=>Y(j,k[T.id]?"已复制":"复制内容"),F=T=>R(T.id,"like"),V=(T,j)=>Y(j,b[T.id]==="like"?"取消点赞":"点赞"),ze=(T,j)=>B(j,T.id),Ce=(T,j)=>Y(j,b[T.id]==="dislike"?"取消点踩":"点踩");function Xe(T){A[T.id]=this.value,t(11,A)}const nt=T=>{t(12,C=!1),t(10,b[T.id]=null,b),t(10,b)},Ve=T=>P(T.id);function pt(T){rt[T?"unshift":"push"](()=>{w=T,t(8,w)})}const ht=T=>Y(T,"历史会话"),Yt=T=>Y(T,"新建会话");function Zt(){o=this.value,t(1,o)}const Cn=T=>T.key==="Enter"&&!T.shiftKey&&(M(),T.preventDefault()),Rt=T=>Y(T,"发送消息");function st(T){rt[T?"unshift":"push"](()=>{w=T,t(8,w)})}return s.$$set=T=>{"sessionId"in T&&t(32,z=T.sessionId),"zIndex"in T&&t(0,ke=T.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(17,i=n>In)},[ke,o,n,l,u,p,h,g,w,k,b,A,C,I,X,ce,he,i,d,M,y,_,S,R,P,B,Y,ae,ue,Fe,ie,Ge,z,ee,Se,_e,qe,O,te,F,V,ze,Ce,Xe,nt,Ve,pt,ht,Yt,Zt,Cn,Rt,st]}class Yo extends un{constructor(e){super(),cn(this,e,qo,jo,Ct,{sessionId:32,zIndex:0},null,[-1,-1,-1])}}function qs(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,p,h,g,d,w,E=s[2]?"退出全屏":"全屏显示",z,M,y,_,k,S,b,A,C=s[7]?"取消吸附":"吸附到边缘",R,P,I,B,X,Y,ae,ce,he,Ee=`${s[3].height}px`,ue,Fe,ie;function Ge(F,V){return F[2]?Xo:Zo}let se=Ge(s),ke=se(s);function ee(F,V){return F[7]?Qo:Vo}let Se=ee(s),_e=Se(s);const qe=[Jo,Ko],O=[];function te(F,V){return F[8]?0:1}return ce=te(s),he=O[ce]=qe[ce](s),{c(){e=x("div"),t=x("div"),n=x("div"),i=x("h3"),l=we(o),a=G(),c=x("div"),u=x("div"),p=x("button"),h=Q("svg"),ke.c(),d=G(),w=x("span"),z=we(E),M=G(),y=x("div"),_=x("button"),k=Q("svg"),_e.c(),b=G(),A=x("span"),R=we(C),P=G(),I=x("div"),B=x("button"),B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',X=G(),Y=x("span"),Y.textContent="关闭助手",ae=G(),he.c(),r(i,"class","svelte-1dubpto"),r(h,"xmlns","http://www.w3.org/2000/svg"),r(h,"width","18"),r(h,"height","18"),r(h,"viewBox","0 0 24 24"),r(h,"fill","none"),r(h,"stroke","currentColor"),r(h,"stroke-width","2"),r(h,"stroke-linecap","round"),r(h,"stroke-linejoin","round"),r(p,"class","sy-assistant-action-button svelte-1dubpto"),r(p,"aria-label",g=s[2]?"退出全屏":"全屏显示"),K(p,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1dubpto"),r(u,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(k,"xmlns","http://www.w3.org/2000/svg"),r(k,"width","18"),r(k,"height","18"),r(k,"viewBox","0 0 24 24"),r(k,"fill","none"),r(k,"stroke","currentColor"),r(k,"stroke-width","2"),r(k,"stroke-linecap","round"),r(k,"stroke-linejoin","round"),r(_,"class","sy-assistant-action-button svelte-1dubpto"),r(_,"aria-label",S=s[7]?"取消吸附":"吸附到边缘"),K(_,"active",s[7]),r(A,"class","sy-assistant-tooltip svelte-1dubpto"),r(y,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(B,"class","sy-assistant-close-button svelte-1dubpto"),r(B,"aria-label","关闭助手"),r(Y,"class","sy-assistant-tooltip svelte-1dubpto"),r(I,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(c,"class","sy-assistant-header-actions svelte-1dubpto"),r(n,"class","sy-assistant-drawer-header svelte-1dubpto"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),K(n,"dragging",s[6]),K(n,"fullscreen",s[2]),K(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1dubpto"),r(e,"class","sy-assistant-drawer svelte-1dubpto"),K(e,"fullscreen",s[2]),N(e,"height",Ee)},m(F,V){W(F,e,V),m(e,t),m(t,n),m(n,i),m(i,l),m(n,a),m(n,c),m(c,u),m(u,p),m(p,h),ke.m(h,null),m(u,d),m(u,w),m(w,z),m(c,M),m(c,y),m(y,_),m(_,k),_e.m(k,null),m(y,b),m(y,A),m(A,R),m(c,P),m(c,I),m(I,B),m(I,X),m(I,Y),m(t,ae),O[ce].m(t,null),ue=!0,Fe||(ie=[H(p,"click",s[16]),H(_,"click",s[18]),H(B,"click",s[15]),H(n,"mousedown",jn(s[17]))],Fe=!0)},p(F,V){(!ue||V[0]&8)&&o!==(o=F[3].title+"")&&Le(l,o),se!==(se=Ge(F))&&(ke.d(1),ke=se(F),ke&&(ke.c(),ke.m(h,null))),(!ue||V[0]&4&&g!==(g=F[2]?"退出全屏":"全屏显示"))&&r(p,"aria-label",g),(!ue||V[0]&4)&&K(p,"active",F[2]),(!ue||V[0]&4)&&E!==(E=F[2]?"退出全屏":"全屏显示")&&Le(z,E),Se!==(Se=ee(F))&&(_e.d(1),_e=Se(F),_e&&(_e.c(),_e.m(k,null))),(!ue||V[0]&128&&S!==(S=F[7]?"取消吸附":"吸附到边缘"))&&r(_,"aria-label",S),(!ue||V[0]&128)&&K(_,"active",F[7]),(!ue||V[0]&128)&&C!==(C=F[7]?"取消吸附":"吸附到边缘")&&Le(R,C),(!ue||V[0]&64)&&K(n,"dragging",F[6]),(!ue||V[0]&4)&&K(n,"fullscreen",F[2]),(!ue||V[0]&128)&&K(n,"snapped",F[7]);let ze=ce;ce=te(F),ce===ze?O[ce].p(F,V):(ln(),We(O[ze],1,1,()=>{O[ze]=null}),rn(),he=O[ce],he?he.p(F,V):(he=O[ce]=qe[ce](F),he.c()),Me(he,1),he.m(t,null)),(!ue||V[0]&4)&&K(e,"fullscreen",F[2]),V[0]&8&&Ee!==(Ee=`${F[3].height}px`)&&N(e,"height",Ee)},i(F){ue||(Me(he),ue=!0)},o(F){We(he),ue=!1},d(F){F&&U(e),ke.d(),_e.d(),O[ce].d(),Fe=!1,me(ie)}}}function Zo(s){let e;return{c(){e=Q("path"),r(e,"d","M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Xo(s){let e;return{c(){e=Q("path"),r(e,"d","M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Vo(s){let e,t;return{c(){e=Q("rect"),t=Q("line"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x1","16"),r(t,"y1","6"),r(t,"x2","16"),r(t,"y2","18")},m(n,i){W(n,e,i),W(n,t,i)},d(n){n&&(U(e),U(t))}}}function Qo(s){let e,t;return{c(){e=Q("rect"),t=Q("rect"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x","12"),r(t,"y","10"),r(t,"width","6"),r(t,"height","8"),r(t,"rx","1"),r(t,"ry","1")},m(n,i){W(n,e,i),W(n,t,i)},d(n){n&&(U(e),U(t))}}}function Ko(s){let e,t;return e=new Yo({props:{zIndex:s[3].zIndex??1e3,sessionId:s[9]}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&8&&(o.zIndex=n[3].zIndex??1e3),i[0]&512&&(o.sessionId=n[9]),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function Jo(s){let e,t;return e=new Ms({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:s[3].zIndex??1e3}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&256&&(o.onClose=n[26]),i[0]&8&&(o.zIndex=n[3].zIndex??1e3),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function $o(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,p,h,g,d,w,E,z,M,y=s[12]>0&&qs(s);return{c(){e=x("div"),t=x("div"),y&&y.c(),i=G(),o=x("button"),l=Q("svg"),a=Q("path"),c=Q("path"),u=Q("path"),p=Q("path"),h=Q("path"),g=Q("path"),d=Q("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1dubpto"),K(t,"fullscreen",s[2]),N(t,"width",n),r(a,"d","M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"),r(a,"fill","#6F8698"),r(c,"d","M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"),r(c,"fill","#3677FF"),r(u,"d","M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"),r(u,"fill","#D0D5F1"),r(p,"d","M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"),r(p,"fill","#3677FF"),r(h,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(h,"fill","#FFFFFF"),r(g,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(g,"fill","#FFFFFF"),r(d,"d","M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"),r(d,"fill","#8896A4"),r(l,"class","sy-assistant-icon"),r(l,"viewBox","0 0 1024 1024"),r(l,"version","1.1"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"width","32"),r(l,"height","32"),r(l,"fill","currentColor"),r(l,"aria-label","助手图标"),r(o,"class","sy-assistant-floating-button svelte-1dubpto"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+((s[3].zIndex??1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1dubpto"),K(e,"fullscreen",s[2]),K(e,"snapped",s[7]),N(e,"position",s[3].position),N(e,"right",s[7]?0:`${s[0]}px`),N(e,"bottom",s[7]?0:`${s[1]}px`),N(e,"top",s[7]||s[2]?"0":"auto"),N(e,"left",s[2]?"0":"auto"),N(e,"z-index",s[3].zIndex??1e3)},m(_,k){W(_,e,k),m(e,t),y&&y.m(t,null),m(e,i),m(e,o),m(o,l),m(l,a),m(l,c),m(l,u),m(l,p),m(l,h),m(l,g),m(l,d),s[27](o),s[29](e),E=!0,z||(M=[H(o,"click",s[15]),H(o,"mousedown",jn(s[28]))],z=!0)},p(_,k){_[12]>0?y?(y.p(_,k),k[0]&4096&&Me(y,1)):(y=qs(_),y.c(),Me(y,1),y.m(t,null)):y&&(ln(),We(y,1,1,()=>{y=null}),rn()),(!E||k[0]&4)&&K(t,"fullscreen",_[2]),k[0]&4096&&n!==(n=`${_[12]}px`)&&N(t,"width",n),(!E||k[0]&1032&&w!==(w=_[10]+" z-index: "+((_[3].zIndex??1e3)+1)+";"))&&r(o,"style",w),(!E||k[0]&4)&&K(e,"fullscreen",_[2]),(!E||k[0]&128)&&K(e,"snapped",_[7]),k[0]&8&&N(e,"position",_[3].position),k[0]&129&&N(e,"right",_[7]?0:`${_[0]}px`),k[0]&130&&N(e,"bottom",_[7]?0:`${_[1]}px`),k[0]&132&&N(e,"top",_[7]||_[2]?"0":"auto"),k[0]&4&&N(e,"left",_[2]?"0":"auto"),k[0]&8&&N(e,"z-index",_[3].zIndex??1e3)},i(_){E||(Me(y),E=!0)},o(_){We(y),E=!1},d(_){_&&U(e),y&&y.d(),s[27](null),s[29](null),z=!1,me(M)}}}const zn=48,fe=20;function el(s,e,t){let n,i,o,l,a=Z,c=()=>(a(),a=ai(i,O=>t(12,l=O)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:fe,bottom:fe},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:p="body"}=e,{options:h={}}=e,g,d=null,w=!1,E,z=!1,M=0,y=0,_=fe,k=20,S=_,b=k,A=!1,C=fe,R=50,P=!1,I={width:0,height:0,right:0,bottom:0},B=!1,X=!1,Y=[],ae=null;async function ce(){try{const O=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!O.ok)throw new Error("Failed to get session ID");const te=await O.json();if(te.code===0)return t(9,ae=te.data.sessionId),ae;throw new Error(te.message||"Failed to get session ID")}catch(O){return console.error("Failed to get session ID:",O),null}}function he(O,te=!1){te?t(23,A=!0):t(6,z=!0),M=O.clientX,y=O.clientY,_=te?C:S,k=te?R:b,O.preventDefault()}function Ee(O){if(!z&&!A)return;const te=M-O.clientX,F=y-O.clientY;if(A){const V=_+te,ze=O.clientY;t(24,C=Math.max(fe,Math.min(window.innerWidth-zn-fe,V)));const Ce=window.innerHeight-zn-fe,nt=Math.max(fe,Math.min(Ce,ze));t(25,R=(window.innerHeight-nt-zn)/window.innerHeight*100)}else{const V=n.width||0,ze=n.height||0,Ce=_+te;t(0,S=Math.max(fe,Math.min(window.innerWidth-V-fe,Ce)));const Xe=k+F;t(1,b=Math.max(fe,Math.min(window.innerHeight-ze-fe,Xe)))}}function ue(){t(6,z=!1),t(23,A=!1)}Wn(()=>{typeof p=="string"?d=document.querySelector(p)||document.body:d=p||document.body;const O=F=>Ee(F),te=()=>ue();return document.addEventListener("mousemove",O),document.addEventListener("mouseup",te),g&&d&&d.appendChild(g),E&&E.getBoundingClientRect().left,t(7,B=n.initialState==="snapped"),t(2,P=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,S=0),t(1,b=0),t(3,n={...n,height:typeof window<"u"?window.innerHeight:n.height,width:n.snappedWidth||n.width})):n.initialState==="fullscreen"&&(t(0,S=0),t(1,b=0),t(3,n={...n,width:typeof window<"u"?window.innerWidth:n.width,height:typeof window<"u"?window.innerHeight:n.height})),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",te),d&&g&&d.removeChild(g)}});async function Fe(){w||await ce(),t(22,w=!w)}function ie(){var O,te,F,V;t(2,P=!P),P?(I.width||(I={width:u.width,height:u.height,right:((O=u.defaultPosition)==null?void 0:O.right)??fe,bottom:((te=u.defaultPosition)==null?void 0:te.bottom)??fe}),B&&t(7,B=!1),t(20,h={...n,width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth}),t(0,S=0),t(1,b=0)):(t(20,h={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((F=u.defaultPosition)==null?void 0:F.right)??fe),t(1,b=((V=u.defaultPosition)==null?void 0:V.bottom)??fe))}function Ge(O){P||he(O)}function se(){var O,te;P&&(t(2,P=!1),t(20,h={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(7,B=!B),B?(n.height,t(0,S=0),t(1,b=0),t(20,h={...n,height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width})):(t(20,h={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((O=u.defaultPosition)==null?void 0:O.right)??fe),t(1,b=((te=u.defaultPosition)==null?void 0:te.bottom)??fe))}function ke(O){t(8,X=!1)}const ee=()=>t(8,X=!1);function Se(O){rt[O?"unshift":"push"](()=>{E=O,t(5,E)})}const _e=O=>he(O,!0);function qe(O){rt[O?"unshift":"push"](()=>{g=O,t(4,g)})}return s.$$set=O=>{"target"in O&&t(21,p=O.target),"options"in O&&t(20,h=O.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n={...u,...h,defaultPosition:{...u.defaultPosition,...h.defaultPosition}}),s.$$.dirty[0]&4194316&&c(t(11,i=yi(w?P?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window<"u"&&(t(0,S=Math.max(fe,Math.min(window.innerWidth-(n.width||0),S))),t(1,b=Math.max(fe,Math.min(window.innerHeight-(n.height||0),b)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${C}px; bottom: ${R}%; transform: none; cursor: ${A?"grabbing":"grab"};`)},[S,b,P,n,g,E,z,B,X,ae,o,i,l,Y,he,Fe,ie,Ge,se,ke,h,p,w,A,C,R,ee,Se,_e,qe]}class tl extends un{constructor(e){super(),cn(this,e,el,$o,Ct,{target:21,options:20},null,[-1,-1])}}re.SyAssistant=tl,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
48
+ `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();await navigator.clipboard.writeText(oe),t(9,k[T]=!0,k),setTimeout(()=>{t(9,k[T]=!1,k),t(9,k)},1500)}catch(oe){console.error("Failed to copy:",oe)}}let b={},A={},C=!1;async function R(T,j){if(b[T]===j){t(10,b[T]=null,b),t(10,b);return}if(t(10,b[T]=j,b),t(10,b),j==="like")try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(oe){console.error("Failed to send feedback:",oe),t(10,b[T]=null,b),t(10,b)}else t(12,C=!0)}async function P(T){var j;if((j=A[T])!=null&&j.trim())try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"0",feedBackContent:A[T]})})).ok)throw new Error("Feedback failed");t(12,C=!1),t(11,A[T]="",A),t(11,A)}catch(oe){console.error("Failed to send feedback:",oe),t(10,b[T]=null,b),t(10,b)}}let I={x:0,y:0};function B(T,j){const pe=T.currentTarget.getBoundingClientRect();t(13,I={x:pe.left-290,y:pe.top-160}),R(j,"dislike")}let X=null;function Y(T,j){const pe=T.currentTarget.getBoundingClientRect();t(14,X={text:j,x:pe.left+pe.width/2,y:pe.top-8})}function ae(){t(14,X=null)}let ce=!1,he=[],Ee=Date.now().toString();function ue(){ae(),t(15,ce=!0)}function Fe(){ae(),t(15,ce=!1)}function ie(T){Ee=T,t(15,ce=!1)}async function Ge(){const T=await se();if(!T){console.error("Failed to create new session");return}Ee=T,t(3,l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")}async function se(){try{const T=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!T.ok)throw new Error("Failed to get session ID");const j=await T.json();if(j.code===0)return Ee=j.data.sessionId,Ee;throw new Error(j.message||"Failed to get session ID")}catch(T){return console.error("Failed to get session ID:",T),null}}let{zIndex:ke}=e;const ee=(T,j)=>y(j,T.tips,j.currentTarget),Se=T=>Go(T.content_title,T.link),_e=()=>{h&&(clearTimeout(h),t(6,h=null))},qe=()=>{t(4,u=null)},O=T=>S(T.id,T.content),te=(T,j)=>Y(j,k[T.id]?"已复制":"复制内容"),F=T=>R(T.id,"like"),V=(T,j)=>Y(j,b[T.id]==="like"?"取消点赞":"点赞"),ze=(T,j)=>B(j,T.id),Ce=(T,j)=>Y(j,b[T.id]==="dislike"?"取消点踩":"点踩");function Xe(T){A[T.id]=this.value,t(11,A)}const nt=T=>{t(12,C=!1),t(10,b[T.id]=null,b),t(10,b)},Ve=T=>P(T.id);function pt(T){rt[T?"unshift":"push"](()=>{w=T,t(8,w)})}const ht=T=>Y(T,"历史会话"),Yt=T=>Y(T,"新建会话");function Zt(){o=this.value,t(1,o)}const Cn=T=>T.key==="Enter"&&!T.shiftKey&&(M(),T.preventDefault()),Rt=T=>Y(T,"发送消息");function st(T){rt[T?"unshift":"push"](()=>{w=T,t(8,w)})}return s.$$set=T=>{"sessionId"in T&&t(32,z=T.sessionId),"zIndex"in T&&t(0,ke=T.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(17,i=n>In)},[ke,o,n,l,u,p,h,g,w,k,b,A,C,I,X,ce,he,i,d,M,y,_,S,R,P,B,Y,ae,ue,Fe,ie,Ge,z,ee,Se,_e,qe,O,te,F,V,ze,Ce,Xe,nt,Ve,pt,ht,Yt,Zt,Cn,Rt,st]}class Yo extends un{constructor(e){super(),cn(this,e,qo,jo,Ct,{sessionId:32,zIndex:0},null,[-1,-1,-1])}}function qs(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,p,h,g,d,w,E=s[2]?"退出全屏":"全屏显示",z,M,y,_,k,S,b,A,C=s[7]?"取消吸附":"吸附到边缘",R,P,I,B,X,Y,ae,ce,he,Ee=`${s[3].height}px`,ue,Fe,ie;function Ge(F,V){return F[2]?Xo:Zo}let se=Ge(s),ke=se(s);function ee(F,V){return F[7]?Qo:Vo}let Se=ee(s),_e=Se(s);const qe=[Jo,Ko],O=[];function te(F,V){return F[8]?0:1}return ce=te(s),he=O[ce]=qe[ce](s),{c(){e=x("div"),t=x("div"),n=x("div"),i=x("h3"),l=we(o),a=G(),c=x("div"),u=x("div"),p=x("button"),h=Q("svg"),ke.c(),d=G(),w=x("span"),z=we(E),M=G(),y=x("div"),_=x("button"),k=Q("svg"),_e.c(),b=G(),A=x("span"),R=we(C),P=G(),I=x("div"),B=x("button"),B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',X=G(),Y=x("span"),Y.textContent="关闭助手",ae=G(),he.c(),r(i,"class","svelte-1dubpto"),r(h,"xmlns","http://www.w3.org/2000/svg"),r(h,"width","18"),r(h,"height","18"),r(h,"viewBox","0 0 24 24"),r(h,"fill","none"),r(h,"stroke","currentColor"),r(h,"stroke-width","2"),r(h,"stroke-linecap","round"),r(h,"stroke-linejoin","round"),r(p,"class","sy-assistant-action-button svelte-1dubpto"),r(p,"aria-label",g=s[2]?"退出全屏":"全屏显示"),K(p,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1dubpto"),r(u,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(k,"xmlns","http://www.w3.org/2000/svg"),r(k,"width","18"),r(k,"height","18"),r(k,"viewBox","0 0 24 24"),r(k,"fill","none"),r(k,"stroke","currentColor"),r(k,"stroke-width","2"),r(k,"stroke-linecap","round"),r(k,"stroke-linejoin","round"),r(_,"class","sy-assistant-action-button svelte-1dubpto"),r(_,"aria-label",S=s[7]?"取消吸附":"吸附到边缘"),K(_,"active",s[7]),r(A,"class","sy-assistant-tooltip svelte-1dubpto"),r(y,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(B,"class","sy-assistant-close-button svelte-1dubpto"),r(B,"aria-label","关闭助手"),r(Y,"class","sy-assistant-tooltip svelte-1dubpto"),r(I,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(c,"class","sy-assistant-header-actions svelte-1dubpto"),r(n,"class","sy-assistant-drawer-header svelte-1dubpto"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),K(n,"dragging",s[6]),K(n,"fullscreen",s[2]),K(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1dubpto"),r(e,"class","sy-assistant-drawer svelte-1dubpto"),K(e,"fullscreen",s[2]),N(e,"height",Ee)},m(F,V){W(F,e,V),m(e,t),m(t,n),m(n,i),m(i,l),m(n,a),m(n,c),m(c,u),m(u,p),m(p,h),ke.m(h,null),m(u,d),m(u,w),m(w,z),m(c,M),m(c,y),m(y,_),m(_,k),_e.m(k,null),m(y,b),m(y,A),m(A,R),m(c,P),m(c,I),m(I,B),m(I,X),m(I,Y),m(t,ae),O[ce].m(t,null),ue=!0,Fe||(ie=[H(p,"click",s[16]),H(_,"click",s[18]),H(B,"click",s[15]),H(n,"mousedown",jn(s[17]))],Fe=!0)},p(F,V){(!ue||V[0]&8)&&o!==(o=F[3].title+"")&&Le(l,o),se!==(se=Ge(F))&&(ke.d(1),ke=se(F),ke&&(ke.c(),ke.m(h,null))),(!ue||V[0]&4&&g!==(g=F[2]?"退出全屏":"全屏显示"))&&r(p,"aria-label",g),(!ue||V[0]&4)&&K(p,"active",F[2]),(!ue||V[0]&4)&&E!==(E=F[2]?"退出全屏":"全屏显示")&&Le(z,E),Se!==(Se=ee(F))&&(_e.d(1),_e=Se(F),_e&&(_e.c(),_e.m(k,null))),(!ue||V[0]&128&&S!==(S=F[7]?"取消吸附":"吸附到边缘"))&&r(_,"aria-label",S),(!ue||V[0]&128)&&K(_,"active",F[7]),(!ue||V[0]&128)&&C!==(C=F[7]?"取消吸附":"吸附到边缘")&&Le(R,C),(!ue||V[0]&64)&&K(n,"dragging",F[6]),(!ue||V[0]&4)&&K(n,"fullscreen",F[2]),(!ue||V[0]&128)&&K(n,"snapped",F[7]);let ze=ce;ce=te(F),ce===ze?O[ce].p(F,V):(ln(),We(O[ze],1,1,()=>{O[ze]=null}),rn(),he=O[ce],he?he.p(F,V):(he=O[ce]=qe[ce](F),he.c()),Me(he,1),he.m(t,null)),(!ue||V[0]&4)&&K(e,"fullscreen",F[2]),V[0]&8&&Ee!==(Ee=`${F[3].height}px`)&&N(e,"height",Ee)},i(F){ue||(Me(he),ue=!0)},o(F){We(he),ue=!1},d(F){F&&U(e),ke.d(),_e.d(),O[ce].d(),Fe=!1,me(ie)}}}function Zo(s){let e;return{c(){e=Q("path"),r(e,"d","M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Xo(s){let e;return{c(){e=Q("path"),r(e,"d","M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Vo(s){let e,t;return{c(){e=Q("rect"),t=Q("line"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x1","16"),r(t,"y1","6"),r(t,"x2","16"),r(t,"y2","18")},m(n,i){W(n,e,i),W(n,t,i)},d(n){n&&(U(e),U(t))}}}function Qo(s){let e,t;return{c(){e=Q("rect"),t=Q("rect"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x","12"),r(t,"y","10"),r(t,"width","6"),r(t,"height","8"),r(t,"rx","1"),r(t,"ry","1")},m(n,i){W(n,e,i),W(n,t,i)},d(n){n&&(U(e),U(t))}}}function Ko(s){let e,t;return e=new Yo({props:{zIndex:s[3].zIndex||1e3,sessionId:s[9]}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&8&&(o.zIndex=n[3].zIndex||1e3),i[0]&512&&(o.sessionId=n[9]),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function Jo(s){let e,t;return e=new Ms({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:s[3].zIndex||1e3}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&256&&(o.onClose=n[26]),i[0]&8&&(o.zIndex=n[3].zIndex||1e3),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function $o(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,p,h,g,d,w,E,z,M,y=s[12]>0&&qs(s);return{c(){e=x("div"),t=x("div"),y&&y.c(),i=G(),o=x("button"),l=Q("svg"),a=Q("path"),c=Q("path"),u=Q("path"),p=Q("path"),h=Q("path"),g=Q("path"),d=Q("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1dubpto"),K(t,"fullscreen",s[2]),N(t,"width",n),r(a,"d","M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"),r(a,"fill","#6F8698"),r(c,"d","M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"),r(c,"fill","#3677FF"),r(u,"d","M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"),r(u,"fill","#D0D5F1"),r(p,"d","M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"),r(p,"fill","#3677FF"),r(h,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(h,"fill","#FFFFFF"),r(g,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(g,"fill","#FFFFFF"),r(d,"d","M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"),r(d,"fill","#8896A4"),r(l,"class","sy-assistant-icon"),r(l,"viewBox","0 0 1024 1024"),r(l,"version","1.1"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"width","32"),r(l,"height","32"),r(l,"fill","currentColor"),r(l,"aria-label","助手图标"),r(o,"class","sy-assistant-floating-button svelte-1dubpto"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+((s[3].zIndex||1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1dubpto"),K(e,"fullscreen",s[2]),K(e,"snapped",s[7]),N(e,"position",s[3].position),N(e,"right",s[7]?0:`${s[0]}px`),N(e,"bottom",s[7]?0:`${s[1]}px`),N(e,"top",s[7]||s[2]?"0":"auto"),N(e,"left",s[2]?"0":"auto"),N(e,"z-index",s[3].zIndex||1e3)},m(_,k){W(_,e,k),m(e,t),y&&y.m(t,null),m(e,i),m(e,o),m(o,l),m(l,a),m(l,c),m(l,u),m(l,p),m(l,h),m(l,g),m(l,d),s[27](o),s[29](e),E=!0,z||(M=[H(o,"click",s[15]),H(o,"mousedown",jn(s[28]))],z=!0)},p(_,k){_[12]>0?y?(y.p(_,k),k[0]&4096&&Me(y,1)):(y=qs(_),y.c(),Me(y,1),y.m(t,null)):y&&(ln(),We(y,1,1,()=>{y=null}),rn()),(!E||k[0]&4)&&K(t,"fullscreen",_[2]),k[0]&4096&&n!==(n=`${_[12]}px`)&&N(t,"width",n),(!E||k[0]&1032&&w!==(w=_[10]+" z-index: "+((_[3].zIndex||1e3)+1)+";"))&&r(o,"style",w),(!E||k[0]&4)&&K(e,"fullscreen",_[2]),(!E||k[0]&128)&&K(e,"snapped",_[7]),k[0]&8&&N(e,"position",_[3].position),k[0]&129&&N(e,"right",_[7]?0:`${_[0]}px`),k[0]&130&&N(e,"bottom",_[7]?0:`${_[1]}px`),k[0]&132&&N(e,"top",_[7]||_[2]?"0":"auto"),k[0]&4&&N(e,"left",_[2]?"0":"auto"),k[0]&8&&N(e,"z-index",_[3].zIndex||1e3)},i(_){E||(Me(y),E=!0)},o(_){We(y),E=!1},d(_){_&&U(e),y&&y.d(),s[27](null),s[29](null),z=!1,me(M)}}}const zn=48,fe=20;function el(s,e,t){let n,i,o,l,a=Z,c=()=>(a(),a=ai(i,O=>t(12,l=O)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:fe,bottom:fe},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:p="body"}=e,{options:h={}}=e,g,d=null,w=!1,E,z=!1,M=0,y=0,_=fe,k=20,S=_,b=k,A=!1,C=fe,R=50,P=!1,I={width:0,height:0,right:0,bottom:0},B=!1,X=!1,Y=[],ae=null;async function ce(){try{const O=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!O.ok)throw new Error("Failed to get session ID");const te=await O.json();if(te.code===0)return t(9,ae=te.data.sessionId),ae;throw new Error(te.message||"Failed to get session ID")}catch(O){return console.error("Failed to get session ID:",O),null}}function he(O,te=!1){te?t(23,A=!0):t(6,z=!0),M=O.clientX,y=O.clientY,_=te?C:S,k=te?R:b,O.preventDefault()}function Ee(O){if(!z&&!A)return;const te=M-O.clientX,F=y-O.clientY;if(A){const V=_+te,ze=O.clientY;t(24,C=Math.max(fe,Math.min(window.innerWidth-zn-fe,V)));const Ce=window.innerHeight-zn-fe,nt=Math.max(fe,Math.min(Ce,ze));t(25,R=(window.innerHeight-nt-zn)/window.innerHeight*100)}else{const V=n.width||0,ze=n.height||0,Ce=_+te;t(0,S=Math.max(fe,Math.min(window.innerWidth-V-fe,Ce)));const Xe=k+F;t(1,b=Math.max(fe,Math.min(window.innerHeight-ze-fe,Xe)))}}function ue(){t(6,z=!1),t(23,A=!1)}Wn(()=>{typeof p=="string"?d=document.querySelector(p)||document.body:d=p||document.body;const O=F=>Ee(F),te=()=>ue();return document.addEventListener("mousemove",O),document.addEventListener("mouseup",te),g&&d&&d.appendChild(g),E&&E.getBoundingClientRect().left,t(7,B=n.initialState==="snapped"),t(2,P=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,S=0),t(1,b=0),t(3,n={...n,height:typeof window<"u"?window.innerHeight:n.height,width:n.snappedWidth||n.width})):n.initialState==="fullscreen"&&(t(0,S=0),t(1,b=0),t(3,n={...n,width:typeof window<"u"?window.innerWidth:n.width,height:typeof window<"u"?window.innerHeight:n.height})),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",te),d&&g&&d.removeChild(g)}});async function Fe(){w||await ce(),t(22,w=!w)}function ie(){var O,te,F,V;t(2,P=!P),P?(I.width||(I={width:u.width,height:u.height,right:((O=u.defaultPosition)==null?void 0:O.right)||fe,bottom:((te=u.defaultPosition)==null?void 0:te.bottom)||fe}),B&&t(7,B=!1),t(20,h={...n,width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth}),t(0,S=0),t(1,b=0)):(t(20,h={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((F=u.defaultPosition)==null?void 0:F.right)||fe),t(1,b=((V=u.defaultPosition)==null?void 0:V.bottom)||fe))}function Ge(O){P||he(O)}function se(){var O,te;P&&(t(2,P=!1),t(20,h={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(7,B=!B),B?(n.height,t(0,S=0),t(1,b=0),t(20,h={...n,height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width})):(t(20,h={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((O=u.defaultPosition)==null?void 0:O.right)||fe),t(1,b=((te=u.defaultPosition)==null?void 0:te.bottom)||fe))}function ke(O){t(8,X=!1)}const ee=()=>t(8,X=!1);function Se(O){rt[O?"unshift":"push"](()=>{E=O,t(5,E)})}const _e=O=>he(O,!0);function qe(O){rt[O?"unshift":"push"](()=>{g=O,t(4,g)})}return s.$$set=O=>{"target"in O&&t(21,p=O.target),"options"in O&&t(20,h=O.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n={...u,...h,defaultPosition:{...u.defaultPosition,...h.defaultPosition}}),s.$$.dirty[0]&4194316&&c(t(11,i=yi(w?P?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window<"u"&&(t(0,S=Math.max(fe,Math.min(window.innerWidth-(n.width||0),S))),t(1,b=Math.max(fe,Math.min(window.innerHeight-(n.height||0),b)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${C}px; bottom: ${R}%; transform: none; cursor: ${A?"grabbing":"grab"};`)},[S,b,P,n,g,E,z,B,X,ae,o,i,l,Y,he,Fe,ie,Ge,se,ke,h,p,w,A,C,R,ee,Se,_e,qe]}class tl extends un{constructor(e){super(),cn(this,e,el,$o,Ct,{target:21,options:20},null,[-1,-1])}}re.SyAssistant=tl,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "name": "@sy-design/svelte",
3
- "version": "1.0.3",
4
- "description": "跨框架组件封装",
5
- "type": "module",
6
- "module": "dist/index.es.js",
7
- "main": "dist/index.umd.js",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/index.es.js",
11
- "require": "./dist/index.umd.js"
12
- },
13
- "./style.css": "./dist/style.css"
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "scripts": {
19
- "build": "vite build"
20
- },
21
- "dependencies": {
22
- "svelte": "^4.2.10",
23
- "@microsoft/fetch-event-source": "^2.0.1",
24
- "marked": "^11.1.0",
25
- "dompurify": "^3.0.6"
26
- },
27
- "devDependencies": {
28
- "@sveltejs/package": "^2.2.6",
29
- "@sveltejs/vite-plugin-svelte": "^3.0.2",
30
- "@tsconfig/svelte": "^5.0.2",
31
- "svelte-check": "^3.6.3",
32
- "svelte-preprocess": "^5.1.3",
33
- "typescript": "^5.2.2",
34
- "tslib": "^2.6.2",
35
- "vite": "^5.0.10"
36
- }
37
- }
1
+ {
2
+ "name": "@sy-design/svelte",
3
+ "version": "1.0.5",
4
+ "description": "跨框架组件封装",
5
+ "type": "module",
6
+ "module": "dist/index.es.js",
7
+ "main": "dist/index.umd.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.es.js",
11
+ "require": "./dist/index.umd.js"
12
+ },
13
+ "./style.css": "./dist/style.css"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "vite build"
20
+ },
21
+ "dependencies": {
22
+ "svelte": "^4.2.10",
23
+ "@microsoft/fetch-event-source": "^2.0.1",
24
+ "marked": "^11.1.0",
25
+ "dompurify": "^3.0.6"
26
+ },
27
+ "devDependencies": {
28
+ "@sveltejs/package": "^2.2.6",
29
+ "@sveltejs/vite-plugin-svelte": "^3.0.2",
30
+ "@tsconfig/svelte": "^5.0.2",
31
+ "svelte-check": "^3.6.3",
32
+ "svelte-preprocess": "^5.1.3",
33
+ "typescript": "^5.2.2",
34
+ "tslib": "^2.6.2",
35
+ "vite": "^5.0.10"
36
+ }
37
+ }
package/dist/index.cjs DELETED
@@ -1,48 +0,0 @@
1
- "use strict";var pi=Object.defineProperty;var Zn=s=>{throw TypeError(s)};var di=(s,e,t)=>e in s?pi(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var te=(s,e,t)=>di(s,typeof e!="symbol"?e+"":e,t),gi=(s,e,t)=>e.has(s)||Zn("Cannot "+t);var Xn=(s,e,t)=>e.has(s)?Zn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t);var Nt=(s,e,t)=>(gi(s,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Se(){}function Os(s){return s()}function Vn(){return Object.create(null)}function ke(s){s.forEach(Os)}function yn(s){return typeof s=="function"}function Zt(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function mi(s){return Object.keys(s).length===0}function wi(s,...e){if(s==null){for(const n of e)n(void 0);return Se}const t=s.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const Ds=typeof window<"u";let Qn=Ds?()=>window.performance.now():()=>Date.now(),Ns=Ds?s=>requestAnimationFrame(s):Se;const ct=new Set;function Ps(s){ct.forEach(e=>{e.c(s)||(ct.delete(e),e.f())}),ct.size!==0&&Ns(Ps)}function ki(s){let e;return ct.size===0&&Ns(Ps),{promise:new Promise(t=>{ct.add(e={c:s,f:t})}),abort(){ct.delete(e)}}}function m(s,e){s.appendChild(e)}function G(s,e,t){s.insertBefore(e,t||null)}function j(s){s.parentNode&&s.parentNode.removeChild(s)}function _i(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function x(s){return document.createElement(s)}function V(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function we(s){return document.createTextNode(s)}function W(){return we(" ")}function Xt(){return we("")}function H(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function Fs(s){return function(e){return e.preventDefault(),s.call(this,e)}}function r(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function bi(s){return Array.from(s.childNodes)}function ze(s,e){e=""+e,s.data!==e&&(s.data=e)}function ft(s,e){s.value=e??""}function N(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}function Q(s,e,t){s.classList.toggle(e,!!t)}let At;function vt(s){At=s}function Tn(){if(!At)throw new Error("Function called outside component initialization");return At}function Hs(s){Tn().$$.on_mount.push(s)}function yi(s){Tn().$$.after_update.push(s)}function Ti(s){Tn().$$.on_destroy.push(s)}const at=[],ht=[];let ut=[];const Kn=[],vi=Promise.resolve();let hn=!1;function Ei(){hn||(hn=!0,vi.then(Bs))}function pn(s){ut.push(s)}const sn=new Set;let lt=0;function Bs(){if(lt!==0)return;const s=At;do{try{for(;lt<at.length;){const e=at[lt];lt++,vt(e),Si(e.$$)}}catch(e){throw at.length=0,lt=0,e}for(vt(null),at.length=0,lt=0;ht.length;)ht.pop()();for(let e=0;e<ut.length;e+=1){const t=ut[e];sn.has(t)||(sn.add(t),t())}ut.length=0}while(at.length);for(;Kn.length;)Kn.pop()();hn=!1,sn.clear(),vt(s)}function Si(s){if(s.fragment!==null){s.update(),ke(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(pn)}}function Ai(s){const e=[],t=[];ut.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),ut=e}const jt=new Set;let Je;function vn(){Je={r:0,c:[],p:Je}}function En(){Je.r||ke(Je.c),Je=Je.p}function Ce(s,e){s&&s.i&&(jt.delete(s),s.i(e))}function qe(s,e,t,n){if(s&&s.o){if(jt.has(s))return;jt.add(s),Je.c.push(()=>{jt.delete(s),n&&(t&&s.d(1),n())}),s.o(e)}else n&&n()}function pt(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function Us(s,e){s.d(1),e.delete(s.key)}function js(s,e,t,n,i,o,l,a,c,u,h,p){let g=s.length,d=o.length,w=g;const E={};for(;w--;)E[s[w].key]=w;const z=[],M=new Map,y=new Map,_=[];for(w=d;w--;){const A=p(i,o,w),C=t(A);let R=l.get(C);R?_.push(()=>R.p(A,e)):(R=u(C,A),R.c()),M.set(C,z[w]=R),C in E&&y.set(C,Math.abs(w-E[C]))}const k=new Set,S=new Set;function b(A){Ce(A,1),A.m(a,h),l.set(A.key,A),h=A.first,d--}for(;g&&d;){const A=z[d-1],C=s[g-1],R=A.key,P=C.key;A===C?(h=A.first,g--,d--):M.has(P)?!l.has(R)||k.has(R)?b(A):S.has(P)?g--:y.get(R)>y.get(P)?(S.add(R),b(A)):(k.add(P),g--):(c(C,l),g--)}for(;g--;){const A=s[g];M.has(A.key)||c(A,l)}for(;d;)b(z[d-1]);return ke(_),z}function Sn(s){s&&s.c()}function Vt(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),pn(()=>{const o=s.$$.on_mount.map(Os).filter(yn);s.$$.on_destroy?s.$$.on_destroy.push(...o):ke(o),s.$$.on_mount=[]}),i.forEach(pn)}function Qt(s,e){const t=s.$$;t.fragment!==null&&(Ai(t.after_update),ke(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function xi(s,e){s.$$.dirty[0]===-1&&(at.push(s),Ei(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function An(s,e,t,n,i,o,l=null,a=[-1]){const c=At;vt(s);const u=s.$$={fragment:null,ctx:[],props:o,update:Se,not_equal:i,bound:Vn(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Vn(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let h=!1;if(u.ctx=t?t(s,e.props||{},(p,g,...d)=>{const w=d.length?d[0]:g;return u.ctx&&i(u.ctx[p],u.ctx[p]=w)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](w),h&&xi(s,p)),g}):[],u.update(),h=!0,ke(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=bi(e.target);u.fragment&&u.fragment.l(p),p.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&Ce(s.$$.fragment),Vt(s,e.target,e.anchor),Bs()}vt(c)}class xn{constructor(){te(this,"$$");te(this,"$$set")}$destroy(){Qt(this,1),this.$destroy=Se}$on(e,t){if(!yn(t))return Se;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!mi(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ri="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ri);const rt=[];function Ii(s,e=Se){let t;const n=new Set;function i(a){if(Zt(s,a)&&(s=a,t)){const c=!rt.length;for(const u of n)u[1](),rt.push(u,s);if(c){for(let u=0;u<rt.length;u+=2)rt[u][0](rt[u+1]);rt.length=0}}}function o(a){i(a(s))}function l(a,c=Se){const u=[a,c];return n.add(u),n.size===1&&(t=e(i,o)||Se),a(s),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:i,update:o,subscribe:l}}function Jn(s){return Object.prototype.toString.call(s)==="[object Date]"}function dn(s,e,t,n){if(typeof t=="number"||Jn(t)){const i=n-t,o=(t-e)/(s.dt||1/60),l=s.opts.stiffness*i,a=s.opts.damping*o,c=(l-a)*s.inv_mass,u=(o+c)*s.dt;return Math.abs(u)<s.opts.precision&&Math.abs(i)<s.opts.precision?n:(s.settled=!1,Jn(t)?new Date(t.getTime()+u):t+u)}else{if(Array.isArray(t))return t.map((i,o)=>dn(s,e[o],t[o],n[o]));if(typeof t=="object"){const i={};for(const o in t)i[o]=dn(s,e[o],t[o],n[o]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function zi(s,e={}){const t=Ii(s),{stiffness:n=.15,damping:i=.8,precision:o=.01}=e;let l,a,c,u=s,h=s,p=1,g=0,d=!1;function w(z,M={}){h=z;const y=c={};return s==null||M.hard||E.stiffness>=1&&E.damping>=1?(d=!0,l=Qn(),u=z,t.set(s=h),Promise.resolve()):(M.soft&&(g=1/((M.soft===!0?.5:+M.soft)*60),p=0),a||(l=Qn(),d=!1,a=ki(_=>{if(d)return d=!1,a=null,!1;p=Math.min(p+g,1);const k={inv_mass:p,opts:E,settled:!0,dt:(_-l)*60/1e3},S=dn(k,u,s,h);return l=_,u=s,t.set(s=S),k.settled&&(a=null),!k.settled})),new Promise(_=>{a.promise.then(()=>{y===c&&_()})}))}const E={set:w,update:(z,M)=>w(z(h,s),M),subscribe:t.subscribe,stiffness:n,damping:i,precision:o};return E}async function Ci(s,e){const t=s.getReader();let n;for(;!(n=await t.read()).done;)e(n.value)}function Li(s){let e,t,n,i=!1;return function(l){e===void 0?(e=l,t=0,n=-1):e=Oi(e,l);const a=e.length;let c=0;for(;t<a;){i&&(e[t]===10&&(c=++t),i=!1);let u=-1;for(;t<a&&u===-1;++t)switch(e[t]){case 58:n===-1&&(n=t-c);break;case 13:i=!0;case 10:u=t;break}if(u===-1)break;s(e.subarray(c,u),n),c=t,n=-1}c===a?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Mi(s,e,t){let n=$n();const i=new TextDecoder;return function(l,a){if(l.length===0)t==null||t(n),n=$n();else if(a>0){const c=i.decode(l.subarray(0,a)),u=a+(l[a+1]===32?2:1),h=i.decode(l.subarray(u));switch(c){case"data":n.data=n.data?n.data+`
2
- `+h:h;break;case"event":n.event=h;break;case"id":s(n.id=h);break;case"retry":const p=parseInt(h,10);isNaN(p)||e(n.retry=p);break}}}}function Oi(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function $n(){return{data:"",event:"",id:"",retry:void 0}}var Di=function(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t};const gn="text/event-stream",Ni=1e3,es="last-event-id";function Pi(s,e){var{signal:t,headers:n,onopen:i,onmessage:o,onclose:l,onerror:a,openWhenHidden:c,fetch:u}=e,h=Di(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,g)=>{const d=Object.assign({},n);d.accept||(d.accept=gn);let w;function E(){w.abort(),document.hidden||S()}c||document.addEventListener("visibilitychange",E);let z=Ni,M=0;function y(){document.removeEventListener("visibilitychange",E),window.clearTimeout(M),w.abort()}t==null||t.addEventListener("abort",()=>{y(),p()});const _=u??window.fetch,k=i??Fi;async function S(){var b;w=new AbortController;try{const A=await _(s,Object.assign(Object.assign({},h),{headers:d,signal:w.signal}));await k(A),await Ci(A.body,Li(Mi(C=>{C?d[es]=C:delete d[es]},C=>{z=C},o))),l==null||l(),y(),p()}catch(A){if(!w.signal.aborted)try{const C=(b=a==null?void 0:a(A))!==null&&b!==void 0?b:z;window.clearTimeout(M),M=window.setTimeout(S,C)}catch(C){y(),g(C)}}}S()})}function Fi(s){const e=s.headers.get("content-type");if(!(e!=null&&e.startsWith(gn)))throw new Error(`Expected content-type to be ${gn}, Actual: ${e}`)}function Rn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let tt=Rn();function Ws(s){tt=s}const Gs=/[&<>"']/,Hi=new RegExp(Gs.source,"g"),qs=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Bi=new RegExp(qs.source,"g"),Ui={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ts=s=>Ui[s];function Re(s,e){if(e){if(Gs.test(s))return s.replace(Hi,ts)}else if(qs.test(s))return s.replace(Bi,ts);return s}const ji=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Wi(s){return s.replace(ji,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Gi=/(^|[^\[])\^/g;function $(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(Gi,"$1"),t=t.replace(i,l),n},getRegex:()=>new RegExp(t,e)};return n}function ns(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const Et={exec:()=>null};function ss(s,e){const t=s.replace(/\|/g,(o,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Pt(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const o=s.charAt(n-i-1);if(o===e&&!t)i++;else if(o!==e&&t)i++;else break}return s.slice(0,n-i)}function qi(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function is(s,e,t,n){const i=e.href,o=e.title?Re(e.title):null,l=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const a={type:"link",raw:t,href:i,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:o,text:Re(l)}}function Yi(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
3
- `).map(i=>{const o=i.match(/^\s+/);if(o===null)return i;const[l]=o;return l.length>=n.length?i.slice(n.length):i}).join(`
4
- `)}class Gt{constructor(e){te(this,"options");te(this,"rules");te(this,"lexer");this.options=e||tt}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Pt(n,`
5
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Yi(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Pt(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const n=Pt(t[0].replace(/^ *>[ \t]?/gm,""),`
6
- `),i=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,o={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const l=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",c="",u=!1;for(;e;){let h=!1;if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let p=t[2].split(`
7
- `,1)[0].replace(/^\t+/,M=>" ".repeat(3*M.length)),g=e.split(`
8
- `,1)[0],d=0;this.options.pedantic?(d=2,c=p.trimStart()):(d=t[2].search(/[^ ]/),d=d>4?1:d,c=p.slice(d),d+=t[1].length);let w=!1;if(!p&&/^ *$/.test(g)&&(a+=g+`
9
- `,e=e.substring(g.length+1),h=!0),!h){const M=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),_=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const S=e.split(`
10
- `,1)[0];if(g=S,this.options.pedantic&&(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),_.test(g)||k.test(g)||M.test(g)||y.test(e))break;if(g.search(/[^ ]/)>=d||!g.trim())c+=`
11
- `+g.slice(d);else{if(w||p.search(/[^ ]/)>=4||_.test(p)||k.test(p)||y.test(p))break;c+=`
12
- `+g}!w&&!g.trim()&&(w=!0),a+=S+`
13
- `,e=e.substring(S.length+1),p=g.slice(d)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(a)&&(u=!0));let E=null,z;this.options.gfm&&(E=/^\[[ xX]\] /.exec(c),E&&(z=E[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!E,checked:z,loose:!1,text:c,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){const p=o.items[h].tokens.filter(d=>d.type==="space"),g=p.length>0&&p.some(d=>/\n.*\n/.test(d.raw));o.loose=g}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=ss(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
- `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const a of i)/^ *-+: *$/.test(a)?l.align.push("right"):/^ *:-+: *$/.test(a)?l.align.push("center"):/^ *:-+ *$/.test(a)?l.align.push("left"):l.align.push(null);for(const a of n)l.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of o)l.rows.push(ss(a,l.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return l}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
15
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Re(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const l=Pt(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=qi(t[2],"()");if(l>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],o="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);l&&(i=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),is(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),o=t[i.toLowerCase()];if(!o){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return is(n,o,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...i[0]].length-1;let a,c,u=l,h=0;const p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+l);(i=p.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(c=[...a].length,i[3]||i[4]){u+=c;continue}else if((i[5]||i[6])&&l%3&&!((l+c)%3)){h+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+h);const g=[...i[0]][0].length,d=e.slice(0,l+i.index+g+c);if(Math.min(l,c)%2){const E=d.slice(1,-1);return{type:"em",raw:d,text:E,tokens:this.lexer.inlineTokens(E)}}const w=d.slice(2,-2);return{type:"strong",raw:d,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return i&&o&&(n=n.substring(1,n.length-1)),n=Re(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=Re(t[1]),i="mailto:"+n):(n=Re(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let i,o;if(t[2]==="@")i=Re(t[0]),o="mailto:"+i;else{let l;do l=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(l!==t[0]);i=Re(t[0]),t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=Re(t[0]),{type:"text",raw:t[0],text:n}}}}const Zi=/^(?: *(?:\n|$))+/,Xi=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Vi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ys=/(?:[*+-]|\d{1,9}[.)])/,Zs=$(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ys).getRegex(),In=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ki=/^[^\n]+/,zn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ji=$(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",zn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$i=$(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ys).getRegex(),Kt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cn=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,eo=$("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",Cn).replace("tag",Kt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xs=$(In).replace("hr",xt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Kt).getRegex(),to=$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xs).getRegex(),Ln={blockquote:to,code:Xi,def:Ji,fences:Vi,heading:Qi,hr:xt,html:eo,lheading:Zs,list:$i,newline:Zi,paragraph:Xs,table:Et,text:Ki},os=$("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",xt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Kt).getRegex(),no={...Ln,table:os,paragraph:$(In).replace("hr",xt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",os).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Kt).getRegex()},so={...Ln,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Et,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(In).replace("hr",xt).replace("heading",` *#{1,6} *[^
16
- ]`).replace("lheading",Zs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Vs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,io=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Qs=/^( {2,}|\\)\n(?!\s*$)/,oo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Rt="\\p{P}$+<=>`^|~",lo=$(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Rt).getRegex(),ro=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,ao=$(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Rt).getRegex(),co=$("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Rt).getRegex(),uo=$("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Rt).getRegex(),fo=$(/\\([punct])/,"gu").replace(/punct/g,Rt).getRegex(),ho=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),po=$(Cn).replace("(?:-->|$)","-->").getRegex(),go=$("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",po).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,mo=$(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",qt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ks=$(/^!?\[(label)\]\[(ref)\]/).replace("label",qt).replace("ref",zn).getRegex(),Js=$(/^!?\[(ref)\](?:\[\])?/).replace("ref",zn).getRegex(),wo=$("reflink|nolink(?!\\()","g").replace("reflink",Ks).replace("nolink",Js).getRegex(),Mn={_backpedal:Et,anyPunctuation:fo,autolink:ho,blockSkip:ro,br:Qs,code:io,del:Et,emStrongLDelim:ao,emStrongRDelimAst:co,emStrongRDelimUnd:uo,escape:Vs,link:mo,nolink:Js,punctuation:lo,reflink:Ks,reflinkSearch:wo,tag:go,text:oo,url:Et},ko={...Mn,link:$(/^!?\[(label)\]\((.*?)\)/).replace("label",qt).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qt).getRegex()},mn={...Mn,escape:$(Vs).replace("])","~|])").getRegex(),url:$(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},_o={...mn,br:$(Qs).replace("{2,}","*").getRegex(),text:$(mn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ft={normal:Ln,gfm:no,pedantic:so},wt={normal:Mn,gfm:mn,breaks:_o,pedantic:ko};class He{constructor(e){te(this,"tokens");te(this,"options");te(this,"state");te(this,"tokenizer");te(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||tt,this.options.tokenizer=this.options.tokenizer||new Gt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Ft.normal,inline:wt.normal};this.options.pedantic?(t.block=Ft.pedantic,t.inline=wt.pedantic):this.options.gfm&&(t.block=Ft.gfm,this.options.breaks?t.inline=wt.breaks:t.inline=wt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ft,inline:wt}}static lex(e,t){return new He(t).lex(e)}static lexInline(e,t){return new He(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
17
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,c,u)=>c+" ".repeat(u.length));let n,i,o,l;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
18
- `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
19
- `+n.raw,i.text+=`
20
- `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
21
- `+n.raw,i.text+=`
22
- `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const c=e.slice(1);let u;this.options.extensions.startBlock.forEach(h=>{u=h.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){i=t[t.length-1],l&&i.type==="paragraph"?(i.raw+=`
23
- `+n.raw,i.text+=`
24
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),l=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
25
- `+n.raw,i.text+=`
26
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,o,l=e,a,c,u;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,a.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(u=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,l,u)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const p=e.slice(1);let g;this.options.extensions.startInline.forEach(d=>{g=d.call({lexer:this},p),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(o=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(u=n.raw.slice(-1)),c=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}}class Yt{constructor(e){te(this,"options");this.options=e||tt}code(e,t,n){var o;const i=(o=(t||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
27
- `,i?'<pre><code class="language-'+Re(i)+'">'+(n?e:Re(e,!0))+`</code></pre>
28
- `:"<pre><code>"+(n?e:Re(e,!0))+`</code></pre>
29
- `}blockquote(e){return`<blockquote>
30
- ${e}</blockquote>
31
- `}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
32
- `}hr(){return`<hr>
33
- `}list(e,t,n){const i=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+i+o+`>
34
- `+e+"</"+i+`>
35
- `}listitem(e,t,n){return`<li>${e}</li>
36
- `}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
37
- `}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
38
- <thead>
39
- `+e+`</thead>
40
- `+t+`</table>
41
- `}tablerow(e){return`<tr>
42
- ${e}</tr>
43
- `}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
44
- `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=ns(e);if(i===null)return n;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){const i=ns(e);if(i===null)return n;e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class On{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Be{constructor(e){te(this,"options");te(this,"renderer");te(this,"textRenderer");this.options=e||tt,this.options.renderer=this.options.renderer||new Yt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new On}static parse(e,t){return new Be(t).parse(e)}static parseInline(e,t){return new Be(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=o,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=a||"";continue}}switch(o.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const l=o;n+=this.renderer.heading(this.parseInline(l.tokens),l.depth,Wi(this.parseInline(l.tokens,this.textRenderer)));continue}case"code":{const l=o;n+=this.renderer.code(l.text,l.lang,!!l.escaped);continue}case"table":{const l=o;let a="",c="";for(let h=0;h<l.header.length;h++)c+=this.renderer.tablecell(this.parseInline(l.header[h].tokens),{header:!0,align:l.align[h]});a+=this.renderer.tablerow(c);let u="";for(let h=0;h<l.rows.length;h++){const p=l.rows[h];c="";for(let g=0;g<p.length;g++)c+=this.renderer.tablecell(this.parseInline(p[g].tokens),{header:!1,align:l.align[g]});u+=this.renderer.tablerow(c)}n+=this.renderer.table(a,u);continue}case"blockquote":{const l=o,a=this.parse(l.tokens);n+=this.renderer.blockquote(a);continue}case"list":{const l=o,a=l.ordered,c=l.start,u=l.loose;let h="";for(let p=0;p<l.items.length;p++){const g=l.items[p],d=g.checked,w=g.task;let E="";if(g.task){const z=this.renderer.checkbox(!!d);u?g.tokens.length>0&&g.tokens[0].type==="paragraph"?(g.tokens[0].text=z+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&g.tokens[0].tokens[0].type==="text"&&(g.tokens[0].tokens[0].text=z+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:z+" "}):E+=z+" "}E+=this.parse(g.tokens,u),h+=this.renderer.listitem(E,w,!!d)}n+=this.renderer.list(h,a,c);continue}case"html":{const l=o;n+=this.renderer.html(l.text,l.block);continue}case"paragraph":{const l=o;n+=this.renderer.paragraph(this.parseInline(l.tokens));continue}case"text":{let l=o,a=l.tokens?this.parseInline(l.tokens):l.text;for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],a+=`
45
- `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}switch(o.type){case"escape":{const l=o;n+=t.text(l.text);break}case"html":{const l=o;n+=t.html(l.text);break}case"link":{const l=o;n+=t.link(l.href,l.title,this.parseInline(l.tokens,t));break}case"image":{const l=o;n+=t.image(l.href,l.title,l.text);break}case"strong":{const l=o;n+=t.strong(this.parseInline(l.tokens,t));break}case"em":{const l=o;n+=t.em(this.parseInline(l.tokens,t));break}case"codespan":{const l=o;n+=t.codespan(l.text);break}case"br":{n+=t.br();break}case"del":{const l=o;n+=t.del(this.parseInline(l.tokens,t));break}case"text":{const l=o;n+=t.text(l.text);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class St{constructor(e){te(this,"options");this.options=e||tt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}te(St,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var et,wn,$s;class bo{constructor(...e){Xn(this,et);te(this,"defaults",Rn());te(this,"options",this.setOptions);te(this,"parse",Nt(this,et,wn).call(this,He.lex,Be.parse));te(this,"parseInline",Nt(this,et,wn).call(this,He.lexInline,Be.parseInline));te(this,"Parser",Be);te(this,"Renderer",Yt);te(this,"TextRenderer",On);te(this,"Lexer",He);te(this,"Tokenizer",Gt);te(this,"Hooks",St);this.use(...e)}walkTokens(e,t){var i,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const a=l;for(const c of a.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of a.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const a=l;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=l;(o=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=t.renderers[o.name];l?t.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=l.apply(this,a)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),i.extensions=t),n.renderer){const o=this.defaults.renderer||new Yt(this.defaults);for(const l in n.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.renderer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p||""}}i.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Gt(this.defaults);for(const l in n.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const a=l,c=n.tokenizer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new St;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.hooks[a],u=o[a];St.passThroughHooks.has(l)?o[a]=h=>{if(this.defaults.async)return Promise.resolve(c.call(o,h)).then(g=>u.call(o,g));const p=c.call(o,h);return u.call(o,p)}:o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(l.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return He.lex(e,t??this.defaults)}parser(e,t){return Be.parse(e,t??this.defaults)}}et=new WeakSet,wn=function(e,t){return(n,i)=>{const o={...i},l={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const a=Nt(this,et,$s).call(this,!!l.silent,!!l.async);if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(c=>e(c,l)).then(c=>l.hooks?l.hooks.processAllTokens(c):c).then(c=>l.walkTokens?Promise.all(this.walkTokens(c,l.walkTokens)).then(()=>c):c).then(c=>t(c,l)).then(c=>l.hooks?l.hooks.postprocess(c):c).catch(a);try{l.hooks&&(n=l.hooks.preprocess(n));let c=e(n,l);l.hooks&&(c=l.hooks.processAllTokens(c)),l.walkTokens&&this.walkTokens(c,l.walkTokens);let u=t(c,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(c){return a(c)}}},$s=function(e,t){return n=>{if(n.message+=`
46
- Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Re(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const $e=new bo;function K(s,e){return $e.parse(s,e)}K.options=K.setOptions=function(s){return $e.setOptions(s),K.defaults=$e.defaults,Ws(K.defaults),K};K.getDefaults=Rn;K.defaults=tt;K.use=function(...s){return $e.use(...s),K.defaults=$e.defaults,Ws(K.defaults),K};K.walkTokens=function(s,e){return $e.walkTokens(s,e)};K.parseInline=$e.parseInline;K.Parser=Be;K.parser=Be.parse;K.Renderer=Yt;K.TextRenderer=On;K.Lexer=He;K.lexer=He.lex;K.Tokenizer=Gt;K.Hooks=St;K.parse=K;K.options;K.setOptions;K.use;K.walkTokens;K.parseInline;Be.parse;He.lex;/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:ei,setPrototypeOf:ls,isFrozen:yo,getPrototypeOf:To,getOwnPropertyDescriptor:vo}=Object;let{freeze:ye,seal:Le,create:ti}=Object,{apply:kn,construct:_n}=typeof Reflect<"u"&&Reflect;ye||(ye=function(e){return e});Le||(Le=function(e){return e});kn||(kn=function(e,t,n){return e.apply(t,n)});_n||(_n=function(e,t){return new e(...t)});const Ht=Ie(Array.prototype.forEach),rs=Ie(Array.prototype.pop),kt=Ie(Array.prototype.push),Wt=Ie(String.prototype.toLowerCase),on=Ie(String.prototype.toString),as=Ie(String.prototype.match),_t=Ie(String.prototype.replace),Eo=Ie(String.prototype.indexOf),So=Ie(String.prototype.trim),Me=Ie(Object.prototype.hasOwnProperty),be=Ie(RegExp.prototype.test),bt=Ao(TypeError);function Ie(s){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return kn(s,e,n)}}function Ao(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _n(s,t)}}function q(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wt;ls&&ls(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(yo(e)||(e[n]=o),i=o)}s[i]=!0}return s}function xo(s){for(let e=0;e<s.length;e++)Me(s,e)||(s[e]=null);return s}function Ke(s){const e=ti(null);for(const[t,n]of ei(s))Me(s,t)&&(Array.isArray(n)?e[t]=xo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=Ke(n):e[t]=n);return e}function yt(s,e){for(;s!==null;){const n=vo(s,e);if(n){if(n.get)return Ie(n.get);if(typeof n.value=="function")return Ie(n.value)}s=To(s)}function t(){return null}return t}const cs=ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ln=ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),rn=ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ro=ye(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),an=ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Io=ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),us=ye(["#text"]),fs=ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cn=ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hs=ye(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bt=ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zo=Le(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Co=Le(/<%[\w\W]*|[\w\W]*%>/gm),Lo=Le(/\$\{[\w\W]*}/gm),Mo=Le(/^data-[\-\w.\u00B7-\uFFFF]+$/),Oo=Le(/^aria-[\-\w]+$/),ni=Le(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Do=Le(/^(?:\w+script|data):/i),No=Le(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),si=Le(/^html$/i),Po=Le(/^[a-z][.\w]*(-[.\w]+)+$/i);var ps=Object.freeze({__proto__:null,ARIA_ATTR:Oo,ATTR_WHITESPACE:No,CUSTOM_ELEMENT:Po,DATA_ATTR:Mo,DOCTYPE_NAME:si,ERB_EXPR:Co,IS_ALLOWED_URI:ni,IS_SCRIPT_OR_DATA:Do,MUSTACHE_EXPR:zo,TMPLIT_EXPR:Lo});const Tt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Fo=function(){return typeof window>"u"?null:window},Ho=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ds=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ii(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fo();const e=D=>ii(D);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==Tt.document)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:p,DOMParser:g,trustedTypes:d}=s,w=c.prototype,E=yt(w,"cloneNode"),z=yt(w,"remove"),M=yt(w,"nextSibling"),y=yt(w,"childNodes"),_=yt(w,"parentNode");if(typeof l=="function"){const D=t.createElement("template");D.content&&D.content.ownerDocument&&(t=D.content.ownerDocument)}let k,S="";const{implementation:b,createNodeIterator:A,createDocumentFragment:C,getElementsByTagName:R}=t,{importNode:P}=n;let I=ds();e.isSupported=typeof ei=="function"&&typeof _=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:Z,TMPLIT_EXPR:Y,DATA_ATTR:le,ARIA_ATTR:re,IS_SCRIPT_OR_DATA:fe,ATTR_WHITESPACE:Te,CUSTOM_ELEMENT:ae}=ps;let{IS_ALLOWED_URI:Oe}=ps,se=null;const Ue=q({},[...cs,...ln,...rn,...an,...us]);let ne=null;const de=q({},[...fs,...cn,...hs,...Bt]);let J=Object.seal(ti(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ve=null,ge=null,je=!0,O=!0,ee=!1,F=!0,X=!1,Ae=!0,xe=!1,Ye=!1,Ve=!1,Ze=!1,nt=!1,st=!1,It=!0,zt=!1;const Jt="user-content-";let dt=!0,Qe=!1,T={},U=null;const ie=q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ce=null;const De=q({},["audio","video","img","source","image","track"]);let Xe=null;const Ne=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ct="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",We="http://www.w3.org/1999/xhtml";let it=We,$t=!1,en=null;const li=q({},[Ct,Lt,We],on);let Mt=q({},["mi","mo","mn","ms","mtext"]),Ot=q({},["annotation-xml"]);const ri=q({},["title","style","font","a","script"]);let gt=null;const ai=["application/xhtml+xml","text/html"],ci="text/html";let he=null,ot=null;const ui=t.createElement("form"),Dn=function(f){return f instanceof RegExp||f instanceof Function},tn=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ot&&ot===f)){if((!f||typeof f!="object")&&(f={}),f=Ke(f),gt=ai.indexOf(f.PARSER_MEDIA_TYPE)===-1?ci:f.PARSER_MEDIA_TYPE,he=gt==="application/xhtml+xml"?on:Wt,se=Me(f,"ALLOWED_TAGS")?q({},f.ALLOWED_TAGS,he):Ue,ne=Me(f,"ALLOWED_ATTR")?q({},f.ALLOWED_ATTR,he):de,en=Me(f,"ALLOWED_NAMESPACES")?q({},f.ALLOWED_NAMESPACES,on):li,Xe=Me(f,"ADD_URI_SAFE_ATTR")?q(Ke(Ne),f.ADD_URI_SAFE_ATTR,he):Ne,ce=Me(f,"ADD_DATA_URI_TAGS")?q(Ke(De),f.ADD_DATA_URI_TAGS,he):De,U=Me(f,"FORBID_CONTENTS")?q({},f.FORBID_CONTENTS,he):ie,ve=Me(f,"FORBID_TAGS")?q({},f.FORBID_TAGS,he):{},ge=Me(f,"FORBID_ATTR")?q({},f.FORBID_ATTR,he):{},T=Me(f,"USE_PROFILES")?f.USE_PROFILES:!1,je=f.ALLOW_ARIA_ATTR!==!1,O=f.ALLOW_DATA_ATTR!==!1,ee=f.ALLOW_UNKNOWN_PROTOCOLS||!1,F=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,X=f.SAFE_FOR_TEMPLATES||!1,Ae=f.SAFE_FOR_XML!==!1,xe=f.WHOLE_DOCUMENT||!1,Ze=f.RETURN_DOM||!1,nt=f.RETURN_DOM_FRAGMENT||!1,st=f.RETURN_TRUSTED_TYPE||!1,Ve=f.FORCE_BODY||!1,It=f.SANITIZE_DOM!==!1,zt=f.SANITIZE_NAMED_PROPS||!1,dt=f.KEEP_CONTENT!==!1,Qe=f.IN_PLACE||!1,Oe=f.ALLOWED_URI_REGEXP||ni,it=f.NAMESPACE||We,Mt=f.MATHML_TEXT_INTEGRATION_POINTS||Mt,Ot=f.HTML_INTEGRATION_POINTS||Ot,J=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&Dn(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&Dn(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(O=!1),nt&&(Ze=!0),T&&(se=q({},us),ne=[],T.html===!0&&(q(se,cs),q(ne,fs)),T.svg===!0&&(q(se,ln),q(ne,cn),q(ne,Bt)),T.svgFilters===!0&&(q(se,rn),q(ne,cn),q(ne,Bt)),T.mathMl===!0&&(q(se,an),q(ne,hs),q(ne,Bt))),f.ADD_TAGS&&(se===Ue&&(se=Ke(se)),q(se,f.ADD_TAGS,he)),f.ADD_ATTR&&(ne===de&&(ne=Ke(ne)),q(ne,f.ADD_ATTR,he)),f.ADD_URI_SAFE_ATTR&&q(Xe,f.ADD_URI_SAFE_ATTR,he),f.FORBID_CONTENTS&&(U===ie&&(U=Ke(U)),q(U,f.FORBID_CONTENTS,he)),dt&&(se["#text"]=!0),xe&&q(se,["html","head","body"]),se.table&&(q(se,["tbody"]),delete ve.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw bt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw bt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,S=k.createHTML("")}else k===void 0&&(k=Ho(d,i)),k!==null&&typeof S=="string"&&(S=k.createHTML(""));ye&&ye(f),ot=f}},Nn=q({},[...ln,...rn,...Ro]),Pn=q({},[...an,...Io]),fi=function(f){let v=_(f);(!v||!v.tagName)&&(v={namespaceURI:it,tagName:"template"});const L=Wt(f.tagName),oe=Wt(v.tagName);return en[f.namespaceURI]?f.namespaceURI===Lt?v.namespaceURI===We?L==="svg":v.namespaceURI===Ct?L==="svg"&&(oe==="annotation-xml"||Mt[oe]):!!Nn[L]:f.namespaceURI===Ct?v.namespaceURI===We?L==="math":v.namespaceURI===Lt?L==="math"&&Ot[oe]:!!Pn[L]:f.namespaceURI===We?v.namespaceURI===Lt&&!Ot[oe]||v.namespaceURI===Ct&&!Mt[oe]?!1:!Pn[L]&&(ri[L]||!Nn[L]):!!(gt==="application/xhtml+xml"&&en[f.namespaceURI]):!1},Pe=function(f){kt(e.removed,{element:f});try{_(f).removeChild(f)}catch{z(f)}},Dt=function(f,v){try{kt(e.removed,{attribute:v.getAttributeNode(f),from:v})}catch{kt(e.removed,{attribute:null,from:v})}if(v.removeAttribute(f),f==="is")if(Ze||nt)try{Pe(v)}catch{}else try{v.setAttribute(f,"")}catch{}},Fn=function(f){let v=null,L=null;if(Ve)f="<remove></remove>"+f;else{const pe=as(f,/^[\r\n\t ]+/);L=pe&&pe[0]}gt==="application/xhtml+xml"&&it===We&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const oe=k?k.createHTML(f):f;if(it===We)try{v=new g().parseFromString(oe,gt)}catch{}if(!v||!v.documentElement){v=b.createDocument(it,"template",null);try{v.documentElement.innerHTML=$t?S:oe}catch{}}const me=v.body||v.documentElement;return f&&L&&me.insertBefore(t.createTextNode(L),me.childNodes[0]||null),it===We?R.call(v,xe?"html":"body")[0]:xe?v.documentElement:me},Hn=function(f){return A.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},nn=function(f){return f instanceof p&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof h)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},Bn=function(f){return typeof a=="function"&&f instanceof a};function Ge(D,f,v){Ht(D,L=>{L.call(e,f,v,ot)})}const Un=function(f){let v=null;if(Ge(I.beforeSanitizeElements,f,null),nn(f))return Pe(f),!0;const L=he(f.nodeName);if(Ge(I.uponSanitizeElement,f,{tagName:L,allowedTags:se}),f.hasChildNodes()&&!Bn(f.firstElementChild)&&be(/<[/\w]/g,f.innerHTML)&&be(/<[/\w]/g,f.textContent)||f.nodeType===Tt.progressingInstruction||Ae&&f.nodeType===Tt.comment&&be(/<[/\w]/g,f.data))return Pe(f),!0;if(!se[L]||ve[L]){if(!ve[L]&&Wn(L)&&(J.tagNameCheck instanceof RegExp&&be(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L)))return!1;if(dt&&!U[L]){const oe=_(f)||f.parentNode,me=y(f)||f.childNodes;if(me&&oe){const pe=me.length;for(let Ee=pe-1;Ee>=0;--Ee){const Fe=E(me[Ee],!0);Fe.__removalCount=(f.__removalCount||0)+1,oe.insertBefore(Fe,M(f))}}}return Pe(f),!0}return f instanceof c&&!fi(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&be(/<\/no(script|embed|frames)/i,f.innerHTML)?(Pe(f),!0):(X&&f.nodeType===Tt.text&&(v=f.textContent,Ht([B,Z,Y],oe=>{v=_t(v,oe," ")}),f.textContent!==v&&(kt(e.removed,{element:f.cloneNode()}),f.textContent=v)),Ge(I.afterSanitizeElements,f,null),!1)},jn=function(f,v,L){if(It&&(v==="id"||v==="name")&&(L in t||L in ui))return!1;if(!(O&&!ge[v]&&be(le,v))){if(!(je&&be(re,v))){if(!ne[v]||ge[v]){if(!(Wn(f)&&(J.tagNameCheck instanceof RegExp&&be(J.tagNameCheck,f)||J.tagNameCheck instanceof Function&&J.tagNameCheck(f))&&(J.attributeNameCheck instanceof RegExp&&be(J.attributeNameCheck,v)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(v))||v==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&be(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L))))return!1}else if(!Xe[v]){if(!be(Oe,_t(L,Te,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&f!=="script"&&Eo(L,"data:")===0&&ce[f])){if(!(ee&&!be(fe,_t(L,Te,"")))){if(L)return!1}}}}}}return!0},Wn=function(f){return f!=="annotation-xml"&&as(f,ae)},Gn=function(f){Ge(I.beforeSanitizeAttributes,f,null);const{attributes:v}=f;if(!v||nn(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let oe=v.length;for(;oe--;){const me=v[oe],{name:pe,namespaceURI:Ee,value:Fe}=me,mt=he(pe);let _e=pe==="value"?Fe:So(Fe);if(L.attrName=mt,L.attrValue=_e,L.keepAttr=!0,L.forceKeepAttr=void 0,Ge(I.uponSanitizeAttribute,f,L),_e=L.attrValue,zt&&(mt==="id"||mt==="name")&&(Dt(pe,f),_e=Jt+_e),Ae&&be(/((--!?|])>)|<\/(style|title)/i,_e)){Dt(pe,f);continue}if(L.forceKeepAttr||(Dt(pe,f),!L.keepAttr))continue;if(!F&&be(/\/>/i,_e)){Dt(pe,f);continue}X&&Ht([B,Z,Y],Yn=>{_e=_t(_e,Yn," ")});const qn=he(f.nodeName);if(jn(qn,mt,_e)){if(k&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Ee)switch(d.getAttributeType(qn,mt)){case"TrustedHTML":{_e=k.createHTML(_e);break}case"TrustedScriptURL":{_e=k.createScriptURL(_e);break}}try{Ee?f.setAttributeNS(Ee,pe,_e):f.setAttribute(pe,_e),nn(f)?Pe(f):rs(e.removed)}catch{}}}Ge(I.afterSanitizeAttributes,f,null)},hi=function D(f){let v=null;const L=Hn(f);for(Ge(I.beforeSanitizeShadowDOM,f,null);v=L.nextNode();)Ge(I.uponSanitizeShadowNode,v,null),Un(v),Gn(v),v.content instanceof o&&D(v.content);Ge(I.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(D){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,L=null,oe=null,me=null;if($t=!D,$t&&(D="<!-->"),typeof D!="string"&&!Bn(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw bt("dirty is not a string, aborting")}else throw bt("toString is not a function");if(!e.isSupported)return D;if(Ye||tn(f),e.removed=[],typeof D=="string"&&(Qe=!1),Qe){if(D.nodeName){const Fe=he(D.nodeName);if(!se[Fe]||ve[Fe])throw bt("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof a)v=Fn("<!---->"),L=v.ownerDocument.importNode(D,!0),L.nodeType===Tt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?v=L:v.appendChild(L);else{if(!Ze&&!X&&!xe&&D.indexOf("<")===-1)return k&&st?k.createHTML(D):D;if(v=Fn(D),!v)return Ze?null:st?S:""}v&&Ve&&Pe(v.firstChild);const pe=Hn(Qe?D:v);for(;oe=pe.nextNode();)Un(oe),Gn(oe),oe.content instanceof o&&hi(oe.content);if(Qe)return D;if(Ze){if(nt)for(me=C.call(v.ownerDocument);v.firstChild;)me.appendChild(v.firstChild);else me=v;return(ne.shadowroot||ne.shadowrootmode)&&(me=P.call(n,me,!0)),me}let Ee=xe?v.outerHTML:v.innerHTML;return xe&&se["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&be(si,v.ownerDocument.doctype.name)&&(Ee="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
47
- `+Ee),X&&Ht([B,Z,Y],Fe=>{Ee=_t(Ee,Fe," ")}),k&&st?k.createHTML(Ee):Ee},e.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tn(D),Ye=!0},e.clearConfig=function(){ot=null,Ye=!1},e.isValidAttribute=function(D,f,v){ot||tn({});const L=he(D),oe=he(f);return jn(L,oe,v)},e.addHook=function(D,f){typeof f=="function"&&kt(I[D],f)},e.removeHook=function(D){return rs(I[D])},e.removeHooks=function(D){I[D]=[]},e.removeAllHooks=function(){I=ds()},e}var gs=ii();function ms(s,e,t){const n=s.slice();return n[24]=e[t],n}function ws(s){let e,t=s[9].text+"",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),N(e,"left",s[9].x+"px"),N(e,"top",s[9].y+"px"),N(e,"z-index",s[3]+3)},m(i,o){G(i,e,o),m(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&ze(n,t),o&512&&N(e,"left",i[9].x+"px"),o&512&&N(e,"top",i[9].y+"px"),o&8&&N(e,"z-index",i[3]+3)},d(i){i&&j(e)}}}function Bo(s){let e=[],t=new Map,n,i,o=pt(s[0]);const l=c=>c[24].id;for(let c=0;c<o.length;c+=1){let u=ms(s,o,c),h=l(u);t.set(h,e[c]=ks(h,u))}let a=s[5]&&_s();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=W(),a&&a.c(),i=Xt()},m(c,u){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(c,u);G(c,n,u),a&&a.m(c,u),G(c,i,u)},p(c,u){u&8261&&(o=pt(c[0]),e=js(e,u,l,1,c,o,t,n.parentNode,Us,ks,n,ms)),c[5]?a||(a=_s(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},d(c){c&&(j(n),j(i));for(let u=0;u<e.length;u+=1)e[u].d(c);a&&a.d(c)}}}function Uo(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){G(i,e,o),m(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&ze(n,t)},d(i){i&&j(e)}}}function ks(s,e){let t,n,i,o,l=e[24].title+"",a,c,u,h=ys(e[24].timestamp)+"",p,g,d,w,E,z,M,y,_,k,S;function b(){return e[17](e[24])}function A(...C){return e[18](e[24],...C)}return{key:s,first:null,c(){t=x("div"),n=x("button"),i=x("div"),o=x("div"),a=we(l),c=W(),u=x("div"),p=we(h),g=W(),d=x("button"),w=V("svg"),E=V("path"),z=V("path"),M=V("path"),r(o,"class","sy-session-title svelte-1g6fj9a"),r(u,"class","sy-session-time svelte-1g6fj9a"),r(i,"class","sy-session-info svelte-1g6fj9a"),r(n,"class","sy-session-select svelte-1g6fj9a"),r(E,"d","M3 6h18"),r(z,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),r(M,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),r(w,"xmlns","http://www.w3.org/2000/svg"),r(w,"width","16"),r(w,"height","16"),r(w,"viewBox","0 0 24 24"),r(w,"fill","none"),r(w,"stroke","currentColor"),r(w,"stroke-width","2"),r(w,"stroke-linecap","round"),r(w,"stroke-linejoin","round"),r(d,"class","sy-session-delete svelte-1g6fj9a"),d.disabled=y=e[6]===e[24].id,r(d,"aria-label","删除会话"),r(t,"class","sy-session-item svelte-1g6fj9a"),r(t,"data-session-id",_=e[24].id),Q(t,"deleting",e[24].deleting),this.first=t},m(C,R){G(C,t,R),m(t,n),m(n,i),m(i,o),m(o,a),m(i,c),m(i,u),m(u,p),m(t,g),m(t,d),m(d,w),m(w,E),m(w,z),m(w,M),k||(S=[H(n,"click",b),H(d,"click",A)],k=!0)},p(C,R){e=C,R&1&&l!==(l=e[24].title+"")&&ze(a,l),R&1&&h!==(h=ys(e[24].timestamp)+"")&&ze(p,h),R&65&&y!==(y=e[6]===e[24].id)&&(d.disabled=y),R&1&&_!==(_=e[24].id)&&r(t,"data-session-id",_),R&1&&Q(t,"deleting",e[24].deleting)},d(C){C&&j(t),k=!1,ke(S)}}}function _s(s){let e;return{c(){e=x("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',r(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){G(t,e,n)},d(t){t&&j(e)}}}function bs(s){let e,t,n,i,o,l,a,c,u;return{c(){e=x("div"),t=x("div"),t.textContent="确认删除此会话?",n=W(),i=x("div"),o=x("button"),o.textContent="取消",l=W(),a=x("button"),a.textContent="删除",r(t,"class","sy-session-confirm-content svelte-1g6fj9a"),r(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),r(a,"class","sy-session-confirm-delete svelte-1g6fj9a"),r(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),r(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),N(e,"left",s[8].x+"px"),N(e,"top",s[8].y+"px"),N(e,"z-index",s[3]+3)},m(h,p){G(h,e,p),m(e,t),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[H(o,"click",s[19]),H(a,"click",s[14])],c=!0)},p(h,p){p&256&&N(e,"left",h[8].x+"px"),p&256&&N(e,"top",h[8].y+"px"),p&8&&N(e,"z-index",h[3]+3)},d(h){h&&j(e),c=!1,ke(u)}}}function jo(s){let e,t,n,i,o,l,a,c,u,h,p,g,d,w,E,z,M,y,_,k=s[9]&&ws(s);function S(R,P){return R[0].length===0?Uo:Bo}let b=S(s),A=b(s),C=s[7]&&bs(s);return{c(){e=x("div"),t=x("div"),n=x("h2"),n.textContent="历史会话",i=W(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',l=W(),a=x("div"),c=x("input"),u=W(),h=V("svg"),p=V("circle"),g=V("line"),d=W(),k&&k.c(),w=W(),E=x("div"),A.c(),z=W(),C&&C.c(),M=Xt(),r(n,"class","svelte-1g6fj9a"),r(o,"class","sy-session-close svelte-1g6fj9a"),r(o,"aria-label","关闭历史会话"),r(t,"class","sy-session-header svelte-1g6fj9a"),r(c,"type","text"),r(c,"class","sy-session-search-input svelte-1g6fj9a"),r(c,"placeholder","搜索历史会话..."),r(p,"cx","11"),r(p,"cy","11"),r(p,"r","8"),r(g,"x1","21"),r(g,"y1","21"),r(g,"x2","16.65"),r(g,"y2","16.65"),r(h,"class","sy-session-search-icon svelte-1g6fj9a"),r(h,"xmlns","http://www.w3.org/2000/svg"),r(h,"width","16"),r(h,"height","16"),r(h,"viewBox","0 0 24 24"),r(h,"fill","none"),r(h,"stroke","currentColor"),r(h,"stroke-width","2"),r(h,"stroke-linecap","round"),r(h,"stroke-linejoin","round"),r(a,"class","sy-session-search svelte-1g6fj9a"),r(E,"class","sy-session-list svelte-1g6fj9a"),r(e,"class","sy-session-history svelte-1g6fj9a"),N(e,"z-index",s[3]+2)},m(R,P){G(R,e,P),m(e,t),m(t,n),m(t,i),m(t,o),m(e,l),m(e,a),m(a,c),ft(c,s[4]),m(a,u),m(a,h),m(h,p),m(h,g),m(e,d),k&&k.m(e,null),m(e,w),m(e,E),A.m(E,null),G(R,z,P),C&&C.m(R,P),G(R,M,P),y||(_=[H(o,"click",function(){yn(s[1])&&s[1].apply(this,arguments)}),H(o,"mouseenter",s[15]),H(o,"mouseleave",s[12]),H(c,"input",s[16]),H(E,"scroll",s[10])],y=!0)},p(R,[P]){s=R,P&16&&c.value!==s[4]&&ft(c,s[4]),s[9]?k?k.p(s,P):(k=ws(s),k.c(),k.m(e,w)):k&&(k.d(1),k=null),b===(b=S(s))&&A?A.p(s,P):(A.d(1),A=b(s),A&&(A.c(),A.m(E,null))),P&8&&N(e,"z-index",s[3]+2),s[7]?C?C.p(s,P):(C=bs(s),C.c(),C.m(M.parentNode,M)):C&&(C.d(1),C=null)},i:Se,o:Se,d(R){R&&(j(e),j(z),j(M)),k&&k.d(),A.d(),C&&C.d(R),y=!1,ke(_)}}}const un=10;function ys(s){return new Date(s).toLocaleString()}function Wo(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:o}=e,{zIndex:l}=e,a=!1,c=!0,u=0,h="",p=null,g=null,d={x:0,y:0};async function w(){if(!(a||!c)){t(5,a=!0);try{const I=await fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({start:u,length:un,keyword:h})});if(!I.ok)throw new Error("Failed to load sessions");const B=await I.json();if(B.code===0){const Z=B.data.sessionList.map(Y=>({id:Y.session_id,title:Y.name,timestamp:new Date(Y.createDate).getTime()}));t(0,n=[...n,...Z]),u+=un,c=Z.length===un}}catch(I){console.error("Failed to load sessions:",I)}finally{t(5,a=!1)}}}function E(I){const B=I.target,{scrollTop:Z,scrollHeight:Y,clientHeight:le}=B;Y-Z-le<50&&w()}Hs(()=>{w()});let z=null;function M(I,B){const Y=I.currentTarget.getBoundingClientRect();t(9,z={text:B,x:Y.left+Y.width/2,y:Y.bottom+8})}function y(){t(9,z=null)}function _(I,B){const Y=I.currentTarget.getBoundingClientRect();t(8,d={x:Y.left-16,y:Y.top+Y.height/2}),t(7,g=B)}async function k(I){if(I&&!p)try{t(6,p=I),t(7,g=null);const B=document.querySelector(`[data-session-id="${I}"]`);B&&B.classList.add("deleting"),await new Promise(le=>setTimeout(le,300));const Z=await fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:I})});if(!Z.ok)throw new Error("Delete request failed");const Y=await Z.json();if(Y.code===0&&Y.data.respCode===0)t(0,n=n.map(le=>({...le,deleting:le.id===I}))),setTimeout(()=>{t(0,n=n.filter(le=>!le.deleting))},300);else throw new Error("Delete failed: "+Y.message)}catch(B){console.error("Failed to delete session:",B);const Z=document.querySelector(`[data-session-id="${I}"]`);Z&&Z.classList.remove("deleting")}finally{t(6,p=null)}}function S(){g&&k(g)}const b=I=>M(I,"关闭历史会话");function A(){h=this.value,t(4,h)}const C=I=>o(I.id),R=(I,B)=>_(B,I.id),P=()=>t(7,g=null);return s.$$set=I=>{"sessions"in I&&t(0,n=I.sessions),"onClose"in I&&t(1,i=I.onClose),"onSelect"in I&&t(2,o=I.onSelect),"zIndex"in I&&t(3,l=I.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&h!==void 0&&(t(0,n=[]),u=0,c=!0,w())},[n,i,o,l,h,a,p,g,d,z,E,M,y,_,S,b,A,C,R,P]}class oi extends xn{constructor(e){super(),An(this,e,Wo,jo,Zt,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function Ts(s,e,t){const n=s.slice();return n[60]=e[t],n[61]=e,n[62]=t,n}function vs(s,e,t){const n=s.slice();return n[63]=e[t],n[65]=t,n}function Go(s){let e,t=[],n=new Map,i=pt(s[3]);const o=l=>l[60].id;for(let l=0;l<i.length;l+=1){let a=Ts(s,i,l),c=o(a);n.set(c,t[l]=zs(c,a))}return{c(){e=x("div");for(let l=0;l<t.length;l+=1)t[l].c();r(e,"class","sy-assistant-message-list svelte-46wzni")},m(l,a){G(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[46](e)},p(l,a){a[0]&267665145&&(i=pt(l[3]),t=js(t,a,o,1,l,i,n,e,Us,zs,null,Ts))},i:Se,o:Se,d(l){l&&j(e);for(let a=0;a<t.length;a+=1)t[a].d();s[46](null)}}}function qo(s){let e,t;return e=new oi({props:{sessions:s[16],onClose:s[29],onSelect:s[30],zIndex:s[0]}}),{c(){Sn(e.$$.fragment)},m(n,i){Vt(e,n,i),t=!0},p(n,i){const o={};i[0]&65536&&(o.sessions=n[16]),i[0]&1&&(o.zIndex=n[0]),e.$set(o)},i(n){t||(Ce(e.$$.fragment,n),t=!0)},o(n){qe(e.$$.fragment,n),t=!1},d(n){Qt(e,n)}}}function Yo(s){let e;return{c(){e=x("div"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></svg>',r(e,"class","sy-assistant-avatar user svelte-46wzni")},m(t,n){G(t,e,n)},d(t){t&&j(e)}}}function Zo(s){let e;return{c(){e=x("div"),e.innerHTML='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor"><path d="M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z" fill="#6F8698"></path><path d="M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z" fill="#3677FF"></path><path d="M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z" fill="#D0D5F1"></path><path d="M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z" fill="#3677FF"></path><path d="M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z" fill="#8896A4"></path></svg>',r(e,"class","sy-assistant-avatar assistant svelte-46wzni")},m(t,n){G(t,e,n)},d(t){t&&j(e)}}}function Xo(s){let e,t=s[18](s[60].content)+"";return{c(){e=x("div"),r(e,"class","markdown-content svelte-46wzni")},m(n,i){G(n,e,i),e.innerHTML=t},p(n,i){i[0]&8&&t!==(t=n[18](n[60].content)+"")&&(e.innerHTML=t)},d(n){n&&j(e)}}}function Vo(s){let e;return{c(){e=x("span"),e.innerHTML='<span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span>',r(e,"class","sy-assistant-loading svelte-46wzni")},m(t,n){G(t,e,n)},p:Se,d(t){t&&j(e)}}}function Es(s){let e,t=pt(s[60].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=xs(vs(s,t,i));return{c(){e=x("div");for(let i=0;i<n.length;i+=1)n[i].c();r(e,"class","sy-assistant-attachments svelte-46wzni")},m(i,o){G(i,e,o);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(e,null)},p(i,o){if(o[0]&3145849){t=pt(i[60].attachments);let l;for(l=0;l<t.length;l+=1){const a=vs(i,t,l);n[l]?n[l].p(a,o):(n[l]=xs(a),n[l].c(),n[l].m(e,null))}for(;l<n.length;l+=1)n[l].d(1);n.length=t.length}},d(i){i&&j(e),_i(n,i)}}}function Ss(s){let e,t,n;function i(...o){return s[33](s[63],...o)}return{c(){e=x("button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',r(e,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(e,"aria-label","查看详情")},m(o,l){G(o,e,l),t||(n=[H(e,"mouseenter",i),H(e,"mouseleave",s[21])],t=!0)},p(o,l){s=o},d(o){o&&j(e),t=!1,ke(n)}}}function As(s){let e,t=s[4].replace(/\n/g,"<br>")+"",n,i;return{c(){e=x("div"),r(e,"class","sy-assistant-tooltip svelte-46wzni"),r(e,"role","tooltip"),N(e,"left",s[5].x+"px"),N(e,"top",s[5].y+"px"),N(e,"z-index",s[0]+3),Q(e,"align-right",s[5].alignRight)},m(o,l){G(o,e,l),e.innerHTML=t,n||(i=[H(e,"mouseenter",s[35]),H(e,"mouseleave",s[36])],n=!0)},p(o,l){l[0]&16&&t!==(t=o[4].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&32&&N(e,"left",o[5].x+"px"),l[0]&32&&N(e,"top",o[5].y+"px"),l[0]&1&&N(e,"z-index",o[0]+3),l[0]&32&&Q(e,"align-right",o[5].alignRight)},d(o){o&&j(e),n=!1,ke(i)}}}function xs(s){let e,t,n,i,o,l,a,c,u,h=Ut(s[63].content_title).name+"",p,g,d,w=Ut(s[63].content_title).ext+"",E,z,M,y,_,k,S,b,A,C,R=s[63].tips&&Ss(s);function P(){return s[34](s[63])}let I=s[4]&&As(s);return{c(){e=x("div"),t=x("div"),n=x("div"),i=V("svg"),o=V("path"),l=V("polyline"),a=W(),c=x("div"),u=x("span"),p=we(h),g=W(),d=x("span"),E=we(w),M=W(),y=x("div"),R&&R.c(),_=W(),k=x("button"),k.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>',S=W(),I&&I.c(),b=W(),r(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),r(l,"points","13 2 13 9 20 9"),r(i,"xmlns","http://www.w3.org/2000/svg"),r(i,"width","16"),r(i,"height","16"),r(i,"viewBox","0 0 24 24"),r(i,"fill","none"),r(i,"stroke","currentColor"),r(i,"stroke-width","2"),r(i,"stroke-linecap","round"),r(i,"stroke-linejoin","round"),r(u,"class","sy-assistant-filename svelte-46wzni"),r(d,"class","sy-assistant-attachment-ext svelte-46wzni"),r(c,"class","sy-assistant-attachment-name svelte-46wzni"),r(c,"title",z=s[63].content_title),r(n,"class","sy-assistant-attachment-title svelte-46wzni"),r(k,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(k,"aria-label","下载文件"),r(y,"class","sy-assistant-attachment-actions svelte-46wzni"),r(t,"class","sy-assistant-attachment-header svelte-46wzni"),r(e,"class","sy-assistant-attachment svelte-46wzni")},m(B,Z){G(B,e,Z),m(e,t),m(t,n),m(n,i),m(i,o),m(i,l),m(n,a),m(n,c),m(c,u),m(u,p),m(c,g),m(c,d),m(d,E),m(t,M),m(t,y),R&&R.m(y,null),m(y,_),m(y,k),m(e,S),I&&I.m(e,null),m(e,b),A||(C=H(k,"click",P),A=!0)},p(B,Z){s=B,Z[0]&8&&h!==(h=Ut(s[63].content_title).name+"")&&ze(p,h),Z[0]&8&&w!==(w=Ut(s[63].content_title).ext+"")&&ze(E,w),Z[0]&8&&z!==(z=s[63].content_title)&&r(c,"title",z),s[63].tips?R?R.p(s,Z):(R=Ss(s),R.c(),R.m(y,_)):R&&(R.d(1),R=null),s[4]?I?I.p(s,Z):(I=As(s),I.c(),I.m(e,b)):I&&(I.d(1),I=null)},d(B){B&&j(e),R&&R.d(),I&&I.d(),A=!1,C()}}}function Rs(s){let e,t,n,i,o,l,a,c,u,h,p;function g(b,A){return b[9][b[60].id]?Ko:Qo}let d=g(s),w=d(s);function E(){return s[37](s[60])}function z(...b){return s[38](s[60],...b)}function M(){return s[39](s[60])}function y(...b){return s[40](s[60],...b)}function _(...b){return s[41](s[60],...b)}function k(...b){return s[42](s[60],...b)}let S=s[12]&&s[10][s[60].id]==="dislike"&&Is(s);return{c(){e=x("div"),t=x("button"),w.c(),i=W(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',l=W(),a=x("button"),a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h3a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-3"></path></svg>',c=W(),S&&S.c(),u=Xt(),r(t,"class","sy-assistant-action-button svelte-46wzni"),r(t,"aria-label",n=s[9][s[60].id]?"已复制":"复制内容"),Q(t,"copied",s[9][s[60].id]),r(o,"class","sy-assistant-action-button svelte-46wzni"),r(o,"aria-label","点赞"),Q(o,"active",s[10][s[60].id]==="like"),r(a,"class","sy-assistant-action-button svelte-46wzni"),r(a,"aria-label","点踩"),Q(a,"active",s[10][s[60].id]==="dislike"),r(e,"class","sy-assistant-message-actions svelte-46wzni")},m(b,A){G(b,e,A),m(e,t),w.m(t,null),m(e,i),m(e,o),m(e,l),m(e,a),G(b,c,A),S&&S.m(b,A),G(b,u,A),h||(p=[H(t,"click",E),H(t,"mouseenter",z),H(t,"mouseleave",s[27]),H(o,"click",M),H(o,"mouseenter",y),H(o,"mouseleave",s[27]),H(a,"click",_),H(a,"mouseenter",k),H(a,"mouseleave",s[27])],h=!0)},p(b,A){s=b,d!==(d=g(s))&&(w.d(1),w=d(s),w&&(w.c(),w.m(t,null))),A[0]&520&&n!==(n=s[9][s[60].id]?"已复制":"复制内容")&&r(t,"aria-label",n),A[0]&520&&Q(t,"copied",s[9][s[60].id]),A[0]&1032&&Q(o,"active",s[10][s[60].id]==="like"),A[0]&1032&&Q(a,"active",s[10][s[60].id]==="dislike"),s[12]&&s[10][s[60].id]==="dislike"?S?S.p(s,A):(S=Is(s),S.c(),S.m(u.parentNode,u)):S&&(S.d(1),S=null)},d(b){b&&(j(e),j(c),j(u)),w.d(),S&&S.d(b),h=!1,ke(p)}}}function Qo(s){let e,t,n;return{c(){e=V("svg"),t=V("rect"),n=V("path"),r(t,"x","9"),r(t,"y","9"),r(t,"width","13"),r(t,"height","13"),r(t,"rx","2"),r(t,"ry","2"),r(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(i,o){G(i,e,o),m(e,t),m(e,n)},d(i){i&&j(e)}}}function Ko(s){let e,t;return{c(){e=V("svg"),t=V("polyline"),r(t,"points","20 6 9 17 4 12"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(n,i){G(n,e,i),m(e,t)},d(n){n&&j(e)}}}function Is(s){let e,t,n,i,o,l,a,c,u;function h(){s[43].call(t,s[60])}function p(){return s[44](s[60])}function g(){return s[45](s[60])}return{c(){e=x("div"),t=x("textarea"),n=W(),i=x("div"),o=x("button"),o.textContent="取消",l=W(),a=x("button"),a.textContent="提交",r(t,"class","sy-assistant-dislike-input svelte-46wzni"),r(t,"placeholder","请输入您的反馈意见..."),r(o,"class","sy-assistant-popup-cancel svelte-46wzni"),r(a,"class","sy-assistant-popup-submit svelte-46wzni"),r(i,"class","sy-assistant-popup-actions svelte-46wzni"),r(e,"class","sy-assistant-dislike-popup svelte-46wzni"),N(e,"left",s[13].x+"px"),N(e,"top",s[13].y+"px"),N(e,"z-index",s[0]+3)},m(d,w){G(d,e,w),m(e,t),ft(t,s[11][s[60].id]),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[H(t,"input",h),H(o,"click",p),H(a,"click",g)],c=!0)},p(d,w){s=d,w[0]&2056&&ft(t,s[11][s[60].id]),w[0]&8192&&N(e,"left",s[13].x+"px"),w[0]&8192&&N(e,"top",s[13].y+"px"),w[0]&1&&N(e,"z-index",s[0]+3)},d(d){d&&j(e),c=!1,ke(u)}}}function zs(s,e){let t,n,i,o,l,a,c,u,h=new Date(e[60].timestamp).toLocaleTimeString()+"",p,g;function d(S,b){return S[60].type==="assistant"?Zo:Yo}let w=d(e),E=w(e);function z(S,b){return S[7]&&S[60].id===S[3][S[3].length-1].id&&S[60].type==="assistant"&&!S[60].content?Vo:Xo}let M=z(e),y=M(e),_=e[60].attachments&&Es(e),k=e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]&&Rs(e);return{key:s,first:null,c(){t=x("div"),E.c(),n=W(),i=x("div"),o=x("div"),y.c(),l=W(),_&&_.c(),a=W(),k&&k.c(),c=W(),u=x("div"),p=we(h),g=W(),r(o,"class","sy-assistant-message-content svelte-46wzni"),r(u,"class","sy-assistant-message-time svelte-46wzni"),r(i,"class","sy-assistant-message-bubble svelte-46wzni"),r(t,"class","sy-assistant-message svelte-46wzni"),Q(t,"user",e[60].type==="user"),this.first=t},m(S,b){G(S,t,b),E.m(t,null),m(t,n),m(t,i),m(i,o),y.m(o,null),m(o,l),_&&_.m(o,null),m(o,a),k&&k.m(o,null),m(i,c),m(i,u),m(u,p),m(t,g)},p(S,b){e=S,w!==(w=d(e))&&(E.d(1),E=w(e),E&&(E.c(),E.m(t,n))),M===(M=z(e))&&y?y.p(e,b):(y.d(1),y=M(e),y&&(y.c(),y.m(o,l))),e[60].attachments?_?_.p(e,b):(_=Es(e),_.c(),_.m(o,a)):_&&(_.d(1),_=null),e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]?k?k.p(e,b):(k=Rs(e),k.c(),k.m(o,null)):k&&(k.d(1),k=null),b[0]&8&&h!==(h=new Date(e[60].timestamp).toLocaleTimeString()+"")&&ze(p,h),b[0]&8&&Q(t,"user",e[60].type==="user")},d(S){S&&j(t),E.d(),y.d(),_&&_.d(),k&&k.d()}}}function Cs(s){let e,t,n,i,o,l,a,c,u,h,p,g,d,w,E,z,M,y,_,k,S,b,A,C;return{c(){e=x("div"),t=x("div"),n=x("button"),n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',i=W(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',l=W(),a=x("div"),c=x("div"),u=x("div"),h=x("div"),p=x("textarea"),g=W(),d=x("div"),w=we(s[2]),E=we("/"),z=we(bn),M=W(),y=x("button"),_=V("svg"),k=V("line"),S=V("polygon"),r(n,"class","sy-assistant-icon-button svelte-46wzni"),r(n,"aria-label","历史会话"),r(o,"class","sy-assistant-icon-button svelte-46wzni"),r(o,"aria-label","新建会话"),r(t,"class","sy-assistant-chat-actions svelte-46wzni"),r(e,"class","sy-assistant-chat-footer svelte-46wzni"),r(p,"class","sy-assistant-textarea svelte-46wzni"),r(p,"placeholder","输入您的问题..."),r(p,"maxlength",bn),r(p,"rows","3"),r(d,"class","sy-assistant-char-count svelte-46wzni"),Q(d,"over-limit",s[17]),r(h,"class","sy-assistant-textarea-container svelte-46wzni"),r(u,"class","sy-assistant-input-wrapper svelte-46wzni"),r(k,"x1","22"),r(k,"y1","2"),r(k,"x2","11"),r(k,"y2","13"),r(S,"points","22 2 15 22 11 13 2 9 22 2"),r(_,"xmlns","http://www.w3.org/2000/svg"),r(_,"width","20"),r(_,"height","20"),r(_,"viewBox","0 0 24 24"),r(_,"fill","none"),r(_,"stroke","currentColor"),r(_,"stroke-width","2"),r(_,"stroke-linecap","round"),r(_,"stroke-linejoin","round"),r(y,"class","sy-assistant-send-button svelte-46wzni"),y.disabled=b=!s[1].trim()||s[17],r(y,"aria-label","发送消息"),r(c,"class","sy-assistant-input-container svelte-46wzni"),r(a,"class","sy-assistant-input-area svelte-46wzni")},m(R,P){G(R,e,P),m(e,t),m(t,n),m(t,i),m(t,o),G(R,l,P),G(R,a,P),m(a,c),m(c,u),m(u,h),m(h,p),ft(p,s[1]),m(h,g),m(h,d),m(d,w),m(d,E),m(d,z),m(c,M),m(c,y),m(y,_),m(_,k),m(_,S),A||(C=[H(n,"click",s[28]),H(n,"mouseenter",s[47]),H(n,"mouseleave",s[27]),H(n,"blur",s[27]),H(o,"click",s[31]),H(o,"mouseenter",s[48]),H(o,"mouseleave",s[27]),H(p,"input",s[49]),H(p,"keydown",s[50]),H(y,"click",s[19]),H(y,"mouseenter",s[51]),H(y,"mouseleave",s[27])],A=!0)},p(R,P){P[0]&2&&ft(p,R[1]),P[0]&4&&ze(w,R[2]),P[0]&131072&&Q(d,"over-limit",R[17]),P[0]&131074&&b!==(b=!R[1].trim()||R[17])&&(y.disabled=b)},d(R){R&&(j(e),j(l),j(a)),A=!1,ke(C)}}}function Ls(s){let e,t=s[14].text+"",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-assistant-button-tooltip svelte-46wzni"),N(e,"left",s[14].x+"px"),N(e,"top",s[14].y+"px")},m(i,o){G(i,e,o),m(e,n)},p(i,o){o[0]&16384&&t!==(t=i[14].text+"")&&ze(n,t),o[0]&16384&&N(e,"left",i[14].x+"px"),o[0]&16384&&N(e,"top",i[14].y+"px")},d(i){i&&j(e)}}}function Jo(s){let e,t,n,i,o,l,a;const c=[qo,Go],u=[];function h(d,w){return d[15]?0:1}t=h(s),n=u[t]=c[t](s);let p=!s[15]&&Cs(s),g=s[14]&&Ls(s);return{c(){e=x("div"),n.c(),i=W(),p&&p.c(),o=W(),g&&g.c(),l=Xt(),r(e,"class","sy-assistant-chat-container svelte-46wzni"),N(e,"z-index",s[0]+2)},m(d,w){G(d,e,w),u[t].m(e,null),m(e,i),p&&p.m(e,null),s[52](e),G(d,o,w),g&&g.m(d,w),G(d,l,w),a=!0},p(d,w){let E=t;t=h(d),t===E?u[t].p(d,w):(vn(),qe(u[E],1,1,()=>{u[E]=null}),En(),n=u[t],n?n.p(d,w):(n=u[t]=c[t](d),n.c()),Ce(n,1),n.m(e,i)),d[15]?p&&(p.d(1),p=null):p?p.p(d,w):(p=Cs(d),p.c(),p.m(e,null)),(!a||w[0]&1)&&N(e,"z-index",d[0]+2),d[14]?g?g.p(d,w):(g=Ls(d),g.c(),g.m(l.parentNode,l)):g&&(g.d(1),g=null)},i(d){a||(Ce(n),a=!0)},o(d){qe(n),a=!1},d(d){d&&(j(e),j(o),j(l)),u[t].d(),p&&p.d(),s[52](null),g&&g.d(d)}}}let bn=500;function $o(s){const e=s.match(/source#\[(.*)\]#source/);if(e)try{return JSON.parse(`[${e[1]}]`)}catch(t){console.error("Failed to parse attachments:",t)}return null}function Ut(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}async function el(s,e){try{const t=await fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({fileName:s,fileUrl:e})});if(!t.ok)throw new Error("Download failed");const n=t.headers.get("content-type")||"application/octet-stream",i=await t.blob(),o=window.URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=s,document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(o),document.body.removeChild(l)}catch(t){console.error("Failed to download file:",t)}}function tl(s,e,t){let n,i,o="",l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],a="",c=null,u=null,h={x:0,y:0,alignRight:!1},p=null,g=!1;K.setOptions({breaks:!0,gfm:!0});function d(T){try{const U=K(T);return gs.sanitize(U)}catch(U){console.warn("Markdown parsing failed, fallback to HTML:",U);try{const ie=T.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return gs.sanitize(ie)}catch(ie){return console.error("HTML fallback failed:",ie),T}}}let w;function E(T=!1){w&&w.scrollTo({top:w.scrollHeight,behavior:T?"smooth":"auto"})}yi(()=>{E(!1)});let{sessionId:z}=e;async function M(){if(!o.trim()||i)return;if(!z){console.error("No session ID available");return}const T={id:Date.now().toString(),type:"user",content:o.trim(),timestamp:Date.now()};t(3,l=[...l,T]);const U=o.trim();t(1,o="");const ie=(Date.now()+1).toString();a="",t(3,l=[...l,{id:ie,type:"assistant",content:"",timestamp:Date.now()}]),t(7,g=!0),c&&c.abort(),c=new AbortController;try{await Pi("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:Date.now().toString(),keyword:U,flowId:"1"}),signal:c.signal,onmessage(ce){try{const De=ce.data;if(De){const Xe=$o(De);Xe?(t(3,l=l.map(Ne=>Ne.id===ie?{...Ne,attachments:Xe}:Ne)),E(!0)):(a+=De,t(3,l=l.map(Ne=>Ne.id===ie?{...Ne,content:a}:Ne)),E(!1))}}catch(De){console.error("Failed to process SSE message:",De)}},onerror(ce){console.error("SSE error:",ce),c=null,t(7,g=!1)},onclose(){c=null,t(7,g=!1)}})}catch(ce){console.error("Failed to send message:",ce),t(7,g=!1)}}function y(T,U,ie){const ce=ie.getBoundingClientRect(),De=w.getBoundingClientRect(),Xe=ce.left<De.width/2;t(4,u=U),t(5,h={x:ce.left,y:ce.top+ce.height/2,alignRight:Xe})}function _(){t(6,p=setTimeout(()=>{t(4,u=null),t(6,p=null)},200))}Ti(()=>{c&&c.abort(),p&&clearTimeout(p)});let k={};async function S(T,U){try{const ie=U.replace(/<br\s*\/?>/g,`
48
- `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();await navigator.clipboard.writeText(ie),t(9,k[T]=!0,k),setTimeout(()=>{t(9,k[T]=!1,k),t(9,k)},1500)}catch(ie){console.error("Failed to copy:",ie)}}let b={},A={},C=!1;async function R(T,U){if(b[T]===U){t(10,b[T]=null,b),t(10,b);return}if(t(10,b[T]=U,b),t(10,b),U==="like")try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(ie){console.error("Failed to send feedback:",ie),t(10,b[T]=null,b),t(10,b)}else t(12,C=!0)}async function P(T){var U;if((U=A[T])!=null&&U.trim())try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"0",feedBackContent:A[T]})})).ok)throw new Error("Feedback failed");t(12,C=!1),t(11,A[T]="",A),t(11,A)}catch(ie){console.error("Failed to send feedback:",ie),t(10,b[T]=null,b),t(10,b)}}let I={x:0,y:0};function B(T,U){const ce=T.currentTarget.getBoundingClientRect();t(13,I={x:ce.left-290,y:ce.top-160}),R(U,"dislike")}let Z=null;function Y(T,U){const ce=T.currentTarget.getBoundingClientRect();t(14,Z={text:U,x:ce.left+ce.width/2,y:ce.top-8})}function le(){t(14,Z=null)}let re=!1,fe=[],Te=Date.now().toString();function ae(){le(),t(15,re=!0)}function Oe(){le(),t(15,re=!1)}function se(T){Te=T,t(15,re=!1)}async function Ue(){const T=await ne();if(!T){console.error("Failed to create new session");return}Te=T,t(3,l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")}async function ne(){try{const T=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!T.ok)throw new Error("Failed to get session ID");const U=await T.json();if(U.code===0)return Te=U.data.sessionId,Te;throw new Error(U.message||"Failed to get session ID")}catch(T){return console.error("Failed to get session ID:",T),null}}let{zIndex:de}=e;const J=(T,U)=>y(U,T.tips,U.currentTarget),ve=T=>el(T.content_title,T.link),ge=()=>{p&&(clearTimeout(p),t(6,p=null))},je=()=>{t(4,u=null)},O=T=>S(T.id,T.content),ee=(T,U)=>Y(U,k[T.id]?"已复制":"复制内容"),F=T=>R(T.id,"like"),X=(T,U)=>Y(U,b[T.id]==="like"?"取消点赞":"点赞"),Ae=(T,U)=>B(U,T.id),xe=(T,U)=>Y(U,b[T.id]==="dislike"?"取消点踩":"点踩");function Ye(T){A[T.id]=this.value,t(11,A)}const Ve=T=>{t(12,C=!1),t(10,b[T.id]=null,b),t(10,b)},Ze=T=>P(T.id);function nt(T){ht[T?"unshift":"push"](()=>{w=T,t(8,w)})}const st=T=>Y(T,"历史会话"),It=T=>Y(T,"新建会话");function zt(){o=this.value,t(1,o)}const Jt=T=>T.key==="Enter"&&!T.shiftKey&&(M(),T.preventDefault()),dt=T=>Y(T,"发送消息");function Qe(T){ht[T?"unshift":"push"](()=>{w=T,t(8,w)})}return s.$$set=T=>{"sessionId"in T&&t(32,z=T.sessionId),"zIndex"in T&&t(0,de=T.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(17,i=n>bn)},[de,o,n,l,u,h,p,g,w,k,b,A,C,I,Z,re,fe,i,d,M,y,_,S,R,P,B,Y,le,ae,Oe,se,Ue,z,J,ve,ge,je,O,ee,F,X,Ae,xe,Ye,Ve,Ze,nt,st,It,zt,Jt,dt,Qe]}class nl extends xn{constructor(e){super(),An(this,e,tl,Jo,Zt,{sessionId:32,zIndex:0},null,[-1,-1,-1])}}function Ms(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,h,p,g,d,w,E=s[2]?"退出全屏":"全屏显示",z,M,y,_,k,S,b,A,C=s[7]?"取消吸附":"吸附到边缘",R,P,I,B,Z,Y,le,re,fe,Te=`${s[3].height}px`,ae,Oe,se;function Ue(F,X){return F[2]?il:sl}let ne=Ue(s),de=ne(s);function J(F,X){return F[7]?ll:ol}let ve=J(s),ge=ve(s);const je=[al,rl],O=[];function ee(F,X){return F[8]?0:1}return re=ee(s),fe=O[re]=je[re](s),{c(){e=x("div"),t=x("div"),n=x("div"),i=x("h3"),l=we(o),a=W(),c=x("div"),u=x("div"),h=x("button"),p=V("svg"),de.c(),d=W(),w=x("span"),z=we(E),M=W(),y=x("div"),_=x("button"),k=V("svg"),ge.c(),b=W(),A=x("span"),R=we(C),P=W(),I=x("div"),B=x("button"),B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',Z=W(),Y=x("span"),Y.textContent="关闭助手",le=W(),fe.c(),r(i,"class","svelte-1dubpto"),r(p,"xmlns","http://www.w3.org/2000/svg"),r(p,"width","18"),r(p,"height","18"),r(p,"viewBox","0 0 24 24"),r(p,"fill","none"),r(p,"stroke","currentColor"),r(p,"stroke-width","2"),r(p,"stroke-linecap","round"),r(p,"stroke-linejoin","round"),r(h,"class","sy-assistant-action-button svelte-1dubpto"),r(h,"aria-label",g=s[2]?"退出全屏":"全屏显示"),Q(h,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1dubpto"),r(u,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(k,"xmlns","http://www.w3.org/2000/svg"),r(k,"width","18"),r(k,"height","18"),r(k,"viewBox","0 0 24 24"),r(k,"fill","none"),r(k,"stroke","currentColor"),r(k,"stroke-width","2"),r(k,"stroke-linecap","round"),r(k,"stroke-linejoin","round"),r(_,"class","sy-assistant-action-button svelte-1dubpto"),r(_,"aria-label",S=s[7]?"取消吸附":"吸附到边缘"),Q(_,"active",s[7]),r(A,"class","sy-assistant-tooltip svelte-1dubpto"),r(y,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(B,"class","sy-assistant-close-button svelte-1dubpto"),r(B,"aria-label","关闭助手"),r(Y,"class","sy-assistant-tooltip svelte-1dubpto"),r(I,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(c,"class","sy-assistant-header-actions svelte-1dubpto"),r(n,"class","sy-assistant-drawer-header svelte-1dubpto"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),Q(n,"dragging",s[6]),Q(n,"fullscreen",s[2]),Q(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1dubpto"),r(e,"class","sy-assistant-drawer svelte-1dubpto"),Q(e,"fullscreen",s[2]),N(e,"height",Te)},m(F,X){G(F,e,X),m(e,t),m(t,n),m(n,i),m(i,l),m(n,a),m(n,c),m(c,u),m(u,h),m(h,p),de.m(p,null),m(u,d),m(u,w),m(w,z),m(c,M),m(c,y),m(y,_),m(_,k),ge.m(k,null),m(y,b),m(y,A),m(A,R),m(c,P),m(c,I),m(I,B),m(I,Z),m(I,Y),m(t,le),O[re].m(t,null),ae=!0,Oe||(se=[H(h,"click",s[16]),H(_,"click",s[18]),H(B,"click",s[15]),H(n,"mousedown",Fs(s[17]))],Oe=!0)},p(F,X){(!ae||X[0]&8)&&o!==(o=F[3].title+"")&&ze(l,o),ne!==(ne=Ue(F))&&(de.d(1),de=ne(F),de&&(de.c(),de.m(p,null))),(!ae||X[0]&4&&g!==(g=F[2]?"退出全屏":"全屏显示"))&&r(h,"aria-label",g),(!ae||X[0]&4)&&Q(h,"active",F[2]),(!ae||X[0]&4)&&E!==(E=F[2]?"退出全屏":"全屏显示")&&ze(z,E),ve!==(ve=J(F))&&(ge.d(1),ge=ve(F),ge&&(ge.c(),ge.m(k,null))),(!ae||X[0]&128&&S!==(S=F[7]?"取消吸附":"吸附到边缘"))&&r(_,"aria-label",S),(!ae||X[0]&128)&&Q(_,"active",F[7]),(!ae||X[0]&128)&&C!==(C=F[7]?"取消吸附":"吸附到边缘")&&ze(R,C),(!ae||X[0]&64)&&Q(n,"dragging",F[6]),(!ae||X[0]&4)&&Q(n,"fullscreen",F[2]),(!ae||X[0]&128)&&Q(n,"snapped",F[7]);let Ae=re;re=ee(F),re===Ae?O[re].p(F,X):(vn(),qe(O[Ae],1,1,()=>{O[Ae]=null}),En(),fe=O[re],fe?fe.p(F,X):(fe=O[re]=je[re](F),fe.c()),Ce(fe,1),fe.m(t,null)),(!ae||X[0]&4)&&Q(e,"fullscreen",F[2]),X[0]&8&&Te!==(Te=`${F[3].height}px`)&&N(e,"height",Te)},i(F){ae||(Ce(fe),ae=!0)},o(F){qe(fe),ae=!1},d(F){F&&j(e),de.d(),ge.d(),O[re].d(),Oe=!1,ke(se)}}}function sl(s){let e;return{c(){e=V("path"),r(e,"d","M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3")},m(t,n){G(t,e,n)},d(t){t&&j(e)}}}function il(s){let e;return{c(){e=V("path"),r(e,"d","M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3")},m(t,n){G(t,e,n)},d(t){t&&j(e)}}}function ol(s){let e,t;return{c(){e=V("rect"),t=V("line"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x1","16"),r(t,"y1","6"),r(t,"x2","16"),r(t,"y2","18")},m(n,i){G(n,e,i),G(n,t,i)},d(n){n&&(j(e),j(t))}}}function ll(s){let e,t;return{c(){e=V("rect"),t=V("rect"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x","12"),r(t,"y","10"),r(t,"width","6"),r(t,"height","8"),r(t,"rx","1"),r(t,"ry","1")},m(n,i){G(n,e,i),G(n,t,i)},d(n){n&&(j(e),j(t))}}}function rl(s){let e,t;return e=new nl({props:{zIndex:s[3].zIndex??1e3,sessionId:s[9]}}),{c(){Sn(e.$$.fragment)},m(n,i){Vt(e,n,i),t=!0},p(n,i){const o={};i[0]&8&&(o.zIndex=n[3].zIndex??1e3),i[0]&512&&(o.sessionId=n[9]),e.$set(o)},i(n){t||(Ce(e.$$.fragment,n),t=!0)},o(n){qe(e.$$.fragment,n),t=!1},d(n){Qt(e,n)}}}function al(s){let e,t;return e=new oi({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:s[3].zIndex??1e3}}),{c(){Sn(e.$$.fragment)},m(n,i){Vt(e,n,i),t=!0},p(n,i){const o={};i[0]&256&&(o.onClose=n[26]),i[0]&8&&(o.zIndex=n[3].zIndex??1e3),e.$set(o)},i(n){t||(Ce(e.$$.fragment,n),t=!0)},o(n){qe(e.$$.fragment,n),t=!1},d(n){Qt(e,n)}}}function cl(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,h,p,g,d,w,E,z,M,y=s[12]>0&&Ms(s);return{c(){e=x("div"),t=x("div"),y&&y.c(),i=W(),o=x("button"),l=V("svg"),a=V("path"),c=V("path"),u=V("path"),h=V("path"),p=V("path"),g=V("path"),d=V("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1dubpto"),Q(t,"fullscreen",s[2]),N(t,"width",n),r(a,"d","M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"),r(a,"fill","#6F8698"),r(c,"d","M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"),r(c,"fill","#3677FF"),r(u,"d","M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"),r(u,"fill","#D0D5F1"),r(h,"d","M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"),r(h,"fill","#3677FF"),r(p,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(p,"fill","#FFFFFF"),r(g,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(g,"fill","#FFFFFF"),r(d,"d","M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"),r(d,"fill","#8896A4"),r(l,"class","sy-assistant-icon"),r(l,"viewBox","0 0 1024 1024"),r(l,"version","1.1"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"width","32"),r(l,"height","32"),r(l,"fill","currentColor"),r(l,"aria-label","助手图标"),r(o,"class","sy-assistant-floating-button svelte-1dubpto"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+((s[3].zIndex??1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1dubpto"),Q(e,"fullscreen",s[2]),Q(e,"snapped",s[7]),N(e,"position",s[3].position),N(e,"right",s[7]?0:`${s[0]}px`),N(e,"bottom",s[7]?0:`${s[1]}px`),N(e,"top",s[7]||s[2]?"0":"auto"),N(e,"left",s[2]?"0":"auto"),N(e,"z-index",s[3].zIndex??1e3)},m(_,k){G(_,e,k),m(e,t),y&&y.m(t,null),m(e,i),m(e,o),m(o,l),m(l,a),m(l,c),m(l,u),m(l,h),m(l,p),m(l,g),m(l,d),s[27](o),s[29](e),E=!0,z||(M=[H(o,"click",s[15]),H(o,"mousedown",Fs(s[28]))],z=!0)},p(_,k){_[12]>0?y?(y.p(_,k),k[0]&4096&&Ce(y,1)):(y=Ms(_),y.c(),Ce(y,1),y.m(t,null)):y&&(vn(),qe(y,1,1,()=>{y=null}),En()),(!E||k[0]&4)&&Q(t,"fullscreen",_[2]),k[0]&4096&&n!==(n=`${_[12]}px`)&&N(t,"width",n),(!E||k[0]&1032&&w!==(w=_[10]+" z-index: "+((_[3].zIndex??1e3)+1)+";"))&&r(o,"style",w),(!E||k[0]&4)&&Q(e,"fullscreen",_[2]),(!E||k[0]&128)&&Q(e,"snapped",_[7]),k[0]&8&&N(e,"position",_[3].position),k[0]&129&&N(e,"right",_[7]?0:`${_[0]}px`),k[0]&130&&N(e,"bottom",_[7]?0:`${_[1]}px`),k[0]&132&&N(e,"top",_[7]||_[2]?"0":"auto"),k[0]&4&&N(e,"left",_[2]?"0":"auto"),k[0]&8&&N(e,"z-index",_[3].zIndex??1e3)},i(_){E||(Ce(y),E=!0)},o(_){qe(y),E=!1},d(_){_&&j(e),y&&y.d(),s[27](null),s[29](null),z=!1,ke(M)}}}const fn=48,ue=20;function ul(s,e,t){let n,i,o,l,a=Se,c=()=>(a(),a=wi(i,O=>t(12,l=O)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:ue,bottom:ue},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:h="body"}=e,{options:p={}}=e,g,d=null,w=!1,E,z=!1,M=0,y=0,_=ue,k=20,S=_,b=k,A=!1,C=ue,R=50,P=!1,I={width:0,height:0,right:0,bottom:0},B=!1,Z=!1,Y=[],le=null;async function re(){try{const O=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!O.ok)throw new Error("Failed to get session ID");const ee=await O.json();if(ee.code===0)return t(9,le=ee.data.sessionId),le;throw new Error(ee.message||"Failed to get session ID")}catch(O){return console.error("Failed to get session ID:",O),null}}function fe(O,ee=!1){ee?t(23,A=!0):t(6,z=!0),M=O.clientX,y=O.clientY,_=ee?C:S,k=ee?R:b,O.preventDefault()}function Te(O){if(!z&&!A)return;const ee=M-O.clientX,F=y-O.clientY;if(A){const X=_+ee,Ae=O.clientY;t(24,C=Math.max(ue,Math.min(window.innerWidth-fn-ue,X)));const xe=window.innerHeight-fn-ue,Ve=Math.max(ue,Math.min(xe,Ae));t(25,R=(window.innerHeight-Ve-fn)/window.innerHeight*100)}else{const X=n.width||0,Ae=n.height||0,xe=_+ee;t(0,S=Math.max(ue,Math.min(window.innerWidth-X-ue,xe)));const Ye=k+F;t(1,b=Math.max(ue,Math.min(window.innerHeight-Ae-ue,Ye)))}}function ae(){t(6,z=!1),t(23,A=!1)}Hs(()=>{typeof h=="string"?d=document.querySelector(h)||document.body:d=h||document.body;const O=F=>Te(F),ee=()=>ae();return document.addEventListener("mousemove",O),document.addEventListener("mouseup",ee),g&&d&&d.appendChild(g),E&&E.getBoundingClientRect().left,t(7,B=n.initialState==="snapped"),t(2,P=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,S=0),t(1,b=0),t(3,n={...n,height:typeof window<"u"?window.innerHeight:n.height,width:n.snappedWidth||n.width})):n.initialState==="fullscreen"&&(t(0,S=0),t(1,b=0),t(3,n={...n,width:typeof window<"u"?window.innerWidth:n.width,height:typeof window<"u"?window.innerHeight:n.height})),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",ee),d&&g&&d.removeChild(g)}});async function Oe(){w||await re(),t(22,w=!w)}function se(){var O,ee,F,X;t(2,P=!P),P?(I.width||(I={width:u.width,height:u.height,right:((O=u.defaultPosition)==null?void 0:O.right)??ue,bottom:((ee=u.defaultPosition)==null?void 0:ee.bottom)??ue}),B&&t(7,B=!1),t(20,p={...n,width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth}),t(0,S=0),t(1,b=0)):(t(20,p={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((F=u.defaultPosition)==null?void 0:F.right)??ue),t(1,b=((X=u.defaultPosition)==null?void 0:X.bottom)??ue))}function Ue(O){P||fe(O)}function ne(){var O,ee;P&&(t(2,P=!1),t(20,p={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(7,B=!B),B?(n.height,t(0,S=0),t(1,b=0),t(20,p={...n,height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width})):(t(20,p={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((O=u.defaultPosition)==null?void 0:O.right)??ue),t(1,b=((ee=u.defaultPosition)==null?void 0:ee.bottom)??ue))}function de(O){t(8,Z=!1)}const J=()=>t(8,Z=!1);function ve(O){ht[O?"unshift":"push"](()=>{E=O,t(5,E)})}const ge=O=>fe(O,!0);function je(O){ht[O?"unshift":"push"](()=>{g=O,t(4,g)})}return s.$$set=O=>{"target"in O&&t(21,h=O.target),"options"in O&&t(20,p=O.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n={...u,...p,defaultPosition:{...u.defaultPosition,...p.defaultPosition}}),s.$$.dirty[0]&4194316&&c(t(11,i=zi(w?P?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window<"u"&&(t(0,S=Math.max(ue,Math.min(window.innerWidth-(n.width||0),S))),t(1,b=Math.max(ue,Math.min(window.innerHeight-(n.height||0),b)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${C}px; bottom: ${R}%; transform: none; cursor: ${A?"grabbing":"grab"};`)},[S,b,P,n,g,E,z,B,Z,le,o,i,l,Y,fe,Oe,se,Ue,ne,de,p,h,w,A,C,R,J,ve,ge,je]}class fl extends xn{constructor(e){super(),An(this,e,ul,cl,Zt,{target:21,options:20},null,[-1,-1])}}exports.SyAssistant=fl;
@@ -1,48 +0,0 @@
1
- var cl=Object.defineProperty;var ii=pe=>{throw TypeError(pe)};var ul=(pe,K,xe)=>K in pe?cl(pe,K,{enumerable:!0,configurable:!0,writable:!0,value:xe}):pe[K]=xe;var ne=(pe,K,xe)=>ul(pe,typeof K!="symbol"?K+"":K,xe),fl=(pe,K,xe)=>K.has(pe)||ii("Cannot "+xe);var oi=(pe,K,xe)=>K.has(pe)?ii("Cannot add the same private member more than once"):K instanceof WeakSet?K.add(pe):K.set(pe,xe);var $t=(pe,K,xe)=>(fl(pe,K,"access private method"),xe);(function(pe){"use strict";var tt,Nn,li;function K(){}function xe(s){return s()}function Pn(){return Object.create(null)}function me(s){s.forEach(xe)}function en(s){return typeof s=="function"}function Ct(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function ri(s){return Object.keys(s).length===0}function ai(s,...e){if(s==null){for(const n of e)n(void 0);return K}const t=s.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const Fn=typeof window<"u";let Hn=Fn?()=>window.performance.now():()=>Date.now(),Bn=Fn?s=>requestAnimationFrame(s):K;const it=new Set;function Un(s){it.forEach(e=>{e.c(s)||(it.delete(e),e.f())}),it.size!==0&&Bn(Un)}function ci(s){let e;return it.size===0&&Bn(Un),{promise:new Promise(t=>{it.add(e={c:s,f:t})}),abort(){it.delete(e)}}}function m(s,e){s.appendChild(e)}function W(s,e,t){s.insertBefore(e,t||null)}function U(s){s.parentNode&&s.parentNode.removeChild(s)}function ui(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function x(s){return document.createElement(s)}function V(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function we(s){return document.createTextNode(s)}function G(){return we(" ")}function Lt(){return we("")}function H(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function jn(s){return function(e){return e.preventDefault(),s.call(this,e)}}function r(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function fi(s){return Array.from(s.childNodes)}function Le(s,e){e=""+e,s.data!==e&&(s.data=e)}function ot(s,e){s.value=e??""}function N(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}function Q(s,e,t){s.classList.toggle(e,!!t)}let mt;function wt(s){mt=s}function tn(){if(!mt)throw new Error("Function called outside component initialization");return mt}function Wn(s){tn().$$.on_mount.push(s)}function hi(s){tn().$$.after_update.push(s)}function pi(s){tn().$$.on_destroy.push(s)}const lt=[],rt=[];let at=[];const Gn=[],di=Promise.resolve();let nn=!1;function gi(){nn||(nn=!0,di.then(qn))}function sn(s){at.push(s)}const on=new Set;let ct=0;function qn(){if(ct!==0)return;const s=mt;do{try{for(;ct<lt.length;){const e=lt[ct];ct++,wt(e),mi(e.$$)}}catch(e){throw lt.length=0,ct=0,e}for(wt(null),lt.length=0,ct=0;rt.length;)rt.pop()();for(let e=0;e<at.length;e+=1){const t=at[e];on.has(t)||(on.add(t),t())}at.length=0}while(lt.length);for(;Gn.length;)Gn.pop()();nn=!1,on.clear(),wt(s)}function mi(s){if(s.fragment!==null){s.update(),me(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(sn)}}function wi(s){const e=[],t=[];at.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),at=e}const Mt=new Set;let Ke;function ln(){Ke={r:0,c:[],p:Ke}}function rn(){Ke.r||me(Ke.c),Ke=Ke.p}function Me(s,e){s&&s.i&&(Mt.delete(s),s.i(e))}function We(s,e,t,n){if(s&&s.o){if(Mt.has(s))return;Mt.add(s),Ke.c.push(()=>{Mt.delete(s),n&&(t&&s.d(1),n())}),s.o(e)}else n&&n()}function ut(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function Yn(s,e){s.d(1),e.delete(s.key)}function Zn(s,e,t,n,i,o,l,a,c,u,h,p){let g=s.length,d=o.length,w=g;const E={};for(;w--;)E[s[w].key]=w;const z=[],M=new Map,y=new Map,_=[];for(w=d;w--;){const A=p(i,o,w),C=t(A);let R=l.get(C);R?_.push(()=>R.p(A,e)):(R=u(C,A),R.c()),M.set(C,z[w]=R),C in E&&y.set(C,Math.abs(w-E[C]))}const k=new Set,S=new Set;function b(A){Me(A,1),A.m(a,h),l.set(A.key,A),h=A.first,d--}for(;g&&d;){const A=z[d-1],C=s[g-1],R=A.key,P=C.key;A===C?(h=A.first,g--,d--):M.has(P)?!l.has(R)||k.has(R)?b(A):S.has(P)?g--:y.get(R)>y.get(P)?(S.add(R),b(A)):(k.add(P),g--):(c(C,l),g--)}for(;g--;){const A=s[g];M.has(A.key)||c(A,l)}for(;d;)b(z[d-1]);return me(_),z}function an(s){s&&s.c()}function Ot(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),sn(()=>{const o=s.$$.on_mount.map(xe).filter(en);s.$$.on_destroy?s.$$.on_destroy.push(...o):me(o),s.$$.on_mount=[]}),i.forEach(sn)}function Dt(s,e){const t=s.$$;t.fragment!==null&&(wi(t.after_update),me(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function ki(s,e){s.$$.dirty[0]===-1&&(lt.push(s),gi(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function cn(s,e,t,n,i,o,l=null,a=[-1]){const c=mt;wt(s);const u=s.$$={fragment:null,ctx:[],props:o,update:K,not_equal:i,bound:Pn(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Pn(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let h=!1;if(u.ctx=t?t(s,e.props||{},(p,g,...d)=>{const w=d.length?d[0]:g;return u.ctx&&i(u.ctx[p],u.ctx[p]=w)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](w),h&&ki(s,p)),g}):[],u.update(),h=!0,me(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=fi(e.target);u.fragment&&u.fragment.l(p),p.forEach(U)}else u.fragment&&u.fragment.c();e.intro&&Me(s.$$.fragment),Ot(s,e.target,e.anchor),qn()}wt(c)}class un{constructor(){ne(this,"$$");ne(this,"$$set")}$destroy(){Dt(this,1),this.$destroy=K}$on(e,t){if(!en(t))return K;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!ri(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const _i="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_i);const ft=[];function bi(s,e=K){let t;const n=new Set;function i(a){if(Ct(s,a)&&(s=a,t)){const c=!ft.length;for(const u of n)u[1](),ft.push(u,s);if(c){for(let u=0;u<ft.length;u+=2)ft[u][0](ft[u+1]);ft.length=0}}}function o(a){i(a(s))}function l(a,c=K){const u=[a,c];return n.add(u),n.size===1&&(t=e(i,o)||K),a(s),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:i,update:o,subscribe:l}}function Xn(s){return Object.prototype.toString.call(s)==="[object Date]"}function fn(s,e,t,n){if(typeof t=="number"||Xn(t)){const i=n-t,o=(t-e)/(s.dt||1/60),l=s.opts.stiffness*i,a=s.opts.damping*o,c=(l-a)*s.inv_mass,u=(o+c)*s.dt;return Math.abs(u)<s.opts.precision&&Math.abs(i)<s.opts.precision?n:(s.settled=!1,Xn(t)?new Date(t.getTime()+u):t+u)}else{if(Array.isArray(t))return t.map((i,o)=>fn(s,e[o],t[o],n[o]));if(typeof t=="object"){const i={};for(const o in t)i[o]=fn(s,e[o],t[o],n[o]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function yi(s,e={}){const t=bi(s),{stiffness:n=.15,damping:i=.8,precision:o=.01}=e;let l,a,c,u=s,h=s,p=1,g=0,d=!1;function w(z,M={}){h=z;const y=c={};return s==null||M.hard||E.stiffness>=1&&E.damping>=1?(d=!0,l=Hn(),u=z,t.set(s=h),Promise.resolve()):(M.soft&&(g=1/((M.soft===!0?.5:+M.soft)*60),p=0),a||(l=Hn(),d=!1,a=ci(_=>{if(d)return d=!1,a=null,!1;p=Math.min(p+g,1);const k={inv_mass:p,opts:E,settled:!0,dt:(_-l)*60/1e3},S=fn(k,u,s,h);return l=_,u=s,t.set(s=S),k.settled&&(a=null),!k.settled})),new Promise(_=>{a.promise.then(()=>{y===c&&_()})}))}const E={set:w,update:(z,M)=>w(z(h,s),M),subscribe:t.subscribe,stiffness:n,damping:i,precision:o};return E}async function Ti(s,e){const t=s.getReader();let n;for(;!(n=await t.read()).done;)e(n.value)}function vi(s){let e,t,n,i=!1;return function(l){e===void 0?(e=l,t=0,n=-1):e=Si(e,l);const a=e.length;let c=0;for(;t<a;){i&&(e[t]===10&&(c=++t),i=!1);let u=-1;for(;t<a&&u===-1;++t)switch(e[t]){case 58:n===-1&&(n=t-c);break;case 13:i=!0;case 10:u=t;break}if(u===-1)break;s(e.subarray(c,u),n),c=t,n=-1}c===a?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Ei(s,e,t){let n=Vn();const i=new TextDecoder;return function(l,a){if(l.length===0)t==null||t(n),n=Vn();else if(a>0){const c=i.decode(l.subarray(0,a)),u=a+(l[a+1]===32?2:1),h=i.decode(l.subarray(u));switch(c){case"data":n.data=n.data?n.data+`
2
- `+h:h;break;case"event":n.event=h;break;case"id":s(n.id=h);break;case"retry":const p=parseInt(h,10);isNaN(p)||e(n.retry=p);break}}}}function Si(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Vn(){return{data:"",event:"",id:"",retry:void 0}}var Ai=function(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t};const hn="text/event-stream",xi=1e3,Qn="last-event-id";function Ri(s,e){var{signal:t,headers:n,onopen:i,onmessage:o,onclose:l,onerror:a,openWhenHidden:c,fetch:u}=e,h=Ai(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,g)=>{const d=Object.assign({},n);d.accept||(d.accept=hn);let w;function E(){w.abort(),document.hidden||S()}c||document.addEventListener("visibilitychange",E);let z=xi,M=0;function y(){document.removeEventListener("visibilitychange",E),window.clearTimeout(M),w.abort()}t==null||t.addEventListener("abort",()=>{y(),p()});const _=u??window.fetch,k=i??Ii;async function S(){var b;w=new AbortController;try{const A=await _(s,Object.assign(Object.assign({},h),{headers:d,signal:w.signal}));await k(A),await Ti(A.body,vi(Ei(C=>{C?d[Qn]=C:delete d[Qn]},C=>{z=C},o))),l==null||l(),y(),p()}catch(A){if(!w.signal.aborted)try{const C=(b=a==null?void 0:a(A))!==null&&b!==void 0?b:z;window.clearTimeout(M),M=window.setTimeout(S,C)}catch(C){y(),g(C)}}}S()})}function Ii(s){const e=s.headers.get("content-type");if(!(e!=null&&e.startsWith(hn)))throw new Error(`Expected content-type to be ${hn}, Actual: ${e}`)}function pn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Je=pn();function Kn(s){Je=s}const Jn=/[&<>"']/,zi=new RegExp(Jn.source,"g"),$n=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Ci=new RegExp($n.source,"g"),Li={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},es=s=>Li[s];function Re(s,e){if(e){if(Jn.test(s))return s.replace(zi,es)}else if($n.test(s))return s.replace(Ci,es);return s}const Mi=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Oi(s){return s.replace(Mi,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Di=/(^|[^\[])\^/g;function $(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(Di,"$1"),t=t.replace(i,l),n},getRegex:()=>new RegExp(t,e)};return n}function ts(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const kt={exec:()=>null};function ns(s,e){const t=s.replace(/\|/g,(o,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Nt(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const o=s.charAt(n-i-1);if(o===e&&!t)i++;else if(o!==e&&t)i++;else break}return s.slice(0,n-i)}function Ni(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function ss(s,e,t,n){const i=e.href,o=e.title?Re(e.title):null,l=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const a={type:"link",raw:t,href:i,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:o,text:Re(l)}}function Pi(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
3
- `).map(i=>{const o=i.match(/^\s+/);if(o===null)return i;const[l]=o;return l.length>=n.length?i.slice(n.length):i}).join(`
4
- `)}class Pt{constructor(e){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=e||Je}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Nt(n,`
5
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Pi(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Nt(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const n=Nt(t[0].replace(/^ *>[ \t]?/gm,""),`
6
- `),i=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,o={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const l=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",c="",u=!1;for(;e;){let h=!1;if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let p=t[2].split(`
7
- `,1)[0].replace(/^\t+/,M=>" ".repeat(3*M.length)),g=e.split(`
8
- `,1)[0],d=0;this.options.pedantic?(d=2,c=p.trimStart()):(d=t[2].search(/[^ ]/),d=d>4?1:d,c=p.slice(d),d+=t[1].length);let w=!1;if(!p&&/^ *$/.test(g)&&(a+=g+`
9
- `,e=e.substring(g.length+1),h=!0),!h){const M=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),_=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const S=e.split(`
10
- `,1)[0];if(g=S,this.options.pedantic&&(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),_.test(g)||k.test(g)||M.test(g)||y.test(e))break;if(g.search(/[^ ]/)>=d||!g.trim())c+=`
11
- `+g.slice(d);else{if(w||p.search(/[^ ]/)>=4||_.test(p)||k.test(p)||y.test(p))break;c+=`
12
- `+g}!w&&!g.trim()&&(w=!0),a+=S+`
13
- `,e=e.substring(S.length+1),p=g.slice(d)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(a)&&(u=!0));let E=null,z;this.options.gfm&&(E=/^\[[ xX]\] /.exec(c),E&&(z=E[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!E,checked:z,loose:!1,text:c,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){const p=o.items[h].tokens.filter(d=>d.type==="space"),g=p.length>0&&p.some(d=>/\n.*\n/.test(d.raw));o.loose=g}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=ns(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
- `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const a of i)/^ *-+: *$/.test(a)?l.align.push("right"):/^ *:-+: *$/.test(a)?l.align.push("center"):/^ *:-+ *$/.test(a)?l.align.push("left"):l.align.push(null);for(const a of n)l.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of o)l.rows.push(ns(a,l.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return l}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
15
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Re(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const l=Nt(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=Ni(t[2],"()");if(l>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],o="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);l&&(i=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),ss(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),o=t[i.toLowerCase()];if(!o){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return ss(n,o,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...i[0]].length-1;let a,c,u=l,h=0;const p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+l);(i=p.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(c=[...a].length,i[3]||i[4]){u+=c;continue}else if((i[5]||i[6])&&l%3&&!((l+c)%3)){h+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+h);const g=[...i[0]][0].length,d=e.slice(0,l+i.index+g+c);if(Math.min(l,c)%2){const E=d.slice(1,-1);return{type:"em",raw:d,text:E,tokens:this.lexer.inlineTokens(E)}}const w=d.slice(2,-2);return{type:"strong",raw:d,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return i&&o&&(n=n.substring(1,n.length-1)),n=Re(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=Re(t[1]),i="mailto:"+n):(n=Re(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let i,o;if(t[2]==="@")i=Re(t[0]),o="mailto:"+i;else{let l;do l=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(l!==t[0]);i=Re(t[0]),t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=Re(t[0]),{type:"text",raw:t[0],text:n}}}}const Fi=/^(?: *(?:\n|$))+/,Hi=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Bi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_t=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ui=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,is=/(?:[*+-]|\d{1,9}[.)])/,os=$(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,is).getRegex(),dn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ji=/^[^\n]+/,gn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Wi=$(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",gn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gi=$(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,is).getRegex(),Ft="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",mn=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,qi=$("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",mn).replace("tag",Ft).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ls=$(dn).replace("hr",_t).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ft).getRegex(),wn={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ls).getRegex(),code:Hi,def:Wi,fences:Bi,heading:Ui,hr:_t,html:qi,lheading:os,list:Gi,newline:Fi,paragraph:ls,table:kt,text:ji},rs=$("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_t).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ft).getRegex(),Yi={...wn,table:rs,paragraph:$(dn).replace("hr",_t).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rs).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ft).getRegex()},Zi={...wn,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",mn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:kt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(dn).replace("hr",_t).replace("heading",` *#{1,6} *[^
16
- ]`).replace("lheading",os).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},as=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Xi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cs=/^( {2,}|\\)\n(?!\s*$)/,Vi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bt="\\p{P}$+<=>`^|~",Qi=$(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,bt).getRegex(),Ki=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Ji=$(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,bt).getRegex(),$i=$("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,bt).getRegex(),eo=$("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,bt).getRegex(),to=$(/\\([punct])/,"gu").replace(/punct/g,bt).getRegex(),no=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),so=$(mn).replace("(?:-->|$)","-->").getRegex(),io=$("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",so).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ht=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oo=$(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ht).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),us=$(/^!?\[(label)\]\[(ref)\]/).replace("label",Ht).replace("ref",gn).getRegex(),fs=$(/^!?\[(ref)\](?:\[\])?/).replace("ref",gn).getRegex(),lo=$("reflink|nolink(?!\\()","g").replace("reflink",us).replace("nolink",fs).getRegex(),kn={_backpedal:kt,anyPunctuation:to,autolink:no,blockSkip:Ki,br:cs,code:Xi,del:kt,emStrongLDelim:Ji,emStrongRDelimAst:$i,emStrongRDelimUnd:eo,escape:as,link:oo,nolink:fs,punctuation:Qi,reflink:us,reflinkSearch:lo,tag:io,text:Vi,url:kt},ro={...kn,link:$(/^!?\[(label)\]\((.*?)\)/).replace("label",Ht).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ht).getRegex()},_n={...kn,escape:$(as).replace("])","~|])").getRegex(),url:$(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ao={..._n,br:$(cs).replace("{2,}","*").getRegex(),text:$(_n.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Bt={normal:wn,gfm:Yi,pedantic:Zi},yt={normal:kn,gfm:_n,breaks:ao,pedantic:ro};class Ne{constructor(e){ne(this,"tokens");ne(this,"options");ne(this,"state");ne(this,"tokenizer");ne(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Je,this.options.tokenizer=this.options.tokenizer||new Pt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Bt.normal,inline:yt.normal};this.options.pedantic?(t.block=Bt.pedantic,t.inline=yt.pedantic):this.options.gfm&&(t.block=Bt.gfm,this.options.breaks?t.inline=yt.breaks:t.inline=yt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Bt,inline:yt}}static lex(e,t){return new Ne(t).lex(e)}static lexInline(e,t){return new Ne(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
17
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,c,u)=>c+" ".repeat(u.length));let n,i,o,l;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
18
- `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
19
- `+n.raw,i.text+=`
20
- `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
21
- `+n.raw,i.text+=`
22
- `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const c=e.slice(1);let u;this.options.extensions.startBlock.forEach(h=>{u=h.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){i=t[t.length-1],l&&i.type==="paragraph"?(i.raw+=`
23
- `+n.raw,i.text+=`
24
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),l=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
25
- `+n.raw,i.text+=`
26
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,o,l=e,a,c,u;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,a.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(u=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,l,u)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const p=e.slice(1);let g;this.options.extensions.startInline.forEach(d=>{g=d.call({lexer:this},p),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(o=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(u=n.raw.slice(-1)),c=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}}class Ut{constructor(e){ne(this,"options");this.options=e||Je}code(e,t,n){var o;const i=(o=(t||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
27
- `,i?'<pre><code class="language-'+Re(i)+'">'+(n?e:Re(e,!0))+`</code></pre>
28
- `:"<pre><code>"+(n?e:Re(e,!0))+`</code></pre>
29
- `}blockquote(e){return`<blockquote>
30
- ${e}</blockquote>
31
- `}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
32
- `}hr(){return`<hr>
33
- `}list(e,t,n){const i=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+i+o+`>
34
- `+e+"</"+i+`>
35
- `}listitem(e,t,n){return`<li>${e}</li>
36
- `}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
37
- `}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
38
- <thead>
39
- `+e+`</thead>
40
- `+t+`</table>
41
- `}tablerow(e){return`<tr>
42
- ${e}</tr>
43
- `}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
44
- `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=ts(e);if(i===null)return n;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){const i=ts(e);if(i===null)return n;e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class bn{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Pe{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Je,this.options.renderer=this.options.renderer||new Ut,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new bn}static parse(e,t){return new Pe(t).parse(e)}static parseInline(e,t){return new Pe(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=o,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=a||"";continue}}switch(o.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const l=o;n+=this.renderer.heading(this.parseInline(l.tokens),l.depth,Oi(this.parseInline(l.tokens,this.textRenderer)));continue}case"code":{const l=o;n+=this.renderer.code(l.text,l.lang,!!l.escaped);continue}case"table":{const l=o;let a="",c="";for(let h=0;h<l.header.length;h++)c+=this.renderer.tablecell(this.parseInline(l.header[h].tokens),{header:!0,align:l.align[h]});a+=this.renderer.tablerow(c);let u="";for(let h=0;h<l.rows.length;h++){const p=l.rows[h];c="";for(let g=0;g<p.length;g++)c+=this.renderer.tablecell(this.parseInline(p[g].tokens),{header:!1,align:l.align[g]});u+=this.renderer.tablerow(c)}n+=this.renderer.table(a,u);continue}case"blockquote":{const l=o,a=this.parse(l.tokens);n+=this.renderer.blockquote(a);continue}case"list":{const l=o,a=l.ordered,c=l.start,u=l.loose;let h="";for(let p=0;p<l.items.length;p++){const g=l.items[p],d=g.checked,w=g.task;let E="";if(g.task){const z=this.renderer.checkbox(!!d);u?g.tokens.length>0&&g.tokens[0].type==="paragraph"?(g.tokens[0].text=z+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&g.tokens[0].tokens[0].type==="text"&&(g.tokens[0].tokens[0].text=z+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:z+" "}):E+=z+" "}E+=this.parse(g.tokens,u),h+=this.renderer.listitem(E,w,!!d)}n+=this.renderer.list(h,a,c);continue}case"html":{const l=o;n+=this.renderer.html(l.text,l.block);continue}case"paragraph":{const l=o;n+=this.renderer.paragraph(this.parseInline(l.tokens));continue}case"text":{let l=o,a=l.tokens?this.parseInline(l.tokens):l.text;for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],a+=`
45
- `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}switch(o.type){case"escape":{const l=o;n+=t.text(l.text);break}case"html":{const l=o;n+=t.html(l.text);break}case"link":{const l=o;n+=t.link(l.href,l.title,this.parseInline(l.tokens,t));break}case"image":{const l=o;n+=t.image(l.href,l.title,l.text);break}case"strong":{const l=o;n+=t.strong(this.parseInline(l.tokens,t));break}case"em":{const l=o;n+=t.em(this.parseInline(l.tokens,t));break}case"codespan":{const l=o;n+=t.codespan(l.text);break}case"br":{n+=t.br();break}case"del":{const l=o;n+=t.del(this.parseInline(l.tokens,t));break}case"text":{const l=o;n+=t.text(l.text);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class Tt{constructor(e){ne(this,"options");this.options=e||Je}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}ne(Tt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class co{constructor(...e){oi(this,tt);ne(this,"defaults",pn());ne(this,"options",this.setOptions);ne(this,"parse",$t(this,tt,Nn).call(this,Ne.lex,Pe.parse));ne(this,"parseInline",$t(this,tt,Nn).call(this,Ne.lexInline,Pe.parseInline));ne(this,"Parser",Pe);ne(this,"Renderer",Ut);ne(this,"TextRenderer",bn);ne(this,"Lexer",Ne);ne(this,"Tokenizer",Pt);ne(this,"Hooks",Tt);this.use(...e)}walkTokens(e,t){var i,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const a=l;for(const c of a.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of a.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const a=l;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=l;(o=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=t.renderers[o.name];l?t.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=l.apply(this,a)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),i.extensions=t),n.renderer){const o=this.defaults.renderer||new Ut(this.defaults);for(const l in n.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.renderer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p||""}}i.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Pt(this.defaults);for(const l in n.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const a=l,c=n.tokenizer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new Tt;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.hooks[a],u=o[a];Tt.passThroughHooks.has(l)?o[a]=h=>{if(this.defaults.async)return Promise.resolve(c.call(o,h)).then(g=>u.call(o,g));const p=c.call(o,h);return u.call(o,p)}:o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(l.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ne.lex(e,t??this.defaults)}parser(e,t){return Pe.parse(e,t??this.defaults)}}tt=new WeakSet,Nn=function(e,t){return(n,i)=>{const o={...i},l={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const a=$t(this,tt,li).call(this,!!l.silent,!!l.async);if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(c=>e(c,l)).then(c=>l.hooks?l.hooks.processAllTokens(c):c).then(c=>l.walkTokens?Promise.all(this.walkTokens(c,l.walkTokens)).then(()=>c):c).then(c=>t(c,l)).then(c=>l.hooks?l.hooks.postprocess(c):c).catch(a);try{l.hooks&&(n=l.hooks.preprocess(n));let c=e(n,l);l.hooks&&(c=l.hooks.processAllTokens(c)),l.walkTokens&&this.walkTokens(c,l.walkTokens);let u=t(c,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(c){return a(c)}}},li=function(e,t){return n=>{if(n.message+=`
46
- Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Re(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const $e=new co;function J(s,e){return $e.parse(s,e)}J.options=J.setOptions=function(s){return $e.setOptions(s),J.defaults=$e.defaults,Kn(J.defaults),J},J.getDefaults=pn,J.defaults=Je,J.use=function(...s){return $e.use(...s),J.defaults=$e.defaults,Kn(J.defaults),J},J.walkTokens=function(s,e){return $e.walkTokens(s,e)},J.parseInline=$e.parseInline,J.Parser=Pe,J.parser=Pe.parse,J.Renderer=Ut,J.TextRenderer=bn,J.Lexer=Ne,J.lexer=Ne.lex,J.Tokenizer=Pt,J.Hooks=Tt,J.parse=J,J.options,J.setOptions,J.use,J.walkTokens,J.parseInline,Pe.parse,Ne.lex;/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:hs,setPrototypeOf:ps,isFrozen:uo,getPrototypeOf:fo,getOwnPropertyDescriptor:ho}=Object;let{freeze:ye,seal:Oe,create:ds}=Object,{apply:yn,construct:Tn}=typeof Reflect<"u"&&Reflect;ye||(ye=function(e){return e}),Oe||(Oe=function(e){return e}),yn||(yn=function(e,t,n){return e.apply(t,n)}),Tn||(Tn=function(e,t){return new e(...t)});const jt=Ie(Array.prototype.forEach),gs=Ie(Array.prototype.pop),vt=Ie(Array.prototype.push),Wt=Ie(String.prototype.toLowerCase),vn=Ie(String.prototype.toString),ms=Ie(String.prototype.match),Et=Ie(String.prototype.replace),po=Ie(String.prototype.indexOf),go=Ie(String.prototype.trim),De=Ie(Object.prototype.hasOwnProperty),Te=Ie(RegExp.prototype.test),St=mo(TypeError);function Ie(s){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return yn(s,e,n)}}function mo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Tn(s,t)}}function q(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wt;ps&&ps(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(uo(e)||(e[n]=o),i=o)}s[i]=!0}return s}function wo(s){for(let e=0;e<s.length;e++)De(s,e)||(s[e]=null);return s}function et(s){const e=ds(null);for(const[t,n]of hs(s))De(s,t)&&(Array.isArray(n)?e[t]=wo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=et(n):e[t]=n);return e}function At(s,e){for(;s!==null;){const n=ho(s,e);if(n){if(n.get)return Ie(n.get);if(typeof n.value=="function")return Ie(n.value)}s=fo(s)}function t(){return null}return t}const ws=ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),En=ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Sn=ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ko=ye(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),An=ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_o=ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ks=ye(["#text"]),_s=ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),xn=ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),bs=ye(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Gt=ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),bo=Oe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yo=Oe(/<%[\w\W]*|[\w\W]*%>/gm),To=Oe(/\$\{[\w\W]*}/gm),vo=Oe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Eo=Oe(/^aria-[\-\w]+$/),ys=Oe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),So=Oe(/^(?:\w+script|data):/i),Ao=Oe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ts=Oe(/^html$/i),xo=Oe(/^[a-z][.\w]*(-[.\w]+)+$/i);var vs=Object.freeze({__proto__:null,ARIA_ATTR:Eo,ATTR_WHITESPACE:Ao,CUSTOM_ELEMENT:xo,DATA_ATTR:vo,DOCTYPE_NAME:Ts,ERB_EXPR:yo,IS_ALLOWED_URI:ys,IS_SCRIPT_OR_DATA:So,MUSTACHE_EXPR:bo,TMPLIT_EXPR:To});const xt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ro=function(){return typeof window>"u"?null:window},Io=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Es=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ss(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ro();const e=D=>Ss(D);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==xt.document)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:p,DOMParser:g,trustedTypes:d}=s,w=c.prototype,E=At(w,"cloneNode"),z=At(w,"remove"),M=At(w,"nextSibling"),y=At(w,"childNodes"),_=At(w,"parentNode");if(typeof l=="function"){const D=t.createElement("template");D.content&&D.content.ownerDocument&&(t=D.content.ownerDocument)}let k,S="";const{implementation:b,createNodeIterator:A,createDocumentFragment:C,getElementsByTagName:R}=t,{importNode:P}=n;let I=Es();e.isSupported=typeof hs=="function"&&typeof _=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:Z,TMPLIT_EXPR:Y,DATA_ATTR:re,ARIA_ATTR:ae,IS_SCRIPT_OR_DATA:he,ATTR_WHITESPACE:Ee,CUSTOM_ELEMENT:ce}=vs;let{IS_ALLOWED_URI:Fe}=vs,ie=null;const Ge=q({},[...ws,...En,...Sn,...An,...ks]);let se=null;const ke=q({},[..._s,...xn,...bs,...Gt]);let ee=Object.seal(ds(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Se=null,_e=null,qe=!0,O=!0,te=!1,F=!0,X=!1,ze=!0,Ce=!1,Xe=!1,nt=!1,Ve=!1,ht=!1,pt=!1,Yt=!0,Zt=!1;const Cn="user-content-";let Rt=!0,st=!1,T={},j=null;const oe=q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let fe=null;const He=q({},["audio","video","img","source","image","track"]);let Qe=null;const Be=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xt="http://www.w3.org/1998/Math/MathML",Vt="http://www.w3.org/2000/svg",Ye="http://www.w3.org/1999/xhtml";let dt=Ye,Ln=!1,Mn=null;const nl=q({},[Xt,Vt,Ye],vn);let Qt=q({},["mi","mo","mn","ms","mtext"]),Kt=q({},["annotation-xml"]);const sl=q({},["title","style","font","a","script"]);let It=null;const il=["application/xhtml+xml","text/html"],ol="text/html";let de=null,gt=null;const ll=t.createElement("form"),Ys=function(f){return f instanceof RegExp||f instanceof Function},On=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(gt&&gt===f)){if((!f||typeof f!="object")&&(f={}),f=et(f),It=il.indexOf(f.PARSER_MEDIA_TYPE)===-1?ol:f.PARSER_MEDIA_TYPE,de=It==="application/xhtml+xml"?vn:Wt,ie=De(f,"ALLOWED_TAGS")?q({},f.ALLOWED_TAGS,de):Ge,se=De(f,"ALLOWED_ATTR")?q({},f.ALLOWED_ATTR,de):ke,Mn=De(f,"ALLOWED_NAMESPACES")?q({},f.ALLOWED_NAMESPACES,vn):nl,Qe=De(f,"ADD_URI_SAFE_ATTR")?q(et(Be),f.ADD_URI_SAFE_ATTR,de):Be,fe=De(f,"ADD_DATA_URI_TAGS")?q(et(He),f.ADD_DATA_URI_TAGS,de):He,j=De(f,"FORBID_CONTENTS")?q({},f.FORBID_CONTENTS,de):oe,Se=De(f,"FORBID_TAGS")?q({},f.FORBID_TAGS,de):{},_e=De(f,"FORBID_ATTR")?q({},f.FORBID_ATTR,de):{},T=De(f,"USE_PROFILES")?f.USE_PROFILES:!1,qe=f.ALLOW_ARIA_ATTR!==!1,O=f.ALLOW_DATA_ATTR!==!1,te=f.ALLOW_UNKNOWN_PROTOCOLS||!1,F=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,X=f.SAFE_FOR_TEMPLATES||!1,ze=f.SAFE_FOR_XML!==!1,Ce=f.WHOLE_DOCUMENT||!1,Ve=f.RETURN_DOM||!1,ht=f.RETURN_DOM_FRAGMENT||!1,pt=f.RETURN_TRUSTED_TYPE||!1,nt=f.FORCE_BODY||!1,Yt=f.SANITIZE_DOM!==!1,Zt=f.SANITIZE_NAMED_PROPS||!1,Rt=f.KEEP_CONTENT!==!1,st=f.IN_PLACE||!1,Fe=f.ALLOWED_URI_REGEXP||ys,dt=f.NAMESPACE||Ye,Qt=f.MATHML_TEXT_INTEGRATION_POINTS||Qt,Kt=f.HTML_INTEGRATION_POINTS||Kt,ee=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&Ys(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&Ys(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(O=!1),ht&&(Ve=!0),T&&(ie=q({},ks),se=[],T.html===!0&&(q(ie,ws),q(se,_s)),T.svg===!0&&(q(ie,En),q(se,xn),q(se,Gt)),T.svgFilters===!0&&(q(ie,Sn),q(se,xn),q(se,Gt)),T.mathMl===!0&&(q(ie,An),q(se,bs),q(se,Gt))),f.ADD_TAGS&&(ie===Ge&&(ie=et(ie)),q(ie,f.ADD_TAGS,de)),f.ADD_ATTR&&(se===ke&&(se=et(se)),q(se,f.ADD_ATTR,de)),f.ADD_URI_SAFE_ATTR&&q(Qe,f.ADD_URI_SAFE_ATTR,de),f.FORBID_CONTENTS&&(j===oe&&(j=et(j)),q(j,f.FORBID_CONTENTS,de)),Rt&&(ie["#text"]=!0),Ce&&q(ie,["html","head","body"]),ie.table&&(q(ie,["tbody"]),delete Se.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,S=k.createHTML("")}else k===void 0&&(k=Io(d,i)),k!==null&&typeof S=="string"&&(S=k.createHTML(""));ye&&ye(f),gt=f}},Zs=q({},[...En,...Sn,...ko]),Xs=q({},[...An,..._o]),rl=function(f){let v=_(f);(!v||!v.tagName)&&(v={namespaceURI:dt,tagName:"template"});const L=Wt(f.tagName),le=Wt(v.tagName);return Mn[f.namespaceURI]?f.namespaceURI===Vt?v.namespaceURI===Ye?L==="svg":v.namespaceURI===Xt?L==="svg"&&(le==="annotation-xml"||Qt[le]):!!Zs[L]:f.namespaceURI===Xt?v.namespaceURI===Ye?L==="math":v.namespaceURI===Vt?L==="math"&&Kt[le]:!!Xs[L]:f.namespaceURI===Ye?v.namespaceURI===Vt&&!Kt[le]||v.namespaceURI===Xt&&!Qt[le]?!1:!Xs[L]&&(sl[L]||!Zs[L]):!!(It==="application/xhtml+xml"&&Mn[f.namespaceURI]):!1},Ue=function(f){vt(e.removed,{element:f});try{_(f).removeChild(f)}catch{z(f)}},Jt=function(f,v){try{vt(e.removed,{attribute:v.getAttributeNode(f),from:v})}catch{vt(e.removed,{attribute:null,from:v})}if(v.removeAttribute(f),f==="is")if(Ve||ht)try{Ue(v)}catch{}else try{v.setAttribute(f,"")}catch{}},Vs=function(f){let v=null,L=null;if(nt)f="<remove></remove>"+f;else{const ge=ms(f,/^[\r\n\t ]+/);L=ge&&ge[0]}It==="application/xhtml+xml"&&dt===Ye&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const le=k?k.createHTML(f):f;if(dt===Ye)try{v=new g().parseFromString(le,It)}catch{}if(!v||!v.documentElement){v=b.createDocument(dt,"template",null);try{v.documentElement.innerHTML=Ln?S:le}catch{}}const be=v.body||v.documentElement;return f&&L&&be.insertBefore(t.createTextNode(L),be.childNodes[0]||null),dt===Ye?R.call(v,Ce?"html":"body")[0]:Ce?v.documentElement:be},Qs=function(f){return A.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Dn=function(f){return f instanceof p&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof h)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},Ks=function(f){return typeof a=="function"&&f instanceof a};function Ze(D,f,v){jt(D,L=>{L.call(e,f,v,gt)})}const Js=function(f){let v=null;if(Ze(I.beforeSanitizeElements,f,null),Dn(f))return Ue(f),!0;const L=de(f.nodeName);if(Ze(I.uponSanitizeElement,f,{tagName:L,allowedTags:ie}),f.hasChildNodes()&&!Ks(f.firstElementChild)&&Te(/<[/\w]/g,f.innerHTML)&&Te(/<[/\w]/g,f.textContent)||f.nodeType===xt.progressingInstruction||ze&&f.nodeType===xt.comment&&Te(/<[/\w]/g,f.data))return Ue(f),!0;if(!ie[L]||Se[L]){if(!Se[L]&&ei(L)&&(ee.tagNameCheck instanceof RegExp&&Te(ee.tagNameCheck,L)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(L)))return!1;if(Rt&&!j[L]){const le=_(f)||f.parentNode,be=y(f)||f.childNodes;if(be&&le){const ge=be.length;for(let Ae=ge-1;Ae>=0;--Ae){const je=E(be[Ae],!0);je.__removalCount=(f.__removalCount||0)+1,le.insertBefore(je,M(f))}}}return Ue(f),!0}return f instanceof c&&!rl(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&Te(/<\/no(script|embed|frames)/i,f.innerHTML)?(Ue(f),!0):(X&&f.nodeType===xt.text&&(v=f.textContent,jt([B,Z,Y],le=>{v=Et(v,le," ")}),f.textContent!==v&&(vt(e.removed,{element:f.cloneNode()}),f.textContent=v)),Ze(I.afterSanitizeElements,f,null),!1)},$s=function(f,v,L){if(Yt&&(v==="id"||v==="name")&&(L in t||L in ll))return!1;if(!(O&&!_e[v]&&Te(re,v))){if(!(qe&&Te(ae,v))){if(!se[v]||_e[v]){if(!(ei(f)&&(ee.tagNameCheck instanceof RegExp&&Te(ee.tagNameCheck,f)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(f))&&(ee.attributeNameCheck instanceof RegExp&&Te(ee.attributeNameCheck,v)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(v))||v==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&Te(ee.tagNameCheck,L)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(L))))return!1}else if(!Qe[v]){if(!Te(Fe,Et(L,Ee,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&f!=="script"&&po(L,"data:")===0&&fe[f])){if(!(te&&!Te(he,Et(L,Ee,"")))){if(L)return!1}}}}}}return!0},ei=function(f){return f!=="annotation-xml"&&ms(f,ce)},ti=function(f){Ze(I.beforeSanitizeAttributes,f,null);const{attributes:v}=f;if(!v||Dn(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let le=v.length;for(;le--;){const be=v[le],{name:ge,namespaceURI:Ae,value:je}=be,zt=de(ge);let ve=ge==="value"?je:go(je);if(L.attrName=zt,L.attrValue=ve,L.keepAttr=!0,L.forceKeepAttr=void 0,Ze(I.uponSanitizeAttribute,f,L),ve=L.attrValue,Zt&&(zt==="id"||zt==="name")&&(Jt(ge,f),ve=Cn+ve),ze&&Te(/((--!?|])>)|<\/(style|title)/i,ve)){Jt(ge,f);continue}if(L.forceKeepAttr||(Jt(ge,f),!L.keepAttr))continue;if(!F&&Te(/\/>/i,ve)){Jt(ge,f);continue}X&&jt([B,Z,Y],si=>{ve=Et(ve,si," ")});const ni=de(f.nodeName);if($s(ni,zt,ve)){if(k&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Ae)switch(d.getAttributeType(ni,zt)){case"TrustedHTML":{ve=k.createHTML(ve);break}case"TrustedScriptURL":{ve=k.createScriptURL(ve);break}}try{Ae?f.setAttributeNS(Ae,ge,ve):f.setAttribute(ge,ve),Dn(f)?Ue(f):gs(e.removed)}catch{}}}Ze(I.afterSanitizeAttributes,f,null)},al=function D(f){let v=null;const L=Qs(f);for(Ze(I.beforeSanitizeShadowDOM,f,null);v=L.nextNode();)Ze(I.uponSanitizeShadowNode,v,null),Js(v),ti(v),v.content instanceof o&&D(v.content);Ze(I.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(D){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,L=null,le=null,be=null;if(Ln=!D,Ln&&(D="<!-->"),typeof D!="string"&&!Ks(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw St("dirty is not a string, aborting")}else throw St("toString is not a function");if(!e.isSupported)return D;if(Xe||On(f),e.removed=[],typeof D=="string"&&(st=!1),st){if(D.nodeName){const je=de(D.nodeName);if(!ie[je]||Se[je])throw St("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof a)v=Vs("<!---->"),L=v.ownerDocument.importNode(D,!0),L.nodeType===xt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?v=L:v.appendChild(L);else{if(!Ve&&!X&&!Ce&&D.indexOf("<")===-1)return k&&pt?k.createHTML(D):D;if(v=Vs(D),!v)return Ve?null:pt?S:""}v&&nt&&Ue(v.firstChild);const ge=Qs(st?D:v);for(;le=ge.nextNode();)Js(le),ti(le),le.content instanceof o&&al(le.content);if(st)return D;if(Ve){if(ht)for(be=C.call(v.ownerDocument);v.firstChild;)be.appendChild(v.firstChild);else be=v;return(se.shadowroot||se.shadowrootmode)&&(be=P.call(n,be,!0)),be}let Ae=Ce?v.outerHTML:v.innerHTML;return Ce&&ie["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&Te(Ts,v.ownerDocument.doctype.name)&&(Ae="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
47
- `+Ae),X&&jt([B,Z,Y],je=>{Ae=Et(Ae,je," ")}),k&&pt?k.createHTML(Ae):Ae},e.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};On(D),Xe=!0},e.clearConfig=function(){gt=null,Xe=!1},e.isValidAttribute=function(D,f,v){gt||On({});const L=de(D),le=de(f);return $s(L,le,v)},e.addHook=function(D,f){typeof f=="function"&&vt(I[D],f)},e.removeHook=function(D){return gs(I[D])},e.removeHooks=function(D){I[D]=[]},e.removeAllHooks=function(){I=Es()},e}var As=Ss();function xs(s,e,t){const n=s.slice();return n[24]=e[t],n}function Rs(s){let e,t=s[9].text+"",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),N(e,"left",s[9].x+"px"),N(e,"top",s[9].y+"px"),N(e,"z-index",s[3]+3)},m(i,o){W(i,e,o),m(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&Le(n,t),o&512&&N(e,"left",i[9].x+"px"),o&512&&N(e,"top",i[9].y+"px"),o&8&&N(e,"z-index",i[3]+3)},d(i){i&&U(e)}}}function zo(s){let e=[],t=new Map,n,i,o=ut(s[0]);const l=c=>c[24].id;for(let c=0;c<o.length;c+=1){let u=xs(s,o,c),h=l(u);t.set(h,e[c]=Is(h,u))}let a=s[5]&&zs();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=G(),a&&a.c(),i=Lt()},m(c,u){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(c,u);W(c,n,u),a&&a.m(c,u),W(c,i,u)},p(c,u){u&8261&&(o=ut(c[0]),e=Zn(e,u,l,1,c,o,t,n.parentNode,Yn,Is,n,xs)),c[5]?a||(a=zs(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},d(c){c&&(U(n),U(i));for(let u=0;u<e.length;u+=1)e[u].d(c);a&&a.d(c)}}}function Co(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){W(i,e,o),m(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Le(n,t)},d(i){i&&U(e)}}}function Is(s,e){let t,n,i,o,l=e[24].title+"",a,c,u,h=Ls(e[24].timestamp)+"",p,g,d,w,E,z,M,y,_,k,S;function b(){return e[17](e[24])}function A(...C){return e[18](e[24],...C)}return{key:s,first:null,c(){t=x("div"),n=x("button"),i=x("div"),o=x("div"),a=we(l),c=G(),u=x("div"),p=we(h),g=G(),d=x("button"),w=V("svg"),E=V("path"),z=V("path"),M=V("path"),r(o,"class","sy-session-title svelte-1g6fj9a"),r(u,"class","sy-session-time svelte-1g6fj9a"),r(i,"class","sy-session-info svelte-1g6fj9a"),r(n,"class","sy-session-select svelte-1g6fj9a"),r(E,"d","M3 6h18"),r(z,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),r(M,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),r(w,"xmlns","http://www.w3.org/2000/svg"),r(w,"width","16"),r(w,"height","16"),r(w,"viewBox","0 0 24 24"),r(w,"fill","none"),r(w,"stroke","currentColor"),r(w,"stroke-width","2"),r(w,"stroke-linecap","round"),r(w,"stroke-linejoin","round"),r(d,"class","sy-session-delete svelte-1g6fj9a"),d.disabled=y=e[6]===e[24].id,r(d,"aria-label","删除会话"),r(t,"class","sy-session-item svelte-1g6fj9a"),r(t,"data-session-id",_=e[24].id),Q(t,"deleting",e[24].deleting),this.first=t},m(C,R){W(C,t,R),m(t,n),m(n,i),m(i,o),m(o,a),m(i,c),m(i,u),m(u,p),m(t,g),m(t,d),m(d,w),m(w,E),m(w,z),m(w,M),k||(S=[H(n,"click",b),H(d,"click",A)],k=!0)},p(C,R){e=C,R&1&&l!==(l=e[24].title+"")&&Le(a,l),R&1&&h!==(h=Ls(e[24].timestamp)+"")&&Le(p,h),R&65&&y!==(y=e[6]===e[24].id)&&(d.disabled=y),R&1&&_!==(_=e[24].id)&&r(t,"data-session-id",_),R&1&&Q(t,"deleting",e[24].deleting)},d(C){C&&U(t),k=!1,me(S)}}}function zs(s){let e;return{c(){e=x("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',r(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Cs(s){let e,t,n,i,o,l,a,c,u;return{c(){e=x("div"),t=x("div"),t.textContent="确认删除此会话?",n=G(),i=x("div"),o=x("button"),o.textContent="取消",l=G(),a=x("button"),a.textContent="删除",r(t,"class","sy-session-confirm-content svelte-1g6fj9a"),r(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),r(a,"class","sy-session-confirm-delete svelte-1g6fj9a"),r(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),r(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),N(e,"left",s[8].x+"px"),N(e,"top",s[8].y+"px"),N(e,"z-index",s[3]+3)},m(h,p){W(h,e,p),m(e,t),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[H(o,"click",s[19]),H(a,"click",s[14])],c=!0)},p(h,p){p&256&&N(e,"left",h[8].x+"px"),p&256&&N(e,"top",h[8].y+"px"),p&8&&N(e,"z-index",h[3]+3)},d(h){h&&U(e),c=!1,me(u)}}}function Lo(s){let e,t,n,i,o,l,a,c,u,h,p,g,d,w,E,z,M,y,_,k=s[9]&&Rs(s);function S(R,P){return R[0].length===0?Co:zo}let b=S(s),A=b(s),C=s[7]&&Cs(s);return{c(){e=x("div"),t=x("div"),n=x("h2"),n.textContent="历史会话",i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',l=G(),a=x("div"),c=x("input"),u=G(),h=V("svg"),p=V("circle"),g=V("line"),d=G(),k&&k.c(),w=G(),E=x("div"),A.c(),z=G(),C&&C.c(),M=Lt(),r(n,"class","svelte-1g6fj9a"),r(o,"class","sy-session-close svelte-1g6fj9a"),r(o,"aria-label","关闭历史会话"),r(t,"class","sy-session-header svelte-1g6fj9a"),r(c,"type","text"),r(c,"class","sy-session-search-input svelte-1g6fj9a"),r(c,"placeholder","搜索历史会话..."),r(p,"cx","11"),r(p,"cy","11"),r(p,"r","8"),r(g,"x1","21"),r(g,"y1","21"),r(g,"x2","16.65"),r(g,"y2","16.65"),r(h,"class","sy-session-search-icon svelte-1g6fj9a"),r(h,"xmlns","http://www.w3.org/2000/svg"),r(h,"width","16"),r(h,"height","16"),r(h,"viewBox","0 0 24 24"),r(h,"fill","none"),r(h,"stroke","currentColor"),r(h,"stroke-width","2"),r(h,"stroke-linecap","round"),r(h,"stroke-linejoin","round"),r(a,"class","sy-session-search svelte-1g6fj9a"),r(E,"class","sy-session-list svelte-1g6fj9a"),r(e,"class","sy-session-history svelte-1g6fj9a"),N(e,"z-index",s[3]+2)},m(R,P){W(R,e,P),m(e,t),m(t,n),m(t,i),m(t,o),m(e,l),m(e,a),m(a,c),ot(c,s[4]),m(a,u),m(a,h),m(h,p),m(h,g),m(e,d),k&&k.m(e,null),m(e,w),m(e,E),A.m(E,null),W(R,z,P),C&&C.m(R,P),W(R,M,P),y||(_=[H(o,"click",function(){en(s[1])&&s[1].apply(this,arguments)}),H(o,"mouseenter",s[15]),H(o,"mouseleave",s[12]),H(c,"input",s[16]),H(E,"scroll",s[10])],y=!0)},p(R,[P]){s=R,P&16&&c.value!==s[4]&&ot(c,s[4]),s[9]?k?k.p(s,P):(k=Rs(s),k.c(),k.m(e,w)):k&&(k.d(1),k=null),b===(b=S(s))&&A?A.p(s,P):(A.d(1),A=b(s),A&&(A.c(),A.m(E,null))),P&8&&N(e,"z-index",s[3]+2),s[7]?C?C.p(s,P):(C=Cs(s),C.c(),C.m(M.parentNode,M)):C&&(C.d(1),C=null)},i:K,o:K,d(R){R&&(U(e),U(z),U(M)),k&&k.d(),A.d(),C&&C.d(R),y=!1,me(_)}}}const Rn=10;function Ls(s){return new Date(s).toLocaleString()}function Mo(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:o}=e,{zIndex:l}=e,a=!1,c=!0,u=0,h="",p=null,g=null,d={x:0,y:0};async function w(){if(!(a||!c)){t(5,a=!0);try{const I=await fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({start:u,length:Rn,keyword:h})});if(!I.ok)throw new Error("Failed to load sessions");const B=await I.json();if(B.code===0){const Z=B.data.sessionList.map(Y=>({id:Y.session_id,title:Y.name,timestamp:new Date(Y.createDate).getTime()}));t(0,n=[...n,...Z]),u+=Rn,c=Z.length===Rn}}catch(I){console.error("Failed to load sessions:",I)}finally{t(5,a=!1)}}}function E(I){const B=I.target,{scrollTop:Z,scrollHeight:Y,clientHeight:re}=B;Y-Z-re<50&&w()}Wn(()=>{w()});let z=null;function M(I,B){const Y=I.currentTarget.getBoundingClientRect();t(9,z={text:B,x:Y.left+Y.width/2,y:Y.bottom+8})}function y(){t(9,z=null)}function _(I,B){const Y=I.currentTarget.getBoundingClientRect();t(8,d={x:Y.left-16,y:Y.top+Y.height/2}),t(7,g=B)}async function k(I){if(I&&!p)try{t(6,p=I),t(7,g=null);const B=document.querySelector(`[data-session-id="${I}"]`);B&&B.classList.add("deleting"),await new Promise(re=>setTimeout(re,300));const Z=await fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:I})});if(!Z.ok)throw new Error("Delete request failed");const Y=await Z.json();if(Y.code===0&&Y.data.respCode===0)t(0,n=n.map(re=>({...re,deleting:re.id===I}))),setTimeout(()=>{t(0,n=n.filter(re=>!re.deleting))},300);else throw new Error("Delete failed: "+Y.message)}catch(B){console.error("Failed to delete session:",B);const Z=document.querySelector(`[data-session-id="${I}"]`);Z&&Z.classList.remove("deleting")}finally{t(6,p=null)}}function S(){g&&k(g)}const b=I=>M(I,"关闭历史会话");function A(){h=this.value,t(4,h)}const C=I=>o(I.id),R=(I,B)=>_(B,I.id),P=()=>t(7,g=null);return s.$$set=I=>{"sessions"in I&&t(0,n=I.sessions),"onClose"in I&&t(1,i=I.onClose),"onSelect"in I&&t(2,o=I.onSelect),"zIndex"in I&&t(3,l=I.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&h!==void 0&&(t(0,n=[]),u=0,c=!0,w())},[n,i,o,l,h,a,p,g,d,z,E,M,y,_,S,b,A,C,R,P]}class Ms extends un{constructor(e){super(),cn(this,e,Mo,Lo,Ct,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function Os(s,e,t){const n=s.slice();return n[60]=e[t],n[61]=e,n[62]=t,n}function Ds(s,e,t){const n=s.slice();return n[63]=e[t],n[65]=t,n}function Oo(s){let e,t=[],n=new Map,i=ut(s[3]);const o=l=>l[60].id;for(let l=0;l<i.length;l+=1){let a=Os(s,i,l),c=o(a);n.set(c,t[l]=js(c,a))}return{c(){e=x("div");for(let l=0;l<t.length;l+=1)t[l].c();r(e,"class","sy-assistant-message-list svelte-46wzni")},m(l,a){W(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[46](e)},p(l,a){a[0]&267665145&&(i=ut(l[3]),t=Zn(t,a,o,1,l,i,n,e,Yn,js,null,Os))},i:K,o:K,d(l){l&&U(e);for(let a=0;a<t.length;a+=1)t[a].d();s[46](null)}}}function Do(s){let e,t;return e=new Ms({props:{sessions:s[16],onClose:s[29],onSelect:s[30],zIndex:s[0]}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&65536&&(o.sessions=n[16]),i[0]&1&&(o.zIndex=n[0]),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function No(s){let e;return{c(){e=x("div"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></svg>',r(e,"class","sy-assistant-avatar user svelte-46wzni")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Po(s){let e;return{c(){e=x("div"),e.innerHTML='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor"><path d="M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z" fill="#6F8698"></path><path d="M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z" fill="#3677FF"></path><path d="M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z" fill="#D0D5F1"></path><path d="M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z" fill="#3677FF"></path><path d="M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z" fill="#8896A4"></path></svg>',r(e,"class","sy-assistant-avatar assistant svelte-46wzni")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Fo(s){let e,t=s[18](s[60].content)+"";return{c(){e=x("div"),r(e,"class","markdown-content svelte-46wzni")},m(n,i){W(n,e,i),e.innerHTML=t},p(n,i){i[0]&8&&t!==(t=n[18](n[60].content)+"")&&(e.innerHTML=t)},d(n){n&&U(e)}}}function Ho(s){let e;return{c(){e=x("span"),e.innerHTML='<span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span>',r(e,"class","sy-assistant-loading svelte-46wzni")},m(t,n){W(t,e,n)},p:K,d(t){t&&U(e)}}}function Ns(s){let e,t=ut(s[60].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=Hs(Ds(s,t,i));return{c(){e=x("div");for(let i=0;i<n.length;i+=1)n[i].c();r(e,"class","sy-assistant-attachments svelte-46wzni")},m(i,o){W(i,e,o);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(e,null)},p(i,o){if(o[0]&3145849){t=ut(i[60].attachments);let l;for(l=0;l<t.length;l+=1){const a=Ds(i,t,l);n[l]?n[l].p(a,o):(n[l]=Hs(a),n[l].c(),n[l].m(e,null))}for(;l<n.length;l+=1)n[l].d(1);n.length=t.length}},d(i){i&&U(e),ui(n,i)}}}function Ps(s){let e,t,n;function i(...o){return s[33](s[63],...o)}return{c(){e=x("button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',r(e,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(e,"aria-label","查看详情")},m(o,l){W(o,e,l),t||(n=[H(e,"mouseenter",i),H(e,"mouseleave",s[21])],t=!0)},p(o,l){s=o},d(o){o&&U(e),t=!1,me(n)}}}function Fs(s){let e,t=s[4].replace(/\n/g,"<br>")+"",n,i;return{c(){e=x("div"),r(e,"class","sy-assistant-tooltip svelte-46wzni"),r(e,"role","tooltip"),N(e,"left",s[5].x+"px"),N(e,"top",s[5].y+"px"),N(e,"z-index",s[0]+3),Q(e,"align-right",s[5].alignRight)},m(o,l){W(o,e,l),e.innerHTML=t,n||(i=[H(e,"mouseenter",s[35]),H(e,"mouseleave",s[36])],n=!0)},p(o,l){l[0]&16&&t!==(t=o[4].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&32&&N(e,"left",o[5].x+"px"),l[0]&32&&N(e,"top",o[5].y+"px"),l[0]&1&&N(e,"z-index",o[0]+3),l[0]&32&&Q(e,"align-right",o[5].alignRight)},d(o){o&&U(e),n=!1,me(i)}}}function Hs(s){let e,t,n,i,o,l,a,c,u,h=qt(s[63].content_title).name+"",p,g,d,w=qt(s[63].content_title).ext+"",E,z,M,y,_,k,S,b,A,C,R=s[63].tips&&Ps(s);function P(){return s[34](s[63])}let I=s[4]&&Fs(s);return{c(){e=x("div"),t=x("div"),n=x("div"),i=V("svg"),o=V("path"),l=V("polyline"),a=G(),c=x("div"),u=x("span"),p=we(h),g=G(),d=x("span"),E=we(w),M=G(),y=x("div"),R&&R.c(),_=G(),k=x("button"),k.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>',S=G(),I&&I.c(),b=G(),r(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),r(l,"points","13 2 13 9 20 9"),r(i,"xmlns","http://www.w3.org/2000/svg"),r(i,"width","16"),r(i,"height","16"),r(i,"viewBox","0 0 24 24"),r(i,"fill","none"),r(i,"stroke","currentColor"),r(i,"stroke-width","2"),r(i,"stroke-linecap","round"),r(i,"stroke-linejoin","round"),r(u,"class","sy-assistant-filename svelte-46wzni"),r(d,"class","sy-assistant-attachment-ext svelte-46wzni"),r(c,"class","sy-assistant-attachment-name svelte-46wzni"),r(c,"title",z=s[63].content_title),r(n,"class","sy-assistant-attachment-title svelte-46wzni"),r(k,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(k,"aria-label","下载文件"),r(y,"class","sy-assistant-attachment-actions svelte-46wzni"),r(t,"class","sy-assistant-attachment-header svelte-46wzni"),r(e,"class","sy-assistant-attachment svelte-46wzni")},m(B,Z){W(B,e,Z),m(e,t),m(t,n),m(n,i),m(i,o),m(i,l),m(n,a),m(n,c),m(c,u),m(u,p),m(c,g),m(c,d),m(d,E),m(t,M),m(t,y),R&&R.m(y,null),m(y,_),m(y,k),m(e,S),I&&I.m(e,null),m(e,b),A||(C=H(k,"click",P),A=!0)},p(B,Z){s=B,Z[0]&8&&h!==(h=qt(s[63].content_title).name+"")&&Le(p,h),Z[0]&8&&w!==(w=qt(s[63].content_title).ext+"")&&Le(E,w),Z[0]&8&&z!==(z=s[63].content_title)&&r(c,"title",z),s[63].tips?R?R.p(s,Z):(R=Ps(s),R.c(),R.m(y,_)):R&&(R.d(1),R=null),s[4]?I?I.p(s,Z):(I=Fs(s),I.c(),I.m(e,b)):I&&(I.d(1),I=null)},d(B){B&&U(e),R&&R.d(),I&&I.d(),A=!1,C()}}}function Bs(s){let e,t,n,i,o,l,a,c,u,h,p;function g(b,A){return b[9][b[60].id]?Uo:Bo}let d=g(s),w=d(s);function E(){return s[37](s[60])}function z(...b){return s[38](s[60],...b)}function M(){return s[39](s[60])}function y(...b){return s[40](s[60],...b)}function _(...b){return s[41](s[60],...b)}function k(...b){return s[42](s[60],...b)}let S=s[12]&&s[10][s[60].id]==="dislike"&&Us(s);return{c(){e=x("div"),t=x("button"),w.c(),i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',l=G(),a=x("button"),a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h3a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-3"></path></svg>',c=G(),S&&S.c(),u=Lt(),r(t,"class","sy-assistant-action-button svelte-46wzni"),r(t,"aria-label",n=s[9][s[60].id]?"已复制":"复制内容"),Q(t,"copied",s[9][s[60].id]),r(o,"class","sy-assistant-action-button svelte-46wzni"),r(o,"aria-label","点赞"),Q(o,"active",s[10][s[60].id]==="like"),r(a,"class","sy-assistant-action-button svelte-46wzni"),r(a,"aria-label","点踩"),Q(a,"active",s[10][s[60].id]==="dislike"),r(e,"class","sy-assistant-message-actions svelte-46wzni")},m(b,A){W(b,e,A),m(e,t),w.m(t,null),m(e,i),m(e,o),m(e,l),m(e,a),W(b,c,A),S&&S.m(b,A),W(b,u,A),h||(p=[H(t,"click",E),H(t,"mouseenter",z),H(t,"mouseleave",s[27]),H(o,"click",M),H(o,"mouseenter",y),H(o,"mouseleave",s[27]),H(a,"click",_),H(a,"mouseenter",k),H(a,"mouseleave",s[27])],h=!0)},p(b,A){s=b,d!==(d=g(s))&&(w.d(1),w=d(s),w&&(w.c(),w.m(t,null))),A[0]&520&&n!==(n=s[9][s[60].id]?"已复制":"复制内容")&&r(t,"aria-label",n),A[0]&520&&Q(t,"copied",s[9][s[60].id]),A[0]&1032&&Q(o,"active",s[10][s[60].id]==="like"),A[0]&1032&&Q(a,"active",s[10][s[60].id]==="dislike"),s[12]&&s[10][s[60].id]==="dislike"?S?S.p(s,A):(S=Us(s),S.c(),S.m(u.parentNode,u)):S&&(S.d(1),S=null)},d(b){b&&(U(e),U(c),U(u)),w.d(),S&&S.d(b),h=!1,me(p)}}}function Bo(s){let e,t,n;return{c(){e=V("svg"),t=V("rect"),n=V("path"),r(t,"x","9"),r(t,"y","9"),r(t,"width","13"),r(t,"height","13"),r(t,"rx","2"),r(t,"ry","2"),r(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(i,o){W(i,e,o),m(e,t),m(e,n)},d(i){i&&U(e)}}}function Uo(s){let e,t;return{c(){e=V("svg"),t=V("polyline"),r(t,"points","20 6 9 17 4 12"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(n,i){W(n,e,i),m(e,t)},d(n){n&&U(e)}}}function Us(s){let e,t,n,i,o,l,a,c,u;function h(){s[43].call(t,s[60])}function p(){return s[44](s[60])}function g(){return s[45](s[60])}return{c(){e=x("div"),t=x("textarea"),n=G(),i=x("div"),o=x("button"),o.textContent="取消",l=G(),a=x("button"),a.textContent="提交",r(t,"class","sy-assistant-dislike-input svelte-46wzni"),r(t,"placeholder","请输入您的反馈意见..."),r(o,"class","sy-assistant-popup-cancel svelte-46wzni"),r(a,"class","sy-assistant-popup-submit svelte-46wzni"),r(i,"class","sy-assistant-popup-actions svelte-46wzni"),r(e,"class","sy-assistant-dislike-popup svelte-46wzni"),N(e,"left",s[13].x+"px"),N(e,"top",s[13].y+"px"),N(e,"z-index",s[0]+3)},m(d,w){W(d,e,w),m(e,t),ot(t,s[11][s[60].id]),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[H(t,"input",h),H(o,"click",p),H(a,"click",g)],c=!0)},p(d,w){s=d,w[0]&2056&&ot(t,s[11][s[60].id]),w[0]&8192&&N(e,"left",s[13].x+"px"),w[0]&8192&&N(e,"top",s[13].y+"px"),w[0]&1&&N(e,"z-index",s[0]+3)},d(d){d&&U(e),c=!1,me(u)}}}function js(s,e){let t,n,i,o,l,a,c,u,h=new Date(e[60].timestamp).toLocaleTimeString()+"",p,g;function d(S,b){return S[60].type==="assistant"?Po:No}let w=d(e),E=w(e);function z(S,b){return S[7]&&S[60].id===S[3][S[3].length-1].id&&S[60].type==="assistant"&&!S[60].content?Ho:Fo}let M=z(e),y=M(e),_=e[60].attachments&&Ns(e),k=e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]&&Bs(e);return{key:s,first:null,c(){t=x("div"),E.c(),n=G(),i=x("div"),o=x("div"),y.c(),l=G(),_&&_.c(),a=G(),k&&k.c(),c=G(),u=x("div"),p=we(h),g=G(),r(o,"class","sy-assistant-message-content svelte-46wzni"),r(u,"class","sy-assistant-message-time svelte-46wzni"),r(i,"class","sy-assistant-message-bubble svelte-46wzni"),r(t,"class","sy-assistant-message svelte-46wzni"),Q(t,"user",e[60].type==="user"),this.first=t},m(S,b){W(S,t,b),E.m(t,null),m(t,n),m(t,i),m(i,o),y.m(o,null),m(o,l),_&&_.m(o,null),m(o,a),k&&k.m(o,null),m(i,c),m(i,u),m(u,p),m(t,g)},p(S,b){e=S,w!==(w=d(e))&&(E.d(1),E=w(e),E&&(E.c(),E.m(t,n))),M===(M=z(e))&&y?y.p(e,b):(y.d(1),y=M(e),y&&(y.c(),y.m(o,l))),e[60].attachments?_?_.p(e,b):(_=Ns(e),_.c(),_.m(o,a)):_&&(_.d(1),_=null),e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]?k?k.p(e,b):(k=Bs(e),k.c(),k.m(o,null)):k&&(k.d(1),k=null),b[0]&8&&h!==(h=new Date(e[60].timestamp).toLocaleTimeString()+"")&&Le(p,h),b[0]&8&&Q(t,"user",e[60].type==="user")},d(S){S&&U(t),E.d(),y.d(),_&&_.d(),k&&k.d()}}}function Ws(s){let e,t,n,i,o,l,a,c,u,h,p,g,d,w,E,z,M,y,_,k,S,b,A,C;return{c(){e=x("div"),t=x("div"),n=x("button"),n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',l=G(),a=x("div"),c=x("div"),u=x("div"),h=x("div"),p=x("textarea"),g=G(),d=x("div"),w=we(s[2]),E=we("/"),z=we(In),M=G(),y=x("button"),_=V("svg"),k=V("line"),S=V("polygon"),r(n,"class","sy-assistant-icon-button svelte-46wzni"),r(n,"aria-label","历史会话"),r(o,"class","sy-assistant-icon-button svelte-46wzni"),r(o,"aria-label","新建会话"),r(t,"class","sy-assistant-chat-actions svelte-46wzni"),r(e,"class","sy-assistant-chat-footer svelte-46wzni"),r(p,"class","sy-assistant-textarea svelte-46wzni"),r(p,"placeholder","输入您的问题..."),r(p,"maxlength",In),r(p,"rows","3"),r(d,"class","sy-assistant-char-count svelte-46wzni"),Q(d,"over-limit",s[17]),r(h,"class","sy-assistant-textarea-container svelte-46wzni"),r(u,"class","sy-assistant-input-wrapper svelte-46wzni"),r(k,"x1","22"),r(k,"y1","2"),r(k,"x2","11"),r(k,"y2","13"),r(S,"points","22 2 15 22 11 13 2 9 22 2"),r(_,"xmlns","http://www.w3.org/2000/svg"),r(_,"width","20"),r(_,"height","20"),r(_,"viewBox","0 0 24 24"),r(_,"fill","none"),r(_,"stroke","currentColor"),r(_,"stroke-width","2"),r(_,"stroke-linecap","round"),r(_,"stroke-linejoin","round"),r(y,"class","sy-assistant-send-button svelte-46wzni"),y.disabled=b=!s[1].trim()||s[17],r(y,"aria-label","发送消息"),r(c,"class","sy-assistant-input-container svelte-46wzni"),r(a,"class","sy-assistant-input-area svelte-46wzni")},m(R,P){W(R,e,P),m(e,t),m(t,n),m(t,i),m(t,o),W(R,l,P),W(R,a,P),m(a,c),m(c,u),m(u,h),m(h,p),ot(p,s[1]),m(h,g),m(h,d),m(d,w),m(d,E),m(d,z),m(c,M),m(c,y),m(y,_),m(_,k),m(_,S),A||(C=[H(n,"click",s[28]),H(n,"mouseenter",s[47]),H(n,"mouseleave",s[27]),H(n,"blur",s[27]),H(o,"click",s[31]),H(o,"mouseenter",s[48]),H(o,"mouseleave",s[27]),H(p,"input",s[49]),H(p,"keydown",s[50]),H(y,"click",s[19]),H(y,"mouseenter",s[51]),H(y,"mouseleave",s[27])],A=!0)},p(R,P){P[0]&2&&ot(p,R[1]),P[0]&4&&Le(w,R[2]),P[0]&131072&&Q(d,"over-limit",R[17]),P[0]&131074&&b!==(b=!R[1].trim()||R[17])&&(y.disabled=b)},d(R){R&&(U(e),U(l),U(a)),A=!1,me(C)}}}function Gs(s){let e,t=s[14].text+"",n;return{c(){e=x("div"),n=we(t),r(e,"class","sy-assistant-button-tooltip svelte-46wzni"),N(e,"left",s[14].x+"px"),N(e,"top",s[14].y+"px")},m(i,o){W(i,e,o),m(e,n)},p(i,o){o[0]&16384&&t!==(t=i[14].text+"")&&Le(n,t),o[0]&16384&&N(e,"left",i[14].x+"px"),o[0]&16384&&N(e,"top",i[14].y+"px")},d(i){i&&U(e)}}}function jo(s){let e,t,n,i,o,l,a;const c=[Do,Oo],u=[];function h(d,w){return d[15]?0:1}t=h(s),n=u[t]=c[t](s);let p=!s[15]&&Ws(s),g=s[14]&&Gs(s);return{c(){e=x("div"),n.c(),i=G(),p&&p.c(),o=G(),g&&g.c(),l=Lt(),r(e,"class","sy-assistant-chat-container svelte-46wzni"),N(e,"z-index",s[0]+2)},m(d,w){W(d,e,w),u[t].m(e,null),m(e,i),p&&p.m(e,null),s[52](e),W(d,o,w),g&&g.m(d,w),W(d,l,w),a=!0},p(d,w){let E=t;t=h(d),t===E?u[t].p(d,w):(ln(),We(u[E],1,1,()=>{u[E]=null}),rn(),n=u[t],n?n.p(d,w):(n=u[t]=c[t](d),n.c()),Me(n,1),n.m(e,i)),d[15]?p&&(p.d(1),p=null):p?p.p(d,w):(p=Ws(d),p.c(),p.m(e,null)),(!a||w[0]&1)&&N(e,"z-index",d[0]+2),d[14]?g?g.p(d,w):(g=Gs(d),g.c(),g.m(l.parentNode,l)):g&&(g.d(1),g=null)},i(d){a||(Me(n),a=!0)},o(d){We(n),a=!1},d(d){d&&(U(e),U(o),U(l)),u[t].d(),p&&p.d(),s[52](null),g&&g.d(d)}}}let In=500;function Wo(s){const e=s.match(/source#\[(.*)\]#source/);if(e)try{return JSON.parse(`[${e[1]}]`)}catch(t){console.error("Failed to parse attachments:",t)}return null}function qt(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}async function Go(s,e){try{const t=await fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({fileName:s,fileUrl:e})});if(!t.ok)throw new Error("Download failed");const n=t.headers.get("content-type")||"application/octet-stream",i=await t.blob(),o=window.URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=s,document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(o),document.body.removeChild(l)}catch(t){console.error("Failed to download file:",t)}}function qo(s,e,t){let n,i,o="",l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],a="",c=null,u=null,h={x:0,y:0,alignRight:!1},p=null,g=!1;J.setOptions({breaks:!0,gfm:!0});function d(T){try{const j=J(T);return As.sanitize(j)}catch(j){console.warn("Markdown parsing failed, fallback to HTML:",j);try{const oe=T.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return As.sanitize(oe)}catch(oe){return console.error("HTML fallback failed:",oe),T}}}let w;function E(T=!1){w&&w.scrollTo({top:w.scrollHeight,behavior:T?"smooth":"auto"})}hi(()=>{E(!1)});let{sessionId:z}=e;async function M(){if(!o.trim()||i)return;if(!z){console.error("No session ID available");return}const T={id:Date.now().toString(),type:"user",content:o.trim(),timestamp:Date.now()};t(3,l=[...l,T]);const j=o.trim();t(1,o="");const oe=(Date.now()+1).toString();a="",t(3,l=[...l,{id:oe,type:"assistant",content:"",timestamp:Date.now()}]),t(7,g=!0),c&&c.abort(),c=new AbortController;try{await Ri("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:Date.now().toString(),keyword:j,flowId:"1"}),signal:c.signal,onmessage(fe){try{const He=fe.data;if(He){const Qe=Wo(He);Qe?(t(3,l=l.map(Be=>Be.id===oe?{...Be,attachments:Qe}:Be)),E(!0)):(a+=He,t(3,l=l.map(Be=>Be.id===oe?{...Be,content:a}:Be)),E(!1))}}catch(He){console.error("Failed to process SSE message:",He)}},onerror(fe){console.error("SSE error:",fe),c=null,t(7,g=!1)},onclose(){c=null,t(7,g=!1)}})}catch(fe){console.error("Failed to send message:",fe),t(7,g=!1)}}function y(T,j,oe){const fe=oe.getBoundingClientRect(),He=w.getBoundingClientRect(),Qe=fe.left<He.width/2;t(4,u=j),t(5,h={x:fe.left,y:fe.top+fe.height/2,alignRight:Qe})}function _(){t(6,p=setTimeout(()=>{t(4,u=null),t(6,p=null)},200))}pi(()=>{c&&c.abort(),p&&clearTimeout(p)});let k={};async function S(T,j){try{const oe=j.replace(/<br\s*\/?>/g,`
48
- `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();await navigator.clipboard.writeText(oe),t(9,k[T]=!0,k),setTimeout(()=>{t(9,k[T]=!1,k),t(9,k)},1500)}catch(oe){console.error("Failed to copy:",oe)}}let b={},A={},C=!1;async function R(T,j){if(b[T]===j){t(10,b[T]=null,b),t(10,b);return}if(t(10,b[T]=j,b),t(10,b),j==="like")try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(oe){console.error("Failed to send feedback:",oe),t(10,b[T]=null,b),t(10,b)}else t(12,C=!0)}async function P(T){var j;if((j=A[T])!=null&&j.trim())try{if(!(await fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`},body:JSON.stringify({sessionId:z,requestId:T,feedBackFlag:"0",feedBackContent:A[T]})})).ok)throw new Error("Feedback failed");t(12,C=!1),t(11,A[T]="",A),t(11,A)}catch(oe){console.error("Failed to send feedback:",oe),t(10,b[T]=null,b),t(10,b)}}let I={x:0,y:0};function B(T,j){const fe=T.currentTarget.getBoundingClientRect();t(13,I={x:fe.left-290,y:fe.top-160}),R(j,"dislike")}let Z=null;function Y(T,j){const fe=T.currentTarget.getBoundingClientRect();t(14,Z={text:j,x:fe.left+fe.width/2,y:fe.top-8})}function re(){t(14,Z=null)}let ae=!1,he=[],Ee=Date.now().toString();function ce(){re(),t(15,ae=!0)}function Fe(){re(),t(15,ae=!1)}function ie(T){Ee=T,t(15,ae=!1)}async function Ge(){const T=await se();if(!T){console.error("Failed to create new session");return}Ee=T,t(3,l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")}async function se(){try{const T=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!T.ok)throw new Error("Failed to get session ID");const j=await T.json();if(j.code===0)return Ee=j.data.sessionId,Ee;throw new Error(j.message||"Failed to get session ID")}catch(T){return console.error("Failed to get session ID:",T),null}}let{zIndex:ke}=e;const ee=(T,j)=>y(j,T.tips,j.currentTarget),Se=T=>Go(T.content_title,T.link),_e=()=>{p&&(clearTimeout(p),t(6,p=null))},qe=()=>{t(4,u=null)},O=T=>S(T.id,T.content),te=(T,j)=>Y(j,k[T.id]?"已复制":"复制内容"),F=T=>R(T.id,"like"),X=(T,j)=>Y(j,b[T.id]==="like"?"取消点赞":"点赞"),ze=(T,j)=>B(j,T.id),Ce=(T,j)=>Y(j,b[T.id]==="dislike"?"取消点踩":"点踩");function Xe(T){A[T.id]=this.value,t(11,A)}const nt=T=>{t(12,C=!1),t(10,b[T.id]=null,b),t(10,b)},Ve=T=>P(T.id);function ht(T){rt[T?"unshift":"push"](()=>{w=T,t(8,w)})}const pt=T=>Y(T,"历史会话"),Yt=T=>Y(T,"新建会话");function Zt(){o=this.value,t(1,o)}const Cn=T=>T.key==="Enter"&&!T.shiftKey&&(M(),T.preventDefault()),Rt=T=>Y(T,"发送消息");function st(T){rt[T?"unshift":"push"](()=>{w=T,t(8,w)})}return s.$$set=T=>{"sessionId"in T&&t(32,z=T.sessionId),"zIndex"in T&&t(0,ke=T.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(17,i=n>In)},[ke,o,n,l,u,h,p,g,w,k,b,A,C,I,Z,ae,he,i,d,M,y,_,S,R,P,B,Y,re,ce,Fe,ie,Ge,z,ee,Se,_e,qe,O,te,F,X,ze,Ce,Xe,nt,Ve,ht,pt,Yt,Zt,Cn,Rt,st]}class Yo extends un{constructor(e){super(),cn(this,e,qo,jo,Ct,{sessionId:32,zIndex:0},null,[-1,-1,-1])}}function qs(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,h,p,g,d,w,E=s[2]?"退出全屏":"全屏显示",z,M,y,_,k,S,b,A,C=s[7]?"取消吸附":"吸附到边缘",R,P,I,B,Z,Y,re,ae,he,Ee=`${s[3].height}px`,ce,Fe,ie;function Ge(F,X){return F[2]?Xo:Zo}let se=Ge(s),ke=se(s);function ee(F,X){return F[7]?Qo:Vo}let Se=ee(s),_e=Se(s);const qe=[Jo,Ko],O=[];function te(F,X){return F[8]?0:1}return ae=te(s),he=O[ae]=qe[ae](s),{c(){e=x("div"),t=x("div"),n=x("div"),i=x("h3"),l=we(o),a=G(),c=x("div"),u=x("div"),h=x("button"),p=V("svg"),ke.c(),d=G(),w=x("span"),z=we(E),M=G(),y=x("div"),_=x("button"),k=V("svg"),_e.c(),b=G(),A=x("span"),R=we(C),P=G(),I=x("div"),B=x("button"),B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',Z=G(),Y=x("span"),Y.textContent="关闭助手",re=G(),he.c(),r(i,"class","svelte-1dubpto"),r(p,"xmlns","http://www.w3.org/2000/svg"),r(p,"width","18"),r(p,"height","18"),r(p,"viewBox","0 0 24 24"),r(p,"fill","none"),r(p,"stroke","currentColor"),r(p,"stroke-width","2"),r(p,"stroke-linecap","round"),r(p,"stroke-linejoin","round"),r(h,"class","sy-assistant-action-button svelte-1dubpto"),r(h,"aria-label",g=s[2]?"退出全屏":"全屏显示"),Q(h,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1dubpto"),r(u,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(k,"xmlns","http://www.w3.org/2000/svg"),r(k,"width","18"),r(k,"height","18"),r(k,"viewBox","0 0 24 24"),r(k,"fill","none"),r(k,"stroke","currentColor"),r(k,"stroke-width","2"),r(k,"stroke-linecap","round"),r(k,"stroke-linejoin","round"),r(_,"class","sy-assistant-action-button svelte-1dubpto"),r(_,"aria-label",S=s[7]?"取消吸附":"吸附到边缘"),Q(_,"active",s[7]),r(A,"class","sy-assistant-tooltip svelte-1dubpto"),r(y,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(B,"class","sy-assistant-close-button svelte-1dubpto"),r(B,"aria-label","关闭助手"),r(Y,"class","sy-assistant-tooltip svelte-1dubpto"),r(I,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(c,"class","sy-assistant-header-actions svelte-1dubpto"),r(n,"class","sy-assistant-drawer-header svelte-1dubpto"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),Q(n,"dragging",s[6]),Q(n,"fullscreen",s[2]),Q(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1dubpto"),r(e,"class","sy-assistant-drawer svelte-1dubpto"),Q(e,"fullscreen",s[2]),N(e,"height",Ee)},m(F,X){W(F,e,X),m(e,t),m(t,n),m(n,i),m(i,l),m(n,a),m(n,c),m(c,u),m(u,h),m(h,p),ke.m(p,null),m(u,d),m(u,w),m(w,z),m(c,M),m(c,y),m(y,_),m(_,k),_e.m(k,null),m(y,b),m(y,A),m(A,R),m(c,P),m(c,I),m(I,B),m(I,Z),m(I,Y),m(t,re),O[ae].m(t,null),ce=!0,Fe||(ie=[H(h,"click",s[16]),H(_,"click",s[18]),H(B,"click",s[15]),H(n,"mousedown",jn(s[17]))],Fe=!0)},p(F,X){(!ce||X[0]&8)&&o!==(o=F[3].title+"")&&Le(l,o),se!==(se=Ge(F))&&(ke.d(1),ke=se(F),ke&&(ke.c(),ke.m(p,null))),(!ce||X[0]&4&&g!==(g=F[2]?"退出全屏":"全屏显示"))&&r(h,"aria-label",g),(!ce||X[0]&4)&&Q(h,"active",F[2]),(!ce||X[0]&4)&&E!==(E=F[2]?"退出全屏":"全屏显示")&&Le(z,E),Se!==(Se=ee(F))&&(_e.d(1),_e=Se(F),_e&&(_e.c(),_e.m(k,null))),(!ce||X[0]&128&&S!==(S=F[7]?"取消吸附":"吸附到边缘"))&&r(_,"aria-label",S),(!ce||X[0]&128)&&Q(_,"active",F[7]),(!ce||X[0]&128)&&C!==(C=F[7]?"取消吸附":"吸附到边缘")&&Le(R,C),(!ce||X[0]&64)&&Q(n,"dragging",F[6]),(!ce||X[0]&4)&&Q(n,"fullscreen",F[2]),(!ce||X[0]&128)&&Q(n,"snapped",F[7]);let ze=ae;ae=te(F),ae===ze?O[ae].p(F,X):(ln(),We(O[ze],1,1,()=>{O[ze]=null}),rn(),he=O[ae],he?he.p(F,X):(he=O[ae]=qe[ae](F),he.c()),Me(he,1),he.m(t,null)),(!ce||X[0]&4)&&Q(e,"fullscreen",F[2]),X[0]&8&&Ee!==(Ee=`${F[3].height}px`)&&N(e,"height",Ee)},i(F){ce||(Me(he),ce=!0)},o(F){We(he),ce=!1},d(F){F&&U(e),ke.d(),_e.d(),O[ae].d(),Fe=!1,me(ie)}}}function Zo(s){let e;return{c(){e=V("path"),r(e,"d","M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Xo(s){let e;return{c(){e=V("path"),r(e,"d","M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3")},m(t,n){W(t,e,n)},d(t){t&&U(e)}}}function Vo(s){let e,t;return{c(){e=V("rect"),t=V("line"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x1","16"),r(t,"y1","6"),r(t,"x2","16"),r(t,"y2","18")},m(n,i){W(n,e,i),W(n,t,i)},d(n){n&&(U(e),U(t))}}}function Qo(s){let e,t;return{c(){e=V("rect"),t=V("rect"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x","12"),r(t,"y","10"),r(t,"width","6"),r(t,"height","8"),r(t,"rx","1"),r(t,"ry","1")},m(n,i){W(n,e,i),W(n,t,i)},d(n){n&&(U(e),U(t))}}}function Ko(s){let e,t;return e=new Yo({props:{zIndex:s[3].zIndex??1e3,sessionId:s[9]}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&8&&(o.zIndex=n[3].zIndex??1e3),i[0]&512&&(o.sessionId=n[9]),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function Jo(s){let e,t;return e=new Ms({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:s[3].zIndex??1e3}}),{c(){an(e.$$.fragment)},m(n,i){Ot(e,n,i),t=!0},p(n,i){const o={};i[0]&256&&(o.onClose=n[26]),i[0]&8&&(o.zIndex=n[3].zIndex??1e3),e.$set(o)},i(n){t||(Me(e.$$.fragment,n),t=!0)},o(n){We(e.$$.fragment,n),t=!1},d(n){Dt(e,n)}}}function $o(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,h,p,g,d,w,E,z,M,y=s[12]>0&&qs(s);return{c(){e=x("div"),t=x("div"),y&&y.c(),i=G(),o=x("button"),l=V("svg"),a=V("path"),c=V("path"),u=V("path"),h=V("path"),p=V("path"),g=V("path"),d=V("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1dubpto"),Q(t,"fullscreen",s[2]),N(t,"width",n),r(a,"d","M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"),r(a,"fill","#6F8698"),r(c,"d","M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"),r(c,"fill","#3677FF"),r(u,"d","M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"),r(u,"fill","#D0D5F1"),r(h,"d","M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"),r(h,"fill","#3677FF"),r(p,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(p,"fill","#FFFFFF"),r(g,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(g,"fill","#FFFFFF"),r(d,"d","M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"),r(d,"fill","#8896A4"),r(l,"class","sy-assistant-icon"),r(l,"viewBox","0 0 1024 1024"),r(l,"version","1.1"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"width","32"),r(l,"height","32"),r(l,"fill","currentColor"),r(l,"aria-label","助手图标"),r(o,"class","sy-assistant-floating-button svelte-1dubpto"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+((s[3].zIndex??1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1dubpto"),Q(e,"fullscreen",s[2]),Q(e,"snapped",s[7]),N(e,"position",s[3].position),N(e,"right",s[7]?0:`${s[0]}px`),N(e,"bottom",s[7]?0:`${s[1]}px`),N(e,"top",s[7]||s[2]?"0":"auto"),N(e,"left",s[2]?"0":"auto"),N(e,"z-index",s[3].zIndex??1e3)},m(_,k){W(_,e,k),m(e,t),y&&y.m(t,null),m(e,i),m(e,o),m(o,l),m(l,a),m(l,c),m(l,u),m(l,h),m(l,p),m(l,g),m(l,d),s[27](o),s[29](e),E=!0,z||(M=[H(o,"click",s[15]),H(o,"mousedown",jn(s[28]))],z=!0)},p(_,k){_[12]>0?y?(y.p(_,k),k[0]&4096&&Me(y,1)):(y=qs(_),y.c(),Me(y,1),y.m(t,null)):y&&(ln(),We(y,1,1,()=>{y=null}),rn()),(!E||k[0]&4)&&Q(t,"fullscreen",_[2]),k[0]&4096&&n!==(n=`${_[12]}px`)&&N(t,"width",n),(!E||k[0]&1032&&w!==(w=_[10]+" z-index: "+((_[3].zIndex??1e3)+1)+";"))&&r(o,"style",w),(!E||k[0]&4)&&Q(e,"fullscreen",_[2]),(!E||k[0]&128)&&Q(e,"snapped",_[7]),k[0]&8&&N(e,"position",_[3].position),k[0]&129&&N(e,"right",_[7]?0:`${_[0]}px`),k[0]&130&&N(e,"bottom",_[7]?0:`${_[1]}px`),k[0]&132&&N(e,"top",_[7]||_[2]?"0":"auto"),k[0]&4&&N(e,"left",_[2]?"0":"auto"),k[0]&8&&N(e,"z-index",_[3].zIndex??1e3)},i(_){E||(Me(y),E=!0)},o(_){We(y),E=!1},d(_){_&&U(e),y&&y.d(),s[27](null),s[29](null),z=!1,me(M)}}}const zn=48,ue=20;function el(s,e,t){let n,i,o,l,a=K,c=()=>(a(),a=ai(i,O=>t(12,l=O)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:ue,bottom:ue},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:h="body"}=e,{options:p={}}=e,g,d=null,w=!1,E,z=!1,M=0,y=0,_=ue,k=20,S=_,b=k,A=!1,C=ue,R=50,P=!1,I={width:0,height:0,right:0,bottom:0},B=!1,Z=!1,Y=[],re=null;async function ae(){try{const O=await fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")||""}`}});if(!O.ok)throw new Error("Failed to get session ID");const te=await O.json();if(te.code===0)return t(9,re=te.data.sessionId),re;throw new Error(te.message||"Failed to get session ID")}catch(O){return console.error("Failed to get session ID:",O),null}}function he(O,te=!1){te?t(23,A=!0):t(6,z=!0),M=O.clientX,y=O.clientY,_=te?C:S,k=te?R:b,O.preventDefault()}function Ee(O){if(!z&&!A)return;const te=M-O.clientX,F=y-O.clientY;if(A){const X=_+te,ze=O.clientY;t(24,C=Math.max(ue,Math.min(window.innerWidth-zn-ue,X)));const Ce=window.innerHeight-zn-ue,nt=Math.max(ue,Math.min(Ce,ze));t(25,R=(window.innerHeight-nt-zn)/window.innerHeight*100)}else{const X=n.width||0,ze=n.height||0,Ce=_+te;t(0,S=Math.max(ue,Math.min(window.innerWidth-X-ue,Ce)));const Xe=k+F;t(1,b=Math.max(ue,Math.min(window.innerHeight-ze-ue,Xe)))}}function ce(){t(6,z=!1),t(23,A=!1)}Wn(()=>{typeof h=="string"?d=document.querySelector(h)||document.body:d=h||document.body;const O=F=>Ee(F),te=()=>ce();return document.addEventListener("mousemove",O),document.addEventListener("mouseup",te),g&&d&&d.appendChild(g),E&&E.getBoundingClientRect().left,t(7,B=n.initialState==="snapped"),t(2,P=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,S=0),t(1,b=0),t(3,n={...n,height:typeof window<"u"?window.innerHeight:n.height,width:n.snappedWidth||n.width})):n.initialState==="fullscreen"&&(t(0,S=0),t(1,b=0),t(3,n={...n,width:typeof window<"u"?window.innerWidth:n.width,height:typeof window<"u"?window.innerHeight:n.height})),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",te),d&&g&&d.removeChild(g)}});async function Fe(){w||await ae(),t(22,w=!w)}function ie(){var O,te,F,X;t(2,P=!P),P?(I.width||(I={width:u.width,height:u.height,right:((O=u.defaultPosition)==null?void 0:O.right)??ue,bottom:((te=u.defaultPosition)==null?void 0:te.bottom)??ue}),B&&t(7,B=!1),t(20,p={...n,width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth}),t(0,S=0),t(1,b=0)):(t(20,p={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((F=u.defaultPosition)==null?void 0:F.right)??ue),t(1,b=((X=u.defaultPosition)==null?void 0:X.bottom)??ue))}function Ge(O){P||he(O)}function se(){var O,te;P&&(t(2,P=!1),t(20,p={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(7,B=!B),B?(n.height,t(0,S=0),t(1,b=0),t(20,p={...n,height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width})):(t(20,p={...n,width:u.width,height:u.height,drawerWidth:u.drawerWidth}),t(0,S=((O=u.defaultPosition)==null?void 0:O.right)??ue),t(1,b=((te=u.defaultPosition)==null?void 0:te.bottom)??ue))}function ke(O){t(8,Z=!1)}const ee=()=>t(8,Z=!1);function Se(O){rt[O?"unshift":"push"](()=>{E=O,t(5,E)})}const _e=O=>he(O,!0);function qe(O){rt[O?"unshift":"push"](()=>{g=O,t(4,g)})}return s.$$set=O=>{"target"in O&&t(21,h=O.target),"options"in O&&t(20,p=O.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n={...u,...p,defaultPosition:{...u.defaultPosition,...p.defaultPosition}}),s.$$.dirty[0]&4194316&&c(t(11,i=yi(w?P?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window<"u"&&(t(0,S=Math.max(ue,Math.min(window.innerWidth-(n.width||0),S))),t(1,b=Math.max(ue,Math.min(window.innerHeight-(n.height||0),b)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${C}px; bottom: ${R}%; transform: none; cursor: ${A?"grabbing":"grab"};`)},[S,b,P,n,g,E,z,B,Z,re,o,i,l,Y,he,Fe,ie,Ge,se,ke,p,h,w,A,C,R,ee,Se,_e,qe]}class tl extends un{constructor(e){super(),cn(this,e,el,$o,Ct,{target:21,options:20},null,[-1,-1])}}pe.SyAssistant=tl,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})})(this["@sy-design/svelte"]=this["@sy-design/svelte"]||{});