@sy-design/svelte 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +2344 -2190
- package/dist/index.umd.js +25 -25
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
(function(
|
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
|
3
|
-
`).map(i=>{const
|
4
|
-
`)}class
|
5
|
-
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=
|
6
|
-
`),i=this.lexer.state.top;this.lexer.state.top=!0;const
|
1
|
+
(function($,U){typeof exports=="object"&&typeof module!="undefined"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):($=typeof globalThis!="undefined"?globalThis:$||self,U($["@sy-design/svelte"]=$["@sy-design/svelte"]||{}))})(this,function($){"use strict";var Tl=Object.defineProperty,vl=Object.defineProperties;var El=Object.getOwnPropertyDescriptors;var bi=Object.getOwnPropertySymbols;var Sl=Object.prototype.hasOwnProperty,Al=Object.prototype.propertyIsEnumerable;var yi=$=>{throw TypeError($)};var Yn=($,U,ue)=>U in $?Tl($,U,{enumerable:!0,configurable:!0,writable:!0,value:ue}):$[U]=ue,le=($,U)=>{for(var ue in U||(U={}))Sl.call(U,ue)&&Yn($,ue,U[ue]);if(bi)for(var ue of bi(U))Al.call(U,ue)&&Yn($,ue,U[ue]);return $},Ae=($,U)=>vl($,El(U));var ce=($,U,ue)=>Yn($,typeof U!="symbol"?U+"":U,ue),xl=($,U,ue)=>U.has($)||yi("Cannot "+ue);var Ti=($,U,ue)=>U.has($)?yi("Cannot add the same private member more than once"):U instanceof WeakSet?U.add($):U.set($,ue);var pn=($,U,ue)=>(xl($,U,"access private method"),ue);var Re=($,U,ue)=>new Promise((Wt,_e)=>{var St=Je=>{try{At(ue.next(Je))}catch(dt){_e(dt)}},pt=Je=>{try{At(ue.throw(Je))}catch(dt){_e(dt)}},At=Je=>Je.done?Wt(Je.value):Promise.resolve(Je.value).then(St,pt);At((ue=ue.apply($,U)).next())});var ft,Zn,vi;function U(){}function ue(s){return s()}function Wt(){return Object.create(null)}function _e(s){s.forEach(ue)}function St(s){return typeof s=="function"}function pt(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function At(s){return Object.keys(s).length===0}function Je(s,...e){if(s==null){for(const n of e)n(void 0);return U}const t=s.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const dt=typeof window!="undefined";let Xn=dt?()=>window.performance.now():()=>Date.now(),Vn=dt?s=>requestAnimationFrame(s):U;const gt=new Set;function Qn(s){gt.forEach(e=>{e.c(s)||(gt.delete(e),e.f())}),gt.size!==0&&Vn(Qn)}function Ei(s){let e;return gt.size===0&&Vn(Qn),{promise:new Promise(t=>{gt.add(e={c:s,f:t})}),abort(){gt.delete(e)}}}function g(s,e){s.appendChild(e)}function G(s,e,t){s.insertBefore(e,t||null)}function W(s){s.parentNode&&s.parentNode.removeChild(s)}function Jn(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function S(s){return document.createElement(s)}function J(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function Te(s){return document.createTextNode(s)}function q(){return Te(" ")}function qt(){return Te("")}function Y(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function Kn(s){return function(e){return e.preventDefault(),s.call(this,e)}}function a(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function Si(s){return Array.from(s.childNodes)}function Pe(s,e){e=""+e,s.data!==e&&(s.data=e)}function nt(s,e){s.value=e==null?"":e}function P(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}function $n(s,e,t){for(let n=0;n<s.options.length;n+=1){const i=s.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(s.selectedIndex=-1)}function Ai(s){const e=s.querySelector(":checked");return e&&e.__value}function K(s,e,t){s.classList.toggle(e,!!t)}let xt;function It(s){xt=s}function dn(){if(!xt)throw new Error("Function called outside component initialization");return xt}function gn(s){dn().$$.on_mount.push(s)}function xi(s){dn().$$.after_update.push(s)}function Ii(s){dn().$$.on_destroy.push(s)}const mt=[],_t=[];let kt=[];const es=[],Ri=Promise.resolve();let mn=!1;function Ci(){mn||(mn=!0,Ri.then(ts))}function Gt(s){kt.push(s)}const _n=new Set;let wt=0;function ts(){if(wt!==0)return;const s=xt;do{try{for(;wt<mt.length;){const e=mt[wt];wt++,It(e),Li(e.$$)}}catch(e){throw mt.length=0,wt=0,e}for(It(null),mt.length=0,wt=0;_t.length;)_t.pop()();for(let e=0;e<kt.length;e+=1){const t=kt[e];_n.has(t)||(_n.add(t),t())}kt.length=0}while(mt.length);for(;es.length;)es.pop()();mn=!1,_n.clear(),It(s)}function Li(s){if(s.fragment!==null){s.update(),_e(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(Gt)}}function Mi(s){const e=[],t=[];kt.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),kt=e}const Yt=new Set;let rt;function kn(){rt={r:0,c:[],p:rt}}function wn(){rt.r||_e(rt.c),rt=rt.p}function Ue(s,e){s&&s.i&&(Yt.delete(s),s.i(e))}function Ke(s,e,t,n){if(s&&s.o){if(Yt.has(s))return;Yt.add(s),rt.c.push(()=>{Yt.delete(s),n&&(t&&s.d(1),n())}),s.o(e)}else n&&n()}function st(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function ns(s,e){s.d(1),e.delete(s.key)}function ss(s,e,t,n,i,l,o,r,c,u,h,p){let d=s.length,m=l.length,_=d;const E={};for(;_--;)E[s[_].key]=_;const I=[],z=new Map,x=new Map,w=[];for(_=m;_--;){const R=p(i,l,_),L=t(R);let C=o.get(L);C?w.push(()=>C.p(R,e)):(C=u(L,R),C.c()),z.set(L,I[_]=C),L in E&&x.set(L,Math.abs(_-E[L]))}const k=new Set,b=new Set;function v(R){Ue(R,1),R.m(r,h),o.set(R.key,R),h=R.first,m--}for(;d&&m;){const R=I[m-1],L=s[d-1],C=R.key,X=L.key;R===L?(h=R.first,d--,m--):z.has(X)?!o.has(C)||k.has(C)?v(R):b.has(X)?d--:x.get(C)>x.get(X)?(b.add(C),v(R)):(k.add(X),d--):(c(L,o),d--)}for(;d--;){const R=s[d];z.has(R.key)||c(R,o)}for(;m;)v(I[m-1]);return _e(w),I}function bn(s){s&&s.c()}function Zt(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),Gt(()=>{const l=s.$$.on_mount.map(ue).filter(St);s.$$.on_destroy?s.$$.on_destroy.push(...l):_e(l),s.$$.on_mount=[]}),i.forEach(Gt)}function Xt(s,e){const t=s.$$;t.fragment!==null&&(Mi(t.after_update),_e(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function zi(s,e){s.$$.dirty[0]===-1&&(mt.push(s),Ci(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function yn(s,e,t,n,i,l,o=null,r=[-1]){const c=xt;It(s);const u=s.$$={fragment:null,ctx:[],props:l,update:U,not_equal:i,bound:Wt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Wt(),dirty:r,skip_bound:!1,root:e.target||c.$$.root};o&&o(u.root);let h=!1;if(u.ctx=t?t(s,e.props||{},(p,d,...m)=>{const _=m.length?m[0]:d;return u.ctx&&i(u.ctx[p],u.ctx[p]=_)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](_),h&&zi(s,p)),d}):[],u.update(),h=!0,_e(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=Si(e.target);u.fragment&&u.fragment.l(p),p.forEach(W)}else u.fragment&&u.fragment.c();e.intro&&Ue(s.$$.fragment),Zt(s,e.target,e.anchor),ts()}It(c)}class Tn{constructor(){ce(this,"$$");ce(this,"$$set")}$destroy(){Xt(this,1),this.$destroy=U}$on(e,t){if(!St(t))return U;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&&!At(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Oi="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Oi);const bt=[];function Di(s,e=U){let t;const n=new Set;function i(r){if(pt(s,r)&&(s=r,t)){const c=!bt.length;for(const u of n)u[1](),bt.push(u,s);if(c){for(let u=0;u<bt.length;u+=2)bt[u][0](bt[u+1]);bt.length=0}}}function l(r){i(r(s))}function o(r,c=U){const u=[r,c];return n.add(u),n.size===1&&(t=e(i,l)||U),r(s),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:i,update:l,subscribe:o}}function is(s){return Object.prototype.toString.call(s)==="[object Date]"}function vn(s,e,t,n){if(typeof t=="number"||is(t)){const i=n-t,l=(t-e)/(s.dt||1/60),o=s.opts.stiffness*i,r=s.opts.damping*l,c=(o-r)*s.inv_mass,u=(l+c)*s.dt;return Math.abs(u)<s.opts.precision&&Math.abs(i)<s.opts.precision?n:(s.settled=!1,is(t)?new Date(t.getTime()+u):t+u)}else{if(Array.isArray(t))return t.map((i,l)=>vn(s,e[l],t[l],n[l]));if(typeof t=="object"){const i={};for(const l in t)i[l]=vn(s,e[l],t[l],n[l]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function Ni(s,e={}){const t=Di(s),{stiffness:n=.15,damping:i=.8,precision:l=.01}=e;let o,r,c,u=s,h=s,p=1,d=0,m=!1;function _(I,z={}){h=I;const x=c={};return s==null||z.hard||E.stiffness>=1&&E.damping>=1?(m=!0,o=Xn(),u=I,t.set(s=h),Promise.resolve()):(z.soft&&(d=1/((z.soft===!0?.5:+z.soft)*60),p=0),r||(o=Xn(),m=!1,r=Ei(w=>{if(m)return m=!1,r=null,!1;p=Math.min(p+d,1);const k={inv_mass:p,opts:E,settled:!0,dt:(w-o)*60/1e3},b=vn(k,u,s,h);return o=w,u=s,t.set(s=b),k.settled&&(r=null),!k.settled})),new Promise(w=>{r.promise.then(()=>{x===c&&w()})}))}const E={set:_,update:(I,z)=>_(I(h,s),z),subscribe:t.subscribe,stiffness:n,damping:i,precision:l};return E}function Pi(s,e){return Re(this,null,function*(){const t=s.getReader();let n;for(;!(n=yield t.read()).done;)e(n.value)})}function Fi(s){let e,t,n,i=!1;return function(o){e===void 0?(e=o,t=0,n=-1):e=Bi(e,o);const r=e.length;let c=0;for(;t<r;){i&&(e[t]===10&&(c=++t),i=!1);let u=-1;for(;t<r&&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===r?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Hi(s,e,t){let n=os();const i=new TextDecoder;return function(o,r){if(o.length===0)t==null||t(n),n=os();else if(r>0){const c=i.decode(o.subarray(0,r)),u=r+(o[r+1]===32?2:1),h=i.decode(o.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 Bi(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function os(){return{data:"",event:"",id:"",retry:void 0}}var ji=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 En="text/event-stream",Ui=1e3,ls="last-event-id";function Wi(s,e){var{signal:t,headers:n,onopen:i,onmessage:l,onclose:o,onerror:r,openWhenHidden:c,fetch:u}=e,h=ji(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,d)=>{const m=Object.assign({},n);m.accept||(m.accept=En);let _;function E(){_.abort(),document.hidden||b()}c||document.addEventListener("visibilitychange",E);let I=Ui,z=0;function x(){document.removeEventListener("visibilitychange",E),window.clearTimeout(z),_.abort()}t==null||t.addEventListener("abort",()=>{x(),p()});const w=u!=null?u:window.fetch,k=i!=null?i:qi;function b(){return Re(this,null,function*(){var v;_=new AbortController;try{const R=yield w(s,Object.assign(Object.assign({},h),{headers:m,signal:_.signal}));yield k(R),yield Pi(R.body,Fi(Hi(L=>{L?m[ls]=L:delete m[ls]},L=>{I=L},l))),o==null||o(),x(),p()}catch(R){if(!_.signal.aborted)try{const L=(v=r==null?void 0:r(R))!==null&&v!==void 0?v:I;window.clearTimeout(z),z=window.setTimeout(b,L)}catch(L){x(),d(L)}}})}b()})}function qi(s){const e=s.headers.get("content-type");if(!(e!=null&&e.startsWith(En)))throw new Error(`Expected content-type to be ${En}, Actual: ${e}`)}function Sn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let at=Sn();function rs(s){at=s}const as=/[&<>"']/,Gi=new RegExp(as.source,"g"),cs=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Yi=new RegExp(cs.source,"g"),Zi={"&":"&","<":"<",">":">",'"':""","'":"'"},us=s=>Zi[s];function Fe(s,e){if(e){if(as.test(s))return s.replace(Gi,us)}else if(cs.test(s))return s.replace(Yi,us);return s}const Xi=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Vi(s){return s.replace(Xi,(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 Qi=/(^|[^\[])\^/g;function se(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,l)=>{let o=typeof l=="string"?l:l.source;return o=o.replace(Qi,"$1"),t=t.replace(i,o),n},getRegex:()=>new RegExp(t,e)};return n}function fs(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch(e){return null}return s}const Rt={exec:()=>null};function hs(s,e){const t=s.replace(/\|/g,(l,o,r)=>{let c=!1,u=o;for(;--u>=0&&r[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 Vt(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const l=s.charAt(n-i-1);if(l===e&&!t)i++;else if(l!==e&&t)i++;else break}return s.slice(0,n-i)}function Ji(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 ps(s,e,t,n){const i=e.href,l=e.title?Fe(e.title):null,o=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const r={type:"link",raw:t,href:i,title:l,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,r}return{type:"image",raw:t,href:i,title:l,text:Fe(o)}}function Ki(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
3
|
+
`).map(i=>{const l=i.match(/^\s+/);if(l===null)return i;const[o]=l;return o.length>=n.length?i.slice(n.length):i}).join(`
|
4
|
+
`)}class Qt{constructor(e){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=e||at}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:Vt(n,`
|
5
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Ki(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=Vt(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=Vt(t[0].replace(/^ *>[ \t]?/gm,""),`
|
6
|
+
`),i=this.lexer.state.top;this.lexer.state.top=!0;const l=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:l,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,l={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 o=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let r="",c="",u=!1;for(;e;){let h=!1;if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let p=t[2].split(`
|
7
7
|
`,1)[0].replace(/^\t+/,z=>" ".repeat(3*z.length)),d=e.split(`
|
8
|
-
`,1)[0],
|
9
|
-
`,e=e.substring(d.length+1),h=!0),!h){const z=new RegExp(`^ {0,${Math.min(3,
|
10
|
-
`,1)[0];if(d=
|
11
|
-
`+d.slice(
|
12
|
-
`+d}!
|
13
|
-
`,e=e.substring(
|
14
|
-
`):[],
|
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:Fe(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
|
16
|
-
]`).replace("lheading",
|
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,(
|
8
|
+
`,1)[0],m=0;this.options.pedantic?(m=2,c=p.trimStart()):(m=t[2].search(/[^ ]/),m=m>4?1:m,c=p.slice(m),m+=t[1].length);let _=!1;if(!p&&/^ *$/.test(d)&&(r+=d+`
|
9
|
+
`,e=e.substring(d.length+1),h=!0),!h){const z=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),x=new RegExp(`^ {0,${Math.min(3,m-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,m-1)}}#`);for(;e;){const b=e.split(`
|
10
|
+
`,1)[0];if(d=b,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),w.test(d)||k.test(d)||z.test(d)||x.test(e))break;if(d.search(/[^ ]/)>=m||!d.trim())c+=`
|
11
|
+
`+d.slice(m);else{if(_||p.search(/[^ ]/)>=4||w.test(p)||k.test(p)||x.test(p))break;c+=`
|
12
|
+
`+d}!_&&!d.trim()&&(_=!0),r+=b+`
|
13
|
+
`,e=e.substring(b.length+1),p=d.slice(m)}}l.loose||(u?l.loose=!0:/\n *\n *$/.test(r)&&(u=!0));let E=null,I;this.options.gfm&&(E=/^\[[ xX]\] /.exec(c),E&&(I=E[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),l.items.push({type:"list_item",raw:r,task:!!E,checked:I,loose:!1,text:c,tokens:[]}),l.raw+=r}l.items[l.items.length-1].raw=r.trimEnd(),l.items[l.items.length-1].text=c.trimEnd(),l.raw=l.raw.trimEnd();for(let h=0;h<l.items.length;h++)if(this.lexer.state.top=!1,l.items[h].tokens=this.lexer.blockTokens(l.items[h].text,[]),!l.loose){const p=l.items[h].tokens.filter(m=>m.type==="space"),d=p.length>0&&p.some(m=>/\n.*\n/.test(m.raw));l.loose=d}if(l.loose)for(let h=0;h<l.items.length;h++)l.items[h].loose=!0;return l}}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"):"",l=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:l}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=hs(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),l=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
14
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const r of i)/^ *-+: *$/.test(r)?o.align.push("right"):/^ *:-+: *$/.test(r)?o.align.push("center"):/^ *:-+ *$/.test(r)?o.align.push("left"):o.align.push(null);for(const r of n)o.header.push({text:r,tokens:this.lexer.inline(r)});for(const r of l)o.rows.push(hs(r,o.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return o}}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:Fe(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 o=Vt(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{const o=Ji(t[2],"()");if(o>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],l="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],l=o[3])}else l=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)),ps(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.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," "),l=t[i.toLowerCase()];if(!l){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return ps(n,l,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 o=[...i[0]].length-1;let r,c,u=o,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+o);(i=p.exec(t))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(c=[...r].length,i[3]||i[4]){u+=c;continue}else if((i[5]||i[6])&&o%3&&!((o+c)%3)){h+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+h);const d=[...i[0]][0].length,m=e.slice(0,o+i.index+d+c);if(Math.min(o,c)%2){const E=m.slice(1,-1);return{type:"em",raw:m,text:E,tokens:this.lexer.inlineTokens(E)}}const _=m.slice(2,-2);return{type:"strong",raw:m,text:_,tokens:this.lexer.inlineTokens(_)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),l=/^ /.test(n)&&/ $/.test(n);return i&&l&&(n=n.substring(1,n.length-1)),n=Fe(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=Fe(t[1]),i="mailto:"+n):(n=Fe(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,i;let t;if(t=this.rules.inline.url.exec(e)){let l,o;if(t[2]==="@")l=Fe(t[0]),o="mailto:"+l;else{let r;do r=t[0],t[0]=(i=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?i:"";while(r!==t[0]);l=Fe(t[0]),t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:l,href:o,tokens:[{type:"text",raw:l,text:l}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=Fe(t[0]),{type:"text",raw:t[0],text:n}}}}const $i=/^(?: *(?:\n|$))+/,eo=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,to=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ct=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,no=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ds=/(?:[*+-]|\d{1,9}[.)])/,gs=se(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ds).getRegex(),An=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,so=/^[^\n]+/,xn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,io=se(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",xn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),oo=se(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ds).getRegex(),Jt="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",In=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,lo=se("^ {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",In).replace("tag",Jt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ms=se(An).replace("hr",Ct).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",Jt).getRegex(),Rn={blockquote:se(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ms).getRegex(),code:eo,def:io,fences:to,heading:no,hr:Ct,html:lo,lheading:gs,list:oo,newline:$i,paragraph:ms,table:Rt,text:so},_s=se("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ct).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",Jt).getRegex(),ro=Ae(le({},Rn),{table:_s,paragraph:se(An).replace("hr",Ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_s).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",Jt).getRegex()}),ao=Ae(le({},Rn),{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",In).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:Rt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:se(An).replace("hr",Ct).replace("heading",` *#{1,6} *[^
|
16
|
+
]`).replace("lheading",gs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),ks=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,co=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ws=/^( {2,}|\\)\n(?!\s*$)/,uo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Lt="\\p{P}$+<=>`^|~",fo=se(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Lt).getRegex(),ho=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,po=se(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Lt).getRegex(),go=se("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Lt).getRegex(),mo=se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Lt).getRegex(),_o=se(/\\([punct])/,"gu").replace(/punct/g,Lt).getRegex(),ko=se(/^<(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(),wo=se(In).replace("(?:-->|$)","-->").getRegex(),bo=se("^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",wo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,yo=se(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Kt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bs=se(/^!?\[(label)\]\[(ref)\]/).replace("label",Kt).replace("ref",xn).getRegex(),ys=se(/^!?\[(ref)\](?:\[\])?/).replace("ref",xn).getRegex(),To=se("reflink|nolink(?!\\()","g").replace("reflink",bs).replace("nolink",ys).getRegex(),Cn={_backpedal:Rt,anyPunctuation:_o,autolink:ko,blockSkip:ho,br:ws,code:co,del:Rt,emStrongLDelim:po,emStrongRDelimAst:go,emStrongRDelimUnd:mo,escape:ks,link:yo,nolink:ys,punctuation:fo,reflink:bs,reflinkSearch:To,tag:bo,text:uo,url:Rt},vo=Ae(le({},Cn),{link:se(/^!?\[(label)\]\((.*?)\)/).replace("label",Kt).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kt).getRegex()}),Ln=Ae(le({},Cn),{escape:se(ks).replace("])","~|])").getRegex(),url:se(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Eo=Ae(le({},Ln),{br:se(ws).replace("{2,}","*").getRegex(),text:se(Ln.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),$t={normal:Rn,gfm:ro,pedantic:ao},Mt={normal:Cn,gfm:Ln,breaks:Eo,pedantic:vo};class Ze{constructor(e){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"tokenizer");ce(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||at,this.options.tokenizer=this.options.tokenizer||new Qt,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:$t.normal,inline:Mt.normal};this.options.pedantic?(t.block=$t.pedantic,t.inline=Mt.pedantic):this.options.gfm&&(t.block=$t.gfm,this.options.breaks?t.inline=Mt.breaks:t.inline=Mt.gfm),this.tokenizer.rules=t}static get rules(){return{block:$t,inline:Mt}}static lex(e,t){return new Ze(t).lex(e)}static lexInline(e,t){return new Ze(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,(r,c,u)=>c+" ".repeat(u.length));let n,i,l,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(n=r.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
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
19
|
`+n.raw,i.text+=`
|
20
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
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(
|
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(l=e,this.options.extensions&&this.options.extensions.startBlock){let r=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&&(r=Math.min(r,u))}),r<1/0&&r>=0&&(l=e.substring(0,r+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){i=t[t.length-1],o&&i.type==="paragraph"?(i.raw+=`
|
23
23
|
`+n.raw,i.text+=`
|
24
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),l
|
24
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),o=l.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
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
|
26
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,l,o=e,r,c,u;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)h.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,r.index)+"++"+o.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,o,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(l=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const p=e.slice(1);let d;this.options.extensions.startInline.forEach(m=>{d=m.call({lexer:this},p),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(l)){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 en{constructor(e){ce(this,"options");this.options=e||at}code(e,t,n){var l;const i=(l=(t||"").match(/^\S*/))==null?void 0:l[0];return e=e.replace(/\n$/,"")+`
|
27
27
|
`,i?'<pre><code class="language-'+Fe(i)+'">'+(n?e:Fe(e,!0))+`</code></pre>
|
28
28
|
`:"<pre><code>"+(n?e:Fe(e,!0))+`</code></pre>
|
29
29
|
`}blockquote(e){return`<blockquote>
|
30
30
|
${e}</blockquote>
|
31
31
|
`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
|
32
32
|
`}hr(){return`<hr>
|
33
|
-
`}list(e,t,n){const i=t?"ol":"ul",
|
33
|
+
`}list(e,t,n){const i=t?"ol":"ul",l=t&&n!==1?' start="'+n+'"':"";return"<"+i+l+`>
|
34
34
|
`+e+"</"+i+`>
|
35
35
|
`}listitem(e,t,n){return`<li>${e}</li>
|
36
36
|
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
|
@@ -41,8 +41,8 @@ ${e}</blockquote>
|
|
41
41
|
`}tablerow(e){return`<tr>
|
42
42
|
${e}</tr>
|
43
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=
|
45
|
-
`+(
|
46
|
-
Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Fe(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const rt=new ko;function ee(s,e){return rt.parse(s,e)}ee.options=ee.setOptions=function(s){return rt.setOptions(s),ee.defaults=rt.defaults,is(ee.defaults),ee},ee.getDefaults=yn,ee.defaults=lt,ee.use=function(...s){return rt.use(...s),ee.defaults=rt.defaults,is(ee.defaults),ee},ee.walkTokens=function(s,e){return rt.walkTokens(s,e)},ee.parseInline=rt.parseInline,ee.Parser=Ze,ee.parser=Ze.parse,ee.Renderer=Kt,ee.TextRenderer=In,ee.Lexer=Ye,ee.lexer=Ye.lex,ee.Tokenizer=Xt,ee.Hooks=zt,ee.parse=ee,ee.options,ee.setOptions,ee.use,ee.walkTokens,ee.parseInline,Ze.parse,Ye.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:_s,setPrototypeOf:bs,isFrozen:_o,getPrototypeOf:bo,getOwnPropertyDescriptor:yo}=Object;let{freeze:Ce,seal:We,create:ys}=Object,{apply:Rn,construct:Cn}=typeof Reflect!="undefined"&&Reflect;Ce||(Ce=function(e){return e}),We||(We=function(e){return e}),Rn||(Rn=function(e,t,n){return e.apply(t,n)}),Cn||(Cn=function(e,t){return new e(...t)});const $t=He(Array.prototype.forEach),Ts=He(Array.prototype.pop),Ot=He(Array.prototype.push),en=He(String.prototype.toLowerCase),Mn=He(String.prototype.toString),vs=He(String.prototype.match),Dt=He(String.prototype.replace),To=He(String.prototype.indexOf),vo=He(String.prototype.trim),qe=He(Object.prototype.hasOwnProperty),Me=He(RegExp.prototype.test),Nt=Eo(TypeError);function He(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 Rn(s,e,n)}}function Eo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Cn(s,t)}}function Z(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:en;bs&&bs(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(_o(e)||(e[n]=o),i=o)}s[i]=!0}return s}function xo(s){for(let e=0;e<s.length;e++)qe(s,e)||(s[e]=null);return s}function at(s){const e=ys(null);for(const[t,n]of _s(s))qe(s,t)&&(Array.isArray(n)?e[t]=xo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=at(n):e[t]=n);return e}function Pt(s,e){for(;s!==null;){const n=yo(s,e);if(n){if(n.get)return He(n.get);if(typeof n.value=="function")return He(n.value)}s=bo(s)}function t(){return null}return t}const Es=Ce(["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=Ce(["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"]),zn=Ce(["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"]),So=Ce(["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"]),On=Ce(["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"]),Ao=Ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xs=Ce(["#text"]),Ss=Ce(["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"]),Dn=Ce(["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"]),As=Ce(["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"]),tn=Ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Io=We(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ro=We(/<%[\w\W]*|[\w\W]*%>/gm),Co=We(/\$\{[\w\W]*}/gm),Mo=We(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lo=We(/^aria-[\-\w]+$/),Is=We(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zo=We(/^(?:\w+script|data):/i),Oo=We(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rs=We(/^html$/i),Do=We(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cs=Object.freeze({__proto__:null,ARIA_ATTR:Lo,ATTR_WHITESPACE:Oo,CUSTOM_ELEMENT:Do,DATA_ATTR:Mo,DOCTYPE_NAME:Rs,ERB_EXPR:Ro,IS_ALLOWED_URI:Is,IS_SCRIPT_OR_DATA:zo,MUSTACHE_EXPR:Io,TMPLIT_EXPR:Co});const Ft={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},No=function(){return typeof window=="undefined"?null:window},Po=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(l){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Ms=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ls(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:No();const e=P=>Ls(P);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==Ft.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:d,trustedTypes:g}=s,w=c.prototype,v=Pt(w,"cloneNode"),I=Pt(w,"remove"),z=Pt(w,"nextSibling"),E=Pt(w,"childNodes"),_=Pt(w,"parentNode");if(typeof l=="function"){const P=t.createElement("template");P.content&&P.content.ownerDocument&&(t=P.content.ownerDocument)}let k,T="";const{implementation:S,createNodeIterator:b,createDocumentFragment:M,getElementsByTagName:R}=t,{importNode:F}=n;let C=Ms();e.isSupported=typeof _s=="function"&&typeof _=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:V,TMPLIT_EXPR:Q,DATA_ATTR:ae,ARIA_ATTR:ge,IS_SCRIPT_OR_DATA:he,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:ce}=Cs;let{IS_ALLOWED_URI:Xe}=Cs,ue=null;const $e=Z({},[...Es,...Ln,...zn,...On,...xs]);let re=null;const Le=Z({},[...Ss,...Dn,...As,...tn]);let te=Object.seal(ys(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}})),De=null,Ae=null,et=!0,N=!0,ie=!1,O=!0,j=!1,we=!0,ke=!1,Ne=!1,Be=!1,st=!1,yt=!1,Tt=!1,sn=!0,on=!1;const Hn="user-content-";let Ht=!0,ut=!1,it={},y=null;const H=Z({},["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 $=null;const _e=Z({},["audio","video","img","source","image","track"]);let pe=null;const Ie=Z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ye="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml";let vt=ve,Bn=!1,Un=null;const cl=Z({},[ye,tt,ve],Mn);let ln=Z({},["mi","mo","mn","ms","mtext"]),rn=Z({},["annotation-xml"]);const ul=Z({},["title","style","font","a","script"]);let Bt=null;const fl=["application/xhtml+xml","text/html"],hl="text/html";let Te=null,Et=null;const pl=t.createElement("form"),ti=function(f){return f instanceof RegExp||f instanceof Function},jn=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Et&&Et===f)){if((!f||typeof f!="object")&&(f={}),f=at(f),Bt=fl.indexOf(f.PARSER_MEDIA_TYPE)===-1?hl:f.PARSER_MEDIA_TYPE,Te=Bt==="application/xhtml+xml"?Mn:en,ue=qe(f,"ALLOWED_TAGS")?Z({},f.ALLOWED_TAGS,Te):$e,re=qe(f,"ALLOWED_ATTR")?Z({},f.ALLOWED_ATTR,Te):Le,Un=qe(f,"ALLOWED_NAMESPACES")?Z({},f.ALLOWED_NAMESPACES,Mn):cl,pe=qe(f,"ADD_URI_SAFE_ATTR")?Z(at(Ie),f.ADD_URI_SAFE_ATTR,Te):Ie,$=qe(f,"ADD_DATA_URI_TAGS")?Z(at(_e),f.ADD_DATA_URI_TAGS,Te):_e,y=qe(f,"FORBID_CONTENTS")?Z({},f.FORBID_CONTENTS,Te):H,De=qe(f,"FORBID_TAGS")?Z({},f.FORBID_TAGS,Te):{},Ae=qe(f,"FORBID_ATTR")?Z({},f.FORBID_ATTR,Te):{},it=qe(f,"USE_PROFILES")?f.USE_PROFILES:!1,et=f.ALLOW_ARIA_ATTR!==!1,N=f.ALLOW_DATA_ATTR!==!1,ie=f.ALLOW_UNKNOWN_PROTOCOLS||!1,O=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,j=f.SAFE_FOR_TEMPLATES||!1,we=f.SAFE_FOR_XML!==!1,ke=f.WHOLE_DOCUMENT||!1,st=f.RETURN_DOM||!1,yt=f.RETURN_DOM_FRAGMENT||!1,Tt=f.RETURN_TRUSTED_TYPE||!1,Be=f.FORCE_BODY||!1,sn=f.SANITIZE_DOM!==!1,on=f.SANITIZE_NAMED_PROPS||!1,Ht=f.KEEP_CONTENT!==!1,ut=f.IN_PLACE||!1,Xe=f.ALLOWED_URI_REGEXP||Is,vt=f.NAMESPACE||ve,ln=f.MATHML_TEXT_INTEGRATION_POINTS||ln,rn=f.HTML_INTEGRATION_POINTS||rn,te=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&ti(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&ti(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),j&&(N=!1),yt&&(st=!0),it&&(ue=Z({},xs),re=[],it.html===!0&&(Z(ue,Es),Z(re,Ss)),it.svg===!0&&(Z(ue,Ln),Z(re,Dn),Z(re,tn)),it.svgFilters===!0&&(Z(ue,zn),Z(re,Dn),Z(re,tn)),it.mathMl===!0&&(Z(ue,On),Z(re,As),Z(re,tn))),f.ADD_TAGS&&(ue===$e&&(ue=at(ue)),Z(ue,f.ADD_TAGS,Te)),f.ADD_ATTR&&(re===Le&&(re=at(re)),Z(re,f.ADD_ATTR,Te)),f.ADD_URI_SAFE_ATTR&&Z(pe,f.ADD_URI_SAFE_ATTR,Te),f.FORBID_CONTENTS&&(y===H&&(y=at(y)),Z(y,f.FORBID_CONTENTS,Te)),Ht&&(ue["#text"]=!0),ke&&Z(ue,["html","head","body"]),ue.table&&(Z(ue,["tbody"]),delete De.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,T=k.createHTML("")}else k===void 0&&(k=Po(g,i)),k!==null&&typeof T=="string"&&(T=k.createHTML(""));Ce&&Ce(f),Et=f}},ni=Z({},[...Ln,...zn,...So]),si=Z({},[...On,...Ao]),dl=function(f){let x=_(f);(!x||!x.tagName)&&(x={namespaceURI:vt,tagName:"template"});const L=en(f.tagName),fe=en(x.tagName);return Un[f.namespaceURI]?f.namespaceURI===tt?x.namespaceURI===ve?L==="svg":x.namespaceURI===ye?L==="svg"&&(fe==="annotation-xml"||ln[fe]):!!ni[L]:f.namespaceURI===ye?x.namespaceURI===ve?L==="math":x.namespaceURI===tt?L==="math"&&rn[fe]:!!si[L]:f.namespaceURI===ve?x.namespaceURI===tt&&!rn[fe]||x.namespaceURI===ye&&!ln[fe]?!1:!si[L]&&(ul[L]||!ni[L]):!!(Bt==="application/xhtml+xml"&&Un[f.namespaceURI]):!1},Ve=function(f){Ot(e.removed,{element:f});try{_(f).removeChild(f)}catch(x){I(f)}},an=function(f,x){try{Ot(e.removed,{attribute:x.getAttributeNode(f),from:x})}catch(L){Ot(e.removed,{attribute:null,from:x})}if(x.removeAttribute(f),f==="is")if(st||yt)try{Ve(x)}catch(L){}else try{x.setAttribute(f,"")}catch(L){}},ii=function(f){let x=null,L=null;if(Be)f="<remove></remove>"+f;else{const Ee=vs(f,/^[\r\n\t ]+/);L=Ee&&Ee[0]}Bt==="application/xhtml+xml"&&vt===ve&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const fe=k?k.createHTML(f):f;if(vt===ve)try{x=new d().parseFromString(fe,Bt)}catch(Ee){}if(!x||!x.documentElement){x=S.createDocument(vt,"template",null);try{x.documentElement.innerHTML=Bn?T:fe}catch(Ee){}}const Re=x.body||x.documentElement;return f&&L&&Re.insertBefore(t.createTextNode(L),Re.childNodes[0]||null),vt===ve?R.call(x,ke?"html":"body")[0]:ke?x.documentElement:Re},oi=function(f){return b.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Wn=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")},li=function(f){return typeof a=="function"&&f instanceof a};function nt(P,f,x){$t(P,L=>{L.call(e,f,x,Et)})}const ri=function(f){let x=null;if(nt(C.beforeSanitizeElements,f,null),Wn(f))return Ve(f),!0;const L=Te(f.nodeName);if(nt(C.uponSanitizeElement,f,{tagName:L,allowedTags:ue}),f.hasChildNodes()&&!li(f.firstElementChild)&&Me(/<[/\w]/g,f.innerHTML)&&Me(/<[/\w]/g,f.textContent)||f.nodeType===Ft.progressingInstruction||we&&f.nodeType===Ft.comment&&Me(/<[/\w]/g,f.data))return Ve(f),!0;if(!ue[L]||De[L]){if(!De[L]&&ci(L)&&(te.tagNameCheck instanceof RegExp&&Me(te.tagNameCheck,L)||te.tagNameCheck instanceof Function&&te.tagNameCheck(L)))return!1;if(Ht&&!y[L]){const fe=_(f)||f.parentNode,Re=E(f)||f.childNodes;if(Re&&fe){const Ee=Re.length;for(let Pe=Ee-1;Pe>=0;--Pe){const Qe=v(Re[Pe],!0);Qe.__removalCount=(f.__removalCount||0)+1,fe.insertBefore(Qe,z(f))}}}return Ve(f),!0}return f instanceof c&&!dl(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&Me(/<\/no(script|embed|frames)/i,f.innerHTML)?(Ve(f),!0):(j&&f.nodeType===Ft.text&&(x=f.textContent,$t([W,V,Q],fe=>{x=Dt(x,fe," ")}),f.textContent!==x&&(Ot(e.removed,{element:f.cloneNode()}),f.textContent=x)),nt(C.afterSanitizeElements,f,null),!1)},ai=function(f,x,L){if(sn&&(x==="id"||x==="name")&&(L in t||L in pl))return!1;if(!(N&&!Ae[x]&&Me(ae,x))){if(!(et&&Me(ge,x))){if(!re[x]||Ae[x]){if(!(ci(f)&&(te.tagNameCheck instanceof RegExp&&Me(te.tagNameCheck,f)||te.tagNameCheck instanceof Function&&te.tagNameCheck(f))&&(te.attributeNameCheck instanceof RegExp&&Me(te.attributeNameCheck,x)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(x))||x==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&Me(te.tagNameCheck,L)||te.tagNameCheck instanceof Function&&te.tagNameCheck(L))))return!1}else if(!pe[x]){if(!Me(Xe,Dt(L,Ge,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&f!=="script"&&To(L,"data:")===0&&$[f])){if(!(ie&&!Me(he,Dt(L,Ge,"")))){if(L)return!1}}}}}}return!0},ci=function(f){return f!=="annotation-xml"&&vs(f,ce)},ui=function(f){nt(C.beforeSanitizeAttributes,f,null);const{attributes:x}=f;if(!x||Wn(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:re,forceKeepAttr:void 0};let fe=x.length;for(;fe--;){const Re=x[fe],{name:Ee,namespaceURI:Pe,value:Qe}=Re,Ut=Te(Ee);let ze=Ee==="value"?Qe:vo(Qe);if(L.attrName=Ut,L.attrValue=ze,L.keepAttr=!0,L.forceKeepAttr=void 0,nt(C.uponSanitizeAttribute,f,L),ze=L.attrValue,on&&(Ut==="id"||Ut==="name")&&(an(Ee,f),ze=Hn+ze),we&&Me(/((--!?|])>)|<\/(style|title)/i,ze)){an(Ee,f);continue}if(L.forceKeepAttr||(an(Ee,f),!L.keepAttr))continue;if(!O&&Me(/\/>/i,ze)){an(Ee,f);continue}j&&$t([W,V,Q],hi=>{ze=Dt(ze,hi," ")});const fi=Te(f.nodeName);if(ai(fi,Ut,ze)){if(k&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Pe)switch(g.getAttributeType(fi,Ut)){case"TrustedHTML":{ze=k.createHTML(ze);break}case"TrustedScriptURL":{ze=k.createScriptURL(ze);break}}try{Pe?f.setAttributeNS(Pe,Ee,ze):f.setAttribute(Ee,ze),Wn(f)?Ve(f):Ts(e.removed)}catch(hi){}}}nt(C.afterSanitizeAttributes,f,null)},gl=function P(f){let x=null;const L=oi(f);for(nt(C.beforeSanitizeShadowDOM,f,null);x=L.nextNode();)nt(C.uponSanitizeShadowNode,x,null),ri(x),ui(x),x.content instanceof o&&P(x.content);nt(C.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(P){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,L=null,fe=null,Re=null;if(Bn=!P,Bn&&(P="<!-->"),typeof P!="string"&&!li(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw Nt("dirty is not a string, aborting")}else throw Nt("toString is not a function");if(!e.isSupported)return P;if(Ne||jn(f),e.removed=[],typeof P=="string"&&(ut=!1),ut){if(P.nodeName){const Qe=Te(P.nodeName);if(!ue[Qe]||De[Qe])throw Nt("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof a)x=ii("<!---->"),L=x.ownerDocument.importNode(P,!0),L.nodeType===Ft.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?x=L:x.appendChild(L);else{if(!st&&!j&&!ke&&P.indexOf("<")===-1)return k&&Tt?k.createHTML(P):P;if(x=ii(P),!x)return st?null:Tt?T:""}x&&Be&&Ve(x.firstChild);const Ee=oi(ut?P:x);for(;fe=Ee.nextNode();)ri(fe),ui(fe),fe.content instanceof o&&gl(fe.content);if(ut)return P;if(st){if(yt)for(Re=M.call(x.ownerDocument);x.firstChild;)Re.appendChild(x.firstChild);else Re=x;return(re.shadowroot||re.shadowrootmode)&&(Re=F.call(n,Re,!0)),Re}let Pe=ke?x.outerHTML:x.innerHTML;return ke&&ue["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Me(Rs,x.ownerDocument.doctype.name)&&(Pe="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
47
|
-
`+Pe),j&&$t([W,V,Q],Qe=>{Pe=Dt(Pe,Qe," ")}),k&&Tt?k.createHTML(Pe):Pe},e.setConfig=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jn(P),Ne=!0},e.clearConfig=function(){Et=null,Ne=!1},e.isValidAttribute=function(P,f,x){Et||jn({});const L=Te(P),fe=Te(f);return ai(L,fe,x)},e.addHook=function(P,f){typeof f=="function"&&Ot(C[P],f)},e.removeHook=function(P){return Ts(C[P])},e.removeHooks=function(P){C[P]=[]},e.removeAllHooks=function(){C=Ms()},e}var zs=Ls();function Os(s){var n;if(typeof document=="undefined")return null;const t=`; ${document.cookie}`.split(`; ${s}=`);return t.length===2&&((n=t.pop())==null?void 0:n.split(";").shift())||null}const be=()=>{if(typeof window=="undefined")return null;const s=Os("access_token");if(s)return s;const e=Os("auth_token");if(e)return e;const t=sessionStorage.getItem("vuex");if(t)try{const n=JSON.parse(t);if(n!=null&&n.token)return n.token}catch(n){console.error("Failed to parse vuex data:",n)}return null};function Ds(s,e,t){const n=s.slice();return n[24]=e[t],n}function Ns(s){let e,t=s[9].text+"",n;return{c(){e=A("div"),n=Se(t),r(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),D(e,"left",s[9].x+"px"),D(e,"top",s[9].y+"px"),D(e,"z-index",s[3]+3)},m(i,o){Y(i,e,o),m(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&Ue(n,t),o&512&&D(e,"left",i[9].x+"px"),o&512&&D(e,"top",i[9].y+"px"),o&8&&D(e,"z-index",i[3]+3)},d(i){i&&q(e)}}}function Fo(s){let e=[],t=new Map,n,i,o=_t(s[0]);const l=c=>c[24].sessionId;for(let c=0;c<o.length;c+=1){let u=Ds(s,o,c),h=l(u);t.set(h,e[c]=Ps(h,u))}let a=s[5]&&Fs();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=G(),a&&a.c(),i=Wt()},m(c,u){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(c,u);Y(c,n,u),a&&a.m(c,u),Y(c,i,u)},p(c,u){u&8261&&(o=_t(c[0]),e=es(e,u,l,1,c,o,t,n.parentNode,$n,Ps,n,Ds)),c[5]?a||(a=Fs(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},d(c){c&&(q(n),q(i));for(let u=0;u<e.length;u+=1)e[u].d(c);a&&a.d(c)}}}function Ho(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=A("div"),n=Se(t),r(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){Y(i,e,o),m(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Ue(n,t)},d(i){i&&q(e)}}}function Ps(s,e){let t,n,i,o,l=e[24].title+"",a,c,u,h=Bs(e[24].timestamp)+"",p,d,g,w,v,I,z,E,_,k,T;function S(){return e[17](e[24])}function b(...M){return e[18](e[24],...M)}return{key:s,first:null,c(){t=A("div"),n=A("button"),i=A("div"),o=A("div"),a=Se(l),c=G(),u=A("div"),p=Se(h),d=G(),g=A("button"),w=X("svg"),v=X("path"),I=X("path"),z=X("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(v,"d","M3 6h18"),r(I,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),r(z,"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(g,"class","sy-session-delete svelte-1g6fj9a"),g.disabled=E=e[6]===e[24].sessionId,r(g,"aria-label","删除会话"),r(t,"class","sy-session-item svelte-1g6fj9a"),r(t,"data-session-id",_=e[24].sessionId),J(t,"deleting",e[24].deleting),this.first=t},m(M,R){Y(M,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,d),m(t,g),m(g,w),m(w,v),m(w,I),m(w,z),k||(T=[U(n,"click",S),U(g,"click",b)],k=!0)},p(M,R){e=M,R&1&&l!==(l=e[24].title+"")&&Ue(a,l),R&1&&h!==(h=Bs(e[24].timestamp)+"")&&Ue(p,h),R&65&&E!==(E=e[6]===e[24].sessionId)&&(g.disabled=E),R&1&&_!==(_=e[24].sessionId)&&r(t,"data-session-id",_),R&1&&J(t,"deleting",e[24].deleting)},d(M){M&&q(t),k=!1,me(T)}}}function Fs(s){let e;return{c(){e=A("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){Y(t,e,n)},d(t){t&&q(e)}}}function Hs(s){let e,t,n,i,o,l,a,c,u;return{c(){e=A("div"),t=A("div"),t.textContent="确认删除此会话?",n=G(),i=A("div"),o=A("button"),o.textContent="取消",l=G(),a=A("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"),D(e,"left",s[8].x+"px"),D(e,"top",s[8].y+"px"),D(e,"z-index",s[3]+3)},m(h,p){Y(h,e,p),m(e,t),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[U(o,"click",s[19]),U(a,"click",s[14])],c=!0)},p(h,p){p&256&&D(e,"left",h[8].x+"px"),p&256&&D(e,"top",h[8].y+"px"),p&8&&D(e,"z-index",h[3]+3)},d(h){h&&q(e),c=!1,me(u)}}}function Bo(s){let e,t,n,i,o,l,a,c,u,h,p,d,g,w,v,I,z,E,_,k=s[9]&&Ns(s);function T(R,F){return R[0].length===0?Ho:Fo}let S=T(s),b=S(s),M=s[7]&&Hs(s);return{c(){e=A("div"),t=A("div"),n=A("h2"),n.textContent="历史会话",i=G(),o=A("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=A("div"),c=A("input"),u=G(),h=X("svg"),p=X("circle"),d=X("line"),g=G(),k&&k.c(),w=G(),v=A("div"),b.c(),I=G(),M&&M.c(),z=Wt(),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(d,"x1","21"),r(d,"y1","21"),r(d,"x2","16.65"),r(d,"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(v,"class","sy-session-list svelte-1g6fj9a"),r(e,"class","sy-session-history svelte-1g6fj9a"),D(e,"z-index",s[3]+2)},m(R,F){Y(R,e,F),m(e,t),m(t,n),m(t,i),m(t,o),m(e,l),m(e,a),m(a,c),dt(c,s[4]),m(a,u),m(a,h),m(h,p),m(h,d),m(e,g),k&&k.m(e,null),m(e,w),m(e,v),b.m(v,null),Y(R,I,F),M&&M.m(R,F),Y(R,z,F),E||(_=[U(o,"click",function(){xt(s[1])&&s[1].apply(this,arguments)}),U(o,"mouseenter",s[15]),U(o,"mouseleave",s[12]),U(c,"input",s[16]),U(v,"scroll",s[10])],E=!0)},p(R,[F]){s=R,F&16&&c.value!==s[4]&&dt(c,s[4]),s[9]?k?k.p(s,F):(k=Ns(s),k.c(),k.m(e,w)):k&&(k.d(1),k=null),S===(S=T(s))&&b?b.p(s,F):(b.d(1),b=S(s),b&&(b.c(),b.m(v,null))),F&8&&D(e,"z-index",s[3]+2),s[7]?M?M.p(s,F):(M=Hs(s),M.c(),M.m(z.parentNode,z)):M&&(M.d(1),M=null)},i:B,o:B,d(R){R&&(q(e),q(I),q(z)),k&&k.d(),b.d(),M&&M.d(R),E=!1,me(_)}}}const Nn=10;function Bs(s){return new Date(s).toLocaleString()}function Uo(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,d=null,g={x:0,y:0};function w(){return Oe(this,null,function*(){if(!(a||!c)){t(5,a=!0);try{const C=yield fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({start:u,length:Nn,keyword:h})});if(!C.ok)throw new Error("Failed to load sessions");const W=yield C.json();if(W.code===0){const V=W.data.sessionList.map(Q=>({sessionId:Q.sessionId,title:Q.name,timestamp:new Date(Q.createDate).getTime()}));t(0,n=[...n,...V]),u+=Nn,c=V.length===Nn}}catch(C){console.error("Failed to load sessions:",C)}finally{t(5,a=!1)}}})}function v(C){const W=C.target,{scrollTop:V,scrollHeight:Q,clientHeight:ae}=W;Q-V-ae<50&&w()}Qn(()=>{w()});let I=null;function z(C,W){const Q=C.currentTarget.getBoundingClientRect();t(9,I={text:W,x:Q.left+Q.width/2,y:Q.bottom+8})}function E(){t(9,I=null)}function _(C,W){const Q=C.currentTarget.getBoundingClientRect();t(8,g={x:Q.left-16,y:Q.top+Q.height/2}),t(7,d=W)}function k(C){return Oe(this,null,function*(){if(C&&!p)try{t(6,p=C),t(7,d=null);const W=document.querySelector(`[data-session-id="${C}"]`);W&&W.classList.add("deleting"),yield new Promise(ae=>setTimeout(ae,300));const V=yield fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:C})});if(!V.ok)throw new Error("Delete request failed");const Q=yield V.json();if(Q.code===0&&Q.data.respCode===0)t(0,n=n.map(ae=>xe(se({},ae),{deleting:ae.sessionId===C}))),setTimeout(()=>{t(0,n=n.filter(ae=>!ae.deleting))},300);else throw new Error("Delete failed: "+Q.message)}catch(W){console.error("Failed to delete session:",W);const V=document.querySelector(`[data-session-id="${C}"]`);V&&V.classList.remove("deleting")}finally{t(6,p=null)}})}function T(){d&&k(d)}const S=C=>z(C,"关闭历史会话");function b(){h=this.value,t(4,h)}const M=C=>o(C.sessionId),R=(C,W)=>_(W,C.sessionId),F=()=>t(7,d=null);return s.$$set=C=>{"sessions"in C&&t(0,n=C.sessions),"onClose"in C&&t(1,i=C.onClose),"onSelect"in C&&t(2,o=C.onSelect),"zIndex"in C&&t(3,l=C.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&h!==void 0&&(t(0,n=[]),u=0,c=!0,w())},[n,i,o,l,h,a,p,d,g,I,v,z,E,_,T,S,b,M,R,F]}class Us extends kn{constructor(e){super(),wn(this,e,Uo,Bo,ft,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function js(s,e,t){const n=s.slice();return n[60]=e[t],n[61]=e,n[62]=t,n}function Ws(s,e,t){const n=s.slice();return n[63]=e[t],n[65]=t,n}function jo(s){let e,t=[],n=new Map,i=_t(s[3]);const o=l=>l[60].id;for(let l=0;l<i.length;l+=1){let a=js(s,i,l),c=o(a);n.set(c,t[l]=Qs(c,a))}return{c(){e=A("div");for(let l=0;l<t.length;l+=1)t[l].c();r(e,"class","sy-assistant-message-list svelte-ivxw7h")},m(l,a){Y(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[47](e)},p(l,a){a[0]&268058361&&(i=_t(l[3]),t=es(t,a,o,1,l,i,n,e,$n,Qs,null,js))},i:B,o:B,d(l){l&&q(e);for(let a=0;a<t.length;a+=1)t[a].d();s[47](null)}}}function Wo(s){let e,t;return e=new Us({props:{sessions:s[28],onClose:s[30],onSelect:s[31],zIndex:s[0]}}),{c(){mn(e.$$.fragment)},m(n,i){Gt(e,n,i),t=!0},p(n,i){const o={};i[0]&1&&(o.zIndex=n[0]),e.$set(o)},i(n){t||(je(e.$$.fragment,n),t=!0)},o(n){Ke(e.$$.fragment,n),t=!1},d(n){Yt(e,n)}}}function qo(s){let e;return{c(){e=A("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-ivxw7h")},m(t,n){Y(t,e,n)},d(t){t&&q(e)}}}function Go(s){let e;return{c(){e=A("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-ivxw7h")},m(t,n){Y(t,e,n)},d(t){t&&q(e)}}}function Yo(s){let e,t=s[17](s[60].content)+"";return{c(){e=A("div"),r(e,"class","markdown-content svelte-ivxw7h")},m(n,i){Y(n,e,i),e.innerHTML=t},p(n,i){i[0]&8&&t!==(t=n[17](n[60].content)+"")&&(e.innerHTML=t)},d(n){n&&q(e)}}}function Zo(s){let e;return{c(){e=A("span"),e.innerHTML='<span class="dot svelte-ivxw7h">.</span> <span class="dot svelte-ivxw7h">.</span> <span class="dot svelte-ivxw7h">.</span>',r(e,"class","sy-assistant-loading svelte-ivxw7h")},m(t,n){Y(t,e,n)},p:B,d(t){t&&q(e)}}}function qs(s){let e,t=_t(s[60].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=Zs(Ws(s,t,i));return{c(){e=A("div");for(let i=0;i<n.length;i+=1)n[i].c();r(e,"class","sy-assistant-attachments svelte-ivxw7h")},m(i,o){Y(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]&3670137){t=_t(i[60].attachments);let l;for(l=0;l<t.length;l+=1){const a=Ws(i,t,l);n[l]?n[l].p(a,o):(n[l]=Zs(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&&q(e),ki(n,i)}}}function Gs(s){let e,t,n;function i(...o){return s[34](s[63],...o)}return{c(){e=A("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-ivxw7h"><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-ivxw7h"),r(e,"aria-label","查看详情")},m(o,l){Y(o,e,l),t||(n=[U(e,"mouseenter",i),U(e,"mouseleave",s[20])],t=!0)},p(o,l){s=o},d(o){o&&q(e),t=!1,me(n)}}}function Ys(s){let e,t=s[4].replace(/\n/g,"<br>")+"",n,i;return{c(){e=A("div"),r(e,"class","sy-assistant-tooltip svelte-ivxw7h"),r(e,"role","tooltip"),D(e,"left",s[5].x+"px"),D(e,"top",s[5].y+"px"),D(e,"z-index",s[0]+3),J(e,"align-right",s[5].alignRight)},m(o,l){Y(o,e,l),e.innerHTML=t,n||(i=[U(e,"mouseenter",s[36]),U(e,"mouseleave",s[37])],n=!0)},p(o,l){l[0]&16&&t!==(t=o[4].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&32&&D(e,"left",o[5].x+"px"),l[0]&32&&D(e,"top",o[5].y+"px"),l[0]&1&&D(e,"z-index",o[0]+3),l[0]&32&&J(e,"align-right",o[5].alignRight)},d(o){o&&q(e),n=!1,me(i)}}}function Zs(s){let e,t,n,i,o,l,a,c,u,h=nn(s[63].content_title).name+"",p,d,g,w=nn(s[63].content_title).ext+"",v,I,z,E,_,k,T,S,b,M,R=s[63].tips&&Gs(s);function F(){return s[35](s[63])}let C=s[4]&&Ys(s);return{c(){e=A("div"),t=A("div"),n=A("div"),i=X("svg"),o=X("path"),l=X("polyline"),a=G(),c=A("div"),u=A("span"),p=Se(h),d=G(),g=A("span"),v=Se(w),z=G(),E=A("div"),R&&R.c(),_=G(),k=A("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-ivxw7h"><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>',T=G(),C&&C.c(),S=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-ivxw7h"),r(g,"class","sy-assistant-attachment-ext svelte-ivxw7h"),r(c,"class","sy-assistant-attachment-name svelte-ivxw7h"),r(c,"title",I=s[63].content_title),r(n,"class","sy-assistant-attachment-title svelte-ivxw7h"),r(k,"class","sy-assistant-attachment-toggle svelte-ivxw7h"),r(k,"aria-label","下载文件"),r(E,"class","sy-assistant-attachment-actions svelte-ivxw7h"),r(t,"class","sy-assistant-attachment-header svelte-ivxw7h"),r(e,"class","sy-assistant-attachment svelte-ivxw7h")},m(W,V){Y(W,e,V),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,d),m(c,g),m(g,v),m(t,z),m(t,E),R&&R.m(E,null),m(E,_),m(E,k),m(e,T),C&&C.m(e,null),m(e,S),b||(M=U(k,"click",F),b=!0)},p(W,V){s=W,V[0]&8&&h!==(h=nn(s[63].content_title).name+"")&&Ue(p,h),V[0]&8&&w!==(w=nn(s[63].content_title).ext+"")&&Ue(v,w),V[0]&8&&I!==(I=s[63].content_title)&&r(c,"title",I),s[63].tips?R?R.p(s,V):(R=Gs(s),R.c(),R.m(E,_)):R&&(R.d(1),R=null),s[4]?C?C.p(s,V):(C=Ys(s),C.c(),C.m(e,S)):C&&(C.d(1),C=null)},d(W){W&&q(e),R&&R.d(),C&&C.d(),b=!1,M()}}}function Xs(s){let e,t,n,i,o,l,a,c,u,h,p;function d(S,b){return S[9][S[60].id]?Vo:Xo}let g=d(s),w=g(s);function v(){return s[38](s[60])}function I(...S){return s[39](s[60],...S)}function z(){return s[40](s[60])}function E(...S){return s[41](s[60],...S)}function _(...S){return s[42](s[60],...S)}function k(...S){return s[43](s[60],...S)}let T=s[12]&&s[10][s[60].id]==="dislike"&&Vs(s);return{c(){e=A("div"),t=A("button"),w.c(),i=G(),o=A("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=A("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(),T&&T.c(),u=Wt(),r(t,"class","sy-assistant-action-button svelte-ivxw7h"),r(t,"aria-label",n=s[9][s[60].id]?"已复制":"复制内容"),J(t,"copied",s[9][s[60].id]),r(o,"class","sy-assistant-action-button svelte-ivxw7h"),r(o,"aria-label","点赞"),J(o,"active",s[10][s[60].id]==="like"),r(a,"class","sy-assistant-action-button svelte-ivxw7h"),r(a,"aria-label","点踩"),J(a,"active",s[10][s[60].id]==="dislike"),r(e,"class","sy-assistant-message-actions svelte-ivxw7h")},m(S,b){Y(S,e,b),m(e,t),w.m(t,null),m(e,i),m(e,o),m(e,l),m(e,a),Y(S,c,b),T&&T.m(S,b),Y(S,u,b),h||(p=[U(t,"click",v),U(t,"mouseenter",I),U(t,"mouseleave",s[27]),U(o,"click",z),U(o,"mouseenter",E),U(o,"mouseleave",s[27]),U(a,"click",_),U(a,"mouseenter",k),U(a,"mouseleave",s[27])],h=!0)},p(S,b){s=S,g!==(g=d(s))&&(w.d(1),w=g(s),w&&(w.c(),w.m(t,null))),b[0]&520&&n!==(n=s[9][s[60].id]?"已复制":"复制内容")&&r(t,"aria-label",n),b[0]&520&&J(t,"copied",s[9][s[60].id]),b[0]&1032&&J(o,"active",s[10][s[60].id]==="like"),b[0]&1032&&J(a,"active",s[10][s[60].id]==="dislike"),s[12]&&s[10][s[60].id]==="dislike"?T?T.p(s,b):(T=Vs(s),T.c(),T.m(u.parentNode,u)):T&&(T.d(1),T=null)},d(S){S&&(q(e),q(c),q(u)),w.d(),T&&T.d(S),h=!1,me(p)}}}function Xo(s){let e,t,n;return{c(){e=X("svg"),t=X("rect"),n=X("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){Y(i,e,o),m(e,t),m(e,n)},d(i){i&&q(e)}}}function Vo(s){let e,t;return{c(){e=X("svg"),t=X("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){Y(n,e,i),m(e,t)},d(n){n&&q(e)}}}function Vs(s){let e,t,n,i,o,l,a,c,u,h,p;function d(){s[44].call(i,s[60])}function g(){return s[45](s[60])}function w(){return s[46](s[60])}return{c(){e=A("div"),t=A("div"),t.textContent="反馈意见",n=G(),i=A("textarea"),o=G(),l=A("div"),a=A("button"),a.textContent="取消",c=G(),u=A("button"),u.textContent="提交",r(t,"class","sy-assistant-dislike-title svelte-ivxw7h"),r(i,"class","sy-assistant-dislike-input svelte-ivxw7h"),r(i,"placeholder","请输入您的反馈意见..."),r(a,"class","sy-assistant-popup-cancel svelte-ivxw7h"),r(u,"class","sy-assistant-popup-submit svelte-ivxw7h"),r(l,"class","sy-assistant-popup-actions svelte-ivxw7h"),r(e,"class","sy-assistant-dislike-popup svelte-ivxw7h"),D(e,"left",s[13].x+"px"),D(e,"top",s[13].y+"px"),D(e,"z-index",s[0]+3)},m(v,I){Y(v,e,I),m(e,t),m(e,n),m(e,i),dt(i,s[11][s[60].id]),m(e,o),m(e,l),m(l,a),m(l,c),m(l,u),h||(p=[U(i,"input",d),U(a,"click",g),U(u,"click",w)],h=!0)},p(v,I){s=v,I[0]&2056&&dt(i,s[11][s[60].id]),I[0]&8192&&D(e,"left",s[13].x+"px"),I[0]&8192&&D(e,"top",s[13].y+"px"),I[0]&1&&D(e,"z-index",s[0]+3)},d(v){v&&q(e),h=!1,me(p)}}}function Qs(s,e){let t,n,i,o,l,a,c,u,h=new Date(e[60].timestamp).toLocaleString()+"",p,d;function g(T,S){return T[60].type==="assistant"?Go:qo}let w=g(e),v=w(e);function I(T,S){return T[7]&&T[60].id===T[3][T[3].length-1].id&&T[60].type==="assistant"&&!T[60].content?Zo:Yo}let z=I(e),E=z(e),_=e[60].attachments&&qs(e),k=e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]&&Xs(e);return{key:s,first:null,c(){t=A("div"),v.c(),n=G(),i=A("div"),o=A("div"),E.c(),l=G(),_&&_.c(),a=G(),k&&k.c(),c=G(),u=A("div"),p=Se(h),d=G(),r(o,"class","sy-assistant-message-content svelte-ivxw7h"),r(u,"class","sy-assistant-message-time svelte-ivxw7h"),r(i,"class","sy-assistant-message-bubble svelte-ivxw7h"),r(t,"class","sy-assistant-message svelte-ivxw7h"),J(t,"user",e[60].type==="user"),this.first=t},m(T,S){Y(T,t,S),v.m(t,null),m(t,n),m(t,i),m(i,o),E.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,d)},p(T,S){e=T,w!==(w=g(e))&&(v.d(1),v=w(e),v&&(v.c(),v.m(t,n))),z===(z=I(e))&&E?E.p(e,S):(E.d(1),E=z(e),E&&(E.c(),E.m(o,l))),e[60].attachments?_?_.p(e,S):(_=qs(e),_.c(),_.m(o,a)):_&&(_.d(1),_=null),e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]?k?k.p(e,S):(k=Xs(e),k.c(),k.m(o,null)):k&&(k.d(1),k=null),S[0]&8&&h!==(h=new Date(e[60].timestamp).toLocaleString()+"")&&Ue(p,h),S[0]&8&&J(t,"user",e[60].type==="user")},d(T){T&&q(t),v.d(),E.d(),_&&_.d(),k&&k.d()}}}function Js(s){let e,t,n,i,o,l,a,c,u,h,p,d,g,w,v,I,z,E,_,k,T,S,b,M;return{c(){e=A("div"),t=A("div"),n=A("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=A("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=A("div"),c=A("div"),u=A("div"),h=A("div"),p=A("textarea"),d=G(),g=A("div"),w=Se(s[2]),v=Se("/"),I=Se(Pn),z=G(),E=A("button"),_=X("svg"),k=X("line"),T=X("polygon"),r(n,"class","sy-assistant-icon-button svelte-ivxw7h"),r(n,"aria-label","历史会话"),r(o,"class","sy-assistant-icon-button svelte-ivxw7h"),r(o,"aria-label","新建会话"),r(t,"class","sy-assistant-chat-actions svelte-ivxw7h"),r(e,"class","sy-assistant-chat-footer svelte-ivxw7h"),r(p,"class","sy-assistant-textarea svelte-ivxw7h"),r(p,"placeholder","输入您的问题..."),r(p,"maxlength",Pn),r(p,"rows","3"),r(g,"class","sy-assistant-char-count svelte-ivxw7h"),J(g,"over-limit",s[16]),r(h,"class","sy-assistant-textarea-container svelte-ivxw7h"),r(u,"class","sy-assistant-input-wrapper svelte-ivxw7h"),r(k,"x1","22"),r(k,"y1","2"),r(k,"x2","11"),r(k,"y2","13"),r(T,"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(E,"class","sy-assistant-send-button svelte-ivxw7h"),E.disabled=S=!s[1].trim()||s[16],r(E,"aria-label","发送消息"),r(c,"class","sy-assistant-input-container svelte-ivxw7h"),r(a,"class","sy-assistant-input-area svelte-ivxw7h")},m(R,F){Y(R,e,F),m(e,t),m(t,n),m(t,i),m(t,o),Y(R,l,F),Y(R,a,F),m(a,c),m(c,u),m(u,h),m(h,p),dt(p,s[1]),m(h,d),m(h,g),m(g,w),m(g,v),m(g,I),m(c,z),m(c,E),m(E,_),m(_,k),m(_,T),b||(M=[U(n,"click",s[29]),U(n,"mouseenter",s[48]),U(n,"mouseleave",s[27]),U(n,"blur",s[27]),U(o,"click",s[32]),U(o,"mouseenter",s[49]),U(o,"mouseleave",s[27]),U(p,"input",s[50]),U(p,"keydown",s[51]),U(E,"click",s[18]),U(E,"mouseenter",s[52]),U(E,"mouseleave",s[27])],b=!0)},p(R,F){F[0]&2&&dt(p,R[1]),F[0]&4&&Ue(w,R[2]),F[0]&65536&&J(g,"over-limit",R[16]),F[0]&65538&&S!==(S=!R[1].trim()||R[16])&&(E.disabled=S)},d(R){R&&(q(e),q(l),q(a)),b=!1,me(M)}}}function Ks(s){let e,t=s[14].text+"",n;return{c(){e=A("div"),n=Se(t),r(e,"class","sy-assistant-button-tooltip svelte-ivxw7h"),D(e,"left",s[14].x+"px"),D(e,"top",s[14].y+"px")},m(i,o){Y(i,e,o),m(e,n)},p(i,o){o[0]&16384&&t!==(t=i[14].text+"")&&Ue(n,t),o[0]&16384&&D(e,"left",i[14].x+"px"),o[0]&16384&&D(e,"top",i[14].y+"px")},d(i){i&&q(e)}}}function Qo(s){let e,t,n,i,o,l,a;const c=[Wo,jo],u=[];function h(g,w){return g[15]?0:1}t=h(s),n=u[t]=c[t](s);let p=!s[15]&&Js(s),d=s[14]&&Ks(s);return{c(){e=A("div"),n.c(),i=G(),p&&p.c(),o=G(),d&&d.c(),l=Wt(),r(e,"class","sy-assistant-chat-container svelte-ivxw7h"),D(e,"z-index",s[0]+2)},m(g,w){Y(g,e,w),u[t].m(e,null),m(e,i),p&&p.m(e,null),s[53](e),Y(g,o,w),d&&d.m(g,w),Y(g,l,w),a=!0},p(g,w){let v=t;t=h(g),t===v?u[t].p(g,w):(dn(),Ke(u[v],1,1,()=>{u[v]=null}),gn(),n=u[t],n?n.p(g,w):(n=u[t]=c[t](g),n.c()),je(n,1),n.m(e,i)),g[15]?p&&(p.d(1),p=null):p?p.p(g,w):(p=Js(g),p.c(),p.m(e,null)),(!a||w[0]&1)&&D(e,"z-index",g[0]+2),g[14]?d?d.p(g,w):(d=Ks(g),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i(g){a||(je(n),a=!0)},o(g){Ke(n),a=!1},d(g){g&&(q(e),q(o),q(l)),u[t].d(),p&&p.d(),s[53](null),d&&d.d(g)}}}let Pn=500;function Jo(s){const e=s.match(/source#\[(.*)\]#source/);return e?s.replace(`source#[${e[1]}]#source`,""):s}function $s(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 nn(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}function Ko(s,e,t){let n,i,o="",l=[{sessionId:"",requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],a="",c=null,u=null,h={x:0,y:0,alignRight:!1},p=null,d=!1;ee.setOptions({breaks:!0,gfm:!0});function g(y){try{const H=ee(y);return zs.sanitize(H)}catch(H){console.warn("Markdown parsing failed, fallback to HTML:",H);try{const $=y.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return zs.sanitize($)}catch($){return console.error("HTML fallback failed:",$),y}}}let w;function v(y=!1){w&&w.scrollTo({top:w.scrollHeight,behavior:y?"smooth":"auto"})}bi(()=>{v(!1)});let{sessionId:I}=e;function z(){return Oe(this,null,function*(){if(!o.trim()||i)return;if(!I){console.error("No session ID available");return}const y=Date.now().toString(),H=Date.now().toString()+Math.random().toString().slice(2,8),$={sessionId:I,requestId:H,id:y,type:"user",content:o.trim(),timestamp:Date.now()};t(3,l=[...l,$]);const _e=o.trim();t(1,o="");const pe=(Date.now()+1).toString();a="",t(3,l=[...l,{sessionId:I,requestId:H,id:pe,type:"assistant",content:"",timestamp:Date.now()}]),t(7,d=!0),c&&c.abort(),c=new AbortController;try{yield Ni("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:I,requestId:H,keyword:_e,flowId:"1"}),signal:c.signal,onmessage(Ie){try{const ye=Ie.data;if(ye){const tt=$s(ye);tt?(t(3,l=l.map(ve=>ve.id===pe?xe(se({},ve),{attachments:tt}):ve)),v(!0)):(a+=ye,t(3,l=l.map(ve=>ve.id===pe?xe(se({},ve),{content:a}):ve)),v(!1))}}catch(ye){console.error("Failed to process SSE message:",ye)}},onerror(Ie){console.error("SSE error:",Ie),c=null,t(7,d=!1)},onclose(){c=null,t(7,d=!1)}})}catch(Ie){console.error("Failed to send message:",Ie),t(7,d=!1)}})}function E(y,H,$){const _e=$.getBoundingClientRect(),pe=w.getBoundingClientRect(),Ie=_e.left<pe.width/2;t(4,u=H),t(5,h={x:_e.left,y:_e.top+_e.height/2,alignRight:Ie})}function _(){t(6,p=setTimeout(()=>{t(4,u=null),t(6,p=null)},200))}yi(()=>{c&&c.abort(),p&&clearTimeout(p)});function k(y,H){return Oe(this,null,function*(){try{const $=yield fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({fileName:y,fileUrl:H})});if(!$.ok)throw new Error("Download failed");const _e=$.headers.get("content-type")||"application/octet-stream",pe=yield $.blob(),Ie=window.URL.createObjectURL(pe),ye=document.createElement("a");ye.href=Ie,ye.download=y,document.body.appendChild(ye),ye.click(),window.URL.revokeObjectURL(Ie),document.body.removeChild(ye)}catch($){console.error("Failed to download file:",$)}})}let T={};function S(y,H){return Oe(this,null,function*(){try{const $=H.replace(/<br\s*\/?>/g,`
|
48
|
-
`).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();yield navigator.clipboard.writeText($),t(9,T[y]=!0,T),setTimeout(()=>{t(9,T[y]=!1,T),t(9,T)},1500)}catch($){console.error("Failed to copy:",$)}})}let b={},M={},R=!1;function F(y,H){return Oe(this,null,function*(){if(b[y]===H){t(10,b[y]=null,b),t(10,b);return}if(t(10,b[y]=H,b),t(10,b),H==="like")try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:I,requestId:y,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch($){console.error("Failed to send feedback:",$),t(10,b[y]=null,b),t(10,b)}else t(12,R=!0)})}function C(y){return Oe(this,null,function*(){var H;if((H=M[y])!=null&&H.trim())try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:I,requestId:y,feedBackFlag:"0",feedBackContent:M[y]})})).ok)throw new Error("Feedback failed");t(12,R=!1),t(11,M[y]="",M),t(11,M)}catch($){console.error("Failed to send feedback:",$),t(10,b[y]=null,b),t(10,b)}})}let W={x:0,y:0};function V(y,H){const _e=y.currentTarget.getBoundingClientRect();t(13,W={x:_e.left-290,y:_e.top-160}),F(H,"dislike")}let Q=null;function ae(y,H){const _e=y.currentTarget.getBoundingClientRect();t(14,Q={text:H,x:_e.left+_e.width/2,y:_e.top-8})}function ge(){t(14,Q=null)}let he=!1,Ge=[],ce=Date.now().toString();function Xe(){ge(),t(15,he=!0)}function ue(){ge(),t(15,he=!1)}function $e(y){return Oe(this,null,function*(){if(!d){t(7,d=!0);try{const H=yield fetch("/aiops/aigc/chat/record/session/detail/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:y})});if(!H.ok)throw new Error("Failed to load sessions");const $=yield H.json();if($.code===0){ce=y,t(15,he=!1);const _e=$.data.map((pe,Ie)=>{const ye=$s(pe.answer),tt=Jo(pe.answer);return[{sessionId:pe.sessionId,requestId:pe.requestId,id:(Date.now()+2*Ie).toString(),type:"user",content:pe.keyword,timestamp:new Date(pe.createDate).getTime()},{sessionId:pe.sessionId,requestId:pe.requestId,id:(Date.now()+2*Ie+1).toString(),type:"assistant",content:tt,attachments:ye,timestamp:new Date(pe.createDate).getTime()}]});t(3,l=_e.flat())}}catch(H){console.error("Failed to load sessions:",H)}finally{t(7,d=!1)}}})}function re(){return Oe(this,null,function*(){const y=yield Le();if(!y){console.error("Failed to create new session");return}ce=y,t(3,l=[{sessionId:ce,requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")})}function Le(){return Oe(this,null,function*(){try{const y=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`}});if(!y.ok)throw new Error("Failed to get session ID");const H=yield y.json();if(H.code===0)return ce=H.data.sessionId,ce;throw new Error(H.message||"Failed to get session ID")}catch(y){return console.error("Failed to get session ID:",y),null}})}let{zIndex:te}=e;const De=(y,H)=>E(H,y.tips,H.currentTarget),Ae=y=>k(y.content_title,y.link),et=()=>{p&&(clearTimeout(p),t(6,p=null))},N=()=>{t(4,u=null)},ie=y=>S(y.id,y.content),O=(y,H)=>ae(H,T[y.id]?"已复制":"复制内容"),j=y=>F(y.id,"like"),we=(y,H)=>ae(H,b[y.id]==="like"?"取消点赞":"点赞"),ke=(y,H)=>V(H,y.id),Ne=(y,H)=>ae(H,b[y.id]==="dislike"?"取消点踩":"点踩");function Be(y){M[y.id]=this.value,t(11,M)}const st=y=>{t(12,R=!1),t(10,b[y.id]=null,b),t(10,b)},yt=y=>C(y.id);function Tt(y){mt[y?"unshift":"push"](()=>{w=y,t(8,w)})}const sn=y=>ae(y,"历史会话"),on=y=>ae(y,"新建会话");function Hn(){o=this.value,t(1,o)}const Ht=y=>y.key==="Enter"&&!y.shiftKey&&(z(),y.preventDefault()),ut=y=>ae(y,"发送消息");function it(y){mt[y?"unshift":"push"](()=>{w=y,t(8,w)})}return s.$$set=y=>{"sessionId"in y&&t(33,I=y.sessionId),"zIndex"in y&&t(0,te=y.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(16,i=n>Pn)},[te,o,n,l,u,h,p,d,w,T,b,M,R,W,Q,he,i,g,z,E,_,k,S,F,C,V,ae,ge,Ge,Xe,ue,$e,re,I,De,Ae,et,N,ie,O,j,we,ke,Ne,Be,st,yt,Tt,sn,on,Hn,Ht,ut,it]}class $o extends kn{constructor(e){super(),wn(this,e,Ko,Qo,ft,{sessionId:33,zIndex:0},null,[-1,-1,-1])}}function ei(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,h,p,d,g,w,v=s[2]?"退出全屏":"全屏显示",I,z,E,_,k,T,S,b,M=s[7]?"取消吸附":"吸附到边缘",R,F,C,W,V,Q,ae,ge,he,Ge=`${s[3].height}px`,ce,Xe,ue;function $e(O,j){return O[2]?tl:el}let re=$e(s),Le=re(s);function te(O,j){return O[7]?sl:nl}let De=te(s),Ae=De(s);const et=[ol,il],N=[];function ie(O,j){return O[8]?0:1}return ge=ie(s),he=N[ge]=et[ge](s),{c(){var O,j,we;e=A("div"),t=A("div"),n=A("div"),i=A("h3"),l=Se(o),a=G(),c=A("div"),u=A("div"),h=A("button"),p=X("svg"),Le.c(),g=G(),w=A("span"),I=Se(v),z=G(),E=A("div"),_=A("button"),k=X("svg"),Ae.c(),S=G(),b=A("span"),R=Se(M),F=G(),C=A("div"),W=A("button"),W.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>',V=G(),Q=A("span"),Q.textContent="关闭助手",ae=G(),he.c(),r(i,"class","svelte-1427avp"),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-1427avp"),r(h,"aria-label",d=s[2]?"退出全屏":"全屏显示"),J(h,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1427avp"),D(w,"z-index",((O=s[3].zIndex)!=null?O:1e3)+3),r(u,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),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-1427avp"),r(_,"aria-label",T=s[7]?"取消吸附":"吸附到边缘"),J(_,"active",s[7]),r(b,"class","sy-assistant-tooltip svelte-1427avp"),D(b,"z-index",((j=s[3].zIndex)!=null?j:1e3)+3),r(E,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),r(W,"class","sy-assistant-close-button svelte-1427avp"),r(W,"aria-label","关闭助手"),r(Q,"class","sy-assistant-tooltip svelte-1427avp"),D(Q,"z-index",((we=s[3].zIndex)!=null?we:1e3)+3),r(C,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),r(c,"class","sy-assistant-header-actions svelte-1427avp"),r(n,"class","sy-assistant-drawer-header svelte-1427avp"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),J(n,"dragging",s[6]),J(n,"fullscreen",s[2]),J(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1427avp"),r(e,"class","sy-assistant-drawer svelte-1427avp"),J(e,"fullscreen",s[2]),D(e,"height",Ge)},m(O,j){Y(O,e,j),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),Le.m(p,null),m(u,g),m(u,w),m(w,I),m(c,z),m(c,E),m(E,_),m(_,k),Ae.m(k,null),m(E,S),m(E,b),m(b,R),m(c,F),m(c,C),m(C,W),m(C,V),m(C,Q),m(t,ae),N[ge].m(t,null),ce=!0,Xe||(ue=[U(h,"click",s[16]),U(_,"click",s[18]),U(W,"click",s[15]),U(n,"mousedown",Vn(s[17]))],Xe=!0)},p(O,j){var ke,Ne,Be;(!ce||j[0]&8)&&o!==(o=O[3].title+"")&&Ue(l,o),re!==(re=$e(O))&&(Le.d(1),Le=re(O),Le&&(Le.c(),Le.m(p,null))),(!ce||j[0]&4&&d!==(d=O[2]?"退出全屏":"全屏显示"))&&r(h,"aria-label",d),(!ce||j[0]&4)&&J(h,"active",O[2]),(!ce||j[0]&4)&&v!==(v=O[2]?"退出全屏":"全屏显示")&&Ue(I,v),j[0]&8&&D(w,"z-index",((ke=O[3].zIndex)!=null?ke:1e3)+3),De!==(De=te(O))&&(Ae.d(1),Ae=De(O),Ae&&(Ae.c(),Ae.m(k,null))),(!ce||j[0]&128&&T!==(T=O[7]?"取消吸附":"吸附到边缘"))&&r(_,"aria-label",T),(!ce||j[0]&128)&&J(_,"active",O[7]),(!ce||j[0]&128)&&M!==(M=O[7]?"取消吸附":"吸附到边缘")&&Ue(R,M),j[0]&8&&D(b,"z-index",((Ne=O[3].zIndex)!=null?Ne:1e3)+3),j[0]&8&&D(Q,"z-index",((Be=O[3].zIndex)!=null?Be:1e3)+3),(!ce||j[0]&64)&&J(n,"dragging",O[6]),(!ce||j[0]&4)&&J(n,"fullscreen",O[2]),(!ce||j[0]&128)&&J(n,"snapped",O[7]);let we=ge;ge=ie(O),ge===we?N[ge].p(O,j):(dn(),Ke(N[we],1,1,()=>{N[we]=null}),gn(),he=N[ge],he?he.p(O,j):(he=N[ge]=et[ge](O),he.c()),je(he,1),he.m(t,null)),(!ce||j[0]&4)&&J(e,"fullscreen",O[2]),j[0]&8&&Ge!==(Ge=`${O[3].height}px`)&&D(e,"height",Ge)},i(O){ce||(je(he),ce=!0)},o(O){Ke(he),ce=!1},d(O){O&&q(e),Le.d(),Ae.d(),N[ge].d(),Xe=!1,me(ue)}}}function el(s){let e;return{c(){e=X("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){Y(t,e,n)},d(t){t&&q(e)}}}function tl(s){let e;return{c(){e=X("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){Y(t,e,n)},d(t){t&&q(e)}}}function nl(s){let e,t;return{c(){e=X("rect"),t=X("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){Y(n,e,i),Y(n,t,i)},d(n){n&&(q(e),q(t))}}}function sl(s){let e,t;return{c(){e=X("rect"),t=X("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){Y(n,e,i),Y(n,t,i)},d(n){n&&(q(e),q(t))}}}function il(s){var n;let e,t;return e=new $o({props:{zIndex:(n=s[3].zIndex)!=null?n:1e3,sessionId:s[9]}}),{c(){mn(e.$$.fragment)},m(i,o){Gt(e,i,o),t=!0},p(i,o){var a;const l={};o[0]&8&&(l.zIndex=(a=i[3].zIndex)!=null?a:1e3),o[0]&512&&(l.sessionId=i[9]),e.$set(l)},i(i){t||(je(e.$$.fragment,i),t=!0)},o(i){Ke(e.$$.fragment,i),t=!1},d(i){Yt(e,i)}}}function ol(s){var n;let e,t;return e=new Us({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:(n=s[3].zIndex)!=null?n:1e3}}),{c(){mn(e.$$.fragment)},m(i,o){Gt(e,i,o),t=!0},p(i,o){var a;const l={};o[0]&256&&(l.onClose=i[26]),o[0]&8&&(l.zIndex=(a=i[3].zIndex)!=null?a:1e3),e.$set(l)},i(i){t||(je(e.$$.fragment,i),t=!0)},o(i){Ke(e.$$.fragment,i),t=!1},d(i){Yt(e,i)}}}function ll(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,h,p,d,g,w,v,I,z,E=s[12]>0&&ei(s);return{c(){var _,k;e=A("div"),t=A("div"),E&&E.c(),i=G(),o=A("button"),l=X("svg"),a=X("path"),c=X("path"),u=X("path"),h=X("path"),p=X("path"),d=X("path"),g=X("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1427avp"),J(t,"fullscreen",s[2]),D(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(d,"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(d,"fill","#FFFFFF"),r(g,"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(g,"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-1427avp"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+(((_=s[3].zIndex)!=null?_:1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1427avp"),J(e,"fullscreen",s[2]),J(e,"snapped",s[7]),D(e,"position",s[3].position),D(e,"right",s[7]?0:`${s[0]}px`),D(e,"bottom",s[7]?0:`${s[1]}px`),D(e,"top",s[7]||s[2]?"0":"auto"),D(e,"left",s[2]?"0":"auto"),D(e,"z-index",(k=s[3].zIndex)!=null?k:1e3)},m(_,k){Y(_,e,k),m(e,t),E&&E.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,d),m(l,g),s[27](o),s[29](e),v=!0,I||(z=[U(o,"click",s[15]),U(o,"mousedown",Vn(s[28]))],I=!0)},p(_,k){var T,S;_[12]>0?E?(E.p(_,k),k[0]&4096&&je(E,1)):(E=ei(_),E.c(),je(E,1),E.m(t,null)):E&&(dn(),Ke(E,1,1,()=>{E=null}),gn()),(!v||k[0]&4)&&J(t,"fullscreen",_[2]),k[0]&4096&&n!==(n=`${_[12]}px`)&&D(t,"width",n),(!v||k[0]&1032&&w!==(w=_[10]+" z-index: "+(((T=_[3].zIndex)!=null?T:1e3)+1)+";"))&&r(o,"style",w),(!v||k[0]&4)&&J(e,"fullscreen",_[2]),(!v||k[0]&128)&&J(e,"snapped",_[7]),k[0]&8&&D(e,"position",_[3].position),k[0]&129&&D(e,"right",_[7]?0:`${_[0]}px`),k[0]&130&&D(e,"bottom",_[7]?0:`${_[1]}px`),k[0]&132&&D(e,"top",_[7]||_[2]?"0":"auto"),k[0]&4&&D(e,"left",_[2]?"0":"auto"),k[0]&8&&D(e,"z-index",(S=_[3].zIndex)!=null?S:1e3)},i(_){v||(je(E),v=!0)},o(_){Ke(E),v=!1},d(_){_&&q(e),E&&E.d(),s[27](null),s[29](null),I=!1,me(z)}}}const Fn=48,de=20;function rl(s,e,t){let n,i,o,l,a=B,c=()=>(a(),a=Je(i,N=>t(12,l=N)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:de,bottom:de},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:h="body"}=e,{options:p={}}=e,d,g=null,w=!1,v,I=!1,z=0,E=0,_=de,k=20,T=_,S=k,b=!1,M=de,R=50,F=!1,C={width:0,height:0,right:0,bottom:0},W=!1,V=!1,Q=[],ae=null;function ge(){return Oe(this,null,function*(){try{const N=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`}});if(!N.ok)throw new Error("Failed to get session ID");const ie=yield N.json();if(ie.code===0)return t(9,ae=ie.data.sessionId),ae;throw new Error(ie.message||"Failed to get session ID")}catch(N){return console.error("Failed to get session ID:",N),null}})}function he(N,ie=!1){ie?t(23,b=!0):t(6,I=!0),z=N.clientX,E=N.clientY,_=ie?M:T,k=ie?R:S,N.preventDefault()}function Ge(N){if(!I&&!b)return;const ie=z-N.clientX,O=E-N.clientY;if(b){const j=_+ie,we=N.clientY;t(24,M=Math.max(de,Math.min(window.innerWidth-Fn-de,j)));const ke=window.innerHeight-Fn-de,Be=Math.max(de,Math.min(ke,we));t(25,R=(window.innerHeight-Be-Fn)/window.innerHeight*100)}else{const j=n.width||0,we=n.height||0,ke=_+ie;t(0,T=Math.max(de,Math.min(window.innerWidth-j-de,ke)));const Ne=k+O;t(1,S=Math.max(de,Math.min(window.innerHeight-we-de,Ne)))}}function ce(){t(6,I=!1),t(23,b=!1)}Qn(()=>{typeof h=="string"?g=document.querySelector(h)||document.body:g=h||document.body;const N=O=>Ge(O),ie=()=>ce();return document.addEventListener("mousemove",N),document.addEventListener("mouseup",ie),d&&g&&g.appendChild(d),v&&v.getBoundingClientRect().left,t(7,W=n.initialState==="snapped"),t(2,F=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,T=0),t(1,S=0),t(3,n=xe(se({},n),{height:typeof window!="undefined"?window.innerHeight:n.height,width:n.snappedWidth||n.width}))):n.initialState==="fullscreen"&&(t(0,T=0),t(1,S=0),t(3,n=xe(se({},n),{width:typeof window!="undefined"?window.innerWidth:n.width,height:typeof window!="undefined"?window.innerHeight:n.height}))),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",ie),g&&d&&g.removeChild(d)}});function Xe(){return Oe(this,null,function*(){w||(yield ge()),t(22,w=!w)})}function ue(){var N,ie,O,j,we,ke,Ne,Be;t(2,F=!F),F?(C.width||(C={width:u.width,height:u.height,right:(ie=(N=u.defaultPosition)==null?void 0:N.right)!=null?ie:de,bottom:(j=(O=u.defaultPosition)==null?void 0:O.bottom)!=null?j:de}),W&&t(7,W=!1),t(20,p=xe(se({},n),{width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth})),t(0,T=0),t(1,S=0)):(t(20,p=xe(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,T=(ke=(we=u.defaultPosition)==null?void 0:we.right)!=null?ke:de),t(1,S=(Be=(Ne=u.defaultPosition)==null?void 0:Ne.bottom)!=null?Be:de))}function $e(N){F||he(N)}function re(){var N,ie,O,j;F&&(t(2,F=!1),t(20,p=xe(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth}))),t(7,W=!W),W?(n.height,t(0,T=0),t(1,S=0),t(20,p=xe(se({},n),{height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width}))):(t(20,p=xe(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,T=(ie=(N=u.defaultPosition)==null?void 0:N.right)!=null?ie:de),t(1,S=(j=(O=u.defaultPosition)==null?void 0:O.bottom)!=null?j:de))}function Le(N){t(8,V=!1)}const te=()=>t(8,V=!1);function De(N){mt[N?"unshift":"push"](()=>{v=N,t(5,v)})}const Ae=N=>he(N,!0);function et(N){mt[N?"unshift":"push"](()=>{d=N,t(4,d)})}return s.$$set=N=>{"target"in N&&t(21,h=N.target),"options"in N&&t(20,p=N.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n=xe(se(se({},u),p),{defaultPosition:se(se({},u.defaultPosition),p.defaultPosition)})),s.$$.dirty[0]&4194316&&c(t(11,i=Ri(w?F?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window!="undefined"&&(t(0,T=Math.max(de,Math.min(window.innerWidth-(n.width||0),T))),t(1,S=Math.max(de,Math.min(window.innerHeight-(n.height||0),S)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${M}px; bottom: ${R}%; transform: none; cursor: ${b?"grabbing":"grab"};`)},[T,S,F,n,d,v,I,W,V,ae,o,i,l,Q,he,Xe,ue,$e,re,Le,p,h,w,b,M,R,te,De,Ae,et]}class al extends kn{constructor(e){super(),wn(this,e,rl,ll,ft,{target:21,options:20},null,[-1,-1])}}K.SyAssistant=al,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
|
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=fs(e);if(i===null)return n;e=i;let l='<a href="'+e+'"';return t&&(l+=' title="'+t+'"'),l+=">"+n+"</a>",l}image(e,t,n){const i=fs(e);if(i===null)return n;e=i;let l=`<img src="${e}" alt="${n}"`;return t&&(l+=` title="${t}"`),l+=">",l}text(e){return e}}class Mn{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 Xe{constructor(e){ce(this,"options");ce(this,"renderer");ce(this,"textRenderer");this.options=e||at,this.options.renderer=this.options.renderer||new en,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Mn}static parse(e,t){return new Xe(t).parse(e)}static parseInline(e,t){return new Xe(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const l=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const o=l,r=this.options.extensions.renderers[o.type].call({parser:this},o);if(r!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=r||"";continue}}switch(l.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const o=l;n+=this.renderer.heading(this.parseInline(o.tokens),o.depth,Vi(this.parseInline(o.tokens,this.textRenderer)));continue}case"code":{const o=l;n+=this.renderer.code(o.text,o.lang,!!o.escaped);continue}case"table":{const o=l;let r="",c="";for(let h=0;h<o.header.length;h++)c+=this.renderer.tablecell(this.parseInline(o.header[h].tokens),{header:!0,align:o.align[h]});r+=this.renderer.tablerow(c);let u="";for(let h=0;h<o.rows.length;h++){const p=o.rows[h];c="";for(let d=0;d<p.length;d++)c+=this.renderer.tablecell(this.parseInline(p[d].tokens),{header:!1,align:o.align[d]});u+=this.renderer.tablerow(c)}n+=this.renderer.table(r,u);continue}case"blockquote":{const o=l,r=this.parse(o.tokens);n+=this.renderer.blockquote(r);continue}case"list":{const o=l,r=o.ordered,c=o.start,u=o.loose;let h="";for(let p=0;p<o.items.length;p++){const d=o.items[p],m=d.checked,_=d.task;let E="";if(d.task){const I=this.renderer.checkbox(!!m);u?d.tokens.length>0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=I+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&d.tokens[0].tokens[0].type==="text"&&(d.tokens[0].tokens[0].text=I+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:I+" "}):E+=I+" "}E+=this.parse(d.tokens,u),h+=this.renderer.listitem(E,_,!!m)}n+=this.renderer.list(h,r,c);continue}case"html":{const o=l;n+=this.renderer.html(o.text,o.block);continue}case"paragraph":{const o=l;n+=this.renderer.paragraph(this.parseInline(o.tokens));continue}case"text":{let o=l,r=o.tokens?this.parseInline(o.tokens):o.text;for(;i+1<e.length&&e[i+1].type==="text";)o=e[++i],r+=`
|
45
|
+
`+(o.tokens?this.parseInline(o.tokens):o.text);n+=t?this.renderer.paragraph(r):r;continue}default:{const o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const l=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=o||"";continue}}switch(l.type){case"escape":{const o=l;n+=t.text(o.text);break}case"html":{const o=l;n+=t.html(o.text);break}case"link":{const o=l;n+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break}case"image":{const o=l;n+=t.image(o.href,o.title,o.text);break}case"strong":{const o=l;n+=t.strong(this.parseInline(o.tokens,t));break}case"em":{const o=l;n+=t.em(this.parseInline(o.tokens,t));break}case"codespan":{const o=l;n+=t.codespan(o.text);break}case"br":{n+=t.br();break}case"del":{const o=l;n+=t.del(this.parseInline(o.tokens,t));break}case"text":{const o=l;n+=t.text(o.text);break}default:{const o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}}class zt{constructor(e){ce(this,"options");this.options=e||at}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}ce(zt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class So{constructor(...e){Ti(this,ft);ce(this,"defaults",Sn());ce(this,"options",this.setOptions);ce(this,"parse",pn(this,ft,Zn).call(this,Ze.lex,Xe.parse));ce(this,"parseInline",pn(this,ft,Zn).call(this,Ze.lexInline,Xe.parseInline));ce(this,"Parser",Xe);ce(this,"Renderer",en);ce(this,"TextRenderer",Mn);ce(this,"Lexer",Ze);ce(this,"Tokenizer",Qt);ce(this,"Hooks",zt);this.use(...e)}walkTokens(e,t){var i,l;let n=[];for(const o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{const r=o;for(const c of r.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of r.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const r=o;n=n.concat(this.walkTokens(r.items,t));break}default:{const r=o;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[r.type]?this.defaults.extensions.childTokens[r.type].forEach(c=>{const u=r[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i=le({},n);if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const o=t.renderers[l.name];o?t.renderers[l.name]=function(...r){let c=l.renderer.apply(this,r);return c===!1&&(c=o.apply(this,r)),c}:t.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=t[l.level];o?o.unshift(l.tokenizer):t[l.level]=[l.tokenizer],l.start&&(l.level==="block"?t.startBlock?t.startBlock.push(l.start):t.startBlock=[l.start]:l.level==="inline"&&(t.startInline?t.startInline.push(l.start):t.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(t.childTokens[l.name]=l.childTokens)}),i.extensions=t),n.renderer){const l=this.defaults.renderer||new en(this.defaults);for(const o in n.renderer){if(!(o in l))throw new Error(`renderer '${o}' does not exist`);if(o==="options")continue;const r=o,c=n.renderer[r],u=l[r];l[r]=(...h)=>{let p=c.apply(l,h);return p===!1&&(p=u.apply(l,h)),p||""}}i.renderer=l}if(n.tokenizer){const l=this.defaults.tokenizer||new Qt(this.defaults);for(const o in n.tokenizer){if(!(o in l))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const r=o,c=n.tokenizer[r],u=l[r];l[r]=(...h)=>{let p=c.apply(l,h);return p===!1&&(p=u.apply(l,h)),p}}i.tokenizer=l}if(n.hooks){const l=this.defaults.hooks||new zt;for(const o in n.hooks){if(!(o in l))throw new Error(`hook '${o}' does not exist`);if(o==="options")continue;const r=o,c=n.hooks[r],u=l[r];zt.passThroughHooks.has(o)?l[r]=h=>{if(this.defaults.async)return Promise.resolve(c.call(l,h)).then(d=>u.call(l,d));const p=c.call(l,h);return u.call(l,p)}:l[r]=(...h)=>{let p=c.apply(l,h);return p===!1&&(p=u.apply(l,h)),p}}i.hooks=l}if(n.walkTokens){const l=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(r){let c=[];return c.push(o.call(this,r)),l&&(c=c.concat(l.call(this,r))),c}}this.defaults=le(le({},this.defaults),i)}),this}setOptions(e){return this.defaults=le(le({},this.defaults),e),this}lexer(e,t){return Ze.lex(e,t!=null?t:this.defaults)}parser(e,t){return Xe.parse(e,t!=null?t:this.defaults)}}ft=new WeakSet,Zn=function(e,t){return(n,i)=>{const l=le({},i),o=le(le({},this.defaults),l);this.defaults.async===!0&&l.async===!1&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);const r=pn(this,ft,vi).call(this,!!o.silent,!!o.async);if(typeof n=="undefined"||n===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(c=>e(c,o)).then(c=>o.hooks?o.hooks.processAllTokens(c):c).then(c=>o.walkTokens?Promise.all(this.walkTokens(c,o.walkTokens)).then(()=>c):c).then(c=>t(c,o)).then(c=>o.hooks?o.hooks.postprocess(c):c).catch(r);try{o.hooks&&(n=o.hooks.preprocess(n));let c=e(n,o);o.hooks&&(c=o.hooks.processAllTokens(c)),o.walkTokens&&this.walkTokens(c,o.walkTokens);let u=t(c,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(c){return r(c)}}},vi=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>"+Fe(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const ct=new So;function ee(s,e){return ct.parse(s,e)}ee.options=ee.setOptions=function(s){return ct.setOptions(s),ee.defaults=ct.defaults,rs(ee.defaults),ee},ee.getDefaults=Sn,ee.defaults=at,ee.use=function(...s){return ct.use(...s),ee.defaults=ct.defaults,rs(ee.defaults),ee},ee.walkTokens=function(s,e){return ct.walkTokens(s,e)},ee.parseInline=ct.parseInline,ee.Parser=Xe,ee.parser=Xe.parse,ee.Renderer=en,ee.TextRenderer=Mn,ee.Lexer=Ze,ee.lexer=Ze.lex,ee.Tokenizer=Qt,ee.Hooks=zt,ee.parse=ee,ee.options,ee.setOptions,ee.use,ee.walkTokens,ee.parseInline,Xe.parse,Ze.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:Ts,setPrototypeOf:vs,isFrozen:Ao,getPrototypeOf:xo,getOwnPropertyDescriptor:Io}=Object;let{freeze:Ce,seal:We,create:Es}=Object,{apply:zn,construct:On}=typeof Reflect!="undefined"&&Reflect;Ce||(Ce=function(e){return e}),We||(We=function(e){return e}),zn||(zn=function(e,t,n){return e.apply(t,n)}),On||(On=function(e,t){return new e(...t)});const tn=He(Array.prototype.forEach),Ss=He(Array.prototype.pop),Ot=He(Array.prototype.push),nn=He(String.prototype.toLowerCase),Dn=He(String.prototype.toString),As=He(String.prototype.match),Dt=He(String.prototype.replace),Ro=He(String.prototype.indexOf),Co=He(String.prototype.trim),Ye=He(Object.prototype.hasOwnProperty),Le=He(RegExp.prototype.test),Nt=Lo(TypeError);function He(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 zn(s,e,n)}}function Lo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return On(s,t)}}function V(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nn;vs&&vs(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const l=t(i);l!==i&&(Ao(e)||(e[n]=l),i=l)}s[i]=!0}return s}function Mo(s){for(let e=0;e<s.length;e++)Ye(s,e)||(s[e]=null);return s}function ut(s){const e=Es(null);for(const[t,n]of Ts(s))Ye(s,t)&&(Array.isArray(n)?e[t]=Mo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=ut(n):e[t]=n);return e}function Pt(s,e){for(;s!==null;){const n=Io(s,e);if(n){if(n.get)return He(n.get);if(typeof n.value=="function")return He(n.value)}s=xo(s)}function t(){return null}return t}const xs=Ce(["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"]),Nn=Ce(["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"]),Pn=Ce(["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"]),zo=Ce(["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"]),Fn=Ce(["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"]),Oo=Ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Is=Ce(["#text"]),Rs=Ce(["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"]),Hn=Ce(["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"]),Cs=Ce(["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"]),sn=Ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Do=We(/\{\{[\w\W]*|[\w\W]*\}\}/gm),No=We(/<%[\w\W]*|[\w\W]*%>/gm),Po=We(/\$\{[\w\W]*}/gm),Fo=We(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ho=We(/^aria-[\-\w]+$/),Ls=We(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Bo=We(/^(?:\w+script|data):/i),jo=We(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ms=We(/^html$/i),Uo=We(/^[a-z][.\w]*(-[.\w]+)+$/i);var zs=Object.freeze({__proto__:null,ARIA_ATTR:Ho,ATTR_WHITESPACE:jo,CUSTOM_ELEMENT:Uo,DATA_ATTR:Fo,DOCTYPE_NAME:Ms,ERB_EXPR:No,IS_ALLOWED_URI:Ls,IS_SCRIPT_OR_DATA:Bo,MUSTACHE_EXPR:Do,TMPLIT_EXPR:Po});const Ft={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Wo=function(){return typeof window=="undefined"?null:window},qo=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 l="dompurify"+(n?"#"+n:"");try{return e.createPolicy(l,{createHTML(o){return o},createScriptURL(o){return o}})}catch(o){return console.warn("TrustedTypes policy "+l+" could not be created."),null}},Os=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ds(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wo();const e=H=>Ds(H);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==Ft.document)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:l,HTMLTemplateElement:o,Node:r,Element:c,NodeFilter:u,NamedNodeMap:h=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:m}=s,_=c.prototype,E=Pt(_,"cloneNode"),I=Pt(_,"remove"),z=Pt(_,"nextSibling"),x=Pt(_,"childNodes"),w=Pt(_,"parentNode");if(typeof o=="function"){const H=t.createElement("template");H.content&&H.content.ownerDocument&&(t=H.content.ownerDocument)}let k,b="";const{implementation:v,createNodeIterator:R,createDocumentFragment:L,getElementsByTagName:C}=t,{importNode:X}=n;let y=Os();e.isSupported=typeof Ts=="function"&&typeof w=="function"&&v&&v.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:B,TMPLIT_EXPR:j,DATA_ATTR:te,ARIA_ATTR:ke,IS_SCRIPT_OR_DATA:me,ATTR_WHITESPACE:Be,CUSTOM_ELEMENT:re}=zs;let{IS_ALLOWED_URI:qe}=zs,ie=null;const $e=V({},[...xs,...Nn,...Pn,...Fn,...Is]);let ne=null;const Me=V({},[...Rs,...Hn,...Cs,...sn]);let oe=Object.seal(Es(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}})),Oe=null,xe=null,et=!0,D=!0,ae=!1,N=!0,Z=!1,we=!0,be=!1,De=!1,je=!1,it=!1,yt=!1,Tt=!1,ln=!0,rn=!1;const Wn="user-content-";let Ht=!0,ht=!1,ot={},lt=null;const an=V({},["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 cn=null;const un=V({},["audio","video","img","source","image","track"]);let Bt=null;const T=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),F="http://www.w3.org/1998/Math/MathML",Q="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let he=fe,ve=!1,Ee=null;const vt=V({},[F,Q,fe],Dn);let Ge=V({},["mi","mo","mn","ms","mtext"]),fn=V({},["annotation-xml"]);const ml=V({},["title","style","font","a","script"]);let jt=null;const _l=["application/xhtml+xml","text/html"],kl="text/html";let ye=null,Et=null;const wl=t.createElement("form"),ai=function(f){return f instanceof RegExp||f instanceof Function},qn=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Et&&Et===f)){if((!f||typeof f!="object")&&(f={}),f=ut(f),jt=_l.indexOf(f.PARSER_MEDIA_TYPE)===-1?kl:f.PARSER_MEDIA_TYPE,ye=jt==="application/xhtml+xml"?Dn:nn,ie=Ye(f,"ALLOWED_TAGS")?V({},f.ALLOWED_TAGS,ye):$e,ne=Ye(f,"ALLOWED_ATTR")?V({},f.ALLOWED_ATTR,ye):Me,Ee=Ye(f,"ALLOWED_NAMESPACES")?V({},f.ALLOWED_NAMESPACES,Dn):vt,Bt=Ye(f,"ADD_URI_SAFE_ATTR")?V(ut(T),f.ADD_URI_SAFE_ATTR,ye):T,cn=Ye(f,"ADD_DATA_URI_TAGS")?V(ut(un),f.ADD_DATA_URI_TAGS,ye):un,lt=Ye(f,"FORBID_CONTENTS")?V({},f.FORBID_CONTENTS,ye):an,Oe=Ye(f,"FORBID_TAGS")?V({},f.FORBID_TAGS,ye):{},xe=Ye(f,"FORBID_ATTR")?V({},f.FORBID_ATTR,ye):{},ot=Ye(f,"USE_PROFILES")?f.USE_PROFILES:!1,et=f.ALLOW_ARIA_ATTR!==!1,D=f.ALLOW_DATA_ATTR!==!1,ae=f.ALLOW_UNKNOWN_PROTOCOLS||!1,N=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Z=f.SAFE_FOR_TEMPLATES||!1,we=f.SAFE_FOR_XML!==!1,be=f.WHOLE_DOCUMENT||!1,it=f.RETURN_DOM||!1,yt=f.RETURN_DOM_FRAGMENT||!1,Tt=f.RETURN_TRUSTED_TYPE||!1,je=f.FORCE_BODY||!1,ln=f.SANITIZE_DOM!==!1,rn=f.SANITIZE_NAMED_PROPS||!1,Ht=f.KEEP_CONTENT!==!1,ht=f.IN_PLACE||!1,qe=f.ALLOWED_URI_REGEXP||Ls,he=f.NAMESPACE||fe,Ge=f.MATHML_TEXT_INTEGRATION_POINTS||Ge,fn=f.HTML_INTEGRATION_POINTS||fn,oe=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&ai(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&ai(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(D=!1),yt&&(it=!0),ot&&(ie=V({},Is),ne=[],ot.html===!0&&(V(ie,xs),V(ne,Rs)),ot.svg===!0&&(V(ie,Nn),V(ne,Hn),V(ne,sn)),ot.svgFilters===!0&&(V(ie,Pn),V(ne,Hn),V(ne,sn)),ot.mathMl===!0&&(V(ie,Fn),V(ne,Cs),V(ne,sn))),f.ADD_TAGS&&(ie===$e&&(ie=ut(ie)),V(ie,f.ADD_TAGS,ye)),f.ADD_ATTR&&(ne===Me&&(ne=ut(ne)),V(ne,f.ADD_ATTR,ye)),f.ADD_URI_SAFE_ATTR&&V(Bt,f.ADD_URI_SAFE_ATTR,ye),f.FORBID_CONTENTS&&(lt===an&&(lt=ut(lt)),V(lt,f.FORBID_CONTENTS,ye)),Ht&&(ie["#text"]=!0),be&&V(ie,["html","head","body"]),ie.table&&(V(ie,["tbody"]),delete Oe.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,b=k.createHTML("")}else k===void 0&&(k=qo(m,i)),k!==null&&typeof b=="string"&&(b=k.createHTML(""));Ce&&Ce(f),Et=f}},ci=V({},[...Nn,...Pn,...zo]),ui=V({},[...Fn,...Oo]),bl=function(f){let A=w(f);(!A||!A.tagName)&&(A={namespaceURI:he,tagName:"template"});const O=nn(f.tagName),pe=nn(A.tagName);return Ee[f.namespaceURI]?f.namespaceURI===Q?A.namespaceURI===fe?O==="svg":A.namespaceURI===F?O==="svg"&&(pe==="annotation-xml"||Ge[pe]):!!ci[O]:f.namespaceURI===F?A.namespaceURI===fe?O==="math":A.namespaceURI===Q?O==="math"&&fn[pe]:!!ui[O]:f.namespaceURI===fe?A.namespaceURI===Q&&!fn[pe]||A.namespaceURI===F&&!Ge[pe]?!1:!ui[O]&&(ml[O]||!ci[O]):!!(jt==="application/xhtml+xml"&&Ee[f.namespaceURI]):!1},Ve=function(f){Ot(e.removed,{element:f});try{w(f).removeChild(f)}catch(A){I(f)}},hn=function(f,A){try{Ot(e.removed,{attribute:A.getAttributeNode(f),from:A})}catch(O){Ot(e.removed,{attribute:null,from:A})}if(A.removeAttribute(f),f==="is")if(it||yt)try{Ve(A)}catch(O){}else try{A.setAttribute(f,"")}catch(O){}},fi=function(f){let A=null,O=null;if(je)f="<remove></remove>"+f;else{const Se=As(f,/^[\r\n\t ]+/);O=Se&&Se[0]}jt==="application/xhtml+xml"&&he===fe&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const pe=k?k.createHTML(f):f;if(he===fe)try{A=new d().parseFromString(pe,jt)}catch(Se){}if(!A||!A.documentElement){A=v.createDocument(he,"template",null);try{A.documentElement.innerHTML=ve?b:pe}catch(Se){}}const Ie=A.body||A.documentElement;return f&&O&&Ie.insertBefore(t.createTextNode(O),Ie.childNodes[0]||null),he===fe?C.call(A,be?"html":"body")[0]:be?A.documentElement:Ie},hi=function(f){return R.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Gn=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")},pi=function(f){return typeof r=="function"&&f instanceof r};function tt(H,f,A){tn(H,O=>{O.call(e,f,A,Et)})}const di=function(f){let A=null;if(tt(y.beforeSanitizeElements,f,null),Gn(f))return Ve(f),!0;const O=ye(f.nodeName);if(tt(y.uponSanitizeElement,f,{tagName:O,allowedTags:ie}),f.hasChildNodes()&&!pi(f.firstElementChild)&&Le(/<[/\w]/g,f.innerHTML)&&Le(/<[/\w]/g,f.textContent)||f.nodeType===Ft.progressingInstruction||we&&f.nodeType===Ft.comment&&Le(/<[/\w]/g,f.data))return Ve(f),!0;if(!ie[O]||Oe[O]){if(!Oe[O]&&mi(O)&&(oe.tagNameCheck instanceof RegExp&&Le(oe.tagNameCheck,O)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(O)))return!1;if(Ht&&!lt[O]){const pe=w(f)||f.parentNode,Ie=x(f)||f.childNodes;if(Ie&&pe){const Se=Ie.length;for(let Ne=Se-1;Ne>=0;--Ne){const Qe=E(Ie[Ne],!0);Qe.__removalCount=(f.__removalCount||0)+1,pe.insertBefore(Qe,z(f))}}}return Ve(f),!0}return f instanceof c&&!bl(f)||(O==="noscript"||O==="noembed"||O==="noframes")&&Le(/<\/no(script|embed|frames)/i,f.innerHTML)?(Ve(f),!0):(Z&&f.nodeType===Ft.text&&(A=f.textContent,tn([M,B,j],pe=>{A=Dt(A,pe," ")}),f.textContent!==A&&(Ot(e.removed,{element:f.cloneNode()}),f.textContent=A)),tt(y.afterSanitizeElements,f,null),!1)},gi=function(f,A,O){if(ln&&(A==="id"||A==="name")&&(O in t||O in wl))return!1;if(!(D&&!xe[A]&&Le(te,A))){if(!(et&&Le(ke,A))){if(!ne[A]||xe[A]){if(!(mi(f)&&(oe.tagNameCheck instanceof RegExp&&Le(oe.tagNameCheck,f)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(f))&&(oe.attributeNameCheck instanceof RegExp&&Le(oe.attributeNameCheck,A)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(A))||A==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&Le(oe.tagNameCheck,O)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(O))))return!1}else if(!Bt[A]){if(!Le(qe,Dt(O,Be,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&f!=="script"&&Ro(O,"data:")===0&&cn[f])){if(!(ae&&!Le(me,Dt(O,Be,"")))){if(O)return!1}}}}}}return!0},mi=function(f){return f!=="annotation-xml"&&As(f,re)},_i=function(f){tt(y.beforeSanitizeAttributes,f,null);const{attributes:A}=f;if(!A||Gn(f))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let pe=A.length;for(;pe--;){const Ie=A[pe],{name:Se,namespaceURI:Ne,value:Qe}=Ie,Ut=ye(Se);let ze=Se==="value"?Qe:Co(Qe);if(O.attrName=Ut,O.attrValue=ze,O.keepAttr=!0,O.forceKeepAttr=void 0,tt(y.uponSanitizeAttribute,f,O),ze=O.attrValue,rn&&(Ut==="id"||Ut==="name")&&(hn(Se,f),ze=Wn+ze),we&&Le(/((--!?|])>)|<\/(style|title)/i,ze)){hn(Se,f);continue}if(O.forceKeepAttr||(hn(Se,f),!O.keepAttr))continue;if(!N&&Le(/\/>/i,ze)){hn(Se,f);continue}Z&&tn([M,B,j],wi=>{ze=Dt(ze,wi," ")});const ki=ye(f.nodeName);if(gi(ki,Ut,ze)){if(k&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Ne)switch(m.getAttributeType(ki,Ut)){case"TrustedHTML":{ze=k.createHTML(ze);break}case"TrustedScriptURL":{ze=k.createScriptURL(ze);break}}try{Ne?f.setAttributeNS(Ne,Se,ze):f.setAttribute(Se,ze),Gn(f)?Ve(f):Ss(e.removed)}catch(wi){}}}tt(y.afterSanitizeAttributes,f,null)},yl=function H(f){let A=null;const O=hi(f);for(tt(y.beforeSanitizeShadowDOM,f,null);A=O.nextNode();)tt(y.uponSanitizeShadowNode,A,null),di(A),_i(A),A.content instanceof l&&H(A.content);tt(y.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(H){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,O=null,pe=null,Ie=null;if(ve=!H,ve&&(H="<!-->"),typeof H!="string"&&!pi(H))if(typeof H.toString=="function"){if(H=H.toString(),typeof H!="string")throw Nt("dirty is not a string, aborting")}else throw Nt("toString is not a function");if(!e.isSupported)return H;if(De||qn(f),e.removed=[],typeof H=="string"&&(ht=!1),ht){if(H.nodeName){const Qe=ye(H.nodeName);if(!ie[Qe]||Oe[Qe])throw Nt("root node is forbidden and cannot be sanitized in-place")}}else if(H instanceof r)A=fi("<!---->"),O=A.ownerDocument.importNode(H,!0),O.nodeType===Ft.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?A=O:A.appendChild(O);else{if(!it&&!Z&&!be&&H.indexOf("<")===-1)return k&&Tt?k.createHTML(H):H;if(A=fi(H),!A)return it?null:Tt?b:""}A&&je&&Ve(A.firstChild);const Se=hi(ht?H:A);for(;pe=Se.nextNode();)di(pe),_i(pe),pe.content instanceof l&&yl(pe.content);if(ht)return H;if(it){if(yt)for(Ie=L.call(A.ownerDocument);A.firstChild;)Ie.appendChild(A.firstChild);else Ie=A;return(ne.shadowroot||ne.shadowrootmode)&&(Ie=X.call(n,Ie,!0)),Ie}let Ne=be?A.outerHTML:A.innerHTML;return be&&ie["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Le(Ms,A.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
47
|
+
`+Ne),Z&&tn([M,B,j],Qe=>{Ne=Dt(Ne,Qe," ")}),k&&Tt?k.createHTML(Ne):Ne},e.setConfig=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qn(H),De=!0},e.clearConfig=function(){Et=null,De=!1},e.isValidAttribute=function(H,f,A){Et||qn({});const O=ye(H),pe=ye(f);return gi(O,pe,A)},e.addHook=function(H,f){typeof f=="function"&&Ot(y[H],f)},e.removeHook=function(H){return Ss(y[H])},e.removeHooks=function(H){y[H]=[]},e.removeAllHooks=function(){y=Os()},e}var Ns=Ds();function Ps(s){var n;if(typeof document=="undefined")return null;const t=`; ${document.cookie}`.split(`; ${s}=`);return t.length===2&&((n=t.pop())==null?void 0:n.split(";").shift())||null}const de=()=>{if(typeof window=="undefined")return null;const s=Ps("access_token");if(s)return s;const e=Ps("auth_token");if(e)return e;const t=sessionStorage.getItem("vuex");if(t)try{const n=JSON.parse(t);if(n!=null&&n.token)return n.token}catch(n){console.error("Failed to parse vuex data:",n)}return null};function Fs(s,e,t){const n=s.slice();return n[24]=e[t],n}function Hs(s){let e,t=s[9].text+"",n;return{c(){e=S("div"),n=Te(t),a(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),P(e,"left",s[9].x+"px"),P(e,"top",s[9].y+"px"),P(e,"z-index",s[3]+3)},m(i,l){G(i,e,l),g(e,n)},p(i,l){l&512&&t!==(t=i[9].text+"")&&Pe(n,t),l&512&&P(e,"left",i[9].x+"px"),l&512&&P(e,"top",i[9].y+"px"),l&8&&P(e,"z-index",i[3]+3)},d(i){i&&W(e)}}}function Go(s){let e=[],t=new Map,n,i,l=st(s[0]);const o=c=>c[24].sessionId;for(let c=0;c<l.length;c+=1){let u=Fs(s,l,c),h=o(u);t.set(h,e[c]=Bs(h,u))}let r=s[5]&&js();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=q(),r&&r.c(),i=qt()},m(c,u){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(c,u);G(c,n,u),r&&r.m(c,u),G(c,i,u)},p(c,u){u&8261&&(l=st(c[0]),e=ss(e,u,o,1,c,l,t,n.parentNode,ns,Bs,n,Fs)),c[5]?r||(r=js(),r.c(),r.m(i.parentNode,i)):r&&(r.d(1),r=null)},d(c){c&&(W(n),W(i));for(let u=0;u<e.length;u+=1)e[u].d(c);r&&r.d(c)}}}function Yo(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=S("div"),n=Te(t),a(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,l){G(i,e,l),g(e,n)},p(i,l){l&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Pe(n,t)},d(i){i&&W(e)}}}function Bs(s,e){let t,n,i,l,o=e[24].title+"",r,c,u,h=Ws(e[24].timestamp)+"",p,d,m,_,E,I,z,x,w,k,b;function v(){return e[17](e[24])}function R(...L){return e[18](e[24],...L)}return{key:s,first:null,c(){t=S("div"),n=S("button"),i=S("div"),l=S("div"),r=Te(o),c=q(),u=S("div"),p=Te(h),d=q(),m=S("button"),_=J("svg"),E=J("path"),I=J("path"),z=J("path"),a(l,"class","sy-session-title svelte-1g6fj9a"),a(u,"class","sy-session-time svelte-1g6fj9a"),a(i,"class","sy-session-info svelte-1g6fj9a"),a(n,"class","sy-session-select svelte-1g6fj9a"),a(E,"d","M3 6h18"),a(I,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),a(z,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),a(_,"xmlns","http://www.w3.org/2000/svg"),a(_,"width","16"),a(_,"height","16"),a(_,"viewBox","0 0 24 24"),a(_,"fill","none"),a(_,"stroke","currentColor"),a(_,"stroke-width","2"),a(_,"stroke-linecap","round"),a(_,"stroke-linejoin","round"),a(m,"class","sy-session-delete svelte-1g6fj9a"),m.disabled=x=e[6]===e[24].sessionId,a(m,"aria-label","删除会话"),a(t,"class","sy-session-item svelte-1g6fj9a"),a(t,"data-session-id",w=e[24].sessionId),K(t,"deleting",e[24].deleting),this.first=t},m(L,C){G(L,t,C),g(t,n),g(n,i),g(i,l),g(l,r),g(i,c),g(i,u),g(u,p),g(t,d),g(t,m),g(m,_),g(_,E),g(_,I),g(_,z),k||(b=[Y(n,"click",v),Y(m,"click",R)],k=!0)},p(L,C){e=L,C&1&&o!==(o=e[24].title+"")&&Pe(r,o),C&1&&h!==(h=Ws(e[24].timestamp)+"")&&Pe(p,h),C&65&&x!==(x=e[6]===e[24].sessionId)&&(m.disabled=x),C&1&&w!==(w=e[24].sessionId)&&a(t,"data-session-id",w),C&1&&K(t,"deleting",e[24].deleting)},d(L){L&&W(t),k=!1,_e(b)}}}function js(s){let e;return{c(){e=S("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',a(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){G(t,e,n)},d(t){t&&W(e)}}}function Us(s){let e,t,n,i,l,o,r,c,u;return{c(){e=S("div"),t=S("div"),t.textContent="确认删除此会话?",n=q(),i=S("div"),l=S("button"),l.textContent="取消",o=q(),r=S("button"),r.textContent="删除",a(t,"class","sy-session-confirm-content svelte-1g6fj9a"),a(l,"class","sy-session-confirm-cancel svelte-1g6fj9a"),a(r,"class","sy-session-confirm-delete svelte-1g6fj9a"),a(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),a(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),P(e,"left",s[8].x+"px"),P(e,"top",s[8].y+"px"),P(e,"z-index",s[3]+3)},m(h,p){G(h,e,p),g(e,t),g(e,n),g(e,i),g(i,l),g(i,o),g(i,r),c||(u=[Y(l,"click",s[19]),Y(r,"click",s[14])],c=!0)},p(h,p){p&256&&P(e,"left",h[8].x+"px"),p&256&&P(e,"top",h[8].y+"px"),p&8&&P(e,"z-index",h[3]+3)},d(h){h&&W(e),c=!1,_e(u)}}}function Zo(s){let e,t,n,i,l,o,r,c,u,h,p,d,m,_,E,I,z,x,w,k=s[9]&&Hs(s);function b(C,X){return C[0].length===0?Yo:Go}let v=b(s),R=v(s),L=s[7]&&Us(s);return{c(){e=S("div"),t=S("div"),n=S("h2"),n.textContent="历史会话",i=q(),l=S("button"),l.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>',o=q(),r=S("div"),c=S("input"),u=q(),h=J("svg"),p=J("circle"),d=J("line"),m=q(),k&&k.c(),_=q(),E=S("div"),R.c(),I=q(),L&&L.c(),z=qt(),a(n,"class","svelte-1g6fj9a"),a(l,"class","sy-session-close svelte-1g6fj9a"),a(l,"aria-label","关闭历史会话"),a(t,"class","sy-session-header svelte-1g6fj9a"),a(c,"type","text"),a(c,"class","sy-session-search-input svelte-1g6fj9a"),a(c,"placeholder","搜索历史会话..."),a(p,"cx","11"),a(p,"cy","11"),a(p,"r","8"),a(d,"x1","21"),a(d,"y1","21"),a(d,"x2","16.65"),a(d,"y2","16.65"),a(h,"class","sy-session-search-icon svelte-1g6fj9a"),a(h,"xmlns","http://www.w3.org/2000/svg"),a(h,"width","16"),a(h,"height","16"),a(h,"viewBox","0 0 24 24"),a(h,"fill","none"),a(h,"stroke","currentColor"),a(h,"stroke-width","2"),a(h,"stroke-linecap","round"),a(h,"stroke-linejoin","round"),a(r,"class","sy-session-search svelte-1g6fj9a"),a(E,"class","sy-session-list svelte-1g6fj9a"),a(e,"class","sy-session-history svelte-1g6fj9a"),P(e,"z-index",s[3]+2)},m(C,X){G(C,e,X),g(e,t),g(t,n),g(t,i),g(t,l),g(e,o),g(e,r),g(r,c),nt(c,s[4]),g(r,u),g(r,h),g(h,p),g(h,d),g(e,m),k&&k.m(e,null),g(e,_),g(e,E),R.m(E,null),G(C,I,X),L&&L.m(C,X),G(C,z,X),x||(w=[Y(l,"click",function(){St(s[1])&&s[1].apply(this,arguments)}),Y(l,"mouseenter",s[15]),Y(l,"mouseleave",s[12]),Y(c,"input",s[16]),Y(E,"scroll",s[10])],x=!0)},p(C,[X]){s=C,X&16&&c.value!==s[4]&&nt(c,s[4]),s[9]?k?k.p(s,X):(k=Hs(s),k.c(),k.m(e,_)):k&&(k.d(1),k=null),v===(v=b(s))&&R?R.p(s,X):(R.d(1),R=v(s),R&&(R.c(),R.m(E,null))),X&8&&P(e,"z-index",s[3]+2),s[7]?L?L.p(s,X):(L=Us(s),L.c(),L.m(z.parentNode,z)):L&&(L.d(1),L=null)},i:U,o:U,d(C){C&&(W(e),W(I),W(z)),k&&k.d(),R.d(),L&&L.d(C),x=!1,_e(w)}}}const Bn=10;function Ws(s){return new Date(s).toLocaleString()}function Xo(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:l}=e,{zIndex:o}=e,r=!1,c=!0,u=0,h="",p=null,d=null,m={x:0,y:0};function _(){return Re(this,null,function*(){if(!(r||!c)){t(5,r=!0);try{const y=yield fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({start:u,length:Bn,keyword:h})});if(!y.ok)throw new Error("Failed to load sessions");const M=yield y.json();if(M.code===0){const B=M.data.sessionList.map(j=>({sessionId:j.sessionId,title:j.name,timestamp:new Date(j.createDate).getTime()}));t(0,n=[...n,...B]),u+=Bn,c=B.length===Bn}}catch(y){console.error("Failed to load sessions:",y)}finally{t(5,r=!1)}}})}function E(y){const M=y.target,{scrollTop:B,scrollHeight:j,clientHeight:te}=M;j-B-te<50&&_()}gn(()=>{_()});let I=null;function z(y,M){const j=y.currentTarget.getBoundingClientRect();t(9,I={text:M,x:j.left+j.width/2,y:j.bottom+8})}function x(){t(9,I=null)}function w(y,M){const j=y.currentTarget.getBoundingClientRect();t(8,m={x:j.left-16,y:j.top+j.height/2}),t(7,d=M)}function k(y){return Re(this,null,function*(){if(y&&!p)try{t(6,p=y),t(7,d=null);const M=document.querySelector(`[data-session-id="${y}"]`);M&&M.classList.add("deleting"),yield new Promise(te=>setTimeout(te,300));const B=yield fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({sessionId:y})});if(!B.ok)throw new Error("Delete request failed");const j=yield B.json();if(j.code===0&&j.data.respCode===0)t(0,n=n.map(te=>Ae(le({},te),{deleting:te.sessionId===y}))),setTimeout(()=>{t(0,n=n.filter(te=>!te.deleting))},300);else throw new Error("Delete failed: "+j.message)}catch(M){console.error("Failed to delete session:",M);const B=document.querySelector(`[data-session-id="${y}"]`);B&&B.classList.remove("deleting")}finally{t(6,p=null)}})}function b(){d&&k(d)}const v=y=>z(y,"关闭历史会话");function R(){h=this.value,t(4,h)}const L=y=>l(y.sessionId),C=(y,M)=>w(M,y.sessionId),X=()=>t(7,d=null);return s.$$set=y=>{"sessions"in y&&t(0,n=y.sessions),"onClose"in y&&t(1,i=y.onClose),"onSelect"in y&&t(2,l=y.onSelect),"zIndex"in y&&t(3,o=y.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&h!==void 0&&(t(0,n=[]),u=0,c=!0,_())},[n,i,l,o,h,r,p,d,m,I,E,z,x,w,b,v,R,L,C,X]}class qs extends Tn{constructor(e){super(),yn(this,e,Xo,Zo,pt,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function Gs(s,e,t){const n=s.slice();return n[65]=e[t],n}function Ys(s,e,t){const n=s.slice();return n[68]=e[t],n[69]=e,n[70]=t,n}function Zs(s,e,t){const n=s.slice();return n[71]=e[t],n[73]=t,n}function Vo(s){let e,t=[],n=new Map,i=st(s[4]);const l=o=>o[68].id;for(let o=0;o<i.length;o+=1){let r=Ys(s,i,o),c=l(r);n.set(c,t[o]=ei(c,r))}return{c(){e=S("div");for(let o=0;o<t.length;o+=1)t[o].c();a(e,"class","sy-assistant-message-list svelte-mogmt")},m(o,r){G(o,e,r);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[50](e)},p(o,r){r[0]&2144465394&&(i=st(o[4]),t=ss(t,r,l,1,o,i,n,e,ns,ei,null,Ys))},i:U,o:U,d(o){o&&W(e);for(let r=0;r<t.length;r+=1)t[r].d();s[50](null)}}}function Qo(s){let e,t;return e=new qs({props:{sessions:s[31],onClose:s[33],onSelect:s[34],zIndex:s[1]}}),{c(){bn(e.$$.fragment)},m(n,i){Zt(e,n,i),t=!0},p(n,i){const l={};i[0]&2&&(l.zIndex=n[1]),e.$set(l)},i(n){t||(Ue(e.$$.fragment,n),t=!0)},o(n){Ke(e.$$.fragment,n),t=!1},d(n){Xt(e,n)}}}function Jo(s){let e;return{c(){e=S("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>',a(e,"class","sy-assistant-avatar user svelte-mogmt")},m(t,n){G(t,e,n)},d(t){t&&W(e)}}}function Ko(s){let e;return{c(){e=S("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>',a(e,"class","sy-assistant-avatar assistant svelte-mogmt")},m(t,n){G(t,e,n)},d(t){t&&W(e)}}}function $o(s){let e,t=s[20](s[68].content)+"";return{c(){e=S("div"),a(e,"class","markdown-content svelte-mogmt")},m(n,i){G(n,e,i),e.innerHTML=t},p(n,i){i[0]&16&&t!==(t=n[20](n[68].content)+"")&&(e.innerHTML=t)},d(n){n&&W(e)}}}function el(s){let e;return{c(){e=S("span"),e.innerHTML='<span class="dot svelte-mogmt">.</span> <span class="dot svelte-mogmt">.</span> <span class="dot svelte-mogmt">.</span>',a(e,"class","sy-assistant-loading svelte-mogmt")},m(t,n){G(t,e,n)},p:U,d(t){t&&W(e)}}}function Xs(s){let e,t=st(s[68].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=Js(Zs(s,t,i));return{c(){e=S("div");for(let i=0;i<n.length;i+=1)n[i].c();a(e,"class","sy-assistant-attachments svelte-mogmt")},m(i,l){G(i,e,l);for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(e,null)},p(i,l){if(l[0]&29360370){t=st(i[68].attachments);let o;for(o=0;o<t.length;o+=1){const r=Zs(i,t,o);n[o]?n[o].p(r,l):(n[o]=Js(r),n[o].c(),n[o].m(e,null))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(i){i&&W(e),Jn(n,i)}}}function Vs(s){let e,t,n;function i(...l){return s[37](s[71],...l)}return{c(){e=S("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-mogmt"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',a(e,"class","sy-assistant-attachment-toggle svelte-mogmt"),a(e,"aria-label","查看详情")},m(l,o){G(l,e,o),t||(n=[Y(e,"mouseenter",i),Y(e,"mouseleave",s[23])],t=!0)},p(l,o){s=l},d(l){l&&W(e),t=!1,_e(n)}}}function Qs(s){let e,t=s[5].replace(/\n/g,"<br>")+"",n,i;return{c(){e=S("div"),a(e,"class","sy-assistant-tooltip svelte-mogmt"),a(e,"role","tooltip"),P(e,"left",s[6].x+"px"),P(e,"top",s[6].y+"px"),P(e,"z-index",s[1]+3),K(e,"align-right",s[6].alignRight)},m(l,o){G(l,e,o),e.innerHTML=t,n||(i=[Y(e,"mouseenter",s[39]),Y(e,"mouseleave",s[40])],n=!0)},p(l,o){o[0]&32&&t!==(t=l[5].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),o[0]&64&&P(e,"left",l[6].x+"px"),o[0]&64&&P(e,"top",l[6].y+"px"),o[0]&2&&P(e,"z-index",l[1]+3),o[0]&64&&K(e,"align-right",l[6].alignRight)},d(l){l&&W(e),n=!1,_e(i)}}}function Js(s){let e,t,n,i,l,o,r,c,u,h=on(s[71].content_title).name+"",p,d,m,_=on(s[71].content_title).ext+"",E,I,z,x,w,k,b,v,R,L,C=s[71].tips&&Vs(s);function X(){return s[38](s[71])}let y=s[5]&&Qs(s);return{c(){e=S("div"),t=S("div"),n=S("div"),i=J("svg"),l=J("path"),o=J("polyline"),r=q(),c=S("div"),u=S("span"),p=Te(h),d=q(),m=S("span"),E=Te(_),z=q(),x=S("div"),C&&C.c(),w=q(),k=S("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-mogmt"><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>',b=q(),y&&y.c(),v=q(),a(l,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),a(o,"points","13 2 13 9 20 9"),a(i,"xmlns","http://www.w3.org/2000/svg"),a(i,"width","16"),a(i,"height","16"),a(i,"viewBox","0 0 24 24"),a(i,"fill","none"),a(i,"stroke","currentColor"),a(i,"stroke-width","2"),a(i,"stroke-linecap","round"),a(i,"stroke-linejoin","round"),a(u,"class","sy-assistant-filename svelte-mogmt"),a(m,"class","sy-assistant-attachment-ext svelte-mogmt"),a(c,"class","sy-assistant-attachment-name svelte-mogmt"),a(c,"title",I=s[71].content_title),a(n,"class","sy-assistant-attachment-title svelte-mogmt"),a(k,"class","sy-assistant-attachment-toggle svelte-mogmt"),a(k,"aria-label","下载文件"),a(x,"class","sy-assistant-attachment-actions svelte-mogmt"),a(t,"class","sy-assistant-attachment-header svelte-mogmt"),a(e,"class","sy-assistant-attachment svelte-mogmt")},m(M,B){G(M,e,B),g(e,t),g(t,n),g(n,i),g(i,l),g(i,o),g(n,r),g(n,c),g(c,u),g(u,p),g(c,d),g(c,m),g(m,E),g(t,z),g(t,x),C&&C.m(x,null),g(x,w),g(x,k),g(e,b),y&&y.m(e,null),g(e,v),R||(L=Y(k,"click",X),R=!0)},p(M,B){s=M,B[0]&16&&h!==(h=on(s[71].content_title).name+"")&&Pe(p,h),B[0]&16&&_!==(_=on(s[71].content_title).ext+"")&&Pe(E,_),B[0]&16&&I!==(I=s[71].content_title)&&a(c,"title",I),s[71].tips?C?C.p(s,B):(C=Vs(s),C.c(),C.m(x,w)):C&&(C.d(1),C=null),s[5]?y?y.p(s,B):(y=Qs(s),y.c(),y.m(e,v)):y&&(y.d(1),y=null)},d(M){M&&W(e),C&&C.d(),y&&y.d(),R=!1,L()}}}function Ks(s){let e,t,n,i,l,o,r,c,u,h,p;function d(v,R){return v[12][v[68].id]?nl:tl}let m=d(s),_=m(s);function E(){return s[41](s[68])}function I(...v){return s[42](s[68],...v)}function z(){return s[43](s[68])}function x(...v){return s[44](s[68],...v)}function w(...v){return s[45](s[68],...v)}function k(...v){return s[46](s[68],...v)}let b=s[15]&&s[13][s[68].id]==="dislike"&&$s(s);return{c(){e=S("div"),t=S("button"),_.c(),i=q(),l=S("button"),l.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>',o=q(),r=S("button"),r.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=q(),b&&b.c(),u=qt(),a(t,"class","sy-assistant-action-button svelte-mogmt"),a(t,"aria-label",n=s[12][s[68].id]?"已复制":"复制内容"),K(t,"copied",s[12][s[68].id]),a(l,"class","sy-assistant-action-button svelte-mogmt"),a(l,"aria-label","点赞"),K(l,"active",s[13][s[68].id]==="like"),a(r,"class","sy-assistant-action-button svelte-mogmt"),a(r,"aria-label","点踩"),K(r,"active",s[13][s[68].id]==="dislike"),a(e,"class","sy-assistant-message-actions svelte-mogmt")},m(v,R){G(v,e,R),g(e,t),_.m(t,null),g(e,i),g(e,l),g(e,o),g(e,r),G(v,c,R),b&&b.m(v,R),G(v,u,R),h||(p=[Y(t,"click",E),Y(t,"mouseenter",I),Y(t,"mouseleave",s[30]),Y(l,"click",z),Y(l,"mouseenter",x),Y(l,"mouseleave",s[30]),Y(r,"click",w),Y(r,"mouseenter",k),Y(r,"mouseleave",s[30])],h=!0)},p(v,R){s=v,m!==(m=d(s))&&(_.d(1),_=m(s),_&&(_.c(),_.m(t,null))),R[0]&4112&&n!==(n=s[12][s[68].id]?"已复制":"复制内容")&&a(t,"aria-label",n),R[0]&4112&&K(t,"copied",s[12][s[68].id]),R[0]&8208&&K(l,"active",s[13][s[68].id]==="like"),R[0]&8208&&K(r,"active",s[13][s[68].id]==="dislike"),s[15]&&s[13][s[68].id]==="dislike"?b?b.p(s,R):(b=$s(s),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null)},d(v){v&&(W(e),W(c),W(u)),_.d(),b&&b.d(v),h=!1,_e(p)}}}function tl(s){let e,t,n;return{c(){e=J("svg"),t=J("rect"),n=J("path"),a(t,"x","9"),a(t,"y","9"),a(t,"width","13"),a(t,"height","13"),a(t,"rx","2"),a(t,"ry","2"),a(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width","14"),a(e,"height","14"),a(e,"viewBox","0 0 24 24"),a(e,"fill","none"),a(e,"stroke","currentColor"),a(e,"stroke-width","2"),a(e,"stroke-linecap","round"),a(e,"stroke-linejoin","round")},m(i,l){G(i,e,l),g(e,t),g(e,n)},d(i){i&&W(e)}}}function nl(s){let e,t;return{c(){e=J("svg"),t=J("polyline"),a(t,"points","20 6 9 17 4 12"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width","14"),a(e,"height","14"),a(e,"viewBox","0 0 24 24"),a(e,"fill","none"),a(e,"stroke","currentColor"),a(e,"stroke-width","2"),a(e,"stroke-linecap","round"),a(e,"stroke-linejoin","round")},m(n,i){G(n,e,i),g(e,t)},d(n){n&&W(e)}}}function $s(s){let e,t,n,i,l,o,r,c,u,h,p;function d(){s[47].call(i,s[68])}function m(){return s[48](s[68])}function _(){return s[49](s[68])}return{c(){e=S("div"),t=S("div"),t.textContent="反馈意见",n=q(),i=S("textarea"),l=q(),o=S("div"),r=S("button"),r.textContent="取消",c=q(),u=S("button"),u.textContent="提交",a(t,"class","sy-assistant-dislike-title svelte-mogmt"),a(i,"class","sy-assistant-dislike-input svelte-mogmt"),a(i,"placeholder","请输入您的反馈意见..."),a(r,"class","sy-assistant-popup-cancel svelte-mogmt"),a(u,"class","sy-assistant-popup-submit svelte-mogmt"),a(o,"class","sy-assistant-popup-actions svelte-mogmt"),a(e,"class","sy-assistant-dislike-popup svelte-mogmt"),P(e,"left",s[16].x+"px"),P(e,"top",s[16].y+"px"),P(e,"z-index",s[1]+3)},m(E,I){G(E,e,I),g(e,t),g(e,n),g(e,i),nt(i,s[14][s[68].id]),g(e,l),g(e,o),g(o,r),g(o,c),g(o,u),h||(p=[Y(i,"input",d),Y(r,"click",m),Y(u,"click",_)],h=!0)},p(E,I){s=E,I[0]&16400&&nt(i,s[14][s[68].id]),I[0]&65536&&P(e,"left",s[16].x+"px"),I[0]&65536&&P(e,"top",s[16].y+"px"),I[0]&2&&P(e,"z-index",s[1]+3)},d(E){E&&W(e),h=!1,_e(p)}}}function ei(s,e){let t,n,i,l,o,r,c,u,h=new Date(e[68].timestamp).toLocaleString()+"",p,d;function m(b,v){return b[68].type==="assistant"?Ko:Jo}let _=m(e),E=_(e);function I(b,v){return b[8]&&b[68].id===b[4][b[4].length-1].id&&b[68].type==="assistant"&&!b[68].content?el:$o}let z=I(e),x=z(e),w=e[68].attachments&&Xs(e),k=e[68].id!=="-1"&&e[68].type==="assistant"&&!e[8]&&Ks(e);return{key:s,first:null,c(){t=S("div"),E.c(),n=q(),i=S("div"),l=S("div"),x.c(),o=q(),w&&w.c(),r=q(),k&&k.c(),c=q(),u=S("div"),p=Te(h),d=q(),a(l,"class","sy-assistant-message-content svelte-mogmt"),a(u,"class","sy-assistant-message-time svelte-mogmt"),a(i,"class","sy-assistant-message-bubble svelte-mogmt"),a(t,"class","sy-assistant-message svelte-mogmt"),K(t,"user",e[68].type==="user"),this.first=t},m(b,v){G(b,t,v),E.m(t,null),g(t,n),g(t,i),g(i,l),x.m(l,null),g(l,o),w&&w.m(l,null),g(l,r),k&&k.m(l,null),g(i,c),g(i,u),g(u,p),g(t,d)},p(b,v){e=b,_!==(_=m(e))&&(E.d(1),E=_(e),E&&(E.c(),E.m(t,n))),z===(z=I(e))&&x?x.p(e,v):(x.d(1),x=z(e),x&&(x.c(),x.m(l,o))),e[68].attachments?w?w.p(e,v):(w=Xs(e),w.c(),w.m(l,r)):w&&(w.d(1),w=null),e[68].id!=="-1"&&e[68].type==="assistant"&&!e[8]?k?k.p(e,v):(k=Ks(e),k.c(),k.m(l,null)):k&&(k.d(1),k=null),v[0]&16&&h!==(h=new Date(e[68].timestamp).toLocaleString()+"")&&Pe(p,h),v[0]&16&&K(t,"user",e[68].type==="user")},d(b){b&&W(t),E.d(),x.d(),w&&w.d(),k&&k.d()}}}function ti(s){let e,t,n,i,l,o,r,c,u,h,p,d,m,_,E,I,z,x,w,k,b,v,R,L,C,X,y,M=s[0]&&ni(s),B=!s[0]&&ii();return{c(){e=S("div"),t=S("div"),M&&M.c(),n=q(),B&&B.c(),i=q(),l=S("div"),o=S("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"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',r=q(),c=S("button"),c.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>',u=q(),h=S("div"),p=S("div"),d=S("div"),m=S("div"),_=S("textarea"),E=q(),I=S("div"),z=Te(s[3]),x=Te("/"),w=Te(jn),k=q(),b=S("button"),v=J("svg"),R=J("line"),L=J("polygon"),a(o,"class","sy-assistant-icon-button svelte-mogmt"),a(o,"aria-label","历史会话"),a(c,"class","sy-assistant-icon-button svelte-mogmt"),a(c,"aria-label","新建会话"),a(l,"class","sy-assistant-chat-actions-btns svelte-mogmt"),a(t,"class","sy-assistant-chat-actions svelte-mogmt"),a(e,"class","sy-assistant-chat-footer svelte-mogmt"),a(_,"class","sy-assistant-textarea svelte-mogmt"),a(_,"placeholder","输入您的问题..."),a(_,"maxlength",jn),a(_,"rows","3"),a(I,"class","sy-assistant-char-count svelte-mogmt"),K(I,"over-limit",s[19]),a(m,"class","sy-assistant-textarea-container svelte-mogmt"),a(d,"class","sy-assistant-input-wrapper svelte-mogmt"),a(R,"x1","22"),a(R,"y1","2"),a(R,"x2","11"),a(R,"y2","13"),a(L,"points","22 2 15 22 11 13 2 9 22 2"),a(v,"xmlns","http://www.w3.org/2000/svg"),a(v,"width","20"),a(v,"height","20"),a(v,"viewBox","0 0 24 24"),a(v,"fill","none"),a(v,"stroke","currentColor"),a(v,"stroke-width","2"),a(v,"stroke-linecap","round"),a(v,"stroke-linejoin","round"),a(b,"class","sy-assistant-send-button svelte-mogmt"),b.disabled=C=!s[2].trim()||s[19],a(b,"aria-label","发送消息"),a(p,"class","sy-assistant-input-container svelte-mogmt"),a(h,"class","sy-assistant-input-area svelte-mogmt")},m(j,te){G(j,e,te),g(e,t),M&&M.m(t,null),g(t,n),B&&B.m(t,null),g(t,i),g(t,l),g(l,o),g(l,r),g(l,c),G(j,u,te),G(j,h,te),g(h,p),g(p,d),g(d,m),g(m,_),nt(_,s[2]),g(m,E),g(m,I),g(I,z),g(I,x),g(I,w),g(p,k),g(p,b),g(b,v),g(v,R),g(v,L),X||(y=[Y(o,"click",s[32]),Y(o,"mouseenter",s[52]),Y(o,"mouseleave",s[30]),Y(c,"click",s[35]),Y(c,"mouseenter",s[53]),Y(c,"mouseleave",s[30]),Y(_,"input",s[54]),Y(_,"keydown",s[55]),Y(b,"click",s[21]),Y(b,"mouseenter",s[56]),Y(b,"mouseleave",s[30])],X=!0)},p(j,te){j[0]?M?M.p(j,te):(M=ni(j),M.c(),M.m(t,n)):M&&(M.d(1),M=null),j[0]?B&&(B.d(1),B=null):B||(B=ii(),B.c(),B.m(t,i)),te[0]&4&&nt(_,j[2]),te[0]&8&&Pe(z,j[3]),te[0]&524288&&K(I,"over-limit",j[19]),te[0]&524292&&C!==(C=!j[2].trim()||j[19])&&(b.disabled=C)},d(j){j&&(W(e),W(u),W(h)),M&&M.d(),B&&B.d(),X=!1,_e(y)}}}function ni(s){let e,t,n,i,l=st(s[10]),o=[];for(let r=0;r<l.length;r+=1)o[r]=si(Gs(s,l,r));return{c(){e=S("div"),t=S("select");for(let r=0;r<o.length;r+=1)o[r].c();a(t,"class","sy-assistant-select svelte-mogmt"),s[11]===void 0&&Gt(()=>s[51].call(t)),a(e,"class","sy-assistant-scene-select svelte-mogmt")},m(r,c){G(r,e,c),g(e,t);for(let u=0;u<o.length;u+=1)o[u]&&o[u].m(t,null);$n(t,s[11],!0),n||(i=Y(t,"change",s[51]),n=!0)},p(r,c){if(c[0]&1024){l=st(r[10]);let u;for(u=0;u<l.length;u+=1){const h=Gs(r,l,u);o[u]?o[u].p(h,c):(o[u]=si(h),o[u].c(),o[u].m(t,null))}for(;u<o.length;u+=1)o[u].d(1);o.length=l.length}c[0]&3072&&$n(t,r[11])},d(r){r&&W(e),Jn(o,r),n=!1,i()}}}function si(s){let e,t=s[65].name+"",n,i,l;return{c(){e=S("option"),n=Te(t),i=q(),e.__value=l=s[65].code,nt(e,e.__value)},m(o,r){G(o,e,r),g(e,n),g(e,i)},p(o,r){r[0]&1024&&t!==(t=o[65].name+"")&&Pe(n,t),r[0]&1024&&l!==(l=o[65].code)&&(e.__value=l,nt(e,e.__value))},d(o){o&&W(e)}}}function ii(s){let e;return{c(){e=S("div"),a(e,"class","sy-assistant-scene-select svelte-mogmt")},m(t,n){G(t,e,n)},d(t){t&&W(e)}}}function oi(s){let e,t=s[17].text+"",n;return{c(){e=S("div"),n=Te(t),a(e,"class","sy-assistant-button-tooltip svelte-mogmt"),P(e,"left",s[17].x+"px"),P(e,"top",s[17].y+"px")},m(i,l){G(i,e,l),g(e,n)},p(i,l){l[0]&131072&&t!==(t=i[17].text+"")&&Pe(n,t),l[0]&131072&&P(e,"left",i[17].x+"px"),l[0]&131072&&P(e,"top",i[17].y+"px")},d(i){i&&W(e)}}}function sl(s){let e,t,n,i,l,o,r;const c=[Qo,Vo],u=[];function h(m,_){return m[18]?0:1}t=h(s),n=u[t]=c[t](s);let p=!s[18]&&ti(s),d=s[17]&&oi(s);return{c(){e=S("div"),n.c(),i=q(),p&&p.c(),l=q(),d&&d.c(),o=qt(),a(e,"class","sy-assistant-chat-container svelte-mogmt"),P(e,"z-index",s[1]+2)},m(m,_){G(m,e,_),u[t].m(e,null),g(e,i),p&&p.m(e,null),s[57](e),G(m,l,_),d&&d.m(m,_),G(m,o,_),r=!0},p(m,_){let E=t;t=h(m),t===E?u[t].p(m,_):(kn(),Ke(u[E],1,1,()=>{u[E]=null}),wn(),n=u[t],n?n.p(m,_):(n=u[t]=c[t](m),n.c()),Ue(n,1),n.m(e,i)),m[18]?p&&(p.d(1),p=null):p?p.p(m,_):(p=ti(m),p.c(),p.m(e,null)),(!r||_[0]&2)&&P(e,"z-index",m[1]+2),m[17]?d?d.p(m,_):(d=oi(m),d.c(),d.m(o.parentNode,o)):d&&(d.d(1),d=null)},i(m){r||(Ue(n),r=!0)},o(m){Ke(n),r=!1},d(m){m&&(W(e),W(l),W(o)),u[t].d(),p&&p.d(),s[57](null),d&&d.d(m)}}}let jn=500;function il(s){const e=s.match(/source#\[(.*)\]#source/);return e?s.replace(`source#[${e[1]}]#source`,""):s}function li(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 on(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}function ol(s,e,t){let n,i,l="",o=[{sessionId:"",requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],r="",c=null,u=null,h={x:0,y:0,alignRight:!1},p=null,d=!1;ee.setOptions({breaks:!0,gfm:!0});function m(T){try{const F=ee(T);return Ns.sanitize(F)}catch(F){console.warn("Markdown parsing failed, fallback to HTML:",F);try{const Q=T.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return Ns.sanitize(Q)}catch(Q){return console.error("HTML fallback failed:",Q),T}}}let _;function E(T=!1){_&&_.scrollTo({top:_.scrollHeight,behavior:T?"smooth":"auto"})}xi(()=>{E(!1)});let{sessionId:I}=e,z=[],x="",{hasScene:w=!1}=e;function k(){return Re(this,null,function*(){var T;if(w)try{const F=yield fetch("/aiops/aigc/chat/getSceneList",{headers:{"Auth-Token":`${de()}`,Authorization:`bearer ${de()}`}});if(!F.ok)throw new Error("Failed to fetch scenes");const Q=yield F.json();Q.status==="success"&&((T=Q.data)!=null&&T.sceneList)&&(t(10,z=Q.data.sceneList),z.length>0&&t(11,x=z[0].code))}catch(F){console.error("Failed to fetch scenes:",F)}})}gn(()=>{k()});function b(){return Re(this,null,function*(){if(!l.trim()||i)return;if(!I){console.error("No session ID available");return}const T=Date.now().toString(),F=Date.now().toString()+Math.random().toString().slice(2,8),Q={sessionId:I,requestId:F,id:T,type:"user",content:l.trim(),timestamp:Date.now()};t(4,o=[...o,Q]);const fe=l.trim();t(2,l="");const he=(Date.now()+1).toString();r="",t(4,o=[...o,{sessionId:I,requestId:F,id:he,type:"assistant",content:"",timestamp:Date.now()}]),t(8,d=!0),c&&c.abort(),c=new AbortController;try{yield Wi("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({sessionId:I,requestId:F,keyword:fe,flowId:"1",extendKeys:w?{sceneCode:x}:void 0}),signal:c.signal,onmessage(ve){try{const Ee=ve.data;if(Ee){const vt=li(Ee);vt?(t(4,o=o.map(Ge=>Ge.id===he?Ae(le({},Ge),{attachments:vt}):Ge)),E(!0)):(r+=Ee,t(4,o=o.map(Ge=>Ge.id===he?Ae(le({},Ge),{content:r}):Ge)),E(!1))}}catch(Ee){console.error("Failed to process SSE message:",Ee)}},onerror(ve){console.error("SSE error:",ve),c=null,t(8,d=!1)},onclose(){c=null,t(8,d=!1)}})}catch(ve){console.error("Failed to send message:",ve),t(8,d=!1)}})}function v(T,F,Q){const fe=Q.getBoundingClientRect(),he=_.getBoundingClientRect(),ve=fe.left<he.width/2;t(5,u=F),t(6,h={x:fe.left,y:fe.top+fe.height/2,alignRight:ve})}function R(){t(7,p=setTimeout(()=>{t(5,u=null),t(7,p=null)},200))}Ii(()=>{c&&c.abort(),p&&clearTimeout(p)});function L(T,F){return Re(this,null,function*(){try{const Q=yield fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({fileName:T,fileUrl:F})});if(!Q.ok)throw new Error("Download failed");const fe=Q.headers.get("content-type")||"application/octet-stream",he=yield Q.blob(),ve=window.URL.createObjectURL(he),Ee=document.createElement("a");Ee.href=ve,Ee.download=T,document.body.appendChild(Ee),Ee.click(),window.URL.revokeObjectURL(ve),document.body.removeChild(Ee)}catch(Q){console.error("Failed to download file:",Q)}})}let C={};function X(T,F){return Re(this,null,function*(){try{const Q=F.replace(/<br\s*\/?>/g,`
|
48
|
+
`).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();yield navigator.clipboard.writeText(Q),t(12,C[T]=!0,C),setTimeout(()=>{t(12,C[T]=!1,C),t(12,C)},1500)}catch(Q){console.error("Failed to copy:",Q)}})}let y={},M={},B=!1;function j(T,F){return Re(this,null,function*(){if(y[T]===F){t(13,y[T]=null,y),t(13,y);return}if(t(13,y[T]=F,y),t(13,y),F==="like")try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({sessionId:I,requestId:T,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(Q){console.error("Failed to send feedback:",Q),t(13,y[T]=null,y),t(13,y)}else t(15,B=!0)})}function te(T){return Re(this,null,function*(){var F;if((F=M[T])!=null&&F.trim())try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({sessionId:I,requestId:T,feedBackFlag:"0",feedBackContent:M[T]})})).ok)throw new Error("Feedback failed");t(15,B=!1),t(14,M[T]="",M),t(14,M)}catch(Q){console.error("Failed to send feedback:",Q),t(13,y[T]=null,y),t(13,y)}})}let ke={x:0,y:0};function me(T,F){const fe=T.currentTarget.getBoundingClientRect();t(16,ke={x:fe.left-290,y:fe.top-160}),j(F,"dislike")}let Be=null;function re(T,F){const fe=T.currentTarget.getBoundingClientRect();t(17,Be={text:F,x:fe.left+fe.width/2,y:fe.top-8})}function qe(){t(17,Be=null)}let ie=!1,$e=[],ne=Date.now().toString();function Me(){qe(),t(18,ie=!0)}function oe(){qe(),t(18,ie=!1)}function Oe(T){return Re(this,null,function*(){if(!d){t(8,d=!0);try{const F=yield fetch("/aiops/aigc/chat/record/session/detail/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`},body:JSON.stringify({sessionId:T})});if(!F.ok)throw new Error("Failed to load sessions");const Q=yield F.json();if(Q.code===0){ne=T,t(18,ie=!1);const fe=Q.data.map((he,ve)=>{const Ee=li(he.answer),vt=il(he.answer);return[{sessionId:he.sessionId,requestId:he.requestId,id:(Date.now()+2*ve).toString(),type:"user",content:he.keyword,timestamp:new Date(he.createDate).getTime()},{sessionId:he.sessionId,requestId:he.requestId,id:(Date.now()+2*ve+1).toString(),type:"assistant",content:vt,attachments:Ee,timestamp:new Date(he.createDate).getTime()}]});t(4,o=fe.flat())}}catch(F){console.error("Failed to load sessions:",F)}finally{t(8,d=!1)}}})}function xe(){return Re(this,null,function*(){const T=yield et();if(!T){console.error("Failed to create new session");return}ne=T,t(4,o=[{sessionId:ne,requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(2,l="")})}function et(){return Re(this,null,function*(){try{const T=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`}});if(!T.ok)throw new Error("Failed to get session ID");const F=yield T.json();if(F.code===0)return ne=F.data.sessionId,ne;throw new Error(F.message||"Failed to get session ID")}catch(T){return console.error("Failed to get session ID:",T),null}})}let{zIndex:D}=e;const ae=(T,F)=>v(F,T.tips,F.currentTarget),N=T=>L(T.content_title,T.link),Z=()=>{p&&(clearTimeout(p),t(7,p=null))},we=()=>{t(5,u=null)},be=T=>X(T.id,T.content),De=(T,F)=>re(F,C[T.id]?"已复制":"复制内容"),je=T=>j(T.id,"like"),it=(T,F)=>re(F,y[T.id]==="like"?"取消点赞":"点赞"),yt=(T,F)=>me(F,T.id),Tt=(T,F)=>re(F,y[T.id]==="dislike"?"取消点踩":"点踩");function ln(T){M[T.id]=this.value,t(14,M)}const rn=T=>{t(15,B=!1),t(13,y[T.id]=null,y),t(13,y)},Wn=T=>te(T.id);function Ht(T){_t[T?"unshift":"push"](()=>{_=T,t(9,_)})}function ht(){x=Ai(this),t(11,x),t(10,z)}const ot=T=>re(T,"历史会话"),lt=T=>re(T,"新建会话");function an(){l=this.value,t(2,l)}const cn=T=>T.key==="Enter"&&!T.shiftKey&&(b(),T.preventDefault()),un=T=>re(T,"发送消息");function Bt(T){_t[T?"unshift":"push"](()=>{_=T,t(9,_)})}return s.$$set=T=>{"sessionId"in T&&t(36,I=T.sessionId),"hasScene"in T&&t(0,w=T.hasScene),"zIndex"in T&&t(1,D=T.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&4&&t(3,n=l.length),s.$$.dirty[0]&8&&t(19,i=n>jn)},[w,D,l,n,o,u,h,p,d,_,z,x,C,y,M,B,ke,Be,ie,i,m,b,v,R,L,X,j,te,me,re,qe,$e,Me,oe,Oe,xe,I,ae,N,Z,we,be,De,je,it,yt,Tt,ln,rn,Wn,Ht,ht,ot,lt,an,cn,un,Bt]}class ll extends Tn{constructor(e){super(),yn(this,e,ol,sl,pt,{sessionId:36,hasScene:0,zIndex:1},null,[-1,-1,-1])}}function ri(s){let e,t,n,i,l=s[3].title+"",o,r,c,u,h,p,d,m,_,E=s[2]?"退出全屏":"全屏显示",I,z,x,w,k,b,v,R,L=s[7]?"取消吸附":"吸附到边缘",C,X,y,M,B,j,te,ke,me,Be=`${s[3].height}px`,re,qe,ie;function $e(N,Z){return N[2]?al:rl}let ne=$e(s),Me=ne(s);function oe(N,Z){return N[7]?ul:cl}let Oe=oe(s),xe=Oe(s);const et=[hl,fl],D=[];function ae(N,Z){return N[8]?0:1}return ke=ae(s),me=D[ke]=et[ke](s),{c(){var N,Z,we;e=S("div"),t=S("div"),n=S("div"),i=S("h3"),o=Te(l),r=q(),c=S("div"),u=S("div"),h=S("button"),p=J("svg"),Me.c(),m=q(),_=S("span"),I=Te(E),z=q(),x=S("div"),w=S("button"),k=J("svg"),xe.c(),v=q(),R=S("span"),C=Te(L),X=q(),y=S("div"),M=S("button"),M.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>',B=q(),j=S("span"),j.textContent="关闭助手",te=q(),me.c(),a(i,"class","svelte-1427avp"),a(p,"xmlns","http://www.w3.org/2000/svg"),a(p,"width","18"),a(p,"height","18"),a(p,"viewBox","0 0 24 24"),a(p,"fill","none"),a(p,"stroke","currentColor"),a(p,"stroke-width","2"),a(p,"stroke-linecap","round"),a(p,"stroke-linejoin","round"),a(h,"class","sy-assistant-action-button svelte-1427avp"),a(h,"aria-label",d=s[2]?"退出全屏":"全屏显示"),K(h,"active",s[2]),a(_,"class","sy-assistant-tooltip svelte-1427avp"),P(_,"z-index",((N=s[3].zIndex)!=null?N:1e3)+3),a(u,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),a(k,"xmlns","http://www.w3.org/2000/svg"),a(k,"width","18"),a(k,"height","18"),a(k,"viewBox","0 0 24 24"),a(k,"fill","none"),a(k,"stroke","currentColor"),a(k,"stroke-width","2"),a(k,"stroke-linecap","round"),a(k,"stroke-linejoin","round"),a(w,"class","sy-assistant-action-button svelte-1427avp"),a(w,"aria-label",b=s[7]?"取消吸附":"吸附到边缘"),K(w,"active",s[7]),a(R,"class","sy-assistant-tooltip svelte-1427avp"),P(R,"z-index",((Z=s[3].zIndex)!=null?Z:1e3)+3),a(x,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),a(M,"class","sy-assistant-close-button svelte-1427avp"),a(M,"aria-label","关闭助手"),a(j,"class","sy-assistant-tooltip svelte-1427avp"),P(j,"z-index",((we=s[3].zIndex)!=null?we:1e3)+3),a(y,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),a(c,"class","sy-assistant-header-actions svelte-1427avp"),a(n,"class","sy-assistant-drawer-header svelte-1427avp"),a(n,"role","button"),a(n,"tabindex","0"),a(n,"aria-label","拖动助手窗口"),K(n,"dragging",s[6]),K(n,"fullscreen",s[2]),K(n,"snapped",s[7]),a(t,"class","sy-assistant-drawer-content svelte-1427avp"),a(e,"class","sy-assistant-drawer svelte-1427avp"),K(e,"fullscreen",s[2]),P(e,"height",Be)},m(N,Z){G(N,e,Z),g(e,t),g(t,n),g(n,i),g(i,o),g(n,r),g(n,c),g(c,u),g(u,h),g(h,p),Me.m(p,null),g(u,m),g(u,_),g(_,I),g(c,z),g(c,x),g(x,w),g(w,k),xe.m(k,null),g(x,v),g(x,R),g(R,C),g(c,X),g(c,y),g(y,M),g(y,B),g(y,j),g(t,te),D[ke].m(t,null),re=!0,qe||(ie=[Y(h,"click",s[16]),Y(w,"click",s[18]),Y(M,"click",s[15]),Y(n,"mousedown",Kn(s[17]))],qe=!0)},p(N,Z){var be,De,je;(!re||Z[0]&8)&&l!==(l=N[3].title+"")&&Pe(o,l),ne!==(ne=$e(N))&&(Me.d(1),Me=ne(N),Me&&(Me.c(),Me.m(p,null))),(!re||Z[0]&4&&d!==(d=N[2]?"退出全屏":"全屏显示"))&&a(h,"aria-label",d),(!re||Z[0]&4)&&K(h,"active",N[2]),(!re||Z[0]&4)&&E!==(E=N[2]?"退出全屏":"全屏显示")&&Pe(I,E),Z[0]&8&&P(_,"z-index",((be=N[3].zIndex)!=null?be:1e3)+3),Oe!==(Oe=oe(N))&&(xe.d(1),xe=Oe(N),xe&&(xe.c(),xe.m(k,null))),(!re||Z[0]&128&&b!==(b=N[7]?"取消吸附":"吸附到边缘"))&&a(w,"aria-label",b),(!re||Z[0]&128)&&K(w,"active",N[7]),(!re||Z[0]&128)&&L!==(L=N[7]?"取消吸附":"吸附到边缘")&&Pe(C,L),Z[0]&8&&P(R,"z-index",((De=N[3].zIndex)!=null?De:1e3)+3),Z[0]&8&&P(j,"z-index",((je=N[3].zIndex)!=null?je:1e3)+3),(!re||Z[0]&64)&&K(n,"dragging",N[6]),(!re||Z[0]&4)&&K(n,"fullscreen",N[2]),(!re||Z[0]&128)&&K(n,"snapped",N[7]);let we=ke;ke=ae(N),ke===we?D[ke].p(N,Z):(kn(),Ke(D[we],1,1,()=>{D[we]=null}),wn(),me=D[ke],me?me.p(N,Z):(me=D[ke]=et[ke](N),me.c()),Ue(me,1),me.m(t,null)),(!re||Z[0]&4)&&K(e,"fullscreen",N[2]),Z[0]&8&&Be!==(Be=`${N[3].height}px`)&&P(e,"height",Be)},i(N){re||(Ue(me),re=!0)},o(N){Ke(me),re=!1},d(N){N&&W(e),Me.d(),xe.d(),D[ke].d(),qe=!1,_e(ie)}}}function rl(s){let e;return{c(){e=J("path"),a(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&&W(e)}}}function al(s){let e;return{c(){e=J("path"),a(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&&W(e)}}}function cl(s){let e,t;return{c(){e=J("rect"),t=J("line"),a(e,"x","3"),a(e,"y","3"),a(e,"width","18"),a(e,"height","18"),a(e,"rx","2"),a(e,"ry","2"),a(t,"x1","16"),a(t,"y1","6"),a(t,"x2","16"),a(t,"y2","18")},m(n,i){G(n,e,i),G(n,t,i)},d(n){n&&(W(e),W(t))}}}function ul(s){let e,t;return{c(){e=J("rect"),t=J("rect"),a(e,"x","3"),a(e,"y","3"),a(e,"width","18"),a(e,"height","18"),a(e,"rx","2"),a(e,"ry","2"),a(t,"x","12"),a(t,"y","10"),a(t,"width","6"),a(t,"height","8"),a(t,"rx","1"),a(t,"ry","1")},m(n,i){G(n,e,i),G(n,t,i)},d(n){n&&(W(e),W(t))}}}function fl(s){var n;let e,t;return e=new ll({props:{zIndex:(n=s[3].zIndex)!=null?n:1e3,sessionId:s[9],hasScene:s[3].hasScene}}),{c(){bn(e.$$.fragment)},m(i,l){Zt(e,i,l),t=!0},p(i,l){var r;const o={};l[0]&8&&(o.zIndex=(r=i[3].zIndex)!=null?r:1e3),l[0]&512&&(o.sessionId=i[9]),l[0]&8&&(o.hasScene=i[3].hasScene),e.$set(o)},i(i){t||(Ue(e.$$.fragment,i),t=!0)},o(i){Ke(e.$$.fragment,i),t=!1},d(i){Xt(e,i)}}}function hl(s){var n;let e,t;return e=new qs({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:(n=s[3].zIndex)!=null?n:1e3}}),{c(){bn(e.$$.fragment)},m(i,l){Zt(e,i,l),t=!0},p(i,l){var r;const o={};l[0]&256&&(o.onClose=i[26]),l[0]&8&&(o.zIndex=(r=i[3].zIndex)!=null?r:1e3),e.$set(o)},i(i){t||(Ue(e.$$.fragment,i),t=!0)},o(i){Ke(e.$$.fragment,i),t=!1},d(i){Xt(e,i)}}}function pl(s){let e,t,n=`${s[12]}px`,i,l,o,r,c,u,h,p,d,m,_,E,I,z,x=s[12]>0&&ri(s);return{c(){var w,k;e=S("div"),t=S("div"),x&&x.c(),i=q(),l=S("button"),o=J("svg"),r=J("path"),c=J("path"),u=J("path"),h=J("path"),p=J("path"),d=J("path"),m=J("path"),a(t,"class","sy-assistant-drawer-wrapper svelte-1427avp"),K(t,"fullscreen",s[2]),P(t,"width",n),a(r,"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"),a(r,"fill","#6F8698"),a(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"),a(c,"fill","#3677FF"),a(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"),a(u,"fill","#D0D5F1"),a(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"),a(h,"fill","#3677FF"),a(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"),a(p,"fill","#FFFFFF"),a(d,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(d,"fill","#FFFFFF"),a(m,"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"),a(m,"fill","#8896A4"),a(o,"class","sy-assistant-icon"),a(o,"viewBox","0 0 1024 1024"),a(o,"version","1.1"),a(o,"xmlns","http://www.w3.org/2000/svg"),a(o,"width","32"),a(o,"height","32"),a(o,"fill","currentColor"),a(o,"aria-label","助手图标"),a(l,"class","sy-assistant-floating-button svelte-1427avp"),a(l,"aria-label","打开助手"),a(l,"style",_=s[10]+" z-index: "+(((w=s[3].zIndex)!=null?w:1e3)+1)+";"),a(e,"class","sy-assistant-container sy-assistant-theme svelte-1427avp"),K(e,"fullscreen",s[2]),K(e,"snapped",s[7]),P(e,"position",s[3].position),P(e,"right",s[7]?0:`${s[0]}px`),P(e,"bottom",s[7]?0:`${s[1]}px`),P(e,"top",s[7]||s[2]?"0":"auto"),P(e,"left",s[2]?"0":"auto"),P(e,"z-index",(k=s[3].zIndex)!=null?k:1e3)},m(w,k){G(w,e,k),g(e,t),x&&x.m(t,null),g(e,i),g(e,l),g(l,o),g(o,r),g(o,c),g(o,u),g(o,h),g(o,p),g(o,d),g(o,m),s[27](l),s[29](e),E=!0,I||(z=[Y(l,"click",s[15]),Y(l,"mousedown",Kn(s[28]))],I=!0)},p(w,k){var b,v;w[12]>0?x?(x.p(w,k),k[0]&4096&&Ue(x,1)):(x=ri(w),x.c(),Ue(x,1),x.m(t,null)):x&&(kn(),Ke(x,1,1,()=>{x=null}),wn()),(!E||k[0]&4)&&K(t,"fullscreen",w[2]),k[0]&4096&&n!==(n=`${w[12]}px`)&&P(t,"width",n),(!E||k[0]&1032&&_!==(_=w[10]+" z-index: "+(((b=w[3].zIndex)!=null?b:1e3)+1)+";"))&&a(l,"style",_),(!E||k[0]&4)&&K(e,"fullscreen",w[2]),(!E||k[0]&128)&&K(e,"snapped",w[7]),k[0]&8&&P(e,"position",w[3].position),k[0]&129&&P(e,"right",w[7]?0:`${w[0]}px`),k[0]&130&&P(e,"bottom",w[7]?0:`${w[1]}px`),k[0]&132&&P(e,"top",w[7]||w[2]?"0":"auto"),k[0]&4&&P(e,"left",w[2]?"0":"auto"),k[0]&8&&P(e,"z-index",(v=w[3].zIndex)!=null?v:1e3)},i(w){E||(Ue(x),E=!0)},o(w){Ke(x),E=!1},d(w){w&&W(e),x&&x.d(),s[27](null),s[29](null),I=!1,_e(z)}}}const Un=48,ge=20;function dl(s,e,t){let n,i,l,o,r=U,c=()=>(r(),r=Je(i,D=>t(12,o=D)),i);s.$$.on_destroy.push(()=>r());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:ge,bottom:ge},snappedWidth:480,drawerWidth:480,zIndex:1e3,hasScene:!1};let{target:h="body"}=e,{options:p={}}=e,d,m=null,_=!1,E,I=!1,z=0,x=0,w=ge,k=20,b=w,v=k,R=!1,L=ge,C=50,X=!1,y={width:0,height:0,right:0,bottom:0},M=!1,B=!1,j=[],te=null;function ke(){return Re(this,null,function*(){try{const D=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${de()}`,Authorization:`bearer ${de()}`}});if(!D.ok)throw new Error("Failed to get session ID");const ae=yield D.json();if(ae.code===0)return t(9,te=ae.data.sessionId),te;throw new Error(ae.message||"Failed to get session ID")}catch(D){return console.error("Failed to get session ID:",D),null}})}function me(D,ae=!1){ae?t(23,R=!0):t(6,I=!0),z=D.clientX,x=D.clientY,w=ae?L:b,k=ae?C:v,D.preventDefault()}function Be(D){if(!I&&!R)return;const ae=z-D.clientX,N=x-D.clientY;if(R){const Z=w+ae,we=D.clientY;t(24,L=Math.max(ge,Math.min(window.innerWidth-Un-ge,Z)));const be=window.innerHeight-Un-ge,je=Math.max(ge,Math.min(be,we));t(25,C=(window.innerHeight-je-Un)/window.innerHeight*100)}else{const Z=n.width||0,we=n.height||0,be=w+ae;t(0,b=Math.max(ge,Math.min(window.innerWidth-Z-ge,be)));const De=k+N;t(1,v=Math.max(ge,Math.min(window.innerHeight-we-ge,De)))}}function re(){t(6,I=!1),t(23,R=!1)}gn(()=>{typeof h=="string"?m=document.querySelector(h)||document.body:m=h||document.body;const D=N=>Be(N),ae=()=>re();return document.addEventListener("mousemove",D),document.addEventListener("mouseup",ae),d&&m&&m.appendChild(d),E&&E.getBoundingClientRect().left,t(7,M=n.initialState==="snapped"),t(2,X=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,b=0),t(1,v=0),t(3,n=Ae(le({},n),{height:typeof window!="undefined"?window.innerHeight:n.height,width:n.snappedWidth||n.width}))):n.initialState==="fullscreen"&&(t(0,b=0),t(1,v=0),t(3,n=Ae(le({},n),{width:typeof window!="undefined"?window.innerWidth:n.width,height:typeof window!="undefined"?window.innerHeight:n.height}))),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",ae),m&&d&&m.removeChild(d)}});function qe(){return Re(this,null,function*(){_||(yield ke()),t(22,_=!_)})}function ie(){var D,ae,N,Z,we,be,De,je;t(2,X=!X),X?(y.width||(y={width:u.width,height:u.height,right:(ae=(D=u.defaultPosition)==null?void 0:D.right)!=null?ae:ge,bottom:(Z=(N=u.defaultPosition)==null?void 0:N.bottom)!=null?Z:ge}),M&&t(7,M=!1),t(20,p=Ae(le({},n),{width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth})),t(0,b=0),t(1,v=0)):(t(20,p=Ae(le({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,b=(be=(we=u.defaultPosition)==null?void 0:we.right)!=null?be:ge),t(1,v=(je=(De=u.defaultPosition)==null?void 0:De.bottom)!=null?je:ge))}function $e(D){X||me(D)}function ne(){var D,ae,N,Z;X&&(t(2,X=!1),t(20,p=Ae(le({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth}))),t(7,M=!M),M?(n.height,t(0,b=0),t(1,v=0),t(20,p=Ae(le({},n),{height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width}))):(t(20,p=Ae(le({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,b=(ae=(D=u.defaultPosition)==null?void 0:D.right)!=null?ae:ge),t(1,v=(Z=(N=u.defaultPosition)==null?void 0:N.bottom)!=null?Z:ge))}function Me(D){t(8,B=!1)}const oe=()=>t(8,B=!1);function Oe(D){_t[D?"unshift":"push"](()=>{E=D,t(5,E)})}const xe=D=>me(D,!0);function et(D){_t[D?"unshift":"push"](()=>{d=D,t(4,d)})}return s.$$set=D=>{"target"in D&&t(21,h=D.target),"options"in D&&t(20,p=D.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n=Ae(le(le({},u),p),{defaultPosition:le(le({},u.defaultPosition),p.defaultPosition)})),s.$$.dirty[0]&4194316&&c(t(11,i=Ni(_?X?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window!="undefined"&&(t(0,b=Math.max(ge,Math.min(window.innerWidth-(n.width||0),b))),t(1,v=Math.max(ge,Math.min(window.innerHeight-(n.height||0),v)))),s.$$.dirty[0]&62914560&&t(10,l=_?"display: none;":`position: fixed; right: ${L}px; bottom: ${C}%; transform: none; cursor: ${R?"grabbing":"grab"};`)},[b,v,X,n,d,E,I,M,B,te,l,i,o,j,me,qe,ie,$e,ne,Me,p,h,_,R,L,C,oe,Oe,xe,et]}class gl extends Tn{constructor(e){super(),yn(this,e,dl,pl,pt,{target:21,options:20},null,[-1,-1])}}$.SyAssistant=gl,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|