132 lines
220 KiB
JavaScript
132 lines
220 KiB
JavaScript
import{o as e,r as t,t as n}from"./request-xrnk7ZJV.js";import{Cn as r,Er as i,Ft as a,In as o,Ln as s,M as c,N as l,Nn as u,Nr as d,Pr as f,Rn as p,Wn as m,_n as h,jr as g,n as _,t as v,tr as y,wn as b}from"./jsx-runtime-OfKoVykY.js";import{o as x,s as S}from"./chunk-OB3PAWPO-D_lbwNck.js";import{t as C}from"./global-Bo3H1Lqq.js";import{t as w}from"./typography-C81dpVAv.js";import{t as T}from"./tooltip-DI_m69zk.js";import{t as E}from"./config-provider-DDrois2A.js";import{r as D,t as O}from"./PlusOutlined-CKNTdA7h.js";import{t as k}from"./space-JYtHxLjg.js";import{t as A}from"./button-DsOd0cni.js";import{t as j}from"./card-C-jMUkpS.js";import{t as ee}from"./divider-j0hopRxQ.js";import{t as M}from"./dropdown-C2Q1pw1q.js";import{t as N}from"./flex-DlUpxjJi.js";import{t as te}from"./input-BOiVaS7w.js";import{r as ne}from"./CopyOutlined-Bb8Wrh2R.js";import{t as re}from"./UserOutlined-CHErCzr8.js";import{t as ie}from"./useTranslation-C4ZVtLa2.js";import{$ as ae,Ht as P,K as oe,ct as F,et as I,lt as se,mt as L,rn as ce,tt as le}from"./index-DLqXr84t.js";import{t as ue}from"./agent-CGxkD5Jw.js";function de(e,t){this.v=e,this.k=t}function fe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pe(e){if(Array.isArray(e))return e}function R(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function me(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z(e,t){return pe(e)||R(e,t)||he(e,t)||me()}function he(e,t){if(e){if(typeof e==`string`)return fe(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fe(e,t):void 0}}function B(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof de;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}B.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},B.prototype.next=function(e){return this._invoke(`next`,e)},B.prototype.throw=function(e){return this._invoke(`throw`,e)},B.prototype.return=function(e){return this._invoke(`return`,e)};var ge=Object.entries,_e=Object.setPrototypeOf,ve=Object.isFrozen,ye=Object.getPrototypeOf,be=Object.getOwnPropertyDescriptor,V=Object.freeze,H=Object.seal,xe=Object.create,Se=typeof Reflect<`u`&&Reflect,Ce=Se.apply,we=Se.construct;V||=function(e){return e},H||=function(e){return e},Ce||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},we||=function(e){return new e(...[...arguments].slice(1))};var Te=W(Array.prototype.forEach);Array.prototype.indexOf;var Ee=W(Array.prototype.lastIndexOf),De=W(Array.prototype.pop),Oe=W(Array.prototype.push),ke=W(Array.prototype.slice),Ae=W(Array.prototype.splice),je=Array.isArray,Me=Je(Set),Ne=W(Set.prototype.add),Pe=W(Set.prototype.has),Fe=W(String.prototype.toLowerCase),Ie=W(String.prototype.toString),Le=W(String.prototype.match),Re=W(String.prototype.replace),ze=W(String.prototype.indexOf),Be=W(String.prototype.trim),Ve=W(Number.prototype.toString),He=W(Boolean.prototype.toString),Ue=typeof BigInt>`u`?null:W(BigInt.prototype.toString),We=typeof Symbol>`u`?null:W(Symbol.prototype.toString),Ge=W(Object.prototype.hasOwnProperty),Ke=W(Object.prototype.toString),U=W(RegExp.prototype.test),qe=Je(TypeError);function W(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ce(e,t,n)}}function Je(e){return function(){return we(e,[...arguments])}}function G(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fe;if(_e&&_e(e,null),!je(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ve(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ye(e){for(let t=0;t<e.length;t++)Ge(e,t)||(e[t]=null);return e}function Xe(e){let t=xe(null);for(let r of ge(e)){var n=z(r,2);let i=n[0],a=n[1];Ge(e,i)&&(t[i]=je(a)?Ye(a):a&&typeof a==`object`&&a.constructor===Object?Xe(a):a)}return t}function Ze(e){switch(typeof e){case`string`:return e;case`number`:return Ve(e);case`boolean`:return He(e);case`bigint`:return Ue?Ue(e):`0`;case`symbol`:return We?We(e):`Symbol()`;case`undefined`:return Ke(e);case`function`:case`object`:{if(e===null)return Ke(e);let t=e,n=Qe(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Ke(e)}return Ke(e)}default:return Ke(e)}}function Qe(e,t){for(;e!==null;){let n=be(e,t);if(n){if(n.get)return W(n.get);if(typeof n.value==`function`)return W(n.value)}e=ye(e)}function n(){return null}return n}function $e(e,t){for(;e!==null;){let n=be(e,t);if(n)return n.get?W(n.get):null;e=ye(e)}return null}function et(e){try{return U(e,``),!0}catch{return!1}}var tt=V(`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.search.section.select.shadow.slot.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`.split(`.`)),nt=V(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),rt=V([`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`]),it=V([`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`]),at=V(`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`.split(`.`)),ot=V([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),st=V([`#text`]),ct=V(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.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.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),lt=V(`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.dominant-baseline.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.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.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-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.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`.split(`.`)),ut=V(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.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`.split(`.`)),dt=V([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ft=H(/{{[\w\W]*|^[\w\W]*}}/g),pt=H(/<%[\w\W]*|^[\w\W]*%>/g),mt=H(/\${[\w\W]*/g),ht=H(/^data-[\-\w.\u00B7-\uFFFF]+$/),gt=H(/^aria-[\-\w]+$/),_t=H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vt=H(/^(?:\w+script|data):/i),yt=H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bt=H(/^html$/i),xt=H(/^[a-z][.\w]*(-[.\w]+)+$/i),St=H(/<[/\w!]/g),Ct=H(/<[/\w]/g),wt=H(/<\/no(script|embed|frames)/i),Tt=H(/\/>/i),K={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Et=V(G({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Dt=function(){return typeof window>`u`?null:window},Ot=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},kt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},At=function(e,t,n,r){return Ge(e,t)&&je(e[t])?G(r.base?Xe(r.base):{},e[t],r.transform):n},jt=function(e,t,n){let r=Ge(e,t)?e[t]:void 0;return r&&typeof r==`object`?Xe(r):n()};function Mt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Dt(),t=e=>Mt(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==K.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Qe(d,`cloneNode`),p=Qe(d,`remove`),m=Qe(d,`removeAttributeNode`),h=Qe(d,`nextSibling`),g=Qe(d,`childNodes`),_=Qe(d,`parentNode`),v=Qe(d,`shadowRoot`),y=Qe(d,`attributes`),b=o&&o.prototype?Qe(o.prototype,`nodeType`):null,x=o&&o.prototype?Qe(o.prototype,`nodeName`):null,S=o&&o.prototype?Qe(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=$e(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,A=!1,j=0,ee=function(){if(j>0)throw qe(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},M=function(e){ee(),j++;try{return D.createHTML(e)}finally{j--}},N=function(e){ee(),j++;try{return D.createScriptURL(e)}finally{j--}},te=function(){return A||=(k=Ot(u,i),!0),k},ne=n,re=ne.implementation,ie=ne.createNodeIterator,ae=ne.createDocumentFragment,P=ne.getElementsByTagName,oe=r.importNode,F=kt();t.isSupported=typeof ge==`function`&&typeof _==`function`&&re&&re.createHTMLDocument!==void 0;let I=ft,se=pt,L=mt,ce=ht,le=gt,ue=vt,de=yt,fe=xt,pe=_t,R=null,me=G({},[...tt,...nt,...rt,...at,...st]),z=null,he=G({},[...ct,...lt,...ut,...dt]),B=Object.seal(xe(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}})),_e=null,ve=null,ye=Object.seal(xe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),be=!0,Se=!0,Ce=!1,we=!0,Ve=!1,He=!0,Ue=!1,We=!1,Ke=null,W=null,Je=!1,Ye=!1,Nt=!1,Pt=!1,q=!0,Ft=!1,It=`user-content-`,Lt=!0,Rt=!1,zt=null,J={},Bt=null,Vt=G({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ht=null,Ut=G({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Wt=null,Gt=G({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Kt=`http://www.w3.org/1998/Math/MathML`,qt=`http://www.w3.org/2000/svg`,Jt=`http://www.w3.org/1999/xhtml`,Yt=Jt,Xt=!1,Zt=null,Qt=G({},[Kt,qt,Jt],Ie),$t=V([`mi`,`mo`,`mn`,`ms`,`mtext`]),en=G({},$t),tn=V([`annotation-xml`]),nn=G({},tn),rn=G({},[`title`,`style`,`font`,`a`,`script`]),an=null,on=[`application/xhtml+xml`,`text/html`],Y=null,sn=null,cn=n.createElement(`form`),ln=function(e){return e instanceof RegExp||e instanceof Function},un=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(sn&&sn===e)return;e&&typeof e==`object`||(e={}),e=Xe(e),an=on.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=an===`application/xhtml+xml`?Ie:Fe,R=At(e,`ALLOWED_TAGS`,me,{transform:Y}),z=At(e,`ALLOWED_ATTR`,he,{transform:Y}),Zt=At(e,`ALLOWED_NAMESPACES`,Qt,{transform:Ie}),Wt=At(e,`ADD_URI_SAFE_ATTR`,Gt,{transform:Y,base:Gt}),Ht=At(e,`ADD_DATA_URI_TAGS`,Ut,{transform:Y,base:Ut}),Bt=At(e,`FORBID_CONTENTS`,Vt,{transform:Y}),_e=At(e,`FORBID_TAGS`,Xe({}),{transform:Y}),ve=At(e,`FORBID_ATTR`,Xe({}),{transform:Y}),J=Ge(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Xe(e.USE_PROFILES):e.USE_PROFILES:!1,be=e.ALLOW_ARIA_ATTR!==!1,Se=e.ALLOW_DATA_ATTR!==!1,Ce=e.ALLOW_UNKNOWN_PROTOCOLS||!1,we=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ve=e.SAFE_FOR_TEMPLATES||!1,He=e.SAFE_FOR_XML!==!1,Ue=e.WHOLE_DOCUMENT||!1,Ye=e.RETURN_DOM||!1,Nt=e.RETURN_DOM_FRAGMENT||!1,Pt=e.RETURN_TRUSTED_TYPE||!1,Je=e.FORCE_BODY||!1,q=e.SANITIZE_DOM!==!1,Ft=e.SANITIZE_NAMED_PROPS||!1,Lt=e.KEEP_CONTENT!==!1,Rt=e.IN_PLACE||!1,pe=et(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:_t,Yt=typeof e.NAMESPACE==`string`?e.NAMESPACE:Jt,en=jt(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>G({},$t)),nn=jt(e,`HTML_INTEGRATION_POINTS`,()=>G({},tn));let t=jt(e,`CUSTOM_ELEMENT_HANDLING`,()=>xe(null));if(B=xe(null),Ge(t,`tagNameCheck`)&&ln(t.tagNameCheck)&&(B.tagNameCheck=t.tagNameCheck),Ge(t,`attributeNameCheck`)&&ln(t.attributeNameCheck)&&(B.attributeNameCheck=t.attributeNameCheck),Ge(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),H(B),Ve&&(Se=!1),Nt&&(Ye=!0),J&&(R=G({},st),z=xe(null),J.html===!0&&(G(R,tt),G(z,ct)),J.svg===!0&&(G(R,nt),G(z,lt),G(z,dt)),J.svgFilters===!0&&(G(R,rt),G(z,lt),G(z,dt)),J.mathMl===!0&&(G(R,at),G(z,ut),G(z,dt))),ye.tagCheck=null,ye.attributeCheck=null,Ge(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?ye.tagCheck=e.ADD_TAGS:je(e.ADD_TAGS)&&(R===me&&(R=Xe(R)),G(R,e.ADD_TAGS,Y))),Ge(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?ye.attributeCheck=e.ADD_ATTR:je(e.ADD_ATTR)&&(z===he&&(z=Xe(z)),G(z,e.ADD_ATTR,Y))),Ge(e,`ADD_FORBID_CONTENTS`)&&je(e.ADD_FORBID_CONTENTS)&&(Bt===Vt&&(Bt=Xe(Bt)),G(Bt,e.ADD_FORBID_CONTENTS,Y)),Lt&&(R[`#text`]=!0),Ue&&G(R,[`html`,`head`,`body`]),R.table&&(G(R,[`tbody`]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw qe(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw qe(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=M(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=te()),D&&typeof O==`string`&&(O=M(``)));V&&V(e),sn=e},dn=G({},[...nt,...rt,...it]),fn=G({},[...at,...ot]),pn=function(e,t,n){return t.namespaceURI===Jt?e===`svg`:t.namespaceURI===Kt?e===`svg`&&(n===`annotation-xml`||en[n]):!!dn[e]},mn=function(e,t,n){return t.namespaceURI===Jt?e===`math`:t.namespaceURI===qt?e===`math`&&nn[n]:!!fn[e]},hn=function(e,t,n){return t.namespaceURI===qt&&!nn[n]||t.namespaceURI===Kt&&!en[n]?!1:!fn[e]&&(rn[e]||!dn[e])},gn=function(e){let t=E(e),n=Fe(w(e)),r=_(e),i,a;return r&&C(r)===K.element?(i={namespaceURI:E(r)},a=Fe(w(r))):(i={namespaceURI:Yt},a=`template`),Zt[t]?t===qt?pn(n,i,a):t===Kt?mn(n,i,a):t===Jt?hn(n,i,a):!!(an===`application/xhtml+xml`&&Zt[t]):!1},_n=function(e){Oe(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw qe(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},vn=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},yn=function(e){Cn(e);let t=g(e);t&&Te(ke(t),e=>{try{p(e)}catch{}});let n=C(e)===K.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&vn(e,r,i)}},bn=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Oe(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Ye||Nt)try{_n(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},xn=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||z[Y(i)]||vn(e,r,i)}},Sn=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===K.element){let t=v(e);Rn(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Cn=function(e){Sn(e,e=>{C(e)===K.element&&xn(e)})},wn=function(e){let t=[];return Sn(e,e=>{t.push(e)},!0),t},Tn=function(e,t){let n=Me();Te(wn(e),e=>{C(e)===K.element&&Ne(n,e)}),Te(t,e=>{C(e)===K.element&&!Pe(n,e)&&xn(e)})},En=function(e,n){let r=!1;return Te(t.removed,t=>{t.element&&(r||=t.element===e,Cn(t.element))}),Tn(e,n),r},Dn=function(e,t){let n=zt,r=null,i=()=>(r||(r=Me(),Te(t,e=>{Ne(r,e)})),r);for(let t=0;;t++){let r=wn(e),a=[e],o=!1;if(Te(r,e=>{C(e)===K.documentFragment?Oe(a,e):!o&&!Pe(n,e)&&(o=Pe(i(),e))}),!o)return;if(t>=8)throw qe(`the tree kept changing during in-place sanitization; refusing to return it`);Te(a,(t,n)=>{On(t,n>0,e,i())})}},On=function(e,t,n,r){let i=Nn(e),a;for(;a=i.nextNode();)Pe(r,a)&&!Pe(zt,a)&&(t&&Bn(F.uponSanitizeShadowNode,a,null),Kn(a,n),$n(a,n),Rn(a.content)&&er(a.content))},kn=function(e){zt&&Ne(zt,e)},An=function(e,t){return He?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},jn=function(e){He&&Sn(e,e=>{let t=C(e);if(t===K.processingInstruction||t===K.comment&&U(Ct,e.data)){try{p(e)}catch{}return!1}if(t===K.element){let t=e,n=Y(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&An(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Mn=function(e){let t=null,r=null;if(Je)e=`<remove></remove>`+e;else{let t=Le(e,/^[\r\n\t ]+/);r=t&&t[0]}an===`application/xhtml+xml`&&Yt===Jt&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?M(e):e;if(Yt===Jt)try{t=new l().parseFromString(i,an)}catch{}if(!t||!t.documentElement){t=re.createDocument(Yt,`template`,null);try{t.documentElement.innerHTML=Xt?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Yt===Jt?P.call(t,Ue?`html`:`body`)[0]:Ue?t.documentElement:a},Nn=function(e){let t=S?S(e):e.ownerDocument;return ie.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Pn=function(e){return e=Re(e,I,` `),e=Re(e,se,` `),e=Re(e,L,` `),e},Fn=function(e){In(e);let t=e.querySelectorAll?.call(e,`template`);t&&Te(t,e=>{Rn(e.content)&&Fn(e.content)})},In=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ie.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Pn(r.data),r=n.nextNode()},Ln=function(e){let t=x?x(e):null;return typeof t!=`string`||Y(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Rn=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===K.documentFragment}catch{return!1}},zn=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Bn(e,n,r){e.length!==0&&Te(e,e=>{e.call(t,n,r,sn)})}let Vn=function(e,t){return!!(He&&e.hasChildNodes()&&!zn(e.firstElementChild)&&U(St,e.textContent)&&U(St,e.innerHTML)||He&&Et[t]&&C(e)===K.element&&E(e)===Jt&&(zn(e.firstElementChild)||typeof e.textContent==`string`&&U(St,e.textContent))||e.nodeType===K.processingInstruction||He&&e.nodeType===K.comment&&U(Ct,e.data))},Hn=function(e,t){return e instanceof RegExp?U(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Un=function(e,t,n){if(!_e[t]&&Yn(t)&&Hn(B.tagNameCheck,t))return!1;if(Lt&&!Bt[t]&&!Bt[Fe(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return _n(e),!0},Wn=function(e,t,n,r){return e.length===0?t:t===n||t===r?Xe(t):t},Gn=function(e,t){return e===t||_(e)!==null?!1:(Rt&&Cn(e),!0)},Kn=function(e,n){if(kn(e),Bn(F.beforeSanitizeElements,e,null),Gn(e,n))return!0;if(Ln(e))return _n(e),!0;let r=Y(w(e));if(R=Wn(F.uponSanitizeElement,R,me,Ke),Bn(F.uponSanitizeElement,e,{tagName:r,allowedTags:R}),Gn(e,n))return!0;if(Vn(e,r))return _n(e),!0;if(_e[r]||!(ye.tagCheck instanceof Function&&ye.tagCheck(r))&&!R[r]){let t=Un(e,r,n);return t===!1&&(Bn(F.afterSanitizeElements,e,null),Gn(e,n))?!0:t}if(C(e)===K.element&&!gn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&U(wt,e.innerHTML))return _n(e),!0;if(Ve&&e.nodeType===K.text){let n=Pn(e.textContent);e.textContent!==n&&(Oe(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Bn(F.afterSanitizeElements,e,null),Gn(e,n)},qn=function(e,t,r){if(ve[t]||An(t,e)||q&&(t===`id`||t===`name`)&&(r in n||r in cn))return!1;let i=z[t]||ye.attributeCheck instanceof Function&&ye.attributeCheck(t,e);return Se&&U(ce,t)||be&&U(le,t)?!0:i?Wt[t]||U(pe,Re(r,de,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ze(r,`data:`)===0&&Ht[e]||Ce&&!U(ue,Re(r,de,``))?!0:!r:Yn(e)&&Hn(B.tagNameCheck,e)&&Hn(B.attributeNameCheck,t,e)||t===`is`&&B.allowCustomizedBuiltInElements&&Hn(B.tagNameCheck,r)},Jn=G({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Yn=function(e){return!Jn[Fe(e)]&&U(fe,e)},Xn=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return M(r);case`TrustedScriptURL`:return N(r)}return r},Zn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Ln(e)||(_n(e),!1)}catch{return bn(t,e),!1}},Qn=function(e,t){return He&&U(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Fe(e)===`attributename`&&Le(t,`href`)!==null},$n=function(e,n){if(Bn(F.beforeSanitizeAttributes,e,null),Gn(e,n))return;let r=e.attributes;if(!r||Ln(e))return;z=Wn(F.uponSanitizeAttribute,z,he,W);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},a=r.length,o=Y(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=Y(s),d=l,f=s===`value`?d:Be(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Bn(F.uponSanitizeAttribute,e,i),f=i.attrValue,Ft&&(u===`id`||u===`name`)&&ze(f,It)!==0&&(bn(s,e,n),f=It+f,p=!0),Qn(s,f)?bn(s,e,n):i.forceKeepAttr||(i.keepAttr?!we&&U(Tt,f)?bn(s,e,n):(Ve&&(f=Pn(f)),qn(o,u,f)?(f=Xn(o,u,c,f),f!==d&&Zn(e,s,c,f)&&p&&De(t.removed)):bn(s,e,n)):bn(s,e,n))}Bn(F.afterSanitizeAttributes,e,null),Gn(e,n)},er=function(e){let t=null,n=Nn(e);for(Bn(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Bn(F.uponSanitizeShadowNode,t,null),Kn(t,e),$n(t,e),Rn(t.content)&&er(t.content),C(t)===K.element){let e=v(t);Rn(e)&&(tr(e),er(e))}Ve&&In(e),Bn(F.afterSanitizeShadowDOM,e,null)},tr=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){er(e.shadow);continue}let n=e.node,r=C(n)===K.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&Y(e)===`template`){let e=n.content;Rn(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Rn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Xt=!e,Xt&&(e=`<!-->`),typeof e!=`string`&&!zn(e)&&(e=Ze(e),typeof e!=`string`))throw qe(`dirty is not a string, aborting`);if(!t.isSupported)return e;We?(R=Ke,z=W):un(n),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(R=Xe(R)),F.uponSanitizeAttribute.length>0&&(z=Xe(z)),t.removed=[];let c=Rt&&typeof e!=`string`&&zn(e),l=[],u=zt;if(c){jn(e);let t=w(e);if(typeof t==`string`){let n=Y(t);if(!R[n]||_e[n])throw yn(e),qe(`root node is forbidden and cannot be sanitized in-place`)}if(Ln(e))throw yn(e),qe(`root node is clobbered and cannot be sanitized in-place`);l=wn(e),zt=Me()}else if(zn(e))i=Mn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===K.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),tr(i);else{if(!Ye&&!Ve&&!Ue&&e.indexOf(`<`)===-1)return D&&Pt?M(e):e;if(i=Mn(e),!i)return Ye?null:Pt?O:``}i&&Je&&_n(i.firstChild);let d=c?e:i;try{c&&tr(e);let t=Nn(d);for(;o=t.nextNode();)Kn(o,d),$n(o,d),Rn(o.content)&&er(o.content);c&&Dn(e,l)}catch(t){throw c&&(yn(e),En(e,l)),t}finally{zt=u}if(c){if(En(e,l))throw qe(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Ve&&Fn(e),e}if(Ye){if(Ve&&Fn(i),Nt)for(s=ae.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(z.shadowroot||z.shadowrootmode)&&(s=oe.call(r,s,!0)),s}let f=Ue?i.outerHTML:i.innerHTML;return Ue&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&U(bt,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
`+f),Ve&&(f=Pn(f)),D&&Pt?M(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};un(e),We=!0,Ke=R,W=z},t.clearConfig=function(){sn=null,We=!1,Ke=null,W=null,D=k,O=``},t.isValidAttribute=function(e,t,n){sn||un({});let r=Y(e),i=Y(t);return typeof n==`string`&&(Qn(t,n)||!we&&U(Tt,n))?!1:qn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Ge(F,e)&&Oe(F[e],t)},t.removeHook=function(e,t){if(Ge(F,e)){if(t!==void 0){let n=Ee(F[e],t);return n===-1?void 0:Ae(F[e],n,1)[0]}return De(F[e])}},t.removeHooks=function(e){Ge(F,e)&&(F[e]=[])},t.removeAllHooks=function(){F=kt()},t}var Nt=Mt(),Pt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var t=`accept acceptCharset accessKey action allowFullScreen allowTransparency
|
|
alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
|
|
charSet checked classID className colSpan cols content contentEditable contextMenu
|
|
controls coords crossOrigin data dateTime default defer dir disabled download draggable
|
|
encType form formAction formEncType formMethod formNoValidate formTarget frameBorder
|
|
headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity
|
|
is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media
|
|
mediaGroup method min minLength multiple muted name noValidate nonce open
|
|
optimum pattern placeholder poster preload radioGroup readOnly rel required
|
|
reversed role rowSpan rows sandbox scope scoped scrolling seamless selected
|
|
shape size sizes span spellCheck src srcDoc srcLang srcSet start step style
|
|
summary tabIndex target title type useMap value width wmode wrap onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown
|
|
onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick
|
|
onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown
|
|
onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
|
|
onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
|
|
onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
|
|
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad
|
|
onPointerDown onPointerMove onPointerUp onPointerCancel onPointerEnter onPointerLeave onPointerOver onPointerOut onGotPointerCapture onLostPointerCapture
|
|
onAnimationStart onAnimationEnd onAnimationIteration
|
|
onTransitionEnd onTransitionRun onTransitionStart onTransitionCancel
|
|
onBeforeInput onReset onInvalid
|
|
onAuxClick onToggle onBeforeToggle onCancel onClose onResize onScrollEnd`.split(/[\s\n]+/),n=`aria-`,r=`data-`;function i(e,t){return e.indexOf(t)===0}function a(e,a=!1){let o;o=a===!1?{aria:!0,data:!0,attr:!0}:a===!0?{aria:!0}:{...a};let s={};return Object.keys(e).forEach(a=>{(o.aria&&(a===`role`||i(a,n))||o.data&&i(a,r)||o.attr&&t.includes(a))&&(s[a]=e[a])}),s}})),q=e(f());function Ft(e,t){return(0,q.useImperativeHandle)(e,()=>{let e=t(),{nativeElement:n}=e;return new Proxy(n,{get(t,n){return e[n]?e[n]:Reflect.get(t,n)}})})}var It=q.createContext({}),Lt={classNames:{},styles:{},className:``,style:{},shortcutKeys:{}},Rt=e=>{let t=q.useContext(It);return q.useMemo(()=>({...Lt,...t[e]}),[t[e]])};t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.preMessage=void 0;var t={},n=[],r=e=>{n.push(e)};e.preMessage=r;function i(e,t){}function a(e,t){}function o(){t={}}function s(e,n,r){!n&&!t[r]&&(e(!1,r),t[r]=!0)}function c(e,t){s(i,e,t)}function l(e,t){s(a,e,t)}c.preMessage=r,c.resetWarned=o,c.noteOnce=l,e.default=c}))();function zt(){}var J=zt,Bt=(0,q.createContext)(void 0),Vt=t(((e,t)=>{function n(e){return e&&e.__esModule?e:{default:e}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Ht=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={items_per_page:`/ page`,jump_to:`Go to`,jump_to_confirm:`confirm`,page:`Page`,prev_page:`Previous Page`,next_page:`Next Page`,prev_5:`Previous 5 Pages`,next_5:`Next 5 Pages`,prev_3:`Previous 3 Pages`,next_3:`Next 3 Pages`,page_size:`Page Size`}})),Ut=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.commonLocale=void 0,e.commonLocale={yearFormat:`YYYY`,dayFormat:`D`,cellMeridiemFormat:`A`,monthBeforeYear:!0}})),Wt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={...Ut().commonLocale,locale:`en_US`,today:`Today`,now:`Now`,backToToday:`Back to today`,ok:`OK`,clear:`Clear`,week:`Week`,month:`Month`,year:`Year`,timeSelect:`select time`,dateSelect:`select date`,weekSelect:`Choose a week`,monthSelect:`Choose a month`,yearSelect:`Choose a year`,decadeSelect:`Choose a decade`,previousMonth:`Previous month`,nextMonth:`Next month`,previousYear:`Last year`,nextYear:`Next year`,previousDecade:`Last decade`,nextDecade:`Next decade`,previousCentury:`Last century`,nextCentury:`Next century`}})),Gt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={placeholder:`Select time`,rangePlaceholder:[`Start time`,`End time`]}})),Kt=t((e=>{var t=Vt().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(Wt()),r=t(Gt());e.default={lang:{placeholder:`Select date`,yearPlaceholder:`Select year`,quarterPlaceholder:`Select quarter`,monthPlaceholder:`Select month`,weekPlaceholder:`Select week`,rangePlaceholder:[`Start date`,`End date`],rangeYearPlaceholder:[`Start year`,`End year`],rangeQuarterPlaceholder:[`Start quarter`,`End quarter`],rangeMonthPlaceholder:[`Start month`,`End month`],rangeWeekPlaceholder:[`Start week`,`End week`],...n.default},timePickerLocale:{...r.default}}})),qt=t((e=>{var t=Vt().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=t(Kt()).default})),Jt=t((e=>{var t=Vt().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(Ht()),r=t(qt()),i=t(Kt()),a=t(Gt()),o="${label} is not a valid ${type}";e.default={locale:`en`,Pagination:n.default,DatePicker:i.default,TimePicker:a.default,Calendar:r.default,global:{placeholder:`Please select`,close:`Close`,sortable:`sortable`,show:`Show`,hide:`Hide`},Table:{filterTitle:`Filter menu`,filterConfirm:`OK`,filterReset:`Reset`,filterEmptyText:`No filters`,filterCheckAll:`Select all items`,filterSearchPlaceholder:`Search in filters`,emptyText:`No data`,selectAll:`Select current page`,selectInvert:`Invert current page`,selectNone:`Clear all data`,selectionAll:`Select all data`,sortTitle:`Sort`,expand:`Expand row`,collapse:`Collapse row`,triggerDesc:`Click to sort descending`,triggerAsc:`Click to sort ascending`,cancelSort:`Click to cancel sorting`},Tour:{Next:`Next`,Previous:`Previous`,Finish:`Finish`},Modal:{okText:`OK`,cancelText:`Cancel`,justOkText:`OK`},Popconfirm:{okText:`OK`,cancelText:`Cancel`},Transfer:{titles:[``,``],searchPlaceholder:`Search here`,itemUnit:`item`,itemsUnit:`items`,remove:`Remove`,selectCurrent:`Select current page`,removeCurrent:`Remove current page`,selectAll:`Select all data`,deselectAll:`Deselect all data`,removeAll:`Remove all data`,selectInvert:`Invert current page`},Upload:{uploading:`Uploading...`,removeFile:`Remove file`,uploadError:`Upload error`,previewFile:`Preview file`,downloadFile:`Download file`},Empty:{description:`No data`},Icon:{icon:`icon`},Text:{edit:`Edit`,copy:`Copy`,copied:`Copied`,expand:`Expand`,collapse:`Collapse`},Carousel:{prevSlide:`Previous slide`,nextSlide:`Next slide`},Form:{optional:`(optional)`,defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:o,method:o,array:o,object:o,number:o,date:o,boolean:o,integer:o,float:o,regexp:o,email:o,url:o,hex:o},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},QRCode:{expired:`QR code expired`,refresh:`Refresh`,scanned:`Scanned`},ColorPicker:{presetEmpty:`Empty`,transparent:`Transparent`,singleColor:`Single`,gradientColor:`Gradient`}}})),Yt=t(((e,t)=>{t.exports=Jt()})),Xt={locale:`en`,Conversations:{create:`New chat`},Sender:{stopLoading:`Stop loading`,speechRecording:`Speech recording`},Actions:{feedbackLike:`Like`,feedbackDislike:`Dislike`,audio:`Play audio`,audioRunning:`Audio playing`,audioError:`Playback error`,audioLoading:`Loading audio`},Bubble:{editableOk:`OK`,editableCancel:`Cancel`},Mermaid:{zoomIn:`Zoom in`,zoomOut:`Zoom out`,zoomReset:`Reset`,download:`Download`,code:`Code`,image:`Image`},Folder:{selectFile:`Please select a file`,loadError:`Failed to load file`,noService:`File content service not configured`,loadFailed:`Failed to load file`}},Zt=e(Yt()),Qt=(e,t)=>{let n=q.useContext(Bt);return[q.useMemo(()=>{let r=t||Xt?.[e]||Zt.default?.[e],i=n?.[e]??{};return{...typeof r==`function`?r():r,...i||{}}},[e,t,n]),q.useMemo(()=>{let e=n?.locale;return n?.exist&&!e?Xt.locale:e},[n])]};function $t(){let{getPrefixCls:e,direction:t,csp:n,iconPrefixCls:r,theme:i}=q.useContext(E.ConfigContext);return{theme:i,getPrefixCls:e,direction:t,csp:n,iconPrefixCls:r}}var en=1e3,tn=4,nn=140,rn=nn/2,an=250,on=500,Y=.8;function sn({className:e}){let[t]=Qt(`Sender`,Xt.Sender);return q.createElement(`svg`,{color:`currentColor`,viewBox:`0 0 ${en} ${en}`,xmlns:`http://www.w3.org/2000/svg`,className:e},q.createElement(`title`,null,t.speechRecording),Array.from({length:tn}).map((e,t)=>{let n=t*286.66666666666663,r=en/2-an/2,i=en/2-on/2;return q.createElement(`rect`,{fill:`currentColor`,rx:rn,ry:rn,height:an,width:nn,x:n,y:r,key:t},q.createElement(`animate`,{attributeName:`height`,values:`${an}; ${on}; ${an}`,keyTimes:`0; 0.5; 1`,dur:`${Y}s`,begin:`${Y/tn*t}s`,repeatCount:`indefinite`}),q.createElement(`animate`,{attributeName:`y`,values:`${r}; ${i}; ${r}`,keyTimes:`0; 0.5; 1`,dur:`${Y}s`,begin:`${Y/tn*t}s`,repeatCount:`indefinite`}))}))}var cn=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(y());function n(e){return e&&e.__esModule?e:{default:e}}var r;e.default=()=>(r===void 0&&(r=(0,t.default)()),r)}))()),ln=()=>{let[e,t]=q.useState(!1);return q.useEffect(()=>{t((0,cn.default)())},[]),e},un=e=>({[e.componentCls]:{[`${e.antCls}-motion-collapse-legacy`]:{overflow:`hidden`,"&-active":{transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},
|
|
opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}},[`${e.antCls}-motion-collapse`]:{overflow:`hidden`,transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},
|
|
opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}}}),dn=`2.9.0`,fn={blue:`#1677FF`,purple:`#722ED1`,cyan:`#13C2C2`,green:`#52C41A`,magenta:`#EB2F96`,pink:`#EB2F96`,red:`#F5222D`,orange:`#FA8C16`,yellow:`#FADB14`,volcano:`#FA541C`,geekblue:`#2F54EB`,gold:`#FAAD14`,lime:`#A0D911`,colorPrimary:`#1677ff`,colorSuccess:`#52c41a`,colorWarning:`#faad14`,colorError:`#ff4d4f`,colorInfo:`#1677ff`,colorLink:``,colorTextBase:``,colorBgBase:``,fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
'Noto Color Emoji'`,fontFamilyCode:`'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,fontSize:14,lineWidth:1,lineType:`solid`,motionUnit:.1,motionBase:0,motionEaseOutCirc:`cubic-bezier(0.08, 0.82, 0.17, 1)`,motionEaseInOutCirc:`cubic-bezier(0.78, 0.14, 0.15, 0.86)`,motionEaseOut:`cubic-bezier(0.215, 0.61, 0.355, 1)`,motionEaseInOut:`cubic-bezier(0.645, 0.045, 0.355, 1)`,motionEaseOutBack:`cubic-bezier(0.12, 0.4, 0.29, 1.46)`,motionEaseInBack:`cubic-bezier(0.71, -0.46, 0.88, 0.6)`,motionEaseInQuint:`cubic-bezier(0.755, 0.05, 0.855, 0.06)`,motionEaseOutQuint:`cubic-bezier(0.23, 1, 0.32, 1)`,borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0};function pn(e){return e>=0&&e<=255}function mn(e,t){let{r:n,g:r,b:i,a}=new h(e).toRgb();if(a<1)return e;let{r:o,g:s,b:c}=new h(t).toRgb();for(let e=.01;e<=1;e+=.01){let t=Math.round((n-o*(1-e))/e),a=Math.round((r-s*(1-e))/e),l=Math.round((i-c*(1-e))/e);if(pn(t)&&pn(a)&&pn(l))return new h({r:t,g:a,b:l,a:Math.round(e*100)/100}).toRgbString()}return new h({r:n,g:r,b:i,a:1}).toRgbString()}function hn(e){let{override:t,...n}=e,r={...t};Object.keys(fn).forEach(e=>{delete r[e]});let i={...n,...r},a=1200,o=1600;return i.motion===!1&&(i.motionDurationFast=`0s`,i.motionDurationMid=`0s`,i.motionDurationSlow=`0s`),{...i,colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:mn(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:mn(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:mn(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:mn(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:`none`,linkHoverDecoration:`none`,linkFocusDecoration:`none`,controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:`
|
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowSecondary:`
|
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowTertiary:`
|
|
0 1px 2px 0 rgba(0, 0, 0, 0.03),
|
|
0 1px 6px -1px rgba(0, 0, 0, 0.02),
|
|
0 2px 4px 0 rgba(0, 0, 0, 0.02)
|
|
`,screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:a,screenXLMin:a,screenXLMax:1599,screenXXL:o,screenXXLMin:o,boxShadowPopoverArrow:`2px 2px 5px rgba(0, 0, 0, 0.05)`,boxShadowCard:`
|
|
0 1px 2px -2px ${new h(`rgba(0, 0, 0, 0.16)`).toRgbString()},
|
|
0 3px 6px 0 ${new h(`rgba(0, 0, 0, 0.12)`).toRgbString()},
|
|
0 5px 12px 4px ${new h(`rgba(0, 0, 0, 0.09)`).toRgbString()}
|
|
`,boxShadowDrawerRight:`
|
|
-6px 0 16px 0 rgba(0, 0, 0, 0.08),
|
|
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
|
-9px 0 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowDrawerLeft:`
|
|
6px 0 16px 0 rgba(0, 0, 0, 0.08),
|
|
3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
|
9px 0 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowDrawerUp:`
|
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowDrawerDown:`
|
|
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowTabsOverflowLeft:`inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)`,boxShadowTabsOverflowRight:`inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)`,boxShadowTabsOverflowTop:`inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)`,boxShadowTabsOverflowBottom:`inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)`,...r}}var gn={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},_n={motionBase:!0,motionUnit:!0},vn=p(se.defaultAlgorithm),yn={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},bn=(e,t,n)=>{let r=n.getDerivativeToken(e),{override:i,...a}=t,o={...r,override:i};return o=hn(o),a&&Object.entries(a).forEach(([e,t])=>{let{theme:n,...r}=t,i=r;n&&(i=bn({...o,...r},{override:r},n)),o[e]=i}),o};function xn(){let{token:e,hashed:t,theme:n,override:r,cssVar:i,zeroRuntime:a}=q.useContext(se._internalContext),s={prefix:i?.prefix??`ant`,key:i?.key??`css-var-root`},c=n||vn,[l,u,d]=o(c,[se.defaultSeed,e],{salt:`${dn}-${t||``}`,override:r,getComputedToken:bn,cssVar:{...s,unitless:gn,ignore:_n,preserve:yn}});return[c,d,t?u:``,l,s,!!a]}function Sn(){let[e,t,n]=xn();return{theme:e,token:t,hashId:n}}var{genStyleHooks:Cn,genComponentStyleHook:wn,genSubStyleComponent:Tn}=r({usePrefix:()=>{let{getPrefixCls:e,iconPrefixCls:t}=$t();return{iconPrefixCls:t,rootPrefixCls:e()}},useToken:()=>{let[e,t,n,r,i,a]=xn();return{theme:e,realToken:t,hashId:n,token:r,cssVar:i,zeroRuntime:a}},useCSP:()=>{let{csp:e}=$t();return e??{}},layer:{name:`antdx`}}),En=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e,t){let n=Object.assign({},e);return Array.isArray(t)&&t.forEach(e=>{delete n[e]}),n}})),Dn=q.createContext({});function On(e){let t=getComputedStyle(e).display;return t===`block`||t===`flex`||t===`list-item`||t===`table`}function kn(e){let t=[``],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;n.nextNode();){let e=n.currentNode;e.nodeType===Node.TEXT_NODE?t[t.length-1]+=e.textContent:e.tagName===`BR`&&e.parentNode?.childElementCount===1||e.tagName!==`BR`&&!On(e)||t.push(``)}return t.join(`
|
|
`)}var An=({content:e,prefixCls:t,okText:n,cancelText:r,onEditConfirm:i,onEditCancel:a})=>{let o=q.useRef(null),[s]=Qt(`Bubble`,Xt.Bubble),c=g(()=>{i?.(kn(o.current))}),l=g(()=>a?.());if(q.useEffect(()=>{o.current.textContent=e,o.current.focus();let t=window.getSelection(),n=document.createRange();n.selectNodeContents(o.current),n.collapse(!1),t.removeAllRanges(),t.addRange(n)},[]),typeof e!=`string`)throw Error(`Content of editable Bubble should be string`);let u=q.useMemo(()=>q.createElement(`div`,{ref:o,contentEditable:!0}),[]);return q.createElement(q.Fragment,null,u,q.createElement(N,{rootClassName:`${t}-editing-opts`,gap:8},q.createElement(A,{type:`primary`,shape:`round`,size:`small`,onClick:c},n||s.editableOk),q.createElement(A,{type:`text`,shape:`round`,size:`small`,onClick:l},r||s.editableCancel)))},jn=({prefixCls:e})=>q.createElement(`span`,{className:`${e}-dot`},q.createElement(`i`,{className:`${e}-dot-item`,key:`item-1`}),q.createElement(`i`,{className:`${e}-dot-item`,key:`item-2`}),q.createElement(`i`,{className:`${e}-dot-item`,key:`item-3`})),Mn=new u(`loadingMove`,{"0%":{transform:`translateY(0)`},"10%":{transform:`translateY(4px)`},"20%":{transform:`translateY(0)`},"30%":{transform:`translateY(-4px)`},"40%":{transform:`translateY(0)`}}),Nn=new u(`cursorBlink`,{"0%":{opacity:1},"50%":{opacity:0},"100%":{opacity:1}}),Pn=new u(`fadeIn`,{"0%":{opacity:0},"100%":{opacity:1}}),Fn=e=>{let{componentCls:t,fontSize:n,typingContent:r,typingAnimationDuration:i,typingAnimationName:a,lineHeight:o,paddingSM:c,colorText:l,calc:u}=e;return[{[t]:{display:`flex`,columnGap:c,[`&${t}-rtl`]:{direction:`rtl`},[`&${t}-loading`]:{alignItems:`center`},[`${t}-body`]:{display:`flex`,flexDirection:`column`,maxWidth:`100%`},[`${t}-content`]:{position:`relative`,boxSizing:`border-box`,minWidth:0,maxWidth:`100%`,minHeight:u(c).mul(2).add(u(o).mul(n)).equal(),paddingInline:`${s(e.padding)}`,paddingBlock:`${s(c)}`,color:l,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:`break-word`,"&-string":{whiteSpace:`pre-wrap`}},[`${t}-typing:last-child::after`]:{content:r,fontWeight:900,userSelect:`none`,opacity:1,marginInlineStart:`0.1em`,animationName:a,animationDuration:s(i),animationIterationCount:`infinite`,animationTimingFunction:`linear`},[`${t}-fade-in .fade-in`]:{display:`inline`,animationName:Pn,animationDuration:`1s`,animationTimingFunction:`linear`},[`${t}-dot`]:{position:`relative`,height:e.controlHeight,display:`flex`,alignItems:`center`,columnGap:e.marginXS,padding:`0 ${s(e.paddingXXS)}`,alignSelf:`center`,"&-item":{backgroundColor:e.colorPrimary,borderRadius:`100%`,width:4,height:4,animationName:Mn,animationDuration:`2s`,animationIterationCount:`infinite`,animationTimingFunction:`linear`,"&:nth-child(1)":{animationDelay:`0s`},"&:nth-child(2)":{animationDelay:`0.2s`},"&:nth-child(3)":{animationDelay:`0.4s`}}},[`&${t}-start`]:{flexDirection:`row`,alignSelf:`flex-start`,[`& ${t}-header`]:{flexDirection:`row`}},[`&${t}-end`]:{flexDirection:`row-reverse`,alignSelf:`flex-end`,[`& ${t}-header`]:{flexDirection:`row-reverse`},[`& ${t}-editing-opts`]:{flexDirection:`row-reverse`}}}},Nn]},In=e=>{let{componentCls:t}=e;return{[t]:{[`${t}-content`]:{"&-filled":{backgroundColor:e.colorFillContent},"&-outlined":{border:`1px solid ${e.colorBorderSecondary}`},"&-shadow":{boxShadow:e.boxShadowTertiary},"&-borderless":{backgroundColor:`transparent`,padding:0,minHeight:0}}}}},Ln=e=>{let{componentCls:t,fontSize:n,lineHeight:r,paddingSM:i,borderRadius:a,calc:o}=e,s=o(n).mul(r).div(2).add(i).equal(),c=o(a).mul(2).equal(),l=`${t}-content`;return{[t]:{[l]:{"&-default":{borderRadius:{_skip_check_:!0,value:c}},"&-round":{borderRadius:{_skip_check_:!0,value:s}},"&-corner":{borderRadius:{_skip_check_:!0,value:c}},"&-editing":{"div:first-child":{outline:`none`},[`${t}-editing-opts`]:{marginBlockStart:e.marginSM,"button:last-child":{backgroundColor:e.colorBgContainer,"&:hover":{backgroundColor:e.colorBgLayout}}}}},[`&${t}-start ${t}-content-corner`]:{borderStartStartRadius:e.borderRadiusXS},[`&${t}-end ${t}-content-corner`]:{borderStartEndRadius:e.borderRadiusXS}}}},Rn=e=>{let{componentCls:t}=e;return{[t]:{"&-divider":{width:`100%`,justifyContent:`center`,[`& ${t}-body`]:{width:`100%`}}}}},zn=e=>{let{componentCls:t}=e;return{[`${t}-list`]:{maxHeight:`100%`,width:`100%`,boxSizing:`border-box`,[`& ${t}`]:{width:`100%`,boxSizing:`border-box`,paddingBlock:e.padding},[`& ${t}-start:not(${t}-divider):not(${t}-system)`]:{paddingInlineEnd:`15%`},[`& ${t}-end:not(${t}-divider):not(${t}-system)`]:{paddingInlineStart:`15%`},[`${t}-list-scroll-box`]:{overflowY:`auto`,display:`flex`,width:`100%`,maxHeight:`100%`,flexDirection:`column`,scrollbarWidth:`thin`,scrollbarColor:`${e.colorTextTertiary} transparent`,"&::-webkit-scrollbar":{width:8,backgroundColor:`transparent`},"&::-webkit-scrollbar-thumb":{backgroundColor:e.colorTextTertiary,borderRadius:e.borderRadiusSM}},[`${t}-list-autoscroll`]:{flexDirection:`column-reverse`},[`${t}-list-scroll-content`]:{display:`flex`,width:`100%`,height:`fit-content`,flexDirection:`column`,boxSizing:`border-box`,paddingInline:e.paddingXS}}}},Bn=e=>{let{componentCls:t,fontSize:n,lineHeight:r,paddingXXS:i,margin:a,colorText:o,fontSizeLG:s,calc:c}=e;return{[t]:{[`${t}-header`]:{display:`flex`,marginBottom:i,fontSize:n,lineHeight:r,color:o},[`${t}-footer`]:{display:`flex`,marginBlockStart:a,fontSize:n,lineHeight:r,color:o,"&-start":{flexDirection:`row`},"&-end":{flexDirection:`row-reverse`}},[`${t}-avatar`]:{minWidth:c(s).mul(2).equal()}}}},Vn=e=>{let{componentCls:t,paddingSM:n,paddingXS:r,lineHeight:i,fontSize:a,fontSizeSM:o,calc:c}=e;return{[t]:{[`&${t}-system`]:{width:`100%`,justifyContent:`center`,[`${t}-content`]:{display:`flex`,gap:`${s(o)}`,alignItems:`center`,minHeight:c(r).mul(2).add(c(i).mul(a)).equal(),fontSize:`${s(a)}`,paddingInline:`${s(n)}`,paddingBlock:`${s(r)}`},[`${t}-system-content`]:{},[`${t}-system-extra`]:{}}}}},Hn=Cn(`Bubble`,e=>{let t=b(e,{});return[Fn(t),In(t),Ln(t),Bn(t),zn(t),Vn(t),Rn(t)]},()=>({typingContent:`"|"`,typingAnimationName:`cursorBlink`,typingAnimationDuration:`0.8s`})),Un=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(){return!!(typeof window<`u`&&window.document&&window.document.createElement)}})),Wn=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useLayoutUpdateEffect=e.default=void 0;var t=a(f()),n=r(Un());function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(typeof WeakMap!=`function`)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!=`object`&&typeof e!=`function`)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var o=(0,n.default)()?t.useLayoutEffect:t.useEffect,s=(e,n)=>{let r=t.useRef(!0);o(()=>e(r.current),n),o(()=>(r.current=!1,()=>{r.current=!0}),[])};e.useLayoutUpdateEffect=(e,t)=>{s(t=>{if(!t)return e()},t)},e.default=s}))());function Gn(e){return!e||e.length===0?``:e.reduce((e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return e.slice(0,n)})}function Kn({streaming:e,content:t,typing:n,onTyping:r,onTypingComplete:i}){let[a,o]=q.useState([]),s=q.useRef(!1),c=q.useRef(``),l=q.useRef(1),u=q.useRef(-1),d=q.useRef(e);d.current=e;let f=q.useMemo(()=>{let e={effect:`fade-in`,interval:100,step:6,keepPrefix:!0};if(n===!0)return e;let{step:t=6,interval:r=100}=n,i=e=>typeof e==`number`;if(!i(r)||r<=0)throw`[Bubble] invalid prop typing.interval, expect positive number.`;if(!i(t)&&!Array.isArray(t))throw`[Bubble] invalid prop typing.step, expect positive number or positive number array`;if(i(t)&&t<=0)throw`[Bubble] invalid prop typing.step, expect positive number`;if(Array.isArray(t)){if(!i(t[0])||t[0]<=0)throw`[Bubble] invalid prop typing.step[0], expect positive number`;if(!i(t[1])||t[1]<=0)throw`[Bubble] invalid prop typing.step[1], expect positive number`;if(t[0]>t[1])throw`[Bubble] invalid prop typing.step, step[0] should less than step[1]`}return{...e,...n}},[n]),p=q.useRef({content:t,interval:f.interval,step:f.step});p.current={content:t,interval:f.interval,step:f.step};let m=()=>Math.random().toString().slice(2),h=q.useCallback(e=>{let t=0;c.current=f.keepPrefix?Gn([p.current.content,c.current]):``,o(c.current?[{text:c.current,id:m(),taskId:e,done:!0}]:[]);let n=()=>{if(e!==l.current)return;let a=performance.now(),{content:f,interval:h,step:g}=p.current;if(a-t<h){u.current=requestAnimationFrame(n);return}let _=c.current.length,v=typeof g==`number`?g:Math.floor(Math.random()*(g[1]-g[0]))+g[0],y=f.slice(_,_+v);if(!y){if(d.current){u.current=requestAnimationFrame(n);return}o(t=>[{text:t.map(({text:e})=>e).join(``),id:m(),taskId:e,done:!0}]),i?.(f),s.current=!1,l.current++;return}c.current+=y;let b={id:m(),text:y,taskId:e,done:!1};o(e=>e.concat(b)),s.current||=!0,t=a,u.current=requestAnimationFrame(n),r?.(c.current,f)};n()},[f.keepPrefix,r,i]),g=q.useCallback(()=>{cancelAnimationFrame(u.current),o([]),c.current=``,s.current=!1},[]);return(0,Wn.default)(()=>{if(!t)return g();t!==c.current&&(s.current&&!t.startsWith(c.current)?(cancelAnimationFrame(u.current),s.current=!1,requestAnimationFrame(()=>h(++l.current))):s.current===!1&&h(l.current))},[t,h]),{renderedData:a,animating:s.current,memoedAnimationCfg:f}}var qn=({prefixCls:e,streaming:t,content:n,typing:r,onTyping:i,onTypingComplete:a})=>{let{renderedData:o,animating:s,memoedAnimationCfg:c}=Kn({streaming:t,content:n,typing:r,onTyping:i,onTypingComplete:a}),{effect:l}=c,u=o.map(e=>l===`fade-in`&&!e.done?q.createElement(`span`,{key:e.id,className:`fade-in`},e.text):e.text),d=r!==!0&&l===`typing`;return q.createElement(`div`,{className:m({[`${e}-typing`]:d&&s,[`${e}-fade-in`]:!d})},u)},Jn=e(Pt()),Yn=q.forwardRef(({prefixCls:e,rootClassName:t,style:n,className:r,styles:i={},classNames:a={},placement:o=`start`,content:s,contentRender:l,editable:u=!1,typing:d,streaming:f=!1,variant:p=`filled`,shape:h=`default`,header:g,footer:_,avatar:v,extra:y,footerPlacement:b,loading:x,loadingRender:S,onTyping:C,onTypingComplete:w,onEditConfirm:T,onEditCancel:E,...D},O)=>{let k=q.useRef(null);q.useImperativeHandle(O,()=>({nativeElement:k.current}));let A=Rt(`bubble`),{direction:j,getPrefixCls:ee}=$t(),M=ee(`bubble`,e),N=q.useContext(Dn),[te,ne]=Hn(M),re={...A.style,...A.styles.root,...i.root,...n},ie=m(M,A.className,A.classNames.root,a.root,t,r,te,ne,`${M}-${o}`,{[`${M}-${N.status}`]:N.status,[`${M}-rtl`]:j===`rtl`,[`${M}-loading`]:x}),ae=(0,Jn.default)(D,{attr:!0,aria:!0,data:!0}),P={key:N?.key,status:N?.status,extraInfo:N?.extraInfo},oe=q.useMemo(()=>l?l(s,P):s,[s,l,P.key,P.status,P.extraInfo]),F=typeof d==`function`?d(s,P):d,I=!!F&&typeof oe==`string`;q.useEffect(()=>{I||f||s&&w?.(s)},[oe,I,f]);let se=b||(o===`start`?`outer-start`:`outer-end`),L=typeof u==`boolean`?u:u.editing,ce=()=>{if(x)return S?S():q.createElement(jn,{prefixCls:M});let e=q.createElement(q.Fragment,null,I?q.createElement(qn,{prefixCls:M,streaming:f,typing:F,content:oe,onTyping:C,onTypingComplete:w}):oe),t=se.includes(`inner`);return q.createElement(`div`,{className:le(`body`),style:ue(`body`)},R(),q.createElement(`div`,{style:{...A.styles.content,...i.content},className:m(`${M}-content`,`${M}-content-${p}`,A.classNames.content,a.content,{[`${M}-content-${N?.status}`]:N?.status,[`${M}-content-${h}`]:p!==`borderless`,[`${M}-content-editing`]:L,[`${M}-content-string`]:typeof oe==`string`})},L?q.createElement(An,{prefixCls:M,content:s,okText:u?.okText,cancelText:u?.cancelText,onEditConfirm:T,onEditCancel:E}):q.createElement(q.Fragment,null,t?q.createElement(`div`,{className:m(`${M}-content-with-footer`)},e):e,t&&me())),!L&&!t&&me())},le=e=>m(`${M}-${e}`,A.classNames[e],a[e]),ue=e=>({...A.styles[e],...i[e]}),de=e=>typeof e==`function`?e(s,P):e,fe=()=>v?q.createElement(`div`,{className:le(`avatar`),style:ue(`avatar`)},de(v)):null,pe=()=>y?q.createElement(`div`,{className:le(`extra`),style:ue(`extra`)},de(y)):null,R=()=>g?q.createElement(`div`,{className:le(`header`),style:ue(`header`)},de(g)):null,me=()=>{if(!_)return null;let e=m(le(`footer`),{[`${M}-footer-start`]:se.includes(`start`),[`${M}-footer-end`]:se.includes(`end`)});return q.createElement(`div`,{className:e,style:ue(`footer`)},de(_))};return q.createElement(`div`,c({className:ie,style:re},D,ae,{ref:k}),fe(),ce(),!L&&!x&&pe())}),Xn=q.forwardRef(({prefixCls:e,content:t=``,rootClassName:n,style:r,className:i,styles:a={},classNames:o={},dividerProps:s,...l},u)=>{let{getPrefixCls:d}=$t(),f=Rt(`bubble`),p=d(`bubble`,e),[h,g]=Hn(p),_=m(h,g,p,`${p}-divider`,f.className,f.classNames.root,i,o.root,n);return q.createElement(Yn,c({ref:u,style:r,styles:a,className:_,classNames:o,prefixCls:p,variant:`borderless`,content:t,contentRender:e=>q.createElement(ee,s,e)},l))});function Zn(e){return getComputedStyle(e).flexDirection===`column-reverse`}function Qn(e,t){let n=(0,q.useRef)(null),r=(0,q.useRef)(!0),i=(0,q.useRef)(!1),a=(0,q.useRef)(0),o=(0,q.useRef)(void 0),s=(0,q.useRef)(!1),c=(0,q.useRef)(!1);(0,q.useLayoutEffect)(()=>{if(!e||!t)return;if(!n.current){let t=document.createElement(`div`);t.style.bottom=`0`,t.style.flexShrink=`0`,t.style.pointerEvents=`none`,t.style.height=`10px`,t.style.visibility=`hidden`,e.insertBefore(t,e.firstChild),n.current=t}let a=new IntersectionObserver(([e])=>{r.current=e.isIntersecting,i.current=!e.isIntersecting},{root:e,threshold:0});a.observe(n.current);let s=new ResizeObserver(()=>{e&&(o.current?c.current&&requestAnimationFrame(()=>e.scrollTo({top:Zn(e)?0:e.scrollHeight,behavior:`instant`})):Zn(e)&&i.current&&d())});return s.observe(t),()=>{a.disconnect(),s.disconnect(),clearTimeout(o.current),n.current?.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null)}},[e,t]);let l=(0,q.useCallback)(()=>{o.current=setTimeout(()=>{clearTimeout(o.current),o.current=void 0,c.current=!1},50)},[]),u=(0,q.useCallback)(e=>{let t=e.target;if(!Zn(t))return;let{scrollTop:n,scrollHeight:r}=t;a.current=r+n,s.current?s.current=!1:(o.current&&clearTimeout(o.current),l())},[l]);(0,q.useLayoutEffect)(()=>{if(e)return e.addEventListener(`scroll`,u,{capture:!0}),()=>e?.removeEventListener(`scroll`,u,{capture:!0})},[e,u]);let d=(0,q.useCallback)(()=>{e.scrollTop=a.current-e.scrollHeight,s.current=!0},[e]);return{reset:(0,q.useCallback)(()=>{r.current=!0,i.current=!1,a.current=e?.scrollHeight||0},[e]),scrollTo:(0,q.useCallback)(n=>{if(!e||!t)return;let{top:r,intoView:i,intoViewDom:a}=n||{};Zn(e)?r!==void 0&&r>=-10?c.current=!0:a&&i?.block===`end`?c.current=t.lastElementChild===a:c.current=!1:r!==void 0&&r>=e.scrollHeight-e.clientHeight-10?c.current=!0:a&&i?.block===`end`?c.current=t.lastElementChild===a:c.current=!1,o.current||l(),a?a.scrollIntoView(i):e.scrollTo(n)},[e,t])}}var $n=q.forwardRef(({prefixCls:e,content:t,variant:n=`shadow`,shape:r,style:i,className:a,styles:o={},classNames:s={},rootClassName:l,...u},d)=>{let f=Rt(`bubble`),{getPrefixCls:p}=$t(),h=p(`bubble`,e),[g,_]=Hn(h),v=`${h}-system`,y=m(g,_,v,h,f.className,f.classNames.root,s.root,a,l);return q.createElement(Yn,c({ref:d,style:i,className:y,styles:o,classNames:s,variant:n,shape:r,content:t},u))}),er=e(En());function tr(e){return typeof e==`function`&&e instanceof Function}var nr=q.memo(Yn),rr=q.memo(Xn),ir=q.memo($n),ar=e=>{let{_key:t,bubblesRef:n,extraInfo:r,status:i,role:a,classNames:o={},styles:s={},...l}=e,u=q.useCallback(e=>{e?n.current[t]=e:delete n.current[t]},[t]),{root:d,bubble:f,divider:p,system:m,...h}=o,{root:g,bubble:_,divider:v,system:y,...b}=s,x=q.createElement(nr,c({ref:u,style:g||_,className:d||f,classNames:h,styles:b},l));return a===`divider`?x=q.createElement(rr,c({ref:u,style:g||v,className:d||p,classNames:h,styles:b},l)):a===`system`&&(x=q.createElement(ir,c({ref:u,style:g||y,className:d||m,classNames:h,styles:b},l))),q.createElement(Dn.Provider,{value:{key:t,status:i,extraInfo:r}},x)};Yn.List=q.forwardRef((e,t)=>{let{prefixCls:n,rootClassName:r,className:i,styles:a={},classNames:o={},style:s,items:l,autoScroll:u=!0,role:d,onScroll:f,...p}=e,h=(0,Jn.default)(p,{attr:!0,aria:!0}),g=q.useRef(null),_=q.useRef({}),[v,y]=q.useState(),[b,x]=q.useState(),{scrollTo:S}=Qn(v,b),{getPrefixCls:C}=$t(),w=C(`bubble`,n),T=`${w}-list`,[E,D]=Hn(w),O=m(T,r,i,o.root,E,D),k={...a.root,...s};return Ft(t,()=>({nativeElement:g.current,scrollBoxNativeElement:v,scrollTo:({key:e,top:t,behavior:n=`smooth`,block:r})=>{let{scrollHeight:i,clientHeight:a}=v;if(typeof t==`number`)S({top:u?-i+a+t:t,behavior:n});else if(t===`bottom`)S({top:u?0:i,behavior:n});else if(t===`top`){let e=u?-i:0;S({top:e,behavior:n})}else e&&_.current[e]&&S({intoView:{behavior:n,block:r},intoViewDom:_.current[e].nativeElement})}})),q.createElement(`div`,c({},h,{className:O,style:k,ref:g}),q.createElement(`div`,{className:m(`${T}-scroll-box`,o.scroll,{[`${T}-autoscroll`]:u}),style:a.scroll,ref:e=>y(e),onScroll:f},q.createElement(`div`,{ref:e=>x(e),className:m(`${T}-scroll-content`)},l.map(e=>{let t;if(e.role&&d){let n=d[e.role];t={...tr(n)?n(e):n,...e}}else t=e;return q.createElement(ar,c({classNames:(0,er.default)(o,[`root`,`scroll`]),styles:(0,er.default)(a,[`root`,`scroll`])},(0,er.default)(t,[`key`]),{key:e.key,_key:e.key,bubblesRef:_}))}))))}),Yn.System=$n,Yn.Divider=Xn;var or=Yn,sr=()=>({height:0,opacity:0}),cr=e=>{let{scrollHeight:t}=e;return{height:t,opacity:1}},lr=e=>({height:e?e.offsetHeight:0}),ur=(e,t)=>t?.deadline===!0||t.propertyName===`height`,dr=(e=`ant`)=>({motionName:`${e}-motion-collapse`,onAppearStart:sr,onEnterStart:sr,onAppearActive:cr,onEnterActive:cr,onLeaveStart:lr,onLeaveActive:sr,onAppearEnd:ur,onEnterEnd:ur,onLeaveEnd:ur,motionDeadline:500}),fr=(e,t,n)=>{let r=typeof e==`boolean`||e?.expandedKeys===void 0,[a,o,s,c]=q.useMemo(()=>{let t={expandedKeys:[],defaultExpandedKeys:[],onExpand:()=>{}};return e?(typeof e==`object`&&(t={...t,...e}),[!0,t.defaultExpandedKeys,t.expandedKeys,t.onExpand]):[!1,t.defaultExpandedKeys,t.expandedKeys,t.onExpand]},[e]),[l,u]=i(o||[],r?void 0:s),d=e=>{u(t=>{let n=r?t:s,i=n.includes(e)?n.filter(t=>t!==e):[...n,e];return c?.(i),i})},f=q.useMemo(()=>a?{...dr(n),motionAppear:!1,leavedClassName:`${t}-content-hidden`}:{},[n,t,a]);return[a,l,a?d:void 0,f]},pr=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){let{keyCode:n}=e;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=t.F1&&n<=t.F12)return!1;switch(n){case t.ALT:case t.CAPS_LOCK:case t.CONTEXT_MENU:case t.CTRL:case t.DOWN:case t.END:case t.ESC:case t.HOME:case t.INSERT:case t.LEFT:case t.MAC_FF_META:case t.META:case t.NUMLOCK:case t.NUM_CENTER:case t.PAGE_DOWN:case t.PAGE_UP:case t.PAUSE:case t.PRINT_SCREEN:case t.RIGHT:case t.SHIFT:case t.UP:case t.WIN_KEY:case t.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=t.ZERO&&e<=t.NINE||e>=t.NUM_ZERO&&e<=t.NUM_MULTIPLY||e>=t.A&&e<=t.Z||window.navigator.userAgent.indexOf(`WebKit`)!==-1&&e===0)return!0;switch(e){case t.SPACE:case t.QUESTION_MARK:case t.NUM_PLUS:case t.NUM_MINUS:case t.NUM_PERIOD:case t.NUM_DIVISION:case t.SEMICOLON:case t.DASH:case t.EQUALS:case t.COMMA:case t.PERIOD:case t.SLASH:case t.APOSTROPHE:case t.SINGLE_QUOTE:case t.OPEN_SQUARE_BRACKET:case t.BACKSLASH:case t.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},isEditableTarget:function(e){let t=e.target;if(!(t instanceof HTMLElement))return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)}};e.default=t}))()),mr={Alt:[`altKey`,`⌥`,`Alt`],Ctrl:[`ctrlKey`,`⌃`,`Ctrl`],Meta:[`metaKey`,`⌘`,`Win`],Shift:[`shiftKey`,`⇧`,`Shift`]},hr=Array.from({length:9},(e,t)=>pr.default.ONE+t),gr=/(mac|iphone|ipod|ipad)/i.test(typeof navigator<`u`?navigator?.platform:``),_r=e=>e===`number`?e:typeof e==`string`&&mr?.[e]?.[gr?1:2]?mr[e][gr?1:2]:Object.entries(pr.default||{})?.find(([t,n])=>n===e)?.[0]||``,vr=(e,t)=>{let n=[...e],r=n.pop();return n.reduce((e,n)=>e&&(t[mr?.[n]?.[0]]||!1),r===t.keyCode)?{actionShortcutKey:e,actionKeyCodeNumber:hr.indexOf(t.keyCode)>-1&&hr.indexOf(t.keyCode),actionKeyCode:t.keyCode,timeStamp:t.timeStamp}:!1},yr=e=>{let t=[...e],n=t.pop();return{keyCodeDict:n===`number`?hr:[n],prefixKeys:t}},br=(e,t,n)=>{J(!e.find(({shortcutKey:e})=>e.toString()===t.toString()),n,`Same shortcutKey ${t.toString()}`)},xr=(e,t,n)=>{let r=Object.assign({},t||{},n);return Object.keys(r).reduce(({flattenShortcutKeys:t,shortcutKeysInfo:n},i)=>{let a=r[i];if(!Array.isArray(a))return{flattenShortcutKeys:t,shortcutKeysInfo:n};if(n={...n,[i]:{shortcutKeys:a,shortcutKeysIcon:[]}},a.every(e=>Array.isArray(e)))a.forEach((r,a)=>{let o=r;br(t,o,e),t.push({name:i,shortcutKey:o,index:a}),n[i].shortcutKeysIcon.push(o?.map(e=>_r(e)))});else{let{keyCodeDict:r,prefixKeys:o}=yr(a);r.forEach(n=>{br(t,[...o,n],e),t.push({name:i,shortcutKey:[...o,n]})}),n[i].shortcutKeysIcon=a.map(e=>_r(e))}return{flattenShortcutKeys:t,shortcutKeysInfo:n}},{flattenShortcutKeys:[],shortcutKeysInfo:{}})},Sr=()=>{let e=(0,q.useRef)(void 0);return[e,t=>{e.current=t}]},Cr=(e,t)=>{let{flattenShortcutKeys:n,shortcutKeysInfo:r}=xr(e,Rt(e).shortcutKeys,t),[i,a]=(0,q.useState)(null),[o,s]=Sr(),c=(0,q.useRef)(!1),l=e=>{for(let t of n){let n=vr(t.shortcutKey,e);if(n){let e={...n,name:t.name,index:t?.index};if(c.current)return;c.current=!0,a(e),o?.current?.(e)}}},u=()=>{c.current=!1};return(0,q.useEffect)(()=>{if(n.length!==0)return document.addEventListener(`keydown`,l),document.addEventListener(`keyup`,u),()=>{document.removeEventListener(`keydown`,l),document.removeEventListener(`keyup`,u)}},[n.length,o]),[i,r,s]},wr=({shortcutKeysIcon:e,prefixCls:t})=>{let[n]=Qt(`Conversations`,Xt.Conversations),r=!!e?.length;return q.createElement(`div`,{className:m(t,{[`${t}-shortcut-keys-show`]:r})},q.createElement(`span`,null,n.create),r&&q.createElement(`span`,{className:m(`${t}-shortcut-keys`)},e.map(e=>q.createElement(`span`,{className:m(`${t}-shortcut-key`),key:e},e))))},Tr=({icon:e,label:t,align:n,shortcutKeyInfo:r,prefixCls:i})=>{let{shortcutKeysIcon:a}=r||{},o={label:q.createElement(wr,{prefixCls:`${i}-label`,shortcutKeysIcon:a}),icon:q.createElement(O,{className:`${i}-icon`}),align:`center`};return t&&(o.label=typeof t==`function`?t({shortcutKeyInfo:r,components:{CreationLabel:wr}}):t),e&&(o.icon=typeof e==`function`?e():e),[o.icon,o.label,n||o.align]},Er=({className:e,icon:t,label:n,align:r,style:i,disabled:a,onClick:o,prefixCls:s,shortcutKeyInfo:c})=>{let[l,u,d]=Tr({prefixCls:s,label:n,icon:t,align:r,shortcutKeyInfo:c});return q.createElement(`button`,{type:`button`,onClick:e=>{a||o?.(e)},style:i,className:m(s,e,`${s}-${d}`,{[`${s}-disabled`]:a})},l,u)},Dr=q.createContext(null),Or=({className:e,children:t})=>{let{prefixCls:n,groupInfo:r,enableCollapse:i,expandedKeys:o,onItemExpand:s,collapseMotion:u}=q.useContext(Dr)||{},{label:d,name:f,collapsible:p}=r||{},h=typeof d==`function`?d(f,{groupInfo:r}):d||f,g=p&&i,_=()=>{g&&s?.(r.name)},v=g&&!!o?.includes?.(f);return q.createElement(`li`,{className:e},q.createElement(`div`,{className:m(`${n}-group-title`,{[`${n}-group-title-collapsible`]:g}),onClick:_},h&&q.createElement(`div`,{className:m(`${n}-group-label`)},h),g&&q.createElement(`div`,{className:m(`${n}-group-collapse-trigger `,`${n}-group-collapse-trigger-${v?`open`:`close`}`)},q.createElement(l,null))),q.createElement(a,c({},u,{visible:!g||v}),({className:e,style:n},r)=>q.createElement(`div`,{className:m(e),ref:r,style:n},t)))},kr=(e,t=[])=>{let[n,r,i]=(0,q.useMemo)(()=>{let t={label:``,collapsibleHandle:!1,collapsibleOptions:{}};if(!e)return[``,t.collapsibleHandle,t.collapsibleOptions];if(typeof e==`object`){let{collapsible:n,defaultExpandedKeys:r,expandedKeys:i,onExpand:a,...o}=e;t={...t,...o,collapsibleHandle:n,collapsibleOptions:{defaultExpandedKeys:r,expandedKeys:i,onExpand:a}}}return[t.label,t.collapsibleHandle,t.collapsibleOptions]},[e]);return q.useMemo(()=>{let a=t.reduce((t,i)=>{if(i?.type===`divider`||!i.group||!e)return t.push({data:[i],name:``,label:``,enableGroup:!1,collapsible:!1}),t;let a=i,o=t.some((e,n)=>e.name===a?.group&&(t[n].data.push(a),!0)),s=typeof r==`function`?r?.(a?.group):r;return o||t.push({data:[a],enableGroup:!0,name:a?.group,label:n,collapsible:s}),t},[]),o=a.reduce((e,t)=>(t.data.forEach(t=>{t.type!==`divider`&&e.push({key:t.key,disabled:t.disabled})}),e),[]);return[a,i,o]},[t,i])},Ar=e=>{e.stopPropagation()},jr=e=>{let{prefixCls:t,info:n,className:r,direction:i,onClick:a,active:o,menu:s,...l}=e,u=ln(),d=(0,Jn.default)(l,{aria:!0,data:!0,attr:!0}),{disabled:f}=n,p=m(r,`${t}-item`,{[`${t}-item-active`]:o&&!f},{[`${t}-item-disabled`]:f}),h=()=>{!f&&a&&a(n.key)},{trigger:g,...v}=s||{},y=v?.getPopupContainer;return q.createElement(`li`,c({title:typeof n.label==`object`?void 0:`${n.label}`},d,{className:p,onClick:h}),n.icon&&q.createElement(`div`,{className:`${t}-icon`},n.icon),q.createElement(w.Text,{className:`${t}-label`},n.label),!f&&s&&q.createElement(`div`,{onClick:Ar},q.createElement(M,{menu:v,placement:i===`rtl`?`bottomLeft`:`bottomRight`,trigger:[`click`],disabled:f,getPopupContainer:y},(e=>{let n=q.createElement(_,{onClick:Ar,className:m(`${t}-menu-icon`,{[`${t}-menu-icon-mobile`]:u})});return g?typeof g==`function`?g(e,{originNode:n}):g:n})(n))))},Mr=e=>{let{componentCls:t,calc:n}=e;return{[t]:{display:`flex`,flexDirection:`column`,gap:e.paddingXXS,overflowY:`auto`,padding:e.paddingSM,margin:0,listStyle:`none`,"ul, ol":{margin:0,padding:0,listStyle:`none`},[`&${t}-rtl`]:{direction:`rtl`},[`${t}-creation`]:{backgroundColor:e.creationBgColor,color:e.colorPrimary,border:`none`,fontWeight:500,paddingBlock:e.paddingXS,paddingInline:e.paddingSM,fontSize:e.fontSize,cursor:`pointer`,display:`flex`,touchAction:`manipulation`,gap:e.paddingXS,marginBlockEnd:e.marginSM,lineHeight:e.lineHeight,borderRadius:e.borderRadiusLG,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,[`&:not(${t}-creation-disabled):hover`]:{color:e.colorPrimary,background:e.creationHoverColor},[`&:not(${t}-creation-disabled)`]:{border:`${s(e.lineWidth)} ${e.lineType}, ${e.creationBorderColor}`},"&-start":{justifyContent:`flex-start`},"&-center":{justifyContent:`center`},"&-end":{justifyContent:`flex-end`},"&-label":{display:`flex`,justifyContent:`space-between`,alignItems:`center`},"&-label-shortcut-keys-show":{flex:1},"&-label-shortcut-keys":{height:e.controlHeightXS,display:`flex`,alignItems:`center`,gap:s(4)},"&-label-shortcut-key":{borderRadius:e.borderRadiusSM,height:`100%`,boxSizing:`border-box`,fontSize:e.fontSizeIcon,paddingInline:`${s(n(e.paddingXXS).sub(1).equal())}`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:e.shortcutKeyTextColor,border:`${s(e.lineWidth)} ${e.lineType}, ${e.creationBorderColor}`},"&-disabled":{cursor:`not-allowed`,background:e.colorBgContainerDisabled,[`& ${t}-creation-label, ${t}-creation-icon`]:{color:e.colorTextDisabled},[`& ${t}-creation-label-shortcut-keys`]:{color:e.colorTextDisabled,border:`${s(e.lineWidth)} ${e.lineType}, ${e.colorBgContainerDisabled}`}}},[`${t}-divider`]:{marginBlock:e.marginXXS},[`${t}-item`]:{display:`flex`,height:e.controlHeightLG,minHeight:e.controlHeightLG,gap:e.paddingXS,padding:`0 ${s(e.paddingXS)}`,alignItems:`center`,borderRadius:e.borderRadiusLG,cursor:`pointer`,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,touchAction:`manipulation`,[`&:not(${t}-item-disabled):hover`]:{backgroundColor:e.colorBgTextHover},"&-active":{backgroundColor:e.colorBgTextHover,[`& ${t}-label, ${t}-menu-icon`]:{color:e.colorText}},"&-disabled":{cursor:`not-allowed`,[`& ${t}-label, ${t}-icon, ${t}-menu-icon`]:{color:e.colorTextDisabled}},"&:hover, &-active":{[`& ${t}-menu-icon`]:{opacity:.6}},[`${t}-menu-icon:hover`]:{opacity:1}},[`${t}-content-hidden`]:{display:`none`},[`${t}-label`]:{flex:1,color:e.colorText,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},[`${t}-menu-icon`]:{opacity:0,fontSize:e.fontSizeXL,[`&${t}-menu-icon-mobile`]:{opacity:.6}},[`${t}-list`]:{display:`flex`,gap:e.paddingXXS,flexDirection:`column`},[`${t}-group-collapsible-list`]:{paddingBlockStart:e.paddingXXS,[`& ${t}-item`]:{paddingInlineStart:e.paddingXL}},[`${t}-group-title`]:{display:`flex`,alignItems:`center`,color:e.colorTextDescription,height:e.controlHeightLG,minHeight:e.controlHeightLG,padding:`0 ${s(e.paddingXS)}`},[`${t}-group-title-collapsible`]:{justifyContent:`space-between`,cursor:`pointer`,color:e.colorText,borderRadius:e.borderRadiusLG,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,touchAction:`manipulation`,"&:hover":{backgroundColor:e.colorBgTextHover}},[`${t}-group-collapse-trigger`]:{transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,transform:`rotate(0deg)`,transformOrigin:`center center`},[`${t}-group-collapse-trigger-open`]:{transform:`rotate(90deg)`},[`${t}-group-collapse-trigger-close`]:{transform:`rotate(0deg)`}}}},Nr=Cn(`Conversations`,e=>{let t=b(e,{});return[Mr(t),un(t)]},e=>{let t=new h(e.colorPrimary).setA(.15),n=new h(e.colorPrimary).setA(.22),r=new h(e.colorPrimary).setA(.25),i=new h(e.colorPrimary).setA(.65);return{creationBgColor:t.toRgbString(),creationBorderColor:n.toRgbString(),creationHoverColor:r.toRgbString(),shortcutKeyTextColor:i.toRgbString()}}),Pr=q.forwardRef((e,t)=>{let{prefixCls:n,shortcutKeys:r,rootClassName:a,items:o,activeKey:s,defaultActiveKey:l,onActiveChange:u,menu:d,styles:f={},classNames:p={},groupable:h,className:g,style:_,creation:v,...y}=e,b=(0,Jn.default)(y,{attr:!0,aria:!0,data:!0}),x=q.useRef(null);Ft(t,()=>({nativeElement:x.current}));let[S,C]=i(l,s),[w,T,E]=kr(h,o),{getPrefixCls:D,direction:O}=$t(),k=D(`conversations`,n),A=Rt(`conversations`),[j,M]=Nr(k),N=m(k,A.className,A.classNames.root,g,p.root,a,j,M,{[`${k}-rtl`]:O===`rtl`}),te=e=>{C(e),u?.(e,o?.find(t=>t.key===e))},[ne,re,ie]=Cr(`conversations`,r);ie(e=>{switch(e?.name){case`items`:{let t=e?.actionKeyCodeNumber??e?.index;typeof t==`number`&&!E?.[t]?.disabled&&E?.[t]?.key&&(C(E?.[t]?.key),u?.(E?.[t]?.key,o?.find(e=>e.key===E?.[t]?.key)))}break;case`creation`:typeof v?.onClick==`function`&&!v?.disabled&&v.onClick()}});let ae=e=>e.map((e,t)=>{if(e.type===`divider`)return q.createElement(ee,{key:`key-divider-${t}`,className:`${k}-divider`,dashed:e.dashed});let n=e,{label:r,disabled:i,icon:a,...o}=n;return q.createElement(jr,c({},o,{key:n.key||`key-${t}`,info:n,prefixCls:k,direction:O,className:m(p.item,A.classNames.item,n.className),style:{...A.styles.item,...f.item,...n.style},menu:typeof d==`function`?d(n):d,active:S===n.key,onClick:te}))}),[P,oe,F,I]=fr(T,k,D());return q.createElement(`ul`,c({},b,{style:{...A.style,..._,...A.styles.root,...f.root},className:N,ref:x}),!!v&&q.createElement(Er,c({className:m(A.classNames.creation,p.creation),style:{...A.styles.creation,...f.creation},shortcutKeyInfo:re?.creation,prefixCls:`${k}-creation`},v)),w.map((e,t)=>{let n=ae(e.data);return e.enableGroup?q.createElement(Dr.Provider,{key:e.name||`key-${t}`,value:{prefixCls:k,groupInfo:e,enableCollapse:P,expandedKeys:oe,onItemExpand:F,collapseMotion:I}},q.createElement(Or,{className:m(A.classNames.group,p.group)},q.createElement(`ul`,{className:m(`${k}-list`,{[`${k}-group-collapsible-list`]:e.collapsible}),style:{...A.styles.group,...f.group}},n))):n}))});Pr.Creation=Er;var Fr=q.createContext(null),Ir=q.forwardRef((e,t)=>{let{className:n,action:r,onClick:i,...a}=e,o=(0,q.useContext)(Fr),{prefixCls:s,disabled:l,setSubmitDisabled:u}=o,d=a.disabled??l??o[`${r}Disabled`];return(0,q.useEffect)(()=>{r===`onSend`&&u?.(d)},[d,r,u]),q.createElement(A,c({type:`text`},a,{ref:t,onClick:e=>{d||(o[r]?.(),i?.(e))},disabled:d,className:m(s,n,{[`${s}-disabled`]:d})}))});function Lr(e,t){return q.createElement(Ir,c({icon:q.createElement(oe,null)},e,{action:`onClear`,ref:t}))}var Rr=q.forwardRef(Lr),zr=(0,q.memo)(e=>{let{className:t}=e,[n]=Qt(`Sender`,Xt.Sender);return q.createElement(`svg`,{color:`currentColor`,viewBox:`0 0 1000 1000`,xmlns:`http://www.w3.org/2000/svg`,className:t},q.createElement(`title`,null,n.stopLoading),q.createElement(`rect`,{fill:`currentColor`,height:`250`,rx:`24`,ry:`24`,width:`250`,x:`375`,y:`375`}),q.createElement(`circle`,{cx:`500`,cy:`500`,fill:`none`,r:`450`,stroke:`currentColor`,strokeWidth:`100`,opacity:`0.45`}),q.createElement(`circle`,{cx:`500`,cy:`500`,fill:`none`,r:`450`,stroke:`currentColor`,strokeWidth:`100`,strokeDasharray:`600 9999999`},q.createElement(`animateTransform`,{attributeName:`transform`,dur:`1s`,from:`0 500 500`,repeatCount:`indefinite`,to:`360 500 500`,type:`rotate`})))}),Br=q.forwardRef((e,t)=>{let{prefixCls:n}=q.useContext(Fr),{className:r}=e;return q.createElement(Ir,c({icon:q.createElement(zr,{className:`${n}-loading-icon`}),color:`primary`,variant:`text`,shape:`circle`},e,{className:m(r,`${n}-loading-button`),action:`onCancel`,ref:t}))});function Vr(e,t){return q.createElement(Ir,c({icon:q.createElement(le,null),type:`primary`,shape:`circle`},e,{action:`onSend`,ref:t}))}var Hr=q.forwardRef(Vr),Ur=q.createContext({}),Wr=e=>{let t=(0,q.useCallback)(()=>typeof window>`u`?null:window.getSelection(),[]),n=(e,t)=>{if(!e||!t)return t;let n=e,r=null;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n!==t;)n instanceof HTMLElement&&n.tagName===`SPAN`&&(r=n),n=n.parentElement;return r||t},r=(0,q.useCallback)(()=>{let e=t();if(!e)return{range:null,selection:e};try{return{range:e.getRangeAt(0)||document.createRange(),selection:e}}catch{return{range:document.createRange(),selection:e}}},[t]),i=(0,q.useCallback)((e,t)=>{if(e&&t)try{t.removeAllRanges(),t.addRange(e)}catch(e){J(!1,`Sender`,`Failed to set range: ${e}`)}},[]),a=(0,q.useCallback)(()=>{let e=t();if(e)try{e.removeAllRanges()}catch(e){J(!1,`Sender`,`Failed to remove all ranges: ${e}`)}},[t]),o=(0,q.useCallback)((e,t=!1)=>{if(e&&typeof e.focus==`function`)try{e.focus({preventScroll:t})}catch(e){J(!1,`Sender`,`Failed to focus element: ${e}`)}},[]),s=(0,q.useCallback)((e,t)=>{if(!e)return;o(e,t);let{range:n,selection:a}=r();if(n&&a)try{n.selectNodeContents(e),n.collapse(!1),i(n,a)}catch(e){J(!1,`Sender`,`Failed to set end cursor: ${e}`)}},[o,r,i]),c=(0,q.useCallback)((e,t)=>{if(!e)return;o(e,t);let{range:n,selection:a}=r();if(n&&a)try{n.selectNodeContents(e),n.collapse(!0),i(n,a)}catch(e){J(!1,`Sender`,`Failed to set start cursor: ${e}`)}},[o,r,i]),l=(0,q.useCallback)((e,t,n)=>{if(!e)return;o(e,n);let{range:a,selection:s}=r();if(a&&s)try{a.selectNodeContents(e),t&&a.setStart(e,1),i(a,s)}catch(e){J(!1,`Sender`,`Failed to select all content: ${e}`)}},[o,r,i]),u=(0,q.useCallback)((e,t,n,a)=>{if(!e||typeof n!=`number`||n<0||!t)return{range:null,selection:null};o(t,a);let{range:s,selection:c}=r();if(s&&c)try{let t=Math.min(n,e.childNodes.length);s.setStart(e,t),s.setEnd(e,t),s.collapse(!1),i(s,c)}catch(e){J(!1,`Sender`,`Failed to set cursor position:: ${e}`)}return{range:s,selection:c}},[o,r,i]),d=(0,q.useCallback)((t,n,r=!1)=>{if(!e||!t?.current)return;let{getSlotDom:i,slotConfigMap:a}=e,o=e=>{let t=i(e);if(!t)return null;let n=a.get(e);if(!n)return null;if(n.type===`input`)return t.querySelector(`input`);let r=t?.getAttribute?.(`data-node-type`)||``;return n.type===`content`&&r!==`nbsp`?t:null},s=(e=>{let n=t.current;if(!n)return null;if(e)return o(e);for(let e of Array.from(n.childNodes)){let t=e?.getAttribute?.(`data-slot-key`);if(t){let e=o(t);if(e)return e}}return null})(n);s&&(s.nodeName===`INPUT`?s.focus({preventScroll:r}):u(s,t.current,0,r))},[e,u]),f=(0,q.useCallback)((e,t,n,r,i)=>{n&&r&&(o(t,i),n?.setStartAfter(e),n.collapse(!1),r.removeAllRanges(),r.addRange(n))},[o]),p=(0,q.useCallback)(e=>{if(!e)return{value:``,startContainer:null,startOffset:0};let n=t();if(!n||n.rangeCount===0)return{value:``,startContainer:null,startOffset:0};try{let t=n.getRangeAt(0),r=t.cloneRange();if(!e.contains(t.startContainer))return{value:``,startContainer:null,startOffset:0};if(t.endContainer===e&&t.endContainer.lastChild?.nodeType===Node.TEXT_NODE){let e=t.endContainer.lastChild;t=document.createRange(),t.setStart(e,e.length),t.setEnd(e,e.length)}return r=t.cloneRange(),r.selectNodeContents(e),r.setEnd(t.startContainer,t.startOffset),{value:r.toString().replace(/\u200B/g,``),startContainer:t.startContainer,startOffset:t.startOffset}}catch(e){return J(!1,`Sender`,`Failed to get text before cursor: ${e}`),{value:``,startContainer:null,startOffset:0}}},[t]),m=(0,q.useCallback)((i,a,o)=>{if(i===`start`||i===`end`)return{type:i,selection:t()};let l=null,u=null;if(o?.current)l=o.current,u=t();else{let e=r();l=e.range,u=e.selection}if(!l||!u)return{type:`end`,selection:u};let d=a?.current;if(!d)return{type:`end`,selection:u};let f=d.contains(l.endContainer),p=d.contains(l.startContainer);if(!f)return s(d,!0),{type:`end`,selection:u};if(!p)return c(d,!0),{type:`start`,selection:u};let m=n(l.endContainer,d),h=n(l.startContainer,d);if(m===h&&h!==d&&e?.getNodeInfo){let{slotKey:t,slotConfig:n,skillKey:r}=e.getNodeInfo(m)||{};if(t)return{type:`slot`,slotKey:n?.key,slotType:n?.type,range:l,selection:u};if(r)return{type:`start`,selection:u}}return{type:`box`,range:l,selection:u}},[e,r,t,s,c,n]),h=(0,q.useCallback)(e=>{let t=e.childNodes[e.childNodes.length-1],n=t?.nodeType===Node.TEXT_NODE&&t.textContent===`
|
|
`?e.childNodes.length-1:e.childNodes.length;return u(e,e,n).range||document.createRange()},[u]),g=(0,q.useCallback)(t=>{let n=+!!e?.getEditorValue?.().skill;return u(t,t,n).range||document.createRange()},[u,e]),_=(0,q.useCallback)(e=>e.replace(/\u200B/g,``).replace(/\n/g,``).replace(/^\n+|\n+$/g,``),[]);return{setEndCursor:s,setStartCursor:c,setAllSelectCursor:l,setCursorPosition:u,setAfterNodeFocus:f,setSlotFocus:d,getTextBeforeCursor:p,getSelection:t,removeAllRanges:a,getRange:r,getInsertPosition:m,getEndRange:h,getStartRange:g,copySelectionString:(0,q.useCallback)(async()=>{try{let e=t();if(!e)return!1;let n=e.toString();if(!n)return!1;let r=_(n);return await navigator.clipboard.writeText(r),!0}catch(e){return J(!1,`Sender`,`Failed to copy selection: ${e}`),!1}},[t,_]),getCleanedText:_}},Gr=4.35,Kr=(e,t,n)=>{let{token:r}=Sn(),i=n.current?window.getComputedStyle(n.current):{},a=parseFloat(`${e.lineHeight||r.lineHeight}`),o=parseFloat(`${i?.fontSize||e.fontSize||r.fontSize}`),s=i?.lineHeight?parseFloat(`${i?.lineHeight}`):a*o;return t===!1||!t?{}:t===!0?{height:`auto`}:{minHeight:t.minRows?(s+Gr)*t.minRows:`auto`,maxHeight:t.maxRows?(s+Gr)*t.maxRows:`auto`,overflowY:`auto`}},qr=e=>{let{prefixCls:t,placeholder:n,slotDomMap:r,slotConfigMap:i}=e,a=(0,q.useCallback)(e=>{let r=document.createElement(`span`);return r.setAttribute(`contenteditable`,`false`),r.dataset.skillKey=e,r.dataset.placeholder=n||``,r.className=`${t}-skill`,r},[t,n]),o=(0,q.useCallback)(e=>{let n=document.createElement(`span`);return n.setAttribute(`contenteditable`,`true`),n.dataset.slotKey=e.key,n.className=m(`${t}-slot`,`${t}-slot-content`),n},[t]),s=(0,q.useCallback)(e=>{let n=document.createElement(`span`);return n.setAttribute(`contenteditable`,`false`),n.dataset.slotKey=e,n.className=`${t}-slot`,n},[t]),c=(0,q.useCallback)((e,n)=>{let r=document.createElement(`span`);return r.setAttribute(`contenteditable`,`false`),r.dataset.slotKey=e,r.dataset.nodeType=`nbsp`,r.className=m(`${t}-slot-${n}`,`${t}-slot-no-width`),r.textContent=`\xA0`,r},[t]),l=(e,t)=>{r.current.set(e,t)},u=e=>r.current.get(e);return{buildSkillSpan:a,buildEditSlotSpan:o,buildSlotSpan:s,buildSpaceSpan:c,saveSlotDom:l,getSlotDom:u,getSlotLastDom:(e,t)=>(t??i.get(e)?.type)===`content`?u(`${e}_after`):u(e)}},Jr=new Set([`input`,`select`,`custom`,`content`]),Yr=e=>e?.reduce((e,t)=>{let{key:n,type:r}=t;if(!n)return e;let i=t.props||{};return e[n]=(Jr.has(r)?i.defaultValue:i.value??i.label)??``,e},{})??{},Xr=(e,t)=>{e?.forEach(e=>{e.key&&t.set(e.key,e)})},Zr=(e,t)=>{if(!e?.dataset)return null;let{dataset:n}=e;return{slotKey:n.slotKey,placeholder:n.placeholder,nodeType:n.nodeType,skillKey:n.skillKey,slotConfig:n.slotKey?t.get(n.slotKey):void 0,targetNode:e}},Qr=e=>{let[t,n]=(0,q.useState)({}),r=(0,q.useRef)(t),i=(0,q.useRef)(new Map),a=(0,q.useRef)(new Set);(0,q.useEffect)(()=>{if(!e)return;i.current.forEach((e,t)=>{a.current.has(t)||i.current.delete(t)}),Xr(e,i.current);let t=Yr(e);a.current.forEach(e=>{e in r.current&&(t[e]=r.current[e])}),n(t),r.current=t},[e]);let o=(0,q.useCallback)(e=>{let t=typeof e==`function`?e(r.current):e;n(t),r.current=t},[]),s=(0,q.useCallback)(e=>{let t=Yr(e);e.forEach(e=>{e.key&&(i.current.set(e.key,e),a.current.add(e.key))}),n(e=>({...e,...t})),r.current={...r.current,...t}},[]),c=(0,q.useCallback)(()=>{i.current.clear(),a.current.clear(),n({}),r.current={}},[]),l=(0,q.useCallback)(e=>Zr(e,i.current),[]);return[i.current,{getSlotValues:()=>r.current,setSlotValues:o,mergeSlotConfig:s,getNodeInfo:l,getNodeTextValue:e=>{let t=e.nodeType;if(t===Node.TEXT_NODE)return e.textContent||``;if(t!==Node.ELEMENT_NODE)return``;let n=e,i=l(n);if(!i)return n.innerText||``;let{slotKey:a,skillKey:o,nodeType:s,slotConfig:c}=i;if(o)return``;let u=n.innerText||``;if(a){if(s===`nbsp`)return` `;if(!c)return u;let e=c.type===`content`?u:r.current[a]??``;return c.formatResult?.(e)??e}return u},clear:c}]},$r=({removeSkill:e,prefixCls:t,toolTip:n,closable:r,title:i,value:a})=>{let o=`${t}-skill`,s=(0,q.useMemo)(()=>{if(!r)return[null];let t=typeof r==`boolean`?{}:r,n=n=>{t.disabled||(n.stopPropagation(),e(),t.onClose?.(n))},i=t.closeIcon||q.createElement(D,{className:`${o}-close-icon`});return q.createElement(`div`,{className:m(`${o}-close`,{[`${o}-close-disabled`]:t.disabled}),onClick:n,role:`button`,"aria-label":`Close skill`,tabIndex:0},i)},[r,e]),c=i||a,l=n?q.createElement(T,n,c):c;return q.createElement(`div`,{className:`${o}-wrapper`,contentEditable:!1},q.createElement(`div`,{className:`${o}-tag`,contentEditable:!1,role:`button`,tabIndex:0},q.createElement(`span`,{className:`${o}-tag-text`},l),s),q.createElement(`div`,{className:`${o}-holder`}))};$r.displayName=`Skill`;var ei=e(d()),ti=q.forwardRef((e,t)=>{let{onChange:n,onKeyUp:r,onKeyDown:i,onPaste:a,onPasteFile:o,disabled:s,readOnly:l,submitType:u=`enter`,prefixCls:d,styles:f={},classNames:p={},autoSize:h,triggerSend:g,placeholder:_,onFocus:v,onBlur:y,slotConfig:b,skill:x,...S}=q.useContext(Ur),{direction:C,getPrefixCls:w}=$t(),T=`${w(`sender`,d)}`,E=Rt(`sender`),D=`${T}-input`,O=(0,q.useRef)(null),k=(0,q.useRef)(new Map),A=(0,q.useRef)(!1),j=(0,q.useRef)(!1),ee=(0,q.useRef)(null),N=(0,q.useRef)(null),ne=(0,q.useRef)(null),re={...E.styles?.input,...f.input},ie=Kr(re,h,O),ae={...(0,Jn.default)(S,{attr:!0,aria:!0,data:!0}),ref:O},[P,{getSlotValues:oe,setSlotValues:F,getNodeInfo:I,mergeSlotConfig:se,getNodeTextValue:ce,clear:le}]=Qr(b),[ue,de]=(0,q.useState)(new Map),[fe,pe]=(0,q.useState)(null),{setEndCursor:R,setStartCursor:me,setAllSelectCursor:z,setCursorPosition:he,setSlotFocus:B,setAfterNodeFocus:ge,getTextBeforeCursor:_e,removeAllRanges:ve,getRange:ye,getInsertPosition:be,getEndRange:V,getStartRange:H,getSelection:xe,copySelectionString:Se,getCleanedText:Ce}=Wr({prefixCls:T,getSlotDom:e=>k.current.get(e),slotConfigMap:P,getNodeInfo:I,getEditorValue:()=>Fe()}),{buildSkillSpan:we,buildEditSlotSpan:Te,buildSlotSpan:Ee,buildSpaceSpan:De,getSlotDom:Oe,saveSlotDom:ke,getSlotLastDom:Ae}=qr({prefixCls:T,placeholder:_,slotDomMap:k,slotConfigMap:P}),je=e=>{let t=Fe();N.current&&(!t?.value&&t.slotConfig.length===0&&_?(N.current.setAttribute(`contenteditable`,`true`),N.current.classList.add(`${T}-skill-empty`)):(N.current.setAttribute(`contenteditable`,`false`),N.current.classList.remove(`${T}-skill-empty`))),n?.(t.value,e,t.slotConfig,t.skill)},Me=(e,t,n)=>{let r=Oe(e),i=P.get(e);if(F(n=>({...n,[e]:t})),r&&i){let t=Ne(i,r);de(n=>{let r=new Map(n);return r.set(e,t),r}),je(n)}},Ne=(e,t)=>{if(!e.key)return null;let n=oe()[e.key];return(0,ei.createPortal)((()=>{switch(e.type){case`content`:return t.innerHTML=n||``,t.setAttribute(`data-placeholder`,e.props?.placeholder||``),null;case`input`:return q.createElement(te,{readOnly:l,className:`${T}-slot-input`,placeholder:e.props?.placeholder||``,"data-slot-input":e.key,size:`small`,variant:`borderless`,value:n||``,tabIndex:0,onKeyDown:W,onChange:t=>{Me(e.key,t.target.value,t)},spellCheck:!1});case`select`:return q.createElement(M,{disabled:l,menu:{items:e.props?.options?.map(e=>({label:e,key:e})),defaultSelectedKeys:e.props?.defaultValue?[e.props.defaultValue]:[],selectable:!0,onSelect:({key:t,domEvent:n})=>{Me(e.key,t,n)}},trigger:[`click`]},q.createElement(`span`,{className:m(`${T}-slot-select`,{placeholder:!n,[`${T}-slot-select-selector-value`]:n})},q.createElement(`span`,{"data-placeholder":e.props?.placeholder,className:`${T}-slot-select-value`},n||``),q.createElement(`span`,{className:`${T}-slot-select-arrow`},q.createElement(L,null))));case`tag`:return q.createElement(`span`,{className:`${T}-slot-tag`},e.props?.label||e.props?.value||``);case`custom`:return e.customRender?.(n,t=>{Me(e.key,t)},{disabled:s,readOnly:l},e);default:return null}})(),t)},Pe=e=>e.reduce((e,t)=>{if(t.type===`text`)return e.push(document.createTextNode(t.value||``)),e;let n=t.key;if(J(!!n,`Sender`,`Slot key is missing: ${n}`),n){let r,i;if(t.type===`content`){i=Te(t);let e=De(n,`before`),a=De(n,`after`);r=[e,i,a],ke(`${n}_before`,e),ke(n,i),ke(`${n}_after`,a)}else i=Ee(n),r=[i],ke(n,i);if(i){let a=Ne(t,i);a&&(de(e=>{let t=new Map(e);return t.set(n,a),t}),e.push(...r))}}return e},[]),Fe=()=>{let e=O.current,t={value:``,slotConfig:[],skill:void 0};if(!e)return t;let n=e.childNodes;if(n.length===0)return e.innerHTML=``,N.current=null,t;let r=!!x,i=Array(n.length),a=[],o,s=0;for(let e=0;e<n.length;e++){let t=n[e],c=ce(t);if(i[s++]=c,t.nodeType===Node.TEXT_NODE)c&&a.push({type:`text`,value:c});else if(t.nodeType===Node.ELEMENT_NODE){let e=I(t);if(e){let{skillKey:t,slotKey:n,nodeType:i}=e;if(t&&r&&(o=x),n&&i!==`nbsp`){let e=P.get(n);e&&a.push({...e,value:c})}}}}let c=i.slice(0,s).join(``);return o||(N.current=null),{value:c,slotConfig:a,skill:o}},Ie=()=>{let e=O.current;e&&(e.innerHTML=``,N.current=null,ne.current=null,ee.current=null,ve(),k?.current?.clear())},Le=e=>{e.forEach(e=>{O.current?.appendChild(e)})},Re=(e,t)=>{let n=O.current;n&&(n.querySelectorAll(`[data-slot-key="${e}"]`).forEach(e=>{e.remove()}),k.current.delete(e),F(t=>{let{[e]:n,...r}=t;return r}),de(t=>{let n=new Map(t);return n.delete(e),n}),je(t))},ze=()=>{if(x&&ne.current!==x){Be(!1),ne.current=x;let e=we(x.value),t=(0,ei.createPortal)(q.createElement($r,c({removeSkill:Be},x,{prefixCls:T})),e);pe(t);let n=document.createRange(),r=O.current;if(!r)return;n.setStart(r,0),n.insertNode(e),N.current=e,je()}},Be=(e=!0)=>{O.current&&N.current&&(N.current?.remove(),N.current=null,ne.current=null,e&&je())},Ve=e=>{u===`enter`&&e&&e.querySelectorAll(`br`).forEach(e=>{e.remove()})},He=()=>{b&&b.length>0&&O.current&&(Ie(),Le(Pe(b)))},Ue=e=>{let t=i?.(e);return j.current||A.current||t===!1},We=(e,t)=>{if(!O.current)return!1;let{range:n,selection:r}=ye();if(!r||r.rangeCount===0)return!1;let{focusOffset:i,anchorNode:a}=r;if(!a||!O.current.contains(a))return!1;if(a.nodeType===Node.TEXT_NODE&&n){let r=a.parentNode,o=I(r),s=n.toString(),c=a.textContent?.length===s.length,l=a.textContent?.length===1&&i===1;if(o?.slotConfig?.type===`content`&&(c||l))return e.preventDefault(),t===`cut`&&Se(),a.parentNode.innerHTML=``,!0}if(t===`backspace`&&i===0){let t=a.previousSibling;if(t){let n=I(t);if(n){let{slotKey:t,skillKey:r}=n;if(t)return e.preventDefault(),Re(t,e),!0;if(r)return e.preventDefault(),Be(),!0}}}return!1},Ge=e=>{let{key:t,shiftKey:n,ctrlKey:r,altKey:i,metaKey:a}=e;if(t!==`Enter`)return!1;let o=r||i||a;return u===`enter`&&!n&&!o||u===`shiftEnter`&&n&&!o},Ke=()=>{if(!N.current||!O.current||N.current.getAttribute(`contenteditable`)===`false`)return;let e=xe();e?.anchorNode&&N.current.contains(e.anchorNode)&&O.current.contains(e.anchorNode)&&(N.current.setAttribute(`contenteditable`,`false`),N.current.classList.remove(`${T}-skill-empty`),at({cursor:`end`}))},U=()=>{A.current=!0},qe=()=>{A.current=!1,j.current=!1},W=e=>{Ue(e)||e.key===`Backspace`&&We(e,`backspace`)||(Ge(e)?(e.preventDefault(),j.current=!0,g?.()):(e.key===`a`||e.key===`A`)&&(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey?(z(O.current,N.current),e.preventDefault()):Ke())},Je=e=>{v?.(e)},G=e=>{j.current&&=!1;let{range:t}=ye();ee.current=t;let n=setTimeout(()=>{ee.current=null,clearTimeout(n)},200);y?.(e)},Ye=e=>{Ve(O?.current),je(e)},Xe=e=>{We(e,`cut`)},Ze=e=>{e.preventDefault();let t=e.clipboardData?.files,n=e.clipboardData?.getData(`text/plain`);if(!n&&t?.length&&o)o(t);else{if(n){let e=!1,t=Ce(n);try{e=document.execCommand(`insertText`,!1,t)}catch(e){J(!1,`Sender`,`insertText command failed: ${e}`)}e||et([{type:`text`,value:t}])}a?.(e)}},Qe=e=>{e.key===`Enter`&&(j.current=!1),r?.(e)},$e=()=>{let e=O.current,t=xe();e&&t?.focusNode===e&&t.focusOffset===0&&Fe().skill&&he(e,O.current,1)},et=(e,t,n,r)=>{let i=O.current;if(i)try{se(e);let a=Pe(e);if(a.length===0)return;let o=tt(t,i);if(!o.range||!o.selection)return;let{range:s,selection:c}=o;n?.length&&nt(s,n,i),s.deleteContents(),rt(a,s,o),it(a,s,c,r)}catch(e){J(!1,`Sender`,`Insert operation failed: ${e}`)}},tt=(e,t)=>{let{type:n,slotKey:r,slotType:i,range:a,selection:o}=be(e,O,ee);if(!o)return{range:null,selection:null,type:n};let s=null;switch(n){case`end`:s=V(t);break;case`start`:s=H(t);break;case`slot`:s=ye().range;break;case`box`:s=a||null,s&&N.current&&s.collapsed&&s.startOffset===0&&s.setStartAfter(N.current)}return{range:s,selection:o,type:n,slotKey:r,slotType:i}},nt=(e,t,n)=>{let{value:r,startContainer:i,startOffset:a}=_e(n);r.length>=t.length&&r.endsWith(t)&&i&&a>=0&&(e.setStart(i,a-t.length),e.setEnd(i,a),e.deleteContents())},rt=(e,t,n)=>{let{type:r,slotKey:i,slotType:a}=n,o=!0;e.forEach(e=>{if(o&&r===`slot`&&(a!==`content`||e.nodeType!==Node.TEXT_NODE)&&i){o=!1;let e=Ae(i);e&&t.setStartAfter(e)}t.insertNode(e),t.setStartAfter(e)})},it=(e,t,n,r)=>{let i=e[e.length-1];ge(i,O.current,t,n,r),setTimeout(()=>{Ye(null)},0)},at=e=>{let t={preventScroll:e?.preventScroll??!1,cursor:e?.cursor??`end`,key:e?.key};switch(t.cursor){case`slot`:B(O,e?.key,t.preventScroll);break;case`start`:me(O.current,t.preventScroll);break;case`all`:z(O.current,N.current,t.preventScroll);break;case`end`:R(O.current,t.preventScroll)}},ot=()=>{let e=O.current;e&&(e.innerHTML=``,ne.current=null,N.current=null,le(),ze(),ee.current=null,k?.current?.clear(),Ye(null))};return(0,q.useEffect)(()=>{He(),x?ze():je()},[b]),(0,q.useEffect)(()=>{ze()},[x]),(0,q.useImperativeHandle)(t,()=>({nativeElement:O.current,focus:at,blur:()=>O.current?.blur(),insert:et,clear:ot,getValue:Fe})),q.createElement(q.Fragment,null,q.createElement(`div`,c({},ae,{role:`textbox`,tabIndex:0,style:{...re,...ie},className:m(D,`${D}-slot`,E.classNames.input,p.input,{[`${T}-rtl`]:C===`rtl`}),"data-placeholder":_,contentEditable:!l,suppressContentEditableWarning:!0,spellCheck:!1,onCut:Xe,onKeyDown:W,onKeyUp:Qe,onPaste:Ze,onCompositionStart:U,onCompositionEnd:qe,onFocus:Je,onBlur:G,onSelect:$e,onInput:Ye},S)),q.createElement(`div`,{style:{display:`none`},id:`${T}-slot-placeholders`},Array.from(ue.values()),fe))}),ni=q.forwardRef((e,t)=>{let{speechRecording:n,disabled:r,onSpeechDisabled:i,prefixCls:a}=q.useContext(Fr),o=e.disabled??r??i,s=null;return s=n?q.createElement(sn,{className:`${a}-recording-icon`}):o?q.createElement(I,null):q.createElement(ae,null),q.createElement(Ir,c({icon:s,variant:`text`,color:`primary`},e,{action:`onSpeech`,ref:t}))}),ri=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e,t){let n=e;for(let e=0;e<t.length;e+=1){if(n==null)return;n=n[t[e]]}return n}}))());function ii(e,t,n){return(0,ri.default)(e,t)||n}var ai=q.forwardRef((e,t)=>{let{value:n,onChange:r,onKeyUp:i,onKeyDown:a,onPaste:o,onPasteFile:s,disabled:l,readOnly:u,submitType:d=`enter`,prefixCls:f,styles:p={},classNames:h={},autoSize:g,components:_,triggerSend:v,placeholder:y,onFocus:b,onBlur:x,...S}=q.useContext(Ur),C=q.useRef(null),w=(e,t=`cursor`)=>{let n=C.current?.resizableTextArea?.textArea,i=n.value,a=i.length,o=i.length;t===`cursor`&&(a=n?.selectionStart,o=n?.selectionEnd),t===`start`&&(a=0,o=0),n.value=i.substring(0,a)+e+i.substring(o,i.length),n.selectionStart=a+e.length,n.selectionEnd=a+e.length,n.focus(),r?.(n.value)},T=()=>{r?.(``)},E=()=>({value:n||``,slotConfig:[]});q.useImperativeHandle(t,()=>({nativeElement:C.current?.resizableTextArea?.textArea,focus:C.current?.focus,blur:C.current?.blur,insert:w,clear:T,getValue:E}));let D=q.useRef(!1),O=()=>{D.current=!0},k=()=>{D.current=!1},A=e=>{let t=a?.(e),{key:n,shiftKey:r,ctrlKey:i,altKey:o,metaKey:s}=e;if(!(D.current||n!==`Enter`||t===!1)&&n===`Enter`){let t=i||o||s;if(d===`enter`&&!r&&!t||d===`shiftEnter`&&r&&!t){e.preventDefault(),v?.();return}}},j=e=>{let t=e.clipboardData?.files;!e.clipboardData?.getData(`text/plain`)&&t?.length&&s&&(s(t),e.preventDefault()),o?.(e)},ee=ii(_,[`input`],te.TextArea),M={...(0,Jn.default)(S,{attr:!0,aria:!0,data:!0}),ref:C};return q.createElement(ee,c({},M,{disabled:l,style:p.input,className:m(`${f}-input`,h.input),autoSize:g,value:n,onChange:e=>{r?.(e.target.value,e)},onKeyUp:i,onCompositionStart:O,onCompositionEnd:k,onKeyDown:A,onPaste:j,variant:`borderless`,readOnly:u,placeholder:y,onFocus:b,onBlur:x}))});function oi(e,t){let n=g(e),[r,a,o]=q.useMemo(()=>typeof t==`object`?[t.recording,t.onRecordingChange,typeof t.recording==`boolean`]:[void 0,void 0,!1],[t]),[s,c]=q.useState(null);q.useEffect(()=>{if(!o&&`permissions`in navigator){let e=null;return navigator.permissions.query({name:`microphone`}).then(t=>{c(t.state),t.onchange=function(){c(this.state)},e=t}).catch(e=>{J(!1,`Sender`,`Browser does not support querying microphone permission. ${e instanceof Error?e.message:String(e)}`)}),()=>{e&&(e.onchange=null)}}},[o]);let l;!l&&typeof window<`u`&&(l=window.SpeechRecognition||window.webkitSpeechRecognition);let u=!!(o||l&&s!==`denied`),d=q.useRef(null),[f,p]=i(!1,r),m=q.useRef(!1),h=()=>{if(u&&!d.current){let e=new l;e.onstart=()=>{p(!0)},e.onend=()=>{p(!1)},e.onresult=e=>{if(!m.current){let t=e.results?.[0]?.[0]?.transcript;n(t)}m.current=!1},d.current=e}},_=g(e=>{(!e||f)&&(m.current=e,o?a?.(!f):(h(),d.current&&(f?(d.current.stop(),a?.(!1)):(d.current.start(),a?.(!0)))))});return q.useEffect(()=>()=>{let e=d.current;if(e){e.onstart=null,e.onend=null,e.onresult=null;try{e.stop()}catch{}d.current=null}},[]),[u,_,f]}var si=q.createContext({}),ci=()=>({height:0}),li=e=>({height:e.scrollHeight});function ui(e){let{title:t,onOpenChange:n,open:r,children:i,className:o,style:s,classNames:c={},styles:l={},prefixCls:u,closable:d,forceRender:f}=e,{prefixCls:p}=q.useContext(si),{direction:h,getPrefixCls:g}=$t(),_=g(`sender`,u||p),v=`${_}-header`,y=()=>{n?.(!r)};return q.createElement(a,{motionEnter:!0,motionLeave:!0,motionName:`${v}-motion`,leavedClassName:`${v}-motion-hidden`,onEnterStart:ci,onEnterActive:li,onLeaveStart:li,onLeaveActive:ci,visible:r,forceRender:f},({className:e,style:n})=>q.createElement(`div`,{className:m(_,v,e,o,{[`${v}-rtl`]:h===`rtl`}),style:{...n,...s}},(d!==!1||t)&&q.createElement(`div`,{className:m(`${v}-header`,c.header),style:{...l.header}},q.createElement(`div`,{className:`${v}-title`},t),d!==!1&&q.createElement(`div`,{className:`${v}-close`},q.createElement(A,{type:`text`,icon:q.createElement(D,null),size:`small`,onClick:y}))),i&&q.createElement(`div`,{className:m(`${v}-content`,c.content),style:{...l.content}},i)))}var di=e=>{let{componentCls:t,calc:n}=e,r=`${t}-header`;return{[t]:{[`&${r}-rtl`]:{direction:`rtl`},[`${r}`]:{borderBottomWidth:e.lineWidth,borderBottomStyle:`solid`,borderBottomColor:e.colorBorderInput,[`${r}-header`]:{background:e.colorFillAlter,fontSize:e.fontSize,lineHeight:e.lineHeight,paddingBlock:n(e.paddingSM).sub(e.lineWidthBold).equal(),paddingInlineStart:e.padding,paddingInlineEnd:e.paddingXS,display:`flex`,borderRadius:{_skip_check_:!0,value:n(e.borderRadius).mul(2).equal()},borderEndStartRadius:0,borderEndEndRadius:0,[`${r}-title`]:{flex:`auto`}},[`${r}-content`]:{padding:e.padding}},[`${r}-motion`]:{transition:[`height`,`border`].map(t=>`${t} ${e.motionDurationSlow}`).join(`,`),overflow:`hidden`,"&-enter-start, &-leave-active":{borderBottomColor:`transparent`},"&-hidden":{display:`none`}}}}},fi=e=>{let{componentCls:t,antCls:n,calc:r}=e,i=`${t}-slot`,a=`${n}-input`,o=`${a}-borderless`,c=`${n}-dropdown-trigger`,l=`${t}-slot-input`,u=`${t}-slot-select`,d=`${t}-slot-tag`,f=`${t}-slot-content`,p=`${t}-skill`;return{[t]:{[`${t}-input-slot`]:{outline:`none`,cursor:`text`,whiteSpace:`pre-wrap`,width:`100%`,caretColor:e.colorPrimary,fontSize:e.fontSize,lineHeight:e.lineHeight,"&:empty::before":{content:`attr(data-placeholder)`,color:e.colorTextPlaceholder}},[`${i}:not(${f})`]:{display:`inline-block`,verticalAlign:`middle`,alignItems:`center`,marginBlock:1,height:r(e.fontSize).mul(e.lineHeight).add(2).equal(),wordBreak:`break-all`,marginInline:e.marginXXS},[`${a}${l}`]:{height:`100%`,background:e.colorBgSlot,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,paddingInline:e.paddingXXS,fontSize:`inherit`,lineHeight:`inherit`,position:`relative`,[`&${o}`]:{"&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)":{outline:`none`}},"&::placeholder":{color:e.colorTextSlotPlaceholder,fontSize:`inherit`,lineHeight:`inherit`},[i]:{display:`inline-flex`,margin:`0 ${s(e.marginXXS)}`,verticalAlign:`bottom`,alignItems:`center`,marginBlock:s(r(e.marginXXS).div(2).equal()),minHeight:e.controlHeightSM,wordBreak:`break-all`}},[u]:{fontSize:e.fontSize,lineHeight:e.lineHeight,paddingInline:e.paddingXXS,transition:`border-color ${e.motionDurationMid}`,position:`relative`,display:`inline-flex`,alignItems:`center`,cursor:`pointer`,background:e.colorBgSlot,height:`100%`,boxSizing:`border-box`,borderRadius:e.borderRadius,color:e.colorTextSlot,border:`1px solid ${e.colorBorderSlot}`,"&.placeholder":{color:e.colorTextSlotPlaceholder},[`${u}`]:{fontSize:e.fontSize,lineHeight:e.lineHeight,padding:`0 ${s(e.paddingXXS)}`,transition:`border-color ${e.motionDurationMid}`,position:`relative`,display:`inline`,cursor:`pointer`,background:e.colorBgSlot,alignItems:`center`,justifyContent:`center`,borderRadius:e.borderRadius,color:e.colorTextSlot,border:`1px solid ${e.colorBorderSlot}`,"&.placeholder":{color:e.colorTextSlotPlaceholder},[`&${c}-open`]:{borderColor:e.colorBorderSlotHover}},[`${u}-value`]:{flex:1,fontSize:e.fontSize,lineHeight:e.lineHeight,"&:empty::before":{content:`attr(data-placeholder)`}},[`${u}-arrow`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSize,lineHeight:e.lineHeight,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},[`${d}`]:{background:e.colorBgSlot,border:`1px solid ${e.colorBorderSlot}`,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,padding:`0 ${s(e.paddingXXS)}`,fontSize:e.fontSize,lineHeight:e.lineHeight,position:`relative`,cursor:`default`}},[`${u}-arrow`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSize,lineHeight:e.lineHeight,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},[d]:{background:e.colorBgSlot,border:`1px solid ${e.colorBorderSlot}`,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,padding:`0 ${s(e.paddingXXS)}`,fontSize:e.fontSize,lineHeight:e.lineHeight,height:`100%`,boxSizing:`border-box`,position:`relative`,cursor:`default`},[f]:{height:r(e.fontSize).mul(e.lineHeight).add(2).equal(),caretColor:e.colorPrimary,background:e.colorBgSlot,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,paddingInline:e.paddingXXS,boxSizing:`border-box`,verticalAlign:`middle`,fontSize:e.fontSize,marginBlock:1,lineHeight:e.lineHeight,display:`inline-block`,position:`relative`,cursor:`text`,"&:empty":{width:`fit-content`,"&::after":{display:`inline-block`,height:`inherit`,content:`attr(data-placeholder)`,color:e.colorTextSlotPlaceholder}}},[`${i}-no-width`]:{userSelect:`none`,width:`3px`,display:`inline-block`,lineHeight:`inherit`},[p]:{display:`inline-block`,verticalAlign:`baseline`,alignItems:`center`,marginBlock:1,height:r(e.fontSize).mul(e.lineHeight).add(2).equal(),wordBreak:`break-all`,paddingInlineEnd:0,paddingInlineStart:0,marginInlineEnd:0,marginInlineStart:-1,[`&${p}-empty`]:{"&::after":{display:`inline-block`,pointerEvents:`none`,height:`inherit`,content:`attr(data-placeholder)`,color:e.colorTextPlaceholder}}},[`${p}-wrapper`]:{height:`100%`,display:`inline-flex`},[`${p}-tag`]:{paddingInline:e.paddingXS,height:`100%`,backgroundColor:e.colorBgSkill,borderRadius:e.borderRadius,color:e.colorPrimary,alignItems:`center`,fontWeight:500,display:`inline-flex`,cursor:`pointer`,gap:e.marginXXS,transition:`background-color ${e.motionDurationMid}`,"&:hover":{backgroundColor:e.colorBgSkillHover,[`${p}-tag-close:not(${p}-tag-close-disabled)`]:{color:e.colorPrimaryHover}},"&-close":{fontSize:e.fontSizeSM,display:`inline-flex`,transition:`color ${e.motionDurationMid}`,color:e.colorPrimary},"&-close-disabled":{cursor:`not-allowed`,color:e.colorTextDisabled}},[`${p}-holder`]:{width:e.marginXS,height:`100%`}}}},pi=e=>{let{componentCls:t,antCls:n}=e,r=`${t}-switch`;return{[t]:{[`&${r}-rtl`]:{direction:`rtl`},[`&${r}`]:{display:`inline-block`,[`${n}-btn:not(:disabled):not(${n}-btn-disabled):hover`]:{background:e.switchUncheckedHoverBg,borderColor:e.colorBorder,color:e.colorText},[`&${r}-checked`]:{[`${n}-btn:not(:disabled):not(${n}-btn-disabled):hover`]:{background:e.switchCheckedHoverBg,borderColor:e.colorPrimary,color:e.colorPrimaryText},[`${r}-content`]:{background:e.switchCheckedBg}}}}}},mi=e=>{let{antCls:t,componentCls:n,paddingSM:r,paddingXS:i,paddingXXS:a,lineWidth:o,calc:s}=e;return{[n]:{[`&${n}-main`]:{position:`relative`,width:`100%`,boxSizing:`border-box`,boxShadow:`${e.boxShadowTertiary}`,borderRadius:{_skip_check_:!0,value:s(e.borderRadius).mul(2).equal()},borderColor:e.colorBorderInput,borderWidth:o,borderStyle:`solid`},[`&${n}-disabled`]:{background:e.colorBgContainerDisabled,borderColor:`transparent`},[`&${n}-rtl`]:{direction:`rtl`},[`${n}-content`]:{display:`flex`,gap:i,width:`100%`,paddingBlock:r,paddingInlineStart:r,paddingInlineEnd:r,boxSizing:`border-box`,alignItems:`flex-end`},[`${n}-prefix`]:{flex:`none`},[`${n}-input`]:{paddingInline:0,borderRadius:0,flex:`auto`,alignSelf:`center`,caretColor:e.colorPrimary,fontSize:e.fontSize,[`&${t}-input-borderless`]:{"&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)":{outline:`none`}}},[`${n}-actions-list`]:{flex:`none`,display:`flex`,"&-presets":{gap:e.paddingXS}},[`${n}-actions-btn`]:{[`&-disabled:where(${t}-btn-variant-text)`]:{color:e.colorTextActionsDisabled,borderColor:`transparent`},[`&-disabled:not(${t}-btn-variant-text)`]:{background:e.colorBgActionsDisabled,color:e.colorTextLightSolid,borderColor:`transparent`},"&-loading-button":{padding:0,border:0},"&-loading-icon":{height:e.controlHeight,width:e.controlHeight,verticalAlign:`top`},"&-recording-icon":{height:`1.2em`,width:`1.2em`,verticalAlign:`top`}},[`${n}-footer`]:{paddingInlineStart:r,paddingInlineEnd:r,paddingBlockEnd:r,paddingBlockStart:a,boxSizing:`border-box`}}}},hi=Cn(`Sender`,e=>{let{paddingXS:t,calc:n}=e,r=b(e,{SenderContentMaxWidth:`calc(100% - ${s(n(t).add(32).equal())})`});return[mi(r),di(r),pi(r),fi(r)]},e=>{let{colorPrimary:t,colorFillTertiary:n}=e,r=new h(t).setA(.06).toRgbString(),i=new h(t).setA(.08).toRgbString(),a=new h(t).setA(.15).toRgbString(),o=t,s=new h(t).setA(.25).toRgbString(),c=new h(t).setA(.1).toRgbString(),l=r,u=new h(t).setA(.08).toRgbString(),d=new h(n).setA(.04).toRgbString(),f=new h(t).setA(.1).toRgbString(),p=new h(n).setA(.1).toRgbString(),m=`0 4px 12px 0 ${new h(t).setA(.1).toRgbString()}`,g=new h(t).setA(.45).toRgbString();return{colorBgSlot:r,colorBgSkill:i,colorBgSkillHover:a,colorTextSlot:o,colorTextSlotPlaceholder:s,colorBorderSlotHover:c,colorBorderSlot:l,switchCheckedBg:u,switchCheckedHoverBg:f,switchUncheckedHoverBg:d,colorBorderInput:p,boxShadowInput:m,colorBgActionsDisabled:g,colorTextActionsDisabled:g}}),gi={SendButton:Hr,ClearButton:Rr,LoadingButton:Br,SpeechButton:ni},_i=q.forwardRef((e,t)=>{let{prefixCls:n,styles:r={},classNames:a={},className:o,rootClassName:s,style:l,defaultValue:u,value:d,slotConfig:f,readOnly:p,submitType:h=`enter`,onSubmit:g,loading:_,components:v,onCancel:y,onChange:b,suffix:x,onKeyUp:S,onKeyDown:C,disabled:w,allowSpeech:T,prefix:E,footer:D,header:O,onPaste:k,onPasteFile:A,autoSize:j={maxRows:8},placeholder:ee,onFocus:M,onBlur:te,skill:ne,...re}=e,ie=(0,Jn.default)(re,{attr:!0,aria:!0,data:!0}),ae=q.useId(),P=Array.isArray(f)||ne?.value,{direction:oe,getPrefixCls:F}=$t(),I=F(`sender`,n),se=q.useRef(null),L=q.useRef(null);Ft(t,()=>({nativeElement:se.current,inputElement:L.current?.nativeElement,focus:e=>L.current?.focus(e),blur:()=>L.current?.blur(),insert:(...e)=>L.current?.insert?.(...e),clear:()=>L.current?.clear(),getValue:()=>L.current?.getValue()??{value:``,slotConfig:[],skill:void 0}}));let ce=Rt(`sender`),le=`${I}-input`,[ue,de]=hi(I),fe=m(I,ce.className,o,s,ce.classNames.root,a.root,ue,de,`${I}-main`,{[`${I}-rtl`]:oe===`rtl`,[`${I}-disabled`]:w}),pe=`${I}-actions-btn`,R=`${I}-actions-list`,[me,z]=i(u||``,d),he=(e,t,n,r)=>{z(e),b?.(e,t,n??[],r)},[B,ge,_e]=oi(e=>{P?L.current?.insert?.([{type:`text`,value:e}]):he(`${me} ${e}`)},T),ve=()=>{if(L?.current&&g&&!_&&!Ce){let e=L.current.getValue();g(e.value,e.slotConfig,e.skill)}},ye=()=>{he(``),P&&L.current?.clear?.()},be=q.createElement(N,{className:`${R}-presets`},T&&q.createElement(ni,null),_?q.createElement(Br,null):q.createElement(Hr,null)),V=be;typeof x==`function`?V=x(be,{components:gi}):(x||x===!1)&&(V=x);let H=typeof E==`function`?E(be,{components:gi}):E||null,xe=typeof O==`function`?O(be,{components:gi}):O||null,Se=typeof D==`function`?D(be,{components:gi}):D||null,[Ce,we]=(0,q.useState)(!me),Te={prefixCls:pe,onSend:ve,onSendDisabled:!me,onClear:ye,onClearDisabled:!me,onCancel:y,onCancelDisabled:!_,onSpeech:()=>ge(!1),onSpeechDisabled:!B,speechRecording:_e,disabled:w,setSubmitDisabled:we},Ee=q.useMemo(()=>({value:me,onChange:he,slotConfig:f,onKeyUp:S,onKeyDown:C,onPaste:k,onPasteFile:A,disabled:w,readOnly:p,submitType:h,prefixCls:I,styles:r,classNames:a,autoSize:j,components:v,triggerSend:ve,placeholder:ee,onFocus:M,onBlur:te,skill:ne,...re}),[me,he,f,S,C,k,A,w,p,h,I,r,a,j,v,ve,ee,M,te,ne,re]),De=e=>{!P&&e.target!==se.current?.querySelector(`.${le}`)&&e.preventDefault(),e.target===se.current?.querySelector(`.${le}`)&&L.current?.focus()};return q.createElement(`div`,c({key:ae,ref:se,className:fe,style:{...ce.style,...l,...ce.styles.root,...r.root}},ie),q.createElement(Ur.Provider,{value:Ee},q.createElement(Fr.Provider,{value:Te},xe&&q.createElement(si.Provider,{value:{prefixCls:I}},xe),q.createElement(`div`,{className:m(`${I}-content`,a.content),style:r.content,onMouseDown:De},H&&q.createElement(`div`,{className:m(`${I}-prefix`,ce.classNames.prefix,a.prefix),style:{...ce.styles.prefix,...r.prefix}},H),P?q.createElement(ti,{ref:L}):q.createElement(ai,{ref:L}),V&&q.createElement(`div`,{className:m(R,ce.classNames.suffix,a.suffix),style:{...ce.styles.suffix,...r.suffix}},V)),Se&&q.createElement(`div`,{className:m(`${I}-footer`,ce.classNames.footer,a.footer),style:{...ce.styles.footer,...r.footer}},Se))))}),vi=q.forwardRef((e,t)=>{let{children:n,className:r,classNames:a={},styles:o={},icon:s,style:l,onChange:u,rootClassName:d,loading:f,defaultValue:p,value:h,checkedChildren:g,unCheckedChildren:_,disabled:v,prefixCls:y,...b}=e,{styles:x={},classNames:S={},prefixCls:C}=q.useContext(Ur),w=(0,Jn.default)(b,{attr:!0,aria:!0,data:!0}),T=q.useId(),{direction:E,getPrefixCls:D}=$t(),O=D(`sender`,y||C),k=`${O}-switch`,[j,ee]=hi(O),M=q.useRef(null);Ft(t,()=>({nativeElement:M.current}));let[N,te]=i(p,h),ne=Rt(`sender`),re=m(O,k,r,d,ne.classNames.switch,S.switch,a.root,j,ee,{[`${k}-checked`]:N,[`${k}-rtl`]:E===`rtl`});return q.createElement(`div`,c({ref:M,className:re,key:T,style:{...l,...ne.styles.switch,...x.switch,...o.root}},w),q.createElement(A,{disabled:v,loading:f,className:m(`${k}-content`,a.content),style:o.content,styles:{icon:o.icon,content:o.title},classNames:{icon:a.icon,content:a.title},variant:`outlined`,color:N?`primary`:`default`,icon:s,onClick:()=>{let e=!N;te(e),u?.(e)}},N?g:_,n))}),yi=_i;yi.Header=ui,yi.Switch=vi;var bi=e=>{let{componentCls:t,calc:n}=e,r=n(e.fontSizeHeading3).mul(e.lineHeightHeading3).equal(),i=n(e.fontSize).mul(e.lineHeight).equal();return{[t]:{gap:e.padding,[`${t}-icon`]:{height:n(r).add(i).add(e.paddingXXS).equal(),display:`flex`,img:{height:`100%`}},[`${t}-content-wrapper`]:{gap:e.paddingXS,flex:`auto`,minWidth:0,[`${t}-title-wrapper`]:{gap:e.paddingXS},[`${t}-title`]:{margin:0},[`${t}-extra`]:{marginInlineStart:`auto`}}}}},xi=e=>{let{componentCls:t}=e;return{[t]:{"&-filled":{paddingInline:e.padding,paddingBlock:e.paddingSM,background:e.colorFillContent,borderRadius:e.borderRadiusLG},"&-borderless":{[`${t}-title`]:{fontSize:e.fontSizeHeading3,lineHeight:e.lineHeightHeading3}}}}},Si=Cn(`Welcome`,e=>{let t=b(e,{});return[bi(t),xi(t)]},()=>({})),Ci=q.forwardRef((e,t)=>{let{prefixCls:n,rootClassName:r,className:i,style:a,variant:o=`filled`,classNames:s={},styles:c={},icon:l,title:u,description:d,extra:f}=e,{direction:p,getPrefixCls:h}=$t(),g=h(`welcome`,n),_=Rt(`welcome`),[v,y]=Si(g),b=q.useMemo(()=>{if(!l)return null;let e=l;return typeof l==`string`&&l.startsWith(`http`)&&(e=q.createElement(`img`,{src:l,alt:`icon`})),q.createElement(`div`,{className:m(`${g}-icon`,_.classNames.icon,s.icon),style:c.icon},e)},[l]),x=q.useMemo(()=>u?q.createElement(w.Title,{level:4,className:m(`${g}-title`,_.classNames.title,s.title),style:c.title},u):null,[u]),S=q.useMemo(()=>f?q.createElement(`div`,{className:m(`${g}-extra`,_.classNames.extra,s.extra),style:c.extra},f):null,[f]);return q.createElement(N,{ref:t,className:m(g,_.className,i,r,s.root,v,y,`${g}-${o}`,{[`${g}-rtl`]:p===`rtl`}),style:{...a,...c.root}},b,q.createElement(N,{vertical:!0,className:`${g}-content-wrapper`},f?q.createElement(N,{align:`flex-start`,className:`${g}-title-wrapper`},x,S):x,d&&q.createElement(w.Text,{className:m(`${g}-description`,_.classNames.description,s.description),style:c.description},d)))}),wi={_chatMessagesStores:new Map,get:e=>wi._chatMessagesStores.get(e),set:(e,t)=>{wi._chatMessagesStores.set(e,t)},delete:e=>{wi._chatMessagesStores.delete(e)},getMessages:e=>wi._chatMessagesStores.get(e)?.getMessages()},Ti={_allConversationStores:new Map,set:(e,t)=>{Ti._allConversationStores.set(e,t)},delete:e=>{Ti._allConversationStores.delete(e)},getConversation:e=>{for(let t of Ti._allConversationStores.values())if(t){let n=t.getConversation(e);if(n)return n}}},Ei=class{conversations=[];listeners=[];storeKey;activeConversationKey;emitListeners(){this.listeners.forEach(e=>{e()})}constructor(e,t){this.setConversations(e),this.storeKey=Math.random().toString(),Ti.set(this.storeKey,this),this.activeConversationKey=t}setActiveConversationKey=e=>(this.activeConversationKey=e,this.emitListeners(),!0);setConversations=e=>(this.conversations=[...e],this.emitListeners(),!0);getConversation=e=>this.conversations.find(t=>t.key===e);addConversation=(e,t)=>!this.getConversation(e.key)&&(this.setConversations(t===`prepend`?[e,...this.conversations]:[...this.conversations,e]),!0);setConversation=(e,t)=>{let n=this.getConversation(e);return n?(Object.assign(n,t),this.setConversations([...this.conversations]),!0):!1};removeConversation=e=>{let t=this.conversations.findIndex(t=>t.key===e);return t!==-1&&(this.conversations.splice(t,1),this.setConversations([...this.conversations]),!0)};getMessages=e=>wi.getMessages(e);getSnapshot=()=>this.conversations;getActiveConversationKey=()=>this.activeConversationKey;subscribe=e=>(this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)});destroy=()=>{Ti.delete(this.storeKey)}};function Di(e){let[t]=(0,q.useState)(()=>new Ei(e?.defaultConversations||[],e?.defaultActiveConversationKey||``));return(0,q.useEffect)(()=>()=>{t.destroy()},[]),{conversations:(0,q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot),activeConversationKey:(0,q.useSyncExternalStore)(t.subscribe,t.getActiveConversationKey,t.getActiveConversationKey),setActiveConversationKey:t.setActiveConversationKey,addConversation:t.addConversation,removeConversation:t.removeConversation,setConversation:t.setConversation,getConversation:t.getConversation,setConversations:t.setConversations,getMessages:t.getMessages}}var Oi=`
|
|
|
|
`,ki=`
|
|
`,Ai=`:`,ji=e=>(e??``).trim()!==``;function Mi(e=Oi){let t=``;return new TransformStream({transform(n,r){t+=n;let i=t.split(e);i.slice(0,-1).forEach(e=>{ji(e)&&r.enqueue(e)}),t=i[i.length-1]},flush(e){ji(t)&&e.enqueue(t)}})}function Ni(e=ki,t=Ai){return new TransformStream({transform(n,r){let i=n.split(e).reduce((e,n)=>{let r=n.indexOf(t);if(r===-1)return console.warn(`The key-value separator "${t}" is not found in the sse line: ${n} !`),e;let i=n.slice(0,r).trim();if(!ji(i))return e;let a=n.slice(r+1).trim();return{...e,[i]:a}},{});Object.keys(i).length!==0&&r.enqueue(i)}})}function Pi(){if(typeof TextDecoderStream<`u`)return new TextDecoderStream;let e=new TextDecoder(`utf-8`);return new TransformStream({transform(t,n){n.enqueue(e.decode(t,{stream:!0}))},flush(t){t.enqueue(e.decode())}})}function Fi(e){let{readableStream:t,transformStream:n,streamSeparator:r,partSeparator:i,kvSeparator:a}=e;if(!(t instanceof ReadableStream))throw Error(`The options.readableStream must be an instance of ReadableStream.`);let o=Pi(),s=n?t.pipeThrough(o).pipeThrough(n):t.pipeThrough(o).pipeThrough(Mi(r)).pipeThrough(Ni(i,a));return s[Symbol.asyncIterator]=async function*(){let e=this.getReader(),t=!1;try{for(;;){let{done:n,value:r}=await e.read();if(n){t=!0;break}r&&(yield r)}}finally{t||e.cancel().catch(()=>{}),e.releaseLock()}},s}var Ii=async(e,t)=>{let{fetch:n=globalThis.fetch,middlewares:r={},...i}=t;if(typeof n!=`function`)throw Error(`The options.fetch must be a typeof fetch function!`);let a=[e,i];typeof r.onRequest==`function`&&(a=await r.onRequest(...a));let o=await n(...a);if(typeof r.onResponse==`function`){let e=await r.onResponse(o);if(!(e instanceof Response))throw Error(`The options.onResponse must return a Response instance!`);o=e}if(!o.ok)throw Error(`Fetch failed with status ${o.status}`);if(!o.body)throw Error(`The response body is empty.`);return o},Li={manual:!1,headers:{"Content-Type":`application/json`}},Ri=`Last-Event-ID`,zi=class{baseURL;options;constructor(e,t){if(!e||typeof e!=`string`)throw Error(`The baseURL is not valid!`);this.baseURL=e,this.options=t||{}}},Bi=class extends zi{_asyncHandler;timeoutHandler;_isTimeout=!1;streamTimeoutHandler;_isStreamTimeout=!1;abortController;_isRequesting=!1;_manual=!1;lastManualParams;retryTimes=0;retryTimer;lastEventId=void 0;get asyncHandler(){return this._asyncHandler}get isTimeout(){return this._isTimeout}set isTimeout(e){this._isTimeout=e}get isStreamTimeout(){return this._isStreamTimeout}set isStreamTimeout(e){this._isStreamTimeout=e}get isRequesting(){return this._isRequesting}get manual(){return this._manual}constructor(e,t){super(e,t),this._manual=t?.manual||!1,this.manual||this.init()}run(e){return this.manual?(this.resetRetry(),this.lastManualParams=e,this.init(e),!0):(console.warn(`The request is not manual, so it cannot be run!`),!1)}abort(){clearTimeout(this.timeoutHandler),clearTimeout(this.streamTimeoutHandler),this.abortController.abort()}init(e,t){this.abortController=new AbortController;let{callbacks:n,params:r,headers:i={},transformStream:a,fetch:o,timeout:s,streamTimeout:c,middlewares:l,streamSeparator:u,partSeparator:d,kvSeparator:f,...p}=this.options,m=Object.assign({},Li.headers||{},i,t||{}),h={...p,method:`POST`,body:JSON.stringify({...r,...e||{}}),params:{...r,...e},headers:m,signal:this.abortController.signal,middlewares:l};s&&s>0&&(this.timeoutHandler=window.setTimeout(()=>{this.isTimeout=!0,this.finishRequest(),n?.onError?.(Error(`TimeoutError`))},s)),this.startRequest(),this._asyncHandler=Ii(this.baseURL,{fetch:o,...h}).then(async e=>{if(clearTimeout(this.timeoutHandler),this.isTimeout)return;if(a){let t=a;typeof a==`function`&&(t=a(this.baseURL,e.headers)),await this.customResponseHandler(e,n,t,c,u,d,f);return}let t=e.headers.get(`content-type`)||``;switch(t.split(`;`)[0].trim()){case`text/event-stream`:await this.sseResponseHandler(e,n,c,u,d,f);break;case`application/json`:await this.jsonResponseHandler(e,n);break;default:throw Error(`The response content-type: ${t} is not support!`)}}).catch(e=>{clearTimeout(this.timeoutHandler),this.finishRequest();let t=e instanceof Error||e instanceof DOMException?e:Error(`Unknown error!`),r=n?.onError?.(t);if(t.name!==`AbortError`){let e=typeof r==`number`?r:this.options.retryInterval;if(e&&e>0){if(typeof this.options.retryTimes==`number`&&this.retryTimes>=this.options.retryTimes)return;clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{let e={};this.lastEventId!==void 0&&(e[Ri]=this.lastEventId),this.init(this.lastManualParams,e)},e),this.retryTimes+=1}}})}startRequest(){this._isRequesting=!0}finishRequest(){this._isRequesting=!1}customResponseHandler=async(e,t,n,r,i,a,o)=>{let s=Fi({readableStream:e.body,transformStream:n,streamSeparator:i,partSeparator:a,kvSeparator:o});await this.processStream(s,e,t,r)};sseResponseHandler=async(e,t,n,r,i,a)=>{let o=Fi({readableStream:e.body,streamSeparator:r,partSeparator:i,kvSeparator:a});await this.processStream(o,e,t,n)};async processStream(e,t,n,r){let i=[],a=e[Symbol.asyncIterator](),o;do{if(r&&(this.streamTimeoutHandler=window.setTimeout(()=>{this.isStreamTimeout=!0,this.finishRequest(),n?.onError?.(Error(`StreamTimeoutError`),void 0,t.headers)},r)),o=await a.next(),clearTimeout(this.streamTimeoutHandler),this.isStreamTimeout)break;o.value&&(i.push(o.value),n?.onUpdate?.(o.value,t.headers),o?.value?.id!==void 0&&(this.lastEventId=o.value.id))}while(!o.done);r&&(clearTimeout(this.streamTimeoutHandler),this.isStreamTimeout)?this.finishRequest():(this.finishRequest(),n?.onSuccess?.(i,t.headers))}jsonResponseHandler=async(e,t)=>{let n=await e.json();if(n?.success===!1){let r=Error(n.message||`System error`);r.name=n.name||`SystemError`,t?.onError?.(r,n,e.headers)}else t?.onUpdate?.(n,e.headers),this.finishRequest(),t?.onSuccess?.([n],e.headers)};resetRetry(){clearTimeout(this.retryTimer),this.retryTimes=0,this.lastEventId=void 0}};function Vi(e,t){return new Bi(e,t)}function Hi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ui=Hi();function Wi(e){Ui=e}var Gi={exec:()=>null};function X(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Ki.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ki={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},qi=/^(?:[ \t]*(?:\n|$))+/,Ji=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Yi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Zi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Qi=/(?:[*+-]|\d{1,9}[.)])/,$i=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ea=X($i).replace(/bull/g,Qi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ta=X($i).replace(/bull/g,Qi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),na=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ra=/^[^\n]+/,ia=/(?!\s*\])(?:\\.|[^\[\]\\])+/,aa=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ia).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),oa=X(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Qi).getRegex(),sa=`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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,ca=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,la=X(`^ {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`,ca).replace(`tag`,sa).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ua=X(na).replace(`hr`,Xi).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`,sa).getRegex(),da={blockquote:X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ua).getRegex(),code:Ji,def:aa,fences:Yi,heading:Zi,hr:Xi,html:la,lheading:ea,list:oa,newline:qi,paragraph:ua,table:Gi,text:ra},fa=X(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Xi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\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`,sa).getRegex(),pa={...da,lheading:ta,table:fa,paragraph:X(na).replace(`hr`,Xi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,fa).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`,sa).getRegex()},ma={...da,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,ca).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:Gi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(na).replace(`hr`,Xi).replace(`heading`,` *#{1,6} *[^
|
|
]`).replace(`lheading`,ea).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ha=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ga=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_a=/^( {2,}|\\)\n(?!\s*$)/,va=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ya=/[\p{P}\p{S}]/u,ba=/[\s\p{P}\p{S}]/u,xa=/[^\s\p{P}\p{S}]/u,Sa=X(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ba).getRegex(),Ca=/(?!~)[\p{P}\p{S}]/u,wa=/(?!~)[\s\p{P}\p{S}]/u,Ta=/(?:[^\s\p{P}\p{S}]|~)/u,Ea=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Da=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Oa=X(Da,`u`).replace(/punct/g,ya).getRegex(),ka=X(Da,`u`).replace(/punct/g,Ca).getRegex(),Aa=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,ja=X(Aa,`gu`).replace(/notPunctSpace/g,xa).replace(/punctSpace/g,ba).replace(/punct/g,ya).getRegex(),Ma=X(Aa,`gu`).replace(/notPunctSpace/g,Ta).replace(/punctSpace/g,wa).replace(/punct/g,Ca).getRegex(),Na=X(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,xa).replace(/punctSpace/g,ba).replace(/punct/g,ya).getRegex(),Pa=X(/\\(punct)/,`gu`).replace(/punct/g,ya).getRegex(),Fa=X(/^<(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(),Ia=X(ca).replace(`(?:-->|$)`,`-->`).getRegex(),La=X(`^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`,Ia).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ra=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,za=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,Ra).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ba=X(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ra).replace(`ref`,ia).getRegex(),Va=X(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ia).getRegex(),Ha={_backpedal:Gi,anyPunctuation:Pa,autolink:Fa,blockSkip:Ea,br:_a,code:ga,del:Gi,emStrongLDelim:Oa,emStrongRDelimAst:ja,emStrongRDelimUnd:Na,escape:ha,link:za,nolink:Va,punctuation:Sa,reflink:Ba,reflinkSearch:X(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ba).replace(`nolink`,Va).getRegex(),tag:La,text:va,url:Gi},Ua={...Ha,link:X(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ra).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ra).getRegex()},Wa={...Ha,emStrongRDelimAst:Ma,emStrongLDelim:ka,url:X(/^((?: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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ga={...Wa,br:X(_a).replace(`{2,}`,`*`).getRegex(),text:X(Wa.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ka={normal:da,gfm:pa,pedantic:ma},qa={normal:Ha,gfm:Wa,breaks:Ga,pedantic:Ua},Ja={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ya=e=>Ja[e];function Xa(e,t){if(t){if(Ki.escapeTest.test(e))return e.replace(Ki.escapeReplace,Ya)}else if(Ki.escapeTestNoEncode.test(e))return e.replace(Ki.escapeReplaceNoEncode,Ya);return e}function Za(e){try{e=encodeURI(e).replace(Ki.percentDecode,`%`)}catch{return null}return e}function Qa(e,t){let n=e.replace(Ki.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Ki.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Ki.slashPipe,`|`);return n}function $a(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function eo(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function to(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function no(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
`)}var ro=class{options;rules;lexer;constructor(e){this.options=e||Ui}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:$a(e,`
|
|
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=no(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=$a(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:$a(t[0],`
|
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=$a(t[0],`
|
|
`).split(`
|
|
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
${s}`:s,r=r?`${r}
|
|
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
`+e.join(`
|
|
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
`+e.join(`
|
|
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let 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){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Qa(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Qa(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let 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){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let 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){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.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){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=$a(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=eo(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),to(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return to(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let 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){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},io=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ui,this.options.tokenizer=this.options.tokenizer||new ro,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ki,block:Ka.normal,inline:qa.normal};this.options.pedantic?(t.block=Ka.pedantic,t.inline=qa.pedantic):this.options.gfm&&(t.block=Ka.gfm,t.inline=this.options.breaks?qa.breaks:qa.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ka,inline:qa}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Ki.carriageReturn,`
|
|
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Ki.tabCharGlobal,` `).replace(Ki.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
`+r.raw,n.text+=`
|
|
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
`+r.raw,n.text+=`
|
|
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
|
|
`+r.raw,a.text+=`
|
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
|
|
`+r.raw,n.text+=`
|
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if((r=this.tokenizer.escape(e))||(r=this.tokenizer.tag(e))||(r=this.tokenizer.link(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if((r=this.tokenizer.emStrong(e,n,a))||(r=this.tokenizer.codespan(e))||(r=this.tokenizer.br(e))||(r=this.tokenizer.del(e))||(r=this.tokenizer.autolink(e))||!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},ao=class{options;parser;constructor(e){this.options=e||Ui}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Ki.notSpaceStart)?.[0],i=e.replace(Ki.endingNewline,``)+`
|
|
`;return r?`<pre><code class="language-`+Xa(r)+`">`+(n?i:Xa(i,!0))+`</code></pre>
|
|
`:`<pre><code>`+(n?i:Xa(i,!0))+`</code></pre>
|
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
${this.parser.parse(e)}</blockquote>
|
|
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
`}hr(e){return`<hr>
|
|
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
`+r+`</`+i+`>
|
|
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+Xa(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
<thead>
|
|
`+t+`</thead>
|
|
`+r+`</table>
|
|
`}tablerow({text:e}){return`<tr>
|
|
${e}</tr>
|
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Xa(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Za(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Xa(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Za(e);if(i===null)return Xa(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Xa(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Xa(e.text)}},oo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},so=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ui,this.options.renderer=this.options.renderer||new ao,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oo}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
`+this.renderer.text(i);n+=t?this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},co=class{options;block;constructor(e){this.options=e||Ui}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?io.lex:io.lexInline}provideParser(){return this.block?so.parse:so.parseInline}},lo=class{defaults=Hi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=so;Renderer=ao;TextRenderer=oo;Lexer=io;Tokenizer=ro;Hooks=co;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ao(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ro(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new co;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=co.passThroughHooks.has(n)?e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return io.lex(e,t??this.defaults)}parser(e,t){return so.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?io.lex:io.lexInline,s=i.hooks?i.hooks.provideParser():e?so.parse:so.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Xa(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},uo=new lo;function Z(e,t){return uo.parse(e,t)}Z.options=Z.setOptions=function(e){return uo.setOptions(e),Z.defaults=uo.defaults,Wi(Z.defaults),Z},Z.getDefaults=Hi,Z.defaults=Ui,Z.use=function(...e){return uo.use(...e),Z.defaults=uo.defaults,Wi(Z.defaults),Z},Z.walkTokens=function(e,t){return uo.walkTokens(e,t)},Z.parseInline=uo.parseInline,Z.Parser=so,Z.parser=so.parse,Z.Renderer=ao,Z.TextRenderer=oo,Z.Lexer=io,Z.lexer=io.lex,Z.Tokenizer=ro,Z.Hooks=co,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,so.parse,io.lex;var fo={escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeTest:/[&<>"'/]/,notSpaceStart:/^\S*/,endingNewline:/\n$/,escapeReplace:/[&<>"'/]/g,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,completeFencedCode:/^ {0,3}(`{3,}|~{3,})([\s\S]*?)\n {0,3}\1[ \n\t]*$/},po={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},mo=e=>po[e];function ho(e,t){if(t){if(fo.escapeTest.test(e))return e.replace(fo.escapeReplace,mo)}else if(fo.escapeTestNoEncode.test(e))return e.replace(fo.escapeReplaceNoEncode,mo);return e}var go=Symbol(`tailMarker`),_o=`X_MD_NL_`,vo=``,yo=/\uE000X_MD_NL_\d+\uE001/g,bo=class{options;markdownInstance;injectTail=!1;constructor(e={}){this.options=e,this.markdownInstance=new lo,this.configureLinkRenderer(),this.configureParagraphRenderer(),this.configureCodeRenderer(),this.configureHtmlEscapeRenderer(),this.configureTailInjection(),this.markdownInstance.use(e.markedConfig||{})}configureHtmlEscapeRenderer(){this.options.escapeRawHtml&&this.markdownInstance.use({renderer:{html(e){let{raw:t=``,text:n=``}=e;return ho(t||n,!0)}}})}configureLinkRenderer(){this.options.openLinksInNewTab&&this.markdownInstance.use({renderer:{link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n);return`<a href="${e}"${t?` title="${t}"`:``} target="_blank" rel="noopener noreferrer">${r}</a>`}}})}configureParagraphRenderer(){let{paragraphTag:e}=this.options;e&&this.markdownInstance.use({renderer:{paragraph({tokens:t}){return`<${e}>${this.parser.parseInline(t)}</${e}>\n`}}})}configureCodeRenderer(){this.markdownInstance.use({renderer:{code({text:e,raw:t,lang:n,escaped:r,codeBlockStyle:i}){let a=(n||``).trim(),o=a.match(fo.notSpaceStart)?.[0],s=`${e.replace(fo.endingNewline,``)}\n`,c=i===`indented`||fo.completeFencedCode.test(t)?`done`:`loading`,l=r?s:ho(s,!0),u=o?` class="language-${ho(o)}"`:``;return`<pre><code${` data-block="true" data-state="${c}"`+(a?` data-lang="${ho(a)}"`:``)}${u}>${l}</code></pre>\n`}}})}configureTailInjection(){let e=this;this.markdownInstance.use({hooks:{processAllTokens(t){if(!e.injectTail)return t;let n=e.findLastTextToken(t);return n&&(n[go]=!0),t}},renderer:{text(e){let t=`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`text`in e?e.text:``;return e[go]?`${t}<xmd-tail></xmd-tail>`:t}}})}protectCustomTags(e,t){let n=new Map,r=Object.keys(this.options.components||{});if(r.length===0)return{protected:e,placeholders:n};let i=0,a=e=>e.replace(/\n/g,()=>{let e=`${_o}${i++}${vo}`;return n.set(e,`
|
|
`),e}),o=r.map(e=>e.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),s=RegExp(`<(${o})(?:\\s[^>]*)?>`,`gi`),c=RegExp(`</(${o})>`,`gi`),l=[],u=s.exec(e);for(;u!==null;)l.push({index:u.index,type:`open`,tagName:u[1].toLowerCase(),match:u[0]}),u=s.exec(e);for(c.lastIndex=0,u=c.exec(e);u!==null;)l.push({index:u.index,type:`close`,tagName:u[1].toLowerCase(),match:u[0]}),u=c.exec(e);l.sort((e,t)=>e.index-t.index);let d=[],f=[],p=0;for(let n of l)if(n.type===`open`)n.match.endsWith(`/>`)||d.push({tagName:n.tagName,start:n.index,openTag:n.match});else if(n.type===`close`&&d.length>0&&d[d.length-1].tagName===n.tagName){let r=d.pop();if(d.length===0){let i=r.start,o=n.index+n.match.length,s=r.openTag,c=n.match,l=e.slice(i+s.length,n.index);if(p<i&&f.push(e.slice(p,i)),t&&l.includes(`
|
|
`)){let e=a(l);f.push(s+e+c)}else if(l.includes(`
|
|
|
|
`)){let e=l.replace(/\n{2,}/g,e=>a(e));f.push(s+e+c)}else f.push(s+l+c);p=o}}return p<e.length&&f.push(e.slice(p)),{protected:f.join(``),placeholders:n}}restorePlaceholders(e,t){return t.size===0?e:e.replace(yo,e=>t.get(e)??e)}findLastNonEmptyToken(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`list`&&`items`in n&&Array.isArray(n.items))for(let e=n.items.length-1;e>=0;e--){let t=n.items[e];if(`tokens`in t&&t.tokens&&t.tokens.length>0){let e=this.findLastNonEmptyToken(t.tokens);if(e)return e}}if(`tokens`in n&&n.tokens&&n.tokens.length>0){let e=this.findLastNonEmptyToken(n.tokens);if(e)return e}if(n.type===`text`){if((`text`in n?n.text:``).trim())return n}else if(n.type===`html`||n.type===`tag`)return n}return null}findLastTextToken(e){let t=this.findLastNonEmptyToken(e);return t?.type===`text`?t:null}parse(e,t){if(this.injectTail=t?.injectTail??!1,this.options.protectCustomTagNewlines||this.options.disableCustomTagBlockMarkdown){let{protected:t,placeholders:n}=this.protectCustomTags(e,!!this.options.disableCustomTagBlockMarkdown),r=this.markdownInstance.parse(t);return this.restorePlaceholders(r,n)}return this.markdownInstance.parse(e)}},xo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(t=e.ElementType||={});function n(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype})),So=t(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.cloneNode=e.hasChildren=e.isDocument=e.isDirective=e.isComment=e.isText=e.isCDATA=e.isTag=e.Element=e.Document=e.CDATA=e.NodeWithChildren=e.ProcessingInstruction=e.Comment=e.Text=e.DataNode=e.Node=void 0;var a=xo(),o=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return e===void 0&&(e=!1),S(this,e)},e}();e.Node=o;var s=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.data=t,n}return Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),t}(o);e.DataNode=s;var c=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=a.ElementType.Text,t}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),t}(s);e.Text=c;var l=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=a.ElementType.Comment,t}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),t}(s);e.Comment=l;var u=function(e){r(t,e);function t(t,n){var r=e.call(this,n)||this;return r.name=t,r.type=a.ElementType.Directive,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),t}(s);e.ProcessingInstruction=u;var d=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.children=t,n}return Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.children[0]??null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(o);e.NodeWithChildren=d;var f=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=a.ElementType.CDATA,t}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(d);e.CDATA=f;var p=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=a.ElementType.Root,t}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(d);e.Document=p;var m=function(e){r(t,e);function t(t,n,r,i){r===void 0&&(r=[]),i===void 0&&(i=t===`script`?a.ElementType.Script:t===`style`?a.ElementType.Style:a.ElementType.Tag);var o=e.call(this,r)||this;return o.name=t,o.attribs=n,o.type=i,o}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map(function(t){return{name:t,value:e.attribs[t],namespace:e[`x-attribsNamespace`]?.[t],prefix:e[`x-attribsPrefix`]?.[t]}})},enumerable:!1,configurable:!0}),t}(d);e.Element=m;function h(e){return(0,a.isTag)(e)}e.isTag=h;function g(e){return e.type===a.ElementType.CDATA}e.isCDATA=g;function _(e){return e.type===a.ElementType.Text}e.isText=_;function v(e){return e.type===a.ElementType.Comment}e.isComment=v;function y(e){return e.type===a.ElementType.Directive}e.isDirective=y;function b(e){return e.type===a.ElementType.Root}e.isDocument=b;function x(e){return Object.prototype.hasOwnProperty.call(e,`children`)}e.hasChildren=x;function S(e,t){t===void 0&&(t=!1);var n;if(_(e))n=new c(e.data);else if(v(e))n=new l(e.data);else if(h(e)){var r=t?C(e.children):[],a=new m(e.name,i({},e.attribs),r);r.forEach(function(e){return e.parent=a}),e.namespace!=null&&(a.namespace=e.namespace),e[`x-attribsNamespace`]&&(a[`x-attribsNamespace`]=i({},e[`x-attribsNamespace`])),e[`x-attribsPrefix`]&&(a[`x-attribsPrefix`]=i({},e[`x-attribsPrefix`])),n=a}else if(g(e)){var r=t?C(e.children):[],o=new f(r);r.forEach(function(e){return e.parent=o}),n=o}else if(b(e)){var r=t?C(e.children):[],s=new p(r);r.forEach(function(e){return e.parent=s}),e[`x-mode`]&&(s[`x-mode`]=e[`x-mode`]),n=s}else if(y(e)){var d=new u(e.name,e.data);e[`x-name`]!=null&&(d[`x-name`]=e[`x-name`],d[`x-publicId`]=e[`x-publicId`],d[`x-systemId`]=e[`x-systemId`]),n=d}else throw Error(`Not implemented yet: ${e.type}`);return n.startIndex=e.startIndex,n.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(n.sourceCodeLocation=e.sourceCodeLocation),n}e.cloneNode=S;function C(e){for(var t=e.map(function(e){return S(e,!0)}),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}})),Co=t(((e,t,n)=>{var r=n&&n.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),i=n&&n.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&r(t,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var a=xo(),o=So();i(So(),e);var s={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},c=function(){function e(e,t,n){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=s),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??s,this.elementCB=n??null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?a.ElementType.Tag:void 0,r=new o.Element(e,t,void 0,n);this.addNode(r),this.tagStack.push(r)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===a.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new o.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===a.ElementType.Comment)this.lastNode.data+=e;else{var t=new o.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new o.Text(``),t=new o.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new o.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();e.DomHandler=c,e.default=c})),wo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=`animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.linearGradient.radialGradient.textPath`.split(`.`),e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,t){return e[t.toLowerCase()]=t,e},{}),e.CARRIAGE_RETURN=`\r`,e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,`g`),e.CARRIAGE_RETURN_PLACEHOLDER=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,`g`)})),To=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatAttributes=i,e.hasOpenTag=o,e.escapeSpecialCharacters=s,e.revertEscapedCharacters=c,e.formatDOM=l;var t=Co(),n=wo();function r(e){return n.CASE_SENSITIVE_TAG_NAMES_MAP[e]}function i(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n];t[i.name]=i.value}return t}function a(e){return e=e.toLowerCase(),r(e)||e}function o(e,t){var n=`<`+t,r=e.toLowerCase().indexOf(n);if(r===-1)return!1;var i=e[r+n.length];return i===`>`||i===` `||i===` `||i===`
|
|
`||i===`\r`||i===`/`}function s(e){return e.replace(n.CARRIAGE_RETURN_REGEX,n.CARRIAGE_RETURN_PLACEHOLDER)}function c(e){return e.replace(n.CARRIAGE_RETURN_PLACEHOLDER_REGEX,n.CARRIAGE_RETURN)}function l(e,n,r){n===void 0&&(n=null);for(var o=[],s,u=0,d=e.length;u<d;u++){var f=e[u];switch(f.nodeType){case 1:var p=a(f.nodeName);s=new t.Element(p,i(f.attributes)),s.children=l(p===`template`?f.content.childNodes:f.childNodes,s);break;case 3:s=new t.Text(c(f.nodeValue??``));break;case 8:s=new t.Comment(f.nodeValue??``);break;default:continue}var m=o[u-1]??null;m&&(m.next=s),s.parent=n,s.prev=m,s.next=null,o.push(s)}return r&&(s=new t.ProcessingInstruction(r.substring(0,r.indexOf(` `)).toLowerCase(),r),s.next=o[0]??null,s.parent=n,o.unshift(s),o[1]&&(o[1].prev=o[0])),o}})),Eo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=h;var t=To(),n=`html`,r=`head`,i=`body`,a=/<([a-zA-Z]+[0-9]?)/,o=function(e,t){throw Error("This browser does not support `document.implementation.createHTMLDocument`")},s=function(e,t){throw Error("This browser does not support `DOMParser.prototype.parseFromString`")},c=typeof window==`object`&&window.DOMParser;if(typeof c==`function`){var l=new c,u=`text/html`;s=function(e,t){return t&&(e=`<${t}>${e}</${t}>`),l.parseFromString(e,u)},o=s}if(typeof document==`object`&&document.implementation){var d=document.implementation.createHTMLDocument();o=function(e,t){if(t){var n=d.documentElement.querySelector(t);return n&&(n.innerHTML=e),d}return d.documentElement.innerHTML=e,d}}var f=typeof document==`object`&&document.createElement(`template`),p;f&&f.content&&(p=function(e){return f.innerHTML=e,f.content.childNodes});var m=function(){return document.createDocumentFragment().childNodes};function h(e){var c,l;e=(0,t.escapeSpecialCharacters)(e);var u=(a.exec(e)?.[1])?.toLowerCase();switch(u){case n:var d=s(e);if(!(0,t.hasOpenTag)(e,r)){var f=d.querySelector(r);(c=f?.parentNode)==null||c.removeChild(f)}if(!(0,t.hasOpenTag)(e,i)){var f=d.querySelector(i);(l=f?.parentNode)==null||l.removeChild(f)}return d.querySelectorAll(n);case r:case i:var h=o(e).querySelectorAll(u);return(0,t.hasOpenTag)(e,i)&&(0,t.hasOpenTag)(e,r)?h[0].parentNode?.childNodes??m():h;default:if(p)return p(e);var f=o(e,i).querySelector(i);return f?.childNodes??m()}}})),Do=t(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var i=r(Eo()),a=To(),o=/<(![a-zA-Z\s]+)>/;function s(e){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];var t=o.exec(e),n=t?t[1]:void 0;return(0,a.formatDOM)((0,i.default)(e),null,n)}})),Oo=t((e=>{e.SAME=0,e.CAMELCASE=1,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":`acceptCharset`,accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:`className`,classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:`htmlFor`,form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":`httpEquiv`,icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":`accentHeight`,accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":`alignmentBaseline`,allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":`arabicForm`,ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":`baselineShift`,baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":`capHeight`,clip:0,clipPath:1,"clip-path":`clipPath`,clipPathUnits:1,clipRule:1,"clip-rule":`clipRule`,color:0,colorInterpolation:1,"color-interpolation":`colorInterpolation`,colorInterpolationFilters:1,"color-interpolation-filters":`colorInterpolationFilters`,colorProfile:1,"color-profile":`colorProfile`,colorRendering:1,"color-rendering":`colorRendering`,contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":`dominantBaseline`,dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":`enableBackground`,end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":`fillOpacity`,fillRule:1,"fill-rule":`fillRule`,filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":`floodOpacity`,floodColor:1,"flood-color":`floodColor`,focusable:0,fontFamily:1,"font-family":`fontFamily`,fontSize:1,"font-size":`fontSize`,fontSizeAdjust:1,"font-size-adjust":`fontSizeAdjust`,fontStretch:1,"font-stretch":`fontStretch`,fontStyle:1,"font-style":`fontStyle`,fontVariant:1,"font-variant":`fontVariant`,fontWeight:1,"font-weight":`fontWeight`,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":`glyphName`,glyphOrientationHorizontal:1,"glyph-orientation-horizontal":`glyphOrientationHorizontal`,glyphOrientationVertical:1,"glyph-orientation-vertical":`glyphOrientationVertical`,glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":`horizAdvX`,horizOriginX:1,"horiz-origin-x":`horizOriginX`,ideographic:0,imageRendering:1,"image-rendering":`imageRendering`,in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":`letterSpacing`,lightingColor:1,"lighting-color":`lightingColor`,limitingConeAngle:1,local:0,markerEnd:1,"marker-end":`markerEnd`,markerHeight:1,markerMid:1,"marker-mid":`markerMid`,markerStart:1,"marker-start":`markerStart`,markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":`overlinePosition`,overlineThickness:1,"overline-thickness":`overlineThickness`,paintOrder:1,"paint-order":`paintOrder`,panose1:0,"panose-1":`panose1`,pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":`pointerEvents`,points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":`renderingIntent`,repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":`shapeRendering`,slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":`stopColor`,stopOpacity:1,"stop-opacity":`stopOpacity`,strikethroughPosition:1,"strikethrough-position":`strikethroughPosition`,strikethroughThickness:1,"strikethrough-thickness":`strikethroughThickness`,string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":`strokeDasharray`,strokeDashoffset:1,"stroke-dashoffset":`strokeDashoffset`,strokeLinecap:1,"stroke-linecap":`strokeLinecap`,strokeLinejoin:1,"stroke-linejoin":`strokeLinejoin`,strokeMiterlimit:1,"stroke-miterlimit":`strokeMiterlimit`,strokeWidth:1,"stroke-width":`strokeWidth`,strokeOpacity:1,"stroke-opacity":`strokeOpacity`,suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":`textAnchor`,textDecoration:1,"text-decoration":`textDecoration`,textLength:1,textRendering:1,"text-rendering":`textRendering`,to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":`underlinePosition`,underlineThickness:1,"underline-thickness":`underlineThickness`,unicode:0,unicodeBidi:1,"unicode-bidi":`unicodeBidi`,unicodeRange:1,"unicode-range":`unicodeRange`,unitsPerEm:1,"units-per-em":`unitsPerEm`,unselectable:0,vAlphabetic:1,"v-alphabetic":`vAlphabetic`,values:0,vectorEffect:1,"vector-effect":`vectorEffect`,version:0,vertAdvY:1,"vert-adv-y":`vertAdvY`,vertOriginX:1,"vert-origin-x":`vertOriginX`,vertOriginY:1,"vert-origin-y":`vertOriginY`,vHanging:1,"v-hanging":`vHanging`,vIdeographic:1,"v-ideographic":`vIdeographic`,viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":`vMathematical`,vocab:0,widths:0,wordSpacing:1,"word-spacing":`wordSpacing`,writingMode:1,"writing-mode":`writingMode`,x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":`xHeight`,xlinkActuate:1,"xlink:actuate":`xlinkActuate`,xlinkArcrole:1,"xlink:arcrole":`xlinkArcrole`,xlinkHref:1,"xlink:href":`xlinkHref`,xlinkRole:1,"xlink:role":`xlinkRole`,xlinkShow:1,"xlink:show":`xlinkShow`,xlinkTitle:1,"xlink:title":`xlinkTitle`,xlinkType:1,"xlink:type":`xlinkType`,xmlBase:1,"xml:base":`xmlBase`,xmlLang:1,"xml:lang":`xmlLang`,xmlns:0,"xml:space":`xmlSpace`,xmlnsXlink:1,"xmlns:xlink":`xmlnsXlink`,xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),ko=t((e=>{var t=0,n=1,r=2,i=3,a=4,o=5,s=6;function c(e){return u.hasOwnProperty(e)?u[e]:null}function l(e,t,n,o,s,c,l){this.acceptsBooleans=t===r||t===i||t===a,this.attributeName=o,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=l}var u={};[`children`,`dangerouslySetInnerHTML`,`defaultValue`,`defaultChecked`,`innerHTML`,`suppressContentEditableWarning`,`suppressHydrationWarning`,`style`].forEach(e=>{u[e]=new l(e,t,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(([e,t])=>{u[e]=new l(e,n,!1,t,null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(e=>{u[e]=new l(e,r,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(e=>{u[e]=new l(e,r,!1,e,null,!1,!1)}),[`allowFullScreen`,`async`,`autoFocus`,`autoPlay`,`controls`,`default`,`defer`,`disabled`,`disablePictureInPicture`,`disableRemotePlayback`,`formNoValidate`,`hidden`,`loop`,`noModule`,`noValidate`,`open`,`playsInline`,`readOnly`,`required`,`reversed`,`scoped`,`seamless`,`itemScope`].forEach(e=>{u[e]=new l(e,i,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(e=>{u[e]=new l(e,i,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(e=>{u[e]=new l(e,a,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(e=>{u[e]=new l(e,s,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(e=>{u[e]=new l(e,o,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-\:]([a-z])/g,f=e=>e[1].toUpperCase();`accent-height.alignment-baseline.arabic-form.baseline-shift.cap-height.clip-path.clip-rule.color-interpolation.color-interpolation-filters.color-profile.color-rendering.dominant-baseline.enable-background.fill-opacity.fill-rule.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.glyph-name.glyph-orientation-horizontal.glyph-orientation-vertical.horiz-adv-x.horiz-origin-x.image-rendering.letter-spacing.lighting-color.marker-end.marker-mid.marker-start.overline-position.overline-thickness.paint-order.panose-1.pointer-events.rendering-intent.shape-rendering.stop-color.stop-opacity.strikethrough-position.strikethrough-thickness.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.text-anchor.text-decoration.text-rendering.underline-position.underline-thickness.unicode-bidi.unicode-range.units-per-em.v-alphabetic.v-hanging.v-ideographic.v-mathematical.vector-effect.vert-adv-y.vert-origin-x.vert-origin-y.word-spacing.writing-mode.xmlns:xlink.x-height`.split(`.`).forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,null,!1,!1)}),[`xlink:actuate`,`xlink:arcrole`,`xlink:role`,`xlink:show`,`xlink:title`,`xlink:type`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!1,!1)});var p=`xlinkHref`;u[p]=new l(`xlinkHref`,n,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!0,!0)});var{CAMELCASE:m,SAME:h,possibleStandardNames:g}=Oo(),_=RegExp.prototype.test.bind(RegExp(`^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`)),v=Object.keys(g).reduce((e,t)=>{let n=g[t];return n===h?e[t]=t:n===m?e[t.toLowerCase()]=t:e[t]=n,e},{});e.BOOLEAN=i,e.BOOLEANISH_STRING=r,e.NUMERIC=o,e.OVERLOADED_BOOLEAN=a,e.POSITIVE_NUMERIC=s,e.RESERVED=t,e.STRING=n,e.getPropertyInfo=c,e.isCustomAttribute=_,e.possibleStandardNames=v})),Ao=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),jo=t(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(Ao());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),Mo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),No=t(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(jo()),i=Mo();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),Po=t(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=s,e.setStyleProp=l;var i=f(),a=r(No()),o=new Set([`annotation-xml`,`color-profile`,`font-face`,`font-face-src`,`font-face-uri`,`font-face-format`,`font-face-name`,`missing-glyph`]);function s(e,t){return e.includes(`-`)?!o.has(e):!!(t&&typeof t.is==`string`)}var c={reactCompat:!0};function l(e,t){if(typeof e==`string`){if(!e.trim())t.style={};else try{t.style=(0,a.default)(e,c)}catch{t.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(i.version.split(`.`)[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set([`tr`,`tbody`,`thead`,`tfoot`,`colgroup`,`table`,`head`,`html`,`frameset`]),e.canTextBeChildOfNode=function(t){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(t.name)},e.returnFirstArg=function(e){return e}})),Fo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var t=ko(),n=Po(),r=[`checked`,`value`],i=[`input`,`select`,`textarea`],a={reset:!0,submit:!0};function o(e,o){e===void 0&&(e={});var c={},l=!!(e.type&&a[e.type]);for(var u in e){var d=e[u];if((0,t.isCustomAttribute)(u))c[u]=d;else{var f=u.toLowerCase(),p=s(f);if(p){var m=(0,t.getPropertyInfo)(p);switch(r.includes(p)&&i.includes(o)&&!l&&(p=s(`default`+f)),c[p]=d,m?.type){case t.BOOLEAN:c[p]=!0;break;case t.OVERLOADED_BOOLEAN:d===``&&(c[p]=!0)}}else n.PRESERVE_CUSTOM_ATTRIBUTES&&(c[u]=d)}}return(0,n.setStyleProp)(e.style,c),c}function s(e){return t.possibleStandardNames[e]}})),Io=t(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=f(),a=r(Fo()),o=Po(),s={cloneElement:i.cloneElement,createElement:i.createElement,isValidElement:i.isValidElement};function c(e,t){t===void 0&&(t={});for(var n=[],r=typeof t.replace==`function`,i=t.transform??o.returnFirstArg,u=t.library??s,d=u.cloneElement,f=u.createElement,p=u.isValidElement,m=e.length,h=0;h<m;h++){var g=e[h];if(r){var _=t.replace?.call(t,g,h);if(p(_)){m>1&&(_=d(_,{key:_.key??h})),n.push(i(_,g,h));continue}}if(g.type===`text`){var v=!g.data.trim().length;if(v&&g.parent&&!(0,o.canTextBeChildOfNode)(g.parent)||t.trim&&v)continue;n.push(i(g.data,g,h))}else{var y=g,b={};l(y)?((0,o.setStyleProp)(y.attribs.style,y.attribs),b=y.attribs):y.attribs&&(b=(0,a.default)(y.attribs,y.name));var x=void 0;switch(g.type){case`script`:case`style`:g.children[0]&&(b.dangerouslySetInnerHTML={__html:g.children[0].data});break;case`tag`:g.name===`textarea`&&g.children[0]?b.defaultValue=g.children[0].data:g.children?.length&&(x=c(g.children,t));break;default:continue}m>1&&(b.key=h),n.push(i(f(g.name,b,x),g,h))}}return n.length===1?n[0]:n}function l(e){return o.PRESERVE_CUSTOM_ATTRIBUTES&&e.type===`tag`&&(0,o.isCustomComponent)(e.name,e.attribs)}})),Lo=e(t(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=c;var i=r(Do());e.htmlToDOM=i.default,e.attributesToProps=r(Fo()).default;var a=r(Io());e.domToReact=a.default;var o=Co();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return o.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return o.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return o.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return o.Text}});var s={lowerCaseAttributeNames:!1};function c(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);return e?(0,a.default)((0,i.default)(e,t?.htmlparser2??s),t):[]}}))(),1),Ro=Lo.default.default||Lo.default,zo=q.memo(e=>{let{text:t,animationConfig:n}=e,{fadeDuration:r=200,easing:i=`ease-in-out`}=n||{},[a,o]=(0,q.useState)([]),s=(0,q.useRef)(``);(0,q.useEffect)(()=>{if(t===s.current)return;if(!(s.current&&t.indexOf(s.current)===0)){o([t]),s.current=t;return}let e=t.slice(s.current.length);e&&(o(t=>[...t,e]),s.current=t)},[t]);let c=(0,q.useMemo)(()=>({animation:`x-markdown-fade-in ${r}ms ${i} forwards`,color:`inherit`}),[r,i]);return q.createElement(q.Fragment,null,a.map((e,t)=>q.createElement(`span`,{style:c,key:`animation-text-${t}`},e)))}),Bo=/\s/,Vo=/[a-zA-Z0-9-]/,Ho=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Uo=`<!--`,Wo=`-->`,Go=`<![CDATA[`,Ko=`]]>`,qo=(e,t)=>`${e}-${t}`,Jo=(e,t)=>{if(!e.startsWith(Uo,t))return t;let n=e.indexOf(Wo,t+4);return n===-1?e.length:n+3},Yo=(e,t)=>{if(!e.startsWith(Go,t))return t;let n=e.indexOf(Ko,t+9);return n===-1?e.length:n+3},Xo=(e,t)=>{if(e[t+1]!==`/`)return null;let n=t+2,r=``;for(;n<e.length&&Bo.test(e[n]);)n++;for(;n<e.length&&Vo.test(e[n]);)r+=e[n],n++;for(;n<e.length&&Bo.test(e[n]);)n++;return!r||e[n]!==`>`?null:{tagName:r.toLowerCase(),endPos:n+1}},Zo=(e,t)=>{let n=t+1,r=``;for(;n<e.length&&Vo.test(e[n]);)r+=e[n],n++;if(!r)return null;let i=!1,a=!1;for(;n<e.length;){if(e[n]===`>`){i=!0,a=e[n-1]===`/`;break}if(e[n]===`"`||e[n]===`'`){let t=e[n];for(n++;n<e.length;)if(e[n]===`\\`&&n+1<e.length)n+=2;else{if(e[n]===t){n++;break}n++}}else n++}return{tagName:r.toLowerCase(),endPos:i?n+1:e.length,foundEnd:i,isSelfClosing:a}};function Qo(e,t){let n=new Set(Array.from(t,e=>e.toLowerCase()));if(n.size===0||e.length===0)return new Set;let r=new Set,i={},a={},o=0;for(;o<e.length;){let t=Jo(e,o);if(t!==o){o=t;continue}let c=Yo(e,o);if(c!==o){o=c;continue}if(e[o]!==`<`){o++;continue}let l=Xo(e,o);if(l){let e=a[l.tagName];n.has(l.tagName)&&e?.length&&e.pop(),o=l.endPos;continue}let u=Zo(e,o);if(!u||!n.has(u.tagName)){o++;continue}i[u.tagName]=(i[u.tagName]??0)+1;let d=i[u.tagName];if(!u.foundEnd)r.add(qo(u.tagName,d));else if(!u.isSelfClosing&&!Ho.has(u.tagName)){var s;a[s=u.tagName]??(a[s]=[]),a[u.tagName].push(d)}o=u.endPos}for(let[e,t]of Object.entries(a))t.forEach(t=>{r.add(qo(e,t))});return r}var $o=null;function es(){if($o)return $o;if(typeof window<`u`&&typeof Node<`u`)try{let e=document.createElement(`template`);e.innerHTML=`<test-detect></test-detect>`;let t=e.content.firstChild;if(t){let n=Object.getOwnPropertyDescriptor(Node.prototype,`nodeName`)?.get,r=Object.getOwnPropertyDescriptor(Node.prototype,`nodeValue`)?.get,i=n&&t.nodeName&&!n.call(t);if(i){let e=n;Object.defineProperty(Node.prototype,"nodeName",{get:function(){let t=e.call(this);if(t)return t;if(this.nodeType===1&&`tagName`in this)return this.tagName;switch(this.nodeType){case 3:return`#text`;case 4:return`#cdata-section`;case 7:return`#processing-instruction`;case 8:return`#comment`;case 9:return`#document`;case 11:return`#document-fragment`}return t},configurable:!0,enumerable:!0})}let a=r&&(()=>{e.innerHTML=`<div>test</div>`;let t=e.content.firstChild?.firstChild;if(!t)return!1;let n=r.call(t);return t.nodeValue!=null&&n==null})();if(a){let e=r;Object.defineProperty(Node.prototype,"nodeValue",{get:function(){let t=e.call(this);return t==null&&(this.nodeType===3||this.nodeType===4||this.nodeType===8)&&`data`in this?this.data:t},configurable:!0,enumerable:!0})}if(i||a)return $o=Nt(window),$o}}catch{}return $o=Nt,$o}var ts=class e{options;static NON_WHITESPACE_REGEX=/[^\r\n\s]+/;constructor(e){this.options=e}detectUnclosedTags(e){return Qo(e,Object.keys(this.options.components??{}))}configureDOMPurify(){let e=Object.keys(this.options.components||{}),t=this.options.dompurifyConfig||{},n=Array.isArray(t.ADD_TAGS)?t.ADD_TAGS:[],r=Array.isArray(t.ADD_ATTR)?t.ADD_ATTR:[];return{...t,ADD_TAGS:Array.from(new Set([...e,...n])),ADD_ATTR:Array.from(new Set([`target`,`rel`,...r]))}}createReplaceElement(t,n){let{enableAnimation:r,animationConfig:i}=this.options.streaming||{};return a=>{let o=`x-markdown-component-${n.current++}`,s=a.type===`text`&&a.data&&e.NON_WHITESPACE_REGEX.test(a.data),c=a.parent?.name,l=c&&this.options.components?.[c];if(r&&s&&!l)return q.createElement(zo,{text:a.data,key:o,animationConfig:i});if(!(`name`in a))return;let{name:u,attribs:d,children:f}=a,p=this.options.components?.[u];if(p){n.tagIndexes[u]=(n.tagIndexes[u]??0)+1;let e={domNode:a,streamStatus:t?.has(qo(u,n.tagIndexes[u]))?`loading`:`done`,key:o,...d,...d.disabled!==void 0&&{disabled:!0},...d.checked!==void 0&&{checked:!0}};if(e.className=[e.className,e.classname,e.class].filter(Boolean).join(` `).trim()||``,u===`code`){let{"data-block":t=`false`,"data-state":n=`done`}=d||{};e.block=t===`true`,e.streamStatus=n===`loading`?`loading`:`done`;let r=d?.[`data-lang`],i=d?.class?.match(/(?:^|\s)language-([^\s]+)/)?.[1]??d?.class?.match(/(?:^|\s)lang-([^\s]+)/)?.[1],a=r||i;a&&(e.lang=a)}return f&&(e.children=this.processChildren(f,t,n)),q.createElement(p,e)}}}processChildren(e,t,n){return(0,Lo.domToReact)(e,{replace:this.createReplaceElement(t,n)})}processHtml(e){if(typeof Nt.sanitize!=`function`)return null;let t=this.detectUnclosedTags(e),n={current:0,tagIndexes:{}},r=es(),i=this.configureDOMPurify();return Ro(r.sanitize(e,i),{replace:this.createReplaceElement(t,n)})}render(e){return this.processHtml(e)}},ns={FPS_THRESHOLD:{GOOD:55,WARNING:40},COLORS:{GOOD:`#52c41a`,WARNING:`#faad14`,DANGER:`#ff4d4f`},CHART:{WIDTH:750,HEIGHT:400,PADDING:80}},rs=()=>typeof window>`u`?{x:12,y:12}:{x:window.innerWidth-220,y:window.innerHeight/2-100},is=()=>{let[e,t]=(0,q.useState)(0),[n,r]=(0,q.useState)(0),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)([]),[u,d]=(0,q.useState)(rs()),[f,p]=(0,q.useState)(!1),m=(0,q.useRef)([]),h=(0,q.useRef)([]),g=(0,q.useRef)(0),_=(0,q.useRef)(0),v=(0,q.useRef)(void 0),y=(0,q.useRef)({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0});(0,q.useEffect)(()=>{if(typeof window>`u`)return;f||(p(!0),g.current=performance.now());let e=()=>{let n=performance.now(),a=n-g.current;if(h.current.push(a),h.current.length>60&&h.current.shift(),_.current++,a>=1e3){let e=Math.round(_.current*1e3/a),o=b();t(e),r(o),i&&m.current.push({timestamp:Date.now(),fps:e,memory:o}),_.current=0,g.current=n}v.current=requestAnimationFrame(e)};return v.current=requestAnimationFrame(e),()=>{v.current!==void 0&&cancelAnimationFrame(v.current)}},[i,f]);let b=()=>{let e=performance;return e.memory?Math.round(e.memory.usedJSHeapSize/1024/1024):0},x=e=>e<1?`${Math.round(e*1024)} KB`:e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(2)} MB`,S=e=>e>=ns.FPS_THRESHOLD.GOOD?ns.COLORS.GOOD:e>=ns.FPS_THRESHOLD.WARNING?ns.COLORS.WARNING:ns.COLORS.DANGER,C=(0,q.useCallback)(()=>{i?(a(!1),l([...m.current]),s(!0)):(m.current=[],a(!0))},[i]),w=(0,q.useCallback)(e=>{e.target.closest(`.x-markdown-debug-action`)||(y.current={isDragging:!0,startX:e.clientX,startY:e.clientY,initialX:u.x,initialY:u.y})},[u]),T=(0,q.useCallback)(e=>{if(!y.current.isDragging)return;let t=e.clientX-y.current.startX,n=e.clientY-y.current.startY;d({x:y.current.initialX+t,y:y.current.initialY+n})},[]),E=(0,q.useCallback)(()=>{y.current.isDragging=!1},[]);return(0,q.useEffect)(()=>{if(typeof window<`u`)return document.addEventListener(`mousemove`,T),document.addEventListener(`mouseup`,E),()=>{document.removeEventListener(`mousemove`,T),document.removeEventListener(`mouseup`,E)}},[T,E]),q.createElement(q.Fragment,null,q.createElement(`div`,{className:`x-markdown-debug-panel`,style:{left:u.x,top:u.y,cursor:y.current.isDragging?`grabbing`:`grab`},onMouseDown:w},q.createElement(`div`,{className:`x-markdown-debug-row`},q.createElement(`span`,{className:`x-markdown-debug-label`},`FPS`),q.createElement(`span`,{className:`x-markdown-debug-value`,style:{color:S(e)}},e)),q.createElement(`div`,{className:`x-markdown-debug-row`},q.createElement(`span`,{className:`x-markdown-debug-label`},`Memory`),q.createElement(`span`,{className:`x-markdown-debug-value`},x(n))),q.createElement(`div`,{className:`x-markdown-debug-actions`},q.createElement(`button`,{type:`button`,className:`x-markdown-debug-action x-markdown-debug-record-btn ${i?`recording`:``}`,onClick:C},i?`⏹ Stop`:`⏺ Record`),c.length>0&&!i&&q.createElement(`button`,{type:`button`,className:`x-markdown-debug-action`,onClick:()=>s(!0)},`📊 View`))),o&&c.length>0?q.createElement(`div`,{className:`x-markdown-debug-modal-overlay`,onClick:()=>s(!1)},q.createElement(`div`,{className:`x-markdown-debug-modal`,onClick:e=>e.stopPropagation()},q.createElement(`div`,{className:`x-markdown-debug-modal-header`},q.createElement(`span`,{style:{color:`#fff`,fontSize:18,fontWeight:`600`}},`Performance Recording`),q.createElement(`button`,{type:`button`,className:`x-markdown-debug-close-btn`,onClick:()=>s(!1)},`✕`)),q.createElement(()=>{if(!c.length)return null;let{WIDTH:e,HEIGHT:t,PADDING:n}=ns.CHART,r=e-n*2,i=t-n*2,a=c[0]?.timestamp??0,o=(c[c.length-1]?.timestamp??0)-a||1,s=Math.max(...c.map(e=>e.fps),60),l=Math.max(...c.map(e=>e.memory),0)*1.1,u=c.length>0?c.reduce((e,t)=>e+t.fps,0)/c.length:0,d=c.length>0?c.reduce((e,t)=>e+t.memory,0)/c.length:0,f=c.length>0?Math.min(...c.map(e=>e.fps)):0,p=c.length>0?Math.max(...c.map(e=>e.fps)):0,m=(e,t)=>c.map(s=>`${n+(s.timestamp-a)/o*r},${n+i-s[e]/t*i}`).join(` `);return q.createElement(`div`,{className:`x-markdown-debug-modal-content`},q.createElement(`div`,{className:`x-markdown-debug-stats-summary`},q.createElement(`div`,{className:`x-markdown-debug-stat-item`},q.createElement(`div`,{className:`x-markdown-debug-stat-label`},`Duration`),q.createElement(`div`,{className:`x-markdown-debug-stat-value`},(o/1e3).toFixed(2),`s`)),q.createElement(`div`,{className:`x-markdown-debug-stat-item`},q.createElement(`div`,{className:`x-markdown-debug-stat-label`},`FPS Avg`),q.createElement(`div`,{className:`x-markdown-debug-stat-value`,style:{color:S(u)}},u.toFixed(1))),q.createElement(`div`,{className:`x-markdown-debug-stat-item`},q.createElement(`div`,{className:`x-markdown-debug-stat-label`},`FPS Range`),q.createElement(`div`,{className:`x-markdown-debug-stat-value`},f,` - `,p)),q.createElement(`div`,{className:`x-markdown-debug-stat-item`},q.createElement(`div`,{className:`x-markdown-debug-stat-label`},`Memory Avg`),q.createElement(`div`,{className:`x-markdown-debug-stat-value`},x(d)))),q.createElement(`svg`,{width:e,height:t,className:`x-markdown-debug-chart-full`,role:`img`,"aria-label":`Performance chart showing FPS and memory usage over time`},q.createElement(`title`,null,`Performance Chart`),[0,.25,.5,.75,1].map(a=>q.createElement(`g`,{key:a},q.createElement(`line`,{x1:n,y1:n+i*a,x2:e-n,y2:n+i*a,stroke:`rgba(255,255,255,0.1)`,strokeWidth:`1`}),q.createElement(`line`,{x1:n+r*a,y1:n,x2:n+r*a,y2:t-n,stroke:`rgba(255,255,255,0.1)`,strokeWidth:`1`}))),q.createElement(`polyline`,{points:m(`fps`,s),fill:`none`,stroke:ns.COLORS.GOOD,strokeWidth:`2`,className:`fps-line`}),q.createElement(`polyline`,{points:m(`memory`,l),fill:`none`,stroke:`#1890ff`,strokeWidth:`2`,className:`memory-line`}),q.createElement(`text`,{x:n-10,y:n,fill:ns.COLORS.GOOD,fontSize:`12`,textAnchor:`end`},s.toFixed(0)),q.createElement(`text`,{x:n-10,y:t-n,fill:ns.COLORS.GOOD,fontSize:`12`,textAnchor:`end`},`0`),q.createElement(`text`,{x:n-10,y:n-15,fill:ns.COLORS.GOOD,fontSize:`14`,fontWeight:`bold`,textAnchor:`end`},`FPS`),q.createElement(`text`,{x:e-n+10,y:n+20,fill:`#1890ff`,fontSize:`12`,textAnchor:`start`},x(l)),q.createElement(`text`,{x:e-n+10,y:t-n,fill:`#1890ff`,fontSize:`12`,textAnchor:`start`},x(0)),q.createElement(`text`,{x:e-n+10,y:n+5,fill:`#1890ff`,fontSize:`14`,fontWeight:`bold`,textAnchor:`start`},`Memory`),q.createElement(`text`,{x:n,y:t-n+20,fill:`rgba(255,255,255,0.6)`,fontSize:`12`,textAnchor:`middle`},`0s`),q.createElement(`text`,{x:e-n,y:t-n+20,fill:`rgba(255,255,255,0.6)`,fontSize:`12`,textAnchor:`middle`},(o/1e3).toFixed(1),`s`)),q.createElement(`div`,{className:`x-markdown-debug-legend`},q.createElement(`div`,{className:`x-markdown-debug-legend-item`},q.createElement(`span`,{className:`x-markdown-debug-legend-color`,style:{backgroundColor:ns.COLORS.GOOD}}),q.createElement(`span`,null,`FPS`)),q.createElement(`div`,{className:`x-markdown-debug-legend-item`},q.createElement(`span`,{className:`x-markdown-debug-legend-color`,style:{backgroundColor:`#1890ff`}}),q.createElement(`span`,null,`Memory`))))},null))):null)},Q=function(e){return e.Text=`text`,e.Link=`link`,e.Image=`image`,e.Html=`html`,e.Emphasis=`emphasis`,e.List=`list`,e.Table=`table`,e.InlineCode=`inline-code`,e}({}),as={image:[/^!\[[^\]\r\n]{0,1000}$/,/^!\[[^\r\n]{0,1000}\]\(*[^)\r\n]{0,1000}$/],link:[/^\[[^\]\r\n]{0,1000}$/,/^\[[^\r\n]{0,1000}\]\(*[^)\r\n]{0,1000}$/],html:[/^<\/$/,/^<\/?[a-zA-Z][a-zA-Z0-9-]{0,100}[^>\r\n]{0,1000}$/],commonEmphasis:[/^(\*{1,3}|_{1,3})(?!\s)(?!.*\1$)[^\r\n]{0,1000}$/],list:[/^[-+*]\s{0,3}$/,/^[-+*]\s{1,3}(\*{1,3}|_{1,3})(?!\s)(?!.*\1$)[^\r\n]{0,1000}$/],"inline-code":[/^`[^`\r\n]{0,300}$/]},os=e=>{if(e.includes(`
|
|
|
|
`))return!1;let t=e.split(`
|
|
`);if(t.length<=1)return!0;let[n,r]=t,i=n.trim();if(!/^\|.*\|$/.test(i))return!1;let a=r.trim().split(`|`).map(e=>e.trim()).filter(Boolean),o=/^:?-+:?$/;return a.every((e,t)=>t===a.length-1&&e===`:`||o.test(e))},ss={[Q.Link]:{tokenType:Q.Link,isStartOfToken:e=>e.startsWith(`[`),isStreamingValid:e=>as.link.some(t=>t.test(e))},[Q.Image]:{tokenType:Q.Image,isStartOfToken:e=>e.startsWith(`!`),isStreamingValid:e=>as.image.some(t=>t.test(e))},[Q.Html]:{tokenType:Q.Html,isStartOfToken:e=>e.startsWith(`<`),isStreamingValid:e=>as.html.some(t=>t.test(e))},[Q.Emphasis]:{tokenType:Q.Emphasis,isStartOfToken:e=>e.startsWith(`*`)||e.startsWith(`_`),isStreamingValid:e=>as.commonEmphasis.some(t=>t.test(e))},[Q.List]:{tokenType:Q.List,isStartOfToken:e=>/^[-+*]/.test(e),isStreamingValid:e=>as.list.some(t=>t.test(e)),getCommitPrefix:e=>{let t=e.match(/^([-+*]\s{0,3})/)?.[1],n=t?e.slice(t.length):``;return t&&n.startsWith("`")?t:null}},[Q.Table]:{tokenType:Q.Table,isStartOfToken:e=>e.startsWith(`|`),isStreamingValid:os},[Q.InlineCode]:{tokenType:Q.InlineCode,isStartOfToken:e=>e.startsWith("`"),isStreamingValid:e=>as[`inline-code`].some(t=>t.test(e))}},cs=(e,t)=>{let n=ss[t];if(!n)return;let{token:r,pending:i}=e;if(r===Q.Text&&n.isStartOfToken(i))e.token=t;else if(r===t&&!n.isStreamingValid(i)){let t=n.getCommitPrefix?.(i);if(t){e.completeMarkdown+=t,e.pending=i.slice(t.length),e.token=Q.Text;return}fs(e)}},ls=Object.values(ss).map(e=>({tokenType:e.tokenType,recognize:t=>cs(t,e.tokenType)})),us=()=>({inFenced:!1,fenceChar:``,fenceLen:0,lineFenceChar:``,lineFenceLen:0,lineFenceRunEnded:!1,lineTailBlank:!0}),ds=()=>({pending:``,token:Q.Text,processedLength:0,completeMarkdown:``,fence:us()}),fs=e=>{e.pending&&=(e.completeMarkdown+=e.pending,``),e.token=Q.Text},ps=(e,t)=>{t===`
|
|
`?(e.lineFenceLen>=3&&(e.inFenced?e.lineFenceChar===e.fenceChar&&e.lineFenceLen>=e.fenceLen&&e.lineTailBlank&&(e.inFenced=!1,e.fenceChar=``,e.fenceLen=0):(e.inFenced=!0,e.fenceChar=e.lineFenceChar,e.fenceLen=e.lineFenceLen)),e.lineFenceChar=``,e.lineFenceLen=0,e.lineFenceRunEnded=!1,e.lineTailBlank=!0):e.lineFenceRunEnded?e.lineTailBlank=e.lineTailBlank&&/\s/.test(t):e.lineFenceLen===0&&(t==="`"||t===`~`)?(e.lineFenceChar=t,e.lineFenceLen=1):e.lineFenceLen>0&&t===e.lineFenceChar?e.lineFenceLen+=1:(e.lineFenceRunEnded=!0,e.lineTailBlank=e.lineTailBlank&&/\s/.test(t))},ms=e=>e.inFenced||e.lineFenceLen>=3,hs=e=>{let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=55296&&r<=56319?n+1<e.length&&e.charCodeAt(n+1)>=56320&&e.charCodeAt(n+1)<=57343&&(t+=e[n]+e[n+1],n++):(r<56320||r>57343)&&(t+=e[n])}return t},gs=e=>{try{return encodeURIComponent(e)}catch(t){return t instanceof URIError?encodeURIComponent(hs(e)):``}},_s=(e,t)=>{let{streaming:n,components:r={}}=t||{},{hasNextChunk:i=!1,incompleteMarkdownComponentMap:a}=n||{},[o,s]=(0,q.useState)(``),c=i?o:typeof e==`string`?e:``,l=(0,q.useRef)(ds()),u=(0,q.useCallback)(e=>{let{token:t,pending:n}=e;if(t===Q.Text||t===Q.Image&&n===`!`)return;if(t===Q.Table&&n.split(`
|
|
`).length>2)return n;let i=(a||{})[t]||`incomplete-${t}`,o=gs(n);return r?.[i]?`<${i} data-raw="${o}" />`:void 0},[a,r]),d=(0,q.useCallback)(e=>{if(!e){s(``),l.current=ds();return}let t=l.current.completeMarkdown+l.current.pending;e.startsWith(t)||(l.current=ds());let n=l.current,r=e.slice(n.processedLength);if(!r)return;n.processedLength+=r.length;for(let e of r)if(n.pending+=e,ps(n.fence,e),ms(n.fence))fs(n);else{if(n.token===Q.Text)for(let e of ls)e.recognize(n);else if(ls.find(e=>e.tokenType===n.token)?.recognize(n),n.token===Q.Text)for(let e of ls)e.recognize(n);n.token===Q.Text&&fs(n)}let i=u(n);s(n.completeMarkdown+(i||``))},[u]);return(0,q.useEffect)(()=>{typeof e==`string`?i&&d(e):(console.error(`X-Markdown: input must be string, not ${typeof e}.`),s(``))},[e,i,d]),c},vs=e=>e?typeof e==`boolean`?`▋`:e.content||`▋`:null,ys=q.memo(e=>{let{streaming:t,config:n,components:r,paragraphTag:i,content:a,children:o,rootClassName:s,className:c,style:l,openLinksInNewTab:u,dompurifyConfig:d,protectCustomTagNewlines:f,disableCustomTagBlockMarkdown:p,escapeRawHtml:h,debug:g,disableDefaultStyles:_}=e,v=(0,q.useMemo)(()=>vs(t?.tail),[t?.tail]),y=typeof t?.tail==`object`?t.tail.component:void 0,b=!!t?.hasNextChunk&&v,x=(0,q.useMemo)(()=>{if(_===!0)return`x-md-disable-all`;if(Array.isArray(_))return _.map(e=>`x-md-disable-${e}`)},[_]),S=m(`x-markdown`,x,s,c),C=_s(a||o||``,{streaming:t,components:r}),w=(0,q.useMemo)(()=>{if(!b)return r;let e=y?q.createElement(y,{content:v}):q.createElement(`span`,{className:`xmd-tail`},v);return{...r,"xmd-tail":()=>e}},[b,r,y,v]),T=(0,q.useMemo)(()=>new bo({markedConfig:n,paragraphTag:i,openLinksInNewTab:u,components:w,protectCustomTagNewlines:f,disableCustomTagBlockMarkdown:p,escapeRawHtml:h}),[n,i,u,w,f,p,h]),E=(0,q.useMemo)(()=>new ts({components:w,dompurifyConfig:d,streaming:t}),[w,d,t]),D=(0,q.useMemo)(()=>C?T.parse(C,{injectTail:!!b}):``,[C,T,b]),O=(0,q.useMemo)(()=>D?E.render(D):null,[D,E]);return C?q.createElement(q.Fragment,null,q.createElement(`div`,{className:S,style:l},O),g?q.createElement(is,null):null):null});async function bs(){return n({url:`/ai/chat/conversations`,method:`get`})}async function xs(e){return n({url:`/ai/chat/messages/${e}`,method:`get`})}async function Ss(e){return n({url:`/ai/chat/conversations/${e}`,method:`delete`})}var $=v(),{Text:Cs}=w,ws=()=>{let{t:e}=ie(),{message:t,modal:n}=ce.useApp(),{token:r}=se.useToken(),i=C(e=>e.themeConfig),a=x(),[o]=S(),s=o.get(`agent_id`),[c,l]=(0,q.useState)(null),u=(0,q.useRef)(null),{conversations:d,setConversations:f,activeConversationKey:p,setActiveConversationKey:m}=Di({}),[h,g]=(0,q.useState)([]),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(``),[w,T]=(0,q.useState)(!1),E=async()=>{let{data:e}=await bs();e.success&&e.data&&f(e.data)},D=async e=>{let{data:t}=await xs(e);t.success&&t.data&&(g(t.data),setTimeout(()=>{u.current?.scrollTo({top:`bottom`})},100))};(0,q.useEffect)(()=>{E()},[]),(0,q.useEffect)(()=>{s&&ue(Number(s)).then(({data:e})=>{e.success&&e.data&&l(e.data)})},[s]);let O=e=>{m(e),D(e)},ee=()=>{m(``),g([])},M=r=>{n.confirm({title:e(`ai.chat.delete.confirm`),okButtonProps:{danger:!0},onOk:async()=>{await Ss(r),t.success(e(`ai.chat.delete.success`)),p===r&&(m(``),g([])),await E()}})},N=async e=>{if(!e.trim()||_)return;let t={key:`user-${Date.now()}`,role:`user`,content:e,status:`success`},n={key:`assistant-${Date.now()}`,role:`assistant`,content:``,loading:!0,extraInfo:{isStreaming:!0}};g(e=>[...e,t,n]),v(!0),T(!0);let r=localStorage.getItem(`token`),i=``;Vi(`/index.php/ai/chat/send`,{headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,Accept:`text/event-stream`},method:`post`,params:{conversation_id:p,message:e,agent_id:s?Number(s):void 0},callbacks:{onSuccess:async()=>{if(v(!1),b(``),T(!1),!p){let{data:e}=await bs();if(e.success&&e.data&&e.data.length>0){f(e.data);let t=e.data[0].key;m(t)}}},onError:()=>{v(!1),T(!1)},onUpdate:e=>{console.log(`onUpdate`,e);let t=e.data;if(t!==`[DONE]`)try{let e=JSON.parse(t);e.type===`text_delta`&&e.delta&&(i+=e.delta,g(e=>e.map(e=>e.key===n.key?{...e,content:i,loading:!1}:e))),e.type===`text_end`&&g(t=>t.map(t=>t.key===n.key?{...t,key:e.message_id,loading:!1}:t))}catch{}}}})},te={assistant:{placement:`start`,variant:`filled`,avatar:(0,$.jsx)(P,{src:c?.icon||`https://file.xinadmin.cn/file/favicons.ico`}),contentRender:(e,t)=>{if(!e)return null;let n=t?.extraInfo?.isStreaming===!0;return(0,$.jsx)(ys,{content:e,streaming:{hasNextChunk:n,enableAnimation:!0,tail:n},openLinksInNewTab:!0,escapeRawHtml:!0})}},user:{placement:`end`,variant:`filled`,avatar:(0,$.jsx)(P,{icon:(0,$.jsx)(re,{}),style:{background:r.colorFillSecondary,color:r.colorTextSecondary},size:36})}},ae=h.length>0;return(0,$.jsxs)(j,{styles:{body:{padding:0,overflow:`hidden`,display:`flex`,height:`calc(100vh - 180px)`}},title:(0,$.jsx)(k,{align:`center`,children:c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{src:c.icon,size:36}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{style:{fontSize:18,fontWeight:600,marginRight:10},children:c.name}),c.description&&(0,$.jsx)(Cs,{type:`secondary`,style:{fontSize:12,lineHeight:1},children:c.description})]})]}):(0,$.jsx)(`span`,{children:e(`ai.chat.defaultTitle`)})}),extra:(0,$.jsx)(A,{onClick:()=>a(`/ai/agent`),children:e(`ai.chat.switchAgent`)}),children:[(0,$.jsx)(`div`,{style:{width:280,borderRight:`1px solid ${r.colorBorderSecondary}`},children:(0,$.jsx)(Pr,{items:d,activeKey:p,onActiveChange:O,menu:e=>({items:[{label:`Rename`,key:`Rename`,icon:(0,$.jsx)(ne,{})},{type:`divider`},{label:`Delete Chat`,key:`delete`,icon:(0,$.jsx)(F,{}),danger:!0,onClick:()=>M(e.key)}]}),creation:{onClick:ee},style:{flex:1,overflow:`auto`}})}),(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 px-1`,children:[!ae&&(0,$.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,$.jsx)(Ci,{icon:c?.icon||`https://file.xinadmin.cn/file/favicons.ico`,style:{backgroundImage:i.themeScheme===`dark`?`linear-gradient(97deg, rgba(90,196,255,0.12) 0%, rgba(174,136,255,0.12) 100%)`:`linear-gradient(97deg, #f2f9fe 0%, #f7f3ff 100%)`,borderRadius:20,width:`80%`,padding:`20px`},title:e(`ai.chat.welcome.title`),description:e(`ai.chat.welcome.description`),variant:`borderless`})}),ae&&(0,$.jsx)(`div`,{style:{flex:1,overflow:`hidden`},children:(0,$.jsx)(or.List,{ref:u,items:h,autoScroll:!0,style:{height:`100%`,padding:16},role:te})}),(0,$.jsx)(`div`,{style:{padding:`0 16px 16px`},children:(0,$.jsx)(yi,{loading:_,disabled:w,value:y,onChange:b,placeholder:e(`ai.chat.placeholder`),onSubmit:N,onCancel:()=>v(!1),autoSize:{minRows:1,maxRows:6}})})]})]})};export{ws as default}; |