@waniwani/sdk 0.10.9-beta.2 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,27 +21,27 @@ Error generating stack: `+n.message+`
21
21
  `))+1))}let l="#".repeat(r),i=a.enter("headingAtx"),s=a.enter("phrasing");o.move(l+" ");let u=a.containerPhrasing(e,{before:"# ",after:`
22
22
  `,...o.current()});return/^[\t ]/.test(u)&&(u=Cr(u.charCodeAt(0))+u.slice(1)),u=u?l+" "+u:l,a.options.closeAtx&&(u+=" "+l),s(),i(),u}var rI=I(()=>{"use strict";ad();aI()});function Vh(e){return e.value||""}function hP(){return"<"}var oI=I(()=>{"use strict";Vh.peek=hP});function Gh(e,t,a,n){let r=_l(a),o=r==='"'?"Quote":"Apostrophe",l=a.enter("image"),i=a.enter("label"),s=a.createTracker(n),u=s.move("![");return u+=s.move(a.safe(e.alt,{before:u,after:"]",...s.current()})),u+=s.move("]("),i(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(i=a.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(a.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(i=a.enter("destinationRaw"),u+=s.move(a.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),i(),e.title&&(i=a.enter(`title${o}`),u+=s.move(" "+r),u+=s.move(a.safe(e.title,{before:u,after:r,...s.current()})),u+=s.move(r),i()),u+=s.move(")"),l(),u}function gP(){return"!"}var lI=I(()=>{"use strict";td();Gh.peek=gP});function Wh(e,t,a,n){let r=e.referenceType,o=a.enter("imageReference"),l=a.enter("label"),i=a.createTracker(n),s=i.move("!["),u=a.safe(e.alt,{before:s,after:"]",...i.current()});s+=i.move(u+"]["),l();let c=a.stack;a.stack=[],l=a.enter("reference");let d=a.safe(a.associationId(e),{before:s,after:"]",...i.current()});return l(),a.stack=c,o(),r==="full"||!u||u!==d?s+=i.move(d+"]"):r==="shortcut"?s=s.slice(0,-1):s+=i.move("]"),s}function yP(){return"!"}var iI=I(()=>{"use strict";Wh.peek=yP});function $h(e,t,a){let n=e.value||"",r="`",o=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(n);)r+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++o<a.unsafe.length;){let l=a.unsafe[o],i=a.compilePattern(l),s;if(l.atBreak)for(;s=i.exec(n);){let u=s.index;n.charCodeAt(u)===10&&n.charCodeAt(u-1)===13&&u--,n=n.slice(0,u)+" "+n.slice(s.index+1)}}return r+n+r}function xP(){return"`"}var sI=I(()=>{"use strict";$h.peek=xP});function Xh(e,t){let a=fo(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}var uI=I(()=>{"use strict";rd()});function Zh(e,t,a,n){let r=_l(a),o=r==='"'?"Quote":"Apostrophe",l=a.createTracker(n),i,s;if(Xh(e,a)){let c=a.stack;a.stack=[],i=a.enter("autolink");let d=l.move("<");return d+=l.move(a.containerPhrasing(e,{before:d,after:">",...l.current()})),d+=l.move(">"),i(),a.stack=c,d}i=a.enter("link"),s=a.enter("label");let u=l.move("[");return u+=l.move(a.containerPhrasing(e,{before:u,after:"](",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=a.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(a.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=a.enter("destinationRaw"),u+=l.move(a.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=a.enter(`title${o}`),u+=l.move(" "+r),u+=l.move(a.safe(e.title,{before:u,after:r,...l.current()})),u+=l.move(r),s()),u+=l.move(")"),i(),u}function vP(e,t,a){return Xh(e,a)?"<":"["}var cI=I(()=>{"use strict";td();uI();Zh.peek=vP});function Qh(e,t,a,n){let r=e.referenceType,o=a.enter("linkReference"),l=a.enter("label"),i=a.createTracker(n),s=i.move("["),u=a.containerPhrasing(e,{before:s,after:"]",...i.current()});s+=i.move(u+"]["),l();let c=a.stack;a.stack=[],l=a.enter("reference");let d=a.safe(a.associationId(e),{before:s,after:"]",...i.current()});return l(),a.stack=c,o(),r==="full"||!u||u!==d?s+=i.move(d+"]"):r==="shortcut"?s=s.slice(0,-1):s+=i.move("]"),s}function wP(){return"["}var dI=I(()=>{"use strict";Qh.peek=wP});function Pl(e){let t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}var od=I(()=>{"use strict"});function fI(e){let t=Pl(e),a=e.options.bulletOther;if(!a)return t==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+a+"`) to be different");return a}var pI=I(()=>{"use strict";od()});function mI(e){let t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}var hI=I(()=>{"use strict"});function ld(e){let t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}var Kh=I(()=>{"use strict"});function gI(e,t,a,n){let r=a.enter("list"),o=a.bulletCurrent,l=e.ordered?mI(a):Pl(a),i=e.ordered?l==="."?")":".":fI(a),s=t&&a.bulletLastUsed?l===a.bulletLastUsed:!1;if(!e.ordered){let c=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&c&&(!c.children||!c.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(s=!0),ld(a)===l&&c){let d=-1;for(;++d<e.children.length;){let f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){s=!0;break}}}}s&&(l=i),a.bulletCurrent=l;let u=a.containerFlow(e,n);return a.bulletLastUsed=l,a.bulletCurrent=o,r(),u}var yI=I(()=>{"use strict";od();pI();hI();Kh()});function xI(e){let t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}var vI=I(()=>{"use strict"});function wI(e,t,a,n){let r=xI(a),o=a.bulletCurrent||Pl(a);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(a.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);let i=a.createTracker(n);i.move(o+" ".repeat(l-o.length)),i.shift(l);let s=a.enter("listItem"),u=a.indentLines(a.containerFlow(e,i.current()),c);return s(),u;function c(d,f,p){return f?(p?"":" ".repeat(l))+d:(p?o:o+" ".repeat(l-o.length))+d}}var bI=I(()=>{"use strict";od();vI()});function SI(e,t,a,n){let r=a.enter("paragraph"),o=a.enter("phrasing"),l=a.containerPhrasing(e,n);return o(),r(),l}var CI=I(()=>{"use strict"});var Yh,II=I(()=>{"use strict";$c();Yh=vr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"])});var LI=I(()=>{"use strict";II()});function kI(e,t,a,n){return(e.children.some(function(l){return Yh(l)})?a.containerPhrasing:a.containerFlow).call(a,e,n)}var TI=I(()=>{"use strict";LI()});function MI(e){let t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}var AI=I(()=>{"use strict"});function Jh(e,t,a,n){let r=MI(a),o=a.enter("strong"),l=a.createTracker(n),i=l.move(r+r),s=l.move(a.containerPhrasing(e,{after:r,before:i,...l.current()})),u=s.charCodeAt(0),c=Ol(n.before.charCodeAt(n.before.length-1),u,r);c.inside&&(s=Cr(u)+s.slice(1));let d=s.charCodeAt(s.length-1),f=Ol(n.after.charCodeAt(0),d,r);f.inside&&(s=s.slice(0,-1)+Cr(d));let p=l.move(r+r);return o(),a.attentionEncodeSurroundingInfo={after:f.outside,before:c.outside},i+s+p}function bP(e,t,a){return a.options.strong||"*"}var EI=I(()=>{"use strict";AI();ad();Hh();Jh.peek=bP});function RI(e,t,a,n){return a.safe(e.value,n)}var DI=I(()=>{"use strict"});function _I(e){let t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}var OI=I(()=>{"use strict"});function PI(e,t,a){let n=(ld(a)+(a.options.ruleSpaces?" ":"")).repeat(_I(a));return a.options.ruleSpaces?n.slice(0,-1):n}var NI=I(()=>{"use strict";OI();Kh()});var Is,BI=I(()=>{"use strict";O0();U0();W0();X0();K0();rI();oI();lI();iI();sI();cI();dI();yI();bI();CI();TI();EI();DI();NI();Is={blockquote:_0,break:Fh,code:G0,definition:$0,emphasis:jh,hardBreak:Fh,heading:nI,html:Vh,image:Gh,imageReference:Wh,inlineCode:$h,link:Zh,linkReference:Qh,list:gI,listItem:wI,paragraph:SI,root:kI,strong:Jh,text:RI,thematicBreak:PI}});function Nl(e){let t="&"+e+";";UI.innerHTML=t;let a=UI.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===t?!1:a}var UI,id=I(()=>{"use strict";UI=document.createElement("i")});function sd(e,t){let a=Number.parseInt(e,t);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"\uFFFD":String.fromCodePoint(a)}var eg=I(()=>{"use strict"});function zI(e){return e.replace(SP,CP)}function CP(e,t,a){if(t)return t;if(a.charCodeAt(0)===35){let r=a.charCodeAt(1),o=r===120||r===88;return sd(a.slice(o?2:1),o?16:10)}return Nl(a)||e}var SP,qI=I(()=>{"use strict";id();eg();SP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi});var tg=I(()=>{"use strict";BI()});function ng(){return{enter:{table:IP,tableData:FI,tableHeader:FI,tableRow:kP},exit:{codeText:TP,table:LP,tableData:ag,tableHeader:ag,tableRow:ag}}}function IP(e){let t=e._align;this.enter({type:"table",align:t.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function LP(e){this.exit(e),this.data.inTable=void 0}function kP(e){this.enter({type:"tableRow",children:[]},e)}function ag(e){this.exit(e)}function FI(e){this.enter({type:"tableCell",children:[]},e)}function TP(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,MP));let a=this.stack[this.stack.length-1];a.type,a.value=t,this.exit(e)}function MP(e,t){return t==="|"?t:e}function rg(e){let t=e||{},a=t.tableCellPadding,n=t.tablePipeAlign,r=t.stringLength,o=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
23
23
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:l,tableCell:s,tableRow:i}};function l(p,y,v,S){return u(c(p,v,S),p.align)}function i(p,y,v,S){let g=d(p,v,S),x=u([g]);return x.slice(0,x.indexOf(`
24
- `))}function s(p,y,v,S){let g=v.enter("tableCell"),x=v.enter("phrasing"),m=v.containerPhrasing(p,{...S,before:o,after:o});return x(),g(),m}function u(p,y){return R0(p,{align:y,alignDelimiters:n,padding:a,stringLength:r})}function c(p,y,v){let S=p.children,g=-1,x=[],m=y.enter("table");for(;++g<S.length;)x[g]=d(S[g],y,v);return m(),x}function d(p,y,v){let S=p.children,g=-1,x=[],m=y.enter("tableRow");for(;++g<S.length;)x[g]=s(S[g],p,y,v);return m(),x}function f(p,y,v){let S=Is.inlineCode(p,y,v);return v.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}var HI=I(()=>{"use strict";D0();tg()});var jI=I(()=>{"use strict";HI()});function og(){return{exit:{taskListCheckValueChecked:VI,taskListCheckValueUnchecked:VI,paragraph:AP}}}function lg(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:EP}}}function VI(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function AP(e){let t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){let a=this.stack[this.stack.length-1];a.type;let n=a.children[0];if(n&&n.type==="text"){let r=t.children,o=-1,l;for(;++o<r.length;){let i=r[o];if(i.type==="paragraph"){l=i;break}}l===a&&(n.value=n.value.slice(1),n.value.length===0?a.children.shift():a.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,a.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function EP(e,t,a,n){let r=e.children[0],o=typeof e.checked=="boolean"&&r&&r.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",i=a.createTracker(n);o&&i.move(l);let s=Is.listItem(e,t,a,{...n,...i.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(c){return c+l}}var GI=I(()=>{"use strict";tg()});var WI=I(()=>{"use strict";GI()});function ig(){return[Ph(),Bh(),zh(),ng(),og()]}function sg(e){return{extensions:[Nh(),Uh(e),qh(),rg(e),lg()]}}var $I=I(()=>{"use strict";S0();k0();A0();jI();WI()});var XI=I(()=>{"use strict";$I()});function it(e,t,a,n){let r=e.length,o=0,l;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,a=a>0?a:0,n.length<1e4)l=Array.from(n),l.unshift(t,a),e.splice(...l);else for(a&&e.splice(t,a);o<n.length;)l=n.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Vt(e,t){return e.length>0?(it(e,e.length,0,t),e):t}var Nn=I(()=>{"use strict"});function ud(e){let t={},a=-1;for(;++a<e.length;)RP(t,e[a]);return t}function RP(e,t){let a;for(a in t){let r=(ZI.call(e,a)?e[a]:void 0)||(e[a]={}),o=t[a],l;if(o)for(l in o){ZI.call(r,l)||(r[l]=[]);let i=o[l];DP(r[l],Array.isArray(i)?i:i?[i]:[])}}}function DP(e,t){let a=-1,n=[];for(;++a<t.length;)(t[a].add==="after"?e:n).push(t[a]);it(e,0,0,n)}var ZI,ug=I(()=>{"use strict";Nn();ZI={}.hasOwnProperty});function dg(){return{text:an}}function PP(e,t,a){let n=this,r,o;return l;function l(d){return!cg(d)||!n1.call(n,n.previous)||fg(n.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),i(d))}function i(d){return cg(d)?(e.consume(d),i):d===64?(e.consume(d),s):a(d)}function s(d){return d===46?e.check(OP,c,u)(d):d===45||d===95||tt(d)?(o=!0,e.consume(d),s):c(d)}function u(d){return e.consume(d),r=!0,s}function c(d){return o&&r&&xt(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):a(d)}}function NP(e,t,a){let n=this;return r;function r(l){return l!==87&&l!==119||!t1.call(n,n.previous)||fg(n.events)?a(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_P,e.attempt(QI,e.attempt(KI,o),a),a)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function BP(e,t,a){let n=this,r="",o=!1;return l;function l(d){return(d===72||d===104)&&a1.call(n,n.previous)&&!fg(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(d),e.consume(d),i):a(d)}function i(d){if(xt(d)&&r.length<5)return r+=String.fromCodePoint(d),e.consume(d),i;if(d===58){let f=r.toLowerCase();if(f==="http"||f==="https")return e.consume(d),s}return a(d)}function s(d){return d===47?(e.consume(d),o?u:(o=!0,s)):a(d)}function u(d){return d===null||uo(d)||ue(d)||tn(d)||co(d)?a(d):e.attempt(QI,e.attempt(KI,c),a)(d)}function c(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function UP(e,t,a){let n=0;return r;function r(l){return(l===87||l===119)&&n<3?(n++,e.consume(l),r):l===46&&n===3?(e.consume(l),o):a(l)}function o(l){return l===null?a(l):t(l)}}function zP(e,t,a){let n,r,o;return l;function l(u){return u===46||u===95?e.check(YI,s,i)(u):u===null||ue(u)||tn(u)||u!==45&&co(u)?s(u):(o=!0,e.consume(u),l)}function i(u){return u===95?n=!0:(r=n,n=void 0),e.consume(u),l}function s(u){return r||n||!o?a(u):t(u)}}function qP(e,t){let a=0,n=0;return r;function r(l){return l===40?(a++,e.consume(l),r):l===41&&n<a?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(YI,t,o)(l):l===null||ue(l)||tn(l)?t(l):(e.consume(l),r)}function o(l){return l===41&&n++,e.consume(l),r}}function FP(e,t,a){return n;function n(i){return i===33||i===34||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===63||i===95||i===126?(e.consume(i),n):i===38?(e.consume(i),o):i===93?(e.consume(i),r):i===60||i===null||ue(i)||tn(i)?t(i):a(i)}function r(i){return i===null||i===40||i===91||ue(i)||tn(i)?t(i):n(i)}function o(i){return xt(i)?l(i):a(i)}function l(i){return i===59?(e.consume(i),n):xt(i)?(e.consume(i),l):a(i)}}function HP(e,t,a){return n;function n(o){return e.consume(o),r}function r(o){return tt(o)?a(o):t(o)}}function t1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ue(e)}function a1(e){return!xt(e)}function n1(e){return!(e===47||cg(e))}function cg(e){return e===43||e===45||e===46||e===95||tt(e)}function fg(e){let t=e.length,a=!1;for(;t--;){let n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){a=!0;break}if(n._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}var _P,QI,KI,YI,OP,JI,e1,Bn,an,po,r1=I(()=>{"use strict";ye();_P={tokenize:UP,partial:!0},QI={tokenize:zP,partial:!0},KI={tokenize:qP,partial:!0},YI={tokenize:FP,partial:!0},OP={tokenize:HP,partial:!0},JI={name:"wwwAutolink",tokenize:NP,previous:t1},e1={name:"protocolAutolink",tokenize:BP,previous:a1},Bn={name:"emailAutolink",tokenize:PP,previous:n1},an={};po=48;for(;po<123;)an[po]=Bn,po++,po===58?po=65:po===91&&(po=97);an[43]=Bn;an[45]=Bn;an[46]=Bn;an[95]=Bn;an[72]=[Bn,e1];an[104]=[Bn,e1];an[87]=[Bn,JI];an[119]=[Bn,JI]});function Da(e){let t=[],a=-1,n=0,r=0;for(;++a<e.length;){let o=e.charCodeAt(a),l="";if(o===37&&tt(e.charCodeAt(a+1))&&tt(e.charCodeAt(a+2)))r=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){let i=e.charCodeAt(a+1);o<56320&&i>56319&&i<57344?(l=String.fromCharCode(o,i),r=1):l="\uFFFD"}else l=String.fromCharCode(o);l&&(t.push(e.slice(n,a),encodeURIComponent(l)),n=a+r+1,l=""),r&&(a+=r,r=0)}return t.join("")+e.slice(n)}var mo=I(()=>{"use strict";ye()});var o1=I(()=>{"use strict";r1()});function Ir(e,t,a){let n=[],r=-1;for(;++r<e.length;){let o=e[r].resolveAll;o&&!n.includes(o)&&(t=o(t,a),n.push(o))}return t}var Ls=I(()=>{"use strict"});function jP(e,t){let a=-1,n,r,o,l,i,s,u,c;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(n=a;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[n][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;let d={...e[n][1].end},f={...e[a][1].start};l1(d,-s),l1(f,s),l={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},i={type:s>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:f},o={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[a][1].start}},r={type:s>1?"strong":"emphasis",start:{...l.start},end:{...i.end}},e[n][1].end={...l.start},e[a][1].start={...i.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Vt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Vt(u,[["enter",r,t],["enter",l,t],["exit",l,t],["enter",o,t]]),u=Vt(u,Ir(t.parser.constructs.insideSpan.null,e.slice(n+1,a),t)),u=Vt(u,[["exit",o,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[a][1].end.offset-e[a][1].start.offset?(c=2,u=Vt(u,[["enter",e[a][1],t],["exit",e[a][1],t]])):c=0,it(e,n-1,a-n+3,u),a=n+u.length-c-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function VP(e,t){let a=this.parser.constructs.attentionMarkers.null,n=this.previous,r=Pn(n),o;return l;function l(s){return o=s,e.enter("attentionSequence"),i(s)}function i(s){if(s===o)return e.consume(s),i;let u=e.exit("attentionSequence"),c=Pn(s),d=!c||c===2&&r||a.includes(s),f=!r||r===2&&c||a.includes(n);return u._open=!!(o===42?d:d&&(r||!f)),u._close=!!(o===42?f:f&&(c||!d)),t(s)}}function l1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ks,i1=I(()=>{"use strict";Nn();nd();Ls();ks={name:"attention",resolveAll:jP,tokenize:VP}});function GP(e,t,a){let n=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return xt(p)?(e.consume(p),l):p===64?a(p):u(p)}function l(p){return p===43||p===45||p===46||tt(p)?(n=1,i(p)):u(p)}function i(p){return p===58?(e.consume(p),n=0,s):(p===43||p===45||p===46||tt(p))&&n++<32?(e.consume(p),i):(n=0,u(p))}function s(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||uo(p)?a(p):(e.consume(p),s)}function u(p){return p===64?(e.consume(p),c):m0(p)?(e.consume(p),u):a(p)}function c(p){return tt(p)?d(p):a(p)}function d(p){return p===46?(e.consume(p),n=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||tt(p))&&n++<63){let y=p===45?f:d;return e.consume(p),y}return a(p)}}var pg,s1=I(()=>{"use strict";ye();pg={name:"autolink",tokenize:GP}});function X(e,t,a,n){let r=n?n-1:Number.POSITIVE_INFINITY,o=0;return l;function l(s){return K(s)?(e.enter(a),i(s)):t(s)}function i(s){return K(s)&&o++<r?(e.consume(s),i):(e.exit(a),t(s))}}var st=I(()=>{"use strict";ye()});function WP(e,t,a){return n;function n(o){return K(o)?X(e,r,"linePrefix")(o):r(o)}function r(o){return o===null||H(o)?t(o):a(o)}}var nn,cd=I(()=>{"use strict";st();ye();nn={partial:!0,tokenize:WP}});function $P(e,t,a){let n=this;return r;function r(l){if(l===62){let i=n.containerState;return i.open||(e.enter("blockQuote",{_container:!0}),i.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return a(l)}function o(l){return K(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function XP(e,t,a){let n=this;return r;function r(l){return K(l)?X(e,o,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(dd,t,a)(l)}}function ZP(e){e.exit("blockQuote")}var dd,u1=I(()=>{"use strict";st();ye();dd={continuation:{tokenize:XP},exit:ZP,name:"blockQuote",tokenize:$P}});function QP(e,t,a){return n;function n(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),r}function r(o){return g0(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(o)}}var fd,c1=I(()=>{"use strict";ye();fd={name:"characterEscape",tokenize:QP}});function KP(e,t,a){let n=this,r=0,o,l;return i;function i(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),s}function s(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,l=tt,c(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=h0,c):(e.enter("characterReferenceValue"),o=7,l=Cs,c(d))}function c(d){if(d===59&&r){let f=e.exit("characterReferenceValue");return l===tt&&!Nl(n.sliceSerialize(f))?a(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(d)&&r++<o?(e.consume(d),c):a(d)}}var pd,d1=I(()=>{"use strict";id();ye();pd={name:"characterReference",tokenize:KP}});function YP(e,t,a){let n=this,r={partial:!0,tokenize:L},o=0,l=0,i;return s;function s(b){return u(b)}function u(b){let A=n.events[n.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,i=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(b)}function c(b){return b===i?(l++,e.consume(b),c):l<3?a(b):(e.exit("codeFencedFenceSequence"),K(b)?X(e,d,"whitespace")(b):d(b))}function d(b){return b===null||H(b)?(e.exit("codeFencedFence"),n.interrupt?t(b):e.check(f1,v,w)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||H(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(b)):K(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),X(e,p,"whitespace")(b)):b===96&&b===i?a(b):(e.consume(b),f)}function p(b){return b===null||H(b)?d(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||H(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(b)):b===96&&b===i?a(b):(e.consume(b),y)}function v(b){return e.attempt(r,w,S)(b)}function S(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g}function g(b){return o>0&&K(b)?X(e,x,"linePrefix",o+1)(b):x(b)}function x(b){return b===null||H(b)?e.check(f1,v,w)(b):(e.enter("codeFlowValue"),m(b))}function m(b){return b===null||H(b)?(e.exit("codeFlowValue"),x(b)):(e.consume(b),m)}function w(b){return e.exit("codeFenced"),t(b)}function L(b,A,R){let _=0;return T;function T(V){return b.enter("lineEnding"),b.consume(V),b.exit("lineEnding"),D}function D(V){return b.enter("codeFencedFence"),K(V)?X(b,N,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):N(V)}function N(V){return V===i?(b.enter("codeFencedFenceSequence"),B(V)):R(V)}function B(V){return V===i?(_++,b.consume(V),B):_>=l?(b.exit("codeFencedFenceSequence"),K(V)?X(b,j,"whitespace")(V):j(V)):R(V)}function j(V){return V===null||H(V)?(b.exit("codeFencedFence"),A(V)):R(V)}}}function JP(e,t,a){let n=this;return r;function r(l){return l===null?a(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return n.parser.lazy[n.now().line]?a(l):t(l)}}var f1,md,p1=I(()=>{"use strict";st();ye();f1={partial:!0,tokenize:JP},md={concrete:!0,name:"codeFenced",tokenize:YP}});function tN(e,t,a){let n=this;return r;function r(u){return e.enter("codeIndented"),X(e,o,"linePrefix",5)(u)}function o(u){let c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?l(u):a(u)}function l(u){return u===null?s(u):H(u)?e.attempt(eN,l,s)(u):(e.enter("codeFlowValue"),i(u))}function i(u){return u===null||H(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),i)}function s(u){return e.exit("codeIndented"),t(u)}}function aN(e,t,a){let n=this;return r;function r(l){return n.parser.lazy[n.now().line]?a(l):H(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r):X(e,o,"linePrefix",5)(l)}function o(l){let i=n.events[n.events.length-1];return i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?t(l):H(l)?r(l):a(l)}}var Ts,eN,m1=I(()=>{"use strict";st();ye();Ts={name:"codeIndented",tokenize:tN},eN={partial:!0,tokenize:aN}});function nN(e){let t=e.length-4,a=3,n,r;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=a;++n<t;)if(e[n][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(n=a-1,t++;++n<=t;)r===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(r=n):(n===t||e[n][1].type==="lineEnding")&&(e[r][1].type="codeTextData",n!==r+2&&(e[r][1].end=e[n-1][1].end,e.splice(r+2,n-r-2),t-=n-r-2,n=r+2),r=void 0);return e}function rN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function oN(e,t,a){let n=this,r=0,o,l;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),r++,s):(e.exit("codeTextSequence"),u(f))}function u(f){return f===null?a(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),u):f===96?(l=e.enter("codeTextSequence"),o=0,d(f)):H(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||H(f)?(e.exit("codeTextData"),u(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(l.type="codeTextData",c(f))}}var mg,h1=I(()=>{"use strict";ye();mg={name:"codeText",previous:rN,resolve:nN,tokenize:oN}});function Ms(e,t){let a=0;if(t.length<1e4)e.push(...t);else for(;a<t.length;)e.push(...t.slice(a,a+1e4)),a+=1e4}var hd,g1=I(()=>{"use strict";hd=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,a){let n=a??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,a,n){let r=a||0;this.setCursor(Math.trunc(t));let o=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&Ms(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ms(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ms(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let a=this.left.splice(t,Number.POSITIVE_INFINITY);Ms(this.right,a.reverse())}else{let a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ms(this.left,a.reverse())}}}});function gd(e){let t={},a=-1,n,r,o,l,i,s,u,c=new hd(e);for(;++a<c.length;){for(;a in t;)a=t[a];if(n=c.get(a),a&&n[1].type==="chunkFlow"&&c.get(a-1)[1].type==="listItemPrefix"&&(s=n[1]._tokenizer.events,o=0,o<s.length&&s[o][1].type==="lineEndingBlank"&&(o+=2),o<s.length&&s[o][1].type==="content"))for(;++o<s.length&&s[o][1].type!=="content";)s[o][1].type==="chunkText"&&(s[o][1]._isInFirstContentOfListItem=!0,o++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,lN(c,a)),a=t[a],u=!0);else if(n[1]._container){for(o=a,r=void 0;o--;)if(l=c.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(r&&(c.get(r)[1].type="lineEndingBlank"),l[1].type="lineEnding",r=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;r&&(n[1].end={...c.get(r)[1].start},i=c.slice(r,a),i.unshift(n),c.splice(r,a-r+1,i))}}return it(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function lN(e,t){let a=e.get(t)[1],n=e.get(t)[2],r=t-1,o=[],l=a._tokenizer;l||(l=n.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let i=l.events,s=[],u={},c,d,f=-1,p=a,y=0,v=0,S=[v];for(;p;){for(;e.get(++r)[1]!==p;);o.push(r),p._tokenizer||(c=n.sliceStream(p),p.next||c.push(null),d&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(c),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=a;++f<i.length;)i[f][0]==="exit"&&i[f-1][0]==="enter"&&i[f][1].type===i[f-1][1].type&&i[f][1].start.line!==i[f][1].end.line&&(v=f+1,S.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),f=S.length;f--;){let g=i.slice(S[f],S[f+1]),x=o.pop();s.push([x,x+g.length-1]),e.splice(x,2,g)}for(s.reverse(),f=-1;++f<s.length;)u[y+s[f][0]]=y+s[f][1],y+=s[f][1]-s[f][0]-1;return u}var hg=I(()=>{"use strict";Nn();g1()});function sN(e){return gd(e),e}function uN(e,t){let a;return n;function n(i){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),r(i)}function r(i){return i===null?o(i):H(i)?e.check(iN,l,o)(i):(e.consume(i),r)}function o(i){return e.exit("chunkContent"),e.exit("content"),t(i)}function l(i){return e.consume(i),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,r}}function cN(e,t,a){let n=this;return r;function r(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),X(e,o,"linePrefix")}function o(l){if(l===null||H(l))return a(l);let i=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?t(l):e.interrupt(n.parser.constructs.flow,a,t)(l)}}var gg,iN,y1=I(()=>{"use strict";st();ye();hg();gg={resolve:sN,tokenize:uN},iN={partial:!0,tokenize:cN}});function yd(e,t,a,n,r,o,l,i,s){let u=s||Number.POSITIVE_INFINITY,c=0;return d;function d(g){return g===60?(e.enter(n),e.enter(r),e.enter(o),e.consume(g),e.exit(o),f):g===null||g===32||g===41||uo(g)?a(g):(e.enter(n),e.enter(l),e.enter(i),e.enter("chunkString",{contentType:"string"}),v(g))}function f(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),e.exit(n),t):(e.enter(i),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(i),f(g)):g===null||g===60||H(g)?a(g):(e.consume(g),g===92?y:p)}function y(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function v(g){return!c&&(g===null||g===41||ue(g))?(e.exit("chunkString"),e.exit(i),e.exit(l),e.exit(n),t(g)):c<u&&g===40?(e.consume(g),c++,v):g===41?(e.consume(g),c--,v):g===null||g===32||g===40||uo(g)?a(g):(e.consume(g),g===92?S:v)}function S(g){return g===40||g===41||g===92?(e.consume(g),v):v(g)}}var yg=I(()=>{"use strict";ye()});function xd(e,t,a,n,r,o){let l=this,i=0,s;return u;function u(p){return e.enter(n),e.enter(r),e.consume(p),e.exit(r),e.enter(o),c}function c(p){return i>999||p===null||p===91||p===93&&!s||p===94&&!i&&"_hiddenFootnoteSupport"in l.parser.constructs?a(p):p===93?(e.exit(o),e.enter(r),e.consume(p),e.exit(r),e.exit(n),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||H(p)||i++>999?(e.exit("chunkString"),c(p)):(e.consume(p),s||(s=!K(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),i++,d):d(p)}}var xg=I(()=>{"use strict";ye()});function vd(e,t,a,n,r,o){let l;return i;function i(f){return f===34||f===39||f===40?(e.enter(n),e.enter(r),e.consume(f),e.exit(r),l=f===40?41:f,s):a(f)}function s(f){return f===l?(e.enter(r),e.consume(f),e.exit(r),e.exit(n),t):(e.enter(o),u(f))}function u(f){return f===l?(e.exit(o),s(l)):f===null?a(f):H(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),X(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===l||f===null||H(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?d:c)}function d(f){return f===l||f===92?(e.consume(f),c):c(f)}}var vg=I(()=>{"use strict";st();ye()});function ho(e,t){let a;return n;function n(r){return H(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),a=!0,n):K(r)?X(e,n,a?"linePrefix":"lineSuffix")(r):t(r)}}var wg=I(()=>{"use strict";st();ye()});function fN(e,t,a){let n=this,r;return o;function o(p){return e.enter("definition"),l(p)}function l(p){return xd.call(n,e,i,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function i(p){return r=Nt(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s):a(p)}function s(p){return ue(p)?ho(e,u)(p):u(p)}function u(p){return yd(e,c,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(dN,d,d)(p)}function d(p){return K(p)?X(e,f,"whitespace")(p):f(p)}function f(p){return p===null||H(p)?(e.exit("definition"),n.parser.defined.push(r),t(p)):a(p)}}function pN(e,t,a){return n;function n(i){return ue(i)?ho(e,r)(i):a(i)}function r(i){return vd(e,o,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function o(i){return K(i)?X(e,l,"whitespace")(i):l(i)}function l(i){return i===null||H(i)?t(i):a(i)}}var bg,dN,x1=I(()=>{"use strict";yg();xg();st();vg();wg();ye();Dl();bg={name:"definition",tokenize:fN},dN={partial:!0,tokenize:pN}});function mN(e,t,a){return n;function n(o){return e.enter("hardBreakEscape"),e.consume(o),r}function r(o){return H(o)?(e.exit("hardBreakEscape"),t(o)):a(o)}}var Sg,v1=I(()=>{"use strict";ye();Sg={name:"hardBreakEscape",tokenize:mN}});function hN(e,t){let a=e.length-2,n=3,r,o;return e[n][1].type==="whitespace"&&(n+=2),a-2>n&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(n===a-1||a-4>n&&e[a-2][1].type==="whitespace")&&(a-=n+1===a?2:4),a>n&&(r={type:"atxHeadingText",start:e[n][1].start,end:e[a][1].end},o={type:"chunkText",start:e[n][1].start,end:e[a][1].end,contentType:"text"},it(e,n,a-n+1,[["enter",r,t],["enter",o,t],["exit",o,t],["exit",r,t]])),e}function gN(e,t,a){let n=0;return r;function r(c){return e.enter("atxHeading"),o(c)}function o(c){return e.enter("atxHeadingSequence"),l(c)}function l(c){return c===35&&n++<6?(e.consume(c),l):c===null||ue(c)?(e.exit("atxHeadingSequence"),i(c)):a(c)}function i(c){return c===35?(e.enter("atxHeadingSequence"),s(c)):c===null||H(c)?(e.exit("atxHeading"),t(c)):K(c)?X(e,i,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function s(c){return c===35?(e.consume(c),s):(e.exit("atxHeadingSequence"),i(c))}function u(c){return c===null||c===35||ue(c)?(e.exit("atxHeadingText"),i(c)):(e.consume(c),u)}}var Cg,w1=I(()=>{"use strict";st();ye();Nn();Cg={name:"headingAtx",resolve:hN,tokenize:gN}});var b1,Ig,S1=I(()=>{"use strict";b1=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ig=["pre","script","style","textarea"]});function vN(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function wN(e,t,a){let n=this,r,o,l,i,s;return u;function u(k){return c(k)}function c(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),d}function d(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),o=!0,v):k===63?(e.consume(k),r=3,n.interrupt?t:C):xt(k)?(e.consume(k),l=String.fromCharCode(k),S):a(k)}function f(k){return k===45?(e.consume(k),r=2,p):k===91?(e.consume(k),r=5,i=0,y):xt(k)?(e.consume(k),r=4,n.interrupt?t:C):a(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:C):a(k)}function y(k){let Ze="CDATA[";return k===Ze.charCodeAt(i++)?(e.consume(k),i===Ze.length?n.interrupt?t:N:y):a(k)}function v(k){return xt(k)?(e.consume(k),l=String.fromCharCode(k),S):a(k)}function S(k){if(k===null||k===47||k===62||ue(k)){let Ze=k===47,Ue=l.toLowerCase();return!Ze&&!o&&Ig.includes(Ue)?(r=1,n.interrupt?t(k):N(k)):b1.includes(l.toLowerCase())?(r=6,Ze?(e.consume(k),g):n.interrupt?t(k):N(k)):(r=7,n.interrupt&&!n.parser.lazy[n.now().line]?a(k):o?x(k):m(k))}return k===45||tt(k)?(e.consume(k),l+=String.fromCharCode(k),S):a(k)}function g(k){return k===62?(e.consume(k),n.interrupt?t:N):a(k)}function x(k){return K(k)?(e.consume(k),x):T(k)}function m(k){return k===47?(e.consume(k),T):k===58||k===95||xt(k)?(e.consume(k),w):K(k)?(e.consume(k),m):T(k)}function w(k){return k===45||k===46||k===58||k===95||tt(k)?(e.consume(k),w):L(k)}function L(k){return k===61?(e.consume(k),b):K(k)?(e.consume(k),L):m(k)}function b(k){return k===null||k===60||k===61||k===62||k===96?a(k):k===34||k===39?(e.consume(k),s=k,A):K(k)?(e.consume(k),b):R(k)}function A(k){return k===s?(e.consume(k),s=null,_):k===null||H(k)?a(k):(e.consume(k),A)}function R(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||ue(k)?L(k):(e.consume(k),R)}function _(k){return k===47||k===62||K(k)?m(k):a(k)}function T(k){return k===62?(e.consume(k),D):a(k)}function D(k){return k===null||H(k)?N(k):K(k)?(e.consume(k),D):a(k)}function N(k){return k===45&&r===2?(e.consume(k),F):k===60&&r===1?(e.consume(k),te):k===62&&r===4?(e.consume(k),Xe):k===63&&r===3?(e.consume(k),C):k===93&&r===5?(e.consume(k),Z):H(k)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(yN,le,B)(k)):k===null||H(k)?(e.exit("htmlFlowData"),B(k)):(e.consume(k),N)}function B(k){return e.check(xN,j,le)(k)}function j(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),V}function V(k){return k===null||H(k)?B(k):(e.enter("htmlFlowData"),N(k))}function F(k){return k===45?(e.consume(k),C):N(k)}function te(k){return k===47?(e.consume(k),l="",$e):N(k)}function $e(k){if(k===62){let Ze=l.toLowerCase();return Ig.includes(Ze)?(e.consume(k),Xe):N(k)}return xt(k)&&l.length<8?(e.consume(k),l+=String.fromCharCode(k),$e):N(k)}function Z(k){return k===93?(e.consume(k),C):N(k)}function C(k){return k===62?(e.consume(k),Xe):k===45&&r===2?(e.consume(k),C):N(k)}function Xe(k){return k===null||H(k)?(e.exit("htmlFlowData"),le(k)):(e.consume(k),Xe)}function le(k){return e.exit("htmlFlow"),t(k)}}function bN(e,t,a){let n=this;return r;function r(l){return H(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):a(l)}function o(l){return n.parser.lazy[n.now().line]?a(l):t(l)}}function SN(e,t,a){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(nn,t,a)}}var Lg,yN,xN,C1=I(()=>{"use strict";ye();S1();cd();Lg={concrete:!0,name:"htmlFlow",resolveTo:vN,tokenize:wN},yN={partial:!0,tokenize:SN},xN={partial:!0,tokenize:bN}});function CN(e,t,a){let n=this,r,o,l;return i;function i(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),s}function s(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),L):C===63?(e.consume(C),m):xt(C)?(e.consume(C),R):a(C)}function u(C){return C===45?(e.consume(C),c):C===91?(e.consume(C),o=0,y):xt(C)?(e.consume(C),x):a(C)}function c(C){return C===45?(e.consume(C),p):a(C)}function d(C){return C===null?a(C):C===45?(e.consume(C),f):H(C)?(l=d,te(C)):(e.consume(C),d)}function f(C){return C===45?(e.consume(C),p):d(C)}function p(C){return C===62?F(C):C===45?f(C):d(C)}function y(C){let Xe="CDATA[";return C===Xe.charCodeAt(o++)?(e.consume(C),o===Xe.length?v:y):a(C)}function v(C){return C===null?a(C):C===93?(e.consume(C),S):H(C)?(l=v,te(C)):(e.consume(C),v)}function S(C){return C===93?(e.consume(C),g):v(C)}function g(C){return C===62?F(C):C===93?(e.consume(C),g):v(C)}function x(C){return C===null||C===62?F(C):H(C)?(l=x,te(C)):(e.consume(C),x)}function m(C){return C===null?a(C):C===63?(e.consume(C),w):H(C)?(l=m,te(C)):(e.consume(C),m)}function w(C){return C===62?F(C):m(C)}function L(C){return xt(C)?(e.consume(C),b):a(C)}function b(C){return C===45||tt(C)?(e.consume(C),b):A(C)}function A(C){return H(C)?(l=A,te(C)):K(C)?(e.consume(C),A):F(C)}function R(C){return C===45||tt(C)?(e.consume(C),R):C===47||C===62||ue(C)?_(C):a(C)}function _(C){return C===47?(e.consume(C),F):C===58||C===95||xt(C)?(e.consume(C),T):H(C)?(l=_,te(C)):K(C)?(e.consume(C),_):F(C)}function T(C){return C===45||C===46||C===58||C===95||tt(C)?(e.consume(C),T):D(C)}function D(C){return C===61?(e.consume(C),N):H(C)?(l=D,te(C)):K(C)?(e.consume(C),D):_(C)}function N(C){return C===null||C===60||C===61||C===62||C===96?a(C):C===34||C===39?(e.consume(C),r=C,B):H(C)?(l=N,te(C)):K(C)?(e.consume(C),N):(e.consume(C),j)}function B(C){return C===r?(e.consume(C),r=void 0,V):C===null?a(C):H(C)?(l=B,te(C)):(e.consume(C),B)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?a(C):C===47||C===62||ue(C)?_(C):(e.consume(C),j)}function V(C){return C===47||C===62||ue(C)?_(C):a(C)}function F(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):a(C)}function te(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),$e}function $e(C){return K(C)?X(e,Z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):Z(C)}function Z(C){return e.enter("htmlTextData"),l(C)}}var kg,I1=I(()=>{"use strict";st();ye();kg={name:"htmlText",tokenize:CN}});function TN(e){let t=-1,a=[];for(;++t<e.length;){let n=e[t][1];if(a.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){let r=n.type==="labelImage"?4:2;n.type="data",t+=r}}return e.length!==a.length&&it(e,0,e.length,a),e}function MN(e,t){let a=e.length,n=0,r,o,l,i;for(;a--;)if(r=e[a][1],o){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[a][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(l){if(e[a][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(o=a,r.type!=="labelLink")){n=2;break}}else r.type==="labelEnd"&&(l=a);let s={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},c={type:"labelText",start:{...e[o+n+2][1].end},end:{...e[l-2][1].start}};return i=[["enter",s,t],["enter",u,t]],i=Vt(i,e.slice(o+1,o+n+3)),i=Vt(i,[["enter",c,t]]),i=Vt(i,Ir(t.parser.constructs.insideSpan.null,e.slice(o+n+4,l-3),t)),i=Vt(i,[["exit",c,t],e[l-2],e[l-1],["exit",u,t]]),i=Vt(i,e.slice(l+1)),i=Vt(i,[["exit",s,t]]),it(e,o,e.length,i),e}function AN(e,t,a){let n=this,r=n.events.length,o,l;for(;r--;)if((n.events[r][1].type==="labelImage"||n.events[r][1].type==="labelLink")&&!n.events[r][1]._balanced){o=n.events[r][1];break}return i;function i(f){return o?o._inactive?d(f):(l=n.parser.defined.includes(Nt(n.sliceSerialize({start:o.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),s):a(f)}function s(f){return f===40?e.attempt(IN,c,l?c:d)(f):f===91?e.attempt(LN,c,l?u:d)(f):l?c(f):d(f)}function u(f){return e.attempt(kN,c,d)(f)}function c(f){return t(f)}function d(f){return o._balanced=!0,a(f)}}function EN(e,t,a){return n;function n(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return ue(d)?ho(e,o)(d):o(d)}function o(d){return d===41?c(d):yd(e,l,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function l(d){return ue(d)?ho(e,s)(d):c(d)}function i(d){return a(d)}function s(d){return d===34||d===39||d===40?vd(e,u,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return ue(d)?ho(e,c)(d):c(d)}function c(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):a(d)}}function RN(e,t,a){let n=this;return r;function r(i){return xd.call(n,e,o,l,"reference","referenceMarker","referenceString")(i)}function o(i){return n.parser.defined.includes(Nt(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(i):a(i)}function l(i){return a(i)}}function DN(e,t,a){return n;function n(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),r}function r(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):a(o)}}var go,IN,LN,kN,wd=I(()=>{"use strict";yg();xg();vg();wg();ye();Nn();Dl();Ls();go={name:"labelEnd",resolveAll:TN,resolveTo:MN,tokenize:AN},IN={tokenize:EN},LN={tokenize:RN},kN={tokenize:DN}});function _N(e,t,a){let n=this;return r;function r(i){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(i),e.exit("labelImageMarker"),o}function o(i){return i===91?(e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelImage"),l):a(i)}function l(i){return i===94&&"_hiddenFootnoteSupport"in n.parser.constructs?a(i):t(i)}}var Tg,L1=I(()=>{"use strict";wd();Tg={name:"labelStartImage",resolveAll:go.resolveAll,tokenize:_N}});function ON(e,t,a){let n=this;return r;function r(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?a(l):t(l)}}var Mg,k1=I(()=>{"use strict";wd();Mg={name:"labelStartLink",resolveAll:go.resolveAll,tokenize:ON}});function PN(e,t){return a;function a(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),X(e,t,"linePrefix")}}var As,T1=I(()=>{"use strict";st();As={name:"lineEnding",tokenize:PN}});function NN(e,t,a){let n=0,r;return o;function o(u){return e.enter("thematicBreak"),l(u)}function l(u){return r=u,i(u)}function i(u){return u===r?(e.enter("thematicBreakSequence"),s(u)):n>=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):a(u)}function s(u){return u===r?(e.consume(u),n++,s):(e.exit("thematicBreakSequence"),K(u)?X(e,i,"whitespace")(u):i(u))}}var yo,Ag=I(()=>{"use strict";st();ye();yo={name:"thematicBreak",tokenize:NN}});function zN(e,t,a){let n=this,r=n.events[n.events.length-1],o=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,l=0;return i;function i(p){let y=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Cs(p)){if(n.containerState.type||(n.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(yo,a,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(p)}return a(p)}function s(p){return Cs(p)&&++l<10?(e.consume(p),s):(!n.interrupt||l<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):a(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(nn,n.interrupt?a:c,e.attempt(BN,f,d))}function c(p){return n.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return K(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):a(p)}function f(p){return n.containerState.size=o+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function qN(e,t,a){let n=this;return n.containerState._closeFlow=void 0,e.check(nn,r,o);function r(i){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,X(e,t,"listItemIndent",n.containerState.size+1)(i)}function o(i){return n.containerState.furtherBlankLines||!K(i)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,l(i)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(UN,t,l)(i))}function l(i){return n.containerState._closeFlow=!0,n.interrupt=void 0,X(e,e.attempt(Bt,t,a),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}function FN(e,t,a){let n=this;return X(e,r,"listItemIndent",n.containerState.size+1);function r(o){let l=n.events[n.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===n.containerState.size?t(o):a(o)}}function HN(e){e.exit(this.containerState.type)}function jN(e,t,a){let n=this;return X(e,r,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(o){let l=n.events[n.events.length-1];return!K(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):a(o)}}var Bt,BN,UN,M1=I(()=>{"use strict";st();ye();cd();Ag();Bt={continuation:{tokenize:qN},exit:HN,name:"list",tokenize:zN},BN={partial:!0,tokenize:jN},UN={partial:!0,tokenize:FN}});function VN(e,t){let a=e.length,n,r,o;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){n=a;break}e[a][1].type==="paragraph"&&(r=a)}else e[a][1].type==="content"&&e.splice(a,1),!o&&e[a][1].type==="definition"&&(o=a);let l={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",l,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end={...e[o][1].end}):e[n][1]=l,e.push(["exit",l,t]),e}function GN(e,t,a){let n=this,r;return o;function o(u){let c=n.events.length,d;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){d=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(e.enter("setextHeadingLine"),r=u,l(u)):a(u)}function l(u){return e.enter("setextHeadingLineSequence"),i(u)}function i(u){return u===r?(e.consume(u),i):(e.exit("setextHeadingLineSequence"),K(u)?X(e,s,"lineSuffix")(u):s(u))}function s(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):a(u)}}var bd,A1=I(()=>{"use strict";st();ye();bd={name:"setextUnderline",resolveTo:VN,tokenize:GN}});var Sd=I(()=>{"use strict";i1();s1();cd();u1();c1();d1();p1();m1();h1();y1();x1();v1();w1();C1();I1();wd();L1();k1();T1();M1();A1();Ag()});function Eg(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:QN,continuation:{tokenize:KN},exit:YN}},text:{91:{name:"gfmFootnoteCall",tokenize:ZN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$N,resolveTo:XN}}}}function $N(e,t,a){let n=this,r=n.events.length,o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),l;for(;r--;){let s=n.events[r][1];if(s.type==="labelImage"){l=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return i;function i(s){if(!l||!l._balanced)return a(s);let u=Nt(n.sliceSerialize({start:l.end,end:n.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?a(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s))}}function XN(e,t){let a=e.length,n;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){n=e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let l={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},s=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",l,t],["enter",i,t],["exit",i,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...s),e}function ZN(e,t,a){let n=this,r=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),o=0,l;return i;function i(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),s}function s(d){return d!==94?a(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(o>999||d===93&&!l||d===null||d===91||ue(d))return a(d);if(d===93){e.exit("chunkString");let f=e.exit("gfmFootnoteCallString");return r.includes(Nt(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(d)}return ue(d)||(l=!0),o++,e.consume(d),d===92?c:u}function c(d){return d===91||d===92||d===93?(e.consume(d),o++,u):u(d)}}function QN(e,t,a){let n=this,r=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),o,l=0,i;return s;function s(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):a(y)}function c(y){if(l>999||y===93&&!i||y===null||y===91||ue(y))return a(y);if(y===93){e.exit("chunkString");let v=e.exit("gfmFootnoteDefinitionLabelString");return o=Nt(n.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ue(y)||(i=!0),l++,e.consume(y),y===92?d:c}function d(y){return y===91||y===92||y===93?(e.consume(y),l++,c):c(y)}function f(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),r.includes(o)||r.push(o),X(e,p,"gfmFootnoteDefinitionWhitespace")):a(y)}function p(y){return t(y)}}function KN(e,t,a){return e.check(nn,t,e.attempt(WN,t,a))}function YN(e){e.exit("gfmFootnoteDefinition")}function JN(e,t,a){let n=this;return X(e,r,"gfmFootnoteDefinitionIndent",5);function r(o){let l=n.events[n.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):a(o)}}var WN,E1=I(()=>{"use strict";Sd();st();ye();Dl();WN={tokenize:JN,partial:!0}});var R1=I(()=>{"use strict";E1()});function Rg(e){let a=(e||{}).singleTilde,n={name:"strikethrough",tokenize:o,resolveAll:r};return a==null&&(a=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(l,i){let s=-1;for(;++s<l.length;)if(l[s][0]==="enter"&&l[s][1].type==="strikethroughSequenceTemporary"&&l[s][1]._close){let u=s;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[s][1].end.offset-l[s][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[s][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";let c={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[s][1].end)},d={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[s][1].start)},f=[["enter",c,i],["enter",l[u][1],i],["exit",l[u][1],i],["enter",d,i]],p=i.parser.constructs.insideSpan.null;p&&it(f,f.length,0,Ir(p,l.slice(u+1,s),i)),it(f,f.length,0,[["exit",d,i],["enter",l[s][1],i],["exit",l[s][1],i],["exit",c,i]]),it(l,u-1,s-u+3,f),s=u+f.length-2;break}}for(s=-1;++s<l.length;)l[s][1].type==="strikethroughSequenceTemporary"&&(l[s][1].type="data");return l}function o(l,i,s){let u=this.previous,c=this.events,d=0;return f;function f(y){return u===126&&c[c.length-1][1].type!=="characterEscape"?s(y):(l.enter("strikethroughSequenceTemporary"),p(y))}function p(y){let v=Pn(u);if(y===126)return d>1?s(y):(l.consume(y),d++,p);if(d<2&&!a)return s(y);let S=l.exit("strikethroughSequenceTemporary"),g=Pn(y);return S._open=!g||g===2&&!!v,S._close=!v||v===2&&!!g,i(y)}}}var D1=I(()=>{"use strict";Nn();nd();Ls()});var _1=I(()=>{"use strict";D1()});function e3(e,t,a,n){let r=0;if(!(a===0&&n.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=a,e.map[r][2].push(...n);return}r+=1}e.map.push([t,a,n])}}var Cd,O1=I(()=>{"use strict";Cd=class{constructor(){this.map=[]}add(t,a,n){e3(this,t,a,n)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let a=this.map.length,n=[];for(;a>0;)a-=1,n.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];n.push(t.slice()),t.length=0;let r=n.pop();for(;r;){for(let o of r)t.push(o);r=n.pop()}this.map.length=0}}});function P1(e,t){let a=!1,n=[];for(;t<e.length;){let r=e[t];if(a){if(r[0]==="enter")r[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){let o=n.length-1;n[o]=n[o]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(a=!0);t+=1}return n}var N1=I(()=>{"use strict"});function Dg(){return{flow:{null:{name:"table",tokenize:t3,resolveAll:a3}}}}function t3(e,t,a){let n=this,r=0,o=0,l;return i;function i(T){let D=n.events.length-1;for(;D>-1;){let j=n.events[D][1].type;if(j==="lineEnding"||j==="linePrefix")D--;else break}let N=D>-1?n.events[D][1].type:null,B=N==="tableHead"||N==="tableRow"?b:s;return B===b&&n.parser.lazy[n.now().line]?a(T):B(T)}function s(T){return e.enter("tableHead"),e.enter("tableRow"),u(T)}function u(T){return T===124||(l=!0,o+=1),c(T)}function c(T){return T===null?a(T):H(T)?o>1?(o=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),p):a(T):K(T)?X(e,c,"whitespace")(T):(o+=1,l&&(l=!1,r+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),l=!0,c):(e.enter("data"),d(T)))}function d(T){return T===null||T===124||ue(T)?(e.exit("data"),c(T)):(e.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(e.consume(T),d):d(T)}function p(T){return n.interrupt=!1,n.parser.lazy[n.now().line]?a(T):(e.enter("tableDelimiterRow"),l=!1,K(T)?X(e,y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):y(T))}function y(T){return T===45||T===58?S(T):T===124?(l=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),v):L(T)}function v(T){return K(T)?X(e,S,"whitespace")(T):S(T)}function S(T){return T===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),g):T===45?(o+=1,g(T)):T===null||H(T)?w(T):L(T)}function g(T){return T===45?(e.enter("tableDelimiterFiller"),x(T)):L(T)}function x(T){return T===45?(e.consume(T),x):T===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),m):(e.exit("tableDelimiterFiller"),m(T))}function m(T){return K(T)?X(e,w,"whitespace")(T):w(T)}function w(T){return T===124?y(T):T===null||H(T)?!l||r!==o?L(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):L(T)}function L(T){return a(T)}function b(T){return e.enter("tableRow"),A(T)}function A(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),A):T===null||H(T)?(e.exit("tableRow"),t(T)):K(T)?X(e,A,"whitespace")(T):(e.enter("data"),R(T))}function R(T){return T===null||T===124||ue(T)?(e.exit("data"),A(T)):(e.consume(T),T===92?_:R)}function _(T){return T===92||T===124?(e.consume(T),R):R(T)}}function a3(e,t){let a=-1,n=!0,r=0,o=[0,0,0,0],l=[0,0,0,0],i=!1,s=0,u,c,d,f=new Cd;for(;++a<e.length;){let p=e[a],y=p[1];p[0]==="enter"?y.type==="tableHead"?(i=!1,s!==0&&(B1(f,t,s,u,c),c=void 0,s=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},f.add(a,0,[["enter",u,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(n=!0,d=void 0,o=[0,0,0,0],l=[0,a+1,0,0],i&&(i=!1,c={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},f.add(a,0,[["enter",c,t]])),r=y.type==="tableDelimiterRow"?2:c?3:1):r&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(n=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],d=Id(f,t,o,r,void 0,d),o=[0,0,0,0]),l[2]=a)):y.type==="tableCellDivider"&&(n?n=!1:(o[1]!==0&&(l[0]=l[1],d=Id(f,t,o,r,void 0,d)),o=l,l=[o[1],a,0,0])):y.type==="tableHead"?(i=!0,s=a):y.type==="tableRow"||y.type==="tableDelimiterRow"?(s=a,o[1]!==0?(l[0]=l[1],d=Id(f,t,o,r,a,d)):l[1]!==0&&(d=Id(f,t,l,r,a,d)),r=0):r&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(l[3]=a)}for(s!==0&&B1(f,t,s,u,c),f.consume(t.events),a=-1;++a<t.events.length;){let p=t.events[a];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=P1(t.events,a))}return e}function Id(e,t,a,n,r,o){let l=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",i="tableContent";a[0]!==0&&(o.end=Object.assign({},Bl(t.events,a[0])),e.add(a[0],0,[["exit",o,t]]));let s=Bl(t.events,a[1]);if(o={type:l,start:Object.assign({},s),end:Object.assign({},s)},e.add(a[1],0,[["enter",o,t]]),a[2]!==0){let u=Bl(t.events,a[2]),c=Bl(t.events,a[3]),d={type:i,start:Object.assign({},u),end:Object.assign({},c)};if(e.add(a[2],0,[["enter",d,t]]),n!==2){let f=t.events[a[2]],p=t.events[a[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",a[3]>a[2]+1){let y=a[2]+1,v=a[3]-a[2]-1;e.add(y,v,[])}}e.add(a[3]+1,0,[["exit",d,t]])}return r!==void 0&&(o.end=Object.assign({},Bl(t.events,r)),e.add(r,0,[["exit",o,t]]),o=void 0),o}function B1(e,t,a,n,r){let o=[],l=Bl(t.events,a);r&&(r.end=Object.assign({},l),o.push(["exit",r,t])),n.end=Object.assign({},l),o.push(["exit",n,t]),e.add(a+1,0,o)}function Bl(e,t){let a=e[t],n=a[0]==="enter"?"start":"end";return a[1][n]}var U1=I(()=>{"use strict";st();ye();O1();N1()});var z1=I(()=>{"use strict";U1()});function _g(){return{text:{91:n3}}}function r3(e,t,a){let n=this;return r;function r(s){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?a(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return ue(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),l):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),l):a(s)}function l(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),i):a(s)}function i(s){return H(s)?t(s):K(s)?e.check({tokenize:o3},t,a)(s):a(s)}}function o3(e,t,a){return X(e,n,"whitespace");function n(r){return r===null?a(r):t(r)}}var n3,q1=I(()=>{"use strict";st();ye();n3={name:"tasklistCheck",tokenize:r3}});var F1=I(()=>{"use strict";q1()});function H1(e){return ud([dg(),Eg(),Rg(e),Dg(),_g()])}var j1=I(()=>{"use strict";ug();o1();R1();_1();z1();F1()});function Ld(e){let t=this,a=e||l3,n=t.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),l=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(H1(a)),o.push(ig()),l.push(sg(a))}var l3,V1=I(()=>{"use strict";XI();j1();l3={}});var G1=I(()=>{"use strict";V1()});var i3,s3,u3,W1,c3,d3,$1,Q1,K1,f3,p3,m3,h3,g3,y3,x3,xo,Y1,v3,w3,b3,S3,C3,I3,X1,Lr,Ul,L3,J1,Td,k3,eL,Pg,T3,M3,tL,A3,E3,R3,D3,_3,O3,P3,N3,B3,aL,U3,z3,q3,F3,H3,j3,kd,V3,G3,W3,$3,X3,Z3,Q3,K3,Y3,J3,Z1,eB,nL,tB,aB,nB,rB,oB,lB,Og,ya,iB,sB,uB,rL,oL=I(()=>{"use strict";i3=Object.defineProperty,s3=Object.defineProperties,u3=Object.getOwnPropertyDescriptors,W1=Object.getOwnPropertySymbols,c3=Object.prototype.hasOwnProperty,d3=Object.prototype.propertyIsEnumerable,$1=(e,t,a)=>t in e?i3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Q1=(e,t)=>{for(var a in t||(t={}))c3.call(t,a)&&$1(e,a,t[a]);if(W1)for(var a of W1(t))d3.call(t,a)&&$1(e,a,t[a]);return e},K1=(e,t)=>s3(e,u3(t)),f3=/(\*\*)([^*]*\*?)$/,p3=/(__)([^_]*?)$/,m3=/(\*\*\*)([^*]*?)$/,h3=/(\*)([^*]*?)$/,g3=/(_)([^_]*?)$/,y3=/(`)([^`]*?)$/,x3=/(~~)([^~]*?)$/,xo=/^[\s_~*`]*$/,Y1=/^[\s]*[-*+][\s]+$/,v3=/[\p{L}\p{N}_]/u,w3=/^```[^`\n]*```?$/,b3=/^\*{4,}$/,S3=/(__)([^_]+)_$/,C3=/(~~)([^~]+)~$/,I3=/__/g,X1=/~~/g,Lr=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:v3.test(e)},Ul=(e,t)=>{let a=!1;for(let n=0;n<t;n+=1)e[n]==="`"&&e[n+1]==="`"&&e[n+2]==="`"&&(a=!a,n+=2);return a},L3=(e,t)=>{let a=1;for(let n=t-1;n>=0;n-=1)if(e[n]==="]")a+=1;else if(e[n]==="["&&(a-=1,a===0))return n;return-1},J1=(e,t)=>{let a=1;for(let n=t+1;n<e.length;n+=1)if(e[n]==="[")a+=1;else if(e[n]==="]"&&(a-=1,a===0))return n;return-1},Td=(e,t)=>{let a=!1,n=!1;for(let r=0;r<e.length&&r<t;r+=1){if(e[r]==="\\"&&e[r+1]==="$"){r+=1;continue}e[r]==="$"&&(e[r+1]==="$"?(n=!n,r+=1,a=!1):n||(a=!a))}return a||n},k3=(e,t)=>{for(let a=t;a<e.length;a+=1){if(e[a]===")")return!0;if(e[a]===`
25
- `)return!1}return!1},eL=(e,t)=>{for(let a=t-1;a>=0;a-=1){if(e[a]===")")return!1;if(e[a]==="(")return a>0&&e[a-1]==="]"?k3(e,t):!1;if(e[a]===`
24
+ `))}function s(p,y,v,S){let g=v.enter("tableCell"),x=v.enter("phrasing"),m=v.containerPhrasing(p,{...S,before:o,after:o});return x(),g(),m}function u(p,y){return R0(p,{align:y,alignDelimiters:n,padding:a,stringLength:r})}function c(p,y,v){let S=p.children,g=-1,x=[],m=y.enter("table");for(;++g<S.length;)x[g]=d(S[g],y,v);return m(),x}function d(p,y,v){let S=p.children,g=-1,x=[],m=y.enter("tableRow");for(;++g<S.length;)x[g]=s(S[g],p,y,v);return m(),x}function f(p,y,v){let S=Is.inlineCode(p,y,v);return v.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}var HI=I(()=>{"use strict";D0();tg()});var jI=I(()=>{"use strict";HI()});function og(){return{exit:{taskListCheckValueChecked:VI,taskListCheckValueUnchecked:VI,paragraph:AP}}}function lg(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:EP}}}function VI(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function AP(e){let t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){let a=this.stack[this.stack.length-1];a.type;let n=a.children[0];if(n&&n.type==="text"){let r=t.children,o=-1,l;for(;++o<r.length;){let i=r[o];if(i.type==="paragraph"){l=i;break}}l===a&&(n.value=n.value.slice(1),n.value.length===0?a.children.shift():a.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,a.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function EP(e,t,a,n){let r=e.children[0],o=typeof e.checked=="boolean"&&r&&r.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",i=a.createTracker(n);o&&i.move(l);let s=Is.listItem(e,t,a,{...n,...i.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(c){return c+l}}var GI=I(()=>{"use strict";tg()});var WI=I(()=>{"use strict";GI()});function ig(){return[Ph(),Bh(),zh(),ng(),og()]}function sg(e){return{extensions:[Nh(),Uh(e),qh(),rg(e),lg()]}}var $I=I(()=>{"use strict";S0();k0();A0();jI();WI()});var XI=I(()=>{"use strict";$I()});function it(e,t,a,n){let r=e.length,o=0,l;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,a=a>0?a:0,n.length<1e4)l=Array.from(n),l.unshift(t,a),e.splice(...l);else for(a&&e.splice(t,a);o<n.length;)l=n.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function Vt(e,t){return e.length>0?(it(e,e.length,0,t),e):t}var Nn=I(()=>{"use strict"});function ud(e){let t={},a=-1;for(;++a<e.length;)RP(t,e[a]);return t}function RP(e,t){let a;for(a in t){let r=(ZI.call(e,a)?e[a]:void 0)||(e[a]={}),o=t[a],l;if(o)for(l in o){ZI.call(r,l)||(r[l]=[]);let i=o[l];DP(r[l],Array.isArray(i)?i:i?[i]:[])}}}function DP(e,t){let a=-1,n=[];for(;++a<t.length;)(t[a].add==="after"?e:n).push(t[a]);it(e,0,0,n)}var ZI,ug=I(()=>{"use strict";Nn();ZI={}.hasOwnProperty});function dg(){return{text:an}}function PP(e,t,a){let n=this,r,o;return l;function l(d){return!cg(d)||!nL.call(n,n.previous)||fg(n.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),i(d))}function i(d){return cg(d)?(e.consume(d),i):d===64?(e.consume(d),s):a(d)}function s(d){return d===46?e.check(OP,c,u)(d):d===45||d===95||tt(d)?(o=!0,e.consume(d),s):c(d)}function u(d){return e.consume(d),r=!0,s}function c(d){return o&&r&&xt(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):a(d)}}function NP(e,t,a){let n=this;return r;function r(l){return l!==87&&l!==119||!tL.call(n,n.previous)||fg(n.events)?a(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_P,e.attempt(QI,e.attempt(KI,o),a),a)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function BP(e,t,a){let n=this,r="",o=!1;return l;function l(d){return(d===72||d===104)&&aL.call(n,n.previous)&&!fg(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(d),e.consume(d),i):a(d)}function i(d){if(xt(d)&&r.length<5)return r+=String.fromCodePoint(d),e.consume(d),i;if(d===58){let f=r.toLowerCase();if(f==="http"||f==="https")return e.consume(d),s}return a(d)}function s(d){return d===47?(e.consume(d),o?u:(o=!0,s)):a(d)}function u(d){return d===null||uo(d)||ue(d)||tn(d)||co(d)?a(d):e.attempt(QI,e.attempt(KI,c),a)(d)}function c(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function UP(e,t,a){let n=0;return r;function r(l){return(l===87||l===119)&&n<3?(n++,e.consume(l),r):l===46&&n===3?(e.consume(l),o):a(l)}function o(l){return l===null?a(l):t(l)}}function zP(e,t,a){let n,r,o;return l;function l(u){return u===46||u===95?e.check(YI,s,i)(u):u===null||ue(u)||tn(u)||u!==45&&co(u)?s(u):(o=!0,e.consume(u),l)}function i(u){return u===95?n=!0:(r=n,n=void 0),e.consume(u),l}function s(u){return r||n||!o?a(u):t(u)}}function qP(e,t){let a=0,n=0;return r;function r(l){return l===40?(a++,e.consume(l),r):l===41&&n<a?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(YI,t,o)(l):l===null||ue(l)||tn(l)?t(l):(e.consume(l),r)}function o(l){return l===41&&n++,e.consume(l),r}}function FP(e,t,a){return n;function n(i){return i===33||i===34||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===63||i===95||i===126?(e.consume(i),n):i===38?(e.consume(i),o):i===93?(e.consume(i),r):i===60||i===null||ue(i)||tn(i)?t(i):a(i)}function r(i){return i===null||i===40||i===91||ue(i)||tn(i)?t(i):n(i)}function o(i){return xt(i)?l(i):a(i)}function l(i){return i===59?(e.consume(i),n):xt(i)?(e.consume(i),l):a(i)}}function HP(e,t,a){return n;function n(o){return e.consume(o),r}function r(o){return tt(o)?a(o):t(o)}}function tL(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ue(e)}function aL(e){return!xt(e)}function nL(e){return!(e===47||cg(e))}function cg(e){return e===43||e===45||e===46||e===95||tt(e)}function fg(e){let t=e.length,a=!1;for(;t--;){let n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){a=!0;break}if(n._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}var _P,QI,KI,YI,OP,JI,eL,Bn,an,po,rL=I(()=>{"use strict";ye();_P={tokenize:UP,partial:!0},QI={tokenize:zP,partial:!0},KI={tokenize:qP,partial:!0},YI={tokenize:FP,partial:!0},OP={tokenize:HP,partial:!0},JI={name:"wwwAutolink",tokenize:NP,previous:tL},eL={name:"protocolAutolink",tokenize:BP,previous:aL},Bn={name:"emailAutolink",tokenize:PP,previous:nL},an={};po=48;for(;po<123;)an[po]=Bn,po++,po===58?po=65:po===91&&(po=97);an[43]=Bn;an[45]=Bn;an[46]=Bn;an[95]=Bn;an[72]=[Bn,eL];an[104]=[Bn,eL];an[87]=[Bn,JI];an[119]=[Bn,JI]});function Da(e){let t=[],a=-1,n=0,r=0;for(;++a<e.length;){let o=e.charCodeAt(a),l="";if(o===37&&tt(e.charCodeAt(a+1))&&tt(e.charCodeAt(a+2)))r=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){let i=e.charCodeAt(a+1);o<56320&&i>56319&&i<57344?(l=String.fromCharCode(o,i),r=1):l="\uFFFD"}else l=String.fromCharCode(o);l&&(t.push(e.slice(n,a),encodeURIComponent(l)),n=a+r+1,l=""),r&&(a+=r,r=0)}return t.join("")+e.slice(n)}var mo=I(()=>{"use strict";ye()});var oL=I(()=>{"use strict";rL()});function Ir(e,t,a){let n=[],r=-1;for(;++r<e.length;){let o=e[r].resolveAll;o&&!n.includes(o)&&(t=o(t,a),n.push(o))}return t}var Ls=I(()=>{"use strict"});function jP(e,t){let a=-1,n,r,o,l,i,s,u,c;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(n=a;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[n][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;let d={...e[n][1].end},f={...e[a][1].start};lL(d,-s),lL(f,s),l={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},i={type:s>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:f},o={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[a][1].start}},r={type:s>1?"strong":"emphasis",start:{...l.start},end:{...i.end}},e[n][1].end={...l.start},e[a][1].start={...i.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Vt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Vt(u,[["enter",r,t],["enter",l,t],["exit",l,t],["enter",o,t]]),u=Vt(u,Ir(t.parser.constructs.insideSpan.null,e.slice(n+1,a),t)),u=Vt(u,[["exit",o,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[a][1].end.offset-e[a][1].start.offset?(c=2,u=Vt(u,[["enter",e[a][1],t],["exit",e[a][1],t]])):c=0,it(e,n-1,a-n+3,u),a=n+u.length-c-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function VP(e,t){let a=this.parser.constructs.attentionMarkers.null,n=this.previous,r=Pn(n),o;return l;function l(s){return o=s,e.enter("attentionSequence"),i(s)}function i(s){if(s===o)return e.consume(s),i;let u=e.exit("attentionSequence"),c=Pn(s),d=!c||c===2&&r||a.includes(s),f=!r||r===2&&c||a.includes(n);return u._open=!!(o===42?d:d&&(r||!f)),u._close=!!(o===42?f:f&&(c||!d)),t(s)}}function lL(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ks,iL=I(()=>{"use strict";Nn();nd();Ls();ks={name:"attention",resolveAll:jP,tokenize:VP}});function GP(e,t,a){let n=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return xt(p)?(e.consume(p),l):p===64?a(p):u(p)}function l(p){return p===43||p===45||p===46||tt(p)?(n=1,i(p)):u(p)}function i(p){return p===58?(e.consume(p),n=0,s):(p===43||p===45||p===46||tt(p))&&n++<32?(e.consume(p),i):(n=0,u(p))}function s(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||uo(p)?a(p):(e.consume(p),s)}function u(p){return p===64?(e.consume(p),c):m0(p)?(e.consume(p),u):a(p)}function c(p){return tt(p)?d(p):a(p)}function d(p){return p===46?(e.consume(p),n=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||tt(p))&&n++<63){let y=p===45?f:d;return e.consume(p),y}return a(p)}}var pg,sL=I(()=>{"use strict";ye();pg={name:"autolink",tokenize:GP}});function X(e,t,a,n){let r=n?n-1:Number.POSITIVE_INFINITY,o=0;return l;function l(s){return K(s)?(e.enter(a),i(s)):t(s)}function i(s){return K(s)&&o++<r?(e.consume(s),i):(e.exit(a),t(s))}}var st=I(()=>{"use strict";ye()});function WP(e,t,a){return n;function n(o){return K(o)?X(e,r,"linePrefix")(o):r(o)}function r(o){return o===null||H(o)?t(o):a(o)}}var nn,cd=I(()=>{"use strict";st();ye();nn={partial:!0,tokenize:WP}});function $P(e,t,a){let n=this;return r;function r(l){if(l===62){let i=n.containerState;return i.open||(e.enter("blockQuote",{_container:!0}),i.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return a(l)}function o(l){return K(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function XP(e,t,a){let n=this;return r;function r(l){return K(l)?X(e,o,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(dd,t,a)(l)}}function ZP(e){e.exit("blockQuote")}var dd,uL=I(()=>{"use strict";st();ye();dd={continuation:{tokenize:XP},exit:ZP,name:"blockQuote",tokenize:$P}});function QP(e,t,a){return n;function n(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),r}function r(o){return g0(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(o)}}var fd,cL=I(()=>{"use strict";ye();fd={name:"characterEscape",tokenize:QP}});function KP(e,t,a){let n=this,r=0,o,l;return i;function i(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),s}function s(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,l=tt,c(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=h0,c):(e.enter("characterReferenceValue"),o=7,l=Cs,c(d))}function c(d){if(d===59&&r){let f=e.exit("characterReferenceValue");return l===tt&&!Nl(n.sliceSerialize(f))?a(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(d)&&r++<o?(e.consume(d),c):a(d)}}var pd,dL=I(()=>{"use strict";id();ye();pd={name:"characterReference",tokenize:KP}});function YP(e,t,a){let n=this,r={partial:!0,tokenize:L},o=0,l=0,i;return s;function s(b){return u(b)}function u(b){let A=n.events[n.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,i=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(b)}function c(b){return b===i?(l++,e.consume(b),c):l<3?a(b):(e.exit("codeFencedFenceSequence"),K(b)?X(e,d,"whitespace")(b):d(b))}function d(b){return b===null||H(b)?(e.exit("codeFencedFence"),n.interrupt?t(b):e.check(fL,v,w)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||H(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(b)):K(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),X(e,p,"whitespace")(b)):b===96&&b===i?a(b):(e.consume(b),f)}function p(b){return b===null||H(b)?d(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||H(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(b)):b===96&&b===i?a(b):(e.consume(b),y)}function v(b){return e.attempt(r,w,S)(b)}function S(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g}function g(b){return o>0&&K(b)?X(e,x,"linePrefix",o+1)(b):x(b)}function x(b){return b===null||H(b)?e.check(fL,v,w)(b):(e.enter("codeFlowValue"),m(b))}function m(b){return b===null||H(b)?(e.exit("codeFlowValue"),x(b)):(e.consume(b),m)}function w(b){return e.exit("codeFenced"),t(b)}function L(b,A,R){let _=0;return T;function T(V){return b.enter("lineEnding"),b.consume(V),b.exit("lineEnding"),D}function D(V){return b.enter("codeFencedFence"),K(V)?X(b,N,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):N(V)}function N(V){return V===i?(b.enter("codeFencedFenceSequence"),B(V)):R(V)}function B(V){return V===i?(_++,b.consume(V),B):_>=l?(b.exit("codeFencedFenceSequence"),K(V)?X(b,j,"whitespace")(V):j(V)):R(V)}function j(V){return V===null||H(V)?(b.exit("codeFencedFence"),A(V)):R(V)}}}function JP(e,t,a){let n=this;return r;function r(l){return l===null?a(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return n.parser.lazy[n.now().line]?a(l):t(l)}}var fL,md,pL=I(()=>{"use strict";st();ye();fL={partial:!0,tokenize:JP},md={concrete:!0,name:"codeFenced",tokenize:YP}});function tN(e,t,a){let n=this;return r;function r(u){return e.enter("codeIndented"),X(e,o,"linePrefix",5)(u)}function o(u){let c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?l(u):a(u)}function l(u){return u===null?s(u):H(u)?e.attempt(eN,l,s)(u):(e.enter("codeFlowValue"),i(u))}function i(u){return u===null||H(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),i)}function s(u){return e.exit("codeIndented"),t(u)}}function aN(e,t,a){let n=this;return r;function r(l){return n.parser.lazy[n.now().line]?a(l):H(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r):X(e,o,"linePrefix",5)(l)}function o(l){let i=n.events[n.events.length-1];return i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?t(l):H(l)?r(l):a(l)}}var Ts,eN,mL=I(()=>{"use strict";st();ye();Ts={name:"codeIndented",tokenize:tN},eN={partial:!0,tokenize:aN}});function nN(e){let t=e.length-4,a=3,n,r;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=a;++n<t;)if(e[n][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(n=a-1,t++;++n<=t;)r===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(r=n):(n===t||e[n][1].type==="lineEnding")&&(e[r][1].type="codeTextData",n!==r+2&&(e[r][1].end=e[n-1][1].end,e.splice(r+2,n-r-2),t-=n-r-2,n=r+2),r=void 0);return e}function rN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function oN(e,t,a){let n=this,r=0,o,l;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),r++,s):(e.exit("codeTextSequence"),u(f))}function u(f){return f===null?a(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),u):f===96?(l=e.enter("codeTextSequence"),o=0,d(f)):H(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||H(f)?(e.exit("codeTextData"),u(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(l.type="codeTextData",c(f))}}var mg,hL=I(()=>{"use strict";ye();mg={name:"codeText",previous:rN,resolve:nN,tokenize:oN}});function Ms(e,t){let a=0;if(t.length<1e4)e.push(...t);else for(;a<t.length;)e.push(...t.slice(a,a+1e4)),a+=1e4}var hd,gL=I(()=>{"use strict";hd=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,a){let n=a??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,a,n){let r=a||0;this.setCursor(Math.trunc(t));let o=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&Ms(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ms(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ms(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let a=this.left.splice(t,Number.POSITIVE_INFINITY);Ms(this.right,a.reverse())}else{let a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ms(this.left,a.reverse())}}}});function gd(e){let t={},a=-1,n,r,o,l,i,s,u,c=new hd(e);for(;++a<c.length;){for(;a in t;)a=t[a];if(n=c.get(a),a&&n[1].type==="chunkFlow"&&c.get(a-1)[1].type==="listItemPrefix"&&(s=n[1]._tokenizer.events,o=0,o<s.length&&s[o][1].type==="lineEndingBlank"&&(o+=2),o<s.length&&s[o][1].type==="content"))for(;++o<s.length&&s[o][1].type!=="content";)s[o][1].type==="chunkText"&&(s[o][1]._isInFirstContentOfListItem=!0,o++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,lN(c,a)),a=t[a],u=!0);else if(n[1]._container){for(o=a,r=void 0;o--;)if(l=c.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(r&&(c.get(r)[1].type="lineEndingBlank"),l[1].type="lineEnding",r=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;r&&(n[1].end={...c.get(r)[1].start},i=c.slice(r,a),i.unshift(n),c.splice(r,a-r+1,i))}}return it(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function lN(e,t){let a=e.get(t)[1],n=e.get(t)[2],r=t-1,o=[],l=a._tokenizer;l||(l=n.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let i=l.events,s=[],u={},c,d,f=-1,p=a,y=0,v=0,S=[v];for(;p;){for(;e.get(++r)[1]!==p;);o.push(r),p._tokenizer||(c=n.sliceStream(p),p.next||c.push(null),d&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(c),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=a;++f<i.length;)i[f][0]==="exit"&&i[f-1][0]==="enter"&&i[f][1].type===i[f-1][1].type&&i[f][1].start.line!==i[f][1].end.line&&(v=f+1,S.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),f=S.length;f--;){let g=i.slice(S[f],S[f+1]),x=o.pop();s.push([x,x+g.length-1]),e.splice(x,2,g)}for(s.reverse(),f=-1;++f<s.length;)u[y+s[f][0]]=y+s[f][1],y+=s[f][1]-s[f][0]-1;return u}var hg=I(()=>{"use strict";Nn();gL()});function sN(e){return gd(e),e}function uN(e,t){let a;return n;function n(i){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),r(i)}function r(i){return i===null?o(i):H(i)?e.check(iN,l,o)(i):(e.consume(i),r)}function o(i){return e.exit("chunkContent"),e.exit("content"),t(i)}function l(i){return e.consume(i),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,r}}function cN(e,t,a){let n=this;return r;function r(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),X(e,o,"linePrefix")}function o(l){if(l===null||H(l))return a(l);let i=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&i&&i[1].type==="linePrefix"&&i[2].sliceSerialize(i[1],!0).length>=4?t(l):e.interrupt(n.parser.constructs.flow,a,t)(l)}}var gg,iN,yL=I(()=>{"use strict";st();ye();hg();gg={resolve:sN,tokenize:uN},iN={partial:!0,tokenize:cN}});function yd(e,t,a,n,r,o,l,i,s){let u=s||Number.POSITIVE_INFINITY,c=0;return d;function d(g){return g===60?(e.enter(n),e.enter(r),e.enter(o),e.consume(g),e.exit(o),f):g===null||g===32||g===41||uo(g)?a(g):(e.enter(n),e.enter(l),e.enter(i),e.enter("chunkString",{contentType:"string"}),v(g))}function f(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),e.exit(n),t):(e.enter(i),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(i),f(g)):g===null||g===60||H(g)?a(g):(e.consume(g),g===92?y:p)}function y(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function v(g){return!c&&(g===null||g===41||ue(g))?(e.exit("chunkString"),e.exit(i),e.exit(l),e.exit(n),t(g)):c<u&&g===40?(e.consume(g),c++,v):g===41?(e.consume(g),c--,v):g===null||g===32||g===40||uo(g)?a(g):(e.consume(g),g===92?S:v)}function S(g){return g===40||g===41||g===92?(e.consume(g),v):v(g)}}var yg=I(()=>{"use strict";ye()});function xd(e,t,a,n,r,o){let l=this,i=0,s;return u;function u(p){return e.enter(n),e.enter(r),e.consume(p),e.exit(r),e.enter(o),c}function c(p){return i>999||p===null||p===91||p===93&&!s||p===94&&!i&&"_hiddenFootnoteSupport"in l.parser.constructs?a(p):p===93?(e.exit(o),e.enter(r),e.consume(p),e.exit(r),e.exit(n),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||H(p)||i++>999?(e.exit("chunkString"),c(p)):(e.consume(p),s||(s=!K(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),i++,d):d(p)}}var xg=I(()=>{"use strict";ye()});function vd(e,t,a,n,r,o){let l;return i;function i(f){return f===34||f===39||f===40?(e.enter(n),e.enter(r),e.consume(f),e.exit(r),l=f===40?41:f,s):a(f)}function s(f){return f===l?(e.enter(r),e.consume(f),e.exit(r),e.exit(n),t):(e.enter(o),u(f))}function u(f){return f===l?(e.exit(o),s(l)):f===null?a(f):H(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),X(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===l||f===null||H(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?d:c)}function d(f){return f===l||f===92?(e.consume(f),c):c(f)}}var vg=I(()=>{"use strict";st();ye()});function ho(e,t){let a;return n;function n(r){return H(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),a=!0,n):K(r)?X(e,n,a?"linePrefix":"lineSuffix")(r):t(r)}}var wg=I(()=>{"use strict";st();ye()});function fN(e,t,a){let n=this,r;return o;function o(p){return e.enter("definition"),l(p)}function l(p){return xd.call(n,e,i,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function i(p){return r=Nt(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s):a(p)}function s(p){return ue(p)?ho(e,u)(p):u(p)}function u(p){return yd(e,c,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(dN,d,d)(p)}function d(p){return K(p)?X(e,f,"whitespace")(p):f(p)}function f(p){return p===null||H(p)?(e.exit("definition"),n.parser.defined.push(r),t(p)):a(p)}}function pN(e,t,a){return n;function n(i){return ue(i)?ho(e,r)(i):a(i)}function r(i){return vd(e,o,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function o(i){return K(i)?X(e,l,"whitespace")(i):l(i)}function l(i){return i===null||H(i)?t(i):a(i)}}var bg,dN,xL=I(()=>{"use strict";yg();xg();st();vg();wg();ye();Dl();bg={name:"definition",tokenize:fN},dN={partial:!0,tokenize:pN}});function mN(e,t,a){return n;function n(o){return e.enter("hardBreakEscape"),e.consume(o),r}function r(o){return H(o)?(e.exit("hardBreakEscape"),t(o)):a(o)}}var Sg,vL=I(()=>{"use strict";ye();Sg={name:"hardBreakEscape",tokenize:mN}});function hN(e,t){let a=e.length-2,n=3,r,o;return e[n][1].type==="whitespace"&&(n+=2),a-2>n&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(n===a-1||a-4>n&&e[a-2][1].type==="whitespace")&&(a-=n+1===a?2:4),a>n&&(r={type:"atxHeadingText",start:e[n][1].start,end:e[a][1].end},o={type:"chunkText",start:e[n][1].start,end:e[a][1].end,contentType:"text"},it(e,n,a-n+1,[["enter",r,t],["enter",o,t],["exit",o,t],["exit",r,t]])),e}function gN(e,t,a){let n=0;return r;function r(c){return e.enter("atxHeading"),o(c)}function o(c){return e.enter("atxHeadingSequence"),l(c)}function l(c){return c===35&&n++<6?(e.consume(c),l):c===null||ue(c)?(e.exit("atxHeadingSequence"),i(c)):a(c)}function i(c){return c===35?(e.enter("atxHeadingSequence"),s(c)):c===null||H(c)?(e.exit("atxHeading"),t(c)):K(c)?X(e,i,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function s(c){return c===35?(e.consume(c),s):(e.exit("atxHeadingSequence"),i(c))}function u(c){return c===null||c===35||ue(c)?(e.exit("atxHeadingText"),i(c)):(e.consume(c),u)}}var Cg,wL=I(()=>{"use strict";st();ye();Nn();Cg={name:"headingAtx",resolve:hN,tokenize:gN}});var bL,Ig,SL=I(()=>{"use strict";bL=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ig=["pre","script","style","textarea"]});function vN(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function wN(e,t,a){let n=this,r,o,l,i,s;return u;function u(k){return c(k)}function c(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),d}function d(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),o=!0,v):k===63?(e.consume(k),r=3,n.interrupt?t:C):xt(k)?(e.consume(k),l=String.fromCharCode(k),S):a(k)}function f(k){return k===45?(e.consume(k),r=2,p):k===91?(e.consume(k),r=5,i=0,y):xt(k)?(e.consume(k),r=4,n.interrupt?t:C):a(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:C):a(k)}function y(k){let Ze="CDATA[";return k===Ze.charCodeAt(i++)?(e.consume(k),i===Ze.length?n.interrupt?t:N:y):a(k)}function v(k){return xt(k)?(e.consume(k),l=String.fromCharCode(k),S):a(k)}function S(k){if(k===null||k===47||k===62||ue(k)){let Ze=k===47,Ue=l.toLowerCase();return!Ze&&!o&&Ig.includes(Ue)?(r=1,n.interrupt?t(k):N(k)):bL.includes(l.toLowerCase())?(r=6,Ze?(e.consume(k),g):n.interrupt?t(k):N(k)):(r=7,n.interrupt&&!n.parser.lazy[n.now().line]?a(k):o?x(k):m(k))}return k===45||tt(k)?(e.consume(k),l+=String.fromCharCode(k),S):a(k)}function g(k){return k===62?(e.consume(k),n.interrupt?t:N):a(k)}function x(k){return K(k)?(e.consume(k),x):T(k)}function m(k){return k===47?(e.consume(k),T):k===58||k===95||xt(k)?(e.consume(k),w):K(k)?(e.consume(k),m):T(k)}function w(k){return k===45||k===46||k===58||k===95||tt(k)?(e.consume(k),w):L(k)}function L(k){return k===61?(e.consume(k),b):K(k)?(e.consume(k),L):m(k)}function b(k){return k===null||k===60||k===61||k===62||k===96?a(k):k===34||k===39?(e.consume(k),s=k,A):K(k)?(e.consume(k),b):R(k)}function A(k){return k===s?(e.consume(k),s=null,_):k===null||H(k)?a(k):(e.consume(k),A)}function R(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||ue(k)?L(k):(e.consume(k),R)}function _(k){return k===47||k===62||K(k)?m(k):a(k)}function T(k){return k===62?(e.consume(k),D):a(k)}function D(k){return k===null||H(k)?N(k):K(k)?(e.consume(k),D):a(k)}function N(k){return k===45&&r===2?(e.consume(k),F):k===60&&r===1?(e.consume(k),te):k===62&&r===4?(e.consume(k),Xe):k===63&&r===3?(e.consume(k),C):k===93&&r===5?(e.consume(k),Z):H(k)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(yN,le,B)(k)):k===null||H(k)?(e.exit("htmlFlowData"),B(k)):(e.consume(k),N)}function B(k){return e.check(xN,j,le)(k)}function j(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),V}function V(k){return k===null||H(k)?B(k):(e.enter("htmlFlowData"),N(k))}function F(k){return k===45?(e.consume(k),C):N(k)}function te(k){return k===47?(e.consume(k),l="",$e):N(k)}function $e(k){if(k===62){let Ze=l.toLowerCase();return Ig.includes(Ze)?(e.consume(k),Xe):N(k)}return xt(k)&&l.length<8?(e.consume(k),l+=String.fromCharCode(k),$e):N(k)}function Z(k){return k===93?(e.consume(k),C):N(k)}function C(k){return k===62?(e.consume(k),Xe):k===45&&r===2?(e.consume(k),C):N(k)}function Xe(k){return k===null||H(k)?(e.exit("htmlFlowData"),le(k)):(e.consume(k),Xe)}function le(k){return e.exit("htmlFlow"),t(k)}}function bN(e,t,a){let n=this;return r;function r(l){return H(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):a(l)}function o(l){return n.parser.lazy[n.now().line]?a(l):t(l)}}function SN(e,t,a){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(nn,t,a)}}var Lg,yN,xN,CL=I(()=>{"use strict";ye();SL();cd();Lg={concrete:!0,name:"htmlFlow",resolveTo:vN,tokenize:wN},yN={partial:!0,tokenize:SN},xN={partial:!0,tokenize:bN}});function CN(e,t,a){let n=this,r,o,l;return i;function i(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),s}function s(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),L):C===63?(e.consume(C),m):xt(C)?(e.consume(C),R):a(C)}function u(C){return C===45?(e.consume(C),c):C===91?(e.consume(C),o=0,y):xt(C)?(e.consume(C),x):a(C)}function c(C){return C===45?(e.consume(C),p):a(C)}function d(C){return C===null?a(C):C===45?(e.consume(C),f):H(C)?(l=d,te(C)):(e.consume(C),d)}function f(C){return C===45?(e.consume(C),p):d(C)}function p(C){return C===62?F(C):C===45?f(C):d(C)}function y(C){let Xe="CDATA[";return C===Xe.charCodeAt(o++)?(e.consume(C),o===Xe.length?v:y):a(C)}function v(C){return C===null?a(C):C===93?(e.consume(C),S):H(C)?(l=v,te(C)):(e.consume(C),v)}function S(C){return C===93?(e.consume(C),g):v(C)}function g(C){return C===62?F(C):C===93?(e.consume(C),g):v(C)}function x(C){return C===null||C===62?F(C):H(C)?(l=x,te(C)):(e.consume(C),x)}function m(C){return C===null?a(C):C===63?(e.consume(C),w):H(C)?(l=m,te(C)):(e.consume(C),m)}function w(C){return C===62?F(C):m(C)}function L(C){return xt(C)?(e.consume(C),b):a(C)}function b(C){return C===45||tt(C)?(e.consume(C),b):A(C)}function A(C){return H(C)?(l=A,te(C)):K(C)?(e.consume(C),A):F(C)}function R(C){return C===45||tt(C)?(e.consume(C),R):C===47||C===62||ue(C)?_(C):a(C)}function _(C){return C===47?(e.consume(C),F):C===58||C===95||xt(C)?(e.consume(C),T):H(C)?(l=_,te(C)):K(C)?(e.consume(C),_):F(C)}function T(C){return C===45||C===46||C===58||C===95||tt(C)?(e.consume(C),T):D(C)}function D(C){return C===61?(e.consume(C),N):H(C)?(l=D,te(C)):K(C)?(e.consume(C),D):_(C)}function N(C){return C===null||C===60||C===61||C===62||C===96?a(C):C===34||C===39?(e.consume(C),r=C,B):H(C)?(l=N,te(C)):K(C)?(e.consume(C),N):(e.consume(C),j)}function B(C){return C===r?(e.consume(C),r=void 0,V):C===null?a(C):H(C)?(l=B,te(C)):(e.consume(C),B)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?a(C):C===47||C===62||ue(C)?_(C):(e.consume(C),j)}function V(C){return C===47||C===62||ue(C)?_(C):a(C)}function F(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):a(C)}function te(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),$e}function $e(C){return K(C)?X(e,Z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):Z(C)}function Z(C){return e.enter("htmlTextData"),l(C)}}var kg,IL=I(()=>{"use strict";st();ye();kg={name:"htmlText",tokenize:CN}});function TN(e){let t=-1,a=[];for(;++t<e.length;){let n=e[t][1];if(a.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){let r=n.type==="labelImage"?4:2;n.type="data",t+=r}}return e.length!==a.length&&it(e,0,e.length,a),e}function MN(e,t){let a=e.length,n=0,r,o,l,i;for(;a--;)if(r=e[a][1],o){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[a][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(l){if(e[a][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(o=a,r.type!=="labelLink")){n=2;break}}else r.type==="labelEnd"&&(l=a);let s={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},c={type:"labelText",start:{...e[o+n+2][1].end},end:{...e[l-2][1].start}};return i=[["enter",s,t],["enter",u,t]],i=Vt(i,e.slice(o+1,o+n+3)),i=Vt(i,[["enter",c,t]]),i=Vt(i,Ir(t.parser.constructs.insideSpan.null,e.slice(o+n+4,l-3),t)),i=Vt(i,[["exit",c,t],e[l-2],e[l-1],["exit",u,t]]),i=Vt(i,e.slice(l+1)),i=Vt(i,[["exit",s,t]]),it(e,o,e.length,i),e}function AN(e,t,a){let n=this,r=n.events.length,o,l;for(;r--;)if((n.events[r][1].type==="labelImage"||n.events[r][1].type==="labelLink")&&!n.events[r][1]._balanced){o=n.events[r][1];break}return i;function i(f){return o?o._inactive?d(f):(l=n.parser.defined.includes(Nt(n.sliceSerialize({start:o.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),s):a(f)}function s(f){return f===40?e.attempt(IN,c,l?c:d)(f):f===91?e.attempt(LN,c,l?u:d)(f):l?c(f):d(f)}function u(f){return e.attempt(kN,c,d)(f)}function c(f){return t(f)}function d(f){return o._balanced=!0,a(f)}}function EN(e,t,a){return n;function n(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return ue(d)?ho(e,o)(d):o(d)}function o(d){return d===41?c(d):yd(e,l,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function l(d){return ue(d)?ho(e,s)(d):c(d)}function i(d){return a(d)}function s(d){return d===34||d===39||d===40?vd(e,u,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return ue(d)?ho(e,c)(d):c(d)}function c(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):a(d)}}function RN(e,t,a){let n=this;return r;function r(i){return xd.call(n,e,o,l,"reference","referenceMarker","referenceString")(i)}function o(i){return n.parser.defined.includes(Nt(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(i):a(i)}function l(i){return a(i)}}function DN(e,t,a){return n;function n(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),r}function r(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):a(o)}}var go,IN,LN,kN,wd=I(()=>{"use strict";yg();xg();vg();wg();ye();Nn();Dl();Ls();go={name:"labelEnd",resolveAll:TN,resolveTo:MN,tokenize:AN},IN={tokenize:EN},LN={tokenize:RN},kN={tokenize:DN}});function _N(e,t,a){let n=this;return r;function r(i){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(i),e.exit("labelImageMarker"),o}function o(i){return i===91?(e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelImage"),l):a(i)}function l(i){return i===94&&"_hiddenFootnoteSupport"in n.parser.constructs?a(i):t(i)}}var Tg,LL=I(()=>{"use strict";wd();Tg={name:"labelStartImage",resolveAll:go.resolveAll,tokenize:_N}});function ON(e,t,a){let n=this;return r;function r(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?a(l):t(l)}}var Mg,kL=I(()=>{"use strict";wd();Mg={name:"labelStartLink",resolveAll:go.resolveAll,tokenize:ON}});function PN(e,t){return a;function a(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),X(e,t,"linePrefix")}}var As,TL=I(()=>{"use strict";st();As={name:"lineEnding",tokenize:PN}});function NN(e,t,a){let n=0,r;return o;function o(u){return e.enter("thematicBreak"),l(u)}function l(u){return r=u,i(u)}function i(u){return u===r?(e.enter("thematicBreakSequence"),s(u)):n>=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):a(u)}function s(u){return u===r?(e.consume(u),n++,s):(e.exit("thematicBreakSequence"),K(u)?X(e,i,"whitespace")(u):i(u))}}var yo,Ag=I(()=>{"use strict";st();ye();yo={name:"thematicBreak",tokenize:NN}});function zN(e,t,a){let n=this,r=n.events[n.events.length-1],o=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,l=0;return i;function i(p){let y=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Cs(p)){if(n.containerState.type||(n.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(yo,a,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(p)}return a(p)}function s(p){return Cs(p)&&++l<10?(e.consume(p),s):(!n.interrupt||l<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):a(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(nn,n.interrupt?a:c,e.attempt(BN,f,d))}function c(p){return n.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return K(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):a(p)}function f(p){return n.containerState.size=o+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function qN(e,t,a){let n=this;return n.containerState._closeFlow=void 0,e.check(nn,r,o);function r(i){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,X(e,t,"listItemIndent",n.containerState.size+1)(i)}function o(i){return n.containerState.furtherBlankLines||!K(i)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,l(i)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(UN,t,l)(i))}function l(i){return n.containerState._closeFlow=!0,n.interrupt=void 0,X(e,e.attempt(Bt,t,a),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}function FN(e,t,a){let n=this;return X(e,r,"listItemIndent",n.containerState.size+1);function r(o){let l=n.events[n.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===n.containerState.size?t(o):a(o)}}function HN(e){e.exit(this.containerState.type)}function jN(e,t,a){let n=this;return X(e,r,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(o){let l=n.events[n.events.length-1];return!K(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):a(o)}}var Bt,BN,UN,ML=I(()=>{"use strict";st();ye();cd();Ag();Bt={continuation:{tokenize:qN},exit:HN,name:"list",tokenize:zN},BN={partial:!0,tokenize:jN},UN={partial:!0,tokenize:FN}});function VN(e,t){let a=e.length,n,r,o;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){n=a;break}e[a][1].type==="paragraph"&&(r=a)}else e[a][1].type==="content"&&e.splice(a,1),!o&&e[a][1].type==="definition"&&(o=a);let l={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",l,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end={...e[o][1].end}):e[n][1]=l,e.push(["exit",l,t]),e}function GN(e,t,a){let n=this,r;return o;function o(u){let c=n.events.length,d;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){d=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(e.enter("setextHeadingLine"),r=u,l(u)):a(u)}function l(u){return e.enter("setextHeadingLineSequence"),i(u)}function i(u){return u===r?(e.consume(u),i):(e.exit("setextHeadingLineSequence"),K(u)?X(e,s,"lineSuffix")(u):s(u))}function s(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):a(u)}}var bd,AL=I(()=>{"use strict";st();ye();bd={name:"setextUnderline",resolveTo:VN,tokenize:GN}});var Sd=I(()=>{"use strict";iL();sL();cd();uL();cL();dL();pL();mL();hL();yL();xL();vL();wL();CL();IL();wd();LL();kL();TL();ML();AL();Ag()});function Eg(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:QN,continuation:{tokenize:KN},exit:YN}},text:{91:{name:"gfmFootnoteCall",tokenize:ZN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$N,resolveTo:XN}}}}function $N(e,t,a){let n=this,r=n.events.length,o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),l;for(;r--;){let s=n.events[r][1];if(s.type==="labelImage"){l=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return i;function i(s){if(!l||!l._balanced)return a(s);let u=Nt(n.sliceSerialize({start:l.end,end:n.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?a(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s))}}function XN(e,t){let a=e.length,n;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){n=e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let l={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},s=[e[a+1],e[a+2],["enter",r,t],e[a+3],e[a+4],["enter",o,t],["exit",o,t],["enter",l,t],["enter",i,t],["exit",i,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(a,e.length-a+1,...s),e}function ZN(e,t,a){let n=this,r=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),o=0,l;return i;function i(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),s}function s(d){return d!==94?a(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(o>999||d===93&&!l||d===null||d===91||ue(d))return a(d);if(d===93){e.exit("chunkString");let f=e.exit("gfmFootnoteCallString");return r.includes(Nt(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):a(d)}return ue(d)||(l=!0),o++,e.consume(d),d===92?c:u}function c(d){return d===91||d===92||d===93?(e.consume(d),o++,u):u(d)}}function QN(e,t,a){let n=this,r=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),o,l=0,i;return s;function s(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):a(y)}function c(y){if(l>999||y===93&&!i||y===null||y===91||ue(y))return a(y);if(y===93){e.exit("chunkString");let v=e.exit("gfmFootnoteDefinitionLabelString");return o=Nt(n.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ue(y)||(i=!0),l++,e.consume(y),y===92?d:c}function d(y){return y===91||y===92||y===93?(e.consume(y),l++,c):c(y)}function f(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),r.includes(o)||r.push(o),X(e,p,"gfmFootnoteDefinitionWhitespace")):a(y)}function p(y){return t(y)}}function KN(e,t,a){return e.check(nn,t,e.attempt(WN,t,a))}function YN(e){e.exit("gfmFootnoteDefinition")}function JN(e,t,a){let n=this;return X(e,r,"gfmFootnoteDefinitionIndent",5);function r(o){let l=n.events[n.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):a(o)}}var WN,EL=I(()=>{"use strict";Sd();st();ye();Dl();WN={tokenize:JN,partial:!0}});var RL=I(()=>{"use strict";EL()});function Rg(e){let a=(e||{}).singleTilde,n={name:"strikethrough",tokenize:o,resolveAll:r};return a==null&&(a=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(l,i){let s=-1;for(;++s<l.length;)if(l[s][0]==="enter"&&l[s][1].type==="strikethroughSequenceTemporary"&&l[s][1]._close){let u=s;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[s][1].end.offset-l[s][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[s][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";let c={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[s][1].end)},d={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[s][1].start)},f=[["enter",c,i],["enter",l[u][1],i],["exit",l[u][1],i],["enter",d,i]],p=i.parser.constructs.insideSpan.null;p&&it(f,f.length,0,Ir(p,l.slice(u+1,s),i)),it(f,f.length,0,[["exit",d,i],["enter",l[s][1],i],["exit",l[s][1],i],["exit",c,i]]),it(l,u-1,s-u+3,f),s=u+f.length-2;break}}for(s=-1;++s<l.length;)l[s][1].type==="strikethroughSequenceTemporary"&&(l[s][1].type="data");return l}function o(l,i,s){let u=this.previous,c=this.events,d=0;return f;function f(y){return u===126&&c[c.length-1][1].type!=="characterEscape"?s(y):(l.enter("strikethroughSequenceTemporary"),p(y))}function p(y){let v=Pn(u);if(y===126)return d>1?s(y):(l.consume(y),d++,p);if(d<2&&!a)return s(y);let S=l.exit("strikethroughSequenceTemporary"),g=Pn(y);return S._open=!g||g===2&&!!v,S._close=!v||v===2&&!!g,i(y)}}}var DL=I(()=>{"use strict";Nn();nd();Ls()});var _L=I(()=>{"use strict";DL()});function e3(e,t,a,n){let r=0;if(!(a===0&&n.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=a,e.map[r][2].push(...n);return}r+=1}e.map.push([t,a,n])}}var Cd,OL=I(()=>{"use strict";Cd=class{constructor(){this.map=[]}add(t,a,n){e3(this,t,a,n)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let a=this.map.length,n=[];for(;a>0;)a-=1,n.push(t.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),t.length=this.map[a][0];n.push(t.slice()),t.length=0;let r=n.pop();for(;r;){for(let o of r)t.push(o);r=n.pop()}this.map.length=0}}});function PL(e,t){let a=!1,n=[];for(;t<e.length;){let r=e[t];if(a){if(r[0]==="enter")r[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){let o=n.length-1;n[o]=n[o]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(a=!0);t+=1}return n}var NL=I(()=>{"use strict"});function Dg(){return{flow:{null:{name:"table",tokenize:t3,resolveAll:a3}}}}function t3(e,t,a){let n=this,r=0,o=0,l;return i;function i(T){let D=n.events.length-1;for(;D>-1;){let j=n.events[D][1].type;if(j==="lineEnding"||j==="linePrefix")D--;else break}let N=D>-1?n.events[D][1].type:null,B=N==="tableHead"||N==="tableRow"?b:s;return B===b&&n.parser.lazy[n.now().line]?a(T):B(T)}function s(T){return e.enter("tableHead"),e.enter("tableRow"),u(T)}function u(T){return T===124||(l=!0,o+=1),c(T)}function c(T){return T===null?a(T):H(T)?o>1?(o=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),p):a(T):K(T)?X(e,c,"whitespace")(T):(o+=1,l&&(l=!1,r+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),l=!0,c):(e.enter("data"),d(T)))}function d(T){return T===null||T===124||ue(T)?(e.exit("data"),c(T)):(e.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(e.consume(T),d):d(T)}function p(T){return n.interrupt=!1,n.parser.lazy[n.now().line]?a(T):(e.enter("tableDelimiterRow"),l=!1,K(T)?X(e,y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):y(T))}function y(T){return T===45||T===58?S(T):T===124?(l=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),v):L(T)}function v(T){return K(T)?X(e,S,"whitespace")(T):S(T)}function S(T){return T===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),g):T===45?(o+=1,g(T)):T===null||H(T)?w(T):L(T)}function g(T){return T===45?(e.enter("tableDelimiterFiller"),x(T)):L(T)}function x(T){return T===45?(e.consume(T),x):T===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),m):(e.exit("tableDelimiterFiller"),m(T))}function m(T){return K(T)?X(e,w,"whitespace")(T):w(T)}function w(T){return T===124?y(T):T===null||H(T)?!l||r!==o?L(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):L(T)}function L(T){return a(T)}function b(T){return e.enter("tableRow"),A(T)}function A(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),A):T===null||H(T)?(e.exit("tableRow"),t(T)):K(T)?X(e,A,"whitespace")(T):(e.enter("data"),R(T))}function R(T){return T===null||T===124||ue(T)?(e.exit("data"),A(T)):(e.consume(T),T===92?_:R)}function _(T){return T===92||T===124?(e.consume(T),R):R(T)}}function a3(e,t){let a=-1,n=!0,r=0,o=[0,0,0,0],l=[0,0,0,0],i=!1,s=0,u,c,d,f=new Cd;for(;++a<e.length;){let p=e[a],y=p[1];p[0]==="enter"?y.type==="tableHead"?(i=!1,s!==0&&(BL(f,t,s,u,c),c=void 0,s=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},f.add(a,0,[["enter",u,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(n=!0,d=void 0,o=[0,0,0,0],l=[0,a+1,0,0],i&&(i=!1,c={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},f.add(a,0,[["enter",c,t]])),r=y.type==="tableDelimiterRow"?2:c?3:1):r&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(n=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],d=Id(f,t,o,r,void 0,d),o=[0,0,0,0]),l[2]=a)):y.type==="tableCellDivider"&&(n?n=!1:(o[1]!==0&&(l[0]=l[1],d=Id(f,t,o,r,void 0,d)),o=l,l=[o[1],a,0,0])):y.type==="tableHead"?(i=!0,s=a):y.type==="tableRow"||y.type==="tableDelimiterRow"?(s=a,o[1]!==0?(l[0]=l[1],d=Id(f,t,o,r,a,d)):l[1]!==0&&(d=Id(f,t,l,r,a,d)),r=0):r&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(l[3]=a)}for(s!==0&&BL(f,t,s,u,c),f.consume(t.events),a=-1;++a<t.events.length;){let p=t.events[a];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=PL(t.events,a))}return e}function Id(e,t,a,n,r,o){let l=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",i="tableContent";a[0]!==0&&(o.end=Object.assign({},Bl(t.events,a[0])),e.add(a[0],0,[["exit",o,t]]));let s=Bl(t.events,a[1]);if(o={type:l,start:Object.assign({},s),end:Object.assign({},s)},e.add(a[1],0,[["enter",o,t]]),a[2]!==0){let u=Bl(t.events,a[2]),c=Bl(t.events,a[3]),d={type:i,start:Object.assign({},u),end:Object.assign({},c)};if(e.add(a[2],0,[["enter",d,t]]),n!==2){let f=t.events[a[2]],p=t.events[a[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",a[3]>a[2]+1){let y=a[2]+1,v=a[3]-a[2]-1;e.add(y,v,[])}}e.add(a[3]+1,0,[["exit",d,t]])}return r!==void 0&&(o.end=Object.assign({},Bl(t.events,r)),e.add(r,0,[["exit",o,t]]),o=void 0),o}function BL(e,t,a,n,r){let o=[],l=Bl(t.events,a);r&&(r.end=Object.assign({},l),o.push(["exit",r,t])),n.end=Object.assign({},l),o.push(["exit",n,t]),e.add(a+1,0,o)}function Bl(e,t){let a=e[t],n=a[0]==="enter"?"start":"end";return a[1][n]}var UL=I(()=>{"use strict";st();ye();OL();NL()});var zL=I(()=>{"use strict";UL()});function _g(){return{text:{91:n3}}}function r3(e,t,a){let n=this;return r;function r(s){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?a(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return ue(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),l):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),l):a(s)}function l(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),i):a(s)}function i(s){return H(s)?t(s):K(s)?e.check({tokenize:o3},t,a)(s):a(s)}}function o3(e,t,a){return X(e,n,"whitespace");function n(r){return r===null?a(r):t(r)}}var n3,qL=I(()=>{"use strict";st();ye();n3={name:"tasklistCheck",tokenize:r3}});var FL=I(()=>{"use strict";qL()});function HL(e){return ud([dg(),Eg(),Rg(e),Dg(),_g()])}var jL=I(()=>{"use strict";ug();oL();RL();_L();zL();FL()});function Ld(e){let t=this,a=e||l3,n=t.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),l=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(HL(a)),o.push(ig()),l.push(sg(a))}var l3,VL=I(()=>{"use strict";XI();jL();l3={}});var GL=I(()=>{"use strict";VL()});var i3,s3,u3,WL,c3,d3,$L,QL,KL,f3,p3,m3,h3,g3,y3,x3,xo,YL,v3,w3,b3,S3,C3,I3,XL,Lr,Ul,L3,JL,Td,k3,e1,Pg,T3,M3,t1,A3,E3,R3,D3,_3,O3,P3,N3,B3,a1,U3,z3,q3,F3,H3,j3,kd,V3,G3,W3,$3,X3,Z3,Q3,K3,Y3,J3,ZL,eB,n1,tB,aB,nB,rB,oB,lB,Og,ya,iB,sB,uB,r1,o1=I(()=>{"use strict";i3=Object.defineProperty,s3=Object.defineProperties,u3=Object.getOwnPropertyDescriptors,WL=Object.getOwnPropertySymbols,c3=Object.prototype.hasOwnProperty,d3=Object.prototype.propertyIsEnumerable,$L=(e,t,a)=>t in e?i3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,QL=(e,t)=>{for(var a in t||(t={}))c3.call(t,a)&&$L(e,a,t[a]);if(WL)for(var a of WL(t))d3.call(t,a)&&$L(e,a,t[a]);return e},KL=(e,t)=>s3(e,u3(t)),f3=/(\*\*)([^*]*\*?)$/,p3=/(__)([^_]*?)$/,m3=/(\*\*\*)([^*]*?)$/,h3=/(\*)([^*]*?)$/,g3=/(_)([^_]*?)$/,y3=/(`)([^`]*?)$/,x3=/(~~)([^~]*?)$/,xo=/^[\s_~*`]*$/,YL=/^[\s]*[-*+][\s]+$/,v3=/[\p{L}\p{N}_]/u,w3=/^```[^`\n]*```?$/,b3=/^\*{4,}$/,S3=/(__)([^_]+)_$/,C3=/(~~)([^~]+)~$/,I3=/__/g,XL=/~~/g,Lr=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:v3.test(e)},Ul=(e,t)=>{let a=!1;for(let n=0;n<t;n+=1)e[n]==="`"&&e[n+1]==="`"&&e[n+2]==="`"&&(a=!a,n+=2);return a},L3=(e,t)=>{let a=1;for(let n=t-1;n>=0;n-=1)if(e[n]==="]")a+=1;else if(e[n]==="["&&(a-=1,a===0))return n;return-1},JL=(e,t)=>{let a=1;for(let n=t+1;n<e.length;n+=1)if(e[n]==="[")a+=1;else if(e[n]==="]"&&(a-=1,a===0))return n;return-1},Td=(e,t)=>{let a=!1,n=!1;for(let r=0;r<e.length&&r<t;r+=1){if(e[r]==="\\"&&e[r+1]==="$"){r+=1;continue}e[r]==="$"&&(e[r+1]==="$"?(n=!n,r+=1,a=!1):n||(a=!a))}return a||n},k3=(e,t)=>{for(let a=t;a<e.length;a+=1){if(e[a]===")")return!0;if(e[a]===`
25
+ `)return!1}return!1},e1=(e,t)=>{for(let a=t-1;a>=0;a-=1){if(e[a]===")")return!1;if(e[a]==="(")return a>0&&e[a-1]==="]"?k3(e,t):!1;if(e[a]===`
26
26
  `)return!1}return!1},Pg=(e,t,a)=>{let n=0;for(let s=t-1;s>=0;s-=1)if(e[s]===`
27
27
  `){n=s+1;break}let r=e.length;for(let s=t;s<e.length;s+=1)if(e[s]===`
28
28
  `){r=s;break}let o=e.substring(n,r),l=0,i=!1;for(let s of o)if(s===a)l+=1;else if(s!==" "&&s!==" "){i=!0;break}return l>=3&&!i},T3=(e,t,a)=>{if(a!==" "&&a!==" ")return!1;let n=0;for(let r=t-1;r>=0;r-=1)if(e[r]===`
29
- `){n=r+1;break}for(let r=n;r<t;r+=1)if(e[r]!==" "&&e[r]!==" ")return!1;return!0},M3=(e,t,a,n)=>a==="\\"||e.includes("$")&&Td(e,t)?!0:a!=="*"&&n==="*"?(t<e.length-2?e[t+2]:"")!=="*":!!(a==="*"||a&&n&&Lr(a)&&Lr(n)||T3(e,t,n)),tL=e=>{let t=0,a=e.length;for(let n=0;n<a;n+=1){if(e[n]!=="*")continue;let r=n>0?e[n-1]:"",o=n<a-1?e[n+1]:"";M3(e,n,r,o)||(t+=1)}return t},A3=(e,t,a,n)=>!!(a==="\\"||e.includes("$")&&Td(e,t)||eL(e,t)||a==="_"||n==="_"||a&&n&&Lr(a)&&Lr(n)),E3=e=>{let t=0,a=e.length;for(let n=0;n<a;n+=1){if(e[n]!=="_")continue;let r=n>0?e[n-1]:"",o=n<a-1?e[n+1]:"";A3(e,n,r,o)||(t+=1)}return t},R3=e=>{let t=0,a=0;for(let n=0;n<e.length;n+=1)e[n]==="*"?a+=1:(a>=3&&(t+=Math.floor(a/3)),a=0);return a>=3&&(t+=Math.floor(a/3)),t},D3=(e,t,a)=>{if(!t||xo.test(t))return!0;let n=e.substring(0,a).lastIndexOf(`
30
- `),r=n===-1?0:n+1,o=e.substring(r,a);return Y1.test(o)&&t.includes(`
29
+ `){n=r+1;break}for(let r=n;r<t;r+=1)if(e[r]!==" "&&e[r]!==" ")return!1;return!0},M3=(e,t,a,n)=>a==="\\"||e.includes("$")&&Td(e,t)?!0:a!=="*"&&n==="*"?(t<e.length-2?e[t+2]:"")!=="*":!!(a==="*"||a&&n&&Lr(a)&&Lr(n)||T3(e,t,n)),t1=e=>{let t=0,a=e.length;for(let n=0;n<a;n+=1){if(e[n]!=="*")continue;let r=n>0?e[n-1]:"",o=n<a-1?e[n+1]:"";M3(e,n,r,o)||(t+=1)}return t},A3=(e,t,a,n)=>!!(a==="\\"||e.includes("$")&&Td(e,t)||e1(e,t)||a==="_"||n==="_"||a&&n&&Lr(a)&&Lr(n)),E3=e=>{let t=0,a=e.length;for(let n=0;n<a;n+=1){if(e[n]!=="_")continue;let r=n>0?e[n-1]:"",o=n<a-1?e[n+1]:"";A3(e,n,r,o)||(t+=1)}return t},R3=e=>{let t=0,a=0;for(let n=0;n<e.length;n+=1)e[n]==="*"?a+=1:(a>=3&&(t+=Math.floor(a/3)),a=0);return a>=3&&(t+=Math.floor(a/3)),t},D3=(e,t,a)=>{if(!t||xo.test(t))return!0;let n=e.substring(0,a).lastIndexOf(`
30
+ `),r=n===-1?0:n+1,o=e.substring(r,a);return YL.test(o)&&t.includes(`
31
31
  `)?!0:Pg(e,a,"*")},_3=e=>{let t=e.match(f3);if(!t)return e;let a=t[2],n=e.lastIndexOf(t[1]);return Ul(e,n)||D3(e,a,n)?e:(e.match(/\*\*/g)||[]).length%2===1?a.endsWith("*")?`${e}*`:`${e}**`:e},O3=(e,t,a)=>{if(!t||xo.test(t))return!0;let n=e.substring(0,a).lastIndexOf(`
32
- `),r=n===-1?0:n+1,o=e.substring(r,a);return Y1.test(o)&&t.includes(`
33
- `)?!0:Pg(e,a,"_")},P3=e=>{let t=e.match(p3);if(!t){let r=e.match(S3);if(r){let o=e.lastIndexOf(r[1]);if(!Ul(e,o)&&(e.match(I3)||[]).length%2===1)return`${e}_`}return e}let a=t[2],n=e.lastIndexOf(t[1]);return Ul(e,n)||O3(e,a,n)?e:(e.match(/__/g)||[]).length%2===1?`${e}__`:e},N3=e=>{for(let t=0;t<e.length;t+=1)if(e[t]==="*"&&e[t-1]!=="*"&&e[t+1]!=="*"&&e[t-1]!=="\\"&&!Td(e,t)){let a=t>0?e[t-1]:"",n=t<e.length-1?e[t+1]:"";if(a&&n&&Lr(a)&&Lr(n))continue;return t}return-1},B3=e=>{if(!e.match(h3))return e;let t=N3(e);if(t===-1||Ul(e,t))return e;let a=e.substring(t+1);return!a||xo.test(a)?e:tL(e)%2===1?`${e}*`:e},aL=e=>{for(let t=0;t<e.length;t+=1)if(e[t]==="_"&&e[t-1]!=="_"&&e[t+1]!=="_"&&e[t-1]!=="\\"&&!Td(e,t)&&!eL(e,t)){let a=t>0?e[t-1]:"",n=t<e.length-1?e[t+1]:"";if(a&&n&&Lr(a)&&Lr(n))continue;return t}return-1},U3=e=>{let t=e.length;for(;t>0&&e[t-1]===`
34
- `;)t-=1;if(t<e.length){let a=e.slice(0,t),n=e.slice(t);return`${a}_${n}`}return`${e}_`},z3=e=>{if(!e.endsWith("**"))return null;let t=e.slice(0,-2);if((t.match(/\*\*/g)||[]).length%2!==1)return null;let a=t.indexOf("**"),n=aL(t);return a!==-1&&n!==-1&&a<n?`${t}_**`:null},q3=e=>{if(!e.match(g3))return e;let t=aL(e);if(t===-1||Ul(e,t))return e;let a=e.substring(t+1);if(!a||xo.test(a))return e;if(E3(e)%2===1){let n=z3(e);return n!==null?n:U3(e)}return e},F3=e=>{let t=(e.match(/\*\*/g)||[]).length,a=tL(e);return t%2===0&&a%2===0},H3=(e,t,a)=>!t||xo.test(t)||Ul(e,a)?!0:Pg(e,a,"*"),j3=e=>{if(b3.test(e))return e;let t=e.match(m3);if(!t)return e;let a=t[2],n=e.lastIndexOf(t[1]);return H3(e,a,n)?e:R3(e)%2===1?F3(e)?e:`${e}***`:e},kd=(e,t)=>{let a=!1,n=!1;for(let r=0;r<t;r+=1){if(e.substring(r,r+3)==="```"){n=!n,r+=2;continue}!n&&e[r]==="`"&&(a=!a)}return a||n},V3=(e,t)=>{let a=e.substring(t,t+3)==="```",n=t>0&&e.substring(t-1,t+2)==="```",r=t>1&&e.substring(t-2,t+1)==="```";return a||n||r},G3=e=>{let t=0;for(let a=0;a<e.length;a+=1)e[a]==="`"&&!V3(e,a)&&(t+=1);return t},W3=e=>!e.match(w3)||e.includes(`
32
+ `),r=n===-1?0:n+1,o=e.substring(r,a);return YL.test(o)&&t.includes(`
33
+ `)?!0:Pg(e,a,"_")},P3=e=>{let t=e.match(p3);if(!t){let r=e.match(S3);if(r){let o=e.lastIndexOf(r[1]);if(!Ul(e,o)&&(e.match(I3)||[]).length%2===1)return`${e}_`}return e}let a=t[2],n=e.lastIndexOf(t[1]);return Ul(e,n)||O3(e,a,n)?e:(e.match(/__/g)||[]).length%2===1?`${e}__`:e},N3=e=>{for(let t=0;t<e.length;t+=1)if(e[t]==="*"&&e[t-1]!=="*"&&e[t+1]!=="*"&&e[t-1]!=="\\"&&!Td(e,t)){let a=t>0?e[t-1]:"",n=t<e.length-1?e[t+1]:"";if(a&&n&&Lr(a)&&Lr(n))continue;return t}return-1},B3=e=>{if(!e.match(h3))return e;let t=N3(e);if(t===-1||Ul(e,t))return e;let a=e.substring(t+1);return!a||xo.test(a)?e:t1(e)%2===1?`${e}*`:e},a1=e=>{for(let t=0;t<e.length;t+=1)if(e[t]==="_"&&e[t-1]!=="_"&&e[t+1]!=="_"&&e[t-1]!=="\\"&&!Td(e,t)&&!e1(e,t)){let a=t>0?e[t-1]:"",n=t<e.length-1?e[t+1]:"";if(a&&n&&Lr(a)&&Lr(n))continue;return t}return-1},U3=e=>{let t=e.length;for(;t>0&&e[t-1]===`
34
+ `;)t-=1;if(t<e.length){let a=e.slice(0,t),n=e.slice(t);return`${a}_${n}`}return`${e}_`},z3=e=>{if(!e.endsWith("**"))return null;let t=e.slice(0,-2);if((t.match(/\*\*/g)||[]).length%2!==1)return null;let a=t.indexOf("**"),n=a1(t);return a!==-1&&n!==-1&&a<n?`${t}_**`:null},q3=e=>{if(!e.match(g3))return e;let t=a1(e);if(t===-1||Ul(e,t))return e;let a=e.substring(t+1);if(!a||xo.test(a))return e;if(E3(e)%2===1){let n=z3(e);return n!==null?n:U3(e)}return e},F3=e=>{let t=(e.match(/\*\*/g)||[]).length,a=t1(e);return t%2===0&&a%2===0},H3=(e,t,a)=>!t||xo.test(t)||Ul(e,a)?!0:Pg(e,a,"*"),j3=e=>{if(b3.test(e))return e;let t=e.match(m3);if(!t)return e;let a=t[2],n=e.lastIndexOf(t[1]);return H3(e,a,n)?e:R3(e)%2===1?F3(e)?e:`${e}***`:e},kd=(e,t)=>{let a=!1,n=!1;for(let r=0;r<t;r+=1){if(e.substring(r,r+3)==="```"){n=!n,r+=2;continue}!n&&e[r]==="`"&&(a=!a)}return a||n},V3=(e,t)=>{let a=e.substring(t,t+3)==="```",n=t>0&&e.substring(t-1,t+2)==="```",r=t>1&&e.substring(t-2,t+1)==="```";return a||n||r},G3=e=>{let t=0;for(let a=0;a<e.length;a+=1)e[a]==="`"&&!V3(e,a)&&(t+=1);return t},W3=e=>!e.match(w3)||e.includes(`
35
35
  `)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,$3=e=>(e.match(/```/g)||[]).length%2===1,X3=e=>{let t=W3(e);if(t!==null)return t;let a=e.match(y3);if(a&&!$3(e)){let n=a[2];if(!n||xo.test(n))return e;if(G3(e)%2===1)return`${e}\``}return e},Z3=(e,t)=>t>=2&&e.substring(t-2,t+1)==="```"||t>=1&&e.substring(t-1,t+2)==="```"||t<=e.length-3&&e.substring(t,t+3)==="```",Q3=e=>{let t=0,a=!1;for(let n=0;n<e.length-1;n+=1)e[n]==="`"&&!Z3(e,n)&&(a=!a),!a&&e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},K3=e=>{let t=e.indexOf("$$");return t!==-1&&e.indexOf(`
36
36
  `,t)!==-1&&!e.endsWith(`
37
37
  `)?`${e}
38
- $$`:`${e}$$`},Y3=e=>Q3(e)%2===0?e:K3(e),J3=(e,t,a)=>{if(e.substring(t+2).includes(")"))return null;let n=L3(e,t);if(n===-1||kd(e,n))return null;let r=n>0&&e[n-1]==="!",o=r?n-1:n,l=e.substring(0,o);if(r)return l;let i=e.substring(n+1,t);return a==="text-only"?`${l}${i}`:`${l}[${i}](streamdown:incomplete-link)`},Z1=(e,t)=>{for(let a=0;a<=t;a++)if(e[a]==="["&&!kd(e,a)){if(a>0&&e[a-1]==="!")continue;let n=J1(e,a);if(n===-1)return a;if(n+1<e.length&&e[n+1]==="("){let r=e.indexOf(")",n+2);r!==-1&&(a=r)}}return-1},eB=(e,t,a)=>{let n=t>0&&e[t-1]==="!",r=n?t-1:t,o=e.substring(t+1);if(!o.includes("]")){let l=e.substring(0,r);if(n)return l;if(a==="text-only"){let i=Z1(e,t);return i!==-1?e.substring(0,i)+e.substring(i+1):`${l}${o}`}return`${e}](streamdown:incomplete-link)`}if(J1(e,t)===-1){let l=e.substring(0,r);if(n)return l;if(a==="text-only"){let i=Z1(e,t);if(i!==-1)return e.substring(0,i)+e.substring(i+1);let s=e.substring(t+1);return`${l}${s}`}return`${e}](streamdown:incomplete-link)`}return null},nL=(e,t="protocol")=>{let a=e.lastIndexOf("](");if(a!==-1&&!kd(e,a)){let n=J3(e,a,t);if(n!==null)return n}for(let n=e.length-1;n>=0;n-=1)if(e[n]==="["&&!kd(e,n)){let r=eB(e,n,t);if(r!==null)return r}return e},tB=/^-{1,2}$/,aB=/^[\s]*-{1,2}[\s]+$/,nB=/^={1,2}$/,rB=/^[\s]*={1,2}[\s]+$/,oB=e=>{if(!e||typeof e!="string")return e;let t=e.lastIndexOf(`
38
+ $$`:`${e}$$`},Y3=e=>Q3(e)%2===0?e:K3(e),J3=(e,t,a)=>{if(e.substring(t+2).includes(")"))return null;let n=L3(e,t);if(n===-1||kd(e,n))return null;let r=n>0&&e[n-1]==="!",o=r?n-1:n,l=e.substring(0,o);if(r)return l;let i=e.substring(n+1,t);return a==="text-only"?`${l}${i}`:`${l}[${i}](streamdown:incomplete-link)`},ZL=(e,t)=>{for(let a=0;a<=t;a++)if(e[a]==="["&&!kd(e,a)){if(a>0&&e[a-1]==="!")continue;let n=JL(e,a);if(n===-1)return a;if(n+1<e.length&&e[n+1]==="("){let r=e.indexOf(")",n+2);r!==-1&&(a=r)}}return-1},eB=(e,t,a)=>{let n=t>0&&e[t-1]==="!",r=n?t-1:t,o=e.substring(t+1);if(!o.includes("]")){let l=e.substring(0,r);if(n)return l;if(a==="text-only"){let i=ZL(e,t);return i!==-1?e.substring(0,i)+e.substring(i+1):`${l}${o}`}return`${e}](streamdown:incomplete-link)`}if(JL(e,t)===-1){let l=e.substring(0,r);if(n)return l;if(a==="text-only"){let i=ZL(e,t);if(i!==-1)return e.substring(0,i)+e.substring(i+1);let s=e.substring(t+1);return`${l}${s}`}return`${e}](streamdown:incomplete-link)`}return null},n1=(e,t="protocol")=>{let a=e.lastIndexOf("](");if(a!==-1&&!kd(e,a)){let n=J3(e,a,t);if(n!==null)return n}for(let n=e.length-1;n>=0;n-=1)if(e[n]==="["&&!kd(e,n)){let r=eB(e,n,t);if(r!==null)return r}return e},tB=/^-{1,2}$/,aB=/^[\s]*-{1,2}[\s]+$/,nB=/^={1,2}$/,rB=/^[\s]*={1,2}[\s]+$/,oB=e=>{if(!e||typeof e!="string")return e;let t=e.lastIndexOf(`
39
39
  `);if(t===-1)return e;let a=e.substring(t+1),n=e.substring(0,t),r=a.trim();if(tB.test(r)&&!a.match(aB)){let o=n.split(`
40
40
  `).at(-1);if(o&&o.trim().length>0)return`${e}\u200B`}if(nB.test(r)&&!a.match(rB)){let o=n.split(`
41
- `).at(-1);if(o&&o.trim().length>0)return`${e}\u200B`}return e},lB=e=>{let t=e.match(x3);if(t){let a=t[2];if(!a||xo.test(a))return e;if((e.match(X1)||[]).length%2===1)return`${e}~~`}else if(e.match(C3)&&(e.match(X1)||[]).length%2===1)return`${e}~`;return e},Og=e=>e!==!1,ya={SETEXT_HEADINGS:0,LINKS:10,BOLD_ITALIC:20,BOLD:30,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,DEFAULT:100},iB=[{handler:{name:"setextHeadings",handle:oB,priority:ya.SETEXT_HEADINGS},optionKey:"setextHeadings"},{handler:{name:"links",handle:nL,priority:ya.LINKS},optionKey:"links",earlyReturn:e=>e.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:j3,priority:ya.BOLD_ITALIC},optionKey:"boldItalic"},{handler:{name:"bold",handle:_3,priority:ya.BOLD},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:P3,priority:ya.ITALIC_DOUBLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:B3,priority:ya.ITALIC_SINGLE_ASTERISK},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:q3,priority:ya.ITALIC_SINGLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"inlineCode",handle:X3,priority:ya.INLINE_CODE},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:lB,priority:ya.STRIKETHROUGH},optionKey:"strikethrough"},{handler:{name:"katex",handle:Y3,priority:ya.KATEX},optionKey:"katex"}],sB=e=>{var t;let a=(t=e?.linkMode)!=null?t:"protocol";return iB.filter(({handler:n,optionKey:r})=>n.name==="links"?Og(e?.links)||Og(e?.images):Og(e?.[r])).map(({handler:n,earlyReturn:r})=>n.name==="links"?{handler:K1(Q1({},n),{handle:o=>nL(o,a)}),earlyReturn:a==="protocol"?r:void 0}:{handler:n,earlyReturn:r})},uB=(e,t)=>{var a;if(!e||typeof e!="string")return e;let n=e.endsWith(" ")&&!e.endsWith(" ")?e.slice(0,-1):e,r=sB(t),o=((a=t?.handlers)!=null?a:[]).map(i=>{var s;return{handler:K1(Q1({},i),{priority:(s=i.priority)!=null?s:ya.DEFAULT}),earlyReturn:void 0}}),l=[...r,...o].sort((i,s)=>{var u,c;return((u=i.handler.priority)!=null?u:ya.DEFAULT)-((c=s.handler.priority)!=null?c:ya.DEFAULT)});for(let{handler:i,earlyReturn:s}of l)if(n=i.handle(n),s!=null&&s(n))return n;return n},rL=uB});function lL(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}var iL=I(()=>{"use strict"});function Md(e,t){return((t||fB).jsx?dB:cB).test(e)}var cB,dB,fB,sL=I(()=>{"use strict";cB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fB={}});var uL=I(()=>{"use strict";sL()});function Ng(e){return typeof e=="object"?e.type==="text"?cL(e.value):!1:cL(e)}function cL(e){return e.replace(pB,"")===""}var pB,dL=I(()=>{"use strict";pB=/[ \t\n\f\r]/g});var fL=I(()=>{"use strict";dL()});var Un,Bg=I(()=>{"use strict";Un=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};Un.prototype.normal={};Un.prototype.property={};Un.prototype.space=void 0});function Ug(e,t){let a={},n={};for(let r of e)Object.assign(a,r.property),Object.assign(n,r.normal);return new Un(a,n,t)}var pL=I(()=>{"use strict";Bg()});function Es(e){return e.toLowerCase()}var zg=I(()=>{"use strict"});var kt,qg=I(()=>{"use strict";kt=class{constructor(t,a){this.attribute=a,this.property=t}};kt.prototype.attribute="";kt.prototype.booleanish=!1;kt.prototype.boolean=!1;kt.prototype.commaOrSpaceSeparated=!1;kt.prototype.commaSeparated=!1;kt.prototype.defined=!1;kt.prototype.mustUseProperty=!1;kt.prototype.number=!1;kt.prototype.overloadedBoolean=!1;kt.prototype.property="";kt.prototype.spaceSeparated=!1;kt.prototype.space=void 0});var Rs={};ru(Rs,{boolean:()=>oe,booleanish:()=>at,commaOrSpaceSeparated:()=>aa,commaSeparated:()=>kr,number:()=>U,overloadedBoolean:()=>Ad,spaceSeparated:()=>Ae});function vo(){return 2**++mB}var mB,oe,at,Ad,U,Ae,kr,aa,Ds=I(()=>{"use strict";mB=0,oe=vo(),at=vo(),Ad=vo(),U=vo(),Ae=vo(),kr=vo(),aa=vo()});function mL(e,t,a){a&&(e[t]=a)}var Fg,wo,Hg=I(()=>{"use strict";qg();Ds();Fg=Object.keys(Rs),wo=class extends kt{constructor(t,a,n,r){let o=-1;if(super(t,a),mL(this,"space",r),typeof n=="number")for(;++o<Fg.length;){let l=Fg[o];mL(this,Fg[o],(n&Rs[l])===Rs[l])}}};wo.prototype.defined=!0});function _a(e){let t={},a={};for(let[n,r]of Object.entries(e.properties)){let o=new wo(n,e.transform(e.attributes||{},n),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),t[n]=o,a[Es(n)]=n,a[Es(o.attribute)]=n}return new Un(t,a,e.space)}var bo=I(()=>{"use strict";zg();Hg();Bg()});var jg,hL=I(()=>{"use strict";bo();Ds();jg=_a({properties:{ariaActiveDescendant:null,ariaAtomic:at,ariaAutoComplete:null,ariaBusy:at,ariaChecked:at,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:Ae,ariaCurrent:null,ariaDescribedBy:Ae,ariaDetails:null,ariaDisabled:at,ariaDropEffect:Ae,ariaErrorMessage:null,ariaExpanded:at,ariaFlowTo:Ae,ariaGrabbed:at,ariaHasPopup:null,ariaHidden:at,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ae,ariaLevel:U,ariaLive:null,ariaModal:at,ariaMultiLine:at,ariaMultiSelectable:at,ariaOrientation:null,ariaOwns:Ae,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:at,ariaReadOnly:at,ariaRelevant:null,ariaRequired:at,ariaRoleDescription:Ae,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:at,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}})});function Ed(e,t){return t in e?e[t]:t}var Vg=I(()=>{"use strict"});function Rd(e,t){return Ed(e,t.toLowerCase())}var Gg=I(()=>{"use strict";Vg()});var gL,yL=I(()=>{"use strict";Gg();bo();Ds();gL=_a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kr,acceptCharset:Ae,accessKey:Ae,action:null,allow:null,allowFullScreen:oe,allowPaymentRequest:oe,allowUserMedia:oe,alt:null,as:null,async:oe,autoCapitalize:null,autoComplete:Ae,autoFocus:oe,autoPlay:oe,blocking:Ae,capture:null,charSet:null,checked:oe,cite:null,className:Ae,cols:U,colSpan:null,content:null,contentEditable:at,controls:oe,controlsList:Ae,coords:U|kr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oe,defer:oe,dir:null,dirName:null,disabled:oe,download:Ad,draggable:at,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oe,formTarget:null,headers:Ae,height:U,hidden:Ad,high:U,href:null,hrefLang:null,htmlFor:Ae,httpEquiv:Ae,id:null,imageSizes:null,imageSrcSet:null,inert:oe,inputMode:null,integrity:null,is:null,isMap:oe,itemId:null,itemProp:Ae,itemRef:Ae,itemScope:oe,itemType:Ae,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oe,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:oe,muted:oe,name:null,nonce:null,noModule:oe,noValidate:oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oe,optimum:U,pattern:null,ping:Ae,placeholder:null,playsInline:oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oe,referrerPolicy:null,rel:Ae,required:oe,reversed:oe,rows:U,rowSpan:U,sandbox:Ae,scope:null,scoped:oe,seamless:oe,selected:oe,shadowRootClonable:oe,shadowRootDelegatesFocus:oe,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:at,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:oe,useMap:null,value:at,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ae,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oe,declare:oe,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:oe,noHref:oe,noShade:oe,noWrap:oe,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:at,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:oe,disableRemotePlayback:oe,prefix:null,property:null,results:U,security:null,unselectable:null},space:"html",transform:Rd})});var xL,vL=I(()=>{"use strict";Vg();bo();Ds();xL=_a({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:aa,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:Ae,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kr,g2:kr,glyphName:kr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:aa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:U,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ae,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:aa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:aa,rev:aa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:aa,requiredFeatures:aa,requiredFonts:aa,requiredFormats:aa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:aa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:aa,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:aa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ed})});var Wg,wL=I(()=>{"use strict";bo();Wg=_a({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}})});var $g,bL=I(()=>{"use strict";bo();Gg();$g=_a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Rd})});var Xg,SL=I(()=>{"use strict";bo();Xg=_a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}})});var Zg,CL=I(()=>{"use strict";Zg={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"}});function Qg(e,t){let a=Es(t),n=t,r=kt;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&gB.test(t)){if(t.charAt(4)==="-"){let o=t.slice(5).replace(IL,xB);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=t.slice(4);if(!IL.test(o)){let l=o.replace(hB,yB);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}r=wo}return new r(n,t)}function yB(e){return"-"+e.toLowerCase()}function xB(e){return e.charAt(1).toUpperCase()}var hB,IL,gB,LL=I(()=>{"use strict";Hg();qg();zg();hB=/[A-Z]/g,IL=/-[a-z]/g,gB=/^data[-\w.:]+$/i});var kL,Dd,TL=I(()=>{"use strict";pL();hL();yL();vL();wL();bL();SL();CL();LL();kL=Ug([jg,gL,Wg,$g,Xg],"html"),Dd=Ug([jg,xL,Wg,$g,Xg],"svg")});function ML(e){return e.join(" ").trim()}var AL=I(()=>{"use strict"});var PL=Ot((Z$,OL)=>{"use strict";var EL=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,vB=/\n/g,wB=/^\s*/,bB=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,SB=/^:\s*/,CB=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,IB=/^[;\s]*/,LB=/^\s+|\s+$/g,kB=`
42
- `,RL="/",DL="*",So="",TB="comment",MB="declaration";function AB(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var a=1,n=1;function r(y){var v=y.match(vB);v&&(a+=v.length);var S=y.lastIndexOf(kB);n=~S?y.length-S:n+y.length}function o(){var y={line:a,column:n};return function(v){return v.position=new l(y),u(),v}}function l(y){this.start=y,this.end={line:a,column:n},this.source=t.source}l.prototype.content=e;function i(y){var v=new Error(t.source+":"+a+":"+n+": "+y);if(v.reason=y,v.filename=t.source,v.line=a,v.column=n,v.source=e,!t.silent)throw v}function s(y){var v=y.exec(e);if(v){var S=v[0];return r(S),e=e.slice(S.length),v}}function u(){s(wB)}function c(y){var v;for(y=y||[];v=d();)v!==!1&&y.push(v);return y}function d(){var y=o();if(!(RL!=e.charAt(0)||DL!=e.charAt(1))){for(var v=2;So!=e.charAt(v)&&(DL!=e.charAt(v)||RL!=e.charAt(v+1));)++v;if(v+=2,So===e.charAt(v-1))return i("End of comment missing");var S=e.slice(2,v-2);return n+=2,r(S),e=e.slice(v),n+=2,y({type:TB,comment:S})}}function f(){var y=o(),v=s(bB);if(v){if(d(),!s(SB))return i("property missing ':'");var S=s(CB),g=y({type:MB,property:_L(v[0].replace(EL,So)),value:S?_L(S[0].replace(EL,So)):So});return s(IB),g}}function p(){var y=[];c(y);for(var v;v=f();)v!==!1&&(y.push(v),c(y));return y}return u(),p()}function _L(e){return e?e.replace(LB,So):So}OL.exports=AB});var NL=Ot(_s=>{"use strict";var EB=_s&&_s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_s,"__esModule",{value:!0});_s.default=DB;var RB=EB(PL());function DB(e,t){let a=null;if(!e||typeof e!="string")return a;let n=(0,RB.default)(e),r=typeof t=="function";return n.forEach(o=>{if(o.type!=="declaration")return;let{property:l,value:i}=o;r?t(l,i,o):i&&(a=a||{},a[l]=i)}),a}});var UL=Ot(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.camelCase=void 0;var _B=/^--[a-zA-Z0-9_-]+$/,OB=/-([a-z])/g,PB=/^[^-]+$/,NB=/^-(webkit|moz|ms|o|khtml)-/,BB=/^-(ms)-/,UB=function(e){return!e||PB.test(e)||_B.test(e)},zB=function(e,t){return t.toUpperCase()},BL=function(e,t){return"".concat(t,"-")},qB=function(e,t){return t===void 0&&(t={}),UB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(BB,BL):e=e.replace(NB,BL),e.replace(OB,zB))};_d.camelCase=qB});var qL=Ot((Yg,zL)=>{"use strict";var FB=Yg&&Yg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},HB=FB(NL()),jB=UL();function Kg(e,t){var a={};return!e||typeof e!="string"||(0,HB.default)(e,function(n,r){n&&r&&(a[(0,jB.camelCase)(n,t)]=r)}),a}Kg.default=Kg;zL.exports=Kg});function Tr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?FL(e.position):"start"in e||"end"in e?FL(e):"line"in e||"column"in e?Jg(e):""}function Jg(e){return HL(e&&e.line)+":"+HL(e&&e.column)}function FL(e){return Jg(e&&e.start)+"-"+Jg(e&&e.end)}function HL(e){return e&&typeof e=="number"?e:1}var jL=I(()=>{"use strict"});var ey=I(()=>{"use strict";jL()});var ut,VL=I(()=>{"use strict";ey();ut=class extends Error{constructor(t,a,n){super(),typeof a=="string"&&(n=a,a=void 0);let r="",o={},l=!1;if(a&&("line"in a&&"column"in a?o={place:a}:"start"in a&&"end"in a?o={place:a}:"type"in a?o={ancestors:[a],place:a.position}:o={...a}),typeof t=="string"?r=t:!o.cause&&t&&(l=!0,r=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof n=="string"){let s=n.indexOf(":");s===-1?o.ruleId=n:(o.source=n.slice(0,s),o.ruleId=n.slice(s+1))}if(!o.place&&o.ancestors&&o.ancestors){let s=o.ancestors[o.ancestors.length-1];s&&(o.place=s.position)}let i=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=i?i.line:void 0,this.name=Tr(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};ut.prototype.file="";ut.prototype.name="";ut.prototype.reason="";ut.prototype.message="";ut.prototype.stack="";ut.prototype.column=void 0;ut.prototype.line=void 0;ut.prototype.ancestors=void 0;ut.prototype.cause=void 0;ut.prototype.fatal=void 0;ut.prototype.place=void 0;ut.prototype.ruleId=void 0;ut.prototype.source=void 0});var ty=I(()=>{"use strict";VL()});function ny(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let a=t.filePath||void 0,n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=t4(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=e4(a,t.jsx,t.jsxs)}let r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Dd:kL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=$L(r,e,void 0);return o&&typeof o!="string"?o:r.create(e,r.Fragment,{children:o||void 0},void 0)}function $L(e,t,a){if(t.type==="element")return XB(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ZB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return KB(e,t,a);if(t.type==="mdxjsEsm")return QB(e,t);if(t.type==="root")return YB(e,t,a);if(t.type==="text")return JB(e,t)}function XB(e,t,a){let n=e.schema,r=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=Dd,e.schema=r),e.ancestors.push(t);let o=ZL(e,t.tagName,!1),l=a4(e,t),i=oy(e,t);return WB.has(t.tagName)&&(i=i.filter(function(s){return typeof s=="string"?!Ng(s):!0})),XL(e,l,o,t),ry(l,i),e.ancestors.pop(),e.schema=n,e.create(t,o,l,a)}function ZB(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Os(e,t.position)}function QB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Os(e,t.position)}function KB(e,t,a){let n=e.schema,r=n;t.name==="svg"&&n.space==="html"&&(r=Dd,e.schema=r),e.ancestors.push(t);let o=t.name===null?e.Fragment:ZL(e,t.name,!0),l=n4(e,t),i=oy(e,t);return XL(e,l,o,t),ry(l,i),e.ancestors.pop(),e.schema=n,e.create(t,o,l,a)}function YB(e,t,a){let n={};return ry(n,oy(e,t)),e.create(t,e.Fragment,n,a)}function JB(e,t){return t.value}function XL(e,t,a,n){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=n)}function ry(e,t){if(t.length>0){let a=t.length>1?t:t[0];a&&(e.children=a)}}function e4(e,t,a){return n;function n(r,o,l,i){let u=Array.isArray(l.children)?a:t;return i?u(o,l,i):u(o,l)}}function t4(e,t){return a;function a(n,r,o,l){let i=Array.isArray(o.children),s=Rl(n);return t(r,o,l,i,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function a4(e,t){let a={},n,r;for(r in t.properties)if(r!=="children"&&ay.call(t.properties,r)){let o=r4(e,r,t.properties[r]);if(o){let[l,i]=o;e.tableCellAlignToStyle&&l==="align"&&typeof i=="string"&&$B.has(t.tagName)?n=i:a[l]=i}}if(n){let o=a.style||(a.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return a}function n4(e,t){let a={};for(let n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){let o=n.data.estree.body[0];o.type;let l=o.expression;l.type;let i=l.properties[0];i.type,Object.assign(a,e.evaluater.evaluateExpression(i.argument))}else Os(e,t.position);else{let r=n.name,o;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){let i=n.value.data.estree.body[0];i.type,o=e.evaluater.evaluateExpression(i.expression)}else Os(e,t.position);else o=n.value===null?!0:n.value;a[r]=o}return a}function oy(e,t){let a=[],n=-1,r=e.passKeys?new Map:VB;for(;++n<t.children.length;){let o=t.children[n],l;if(e.passKeys){let s=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(s){let u=r.get(s)||0;l=s+"-"+u,r.set(s,u+1)}}let i=$L(e,o,l);i!==void 0&&a.push(i)}return a}function r4(e,t,a){let n=Qg(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=n.commaSeparated?lL(a):ML(a)),n.property==="style"){let r=typeof a=="object"?a:o4(e,String(a));return e.stylePropertyNameCase==="css"&&(r=l4(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&n.space?Zg[n.property]||n.property:n.attribute,a]}}function o4(e,t){try{return(0,GL.default)(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};let n=a,r=new ut("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=WL+"#cannot-parse-style-attribute",r}}function ZL(e,t,a){let n;if(!a)n={type:"Literal",value:t};else if(t.includes(".")){let r=t.split("."),o=-1,l;for(;++o<r.length;){let i=Md(r[o])?{type:"Identifier",name:r[o]}:{type:"Literal",value:r[o]};l=l?{type:"MemberExpression",object:l,property:i,computed:!!(o&&i.type==="Literal"),optional:!1}:i}n=l}else n=Md(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){let r=n.value;return ay.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(n);Os(e)}function Os(e,t){let a=new ut("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=WL+"#cannot-handle-mdx-estrees-without-createevaluater",a}function l4(e){let t={},a;for(a in e)ay.call(e,a)&&(t[i4(a)]=e[a]);return t}function i4(e){let t=e.replace(GB,s4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function s4(e){return"-"+e.toLowerCase()}var GL,ay,VB,GB,WB,$B,WL,QL=I(()=>{"use strict";iL();uL();fL();TL();AL();GL=q(qL(),1);bs();ty();ay={}.hasOwnProperty,VB=new Map,GB=/[A-Z]/g,WB=new Set(["table","tbody","thead","tfoot","tr"]),$B=new Set(["td","th"]),WL="https://github.com/syntax-tree/hast-util-to-jsx-runtime"});var KL=I(()=>{"use strict";QL()});function u4(e){let t=e.attempt(this.parser.constructs.contentInitial,n,r),a;return t;function n(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),X(e,t,"linePrefix")}function r(i){return e.enter("paragraph"),o(i)}function o(i){let s=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=s),a=s,l(i)}function l(i){if(i===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(i);return}return H(i)?(e.consume(i),e.exit("chunkText"),o):(e.consume(i),l)}}var YL,JL=I(()=>{"use strict";st();ye();YL={tokenize:u4}});function c4(e){let t=this,a=[],n=0,r,o,l;return i;function i(m){if(n<a.length){let w=a[n];return t.containerState=w[1],e.attempt(w[0].continuation,s,u)(m)}return u(m)}function s(m){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&x();let w=t.events.length,L=w,b;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){b=t.events[L][1].end;break}g(n);let A=w;for(;A<t.events.length;)t.events[A][1].end={...b},A++;return it(t.events,L+1,0,t.events.slice(w)),t.events.length=A,u(m)}return i(m)}function u(m){if(n===a.length){if(!r)return f(m);if(r.currentConstruct&&r.currentConstruct.concrete)return y(m);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ek,c,d)(m)}function c(m){return r&&x(),g(n),f(m)}function d(m){return t.parser.lazy[t.now().line]=n!==a.length,l=t.now().offset,y(m)}function f(m){return t.containerState={},e.attempt(ek,p,y)(m)}function p(m){return n++,a.push([t.currentConstruct,t.containerState]),f(m)}function y(m){if(m===null){r&&x(),g(0),e.consume(m);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:o}),v(m)}function v(m){if(m===null){S(e.exit("chunkFlow"),!0),g(0),e.consume(m);return}return H(m)?(e.consume(m),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,i):(e.consume(m),v)}function S(m,w){let L=t.sliceStream(m);if(w&&L.push(null),m.previous=o,o&&(o.next=m),o=m,r.defineSkip(m.start),r.write(L),t.parser.lazy[m.start.line]){let b=r.events.length;for(;b--;)if(r.events[b][1].start.offset<l&&(!r.events[b][1].end||r.events[b][1].end.offset>l))return;let A=t.events.length,R=A,_,T;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(_){T=t.events[R][1].end;break}_=!0}for(g(n),b=A;b<t.events.length;)t.events[b][1].end={...T},b++;it(t.events,R+1,0,t.events.slice(A)),t.events.length=b}}function g(m){let w=a.length;for(;w-- >m;){let L=a[w];t.containerState=L[1],L[0].exit.call(t,e)}a.length=m}function x(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}function d4(e,t,a){return X(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var tk,ek,ak=I(()=>{"use strict";st();ye();Nn();tk={tokenize:c4},ek={tokenize:d4}});function f4(e){let t=this,a=e.attempt(nn,n,e.attempt(this.parser.constructs.flowInitial,r,X(e,e.attempt(this.parser.constructs.flow,r,e.attempt(gg,r)),"linePrefix")));return a;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,a}}var nk,rk=I(()=>{"use strict";Sd();st();nk={tokenize:f4}});function sk(e){return{resolveAll:uk(e==="text"?p4:void 0),tokenize:t};function t(a){let n=this,r=this.parser.constructs[e],o=a.attempt(r,l,i);return l;function l(c){return u(c)?o(c):i(c)}function i(c){if(c===null){a.consume(c);return}return a.enter("data"),a.consume(c),s}function s(c){return u(c)?(a.exit("data"),o(c)):(a.consume(c),s)}function u(c){if(c===null)return!0;let d=r[c],f=-1;if(d)for(;++f<d.length;){let p=d[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function uk(e){return t;function t(a,n){let r=-1,o;for(;++r<=a.length;)o===void 0?a[r]&&a[r][1].type==="data"&&(o=r,r++):(!a[r]||a[r][1].type!=="data")&&(r!==o+2&&(a[o][1].end=a[r-1][1].end,a.splice(o+2,r-o-2),r=o+2),o=void 0);return e?e(a,n):a}}function p4(e,t){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){let n=e[a-1][1],r=t.sliceStream(n),o=r.length,l=-1,i=0,s;for(;o--;){let u=r[o];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)i++,l--;if(l)break;l=-1}else if(u===-2)s=!0,i++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(i=0),i){let u={type:a===e.length||s||i<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:n.start._bufferIndex+l,_index:n.start._index+o,line:n.end.line,column:n.end.column-i,offset:n.end.offset-i},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(e.splice(a,0,["enter",u,t],["exit",u,t]),a+=2)}a++}return e}var ok,lk,ik,ly=I(()=>{"use strict";ok={resolveAll:uk()},lk=sk("string"),ik=sk("text")});var iy={};ru(iy,{attentionMarkers:()=>b4,contentInitial:()=>h4,disable:()=>S4,document:()=>m4,flow:()=>y4,flowInitial:()=>g4,insideSpan:()=>w4,string:()=>x4,text:()=>v4});var m4,h4,g4,y4,x4,v4,w4,b4,S4,ck=I(()=>{"use strict";Sd();ly();m4={42:Bt,43:Bt,45:Bt,48:Bt,49:Bt,50:Bt,51:Bt,52:Bt,53:Bt,54:Bt,55:Bt,56:Bt,57:Bt,62:dd},h4={91:bg},g4={[-2]:Ts,[-1]:Ts,32:Ts},y4={35:Cg,42:yo,45:[bd,yo],60:Lg,61:bd,95:yo,96:md,126:md},x4={38:pd,92:fd},v4={[-5]:As,[-4]:As,[-3]:As,33:Tg,38:pd,42:ks,60:[pg,kg],91:Mg,92:[Sg,fd],93:go,95:ks,96:mg},w4={null:[ks,ok]},b4={null:[42,95]},S4={null:[]}});function dk(e,t,a){let n={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0},r={},o=[],l=[],i=[],s=!0,u={attempt:_(A),check:_(R),consume:w,enter:L,exit:b,interrupt:_(R,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:S,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:p},d=t.tokenize.call(c,u),f;return t.resolveAll&&o.push(t),c;function p(B){return l=Vt(l,B),x(),l[l.length-1]!==null?[]:(T(t,0),c.events=Ir(o,c.events,c),c.events)}function y(B,j){return I4(v(B),j)}function v(B){return C4(l,B)}function S(){let{_bufferIndex:B,_index:j,line:V,column:F,offset:te}=n;return{_bufferIndex:B,_index:j,line:V,column:F,offset:te}}function g(B){r[B.line]=B.column,N()}function x(){let B;for(;n._index<l.length;){let j=l[n._index];if(typeof j=="string")for(B=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===B&&n._bufferIndex<j.length;)m(j.charCodeAt(n._bufferIndex));else m(j)}}function m(B){s=void 0,f=B,d=d(B)}function w(B){H(B)?(n.line++,n.column=1,n.offset+=B===-3?2:1,N()):B!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===l[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=B,s=!0}function L(B,j){let V=j||{};return V.type=B,V.start=S(),c.events.push(["enter",V,c]),i.push(V),V}function b(B){let j=i.pop();return j.end=S(),c.events.push(["exit",j,c]),j}function A(B,j){T(B,j.from)}function R(B,j){j.restore()}function _(B,j){return V;function V(F,te,$e){let Z,C,Xe,le;return Array.isArray(F)?Ze(F):"tokenize"in F?Ze([F]):k(F);function k(Q){return ke;function ke(se){let Se=se!==null&&Q[se],Le=se!==null&&Q.null,Fe=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return Ze(Fe)(se)}}function Ze(Q){return Z=Q,C=0,Q.length===0?$e:Ue(Q[C])}function Ue(Q){return ke;function ke(se){return le=D(),Xe=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?G(se):Q.tokenize.call(j?Object.assign(Object.create(c),j):c,u,Hn,G)(se)}}function Hn(Q){return s=!0,B(Xe,le),te}function G(Q){return s=!0,le.restore(),++C<Z.length?Ue(Z[C]):$e}}}function T(B,j){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&it(c.events,j,c.events.length-j,B.resolve(c.events.slice(j),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function D(){let B=S(),j=c.previous,V=c.currentConstruct,F=c.events.length,te=Array.from(i);return{from:F,restore:$e};function $e(){n=B,c.previous=j,c.currentConstruct=V,c.events.length=F,i=te,N()}}function N(){n.line in r&&n.column<2&&(n.column=r[n.line],n.offset+=r[n.line]-1)}}function C4(e,t){let a=t.start._index,n=t.start._bufferIndex,r=t.end._index,o=t.end._bufferIndex,l;if(a===r)l=[e[a].slice(n,o)];else{if(l=e.slice(a,r),n>-1){let i=l[0];typeof i=="string"?l[0]=i.slice(n):l.shift()}o>0&&l.push(e[r].slice(0,o))}return l}function I4(e,t){let a=-1,n=[],r;for(;++a<e.length;){let o=e[a],l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
41
+ `).at(-1);if(o&&o.trim().length>0)return`${e}\u200B`}return e},lB=e=>{let t=e.match(x3);if(t){let a=t[2];if(!a||xo.test(a))return e;if((e.match(XL)||[]).length%2===1)return`${e}~~`}else if(e.match(C3)&&(e.match(XL)||[]).length%2===1)return`${e}~`;return e},Og=e=>e!==!1,ya={SETEXT_HEADINGS:0,LINKS:10,BOLD_ITALIC:20,BOLD:30,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,DEFAULT:100},iB=[{handler:{name:"setextHeadings",handle:oB,priority:ya.SETEXT_HEADINGS},optionKey:"setextHeadings"},{handler:{name:"links",handle:n1,priority:ya.LINKS},optionKey:"links",earlyReturn:e=>e.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:j3,priority:ya.BOLD_ITALIC},optionKey:"boldItalic"},{handler:{name:"bold",handle:_3,priority:ya.BOLD},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:P3,priority:ya.ITALIC_DOUBLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:B3,priority:ya.ITALIC_SINGLE_ASTERISK},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:q3,priority:ya.ITALIC_SINGLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"inlineCode",handle:X3,priority:ya.INLINE_CODE},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:lB,priority:ya.STRIKETHROUGH},optionKey:"strikethrough"},{handler:{name:"katex",handle:Y3,priority:ya.KATEX},optionKey:"katex"}],sB=e=>{var t;let a=(t=e?.linkMode)!=null?t:"protocol";return iB.filter(({handler:n,optionKey:r})=>n.name==="links"?Og(e?.links)||Og(e?.images):Og(e?.[r])).map(({handler:n,earlyReturn:r})=>n.name==="links"?{handler:KL(QL({},n),{handle:o=>n1(o,a)}),earlyReturn:a==="protocol"?r:void 0}:{handler:n,earlyReturn:r})},uB=(e,t)=>{var a;if(!e||typeof e!="string")return e;let n=e.endsWith(" ")&&!e.endsWith(" ")?e.slice(0,-1):e,r=sB(t),o=((a=t?.handlers)!=null?a:[]).map(i=>{var s;return{handler:KL(QL({},i),{priority:(s=i.priority)!=null?s:ya.DEFAULT}),earlyReturn:void 0}}),l=[...r,...o].sort((i,s)=>{var u,c;return((u=i.handler.priority)!=null?u:ya.DEFAULT)-((c=s.handler.priority)!=null?c:ya.DEFAULT)});for(let{handler:i,earlyReturn:s}of l)if(n=i.handle(n),s!=null&&s(n))return n;return n},r1=uB});function l1(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}var i1=I(()=>{"use strict"});function Md(e,t){return((t||fB).jsx?dB:cB).test(e)}var cB,dB,fB,s1=I(()=>{"use strict";cB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fB={}});var u1=I(()=>{"use strict";s1()});function Ng(e){return typeof e=="object"?e.type==="text"?c1(e.value):!1:c1(e)}function c1(e){return e.replace(pB,"")===""}var pB,d1=I(()=>{"use strict";pB=/[ \t\n\f\r]/g});var f1=I(()=>{"use strict";d1()});var Un,Bg=I(()=>{"use strict";Un=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};Un.prototype.normal={};Un.prototype.property={};Un.prototype.space=void 0});function Ug(e,t){let a={},n={};for(let r of e)Object.assign(a,r.property),Object.assign(n,r.normal);return new Un(a,n,t)}var p1=I(()=>{"use strict";Bg()});function Es(e){return e.toLowerCase()}var zg=I(()=>{"use strict"});var kt,qg=I(()=>{"use strict";kt=class{constructor(t,a){this.attribute=a,this.property=t}};kt.prototype.attribute="";kt.prototype.booleanish=!1;kt.prototype.boolean=!1;kt.prototype.commaOrSpaceSeparated=!1;kt.prototype.commaSeparated=!1;kt.prototype.defined=!1;kt.prototype.mustUseProperty=!1;kt.prototype.number=!1;kt.prototype.overloadedBoolean=!1;kt.prototype.property="";kt.prototype.spaceSeparated=!1;kt.prototype.space=void 0});var Rs={};ru(Rs,{boolean:()=>oe,booleanish:()=>at,commaOrSpaceSeparated:()=>aa,commaSeparated:()=>kr,number:()=>U,overloadedBoolean:()=>Ad,spaceSeparated:()=>Ae});function vo(){return 2**++mB}var mB,oe,at,Ad,U,Ae,kr,aa,Ds=I(()=>{"use strict";mB=0,oe=vo(),at=vo(),Ad=vo(),U=vo(),Ae=vo(),kr=vo(),aa=vo()});function m1(e,t,a){a&&(e[t]=a)}var Fg,wo,Hg=I(()=>{"use strict";qg();Ds();Fg=Object.keys(Rs),wo=class extends kt{constructor(t,a,n,r){let o=-1;if(super(t,a),m1(this,"space",r),typeof n=="number")for(;++o<Fg.length;){let l=Fg[o];m1(this,Fg[o],(n&Rs[l])===Rs[l])}}};wo.prototype.defined=!0});function _a(e){let t={},a={};for(let[n,r]of Object.entries(e.properties)){let o=new wo(n,e.transform(e.attributes||{},n),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),t[n]=o,a[Es(n)]=n,a[Es(o.attribute)]=n}return new Un(t,a,e.space)}var bo=I(()=>{"use strict";zg();Hg();Bg()});var jg,h1=I(()=>{"use strict";bo();Ds();jg=_a({properties:{ariaActiveDescendant:null,ariaAtomic:at,ariaAutoComplete:null,ariaBusy:at,ariaChecked:at,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:Ae,ariaCurrent:null,ariaDescribedBy:Ae,ariaDetails:null,ariaDisabled:at,ariaDropEffect:Ae,ariaErrorMessage:null,ariaExpanded:at,ariaFlowTo:Ae,ariaGrabbed:at,ariaHasPopup:null,ariaHidden:at,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ae,ariaLevel:U,ariaLive:null,ariaModal:at,ariaMultiLine:at,ariaMultiSelectable:at,ariaOrientation:null,ariaOwns:Ae,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:at,ariaReadOnly:at,ariaRelevant:null,ariaRequired:at,ariaRoleDescription:Ae,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:at,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}})});function Ed(e,t){return t in e?e[t]:t}var Vg=I(()=>{"use strict"});function Rd(e,t){return Ed(e,t.toLowerCase())}var Gg=I(()=>{"use strict";Vg()});var g1,y1=I(()=>{"use strict";Gg();bo();Ds();g1=_a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kr,acceptCharset:Ae,accessKey:Ae,action:null,allow:null,allowFullScreen:oe,allowPaymentRequest:oe,allowUserMedia:oe,alt:null,as:null,async:oe,autoCapitalize:null,autoComplete:Ae,autoFocus:oe,autoPlay:oe,blocking:Ae,capture:null,charSet:null,checked:oe,cite:null,className:Ae,cols:U,colSpan:null,content:null,contentEditable:at,controls:oe,controlsList:Ae,coords:U|kr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oe,defer:oe,dir:null,dirName:null,disabled:oe,download:Ad,draggable:at,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oe,formTarget:null,headers:Ae,height:U,hidden:Ad,high:U,href:null,hrefLang:null,htmlFor:Ae,httpEquiv:Ae,id:null,imageSizes:null,imageSrcSet:null,inert:oe,inputMode:null,integrity:null,is:null,isMap:oe,itemId:null,itemProp:Ae,itemRef:Ae,itemScope:oe,itemType:Ae,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oe,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:oe,muted:oe,name:null,nonce:null,noModule:oe,noValidate:oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oe,optimum:U,pattern:null,ping:Ae,placeholder:null,playsInline:oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oe,referrerPolicy:null,rel:Ae,required:oe,reversed:oe,rows:U,rowSpan:U,sandbox:Ae,scope:null,scoped:oe,seamless:oe,selected:oe,shadowRootClonable:oe,shadowRootDelegatesFocus:oe,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:at,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:oe,useMap:null,value:at,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ae,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oe,declare:oe,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:oe,noHref:oe,noShade:oe,noWrap:oe,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:at,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:oe,disableRemotePlayback:oe,prefix:null,property:null,results:U,security:null,unselectable:null},space:"html",transform:Rd})});var x1,v1=I(()=>{"use strict";Vg();bo();Ds();x1=_a({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:aa,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:Ae,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kr,g2:kr,glyphName:kr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:aa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:U,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ae,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:aa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:aa,rev:aa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:aa,requiredFeatures:aa,requiredFonts:aa,requiredFormats:aa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:aa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:aa,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:aa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ed})});var Wg,w1=I(()=>{"use strict";bo();Wg=_a({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}})});var $g,b1=I(()=>{"use strict";bo();Gg();$g=_a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Rd})});var Xg,S1=I(()=>{"use strict";bo();Xg=_a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}})});var Zg,C1=I(()=>{"use strict";Zg={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"}});function Qg(e,t){let a=Es(t),n=t,r=kt;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&gB.test(t)){if(t.charAt(4)==="-"){let o=t.slice(5).replace(I1,xB);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=t.slice(4);if(!I1.test(o)){let l=o.replace(hB,yB);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}r=wo}return new r(n,t)}function yB(e){return"-"+e.toLowerCase()}function xB(e){return e.charAt(1).toUpperCase()}var hB,I1,gB,L1=I(()=>{"use strict";Hg();qg();zg();hB=/[A-Z]/g,I1=/-[a-z]/g,gB=/^data[-\w.:]+$/i});var k1,Dd,T1=I(()=>{"use strict";p1();h1();y1();v1();w1();b1();S1();C1();L1();k1=Ug([jg,g1,Wg,$g,Xg],"html"),Dd=Ug([jg,x1,Wg,$g,Xg],"svg")});function M1(e){return e.join(" ").trim()}var A1=I(()=>{"use strict"});var P1=Ot((Z$,O1)=>{"use strict";var E1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,vB=/\n/g,wB=/^\s*/,bB=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,SB=/^:\s*/,CB=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,IB=/^[;\s]*/,LB=/^\s+|\s+$/g,kB=`
42
+ `,R1="/",D1="*",So="",TB="comment",MB="declaration";function AB(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var a=1,n=1;function r(y){var v=y.match(vB);v&&(a+=v.length);var S=y.lastIndexOf(kB);n=~S?y.length-S:n+y.length}function o(){var y={line:a,column:n};return function(v){return v.position=new l(y),u(),v}}function l(y){this.start=y,this.end={line:a,column:n},this.source=t.source}l.prototype.content=e;function i(y){var v=new Error(t.source+":"+a+":"+n+": "+y);if(v.reason=y,v.filename=t.source,v.line=a,v.column=n,v.source=e,!t.silent)throw v}function s(y){var v=y.exec(e);if(v){var S=v[0];return r(S),e=e.slice(S.length),v}}function u(){s(wB)}function c(y){var v;for(y=y||[];v=d();)v!==!1&&y.push(v);return y}function d(){var y=o();if(!(R1!=e.charAt(0)||D1!=e.charAt(1))){for(var v=2;So!=e.charAt(v)&&(D1!=e.charAt(v)||R1!=e.charAt(v+1));)++v;if(v+=2,So===e.charAt(v-1))return i("End of comment missing");var S=e.slice(2,v-2);return n+=2,r(S),e=e.slice(v),n+=2,y({type:TB,comment:S})}}function f(){var y=o(),v=s(bB);if(v){if(d(),!s(SB))return i("property missing ':'");var S=s(CB),g=y({type:MB,property:_1(v[0].replace(E1,So)),value:S?_1(S[0].replace(E1,So)):So});return s(IB),g}}function p(){var y=[];c(y);for(var v;v=f();)v!==!1&&(y.push(v),c(y));return y}return u(),p()}function _1(e){return e?e.replace(LB,So):So}O1.exports=AB});var N1=Ot(_s=>{"use strict";var EB=_s&&_s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_s,"__esModule",{value:!0});_s.default=DB;var RB=EB(P1());function DB(e,t){let a=null;if(!e||typeof e!="string")return a;let n=(0,RB.default)(e),r=typeof t=="function";return n.forEach(o=>{if(o.type!=="declaration")return;let{property:l,value:i}=o;r?t(l,i,o):i&&(a=a||{},a[l]=i)}),a}});var U1=Ot(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.camelCase=void 0;var _B=/^--[a-zA-Z0-9_-]+$/,OB=/-([a-z])/g,PB=/^[^-]+$/,NB=/^-(webkit|moz|ms|o|khtml)-/,BB=/^-(ms)-/,UB=function(e){return!e||PB.test(e)||_B.test(e)},zB=function(e,t){return t.toUpperCase()},B1=function(e,t){return"".concat(t,"-")},qB=function(e,t){return t===void 0&&(t={}),UB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(BB,B1):e=e.replace(NB,B1),e.replace(OB,zB))};_d.camelCase=qB});var q1=Ot((Yg,z1)=>{"use strict";var FB=Yg&&Yg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},HB=FB(N1()),jB=U1();function Kg(e,t){var a={};return!e||typeof e!="string"||(0,HB.default)(e,function(n,r){n&&r&&(a[(0,jB.camelCase)(n,t)]=r)}),a}Kg.default=Kg;z1.exports=Kg});function Tr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?F1(e.position):"start"in e||"end"in e?F1(e):"line"in e||"column"in e?Jg(e):""}function Jg(e){return H1(e&&e.line)+":"+H1(e&&e.column)}function F1(e){return Jg(e&&e.start)+"-"+Jg(e&&e.end)}function H1(e){return e&&typeof e=="number"?e:1}var j1=I(()=>{"use strict"});var ey=I(()=>{"use strict";j1()});var ut,V1=I(()=>{"use strict";ey();ut=class extends Error{constructor(t,a,n){super(),typeof a=="string"&&(n=a,a=void 0);let r="",o={},l=!1;if(a&&("line"in a&&"column"in a?o={place:a}:"start"in a&&"end"in a?o={place:a}:"type"in a?o={ancestors:[a],place:a.position}:o={...a}),typeof t=="string"?r=t:!o.cause&&t&&(l=!0,r=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof n=="string"){let s=n.indexOf(":");s===-1?o.ruleId=n:(o.source=n.slice(0,s),o.ruleId=n.slice(s+1))}if(!o.place&&o.ancestors&&o.ancestors){let s=o.ancestors[o.ancestors.length-1];s&&(o.place=s.position)}let i=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=i?i.line:void 0,this.name=Tr(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};ut.prototype.file="";ut.prototype.name="";ut.prototype.reason="";ut.prototype.message="";ut.prototype.stack="";ut.prototype.column=void 0;ut.prototype.line=void 0;ut.prototype.ancestors=void 0;ut.prototype.cause=void 0;ut.prototype.fatal=void 0;ut.prototype.place=void 0;ut.prototype.ruleId=void 0;ut.prototype.source=void 0});var ty=I(()=>{"use strict";V1()});function ny(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let a=t.filePath||void 0,n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=t4(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=e4(a,t.jsx,t.jsxs)}let r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Dd:k1,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=$1(r,e,void 0);return o&&typeof o!="string"?o:r.create(e,r.Fragment,{children:o||void 0},void 0)}function $1(e,t,a){if(t.type==="element")return XB(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ZB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return KB(e,t,a);if(t.type==="mdxjsEsm")return QB(e,t);if(t.type==="root")return YB(e,t,a);if(t.type==="text")return JB(e,t)}function XB(e,t,a){let n=e.schema,r=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=Dd,e.schema=r),e.ancestors.push(t);let o=Z1(e,t.tagName,!1),l=a4(e,t),i=oy(e,t);return WB.has(t.tagName)&&(i=i.filter(function(s){return typeof s=="string"?!Ng(s):!0})),X1(e,l,o,t),ry(l,i),e.ancestors.pop(),e.schema=n,e.create(t,o,l,a)}function ZB(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Os(e,t.position)}function QB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Os(e,t.position)}function KB(e,t,a){let n=e.schema,r=n;t.name==="svg"&&n.space==="html"&&(r=Dd,e.schema=r),e.ancestors.push(t);let o=t.name===null?e.Fragment:Z1(e,t.name,!0),l=n4(e,t),i=oy(e,t);return X1(e,l,o,t),ry(l,i),e.ancestors.pop(),e.schema=n,e.create(t,o,l,a)}function YB(e,t,a){let n={};return ry(n,oy(e,t)),e.create(t,e.Fragment,n,a)}function JB(e,t){return t.value}function X1(e,t,a,n){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=n)}function ry(e,t){if(t.length>0){let a=t.length>1?t:t[0];a&&(e.children=a)}}function e4(e,t,a){return n;function n(r,o,l,i){let u=Array.isArray(l.children)?a:t;return i?u(o,l,i):u(o,l)}}function t4(e,t){return a;function a(n,r,o,l){let i=Array.isArray(o.children),s=Rl(n);return t(r,o,l,i,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function a4(e,t){let a={},n,r;for(r in t.properties)if(r!=="children"&&ay.call(t.properties,r)){let o=r4(e,r,t.properties[r]);if(o){let[l,i]=o;e.tableCellAlignToStyle&&l==="align"&&typeof i=="string"&&$B.has(t.tagName)?n=i:a[l]=i}}if(n){let o=a.style||(a.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return a}function n4(e,t){let a={};for(let n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){let o=n.data.estree.body[0];o.type;let l=o.expression;l.type;let i=l.properties[0];i.type,Object.assign(a,e.evaluater.evaluateExpression(i.argument))}else Os(e,t.position);else{let r=n.name,o;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){let i=n.value.data.estree.body[0];i.type,o=e.evaluater.evaluateExpression(i.expression)}else Os(e,t.position);else o=n.value===null?!0:n.value;a[r]=o}return a}function oy(e,t){let a=[],n=-1,r=e.passKeys?new Map:VB;for(;++n<t.children.length;){let o=t.children[n],l;if(e.passKeys){let s=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(s){let u=r.get(s)||0;l=s+"-"+u,r.set(s,u+1)}}let i=$1(e,o,l);i!==void 0&&a.push(i)}return a}function r4(e,t,a){let n=Qg(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=n.commaSeparated?l1(a):M1(a)),n.property==="style"){let r=typeof a=="object"?a:o4(e,String(a));return e.stylePropertyNameCase==="css"&&(r=l4(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&n.space?Zg[n.property]||n.property:n.attribute,a]}}function o4(e,t){try{return(0,G1.default)(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};let n=a,r=new ut("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=W1+"#cannot-parse-style-attribute",r}}function Z1(e,t,a){let n;if(!a)n={type:"Literal",value:t};else if(t.includes(".")){let r=t.split("."),o=-1,l;for(;++o<r.length;){let i=Md(r[o])?{type:"Identifier",name:r[o]}:{type:"Literal",value:r[o]};l=l?{type:"MemberExpression",object:l,property:i,computed:!!(o&&i.type==="Literal"),optional:!1}:i}n=l}else n=Md(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){let r=n.value;return ay.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(n);Os(e)}function Os(e,t){let a=new ut("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=W1+"#cannot-handle-mdx-estrees-without-createevaluater",a}function l4(e){let t={},a;for(a in e)ay.call(e,a)&&(t[i4(a)]=e[a]);return t}function i4(e){let t=e.replace(GB,s4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function s4(e){return"-"+e.toLowerCase()}var G1,ay,VB,GB,WB,$B,W1,Q1=I(()=>{"use strict";i1();u1();f1();T1();A1();G1=q(q1(),1);bs();ty();ay={}.hasOwnProperty,VB=new Map,GB=/[A-Z]/g,WB=new Set(["table","tbody","thead","tfoot","tr"]),$B=new Set(["td","th"]),W1="https://github.com/syntax-tree/hast-util-to-jsx-runtime"});var K1=I(()=>{"use strict";Q1()});function u4(e){let t=e.attempt(this.parser.constructs.contentInitial,n,r),a;return t;function n(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),X(e,t,"linePrefix")}function r(i){return e.enter("paragraph"),o(i)}function o(i){let s=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=s),a=s,l(i)}function l(i){if(i===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(i);return}return H(i)?(e.consume(i),e.exit("chunkText"),o):(e.consume(i),l)}}var Y1,J1=I(()=>{"use strict";st();ye();Y1={tokenize:u4}});function c4(e){let t=this,a=[],n=0,r,o,l;return i;function i(m){if(n<a.length){let w=a[n];return t.containerState=w[1],e.attempt(w[0].continuation,s,u)(m)}return u(m)}function s(m){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&x();let w=t.events.length,L=w,b;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){b=t.events[L][1].end;break}g(n);let A=w;for(;A<t.events.length;)t.events[A][1].end={...b},A++;return it(t.events,L+1,0,t.events.slice(w)),t.events.length=A,u(m)}return i(m)}function u(m){if(n===a.length){if(!r)return f(m);if(r.currentConstruct&&r.currentConstruct.concrete)return y(m);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ek,c,d)(m)}function c(m){return r&&x(),g(n),f(m)}function d(m){return t.parser.lazy[t.now().line]=n!==a.length,l=t.now().offset,y(m)}function f(m){return t.containerState={},e.attempt(ek,p,y)(m)}function p(m){return n++,a.push([t.currentConstruct,t.containerState]),f(m)}function y(m){if(m===null){r&&x(),g(0),e.consume(m);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:o}),v(m)}function v(m){if(m===null){S(e.exit("chunkFlow"),!0),g(0),e.consume(m);return}return H(m)?(e.consume(m),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,i):(e.consume(m),v)}function S(m,w){let L=t.sliceStream(m);if(w&&L.push(null),m.previous=o,o&&(o.next=m),o=m,r.defineSkip(m.start),r.write(L),t.parser.lazy[m.start.line]){let b=r.events.length;for(;b--;)if(r.events[b][1].start.offset<l&&(!r.events[b][1].end||r.events[b][1].end.offset>l))return;let A=t.events.length,R=A,_,T;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(_){T=t.events[R][1].end;break}_=!0}for(g(n),b=A;b<t.events.length;)t.events[b][1].end={...T},b++;it(t.events,R+1,0,t.events.slice(A)),t.events.length=b}}function g(m){let w=a.length;for(;w-- >m;){let L=a[w];t.containerState=L[1],L[0].exit.call(t,e)}a.length=m}function x(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}function d4(e,t,a){return X(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var tk,ek,ak=I(()=>{"use strict";st();ye();Nn();tk={tokenize:c4},ek={tokenize:d4}});function f4(e){let t=this,a=e.attempt(nn,n,e.attempt(this.parser.constructs.flowInitial,r,X(e,e.attempt(this.parser.constructs.flow,r,e.attempt(gg,r)),"linePrefix")));return a;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,a}}var nk,rk=I(()=>{"use strict";Sd();st();nk={tokenize:f4}});function sk(e){return{resolveAll:uk(e==="text"?p4:void 0),tokenize:t};function t(a){let n=this,r=this.parser.constructs[e],o=a.attempt(r,l,i);return l;function l(c){return u(c)?o(c):i(c)}function i(c){if(c===null){a.consume(c);return}return a.enter("data"),a.consume(c),s}function s(c){return u(c)?(a.exit("data"),o(c)):(a.consume(c),s)}function u(c){if(c===null)return!0;let d=r[c],f=-1;if(d)for(;++f<d.length;){let p=d[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function uk(e){return t;function t(a,n){let r=-1,o;for(;++r<=a.length;)o===void 0?a[r]&&a[r][1].type==="data"&&(o=r,r++):(!a[r]||a[r][1].type!=="data")&&(r!==o+2&&(a[o][1].end=a[r-1][1].end,a.splice(o+2,r-o-2),r=o+2),o=void 0);return e?e(a,n):a}}function p4(e,t){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){let n=e[a-1][1],r=t.sliceStream(n),o=r.length,l=-1,i=0,s;for(;o--;){let u=r[o];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)i++,l--;if(l)break;l=-1}else if(u===-2)s=!0,i++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(i=0),i){let u={type:a===e.length||s||i<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:n.start._bufferIndex+l,_index:n.start._index+o,line:n.end.line,column:n.end.column-i,offset:n.end.offset-i},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(e.splice(a,0,["enter",u,t],["exit",u,t]),a+=2)}a++}return e}var ok,lk,ik,ly=I(()=>{"use strict";ok={resolveAll:uk()},lk=sk("string"),ik=sk("text")});var iy={};ru(iy,{attentionMarkers:()=>b4,contentInitial:()=>h4,disable:()=>S4,document:()=>m4,flow:()=>y4,flowInitial:()=>g4,insideSpan:()=>w4,string:()=>x4,text:()=>v4});var m4,h4,g4,y4,x4,v4,w4,b4,S4,ck=I(()=>{"use strict";Sd();ly();m4={42:Bt,43:Bt,45:Bt,48:Bt,49:Bt,50:Bt,51:Bt,52:Bt,53:Bt,54:Bt,55:Bt,56:Bt,57:Bt,62:dd},h4={91:bg},g4={[-2]:Ts,[-1]:Ts,32:Ts},y4={35:Cg,42:yo,45:[bd,yo],60:Lg,61:bd,95:yo,96:md,126:md},x4={38:pd,92:fd},v4={[-5]:As,[-4]:As,[-3]:As,33:Tg,38:pd,42:ks,60:[pg,kg],91:Mg,92:[Sg,fd],93:go,95:ks,96:mg},w4={null:[ks,ok]},b4={null:[42,95]},S4={null:[]}});function dk(e,t,a){let n={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0},r={},o=[],l=[],i=[],s=!0,u={attempt:_(A),check:_(R),consume:w,enter:L,exit:b,interrupt:_(R,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:S,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:p},d=t.tokenize.call(c,u),f;return t.resolveAll&&o.push(t),c;function p(B){return l=Vt(l,B),x(),l[l.length-1]!==null?[]:(T(t,0),c.events=Ir(o,c.events,c),c.events)}function y(B,j){return I4(v(B),j)}function v(B){return C4(l,B)}function S(){let{_bufferIndex:B,_index:j,line:V,column:F,offset:te}=n;return{_bufferIndex:B,_index:j,line:V,column:F,offset:te}}function g(B){r[B.line]=B.column,N()}function x(){let B;for(;n._index<l.length;){let j=l[n._index];if(typeof j=="string")for(B=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===B&&n._bufferIndex<j.length;)m(j.charCodeAt(n._bufferIndex));else m(j)}}function m(B){s=void 0,f=B,d=d(B)}function w(B){H(B)?(n.line++,n.column=1,n.offset+=B===-3?2:1,N()):B!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===l[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=B,s=!0}function L(B,j){let V=j||{};return V.type=B,V.start=S(),c.events.push(["enter",V,c]),i.push(V),V}function b(B){let j=i.pop();return j.end=S(),c.events.push(["exit",j,c]),j}function A(B,j){T(B,j.from)}function R(B,j){j.restore()}function _(B,j){return V;function V(F,te,$e){let Z,C,Xe,le;return Array.isArray(F)?Ze(F):"tokenize"in F?Ze([F]):k(F);function k(Q){return ke;function ke(se){let Se=se!==null&&Q[se],Le=se!==null&&Q.null,Fe=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return Ze(Fe)(se)}}function Ze(Q){return Z=Q,C=0,Q.length===0?$e:Ue(Q[C])}function Ue(Q){return ke;function ke(se){return le=D(),Xe=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?G(se):Q.tokenize.call(j?Object.assign(Object.create(c),j):c,u,Hn,G)(se)}}function Hn(Q){return s=!0,B(Xe,le),te}function G(Q){return s=!0,le.restore(),++C<Z.length?Ue(Z[C]):$e}}}function T(B,j){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&it(c.events,j,c.events.length-j,B.resolve(c.events.slice(j),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function D(){let B=S(),j=c.previous,V=c.currentConstruct,F=c.events.length,te=Array.from(i);return{from:F,restore:$e};function $e(){n=B,c.previous=j,c.currentConstruct=V,c.events.length=F,i=te,N()}}function N(){n.line in r&&n.column<2&&(n.column=r[n.line],n.offset+=r[n.line]-1)}}function C4(e,t){let a=t.start._index,n=t.start._bufferIndex,r=t.end._index,o=t.end._bufferIndex,l;if(a===r)l=[e[a].slice(n,o)];else{if(l=e.slice(a,r),n>-1){let i=l[0];typeof i=="string"?l[0]=i.slice(n):l.shift()}o>0&&l.push(e[r].slice(0,o))}return l}function I4(e,t){let a=-1,n=[],r;for(;++a<e.length;){let o=e[a],l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
43
43
  `;break}case-3:{l=`\r
44
- `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&r)continue;l=" ";break}default:l=String.fromCharCode(o)}r=o===-2,n.push(l)}return n.join("")}var fk=I(()=>{"use strict";ye();Nn();Ls()});function sy(e){let n={constructs:ud([iy,...(e||{}).extensions||[]]),content:r(YL),defined:[],document:r(tk),flow:r(nk),lazy:{},string:r(lk),text:r(ik)};return n;function r(o){return l;function l(i){return dk(n,o,i)}}}var pk=I(()=>{"use strict";ug();JL();ak();rk();ly();ck();fk()});function uy(e){for(;!gd(e););return e}var mk=I(()=>{"use strict";hg()});function cy(){let e=1,t="",a=!0,n;return r;function r(o,l,i){let s=[],u,c,d,f,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),d=0,t="",a&&(o.charCodeAt(0)===65279&&d++,a=void 0);d<o.length;){if(hk.lastIndex=d,u=hk.exec(o),f=u&&u.index!==void 0?u.index:o.length,p=o.charCodeAt(f),!u){t=o.slice(d);break}if(p===10&&d===f&&n)s.push(-3),n=void 0;else switch(n&&(s.push(-5),n=void 0),d<f&&(s.push(o.slice(d,f)),e+=f-d),p){case 0:{s.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,s.push(-2);e++<c;)s.push(-1);break}case 10:{s.push(-4),e=1;break}default:n=!0,e=1}d=f+1}return i&&(n&&s.push(-5),t&&s.push(t),s.push(null)),s}}var hk,gk=I(()=>{"use strict";hk=/[\0\t\n\r]/g});var yk=I(()=>{"use strict";pk();mk();gk()});function dy(e,t,a){return typeof t!="string"&&(a=t,t=void 0),L4(a)(uy(sy(a).document().write(cy()(e,t,!0))))}function L4(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Pr),autolinkProtocol:_,autolinkEmail:_,atxHeading:o(zt),blockQuote:o(se),characterEscape:_,characterReference:_,codeFenced:o(Se),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Se,l),codeText:o(Le,l),codeTextData:_,data:_,codeFlowValue:_,definition:o(Fe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(St),hardBreakEscape:o(un),hardBreakTrailing:o(un),htmlFlow:o(cn,l),htmlFlowData:_,htmlText:o(cn,l),htmlTextData:_,image:o(Mo),label:l,link:o(Pr),listItem:o(P2),listItemValue:f,listOrdered:o(vx,d),listUnordered:o(vx),paragraph:o(N2),reference:k,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(zt),strong:o(B2),thematicBreak:o(z2)},exit:{atxHeading:s(),atxHeadingSequence:L,autolink:s(),autolinkEmail:ke,autolinkProtocol:Q,blockQuote:s(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ue,characterReferenceMarkerNumeric:Ue,characterReferenceValue:Hn,characterReference:G,codeFenced:s(S),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:T,codeIndented:s(g),codeText:s(V),codeTextData:T,data:T,definition:s(),definitionDestinationString:w,definitionLabelString:x,definitionTitleString:m,emphasis:s(),hardBreakEscape:s(N),hardBreakTrailing:s(N),htmlFlow:s(B),htmlFlowData:T,htmlText:s(j),htmlTextData:T,image:s(te),label:Z,labelText:$e,lineEnding:D,link:s(F),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:Ze,resourceDestinationString:C,resourceTitleString:Xe,resource:le,setextHeading:s(R),setextHeadingLineSequence:A,setextHeadingText:b,strong:s(),thematicBreak:s()}};wk(t,(e||{}).mdastExtensions||[]);let a={};return n;function n(O){let z={type:"root",children:[]},ne={stack:[z],tokenStack:[],config:t,enter:i,exit:u,buffer:l,resume:c,data:a},me=[],Pe=-1;for(;++Pe<O.length;)if(O[Pe][1].type==="listOrdered"||O[Pe][1].type==="listUnordered")if(O[Pe][0]==="enter")me.push(Pe);else{let Ua=me.pop();Pe=r(O,Ua,Pe)}for(Pe=-1;++Pe<O.length;){let Ua=t[O[Pe][0]];vk.call(Ua,O[Pe][1].type)&&Ua[O[Pe][1].type].call(Object.assign({sliceSerialize:O[Pe][2].sliceSerialize},ne),O[Pe][1])}if(ne.tokenStack.length>0){let Ua=ne.tokenStack[ne.tokenStack.length-1];(Ua[1]||xk).call(ne,void 0,Ua[0])}for(z.position={start:Mr(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Mr(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)z=t.transforms[Pe](z)||z;return z}function r(O,z,ne){let me=z-1,Pe=-1,Ua=!1,Nr,dn,ai,ni;for(;++me<=ne;){let la=O[me];switch(la[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{la[0]==="enter"?Pe++:Pe--,ni=void 0;break}case"lineEndingBlank":{la[0]==="enter"&&(Nr&&!ni&&!Pe&&!ai&&(ai=me),ni=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ni=void 0}if(!Pe&&la[0]==="enter"&&la[1].type==="listItemPrefix"||Pe===-1&&la[0]==="exit"&&(la[1].type==="listUnordered"||la[1].type==="listOrdered")){if(Nr){let Ao=me;for(dn=void 0;Ao--;){let fn=O[Ao];if(fn[1].type==="lineEnding"||fn[1].type==="lineEndingBlank"){if(fn[0]==="exit")continue;dn&&(O[dn][1].type="lineEndingBlank",Ua=!0),fn[1].type="lineEnding",dn=Ao}else if(!(fn[1].type==="linePrefix"||fn[1].type==="blockQuotePrefix"||fn[1].type==="blockQuotePrefixWhitespace"||fn[1].type==="blockQuoteMarker"||fn[1].type==="listItemIndent"))break}ai&&(!dn||ai<dn)&&(Nr._spread=!0),Nr.end=Object.assign({},dn?O[dn][1].start:la[1].end),O.splice(dn||me,0,["exit",Nr,la[2]]),me++,ne++}if(la[1].type==="listItemPrefix"){let Ao={type:"listItem",_spread:!1,start:Object.assign({},la[1].start),end:void 0};Nr=Ao,O.splice(me,0,["enter",Ao,la[2]]),me++,ne++,ai=void 0,ni=!0}}}return O[z][1]._spread=Ua,ne}function o(O,z){return ne;function ne(me){i.call(this,O(me),me),z&&z.call(this,me)}}function l(){this.stack.push({type:"fragment",children:[]})}function i(O,z,ne){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([z,ne||void 0]),O.position={start:Mr(z.start),end:void 0}}function s(O){return z;function z(ne){O&&O.call(this,ne),u.call(this,ne)}}function u(O,z){let ne=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==O.type&&(z?z.call(this,O,me[0]):(me[1]||xk).call(this,O,me[0]));else throw new Error("Cannot close `"+O.type+"` ("+Tr({start:O.start,end:O.end})+"): it\u2019s not open");ne.position.end=Mr(O.end)}function c(){return fo(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(O){if(this.data.expectingFirstListItemValue){let z=this.stack[this.stack.length-2];z.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),z=this.stack[this.stack.length-1];z.lang=O}function y(){let O=this.resume(),z=this.stack[this.stack.length-1];z.meta=O}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O.replace(/(\r?\n|\r)$/g,"")}function x(O){let z=this.resume(),ne=this.stack[this.stack.length-1];ne.label=z,ne.identifier=Nt(this.sliceSerialize(O)).toLowerCase()}function m(){let O=this.resume(),z=this.stack[this.stack.length-1];z.title=O}function w(){let O=this.resume(),z=this.stack[this.stack.length-1];z.url=O}function L(O){let z=this.stack[this.stack.length-1];if(!z.depth){let ne=this.sliceSerialize(O).length;z.depth=ne}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function A(O){let z=this.stack[this.stack.length-1];z.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function _(O){let ne=this.stack[this.stack.length-1].children,me=ne[ne.length-1];(!me||me.type!=="text")&&(me=U2(),me.position={start:Mr(O.start),end:void 0},ne.push(me)),this.stack.push(me)}function T(O){let z=this.stack.pop();z.value+=this.sliceSerialize(O),z.position.end=Mr(O.end)}function D(O){let z=this.stack[this.stack.length-1];if(this.data.atHardBreak){let ne=z.children[z.children.length-1];ne.position.end=Mr(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(z.type)&&(_.call(this,O),T.call(this,O))}function N(){this.data.atHardBreak=!0}function B(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O}function j(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O}function V(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O}function F(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let z=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=z,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function te(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let z=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=z,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function $e(O){let z=this.sliceSerialize(O),ne=this.stack[this.stack.length-2];ne.label=zI(z),ne.identifier=Nt(z).toLowerCase()}function Z(){let O=this.stack[this.stack.length-1],z=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){let me=O.children;ne.children=me}else ne.alt=z}function C(){let O=this.resume(),z=this.stack[this.stack.length-1];z.url=O}function Xe(){let O=this.resume(),z=this.stack[this.stack.length-1];z.title=O}function le(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function Ze(O){let z=this.resume(),ne=this.stack[this.stack.length-1];ne.label=z,ne.identifier=Nt(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function Ue(O){this.data.characterReferenceType=O.type}function Hn(O){let z=this.sliceSerialize(O),ne=this.data.characterReferenceType,me;ne?(me=sd(z,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Nl(z);let Pe=this.stack[this.stack.length-1];Pe.value+=me}function G(O){let z=this.stack.pop();z.position.end=Mr(O.end)}function Q(O){T.call(this,O);let z=this.stack[this.stack.length-1];z.url=this.sliceSerialize(O)}function ke(O){T.call(this,O);let z=this.stack[this.stack.length-1];z.url="mailto:"+this.sliceSerialize(O)}function se(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Le(){return{type:"inlineCode",value:""}}function Fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function St(){return{type:"emphasis",children:[]}}function zt(){return{type:"heading",depth:0,children:[]}}function un(){return{type:"break"}}function cn(){return{type:"html",value:""}}function Mo(){return{type:"image",title:null,url:"",alt:null}}function Pr(){return{type:"link",title:null,url:"",children:[]}}function vx(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function P2(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function N2(){return{type:"paragraph",children:[]}}function B2(){return{type:"strong",children:[]}}function U2(){return{type:"text",value:""}}function z2(){return{type:"thematicBreak"}}}function Mr(e){return{line:e.line,column:e.column,offset:e.offset}}function wk(e,t){let a=-1;for(;++a<t.length;){let n=t[a];Array.isArray(n)?wk(e,n):k4(e,n)}}function k4(e,t){let a;for(a in t)if(vk.call(t,a))switch(a){case"canContainEols":{let n=t[a];n&&e[a].push(...n);break}case"transforms":{let n=t[a];n&&e[a].push(...n);break}case"enter":case"exit":{let n=t[a];n&&Object.assign(e[a],n);break}}}function xk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Tr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Tr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Tr({start:t.start,end:t.end})+") is still open")}var vk,bk=I(()=>{"use strict";rd();yk();eg();qI();Dl();id();ey();vk={}.hasOwnProperty});var Sk=I(()=>{"use strict";bk()});function Od(e){let t=this;t.parser=a;function a(n){return dy(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}var Ck=I(()=>{"use strict";Sk()});var Ik=I(()=>{"use strict";Ck()});function Lk(e,t){let a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,a),e.applyData(t,a)}var kk=I(()=>{"use strict"});function Tk(e,t){let a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,a),[e.applyData(t,a),{type:"text",value:`
44
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&r)continue;l=" ";break}default:l=String.fromCharCode(o)}r=o===-2,n.push(l)}return n.join("")}var fk=I(()=>{"use strict";ye();Nn();Ls()});function sy(e){let n={constructs:ud([iy,...(e||{}).extensions||[]]),content:r(Y1),defined:[],document:r(tk),flow:r(nk),lazy:{},string:r(lk),text:r(ik)};return n;function r(o){return l;function l(i){return dk(n,o,i)}}}var pk=I(()=>{"use strict";ug();J1();ak();rk();ly();ck();fk()});function uy(e){for(;!gd(e););return e}var mk=I(()=>{"use strict";hg()});function cy(){let e=1,t="",a=!0,n;return r;function r(o,l,i){let s=[],u,c,d,f,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),d=0,t="",a&&(o.charCodeAt(0)===65279&&d++,a=void 0);d<o.length;){if(hk.lastIndex=d,u=hk.exec(o),f=u&&u.index!==void 0?u.index:o.length,p=o.charCodeAt(f),!u){t=o.slice(d);break}if(p===10&&d===f&&n)s.push(-3),n=void 0;else switch(n&&(s.push(-5),n=void 0),d<f&&(s.push(o.slice(d,f)),e+=f-d),p){case 0:{s.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,s.push(-2);e++<c;)s.push(-1);break}case 10:{s.push(-4),e=1;break}default:n=!0,e=1}d=f+1}return i&&(n&&s.push(-5),t&&s.push(t),s.push(null)),s}}var hk,gk=I(()=>{"use strict";hk=/[\0\t\n\r]/g});var yk=I(()=>{"use strict";pk();mk();gk()});function dy(e,t,a){return typeof t!="string"&&(a=t,t=void 0),L4(a)(uy(sy(a).document().write(cy()(e,t,!0))))}function L4(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Pr),autolinkProtocol:_,autolinkEmail:_,atxHeading:o(zt),blockQuote:o(se),characterEscape:_,characterReference:_,codeFenced:o(Se),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Se,l),codeText:o(Le,l),codeTextData:_,data:_,codeFlowValue:_,definition:o(Fe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(St),hardBreakEscape:o(un),hardBreakTrailing:o(un),htmlFlow:o(cn,l),htmlFlowData:_,htmlText:o(cn,l),htmlTextData:_,image:o(Mo),label:l,link:o(Pr),listItem:o(P2),listItemValue:f,listOrdered:o(vx,d),listUnordered:o(vx),paragraph:o(N2),reference:k,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(zt),strong:o(B2),thematicBreak:o(z2)},exit:{atxHeading:s(),atxHeadingSequence:L,autolink:s(),autolinkEmail:ke,autolinkProtocol:Q,blockQuote:s(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ue,characterReferenceMarkerNumeric:Ue,characterReferenceValue:Hn,characterReference:G,codeFenced:s(S),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:T,codeIndented:s(g),codeText:s(V),codeTextData:T,data:T,definition:s(),definitionDestinationString:w,definitionLabelString:x,definitionTitleString:m,emphasis:s(),hardBreakEscape:s(N),hardBreakTrailing:s(N),htmlFlow:s(B),htmlFlowData:T,htmlText:s(j),htmlTextData:T,image:s(te),label:Z,labelText:$e,lineEnding:D,link:s(F),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:Ze,resourceDestinationString:C,resourceTitleString:Xe,resource:le,setextHeading:s(R),setextHeadingLineSequence:A,setextHeadingText:b,strong:s(),thematicBreak:s()}};wk(t,(e||{}).mdastExtensions||[]);let a={};return n;function n(O){let z={type:"root",children:[]},ne={stack:[z],tokenStack:[],config:t,enter:i,exit:u,buffer:l,resume:c,data:a},me=[],Pe=-1;for(;++Pe<O.length;)if(O[Pe][1].type==="listOrdered"||O[Pe][1].type==="listUnordered")if(O[Pe][0]==="enter")me.push(Pe);else{let Ua=me.pop();Pe=r(O,Ua,Pe)}for(Pe=-1;++Pe<O.length;){let Ua=t[O[Pe][0]];vk.call(Ua,O[Pe][1].type)&&Ua[O[Pe][1].type].call(Object.assign({sliceSerialize:O[Pe][2].sliceSerialize},ne),O[Pe][1])}if(ne.tokenStack.length>0){let Ua=ne.tokenStack[ne.tokenStack.length-1];(Ua[1]||xk).call(ne,void 0,Ua[0])}for(z.position={start:Mr(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Mr(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)z=t.transforms[Pe](z)||z;return z}function r(O,z,ne){let me=z-1,Pe=-1,Ua=!1,Nr,dn,ai,ni;for(;++me<=ne;){let la=O[me];switch(la[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{la[0]==="enter"?Pe++:Pe--,ni=void 0;break}case"lineEndingBlank":{la[0]==="enter"&&(Nr&&!ni&&!Pe&&!ai&&(ai=me),ni=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ni=void 0}if(!Pe&&la[0]==="enter"&&la[1].type==="listItemPrefix"||Pe===-1&&la[0]==="exit"&&(la[1].type==="listUnordered"||la[1].type==="listOrdered")){if(Nr){let Ao=me;for(dn=void 0;Ao--;){let fn=O[Ao];if(fn[1].type==="lineEnding"||fn[1].type==="lineEndingBlank"){if(fn[0]==="exit")continue;dn&&(O[dn][1].type="lineEndingBlank",Ua=!0),fn[1].type="lineEnding",dn=Ao}else if(!(fn[1].type==="linePrefix"||fn[1].type==="blockQuotePrefix"||fn[1].type==="blockQuotePrefixWhitespace"||fn[1].type==="blockQuoteMarker"||fn[1].type==="listItemIndent"))break}ai&&(!dn||ai<dn)&&(Nr._spread=!0),Nr.end=Object.assign({},dn?O[dn][1].start:la[1].end),O.splice(dn||me,0,["exit",Nr,la[2]]),me++,ne++}if(la[1].type==="listItemPrefix"){let Ao={type:"listItem",_spread:!1,start:Object.assign({},la[1].start),end:void 0};Nr=Ao,O.splice(me,0,["enter",Ao,la[2]]),me++,ne++,ai=void 0,ni=!0}}}return O[z][1]._spread=Ua,ne}function o(O,z){return ne;function ne(me){i.call(this,O(me),me),z&&z.call(this,me)}}function l(){this.stack.push({type:"fragment",children:[]})}function i(O,z,ne){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([z,ne||void 0]),O.position={start:Mr(z.start),end:void 0}}function s(O){return z;function z(ne){O&&O.call(this,ne),u.call(this,ne)}}function u(O,z){let ne=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==O.type&&(z?z.call(this,O,me[0]):(me[1]||xk).call(this,O,me[0]));else throw new Error("Cannot close `"+O.type+"` ("+Tr({start:O.start,end:O.end})+"): it\u2019s not open");ne.position.end=Mr(O.end)}function c(){return fo(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(O){if(this.data.expectingFirstListItemValue){let z=this.stack[this.stack.length-2];z.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),z=this.stack[this.stack.length-1];z.lang=O}function y(){let O=this.resume(),z=this.stack[this.stack.length-1];z.meta=O}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O.replace(/(\r?\n|\r)$/g,"")}function x(O){let z=this.resume(),ne=this.stack[this.stack.length-1];ne.label=z,ne.identifier=Nt(this.sliceSerialize(O)).toLowerCase()}function m(){let O=this.resume(),z=this.stack[this.stack.length-1];z.title=O}function w(){let O=this.resume(),z=this.stack[this.stack.length-1];z.url=O}function L(O){let z=this.stack[this.stack.length-1];if(!z.depth){let ne=this.sliceSerialize(O).length;z.depth=ne}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function A(O){let z=this.stack[this.stack.length-1];z.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function _(O){let ne=this.stack[this.stack.length-1].children,me=ne[ne.length-1];(!me||me.type!=="text")&&(me=U2(),me.position={start:Mr(O.start),end:void 0},ne.push(me)),this.stack.push(me)}function T(O){let z=this.stack.pop();z.value+=this.sliceSerialize(O),z.position.end=Mr(O.end)}function D(O){let z=this.stack[this.stack.length-1];if(this.data.atHardBreak){let ne=z.children[z.children.length-1];ne.position.end=Mr(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(z.type)&&(_.call(this,O),T.call(this,O))}function N(){this.data.atHardBreak=!0}function B(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O}function j(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O}function V(){let O=this.resume(),z=this.stack[this.stack.length-1];z.value=O}function F(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let z=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=z,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function te(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let z=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=z,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function $e(O){let z=this.sliceSerialize(O),ne=this.stack[this.stack.length-2];ne.label=zI(z),ne.identifier=Nt(z).toLowerCase()}function Z(){let O=this.stack[this.stack.length-1],z=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){let me=O.children;ne.children=me}else ne.alt=z}function C(){let O=this.resume(),z=this.stack[this.stack.length-1];z.url=O}function Xe(){let O=this.resume(),z=this.stack[this.stack.length-1];z.title=O}function le(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function Ze(O){let z=this.resume(),ne=this.stack[this.stack.length-1];ne.label=z,ne.identifier=Nt(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function Ue(O){this.data.characterReferenceType=O.type}function Hn(O){let z=this.sliceSerialize(O),ne=this.data.characterReferenceType,me;ne?(me=sd(z,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Nl(z);let Pe=this.stack[this.stack.length-1];Pe.value+=me}function G(O){let z=this.stack.pop();z.position.end=Mr(O.end)}function Q(O){T.call(this,O);let z=this.stack[this.stack.length-1];z.url=this.sliceSerialize(O)}function ke(O){T.call(this,O);let z=this.stack[this.stack.length-1];z.url="mailto:"+this.sliceSerialize(O)}function se(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Le(){return{type:"inlineCode",value:""}}function Fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function St(){return{type:"emphasis",children:[]}}function zt(){return{type:"heading",depth:0,children:[]}}function un(){return{type:"break"}}function cn(){return{type:"html",value:""}}function Mo(){return{type:"image",title:null,url:"",alt:null}}function Pr(){return{type:"link",title:null,url:"",children:[]}}function vx(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function P2(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function N2(){return{type:"paragraph",children:[]}}function B2(){return{type:"strong",children:[]}}function U2(){return{type:"text",value:""}}function z2(){return{type:"thematicBreak"}}}function Mr(e){return{line:e.line,column:e.column,offset:e.offset}}function wk(e,t){let a=-1;for(;++a<t.length;){let n=t[a];Array.isArray(n)?wk(e,n):k4(e,n)}}function k4(e,t){let a;for(a in t)if(vk.call(t,a))switch(a){case"canContainEols":{let n=t[a];n&&e[a].push(...n);break}case"transforms":{let n=t[a];n&&e[a].push(...n);break}case"enter":case"exit":{let n=t[a];n&&Object.assign(e[a],n);break}}}function xk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Tr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Tr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Tr({start:t.start,end:t.end})+") is still open")}var vk,bk=I(()=>{"use strict";rd();yk();eg();qI();Dl();id();ey();vk={}.hasOwnProperty});var Sk=I(()=>{"use strict";bk()});function Od(e){let t=this;t.parser=a;function a(n){return dy(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}var Ck=I(()=>{"use strict";Sk()});var Ik=I(()=>{"use strict";Ck()});function Lk(e,t){let a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,a),e.applyData(t,a)}var kk=I(()=>{"use strict"});function Tk(e,t){let a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,a),[e.applyData(t,a),{type:"text",value:`
45
45
  `}]}var Mk=I(()=>{"use strict"});function Ak(e,t){let a=t.value?t.value+`
46
46
  `:"",n={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(n.className=["language-"+r[0]]);let o={type:"element",tagName:"code",properties:n,children:[{type:"text",value:a}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}var Ek=I(()=>{"use strict"});function Rk(e,t){let a={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}var Dk=I(()=>{"use strict"});function _k(e,t){let a={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}var Ok=I(()=>{"use strict"});function Pk(e,t){let a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),r=Da(n.toLowerCase()),o=e.footnoteOrder.indexOf(n),l,i=e.footnoteCounts.get(n);i===void 0?(i=0,e.footnoteOrder.push(n),l=e.footnoteOrder.length):l=o+1,i+=1,e.footnoteCounts.set(n,i);let s={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+r,id:a+"fnref-"+r+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,s);let u={type:"element",tagName:"sup",properties:{},children:[s]};return e.patch(t,u),e.applyData(t,u)}var Nk=I(()=>{"use strict";mo()});function Bk(e,t){let a={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}var Uk=I(()=>{"use strict"});function zk(e,t){if(e.options.allowDangerousHtml){let a={type:"raw",value:t.value};return e.patch(t,a),e.applyData(t,a)}}var qk=I(()=>{"use strict"});function Pd(e,t){let a=t.referenceType,n="]";if(a==="collapsed"?n+="[]":a==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];let r=e.all(t),o=r[0];o&&o.type==="text"?o.value="["+o.value:r.unshift({type:"text",value:"["});let l=r[r.length-1];return l&&l.type==="text"?l.value+=n:r.push({type:"text",value:n}),r}var fy=I(()=>{"use strict"});function Fk(e,t){let a=String(t.identifier).toUpperCase(),n=e.definitionById.get(a);if(!n)return Pd(e,t);let r={src:Da(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(r.title=n.title);let o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,o),e.applyData(t,o)}var Hk=I(()=>{"use strict";mo();fy()});function jk(e,t){let a={src:Da(t.url)};t.alt!==null&&t.alt!==void 0&&(a.alt=t.alt),t.title!==null&&t.title!==void 0&&(a.title=t.title);let n={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,n),e.applyData(t,n)}var Vk=I(()=>{"use strict";mo()});function Gk(e,t){let a={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,a);let n={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(t,n),e.applyData(t,n)}var Wk=I(()=>{"use strict"});function $k(e,t){let a=String(t.identifier).toUpperCase(),n=e.definitionById.get(a);if(!n)return Pd(e,t);let r={href:Da(n.url||"")};n.title!==null&&n.title!==void 0&&(r.title=n.title);let o={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}var Xk=I(()=>{"use strict";mo();fy()});function Zk(e,t){let a={href:Da(t.url)};t.title!==null&&t.title!==void 0&&(a.title=t.title);let n={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Qk=I(()=>{"use strict";mo()});function Kk(e,t,a){let n=e.all(t),r=a?T4(a):Yk(t),o={},l=[];if(typeof t.checked=="boolean"){let c=n[0],d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let i=-1;for(;++i<n.length;){let c=n[i];(r||i!==0||c.type!=="element"||c.tagName!=="p")&&l.push({type:"text",value:`
47
47
  `}),c.type==="element"&&c.tagName==="p"&&!r?l.push(...c.children):l.push(c)}let s=n[n.length-1];s&&(r||s.type!=="element"||s.tagName!=="p")&&l.push({type:"text",value:`
@@ -110,7 +110,7 @@ ${e}</tr>
110
110
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),a=e.header?"th":"td";return(e.align?`<${a} align="${e.align}">`:`<${a}>`)+t+`</${a}>
111
111
  `}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>${zn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:a}){let n=this.parser.parseInline(a),r=uM(e);if(r===null)return n;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+zn(t)+'"'),o+=">"+n+"</a>",o}image({href:e,title:t,text:a,tokens:n}){n&&(a=this.parser.parseInline(n,this.parser.textRenderer));let r=uM(e);if(r===null)return zn(a);e=r;let o=`<img src="${e}" alt="${a}"`;return t&&(o+=` title="${zn(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:zn(e.text)}},Ny=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""}checkbox({raw:e}){return e}},ja=class Ty{constructor(t){ve(this,"options");ve(this,"renderer");ve(this,"textRenderer");this.options=t||Io,this.options.renderer=this.options.renderer||new Wd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ny}static parse(t,a){return new Ty(a).parse(t)}static parseInline(t,a){return new Ty(a).parseInline(t)}parse(t){let a="";for(let n=0;n<t.length;n++){let r=t[n];if(this.options.extensions?.renderers?.[r.type]){let l=r,i=this.options.extensions.renderers[l.type].call({parser:this},l);if(i!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){a+=i||"";continue}}let o=r;switch(o.type){case"space":{a+=this.renderer.space(o);break}case"hr":{a+=this.renderer.hr(o);break}case"heading":{a+=this.renderer.heading(o);break}case"code":{a+=this.renderer.code(o);break}case"table":{a+=this.renderer.table(o);break}case"blockquote":{a+=this.renderer.blockquote(o);break}case"list":{a+=this.renderer.list(o);break}case"checkbox":{a+=this.renderer.checkbox(o);break}case"html":{a+=this.renderer.html(o);break}case"def":{a+=this.renderer.def(o);break}case"paragraph":{a+=this.renderer.paragraph(o);break}case"text":{a+=this.renderer.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return a}parseInline(t,a=this.renderer){let n="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=i||"";continue}}let l=o;switch(l.type){case"escape":{n+=a.text(l);break}case"html":{n+=a.html(l);break}case"link":{n+=a.link(l);break}case"image":{n+=a.image(l);break}case"checkbox":{n+=a.checkbox(l);break}case"strong":{n+=a.strong(l);break}case"em":{n+=a.em(l);break}case"codespan":{n+=a.codespan(l);break}case"br":{n+=a.br(l);break}case"del":{n+=a.del(l);break}case"text":{n+=a.text(l);break}default:{let i='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}},qs=(jd=class{constructor(e){ve(this,"options");ve(this,"block");this.options=e||Io}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?xa.lex:xa.lexInline}provideParser(){return this.block?ja.parse:ja.parseInline}},ve(jd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ve(jd,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),jd),EU=class{constructor(...e){ve(this,"defaults",My());ve(this,"options",this.setOptions);ve(this,"parse",this.parseMarkdown(!0));ve(this,"parseInline",this.parseMarkdown(!1));ve(this,"Parser",ja);ve(this,"Renderer",Wd);ve(this,"TextRenderer",Ny);ve(this,"Lexer",xa);ve(this,"Tokenizer",Gd);ve(this,"Hooks",qs);this.use(...e)}walkTokens(e,t){let a=[];for(let n of e)switch(a=a.concat(t.call(this,n)),n.type){case"table":{let r=n;for(let o of r.header)a=a.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let l of o)a=a.concat(this.walkTokens(l.tokens,t));break}case"list":{let r=n;a=a.concat(this.walkTokens(r.items,t));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let l=r[o].flat(1/0);a=a.concat(this.walkTokens(l,t))}):r.tokens&&(a=a.concat(this.walkTokens(r.tokens,t)))}}return a}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(a=>{let n={...a};if(n.async=this.defaults.async||n.async||!1,a.extensions&&(a.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...l){let i=r.renderer.apply(this,l);return i===!1&&(i=o.apply(this,l)),i}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),n.extensions=t),a.renderer){let r=this.defaults.renderer||new Wd(this.defaults);for(let o in a.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let l=o,i=a.renderer[l],s=r[l];r[l]=(...u)=>{let c=i.apply(r,u);return c===!1&&(c=s.apply(r,u)),c||""}}n.renderer=r}if(a.tokenizer){let r=this.defaults.tokenizer||new Gd(this.defaults);for(let o in a.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let l=o,i=a.tokenizer[l],s=r[l];r[l]=(...u)=>{let c=i.apply(r,u);return c===!1&&(c=s.apply(r,u)),c}}n.tokenizer=r}if(a.hooks){let r=this.defaults.hooks||new qs;for(let o in a.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let l=o,i=a.hooks[l],s=r[l];qs.passThroughHooks.has(o)?r[l]=u=>{if(this.defaults.async&&qs.passThroughHooksRespectAsync.has(o))return(async()=>{let d=await i.call(r,u);return s.call(r,d)})();let c=i.call(r,u);return s.call(r,c)}:r[l]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await i.apply(r,u);return d===!1&&(d=await s.apply(r,u)),d})();let c=i.apply(r,u);return c===!1&&(c=s.apply(r,u)),c}}n.hooks=r}if(a.walkTokens){let r=this.defaults.walkTokens,o=a.walkTokens;n.walkTokens=function(l){let i=[];return i.push(o.call(this,l)),r&&(i=i.concat(r.call(this,l))),i}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return xa.lex(e,t??this.defaults)}parser(e,t){return ja.parse(e,t??this.defaults)}parseMarkdown(e){return(t,a)=>{let n={...a},r={...this.defaults,...n},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return o(new 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(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let l=r.hooks?await r.hooks.preprocess(t):t,i=await(r.hooks?await r.hooks.provideLexer():e?xa.lex:xa.lexInline)(l,r),s=r.hooks?await r.hooks.processAllTokens(i):i;r.walkTokens&&await Promise.all(this.walkTokens(s,r.walkTokens));let u=await(r.hooks?await r.hooks.provideParser():e?ja.parse:ja.parseInline)(s,r);return r.hooks?await r.hooks.postprocess(u):u})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let l=(r.hooks?r.hooks.provideLexer():e?xa.lex:xa.lexInline)(t,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let i=(r.hooks?r.hooks.provideParser():e?ja.parse:ja.parseInline)(l,r);return r.hooks&&(i=r.hooks.postprocess(i)),i}catch(l){return o(l)}}}onError(e,t){return a=>{if(a.message+=`
112
112
  Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+zn(a.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(a);throw a}}},Co=new EU;Oe.options=Oe.setOptions=function(e){return Co.setOptions(e),Oe.defaults=Co.defaults,fM(Oe.defaults),Oe};Oe.getDefaults=My;Oe.defaults=Io;Oe.use=function(...e){return Co.use(...e),Oe.defaults=Co.defaults,fM(Oe.defaults),Oe};Oe.walkTokens=function(e,t){return Co.walkTokens(e,t)};Oe.parseInline=Co.parseInline;Oe.Parser=ja;Oe.parser=ja.parse;Oe.Renderer=Wd;Oe.TextRenderer=Ny;Oe.Lexer=xa;Oe.lexer=xa.lex;Oe.Tokenizer=Gd;Oe.Hooks=qs;Oe.parse=Oe;tK=Oe.options,aK=Oe.setOptions,nK=Oe.use,rK=Oe.walkTokens,oK=Oe.parseInline,lK=ja.parse,iK=xa.lex});var IM={};ru(IM,{CodeBlock:()=>PU});var Va,na,RU,DU,_U,OU,PU,LM=I(()=>{"use strict";"use client";Zd();Va=q(xe(),1),na=q(ee(),1),RU=Y("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),DU=(0,Va.memo)(({children:e,result:t,language:a,className:n,...r})=>{let o=(0,Va.useMemo)(()=>({backgroundColor:t.bg,color:t.fg}),[t.bg,t.fg]);return(0,na.jsx)("pre",{className:Y(n,"p-4 text-sm dark:bg-(--shiki-dark-bg)!"),"data-language":a,"data-streamdown":"code-block-body",style:o,...r,children:(0,na.jsx)("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:t.tokens.map((l,i)=>(0,na.jsx)("span",{className:RU,children:l.map((s,u)=>(0,na.jsx)("span",{className:"dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!",style:{color:s.color,backgroundColor:s.bgColor,...s.htmlStyle},...s.htmlAttrs,children:s.content},u))},i))})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className),_U=({className:e,language:t,style:a,...n})=>(0,na.jsx)("div",{className:Y("my-4 w-full overflow-hidden rounded-xl border border-border",e),"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...a},...n}),OU=({language:e,children:t})=>(0,na.jsxs)("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":e,"data-streamdown":"code-block-header",children:[(0,na.jsx)("span",{className:"ml-1 font-mono lowercase",children:e}),(0,na.jsx)("div",{className:"flex items-center gap-2",children:t})]}),PU=({code:e,language:t,className:a,children:n,...r})=>{let{shikiTheme:o}=(0,Va.useContext)(Wt),l=kM(),i=(0,Va.useMemo)(()=>({bg:"transparent",fg:"inherit",tokens:e.split(`
113
- `).map(c=>[{content:c,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[e]),[s,u]=(0,Va.useState)(i);return(0,Va.useEffect)(()=>{if(!l){u(i);return}let c=l.highlight({code:e,language:t,themes:o},d=>{u(d)});if(c){u(c);return}u(i)},[e,t,o,l,i]),(0,na.jsx)(By.Provider,{value:{code:e},children:(0,na.jsxs)(_U,{language:t,children:[(0,na.jsx)(OU,{language:t,children:n}),(0,na.jsx)(DU,{className:a,language:t,result:s,...r})]})})}});var TM={};ru(TM,{Mermaid:()=>Uy});var MM=I(()=>{"use strict";"use client";Zd()});function zU(e={}){let{immediate:t=!1,debounceDelay:a=NU,rootMargin:n=BU,idleTimeout:r=UU}=e,[o,l]=(0,E.useState)(!1),i=(0,E.useRef)(null),s=(0,E.useRef)(null),u=(0,E.useRef)(null),c=(0,E.useMemo)(()=>p=>{let y=Date.now();return window.setTimeout(()=>{p({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-y))})},1)},[]),d=(0,E.useMemo)(()=>typeof window<"u"&&window.requestIdleCallback?(p,y)=>window.requestIdleCallback(p,y):c,[c]),f=(0,E.useMemo)(()=>typeof window<"u"&&window.cancelIdleCallback?p=>window.cancelIdleCallback(p):p=>{clearTimeout(p)},[]);return(0,E.useEffect)(()=>{if(t){l(!0);return}let p=i.current;if(!p)return;s.current&&(clearTimeout(s.current),s.current=null),u.current&&(f(u.current),u.current=null);let y=()=>{s.current&&(clearTimeout(s.current),s.current=null),u.current&&(f(u.current),u.current=null)},v=m=>{u.current=d(w=>{w.timeRemaining()>0||w.didTimeout?(l(!0),m.disconnect()):u.current=d(()=>{l(!0),m.disconnect()},{timeout:r/2})},{timeout:r})},S=m=>{y(),s.current=window.setTimeout(()=>{var w,L;let b=m.takeRecords();(b.length===0||(L=(w=b.at(-1))==null?void 0:w.isIntersecting)!=null&&L)&&v(m)},a)},g=(m,w)=>{m.isIntersecting?S(w):y()},x=new IntersectionObserver(m=>{for(let w of m)g(w,x)},{rootMargin:n,threshold:0});return x.observe(p),()=>{s.current&&clearTimeout(s.current),u.current&&f(u.current),x.disconnect()}},[t,a,n,r,f,d]),{shouldRender:o,containerRef:i}}function Jd(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let a=e.position.start,n=t.position.start,r=e.position.end,o=t.position.end;return a?.line===n?.line&&a?.column===n?.column&&r?.line===o?.line&&r?.column===o?.column}function nt(e,t){return e.className===t.className&&Jd(e.node,t.node)}var E,M,NU,BU,UU,Vy,Gy,Yd,qU,FU,HU,NM,AM,jU,VU,Y,ql,By,BM,EM,RM,GU,DM,WU,$U,js,XU,ZU,QU,Hy,UM,kM,Wy,KU,YU,Vs,JU,ez,tz,zM,qM,az,zy,nz,rz,oz,lz,iz,sz,uz,jy,Qd,$y,FM,HM,jM,VM,cz,GM,WM,$M,XM,ZM,QM,KM,YM,JM,eA,tA,aA,nA,rA,oA,lA,iA,dz,sA,uA,cA,fz,_M,OM,Kd,pz,PM,dA,mz,hz,gz,yz,xz,vz,wz,qy,bz,Fy,fA,pA,mA,Sz,Cz,Iz,Lz,Wt,Xy,kz,ef,Tz,Uy,Zd=I(()=>{"use strict";"use client";E=q(xe(),1);GC();$C();f0();G1();oL();M=q(ee(),1);gh();xh();KL();Ik();RT();oM();CM();NU=300,BU="300px",UU=500;Vy=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),Gy=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),Yd=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),qU=e=>(0,M.jsxs)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[(0,M.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),FU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),HU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),NM=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),AM=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),jU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),VU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),Y=(...e)=>yh(Fc(e)),ql=(e,t,a)=>{let n=typeof t=="string"?new Blob([t],{type:a}):t,r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)},By=(0,E.createContext)({code:""}),BM=()=>(0,E.useContext)(By),EM=({onCopy:e,onError:t,timeout:a=2e3,children:n,className:r,code:o,...l})=>{let[i,s]=(0,E.useState)(!1),u=(0,E.useRef)(0),{code:c}=BM(),{isAnimating:d}=(0,E.useContext)(Wt),f=o??c,p=async()=>{var v;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.writeText)){t?.(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(f),s(!0),e?.(),u.current=window.setTimeout(()=>s(!1),a))}catch(S){t?.(S)}};(0,E.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let y=i?Vy:Gy;return(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:d,onClick:p,title:"Copy Code",type:"button",...l,children:n??(0,M.jsx)(y,{size:14})})},RM={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},GU=({onDownload:e,onError:t,language:a,children:n,className:r,code:o,...l})=>{let{code:i}=BM(),{isAnimating:s}=(0,E.useContext)(Wt),u=o??i,c=`file.${a&&a in RM?RM[a]:"txt"}`,d="text/plain",f=()=>{try{ql(c,u,d),e?.()}catch(p){t?.(p)}};return(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:s,onClick:f,title:"Download file",type:"button",...l,children:n??(0,M.jsx)(Yd,{size:14})})},DM=()=>(0,M.jsxs)("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[(0,M.jsx)("div",{className:"h-[46px] w-full bg-muted/80"}),(0,M.jsx)("div",{className:"flex w-full items-center justify-center p-4",children:(0,M.jsx)(qU,{className:"size-4 animate-spin"})})]}),WU=/\.[^/.]+$/,$U=({node:e,className:t,src:a,alt:n,...r})=>{let o=async()=>{if(a)try{let l=await(await fetch(a)).blob(),i=new URL(a,window.location.origin).pathname.split("/").pop()||"",s=i.split(".").pop(),u=i.includes(".")&&s!==void 0&&s.length<=4,c="";if(u)c=i;else{let d=l.type,f="png";d.includes("jpeg")||d.includes("jpg")?f="jpg":d.includes("png")?f="png":d.includes("svg")?f="svg":d.includes("gif")?f="gif":d.includes("webp")&&(f="webp"),c=`${(n||i||"image").replace(WU,"")}.${f}`}ql(c,l,l.type)}catch{window.open(a,"_blank")}};return a?(0,M.jsxs)("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[(0,M.jsx)("img",{alt:n,className:Y("max-w-full rounded-lg",t),"data-streamdown":"image",src:a,...r}),(0,M.jsx)("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),(0,M.jsx)("button",{className:Y("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:o,title:"Download image",type:"button",children:(0,M.jsx)(Yd,{size:14})})]}):null},js=0,XU=()=>{js+=1,js===1&&(document.body.style.overflow="hidden")},ZU=()=>{js=Math.max(0,js-1),js===0&&(document.body.style.overflow="")},QU=({url:e,isOpen:t,onClose:a,onConfirm:n})=>{let[r,o]=(0,E.useState)(!1),l=(0,E.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),i=(0,E.useCallback)(()=>{n(),a()},[n,a]);return(0,E.useEffect)(()=>{if(t){XU();let s=u=>{u.key==="Escape"&&a()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),ZU()}}},[t,a]),t?(0,M.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm","data-streamdown":"link-safety-modal",onClick:a,onKeyDown:s=>{s.key==="Escape"&&a()},role:"button",tabIndex:0,children:(0,M.jsxs)("div",{className:"relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg",onClick:s=>s.stopPropagation(),onKeyDown:s=>s.stopPropagation(),role:"presentation",children:[(0,M.jsx)("button",{className:"absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:a,title:"Close",type:"button",children:(0,M.jsx)(NM,{size:16})}),(0,M.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,M.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-lg",children:[(0,M.jsx)(AM,{size:20}),(0,M.jsx)("span",{children:"Open external link?"})]}),(0,M.jsx)("p",{className:"text-muted-foreground text-sm",children:"You're about to visit an external website."})]}),(0,M.jsx)("div",{className:Y("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),(0,M.jsxs)("div",{className:"flex gap-2",children:[(0,M.jsx)("button",{className:"flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted",onClick:l,type:"button",children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Vy,{size:14}),(0,M.jsx)("span",{children:"Copied"})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Gy,{size:14}),(0,M.jsx)("span",{children:"Copy link"})]})}),(0,M.jsxs)("button",{className:"flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90",onClick:i,type:"button",children:[(0,M.jsx)(AM,{size:14}),(0,M.jsx)("span",{children:"Open link"})]})]})]})}):null},Hy=(0,E.createContext)(null),UM=()=>(0,E.useContext)(Hy),kM=()=>{var e;let t=UM();return(e=t?.code)!=null?e:null},Wy=()=>{var e;let t=UM();return(e=t?.mermaid)!=null?e:null},KU=(e,t)=>{var a;let n=(a=void 0)!=null?a:5;return new Promise((r,o)=>{let l="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{let s=document.createElement("canvas"),u=i.width*n,c=i.height*n;s.width=u,s.height=c;let d=s.getContext("2d");if(!d){o(new Error("Failed to create 2D canvas context for PNG export"));return}d.drawImage(i,0,0,u,c),s.toBlob(f=>{if(!f){o(new Error("Failed to create PNG blob"));return}r(f)},"image/png")},i.onerror=()=>o(new Error("Failed to load SVG image")),i.src=l})},YU=({chart:e,children:t,className:a,onDownload:n,config:r,onError:o})=>{let[l,i]=(0,E.useState)(!1),s=(0,E.useRef)(null),{isAnimating:u}=(0,E.useContext)(Wt),c=Wy(),d=async f=>{try{if(f==="mmd"){ql("diagram.mmd",e,"text/plain"),i(!1),n?.(f);return}if(!c){o?.(new Error("Mermaid plugin not available"));return}let p=c.getMermaid(r),y=e.split("").reduce((g,x)=>(g<<5)-g+x.charCodeAt(0)|0,0),v=`mermaid-${Math.abs(y)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:S}=await p.render(v,e);if(!S){o?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(f==="svg"){ql("diagram.svg",S,"image/svg+xml"),i(!1),n?.(f);return}if(f==="png"){let g=await KU(S);ql("diagram.png",g,"image/png"),n?.(f),i(!1);return}}catch(p){o?.(p)}};return(0,E.useEffect)(()=>{let f=p=>{let y=p.composedPath();s.current&&!y.includes(s.current)&&i(!1)};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[]),(0,M.jsxs)("div",{className:"relative",ref:s,children:[(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",a),disabled:u,onClick:()=>i(!l),title:"Download diagram",type:"button",children:t??(0,M.jsx)(Yd,{size:14})}),l?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]}):null]})},Vs=0,JU=()=>{Vs+=1,Vs===1&&(document.body.style.overflow="hidden")},ez=()=>{Vs=Math.max(0,Vs-1),Vs===0&&(document.body.style.overflow="")},tz=({chart:e,config:t,onFullscreen:a,onExit:n,className:r,...o})=>{let[l,i]=(0,E.useState)(!1),{isAnimating:s,controls:u}=(0,E.useContext)(Wt),c=(()=>{if(typeof u=="boolean")return u;let f=u.mermaid;return f===!1?!1:f===!0||f===void 0?!0:f.panZoom!==!1})(),d=()=>{i(!l)};return(0,E.useEffect)(()=>{if(l){JU();let f=p=>{p.key==="Escape"&&i(!1)};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f),ez()}}},[l]),(0,E.useEffect)(()=>{l?a?.():n&&n()},[l,a,n]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:s,onClick:d,title:"View fullscreen",type:"button",...o,children:(0,M.jsx)(FU,{size:14})}),l?(0,M.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:d,onKeyDown:f=>{f.key==="Escape"&&d()},role:"button",tabIndex:0,children:[(0,M.jsx)("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:d,title:"Exit fullscreen",type:"button",children:(0,M.jsx)(NM,{size:20})}),(0,M.jsx)("div",{className:"flex size-full items-center justify-center p-4",onClick:f=>f.stopPropagation(),onKeyDown:f=>f.stopPropagation(),role:"presentation",children:(0,M.jsx)(Uy,{chart:e,className:"size-full [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:!0,showControls:c})})]}):null]})},zM=e=>{var t,a;let n=[],r=[],o=e.querySelectorAll("thead th");for(let i of o)n.push(((t=i.textContent)==null?void 0:t.trim())||"");let l=e.querySelectorAll("tbody tr");for(let i of l){let s=[],u=i.querySelectorAll("td");for(let c of u)s.push(((a=c.textContent)==null?void 0:a.trim())||"");r.push(s)}return{headers:n,rows:r}},qM=e=>{let{headers:t,rows:a}=e,n=i=>{let s=!1,u=!1;for(let c of i){if(c==='"'){s=!0,u=!0;break}(c===","||c===`
113
+ `).map(c=>[{content:c,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[e]),[s,u]=(0,Va.useState)(i);return(0,Va.useEffect)(()=>{if(!l){u(i);return}let c=l.highlight({code:e,language:t,themes:o},d=>{u(d)});if(c){u(c);return}u(i)},[e,t,o,l,i]),(0,na.jsx)(By.Provider,{value:{code:e},children:(0,na.jsxs)(_U,{language:t,children:[(0,na.jsx)(OU,{language:t,children:n}),(0,na.jsx)(DU,{className:a,language:t,result:s,...r})]})})}});var TM={};ru(TM,{Mermaid:()=>Uy});var MM=I(()=>{"use strict";"use client";Zd()});function zU(e={}){let{immediate:t=!1,debounceDelay:a=NU,rootMargin:n=BU,idleTimeout:r=UU}=e,[o,l]=(0,E.useState)(!1),i=(0,E.useRef)(null),s=(0,E.useRef)(null),u=(0,E.useRef)(null),c=(0,E.useMemo)(()=>p=>{let y=Date.now();return window.setTimeout(()=>{p({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-y))})},1)},[]),d=(0,E.useMemo)(()=>typeof window<"u"&&window.requestIdleCallback?(p,y)=>window.requestIdleCallback(p,y):c,[c]),f=(0,E.useMemo)(()=>typeof window<"u"&&window.cancelIdleCallback?p=>window.cancelIdleCallback(p):p=>{clearTimeout(p)},[]);return(0,E.useEffect)(()=>{if(t){l(!0);return}let p=i.current;if(!p)return;s.current&&(clearTimeout(s.current),s.current=null),u.current&&(f(u.current),u.current=null);let y=()=>{s.current&&(clearTimeout(s.current),s.current=null),u.current&&(f(u.current),u.current=null)},v=m=>{u.current=d(w=>{w.timeRemaining()>0||w.didTimeout?(l(!0),m.disconnect()):u.current=d(()=>{l(!0),m.disconnect()},{timeout:r/2})},{timeout:r})},S=m=>{y(),s.current=window.setTimeout(()=>{var w,L;let b=m.takeRecords();(b.length===0||(L=(w=b.at(-1))==null?void 0:w.isIntersecting)!=null&&L)&&v(m)},a)},g=(m,w)=>{m.isIntersecting?S(w):y()},x=new IntersectionObserver(m=>{for(let w of m)g(w,x)},{rootMargin:n,threshold:0});return x.observe(p),()=>{s.current&&clearTimeout(s.current),u.current&&f(u.current),x.disconnect()}},[t,a,n,r,f,d]),{shouldRender:o,containerRef:i}}function Jd(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let a=e.position.start,n=t.position.start,r=e.position.end,o=t.position.end;return a?.line===n?.line&&a?.column===n?.column&&r?.line===o?.line&&r?.column===o?.column}function nt(e,t){return e.className===t.className&&Jd(e.node,t.node)}var E,M,NU,BU,UU,Vy,Gy,Yd,qU,FU,HU,NM,AM,jU,VU,Y,ql,By,BM,EM,RM,GU,DM,WU,$U,js,XU,ZU,QU,Hy,UM,kM,Wy,KU,YU,Vs,JU,ez,tz,zM,qM,az,zy,nz,rz,oz,lz,iz,sz,uz,jy,Qd,$y,FM,HM,jM,VM,cz,GM,WM,$M,XM,ZM,QM,KM,YM,JM,eA,tA,aA,nA,rA,oA,lA,iA,dz,sA,uA,cA,fz,_M,OM,Kd,pz,PM,dA,mz,hz,gz,yz,xz,vz,wz,qy,bz,Fy,fA,pA,mA,Sz,Cz,Iz,Lz,Wt,Xy,kz,ef,Tz,Uy,Zd=I(()=>{"use strict";"use client";E=q(xe(),1);GC();$C();f0();GL();o1();M=q(ee(),1);gh();xh();K1();Ik();RT();oM();CM();NU=300,BU="300px",UU=500;Vy=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),Gy=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),Yd=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),qU=e=>(0,M.jsxs)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[(0,M.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),FU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),HU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),NM=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),AM=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),jU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),VU=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),Y=(...e)=>yh(Fc(e)),ql=(e,t,a)=>{let n=typeof t=="string"?new Blob([t],{type:a}):t,r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)},By=(0,E.createContext)({code:""}),BM=()=>(0,E.useContext)(By),EM=({onCopy:e,onError:t,timeout:a=2e3,children:n,className:r,code:o,...l})=>{let[i,s]=(0,E.useState)(!1),u=(0,E.useRef)(0),{code:c}=BM(),{isAnimating:d}=(0,E.useContext)(Wt),f=o??c,p=async()=>{var v;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.writeText)){t?.(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(f),s(!0),e?.(),u.current=window.setTimeout(()=>s(!1),a))}catch(S){t?.(S)}};(0,E.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let y=i?Vy:Gy;return(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:d,onClick:p,title:"Copy Code",type:"button",...l,children:n??(0,M.jsx)(y,{size:14})})},RM={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},GU=({onDownload:e,onError:t,language:a,children:n,className:r,code:o,...l})=>{let{code:i}=BM(),{isAnimating:s}=(0,E.useContext)(Wt),u=o??i,c=`file.${a&&a in RM?RM[a]:"txt"}`,d="text/plain",f=()=>{try{ql(c,u,d),e?.()}catch(p){t?.(p)}};return(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:s,onClick:f,title:"Download file",type:"button",...l,children:n??(0,M.jsx)(Yd,{size:14})})},DM=()=>(0,M.jsxs)("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[(0,M.jsx)("div",{className:"h-[46px] w-full bg-muted/80"}),(0,M.jsx)("div",{className:"flex w-full items-center justify-center p-4",children:(0,M.jsx)(qU,{className:"size-4 animate-spin"})})]}),WU=/\.[^/.]+$/,$U=({node:e,className:t,src:a,alt:n,...r})=>{let o=async()=>{if(a)try{let l=await(await fetch(a)).blob(),i=new URL(a,window.location.origin).pathname.split("/").pop()||"",s=i.split(".").pop(),u=i.includes(".")&&s!==void 0&&s.length<=4,c="";if(u)c=i;else{let d=l.type,f="png";d.includes("jpeg")||d.includes("jpg")?f="jpg":d.includes("png")?f="png":d.includes("svg")?f="svg":d.includes("gif")?f="gif":d.includes("webp")&&(f="webp"),c=`${(n||i||"image").replace(WU,"")}.${f}`}ql(c,l,l.type)}catch{window.open(a,"_blank")}};return a?(0,M.jsxs)("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[(0,M.jsx)("img",{alt:n,className:Y("max-w-full rounded-lg",t),"data-streamdown":"image",src:a,...r}),(0,M.jsx)("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),(0,M.jsx)("button",{className:Y("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:o,title:"Download image",type:"button",children:(0,M.jsx)(Yd,{size:14})})]}):null},js=0,XU=()=>{js+=1,js===1&&(document.body.style.overflow="hidden")},ZU=()=>{js=Math.max(0,js-1),js===0&&(document.body.style.overflow="")},QU=({url:e,isOpen:t,onClose:a,onConfirm:n})=>{let[r,o]=(0,E.useState)(!1),l=(0,E.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),i=(0,E.useCallback)(()=>{n(),a()},[n,a]);return(0,E.useEffect)(()=>{if(t){XU();let s=u=>{u.key==="Escape"&&a()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),ZU()}}},[t,a]),t?(0,M.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm","data-streamdown":"link-safety-modal",onClick:a,onKeyDown:s=>{s.key==="Escape"&&a()},role:"button",tabIndex:0,children:(0,M.jsxs)("div",{className:"relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg",onClick:s=>s.stopPropagation(),onKeyDown:s=>s.stopPropagation(),role:"presentation",children:[(0,M.jsx)("button",{className:"absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:a,title:"Close",type:"button",children:(0,M.jsx)(NM,{size:16})}),(0,M.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,M.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-lg",children:[(0,M.jsx)(AM,{size:20}),(0,M.jsx)("span",{children:"Open external link?"})]}),(0,M.jsx)("p",{className:"text-muted-foreground text-sm",children:"You're about to visit an external website."})]}),(0,M.jsx)("div",{className:Y("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),(0,M.jsxs)("div",{className:"flex gap-2",children:[(0,M.jsx)("button",{className:"flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted",onClick:l,type:"button",children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Vy,{size:14}),(0,M.jsx)("span",{children:"Copied"})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Gy,{size:14}),(0,M.jsx)("span",{children:"Copy link"})]})}),(0,M.jsxs)("button",{className:"flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90",onClick:i,type:"button",children:[(0,M.jsx)(AM,{size:14}),(0,M.jsx)("span",{children:"Open link"})]})]})]})}):null},Hy=(0,E.createContext)(null),UM=()=>(0,E.useContext)(Hy),kM=()=>{var e;let t=UM();return(e=t?.code)!=null?e:null},Wy=()=>{var e;let t=UM();return(e=t?.mermaid)!=null?e:null},KU=(e,t)=>{var a;let n=(a=void 0)!=null?a:5;return new Promise((r,o)=>{let l="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{let s=document.createElement("canvas"),u=i.width*n,c=i.height*n;s.width=u,s.height=c;let d=s.getContext("2d");if(!d){o(new Error("Failed to create 2D canvas context for PNG export"));return}d.drawImage(i,0,0,u,c),s.toBlob(f=>{if(!f){o(new Error("Failed to create PNG blob"));return}r(f)},"image/png")},i.onerror=()=>o(new Error("Failed to load SVG image")),i.src=l})},YU=({chart:e,children:t,className:a,onDownload:n,config:r,onError:o})=>{let[l,i]=(0,E.useState)(!1),s=(0,E.useRef)(null),{isAnimating:u}=(0,E.useContext)(Wt),c=Wy(),d=async f=>{try{if(f==="mmd"){ql("diagram.mmd",e,"text/plain"),i(!1),n?.(f);return}if(!c){o?.(new Error("Mermaid plugin not available"));return}let p=c.getMermaid(r),y=e.split("").reduce((g,x)=>(g<<5)-g+x.charCodeAt(0)|0,0),v=`mermaid-${Math.abs(y)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:S}=await p.render(v,e);if(!S){o?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(f==="svg"){ql("diagram.svg",S,"image/svg+xml"),i(!1),n?.(f);return}if(f==="png"){let g=await KU(S);ql("diagram.png",g,"image/png"),n?.(f),i(!1);return}}catch(p){o?.(p)}};return(0,E.useEffect)(()=>{let f=p=>{let y=p.composedPath();s.current&&!y.includes(s.current)&&i(!1)};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[]),(0,M.jsxs)("div",{className:"relative",ref:s,children:[(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",a),disabled:u,onClick:()=>i(!l),title:"Download diagram",type:"button",children:t??(0,M.jsx)(Yd,{size:14})}),l?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]}):null]})},Vs=0,JU=()=>{Vs+=1,Vs===1&&(document.body.style.overflow="hidden")},ez=()=>{Vs=Math.max(0,Vs-1),Vs===0&&(document.body.style.overflow="")},tz=({chart:e,config:t,onFullscreen:a,onExit:n,className:r,...o})=>{let[l,i]=(0,E.useState)(!1),{isAnimating:s,controls:u}=(0,E.useContext)(Wt),c=(()=>{if(typeof u=="boolean")return u;let f=u.mermaid;return f===!1?!1:f===!0||f===void 0?!0:f.panZoom!==!1})(),d=()=>{i(!l)};return(0,E.useEffect)(()=>{if(l){JU();let f=p=>{p.key==="Escape"&&i(!1)};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f),ez()}}},[l]),(0,E.useEffect)(()=>{l?a?.():n&&n()},[l,a,n]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:s,onClick:d,title:"View fullscreen",type:"button",...o,children:(0,M.jsx)(FU,{size:14})}),l?(0,M.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:d,onKeyDown:f=>{f.key==="Escape"&&d()},role:"button",tabIndex:0,children:[(0,M.jsx)("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:d,title:"Exit fullscreen",type:"button",children:(0,M.jsx)(NM,{size:20})}),(0,M.jsx)("div",{className:"flex size-full items-center justify-center p-4",onClick:f=>f.stopPropagation(),onKeyDown:f=>f.stopPropagation(),role:"presentation",children:(0,M.jsx)(Uy,{chart:e,className:"size-full [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:!0,showControls:c})})]}):null]})},zM=e=>{var t,a;let n=[],r=[],o=e.querySelectorAll("thead th");for(let i of o)n.push(((t=i.textContent)==null?void 0:t.trim())||"");let l=e.querySelectorAll("tbody tr");for(let i of l){let s=[],u=i.querySelectorAll("td");for(let c of u)s.push(((a=c.textContent)==null?void 0:a.trim())||"");r.push(s)}return{headers:n,rows:r}},qM=e=>{let{headers:t,rows:a}=e,n=i=>{let s=!1,u=!1;for(let c of i){if(c==='"'){s=!0,u=!0;break}(c===","||c===`
114
114
  `)&&(s=!0)}return s?u?`"${i.replace(/"/g,'""')}"`:`"${i}"`:i},r=t.length>0?a.length+1:a.length,o=new Array(r),l=0;t.length>0&&(o[l]=t.map(n).join(","),l+=1);for(let i of a)o[l]=i.map(n).join(","),l+=1;return o.join(`
115
115
  `)},az=e=>{let{headers:t,rows:a}=e,n=i=>{let s=!1;for(let c of i)if(c===" "||c===`
116
116
  `||c==="\r"){s=!0;break}if(!s)return i;let u=[];for(let c of i)c===" "?u.push("\\t"):c===`
@@ -118,7 +118,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
118
118
  `)},zy=e=>{let t=!1;for(let n of e)if(n==="\\"||n==="|"){t=!0;break}if(!t)return e;let a=[];for(let n of e)n==="\\"?a.push("\\\\"):n==="|"?a.push("\\|"):a.push(n);return a.join("")},nz=e=>{let{headers:t,rows:a}=e;if(t.length===0)return"";let n=new Array(a.length+2),r=0,o=t.map(i=>zy(i));n[r]=`| ${o.join(" | ")} |`,r+=1;let l=new Array(t.length);for(let i=0;i<t.length;i+=1)l[i]="---";n[r]=`| ${l.join(" | ")} |`,r+=1;for(let i of a)if(i.length<t.length){let s=new Array(t.length);for(let u=0;u<t.length;u+=1)s[u]=u<i.length?zy(i[u]):"";n[r]=`| ${s.join(" | ")} |`,r+=1}else{let s=i.map(u=>zy(u));n[r]=`| ${s.join(" | ")} |`,r+=1}return n.join(`
119
119
  `)},rz=({children:e,className:t,onCopy:a,onError:n,timeout:r=2e3})=>{let[o,l]=(0,E.useState)(!1),[i,s]=(0,E.useState)(!1),u=(0,E.useRef)(null),c=(0,E.useRef)(0),{isAnimating:d}=(0,E.useContext)(Wt),f=async y=>{var v,S;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.write)){n?.(new Error("Clipboard API not available"));return}try{let g=(S=u.current)==null?void 0:S.closest('[data-streamdown="table-wrapper"]'),x=g?.querySelector("table");if(!x){n?.(new Error("Table not found"));return}let m=zM(x),w=y==="csv"?qM(m):az(m),L=new ClipboardItem({"text/plain":new Blob([w],{type:"text/plain"}),"text/html":new Blob([x.outerHTML],{type:"text/html"})});await navigator.clipboard.write([L]),s(!0),l(!1),a?.(y),c.current=window.setTimeout(()=>s(!1),r)}catch(g){n?.(g)}};(0,E.useEffect)(()=>{let y=v=>{let S=v.composedPath();u.current&&!S.includes(u.current)&&l(!1)};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y),window.clearTimeout(c.current)}},[]);let p=i?Vy:Gy;return(0,M.jsxs)("div",{className:"relative",ref:u,children:[(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:d,onClick:()=>l(!o),title:"Copy table",type:"button",children:e??(0,M.jsx)(p,{size:14})}),o?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},oz=({children:e,className:t,onDownload:a,onError:n})=>{let[r,o]=(0,E.useState)(!1),l=(0,E.useRef)(null),{isAnimating:i}=(0,E.useContext)(Wt),s=u=>{var c;try{let d=(c=l.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),f=d?.querySelector("table");if(!f){n?.(new Error("Table not found"));return}let p=zM(f),y=u==="csv"?qM(p):nz(p);ql(`table.${u==="csv"?"csv":"md"}`,y,u==="csv"?"text/csv":"text/markdown"),o(!1),a?.(u)}catch(d){n?.(d)}};return(0,E.useEffect)(()=>{let u=c=>{let d=c.composedPath();l.current&&!d.includes(l.current)&&o(!1)};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[]),(0,M.jsxs)("div",{className:"relative",ref:l,children:[(0,M.jsx)("button",{className:Y("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>o(!r),title:"Download table",type:"button",children:e??(0,M.jsx)(Yd,{size:14})}),r?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>s("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>s("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},lz=({children:e,className:t,showControls:a,...n})=>(0,M.jsxs)("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[a?(0,M.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,M.jsx)(rz,{}),(0,M.jsx)(oz,{})]}):null,(0,M.jsx)("div",{className:"overflow-x-auto",children:(0,M.jsx)("table",{className:Y("w-full border-collapse border border-border",t),"data-streamdown":"table",...n,children:e})})]}),iz=(0,E.lazy)(()=>Promise.resolve().then(()=>(LM(),IM)).then(e=>({default:e.CodeBlock}))),sz=(0,E.lazy)(()=>Promise.resolve().then(()=>(MM(),TM)).then(e=>({default:e.Mermaid}))),uz=/language-([^\s]+)/;jy=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,Qd=(e,t)=>{if(typeof e=="boolean")return e;let a=e.mermaid;return a===!1?!1:a===!0||a===void 0?!0:a[t]!==!1},$y=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("ol",{className:Y("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>nt(e,t));$y.displayName="MarkdownOl";FM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("li",{className:Y("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&Jd(e.node,t.node));FM.displayName="MarkdownLi";HM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("ul",{className:Y("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>nt(e,t));HM.displayName="MarkdownUl";jM=(0,E.memo)(({className:e,node:t,...a})=>(0,M.jsx)("hr",{className:Y("my-6 border-border",e),"data-streamdown":"horizontal-rule",...a}),(e,t)=>nt(e,t));jM.displayName="MarkdownHr";VM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("span",{className:Y("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>nt(e,t));VM.displayName="MarkdownStrong";cz=({children:e,className:t,href:a,node:n,...r})=>{let{linkSafety:o}=(0,E.useContext)(Wt),[l,i]=(0,E.useState)(!1),s=a==="streamdown:incomplete-link",u=(0,E.useCallback)(async p=>{if(!(!(o!=null&&o.enabled&&a)||s)){if(p.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(a)){window.open(a,"_blank","noreferrer");return}i(!0)}},[o,a,s]),c=(0,E.useCallback)(()=>{a&&window.open(a,"_blank","noreferrer")},[a]),d=(0,E.useCallback)(()=>{i(!1)},[]),f={url:a??"",isOpen:l,onClose:d,onConfirm:c};return o!=null&&o.enabled&&a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{className:Y("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":s,"data-streamdown":"link",onClick:u,type:"button",children:e}),o.renderModal?o.renderModal(f):(0,M.jsx)(QU,{...f})]}):(0,M.jsx)("a",{className:Y("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":s,"data-streamdown":"link",href:a,rel:"noreferrer",target:"_blank",...r,children:e})},GM=(0,E.memo)(cz,(e,t)=>nt(e,t)&&e.href===t.href);GM.displayName="MarkdownA";WM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h1",{className:Y("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>nt(e,t));WM.displayName="MarkdownH1";$M=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h2",{className:Y("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>nt(e,t));$M.displayName="MarkdownH2";XM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h3",{className:Y("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>nt(e,t));XM.displayName="MarkdownH3";ZM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h4",{className:Y("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>nt(e,t));ZM.displayName="MarkdownH4";QM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h5",{className:Y("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>nt(e,t));QM.displayName="MarkdownH5";KM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h6",{className:Y("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>nt(e,t));KM.displayName="MarkdownH6";YM=(0,E.memo)(({children:e,className:t,node:a,...n})=>{let{controls:r}=(0,E.useContext)(Wt),o=jy(r,"table");return(0,M.jsx)(lz,{className:t,showControls:o,...n,children:e})},(e,t)=>nt(e,t));YM.displayName="MarkdownTable";JM=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("thead",{className:Y("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>nt(e,t));JM.displayName="MarkdownThead";eA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("tbody",{className:Y("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>nt(e,t));eA.displayName="MarkdownTbody";tA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("tr",{className:Y("border-border border-b",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>nt(e,t));tA.displayName="MarkdownTr";aA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("th",{className:Y("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>nt(e,t));aA.displayName="MarkdownTh";nA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("td",{className:Y("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>nt(e,t));nA.displayName="MarkdownTd";rA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("blockquote",{className:Y("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>nt(e,t));rA.displayName="MarkdownBlockquote";oA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("sup",{className:Y("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>nt(e,t));oA.displayName="MarkdownSup";lA=(0,E.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("sub",{className:Y("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>nt(e,t));lA.displayName="MarkdownSub";iA=(0,E.memo)(({children:e,className:t,node:a,...n})=>{if("data-footnotes"in n){let r=l=>{var i,s;if(!(0,E.isValidElement)(l))return!1;let u=Array.isArray(l.props.children)?l.props.children:[l.props.children],c=!1,d=!1;for(let f of u)if(f){if(typeof f=="string")f.trim()!==""&&(c=!0);else if((0,E.isValidElement)(f))if(((i=f.props)==null?void 0:i["data-footnote-backref"])!==void 0)d=!0;else{let p=Array.isArray(f.props.children)?f.props.children:[f.props.children];for(let y of p){if(typeof y=="string"&&y.trim()!==""){c=!0;break}if((0,E.isValidElement)(y)&&((s=y.props)==null?void 0:s["data-footnote-backref"])===void 0){c=!0;break}}}}return d&&!c},o=Array.isArray(e)?e.map(l=>{if(!(0,E.isValidElement)(l))return l;if(l.type===$y){let i=(Array.isArray(l.props.children)?l.props.children:[l.props.children]).filter(s=>!r(s));return i.length===0?null:{...l,props:{...l.props,children:i}}}return l}):e;return(Array.isArray(o)?o.some(l=>l!==null):o!==null)?(0,M.jsx)("section",{className:t,...n,children:o}):null}return(0,M.jsx)("section",{className:t,...n,children:e})},(e,t)=>nt(e,t));iA.displayName="MarkdownSection";dz=({node:e,className:t,children:a,...n})=>{var r,o,l;let i=((r=e?.position)==null?void 0:r.start.line)===((o=e?.position)==null?void 0:o.end.line),{mermaid:s,controls:u}=(0,E.useContext)(Wt),c=Wy();if(i)return(0,M.jsx)("code",{className:Y("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:a});let d=t?.match(uz),f=(l=d?.at(1))!=null?l:"",p="";if((0,E.isValidElement)(a)&&a.props&&typeof a.props=="object"&&"children"in a.props&&typeof a.props.children=="string"?p=a.props.children:typeof a=="string"&&(p=a),f==="mermaid"&&c){let v=jy(u,"mermaid"),S=Qd(u,"download"),g=Qd(u,"copy"),x=Qd(u,"fullscreen"),m=Qd(u,"panZoom"),w=v&&(S||g||x);return(0,M.jsx)(E.Suspense,{fallback:(0,M.jsx)(DM,{}),children:(0,M.jsxs)("div",{className:Y("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[w?(0,M.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[S?(0,M.jsx)(YU,{chart:p,config:s?.config}):null,g?(0,M.jsx)(EM,{code:p}):null,x?(0,M.jsx)(tz,{chart:p,config:s?.config}):null]}):null,(0,M.jsx)(sz,{chart:p,config:s?.config,showControls:m})]})})}let y=jy(u,"code");return(0,M.jsx)(E.Suspense,{fallback:(0,M.jsx)(DM,{}),children:(0,M.jsx)(iz,{className:Y("overflow-x-auto border-border border-t",t),code:p,language:f,children:y?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(GU,{code:p,language:f}),(0,M.jsx)(EM,{})]}):null})})},sA=(0,E.memo)(dz,(e,t)=>e.className===t.className&&Jd(e.node,t.node));sA.displayName="MarkdownCode";uA=(0,E.memo)($U,(e,t)=>e.className===t.className&&Jd(e.node,t.node));uA.displayName="MarkdownImg";cA=(0,E.memo)(({children:e,className:t,node:a,...n})=>{var r,o;let l=(Array.isArray(e)?e:[e]).filter(i=>i!=null&&i!=="");if(l.length===1&&(0,E.isValidElement)(l[0])){let i=l[0].props.node,s=i?.tagName;if(s==="img")return(0,M.jsx)(M.Fragment,{children:e});if(s==="code"&&((r=i?.position)==null?void 0:r.start.line)!==((o=i?.position)==null?void 0:o.end.line))return(0,M.jsx)(M.Fragment,{children:e})}return(0,M.jsx)("p",{className:t,...n,children:e})},(e,t)=>nt(e,t));cA.displayName="MarkdownParagraph";fz={ol:$y,li:FM,ul:HM,hr:jM,strong:VM,a:GM,h1:WM,h2:$M,h3:XM,h4:ZM,h5:QM,h6:KM,table:YM,thead:JM,tbody:eA,tr:tA,th:aA,td:nA,blockquote:rA,code:sA,img:uA,pre:({children:e})=>e,sup:oA,sub:lA,p:cA,section:iA},_M=[],OM={allowDangerousHtml:!0},Kd=new WeakMap,pz=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let a=e.rehypePlugins,n=e.remarkPlugins,r=e.remarkRehypeOptions;if(!(a||n||r)){let c="default";return this.keyCache.set(e,c),c}let o=c=>{if(!c||c.length===0)return"";let d="";for(let f=0;f<c.length;f+=1){let p=c[f];if(f>0&&(d+=","),Array.isArray(p)){let[y,v]=p;if(typeof y=="function"){let S=Kd.get(y);S||(S=y.name,Kd.set(y,S)),d+=S}else d+=String(y);d+=":",d+=JSON.stringify(v)}else if(typeof p=="function"){let y=Kd.get(p);y||(y=p.name,Kd.set(p,y)),d+=y}else d+=String(p)}return d},l=o(a),i=o(n),s=r?JSON.stringify(r):"",u=`${i}::${l}::${s}`;return this.keyCache.set(e,u),u}get(e){let t=this.generateCacheKey(e),a=this.cache.get(t);return a&&(this.cache.delete(t),this.cache.set(t,a)),a}set(e,t){let a=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(a,t)}clear(){this.cache.clear()}},PM=new pz,dA=e=>{let t=mz(e),a=e.children||"";return gz(t.runSync(t.parse(a),a),e)},mz=e=>{let t=PM.get(e);if(t)return t;let a=hz(e);return PM.set(e,a),a},hz=e=>{let t=e.rehypePlugins||_M,a=e.remarkPlugins||_M,n=e.remarkRehypeOptions?{...OM,...e.remarkRehypeOptions}:OM;return Iy().use(Od).use(a).use(Ud,n).use(t)},gz=(e,t)=>ny(e,{Fragment:M.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:M.jsx,jsxs:M.jsxs,passKeys:!0,passNode:!0}),yz=/\[\^[^\]\s]{1,200}\](?!:)/,xz=/\[\^[^\]\s]{1,200}\]:/,vz=/<\/(\w+)>/,wz=/<(\w+)[\s>]/,qy=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
120
120
  `||e[t]==="\r");)t+=1;return t+1<e.length&&e[t]==="$"&&e[t+1]==="$"},bz=e=>{let t=e.length-1;for(;t>=0&&(e[t]===" "||e[t]===" "||e[t]===`
121
- `||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},Fy=e=>{let t=0;for(let a=0;a<e.length-1;a+=1)e[a]==="$"&&e[a+1]==="$"&&(t+=1,a+=1);return t},fA=e=>{let t=yz.test(e),a=xz.test(e);if(t||a)return[e];let n=xa.lex(e,{gfm:!0}),r=[],o=[];for(let l of n){let i=l.raw,s=r.length;if(o.length>0){if(r[s-1]+=i,l.type==="html"){let u=i.match(vz);if(u){let c=u[1];o.at(-1)===c&&o.pop()}}continue}if(l.type==="html"&&l.block){let u=i.match(wz);if(u){let c=u[1];i.includes(`</${c}>`)||o.push(c)}}if(i.trim()==="$$"&&s>0){let u=r[s-1],c=qy(u),d=Fy(u);if(c&&d%2===1){r[s-1]=u+i;continue}}if(s>0&&bz(i)){let u=r[s-1],c=qy(u),d=Fy(u),f=Fy(i);if(c&&d%2===1&&!qy(i)&&f===1){r[s-1]=u+i;continue}}r.push(i)}return r},pA={raw:WC,sanitize:[ed,{}],harden:[VC,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},mA={gfm:[Ld,{}]},Sz=Object.values(pA),Cz=Object.values(mA),Iz={block:" \u258B",circle:" \u25CF"},Lz={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},Wt=(0,E.createContext)(Lz),Xy=(0,E.memo)(({content:e,shouldParseIncompleteMarkdown:t,index:a,...n})=>(0,M.jsx)(dA,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let a=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(a.length!==n.length||a.some(r=>{var o,l;return((o=e.components)==null?void 0:o[r])!==((l=t.components)==null?void 0:l[r])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Xy.displayName="Block";kz=["github-light","github-dark"],ef=(0,E.memo)(({children:e,mode:t="streaming",parseIncompleteMarkdown:a=!0,components:n,rehypePlugins:r=Sz,remarkPlugins:o=Cz,className:l,shikiTheme:i=kz,mermaid:s,controls:u=!0,isAnimating:c=!1,BlockComponent:d=Xy,parseMarkdownIntoBlocksFn:f=fA,caret:p,plugins:y,remend:v,linkSafety:S={enabled:!0},...g})=>{let x=(0,E.useId)(),[m,w]=(0,E.useTransition)(),L=(0,E.useMemo)(()=>typeof e!="string"?"":t==="streaming"&&a?rL(e,v):e,[e,t,a,v]),b=(0,E.useMemo)(()=>f(L),[L,f]),[A,R]=(0,E.useState)(b);(0,E.useEffect)(()=>{t==="streaming"?w(()=>{R(b)}):R(b)},[b,t]);let _=t==="streaming"?A:b,T=(0,E.useMemo)(()=>_.map((F,te)=>`${x}-${te}`),[_.length,x]),D=(0,E.useMemo)(()=>{var F,te;return{shikiTheme:(te=(F=y?.code)==null?void 0:F.getThemes())!=null?te:i,controls:u,isAnimating:c,mode:t,mermaid:s,linkSafety:S}},[i,u,c,t,s,S,y?.code]),N=(0,E.useMemo)(()=>({...fz,...n}),[n]),B=(0,E.useMemo)(()=>{let F=[];return y!=null&&y.cjk&&(F=[...F,...y.cjk.remarkPluginsBefore]),F=[...F,...o],y!=null&&y.cjk&&(F=[...F,...y.cjk.remarkPluginsAfter]),y!=null&&y.math&&(F=[...F,y.math.remarkPlugin]),F},[o,y?.math,y?.cjk]),j=(0,E.useMemo)(()=>y!=null&&y.math?[...r,y.math.rehypePlugin]:r,[r,y?.math]),V=(0,E.useMemo)(()=>p&&c?{"--streamdown-caret":`"${Iz[p]}"`}:void 0,[p,c]);return t==="static"?(0,M.jsx)(Hy.Provider,{value:y??null,children:(0,M.jsx)(Wt.Provider,{value:D,children:(0,M.jsx)("div",{className:Y("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",l),children:(0,M.jsx)(dA,{components:N,rehypePlugins:j,remarkPlugins:B,...g,children:e})})})}):(0,M.jsx)(Hy.Provider,{value:y??null,children:(0,M.jsx)(Wt.Provider,{value:D,children:(0,M.jsxs)("div",{className:Y("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",p?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,l),style:V,children:[_.length===0&&p&&c&&(0,M.jsx)("span",{}),_.map((F,te)=>(0,M.jsx)(d,{components:N,content:F,index:te,rehypePlugins:j,remarkPlugins:B,shouldParseIncompleteMarkdown:a,...g},T[te]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);ef.displayName="Streamdown";Tz=({children:e,className:t,minZoom:a=.5,maxZoom:n=3,zoomStep:r=.1,showControls:o=!0,initialZoom:l=1,fullscreen:i=!1})=>{let s=(0,E.useRef)(null),u=(0,E.useRef)(null),[c,d]=(0,E.useState)(l),[f,p]=(0,E.useState)({x:0,y:0}),[y,v]=(0,E.useState)(!1),[S,g]=(0,E.useState)({x:0,y:0}),[x,m]=(0,E.useState)({x:0,y:0}),w=(0,E.useCallback)(N=>{d(B=>Math.max(a,Math.min(n,B+N)))},[a,n]),L=(0,E.useCallback)(()=>{w(r)},[w,r]),b=(0,E.useCallback)(()=>{w(-r)},[w,r]),A=(0,E.useCallback)(()=>{d(l),p({x:0,y:0})},[l]),R=(0,E.useCallback)(N=>{N.preventDefault();let B=N.deltaY>0?-r:r;w(B)},[w,r]),_=(0,E.useCallback)(N=>{if(N.button!==0||N.isPrimary===!1)return;v(!0),g({x:N.clientX,y:N.clientY}),m(f);let B=N.currentTarget;B instanceof HTMLElement&&B.setPointerCapture(N.pointerId)},[f]),T=(0,E.useCallback)(N=>{if(!y)return;N.preventDefault();let B=N.clientX-S.x,j=N.clientY-S.y;p({x:x.x+B,y:x.y+j})},[y,S,x]),D=(0,E.useCallback)(N=>{v(!1);let B=N.currentTarget;B instanceof HTMLElement&&B.releasePointerCapture(N.pointerId)},[]);return(0,E.useEffect)(()=>{let N=s.current;if(N)return N.addEventListener("wheel",R,{passive:!1}),()=>{N.removeEventListener("wheel",R)}},[R]),(0,E.useEffect)(()=>{let N=u.current;if(N&&y)return document.body.style.userSelect="none",N.addEventListener("pointermove",T,{passive:!1}),N.addEventListener("pointerup",D),N.addEventListener("pointercancel",D),()=>{document.body.style.userSelect="",N.removeEventListener("pointermove",T),N.removeEventListener("pointerup",D),N.removeEventListener("pointercancel",D)}},[y,T,D]),(0,M.jsxs)("div",{className:Y("relative flex flex-col",i?"h-full w-full":"min-h-28 w-full",t),ref:s,style:{cursor:y?"grabbing":"grab"},children:[o?(0,M.jsxs)("div",{className:Y("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",i?"bottom-4 left-4":"bottom-2 left-2"),children:[(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c>=n,onClick:L,title:"Zoom in",type:"button",children:(0,M.jsx)(jU,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c<=a,onClick:b,title:"Zoom out",type:"button",children:(0,M.jsx)(VU,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:A,title:"Reset zoom and pan",type:"button",children:(0,M.jsx)(HU,{size:16})})]}):null,(0,M.jsx)("div",{className:Y("flex-1 origin-center transition-transform duration-150 ease-out",i?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:_,ref:u,role:"application",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},Uy=({chart:e,className:t,config:a,fullscreen:n=!1,showControls:r=!0})=>{let[o,l]=(0,E.useState)(null),[i,s]=(0,E.useState)(!1),[u,c]=(0,E.useState)(""),[d,f]=(0,E.useState)(""),[p,y]=(0,E.useState)(0),{mermaid:v}=(0,E.useContext)(Wt),S=Wy(),g=v?.errorComponent,{shouldRender:x,containerRef:m}=zU({immediate:n});if((0,E.useEffect)(()=>{if(x){if(!S){l("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{l(null),s(!0);let L=S.getMermaid(a),b=e.split("").reduce((_,T)=>(_<<5)-_+T.charCodeAt(0)|0,0),A=`mermaid-${Math.abs(b)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:R}=await L.render(A,e);c(R),f(R)}catch(L){if(!(d||u)){let b=L instanceof Error?L.message:"Failed to render Mermaid chart";l(b)}}finally{s(!1)}})()}},[e,a,p,x,S]),!(x||u||d))return(0,M.jsx)("div",{className:Y("my-4 min-h-[200px]",t),ref:m});if(i&&!u&&!d)return(0,M.jsx)("div",{className:Y("my-4 flex justify-center p-4",t),ref:m,children:(0,M.jsxs)("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[(0,M.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),(0,M.jsx)("span",{className:"text-sm",children:"Loading diagram..."})]})});if(o&&!u&&!d)return g?(0,M.jsx)("div",{ref:m,children:(0,M.jsx)(g,{chart:e,error:o,retry:()=>y(b=>b+1)})}):(0,M.jsxs)("div",{className:Y("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:m,children:[(0,M.jsxs)("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",o]}),(0,M.jsxs)("details",{className:"mt-2",children:[(0,M.jsx)("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),(0,M.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]});let w=u||d;return(0,M.jsx)("div",{className:Y("size-full",t),"data-streamdown":"mermaid",ref:m,children:(0,M.jsx)(Tz,{className:Y(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:(0,M.jsx)("div",{"aria-label":"Mermaid chart",className:Y("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:w},role:"img"})})})}});var g2=Ot((HJ,h2)=>{"use strict";function QF(e,t){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a,n=0;return function(...o){clearTimeout(a);let l=Date.now(),i=l-n,s=t-i;s<=0?(n=l,e.apply(this,o)):a=setTimeout(()=>{n=Date.now(),e.apply(this,o)},s)}}h2.exports=QF});var au=q(xe(),1),xx=q(uC(),1);var U_="https://app.waniwani.ai/api/mcp/chat",z_={api:U_,title:"Assistant",position:"bottom-right",width:400,height:600};function q_(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript;let e=document.querySelectorAll("script[src]");for(let t of e)if(t instanceof HTMLScriptElement&&/embed/i.test(t.src))return t;return null}function Pc(){let e=q_();if(!e)return{};let t=L=>e.getAttribute(L)??void 0,a=L=>{let b=e.getAttribute(L);if(b==null)return;let A=Number(b);return Number.isFinite(A)?A:void 0},n={},r=t("data-api");r&&(n.api=r);let o=t("data-token");o&&(n.token=o);let l=t("data-title");l&&(n.title=l);let i=t("data-welcome-message");i&&(n.welcomeMessage=i);let s=t("data-placeholder");s&&(n.placeholder=s);let u=t("data-mcp-server-url");u&&(n.mcpServerUrl=u);let c=t("data-css");c&&(n.css=c);let d=t("data-suggestions");d&&(n.suggestions=d.split(",").map(L=>L.trim()).filter(Boolean));let f=t("data-position");(f==="bottom-right"||f==="bottom-left")&&(n.position=f);let p=t("data-mode");(p==="floating"||p==="custom"||p==="inline")&&(n.mode=p);let y=t("data-layout");(y==="card"||y==="bar"||y==="embed")&&(n.layout=y);let v=a("data-width");v&&(n.width=v);let S=a("data-height");S&&(n.height=S);let g=t("data-primary-color"),x=t("data-background-color"),m=t("data-text-color"),w=t("data-font-family");return(g||x||m||w)&&(n.theme={},g&&(n.theme.primaryColor=g),x&&(n.theme.backgroundColor=x),m&&(n.theme.textColor=m),w&&(n.theme.fontFamily=w)),n}function Nc(e,t,a){let n=a??Pc(),r={token:"",...z_,...t??{},...n,...e,theme:{...t?.theme??{},...n.theme,...e?.theme}};if(!r.token)throw new Error("[WaniWani] Missing required config: `token`. Set data-token on the script tag or pass it to WaniWani.chat.init().");return r.mode||(r.mode="inline"),r}function Bc(e){if(!e.theme)return;let t=e.theme;return{...t.primaryColor?{primaryColor:t.primaryColor}:{},...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.textColor?{textColor:t.textColor}:{},...t.fontFamily?{fontFamily:t.fontFamily}:{}}}var ct=q(xe(),1);var Ut=q(xe(),1);var zc=q(xe());var Uc=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var cC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var dC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,n)=>n?n.toUpperCase():a.toLowerCase());var fh=e=>{let t=dC(e);return t.charAt(0).toUpperCase()+t.slice(1)};var os=q(xe());var fC={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var pC=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var mC=(0,os.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:l,...i},s)=>(0,os.createElement)("svg",{ref:s,...fC,width:t,height:t,stroke:e,strokeWidth:n?Number(a)*24/Number(t):a,className:Uc("lucide",r),...!o&&!pC(i)&&{"aria-hidden":"true"},...i},[...l.map(([u,c])=>(0,os.createElement)(u,c)),...Array.isArray(o)?o:[o]]));var Ye=(e,t)=>{let a=(0,zc.forwardRef)(({className:n,...r},o)=>(0,zc.createElement)(mC,{ref:o,iconNode:t,className:Uc(`lucide-${cC(fh(e))}`,`lucide-${e}`,n),...r}));return a.displayName=fh(e),a};var F_=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ls=Ye("arrow-down",F_);var H_=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],is=Ye("arrow-up",H_);var j_=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],yr=Ye("braces",j_);var V_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ss=Ye("check",V_);var G_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],us=Ye("chevron-down",G_);var W_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cs=Ye("chevron-right",W_);var $_=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],ds=Ye("clipboard-copy",$_);var X_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],fs=Ye("file",X_);var Z_=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],ps=Ye("loader",Z_);var Q_=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],ms=Ye("paperclip",Q_);var K_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],hs=Ye("square",K_);var Y_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],no=Ye("x",Y_);var IC=q(xe(),1);var _t=q(xe(),1);var J_={damping:.7,stiffness:.05,mass:1.25},eO=70,tO=1e3/60,aO=350,qc=!1;globalThis.document?.addEventListener("mousedown",()=>{qc=!0});globalThis.document?.addEventListener("mouseup",()=>{qc=!1});globalThis.document?.addEventListener("click",()=>{qc=!1});var gC=(e={})=>{let[t,a]=(0,_t.useState)(!1),[n,r]=(0,_t.useState)(e.initial!==!1),[o,l]=(0,_t.useState)(!1),i=(0,_t.useRef)(null);i.current=e;let s=(0,_t.useCallback)(()=>{if(!qc)return!1;let x=window.getSelection();if(!x||!x.rangeCount)return!1;let m=x.getRangeAt(0);return m.commonAncestorContainer.contains(S.current)||S.current?.contains(m.commonAncestorContainer)},[]),u=(0,_t.useCallback)(x=>{d.isAtBottom=x,r(x)},[]),c=(0,_t.useCallback)(x=>{d.escapedFromLock=x,a(x)},[]),d=(0,_t.useMemo)(()=>{let x;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return S.current?.scrollTop??0},set scrollTop(m){S.current&&(S.current.scrollTop=m,d.ignoreScrollToTop=S.current.scrollTop)},get targetScrollTop(){return!S.current||!g.current?0:S.current.scrollHeight-1-S.current.clientHeight},get calculatedTargetScrollTop(){if(!S.current||!g.current)return 0;let{targetScrollTop:m}=this;if(!e.targetScrollTop)return m;if(x?.targetScrollTop===m)return x.calculatedScrollTop;let w=Math.max(Math.min(e.targetScrollTop(m,{scrollElement:S.current,contentElement:g.current}),m),0);return x={targetScrollTop:m,calculatedScrollTop:w},requestAnimationFrame(()=>{x=void 0}),w},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=eO}}},[]),f=(0,_t.useCallback)((x={})=>{typeof x=="string"&&(x={animation:x}),x.preserveScrollPosition||u(!0);let m=Date.now()+(Number(x.wait)||0),w=mh(i.current,x.animation),{ignoreEscapes:L=!1}=x,b,A=d.calculatedTargetScrollTop;x.duration instanceof Promise?x.duration.finally(()=>{b=Date.now()}):b=m+(x.duration??0);let R=async()=>{let _=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:T}=d,D=performance.now(),N=(D-(d.lastTick??D))/tO;if(d.animation||(d.animation={behavior:w,promise:_,ignoreEscapes:L}),d.animation.behavior===w&&(d.lastTick=D),s()||m>Date.now())return R();if(T<Math.min(A,d.calculatedTargetScrollTop)){if(d.animation?.behavior===w){if(w==="instant")return d.scrollTop=d.calculatedTargetScrollTop,R();d.velocity=(w.damping*d.velocity+w.stiffness*d.scrollDifference)/w.mass,d.accumulated+=d.velocity*N,d.scrollTop+=d.accumulated,d.scrollTop!==T&&(d.accumulated=0)}return R()}return b>Date.now()?(A=d.calculatedTargetScrollTop,R()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:mh(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,b-Date.now())||void 0}):d.isAtBottom)});return _.then(T=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),T))};return x.wait!==!0&&(d.animation=void 0),d.animation?.behavior===w?d.animation.promise:R()},[u,s,d]),p=(0,_t.useCallback)(()=>{c(!0),u(!1)},[c,u]),y=(0,_t.useCallback)(({target:x})=>{if(x!==S.current)return;let{scrollTop:m,ignoreScrollToTop:w}=d,{lastScrollTop:L=m}=d;d.lastScrollTop=m,d.ignoreScrollToTop=void 0,w&&w>m&&(L=w),l(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||m===w)return;if(s()){c(!0),u(!1);return}let b=m>L,A=m<L;if(d.animation?.ignoreEscapes){d.scrollTop=L;return}A&&(c(!0),u(!1)),b&&c(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[c,u,s,d]),v=(0,_t.useCallback)(({target:x,deltaY:m})=>{let w=x;for(;!["scroll","auto"].includes(getComputedStyle(w).overflow);){if(!w.parentElement)return;w=w.parentElement}w===S.current&&m<0&&S.current.scrollHeight>S.current.clientHeight&&!d.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,d]),S=hC(x=>{S.current?.removeEventListener("scroll",y),S.current?.removeEventListener("wheel",v),x?.addEventListener("scroll",y,{passive:!0}),x?.addEventListener("wheel",v,{passive:!0})},[]),g=hC(x=>{if(d.resizeObserver?.disconnect(),!x)return;let m;d.resizeObserver=new ResizeObserver(([w])=>{let{height:L}=w.contentRect,b=L-(m??L);if(d.resizeDifference=b,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),l(d.isNearBottom),b>=0){let A=mh(i.current,m?i.current.resize:i.current.initial);f({animation:A,wait:!0,preserveScrollPosition:!0,duration:A==="instant"?void 0:aO})}else d.isNearBottom&&(c(!1),u(!0));m=L,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===b&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(x)},[]);return{contentRef:g,scrollRef:S,scrollToBottom:f,stopScroll:p,isAtBottom:n||o,isNearBottom:o,escapedFromLock:t,state:d}};function hC(e,t){let a=(0,_t.useCallback)(n=>(a.current=n,e(n)),t);return a}var ph=new Map;function mh(...e){let t={...J_},a=!1;for(let r of e){if(r==="instant"){a=!0;continue}typeof r=="object"&&(a=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let n=JSON.stringify(t);return ph.has(n)||ph.set(n,Object.freeze(t)),a?"instant":ph.get(n)}var ro=q(xe(),1),ta=q(xe(),1);var yC=(0,ta.createContext)(null),nO=typeof window<"u"?ta.useLayoutEffect:ta.useEffect;function gs({instance:e,children:t,resize:a,initial:n,mass:r,damping:o,stiffness:l,targetScrollTop:i,contextRef:s,...u}){let c=(0,ta.useRef)(null),d=ro.useCallback((L,b)=>(w?.targetScrollTop??i)?.(L,b)??L,[i]),f=gC({mass:r,damping:o,stiffness:l,resize:a,initial:n,targetScrollTop:d}),{scrollRef:p,contentRef:y,scrollToBottom:v,stopScroll:S,isAtBottom:g,escapedFromLock:x,state:m}=e??f,w=(0,ta.useMemo)(()=>({scrollToBottom:v,stopScroll:S,scrollRef:p,isAtBottom:g,escapedFromLock:x,contentRef:y,state:m,get targetScrollTop(){return c.current},set targetScrollTop(L){c.current=L}}),[v,g,y,p,S,x,m]);return(0,ta.useImperativeHandle)(s,()=>w,[w]),nO(()=>{p.current&&getComputedStyle(p.current).overflow==="visible"&&(p.current.style.overflow="auto")},[]),ro.createElement(yC.Provider,{value:w},ro.createElement("div",{...u},typeof t=="function"?t(w):t))}(function(e){function t({children:a,scrollClassName:n,...r}){let o=hh();return ro.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:n},ro.createElement("div",{...r,ref:o.contentRef},typeof a=="function"?a(o):a))}e.Content=t})(gs||(gs={}));function hh(){let e=(0,ta.useContext)(yC);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}gh();xh();var rO=vC({prefix:"ww"});function $(...e){return rO(Fc(e))}var CC=q(ee(),1),en=({className:e,variant:t="default",size:a="default",type:n="button",...r})=>(0,CC.jsx)("button",{type:n,className:$("ww:inline-flex ww:cursor-pointer ww:items-center ww:justify-center ww:rounded-md ww:font-medium ww:transition-colors ww:disabled:pointer-events-none ww:disabled:opacity-50",t==="default"&&"ww:bg-primary ww:text-primary-foreground ww:hover:bg-primary/90",t==="outline"&&"ww:border ww:border-border ww:bg-background ww:hover:bg-accent ww:hover:text-accent-foreground",t==="ghost"&&"ww:hover:bg-accent ww:hover:text-accent-foreground",a==="default"&&"ww:h-9 ww:px-4 ww:py-2 ww:text-sm",a==="sm"&&"ww:h-8 ww:px-3 ww:text-xs",a==="icon"&&"ww:size-9 ww:!rounded-full",a==="icon-sm"&&"ww:size-7 ww:!rounded-full",e),...r});var ys=q(ee(),1),Sl=({className:e,...t})=>(0,ys.jsx)(gs,{className:$("ww:relative ww:flex-1 ww:overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Cl=({className:e,...t})=>(0,ys.jsx)(gs.Content,{className:$("ww:flex ww:flex-col ww:gap-6 ww:px-4 ww:py-6 ww:mx-auto ww:w-full ww:max-w-3xl",e),...t}),Il=({className:e,...t})=>{let{isAtBottom:a,scrollToBottom:n}=hh(),r=(0,IC.useCallback)(()=>{n()},[n]);return!a&&(0,ys.jsx)(en,{className:$("ww:absolute ww:bottom-4 ww:left-[50%] ww:translate-x-[-50%] ww:rounded-full",e),onClick:r,size:"icon",variant:"outline",...t,children:(0,ys.jsx)(ls,{className:"ww:size-4"})})};var jc=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,a)=>(a&=63,a<36?t+=a.toString(36):a<62?t+=(a-26).toString(36).toUpperCase():a>62?t+="-":t+="_",t),"");var Be=q(xe(),1);var jt=q(ee(),1),iO=async e=>{try{let a=await(await fetch(e)).blob();return new Promise(n=>{let r=new FileReader;r.onloadend=()=>n(r.result),r.onerror=()=>n(null),r.readAsDataURL(a)})}catch{return null}},LC=(0,Be.createContext)(null),kC=()=>{let e=(0,Be.useContext)(LC);if(!e)throw new Error("usePromptInputAttachments must be used within a PromptInput");return e},Ll=({className:e,accept:t,multiple:a,globalDrop:n,maxFiles:r,maxFileSize:o,onSubmit:l,children:i,...s})=>{let u=(0,Be.useRef)(null),c=(0,Be.useRef)(null),[d,f]=(0,Be.useState)([]),p=(0,Be.useRef)(d);(0,Be.useEffect)(()=>{p.current=d},[d]);let y=(0,Be.useCallback)(()=>{u.current?.click()},[]),v=(0,Be.useCallback)(L=>{let b=[...L];if(b.length===0)return;let A=_=>o?_.size<=o:!0,R=b.filter(A);f(_=>{let T=typeof r=="number"?Math.max(0,r-_.length):void 0,D=typeof T=="number"?R.slice(0,T):R;return[..._,...D.map(N=>({filename:N.name,id:jc(),mediaType:N.type,type:"file",url:URL.createObjectURL(N)}))]})},[r,o]),S=(0,Be.useCallback)(L=>{f(b=>{let A=b.find(R=>R.id===L);return A?.url&&URL.revokeObjectURL(A.url),b.filter(R=>R.id!==L)})},[]),g=(0,Be.useCallback)(()=>{f(L=>{for(let b of L)b.url&&URL.revokeObjectURL(b.url);return[]})},[]);(0,Be.useEffect)(()=>()=>{for(let L of p.current)L.url&&URL.revokeObjectURL(L.url)},[]);let x=(0,Be.useCallback)(L=>{L.currentTarget.files&&v(L.currentTarget.files),L.currentTarget.value=""},[v]);(0,Be.useEffect)(()=>{if(!n)return;let L=A=>{A.dataTransfer?.types?.includes("Files")&&A.preventDefault()},b=A=>{A.dataTransfer?.types?.includes("Files")&&A.preventDefault(),A.dataTransfer?.files&&A.dataTransfer.files.length>0&&v(A.dataTransfer.files)};return document.addEventListener("dragover",L),document.addEventListener("drop",b),()=>{document.removeEventListener("dragover",L),document.removeEventListener("drop",b)}},[v,n]);let m=(0,Be.useCallback)(async L=>{L.preventDefault();let b=L.currentTarget,R=new FormData(b).get("message")||"";b.reset();let _=await Promise.all(d.map(async({id:T,...D})=>{if(D.url?.startsWith("blob:")){let N=await iO(D.url);return{...D,url:N??D.url}}return D}));try{let T=l({files:_,text:R},L);T instanceof Promise&&await T,g()}catch{}},[d,l,g]),w=(0,Be.useMemo)(()=>({add:v,clear:g,files:d,openFileDialog:y,remove:S}),[d,v,S,g,y]);return(0,jt.jsxs)(LC.Provider,{value:w,children:[(0,jt.jsx)("input",{accept:t,"aria-label":"Upload files",className:"ww:hidden",multiple:a,onChange:x,ref:u,title:"Upload files",type:"file"}),(0,jt.jsx)("form",{className:$("ww:flex ww:w-full ww:flex-col ww:rounded-lg ww:border ww:border-border ww:bg-background",e),onSubmit:m,ref:c,...s,children:i})]})};var kl=({onChange:e,onKeyDown:t,className:a,placeholder:n="What would you like to know?",...r})=>{let o=kC(),[l,i]=(0,Be.useState)(!1),s=(0,Be.useCallback)(c=>{if(t?.(c),!c.defaultPrevented){if(c.key==="Enter"){if(l||c.nativeEvent.isComposing||c.shiftKey)return;c.preventDefault();let{form:d}=c.currentTarget;if(d?.querySelector('button[type="submit"]')?.disabled)return;d?.requestSubmit()}if(c.key==="Backspace"&&c.currentTarget.value===""&&o.files.length>0){c.preventDefault();let d=o.files.at(-1);d&&o.remove(d.id)}}},[t,l,o]),u=(0,Be.useCallback)(c=>{let d=c.clipboardData?.items;if(!d)return;let f=[];for(let p of d)if(p.kind==="file"){let y=p.getAsFile();y&&f.push(y)}f.length>0&&(c.preventDefault(),o.add(f))},[o]);return(0,jt.jsx)("textarea",{className:$("ww:field-sizing-content ww:max-h-48 ww:min-h-10 ww:w-full ww:resize-none ww:border-0 ww:bg-transparent ww:px-3 ww:py-2 ww:text-sm ww:outline-none ww:placeholder:text-muted-foreground",a),name:"message",onCompositionEnd:()=>i(!1),onCompositionStart:()=>i(!0),onKeyDown:s,onPaste:u,placeholder:n,onChange:e,...r})},Tl=({className:e,status:t,onStop:a,onClick:n,children:r,...o})=>{let l=t==="submitted"||t==="streaming",i=(0,jt.jsx)(is,{className:"ww:size-4"});t==="submitted"?i=(0,jt.jsx)(ps,{className:"ww:size-4 ww:animate-spin"}):t==="streaming"&&(i=(0,jt.jsx)(hs,{className:"ww:size-4"}));let s=(0,Be.useCallback)(u=>{if(l&&a){u.preventDefault(),a();return}n?.(u)},[l,a,n]);return(0,jt.jsx)(en,{"aria-label":l?"Stop":"Submit",className:$("ww:bg-foreground ww:text-background ww:hover:bg-foreground ww:rounded-full",e),onClick:s,size:"icon-sm",type:l&&a?"button":"submit",variant:"ghost",...o,children:r??i})},Ml=({className:e,children:t,...a})=>{let n=kC();return n.files.length>0?(0,jt.jsxs)(en,{className:$("ww:group ww:relative",e),onClick:()=>n.clear(),size:"icon-sm",type:"button",variant:"ghost","aria-label":"Remove all attachments",...a,children:[(0,jt.jsx)("span",{className:"ww:flex ww:size-5 ww:items-center ww:justify-center ww:rounded-full ww:bg-primary ww:text-[10px] ww:font-medium ww:text-primary-foreground ww:transition-opacity ww:group-hover:opacity-0",children:n.files.length}),(0,jt.jsx)(no,{className:"ww:absolute ww:size-4 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100"})]}):(0,jt.jsx)(en,{className:$(e),onClick:()=>n.openFileDialog(),size:"icon-sm",type:"button",variant:"ghost",...a,children:t??(0,jt.jsx)(ms,{className:"ww:size-4"})})};var Vc=q(xe(),1);var oo=q(ee(),1),TC=({className:e,...t})=>(0,oo.jsx)("div",{className:$("ww:flex ww:flex-col ww:gap-1 ww:px-3 ww:py-2",e),...t}),MC=({className:e,...t})=>(0,oo.jsx)("li",{className:$("ww:group ww:flex ww:items-center ww:gap-2 ww:rounded-md ww:px-2 ww:py-1 ww:text-sm ww:transition-colors ww:hover:bg-muted",e),...t}),AC=({className:e,...t})=>(0,oo.jsx)("span",{className:$("ww:inline-block ww:size-2 ww:shrink-0 ww:rounded-full ww:border ww:border-muted-foreground/50",e),...t}),EC=({className:e,...t})=>(0,oo.jsx)("span",{className:$("ww:line-clamp-1 ww:grow ww:break-words ww:text-muted-foreground",e),...t}),RC=({className:e,...t})=>(0,oo.jsx)("div",{className:$("ww:flex ww:shrink-0 ww:gap-1 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100",e),...t}),DC=({className:e,...t})=>(0,oo.jsx)(en,{className:$("ww:size-auto ww:rounded ww:p-1 ww:text-muted-foreground ww:hover:bg-muted-foreground/10 ww:hover:text-foreground",e),size:"icon",type:"button",variant:"ghost",...t});var Ra=q(ee(),1),_C=(0,Vc.memo)(({message:e,onRemove:t})=>{let a=(0,Vc.useCallback)(()=>t(e.id),[t,e.id]);return(0,Ra.jsxs)(MC,{children:[(0,Ra.jsx)(AC,{}),(0,Ra.jsx)(EC,{children:e.text||"(attachment)"}),(0,Ra.jsx)(RC,{children:(0,Ra.jsx)(DC,{"aria-label":"Remove from queue",onClick:a,children:(0,Ra.jsx)(no,{className:"ww:size-3"})})})]})});_C.displayName="ChatQueueItem";function Al({queuedMessages:e,onRemove:t,className:a}){return e.length===0?null:(0,Ra.jsxs)(TC,{className:$("ww:border-t ww:border-border",a),children:[(0,Ra.jsxs)("div",{className:"ww:text-[11px] ww:font-medium ww:text-muted-foreground ww:px-2",children:[e.length," queued"]}),(0,Ra.jsx)("ul",{children:e.map(n=>(0,Ra.jsx)(_C,{message:n,onRemove:t},n.id))})]})}var vh=q(xe(),1),OC=q(ee(),1);function Gc({messages:e,evalEnabled:t,api:a="/api/waniwani"}){let[n,r]=(0,vh.useState)(!1),[o,l]=(0,vh.useState)(null),i=async()=>{let u={name:`session-${new Date().toISOString().slice(0,19)}`,type:"functional",messages:e,mode:"manual"};r(!0),l(null);try{let c=await fetch(`${a}/scenarios`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!c.ok)throw new Error(`${c.status}`);l("saved")}catch{l("error")}finally{r(!1),setTimeout(()=>l(null),2e3)}};return!t||e.length===0?null:(0,OC.jsx)("button",{type:"button",onClick:i,disabled:n,title:"Save scenario to WaniWani",className:"ww:ml-auto ww:text-[10px] ww:font-mono ww:uppercase ww:tracking-wider ww:text-muted-foreground hover:ww:text-foreground ww:cursor-pointer ww:transition-colors ww:disabled:opacity-40",children:n?"saving...":o==="saved"?"saved":o==="error"?"error":"export"})}var xr=q(ee(),1),PC=({files:e,className:t,...a})=>e.length===0?null:(0,xr.jsx)("div",{className:$("ww:flex ww:flex-wrap ww:gap-1.5",t),...a,children:e.map((n,r)=>(0,xr.jsx)(sO,{file:n},r))});function sO({file:e}){return e.mediaType?.startsWith("image/")&&e.url?(0,xr.jsx)("img",{src:e.url,alt:e.filename??"attachment",className:"ww:h-16 ww:max-w-32 ww:rounded ww:object-cover"}):(0,xr.jsxs)("span",{className:"ww:inline-flex ww:items-center ww:gap-1.5 ww:rounded ww:bg-background/20 ww:px-2 ww:py-1 ww:text-xs",children:[(0,xr.jsx)(fs,{className:"ww:size-3 ww:shrink-0"}),(0,xr.jsx)("span",{className:"ww:max-w-24 ww:truncate",children:e.filename??"file"})]})}var wh=q(ee(),1),bh=({className:e,size:t=5,...a})=>(0,wh.jsx)("div",{className:$("ww:flex ww:items-center ww:gap-1",e),...a,children:[0,1,2].map(n=>(0,wh.jsx)("div",{className:"ww:rounded-full ww:bg-muted-foreground/60",style:{width:t,height:t,animation:"ww-pulse 1.4s ease-in-out infinite",animationDelay:`${n*.2}s`}},n))});var NC={name:"cjk-noop",type:"cjk",remarkPluginsBefore:[],remarkPluginsAfter:[],remarkPlugins:[]};var BC={name:"shiki-noop",type:"code-highlighter",supportsLanguage:()=>!1,getSupportedLanguages:()=>[],getThemes:()=>["github-light","github-dark"],highlight:()=>null};var hA=q(xe(),1);Zd();var Gs=q(ee(),1),tf=({className:e,from:t,children:a,...n})=>(0,Gs.jsx)("div",{className:$("ww:group ww:flex ww:w-full",t==="user"?"is-user ww:ml-auto ww:max-w-[80%] ww:flex-col ww:items-end":"is-assistant ww:flex-col",e),...n,children:(0,Gs.jsx)("div",{className:$("ww:flex ww:min-w-0 ww:flex-col ww:gap-2","ww:w-full"),children:a})}),af=({children:e,className:t,...a})=>(0,Gs.jsx)("div",{className:$("ww:flex ww:w-fit ww:min-w-0 ww:max-w-full ww:flex-col ww:gap-2 ww:overflow-hidden ww:text-base","ww:group-[.is-user]:ml-auto ww:group-[.is-user]:rounded-lg ww:group-[.is-user]:bg-user-bubble ww:group-[.is-user]:px-4 ww:group-[.is-user]:py-3 ww:group-[.is-user]:text-primary-foreground","ww:group-[.is-assistant]:text-foreground",t),...a,children:e}),Mz={cjk:NC,code:BC},nf=(0,hA.memo)(({className:e,...t})=>(0,Gs.jsx)(ef,{className:$("ww:size-full ww:[&>*:first-child]:mt-0 ww:[&>*:last-child]:mb-0",e),plugins:Mz,...t}),(e,t)=>e.children===t.children);nf.displayName="MessageResponse";var yA=q(ee(),1);function gA({className:e,text:t,...a}){return t?(0,yA.jsx)("pre",{className:$("ww:mb-2 ww:overflow-x-auto ww:whitespace-pre-wrap ww:break-words ww:text-xs ww:font-mono ww:text-muted-foreground",e),...a,children:t}):null}var vt=q(xe(),1);var fe=q(ee(),1);function Az(e,t=80){if(e==null)return String(e);if(typeof e!="object")return String(e).slice(0,t);if(Array.isArray(e))return`Array(${e.length})`;let a=JSON.stringify(e);if(a.length<=t)return a;let n=Object.entries(e),r=[],o=t-2;for(let[l,i]of n){if(o<=8)break;let s=l.length>4?`${l.slice(0,4)}\u2026`:l,u;typeof i=="string"?u=i.length>2?`'${i.slice(0,1)}\u2026`:`'${i}'`:Array.isArray(i)?u=`Array(${i.length})`:typeof i=="object"&&i!==null?u="{\u2026}":u=String(i);let c=`${s}\u2009${u}`;r.push(c),o-=c.length+3}return`{${r.join(", ")}}`}function Ez({text:e,className:t}){let[a,n]=(0,vt.useState)(!1),r=(0,vt.useRef)(null);(0,vt.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let o=(0,vt.useCallback)(async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)}catch{}},[e]);return(0,fe.jsx)(en,{variant:"ghost",size:"sm",onClick:o,className:$("ww:h-auto ww:gap-1 ww:px-1.5 ww:py-0.5 ww:text-xs ww:text-muted-foreground ww:hover:text-foreground",t),children:a?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(ss,{className:"ww:size-3.5"}),(0,fe.jsx)("span",{children:"Copied"})]}):(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(ds,{className:"ww:size-3.5"}),(0,fe.jsx)("span",{children:"Copy"})]})})}function wA({data:e,label:t,className:a,...n}){let[r,o]=(0,vt.useState)(!1),l=(0,vt.useMemo)(()=>JSON.stringify(e,null,2),[e]),i=Az(e);return(0,fe.jsxs)("div",{className:$("ww:rounded-lg ww:bg-tool-card",a),...n,children:[(0,fe.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:px-3 ww:pt-2.5 ww:pb-1.5",children:[(0,fe.jsx)("span",{className:"ww:text-xs ww:font-medium ww:text-muted-foreground",children:t}),(0,fe.jsx)(Ez,{text:l})]}),(0,fe.jsxs)("button",{type:"button",onClick:()=>o(s=>!s),className:"ww:flex ww:w-full ww:items-start ww:gap-2 ww:px-3 ww:pb-3 ww:text-left",children:[(0,fe.jsx)(cs,{className:$("ww:mt-0.5 ww:size-3.5 ww:shrink-0 ww:text-muted-foreground ww:transition-transform ww:duration-150",r&&"ww:rotate-90")}),r?(0,fe.jsx)("pre",{className:"ww:overflow-x-auto ww:text-xs ww:font-mono ww:text-foreground ww:whitespace-pre-wrap ww:break-all",children:(0,fe.jsx)("code",{children:l})}):(0,fe.jsx)("span",{className:"ww:truncate ww:text-xs ww:font-mono ww:text-foreground/80",children:i})]})]})}var Qy=(0,vt.createContext)({open:!1,toggle:()=>{}});function bA({className:e,defaultOpen:t=!1,children:a,...n}){let[r,o]=(0,vt.useState)(t);return(0,fe.jsx)(Qy.Provider,{value:{open:r,toggle:()=>o(l=>!l)},children:(0,fe.jsx)("div",{className:$("ww:mb-4 ww:w-full",e),"data-state":r?"open":"closed",...n,children:a})})}function SA({className:e,title:t,state:a,...n}){let{open:r,toggle:o}=(0,vt.useContext)(Qy),l=a==="input-available"||a==="input-streaming";return(0,fe.jsxs)("button",{type:"button",onClick:o,className:$("ww:flex ww:w-full ww:items-center ww:justify-between ww:gap-3 ww:py-1.5",e),"aria-expanded":r,...n,children:[(0,fe.jsxs)("div",{className:"ww:flex ww:min-w-0 ww:items-center ww:gap-2",children:[(0,fe.jsx)(yr,{className:"ww:size-4 ww:shrink-0 ww:text-muted-foreground"}),(0,fe.jsx)("span",{className:"ww:truncate ww:text-sm ww:font-medium",children:t}),l&&(0,fe.jsx)("span",{className:"ww:size-2 ww:shrink-0 ww:rounded-full ww:bg-primary ww:animate-pulse"})]}),(0,fe.jsx)(us,{className:$("ww:size-4 ww:shrink-0 ww:text-muted-foreground ww:transition-transform ww:duration-200",r&&"ww:rotate-180")})]})}function CA({className:e,children:t,...a}){let{open:n}=(0,vt.useContext)(Qy);return(0,fe.jsx)("div",{className:$("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,fe.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,fe.jsx)("div",{className:$("ww:mt-2 ww:space-y-3 ww:rounded-lg ww:border ww:border-border ww:bg-background ww:p-3",e),...a,children:t})})})}function IA({className:e,input:t,debug:a,...n}){let r=(0,vt.useMemo)(()=>{if(!a&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:o,...l}=t;return l}return t},[t,a]);return(0,fe.jsx)(wA,{data:r,label:"Request",className:e,...n})}function Zy(e){if(!(typeof e!="object"||e===null))return e}function LA(e){return Zy(e?.ui)}function kA(e){return Zy(Zy(e)?._meta)}function xA(e){if(!e)return;let t=LA(e)?.resourceUri;if(typeof t=="string"&&t.length>0)return t;let a=e["ui/resourceUri"];if(typeof a=="string"&&a.length>0)return a;let n=e["openai/outputTemplate"];if(typeof n=="string"&&n.length>0)return n}function vA(e){return LA(e)?.autoHeight===!0}function rf(e,t,a){if(e){let n=xA(a?.[e]?._meta);if(n)return n}return xA(kA(t))}function TA(e,t,a){return e&&vA(a?.[e]?._meta)?!0:vA(kA(t))}function MA({className:e,output:t,errorText:a,debug:n,...r}){let o=(0,vt.useMemo)(()=>{if(!n&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:l,...i}=t;return i}return t},[t,n]);return t||a?a?(0,fe.jsxs)("div",{className:$("ww:space-y-2",e),...r,children:[(0,fe.jsx)("h4",{className:"ww:text-xs ww:font-medium ww:uppercase ww:tracking-wide ww:text-muted-foreground",children:"Error"}),(0,fe.jsx)("div",{className:"ww:rounded-lg ww:bg-destructive/10 ww:p-3 ww:text-xs ww:text-destructive",children:a})]}):(0,fe.jsx)(wA,{data:o,label:"Response",className:e,...r}):null}var qe=q(xe(),1);function Fl(e){if(!e)return!1;let t=Array.isArray(e.content)&&e.content.length>0,a=typeof e.structuredContent=="object"&&e.structuredContent!==null&&Object.keys(e.structuredContent).length>0;return t||a}function AA(e,t){return!Fl(e)&&!Fl(t)?null:Fl(e)?Fl(t)?{...e.content||t.content?{content:[...e.content??[],...t.content??[]]}:{},...e.structuredContent||t.structuredContent?{structuredContent:{...e.structuredContent??{},...t.structuredContent??{}}}:{}}:{...e.content?{content:[...e.content]}:{},...e.structuredContent?{structuredContent:{...e.structuredContent}}:{}}:{...t?.content?{content:[...t.content]}:{},...t?.structuredContent?{structuredContent:{...t.structuredContent}}:{}}}var RA=q(ee(),1),Rz="/api/mcp/resource",Dz=500,_z=0,Oz=16,Pz="2026-01-26",Nz=300,Bz=3e3,Uz=3;function zz(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function qz(e,t,a){return rf(e,t,a)?!1:t._meta?.["waniwani/autoInjectResultText"]!==!1}function EA({resourceUri:e,toolInput:t,toolResult:a,resourceEndpoint:n=Rz,chatSessionId:r,isDark:o=!1,className:l,autoHeight:i=!1,onOpenLink:s,onFollowUp:u,onCallTool:c,onDisplayModeChange:d,isFullscreen:f=!1,toolDefinitions:p}){let y=(0,qe.useRef)(null),v=(0,qe.useRef)(t),S=(0,qe.useRef)(a),g=(0,qe.useRef)({width:0,height:0}),x=(0,qe.useRef)(null),m=(0,qe.useRef)(!1),w=(0,qe.useRef)(0),L=(0,qe.useRef)("inline"),[b,A]=(0,qe.useState)(_z),[R,_]=(0,qe.useState)(void 0),T=(0,qe.useRef)(s),D=(0,qe.useRef)(u),N=(0,qe.useRef)(c),B=(0,qe.useRef)(d),j=(0,qe.useRef)(r),V=(0,qe.useRef)(p);v.current=t,S.current=a,T.current=s,D.current=u,N.current=c,B.current=d,j.current=r,V.current=p;let F=(0,qe.useCallback)(Z=>i?Math.max(Z+Oz,0):Math.min(Math.max(Z,50),Dz),[i]),te=(0,qe.useMemo)(()=>{let Z=n.includes("?")?"&":"?";return`${n}${Z}uri=${encodeURIComponent(e)}`},[n,e]),$e=(0,qe.useRef)(o);return $e.current=o,(0,qe.useEffect)(()=>{if(!m.current)return;let Z=y.current;Z?.contentWindow&&Z.contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{theme:o?"dark":"light"}},"*")},[o]),(0,qe.useEffect)(()=>{let Z=y.current;if(!Z)return;let C=!1,Xe=!1,le=null,k=null,Ze=setTimeout(()=>{if(C||Xe||w.current>=Uz)return;w.current+=1;let G=new URL(Z.src);G.searchParams.set("_retry",String(w.current)),Z.src=G.toString()},Bz),Ue=G=>{Z.contentWindow?.postMessage(G,"*")},Hn=G=>{if(C||G.source!==Z.contentWindow)return;let Q=G.data;if(!Q||typeof Q!="object"||Q.jsonrpc!=="2.0")return;let ke=Q.method,se=Q.id;if(ke==="ui/initialize"&&se!=null){Xe=!0,clearTimeout(Ze),Ue({jsonrpc:"2.0",id:se,result:{protocolVersion:Q.params?.protocolVersion??Pz,hostInfo:{name:"WaniWani Chat",version:"1.0.0"},hostCapabilities:{openLinks:{},message:{text:{}},tools:{},updateModelContext:{text:{},structuredContent:{}}},hostContext:{theme:$e.current?"dark":"light",displayMode:L.current}}});return}if(ke==="ui/notifications/initialized"){m.current=!0;let Se=v.current,Le=S.current,Fe=Le._meta&&typeof Le._meta=="object"?Le._meta:null,St=zz(j.current),zt=Fe&&typeof Fe.waniwani=="object"&&Fe.waniwani!==null?Fe.waniwani:null,un=zt||St?{...zt??{},...St?{sessionId:St}:{}}:void 0,cn=Fe||un?{...Fe??{},...un?{waniwani:un}:{}}:void 0;Ue({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:Se}});let Mo=Le.content??[{type:"text",text:JSON.stringify(Le)}];Ue({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{content:Mo,structuredContent:Le.structuredContent,_meta:cn,meta:cn}});return}if(ke==="ui/notifications/size-changed"){let Se=Q.params,Le=typeof Se?.height=="number"?Se.height:void 0,Fe=typeof Se?.width=="number"?Se.width:void 0,St=g.current,zt=Le!==void 0&&Le!==St.height,un=Fe!==void 0&&Fe!==St.width;if(!zt&&!un)return;if(zt&&Le!==void 0){St.height=Le;let cn=F(Le),Mo=Z.getBoundingClientRect().height;if(x.current&&(x.current.cancel(),x.current=null),A(cn),Z.animate&&Math.abs(Mo-cn)>2){let Pr=Z.animate([{height:`${Mo}px`},{height:`${cn}px`}],{duration:Nz,easing:"ease-out",fill:"forwards"});x.current=Pr,Pr.onfinish=()=>{x.current===Pr&&(Pr.cancel(),x.current=null)}}}un&&i&&Fe!==void 0&&(St.width=Fe,_(Fe));return}if(ke==="ui/open-link"&&se!=null){let Se=Q.params?.url;typeof Se=="string"&&(T.current?T.current(Se):window.open(Se,"_blank","noopener,noreferrer")),Ue({jsonrpc:"2.0",id:se,result:{}});return}if(ke==="ui/message"&&se!=null){if(D.current&&Q.params){let Se=Q.params,Le=le;if(le=null,k){clearTimeout(k.timer);let Fe=k.text;k=null;let St=(Se.content??[]).map(zt=>zt.text??"").join("").trim();Se={...Se,content:[{type:"text",text:`${St}
121
+ `||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},Fy=e=>{let t=0;for(let a=0;a<e.length-1;a+=1)e[a]==="$"&&e[a+1]==="$"&&(t+=1,a+=1);return t},fA=e=>{let t=yz.test(e),a=xz.test(e);if(t||a)return[e];let n=xa.lex(e,{gfm:!0}),r=[],o=[];for(let l of n){let i=l.raw,s=r.length;if(o.length>0){if(r[s-1]+=i,l.type==="html"){let u=i.match(vz);if(u){let c=u[1];o.at(-1)===c&&o.pop()}}continue}if(l.type==="html"&&l.block){let u=i.match(wz);if(u){let c=u[1];i.includes(`</${c}>`)||o.push(c)}}if(i.trim()==="$$"&&s>0){let u=r[s-1],c=qy(u),d=Fy(u);if(c&&d%2===1){r[s-1]=u+i;continue}}if(s>0&&bz(i)){let u=r[s-1],c=qy(u),d=Fy(u),f=Fy(i);if(c&&d%2===1&&!qy(i)&&f===1){r[s-1]=u+i;continue}}r.push(i)}return r},pA={raw:WC,sanitize:[ed,{}],harden:[VC,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},mA={gfm:[Ld,{}]},Sz=Object.values(pA),Cz=Object.values(mA),Iz={block:" \u258B",circle:" \u25CF"},Lz={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},Wt=(0,E.createContext)(Lz),Xy=(0,E.memo)(({content:e,shouldParseIncompleteMarkdown:t,index:a,...n})=>(0,M.jsx)(dA,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let a=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(a.length!==n.length||a.some(r=>{var o,l;return((o=e.components)==null?void 0:o[r])!==((l=t.components)==null?void 0:l[r])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Xy.displayName="Block";kz=["github-light","github-dark"],ef=(0,E.memo)(({children:e,mode:t="streaming",parseIncompleteMarkdown:a=!0,components:n,rehypePlugins:r=Sz,remarkPlugins:o=Cz,className:l,shikiTheme:i=kz,mermaid:s,controls:u=!0,isAnimating:c=!1,BlockComponent:d=Xy,parseMarkdownIntoBlocksFn:f=fA,caret:p,plugins:y,remend:v,linkSafety:S={enabled:!0},...g})=>{let x=(0,E.useId)(),[m,w]=(0,E.useTransition)(),L=(0,E.useMemo)(()=>typeof e!="string"?"":t==="streaming"&&a?r1(e,v):e,[e,t,a,v]),b=(0,E.useMemo)(()=>f(L),[L,f]),[A,R]=(0,E.useState)(b);(0,E.useEffect)(()=>{t==="streaming"?w(()=>{R(b)}):R(b)},[b,t]);let _=t==="streaming"?A:b,T=(0,E.useMemo)(()=>_.map((F,te)=>`${x}-${te}`),[_.length,x]),D=(0,E.useMemo)(()=>{var F,te;return{shikiTheme:(te=(F=y?.code)==null?void 0:F.getThemes())!=null?te:i,controls:u,isAnimating:c,mode:t,mermaid:s,linkSafety:S}},[i,u,c,t,s,S,y?.code]),N=(0,E.useMemo)(()=>({...fz,...n}),[n]),B=(0,E.useMemo)(()=>{let F=[];return y!=null&&y.cjk&&(F=[...F,...y.cjk.remarkPluginsBefore]),F=[...F,...o],y!=null&&y.cjk&&(F=[...F,...y.cjk.remarkPluginsAfter]),y!=null&&y.math&&(F=[...F,y.math.remarkPlugin]),F},[o,y?.math,y?.cjk]),j=(0,E.useMemo)(()=>y!=null&&y.math?[...r,y.math.rehypePlugin]:r,[r,y?.math]),V=(0,E.useMemo)(()=>p&&c?{"--streamdown-caret":`"${Iz[p]}"`}:void 0,[p,c]);return t==="static"?(0,M.jsx)(Hy.Provider,{value:y??null,children:(0,M.jsx)(Wt.Provider,{value:D,children:(0,M.jsx)("div",{className:Y("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",l),children:(0,M.jsx)(dA,{components:N,rehypePlugins:j,remarkPlugins:B,...g,children:e})})})}):(0,M.jsx)(Hy.Provider,{value:y??null,children:(0,M.jsx)(Wt.Provider,{value:D,children:(0,M.jsxs)("div",{className:Y("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",p?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,l),style:V,children:[_.length===0&&p&&c&&(0,M.jsx)("span",{}),_.map((F,te)=>(0,M.jsx)(d,{components:N,content:F,index:te,rehypePlugins:j,remarkPlugins:B,shouldParseIncompleteMarkdown:a,...g},T[te]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);ef.displayName="Streamdown";Tz=({children:e,className:t,minZoom:a=.5,maxZoom:n=3,zoomStep:r=.1,showControls:o=!0,initialZoom:l=1,fullscreen:i=!1})=>{let s=(0,E.useRef)(null),u=(0,E.useRef)(null),[c,d]=(0,E.useState)(l),[f,p]=(0,E.useState)({x:0,y:0}),[y,v]=(0,E.useState)(!1),[S,g]=(0,E.useState)({x:0,y:0}),[x,m]=(0,E.useState)({x:0,y:0}),w=(0,E.useCallback)(N=>{d(B=>Math.max(a,Math.min(n,B+N)))},[a,n]),L=(0,E.useCallback)(()=>{w(r)},[w,r]),b=(0,E.useCallback)(()=>{w(-r)},[w,r]),A=(0,E.useCallback)(()=>{d(l),p({x:0,y:0})},[l]),R=(0,E.useCallback)(N=>{N.preventDefault();let B=N.deltaY>0?-r:r;w(B)},[w,r]),_=(0,E.useCallback)(N=>{if(N.button!==0||N.isPrimary===!1)return;v(!0),g({x:N.clientX,y:N.clientY}),m(f);let B=N.currentTarget;B instanceof HTMLElement&&B.setPointerCapture(N.pointerId)},[f]),T=(0,E.useCallback)(N=>{if(!y)return;N.preventDefault();let B=N.clientX-S.x,j=N.clientY-S.y;p({x:x.x+B,y:x.y+j})},[y,S,x]),D=(0,E.useCallback)(N=>{v(!1);let B=N.currentTarget;B instanceof HTMLElement&&B.releasePointerCapture(N.pointerId)},[]);return(0,E.useEffect)(()=>{let N=s.current;if(N)return N.addEventListener("wheel",R,{passive:!1}),()=>{N.removeEventListener("wheel",R)}},[R]),(0,E.useEffect)(()=>{let N=u.current;if(N&&y)return document.body.style.userSelect="none",N.addEventListener("pointermove",T,{passive:!1}),N.addEventListener("pointerup",D),N.addEventListener("pointercancel",D),()=>{document.body.style.userSelect="",N.removeEventListener("pointermove",T),N.removeEventListener("pointerup",D),N.removeEventListener("pointercancel",D)}},[y,T,D]),(0,M.jsxs)("div",{className:Y("relative flex flex-col",i?"h-full w-full":"min-h-28 w-full",t),ref:s,style:{cursor:y?"grabbing":"grab"},children:[o?(0,M.jsxs)("div",{className:Y("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",i?"bottom-4 left-4":"bottom-2 left-2"),children:[(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c>=n,onClick:L,title:"Zoom in",type:"button",children:(0,M.jsx)(jU,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c<=a,onClick:b,title:"Zoom out",type:"button",children:(0,M.jsx)(VU,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:A,title:"Reset zoom and pan",type:"button",children:(0,M.jsx)(HU,{size:16})})]}):null,(0,M.jsx)("div",{className:Y("flex-1 origin-center transition-transform duration-150 ease-out",i?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:_,ref:u,role:"application",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},Uy=({chart:e,className:t,config:a,fullscreen:n=!1,showControls:r=!0})=>{let[o,l]=(0,E.useState)(null),[i,s]=(0,E.useState)(!1),[u,c]=(0,E.useState)(""),[d,f]=(0,E.useState)(""),[p,y]=(0,E.useState)(0),{mermaid:v}=(0,E.useContext)(Wt),S=Wy(),g=v?.errorComponent,{shouldRender:x,containerRef:m}=zU({immediate:n});if((0,E.useEffect)(()=>{if(x){if(!S){l("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{l(null),s(!0);let L=S.getMermaid(a),b=e.split("").reduce((_,T)=>(_<<5)-_+T.charCodeAt(0)|0,0),A=`mermaid-${Math.abs(b)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:R}=await L.render(A,e);c(R),f(R)}catch(L){if(!(d||u)){let b=L instanceof Error?L.message:"Failed to render Mermaid chart";l(b)}}finally{s(!1)}})()}},[e,a,p,x,S]),!(x||u||d))return(0,M.jsx)("div",{className:Y("my-4 min-h-[200px]",t),ref:m});if(i&&!u&&!d)return(0,M.jsx)("div",{className:Y("my-4 flex justify-center p-4",t),ref:m,children:(0,M.jsxs)("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[(0,M.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),(0,M.jsx)("span",{className:"text-sm",children:"Loading diagram..."})]})});if(o&&!u&&!d)return g?(0,M.jsx)("div",{ref:m,children:(0,M.jsx)(g,{chart:e,error:o,retry:()=>y(b=>b+1)})}):(0,M.jsxs)("div",{className:Y("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:m,children:[(0,M.jsxs)("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",o]}),(0,M.jsxs)("details",{className:"mt-2",children:[(0,M.jsx)("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),(0,M.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]});let w=u||d;return(0,M.jsx)("div",{className:Y("size-full",t),"data-streamdown":"mermaid",ref:m,children:(0,M.jsx)(Tz,{className:Y(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:(0,M.jsx)("div",{"aria-label":"Mermaid chart",className:Y("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:w},role:"img"})})})}});var g2=Ot((HJ,h2)=>{"use strict";function QF(e,t){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a,n=0;return function(...o){clearTimeout(a);let l=Date.now(),i=l-n,s=t-i;s<=0?(n=l,e.apply(this,o)):a=setTimeout(()=>{n=Date.now(),e.apply(this,o)},s)}}h2.exports=QF});var au=q(xe(),1),xx=q(uC(),1);var U_="https://app.waniwani.ai/api/mcp/chat",z_={api:U_,title:"Assistant",position:"bottom-right",width:400,height:600};function q_(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript;let e=document.querySelectorAll("script[src]");for(let t of e)if(t instanceof HTMLScriptElement&&/embed/i.test(t.src))return t;return null}function Pc(){let e=q_();if(!e)return{};let t=L=>e.getAttribute(L)??void 0,a=L=>{let b=e.getAttribute(L);if(b==null)return;let A=Number(b);return Number.isFinite(A)?A:void 0},n={},r=t("data-api");r&&(n.api=r);let o=t("data-token");o&&(n.token=o);let l=t("data-title");l&&(n.title=l);let i=t("data-welcome-message");i&&(n.welcomeMessage=i);let s=t("data-placeholder");s&&(n.placeholder=s);let u=t("data-mcp-server-url");u&&(n.mcpServerUrl=u);let c=t("data-css");c&&(n.css=c);let d=t("data-suggestions");d&&(n.suggestions=d.split(",").map(L=>L.trim()).filter(Boolean));let f=t("data-position");(f==="bottom-right"||f==="bottom-left")&&(n.position=f);let p=t("data-mode");(p==="floating"||p==="custom"||p==="inline")&&(n.mode=p);let y=t("data-layout");(y==="card"||y==="bar"||y==="embed")&&(n.layout=y);let v=a("data-width");v&&(n.width=v);let S=a("data-height");S&&(n.height=S);let g=t("data-primary-color"),x=t("data-background-color"),m=t("data-text-color"),w=t("data-font-family");return(g||x||m||w)&&(n.theme={},g&&(n.theme.primaryColor=g),x&&(n.theme.backgroundColor=x),m&&(n.theme.textColor=m),w&&(n.theme.fontFamily=w)),n}function Nc(e,t,a){let n=a??Pc(),r={token:"",...z_,...t??{},...n,...e,theme:{...t?.theme??{},...n.theme,...e?.theme}};if(!r.token)throw new Error("[WaniWani] Missing required config: `token`. Set data-token on the script tag or pass it to WaniWani.chat.init().");return r.mode||(r.mode="inline"),r}function Bc(e){if(!e.theme)return;let t=e.theme;return{...t.primaryColor?{primaryColor:t.primaryColor}:{},...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.textColor?{textColor:t.textColor}:{},...t.fontFamily?{fontFamily:t.fontFamily}:{}}}var ct=q(xe(),1);var Ut=q(xe(),1);var zc=q(xe());var Uc=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var cC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var dC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,n)=>n?n.toUpperCase():a.toLowerCase());var fh=e=>{let t=dC(e);return t.charAt(0).toUpperCase()+t.slice(1)};var os=q(xe());var fC={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var pC=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var mC=(0,os.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:l,...i},s)=>(0,os.createElement)("svg",{ref:s,...fC,width:t,height:t,stroke:e,strokeWidth:n?Number(a)*24/Number(t):a,className:Uc("lucide",r),...!o&&!pC(i)&&{"aria-hidden":"true"},...i},[...l.map(([u,c])=>(0,os.createElement)(u,c)),...Array.isArray(o)?o:[o]]));var Ye=(e,t)=>{let a=(0,zc.forwardRef)(({className:n,...r},o)=>(0,zc.createElement)(mC,{ref:o,iconNode:t,className:Uc(`lucide-${cC(fh(e))}`,`lucide-${e}`,n),...r}));return a.displayName=fh(e),a};var F_=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ls=Ye("arrow-down",F_);var H_=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],is=Ye("arrow-up",H_);var j_=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],yr=Ye("braces",j_);var V_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ss=Ye("check",V_);var G_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],us=Ye("chevron-down",G_);var W_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cs=Ye("chevron-right",W_);var $_=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],ds=Ye("clipboard-copy",$_);var X_=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],fs=Ye("file",X_);var Z_=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],ps=Ye("loader",Z_);var Q_=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],ms=Ye("paperclip",Q_);var K_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],hs=Ye("square",K_);var Y_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],no=Ye("x",Y_);var IC=q(xe(),1);var _t=q(xe(),1);var J_={damping:.7,stiffness:.05,mass:1.25},eO=70,tO=1e3/60,aO=350,qc=!1;globalThis.document?.addEventListener("mousedown",()=>{qc=!0});globalThis.document?.addEventListener("mouseup",()=>{qc=!1});globalThis.document?.addEventListener("click",()=>{qc=!1});var gC=(e={})=>{let[t,a]=(0,_t.useState)(!1),[n,r]=(0,_t.useState)(e.initial!==!1),[o,l]=(0,_t.useState)(!1),i=(0,_t.useRef)(null);i.current=e;let s=(0,_t.useCallback)(()=>{if(!qc)return!1;let x=window.getSelection();if(!x||!x.rangeCount)return!1;let m=x.getRangeAt(0);return m.commonAncestorContainer.contains(S.current)||S.current?.contains(m.commonAncestorContainer)},[]),u=(0,_t.useCallback)(x=>{d.isAtBottom=x,r(x)},[]),c=(0,_t.useCallback)(x=>{d.escapedFromLock=x,a(x)},[]),d=(0,_t.useMemo)(()=>{let x;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return S.current?.scrollTop??0},set scrollTop(m){S.current&&(S.current.scrollTop=m,d.ignoreScrollToTop=S.current.scrollTop)},get targetScrollTop(){return!S.current||!g.current?0:S.current.scrollHeight-1-S.current.clientHeight},get calculatedTargetScrollTop(){if(!S.current||!g.current)return 0;let{targetScrollTop:m}=this;if(!e.targetScrollTop)return m;if(x?.targetScrollTop===m)return x.calculatedScrollTop;let w=Math.max(Math.min(e.targetScrollTop(m,{scrollElement:S.current,contentElement:g.current}),m),0);return x={targetScrollTop:m,calculatedScrollTop:w},requestAnimationFrame(()=>{x=void 0}),w},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=eO}}},[]),f=(0,_t.useCallback)((x={})=>{typeof x=="string"&&(x={animation:x}),x.preserveScrollPosition||u(!0);let m=Date.now()+(Number(x.wait)||0),w=mh(i.current,x.animation),{ignoreEscapes:L=!1}=x,b,A=d.calculatedTargetScrollTop;x.duration instanceof Promise?x.duration.finally(()=>{b=Date.now()}):b=m+(x.duration??0);let R=async()=>{let _=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:T}=d,D=performance.now(),N=(D-(d.lastTick??D))/tO;if(d.animation||(d.animation={behavior:w,promise:_,ignoreEscapes:L}),d.animation.behavior===w&&(d.lastTick=D),s()||m>Date.now())return R();if(T<Math.min(A,d.calculatedTargetScrollTop)){if(d.animation?.behavior===w){if(w==="instant")return d.scrollTop=d.calculatedTargetScrollTop,R();d.velocity=(w.damping*d.velocity+w.stiffness*d.scrollDifference)/w.mass,d.accumulated+=d.velocity*N,d.scrollTop+=d.accumulated,d.scrollTop!==T&&(d.accumulated=0)}return R()}return b>Date.now()?(A=d.calculatedTargetScrollTop,R()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:mh(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,b-Date.now())||void 0}):d.isAtBottom)});return _.then(T=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),T))};return x.wait!==!0&&(d.animation=void 0),d.animation?.behavior===w?d.animation.promise:R()},[u,s,d]),p=(0,_t.useCallback)(()=>{c(!0),u(!1)},[c,u]),y=(0,_t.useCallback)(({target:x})=>{if(x!==S.current)return;let{scrollTop:m,ignoreScrollToTop:w}=d,{lastScrollTop:L=m}=d;d.lastScrollTop=m,d.ignoreScrollToTop=void 0,w&&w>m&&(L=w),l(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||m===w)return;if(s()){c(!0),u(!1);return}let b=m>L,A=m<L;if(d.animation?.ignoreEscapes){d.scrollTop=L;return}A&&(c(!0),u(!1)),b&&c(!1),!d.escapedFromLock&&d.isNearBottom&&u(!0)},1)},[c,u,s,d]),v=(0,_t.useCallback)(({target:x,deltaY:m})=>{let w=x;for(;!["scroll","auto"].includes(getComputedStyle(w).overflow);){if(!w.parentElement)return;w=w.parentElement}w===S.current&&m<0&&S.current.scrollHeight>S.current.clientHeight&&!d.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,d]),S=hC(x=>{S.current?.removeEventListener("scroll",y),S.current?.removeEventListener("wheel",v),x?.addEventListener("scroll",y,{passive:!0}),x?.addEventListener("wheel",v,{passive:!0})},[]),g=hC(x=>{if(d.resizeObserver?.disconnect(),!x)return;let m;d.resizeObserver=new ResizeObserver(([w])=>{let{height:L}=w.contentRect,b=L-(m??L);if(d.resizeDifference=b,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),l(d.isNearBottom),b>=0){let A=mh(i.current,m?i.current.resize:i.current.initial);f({animation:A,wait:!0,preserveScrollPosition:!0,duration:A==="instant"?void 0:aO})}else d.isNearBottom&&(c(!1),u(!0));m=L,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===b&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(x)},[]);return{contentRef:g,scrollRef:S,scrollToBottom:f,stopScroll:p,isAtBottom:n||o,isNearBottom:o,escapedFromLock:t,state:d}};function hC(e,t){let a=(0,_t.useCallback)(n=>(a.current=n,e(n)),t);return a}var ph=new Map;function mh(...e){let t={...J_},a=!1;for(let r of e){if(r==="instant"){a=!0;continue}typeof r=="object"&&(a=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let n=JSON.stringify(t);return ph.has(n)||ph.set(n,Object.freeze(t)),a?"instant":ph.get(n)}var ro=q(xe(),1),ta=q(xe(),1);var yC=(0,ta.createContext)(null),nO=typeof window<"u"?ta.useLayoutEffect:ta.useEffect;function gs({instance:e,children:t,resize:a,initial:n,mass:r,damping:o,stiffness:l,targetScrollTop:i,contextRef:s,...u}){let c=(0,ta.useRef)(null),d=ro.useCallback((L,b)=>(w?.targetScrollTop??i)?.(L,b)??L,[i]),f=gC({mass:r,damping:o,stiffness:l,resize:a,initial:n,targetScrollTop:d}),{scrollRef:p,contentRef:y,scrollToBottom:v,stopScroll:S,isAtBottom:g,escapedFromLock:x,state:m}=e??f,w=(0,ta.useMemo)(()=>({scrollToBottom:v,stopScroll:S,scrollRef:p,isAtBottom:g,escapedFromLock:x,contentRef:y,state:m,get targetScrollTop(){return c.current},set targetScrollTop(L){c.current=L}}),[v,g,y,p,S,x,m]);return(0,ta.useImperativeHandle)(s,()=>w,[w]),nO(()=>{p.current&&getComputedStyle(p.current).overflow==="visible"&&(p.current.style.overflow="auto")},[]),ro.createElement(yC.Provider,{value:w},ro.createElement("div",{...u},typeof t=="function"?t(w):t))}(function(e){function t({children:a,scrollClassName:n,...r}){let o=hh();return ro.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:n},ro.createElement("div",{...r,ref:o.contentRef},typeof a=="function"?a(o):a))}e.Content=t})(gs||(gs={}));function hh(){let e=(0,ta.useContext)(yC);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}gh();xh();var rO=vC({prefix:"ww"});function $(...e){return rO(Fc(e))}var CC=q(ee(),1),en=({className:e,variant:t="default",size:a="default",type:n="button",...r})=>(0,CC.jsx)("button",{type:n,className:$("ww:inline-flex ww:cursor-pointer ww:items-center ww:justify-center ww:rounded-md ww:font-medium ww:transition-colors ww:disabled:pointer-events-none ww:disabled:opacity-50",t==="default"&&"ww:bg-primary ww:text-primary-foreground ww:hover:bg-primary/90",t==="outline"&&"ww:border ww:border-border ww:bg-background ww:hover:bg-accent ww:hover:text-accent-foreground",t==="ghost"&&"ww:hover:bg-accent ww:hover:text-accent-foreground",a==="default"&&"ww:h-9 ww:px-4 ww:py-2 ww:text-sm",a==="sm"&&"ww:h-8 ww:px-3 ww:text-xs",a==="icon"&&"ww:size-9 ww:!rounded-full",a==="icon-sm"&&"ww:size-7 ww:!rounded-full",e),...r});var ys=q(ee(),1),Sl=({className:e,...t})=>(0,ys.jsx)(gs,{className:$("ww:relative ww:flex-1 ww:overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Cl=({className:e,...t})=>(0,ys.jsx)(gs.Content,{className:$("ww:flex ww:flex-col ww:gap-6 ww:px-4 ww:py-6 ww:mx-auto ww:w-full ww:max-w-3xl",e),...t}),Il=({className:e,...t})=>{let{isAtBottom:a,scrollToBottom:n}=hh(),r=(0,IC.useCallback)(()=>{n()},[n]);return!a&&(0,ys.jsx)(en,{className:$("ww:absolute ww:bottom-4 ww:left-[50%] ww:translate-x-[-50%] ww:rounded-full",e),onClick:r,size:"icon",variant:"outline",...t,children:(0,ys.jsx)(ls,{className:"ww:size-4"})})};var jc=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,a)=>(a&=63,a<36?t+=a.toString(36):a<62?t+=(a-26).toString(36).toUpperCase():a>62?t+="-":t+="_",t),"");var Be=q(xe(),1);var jt=q(ee(),1),iO=async e=>{try{let a=await(await fetch(e)).blob();return new Promise(n=>{let r=new FileReader;r.onloadend=()=>n(r.result),r.onerror=()=>n(null),r.readAsDataURL(a)})}catch{return null}},LC=(0,Be.createContext)(null),kC=()=>{let e=(0,Be.useContext)(LC);if(!e)throw new Error("usePromptInputAttachments must be used within a PromptInput");return e},Ll=({className:e,accept:t,multiple:a,globalDrop:n,maxFiles:r,maxFileSize:o,onSubmit:l,children:i,...s})=>{let u=(0,Be.useRef)(null),c=(0,Be.useRef)(null),[d,f]=(0,Be.useState)([]),p=(0,Be.useRef)(d);(0,Be.useEffect)(()=>{p.current=d},[d]);let y=(0,Be.useCallback)(()=>{u.current?.click()},[]),v=(0,Be.useCallback)(L=>{let b=[...L];if(b.length===0)return;let A=_=>o?_.size<=o:!0,R=b.filter(A);f(_=>{let T=typeof r=="number"?Math.max(0,r-_.length):void 0,D=typeof T=="number"?R.slice(0,T):R;return[..._,...D.map(N=>({filename:N.name,id:jc(),mediaType:N.type,type:"file",url:URL.createObjectURL(N)}))]})},[r,o]),S=(0,Be.useCallback)(L=>{f(b=>{let A=b.find(R=>R.id===L);return A?.url&&URL.revokeObjectURL(A.url),b.filter(R=>R.id!==L)})},[]),g=(0,Be.useCallback)(()=>{f(L=>{for(let b of L)b.url&&URL.revokeObjectURL(b.url);return[]})},[]);(0,Be.useEffect)(()=>()=>{for(let L of p.current)L.url&&URL.revokeObjectURL(L.url)},[]);let x=(0,Be.useCallback)(L=>{L.currentTarget.files&&v(L.currentTarget.files),L.currentTarget.value=""},[v]);(0,Be.useEffect)(()=>{if(!n)return;let L=A=>{A.dataTransfer?.types?.includes("Files")&&A.preventDefault()},b=A=>{A.dataTransfer?.types?.includes("Files")&&A.preventDefault(),A.dataTransfer?.files&&A.dataTransfer.files.length>0&&v(A.dataTransfer.files)};return document.addEventListener("dragover",L),document.addEventListener("drop",b),()=>{document.removeEventListener("dragover",L),document.removeEventListener("drop",b)}},[v,n]);let m=(0,Be.useCallback)(async L=>{L.preventDefault();let b=L.currentTarget,R=new FormData(b).get("message")||"";b.reset();let _=await Promise.all(d.map(async({id:T,...D})=>{if(D.url?.startsWith("blob:")){let N=await iO(D.url);return{...D,url:N??D.url}}return D}));try{let T=l({files:_,text:R},L);T instanceof Promise&&await T,g()}catch{}},[d,l,g]),w=(0,Be.useMemo)(()=>({add:v,clear:g,files:d,openFileDialog:y,remove:S}),[d,v,S,g,y]);return(0,jt.jsxs)(LC.Provider,{value:w,children:[(0,jt.jsx)("input",{accept:t,"aria-label":"Upload files",className:"ww:hidden",multiple:a,onChange:x,ref:u,title:"Upload files",type:"file"}),(0,jt.jsx)("form",{className:$("ww:flex ww:w-full ww:flex-col ww:rounded-lg ww:border ww:border-border ww:bg-background",e),onSubmit:m,ref:c,...s,children:i})]})};var kl=({onChange:e,onKeyDown:t,className:a,placeholder:n="What would you like to know?",...r})=>{let o=kC(),[l,i]=(0,Be.useState)(!1),s=(0,Be.useCallback)(c=>{if(t?.(c),!c.defaultPrevented){if(c.key==="Enter"){if(l||c.nativeEvent.isComposing||c.shiftKey)return;c.preventDefault();let{form:d}=c.currentTarget;if(d?.querySelector('button[type="submit"]')?.disabled)return;d?.requestSubmit()}if(c.key==="Backspace"&&c.currentTarget.value===""&&o.files.length>0){c.preventDefault();let d=o.files.at(-1);d&&o.remove(d.id)}}},[t,l,o]),u=(0,Be.useCallback)(c=>{let d=c.clipboardData?.items;if(!d)return;let f=[];for(let p of d)if(p.kind==="file"){let y=p.getAsFile();y&&f.push(y)}f.length>0&&(c.preventDefault(),o.add(f))},[o]);return(0,jt.jsx)("textarea",{className:$("ww:field-sizing-content ww:max-h-48 ww:min-h-0 ww:w-full ww:resize-none ww:border-0 ww:bg-transparent ww:px-3 ww:py-2 ww:text-sm ww:outline-none ww:placeholder:text-muted-foreground",a),name:"message",onCompositionEnd:()=>i(!1),onCompositionStart:()=>i(!0),onKeyDown:s,onPaste:u,placeholder:n,onChange:e,...r})},Tl=({className:e,status:t,onStop:a,onClick:n,children:r,...o})=>{let l=t==="submitted"||t==="streaming",i=(0,jt.jsx)(is,{className:"ww:size-4"});t==="submitted"?i=(0,jt.jsx)(ps,{className:"ww:size-4 ww:animate-spin"}):t==="streaming"&&(i=(0,jt.jsx)(hs,{className:"ww:size-4"}));let s=(0,Be.useCallback)(u=>{if(l&&a){u.preventDefault(),a();return}n?.(u)},[l,a,n]);return(0,jt.jsx)(en,{"aria-label":l?"Stop":"Submit",className:$("ww:bg-foreground ww:text-background ww:hover:bg-foreground ww:rounded-full",e),onClick:s,size:"icon-sm",type:l&&a?"button":"submit",variant:"ghost",...o,children:r??i})},Ml=({className:e,children:t,...a})=>{let n=kC();return n.files.length>0?(0,jt.jsxs)(en,{className:$("ww:group ww:relative",e),onClick:()=>n.clear(),size:"icon-sm",type:"button",variant:"ghost","aria-label":"Remove all attachments",...a,children:[(0,jt.jsx)("span",{className:"ww:flex ww:size-5 ww:items-center ww:justify-center ww:rounded-full ww:bg-primary ww:text-[10px] ww:font-medium ww:text-primary-foreground ww:transition-opacity ww:group-hover:opacity-0",children:n.files.length}),(0,jt.jsx)(no,{className:"ww:absolute ww:size-4 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100"})]}):(0,jt.jsx)(en,{className:$(e),onClick:()=>n.openFileDialog(),size:"icon-sm",type:"button",variant:"ghost",...a,children:t??(0,jt.jsx)(ms,{className:"ww:size-4"})})};var Vc=q(xe(),1);var oo=q(ee(),1),TC=({className:e,...t})=>(0,oo.jsx)("div",{className:$("ww:flex ww:flex-col ww:gap-1 ww:px-3 ww:py-2",e),...t}),MC=({className:e,...t})=>(0,oo.jsx)("li",{className:$("ww:group ww:flex ww:items-center ww:gap-2 ww:rounded-md ww:px-2 ww:py-1 ww:text-sm ww:transition-colors ww:hover:bg-muted",e),...t}),AC=({className:e,...t})=>(0,oo.jsx)("span",{className:$("ww:inline-block ww:size-2 ww:shrink-0 ww:rounded-full ww:border ww:border-muted-foreground/50",e),...t}),EC=({className:e,...t})=>(0,oo.jsx)("span",{className:$("ww:line-clamp-1 ww:grow ww:break-words ww:text-muted-foreground",e),...t}),RC=({className:e,...t})=>(0,oo.jsx)("div",{className:$("ww:flex ww:shrink-0 ww:gap-1 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100",e),...t}),DC=({className:e,...t})=>(0,oo.jsx)(en,{className:$("ww:size-auto ww:rounded ww:p-1 ww:text-muted-foreground ww:hover:bg-muted-foreground/10 ww:hover:text-foreground",e),size:"icon",type:"button",variant:"ghost",...t});var Ra=q(ee(),1),_C=(0,Vc.memo)(({message:e,onRemove:t})=>{let a=(0,Vc.useCallback)(()=>t(e.id),[t,e.id]);return(0,Ra.jsxs)(MC,{children:[(0,Ra.jsx)(AC,{}),(0,Ra.jsx)(EC,{children:e.text||"(attachment)"}),(0,Ra.jsx)(RC,{children:(0,Ra.jsx)(DC,{"aria-label":"Remove from queue",onClick:a,children:(0,Ra.jsx)(no,{className:"ww:size-3"})})})]})});_C.displayName="ChatQueueItem";function Al({queuedMessages:e,onRemove:t,className:a}){return e.length===0?null:(0,Ra.jsxs)(TC,{className:$("ww:border-t ww:border-border",a),children:[(0,Ra.jsxs)("div",{className:"ww:text-[11px] ww:font-medium ww:text-muted-foreground ww:px-2",children:[e.length," queued"]}),(0,Ra.jsx)("ul",{children:e.map(n=>(0,Ra.jsx)(_C,{message:n,onRemove:t},n.id))})]})}var vh=q(xe(),1),OC=q(ee(),1);function Gc({messages:e,evalEnabled:t,api:a="/api/waniwani"}){let[n,r]=(0,vh.useState)(!1),[o,l]=(0,vh.useState)(null),i=async()=>{let u={name:`session-${new Date().toISOString().slice(0,19)}`,type:"functional",messages:e,mode:"manual"};r(!0),l(null);try{let c=await fetch(`${a}/scenarios`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!c.ok)throw new Error(`${c.status}`);l("saved")}catch{l("error")}finally{r(!1),setTimeout(()=>l(null),2e3)}};return!t||e.length===0?null:(0,OC.jsx)("button",{type:"button",onClick:i,disabled:n,title:"Save scenario to WaniWani",className:"ww:ml-auto ww:text-[10px] ww:font-mono ww:uppercase ww:tracking-wider ww:text-muted-foreground hover:ww:text-foreground ww:cursor-pointer ww:transition-colors ww:disabled:opacity-40",children:n?"saving...":o==="saved"?"saved":o==="error"?"error":"export"})}var xr=q(ee(),1),PC=({files:e,className:t,...a})=>e.length===0?null:(0,xr.jsx)("div",{className:$("ww:flex ww:flex-wrap ww:gap-1.5",t),...a,children:e.map((n,r)=>(0,xr.jsx)(sO,{file:n},r))});function sO({file:e}){return e.mediaType?.startsWith("image/")&&e.url?(0,xr.jsx)("img",{src:e.url,alt:e.filename??"attachment",className:"ww:h-16 ww:max-w-32 ww:rounded ww:object-cover"}):(0,xr.jsxs)("span",{className:"ww:inline-flex ww:items-center ww:gap-1.5 ww:rounded ww:bg-background/20 ww:px-2 ww:py-1 ww:text-xs",children:[(0,xr.jsx)(fs,{className:"ww:size-3 ww:shrink-0"}),(0,xr.jsx)("span",{className:"ww:max-w-24 ww:truncate",children:e.filename??"file"})]})}var wh=q(ee(),1),bh=({className:e,size:t=5,...a})=>(0,wh.jsx)("div",{className:$("ww:flex ww:items-center ww:gap-1",e),...a,children:[0,1,2].map(n=>(0,wh.jsx)("div",{className:"ww:rounded-full ww:bg-muted-foreground/60",style:{width:t,height:t,animation:"ww-pulse 1.4s ease-in-out infinite",animationDelay:`${n*.2}s`}},n))});var NC={name:"cjk-noop",type:"cjk",remarkPluginsBefore:[],remarkPluginsAfter:[],remarkPlugins:[]};var BC={name:"shiki-noop",type:"code-highlighter",supportsLanguage:()=>!1,getSupportedLanguages:()=>[],getThemes:()=>["github-light","github-dark"],highlight:()=>null};var hA=q(xe(),1);Zd();var Gs=q(ee(),1),tf=({className:e,from:t,children:a,...n})=>(0,Gs.jsx)("div",{className:$("ww:group ww:flex ww:w-full",t==="user"?"is-user ww:ml-auto ww:max-w-[80%] ww:flex-col ww:items-end":"is-assistant ww:flex-col",e),...n,children:(0,Gs.jsx)("div",{className:$("ww:flex ww:min-w-0 ww:flex-col ww:gap-2","ww:w-full"),children:a})}),af=({children:e,className:t,...a})=>(0,Gs.jsx)("div",{className:$("ww:flex ww:w-fit ww:min-w-0 ww:max-w-full ww:flex-col ww:gap-2 ww:overflow-hidden ww:text-base","ww:group-[.is-user]:ml-auto ww:group-[.is-user]:rounded-lg ww:group-[.is-user]:bg-user-bubble ww:group-[.is-user]:px-4 ww:group-[.is-user]:py-3 ww:group-[.is-user]:text-primary-foreground","ww:group-[.is-assistant]:text-foreground",t),...a,children:e}),Mz={cjk:NC,code:BC},nf=(0,hA.memo)(({className:e,...t})=>(0,Gs.jsx)(ef,{className:$("ww:size-full ww:[&>*:first-child]:mt-0 ww:[&>*:last-child]:mb-0",e),plugins:Mz,...t}),(e,t)=>e.children===t.children);nf.displayName="MessageResponse";var yA=q(ee(),1);function gA({className:e,text:t,...a}){return t?(0,yA.jsx)("pre",{className:$("ww:mb-2 ww:overflow-x-auto ww:whitespace-pre-wrap ww:break-words ww:text-xs ww:font-mono ww:text-muted-foreground",e),...a,children:t}):null}var vt=q(xe(),1);var fe=q(ee(),1);function Az(e,t=80){if(e==null)return String(e);if(typeof e!="object")return String(e).slice(0,t);if(Array.isArray(e))return`Array(${e.length})`;let a=JSON.stringify(e);if(a.length<=t)return a;let n=Object.entries(e),r=[],o=t-2;for(let[l,i]of n){if(o<=8)break;let s=l.length>4?`${l.slice(0,4)}\u2026`:l,u;typeof i=="string"?u=i.length>2?`'${i.slice(0,1)}\u2026`:`'${i}'`:Array.isArray(i)?u=`Array(${i.length})`:typeof i=="object"&&i!==null?u="{\u2026}":u=String(i);let c=`${s}\u2009${u}`;r.push(c),o-=c.length+3}return`{${r.join(", ")}}`}function Ez({text:e,className:t}){let[a,n]=(0,vt.useState)(!1),r=(0,vt.useRef)(null);(0,vt.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let o=(0,vt.useCallback)(async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)}catch{}},[e]);return(0,fe.jsx)(en,{variant:"ghost",size:"sm",onClick:o,className:$("ww:h-auto ww:gap-1 ww:px-1.5 ww:py-0.5 ww:text-xs ww:text-muted-foreground ww:hover:text-foreground",t),children:a?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(ss,{className:"ww:size-3.5"}),(0,fe.jsx)("span",{children:"Copied"})]}):(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(ds,{className:"ww:size-3.5"}),(0,fe.jsx)("span",{children:"Copy"})]})})}function wA({data:e,label:t,className:a,...n}){let[r,o]=(0,vt.useState)(!1),l=(0,vt.useMemo)(()=>JSON.stringify(e,null,2),[e]),i=Az(e);return(0,fe.jsxs)("div",{className:$("ww:rounded-lg ww:bg-tool-card",a),...n,children:[(0,fe.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:px-3 ww:pt-2.5 ww:pb-1.5",children:[(0,fe.jsx)("span",{className:"ww:text-xs ww:font-medium ww:text-muted-foreground",children:t}),(0,fe.jsx)(Ez,{text:l})]}),(0,fe.jsxs)("button",{type:"button",onClick:()=>o(s=>!s),className:"ww:flex ww:w-full ww:items-start ww:gap-2 ww:px-3 ww:pb-3 ww:text-left",children:[(0,fe.jsx)(cs,{className:$("ww:mt-0.5 ww:size-3.5 ww:shrink-0 ww:text-muted-foreground ww:transition-transform ww:duration-150",r&&"ww:rotate-90")}),r?(0,fe.jsx)("pre",{className:"ww:overflow-x-auto ww:text-xs ww:font-mono ww:text-foreground ww:whitespace-pre-wrap ww:break-all",children:(0,fe.jsx)("code",{children:l})}):(0,fe.jsx)("span",{className:"ww:truncate ww:text-xs ww:font-mono ww:text-foreground/80",children:i})]})]})}var Qy=(0,vt.createContext)({open:!1,toggle:()=>{}});function bA({className:e,defaultOpen:t=!1,children:a,...n}){let[r,o]=(0,vt.useState)(t);return(0,fe.jsx)(Qy.Provider,{value:{open:r,toggle:()=>o(l=>!l)},children:(0,fe.jsx)("div",{className:$("ww:mb-4 ww:w-full",e),"data-state":r?"open":"closed",...n,children:a})})}function SA({className:e,title:t,state:a,...n}){let{open:r,toggle:o}=(0,vt.useContext)(Qy),l=a==="input-available"||a==="input-streaming";return(0,fe.jsxs)("button",{type:"button",onClick:o,className:$("ww:flex ww:w-full ww:items-center ww:justify-between ww:gap-3 ww:py-1.5",e),"aria-expanded":r,...n,children:[(0,fe.jsxs)("div",{className:"ww:flex ww:min-w-0 ww:items-center ww:gap-2",children:[(0,fe.jsx)(yr,{className:"ww:size-4 ww:shrink-0 ww:text-muted-foreground"}),(0,fe.jsx)("span",{className:"ww:truncate ww:text-sm ww:font-medium",children:t}),l&&(0,fe.jsx)("span",{className:"ww:size-2 ww:shrink-0 ww:rounded-full ww:bg-primary ww:animate-pulse"})]}),(0,fe.jsx)(us,{className:$("ww:size-4 ww:shrink-0 ww:text-muted-foreground ww:transition-transform ww:duration-200",r&&"ww:rotate-180")})]})}function CA({className:e,children:t,...a}){let{open:n}=(0,vt.useContext)(Qy);return(0,fe.jsx)("div",{className:$("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,fe.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,fe.jsx)("div",{className:$("ww:mt-2 ww:space-y-3 ww:rounded-lg ww:border ww:border-border ww:bg-background ww:p-3",e),...a,children:t})})})}function IA({className:e,input:t,debug:a,...n}){let r=(0,vt.useMemo)(()=>{if(!a&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:o,...l}=t;return l}return t},[t,a]);return(0,fe.jsx)(wA,{data:r,label:"Request",className:e,...n})}function Zy(e){if(!(typeof e!="object"||e===null))return e}function LA(e){return Zy(e?.ui)}function kA(e){return Zy(Zy(e)?._meta)}function xA(e){if(!e)return;let t=LA(e)?.resourceUri;if(typeof t=="string"&&t.length>0)return t;let a=e["ui/resourceUri"];if(typeof a=="string"&&a.length>0)return a;let n=e["openai/outputTemplate"];if(typeof n=="string"&&n.length>0)return n}function vA(e){return LA(e)?.autoHeight===!0}function rf(e,t,a){if(e){let n=xA(a?.[e]?._meta);if(n)return n}return xA(kA(t))}function TA(e,t,a){return e&&vA(a?.[e]?._meta)?!0:vA(kA(t))}function MA({className:e,output:t,errorText:a,debug:n,...r}){let o=(0,vt.useMemo)(()=>{if(!n&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:l,...i}=t;return i}return t},[t,n]);return t||a?a?(0,fe.jsxs)("div",{className:$("ww:space-y-2",e),...r,children:[(0,fe.jsx)("h4",{className:"ww:text-xs ww:font-medium ww:uppercase ww:tracking-wide ww:text-muted-foreground",children:"Error"}),(0,fe.jsx)("div",{className:"ww:rounded-lg ww:bg-destructive/10 ww:p-3 ww:text-xs ww:text-destructive",children:a})]}):(0,fe.jsx)(wA,{data:o,label:"Response",className:e,...r}):null}var qe=q(xe(),1);function Fl(e){if(!e)return!1;let t=Array.isArray(e.content)&&e.content.length>0,a=typeof e.structuredContent=="object"&&e.structuredContent!==null&&Object.keys(e.structuredContent).length>0;return t||a}function AA(e,t){return!Fl(e)&&!Fl(t)?null:Fl(e)?Fl(t)?{...e.content||t.content?{content:[...e.content??[],...t.content??[]]}:{},...e.structuredContent||t.structuredContent?{structuredContent:{...e.structuredContent??{},...t.structuredContent??{}}}:{}}:{...e.content?{content:[...e.content]}:{},...e.structuredContent?{structuredContent:{...e.structuredContent}}:{}}:{...t?.content?{content:[...t.content]}:{},...t?.structuredContent?{structuredContent:{...t.structuredContent}}:{}}}var RA=q(ee(),1),Rz="/api/mcp/resource",Dz=500,_z=0,Oz=16,Pz="2026-01-26",Nz=300,Bz=3e3,Uz=3;function zz(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function qz(e,t,a){return rf(e,t,a)?!1:t._meta?.["waniwani/autoInjectResultText"]!==!1}function EA({resourceUri:e,toolInput:t,toolResult:a,resourceEndpoint:n=Rz,chatSessionId:r,isDark:o=!1,className:l,autoHeight:i=!1,onOpenLink:s,onFollowUp:u,onCallTool:c,onDisplayModeChange:d,isFullscreen:f=!1,toolDefinitions:p}){let y=(0,qe.useRef)(null),v=(0,qe.useRef)(t),S=(0,qe.useRef)(a),g=(0,qe.useRef)({width:0,height:0}),x=(0,qe.useRef)(null),m=(0,qe.useRef)(!1),w=(0,qe.useRef)(0),L=(0,qe.useRef)("inline"),[b,A]=(0,qe.useState)(_z),[R,_]=(0,qe.useState)(void 0),T=(0,qe.useRef)(s),D=(0,qe.useRef)(u),N=(0,qe.useRef)(c),B=(0,qe.useRef)(d),j=(0,qe.useRef)(r),V=(0,qe.useRef)(p);v.current=t,S.current=a,T.current=s,D.current=u,N.current=c,B.current=d,j.current=r,V.current=p;let F=(0,qe.useCallback)(Z=>i?Math.max(Z+Oz,0):Math.min(Math.max(Z,50),Dz),[i]),te=(0,qe.useMemo)(()=>{let Z=n.includes("?")?"&":"?";return`${n}${Z}uri=${encodeURIComponent(e)}`},[n,e]),$e=(0,qe.useRef)(o);return $e.current=o,(0,qe.useEffect)(()=>{if(!m.current)return;let Z=y.current;Z?.contentWindow&&Z.contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{theme:o?"dark":"light"}},"*")},[o]),(0,qe.useEffect)(()=>{let Z=y.current;if(!Z)return;let C=!1,Xe=!1,le=null,k=null,Ze=setTimeout(()=>{if(C||Xe||w.current>=Uz)return;w.current+=1;let G=new URL(Z.src);G.searchParams.set("_retry",String(w.current)),Z.src=G.toString()},Bz),Ue=G=>{Z.contentWindow?.postMessage(G,"*")},Hn=G=>{if(C||G.source!==Z.contentWindow)return;let Q=G.data;if(!Q||typeof Q!="object"||Q.jsonrpc!=="2.0")return;let ke=Q.method,se=Q.id;if(ke==="ui/initialize"&&se!=null){Xe=!0,clearTimeout(Ze),Ue({jsonrpc:"2.0",id:se,result:{protocolVersion:Q.params?.protocolVersion??Pz,hostInfo:{name:"WaniWani Chat",version:"1.0.0"},hostCapabilities:{openLinks:{},message:{text:{}},tools:{},updateModelContext:{text:{},structuredContent:{}}},hostContext:{theme:$e.current?"dark":"light",displayMode:L.current}}});return}if(ke==="ui/notifications/initialized"){m.current=!0;let Se=v.current,Le=S.current,Fe=Le._meta&&typeof Le._meta=="object"?Le._meta:null,St=zz(j.current),zt=Fe&&typeof Fe.waniwani=="object"&&Fe.waniwani!==null?Fe.waniwani:null,un=zt||St?{...zt??{},...St?{sessionId:St}:{}}:void 0,cn=Fe||un?{...Fe??{},...un?{waniwani:un}:{}}:void 0;Ue({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:Se}});let Mo=Le.content??[{type:"text",text:JSON.stringify(Le)}];Ue({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{content:Mo,structuredContent:Le.structuredContent,_meta:cn,meta:cn}});return}if(ke==="ui/notifications/size-changed"){let Se=Q.params,Le=typeof Se?.height=="number"?Se.height:void 0,Fe=typeof Se?.width=="number"?Se.width:void 0,St=g.current,zt=Le!==void 0&&Le!==St.height,un=Fe!==void 0&&Fe!==St.width;if(!zt&&!un)return;if(zt&&Le!==void 0){St.height=Le;let cn=F(Le),Mo=Z.getBoundingClientRect().height;if(x.current&&(x.current.cancel(),x.current=null),A(cn),Z.animate&&Math.abs(Mo-cn)>2){let Pr=Z.animate([{height:`${Mo}px`},{height:`${cn}px`}],{duration:Nz,easing:"ease-out",fill:"forwards"});x.current=Pr,Pr.onfinish=()=>{x.current===Pr&&(Pr.cancel(),x.current=null)}}}un&&i&&Fe!==void 0&&(St.width=Fe,_(Fe));return}if(ke==="ui/open-link"&&se!=null){let Se=Q.params?.url;typeof Se=="string"&&(T.current?T.current(Se):window.open(Se,"_blank","noopener,noreferrer")),Ue({jsonrpc:"2.0",id:se,result:{}});return}if(ke==="ui/message"&&se!=null){if(D.current&&Q.params){let Se=Q.params,Le=le;if(le=null,k){clearTimeout(k.timer);let Fe=k.text;k=null;let St=(Se.content??[]).map(zt=>zt.text??"").join("").trim();Se={...Se,content:[{type:"text",text:`${St}
122
122
 
123
123
  ${Fe}`}]}}D.current({...Se,...Le?{modelContext:Le}:{}})}Ue({jsonrpc:"2.0",id:se,result:{}});return}if(ke==="ui/update-model-context"&&se!=null){le=AA(le,Q.params),Ue({jsonrpc:"2.0",id:se,result:{}});return}if(ke==="tools/call"&&se!=null){let Se=N.current;if(!Se){Ue({jsonrpc:"2.0",id:se,error:{code:-32601,message:"tools/call not supported"}});return}let Le=Q.params?.name;Se({name:Le,arguments:Q.params?.arguments??{}}).then(Fe=>{Ue({jsonrpc:"2.0",id:se,result:Fe});let St=Fe.content?.map(zt=>zt.text??"").join("").trim();St&&qz(Le,Fe,V.current)&&(k&&clearTimeout(k.timer),k={text:St,timer:setTimeout(()=>{if(C)return;let zt=le;le=null,k=null,D.current?.({role:"user",content:[{type:"text",text:St}],...zt?{modelContext:zt}:{}})},500)})}).catch(Fe=>{let St=Fe instanceof Error?Fe.message:"Tool call failed";Ue({jsonrpc:"2.0",id:se,error:{code:-32e3,message:St}})});return}if(ke==="ui/request-display-mode"&&se!=null){let Se=Q.params?.mode,Le=Se==="fullscreen"||Se==="inline"||Se==="pip"?Se:"inline";L.current=Le,Ue({jsonrpc:"2.0",id:se,result:{mode:Le}}),Ue({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{displayMode:Le}}),B.current?.(Le);return}if(ke==="ui/resource-teardown"&&se!=null){Ue({jsonrpc:"2.0",id:se,result:{}});return}ke==="ping"&&se!=null&&Ue({jsonrpc:"2.0",id:se,result:{}})};return window.addEventListener("message",Hn),()=>{C=!0,clearTimeout(Ze),k&&clearTimeout(k.timer),window.removeEventListener("message",Hn)}},[i,F]),(0,RA.jsx)("iframe",{ref:y,src:te,sandbox:"allow-scripts allow-forms allow-same-origin",className:$(!f&&"ww:rounded-md ww:border ww:border-border",l),style:{height:f?"100%":b,minWidth:f||!R?void 0:`min(${R}px, 100%)`,width:"100%",border:"none",colorScheme:o?"dark":"auto"},title:"MCP App"})}var Ar=q(ee(),1);function DA({icon:e,title:t,description:a,suggestions:n,onSuggestionSelect:r}){return(0,Ar.jsxs)("div",{className:"ww:flex ww:flex-col ww:items-center ww:justify-center ww:py-12 ww:px-6 ww:text-center ww:min-h-full",children:[e&&(0,Ar.jsx)("div",{className:"ww:mb-4 ww:flex ww:items-center ww:justify-center ww:size-12 ww:rounded-xl ww:bg-foreground ww:text-background",children:e}),(0,Ar.jsx)("h2",{className:"ww:text-lg ww:font-semibold ww:text-foreground",children:t}),a&&(0,Ar.jsx)("p",{className:"ww:mt-1 ww:text-sm ww:text-muted-foreground ww:max-w-sm",children:a}),n&&n.length>0&&(0,Ar.jsx)("div",{className:"ww:mt-6 ww:w-full ww:max-w-md ww:flex ww:flex-col ww:gap-2",children:n.map((o,l)=>(0,Ar.jsx)("button",{type:"button",onClick:()=>r?.(o),className:$("ww:w-full ww:text-left ww:rounded-xl ww:border ww:border-border ww:bg-background ww:px-4 ww:py-3 ww:text-sm","ww:text-foreground ww:hover:bg-accent ww:hover:border-primary/30","ww:transition-all ww:duration-200 ww:ease-out ww:cursor-pointer","ww:animate-[ww-fade-in_0.2s_ease-out_both]"),style:{animationDelay:`${l*50}ms`},children:o},o))})]})}var _A=q(xe(),1);var Ws=q(ee(),1),of=class extends _A.Component{constructor(){super(...arguments);ve(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a){console.warn("[WaniWani] Widget failed to render:",a.message)}render(){return this.state.hasError?(0,Ws.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:rounded-md ww:border ww:border-border ww:bg-muted/50 ww:px-4 ww:py-3 ww:text-sm ww:text-muted-foreground",children:[(0,Ws.jsx)("span",{children:"Widget failed to load"}),(0,Ws.jsx)("button",{type:"button",onClick:()=>this.setState({hasError:!1}),className:"ww:text-xs ww:font-medium ww:text-primary ww:hover:underline",children:"Retry"})]}):this.props.children}};var Ee=q(ee(),1);function Fz(e){return e?e.replace(/[-_]/g," ").replace(/^\w/,t=>t.toUpperCase()):"Tool"}function Hl({messages:e,status:t,welcomeMessage:a,welcome:n,onSuggestionSelect:r,resourceEndpoint:o,chatSessionId:l,isDark:i,onFollowUp:s,onCallTool:u,onWidgetDisplayModeChange:c,fullscreenToolCallId:d,debug:f,toolDefinitions:p}){let y=t==="submitted"||t==="streaming",v=e[e.length-1],S=e.length>0,g=y&&(!S||v.role==="user"),x=d!=null;return(0,Ee.jsxs)(Ee.Fragment,{children:[!x&&(!S&&n?(0,Ee.jsx)(DA,{...n,onSuggestionSelect:r}):a&&(0,Ee.jsx)(tf,{from:"assistant",children:(0,Ee.jsx)(af,{children:(0,Ee.jsx)(nf,{children:a})})})),e.map(m=>{let w=m.parts.filter(D=>D.type==="text"),L=m.parts.filter(D=>D.type==="reasoning"),b=m.parts.filter(D=>D.type==="file"),A=m.parts.filter(D=>"toolCallId"in D),R=m===v&&m.role==="assistant",_=w.length>0,T=x?A.some(D=>D.toolCallId===d):!1;return x&&!T?(0,Ee.jsx)("div",{style:{display:"none"}},m.id):(0,Ee.jsxs)(tf,{from:m.role,children:[!T&&L.map((D,N)=>(0,Ee.jsx)(gA,{text:D.text},`reasoning-${m.id}-${N}`)),A.map(D=>{let N="output"in D?D.output:void 0,B=rf(D.toolName,N,p),j=TA(D.toolName,N,p),V=D.toolCallId===d;return(0,Ee.jsxs)("div",{style:V?{position:"absolute",inset:0,zIndex:10,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--ww-color-background)"}:void 0,children:[(0,Ee.jsx)("div",{style:V?{display:"none"}:void 0,children:(0,Ee.jsxs)(bA,{children:[(0,Ee.jsx)(SA,{title:D.title??Fz(D.toolName),state:D.state}),(0,Ee.jsxs)(CA,{children:[(0,Ee.jsx)(IA,{input:D.input,debug:f}),N!==void 0&&(0,Ee.jsx)(MA,{output:N,errorText:"errorText"in D?D.errorText:void 0,debug:f})]})]})}),B&&o&&N!==void 0&&(0,Ee.jsx)(of,{children:(0,Ee.jsx)(EA,{isFullscreen:V,resourceUri:B,toolInput:D.input??{},toolResult:{content:N.content,structuredContent:N.structuredContent,_meta:N._meta},resourceEndpoint:o,chatSessionId:l,isDark:i,autoHeight:j,toolDefinitions:p,onFollowUp:s,onCallTool:u,onDisplayModeChange:c?F=>c(F,{toolCallId:D.toolCallId,resourceUri:B,toolInput:D.input??{},toolResult:{content:N.content,structuredContent:N.structuredContent,_meta:N._meta},autoHeight:j}):void 0})})]},D.toolCallId)}),!T&&(0,Ee.jsx)("div",{children:(0,Ee.jsxs)(af,{children:[b.length>0&&(0,Ee.jsx)(PC,{files:b}),_?w.map((D,N)=>(0,Ee.jsx)(nf,{children:D.type==="text"?D.text:""},`${m.id}-${N}`)):R&&y&&(0,Ee.jsx)(bh,{})]})})]},m.id)}),!x&&g&&(0,Ee.jsx)(tf,{from:"assistant",children:(0,Ee.jsx)(af,{children:(0,Ee.jsx)(bh,{})})})]})}var $s=q(ee(),1);function jl({suggestions:e,isLoading:t,onSelect:a,className:n,...r}){return e.length===0&&!t?null:(0,$s.jsx)("div",{className:$("ww:px-4 ww:py-2",n),...r,children:(0,$s.jsx)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl ww:flex ww:flex-wrap ww:gap-2",children:t?[0,1,2].map(o=>(0,$s.jsx)("div",{className:"ww:h-7 ww:rounded-full ww:bg-accent ww:animate-pulse",style:{width:`${60+o*20}px`}},o)):e.map((o,l)=>(0,$s.jsx)("button",{type:"button",onClick:()=>a(o),className:$("ww:rounded-full ww:border ww:border-border ww:bg-background ww:px-3 ww:py-1 ww:text-xs","ww:text-foreground ww:hover:bg-accent ww:hover:border-primary/30","ww:transition-all ww:duration-200 ww:ease-out ww:cursor-pointer","ww:animate-[ww-fade-in_0.2s_ease-out_both]"),style:{animationDelay:`${l*50}ms`},children:o},o))})})}var lf=q(xe(),1);function Vl(e){let t=(0,lf.useRef)(e);return t.current=e,(0,lf.useCallback)(async a=>{let{api:n,headers:r,onCallTool:o,sessionId:l}=t.current;if(o)return o(a);let i=`${n??"/api/waniwani"}/tool`,s=typeof l=="string"&&l.trim().length>0?l.trim():void 0,u=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...s?{"X-Session-Id":s}:{},...r},body:JSON.stringify(a)});if(!u.ok)throw new Error(`Tool call failed: ${u.status} ${u.statusText}`);return u.json()},[])}var Na=q(xe(),1);var sE="vercel.ai.error",Hz=Symbol.for(sE),OA,PA,ge=class uE extends(PA=Error,OA=Hz,PA){constructor({name:t,message:a,cause:n}){super(a),this[OA]=!0,this.name=t,this.cause=n}static isInstance(t){return uE.hasMarker(t,sE)}static hasMarker(t,a){let n=Symbol.for(a);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}},cE="AI_APICallError",dE=`vercel.ai.error.${cE}`,jz=Symbol.for(dE),NA,BA,fY=class extends(BA=ge,NA=jz,BA){constructor({message:e,url:t,requestBodyValues:a,statusCode:n,responseHeaders:r,responseBody:o,cause:l,isRetryable:i=n!=null&&(n===408||n===409||n===429||n>=500),data:s}){super({name:cE,message:e,cause:l}),this[NA]=!0,this.url=t,this.requestBodyValues=a,this.statusCode=n,this.responseHeaders=r,this.responseBody=o,this.isRetryable=i,this.data=s}static isInstance(e){return ge.hasMarker(e,dE)}},fE="AI_EmptyResponseBodyError",pE=`vercel.ai.error.${fE}`,Vz=Symbol.for(pE),UA,zA,pY=class extends(zA=ge,UA=Vz,zA){constructor({message:e="Empty response body"}={}){super({name:fE,message:e}),this[UA]=!0}static isInstance(e){return ge.hasMarker(e,pE)}};function mE(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var hE="AI_InvalidArgumentError",gE=`vercel.ai.error.${hE}`,Gz=Symbol.for(gE),qA,FA,yE=class extends(FA=ge,qA=Gz,FA){constructor({message:e,cause:t,argument:a}){super({name:hE,message:e,cause:t}),this[qA]=!0,this.argument=a}static isInstance(e){return ge.hasMarker(e,gE)}},xE="AI_InvalidPromptError",vE=`vercel.ai.error.${xE}`,Wz=Symbol.for(vE),HA,jA,mY=class extends(jA=ge,HA=Wz,jA){constructor({prompt:e,message:t,cause:a}){super({name:xE,message:`Invalid prompt: ${t}`,cause:a}),this[HA]=!0,this.prompt=e}static isInstance(e){return ge.hasMarker(e,vE)}},wE="AI_InvalidResponseDataError",bE=`vercel.ai.error.${wE}`,$z=Symbol.for(bE),VA,GA,hY=class extends(GA=ge,VA=$z,GA){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:wE,message:t}),this[VA]=!0,this.data=e}static isInstance(e){return ge.hasMarker(e,bE)}},SE="AI_JSONParseError",CE=`vercel.ai.error.${SE}`,Xz=Symbol.for(CE),WA,$A,Yy=class extends($A=ge,WA=Xz,$A){constructor({text:e,cause:t}){super({name:SE,message:`JSON parsing failed: Text: ${e}.
124
124
  Error message: ${mE(t)}`,cause:t}),this[WA]=!0,this.text=e}static isInstance(e){return ge.hasMarker(e,CE)}},IE="AI_LoadAPIKeyError",LE=`vercel.ai.error.${IE}`,Zz=Symbol.for(LE),XA,ZA,gY=class extends(ZA=ge,XA=Zz,ZA){constructor({message:e}){super({name:IE,message:e}),this[XA]=!0}static isInstance(e){return ge.hasMarker(e,LE)}},kE="AI_LoadSettingError",TE=`vercel.ai.error.${kE}`,Qz=Symbol.for(TE),QA,KA,yY=class extends(KA=ge,QA=Qz,KA){constructor({message:e}){super({name:kE,message:e}),this[QA]=!0}static isInstance(e){return ge.hasMarker(e,TE)}},ME="AI_NoContentGeneratedError",AE=`vercel.ai.error.${ME}`,Kz=Symbol.for(AE),YA,JA,xY=class extends(JA=ge,YA=Kz,JA){constructor({message:e="No content generated."}={}){super({name:ME,message:e}),this[YA]=!0}static isInstance(e){return ge.hasMarker(e,AE)}},EE="AI_NoSuchModelError",RE=`vercel.ai.error.${EE}`,Yz=Symbol.for(RE),eE,tE,vY=class extends(tE=ge,eE=Yz,tE){constructor({errorName:e=EE,modelId:t,modelType:a,message:n=`No such ${a}: ${t}`}){super({name:e,message:n}),this[eE]=!0,this.modelId=t,this.modelType=a}static isInstance(e){return ge.hasMarker(e,RE)}},DE="AI_TooManyEmbeddingValuesForCallError",_E=`vercel.ai.error.${DE}`,Jz=Symbol.for(_E),aE,nE,wY=class extends(nE=ge,aE=Jz,nE){constructor(e){super({name:DE,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[aE]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return ge.hasMarker(e,_E)}},OE="AI_TypeValidationError",PE=`vercel.ai.error.${OE}`,eq=Symbol.for(PE),rE,oE,rn=class Ky extends(oE=ge,rE=eq,oE){constructor({value:t,cause:a,context:n}){let r="Type validation failed";if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=" (";let o=[];n.entityName&&o.push(n.entityName),n.entityId&&o.push(`id: "${n.entityId}"`),r+=o.join(", "),r+=")"}super({name:OE,message:`${r}: Value: ${JSON.stringify(t)}.
@@ -135,7 +135,7 @@ Error message: ${mE(a)}`,cause:a}),this[rE]=!0,this.value=t,this.context=n}stati
135
135
  `)},flush(e){e.enqueue(`data: [DONE]
136
136
 
137
137
  `)}})}};var dx=ff(()=>Zs(h.union([h.strictObject({type:h.literal("text-start"),id:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("text-delta"),id:h.string(),delta:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("text-end"),id:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("error"),errorText:h.string()}),h.strictObject({type:h.literal("tool-input-start"),toolCallId:h.string(),toolName:h.string(),providerExecuted:h.boolean().optional(),providerMetadata:W.optional(),dynamic:h.boolean().optional(),title:h.string().optional()}),h.strictObject({type:h.literal("tool-input-delta"),toolCallId:h.string(),inputTextDelta:h.string()}),h.strictObject({type:h.literal("tool-input-available"),toolCallId:h.string(),toolName:h.string(),input:h.unknown(),providerExecuted:h.boolean().optional(),providerMetadata:W.optional(),dynamic:h.boolean().optional(),title:h.string().optional()}),h.strictObject({type:h.literal("tool-input-error"),toolCallId:h.string(),toolName:h.string(),input:h.unknown(),providerExecuted:h.boolean().optional(),providerMetadata:W.optional(),dynamic:h.boolean().optional(),errorText:h.string(),title:h.string().optional()}),h.strictObject({type:h.literal("tool-approval-request"),approvalId:h.string(),toolCallId:h.string()}),h.strictObject({type:h.literal("tool-output-available"),toolCallId:h.string(),output:h.unknown(),providerExecuted:h.boolean().optional(),providerMetadata:W.optional(),dynamic:h.boolean().optional(),preliminary:h.boolean().optional()}),h.strictObject({type:h.literal("tool-output-error"),toolCallId:h.string(),errorText:h.string(),providerExecuted:h.boolean().optional(),providerMetadata:W.optional(),dynamic:h.boolean().optional()}),h.strictObject({type:h.literal("tool-output-denied"),toolCallId:h.string()}),h.strictObject({type:h.literal("reasoning-start"),id:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("reasoning-delta"),id:h.string(),delta:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("reasoning-end"),id:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("source-url"),sourceId:h.string(),url:h.string(),title:h.string().optional(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("source-document"),sourceId:h.string(),mediaType:h.string(),title:h.string(),filename:h.string().optional(),providerMetadata:W.optional()}),h.strictObject({type:h.literal("file"),url:h.string(),mediaType:h.string(),providerMetadata:W.optional()}),h.strictObject({type:h.custom(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:h.string().optional(),data:h.unknown(),transient:h.boolean().optional()}),h.strictObject({type:h.literal("start-step")}),h.strictObject({type:h.literal("finish-step")}),h.strictObject({type:h.literal("start"),messageId:h.string().optional(),messageMetadata:h.unknown().optional()}),h.strictObject({type:h.literal("finish"),finishReason:h.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:h.unknown().optional()}),h.strictObject({type:h.literal("abort"),reason:h.string().optional()}),h.strictObject({type:h.literal("message-metadata"),messageMetadata:h.unknown()})])));function UF(e){return e.type.startsWith("data-")}function cx(e){return e.type.startsWith("tool-")}function zF(e){return e.type==="dynamic-tool"}function gf(e){return cx(e)||zF(e)}function t2(e){return e.type.split("-").slice(1).join("-")}function qF({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function FF({stream:e,messageMetadataSchema:t,dataPartSchemas:a,runUpdateMessageJob:n,onError:r,onToolCall:o,onData:l}){return e.pipeThrough(new TransformStream({async transform(i,s){await n(async({state:u,write:c})=>{var d,f,p,y;function v(m){let L=u.message.parts.filter(gf).find(b=>b.toolCallId===m);if(L==null)throw new Wl({chunkType:"tool-invocation",chunkId:m,message:`No tool invocation found for tool call ID "${m}".`});return L}function S(m){var w;let L=u.message.parts.find(R=>cx(R)&&R.toolCallId===m.toolCallId),b=m,A=L;if(L!=null){L.state=m.state,A.input=b.input,A.output=b.output,A.errorText=b.errorText,A.rawInput=b.rawInput,A.preliminary=b.preliminary,m.title!==void 0&&(A.title=m.title),A.providerExecuted=(w=b.providerExecuted)!=null?w:L.providerExecuted;let R=b.providerMetadata;if(R!=null)if(m.state==="output-available"||m.state==="output-error"){let _=L;_.resultProviderMetadata=R}else L.callProviderMetadata=R}else u.message.parts.push({type:`tool-${m.toolName}`,toolCallId:m.toolCallId,state:m.state,title:m.title,input:b.input,output:b.output,rawInput:b.rawInput,errorText:b.errorText,providerExecuted:b.providerExecuted,preliminary:b.preliminary,...b.providerMetadata!=null&&(m.state==="output-available"||m.state==="output-error")?{resultProviderMetadata:b.providerMetadata}:{},...b.providerMetadata!=null&&!(m.state==="output-available"||m.state==="output-error")?{callProviderMetadata:b.providerMetadata}:{}})}function g(m){var w,L;let b=u.message.parts.find(_=>_.type==="dynamic-tool"&&_.toolCallId===m.toolCallId),A=m,R=b;if(b!=null){b.state=m.state,R.toolName=m.toolName,R.input=A.input,R.output=A.output,R.errorText=A.errorText,R.rawInput=(w=A.rawInput)!=null?w:R.rawInput,R.preliminary=A.preliminary,m.title!==void 0&&(R.title=m.title),R.providerExecuted=(L=A.providerExecuted)!=null?L:b.providerExecuted;let _=A.providerMetadata;if(_!=null)if(m.state==="output-available"||m.state==="output-error"){let T=b;T.resultProviderMetadata=_}else b.callProviderMetadata=_}else u.message.parts.push({type:"dynamic-tool",toolName:m.toolName,toolCallId:m.toolCallId,state:m.state,input:A.input,output:A.output,errorText:A.errorText,preliminary:A.preliminary,providerExecuted:A.providerExecuted,title:m.title,...A.providerMetadata!=null&&(m.state==="output-available"||m.state==="output-error")?{resultProviderMetadata:A.providerMetadata}:{},...A.providerMetadata!=null&&!(m.state==="output-available"||m.state==="output-error")?{callProviderMetadata:A.providerMetadata}:{}})}async function x(m){if(m!=null){let w=u.message.metadata!=null?f2(u.message.metadata,m):m;t!=null&&await hf({value:w,schema:t,context:{field:"message.metadata",entityId:u.message.id}}),u.message.metadata=w}}switch(i.type){case"text-start":{let m={type:"text",text:"",providerMetadata:i.providerMetadata,state:"streaming"};u.activeTextParts[i.id]=m,u.message.parts.push(m),c();break}case"text-delta":{let m=u.activeTextParts[i.id];if(m==null)throw new Wl({chunkType:"text-delta",chunkId:i.id,message:`Received text-delta for missing text part with ID "${i.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});m.text+=i.delta,m.providerMetadata=(d=i.providerMetadata)!=null?d:m.providerMetadata,c();break}case"text-end":{let m=u.activeTextParts[i.id];if(m==null)throw new Wl({chunkType:"text-end",chunkId:i.id,message:`Received text-end for missing text part with ID "${i.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});m.state="done",m.providerMetadata=(f=i.providerMetadata)!=null?f:m.providerMetadata,delete u.activeTextParts[i.id],c();break}case"reasoning-start":{let m={type:"reasoning",text:"",providerMetadata:i.providerMetadata,state:"streaming"};u.activeReasoningParts[i.id]=m,u.message.parts.push(m),c();break}case"reasoning-delta":{let m=u.activeReasoningParts[i.id];if(m==null)throw new Wl({chunkType:"reasoning-delta",chunkId:i.id,message:`Received reasoning-delta for missing reasoning part with ID "${i.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});m.text+=i.delta,m.providerMetadata=(p=i.providerMetadata)!=null?p:m.providerMetadata,c();break}case"reasoning-end":{let m=u.activeReasoningParts[i.id];if(m==null)throw new Wl({chunkType:"reasoning-end",chunkId:i.id,message:`Received reasoning-end for missing reasoning part with ID "${i.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});m.providerMetadata=(y=i.providerMetadata)!=null?y:m.providerMetadata,m.state="done",delete u.activeReasoningParts[i.id],c();break}case"file":{u.message.parts.push({type:"file",mediaType:i.mediaType,url:i.url,...i.providerMetadata!=null?{providerMetadata:i.providerMetadata}:{}}),c();break}case"source-url":{u.message.parts.push({type:"source-url",sourceId:i.sourceId,url:i.url,title:i.title,providerMetadata:i.providerMetadata}),c();break}case"source-document":{u.message.parts.push({type:"source-document",sourceId:i.sourceId,mediaType:i.mediaType,title:i.title,filename:i.filename,providerMetadata:i.providerMetadata}),c();break}case"tool-input-start":{let m=u.message.parts.filter(cx);u.partialToolCalls[i.toolCallId]={text:"",toolName:i.toolName,index:m.length,dynamic:i.dynamic,title:i.title},i.dynamic?g({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-streaming",input:void 0,providerExecuted:i.providerExecuted,title:i.title,providerMetadata:i.providerMetadata}):S({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-streaming",input:void 0,providerExecuted:i.providerExecuted,title:i.title,providerMetadata:i.providerMetadata}),c();break}case"tool-input-delta":{let m=u.partialToolCalls[i.toolCallId];if(m==null)throw new Wl({chunkType:"tool-input-delta",chunkId:i.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${i.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});m.text+=i.inputTextDelta;let{value:w}=await Ks(m.text);m.dynamic?g({toolCallId:i.toolCallId,toolName:m.toolName,state:"input-streaming",input:w,title:m.title}):S({toolCallId:i.toolCallId,toolName:m.toolName,state:"input-streaming",input:w,title:m.title}),c();break}case"tool-input-available":{i.dynamic?g({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-available",input:i.input,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:i.title}):S({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-available",input:i.input,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:i.title}),c(),o&&!i.providerExecuted&&await o({toolCall:i});break}case"tool-input-error":{let m=u.message.parts.filter(gf).find(L=>L.toolCallId===i.toolCallId);(m!=null?m.type==="dynamic-tool":!!i.dynamic)?g({toolCallId:i.toolCallId,toolName:i.toolName,state:"output-error",input:i.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata}):S({toolCallId:i.toolCallId,toolName:i.toolName,state:"output-error",input:void 0,rawInput:i.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata}),c();break}case"tool-approval-request":{let m=v(i.toolCallId);m.state="approval-requested",m.approval={id:i.approvalId},c();break}case"tool-output-denied":{let m=v(i.toolCallId);m.state="output-denied",c();break}case"tool-output-available":{let m=v(i.toolCallId);m.type==="dynamic-tool"?g({toolCallId:i.toolCallId,toolName:m.toolName,state:"output-available",input:m.input,output:i.output,preliminary:i.preliminary,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:m.title}):S({toolCallId:i.toolCallId,toolName:t2(m),state:"output-available",input:m.input,output:i.output,providerExecuted:i.providerExecuted,preliminary:i.preliminary,providerMetadata:i.providerMetadata,title:m.title}),c();break}case"tool-output-error":{let m=v(i.toolCallId);m.type==="dynamic-tool"?g({toolCallId:i.toolCallId,toolName:m.toolName,state:"output-error",input:m.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:m.title}):S({toolCallId:i.toolCallId,toolName:t2(m),state:"output-error",input:m.input,rawInput:m.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:m.title}),c();break}case"start-step":{u.message.parts.push({type:"step-start"});break}case"finish-step":{u.activeTextParts={},u.activeReasoningParts={};break}case"start":{i.messageId!=null&&(u.message.id=i.messageId),await x(i.messageMetadata),(i.messageId!=null||i.messageMetadata!=null)&&c();break}case"finish":{i.finishReason!=null&&(u.finishReason=i.finishReason),await x(i.messageMetadata),i.messageMetadata!=null&&c();break}case"message-metadata":{await x(i.messageMetadata),i.messageMetadata!=null&&c();break}case"error":{r?.(new Error(i.errorText));break}default:if(UF(i)){if(a?.[i.type]!=null){let L=u.message.parts.findIndex(A=>"id"in A&&"data"in A&&A.id===i.id&&A.type===i.type),b=L>=0?L:u.message.parts.length;await hf({value:i.data,schema:a[i.type],context:{field:`message.parts[${b}].data`,entityName:i.type,entityId:i.id}})}let m=i;if(m.transient){l?.(m);break}let w=m.id!=null?u.message.parts.find(L=>m.type===L.type&&m.id===L.id):void 0;w!=null?w.data=m.data:u.message.parts.push(m),l?.(m),c()}}s.enqueue(i)})}}))}async function HF({stream:e,onError:t}){let a=e.getReader();try{for(;;){let{done:n}=await a.read();if(n)break}}catch(n){t?.(n)}finally{a.releaseLock()}}var bJ=qn({prefix:"aitxt",size:24});var IJ=ff(()=>Zs(h.array(h.object({id:h.string(),role:h.enum(["system","user","assistant"]),metadata:h.unknown().optional(),parts:h.array(h.union([h.object({type:h.literal("text"),text:h.string(),state:h.enum(["streaming","done"]).optional(),providerMetadata:W.optional()}),h.object({type:h.literal("reasoning"),text:h.string(),state:h.enum(["streaming","done"]).optional(),providerMetadata:W.optional()}),h.object({type:h.literal("source-url"),sourceId:h.string(),url:h.string(),title:h.string().optional(),providerMetadata:W.optional()}),h.object({type:h.literal("source-document"),sourceId:h.string(),mediaType:h.string(),title:h.string(),filename:h.string().optional(),providerMetadata:W.optional()}),h.object({type:h.literal("file"),mediaType:h.string(),filename:h.string().optional(),url:h.string(),providerMetadata:W.optional()}),h.object({type:h.literal("step-start")}),h.object({type:h.string().startsWith("data-"),id:h.string().optional(),data:h.unknown()}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("input-streaming"),input:h.unknown().optional(),providerExecuted:h.boolean().optional(),callProviderMetadata:W.optional(),output:h.never().optional(),errorText:h.never().optional(),approval:h.never().optional()}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("input-available"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.never().optional()}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("approval-requested"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.never().optional(),reason:h.never().optional()})}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("approval-responded"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.boolean(),reason:h.string().optional()})}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("output-available"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.unknown(),errorText:h.never().optional(),callProviderMetadata:W.optional(),resultProviderMetadata:W.optional(),preliminary:h.boolean().optional(),approval:h.object({id:h.string(),approved:h.literal(!0),reason:h.string().optional()}).optional()}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("output-error"),input:h.unknown(),rawInput:h.unknown().optional(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.string(),callProviderMetadata:W.optional(),resultProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.literal(!0),reason:h.string().optional()}).optional()}),h.object({type:h.literal("dynamic-tool"),toolName:h.string(),toolCallId:h.string(),state:h.literal("output-denied"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.literal(!1),reason:h.string().optional()})}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("input-streaming"),providerExecuted:h.boolean().optional(),callProviderMetadata:W.optional(),input:h.unknown().optional(),output:h.never().optional(),errorText:h.never().optional(),approval:h.never().optional()}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("input-available"),providerExecuted:h.boolean().optional(),input:h.unknown(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.never().optional()}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("approval-requested"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.never().optional(),reason:h.never().optional()})}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("approval-responded"),input:h.unknown(),providerExecuted:h.boolean().optional(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.boolean(),reason:h.string().optional()})}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("output-available"),providerExecuted:h.boolean().optional(),input:h.unknown(),output:h.unknown(),errorText:h.never().optional(),callProviderMetadata:W.optional(),resultProviderMetadata:W.optional(),preliminary:h.boolean().optional(),approval:h.object({id:h.string(),approved:h.literal(!0),reason:h.string().optional()}).optional()}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("output-error"),providerExecuted:h.boolean().optional(),input:h.unknown(),rawInput:h.unknown().optional(),output:h.never().optional(),errorText:h.string(),callProviderMetadata:W.optional(),resultProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.literal(!0),reason:h.string().optional()}).optional()}),h.object({type:h.string().startsWith("tool-"),toolCallId:h.string(),state:h.literal("output-denied"),providerExecuted:h.boolean().optional(),input:h.unknown(),output:h.never().optional(),errorText:h.never().optional(),callProviderMetadata:W.optional(),approval:h.object({id:h.string(),approved:h.literal(!1),reason:h.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")));var kJ=qn({prefix:"aiobj",size:24});function p2(e){return({url:t,abortSignal:a})=>wF({url:t,maxBytes:e?.maxBytes,abortSignal:a})}var jF=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,a)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){a(n)}}),this.processQueue()})}};var MJ=qn({prefix:"aiobj",size:24});var AJ=p2();var VF="AI_NoSuchProviderError",GF=`vercel.ai.error.${VF}`,WF=Symbol.for(GF),$F;$F=WF;var EJ=p2();async function XF(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{let{name:a,type:n}=t,r=await new Promise((o,l)=>{let i=new FileReader;i.onload=s=>{var u;o((u=s.target)==null?void 0:u.result)},i.onerror=s=>l(s),i.readAsDataURL(t)});return{type:"file",mediaType:n,filename:a,url:r}}))}var ZF=class{constructor({api:e="/api/chat",credentials:t,headers:a,body:n,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:l}){this.api=e,this.credentials=t,this.headers=a,this.body=n,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=l}async sendMessages({abortSignal:e,...t}){var a,n,r,o,l;let i=await on(this.body),s=await on(this.headers),u=await on(this.credentials),c={...Er(s),...Er(t.headers)},d=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...i,...t.body},headers:c,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),f=(n=d?.api)!=null?n:this.api,p=d?.headers!==void 0?Er(d.headers):c,y=d?.body!==void 0?d.body:{...i,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},v=(r=d?.credentials)!=null?r:u,g=await((o=this.fetch)!=null?o:globalThis.fetch)(f,{method:"POST",headers:{"Content-Type":"application/json",...p},body:JSON.stringify(y),credentials:v,signal:e});if(!g.ok)throw new Error((l=await g.text())!=null?l:"Failed to fetch the chat response.");if(!g.body)throw new Error("The response body is empty.");return this.processResponseStream(g.body)}async reconnectToStream(e){var t,a,n,r,o;let l=await on(this.body),i=await on(this.headers),s=await on(this.credentials),u={...Er(i),...Er(e.headers)},c=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...l,...e.body},headers:u,credentials:s,requestMetadata:e.metadata})),d=(a=c?.api)!=null?a:`${this.api}/${e.chatId}/stream`,f=c?.headers!==void 0?Er(c.headers):u,p=(n=c?.credentials)!=null?n:s,v=await((r=this.fetch)!=null?r:globalThis.fetch)(d,{method:"GET",headers:f,credentials:p});if(v.status===204)return null;if(!v.ok)throw new Error((o=await v.text())!=null?o:"Failed to fetch the chat response.");if(!v.body)throw new Error("The response body is empty.");return this.processResponseStream(v.body)}},fx=class extends ZF{constructor(e={}){super(e)}processResponseStream(e){return e2({stream:e,schema:dx}).pipeThrough(new TransformStream({async transform(t,a){if(!t.success)throw t.error;a.enqueue(t.value)}}))}},m2=class{constructor({generateId:e=XE,id:t=e(),transport:a=new fx,messageMetadataSchema:n,dataPartSchemas:r,state:o,onError:l,onToolCall:i,onFinish:s,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new jF,this.sendMessage=async(d,f)=>{var p,y,v,S;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(p=this.lastMessage)==null?void 0:p.id,...f});return}let g;if("text"in d||"files"in d?g={parts:[...Array.isArray(d.files)?d.files:await XF(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:g=d,d.messageId!=null){let x=this.state.messages.findIndex(m=>m.id===d.messageId);if(x===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[x].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,x+1),this.state.replaceMessage(x,{...g,id:d.messageId,role:(y=g.role)!=null?y:"user",metadata:d.metadata})}else this.state.pushMessage({...g,id:(v=g.id)!=null?v:this.generateId(),role:(S=g.role)!=null?S:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...f})},this.regenerate=async({messageId:d,...f}={})=>{let p=d==null?this.state.messages.length-1:this.state.messages.findIndex(y=>y.id===d);if(p===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[p].role==="assistant"?p:p+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...f})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:f,reason:p,options:y})=>this.jobExecutor.run(async()=>{let v=this.state.messages,S=v[v.length-1],g=x=>gf(x)&&x.state==="approval-requested"&&x.approval.id===d?{...x,state:"approval-responded",approval:{id:d,approved:f,reason:p}}:x;this.state.replaceMessage(v.length-1,{...S,parts:S.parts.map(g)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(g)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(x=>{var m;x&&this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id,...y})})}),this.addToolOutput=async({state:d="output-available",toolCallId:f,output:p,errorText:y,options:v})=>this.jobExecutor.run(async()=>{let S=this.state.messages,g=S[S.length-1],x=m=>gf(m)&&m.toolCallId===f?{...m,state:d,output:p,errorText:y}:m;this.state.replaceMessage(S.length-1,{...g,parts:g.parts.map(x)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(x)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(m=>{var w;m&&this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,...v})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=a,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=r,this.state=o,this.onError=l,this.onToolCall=i,this.onFinish=s,this.onData=u,this.sendAutomaticallyWhen=c}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:a,body:n,messageId:r}){var o,l,i;let s;if(e==="resume-stream")try{let p=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:a,body:n});if(p==null)return;s=p}catch(p){this.onError&&p instanceof Error&&this.onError(p),this.setStatus({status:"error",error:p});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,c=!1,d=!1,f=!1;try{let p={state:qF({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};p.abortController.signal.addEventListener("abort",()=>{c=!0}),this.activeResponse=p;let y;e==="resume-stream"?y=s:y=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:p.abortController.signal,metadata:t,headers:a,body:n,trigger:e,messageId:r});let v=S=>this.jobExecutor.run(()=>S({state:p.state,write:()=>{var g;this.setStatus({status:"streaming"}),p.state.message.id===((g=this.lastMessage)==null?void 0:g.id)?this.state.replaceMessage(this.state.messages.length-1,p.state.message):this.state.pushMessage(p.state.message)}}));await HF({stream:FF({stream:y,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:v,onError:S=>{throw S}}),onError:S=>{throw S}}),this.setStatus({status:"ready"})}catch(p){if(c||p.name==="AbortError")return c=!0,this.setStatus({status:"ready"}),null;f=!0,p instanceof TypeError&&(p.message.toLowerCase().includes("fetch")||p.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&p instanceof Error&&this.onError(p),this.setStatus({status:"error",error:p})}finally{try{(l=this.onFinish)==null||l.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:f,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(p){console.error(p)}this.activeResponse=void 0}!f&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(i=this.lastMessage)==null?void 0:i.id,metadata:t,headers:a,body:n})}};var v2=q(g2(),1);var tu=q(xe(),1);var vf=q(xe(),1);var x2=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},We=(e,t,a)=>(x2(e,t,"read from private field"),a?a.call(e):t.get(e)),ln=(e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)},Dr=(e,t,a,n)=>(x2(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a);function KF(e,t){return t!=null?(0,v2.default)(e,t):e}var Pa,yf,xf,Ys,Js,eu,$l,px,mx,YF=class{constructor(e=[]){ln(this,Pa,void 0),ln(this,yf,"ready"),ln(this,xf,void 0),ln(this,Ys,new Set),ln(this,Js,new Set),ln(this,eu,new Set),this.pushMessage=t=>{Dr(this,Pa,We(this,Pa).concat(t)),We(this,$l).call(this)},this.popMessage=()=>{Dr(this,Pa,We(this,Pa).slice(0,-1)),We(this,$l).call(this)},this.replaceMessage=(t,a)=>{Dr(this,Pa,[...We(this,Pa).slice(0,t),this.snapshot(a),...We(this,Pa).slice(t+1)]),We(this,$l).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,a)=>{let n=a?KF(t,a):t;return We(this,Ys).add(n),()=>{We(this,Ys).delete(n)}},this["~registerStatusCallback"]=t=>(We(this,Js).add(t),()=>{We(this,Js).delete(t)}),this["~registerErrorCallback"]=t=>(We(this,eu).add(t),()=>{We(this,eu).delete(t)}),ln(this,$l,()=>{We(this,Ys).forEach(t=>t())}),ln(this,px,()=>{We(this,Js).forEach(t=>t())}),ln(this,mx,()=>{We(this,eu).forEach(t=>t())}),Dr(this,Pa,e)}get status(){return We(this,yf)}set status(e){Dr(this,yf,e),We(this,px).call(this)}get error(){return We(this,xf)}set error(e){Dr(this,xf,e),We(this,mx).call(this)}get messages(){return We(this,Pa)}set messages(e){Dr(this,Pa,[...e]),We(this,$l).call(this)}};Pa=new WeakMap;yf=new WeakMap;xf=new WeakMap;Ys=new WeakMap;Js=new WeakMap;eu=new WeakMap;$l=new WeakMap;px=new WeakMap;mx=new WeakMap;var Xl,y2=class extends m2{constructor({messages:e,...t}){let a=new YF(e);super({...t,state:a}),ln(this,Xl,void 0),this["~registerMessagesCallback"]=(n,r)=>We(this,Xl)["~registerMessagesCallback"](n,r),this["~registerStatusCallback"]=n=>We(this,Xl)["~registerStatusCallback"](n),this["~registerErrorCallback"]=n=>We(this,Xl)["~registerErrorCallback"](n),Dr(this,Xl,a)}};Xl=new WeakMap;function w2({experimental_throttle:e,resume:t=!1,...a}={}){let n=(0,Na.useRef)("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(n.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});let r={...a,onToolCall:f=>{var p,y;return(y=(p=n.current).onToolCall)==null?void 0:y.call(p,f)},onData:f=>{var p,y;return(y=(p=n.current).onData)==null?void 0:y.call(p,f)},onFinish:f=>{var p,y;return(y=(p=n.current).onFinish)==null?void 0:y.call(p,f)},onError:f=>{var p,y;return(y=(p=n.current).onError)==null?void 0:y.call(p,f)},sendAutomaticallyWhen:f=>{var p,y,v;return(v=(y=(p=n.current).sendAutomaticallyWhen)==null?void 0:y.call(p,f))!=null?v:!1}},o=(0,Na.useRef)("chat"in a?a.chat:new y2(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new y2(r));let i=(0,Na.useCallback)(f=>o.current["~registerMessagesCallback"](f,e),[e,o.current.id]),s=(0,Na.useSyncExternalStore)(i,()=>o.current.messages,()=>o.current.messages),u=(0,Na.useSyncExternalStore)(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),c=(0,Na.useSyncExternalStore)(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),d=(0,Na.useCallback)(f=>{typeof f=="function"&&(f=f(o.current.messages)),o.current.messages=f},[o]);return(0,Na.useEffect)(()=>{t&&o.current.resumeStream()},[t,o]),{id:o.current.id,messages:s,setMessages:d,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:c,resumeStream:o.current.resumeStream,status:u,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}var be=q(xe(),1);function JF(e){let t=e?.cause,a=t?.issues??t?.errors;if(!Array.isArray(a))return null;let n=a.find(r=>r.code==="invalid_union");if(!n?.errors)return null;for(let r of n.errors){if(!Array.isArray(r)||r.some(i=>(i.code==="invalid_value"||i.code==="invalid_literal")&&i.path?.[0]==="type"))continue;let l=r.filter(i=>i.code==="unrecognized_keys").flatMap(i=>i.keys??[]);if(l.length>0)return l}return null}var wf=class extends fx{processResponseStream(t){let a="",n=dx(),r=n.validate?.bind(n);return t.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({async transform(o,l){a+=o;let i=a.split(`
138
- `);a=i.pop()??"";for(let s of i){let u=s.trim();if(!u.startsWith("data:"))continue;let c=u.slice(5).trim();if(c!=="[DONE]")try{let d=JSON.parse(c);if(!r){l.enqueue(d);continue}let f=await r(d);if(f.success){l.enqueue(f.value);continue}let p=JF(f.error);if(p?.length){let y={...d};for(let S of p)delete y[S];let v=await r(y);v.success&&l.enqueue(v.value)}}catch{}}}}))}};var b2="waniwani-visitor-id";function S2(e,t){return e.match(t)?.[1]??null}function e6(e){let t=[["Edge",/Edg(?:e|A|iOS)?\/(\S+)/],["Opera",/(?:OPR|Opera)\/(\S+)/],["Samsung Internet",/SamsungBrowser\/(\S+)/],["Firefox",/Firefox\/(\S+)/],["Chrome",/Chrome\/(\S+)/],["Safari",/Version\/(\S+).*Safari/]];for(let[a,n]of t){let r=S2(e,n);if(r)return{name:a,version:r}}return null}function t6(e){let t=[["iOS",/(?:iPhone|iPad|iPod).+?OS (\d+[_.\d]*)/],["Android",/Android (\d+[.\d]*)/],["macOS",/Mac OS X (\d+[_.\d]*)/],["Windows",/Windows NT (\d+[.\d]*)/],["ChromeOS",/CrOS \S+ (\d+[.\d]*)/],["Linux",/Linux/]];for(let[a,n]of t){let r=S2(e,n);if(r)return{name:a,version:r.replace(/_/g,".")};if(a==="Linux"&&n.test(e))return{name:a,version:""}}return null}function a6(e){return typeof navigator<"u"&&"userAgentData"in navigator&&navigator.userAgentData?.mobile?"mobile":/iPad|tablet|PlayBook/i.test(e)?"tablet":/Mobi|Android.*Mobile|iPhone|iPod/i.test(e)?"mobile":"desktop"}async function n6(e){let t=new TextEncoder().encode(e),a=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(a)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function r6(){try{let a=localStorage.getItem(b2);if(a)return a}catch{}let e=[navigator.userAgent,screen.width,screen.height,screen.colorDepth,Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.language,navigator.hardwareConcurrency??"",navigator.platform??""].join("|"),t=await n6(e);try{localStorage.setItem(b2,t)}catch{}return t}async function C2(){let e=navigator.userAgent,t=await r6();return{userAgent:e,browser:e6(e),os:t6(e),deviceType:a6(e),language:navigator.language,languages:[...navigator.languages],timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,colorDepth:screen.colorDepth,devicePixelRatio:window.devicePixelRatio??1,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0,connectionType:navigator.connection?.effectiveType??"unknown",referrer:document.referrer,visitorId:t}}var o6="x-session-id";function I2(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}async function l6(e,t){let a=`${e.replace(/\/$/,"")}/tools`,n=await fetch(a,{method:"GET",headers:t?{...t}:void 0});if(!n.ok)throw new Error(`[WaniWani] Failed to fetch /tools: ${n.status} ${n.statusText}`);let r=await n.json();if(!r||!Array.isArray(r.tools))return{};let o={};for(let l of r.tools)l&&typeof l.name=="string"&&(o[l.name]=l);return o}function Zl(e){let{api:t="/api/waniwani",headers:a,body:n,onMessageSent:r,onResponseReceived:o}=e,l=(0,be.useRef)(a),i=(0,be.useRef)(n),s=(0,be.useRef)(void 0),u=(0,be.useRef)(null),[c,d]=(0,be.useState)(void 0),f=(0,be.useRef)(c),p=(0,be.useCallback)(()=>f.current,[]),y=(0,be.useCallback)(G=>{let Q=I2(G);Q&&f.current!==Q&&(f.current=Q,d(Q))},[]),v=(0,be.useCallback)(()=>{f.current=void 0,d(void 0)},[]);(0,be.useEffect)(()=>{l.current=a},[a]),(0,be.useEffect)(()=>{i.current=n},[n]),(0,be.useEffect)(()=>{C2().then(G=>{u.current=G}).catch(()=>{})},[]);let S=(0,be.useRef)(new wf({api:t,headers:()=>({...l.current}),body:()=>{let G={...i.current??{}},Q=Object.hasOwn(G,"sessionId"),ke=I2(G.sessionId);if(ke)y(ke),G.sessionId=ke;else if(Q)v(),delete G.sessionId;else{let se=p();se&&(G.sessionId=se)}if(Fl(s.current)&&(G.modelContext=s.current),u.current){let se=u.current;G.visitorContext={timezone:se.timezone,language:se.language,languages:se.languages,deviceType:se.deviceType,referrer:se.referrer,visitorId:se.visitorId}}return G},fetch:(async(G,Q)=>{let ke=await fetch(G,Q);return s.current=void 0,y(ke.headers.get(o6)),ke})})),g=(0,be.useRef)(null),x=(0,be.useRef)(null),m=(0,be.useRef)({}),[w,L]=(0,be.useState)(0),b=e.skipRemoteConfig===!0,A=(0,be.useCallback)(async()=>{if(!b)try{let G=await l6(t,l.current);m.current=G,L(Q=>Q+1)}catch(G){console.warn("[WaniWani] Failed to fetch tool definitions:",G instanceof Error?G.message:G)}},[t,b]);(0,be.useEffect)(()=>{A()},[A]);let{messages:R,sendMessage:_,setMessages:T,status:D}=w2({messages:e.initialMessages,transport:S.current,onFinish({message:G}){o?.(),g.current&&(x.current=G)},onError(G){console.warn("[WaniWani] Chat error:",G.message),g.current&&(g.current.reject(G),g.current=null)}});(0,be.useEffect)(()=>{if(D==="ready"&&g.current&&x.current){let G=g.current,Q=x.current;g.current=null,x.current=null,G.resolve(Q)}},[D]);let[N,B]=(0,be.useState)(""),[j,V]=(0,be.useState)([]),F=D==="submitted"||D==="streaming",te=(0,be.useCallback)(G=>{V(Q=>Q.filter(ke=>ke.id!==G))},[]),$e=F&&j.length>0,Z=(0,be.useCallback)(G=>{let Q=!!G.text?.trim(),ke=!!G.files?.length;if(Q||ke){if(F){if(j.length>0)return;V(se=>[...se,{id:jc(),text:G.text||"",files:G.files??[],modelContext:G.modelContext}]),B("");return}s.current=G.modelContext,_({text:G.text||"",files:G.files}),r?.(G.text||""),B("")}},[_,r,F,j.length]),C=(0,be.useCallback)(G=>new Promise((Q,ke)=>{g.current={resolve:Q,reject:ke},_({text:G}),r?.(G)}),[_,r]);(0,be.useEffect)(()=>{if(D!=="ready"||j.length===0)return;let[G,...Q]=j;V(Q),s.current=G.modelContext,_({text:G.text,files:G.files.length>0?G.files:void 0}),r?.(G.text)},[D,_,r,j]);let Xe=(0,be.useCallback)(()=>{T([]),V([]),v(),B(""),m.current={},L(G=>G+1),A()},[T,v,A]),le=(0,be.useCallback)(G=>{B(G.target.value)},[]),k=R[R.length-1],Ze=R.length>0,Ue=F&&(!Ze||k.role==="user"),Hn=m.current;return{messages:R,status:D,text:N,setText:B,handleSubmit:Z,handleTextChange:le,isLoading:F,showLoaderBubble:Ue,lastMessage:k,hasMessages:Ze,sendMessage:_,sendMessageAndWait:C,reset:Xe,queuedMessages:j,queueFull:$e,removeQueuedMessage:te,sessionId:c,toolDefinitions:Hn,refreshToolDefinitions:A}}var ko=q(xe(),1),i6={debug:!1,eval:!1};function bf(e="/api/waniwani",t,a=!1){let[n,r]=(0,ko.useState)(i6),o=(0,ko.useRef)(t);return(0,ko.useEffect)(()=>{o.current=t},[t]),(0,ko.useEffect)(()=>{a||(async()=>{try{let l=o.current,s=await(await fetch(`${e}/config`,{headers:l?{...l}:void 0})).json();r({debug:s.debug===!0,eval:s.eval===!0})}catch{}})()},[e,a]),n}var sn=q(xe(),1);function s6(e){for(let t of e.parts){let a=t;if(a.type==="data"||a.type==="data-suggestions"){let n=a.data;if(n&&Array.isArray(n.suggestions))return n.suggestions}}return null}function L2(e){return typeof e=="object"&&e!==null&&"initial"in e}function Ql(e){let{messages:t,status:a,config:n}=e,r=L2(n)&&n.initial?n.initial:void 0,[o,l]=(0,sn.useState)(r??[]),i=(0,sn.useRef)(a),s=n===!0||L2(n)&&n.dynamic!==!1,u=(0,sn.useCallback)(()=>{l([])},[]),c=t.length>0;(0,sn.useEffect)(()=>{!c&&r&&r.length>0&&l(r)},[r,c]);let d=t[t.length-1];return(0,sn.useEffect)(()=>{d?.role==="user"&&u()},[d,u]),(0,sn.useEffect)(()=>{let f=i.current;if(i.current=a,f==="streaming"&&a==="ready"&&s){let p=[...t].reverse().find(v=>v.role==="assistant");if(!p)return;console.log("[WaniWani] Assistant parts:",p.parts);let y=s6(p);console.log("[WaniWani] Extracted suggestions:",y),y&&l(y)}},[a,s,t]),{suggestions:o,isLoading:!1,clear:u}}var Kl=q(xe(),1),u6=50,c6=30,d6=2e3,k2=500;function Yl(e,t=!0){let[a,n]=(0,Kl.useState)(""),r=(0,Kl.useRef)(void 0);return(0,Kl.useEffect)(()=>{if(!t){n("");return}let o=0,l=!1,i=!1,s=()=>{i||(l?(o--,n(e.slice(0,o)),o<=0?(l=!1,r.current=setTimeout(s,k2)):r.current=setTimeout(s,c6)):(o++,n(e.slice(0,o)),o>=e.length?(l=!0,r.current=setTimeout(s,d6)):r.current=setTimeout(s,u6)))};return r.current=setTimeout(s,k2),()=>{i=!0,clearTimeout(r.current)}},[e,t]),a}function Sf(e,t){let a=t?.Authorization,n=typeof a=="string"&&a.startsWith("Bearer ")?a.slice(7):null;return n?`${e}/resource?token=${encodeURIComponent(n)}`:`${e}/resource`}var f6={primaryColor:"#6366f1",primaryForeground:"#1f2937",backgroundColor:"#ffffff",textColor:"#1f2937",mutedColor:"#6b7280",borderColor:"#e5e7eb",assistantBubbleColor:"#f3f4f6",userBubbleColor:"#f4f4f4",inputBackgroundColor:"#f9fafb",borderRadius:16,messageBorderRadius:12,fontFamily:"system-ui, -apple-system, 'Segoe UI', sans-serif",headerBackgroundColor:"#ffffff",headerTextColor:"#1f2937",statusColor:"#22c55e",toolCardColor:"#f4f4f5"};var p6={primaryColor:["--ww-primary","--ww-color-primary"],primaryForeground:["--ww-primary-fg","--ww-color-primary-foreground"],backgroundColor:["--ww-bg","--ww-color-background"],textColor:["--ww-text","--ww-color-foreground","--ww-color-accent-foreground"],mutedColor:["--ww-muted","--ww-color-muted-foreground"],borderColor:["--ww-border","--ww-color-border"],assistantBubbleColor:["--ww-assistant-bubble","--ww-color-accent"],userBubbleColor:["--ww-user-bubble"],inputBackgroundColor:["--ww-input-bg","--ww-color-input"],borderRadius:["--ww-radius"],messageBorderRadius:["--ww-msg-radius"],fontFamily:["--ww-font"],headerBackgroundColor:["--ww-header-bg"],headerTextColor:["--ww-header-text"],statusColor:["--ww-status"],toolCardColor:["--ww-tool-card","--ww-color-tool-card"]};function Jl(e){return{...f6,...e}}function ei(e){let t=e.backgroundColor.replace("#",""),a=parseInt(t.substring(0,2),16),n=parseInt(t.substring(2,4),16),r=parseInt(t.substring(4,6),16);return(a*299+n*587+r*114)/1e3<128}function ti(e){let t={};for(let[a,n]of Object.entries(p6)){let r=e[a],o=typeof r=="number"?`${r}px`:String(r);for(let l of n)t[l]=o}return t}var rt=q(ee(),1),Cf=(0,Ut.forwardRef)(function(t,a){let{theme:n,title:r="Assistant",width:o,height:l,className:i,allowAttachments:s=!1,welcomeMessage:u,welcome:c,placeholder:d="Ask me anything...",triggerEvent:f="triggerDemoRequest",api:p,debug:y}=t,v=p??"/api/waniwani",S=Sf(v,t.headers),g=Jl(n),x=ti(g),m=ei(g),w=bf(v,t.headers,t.skipRemoteConfig),L=y??w.debug,b=Zl({...t,api:v}),A=Vl({...t,api:v,sessionId:b.sessionId}),R=Yl(d,!b.text),[_,T]=(0,Ut.useState)(!1),[D,N]=(0,Ut.useState)(null),B=(0,Ut.useRef)(null),j=(0,Ut.useRef)(void 0),V=(0,Ut.useCallback)(()=>{let Z=B.current;if(!Z)return;Z.scrollIntoView({behavior:"smooth",block:"center"});let C=Z.querySelector("textarea");C&&setTimeout(()=>C.focus(),300),T(!0),clearTimeout(j.current),j.current=setTimeout(()=>T(!1),2e3)},[]),F=Ql({messages:b.messages,status:b.status,config:t.suggestions}),te=(0,Ut.useCallback)(Z=>{let C=Z.content.map(Xe=>Xe.text??"").join("").trim();C&&b.handleSubmit({text:C,files:[],modelContext:Z.modelContext})},[b.handleSubmit]),$e=(0,Ut.useCallback)(Z=>{F.clear(),b.handleSubmit({text:Z,files:[]})},[F.clear,b.handleSubmit]);return(0,Ut.useImperativeHandle)(a,()=>({sendMessage:Z=>{b.handleSubmit({text:Z,files:[]}),V()},sendMessageAndWait:Z=>b.sendMessageAndWait(Z),reset:b.reset,focus:V,get messages(){return b.messages}}),[b.handleSubmit,b.sendMessageAndWait,b.reset,b.messages,V]),(0,Ut.useEffect)(()=>{if(!f)return;let Z=C=>{let Xe=C.detail,le=typeof Xe?.message=="string"?Xe.message:void 0;le&&b.handleSubmit({text:le,files:[]}),V()};return window.addEventListener(f,Z),()=>window.removeEventListener(f,Z)},[f,b.handleSubmit,V]),(0,rt.jsxs)("div",{ref:B,style:{...x,width:o,height:l},"data-waniwani-chat":"","data-waniwani-layout":"card",...m?{"data-waniwani-dark":""}:{},className:$("ww:flex ww:flex-col ww:font-[family-name:var(--ww-font)] ww:text-foreground ww:bg-background ww:rounded-[var(--ww-radius)] ww:overflow-hidden",_&&"ww:ring-2 ww:ring-blue-400/70 ww:ring-offset-2 ww:ring-offset-background",i),children:[(0,rt.jsxs)("div",{className:"ww:shrink-0 ww:flex ww:items-center ww:px-6 ww:py-3",style:{backgroundColor:g.headerBackgroundColor,color:g.headerTextColor},children:[(0,rt.jsx)("div",{className:"ww:text-sm ww:font-semibold ww:truncate",children:r}),(0,rt.jsx)(Gc,{messages:b.messages,evalEnabled:w.eval,api:v})]}),(0,rt.jsxs)(Sl,{className:"ww:flex-1 ww:min-h-0 ww:bg-background",children:[(0,rt.jsx)(Cl,{scrollClassName:D?"ww:!relative ww:!overflow-hidden":void 0,children:(0,rt.jsx)(Hl,{messages:b.messages,status:b.status,welcomeMessage:u,welcome:c,onSuggestionSelect:$e,resourceEndpoint:S,chatSessionId:b.sessionId,isDark:m,onFollowUp:te,onCallTool:A,fullscreenToolCallId:D,debug:L,toolDefinitions:b.toolDefinitions,onWidgetDisplayModeChange:(Z,C)=>{N(Z==="fullscreen"?C.toolCallId:null)}})}),(0,rt.jsx)(Il,{})]}),(0,rt.jsx)("div",{style:D?{display:"none"}:void 0,children:(0,rt.jsx)(jl,{suggestions:F.suggestions,isLoading:F.isLoading,onSelect:$e})}),(0,rt.jsx)("div",{style:D?{display:"none"}:void 0,children:(0,rt.jsx)(Al,{queuedMessages:b.queuedMessages,onRemove:b.removeQueuedMessage})}),(0,rt.jsx)("div",{style:D?{display:"none"}:void 0,children:(0,rt.jsx)("div",{className:"ww:shrink-0 ww:px-4 ww:pb-8 ww:pt-2 ww:bg-background",children:(0,rt.jsx)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:(0,rt.jsx)(Ll,{onSubmit:b.handleSubmit,globalDrop:s,multiple:s,className:"ww:rounded-2xl ww:border-border ww:bg-input",children:(0,rt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[s&&(0,rt.jsx)(Ml,{}),(0,rt.jsx)(kl,{onChange:b.handleTextChange,value:b.text,placeholder:R,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,rt.jsx)(Tl,{status:b.status,disabled:b.queueFull})]})})})})})]})});var If=q(xe(),1);async function m6(e,t,a){try{let n=`${e.replace(/\/$/,"")}/config`,r=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${t}`},signal:a});if(!r.ok)return{};let o=await r.json(),l=o&&typeof o=="object"&&"data"in o&&o.data?o.data:o;return l?h6(l):{}}catch{return{}}}function h6(e){let t={};return e.title!=null&&(t.title=e.title),e.welcomeMessage!=null&&(t.welcomeMessage=e.welcomeMessage),e.placeholder!=null&&(t.placeholder=e.placeholder),e.suggestions!=null&&e.suggestions.length>0&&(t.suggestions=e.suggestions),t}function Lf(e,t,a){let[n,r]=(0,If.useState)(e);return(0,If.useEffect)(()=>{let o=e.api,l=e.token;if(!o||!l)return;let i=new AbortController;return m6(o,l,i.signal).then(s=>{if(!i.signal.aborted&&Object.keys(s).length!==0)try{r(Nc(t,s,a))}catch(u){console.error("[WaniWani] Failed to apply remote config:",u)}}).catch(s=>{console.error("[WaniWani] Remote config fetch failed:",s)}),()=>i.abort()},[e.api,e.token]),n}var Tt=q(ee(),1);function g6(){return(0,Tt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"Chat",children:[(0,Tt.jsx)("title",{children:"Chat"}),(0,Tt.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})]})}function y6(){return(0,Tt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"Close",children:[(0,Tt.jsx)("title",{children:"Close"}),(0,Tt.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Tt.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}var hx=56,gx=20,x6=12,To=200,T2=(0,ct.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,onReady:r},o){let l=Lf(t,a,n),[i,s]=(0,ct.useState)(!1),[u,c]=(0,ct.useState)(0),[d,f]=(0,ct.useState)(!1),p=(0,ct.useRef)(null),y=(0,ct.useRef)(i);y.current=i,(0,ct.useEffect)(()=>{r?.()},[]),(0,ct.useEffect)(()=>{let F=window.matchMedia("(max-width: 768px)"),te=$e=>f($e.matches);return te(F),F.addEventListener("change",te),()=>F.removeEventListener("change",te)},[]),(0,ct.useEffect)(()=>{if(!i)return;let F=te=>{te.key==="Escape"&&s(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[i]),(0,ct.useEffect)(()=>{i&&c(0)},[i]);let v=(0,ct.useCallback)(()=>{y.current||c(F=>F+1)},[]),S=(0,ct.useCallback)(()=>s(!0),[]),g=(0,ct.useCallback)(()=>s(!1),[]),x=(0,ct.useCallback)(()=>s(F=>!F),[]);(0,ct.useImperativeHandle)(o,()=>({open:S,close:g,toggle:x,get chat(){return p.current}}));let m=!i&&u>0,w=l.mode==="custom",L=l.position==="bottom-left",b=l.width??400,A=l.height??600,R=l.theme?.primaryColor??"#6366f1",_={position:"fixed",bottom:gx,...L?{left:gx}:{right:gx},zIndex:2147483647,fontFamily:l.theme?.fontFamily??"system-ui, -apple-system, 'Segoe UI', sans-serif"},T={width:hx,height:hx,borderRadius:"50%",backgroundColor:R,color:"#ffffff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:`transform ${To}ms ease, box-shadow ${To}ms ease`,outline:"none"},D=d?{position:"fixed",inset:0,zIndex:2147483647,transition:`transform ${To}ms ease, opacity ${To}ms ease`,...i?{transform:"translateY(0) scale(1)",opacity:1}:{transform:"translateY(20px) scale(0.95)",opacity:0,pointerEvents:"none"}}:{position:"absolute",bottom:w?0:hx+x6,...L?{left:0}:{right:0},width:b,height:A,transition:`transform ${To}ms ease, opacity ${To}ms ease`,...i?{transform:"translateY(0) scale(1)",opacity:1}:{transform:"translateY(20px) scale(0.95)",opacity:0,pointerEvents:"none"}},N={width:"100%",height:"100%",borderRadius:d?0:12,overflow:"hidden",boxShadow:d?"none":"0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)"},B={position:"absolute",top:d?12:8,right:d?12:8,zIndex:10,width:d?36:28,height:d?36:28,borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"inherit",outline:"none",transition:`background-color ${To}ms ease`},j={position:"absolute",top:-2,right:-2,width:12,height:12,borderRadius:"50%",backgroundColor:"#ef4444",border:"2px solid #ffffff"},V=Bc(l);return(0,Tt.jsxs)("div",{style:_,children:[(0,Tt.jsx)("div",{style:D,role:"dialog","aria-label":"Chat panel",children:(0,Tt.jsxs)("div",{style:{...N,position:"relative"},children:[(0,Tt.jsx)("button",{type:"button",onClick:g,style:B,"aria-label":"Close chat",onMouseEnter:F=>{F.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.12)"},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.06)"},children:(0,Tt.jsx)(y6,{})}),(0,Tt.jsx)(Cf,{ref:p,api:l.api,headers:{Authorization:`Bearer ${l.token}`},skipRemoteConfig:!0,body:l.mcpServerUrl?{mcpServerUrl:l.mcpServerUrl}:void 0,theme:V,title:l.title??"Assistant",welcomeMessage:l.welcomeMessage,placeholder:l.placeholder,suggestions:l.suggestions?{initial:l.suggestions}:void 0,onResponseReceived:v,width:"100%",height:"100%"})]})}),!w&&(0,Tt.jsxs)("button",{type:"button",onClick:x,style:{...T,position:"relative"},"aria-label":i?"Close chat":"Open chat",onMouseEnter:F=>{F.currentTarget.style.transform="scale(1.08)",F.currentTarget.style.boxShadow="0 6px 20px rgba(0, 0, 0, 0.2)"},onMouseLeave:F=>{F.currentTarget.style.transform="scale(1)",F.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},children:[(0,Tt.jsx)(g6,{}),m&&(0,Tt.jsx)("span",{style:j})]})]})});var _r=q(xe(),1);var wt=q(xe(),1);var dt=q(ee(),1),M2=(0,wt.forwardRef)(function(t,a){let{theme:n,title:r="Assistant",width:o=600,expandedWidth:l,expandedHeight:i=400,allowAttachments:s=!1,welcomeMessage:u,welcome:c,placeholder:d="Ask me anything...",triggerEvent:f="triggerDemoRequest",api:p}=t,y=l??Math.round((typeof o=="number"?o:600)*1.2),v=p??"/api/waniwani",S=Sf(v,t.headers),g=Jl(n),x=ti(g),m=ei(g),w=bf(p,t.headers,t.skipRemoteConfig),L=Zl(t),b=Vl({...t,sessionId:L.sessionId}),A=Ql({messages:L.messages,status:L.status,config:t.suggestions}),R=(0,wt.useCallback)(le=>{let k=le.content.map(Ze=>Ze.text??"").join("").trim();k&&L.handleSubmit({text:k,files:[],modelContext:le.modelContext})},[L.handleSubmit]),_=(0,wt.useCallback)(le=>{A.clear(),L.handleSubmit({text:le,files:[]})},[A.clear,L.handleSubmit]),T=Yl(d,!L.text),[D,N]=(0,wt.useState)(!1),[B,j]=(0,wt.useState)(!1),[V,F]=(0,wt.useState)(null),te=(0,wt.useRef)(null),$e=(0,wt.useRef)(void 0),Z=(0,wt.useCallback)(()=>{let le=te.current;if(!le)return;le.scrollIntoView({behavior:"smooth",block:"center"});let k=le.querySelector("textarea");k&&setTimeout(()=>k.focus(),300),N(!0),j(!0),clearTimeout($e.current),$e.current=setTimeout(()=>j(!1),2e3)},[]);(0,wt.useImperativeHandle)(a,()=>({sendMessage:le=>{L.handleSubmit({text:le,files:[]}),Z()},sendMessageAndWait:le=>L.sendMessageAndWait(le),reset:L.reset,focus:Z,get messages(){return L.messages}}),[L.handleSubmit,L.sendMessageAndWait,L.reset,L.messages,Z]),(0,wt.useEffect)(()=>{if(!f)return;let le=k=>{let Ze=k.detail,Ue=typeof Ze?.message=="string"?Ze.message:void 0;Ue&&L.handleSubmit({text:Ue,files:[]}),Z()};return window.addEventListener(f,le),()=>window.removeEventListener(f,le)},[f,L.handleSubmit,Z]);let C=D||V!==null;(0,wt.useEffect)(()=>{if(!D)return;let le=k=>{te.current&&!te.current.contains(k.target)&&N(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[D]);let Xe=(0,wt.useCallback)(()=>{N(!0)},[]);return(0,dt.jsxs)("div",{ref:te,style:{...x,width:C?y:o,transition:"width 0.4s cubic-bezier(0.16, 1, 0.3, 1)"},"data-waniwani-chat":"","data-waniwani-layout":"bar",...m?{"data-waniwani-dark":""}:{},className:"ww:flex ww:flex-col ww:font-[family-name:var(--ww-font)] ww:text-foreground",children:[(0,dt.jsxs)("div",{style:{overflow:"hidden",backgroundColor:g.backgroundColor,borderRadius:"var(--ww-radius) var(--ww-radius) 0 0",maxHeight:C?i+200:0,opacity:C?1:0,transform:C?"scaleX(1)":"scaleX(0.88)",transformOrigin:"center bottom",transition:"max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease-out, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"},children:[(0,dt.jsxs)("div",{className:"ww:shrink-0 ww:flex ww:items-center ww:px-6 ww:py-3",style:{backgroundColor:g.headerBackgroundColor,color:g.headerTextColor},children:[(0,dt.jsx)("div",{className:"ww:text-sm ww:font-semibold ww:truncate",children:r}),(0,dt.jsx)(Gc,{messages:L.messages,evalEnabled:w.eval,api:v})]}),(0,dt.jsxs)(Sl,{className:"ww:flex-1",style:{height:i},children:[(0,dt.jsx)(Cl,{scrollClassName:V?"ww:!relative ww:!overflow-hidden":void 0,children:(0,dt.jsx)(Hl,{messages:L.messages,status:L.status,welcomeMessage:u,welcome:c,onSuggestionSelect:_,resourceEndpoint:S,chatSessionId:L.sessionId,isDark:m,onFollowUp:R,onCallTool:b,fullscreenToolCallId:V,toolDefinitions:L.toolDefinitions,onWidgetDisplayModeChange:(le,k)=>{F(le==="fullscreen"?k.toolCallId:null)}})}),(0,dt.jsx)(Il,{})]}),(0,dt.jsx)("div",{style:V?{display:"none"}:void 0,children:(0,dt.jsx)(jl,{suggestions:A.suggestions,isLoading:A.isLoading,onSelect:_})}),(0,dt.jsx)("div",{style:V?{display:"none"}:void 0,children:(0,dt.jsx)(Al,{queuedMessages:L.queuedMessages,onRemove:L.removeQueuedMessage})})]}),(0,dt.jsx)("div",{style:{backgroundColor:C?g.backgroundColor:"transparent",borderRadius:C?"0 0 var(--ww-radius) var(--ww-radius)":void 0,boxShadow:C?"0 8px 24px rgba(0,0,0,0.1)":"none",transition:"background-color 0.2s ease, border-radius 0.3s ease, box-shadow 0.35s ease, padding 0.3s ease",padding:C?"8px 16px 16px":"0"},children:(0,dt.jsx)(Ll,{onSubmit:L.handleSubmit,globalDrop:s,multiple:s,className:$("ww:rounded-2xl ww:border-border ww:bg-input ww:transition-all ww:duration-300",!C&&"ww:shadow-sm",B&&"ww:ring-2 ww:ring-blue-400/70 ww:ring-offset-2 ww:ring-offset-background"),children:(0,dt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[s&&(0,dt.jsx)(Ml,{}),(0,dt.jsx)(kl,{onChange:L.handleTextChange,value:L.text,placeholder:T,onFocus:Xe,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,dt.jsx)(Tl,{status:L.status,disabled:L.queueFull})]})})})]})});var ra=q(xe(),1);var bt=q(ee(),1),A2=(0,ra.forwardRef)(function(t,a){let{theme:n,className:r,allowAttachments:o=!1,welcomeMessage:l,welcome:i,placeholder:s="Ask me anything...",triggerEvent:u="triggerDemoRequest",api:c,mcp:d,debug:f=!1,readOnly:p=!1}=t,y=Jl(n),v=ti(y),S=ei(y),g=Zl({...t,api:c}),x=Vl({...t,api:c,sessionId:g.sessionId,onCallTool:d?.onCallTool}),m=Yl(s,!g.text),[w,L]=(0,ra.useState)(null),b=(0,ra.useRef)(null),A=(0,ra.useCallback)(()=>{let D=b.current;if(!D)return;let N=D.querySelector("textarea");N&&N.focus()},[]),R=Ql({messages:g.messages,status:g.status,config:t.suggestions}),_=(0,ra.useCallback)(D=>{let N=D.content.map(B=>B.text??"").join("").trim();N&&g.handleSubmit({text:N,files:[],modelContext:D.modelContext})},[g.handleSubmit]),T=(0,ra.useCallback)(D=>{R.clear(),g.handleSubmit({text:D,files:[]})},[R.clear,g.handleSubmit]);return(0,ra.useImperativeHandle)(a,()=>({sendMessage:D=>{g.handleSubmit({text:D,files:[]}),A()},sendMessageAndWait:D=>g.sendMessageAndWait(D),reset:g.reset,focus:A,get messages(){return g.messages}}),[g.handleSubmit,g.sendMessageAndWait,g.reset,g.messages,A]),(0,ra.useEffect)(()=>{if(!u)return;let D=N=>{let B=N.detail,j=typeof B?.message=="string"?B.message:void 0;j&&g.handleSubmit({text:j,files:[]}),A()};return window.addEventListener(u,D),()=>window.removeEventListener(u,D)},[u,g.handleSubmit,A]),(0,bt.jsxs)("div",{ref:b,style:v,"data-waniwani-chat":"","data-waniwani-layout":"embed",...S?{"data-waniwani-dark":""}:{},className:$("ww:flex ww:flex-col ww:w-full ww:h-full ww:font-[family-name:var(--ww-font)] ww:text-foreground ww:bg-background ww:overflow-hidden",r),children:[(0,bt.jsxs)(Sl,{className:"ww:flex-1 ww:min-h-0 ww:bg-background",children:[(0,bt.jsx)(Cl,{scrollClassName:w?"ww:!relative ww:!overflow-hidden":void 0,children:(0,bt.jsx)(Hl,{messages:g.messages,status:g.status,welcomeMessage:l,welcome:i,onSuggestionSelect:T,resourceEndpoint:d?.resourceEndpoint,chatSessionId:g.sessionId,isDark:S,onFollowUp:_,onCallTool:x,fullscreenToolCallId:w,debug:f,toolDefinitions:g.toolDefinitions,onWidgetDisplayModeChange:(D,N)=>{L(D==="fullscreen"?N.toolCallId:null)}})}),(0,bt.jsx)(Il,{})]}),!p&&(0,bt.jsx)("div",{style:w?{display:"none"}:void 0,children:(0,bt.jsx)(jl,{suggestions:R.suggestions,isLoading:R.isLoading,onSelect:T})}),!p&&(0,bt.jsx)("div",{style:w?{display:"none"}:void 0,children:(0,bt.jsx)(Al,{queuedMessages:g.queuedMessages,onRemove:g.removeQueuedMessage})}),!p&&(0,bt.jsx)("div",{style:w?{display:"none"}:void 0,children:(0,bt.jsx)("div",{className:"ww:shrink-0 ww:px-4 ww:pb-8 ww:pt-2 ww:bg-background",children:(0,bt.jsx)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:(0,bt.jsx)(Ll,{onSubmit:g.handleSubmit,globalDrop:o,multiple:o,className:"ww:rounded-2xl ww:border-border ww:bg-input",children:(0,bt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[o&&(0,bt.jsx)(Ml,{}),(0,bt.jsx)(kl,{onChange:g.handleTextChange,value:g.text,placeholder:m,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,bt.jsx)(Tl,{status:g.status,disabled:g.queueFull})]})})})})})]})});var kf=q(ee(),1),E2=(0,_r.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,onReady:r},o){let l=Lf(t,a,n),i=(0,_r.useRef)(null);(0,_r.useEffect)(()=>{r?.()},[]),(0,_r.useImperativeHandle)(o,()=>({get chat(){return i.current}}),[]);let s={borderRadius:0,...Bc(l)},u={api:l.api,headers:{Authorization:`Bearer ${l.token}`},skipRemoteConfig:!0,body:l.mcpServerUrl?{mcpServerUrl:l.mcpServerUrl}:void 0,theme:s,welcomeMessage:l.welcomeMessage,placeholder:l.placeholder,suggestions:l.suggestions?{initial:l.suggestions}:void 0},c=l.layout??"card";return c==="bar"?(0,kf.jsx)(M2,{...u,ref:i,title:l.title??"Assistant"}):c==="embed"?(0,kf.jsx)(A2,{...u,ref:i,api:u.api}):(0,kf.jsx)(Cf,{...u,ref:i,title:l.title??"Assistant",width:"100%",height:"100%"})});var yx="/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--ww-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--ww-color-red-300:oklch(80.8% .114 19.571);--ww-color-red-400:oklch(70.4% .191 22.216);--ww-color-red-500:oklch(63.7% .237 25.331);--ww-color-blue-400:oklch(70.7% .165 254.624);--ww-spacing:.25rem;--ww-container-sm:24rem;--ww-container-md:28rem;--ww-container-3xl:48rem;--ww-text-xs:.75rem;--ww-text-xs--line-height:calc(1/.75);--ww-text-sm:.875rem;--ww-text-sm--line-height:calc(1.25/.875);--ww-text-base:1rem;--ww-text-base--line-height:calc(1.5/1);--ww-text-lg:1.125rem;--ww-text-lg--line-height:calc(1.75/1.125);--ww-font-weight-medium:500;--ww-font-weight-semibold:600;--ww-tracking-wide:.025em;--ww-tracking-wider:.05em;--ww-tracking-widest:.1em;--ww-leading-normal:1.5;--ww-radius-md:.375rem;--ww-radius-lg:.5rem;--ww-radius-xl:.75rem;--ww-radius-2xl:1rem;--ww-ease-out:cubic-bezier(0,0,.2,1);--ww-animate-spin:spin 1s linear infinite;--ww-animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--ww-default-transition-duration:.15s;--ww-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--ww-default-font-family:var(--ww-font-sans,system-ui,-apple-system,\"Segoe UI\",sans-serif);--ww-default-mono-font-family:var(--ww-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--ww-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--ww-default-font-feature-settings,normal);font-variation-settings:var(--ww-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--ww-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--ww-default-mono-font-feature-settings,normal);font-variation-settings:var(--ww-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.ww\\:\\!relative{position:relative!important}.ww\\:absolute{position:absolute}.ww\\:relative{position:relative}.ww\\:bottom-4{bottom:calc(var(--ww-spacing)*4)}.ww\\:left-\\[50\\%\\]{left:50%}.ww\\:mx-3{margin-inline:calc(var(--ww-spacing)*3)}.ww\\:mx-auto{margin-inline:auto}.ww\\:my-2{margin-block:calc(var(--ww-spacing)*2)}.ww\\:mt-0\\.5{margin-top:calc(var(--ww-spacing)*.5)}.ww\\:mt-1{margin-top:calc(var(--ww-spacing)*1)}.ww\\:mt-2{margin-top:calc(var(--ww-spacing)*2)}.ww\\:mt-6{margin-top:calc(var(--ww-spacing)*6)}.ww\\:mb-2{margin-bottom:calc(var(--ww-spacing)*2)}.ww\\:mb-4{margin-bottom:calc(var(--ww-spacing)*4)}.ww\\:ml-auto{margin-left:auto}.ww\\:line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.ww\\:block{display:block}.ww\\:contents{display:contents}.ww\\:flex{display:flex}.ww\\:grid{display:grid}.ww\\:hidden{display:none}.ww\\:inline-block{display:inline-block}.ww\\:inline-flex{display:inline-flex}.ww\\:field-sizing-content{field-sizing:content}.ww\\:size-2{width:calc(var(--ww-spacing)*2);height:calc(var(--ww-spacing)*2)}.ww\\:size-3{width:calc(var(--ww-spacing)*3);height:calc(var(--ww-spacing)*3)}.ww\\:size-3\\.5{width:calc(var(--ww-spacing)*3.5);height:calc(var(--ww-spacing)*3.5)}.ww\\:size-4{width:calc(var(--ww-spacing)*4);height:calc(var(--ww-spacing)*4)}.ww\\:size-5{width:calc(var(--ww-spacing)*5);height:calc(var(--ww-spacing)*5)}.ww\\:size-7{width:calc(var(--ww-spacing)*7);height:calc(var(--ww-spacing)*7)}.ww\\:size-8{width:calc(var(--ww-spacing)*8);height:calc(var(--ww-spacing)*8)}.ww\\:size-9{width:calc(var(--ww-spacing)*9);height:calc(var(--ww-spacing)*9)}.ww\\:size-12{width:calc(var(--ww-spacing)*12);height:calc(var(--ww-spacing)*12)}.ww\\:size-auto{width:auto;height:auto}.ww\\:size-full{width:100%;height:100%}.ww\\:h-1\\.5{height:calc(var(--ww-spacing)*1.5)}.ww\\:h-3\\.5{height:calc(var(--ww-spacing)*3.5)}.ww\\:h-7{height:calc(var(--ww-spacing)*7)}.ww\\:h-8{height:calc(var(--ww-spacing)*8)}.ww\\:h-9{height:calc(var(--ww-spacing)*9)}.ww\\:h-16{height:calc(var(--ww-spacing)*16)}.ww\\:h-auto{height:auto}.ww\\:h-full{height:100%}.ww\\:max-h-48{max-height:calc(var(--ww-spacing)*48)}.ww\\:min-h-0{min-height:calc(var(--ww-spacing)*0)}.ww\\:min-h-10{min-height:calc(var(--ww-spacing)*10)}.ww\\:min-h-full{min-height:100%}.ww\\:w-1\\.5{width:calc(var(--ww-spacing)*1.5)}.ww\\:w-fit{width:fit-content}.ww\\:w-full{width:100%}.ww\\:max-w-3xl{max-width:var(--ww-container-3xl)}.ww\\:max-w-24{max-width:calc(var(--ww-spacing)*24)}.ww\\:max-w-32{max-width:calc(var(--ww-spacing)*32)}.ww\\:max-w-\\[80\\%\\]{max-width:80%}.ww\\:max-w-full{max-width:100%}.ww\\:max-w-md{max-width:var(--ww-container-md)}.ww\\:max-w-sm{max-width:var(--ww-container-sm)}.ww\\:min-w-0{min-width:calc(var(--ww-spacing)*0)}.ww\\:flex-1{flex:1}.ww\\:shrink-0{flex-shrink:0}.ww\\:grow{flex-grow:1}.ww\\:translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.ww\\:rotate-90{rotate:90deg}.ww\\:rotate-180{rotate:180deg}.ww\\:animate-\\[ww-fade-in_0\\.2s_ease-out_both\\]{animation:.2s ease-out both ww-fade-in}.ww\\:animate-pulse{animation:var(--ww-animate-pulse)}.ww\\:animate-spin{animation:var(--ww-animate-spin)}.ww\\:cursor-pointer{cursor:pointer}.ww\\:resize-none{resize:none}.ww\\:grid-rows-\\[0fr\\]{grid-template-rows:0fr}.ww\\:grid-rows-\\[1fr\\]{grid-template-rows:1fr}.ww\\:flex-col{flex-direction:column}.ww\\:flex-wrap{flex-wrap:wrap}.ww\\:items-center{align-items:center}.ww\\:items-end{align-items:flex-end}.ww\\:items-start{align-items:flex-start}.ww\\:justify-between{justify-content:space-between}.ww\\:justify-center{justify-content:center}.ww\\:gap-1{gap:calc(var(--ww-spacing)*1)}.ww\\:gap-1\\.5{gap:calc(var(--ww-spacing)*1.5)}.ww\\:gap-2{gap:calc(var(--ww-spacing)*2)}.ww\\:gap-3{gap:calc(var(--ww-spacing)*3)}.ww\\:gap-6{gap:calc(var(--ww-spacing)*6)}:where(.ww\\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.ww\\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}.ww\\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ww\\:\\!overflow-hidden{overflow:hidden!important}.ww\\:overflow-hidden{overflow:hidden}.ww\\:overflow-x-auto{overflow-x:auto}.ww\\:overflow-y-auto{overflow-y:auto}.ww\\:overflow-y-hidden{overflow-y:hidden}.ww\\:\\!rounded-full{border-radius:3.40282e38px!important}.ww\\:rounded{border-radius:var(--ww-radius,16px)}.ww\\:rounded-2xl{border-radius:var(--ww-radius-2xl)}.ww\\:rounded-\\[var\\(--ww-radius\\)\\]{border-radius:var(--ww-radius)}.ww\\:rounded-full{border-radius:3.40282e38px}.ww\\:rounded-lg{border-radius:var(--ww-radius-lg)}.ww\\:rounded-md{border-radius:var(--ww-radius-md)}.ww\\:rounded-xl{border-radius:var(--ww-radius-xl)}.ww\\:border{border-style:var(--tw-border-style);border-width:1px}.ww\\:border-0{border-style:var(--tw-border-style);border-width:0}.ww\\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.ww\\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.ww\\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.ww\\:border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.ww\\:border-\\[\\#03d916\\]{border-color:#03d916}.ww\\:border-border,.ww\\:border-border\\/50{border-color:var(--ww-color-border,#e5e7eb)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-border\\/50{border-color:color-mix(in oklab,var(--ww-color-border,#e5e7eb)50%,transparent)}}.ww\\:border-foreground\\/30{border-color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-foreground\\/30{border-color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)30%,transparent)}}.ww\\:border-muted-foreground\\/50{border-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-muted-foreground\\/50{border-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)50%,transparent)}}.ww\\:border-transparent{border-color:#0000}.ww\\:bg-\\[\\#03d916\\]\\/10{background-color:oklab(76.761% -.205195 .155304/.1)}.ww\\:bg-accent{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:bg-background,.ww\\:bg-background\\/20{background-color:var(--ww-color-background,#fff)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-background\\/20{background-color:color-mix(in oklab,var(--ww-color-background,#fff)20%,transparent)}}.ww\\:bg-foreground{background-color:var(--ww-color-foreground,#1f2937)}.ww\\:bg-input{background-color:var(--ww-color-input,#f9fafb)}.ww\\:bg-muted{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:bg-muted-foreground\\/10{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/10{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)10%,transparent)}}.ww\\:bg-muted-foreground\\/20{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/20{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)20%,transparent)}}.ww\\:bg-muted-foreground\\/60{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/60{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)60%,transparent)}}.ww\\:bg-muted\\/50{background-color:var(--ww-color-muted,#f1f5f9)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted\\/50{background-color:color-mix(in oklab,var(--ww-color-muted,#f1f5f9)50%,transparent)}}.ww\\:bg-primary{background-color:var(--ww-color-primary,#6366f1)}.ww\\:bg-red-500\\/10{background-color:var(--ww-color-red-500)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-red-500\\/10{background-color:color-mix(in oklab,var(--ww-color-red-500)10%,transparent)}}.ww\\:bg-tool-card{background-color:var(--ww-color-tool-card,#f4f4f5)}.ww\\:bg-transparent{background-color:#0000}.ww\\:object-cover{object-fit:cover}.ww\\:p-0{padding:calc(var(--ww-spacing)*0)}.ww\\:p-1{padding:calc(var(--ww-spacing)*1)}.ww\\:p-3{padding:calc(var(--ww-spacing)*3)}.ww\\:px-0{padding-inline:calc(var(--ww-spacing)*0)}.ww\\:px-1\\.5{padding-inline:calc(var(--ww-spacing)*1.5)}.ww\\:px-2{padding-inline:calc(var(--ww-spacing)*2)}.ww\\:px-3{padding-inline:calc(var(--ww-spacing)*3)}.ww\\:px-4{padding-inline:calc(var(--ww-spacing)*4)}.ww\\:px-6{padding-inline:calc(var(--ww-spacing)*6)}.ww\\:py-0\\.5{padding-block:calc(var(--ww-spacing)*.5)}.ww\\:py-1{padding-block:calc(var(--ww-spacing)*1)}.ww\\:py-1\\.5{padding-block:calc(var(--ww-spacing)*1.5)}.ww\\:py-2{padding-block:calc(var(--ww-spacing)*2)}.ww\\:py-2\\.5{padding-block:calc(var(--ww-spacing)*2.5)}.ww\\:py-3{padding-block:calc(var(--ww-spacing)*3)}.ww\\:py-6{padding-block:calc(var(--ww-spacing)*6)}.ww\\:py-8{padding-block:calc(var(--ww-spacing)*8)}.ww\\:py-12{padding-block:calc(var(--ww-spacing)*12)}.ww\\:pt-2{padding-top:calc(var(--ww-spacing)*2)}.ww\\:pt-2\\.5{padding-top:calc(var(--ww-spacing)*2.5)}.ww\\:pt-3{padding-top:calc(var(--ww-spacing)*3)}.ww\\:pr-3{padding-right:calc(var(--ww-spacing)*3)}.ww\\:pb-1\\.5{padding-bottom:calc(var(--ww-spacing)*1.5)}.ww\\:pb-3{padding-bottom:calc(var(--ww-spacing)*3)}.ww\\:pb-8{padding-bottom:calc(var(--ww-spacing)*8)}.ww\\:pl-4{padding-left:calc(var(--ww-spacing)*4)}.ww\\:text-center{text-align:center}.ww\\:text-left{text-align:left}.ww\\:font-\\[family-name\\:var\\(--ww-font\\)\\]{font-family:var(--ww-font)}.ww\\:font-mono{font-family:var(--ww-font-mono)}.ww\\:text-base{font-size:var(--ww-text-base);line-height:var(--tw-leading,var(--ww-text-base--line-height))}.ww\\:text-lg{font-size:var(--ww-text-lg);line-height:var(--tw-leading,var(--ww-text-lg--line-height))}.ww\\:text-sm{font-size:var(--ww-text-sm);line-height:var(--tw-leading,var(--ww-text-sm--line-height))}.ww\\:text-xs{font-size:var(--ww-text-xs);line-height:var(--tw-leading,var(--ww-text-xs--line-height))}.ww\\:text-\\[10px\\]{font-size:10px}.ww\\:text-\\[11px\\]{font-size:11px}.ww\\:leading-normal{--tw-leading:var(--ww-leading-normal);line-height:var(--ww-leading-normal)}.ww\\:font-medium{--tw-font-weight:var(--ww-font-weight-medium);font-weight:var(--ww-font-weight-medium)}.ww\\:font-semibold{--tw-font-weight:var(--ww-font-weight-semibold);font-weight:var(--ww-font-weight-semibold)}.ww\\:tracking-wide{--tw-tracking:var(--ww-tracking-wide);letter-spacing:var(--ww-tracking-wide)}.ww\\:tracking-wider{--tw-tracking:var(--ww-tracking-wider);letter-spacing:var(--ww-tracking-wider)}.ww\\:tracking-widest{--tw-tracking:var(--ww-tracking-widest);letter-spacing:var(--ww-tracking-widest)}.ww\\:break-words{overflow-wrap:break-word}.ww\\:break-all{word-break:break-all}.ww\\:whitespace-pre-wrap{white-space:pre-wrap}.ww\\:text-background{color:var(--ww-color-background,#fff)}.ww\\:text-foreground,.ww\\:text-foreground\\/50{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/50{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)50%,transparent)}}.ww\\:text-foreground\\/60{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/60{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)60%,transparent)}}.ww\\:text-foreground\\/80{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/80{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)80%,transparent)}}.ww\\:text-muted-foreground{color:var(--ww-color-muted-foreground,#6b7280)}.ww\\:text-primary{color:var(--ww-color-primary,#6366f1)}.ww\\:text-primary-foreground{color:var(--ww-color-primary-foreground,#1f2937)}.ww\\:text-red-400{color:var(--ww-color-red-400)}.ww\\:uppercase{text-transform:uppercase}.ww\\:opacity-0{opacity:0}.ww\\:opacity-100{opacity:1}.ww\\:shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-blue-400\\/70{--tw-ring-color:var(--ww-color-blue-400)}@supports (color:color-mix(in lab, red, red)){.ww\\:ring-blue-400\\/70{--tw-ring-color:color-mix(in oklab,var(--ww-color-blue-400)70%,transparent)}}.ww\\:ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ww\\:ring-offset-background{--tw-ring-offset-color:var(--ww-color-background,#fff)}.ww\\:transition-\\[grid-template-rows\\,opacity\\]{transition-property:grid-template-rows,opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:duration-150{--tw-duration:.15s;transition-duration:.15s}.ww\\:duration-200{--tw-duration:.2s;transition-duration:.2s}.ww\\:duration-300{--tw-duration:.3s;transition-duration:.3s}.ww\\:ease-out{--tw-ease:var(--ww-ease-out);transition-timing-function:var(--ww-ease-out)}.ww\\:outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.ww\\:group-hover\\:opacity-0:is(:where(.ww\\:group):hover *){opacity:0}.ww\\:group-hover\\:opacity-100:is(:where(.ww\\:group):hover *){opacity:1}}.ww\\:group-\\[\\.is-assistant\\]\\:text-foreground:is(:where(.ww\\:group).is-assistant *){color:var(--ww-color-foreground,#1f2937)}.ww\\:group-\\[\\.is-user\\]\\:ml-auto:is(:where(.ww\\:group).is-user *){margin-left:auto}.ww\\:group-\\[\\.is-user\\]\\:rounded-lg:is(:where(.ww\\:group).is-user *){border-radius:var(--ww-radius-lg)}.ww\\:group-\\[\\.is-user\\]\\:bg-user-bubble:is(:where(.ww\\:group).is-user *){background-color:var(--ww-color-user-bubble,#f4f4f4)}.ww\\:group-\\[\\.is-user\\]\\:px-4:is(:where(.ww\\:group).is-user *){padding-inline:calc(var(--ww-spacing)*4)}.ww\\:group-\\[\\.is-user\\]\\:py-3:is(:where(.ww\\:group).is-user *){padding-block:calc(var(--ww-spacing)*3)}.ww\\:group-\\[\\.is-user\\]\\:text-primary-foreground:is(:where(.ww\\:group).is-user *){color:var(--ww-color-primary-foreground,#1f2937)}.ww\\:placeholder\\:text-muted-foreground::placeholder{color:var(--ww-color-muted-foreground,#6b7280)}@media (hover:hover){.ww\\:hover\\:border-primary\\/30:hover{border-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:border-primary\\/30:hover{border-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)30%,transparent)}}.ww\\:hover\\:bg-accent:hover{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:hover\\:bg-foreground:hover{background-color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:bg-muted:hover{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)10%,transparent)}}.ww\\:hover\\:bg-muted\\/50:hover{background-color:var(--ww-color-muted,#f1f5f9)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-muted\\/50:hover{background-color:color-mix(in oklab,var(--ww-color-muted,#f1f5f9)50%,transparent)}}.ww\\:hover\\:bg-primary\\/90:hover{background-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)90%,transparent)}}.ww\\:hover\\:text-accent-foreground:hover{color:var(--ww-color-accent-foreground,#1f2937)}.ww\\:hover\\:text-foreground:hover{color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:text-red-300:hover{color:var(--ww-color-red-300)}.ww\\:hover\\:underline:hover{text-decoration-line:underline}}.ww\\:disabled\\:pointer-events-none:disabled{pointer-events:none}.ww\\:disabled\\:opacity-30:disabled{opacity:.3}.ww\\:disabled\\:opacity-40:disabled{opacity:.4}.ww\\:disabled\\:opacity-50:disabled{opacity:.5}.ww\\:\\[\\&\\>\\*\\:first-child\\]\\:mt-0>:first-child{margin-top:calc(var(--ww-spacing)*0)}.ww\\:\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--ww-spacing)*0)}}@keyframes ww-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes ww-fade-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes ww-pulse{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}[data-waniwani-chat] ::-webkit-scrollbar{width:8px}[data-waniwani-chat] ::-webkit-scrollbar-track{background:0 0}[data-waniwani-chat] ::-webkit-scrollbar-thumb{background:var(--ww-color-border);border-radius:9999px}[data-waniwani-chat] ::-webkit-scrollbar-thumb:hover{background:var(--ww-color-muted-foreground)}[data-waniwani-chat] *{scrollbar-width:thin;scrollbar-color:var(--ww-color-border)transparent}[data-waniwani-chat]{--ww-color-background:var(--ww-bg,#fff);--ww-color-foreground:var(--ww-text,#1f2937);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#1f2937);--ww-color-muted-foreground:var(--ww-muted,#6b7280);--ww-color-border:var(--ww-border,#e5e7eb);--ww-color-input:var(--ww-input-bg,#f9fafb);--ww-color-accent:var(--ww-assistant-bubble,#f3f4f6);--ww-color-accent-foreground:var(--ww-text,#1f2937);--ww-color-user-bubble:var(--ww-user-bubble,#f4f4f4);--ww-color-card:var(--ww-bg,#fff);--ww-color-card-foreground:var(--ww-text,#1f2937);--ww-color-card-header:var(--ww-header-bg,#fff);--ww-color-card-header-foreground:var(--ww-header-text,#1f2937);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#f4f4f5);--ww-radius:var(--ww-radius,16px);--ww-font-sans:var(--ww-font,system-ui,-apple-system,\"Segoe UI\",sans-serif)}.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-color-background:var(--ww-bg,#212121);--ww-color-foreground:var(--ww-text,#ececec);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#fff);--ww-color-muted-foreground:var(--ww-muted,#8e8ea0);--ww-color-border:var(--ww-border,#444);--ww-color-input:var(--ww-input-bg,#2f2f2f);--ww-color-accent:var(--ww-assistant-bubble,#2f2f2f);--ww-color-accent-foreground:var(--ww-text,#ececec);--ww-color-user-bubble:var(--ww-user-bubble,#303030);--ww-color-card:var(--ww-bg,#212121);--ww-color-card-foreground:var(--ww-text,#ececec);--ww-color-card-header:var(--ww-header-bg,#1e1e1e);--ww-color-card-header-foreground:var(--ww-header-text,#ececec);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#262626)}[data-waniwani-chat] [data-streamdown=table-wrapper]{flex-direction:column;gap:.5rem;margin-top:1rem;margin-bottom:1rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:first-child:has(button){justify-content:flex-end;align-items:center;gap:.25rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:last-child{overflow-x:auto}[data-waniwani-chat] [data-streamdown=table]{border-collapse:collapse;border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;overflow:hidden}[data-waniwani-chat] [data-streamdown=table-header]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-body]{background-color:color-mix(in srgb,var(--ww-color-accent)40%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]>tr+tr{border-top:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-row]{border-bottom:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-header-cell]{white-space:nowrap;text-align:left;padding:.5rem 1rem;font-size:.875rem;font-weight:600}[data-waniwani-chat] [data-streamdown=table-cell]{padding:.5rem 1rem;font-size:.875rem}[data-waniwani-chat] [data-streamdown=link]{color:var(--ww-color-primary);overflow-wrap:anywhere;cursor:pointer;font-weight:500;text-decoration:underline}[data-waniwani-chat] [data-streamdown=link-safety-modal]{z-index:50;background-color:var(--ww-color-background);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=link-safety-modal]{background-color:color-mix(in srgb,var(--ww-color-background)50%,transparent)}}[data-waniwani-chat] [data-streamdown=link-safety-modal]{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);width:100%;max-width:28rem;color:var(--ww-color-foreground);border-radius:.75rem;flex-direction:column;gap:1rem;margin:0 1rem;padding:1.5rem;display:flex;position:relative;box-shadow:0 10px 25px #0000001a}[data-waniwani-chat] [data-streamdown=link-safety-modal] button{cursor:pointer}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child{color:var(--ww-color-muted-foreground);background:0 0;border:none;border-radius:.375rem;padding:.25rem;transition:background-color .15s,color .15s;position:absolute;top:1rem;right:1rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child:hover{background-color:var(--ww-color-accent);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type{flex-direction:column;gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>div{align-items:center;gap:.5rem;font-size:1.125rem;font-weight:600;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>p{color:var(--ww-color-muted-foreground);font-size:.875rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:nth-child(3){word-break:break-all;background-color:var(--ww-color-accent);border-radius:.375rem;max-height:8rem;padding:.75rem;font-family:ui-monospace,monospace;font-size:.875rem;overflow-y:auto}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child{gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button{border:none;border-radius:.375rem;flex:1;justify-content:center;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:background-color .15s;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child:hover{background-color:var(--ww-color-accent)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child{background-color:var(--ww-color-primary);color:#fff}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child:hover{opacity:.9}[data-waniwani-chat] [data-streamdown=ordered-list]{white-space:normal;list-style-type:decimal;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=ordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=unordered-list]{white-space:normal;list-style-type:disc;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=unordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=list-item]{padding-top:.25rem;padding-bottom:.25rem}[data-waniwani-chat] [data-streamdown=list-item]>p{display:inline}[data-waniwani-chat] [data-streamdown=inline-code]{background-color:var(--ww-color-accent);border-radius:.25rem;padding:.125rem .375rem;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:.875rem}[data-waniwani-chat] [data-streamdown=heading-1]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.875rem;font-weight:600;line-height:2.25rem}[data-waniwani-chat] [data-streamdown=heading-2]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.5rem;font-weight:600;line-height:2rem}[data-waniwani-chat] [data-streamdown=heading-3]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.25rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-4]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.125rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-5]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1rem;font-weight:600;line-height:1.5rem}[data-waniwani-chat] [data-streamdown=heading-6]{margin-top:1.5rem;margin-bottom:.5rem;font-size:.875rem;font-weight:600;line-height:1.25rem}[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid var(--ww-color-muted-foreground);margin-top:1rem;margin-bottom:1rem}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid color-mix(in srgb,var(--ww-color-muted-foreground)30%,transparent)}}[data-waniwani-chat] [data-streamdown=blockquote]{color:var(--ww-color-muted-foreground);padding-left:1rem;font-style:italic}[data-waniwani-chat] [data-streamdown=horizontal-rule]{border-color:var(--ww-color-border);margin-top:1.5rem;margin-bottom:1.5rem}[data-waniwani-chat] [data-streamdown=strong]{font-weight:600}[data-waniwani-chat] [data-streamdown=image-wrapper]{margin-top:1rem;margin-bottom:1rem;display:inline-block;position:relative}[data-waniwani-chat] [data-streamdown=image]{border-radius:.5rem;max-width:100%}[data-waniwani-chat] [data-streamdown=code-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;margin-top:1rem;margin-bottom:1rem;overflow:hidden}[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:var(--ww-color-accent);justify-content:space-between;align-items:center;display:flex}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=code-block-header]{color:var(--ww-color-muted-foreground);padding:.75rem;font-size:.75rem}[data-waniwani-chat] [data-streamdown=code-block-body]{padding:1rem;font-size:.875rem;overflow-x:auto}[data-waniwani-chat] [data-streamdown=code-block-copy-button],[data-waniwani-chat] [data-streamdown=code-block-download-button]{cursor:pointer;color:var(--ww-color-muted-foreground);background:0 0;border:none;padding:.25rem;transition:color .15s}[data-waniwani-chat] [data-streamdown=code-block-copy-button]:hover,[data-waniwani-chat] [data-streamdown=code-block-download-button]:hover{color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=mermaid-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;height:auto;margin-top:1rem;margin-bottom:1rem;padding:1rem;position:relative}[data-waniwani-chat] [data-streamdown=mermaid]{width:100%;height:100%}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}",Ba=null,Or=null,oa=null;function _2(e,t){if(yx&&yx!=="__WANIWANI_EMBED_CSS__"){let a=document.createElement("style");a.textContent=yx,e.appendChild(a)}if(t.css)try{let a=new URL(t.css,window.location.href);if(a.protocol==="https:"||a.protocol==="http:"){let n=document.createElement("link");n.rel="stylesheet",n.href=a.href,e.appendChild(n)}else console.warn("[WaniWani] Custom CSS URL must use http or https protocol.")}catch{console.warn("[WaniWani] Invalid custom CSS URL:",t.css)}}var R2="data-waniwani-embed";function v6(e,t,a){let n=document.querySelector(`[${R2}]`);if(!n)throw new Error(`[WaniWani] No inline mount target. Place \`<div ${R2}></div>\` in your page for \`mode: "inline"\`.`);oa=document.createElement("div"),oa.id="waniwani-chat-embed",oa.style.width="100%",oa.style.height="100%",n.appendChild(oa);let r=oa.attachShadow({mode:"open"});_2(r,e);let o=document.createElement("div");o.style.width="100%",o.style.height="100%",r.appendChild(o);let l=au.default.createRef();return Or=xx.default.createRoot(o),Or.render(au.default.createElement(E2,{ref:l,config:e,programmatic:t,scriptConfig:a})),{destroy:()=>{Or?.unmount(),Or=null,oa?.remove(),oa=null,Ba=null},open:()=>{},close:()=>{},toggle:()=>{},sendMessage:i=>l.current?.chat?.sendMessage(i)}}function w6(e,t){let a=t.position==="bottom-left",n=t.theme?.primaryColor??"#6366f1",r=document.createElement("div");r.setAttribute("data-waniwani-skeleton","");let o=document.createElement("style");o.textContent=`
138
+ `);a=i.pop()??"";for(let s of i){let u=s.trim();if(!u.startsWith("data:"))continue;let c=u.slice(5).trim();if(c!=="[DONE]")try{let d=JSON.parse(c);if(!r){l.enqueue(d);continue}let f=await r(d);if(f.success){l.enqueue(f.value);continue}let p=JF(f.error);if(p?.length){let y={...d};for(let S of p)delete y[S];let v=await r(y);v.success&&l.enqueue(v.value)}}catch{}}}}))}};var b2="waniwani-visitor-id";function S2(e,t){return e.match(t)?.[1]??null}function e6(e){let t=[["Edge",/Edg(?:e|A|iOS)?\/(\S+)/],["Opera",/(?:OPR|Opera)\/(\S+)/],["Samsung Internet",/SamsungBrowser\/(\S+)/],["Firefox",/Firefox\/(\S+)/],["Chrome",/Chrome\/(\S+)/],["Safari",/Version\/(\S+).*Safari/]];for(let[a,n]of t){let r=S2(e,n);if(r)return{name:a,version:r}}return null}function t6(e){let t=[["iOS",/(?:iPhone|iPad|iPod).+?OS (\d+[_.\d]*)/],["Android",/Android (\d+[.\d]*)/],["macOS",/Mac OS X (\d+[_.\d]*)/],["Windows",/Windows NT (\d+[.\d]*)/],["ChromeOS",/CrOS \S+ (\d+[.\d]*)/],["Linux",/Linux/]];for(let[a,n]of t){let r=S2(e,n);if(r)return{name:a,version:r.replace(/_/g,".")};if(a==="Linux"&&n.test(e))return{name:a,version:""}}return null}function a6(e){return typeof navigator<"u"&&"userAgentData"in navigator&&navigator.userAgentData?.mobile?"mobile":/iPad|tablet|PlayBook/i.test(e)?"tablet":/Mobi|Android.*Mobile|iPhone|iPod/i.test(e)?"mobile":"desktop"}async function n6(e){let t=new TextEncoder().encode(e),a=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(a)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function r6(){try{let a=localStorage.getItem(b2);if(a)return a}catch{}let e=[navigator.userAgent,screen.width,screen.height,screen.colorDepth,Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.language,navigator.hardwareConcurrency??"",navigator.platform??""].join("|"),t=await n6(e);try{localStorage.setItem(b2,t)}catch{}return t}async function C2(){let e=navigator.userAgent,t=await r6();return{userAgent:e,browser:e6(e),os:t6(e),deviceType:a6(e),language:navigator.language,languages:[...navigator.languages],timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,colorDepth:screen.colorDepth,devicePixelRatio:window.devicePixelRatio??1,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0,connectionType:navigator.connection?.effectiveType??"unknown",referrer:document.referrer,visitorId:t}}var o6="x-session-id";function I2(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}async function l6(e,t){let a=`${e.replace(/\/$/,"")}/tools`,n=await fetch(a,{method:"GET",headers:t?{...t}:void 0});if(!n.ok)throw new Error(`[WaniWani] Failed to fetch /tools: ${n.status} ${n.statusText}`);let r=await n.json();if(!r||!Array.isArray(r.tools))return{};let o={};for(let l of r.tools)l&&typeof l.name=="string"&&(o[l.name]=l);return o}function Zl(e){let{api:t="/api/waniwani",headers:a,body:n,onMessageSent:r,onResponseReceived:o}=e,l=(0,be.useRef)(a),i=(0,be.useRef)(n),s=(0,be.useRef)(void 0),u=(0,be.useRef)(null),[c,d]=(0,be.useState)(void 0),f=(0,be.useRef)(c),p=(0,be.useCallback)(()=>f.current,[]),y=(0,be.useCallback)(G=>{let Q=I2(G);Q&&f.current!==Q&&(f.current=Q,d(Q))},[]),v=(0,be.useCallback)(()=>{f.current=void 0,d(void 0)},[]);(0,be.useEffect)(()=>{l.current=a},[a]),(0,be.useEffect)(()=>{i.current=n},[n]),(0,be.useEffect)(()=>{C2().then(G=>{u.current=G}).catch(()=>{})},[]);let S=(0,be.useRef)(new wf({api:t,headers:()=>({...l.current}),body:()=>{let G={...i.current??{}},Q=Object.hasOwn(G,"sessionId"),ke=I2(G.sessionId);if(ke)y(ke),G.sessionId=ke;else if(Q)v(),delete G.sessionId;else{let se=p();se&&(G.sessionId=se)}if(Fl(s.current)&&(G.modelContext=s.current),u.current){let se=u.current;G.visitorContext={timezone:se.timezone,language:se.language,languages:se.languages,deviceType:se.deviceType,referrer:se.referrer,visitorId:se.visitorId}}return G},fetch:(async(G,Q)=>{let ke=await fetch(G,Q);return s.current=void 0,y(ke.headers.get(o6)),ke})})),g=(0,be.useRef)(null),x=(0,be.useRef)(null),m=(0,be.useRef)({}),[w,L]=(0,be.useState)(0),b=e.skipRemoteConfig===!0,A=(0,be.useCallback)(async()=>{if(!b)try{let G=await l6(t,l.current);m.current=G,L(Q=>Q+1)}catch(G){console.warn("[WaniWani] Failed to fetch tool definitions:",G instanceof Error?G.message:G)}},[t,b]);(0,be.useEffect)(()=>{A()},[A]);let{messages:R,sendMessage:_,setMessages:T,status:D}=w2({messages:e.initialMessages,transport:S.current,onFinish({message:G}){o?.(),g.current&&(x.current=G)},onError(G){console.warn("[WaniWani] Chat error:",G.message),g.current&&(g.current.reject(G),g.current=null)}});(0,be.useEffect)(()=>{if(D==="ready"&&g.current&&x.current){let G=g.current,Q=x.current;g.current=null,x.current=null,G.resolve(Q)}},[D]);let[N,B]=(0,be.useState)(""),[j,V]=(0,be.useState)([]),F=D==="submitted"||D==="streaming",te=(0,be.useCallback)(G=>{V(Q=>Q.filter(ke=>ke.id!==G))},[]),$e=F&&j.length>0,Z=(0,be.useCallback)(G=>{let Q=!!G.text?.trim(),ke=!!G.files?.length;if(Q||ke){if(F){if(j.length>0)return;V(se=>[...se,{id:jc(),text:G.text||"",files:G.files??[],modelContext:G.modelContext}]),B("");return}s.current=G.modelContext,_({text:G.text||"",files:G.files}),r?.(G.text||""),B("")}},[_,r,F,j.length]),C=(0,be.useCallback)(G=>new Promise((Q,ke)=>{g.current={resolve:Q,reject:ke},_({text:G}),r?.(G)}),[_,r]);(0,be.useEffect)(()=>{if(D!=="ready"||j.length===0)return;let[G,...Q]=j;V(Q),s.current=G.modelContext,_({text:G.text,files:G.files.length>0?G.files:void 0}),r?.(G.text)},[D,_,r,j]);let Xe=(0,be.useCallback)(()=>{T([]),V([]),v(),B(""),m.current={},L(G=>G+1),A()},[T,v,A]),le=(0,be.useCallback)(G=>{B(G.target.value)},[]),k=R[R.length-1],Ze=R.length>0,Ue=F&&(!Ze||k.role==="user"),Hn=m.current;return{messages:R,status:D,text:N,setText:B,handleSubmit:Z,handleTextChange:le,isLoading:F,showLoaderBubble:Ue,lastMessage:k,hasMessages:Ze,sendMessage:_,sendMessageAndWait:C,reset:Xe,queuedMessages:j,queueFull:$e,removeQueuedMessage:te,sessionId:c,toolDefinitions:Hn,refreshToolDefinitions:A}}var ko=q(xe(),1),i6={debug:!1,eval:!1};function bf(e="/api/waniwani",t,a=!1){let[n,r]=(0,ko.useState)(i6),o=(0,ko.useRef)(t);return(0,ko.useEffect)(()=>{o.current=t},[t]),(0,ko.useEffect)(()=>{a||(async()=>{try{let l=o.current,s=await(await fetch(`${e}/config`,{headers:l?{...l}:void 0})).json();r({debug:s.debug===!0,eval:s.eval===!0})}catch{}})()},[e,a]),n}var sn=q(xe(),1);function s6(e){for(let t of e.parts){let a=t;if(a.type==="data"||a.type==="data-suggestions"){let n=a.data;if(n&&Array.isArray(n.suggestions))return n.suggestions}}return null}function L2(e){return typeof e=="object"&&e!==null&&"initial"in e}function Ql(e){let{messages:t,status:a,config:n}=e,r=L2(n)&&n.initial?n.initial:void 0,[o,l]=(0,sn.useState)(r??[]),i=(0,sn.useRef)(a),s=n===!0||L2(n)&&n.dynamic!==!1,u=(0,sn.useCallback)(()=>{l([])},[]),c=t.length>0;(0,sn.useEffect)(()=>{!c&&r&&r.length>0&&l(r)},[r,c]);let d=t[t.length-1];return(0,sn.useEffect)(()=>{d?.role==="user"&&u()},[d,u]),(0,sn.useEffect)(()=>{let f=i.current;if(i.current=a,f==="streaming"&&a==="ready"&&s){let p=[...t].reverse().find(v=>v.role==="assistant");if(!p)return;console.log("[WaniWani] Assistant parts:",p.parts);let y=s6(p);console.log("[WaniWani] Extracted suggestions:",y),y&&l(y)}},[a,s,t]),{suggestions:o,isLoading:!1,clear:u}}var Kl=q(xe(),1),u6=50,c6=30,d6=2e3,k2=500;function Yl(e,t=!0){let[a,n]=(0,Kl.useState)(""),r=(0,Kl.useRef)(void 0);return(0,Kl.useEffect)(()=>{if(!t){n("");return}let o=0,l=!1,i=!1,s=()=>{i||(l?(o--,n(e.slice(0,o)),o<=0?(l=!1,r.current=setTimeout(s,k2)):r.current=setTimeout(s,c6)):(o++,n(e.slice(0,o)),o>=e.length?(l=!0,r.current=setTimeout(s,d6)):r.current=setTimeout(s,u6)))};return r.current=setTimeout(s,k2),()=>{i=!0,clearTimeout(r.current)}},[e,t]),a}function Sf(e,t){let a=t?.Authorization,n=typeof a=="string"&&a.startsWith("Bearer ")?a.slice(7):null;return n?`${e}/resource?token=${encodeURIComponent(n)}`:`${e}/resource`}var f6={primaryColor:"#6366f1",primaryForeground:"#1f2937",backgroundColor:"#ffffff",textColor:"#1f2937",mutedColor:"#6b7280",borderColor:"#e5e7eb",assistantBubbleColor:"#f3f4f6",userBubbleColor:"#f4f4f4",inputBackgroundColor:"#f9fafb",borderRadius:16,messageBorderRadius:12,fontFamily:"system-ui, -apple-system, 'Segoe UI', sans-serif",headerBackgroundColor:"#ffffff",headerTextColor:"#1f2937",statusColor:"#22c55e",toolCardColor:"#f4f4f5"};var p6={primaryColor:["--ww-primary","--ww-color-primary"],primaryForeground:["--ww-primary-fg","--ww-color-primary-foreground"],backgroundColor:["--ww-bg","--ww-color-background"],textColor:["--ww-text","--ww-color-foreground","--ww-color-accent-foreground"],mutedColor:["--ww-muted","--ww-color-muted-foreground"],borderColor:["--ww-border","--ww-color-border"],assistantBubbleColor:["--ww-assistant-bubble","--ww-color-accent"],userBubbleColor:["--ww-user-bubble"],inputBackgroundColor:["--ww-input-bg","--ww-color-input"],borderRadius:["--ww-radius"],messageBorderRadius:["--ww-msg-radius"],fontFamily:["--ww-font"],headerBackgroundColor:["--ww-header-bg"],headerTextColor:["--ww-header-text"],statusColor:["--ww-status"],toolCardColor:["--ww-tool-card","--ww-color-tool-card"]};function Jl(e){return{...f6,...e}}function ei(e){let t=e.backgroundColor.replace("#",""),a=parseInt(t.substring(0,2),16),n=parseInt(t.substring(2,4),16),r=parseInt(t.substring(4,6),16);return(a*299+n*587+r*114)/1e3<128}function ti(e){let t={};for(let[a,n]of Object.entries(p6)){let r=e[a],o=typeof r=="number"?`${r}px`:String(r);for(let l of n)t[l]=o}return t}var rt=q(ee(),1),Cf=(0,Ut.forwardRef)(function(t,a){let{theme:n,title:r="Assistant",width:o,height:l,className:i,allowAttachments:s=!1,welcomeMessage:u,welcome:c,placeholder:d="Ask me anything...",triggerEvent:f="triggerDemoRequest",api:p,debug:y}=t,v=p??"/api/waniwani",S=Sf(v,t.headers),g=Jl(n),x=ti(g),m=ei(g),w=bf(v,t.headers,t.skipRemoteConfig),L=y??w.debug,b=Zl({...t,api:v}),A=Vl({...t,api:v,sessionId:b.sessionId}),R=Yl(d,!b.text),[_,T]=(0,Ut.useState)(!1),[D,N]=(0,Ut.useState)(null),B=(0,Ut.useRef)(null),j=(0,Ut.useRef)(void 0),V=(0,Ut.useCallback)(()=>{let Z=B.current;if(!Z)return;Z.scrollIntoView({behavior:"smooth",block:"center"});let C=Z.querySelector("textarea");C&&setTimeout(()=>C.focus(),300),T(!0),clearTimeout(j.current),j.current=setTimeout(()=>T(!1),2e3)},[]),F=Ql({messages:b.messages,status:b.status,config:t.suggestions}),te=(0,Ut.useCallback)(Z=>{let C=Z.content.map(Xe=>Xe.text??"").join("").trim();C&&b.handleSubmit({text:C,files:[],modelContext:Z.modelContext})},[b.handleSubmit]),$e=(0,Ut.useCallback)(Z=>{F.clear(),b.handleSubmit({text:Z,files:[]})},[F.clear,b.handleSubmit]);return(0,Ut.useImperativeHandle)(a,()=>({sendMessage:Z=>{b.handleSubmit({text:Z,files:[]}),V()},sendMessageAndWait:Z=>b.sendMessageAndWait(Z),reset:b.reset,focus:V,get messages(){return b.messages}}),[b.handleSubmit,b.sendMessageAndWait,b.reset,b.messages,V]),(0,Ut.useEffect)(()=>{if(!f)return;let Z=C=>{let Xe=C.detail,le=typeof Xe?.message=="string"?Xe.message:void 0;le&&b.handleSubmit({text:le,files:[]}),V()};return window.addEventListener(f,Z),()=>window.removeEventListener(f,Z)},[f,b.handleSubmit,V]),(0,rt.jsxs)("div",{ref:B,style:{...x,width:o,height:l},"data-waniwani-chat":"","data-waniwani-layout":"card",...m?{"data-waniwani-dark":""}:{},className:$("ww:flex ww:flex-col ww:font-[family-name:var(--ww-font)] ww:text-foreground ww:bg-background ww:rounded-[var(--ww-radius)] ww:overflow-hidden",_&&"ww:ring-2 ww:ring-blue-400/70 ww:ring-offset-2 ww:ring-offset-background",i),children:[(0,rt.jsxs)("div",{className:"ww:shrink-0 ww:flex ww:items-center ww:px-6 ww:py-3",style:{backgroundColor:g.headerBackgroundColor,color:g.headerTextColor},children:[(0,rt.jsx)("div",{className:"ww:text-sm ww:font-semibold ww:truncate",children:r}),(0,rt.jsx)(Gc,{messages:b.messages,evalEnabled:w.eval,api:v})]}),(0,rt.jsxs)(Sl,{className:"ww:flex-1 ww:min-h-0 ww:bg-background",children:[(0,rt.jsx)(Cl,{scrollClassName:D?"ww:!relative ww:!overflow-hidden":void 0,children:(0,rt.jsx)(Hl,{messages:b.messages,status:b.status,welcomeMessage:u,welcome:c,onSuggestionSelect:$e,resourceEndpoint:S,chatSessionId:b.sessionId,isDark:m,onFollowUp:te,onCallTool:A,fullscreenToolCallId:D,debug:L,toolDefinitions:b.toolDefinitions,onWidgetDisplayModeChange:(Z,C)=>{N(Z==="fullscreen"?C.toolCallId:null)}})}),(0,rt.jsx)(Il,{})]}),(0,rt.jsx)("div",{style:D?{display:"none"}:void 0,children:(0,rt.jsx)(jl,{suggestions:F.suggestions,isLoading:F.isLoading,onSelect:$e})}),(0,rt.jsx)("div",{style:D?{display:"none"}:void 0,children:(0,rt.jsx)(Al,{queuedMessages:b.queuedMessages,onRemove:b.removeQueuedMessage})}),(0,rt.jsx)("div",{style:D?{display:"none"}:void 0,children:(0,rt.jsx)("div",{className:"ww:shrink-0 ww:px-4 ww:pb-8 ww:pt-2 ww:bg-background",children:(0,rt.jsx)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:(0,rt.jsx)(Ll,{onSubmit:b.handleSubmit,globalDrop:s,multiple:s,className:"ww:rounded-2xl ww:border-border ww:bg-input",children:(0,rt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[s&&(0,rt.jsx)(Ml,{}),(0,rt.jsx)(kl,{onChange:b.handleTextChange,value:b.text,placeholder:R,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,rt.jsx)(Tl,{status:b.status,disabled:b.queueFull})]})})})})})]})});var If=q(xe(),1);async function m6(e,t,a){try{let n=`${e.replace(/\/$/,"")}/config`,r=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${t}`},signal:a});if(!r.ok)return{};let o=await r.json(),l=o&&typeof o=="object"&&"data"in o&&o.data?o.data:o;return l?h6(l):{}}catch{return{}}}function h6(e){let t={};return e.title!=null&&(t.title=e.title),e.welcomeMessage!=null&&(t.welcomeMessage=e.welcomeMessage),e.placeholder!=null&&(t.placeholder=e.placeholder),e.suggestions!=null&&e.suggestions.length>0&&(t.suggestions=e.suggestions),t}function Lf(e,t,a){let[n,r]=(0,If.useState)(e);return(0,If.useEffect)(()=>{let o=e.api,l=e.token;if(!o||!l)return;let i=new AbortController;return m6(o,l,i.signal).then(s=>{if(!i.signal.aborted&&Object.keys(s).length!==0)try{r(Nc(t,s,a))}catch(u){console.error("[WaniWani] Failed to apply remote config:",u)}}).catch(s=>{console.error("[WaniWani] Remote config fetch failed:",s)}),()=>i.abort()},[e.api,e.token]),n}var Tt=q(ee(),1);function g6(){return(0,Tt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"Chat",children:[(0,Tt.jsx)("title",{children:"Chat"}),(0,Tt.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})]})}function y6(){return(0,Tt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"Close",children:[(0,Tt.jsx)("title",{children:"Close"}),(0,Tt.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Tt.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}var hx=56,gx=20,x6=12,To=200,T2=(0,ct.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,onReady:r},o){let l=Lf(t,a,n),[i,s]=(0,ct.useState)(!1),[u,c]=(0,ct.useState)(0),[d,f]=(0,ct.useState)(!1),p=(0,ct.useRef)(null),y=(0,ct.useRef)(i);y.current=i,(0,ct.useEffect)(()=>{r?.()},[]),(0,ct.useEffect)(()=>{let F=window.matchMedia("(max-width: 768px)"),te=$e=>f($e.matches);return te(F),F.addEventListener("change",te),()=>F.removeEventListener("change",te)},[]),(0,ct.useEffect)(()=>{if(!i)return;let F=te=>{te.key==="Escape"&&s(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[i]),(0,ct.useEffect)(()=>{i&&c(0)},[i]);let v=(0,ct.useCallback)(()=>{y.current||c(F=>F+1)},[]),S=(0,ct.useCallback)(()=>s(!0),[]),g=(0,ct.useCallback)(()=>s(!1),[]),x=(0,ct.useCallback)(()=>s(F=>!F),[]);(0,ct.useImperativeHandle)(o,()=>({open:S,close:g,toggle:x,get chat(){return p.current}}));let m=!i&&u>0,w=l.mode==="custom",L=l.position==="bottom-left",b=l.width??400,A=l.height??600,R=l.theme?.primaryColor??"#6366f1",_={position:"fixed",bottom:gx,...L?{left:gx}:{right:gx},zIndex:2147483647,fontFamily:l.theme?.fontFamily??"system-ui, -apple-system, 'Segoe UI', sans-serif"},T={width:hx,height:hx,borderRadius:"50%",backgroundColor:R,color:"#ffffff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:`transform ${To}ms ease, box-shadow ${To}ms ease`,outline:"none"},D=d?{position:"fixed",inset:0,zIndex:2147483647,transition:`transform ${To}ms ease, opacity ${To}ms ease`,...i?{transform:"translateY(0) scale(1)",opacity:1}:{transform:"translateY(20px) scale(0.95)",opacity:0,pointerEvents:"none"}}:{position:"absolute",bottom:w?0:hx+x6,...L?{left:0}:{right:0},width:b,height:A,transition:`transform ${To}ms ease, opacity ${To}ms ease`,...i?{transform:"translateY(0) scale(1)",opacity:1}:{transform:"translateY(20px) scale(0.95)",opacity:0,pointerEvents:"none"}},N={width:"100%",height:"100%",borderRadius:d?0:12,overflow:"hidden",boxShadow:d?"none":"0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)"},B={position:"absolute",top:d?12:8,right:d?12:8,zIndex:10,width:d?36:28,height:d?36:28,borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.06)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"inherit",outline:"none",transition:`background-color ${To}ms ease`},j={position:"absolute",top:-2,right:-2,width:12,height:12,borderRadius:"50%",backgroundColor:"#ef4444",border:"2px solid #ffffff"},V=Bc(l);return(0,Tt.jsxs)("div",{style:_,children:[(0,Tt.jsx)("div",{style:D,role:"dialog","aria-label":"Chat panel",children:(0,Tt.jsxs)("div",{style:{...N,position:"relative"},children:[(0,Tt.jsx)("button",{type:"button",onClick:g,style:B,"aria-label":"Close chat",onMouseEnter:F=>{F.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.12)"},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.06)"},children:(0,Tt.jsx)(y6,{})}),(0,Tt.jsx)(Cf,{ref:p,api:l.api,headers:{Authorization:`Bearer ${l.token}`},skipRemoteConfig:!0,body:l.mcpServerUrl?{mcpServerUrl:l.mcpServerUrl}:void 0,theme:V,title:l.title??"Assistant",welcomeMessage:l.welcomeMessage,placeholder:l.placeholder,suggestions:l.suggestions?{initial:l.suggestions}:void 0,onResponseReceived:v,width:"100%",height:"100%"})]})}),!w&&(0,Tt.jsxs)("button",{type:"button",onClick:x,style:{...T,position:"relative"},"aria-label":i?"Close chat":"Open chat",onMouseEnter:F=>{F.currentTarget.style.transform="scale(1.08)",F.currentTarget.style.boxShadow="0 6px 20px rgba(0, 0, 0, 0.2)"},onMouseLeave:F=>{F.currentTarget.style.transform="scale(1)",F.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},children:[(0,Tt.jsx)(g6,{}),m&&(0,Tt.jsx)("span",{style:j})]})]})});var _r=q(xe(),1);var wt=q(xe(),1);var dt=q(ee(),1),M2=(0,wt.forwardRef)(function(t,a){let{theme:n,title:r="Assistant",width:o=600,expandedWidth:l,expandedHeight:i=400,allowAttachments:s=!1,welcomeMessage:u,welcome:c,placeholder:d="Ask me anything...",triggerEvent:f="triggerDemoRequest",api:p}=t,y=l??Math.round((typeof o=="number"?o:600)*1.2),v=p??"/api/waniwani",S=Sf(v,t.headers),g=Jl(n),x=ti(g),m=ei(g),w=bf(p,t.headers,t.skipRemoteConfig),L=Zl(t),b=Vl({...t,sessionId:L.sessionId}),A=Ql({messages:L.messages,status:L.status,config:t.suggestions}),R=(0,wt.useCallback)(le=>{let k=le.content.map(Ze=>Ze.text??"").join("").trim();k&&L.handleSubmit({text:k,files:[],modelContext:le.modelContext})},[L.handleSubmit]),_=(0,wt.useCallback)(le=>{A.clear(),L.handleSubmit({text:le,files:[]})},[A.clear,L.handleSubmit]),T=Yl(d,!L.text),[D,N]=(0,wt.useState)(!1),[B,j]=(0,wt.useState)(!1),[V,F]=(0,wt.useState)(null),te=(0,wt.useRef)(null),$e=(0,wt.useRef)(void 0),Z=(0,wt.useCallback)(()=>{let le=te.current;if(!le)return;le.scrollIntoView({behavior:"smooth",block:"center"});let k=le.querySelector("textarea");k&&setTimeout(()=>k.focus(),300),N(!0),j(!0),clearTimeout($e.current),$e.current=setTimeout(()=>j(!1),2e3)},[]);(0,wt.useImperativeHandle)(a,()=>({sendMessage:le=>{L.handleSubmit({text:le,files:[]}),Z()},sendMessageAndWait:le=>L.sendMessageAndWait(le),reset:L.reset,focus:Z,get messages(){return L.messages}}),[L.handleSubmit,L.sendMessageAndWait,L.reset,L.messages,Z]),(0,wt.useEffect)(()=>{if(!f)return;let le=k=>{let Ze=k.detail,Ue=typeof Ze?.message=="string"?Ze.message:void 0;Ue&&L.handleSubmit({text:Ue,files:[]}),Z()};return window.addEventListener(f,le),()=>window.removeEventListener(f,le)},[f,L.handleSubmit,Z]);let C=D||V!==null;(0,wt.useEffect)(()=>{if(!D)return;let le=k=>{te.current&&!te.current.contains(k.target)&&N(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[D]);let Xe=(0,wt.useCallback)(()=>{N(!0)},[]);return(0,dt.jsxs)("div",{ref:te,style:{...x,width:C?y:o,transition:"width 0.4s cubic-bezier(0.16, 1, 0.3, 1)"},"data-waniwani-chat":"","data-waniwani-layout":"bar",...m?{"data-waniwani-dark":""}:{},className:"ww:flex ww:flex-col ww:font-[family-name:var(--ww-font)] ww:text-foreground",children:[(0,dt.jsxs)("div",{style:{overflow:"hidden",backgroundColor:g.backgroundColor,borderRadius:"var(--ww-radius) var(--ww-radius) 0 0",maxHeight:C?i+200:0,opacity:C?1:0,transform:C?"scaleX(1)":"scaleX(0.88)",transformOrigin:"center bottom",transition:"max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease-out, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"},children:[(0,dt.jsxs)("div",{className:"ww:shrink-0 ww:flex ww:items-center ww:px-6 ww:py-3",style:{backgroundColor:g.headerBackgroundColor,color:g.headerTextColor},children:[(0,dt.jsx)("div",{className:"ww:text-sm ww:font-semibold ww:truncate",children:r}),(0,dt.jsx)(Gc,{messages:L.messages,evalEnabled:w.eval,api:v})]}),(0,dt.jsxs)(Sl,{className:"ww:flex-1",style:{height:i},children:[(0,dt.jsx)(Cl,{scrollClassName:V?"ww:!relative ww:!overflow-hidden":void 0,children:(0,dt.jsx)(Hl,{messages:L.messages,status:L.status,welcomeMessage:u,welcome:c,onSuggestionSelect:_,resourceEndpoint:S,chatSessionId:L.sessionId,isDark:m,onFollowUp:R,onCallTool:b,fullscreenToolCallId:V,toolDefinitions:L.toolDefinitions,onWidgetDisplayModeChange:(le,k)=>{F(le==="fullscreen"?k.toolCallId:null)}})}),(0,dt.jsx)(Il,{})]}),(0,dt.jsx)("div",{style:V?{display:"none"}:void 0,children:(0,dt.jsx)(jl,{suggestions:A.suggestions,isLoading:A.isLoading,onSelect:_})}),(0,dt.jsx)("div",{style:V?{display:"none"}:void 0,children:(0,dt.jsx)(Al,{queuedMessages:L.queuedMessages,onRemove:L.removeQueuedMessage})})]}),(0,dt.jsx)("div",{style:{backgroundColor:C?g.backgroundColor:"transparent",borderRadius:C?"0 0 var(--ww-radius) var(--ww-radius)":void 0,boxShadow:C?"0 8px 24px rgba(0,0,0,0.1)":"none",transition:"background-color 0.2s ease, border-radius 0.3s ease, box-shadow 0.35s ease, padding 0.3s ease",padding:C?"8px 16px 16px":"0"},children:(0,dt.jsx)(Ll,{onSubmit:L.handleSubmit,globalDrop:s,multiple:s,className:$("ww:rounded-2xl ww:border-border ww:bg-input ww:transition-all ww:duration-300",!C&&"ww:shadow-sm",B&&"ww:ring-2 ww:ring-blue-400/70 ww:ring-offset-2 ww:ring-offset-background"),children:(0,dt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[s&&(0,dt.jsx)(Ml,{}),(0,dt.jsx)(kl,{onChange:L.handleTextChange,value:L.text,placeholder:T,onFocus:Xe,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,dt.jsx)(Tl,{status:L.status,disabled:L.queueFull})]})})})]})});var ra=q(xe(),1);var bt=q(ee(),1),A2=(0,ra.forwardRef)(function(t,a){let{theme:n,className:r,allowAttachments:o=!1,welcomeMessage:l,welcome:i,placeholder:s="Ask me anything...",triggerEvent:u="triggerDemoRequest",api:c,mcp:d,debug:f=!1,readOnly:p=!1}=t,y=Jl(n),v=ti(y),S=ei(y),g=Zl({...t,api:c}),x=Vl({...t,api:c,sessionId:g.sessionId,onCallTool:d?.onCallTool}),m=Yl(s,!g.text),[w,L]=(0,ra.useState)(null),b=(0,ra.useRef)(null),A=(0,ra.useCallback)(()=>{let D=b.current;if(!D)return;let N=D.querySelector("textarea");N&&N.focus()},[]),R=Ql({messages:g.messages,status:g.status,config:t.suggestions}),_=(0,ra.useCallback)(D=>{let N=D.content.map(B=>B.text??"").join("").trim();N&&g.handleSubmit({text:N,files:[],modelContext:D.modelContext})},[g.handleSubmit]),T=(0,ra.useCallback)(D=>{R.clear(),g.handleSubmit({text:D,files:[]})},[R.clear,g.handleSubmit]);return(0,ra.useImperativeHandle)(a,()=>({sendMessage:D=>{g.handleSubmit({text:D,files:[]}),A()},sendMessageAndWait:D=>g.sendMessageAndWait(D),reset:g.reset,focus:A,get messages(){return g.messages}}),[g.handleSubmit,g.sendMessageAndWait,g.reset,g.messages,A]),(0,ra.useEffect)(()=>{if(!u)return;let D=N=>{let B=N.detail,j=typeof B?.message=="string"?B.message:void 0;j&&g.handleSubmit({text:j,files:[]}),A()};return window.addEventListener(u,D),()=>window.removeEventListener(u,D)},[u,g.handleSubmit,A]),(0,bt.jsxs)("div",{ref:b,style:v,"data-waniwani-chat":"","data-waniwani-layout":"embed",...S?{"data-waniwani-dark":""}:{},className:$("ww:flex ww:flex-col ww:w-full ww:h-full ww:font-[family-name:var(--ww-font)] ww:text-foreground ww:bg-background ww:overflow-hidden",r),children:[(0,bt.jsxs)(Sl,{className:"ww:flex-1 ww:min-h-0 ww:bg-background",children:[(0,bt.jsx)(Cl,{scrollClassName:w?"ww:!relative ww:!overflow-hidden":void 0,children:(0,bt.jsx)(Hl,{messages:g.messages,status:g.status,welcomeMessage:l,welcome:i,onSuggestionSelect:T,resourceEndpoint:d?.resourceEndpoint,chatSessionId:g.sessionId,isDark:S,onFollowUp:_,onCallTool:x,fullscreenToolCallId:w,debug:f,toolDefinitions:g.toolDefinitions,onWidgetDisplayModeChange:(D,N)=>{L(D==="fullscreen"?N.toolCallId:null)}})}),(0,bt.jsx)(Il,{})]}),!p&&(0,bt.jsx)("div",{style:w?{display:"none"}:void 0,children:(0,bt.jsx)(jl,{suggestions:R.suggestions,isLoading:R.isLoading,onSelect:T})}),!p&&(0,bt.jsx)("div",{style:w?{display:"none"}:void 0,children:(0,bt.jsx)(Al,{queuedMessages:g.queuedMessages,onRemove:g.removeQueuedMessage})}),!p&&(0,bt.jsx)("div",{style:w?{display:"none"}:void 0,children:(0,bt.jsx)("div",{className:"ww:shrink-0 ww:px-4 ww:pb-8 ww:pt-2 ww:bg-background",children:(0,bt.jsx)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:(0,bt.jsx)(Ll,{onSubmit:g.handleSubmit,globalDrop:o,multiple:o,className:"ww:rounded-2xl ww:border-border ww:bg-input",children:(0,bt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[o&&(0,bt.jsx)(Ml,{}),(0,bt.jsx)(kl,{onChange:g.handleTextChange,value:g.text,placeholder:m,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,bt.jsx)(Tl,{status:g.status,disabled:g.queueFull})]})})})})})]})});var kf=q(ee(),1),E2=(0,_r.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,onReady:r},o){let l=Lf(t,a,n),i=(0,_r.useRef)(null);(0,_r.useEffect)(()=>{r?.()},[]),(0,_r.useImperativeHandle)(o,()=>({get chat(){return i.current}}),[]);let s={...Bc(l),borderRadius:0},u={api:l.api,headers:{Authorization:`Bearer ${l.token}`},skipRemoteConfig:!0,body:l.mcpServerUrl?{mcpServerUrl:l.mcpServerUrl}:void 0,theme:s,welcomeMessage:l.welcomeMessage,placeholder:l.placeholder,suggestions:l.suggestions?{initial:l.suggestions}:void 0},c=l.layout??"card";return c==="bar"?(0,kf.jsx)(M2,{...u,ref:i,title:l.title??"Assistant"}):c==="embed"?(0,kf.jsx)(A2,{...u,ref:i,api:u.api}):(0,kf.jsx)(Cf,{...u,ref:i,title:l.title??"Assistant",width:"100%",height:"100%"})});var yx="/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--ww-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--ww-color-red-300:oklch(80.8% .114 19.571);--ww-color-red-400:oklch(70.4% .191 22.216);--ww-color-red-500:oklch(63.7% .237 25.331);--ww-color-blue-400:oklch(70.7% .165 254.624);--ww-spacing:.25rem;--ww-container-sm:24rem;--ww-container-md:28rem;--ww-container-3xl:48rem;--ww-text-xs:.75rem;--ww-text-xs--line-height:calc(1/.75);--ww-text-sm:.875rem;--ww-text-sm--line-height:calc(1.25/.875);--ww-text-base:1rem;--ww-text-base--line-height:calc(1.5/1);--ww-text-lg:1.125rem;--ww-text-lg--line-height:calc(1.75/1.125);--ww-font-weight-medium:500;--ww-font-weight-semibold:600;--ww-tracking-wide:.025em;--ww-tracking-wider:.05em;--ww-tracking-widest:.1em;--ww-leading-normal:1.5;--ww-radius-md:.375rem;--ww-radius-lg:.5rem;--ww-radius-xl:.75rem;--ww-radius-2xl:1rem;--ww-ease-out:cubic-bezier(0,0,.2,1);--ww-animate-spin:spin 1s linear infinite;--ww-animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--ww-default-transition-duration:.15s;--ww-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--ww-default-font-family:var(--ww-font-sans,system-ui,-apple-system,\"Segoe UI\",sans-serif);--ww-default-mono-font-family:var(--ww-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--ww-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--ww-default-font-feature-settings,normal);font-variation-settings:var(--ww-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--ww-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--ww-default-mono-font-feature-settings,normal);font-variation-settings:var(--ww-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.ww\\:\\!relative{position:relative!important}.ww\\:absolute{position:absolute}.ww\\:relative{position:relative}.ww\\:bottom-4{bottom:calc(var(--ww-spacing)*4)}.ww\\:left-\\[50\\%\\]{left:50%}.ww\\:mx-3{margin-inline:calc(var(--ww-spacing)*3)}.ww\\:mx-auto{margin-inline:auto}.ww\\:my-2{margin-block:calc(var(--ww-spacing)*2)}.ww\\:mt-0\\.5{margin-top:calc(var(--ww-spacing)*.5)}.ww\\:mt-1{margin-top:calc(var(--ww-spacing)*1)}.ww\\:mt-2{margin-top:calc(var(--ww-spacing)*2)}.ww\\:mt-6{margin-top:calc(var(--ww-spacing)*6)}.ww\\:mb-2{margin-bottom:calc(var(--ww-spacing)*2)}.ww\\:mb-4{margin-bottom:calc(var(--ww-spacing)*4)}.ww\\:ml-auto{margin-left:auto}.ww\\:line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.ww\\:block{display:block}.ww\\:contents{display:contents}.ww\\:flex{display:flex}.ww\\:grid{display:grid}.ww\\:hidden{display:none}.ww\\:inline-block{display:inline-block}.ww\\:inline-flex{display:inline-flex}.ww\\:field-sizing-content{field-sizing:content}.ww\\:size-2{width:calc(var(--ww-spacing)*2);height:calc(var(--ww-spacing)*2)}.ww\\:size-3{width:calc(var(--ww-spacing)*3);height:calc(var(--ww-spacing)*3)}.ww\\:size-3\\.5{width:calc(var(--ww-spacing)*3.5);height:calc(var(--ww-spacing)*3.5)}.ww\\:size-4{width:calc(var(--ww-spacing)*4);height:calc(var(--ww-spacing)*4)}.ww\\:size-5{width:calc(var(--ww-spacing)*5);height:calc(var(--ww-spacing)*5)}.ww\\:size-7{width:calc(var(--ww-spacing)*7);height:calc(var(--ww-spacing)*7)}.ww\\:size-8{width:calc(var(--ww-spacing)*8);height:calc(var(--ww-spacing)*8)}.ww\\:size-9{width:calc(var(--ww-spacing)*9);height:calc(var(--ww-spacing)*9)}.ww\\:size-12{width:calc(var(--ww-spacing)*12);height:calc(var(--ww-spacing)*12)}.ww\\:size-auto{width:auto;height:auto}.ww\\:size-full{width:100%;height:100%}.ww\\:h-1\\.5{height:calc(var(--ww-spacing)*1.5)}.ww\\:h-3\\.5{height:calc(var(--ww-spacing)*3.5)}.ww\\:h-7{height:calc(var(--ww-spacing)*7)}.ww\\:h-8{height:calc(var(--ww-spacing)*8)}.ww\\:h-9{height:calc(var(--ww-spacing)*9)}.ww\\:h-16{height:calc(var(--ww-spacing)*16)}.ww\\:h-auto{height:auto}.ww\\:h-full{height:100%}.ww\\:max-h-48{max-height:calc(var(--ww-spacing)*48)}.ww\\:min-h-0{min-height:calc(var(--ww-spacing)*0)}.ww\\:min-h-full{min-height:100%}.ww\\:w-1\\.5{width:calc(var(--ww-spacing)*1.5)}.ww\\:w-fit{width:fit-content}.ww\\:w-full{width:100%}.ww\\:max-w-3xl{max-width:var(--ww-container-3xl)}.ww\\:max-w-24{max-width:calc(var(--ww-spacing)*24)}.ww\\:max-w-32{max-width:calc(var(--ww-spacing)*32)}.ww\\:max-w-\\[80\\%\\]{max-width:80%}.ww\\:max-w-full{max-width:100%}.ww\\:max-w-md{max-width:var(--ww-container-md)}.ww\\:max-w-sm{max-width:var(--ww-container-sm)}.ww\\:min-w-0{min-width:calc(var(--ww-spacing)*0)}.ww\\:flex-1{flex:1}.ww\\:shrink-0{flex-shrink:0}.ww\\:grow{flex-grow:1}.ww\\:translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.ww\\:rotate-90{rotate:90deg}.ww\\:rotate-180{rotate:180deg}.ww\\:animate-\\[ww-fade-in_0\\.2s_ease-out_both\\]{animation:.2s ease-out both ww-fade-in}.ww\\:animate-pulse{animation:var(--ww-animate-pulse)}.ww\\:animate-spin{animation:var(--ww-animate-spin)}.ww\\:cursor-pointer{cursor:pointer}.ww\\:resize-none{resize:none}.ww\\:grid-rows-\\[0fr\\]{grid-template-rows:0fr}.ww\\:grid-rows-\\[1fr\\]{grid-template-rows:1fr}.ww\\:flex-col{flex-direction:column}.ww\\:flex-wrap{flex-wrap:wrap}.ww\\:items-center{align-items:center}.ww\\:items-end{align-items:flex-end}.ww\\:items-start{align-items:flex-start}.ww\\:justify-between{justify-content:space-between}.ww\\:justify-center{justify-content:center}.ww\\:gap-1{gap:calc(var(--ww-spacing)*1)}.ww\\:gap-1\\.5{gap:calc(var(--ww-spacing)*1.5)}.ww\\:gap-2{gap:calc(var(--ww-spacing)*2)}.ww\\:gap-3{gap:calc(var(--ww-spacing)*3)}.ww\\:gap-6{gap:calc(var(--ww-spacing)*6)}:where(.ww\\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.ww\\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}.ww\\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ww\\:\\!overflow-hidden{overflow:hidden!important}.ww\\:overflow-hidden{overflow:hidden}.ww\\:overflow-x-auto{overflow-x:auto}.ww\\:overflow-y-auto{overflow-y:auto}.ww\\:overflow-y-hidden{overflow-y:hidden}.ww\\:\\!rounded-full{border-radius:3.40282e38px!important}.ww\\:rounded{border-radius:var(--ww-radius,16px)}.ww\\:rounded-2xl{border-radius:var(--ww-radius-2xl)}.ww\\:rounded-\\[var\\(--ww-radius\\)\\]{border-radius:var(--ww-radius)}.ww\\:rounded-full{border-radius:3.40282e38px}.ww\\:rounded-lg{border-radius:var(--ww-radius-lg)}.ww\\:rounded-md{border-radius:var(--ww-radius-md)}.ww\\:rounded-xl{border-radius:var(--ww-radius-xl)}.ww\\:border{border-style:var(--tw-border-style);border-width:1px}.ww\\:border-0{border-style:var(--tw-border-style);border-width:0}.ww\\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.ww\\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.ww\\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.ww\\:border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.ww\\:border-\\[\\#03d916\\]{border-color:#03d916}.ww\\:border-border,.ww\\:border-border\\/50{border-color:var(--ww-color-border,#e5e7eb)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-border\\/50{border-color:color-mix(in oklab,var(--ww-color-border,#e5e7eb)50%,transparent)}}.ww\\:border-foreground\\/30{border-color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-foreground\\/30{border-color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)30%,transparent)}}.ww\\:border-muted-foreground\\/50{border-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-muted-foreground\\/50{border-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)50%,transparent)}}.ww\\:border-transparent{border-color:#0000}.ww\\:bg-\\[\\#03d916\\]\\/10{background-color:oklab(76.761% -.205195 .155304/.1)}.ww\\:bg-accent{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:bg-background,.ww\\:bg-background\\/20{background-color:var(--ww-color-background,#fff)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-background\\/20{background-color:color-mix(in oklab,var(--ww-color-background,#fff)20%,transparent)}}.ww\\:bg-foreground{background-color:var(--ww-color-foreground,#1f2937)}.ww\\:bg-input{background-color:var(--ww-color-input,#f9fafb)}.ww\\:bg-muted{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:bg-muted-foreground\\/10{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/10{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)10%,transparent)}}.ww\\:bg-muted-foreground\\/20{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/20{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)20%,transparent)}}.ww\\:bg-muted-foreground\\/60{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/60{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)60%,transparent)}}.ww\\:bg-muted\\/50{background-color:var(--ww-color-muted,#f1f5f9)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted\\/50{background-color:color-mix(in oklab,var(--ww-color-muted,#f1f5f9)50%,transparent)}}.ww\\:bg-primary{background-color:var(--ww-color-primary,#6366f1)}.ww\\:bg-red-500\\/10{background-color:var(--ww-color-red-500)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-red-500\\/10{background-color:color-mix(in oklab,var(--ww-color-red-500)10%,transparent)}}.ww\\:bg-tool-card{background-color:var(--ww-color-tool-card,#f4f4f5)}.ww\\:bg-transparent{background-color:#0000}.ww\\:object-cover{object-fit:cover}.ww\\:p-0{padding:calc(var(--ww-spacing)*0)}.ww\\:p-1{padding:calc(var(--ww-spacing)*1)}.ww\\:p-3{padding:calc(var(--ww-spacing)*3)}.ww\\:px-0{padding-inline:calc(var(--ww-spacing)*0)}.ww\\:px-1\\.5{padding-inline:calc(var(--ww-spacing)*1.5)}.ww\\:px-2{padding-inline:calc(var(--ww-spacing)*2)}.ww\\:px-3{padding-inline:calc(var(--ww-spacing)*3)}.ww\\:px-4{padding-inline:calc(var(--ww-spacing)*4)}.ww\\:px-6{padding-inline:calc(var(--ww-spacing)*6)}.ww\\:py-0\\.5{padding-block:calc(var(--ww-spacing)*.5)}.ww\\:py-1{padding-block:calc(var(--ww-spacing)*1)}.ww\\:py-1\\.5{padding-block:calc(var(--ww-spacing)*1.5)}.ww\\:py-2{padding-block:calc(var(--ww-spacing)*2)}.ww\\:py-2\\.5{padding-block:calc(var(--ww-spacing)*2.5)}.ww\\:py-3{padding-block:calc(var(--ww-spacing)*3)}.ww\\:py-6{padding-block:calc(var(--ww-spacing)*6)}.ww\\:py-8{padding-block:calc(var(--ww-spacing)*8)}.ww\\:py-12{padding-block:calc(var(--ww-spacing)*12)}.ww\\:pt-2{padding-top:calc(var(--ww-spacing)*2)}.ww\\:pt-2\\.5{padding-top:calc(var(--ww-spacing)*2.5)}.ww\\:pt-3{padding-top:calc(var(--ww-spacing)*3)}.ww\\:pr-3{padding-right:calc(var(--ww-spacing)*3)}.ww\\:pb-1\\.5{padding-bottom:calc(var(--ww-spacing)*1.5)}.ww\\:pb-3{padding-bottom:calc(var(--ww-spacing)*3)}.ww\\:pb-8{padding-bottom:calc(var(--ww-spacing)*8)}.ww\\:pl-4{padding-left:calc(var(--ww-spacing)*4)}.ww\\:text-center{text-align:center}.ww\\:text-left{text-align:left}.ww\\:font-\\[family-name\\:var\\(--ww-font\\)\\]{font-family:var(--ww-font)}.ww\\:font-mono{font-family:var(--ww-font-mono)}.ww\\:text-base{font-size:var(--ww-text-base);line-height:var(--tw-leading,var(--ww-text-base--line-height))}.ww\\:text-lg{font-size:var(--ww-text-lg);line-height:var(--tw-leading,var(--ww-text-lg--line-height))}.ww\\:text-sm{font-size:var(--ww-text-sm);line-height:var(--tw-leading,var(--ww-text-sm--line-height))}.ww\\:text-xs{font-size:var(--ww-text-xs);line-height:var(--tw-leading,var(--ww-text-xs--line-height))}.ww\\:text-\\[10px\\]{font-size:10px}.ww\\:text-\\[11px\\]{font-size:11px}.ww\\:leading-normal{--tw-leading:var(--ww-leading-normal);line-height:var(--ww-leading-normal)}.ww\\:font-medium{--tw-font-weight:var(--ww-font-weight-medium);font-weight:var(--ww-font-weight-medium)}.ww\\:font-semibold{--tw-font-weight:var(--ww-font-weight-semibold);font-weight:var(--ww-font-weight-semibold)}.ww\\:tracking-wide{--tw-tracking:var(--ww-tracking-wide);letter-spacing:var(--ww-tracking-wide)}.ww\\:tracking-wider{--tw-tracking:var(--ww-tracking-wider);letter-spacing:var(--ww-tracking-wider)}.ww\\:tracking-widest{--tw-tracking:var(--ww-tracking-widest);letter-spacing:var(--ww-tracking-widest)}.ww\\:break-words{overflow-wrap:break-word}.ww\\:break-all{word-break:break-all}.ww\\:whitespace-pre-wrap{white-space:pre-wrap}.ww\\:text-background{color:var(--ww-color-background,#fff)}.ww\\:text-foreground,.ww\\:text-foreground\\/50{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/50{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)50%,transparent)}}.ww\\:text-foreground\\/60{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/60{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)60%,transparent)}}.ww\\:text-foreground\\/80{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/80{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)80%,transparent)}}.ww\\:text-muted-foreground{color:var(--ww-color-muted-foreground,#6b7280)}.ww\\:text-primary{color:var(--ww-color-primary,#6366f1)}.ww\\:text-primary-foreground{color:var(--ww-color-primary-foreground,#1f2937)}.ww\\:text-red-400{color:var(--ww-color-red-400)}.ww\\:uppercase{text-transform:uppercase}.ww\\:opacity-0{opacity:0}.ww\\:opacity-100{opacity:1}.ww\\:shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-blue-400\\/70{--tw-ring-color:var(--ww-color-blue-400)}@supports (color:color-mix(in lab, red, red)){.ww\\:ring-blue-400\\/70{--tw-ring-color:color-mix(in oklab,var(--ww-color-blue-400)70%,transparent)}}.ww\\:ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ww\\:ring-offset-background{--tw-ring-offset-color:var(--ww-color-background,#fff)}.ww\\:transition-\\[grid-template-rows\\,opacity\\]{transition-property:grid-template-rows,opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:duration-150{--tw-duration:.15s;transition-duration:.15s}.ww\\:duration-200{--tw-duration:.2s;transition-duration:.2s}.ww\\:duration-300{--tw-duration:.3s;transition-duration:.3s}.ww\\:ease-out{--tw-ease:var(--ww-ease-out);transition-timing-function:var(--ww-ease-out)}.ww\\:outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.ww\\:group-hover\\:opacity-0:is(:where(.ww\\:group):hover *){opacity:0}.ww\\:group-hover\\:opacity-100:is(:where(.ww\\:group):hover *){opacity:1}}.ww\\:group-\\[\\.is-assistant\\]\\:text-foreground:is(:where(.ww\\:group).is-assistant *){color:var(--ww-color-foreground,#1f2937)}.ww\\:group-\\[\\.is-user\\]\\:ml-auto:is(:where(.ww\\:group).is-user *){margin-left:auto}.ww\\:group-\\[\\.is-user\\]\\:rounded-lg:is(:where(.ww\\:group).is-user *){border-radius:var(--ww-radius-lg)}.ww\\:group-\\[\\.is-user\\]\\:bg-user-bubble:is(:where(.ww\\:group).is-user *){background-color:var(--ww-color-user-bubble,#f4f4f4)}.ww\\:group-\\[\\.is-user\\]\\:px-4:is(:where(.ww\\:group).is-user *){padding-inline:calc(var(--ww-spacing)*4)}.ww\\:group-\\[\\.is-user\\]\\:py-3:is(:where(.ww\\:group).is-user *){padding-block:calc(var(--ww-spacing)*3)}.ww\\:group-\\[\\.is-user\\]\\:text-primary-foreground:is(:where(.ww\\:group).is-user *){color:var(--ww-color-primary-foreground,#1f2937)}.ww\\:placeholder\\:text-muted-foreground::placeholder{color:var(--ww-color-muted-foreground,#6b7280)}@media (hover:hover){.ww\\:hover\\:border-primary\\/30:hover{border-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:border-primary\\/30:hover{border-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)30%,transparent)}}.ww\\:hover\\:bg-accent:hover{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:hover\\:bg-foreground:hover{background-color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:bg-muted:hover{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)10%,transparent)}}.ww\\:hover\\:bg-muted\\/50:hover{background-color:var(--ww-color-muted,#f1f5f9)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-muted\\/50:hover{background-color:color-mix(in oklab,var(--ww-color-muted,#f1f5f9)50%,transparent)}}.ww\\:hover\\:bg-primary\\/90:hover{background-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)90%,transparent)}}.ww\\:hover\\:text-accent-foreground:hover{color:var(--ww-color-accent-foreground,#1f2937)}.ww\\:hover\\:text-foreground:hover{color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:text-red-300:hover{color:var(--ww-color-red-300)}.ww\\:hover\\:underline:hover{text-decoration-line:underline}}.ww\\:disabled\\:pointer-events-none:disabled{pointer-events:none}.ww\\:disabled\\:opacity-30:disabled{opacity:.3}.ww\\:disabled\\:opacity-40:disabled{opacity:.4}.ww\\:disabled\\:opacity-50:disabled{opacity:.5}.ww\\:\\[\\&\\>\\*\\:first-child\\]\\:mt-0>:first-child{margin-top:calc(var(--ww-spacing)*0)}.ww\\:\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--ww-spacing)*0)}}@keyframes ww-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes ww-fade-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes ww-pulse{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}[data-waniwani-chat] ::-webkit-scrollbar{width:8px}[data-waniwani-chat] ::-webkit-scrollbar-track{background:0 0}[data-waniwani-chat] ::-webkit-scrollbar-thumb{background:var(--ww-color-border);border-radius:9999px}[data-waniwani-chat] ::-webkit-scrollbar-thumb:hover{background:var(--ww-color-muted-foreground)}[data-waniwani-chat] *{scrollbar-width:thin;scrollbar-color:var(--ww-color-border)transparent}[data-waniwani-chat]{--ww-color-background:var(--ww-bg,#fff);--ww-color-foreground:var(--ww-text,#1f2937);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#1f2937);--ww-color-muted-foreground:var(--ww-muted,#6b7280);--ww-color-border:var(--ww-border,#e5e7eb);--ww-color-input:var(--ww-input-bg,#f9fafb);--ww-color-accent:var(--ww-assistant-bubble,#f3f4f6);--ww-color-accent-foreground:var(--ww-text,#1f2937);--ww-color-user-bubble:var(--ww-user-bubble,#f4f4f4);--ww-color-card:var(--ww-bg,#fff);--ww-color-card-foreground:var(--ww-text,#1f2937);--ww-color-card-header:var(--ww-header-bg,#fff);--ww-color-card-header-foreground:var(--ww-header-text,#1f2937);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#f4f4f5);--ww-radius:var(--ww-radius,16px);--ww-font-sans:var(--ww-font,system-ui,-apple-system,\"Segoe UI\",sans-serif)}.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-color-background:var(--ww-bg,#212121);--ww-color-foreground:var(--ww-text,#ececec);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#fff);--ww-color-muted-foreground:var(--ww-muted,#8e8ea0);--ww-color-border:var(--ww-border,#444);--ww-color-input:var(--ww-input-bg,#2f2f2f);--ww-color-accent:var(--ww-assistant-bubble,#2f2f2f);--ww-color-accent-foreground:var(--ww-text,#ececec);--ww-color-user-bubble:var(--ww-user-bubble,#303030);--ww-color-card:var(--ww-bg,#212121);--ww-color-card-foreground:var(--ww-text,#ececec);--ww-color-card-header:var(--ww-header-bg,#1e1e1e);--ww-color-card-header-foreground:var(--ww-header-text,#ececec);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#262626)}[data-waniwani-chat] [data-streamdown=table-wrapper]{flex-direction:column;gap:.5rem;margin-top:1rem;margin-bottom:1rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:first-child:has(button){justify-content:flex-end;align-items:center;gap:.25rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:last-child{overflow-x:auto}[data-waniwani-chat] [data-streamdown=table]{border-collapse:collapse;border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;overflow:hidden}[data-waniwani-chat] [data-streamdown=table-header]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-body]{background-color:color-mix(in srgb,var(--ww-color-accent)40%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]>tr+tr{border-top:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-row]{border-bottom:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-header-cell]{white-space:nowrap;text-align:left;padding:.5rem 1rem;font-size:.875rem;font-weight:600}[data-waniwani-chat] [data-streamdown=table-cell]{padding:.5rem 1rem;font-size:.875rem}[data-waniwani-chat] [data-streamdown=link]{color:var(--ww-color-primary);overflow-wrap:anywhere;cursor:pointer;font-weight:500;text-decoration:underline}[data-waniwani-chat] [data-streamdown=link-safety-modal]{z-index:50;background-color:var(--ww-color-background);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=link-safety-modal]{background-color:color-mix(in srgb,var(--ww-color-background)50%,transparent)}}[data-waniwani-chat] [data-streamdown=link-safety-modal]{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);width:100%;max-width:28rem;color:var(--ww-color-foreground);border-radius:.75rem;flex-direction:column;gap:1rem;margin:0 1rem;padding:1.5rem;display:flex;position:relative;box-shadow:0 10px 25px #0000001a}[data-waniwani-chat] [data-streamdown=link-safety-modal] button{cursor:pointer}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child{color:var(--ww-color-muted-foreground);background:0 0;border:none;border-radius:.375rem;padding:.25rem;transition:background-color .15s,color .15s;position:absolute;top:1rem;right:1rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child:hover{background-color:var(--ww-color-accent);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type{flex-direction:column;gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>div{align-items:center;gap:.5rem;font-size:1.125rem;font-weight:600;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>p{color:var(--ww-color-muted-foreground);font-size:.875rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:nth-child(3){word-break:break-all;background-color:var(--ww-color-accent);border-radius:.375rem;max-height:8rem;padding:.75rem;font-family:ui-monospace,monospace;font-size:.875rem;overflow-y:auto}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child{gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button{border:none;border-radius:.375rem;flex:1;justify-content:center;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:background-color .15s;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child:hover{background-color:var(--ww-color-accent)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child{background-color:var(--ww-color-primary);color:#fff}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child:hover{opacity:.9}[data-waniwani-chat] [data-streamdown=ordered-list]{white-space:normal;list-style-type:decimal;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=ordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=unordered-list]{white-space:normal;list-style-type:disc;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=unordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=list-item]{padding-top:.25rem;padding-bottom:.25rem}[data-waniwani-chat] [data-streamdown=list-item]>p{display:inline}[data-waniwani-chat] [data-streamdown=inline-code]{background-color:var(--ww-color-accent);border-radius:.25rem;padding:.125rem .375rem;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:.875rem}[data-waniwani-chat] [data-streamdown=heading-1]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.875rem;font-weight:600;line-height:2.25rem}[data-waniwani-chat] [data-streamdown=heading-2]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.5rem;font-weight:600;line-height:2rem}[data-waniwani-chat] [data-streamdown=heading-3]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.25rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-4]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.125rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-5]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1rem;font-weight:600;line-height:1.5rem}[data-waniwani-chat] [data-streamdown=heading-6]{margin-top:1.5rem;margin-bottom:.5rem;font-size:.875rem;font-weight:600;line-height:1.25rem}[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid var(--ww-color-muted-foreground);margin-top:1rem;margin-bottom:1rem}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid color-mix(in srgb,var(--ww-color-muted-foreground)30%,transparent)}}[data-waniwani-chat] [data-streamdown=blockquote]{color:var(--ww-color-muted-foreground);padding-left:1rem;font-style:italic}[data-waniwani-chat] [data-streamdown=horizontal-rule]{border-color:var(--ww-color-border);margin-top:1.5rem;margin-bottom:1.5rem}[data-waniwani-chat] [data-streamdown=strong]{font-weight:600}[data-waniwani-chat] [data-streamdown=image-wrapper]{margin-top:1rem;margin-bottom:1rem;display:inline-block;position:relative}[data-waniwani-chat] [data-streamdown=image]{border-radius:.5rem;max-width:100%}[data-waniwani-chat] [data-streamdown=code-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;margin-top:1rem;margin-bottom:1rem;overflow:hidden}[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:var(--ww-color-accent);justify-content:space-between;align-items:center;display:flex}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=code-block-header]{color:var(--ww-color-muted-foreground);padding:.75rem;font-size:.75rem}[data-waniwani-chat] [data-streamdown=code-block-body]{padding:1rem;font-size:.875rem;overflow-x:auto}[data-waniwani-chat] [data-streamdown=code-block-copy-button],[data-waniwani-chat] [data-streamdown=code-block-download-button]{cursor:pointer;color:var(--ww-color-muted-foreground);background:0 0;border:none;padding:.25rem;transition:color .15s}[data-waniwani-chat] [data-streamdown=code-block-copy-button]:hover,[data-waniwani-chat] [data-streamdown=code-block-download-button]:hover{color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=mermaid-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;height:auto;margin-top:1rem;margin-bottom:1rem;padding:1rem;position:relative}[data-waniwani-chat] [data-streamdown=mermaid]{width:100%;height:100%}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}",Ba=null,Or=null,oa=null;function _2(e,t){if(yx&&yx!=="__WANIWANI_EMBED_CSS__"){let a=document.createElement("style");a.textContent=yx,e.appendChild(a)}if(t.css)try{let a=new URL(t.css,window.location.href);if(a.protocol==="https:"||a.protocol==="http:"){let n=document.createElement("link");n.rel="stylesheet",n.href=a.href,e.appendChild(n)}else console.warn("[WaniWani] Custom CSS URL must use http or https protocol.")}catch{console.warn("[WaniWani] Invalid custom CSS URL:",t.css)}}var R2="data-waniwani-embed";function v6(e,t,a){let n=document.querySelector(`[${R2}]`);if(!n)throw new Error(`[WaniWani] No inline mount target. Place \`<div ${R2}></div>\` in your page for \`mode: "inline"\`.`);oa=document.createElement("div"),oa.id="waniwani-chat-embed",oa.style.width="100%",oa.style.height="100%",n.appendChild(oa);let r=oa.attachShadow({mode:"open"});_2(r,e);let o=document.createElement("div");o.style.width="100%",o.style.height="100%",r.appendChild(o);let l=au.default.createRef();return Or=xx.default.createRoot(o),Or.render(au.default.createElement(E2,{ref:l,config:e,programmatic:t,scriptConfig:a})),{destroy:()=>{Or?.unmount(),Or=null,oa?.remove(),oa=null,Ba=null},open:()=>{},close:()=>{},toggle:()=>{},sendMessage:i=>l.current?.chat?.sendMessage(i)}}function w6(e,t){let a=t.position==="bottom-left",n=t.theme?.primaryColor??"#6366f1",r=document.createElement("div");r.setAttribute("data-waniwani-skeleton","");let o=document.createElement("style");o.textContent=`
139
139
  @keyframes ww-skeleton-pulse { 0%,100% { opacity:1; } 50% { opacity:0.7; } }
140
140
  [data-waniwani-skeleton] .ww-sk-bubble {
141
141
  position:fixed; bottom:20px; ${a?"left":"right"}:20px;