@waniwani/sdk 0.14.13 → 0.14.15

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.
@@ -78,7 +78,7 @@ import{a as yo,b as Tu,c as vu}from"../chunk-R6LESDWJ.js";import{b as Mt,c as Ct
78
78
  \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function qi(e,t,a,o){let r=o.schema,n=r.space==="svg"?!1:o.settings.omitOptionalTags,s=r.space==="svg"?o.settings.closeEmptyElements:o.settings.voids.includes(e.tagName.toLowerCase()),i=[],l;r.space==="html"&&e.tagName==="svg"&&(o.schema=ya);let u=Cp(o,e.properties),c=o.all(r.space==="html"&&e.tagName==="template"?e.content:e);return o.schema=r,c&&(s=!1),(u||!n||!Hi(e,t,a))&&(i.push("<",e.tagName,u?" "+u:""),s&&(r.space==="svg"||o.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!o.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&i.push(" "),i.push("/")),i.push(">")),i.push(c),!s&&(!n||!fa(e,t,a))&&i.push("</"+e.tagName+">"),i.join("")}function Cp(e,t){let a=[],o=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){let n=Ip(e,r,t[r]);n&&a.push(n)}}for(;++o<a.length;){let n=e.settings.tightAttributes?a[o].charAt(a[o].length-1):void 0;o!==a.length-1&&n!=='"'&&n!=="'"&&(a[o]+=" ")}return a.join("")}function Ip(e,t,a){let o=Zr(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,n=e.settings.allowDangerousCharacters?0:1,s=e.quote,i;if(o.overloadedBoolean&&(a===o.attribute||a==="")?a=!0:(o.boolean||o.overloadedBoolean)&&(typeof a!="string"||a===o.attribute||a==="")&&(a=!!a),a==null||a===!1||typeof a=="number"&&Number.isNaN(a))return"";let l=Xe(o.attribute,Object.assign({},e.settings.characterReferences,{subset:Ja.name[r][n]}));return a===!0||(a=Array.isArray(a)?(o.commaSeparated?en:tn)(a,{padLeft:!e.settings.tightCommaSeparatedLists}):String(a),e.settings.collapseEmptyAttributes&&!a)?l:(e.settings.preferUnquoted&&(i=Xe(a,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ja.unquoted[r][n]}))),i!==a&&(e.settings.quoteSmart&&bo(a,s)>bo(a,e.alternative)&&(s=e.alternative),i=s+Xe(a,Object.assign({},e.settings.characterReferences,{subset:(s==="'"?Ja.single:Ja.double)[r][n],attribute:!0}))+s),l+(i&&"="+i))}f();f();var Sp=["<","&"];function Za(e,t,a,o){return a&&a.type==="element"&&(a.tagName==="script"||a.tagName==="style")?e.value:Xe(e.value,Object.assign({},o.settings.characterReferences,{subset:Sp}))}function Wi(e,t,a,o){return o.settings.allowDangerousHtml?e.value:Za(e,t,a,o)}f();function Gi(e,t,a,o){return o.all(e)}var ji=an("type",{invalid:yp,unknown:bp,handlers:{comment:Ei,doctype:_i,element:qi,raw:Wi,root:Gi,text:Za}});function yp(e){throw new Error("Expected node, not `"+e+"`")}function bp(e){let t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}var kp={},Tp={},vp=[];function lr(e,t){let a=t||kp,o=a.quote||'"',r=o==='"'?"'":'"';if(o!=='"'&&o!=="'")throw new Error("Invalid quote `"+o+"`, expected `'` or `\"`");return{one:Pp,all:Ap,settings:{omitOptionalTags:a.omitOptionalTags||!1,allowParseErrors:a.allowParseErrors||!1,allowDangerousCharacters:a.allowDangerousCharacters||!1,quoteSmart:a.quoteSmart||!1,preferUnquoted:a.preferUnquoted||!1,tightAttributes:a.tightAttributes||!1,upperDoctype:a.upperDoctype||!1,tightDoctype:a.tightDoctype||!1,bogusComments:a.bogusComments||!1,tightCommaSeparatedLists:a.tightCommaSeparatedLists||!1,tightSelfClosing:a.tightSelfClosing||!1,collapseEmptyAttributes:a.collapseEmptyAttributes||!1,allowDangerousHtml:a.allowDangerousHtml||!1,voids:a.voids||on,characterReferences:a.characterReferences||Tp,closeSelfClosing:a.closeSelfClosing||!1,closeEmptyElements:a.closeEmptyElements||!1},schema:a.space==="svg"?ya:Yr,quote:o,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Pp(e,t,a){return ji(e,t,a,this)}function Ap(e){let t=[],a=e&&e.children||vp,o=-1;for(;++o<a.length;)t[o]=this.one(a[o],o,e);return t.join("")}function Ya(e,t){let a=typeof e=="string"?{}:{...e.colorReplacements},o=typeof e=="string"?e:e.name;for(let[r,n]of Object.entries(t?.colorReplacements||{}))typeof n=="string"?a[r]=n:r===o&&Object.assign(a,n);return a}function tt(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Rp(e){return Array.isArray(e)?e:[e]}async function Ji(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function mr(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Zi(e){return e==="ansi"||mr(e)}function hr(e){return e==="none"}function Yi(e){return hr(e)}function el(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let a=Array.isArray(t)?t:t.split(/\s+/g);for(let o of a)o&&!e.properties.class.includes(o)&&e.properties.class.push(o);return e}function ro(e,t=!1){if(e.length===0)return[["",0]];let a=e.split(/(\r?\n)/g),o=0,r=[];for(let n=0;n<a.length;n+=2){let s=t?a[n]+(a[n+1]||""):a[n];r.push([s,o]),o+=a[n].length,o+=a[n+1]?.length||0}return r}function Mp(e){let t=ro(e,!0).map(([r])=>r);function a(r){if(r===e.length)return{line:t.length-1,character:t[t.length-1].length};let n=r,s=0;for(let i of t){if(n<i.length)break;n-=i.length,s++}return{line:s,character:n}}function o(r,n){let s=0;for(let i=0;i<r;i++)s+=t[i].length;return s+=n,s}return{lines:t,indexToPos:a,posToIndex:o}}function tl(e,t,a){let o=new Set;for(let n of e.matchAll(/:?lang=["']([^"']+)["']/g)){let s=n[1].toLowerCase().trim();s&&o.add(s)}for(let n of e.matchAll(/(?:```|~~~)([\w-]+)/g)){let s=n[1].toLowerCase().trim();s&&o.add(s)}for(let n of e.matchAll(/\\begin\{([\w-]+)\}/g)){let s=n[1].toLowerCase().trim();s&&o.add(s)}for(let n of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){let s=n[1].toLowerCase().trim(),i=s.includes("/")?s.split("/").pop():s;i&&o.add(i)}if(!a)return Array.from(o);let r=a.getBundledLanguages();return Array.from(o).filter(n=>n&&r[n])}var gr="light-dark()",Fp=["color","background-color"];function Dp(e,t){let a=0,o=[];for(let r of t)r>a&&o.push({...e,content:e.content.slice(a,r),offset:e.offset+a}),a=r;return a<e.content.length&&o.push({...e,content:e.content.slice(a),offset:e.offset+a}),o}function Bp(e,t){let a=Array.from(t instanceof Set?t:new Set(t)).sort((o,r)=>o-r);return a.length?e.map(o=>o.flatMap(r=>{let n=a.filter(s=>r.offset<s&&s<r.offset+r.content.length).map(s=>s-r.offset).sort((s,i)=>s-i);return n.length?Dp(r,n):r})):e}function Ep(e,t,a,o,r="css-vars"){let n={content:e.content,explanation:e.explanation,offset:e.offset},s=t.map(c=>eo(e.variants[c])),i=new Set(s.flatMap(c=>Object.keys(c))),l={},u=(c,d)=>{let p=d==="color"?"":d==="background-color"?"-bg":`-${d}`;return a+t[c]+(d==="color"?"":p)};return s.forEach((c,d)=>{for(let p of i){let m=c[p]||"inherit";if(d===0&&o&&Fp.includes(p))if(o===gr&&s.length>1){let h=t.findIndex(C=>C==="light"),I=t.findIndex(C=>C==="dark");if(h===-1||I===-1)throw new ae('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let L=s[h][p]||"inherit",S=s[I][p]||"inherit";l[p]=`light-dark(${L}, ${S})`,r==="css-vars"&&(l[u(d,p)]=m)}else l[p]=m;else r==="css-vars"&&(l[u(d,p)]=m)}}),n.htmlStyle=l,n}function eo(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&ge.Italic&&(t["font-style"]="italic"),e.fontStyle&ge.Bold&&(t["font-weight"]="bold");let a=[];e.fontStyle&ge.Underline&&a.push("underline"),e.fontStyle&ge.Strikethrough&&a.push("line-through"),a.length&&(t["text-decoration"]=a.join(" "))}return t}function cr(e){return typeof e=="string"?e:Object.entries(e).map(([t,a])=>`${t}:${a}`).join(";")}var al=new WeakMap;function no(e,t){al.set(e,t)}function ma(e){return al.get(e)}var Pt=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,a){return new e(Object.fromEntries(Rp(a).map(o=>[o,$a])),t)}constructor(...t){if(t.length===2){let[a,o]=t;this.lang=o,this._stacks=a}else{let[a,o,r]=t;this.lang=o,this._stacks={[r]:a}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return _p(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function _p(e){let t=[],a=new Set;function o(r){if(a.has(r))return;a.add(r);let n=r?.nameScopesList?.scopeName;n&&t.push(n),r.parent&&o(r.parent)}return o(e),t}function Op(e,t){if(!(e instanceof Pt))throw new ae("Invalid grammar state");return e.getInternalStack(t)}function Np(){let e=new WeakMap;function t(a){if(!e.has(a.meta)){let o=function(s){if(typeof s=="number"){if(s<0||s>a.source.length)throw new ae(`Invalid decoration offset: ${s}. Code length: ${a.source.length}`);return{...r.indexToPos(s),offset:s}}else{let i=r.lines[s.line];if(i===void 0)throw new ae(`Invalid decoration position ${JSON.stringify(s)}. Lines length: ${r.lines.length}`);let l=s.character;if(l<0&&(l=i.length+l),l<0||l>i.length)throw new ae(`Invalid decoration position ${JSON.stringify(s)}. Line ${s.line} length: ${i.length}`);return{...s,character:l,offset:r.posToIndex(s.line,l)}}},r=Mp(a.source),n=(a.options.decorations||[]).map(s=>({...s,start:o(s.start),end:o(s.end)}));Up(n),e.set(a.meta,{decorations:n,converter:r,source:a.source})}return e.get(a.meta)}return{name:"shiki:decorations",tokens(a){if(!this.options.decorations?.length)return;let r=t(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]);return Bp(a,r)},code(a){if(!this.options.decorations?.length)return;let o=t(this),r=Array.from(a.children).filter(c=>c.type==="element"&&c.tagName==="span");if(r.length!==o.converter.lines.length)throw new ae(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${o.converter.lines.length}). Failed to apply decorations.`);function n(c,d,p,m){let h=r[c],I="",L=-1,S=-1;if(d===0&&(L=0),p===0&&(S=0),p===Number.POSITIVE_INFINITY&&(S=h.children.length),L===-1||S===-1)for(let x=0;x<h.children.length;x++)I+=ol(h.children[x]),L===-1&&I.length===d&&(L=x+1),S===-1&&I.length===p&&(S=x+1);if(L===-1)throw new ae(`Failed to find start index for decoration ${JSON.stringify(m.start)}`);if(S===-1)throw new ae(`Failed to find end index for decoration ${JSON.stringify(m.end)}`);let C=h.children.slice(L,S);if(!m.alwaysWrap&&C.length===h.children.length)i(h,m,"line");else if(!m.alwaysWrap&&C.length===1&&C[0].type==="element")i(C[0],m,"token");else{let x={type:"element",tagName:"span",properties:{},children:C};i(x,m,"wrapper"),h.children.splice(L,C.length,x)}}function s(c,d){r[c]=i(r[c],d,"line")}function i(c,d,p){let m=d.properties||{},h=d.transform||(I=>I);return c.tagName=d.tagName||"span",c.properties={...c.properties,...m,class:c.properties.class},d.properties?.class&&el(c,d.properties.class),c=h(c,p)||c,c}let l=[],u=o.decorations.sort((c,d)=>d.start.offset-c.start.offset||c.end.offset-d.end.offset);for(let c of u){let{start:d,end:p}=c;if(d.line===p.line)n(d.line,d.character,p.character,c);else if(d.line<p.line){n(d.line,d.character,Number.POSITIVE_INFINITY,c);for(let m=d.line+1;m<p.line;m++)l.unshift(()=>s(m,c));n(p.line,0,p.character,c)}}l.forEach(c=>c())}}}function Up(e){for(let t=0;t<e.length;t++){let a=e[t];if(a.start.offset>a.end.offset)throw new ae(`Invalid decoration range: ${JSON.stringify(a.start)} - ${JSON.stringify(a.end)}`);for(let o=t+1;o<e.length;o++){let r=e[o],n=a.start.offset<=r.start.offset&&r.start.offset<a.end.offset,s=a.start.offset<r.end.offset&&r.end.offset<=a.end.offset,i=r.start.offset<=a.start.offset&&a.start.offset<r.end.offset,l=r.start.offset<a.end.offset&&a.end.offset<=r.end.offset;if(n||s||i||l){if(n&&s||i&&l||i&&a.start.offset===a.end.offset||s&&r.start.offset===r.end.offset)continue;throw new ae(`Decorations ${JSON.stringify(a.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function ol(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(ol).join(""):""}var Hp=[Np()];function to(e){let t=qp(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Hp]}function qp(e){let t=[],a=[],o=[];for(let r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":a.push(r);break;default:o.push(r)}return{pre:t,post:a,normal:o}}var mt=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],ur={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Wp(e,t){let a=e.indexOf("\x1B",t);if(a!==-1&&e[a+1]==="["){let o=e.indexOf("m",a);if(o!==-1)return{sequence:e.substring(a+2,o).split(";"),startPosition:a,position:o+1}}return{position:e.length}}function zi(e){let t=e.shift();if(t==="2"){let a=e.splice(0,3).map(o=>Number.parseInt(o));return a.length!==3||a.some(o=>Number.isNaN(o))?void 0:{type:"rgb",rgb:a}}else if(t==="5"){let a=e.shift();if(a)return{type:"table",index:Number(a)}}}function Gp(e){let t=[];for(;e.length>0;){let a=e.shift();if(!a)continue;let o=Number.parseInt(a);if(!Number.isNaN(o))if(o===0)t.push({type:"resetAll"});else if(o<=9)ur[o]&&t.push({type:"setDecoration",value:ur[o]});else if(o<=29){let r=ur[o-20];r&&(t.push({type:"resetDecoration",value:r}),r==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(o<=37)t.push({type:"setForegroundColor",value:{type:"named",name:mt[o-30]}});else if(o===38){let r=zi(e);r&&t.push({type:"setForegroundColor",value:r})}else if(o===39)t.push({type:"resetForegroundColor"});else if(o<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:mt[o-40]}});else if(o===48){let r=zi(e);r&&t.push({type:"setBackgroundColor",value:r})}else o===49?t.push({type:"resetBackgroundColor"}):o===53?t.push({type:"setDecoration",value:"overline"}):o===55?t.push({type:"resetDecoration",value:"overline"}):o>=90&&o<=97?t.push({type:"setForegroundColor",value:{type:"named",name:mt[o-90+8]}}):o>=100&&o<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:mt[o-100+8]}})}return t}function jp(){let e=null,t=null,a=new Set;return{parse(o){let r=[],n=0;do{let s=Wp(o,n),i=s.sequence?o.substring(n,s.startPosition):o.substring(n);if(i.length>0&&r.push({value:i,foreground:e,background:t,decorations:new Set(a)}),s.sequence){let l=Gp(s.sequence);for(let u of l)u.type==="resetAll"?(e=null,t=null,a.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&a.delete(u.value);for(let u of l)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&a.add(u.value)}n=s.position}while(n<o.length);return r}}}var zp={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Vp(e=zp){function t(i){return e[i]}function a(i){return`#${i.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let o;function r(){if(o)return o;o=[];for(let u=0;u<mt.length;u++)o.push(t(mt[u]));let i=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let c=0;c<6;c++)for(let d=0;d<6;d++)o.push(a([i[u],i[c],i[d]]));let l=8;for(let u=0;u<24;u++,l+=10)o.push(a([l,l,l]));return o}function n(i){return r()[i]}function s(i){switch(i.type){case"named":return t(i.name);case"rgb":return a(i.rgb);case"table":return n(i.index)}}return{value:s}}var $p={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Xp(e,t,a){let o=Ya(e,a),r=ro(t),n=Object.fromEntries(mt.map(l=>{let u=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,c=e.colors?.[u];return[l,c||$p[l]]})),s=Vp(n),i=jp();return r.map(l=>i.parse(l[0]).map(u=>{let c,d;u.decorations.has("reverse")?(c=u.background?s.value(u.background):e.bg,d=u.foreground?s.value(u.foreground):e.fg):(c=u.foreground?s.value(u.foreground):e.fg,d=u.background?s.value(u.background):void 0),c=tt(c,o),d=tt(d,o),u.decorations.has("dim")&&(c=Kp(c));let p=ge.None;return u.decorations.has("bold")&&(p|=ge.Bold),u.decorations.has("italic")&&(p|=ge.Italic),u.decorations.has("underline")&&(p|=ge.Underline),u.decorations.has("strikethrough")&&(p|=ge.Strikethrough),{content:u.value,offset:l[1],color:c,bgColor:d,fontStyle:p}}))}function Kp(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let o=t[1];if(o.length===8){let r=Math.round(Number.parseInt(o.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${o.slice(0,6)}${r}`}else{if(o.length===6)return`#${o}80`;if(o.length===4){let r=o[0],n=o[1],s=o[2],i=o[3],l=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${r}${r}${n}${n}${s}${s}${l}`}else if(o.length===3){let r=o[0],n=o[1],s=o[2];return`#${r}${r}${n}${n}${s}${s}80`}}}let a=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return a?`var(${a[1]}-dim)`:e}function wr(e,t,a={}){let{theme:o=e.getLoadedThemes()[0]}=a,r=e.resolveLangAlias(a.lang||"text");if(mr(r)||hr(o))return ro(t).map(l=>[{content:l[0],offset:l[1]}]);let{theme:n,colorMap:s}=e.setTheme(o);if(r==="ansi")return Xp(n,t,a);let i=e.getLanguage(a.lang||"text");if(a.grammarState){if(a.grammarState.lang!==i.name)throw new ae(`Grammar state language "${a.grammarState.lang}" does not match highlight language "${i.name}"`);if(!a.grammarState.themes.includes(n.name))throw new ae(`Grammar state themes "${a.grammarState.themes}" do not contain highlight theme "${n.name}"`)}return Jp(t,i,n,s,a)}function Qp(...e){if(e.length===2)return ma(e[1]);let[t,a,o={}]=e,{lang:r="text",theme:n=t.getLoadedThemes()[0]}=o;if(mr(r)||hr(n))throw new ae("Plain language does not have grammar state");if(r==="ansi")throw new ae("ANSI language does not have grammar state");let{theme:s,colorMap:i}=t.setTheme(n),l=t.getLanguage(r);return new Pt(xr(a,l,s,i,o).stateStack,l.name,s.name)}function Jp(e,t,a,o,r){let n=xr(e,t,a,o,r),s=new Pt(n.stateStack,t.name,a.name);return no(n.tokens,s),n.tokens}function xr(e,t,a,o,r){let n=Ya(a,r),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:i=500}=r,l=ro(e),u=r.grammarState?Op(r.grammarState,a.name)??$a:r.grammarContextCode!=null?xr(r.grammarContextCode,t,a,o,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:$a,c=[],d=[];for(let p=0,m=l.length;p<m;p++){let[h,I]=l[p];if(h===""){c=[],d.push([]);continue}if(s>0&&h.length>=s){c=[],d.push([{content:h,offset:I,color:"",fontStyle:0}]);continue}let L,S,C;r.includeExplanation&&(L=t.tokenizeLine(h,u,i),S=L.tokens,C=0);let x=t.tokenizeLine2(h,u,i),y=x.tokens.length/2;for(let P=0;P<y;P++){let A=x.tokens[2*P],M=P+1<y?x.tokens[2*P+2]:h.length;if(A===M)continue;let R=x.tokens[2*P+1],_=tt(o[pt.getForeground(R)],n),D=pt.getFontStyle(R),O={content:h.substring(A,M),offset:I+A,color:_,fontStyle:D};if(r.includeExplanation){let k=[];if(r.includeExplanation!=="scopeName")for(let T of a.settings){let v;switch(typeof T.scope){case"string":v=T.scope.split(/,/).map(q=>q.trim());break;case"object":v=T.scope;break;default:continue}k.push({settings:T,selectors:v.map(q=>q.split(/ /))})}O.explanation=[];let B=0;for(;A+B<M;){let T=S[C],v=h.substring(T.startIndex,T.endIndex);B+=v.length,O.explanation.push({content:v,scopes:r.includeExplanation==="scopeName"?Zp(T.scopes):Yp(k,T.scopes)}),C+=1}}c.push(O)}d.push(c),c=[],u=x.ruleStack}return{tokens:d,stateStack:u}}function Zp(e){return e.map(t=>({scopeName:t}))}function Yp(e,t){let a=[];for(let o=0,r=t.length;o<r;o++){let n=t[o];a[o]={scopeName:n,themeMatches:tm(e,n,t.slice(0,o))}}return a}function Vi(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function em(e,t,a){if(!Vi(e[e.length-1],t))return!1;let o=e.length-2,r=a.length-1;for(;o>=0&&r>=0;)Vi(e[o],a[r])&&(o-=1),r-=1;return o===-1}function tm(e,t,a){let o=[];for(let{selectors:r,settings:n}of e)for(let s of r)if(em(s,t,a)){o.push(n);break}return o}function rl(e,t,a){let o=Object.entries(a.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),r=o.map(l=>{let u=wr(e,t,{...a,theme:l.theme}),c=ma(u),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:u,state:c,theme:d}}),n=am(...r.map(l=>l.tokens)),s=n[0].map((l,u)=>l.map((c,d)=>{let p={content:c.content,variants:{},offset:c.offset};return"includeExplanation"in a&&a.includeExplanation&&(p.explanation=c.explanation),n.forEach((m,h)=>{let{content:I,explanation:L,offset:S,...C}=m[u][d];p.variants[o[h].color]=C}),p})),i=r[0].state?new Pt(Object.fromEntries(r.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),r[0].state.lang):void 0;return i&&no(s,i),s}function am(...e){let t=e.map(()=>[]),a=e.length;for(let o=0;o<e[0].length;o++){let r=e.map(l=>l[o]),n=t.map(()=>[]);t.forEach((l,u)=>l.push(n[u]));let s=r.map(()=>0),i=r.map(l=>l[0]);for(;i.every(l=>l);){let l=Math.min(...i.map(u=>u.content.length));for(let u=0;u<a;u++){let c=i[u];c.content.length===l?(n[u].push(c),s[u]+=1,i[u]=r[u][s[u]]):(n[u].push({...c,content:c.content.slice(0,l)}),i[u]={...c,content:c.content.slice(l),offset:c.offset+l})}}}return t}function ao(e,t,a){let o,r,n,s,i,l;if("themes"in a){let{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:d="css-vars"}=a,p=Object.entries(a.themes).filter(S=>S[1]).map(S=>({color:S[0],theme:S[1]})).sort((S,C)=>S.color===u?-1:C.color===u?1:0);if(p.length===0)throw new ae("`themes` option must not be empty");let m=rl(e,t,a);if(l=ma(m),u&&gr!==u&&!p.find(S=>S.color===u))throw new ae(`\`themes\` option must contain the defaultColor key \`${u}\``);let h=p.map(S=>e.getTheme(S.theme)),I=p.map(S=>S.color);n=m.map(S=>S.map(C=>Ep(C,I,c,u,d))),l&&no(n,l);let L=p.map(S=>Ya(S.theme,a));r=$i(p,h,L,c,u,"fg",d),o=$i(p,h,L,c,u,"bg",d),s=`shiki-themes ${h.map(S=>S.name).join(" ")}`,i=u?void 0:[r,o].join(";")}else if("theme"in a){let u=Ya(a.theme,a);n=wr(e,t,a);let c=e.getTheme(a.theme);o=tt(c.bg,u),r=tt(c.fg,u),s=c.name,l=ma(n)}else throw new ae("Invalid options, either `theme` or `themes` must be provided");return{tokens:n,fg:r,bg:o,themeName:s,rootStyle:i,grammarState:l}}function $i(e,t,a,o,r,n,s){return e.map((i,l)=>{let u=tt(t[l][n],a[l])||"inherit",c=`${o+i.color}${n==="bg"?"-bg":""}:${u}`;if(l===0&&r){if(r===gr&&e.length>1){let d=e.findIndex(I=>I.color==="light"),p=e.findIndex(I=>I.color==="dark");if(d===-1||p===-1)throw new ae('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let m=tt(t[d][n],a[d])||"inherit",h=tt(t[p][n],a[p])||"inherit";return`light-dark(${m}, ${h});${c}`}return u}return s==="css-vars"?c:null}).filter(i=>!!i).join(";")}function oo(e,t,a,o={meta:{},options:a,codeToHast:(r,n)=>oo(e,r,n),codeToTokens:(r,n)=>ao(e,r,n)}){let r=t;for(let h of to(a))r=h.preprocess?.call(o,r,a)||r;let{tokens:n,fg:s,bg:i,themeName:l,rootStyle:u,grammarState:c}=ao(e,r,a),{mergeWhitespaces:d=!0,mergeSameStyleTokens:p=!1}=a;d===!0?n=rm(n):d==="never"&&(n=nm(n)),p&&(n=sm(n));let m={...o,get source(){return r}};for(let h of to(a))n=h.tokens?.call(m,n)||n;return om(n,{...a,fg:s,bg:i,themeName:l,rootStyle:a.rootStyle===!1?!1:a.rootStyle??u},m,c)}function om(e,t,a,o=ma(e)){let r=to(t),n=[],s={type:"root",children:[]},{structure:i="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),l!==!1&&l!=null&&(u.tabindex=l.toString());for(let[I,L]of Object.entries(t.meta||{}))I.startsWith("_")||(u[I]=L);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},d={type:"element",tagName:"code",properties:{},children:n},p=[],m={...a,structure:i,addClassToHast:el,get source(){return a.source},get tokens(){return e},get options(){return t},get root(){return s},get pre(){return c},get code(){return d},get lines(){return p}};if(e.forEach((I,L)=>{L&&(i==="inline"?s.children.push({type:"element",tagName:"br",properties:{},children:[]}):i==="classic"&&n.push({type:"text",value:`
79
79
  `}));let S={type:"element",tagName:"span",properties:{class:"line"},children:[]},C=0;for(let x of I){let y={type:"element",tagName:"span",properties:{...x.htmlAttrs},children:[{type:"text",value:x.content}]},P=cr(x.htmlStyle||eo(x));P&&(y.properties.style=P);for(let A of r)y=A?.span?.call(m,y,L+1,C,S,x)||y;i==="inline"?s.children.push(y):i==="classic"&&S.children.push(y),C+=x.content.length}if(i==="classic"){for(let x of r)S=x?.line?.call(m,S,L+1)||S;p.push(S),n.push(S)}else i==="inline"&&p.push(S)}),i==="classic"){for(let I of r)d=I?.code?.call(m,d)||d;c.children.push(d);for(let I of r)c=I?.pre?.call(m,c)||c;s.children.push(c)}else if(i==="inline"){let I=[],L={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let x of s.children)x.type==="element"&&x.tagName==="br"?(I.push(L),L={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(x.type==="element"||x.type==="text")&&L.children.push(x);I.push(L);let C={type:"element",tagName:"code",properties:{},children:I};for(let x of r)C=x?.code?.call(m,C)||C;s.children=[];for(let x=0;x<C.children.length;x++){x>0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]});let y=C.children[x];y.type==="element"&&s.children.push(...y.children)}}let h=s;for(let I of r)h=I?.root?.call(m,h)||h;return o&&no(h,o),h}function rm(e){return e.map(t=>{let a=[],o="",r;return t.forEach((n,s)=>{let l=!(n.fontStyle&&(n.fontStyle&ge.Underline||n.fontStyle&ge.Strikethrough));l&&n.content.match(/^\s+$/)&&t[s+1]?(r===void 0&&(r=n.offset),o+=n.content):o?(l?a.push({...n,offset:r,content:o+n.content}):a.push({content:o,offset:r},n),r=void 0,o=""):a.push(n)}),a})}function nm(e){return e.map(t=>t.flatMap(a=>{if(a.content.match(/^\s+$/))return a;let o=a.content.match(/^(\s*)(.*?)(\s*)$/);if(!o)return a;let[,r,n,s]=o;if(!r&&!s)return a;let i=[{...a,offset:a.offset+r.length,content:n}];return r&&i.unshift({content:r,offset:a.offset}),s&&i.push({content:s,offset:a.offset+r.length+n.length}),i}))}function sm(e){return e.map(t=>{let a=[];for(let o of t){if(a.length===0){a.push({...o});continue}let r=a[a.length-1],n=cr(r.htmlStyle||eo(r)),s=cr(o.htmlStyle||eo(o)),i=r.fontStyle&&(r.fontStyle&ge.Underline||r.fontStyle&ge.Strikethrough),l=o.fontStyle&&(o.fontStyle&ge.Underline||o.fontStyle&ge.Strikethrough);!i&&!l&&n===s?r.content+=o.content:a.push({...o})}return a})}var im=lr;function lm(e,t,a){let o={meta:{},options:a,codeToHast:(n,s)=>oo(e,n,s),codeToTokens:(n,s)=>ao(e,n,s)},r=im(oo(e,t,a,o));for(let n of to(a))r=n.postprocess?.call(o,r,a)||r;return r}var Xi={light:"#333333",dark:"#bbbbbb"},Ki={light:"#fffffe",dark:"#1e1e1e"},Qi="__shiki_resolved";function Lr(e){if(e?.[Qi])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:a,fg:o}=t;if(!a||!o){let i=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;i?.settings?.foreground&&(o=i.settings.foreground),i?.settings?.background&&(a=i.settings.background),!o&&t?.colors?.["editor.foreground"]&&(o=t.colors["editor.foreground"]),!a&&t?.colors?.["editor.background"]&&(a=t.colors["editor.background"]),o||(o=t.type==="light"?Xi.light:Xi.dark),a||(a=t.type==="light"?Ki.light:Ki.dark),t.fg=o,t.bg=a}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0,n=new Map;function s(i){if(n.has(i))return n.get(i);r+=1;let l=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?s(i):(n.set(i,l),l)}t.settings=t.settings.map(i=>{let l=i.settings?.foreground&&!i.settings.foreground.startsWith("#"),u=i.settings?.background&&!i.settings.background.startsWith("#");if(!l&&!u)return i;let c={...i,settings:{...i.settings}};if(l){let d=s(i.settings.foreground);t.colorReplacements[d]=i.settings.foreground,c.settings.foreground=d}if(u){let d=s(i.settings.background);t.colorReplacements[d]=i.settings.background,c.settings.background=d}return c});for(let i of Object.keys(t.colors||{}))if((i==="editor.foreground"||i==="editor.background"||i.startsWith("terminal.ansi"))&&!t.colors[i]?.startsWith("#")){let l=s(t.colors[i]);t.colorReplacements[l]=t.colors[i],t.colors[i]=l}return Object.defineProperty(t,Qi,{enumerable:!1,writable:!1,value:!0}),t}async function nl(e){return Array.from(new Set((await Promise.all(e.filter(t=>!Zi(t)).map(async t=>await Ji(t).then(a=>Array.isArray(a)?a:[a])))).flat()))}async function sl(e){return(await Promise.all(e.map(async a=>Yi(a)?null:Lr(await Ji(a))))).filter(a=>!!a)}var dr=3,um=!1;function dm(e,t=3){if(dr&&!(typeof dr=="number"&&t>dr)){if(um)throw new Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var et=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function il(e,t){if(!t)return e;if(t[e]){let a=new Set([e]);for(;t[e];){if(e=t[e],a.has(e))throw new et(`Circular alias \`${Array.from(a).join(" -> ")} -> ${e}\``);a.add(e)}}return e}var fr=class extends ki{constructor(t,a,o,r={}){super(t),this._resolver=t,this._themes=a,this._langs=o,this._alias=r,this._themes.map(n=>this.loadTheme(n)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){let a=Lr(t);return a.name&&(this._resolvedThemes.set(a.name,a),this._loadedThemesCache=null),a}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let a=this._textmateThemeCache.get(t);a||(a=ia.createFromRawTheme(t),this._textmateThemeCache.set(t,a)),this._syncRegistry.setTheme(a)}getGrammar(t){return t=il(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;let a=new Set([...this._langMap.values()].filter(n=>n.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);let o={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);let r=this.loadGrammarWithConfiguration(t.scopeName,1,o);if(r.name=t.name,this._resolvedGrammars.set(t.name,r),t.aliases&&t.aliases.forEach(n=>{this._alias[n]=t.name}),this._loadedLanguagesCache=null,a.size)for(let n of a)this._resolvedGrammars.delete(n.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(n.scopeName),this._syncRegistry?._grammars?.delete(n.scopeName),this.loadLanguage(this._langMap.get(n.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(let r of t)this.resolveEmbeddedLanguages(r);let a=Array.from(this._langGraph.entries()),o=a.filter(([r,n])=>!n);if(o.length){let r=a.filter(([n,s])=>s?(s.embeddedLanguages||s.embeddedLangs)?.some(l=>o.map(([u])=>u).includes(l)):!1).filter(n=>!o.includes(n));throw new et(`Missing languages ${o.map(([n])=>`\`${n}\``).join(", ")}, required by ${r.map(([n])=>`\`${n}\``).join(", ")}`)}for(let[r,n]of a)this._resolver.addLanguage(n);for(let[r,n]of a)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);let a=t.embeddedLanguages??t.embeddedLangs;if(a)for(let o of a)this._langGraph.set(o,this._langMap.get(o))}},pr=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,a){this._onigLib={createOnigScanner:o=>t.createScanner(o),createOnigString:o=>t.createString(o)},a.forEach(o=>this.addLanguage(o))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(a=>{this._langs.set(a,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(a=>{this._injections.get(a)||this._injections.set(a,[]),this._injections.get(a).push(t.scopeName)})}getInjections(t){let a=t.split("."),o=[];for(let r=1;r<=a.length;r++){let n=a.slice(0,r).join(".");o=[...o,...this._injections.get(n)||[]]}return o}},pa=0;function cm(e){pa+=1,e.warnings!==!1&&pa>=10&&pa%10===0&&console.warn(`[Shiki] ${pa} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new et("`engine` option is required for synchronous mode");let a=(e.langs||[]).flat(1),o=(e.themes||[]).flat(1).map(Lr),r=new pr(e.engine,a),n=new fr(r,o,a,e.langAlias),s;function i(x){return il(x,e.langAlias)}function l(x){S();let y=n.getGrammar(typeof x=="string"?x:x.name);if(!y)throw new et(`Language \`${x}\` not found, you may need to load it first`);return y}function u(x){if(x==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};S();let y=n.getTheme(x);if(!y)throw new et(`Theme \`${x}\` not found, you may need to load it first`);return y}function c(x){S();let y=u(x);s!==x&&(n.setTheme(y),s=x);let P=n.getColorMap();return{theme:y,colorMap:P}}function d(){return S(),n.getLoadedThemes()}function p(){return S(),n.getLoadedLanguages()}function m(...x){S(),n.loadLanguages(x.flat(1))}async function h(...x){return m(await nl(x))}function I(...x){S();for(let y of x.flat(1))n.loadTheme(y)}async function L(...x){return S(),I(await sl(x))}function S(){if(t)throw new et("Shiki instance has been disposed")}function C(){t||(t=!0,n.dispose(),pa-=1)}return{setTheme:c,getTheme:u,getLanguage:l,getLoadedThemes:d,getLoadedLanguages:p,resolveLangAlias:i,loadLanguage:h,loadLanguageSync:m,loadTheme:L,loadThemeSync:I,dispose:C,[Symbol.dispose]:C}}async function fm(e){e.engine||dm("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,a,o]=await Promise.all([sl(e.themes||[]),nl(e.langs||[]),e.engine]);return cm({...e,themes:t,langs:a,engine:o})}async function pm(e){let t=await fm(e);return{getLastGrammarState:(...a)=>Qp(t,...a),codeToTokensBase:(a,o)=>wr(t,a,o),codeToTokensWithThemes:(a,o)=>rl(t,a,o),codeToTokens:(a,o)=>ao(t,a,o),codeToHast:(a,o)=>oo(t,a,o),codeToHtml:(a,o)=>lm(t,a,o),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function ll(e){let t=e.langs,a=e.themes,o=e.engine;async function r(n){function s(d){if(typeof d=="string"){if(d=n.langAlias?.[d]||d,Zi(d))return[];let p=t[d];if(!p)throw new ae(`Language \`${d}\` is not included in this bundle. You may want to load it from external source.`);return p}return d}function i(d){if(Yi(d))return"none";if(typeof d=="string"){let p=a[d];if(!p)throw new ae(`Theme \`${d}\` is not included in this bundle. You may want to load it from external source.`);return p}return d}let l=(n.themes??[]).map(d=>i(d)),u=(n.langs??[]).map(d=>s(d)),c=await pm({engine:n.engine??o(),...n,themes:l,langs:u});return{...c,loadLanguage(...d){return c.loadLanguage(...d.map(s))},loadTheme(...d){return c.loadTheme(...d.map(i))},getBundledLanguages(){return t},getBundledThemes(){return a}}}return r}function mm(e){let t;async function a(o={}){if(t){let r=await t;return await Promise.all([r.loadTheme(...o.themes||[]),r.loadLanguage(...o.langs||[])]),r}else{t=e({...o,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...o.themes||[]),r.loadLanguage(...o.langs||[])]),r}}return a}function ul(e,t){let a=mm(e);async function o(r,n){let s=await a({langs:[n.lang],themes:"theme"in n?[n.theme]:Object.values(n.themes)}),i=await t?.guessEmbeddedLanguages?.(r,n.lang,s);return i&&await s.loadLanguage(...i),s}return{getSingletonHighlighter(r){return a(r)},async codeToHtml(r,n){return(await o(r,n)).codeToHtml(r,n)},async codeToHast(r,n){return(await o(r,n)).codeToHast(r,n)},async codeToTokens(r,n){return(await o(r,n)).codeToTokens(r,n)},async codeToTokensBase(r,n){return(await o(r,n)).codeToTokensBase(r,n)},async codeToTokensWithThemes(r,n){return(await o(r,n)).codeToTokensWithThemes(r,n)},async getLastGrammarState(r,n){return(await a({langs:[n.lang],themes:[n.theme]})).getLastGrammarState(r,n)}}}f();var Cr=[{id:"abap",name:"ABAP",import:(()=>import("../abap-3IAGZ3PS.js"))},{id:"actionscript-3",name:"ActionScript",import:(()=>import("../actionscript-3-C46RIPM4.js"))},{id:"ada",name:"Ada",import:(()=>import("../ada-DNTYS66P.js"))},{id:"angular-html",name:"Angular HTML",import:(()=>import("../angular-html-GK625GFM.js"))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>import("../angular-ts-BBPQXDS2.js"))},{id:"apache",name:"Apache Conf",import:(()=>import("../apache-DU26FTNI.js"))},{id:"apex",name:"Apex",import:(()=>import("../apex-OU63AG2P.js"))},{id:"apl",name:"APL",import:(()=>import("../apl-JGB4KP74.js"))},{id:"applescript",name:"AppleScript",import:(()=>import("../applescript-TT4XSRXH.js"))},{id:"ara",name:"Ara",import:(()=>import("../ara-Q7AJDKA4.js"))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>import("../asciidoc-WADBFJPS.js"))},{id:"asm",name:"Assembly",import:(()=>import("../asm-D3LJR7GV.js"))},{id:"astro",name:"Astro",import:(()=>import("../astro-K7JGTCPV.js"))},{id:"awk",name:"AWK",import:(()=>import("../awk-DCAM52A7.js"))},{id:"ballerina",name:"Ballerina",import:(()=>import("../ballerina-44XARFEK.js"))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>import("../bat-WM4RL2AB.js"))},{id:"beancount",name:"Beancount",import:(()=>import("../beancount-5PUWGPVT.js"))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>import("../berry-YAK4XTWX.js"))},{id:"bibtex",name:"BibTeX",import:(()=>import("../bibtex-2ISWNMJJ.js"))},{id:"bicep",name:"Bicep",import:(()=>import("../bicep-EOACOM4G.js"))},{id:"blade",name:"Blade",import:(()=>import("../blade-RWJJQSLU.js"))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>import("../bsl-TNLQPNE3.js"))},{id:"c",name:"C",import:(()=>import("../c-G7V525MX.js"))},{id:"c3",name:"C3",import:(()=>import("../c3-CDQIRWGP.js"))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>import("../cadence-U32GKKTR.js"))},{id:"cairo",name:"Cairo",import:(()=>import("../cairo-26RR6N4F.js"))},{id:"clarity",name:"Clarity",import:(()=>import("../clarity-4JIHRN2V.js"))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>import("../clojure-PKTTXYYS.js"))},{id:"cmake",name:"CMake",import:(()=>import("../cmake-HXKHWGGH.js"))},{id:"cobol",name:"COBOL",import:(()=>import("../cobol-ZFZ6ZP6X.js"))},{id:"codeowners",name:"CODEOWNERS",import:(()=>import("../codeowners-WCXRHQ2R.js"))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>import("../codeql-XZZ2USHF.js"))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>import("../coffee-SGQWHBUL.js"))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>import("../common-lisp-IK3DGBCK.js"))},{id:"coq",name:"Coq",import:(()=>import("../coq-UPTUVPLH.js"))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>import("../cpp-HLYUQ6RF.js"))},{id:"crystal",name:"Crystal",import:(()=>import("../crystal-UPNOBGN4.js"))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>import("../csharp-6EXQ7B24.js"))},{id:"css",name:"CSS",import:(()=>import("../css-MH4LSMNV.js"))},{id:"csv",name:"CSV",import:(()=>import("../csv-CRTD5FOL.js"))},{id:"cue",name:"CUE",import:(()=>import("../cue-IFMTDLM2.js"))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>import("../cypher-WH7754G7.js"))},{id:"d",name:"D",import:(()=>import("../d-VFMGCSG3.js"))},{id:"dart",name:"Dart",import:(()=>import("../dart-CSERBUPM.js"))},{id:"dax",name:"DAX",import:(()=>import("../dax-Y4DTPR3K.js"))},{id:"desktop",name:"Desktop",import:(()=>import("../desktop-UYAYGPQT.js"))},{id:"diff",name:"Diff",import:(()=>import("../diff-BJDM3N45.js"))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>import("../docker-UOM4Q7PD.js"))},{id:"dotenv",name:"dotEnv",import:(()=>import("../dotenv-LK44WBD3.js"))},{id:"dream-maker",name:"Dream Maker",import:(()=>import("../dream-maker-7RP4JRQH.js"))},{id:"edge",name:"Edge",import:(()=>import("../edge-XE5XFLFP.js"))},{id:"elixir",name:"Elixir",import:(()=>import("../elixir-EXRA4QJX.js"))},{id:"elm",name:"Elm",import:(()=>import("../elm-THYL2NRS.js"))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>import("../emacs-lisp-YHLQYGNI.js"))},{id:"erb",name:"ERB",import:(()=>import("../erb-LRUOJBTB.js"))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>import("../erlang-UNX5MMGA.js"))},{id:"fennel",name:"Fennel",import:(()=>import("../fennel-HYSSBG3N.js"))},{id:"fish",name:"Fish",import:(()=>import("../fish-PTKGQOJI.js"))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>import("../fluent-LEZHPPJV.js"))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>import("../fortran-fixed-form-J5AMEFMB.js"))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>import("../fortran-free-form-S3BNTBLS.js"))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>import("../fsharp-H4OIW62Z.js"))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>import("../gdresource-A6NTYFLM.js"))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>import("../gdscript-YQUSJRNZ.js"))},{id:"gdshader",name:"GDShader",import:(()=>import("../gdshader-S5432GFE.js"))},{id:"genie",name:"Genie",import:(()=>import("../genie-RNVG5N7L.js"))},{id:"gherkin",name:"Gherkin",import:(()=>import("../gherkin-E5R62T6O.js"))},{id:"git-commit",name:"Git Commit Message",import:(()=>import("../git-commit-QGH6XOBG.js"))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>import("../git-rebase-XTCZTXU4.js"))},{id:"gleam",name:"Gleam",import:(()=>import("../gleam-W5WZ7CST.js"))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>import("../glimmer-js-JA25I4AE.js"))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>import("../glimmer-ts-CKELYRRF.js"))},{id:"glsl",name:"GLSL",import:(()=>import("../glsl-PVW2OPUD.js"))},{id:"gn",name:"GN",import:(()=>import("../gn-FCAO7WI5.js"))},{id:"gnuplot",name:"Gnuplot",import:(()=>import("../gnuplot-Q6SE5CHZ.js"))},{id:"go",name:"Go",import:(()=>import("../go-CPCZAAWX.js"))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>import("../graphql-UN5O7U5U.js"))},{id:"groovy",name:"Groovy",import:(()=>import("../groovy-PJAEBBJY.js"))},{id:"hack",name:"Hack",import:(()=>import("../hack-QIUJFE3G.js"))},{id:"haml",name:"Ruby Haml",import:(()=>import("../haml-JQIESO7E.js"))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>import("../handlebars-UBV5AWUH.js"))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>import("../haskell-NX6XRMNO.js"))},{id:"haxe",name:"Haxe",import:(()=>import("../haxe-7YNB7FVC.js"))},{id:"hcl",name:"HashiCorp HCL",import:(()=>import("../hcl-ZF75ASCX.js"))},{id:"hjson",name:"Hjson",import:(()=>import("../hjson-65TX6QOC.js"))},{id:"hlsl",name:"HLSL",import:(()=>import("../hlsl-U2O526MI.js"))},{id:"html",name:"HTML",import:(()=>import("../html-AWDHWPK7.js"))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>import("../html-derivative-QY3ZIV7G.js"))},{id:"http",name:"HTTP",import:(()=>import("../http-KIGXJYY6.js"))},{id:"hurl",name:"Hurl",import:(()=>import("../hurl-BZB5LDD5.js"))},{id:"hxml",name:"HXML",import:(()=>import("../hxml-IGTXIURH.js"))},{id:"hy",name:"Hy",import:(()=>import("../hy-CLDGXJYP.js"))},{id:"imba",name:"Imba",import:(()=>import("../imba-NWHLCVE5.js"))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>import("../ini-R6WYP7NC.js"))},{id:"java",name:"Java",import:(()=>import("../java-DHBXDMBM.js"))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>import("../javascript-GNUEDNHO.js"))},{id:"jinja",name:"Jinja",import:(()=>import("../jinja-AEVQQKWS.js"))},{id:"jison",name:"Jison",import:(()=>import("../jison-64A6IJCV.js"))},{id:"json",name:"JSON",import:(()=>import("../json-2ELCHKXT.js"))},{id:"json5",name:"JSON5",import:(()=>import("../json5-QRH5UJYD.js"))},{id:"jsonc",name:"JSON with Comments",import:(()=>import("../jsonc-IXPVR4NY.js"))},{id:"jsonl",name:"JSON Lines",import:(()=>import("../jsonl-C57GMUK5.js"))},{id:"jsonnet",name:"Jsonnet",import:(()=>import("../jsonnet-VNADFLKI.js"))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>import("../jssm-CW4ZYDSF.js"))},{id:"jsx",name:"JSX",import:(()=>import("../jsx-YTENXENT.js"))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>import("../julia-75QR2XDN.js"))},{id:"kdl",name:"KDL",import:(()=>import("../kdl-X3AS2HRT.js"))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>import("../kotlin-WGITM75W.js"))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>import("../kusto-LT46F7AO.js"))},{id:"latex",name:"LaTeX",import:(()=>import("../latex-R4PJ7JDY.js"))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>import("../lean-DYWOENAS.js"))},{id:"less",name:"Less",import:(()=>import("../less-ZYJT7MPU.js"))},{id:"liquid",name:"Liquid",import:(()=>import("../liquid-S4LVU77Y.js"))},{id:"llvm",name:"LLVM IR",import:(()=>import("../llvm-WBQ7MHV7.js"))},{id:"log",name:"Log file",import:(()=>import("../log-AXKDFD3L.js"))},{id:"logo",name:"Logo",import:(()=>import("../logo-E23LAFZY.js"))},{id:"lua",name:"Lua",import:(()=>import("../lua-QQ5QEPPO.js"))},{id:"luau",name:"Luau",import:(()=>import("../luau-D432BEB5.js"))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>import("../make-QFMWQJMG.js"))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>import("../markdown-D756RUOP.js"))},{id:"marko",name:"Marko",import:(()=>import("../marko-WVASNOGB.js"))},{id:"matlab",name:"MATLAB",import:(()=>import("../matlab-ZKZ7YBAH.js"))},{id:"mdc",name:"MDC",import:(()=>import("../mdc-NDTDGSIG.js"))},{id:"mdx",name:"MDX",import:(()=>import("../mdx-34BL2O4O.js"))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>import("../mermaid-54Z3SAII.js"))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>import("../mipsasm-NKQWJEL7.js"))},{id:"mojo",name:"Mojo",import:(()=>import("../mojo-KRRNBH7O.js"))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>import("../moonbit-LQ7JL5LZ.js"))},{id:"move",name:"Move",import:(()=>import("../move-4VWCI4YQ.js"))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>import("../narrat-4QSDQDLH.js"))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>import("../nextflow-DPCEWQNZ.js"))},{id:"nginx",name:"Nginx",import:(()=>import("../nginx-DXHAXQRH.js"))},{id:"nim",name:"Nim",import:(()=>import("../nim-Z6EEJ7SX.js"))},{id:"nix",name:"Nix",import:(()=>import("../nix-WAYR4BYU.js"))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>import("../nushell-26KZW4VL.js"))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>import("../objective-c-246HWLKT.js"))},{id:"objective-cpp",name:"Objective-C++",import:(()=>import("../objective-cpp-RJUXXPYQ.js"))},{id:"ocaml",name:"OCaml",import:(()=>import("../ocaml-P7NGS7PR.js"))},{id:"odin",name:"Odin",import:(()=>import("../odin-UPPZCJGN.js"))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>import("../openscad-JRK6K3FL.js"))},{id:"pascal",name:"Pascal",import:(()=>import("../pascal-RDFLUHHA.js"))},{id:"perl",name:"Perl",import:(()=>import("../perl-5IQEFQG3.js"))},{id:"php",name:"PHP",import:(()=>import("../php-UQGWKJAF.js"))},{id:"pkl",name:"Pkl",import:(()=>import("../pkl-PAM76VXP.js"))},{id:"plsql",name:"PL/SQL",import:(()=>import("../plsql-3Y6UMFEG.js"))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>import("../po-GNTAKCTE.js"))},{id:"polar",name:"Polar",import:(()=>import("../polar-EVTMRLGV.js"))},{id:"postcss",name:"PostCSS",import:(()=>import("../postcss-42343LW7.js"))},{id:"powerquery",name:"PowerQuery",import:(()=>import("../powerquery-M34PNR4X.js"))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>import("../powershell-IR7ICFQW.js"))},{id:"prisma",name:"Prisma",import:(()=>import("../prisma-RXSIFLZX.js"))},{id:"prolog",name:"Prolog",import:(()=>import("../prolog-YBBQ4UD5.js"))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>import("../proto-U4FF45G6.js"))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>import("../pug-XHTBJJNO.js"))},{id:"puppet",name:"Puppet",import:(()=>import("../puppet-HWOKIYJP.js"))},{id:"purescript",name:"PureScript",import:(()=>import("../purescript-D45AJS5J.js"))},{id:"python",name:"Python",aliases:["py"],import:(()=>import("../python-QWA7UE2I.js"))},{id:"qml",name:"QML",import:(()=>import("../qml-RHCWFR3S.js"))},{id:"qmldir",name:"QML Directory",import:(()=>import("../qmldir-FBDC3XMZ.js"))},{id:"qss",name:"Qt Style Sheets",import:(()=>import("../qss-AD3WZQ45.js"))},{id:"r",name:"R",import:(()=>import("../r-NHIAHDOD.js"))},{id:"racket",name:"Racket",import:(()=>import("../racket-7G65C5N5.js"))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>import("../raku-IWS7BLGD.js"))},{id:"razor",name:"ASP.NET Razor",import:(()=>import("../razor-UMC4HKIF.js"))},{id:"reg",name:"Windows Registry Script",import:(()=>import("../reg-V4XLWESR.js"))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>import("../regexp-XP4MR635.js"))},{id:"rel",name:"Rel",import:(()=>import("../rel-DE6UXATM.js"))},{id:"riscv",name:"RISC-V",import:(()=>import("../riscv-5PDXBPPL.js"))},{id:"ron",name:"RON",import:(()=>import("../ron-WD6BJFDY.js"))},{id:"rosmsg",name:"ROS Interface",import:(()=>import("../rosmsg-7LDUCZRQ.js"))},{id:"rst",name:"reStructuredText",import:(()=>import("../rst-HCGHBPBZ.js"))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>import("../ruby-ML25RVXY.js"))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>import("../rust-Z2NYMT2Z.js"))},{id:"sas",name:"SAS",import:(()=>import("../sas-A4JCTK6H.js"))},{id:"sass",name:"Sass",import:(()=>import("../sass-75VDP7DE.js"))},{id:"scala",name:"Scala",import:(()=>import("../scala-7TJ4N6KC.js"))},{id:"scheme",name:"Scheme",import:(()=>import("../scheme-5XARZMKT.js"))},{id:"scss",name:"SCSS",import:(()=>import("../scss-4QR2BXFS.js"))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>import("../sdbl-6M55AJVA.js"))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>import("../shaderlab-322XNY5V.js"))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>import("../shellscript-F23VVVTW.js"))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>import("../shellsession-G65XJMCC.js"))},{id:"smalltalk",name:"Smalltalk",import:(()=>import("../smalltalk-LALIO5SC.js"))},{id:"solidity",name:"Solidity",import:(()=>import("../solidity-TQUKTJZZ.js"))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>import("../soy-ALTWCQTO.js"))},{id:"sparql",name:"SPARQL",import:(()=>import("../sparql-ARI3MVK7.js"))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>import("../splunk-QEFG3NPJ.js"))},{id:"sql",name:"SQL",import:(()=>import("../sql-SBP7VV3V.js"))},{id:"ssh-config",name:"SSH Config",import:(()=>import("../ssh-config-SC6RC6IV.js"))},{id:"stata",name:"Stata",import:(()=>import("../stata-MNI5YOQU.js"))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>import("../stylus-YYWEHAK3.js"))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>import("../surrealql-5X7LI3J6.js"))},{id:"svelte",name:"Svelte",import:(()=>import("../svelte-6TT7H4YP.js"))},{id:"swift",name:"Swift",import:(()=>import("../swift-JEBLU4EM.js"))},{id:"system-verilog",name:"SystemVerilog",import:(()=>import("../system-verilog-46QRSGNM.js"))},{id:"systemd",name:"Systemd Units",import:(()=>import("../systemd-3PUVCSI7.js"))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>import("../talonscript-AK4LB3KC.js"))},{id:"tasl",name:"Tasl",import:(()=>import("../tasl-VHTYBUVI.js"))},{id:"tcl",name:"Tcl",import:(()=>import("../tcl-UUMKHRHL.js"))},{id:"templ",name:"Templ",import:(()=>import("../templ-WN3SJLUV.js"))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>import("../terraform-GCGIT2RL.js"))},{id:"tex",name:"TeX",import:(()=>import("../tex-L55DZDKV.js"))},{id:"toml",name:"TOML",import:(()=>import("../toml-7AH4HFBN.js"))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>import("../ts-tags-NAJDOQCO.js"))},{id:"tsv",name:"TSV",import:(()=>import("../tsv-EB3LRXYX.js"))},{id:"tsx",name:"TSX",import:(()=>import("../tsx-Y5YXGNIX.js"))},{id:"turtle",name:"Turtle",import:(()=>import("../turtle-KM6UGYIQ.js"))},{id:"twig",name:"Twig",import:(()=>import("../twig-GIY7NVAA.js"))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>import("../typescript-ZF5AMNEZ.js"))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>import("../typespec-6JSRRA42.js"))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>import("../typst-ZOSAUKL5.js"))},{id:"v",name:"V",import:(()=>import("../v-HVLBO3DI.js"))},{id:"vala",name:"Vala",import:(()=>import("../vala-WWRVCJNF.js"))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>import("../vb-XFFF4O73.js"))},{id:"verilog",name:"Verilog",import:(()=>import("../verilog-XTDPJNP7.js"))},{id:"vhdl",name:"VHDL",import:(()=>import("../vhdl-OCZJ2AOZ.js"))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>import("../viml-PVA3ZJ5L.js"))},{id:"vue",name:"Vue",import:(()=>import("../vue-V6GLJNYA.js"))},{id:"vue-html",name:"Vue HTML",import:(()=>import("../vue-html-G4DE7FYD.js"))},{id:"vue-vine",name:"Vue Vine",import:(()=>import("../vue-vine-KB45C76H.js"))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>import("../vyper-SBDFKHRI.js"))},{id:"wasm",name:"WebAssembly",import:(()=>import("../wasm-SXNE4SKX.js"))},{id:"wenyan",name:"Wenyan",aliases:["\u6587\u8A00"],import:(()=>import("../wenyan-PMSCJP7P.js"))},{id:"wgsl",name:"WGSL",import:(()=>import("../wgsl-DOXQU7M4.js"))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>import("../wikitext-LGNEKWDX.js"))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>import("../wit-G62U2KBE.js"))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>import("../wolfram-YTZHUYN6.js"))},{id:"xml",name:"XML",import:(()=>import("../xml-WGLM4CWK.js"))},{id:"xsl",name:"XSL",import:(()=>import("../xsl-KAAH2GEK.js"))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>import("../yaml-JGEBDSVI.js"))},{id:"zenscript",name:"ZenScript",import:(()=>import("../zenscript-QQQPZNJ7.js"))},{id:"zig",name:"Zig",import:(()=>import("../zig-6LJUAPBA.js"))}],dl=Object.fromEntries(Cr.map(e=>[e.id,e.import])),cl=Object.fromEntries(Cr.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ha={...dl,...cl};f();var hm=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>import("../andromeeda-XSK3JERF.js"))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>import("../aurora-x-CGSVHL4H.js"))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>import("../ayu-dark-XYI57HMC.js"))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>import("../ayu-light-4PSGMDIC.js"))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>import("../ayu-mirage-DU5SNMZX.js"))},{id:"catppuccin-frappe",displayName:"Catppuccin Frapp\xE9",type:"dark",import:(()=>import("../catppuccin-frappe-UZ4N3Z4I.js"))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>import("../catppuccin-latte-GCOWYLZG.js"))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>import("../catppuccin-macchiato-PJD7W5WJ.js"))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>import("../catppuccin-mocha-RRH4FOBS.js"))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>import("../dark-plus-PSM5XP2I.js"))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>import("../dracula-2VHT5LK5.js"))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>import("../dracula-soft-MSCUO73T.js"))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>import("../everforest-dark-AGVJEQ35.js"))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>import("../everforest-light-62GPFKVJ.js"))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>import("../github-dark-5OJVMBCE.js"))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>import("../github-dark-default-4WERFSZW.js"))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>import("../github-dark-dimmed-7VD3SZKC.js"))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>import("../github-dark-high-contrast-FVMMS656.js"))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>import("../github-light-SE4LEKO7.js"))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>import("../github-light-default-TV7BYQGI.js"))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>import("../github-light-high-contrast-WKO4I3G7.js"))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>import("../gruvbox-dark-hard-LOYZQIGI.js"))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>import("../gruvbox-dark-medium-UIMSJJ6K.js"))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>import("../gruvbox-dark-soft-PU6RNTTO.js"))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>import("../gruvbox-light-hard-ZQJ7XSZF.js"))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>import("../gruvbox-light-medium-CD3ZGYV6.js"))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>import("../gruvbox-light-soft-S74MAGOM.js"))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>import("../horizon-EAAZ4KVN.js"))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>import("../houston-UNRWGR67.js"))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>import("../kanagawa-dragon-BOSCCB42.js"))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>import("../kanagawa-lotus-NXMB2IVI.js"))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>import("../kanagawa-wave-YOHS63UF.js"))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>import("../laserwave-TS4AG4VO.js"))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>import("../light-plus-2HYW3NJ6.js"))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>import("../material-theme-KPDVFAGV.js"))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>import("../material-theme-darker-GVSTMSNT.js"))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>import("../material-theme-lighter-JWZNUXUH.js"))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>import("../material-theme-ocean-MU4N3XNQ.js"))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>import("../material-theme-palenight-VMWD73WM.js"))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>import("../min-dark-ASEVSA24.js"))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>import("../min-light-3H54BB3D.js"))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>import("../monokai-5QWQOFN6.js"))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>import("../night-owl-4QQBS2UX.js"))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>import("../night-owl-light-HR6A2OQO.js"))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>import("../nord-XK3AUNCF.js"))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>import("../one-dark-pro-ZV7CEA5M.js"))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>import("../one-light-FKZJCKM6.js"))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>import("../plastic-SXCQPKYC.js"))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>import("../poimandres-S3UYVG4O.js"))},{id:"red",displayName:"Red",type:"dark",import:(()=>import("../red-A6OC2HVL.js"))},{id:"rose-pine",displayName:"Ros\xE9 Pine",type:"dark",import:(()=>import("../rose-pine-GLWOWPBK.js"))},{id:"rose-pine-dawn",displayName:"Ros\xE9 Pine Dawn",type:"light",import:(()=>import("../rose-pine-dawn-HYE6T7LV.js"))},{id:"rose-pine-moon",displayName:"Ros\xE9 Pine Moon",type:"dark",import:(()=>import("../rose-pine-moon-VHVTDDVO.js"))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>import("../slack-dark-OPW5CYSY.js"))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>import("../slack-ochin-WTVMYBFH.js"))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>import("../snazzy-light-5UQ56PC5.js"))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>import("../solarized-dark-DSMP6D7D.js"))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>import("../solarized-light-3IZTZCIV.js"))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>import("../synthwave-84-JWI6CVJZ.js"))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>import("../tokyo-night-SRK4SADJ.js"))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>import("../vesper-WIZFPFI7.js"))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>import("../vitesse-black-PEGI4HJX.js"))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>import("../vitesse-dark-M2ZAGPXG.js"))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>import("../vitesse-light-RICZI4IG.js"))}],fl=Object.fromEntries(hm.map(e=>[e.id,e.import]));f();var ga=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function gm(){return 2147483648}function wm(){return typeof performance<"u"?performance.now():Date.now()}var xm=(e,t)=>e+(t-e%t)%t;async function Lm(e){let t,a,o={};function r(m){a=m,o.HEAPU8=new Uint8Array(m),o.HEAPU32=new Uint32Array(m)}function n(m,h,I){o.HEAPU8.copyWithin(m,h,h+I)}function s(m){try{return t.grow(m-a.byteLength+65535>>>16),r(t.buffer),1}catch{}}function i(m){let h=o.HEAPU8.length;m=m>>>0;let I=gm();if(m>I)return!1;for(let L=1;L<=4;L*=2){let S=h*(1+.2/L);S=Math.min(S,m+100663296);let C=Math.min(I,xm(Math.max(m,S),65536));if(s(C))return!0}return!1}let l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(m,h,I=1024){let L=h+I,S=h;for(;m[S]&&!(S>=L);)++S;if(S-h>16&&m.buffer&&l)return l.decode(m.subarray(h,S));let C="";for(;h<S;){let x=m[h++];if(!(x&128)){C+=String.fromCharCode(x);continue}let y=m[h++]&63;if((x&224)===192){C+=String.fromCharCode((x&31)<<6|y);continue}let P=m[h++]&63;if((x&240)===224?x=(x&15)<<12|y<<6|P:x=(x&7)<<18|y<<12|P<<6|m[h++]&63,x<65536)C+=String.fromCharCode(x);else{let A=x-65536;C+=String.fromCharCode(55296|A>>10,56320|A&1023)}}return C}function c(m,h){return m?u(o.HEAPU8,m,h):""}let d={emscripten_get_now:wm,emscripten_memcpy_big:n,emscripten_resize_heap:i,fd_write:()=>0};async function p(){let h=await e({env:d,wasi_snapshot_preview1:d});t=h.memory,r(t.buffer),Object.assign(o,h),o.UTF8ToString=c}return await p(),o}var Cm=Object.defineProperty,Im=(e,t,a)=>t in e?Cm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,de=(e,t,a)=>Im(e,typeof t!="symbol"?t+"":t,a),me=null;function Sm(e){throw new ga(e.UTF8ToString(e.getLastOnigError()))}var io=class e{constructor(t){de(this,"utf16Length"),de(this,"utf8Length"),de(this,"utf16Value"),de(this,"utf8Value"),de(this,"utf16OffsetToUtf8"),de(this,"utf8OffsetToUtf16");let a=t.length,o=e._utf8ByteLength(t),r=o!==a,n=r?new Uint32Array(a+1):null;r&&(n[a]=o);let s=r?new Uint32Array(o+1):null;r&&(s[o]=a);let i=new Uint8Array(o),l=0;for(let u=0;u<a;u++){let c=t.charCodeAt(u),d=c,p=!1;if(c>=55296&&c<=56319&&u+1<a){let m=t.charCodeAt(u+1);m>=56320&&m<=57343&&(d=(c-55296<<10)+65536|m-56320,p=!0)}r&&(n[u]=l,p&&(n[u+1]=l),d<=127?s[l+0]=u:d<=2047?(s[l+0]=u,s[l+1]=u):d<=65535?(s[l+0]=u,s[l+1]=u,s[l+2]=u):(s[l+0]=u,s[l+1]=u,s[l+2]=u,s[l+3]=u)),d<=127?i[l++]=d:d<=2047?(i[l++]=192|(d&1984)>>>6,i[l++]=128|(d&63)>>>0):d<=65535?(i[l++]=224|(d&61440)>>>12,i[l++]=128|(d&4032)>>>6,i[l++]=128|(d&63)>>>0):(i[l++]=240|(d&1835008)>>>18,i[l++]=128|(d&258048)>>>12,i[l++]=128|(d&4032)>>>6,i[l++]=128|(d&63)>>>0),p&&u++}this.utf16Length=a,this.utf8Length=o,this.utf16Value=t,this.utf8Value=i,this.utf16OffsetToUtf8=n,this.utf8OffsetToUtf16=s}static _utf8ByteLength(t){let a=0;for(let o=0,r=t.length;o<r;o++){let n=t.charCodeAt(o),s=n,i=!1;if(n>=55296&&n<=56319&&o+1<r){let l=t.charCodeAt(o+1);l>=56320&&l<=57343&&(s=(n-55296<<10)+65536|l-56320,i=!0)}s<=127?a+=1:s<=2047?a+=2:s<=65535?a+=3:a+=4,i&&o++}return a}createString(t){let a=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,a),a}},lo=class je{constructor(t){if(de(this,"id",++je.LAST_ID),de(this,"_onigBinding"),de(this,"content"),de(this,"utf16Length"),de(this,"utf8Length"),de(this,"utf16OffsetToUtf8"),de(this,"utf8OffsetToUtf16"),de(this,"ptr"),!me)throw new ga("Must invoke loadWasm first.");this._onigBinding=me,this.content=t;let a=new io(t);this.utf16Length=a.utf16Length,this.utf8Length=a.utf8Length,this.utf16OffsetToUtf8=a.utf16OffsetToUtf8,this.utf8OffsetToUtf16=a.utf8OffsetToUtf16,this.utf8Length<1e4&&!je._sharedPtrInUse?(je._sharedPtr||(je._sharedPtr=me.omalloc(1e4)),je._sharedPtrInUse=!0,me.HEAPU8.set(a.utf8Value,je._sharedPtr),this.ptr=je._sharedPtr):this.ptr=a.createString(me)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===je._sharedPtr?je._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};de(lo,"LAST_ID",0);de(lo,"_sharedPtr",0);de(lo,"_sharedPtrInUse",!1);var pl=lo,Sr=class{constructor(t){if(de(this,"_onigBinding"),de(this,"_ptr"),!me)throw new ga("Must invoke loadWasm first.");let a=[],o=[];for(let i=0,l=t.length;i<l;i++){let u=new io(t[i]);a[i]=u.createString(me),o[i]=u.utf8Length}let r=me.omalloc(4*t.length);me.HEAPU32.set(a,r/4);let n=me.omalloc(4*t.length);me.HEAPU32.set(o,n/4);let s=me.createOnigScanner(r,n,t.length);for(let i=0,l=t.length;i<l;i++)me.ofree(a[i]);me.ofree(n),me.ofree(r),s===0&&Sm(me),this._onigBinding=me,this._ptr=s}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,a,o){let r=0;if(typeof o=="number"&&(r=o),typeof t=="string"){t=new pl(t);let n=this._findNextMatchSync(t,a,!1,r);return t.dispose(),n}return this._findNextMatchSync(t,a,!1,r)}_findNextMatchSync(t,a,o,r){let n=this._onigBinding,s=n.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(a),r);if(s===0)return null;let i=n.HEAPU32,l=s/4,u=i[l++],c=i[l++],d=[];for(let p=0;p<c;p++){let m=t.convertUtf8OffsetToUtf16(i[l++]),h=t.convertUtf8OffsetToUtf16(i[l++]);d[p]={start:m,end:h,length:h-m}}return{index:u,captureIndices:d}}};function ym(e){return typeof e.instantiator=="function"}function bm(e){return typeof e.default=="function"}function km(e){return typeof e.data<"u"}function Tm(e){return typeof Response<"u"&&e instanceof Response}function vm(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}var so;function Pm(e){if(so)return so;async function t(){me=await Lm(async a=>{let o=e;return o=await o,typeof o=="function"&&(o=await o(a)),typeof o=="function"&&(o=await o(a)),ym(o)?o=await o.instantiator(a):bm(o)?o=await o.default(a):(km(o)&&(o=o.data),Tm(o)?typeof WebAssembly.instantiateStreaming=="function"?o=await Am(o)(a):o=await Rm(o)(a):vm(o)?o=await Ir(o)(a):o instanceof WebAssembly.Module?o=await Ir(o)(a):"default"in o&&o.default instanceof WebAssembly.Module&&(o=await Ir(o.default)(a))),"instance"in o&&(o=o.instance),"exports"in o&&(o=o.exports),o})}return so=t(),so}function Ir(e){return t=>WebAssembly.instantiate(e,t)}function Am(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Rm(e){return async t=>{let a=await e.arrayBuffer();return WebAssembly.instantiate(a,t)}}async function ml(e){return e&&await Pm(e),{createScanner(t){return new Sr(t.map(a=>typeof a=="string"?a:a.source))},createString(t){return new pl(t)}}}var uo=ll({langs:ha,themes:fl,engine:()=>ml(import("../wasm-ISCPKFD2.js"))}),{codeToHtml:Mm,codeToHast:Fm,codeToTokens:Dm,codeToTokensBase:Bm,codeToTokensWithThemes:Em,getSingletonHighlighter:_m,getLastGrammarState:Om}=ul(uo,{guessEmbeddedLanguages:tl});var hl=new Set(Object.keys(ha)),yr=new Map,br=new Map,At=new Map,Nm=(e,t)=>`${e}-${t[0]}-${t[1]}`,Um=(e,t,a)=>{let o=e.slice(0,100),r=e.length>100?e.slice(-100):"";return`${t}:${a[0]}:${a[1]}:${e.length}:${o}:${r}`},Hm=(e,t)=>{let a=Nm(e,t);if(yr.has(a))return yr.get(a);let o=uo({themes:t,langs:[e]});return yr.set(a,o),o};function qm(e={}){var t;let a=(t=e.themes)!=null?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage(o){return hl.has(o)},getSupportedLanguages(){return Array.from(hl)},getThemes(){return a},highlight({code:o,language:r,themes:n},s){let i=Um(o,r,n);return br.has(i)?br.get(i):(s&&(At.has(i)||At.set(i,new Set),At.get(i).add(s)),Hm(r,n).then(l=>{let u=l.getLoadedLanguages().includes(r)?r:"text",c=l.codeToTokens(o,{lang:u,themes:{light:n[0],dark:n[1]}});br.set(i,c);let d=At.get(i);if(d){for(let p of d)p(c);At.delete(i)}}).catch(l=>{console.error("[Streamdown Code] Failed to highlight code:",l),At.delete(i)}),null)}}}var gl=qm();import{memo as zm}from"react";f();import{useEffect as Wm,useRef as co,useState as Gm}from"react";var jm=5,wl=400;function xl(e,t,a={}){let{msPerChar:o=jm}=a,[r,n]=Gm(t?"":e),s=co(e),i=co(t?0:e.length),l=co(0),u=co(null);return(e.length<i.current||!e.startsWith(r.slice(0,i.current)))&&(i.current=t?0:e.length),s.current=e,Wm(()=>{if(!t){u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),i.current=e.length,n(e);return}if(s.current.length-i.current>wl&&(i.current=s.current.length-wl),u.current!==null)return;let d=p=>{let m=s.current;if(i.current>=m.length){u.current=null;return}l.current===0&&(l.current=p);let h=p-l.current;if(h>=o){let I=Math.min(Math.floor(h/o),m.length-i.current);i.current+=I,n(m.slice(0,i.current)),l.current=p}u.current=requestAnimationFrame(d)};return u.current=requestAnimationFrame(d),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,o]),r}import{jsx as fo}from"react/jsx-runtime";var kr=({className:e,from:t,children:a,...o})=>fo("div",{className:F("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),...o,children:fo("div",{className:F("ww:flex ww:min-w-0 ww:flex-col ww:gap-2","ww:w-full"),children:a})}),Tr=({children:e,className:t,...a})=>fo("div",{className:F("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}),Vm={cjk:Xo,code:gl},$m={cjk:Xo},Xm={enabled:!1};function Km({className:e,linkSafety:t,isStreaming:a,children:o,...r}){let s=xl(typeof o=="string"?o:"",!!a),i=typeof o=="string"?s:o;return fo(Ft,{className:F("ww:size-full ww:[&>*:first-child]:mt-0 ww:[&>*:last-child]:mb-0",e),linkSafety:t??Xm,plugins:a?$m:Vm,...r,children:i})}var po=zm(Km,(e,t)=>e.children===t.children&&e.isStreaming===t.isStreaming);po.displayName="MessageResponse";f();import{createContext as Qm,useCallback as Jm,useContext as Sl,useEffect as Zm,useMemo as Pr,useRef as Ym,useState as Ar}from"react";import{Fragment as Il,jsx as $,jsxs as ht}from"react/jsx-runtime";function eh(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 o=Object.entries(e),r=[],n=t-2;for(let[s,i]of o){if(n<=8)break;let l=s.length>4?`${s.slice(0,4)}\u2026`:s,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=`${l}\u2009${u}`;r.push(c),n-=c.length+3}return`{${r.join(", ")}}`}function th({text:e,className:t}){let{t:a}=j(),[o,r]=Ar(!1),n=Ym(null);Zm(()=>()=>{n.current&&clearTimeout(n.current)},[]);let s=Jm(async i=>{i.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>r(!1),2e3)}catch{}},[e]);return $(qe,{variant:"ghost",size:"sm",onClick:s,className:F("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:o?ht(Il,{children:[$(Gt,{className:"ww:size-3.5"}),$("span",{children:a.tool.copied})]}):ht(Il,{children:[$(zt,{className:"ww:size-3.5"}),$("span",{children:a.tool.copy})]})})}function yl({data:e,label:t,className:a,...o}){let[r,n]=Ar(!1),s=Pr(()=>JSON.stringify(e,null,2),[e]),i=eh(e);return ht("div",{className:F("ww:rounded-lg ww:bg-tool-card",a),...o,children:[ht("div",{className:"ww:flex ww:items-center ww:justify-between ww:px-3 ww:pt-2.5 ww:pb-1.5",children:[$("span",{className:"ww:text-xs ww:font-medium ww:text-muted-foreground",children:t}),$(th,{text:s})]}),ht("button",{type:"button",onClick:()=>n(l=>!l),className:"ww:flex ww:w-full ww:items-start ww:gap-2 ww:px-3 ww:pb-3 ww:text-left",children:[$(jt,{className:F("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?$("pre",{className:"ww:overflow-x-auto ww:text-xs ww:font-mono ww:text-foreground ww:whitespace-pre-wrap ww:break-all",children:$("code",{children:s})}):$("span",{className:"ww:truncate ww:text-xs ww:font-mono ww:text-foreground/80",children:i})]})]})}var Rr=Qm({open:!1,toggle:()=>{}});function bl({className:e,defaultOpen:t=!1,children:a,...o}){let[r,n]=Ar(t);return $(Rr.Provider,{value:{open:r,toggle:()=>n(s=>!s)},children:$("div",{className:F("ww:mb-4 ww:w-full",e),"data-state":r?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...o,children:a})})}function kl({className:e,title:t,state:a,...o}){let{open:r,toggle:n}=Sl(Rr),s=a==="input-available"||a==="input-streaming",i=t??"";return ht("button",{type:"button",onClick:n,className:F("ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),"aria-expanded":r,...o,children:[$(st,{className:"ww:size-4 ww:shrink-0"}),$("span",{className:"ww:truncate",children:s?$(Oe,{duration:1.6,children:i}):i}),$(Qe,{className:F("ww:size-4 ww:shrink-0 ww:transition-transform ww:duration-200",r&&"ww:rotate-180")})]})}function Tl({className:e,title:t,state:a,...o}){let r=a==="input-available"||a==="input-streaming",n=t??"";return $("div",{className:F("ww:mb-4 ww:flex ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground",e),style:{animation:"ww-fade-in 0.2s ease-out"},...o,children:$("span",{className:"ww:truncate",children:r?$(Oe,{duration:1.6,children:n}):n})})}function vl({className:e,children:t,...a}){let{open:o}=Sl(Rr);return $("div",{className:F("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",o?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:$("div",{className:"ww:min-h-0 ww:overflow-hidden",children:$("div",{className:F("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 Mr({className:e,input:t,debug:a,...o}){let{t:r}=j(),n=Pr(()=>{if(!a&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:s,...i}=t;return i}return t},[t,a]);return $(yl,{data:n,label:r.tool.request,className:e,...o})}function vr(e){if(!(typeof e!="object"||e===null))return e}function Pl(e){return vr(e?.ui)}function Al(e){return vr(vr(e)?._meta)}function Ll(e){if(!e)return;let t=Pl(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 o=e["openai/outputTemplate"];if(typeof o=="string"&&o.length>0)return o}function Cl(e){return Pl(e)?.autoHeight===!0}function wa(e,t,a){if(e){let o=Ll(a?.[e]?._meta);if(o)return o}return Ll(Al(t))}function Rl(e,t,a){return e&&Cl(a?.[e]?._meta)?!0:Cl(Al(t))}function Fr({className:e,output:t,errorText:a,debug:o,...r}){let{t:n}=j(),s=Pr(()=>{if(!o&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:i,...l}=t;return l}return t},[t,o]);return t||a?a?ht("div",{className:F("ww:space-y-2",e),...r,children:[$("h4",{className:"ww:text-xs ww:font-medium ww:uppercase ww:tracking-wide ww:text-muted-foreground",children:n.tool.error}),$("div",{className:"ww:rounded-lg ww:bg-destructive/10 ww:p-3 ww:text-xs ww:text-destructive",children:a})]}):$(yl,{data:s,label:n.tool.response,className:e,...r}):null}f();import{jsx as Ml,jsxs as ah}from"react/jsx-runtime";function Fl(e){return e.type==="text"||e.type==="reasoning"||e.type==="file"||"toolCallId"in e}function Dl(e){return e.parts.some(Fl)}function Bl(e,t,a){if(t!=="submitted"&&t!=="streaming")return!1;let o=e[e.length-1];return!o||o.role!=="assistant"?!0:!o.parts.some(n=>!(!Fl(n)||a?.ignoreToolParts&&"toolCallId"in n||a?.ignoreReasoningParts&&n.type==="reasoning"))}function El({className:e,...t}){let{t:a}=j();return ah("div",{"aria-live":"polite",className:F("ww:mb-4 ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground",e),style:{animation:"ww-fade-in 0.2s ease-out"},...t,children:[Ml(Jt,{className:"ww:size-4 ww:shrink-0"}),Ml(Oe,{duration:1.6,children:a.workingIndicator.default})]})}f();import{useCallback as oh,useEffect as _l,useMemo as rh,useRef as be,useState as Ol}from"react";import{jsx as hh}from"react/jsx-runtime";var nh="/api/mcp/resource",sh=500,ih=0,lh=16,uh="2026-01-26",dh=300,ch=3e3,fh=3;function ph(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function mh(e,t,a){return wa(e,t,a)?!1:t._meta?.["waniwani/autoInjectResultText"]!==!1}function Nl({resourceUri:e,toolInput:t,toolResult:a,resourceEndpoint:o=nh,chatSessionId:r,isDark:n=!1,className:s,autoHeight:i=!1,onOpenLink:l,onFollowUp:u,onCallTool:c,onDisplayModeChange:d,isFullscreen:p=!1,toolDefinitions:m}){let h=be(null),I=be(t),L=be(a),S=be({width:0,height:0}),C=be(null),x=be(!1),y=be(0),P=be("inline"),[A,M]=Ol(ih),[R,_]=Ol(void 0),D=be(l),O=be(u),k=be(c),B=be(d),T=be(r),v=be(m);I.current=t,L.current=a,D.current=l,O.current=u,k.current=c,B.current=d,T.current=r,v.current=m;let q=oh(X=>i?Math.max(X+lh,0):Math.min(Math.max(X,50),sh),[i]),Le=rh(()=>{let X=o.includes("?")?"&":"?";return`${o}${X}uri=${encodeURIComponent(e)}`},[o,e]),ie=be(n);return ie.current=n,_l(()=>{if(!x.current)return;let X=h.current;X?.contentWindow&&X.contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{theme:n?"dark":"light"}},"*")},[n]),_l(()=>{let X=h.current;if(!X)return;let Ce=!1,Pe=!1,ye=null,ke=null,Ke=setTimeout(()=>{if(Ce||Pe||y.current>=fh)return;y.current+=1;let re=new URL(X.src);re.searchParams.set("_retry",String(y.current)),X.src=re.toString()},ch),U=re=>{X.contentWindow?.postMessage(re,"*")},fe=re=>{if(Ce||re.source!==X.contentWindow)return;let Z=re.data;if(!Z||typeof Z!="object"||Z.jsonrpc!=="2.0")return;let ne=Z.method,G=Z.id;if(ne==="ui/initialize"&&G!=null){Pe=!0,clearTimeout(Ke),U({jsonrpc:"2.0",id:G,result:{protocolVersion:Z.params?.protocolVersion??uh,hostInfo:{name:"Waniwani Chat",version:"1.0.0"},hostCapabilities:{openLinks:{},message:{text:{}},tools:{},updateModelContext:{text:{},structuredContent:{}}},hostContext:{theme:ie.current?"dark":"light",displayMode:P.current}}});return}if(ne==="ui/notifications/initialized"){x.current=!0;let V=I.current,K=L.current,ee=K._meta&&typeof K._meta=="object"?K._meta:null,Y=ph(T.current),le=ee&&typeof ee.waniwani=="object"&&ee.waniwani!==null?ee.waniwani:null,Te=le||Y?{...le??{},...Y?{sessionId:Y}:{}}:void 0,Fe=ee||Te?{...ee??{},...Te?{waniwani:Te}:{}}:void 0;U({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:V}});let xt=K.content??[{type:"text",text:JSON.stringify(K)}];U({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{content:xt,structuredContent:K.structuredContent,_meta:Fe,meta:Fe}});return}if(ne==="ui/notifications/size-changed"){let V=Z.params,K=typeof V?.height=="number"?V.height:void 0,ee=typeof V?.width=="number"?V.width:void 0,Y=S.current,le=K!==void 0&&K!==Y.height,Te=ee!==void 0&&ee!==Y.width;if(!le&&!Te)return;if(le&&K!==void 0){Y.height=K;let Fe=q(K),xt=X.getBoundingClientRect().height;if(C.current&&(C.current.cancel(),C.current=null),M(Fe),X.animate&&Math.abs(xt-Fe)>2){let Lt=X.animate([{height:`${xt}px`},{height:`${Fe}px`}],{duration:dh,easing:"ease-out",fill:"forwards"});C.current=Lt,Lt.onfinish=()=>{C.current===Lt&&(Lt.cancel(),C.current=null)}}}Te&&i&&ee!==void 0&&(Y.width=ee,_(ee));return}if(ne==="ui/open-link"&&G!=null){let V=Z.params?.url;typeof V=="string"&&(D.current?D.current(V):window.open(V,"_blank","noopener,noreferrer")),U({jsonrpc:"2.0",id:G,result:{}});return}if(ne==="ui/message"&&G!=null){if(O.current&&Z.params){let V=Z.params,K=ye;if(ye=null,ke){clearTimeout(ke.timer);let ee=ke.text;ke=null;let Y=(V.content??[]).map(le=>le.text??"").join("").trim();V={...V,content:[{type:"text",text:`${Y}
80
80
 
81
- ${ee}`}]}}O.current({...V,...K?{modelContext:K}:{}})}U({jsonrpc:"2.0",id:G,result:{}});return}if(ne==="ui/update-model-context"&&G!=null){ye=$r(ye,Z.params),U({jsonrpc:"2.0",id:G,result:{}});return}if(ne==="tools/call"&&G!=null){let V=k.current;if(!V){U({jsonrpc:"2.0",id:G,error:{code:-32601,message:"tools/call not supported"}});return}let K=Z.params?.name;V({name:K,arguments:Z.params?.arguments??{}}).then(ee=>{U({jsonrpc:"2.0",id:G,result:ee});let Y=ee.content?.map(le=>le.text??"").join("").trim();Y&&mh(K,ee,v.current)&&(ke&&clearTimeout(ke.timer),ke={text:Y,timer:setTimeout(()=>{if(Ce)return;let le=ye;ye=null,ke=null,O.current?.({role:"user",content:[{type:"text",text:Y}],...le?{modelContext:le}:{}})},500)})}).catch(ee=>{let Y=ee instanceof Error?ee.message:"Tool call failed";U({jsonrpc:"2.0",id:G,error:{code:-32e3,message:Y}})});return}if(ne==="ui/request-display-mode"&&G!=null){let V=Z.params?.mode,K=V==="fullscreen"||V==="inline"||V==="pip"?V:"inline";P.current=K,U({jsonrpc:"2.0",id:G,result:{mode:K}}),U({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{displayMode:K}}),B.current?.(K);return}if(ne==="ui/resource-teardown"&&G!=null){U({jsonrpc:"2.0",id:G,result:{}});return}ne==="ping"&&G!=null&&U({jsonrpc:"2.0",id:G,result:{}})};return window.addEventListener("message",fe),()=>{Ce=!0,clearTimeout(Ke),ke&&clearTimeout(ke.timer),window.removeEventListener("message",fe)}},[i,q]),hh("iframe",{ref:h,src:Le,sandbox:"allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox",className:F(!p&&"ww:rounded-md ww:border ww:border-border",s),style:{height:p?"100%":A,minWidth:p||!R?void 0:`min(${R}px, 100%)`,width:"100%",border:"none",colorScheme:n?"dark":"auto"},title:"MCP App"})}f();import{jsx as xa,jsxs as gh}from"react/jsx-runtime";function Ul({icon:e,title:t,description:a,suggestions:o,onSuggestionSelect:r}){return gh("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&&xa("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}),xa("h2",{className:"ww:text-lg ww:font-semibold ww:text-foreground",children:t}),a&&xa("p",{className:"ww:mt-1 ww:text-sm ww:text-muted-foreground ww:max-w-sm",children:a}),o&&o.length>0&&xa("div",{className:"ww:mt-6 ww:w-full ww:max-w-md ww:flex ww:flex-col ww:gap-2",children:o.map((n,s)=>xa("button",{type:"button",onClick:()=>r?.(n),className:F("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:`${s*50}ms`},children:n},n))})]})}f();import{Component as wh}from"react";import{jsx as Dr,jsxs as Lh}from"react/jsx-runtime";function xh({onRetry:e}){let{t}=j();return Lh("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:[Dr("span",{children:t.widgetErrorBoundary.failedToLoad}),Dr("button",{type:"button",onClick:e,className:"ww:text-xs ww:font-medium ww:text-primary ww:hover:underline",children:t.widgetErrorBoundary.retry})]})}var mo=class extends wh{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.warn("[Waniwani] Widget failed to render:",t.message)}render(){return this.state.hasError?Dr(xh,{onRetry:()=>this.setState({hasError:!1})}):this.props.children}};import{Fragment as Ih,jsx as J,jsxs as at}from"react/jsx-runtime";function Hl(e){return e?e.replace(/[-_]/g," ").replace(/^\w/,t=>t.toUpperCase()):"Tool"}function Ch(e){return e&&/search|find|lookup|query|web|browse|google/i.test(e)?$t:st}function ql({messages:e,status:t,welcomeMessage:a,welcome:o,onSuggestionSelect:r,resourceEndpoint:n,chatSessionId:s,isDark:i,onFollowUp:l,onCallTool:u,onWidgetDisplayModeChange:c,fullscreenToolCallId:d,debug:p,showToolCalls:m=!0,toolDefinitions:h}){let{t:I}=j(),L=e[e.length-1],S=e.length>0,C=d!=null,x=!C&&Bl(e,t,{ignoreToolParts:m===!1,ignoreReasoningParts:m===!1});return at(Ih,{children:[!C&&(!S&&o?J(Ul,{...o,onSuggestionSelect:r}):a&&J(kr,{from:"assistant",children:J(Tr,{children:J(po,{children:a})})})),e.map(y=>{let P=y.parts.filter(T=>T.type==="text"),A=y.parts.filter(T=>T.type==="reasoning"),M=y.parts.filter(T=>T.type==="file"),R=y.parts.filter(T=>"toolCallId"in T),_=y.parts.filter(T=>T.type==="reasoning"||"toolCallId"in T),D=y===L&&y.role==="assistant",O=P.length>0,k=C?R.some(T=>T.toolCallId===d):!1,B=m!==!1&&!k&&_.length>=2;return C&&!k?J("div",{style:{display:"none"}},y.id):y.role==="assistant"&&!Dl(y)?J("div",{style:{display:"none"}},y.id):m===!1&&y.role==="assistant"&&!O&&M.length===0&&R.every(T=>{let v="output"in T?T.output:void 0;return v===void 0||!n||!wa(T.toolName,v,h)})?J("div",{style:{display:"none"}},y.id):at(kr,{from:y.role,children:[m!==!1&&!k&&!B&&A.map((T,v)=>at(ta,{isStreaming:T.state==="streaming",children:[J(aa,{}),J(oa,{children:T.text})]},`reasoning-${y.id}-${v}`)),B&&at(_s,{isWorking:D&&(t==="streaming"||t==="submitted"),children:[J(Os,{workingLabel:I.chainOfThought.working,label:I.chainOfThought.done}),J(Ns,{children:_.map((T,v)=>{let q=v===_.length-1;if(T.type==="reasoning")return J(Hs,{isStreaming:T.state==="streaming",isLast:q,children:T.text},`reasoning-${y.id}-${v}`);let Le=T.title??Hl(T.toolName),ie=Ch(T.toolName);if(m==="titles-only")return J(zo,{icon:ie,title:Le,state:T.state,isLast:q},T.toolCallId);let X="output"in T?T.output:void 0;return at(zo,{icon:ie,title:Le,state:T.state,isLast:q,children:[J(Mr,{input:T.input,debug:p}),X!==void 0&&J(Fr,{output:X,errorText:"errorText"in T?T.errorText:void 0,debug:p})]},T.toolCallId)})})]}),m!==!1&&!k&&!B&&R.length===1&&(()=>{let T=R[0],v=T.title??Hl(T.toolName);if(m==="titles-only")return J(Tl,{title:v,state:T.state});let q="output"in T?T.output:void 0;return at(bl,{children:[J(kl,{title:v,state:T.state}),at(vl,{children:[J(Mr,{input:T.input,debug:p}),q!==void 0&&J(Fr,{output:q,errorText:"errorText"in T?T.errorText:void 0,debug:p})]})]})})(),R.map(T=>{let v="output"in T?T.output:void 0,q=wa(T.toolName,v,h),Le=Rl(T.toolName,v,h),ie=T.toolCallId===d;return q&&n&&v!==void 0?J("div",{style:ie?{position:"absolute",inset:0,zIndex:10,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--ww-color-background)"}:void 0,children:q&&n&&v!==void 0&&J(mo,{children:J(Nl,{isFullscreen:ie,resourceUri:q,toolInput:T.input??{},toolResult:{content:v.content,structuredContent:v.structuredContent,_meta:v._meta},resourceEndpoint:n,chatSessionId:s,isDark:i,autoHeight:Le,toolDefinitions:h,onFollowUp:l,onCallTool:u,onDisplayModeChange:c?X=>c(X,{toolCallId:T.toolCallId,resourceUri:q,toolInput:T.input??{},toolResult:{content:v.content,structuredContent:v.structuredContent,_meta:v._meta},autoHeight:Le}):void 0})})},T.toolCallId):null}),!k&&J("div",{children:at(Tr,{children:[M.length>0&&J(As,{files:M}),O?P.map((T,v)=>{let q=D&&t==="streaming"&&v===P.length-1;return J(po,{isStreaming:q,children:T.type==="text"?T.text:""},`${y.id}-${v}`)}):null]})})]},y.id)}),x&&J(El,{})]})}f();import{jsx as Wl,jsxs as bh}from"react/jsx-runtime";var Sh="https://app.waniwani.ai/assets/waniwani-logo.svg",yh="https://waniwani.ai";function Gl(){let{t:e}=j();return bh("a",{href:yh,target:"_blank",rel:"noopener noreferrer",className:"ww:flex ww:items-center ww:gap-1.5 ww:whitespace-nowrap ww:text-[10px] ww:sm:text-[11px] ww:text-muted-foreground ww:opacity-70 hover:ww:opacity-100 ww:transition-opacity",children:[Wl("span",{children:e.poweredBy.label}),Wl("img",{src:Sh,alt:"Waniwani",width:72,height:10,"data-waniwani-logo":"",className:"ww:h-2.5 ww:w-auto"})]})}f();import{jsx as ho}from"react/jsx-runtime";function jl({suggestions:e,isLoading:t,onSelect:a,className:o,...r}){return e.length===0&&!t?null:ho("div",{className:F("ww:px-4 ww:py-2",o),...r,children:ho("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(n=>ho("div",{className:"ww:h-7 ww:rounded-full ww:bg-accent ww:animate-pulse",style:{width:`${60+n*20}px`}},n)):e.map((n,s)=>ho("button",{type:"button",onClick:()=>a(n),className:F("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:`${s*50}ms`},children:n},n))})})}f();import{useEffect as kh,useRef as Th,useState as vh}from"react";import{jsx as oe,jsxs as gt}from"react/jsx-runtime";var zl=20;function Ph({label:e}){return gt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[oe("title",{children:e}),oe("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),oe("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function Ah({label:e}){return gt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[oe("title",{children:e}),oe("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),oe("polyline",{points:"3 4 3 9 8 9"}),oe("line",{x1:"12",y1:"7",x2:"12",y2:"12"}),oe("line",{x1:"12",y1:"12",x2:"15",y2:"14"})]})}function Rh({label:e}){return gt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[oe("title",{children:e}),oe("polyline",{points:"3 6 5 6 21 6"}),oe("path",{d:"M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6"}),oe("path",{d:"M10 11v6"}),oe("path",{d:"M14 11v6"})]})}function Vl({threads:e,activeThreadId:t,onNewThread:a,onSelectThread:o,onDeleteThread:r}){let{locale:n,t:s}=j(),[i,l]=vh(!1),u=Th(null);kh(()=>{if(!i)return;let p=m=>{let h=u.current;h&&(m.composedPath().includes(h)||l(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[i]);let c=e.slice(0,zl),d=Math.max(0,e.length-zl);return gt("div",{ref:u,className:"ww:relative ww:flex ww:items-center ww:gap-1",children:[oe("button",{type:"button",onClick:a,title:s.threadMenu.newChat,"aria-label":s.threadMenu.newChat,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:oe(Ph,{label:s.threadMenu.newChat})}),oe("button",{type:"button",onClick:()=>l(p=>!p),title:s.threadMenu.threadHistory,"aria-label":s.threadMenu.threadHistory,"aria-expanded":i,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:oe(Ah,{label:s.threadMenu.threadHistory})}),i&&gt("div",{role:"menu",className:"ww:absolute ww:right-0 ww:top-full ww:mt-1 ww:w-72 ww:max-h-80 ww:overflow-y-auto ww:rounded-lg ww:border ww:border-border ww:bg-background ww:shadow-lg ww:z-50",children:[c.length===0&&oe("div",{className:"ww:px-3 ww:py-3 ww:text-xs ww:text-muted-foreground",children:s.threadMenu.noPreviousChats}),c.map(p=>{let m=p.threadId===t,h=Date.parse(p.updatedAt);return gt("div",{className:`ww:flex ww:items-center ww:gap-2 ww:px-3 ww:py-2 ww:text-xs hover:ww:bg-foreground/5 ${m?"ww:bg-foreground/5":""}`,children:[gt("button",{type:"button",onClick:()=>{o(p.threadId),l(!1)},className:"ww:flex-1 ww:min-w-0 ww:text-left ww:cursor-pointer",children:[oe("div",{className:"ww:truncate ww:text-foreground ww:font-medium",children:p.title}),oe("div",{className:"ww:text-[10px] ww:text-muted-foreground",children:Number.isNaN(h)?"":No(h,n)})]}),oe("button",{type:"button",onClick:I=>{I.stopPropagation(),r(p.threadId)},title:s.threadMenu.deleteThread,"aria-label":s.threadMenu.deleteThread,className:"ww:p-1 ww:rounded ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/10 ww:transition-colors ww:cursor-pointer",children:oe(Rh,{label:s.threadMenu.deleteThread})})]},p.threadId)}),d>0&&oe("div",{className:"ww:px-3 ww:py-2 ww:text-[10px] ww:text-muted-foreground ww:border-t ww:border-border",children:s.threadMenu.hiddenThreads(d)})]})]})}f();import{useCallback as Mh,useRef as Fh}from"react";function $l(e){let t=Fh(e);return t.current=e,Mh(async a=>{let{api:o,headers:r,onCallTool:n,sessionId:s}=t.current;if(n)return n(a);let i=`${o??"/api/waniwani"}/tool`,l=typeof s=="string"&&s.trim().length>0?s.trim():void 0,u=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...l?{"X-Session-Id":l}:{},...r},body:JSON.stringify(a)});if(!u.ok)throw new Error(`Tool call failed: ${u.status} ${u.statusText}`);return u.json()},[])}f();import{useChat as Kh}from"@ai-sdk/react";import{useCallback as we,useEffect as Ee,useRef as ce,useState as wt}from"react";f();function Rt(e,t,a){let[o,r=""]=e.split("?"),n=o.replace(/\/$/,""),s=new URLSearchParams(r);if(a)for(let[l,u]of Object.entries(a))s.set(l,u);let i=s.toString();return`${n}${t}${i?`?${i}`:""}`}f();import{DefaultChatTransport as Dh,uiMessageChunkSchema as Bh}from"ai";function Eh(e){let t=e?.cause,a=t?.issues??t?.errors;if(!Array.isArray(a))return null;let o=a.find(r=>r.code==="invalid_union");if(!o?.errors)return null;for(let r of o.errors){if(!Array.isArray(r)||r.some(i=>(i.code==="invalid_value"||i.code==="invalid_literal")&&i.path?.[0]==="type"))continue;let s=r.filter(i=>i.code==="unrecognized_keys").flatMap(i=>i.keys??[]);if(s.length>0)return s}return null}var go=class extends Dh{processResponseStream(t){let a="",o=Bh(),r=o.validate?.bind(o);return t.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({async transform(n,s){a+=n;let i=a.split(`
81
+ ${ee}`}]}}O.current({...V,...K?{modelContext:K}:{}})}U({jsonrpc:"2.0",id:G,result:{}});return}if(ne==="ui/update-model-context"&&G!=null){ye=$r(ye,Z.params),U({jsonrpc:"2.0",id:G,result:{}});return}if(ne==="tools/call"&&G!=null){let V=k.current;if(!V){U({jsonrpc:"2.0",id:G,error:{code:-32601,message:"tools/call not supported"}});return}let K=Z.params?.name;V({name:K,arguments:Z.params?.arguments??{}}).then(ee=>{U({jsonrpc:"2.0",id:G,result:ee});let Y=ee.content?.map(le=>le.text??"").join("").trim();Y&&mh(K,ee,v.current)&&(ke&&clearTimeout(ke.timer),ke={text:Y,timer:setTimeout(()=>{if(Ce)return;let le=ye;ye=null,ke=null,O.current?.({role:"user",content:[{type:"text",text:Y}],...le?{modelContext:le}:{}})},500)})}).catch(ee=>{let Y=ee instanceof Error?ee.message:"Tool call failed";U({jsonrpc:"2.0",id:G,error:{code:-32e3,message:Y}})});return}if(ne==="ui/request-display-mode"&&G!=null){let V=Z.params?.mode,K=V==="fullscreen"||V==="inline"||V==="pip"?V:"inline";P.current=K,U({jsonrpc:"2.0",id:G,result:{mode:K}}),U({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{displayMode:K}}),B.current?.(K);return}if(ne==="ui/resource-teardown"&&G!=null){U({jsonrpc:"2.0",id:G,result:{}});return}ne==="ping"&&G!=null&&U({jsonrpc:"2.0",id:G,result:{}})};return window.addEventListener("message",fe),()=>{Ce=!0,clearTimeout(Ke),ke&&clearTimeout(ke.timer),window.removeEventListener("message",fe)}},[i,q]),hh("iframe",{ref:h,src:Le,sandbox:"allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox",className:F(!p&&"ww:rounded-md ww:border ww:border-border",s),style:{height:p?"100%":A,minWidth:p||!R?void 0:`min(${R}px, 100%)`,width:"100%",border:"none",colorScheme:n?"dark":"auto"},title:"MCP App"})}f();import{jsx as xa,jsxs as gh}from"react/jsx-runtime";function Ul({icon:e,title:t,description:a,suggestions:o,onSuggestionSelect:r}){return gh("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&&xa("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}),xa("h2",{className:"ww:text-lg ww:font-semibold ww:text-foreground",children:t}),a&&xa("p",{className:"ww:mt-1 ww:text-sm ww:text-muted-foreground ww:max-w-sm",children:a}),o&&o.length>0&&xa("div",{className:"ww:mt-6 ww:w-full ww:max-w-md ww:flex ww:flex-col ww:gap-2",children:o.map((n,s)=>xa("button",{type:"button",onClick:()=>r?.(n),className:F("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:`${s*50}ms`},children:n},n))})]})}f();import{Component as wh}from"react";import{jsx as Dr,jsxs as Lh}from"react/jsx-runtime";function xh({onRetry:e}){let{t}=j();return Lh("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:[Dr("span",{children:t.widgetErrorBoundary.failedToLoad}),Dr("button",{type:"button",onClick:e,className:"ww:text-xs ww:font-medium ww:text-primary ww:hover:underline",children:t.widgetErrorBoundary.retry})]})}var mo=class extends wh{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.warn("[Waniwani] Widget failed to render:",t.message)}render(){return this.state.hasError?Dr(xh,{onRetry:()=>this.setState({hasError:!1})}):this.props.children}};import{Fragment as Ih,jsx as J,jsxs as at}from"react/jsx-runtime";function Hl(e){return e?e.replace(/[-_]/g," ").replace(/^\w/,t=>t.toUpperCase()):"Tool"}function Ch(e){return e&&/search|find|lookup|query|web|browse|google/i.test(e)?$t:st}function ql({messages:e,status:t,welcomeMessage:a,welcome:o,onSuggestionSelect:r,resourceEndpoint:n,chatSessionId:s,isDark:i,onFollowUp:l,onCallTool:u,onWidgetDisplayModeChange:c,fullscreenToolCallId:d,debug:p,showToolCalls:m=!0,toolDefinitions:h}){let{t:I}=j(),L=e[e.length-1],S=e.length>0,C=d!=null,x=!C&&Bl(e,t,{ignoreToolParts:m===!1,ignoreReasoningParts:m===!1});return at(Ih,{children:[!C&&(!S&&o?J(Ul,{...o,onSuggestionSelect:r}):a&&J(kr,{from:"assistant",children:J(Tr,{children:J(po,{children:a})})})),e.map(y=>{let P=y.parts.filter(T=>T.type==="text"),A=y.parts.filter(T=>T.type==="reasoning"),M=y.parts.filter(T=>T.type==="file"),R=y.parts.filter(T=>"toolCallId"in T),_=y.parts.filter(T=>T.type==="reasoning"||"toolCallId"in T),D=y===L&&y.role==="assistant",O=P.length>0,k=C?R.some(T=>T.toolCallId===d):!1,B=m!==!1&&!k&&_.length>=2;return C&&!k?J("div",{style:{display:"none"}},y.id):y.role==="assistant"&&!Dl(y)?J("div",{style:{display:"none"}},y.id):m===!1&&y.role==="assistant"&&!O&&M.length===0&&R.every(T=>{let v="output"in T?T.output:void 0;return v===void 0||!n||!wa(T.toolName,v,h)})?J("div",{style:{display:"none"}},y.id):at(kr,{from:y.role,children:[m!==!1&&!k&&!B&&A.map((T,v)=>at(ta,{isStreaming:T.state==="streaming",children:[J(aa,{}),J(oa,{children:T.text})]},`reasoning-${y.id}-${v}`)),B&&at(_s,{isWorking:D&&(t==="streaming"||t==="submitted"),children:[J(Os,{workingLabel:I.chainOfThought.working,label:I.chainOfThought.done}),J(Ns,{children:_.map((T,v)=>{let q=v===_.length-1;if(T.type==="reasoning")return J(Hs,{isStreaming:T.state==="streaming",isLast:q,children:T.text},`reasoning-${y.id}-${v}`);let Le=T.title??Hl(T.toolName),ie=Ch(T.toolName);if(m==="titles-only")return J(zo,{icon:ie,title:Le,state:T.state,isLast:q},T.toolCallId);let X="output"in T?T.output:void 0;return at(zo,{icon:ie,title:Le,state:T.state,isLast:q,children:[J(Mr,{input:T.input,debug:p}),X!==void 0&&J(Fr,{output:X,errorText:"errorText"in T?T.errorText:void 0,debug:p})]},T.toolCallId)})})]}),m!==!1&&!k&&!B&&R.length===1&&(()=>{let T=R[0],v=T.title??Hl(T.toolName);if(m==="titles-only")return J(Tl,{title:v,state:T.state});let q="output"in T?T.output:void 0;return at(bl,{children:[J(kl,{title:v,state:T.state}),at(vl,{children:[J(Mr,{input:T.input,debug:p}),q!==void 0&&J(Fr,{output:q,errorText:"errorText"in T?T.errorText:void 0,debug:p})]})]})})(),R.map(T=>{let v="output"in T?T.output:void 0,q=wa(T.toolName,v,h),Le=Rl(T.toolName,v,h),ie=T.toolCallId===d;return q&&n&&v!==void 0?J("div",{style:ie?{position:"absolute",inset:0,zIndex:10,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--ww-color-background)"}:void 0,children:q&&n&&v!==void 0&&J(mo,{children:J(Nl,{isFullscreen:ie,resourceUri:q,toolInput:T.input??{},toolResult:{content:v.content,structuredContent:v.structuredContent,_meta:v._meta},resourceEndpoint:n,chatSessionId:s,isDark:i,autoHeight:Le,toolDefinitions:h,onFollowUp:l,onCallTool:u,onDisplayModeChange:c?X=>c(X,{toolCallId:T.toolCallId,resourceUri:q,toolInput:T.input??{},toolResult:{content:v.content,structuredContent:v.structuredContent,_meta:v._meta},autoHeight:Le}):void 0})})},T.toolCallId):null}),!k&&J("div",{children:at(Tr,{children:[M.length>0&&J(As,{files:M}),O?P.map((T,v)=>{let q=D&&t==="streaming"&&v===P.length-1;return J(po,{isStreaming:q,children:T.type==="text"?T.text:""},`${y.id}-${v}`)}):null]})})]},y.id)}),x&&J(El,{})]})}f();import{jsx as Wl,jsxs as bh}from"react/jsx-runtime";var Sh="https://app.waniwani.ai/assets/waniwani-logo.svg",yh="https://waniwani.ai";function Gl(){let{t:e}=j();return bh("a",{href:yh,target:"_blank",rel:"noopener noreferrer",className:"ww:flex ww:items-center ww:gap-1.5 ww:whitespace-nowrap ww:text-[10px] ww:sm:text-[11px] ww:text-muted-foreground ww:opacity-70 hover:ww:opacity-100 ww:transition-opacity",children:[Wl("span",{children:e.poweredBy.label}),Wl("img",{src:Sh,alt:"Waniwani",width:72,height:10,"data-waniwani-logo":"",className:"ww:h-2.5 ww:w-auto"})]})}f();import{jsx as ho}from"react/jsx-runtime";function jl({suggestions:e,isLoading:t,onSelect:a,className:o,...r}){return e.length===0&&!t?null:ho("div",{className:F("ww:px-4 ww:py-2",o),...r,children:ho("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(n=>ho("div",{className:"ww:h-8 ww:rounded-full ww:bg-accent ww:animate-pulse",style:{width:`${60+n*20}px`}},n)):e.map((n,s)=>ho("button",{type:"button",onClick:()=>a(n),className:F("ww:rounded-full ww:border ww:border-border ww:bg-background ww:px-3.5 ww:py-1.5 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:`${s*50}ms`},children:n},n))})})}f();import{useEffect as kh,useRef as Th,useState as vh}from"react";import{jsx as oe,jsxs as gt}from"react/jsx-runtime";var zl=20;function Ph({label:e}){return gt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[oe("title",{children:e}),oe("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),oe("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function Ah({label:e}){return gt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[oe("title",{children:e}),oe("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),oe("polyline",{points:"3 4 3 9 8 9"}),oe("line",{x1:"12",y1:"7",x2:"12",y2:"12"}),oe("line",{x1:"12",y1:"12",x2:"15",y2:"14"})]})}function Rh({label:e}){return gt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[oe("title",{children:e}),oe("polyline",{points:"3 6 5 6 21 6"}),oe("path",{d:"M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6"}),oe("path",{d:"M10 11v6"}),oe("path",{d:"M14 11v6"})]})}function Vl({threads:e,activeThreadId:t,onNewThread:a,onSelectThread:o,onDeleteThread:r}){let{locale:n,t:s}=j(),[i,l]=vh(!1),u=Th(null);kh(()=>{if(!i)return;let p=m=>{let h=u.current;h&&(m.composedPath().includes(h)||l(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[i]);let c=e.slice(0,zl),d=Math.max(0,e.length-zl);return gt("div",{ref:u,className:"ww:relative ww:flex ww:items-center ww:gap-1",children:[oe("button",{type:"button",onClick:a,title:s.threadMenu.newChat,"aria-label":s.threadMenu.newChat,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:oe(Ph,{label:s.threadMenu.newChat})}),oe("button",{type:"button",onClick:()=>l(p=>!p),title:s.threadMenu.threadHistory,"aria-label":s.threadMenu.threadHistory,"aria-expanded":i,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:oe(Ah,{label:s.threadMenu.threadHistory})}),i&&gt("div",{role:"menu",className:"ww:absolute ww:right-0 ww:top-full ww:mt-1 ww:w-72 ww:max-h-80 ww:overflow-y-auto ww:rounded-lg ww:border ww:border-border ww:bg-background ww:shadow-lg ww:z-50",children:[c.length===0&&oe("div",{className:"ww:px-3 ww:py-3 ww:text-xs ww:text-muted-foreground",children:s.threadMenu.noPreviousChats}),c.map(p=>{let m=p.threadId===t,h=Date.parse(p.updatedAt);return gt("div",{className:`ww:flex ww:items-center ww:gap-2 ww:px-3 ww:py-2 ww:text-xs hover:ww:bg-foreground/5 ${m?"ww:bg-foreground/5":""}`,children:[gt("button",{type:"button",onClick:()=>{o(p.threadId),l(!1)},className:"ww:flex-1 ww:min-w-0 ww:text-left ww:cursor-pointer",children:[oe("div",{className:"ww:truncate ww:text-foreground ww:font-medium",children:p.title}),oe("div",{className:"ww:text-[10px] ww:text-muted-foreground",children:Number.isNaN(h)?"":No(h,n)})]}),oe("button",{type:"button",onClick:I=>{I.stopPropagation(),r(p.threadId)},title:s.threadMenu.deleteThread,"aria-label":s.threadMenu.deleteThread,className:"ww:p-1 ww:rounded ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/10 ww:transition-colors ww:cursor-pointer",children:oe(Rh,{label:s.threadMenu.deleteThread})})]},p.threadId)}),d>0&&oe("div",{className:"ww:px-3 ww:py-2 ww:text-[10px] ww:text-muted-foreground ww:border-t ww:border-border",children:s.threadMenu.hiddenThreads(d)})]})]})}f();import{useCallback as Mh,useRef as Fh}from"react";function $l(e){let t=Fh(e);return t.current=e,Mh(async a=>{let{api:o,headers:r,onCallTool:n,sessionId:s}=t.current;if(n)return n(a);let i=`${o??"/api/waniwani"}/tool`,l=typeof s=="string"&&s.trim().length>0?s.trim():void 0,u=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...l?{"X-Session-Id":l}:{},...r},body:JSON.stringify(a)});if(!u.ok)throw new Error(`Tool call failed: ${u.status} ${u.statusText}`);return u.json()},[])}f();import{useChat as Kh}from"@ai-sdk/react";import{useCallback as we,useEffect as Ee,useRef as ce,useState as wt}from"react";f();function Rt(e,t,a){let[o,r=""]=e.split("?"),n=o.replace(/\/$/,""),s=new URLSearchParams(r);if(a)for(let[l,u]of Object.entries(a))s.set(l,u);let i=s.toString();return`${n}${t}${i?`?${i}`:""}`}f();import{DefaultChatTransport as Dh,uiMessageChunkSchema as Bh}from"ai";function Eh(e){let t=e?.cause,a=t?.issues??t?.errors;if(!Array.isArray(a))return null;let o=a.find(r=>r.code==="invalid_union");if(!o?.errors)return null;for(let r of o.errors){if(!Array.isArray(r)||r.some(i=>(i.code==="invalid_value"||i.code==="invalid_literal")&&i.path?.[0]==="type"))continue;let s=r.filter(i=>i.code==="unrecognized_keys").flatMap(i=>i.keys??[]);if(s.length>0)return s}return null}var go=class extends Dh{processResponseStream(t){let a="",o=Bh(),r=o.validate?.bind(o);return t.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({async transform(n,s){a+=n;let i=a.split(`
82
82
  `);a=i.pop()??"";for(let l of i){let u=l.trim();if(!u.startsWith("data:"))continue;let c=u.slice(5).trim();if(c!=="[DONE]")try{let d=JSON.parse(c);if(!r){s.enqueue(d);continue}let p=await r(d);if(p.success){s.enqueue(p.value);continue}let m=Eh(p.error);if(m?.length){let h={...d};for(let L of m)delete h[L];let I=await r(h);I.success&&s.enqueue(I.value)}}catch{}}}}))}};f();f();var _h="waniwani-memory";var Me="threads",wo="by_memoryUserId",Oh="by_updatedAt";var Kl="memoryUserId",Xl="waniwani-memory-user-id",Br=null;function Er(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Nh(e,t){if(t<1&&(e.objectStoreNames.contains("ids")||e.createObjectStore("ids")),t<2&&!e.objectStoreNames.contains(Me)){let a=e.createObjectStore(Me,{keyPath:"threadId"});a.createIndex(wo,"memoryUserId",{unique:!1}),a.createIndex(Oh,"updatedAt",{unique:!1})}}async function _r(){return new Promise((e,t)=>{let a=indexedDB.open(_h,2);a.onupgradeneeded=o=>{Nh(a.result,o.oldVersion)},a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error)})}async function Uh(){return _r()}async function Hh(e){return new Promise((t,a)=>{let n=e.transaction("ids","readonly").objectStore("ids").get(Kl);n.onsuccess=()=>t(typeof n.result=="string"?n.result:null),n.onerror=()=>a(n.error)})}async function qh(e,t){return new Promise((a,o)=>{let s=e.transaction("ids","readwrite").objectStore("ids").put(t,Kl);s.onsuccess=()=>a(),s.onerror=()=>o(s.error)})}async function Wh(){if(typeof indexedDB>"u")return null;try{let e=await Uh();try{let t=await Hh(e);if(t)return t;let a=Er();return await qh(e,a),a}finally{e.close()}}catch{return null}}function Gh(){try{let e=localStorage.getItem(Xl);if(e)return e;let t=Er();return localStorage.setItem(Xl,t),t}catch{return null}}async function Ql(){let e=await Wh();if(e)return e;let t=Gh();return t||(Br||(Br=Er()),Br)}var Jl=50,Zl=1e3;function xo(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.threadId=="string"&&typeof t.memoryUserId=="string"&&typeof t.title=="string"&&Array.isArray(t.messages)&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"}async function Lo(e){if(typeof indexedDB>"u")return null;let t=null;try{return t=await _r(),await e(t)}catch{return null}finally{try{t?.close()}catch{}}}function Or(e){return new Promise((t,a)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>a(e.error)})}async function Nr(e){return await Lo(async a=>{let n=a.transaction(Me,"readonly").objectStore(Me).index(wo),i=(await Or(n.getAll(e))??[]).filter(xo);return i.sort((l,u)=>l.updatedAt<u.updatedAt?1:-1),i})??[]}async function Co(e){return await Lo(async a=>{let r=a.transaction(Me,"readonly").objectStore(Me),n=await Or(r.get(e));return xo(n)?n:null})??null}async function Ur(e){if(!xo(e))return;let t=e.messages.length>Zl?{...e,messages:e.messages.slice(e.messages.length-Zl)}:e;await Lo(async a=>{await new Promise((l,u)=>{let c=a.transaction(Me,"readwrite");c.oncomplete=()=>l(),c.onerror=()=>u(c.error),c.onabort=()=>u(c.error),c.objectStore(Me).put(t)});let o=a.transaction(Me,"readwrite"),r=o.objectStore(Me),n=r.index(wo),i=(await Or(n.getAll(t.memoryUserId))??[]).filter(xo);if(i.length>Jl){i.sort((u,c)=>u.updatedAt<c.updatedAt?-1:1);let l=i.slice(0,i.length-Jl);for(let u of l)r.delete(u.threadId)}return await new Promise((l,u)=>{o.oncomplete=()=>l(),o.onerror=()=>u(o.error),o.onabort=()=>u(o.error)}),null})}async function Yl(e){await Lo(async t=>(await new Promise((a,o)=>{let r=t.transaction(Me,"readwrite");r.oncomplete=()=>a(),r.onerror=()=>o(r.error),r.onabort=()=>o(r.error),r.objectStore(Me).delete(e)}),null))}async function Hr(e){return(await Nr(e))[0]?.threadId??null}function eu(e){let t=e.trim();if(!t)return`Conversation on ${new Date().toISOString().slice(0,10)}`;let a=t.split(/\r?\n/,1)[0]??t;return a.length<=60?a:`${a.slice(0,60).trimEnd()}\u2026`}f();var tu="waniwani-visitor-id";function au(e,t){return e.match(t)?.[1]??null}function jh(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,o]of t){let r=au(e,o);if(r)return{name:a,version:r}}return null}function zh(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,o]of t){let r=au(e,o);if(r)return{name:a,version:r.replace(/_/g,".")};if(a==="Linux"&&o.test(e))return{name:a,version:""}}return null}function Vh(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 $h(e){let t=new TextEncoder().encode(e),a=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(a)).map(o=>o.toString(16).padStart(2,"0")).join("")}async function Xh(){try{let a=localStorage.getItem(tu);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 $h(e);try{localStorage.setItem(tu,t)}catch{}return t}async function qr(){let e=navigator.userAgent,[t,a]=await Promise.all([Xh(),Ql()]);return{userAgent:e,browser:jh(e),os:zh(e),deviceType:Vh(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,memoryUserId:a}}var Qh="x-session-id",Jh=250;function ou(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Yt()}function Io(){return new Date().toISOString()}function ru(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}async function Zh(e,t){let a=Rt(e,"/tools"),o=await fetch(a,{method:"GET",headers:t?{...t}:void 0});if(!o.ok)throw new Error(`[Waniwani] Failed to fetch /tools: ${o.status} ${o.statusText}`);let r=await o.json();if(!r||!Array.isArray(r.tools))return{};let n={};for(let s of r.tools)s&&typeof s.name=="string"&&(n[s.name]=s);return n}function nu(e){let{api:t="/api/waniwani",headers:a,body:o,onMessageSent:r,onResponseReceived:n,enableThreadHistory:s=!1,activeThreadId:i,onThreadChange:l}=e,u=ce(a),c=ce(o),d=ce(s);Ee(()=>{d.current=s},[s]);let p=ce(void 0),m=ce(null),[h,I]=wt(void 0),L=ce(h),[S,C]=wt(i),x=ce(S),[y,P]=wt([]),[A,M]=wt(!s),R=ce(void 0),_=ce(void 0),D=ce(void 0),O=ce(void 0),k=ce(0),B=ce(l);Ee(()=>{B.current=l},[l]);let T=we(b=>{x.current=b,C(b),b&&B.current?.(b)},[]),v=we(async()=>{if(!s)return;let b=m.current?.memoryUserId;if(!b)return;let N=await Nr(b);P(N)},[s]),q=we(()=>L.current,[]),Le=we(b=>{let N=ru(b);N&&L.current!==N&&(L.current=N,I(N))},[]),ie=we(()=>{L.current=void 0,I(void 0)},[]);Ee(()=>{u.current=a},[a]),Ee(()=>{c.current=o},[o]),Ee(()=>{let b=!1,N=k.current;return(async()=>{try{let Ie=await qr();if(b)return;m.current=Ie}catch{}if(!s)return;let H=m.current?.memoryUserId;if(!H){M(!0);return}try{let Ie=i??await Hr(H);if(b||N!==k.current)return;if(Ie){let pe=await Co(Ie);if(b||N!==k.current)return;pe&&pe.memoryUserId===H&&(x.current=pe.threadId,C(pe.threadId),R.current=pe.createdAt,_.current=pe.title,pe.sessionId&&(L.current=pe.sessionId,I(pe.sessionId)),ne(pe.messages))}await v()}finally{b||M(!0)}})(),()=>{b=!0}},[]);let X=ce(new go({api:t,headers:()=>({...u.current}),body:()=>{let b={...c.current??{}},N=Object.hasOwn(b,"sessionId"),H=ru(b.sessionId);if(H)Le(H),b.sessionId=H;else if(N)ie(),delete b.sessionId;else{let De=q();De&&(b.sessionId=De)}if(Ct(p.current)&&(b.modelContext=p.current),m.current){let De=m.current;b.visitorContext={timezone:De.timezone,language:De.language,languages:De.languages,deviceType:De.deviceType,referrer:De.referrer,visitorId:De.visitorId};let ze=typeof b.visitor=="object"&&b.visitor!==null?b.visitor:{},ku=typeof ze.client=="object"&&ze.client!==null?ze.client:{};b.visitor={...ze,id:De.visitorId,client:{...ku,memoryUserId:De.memoryUserId}}}let Ie=typeof b.extra=="object"&&b.extra!==null&&!Array.isArray(b.extra)?b.extra:void 0,pe=m.current?.memoryUserId,ue=m.current?.language,Sa={};if(pe&&(Sa.memoryUserId=pe),ue&&(Sa.locale=ue),(Object.keys(Sa).length>0||Ie)&&(b.extra={...Sa,...Ie??{}}),d.current)if(Object.hasOwn(b,"threadId"))typeof b.threadId=="string"&&(x.current=b.threadId);else{let ze=x.current;ze||(ze=ou(),R.current=Io(),_.current=void 0,T(ze)),b.threadId=ze}return b},fetch:(async(b,N)=>{let H=await fetch(b,N);return p.current=void 0,Le(H.headers.get(Qh)),H})})),Ce=ce(null),Pe=ce(null),ye=ce({}),[ke,Ke]=wt(0),U=e.skipRemoteConfig===!0,fe=we(async()=>{if(!U)try{let b=await Zh(t,u.current);ye.current=b,Ke(N=>N+1)}catch(b){console.warn("[Waniwani] Failed to fetch tool definitions:",b instanceof Error?b.message:b)}},[t,U]);Ee(()=>{fe()},[fe]);let{messages:re,sendMessage:Z,setMessages:ne,status:G}=Kh({messages:e.initialMessages,transport:X.current,onFinish({message:b}){n?.(),Ce.current&&(Pe.current=b)},onError(b){console.warn("[Waniwani] Chat error:",b.message),Ce.current&&(Ce.current.reject(b),Ce.current=null)}}),V=ce(re);Ee(()=>{V.current=re},[re]);let K=ce(s);Ee(()=>{if(!s||K.current||(K.current=!0,V.current.length>0))return;let b=!1,N=k.current;return M(!1),(async()=>{try{let H=m.current;if(!H)try{H=await qr(),m.current=H}catch{}let Ie=H?.memoryUserId;if(!Ie||b||N!==k.current){b||M(!0);return}let pe=i??await Hr(Ie);if(b||N!==k.current)return;if(pe){let ue=await Co(pe);if(b||N!==k.current)return;ue&&ue.memoryUserId===Ie&&(x.current=ue.threadId,C(ue.threadId),R.current=ue.createdAt,_.current=ue.title,ue.sessionId&&(L.current=ue.sessionId,I(ue.sessionId)),ne(ue.messages))}await v()}finally{b||M(!0)}})(),()=>{b=!0}},[s]),Ee(()=>{if(G==="ready"&&Ce.current&&Pe.current){let b=Ce.current,N=Pe.current;Ce.current=null,Pe.current=null,b.resolve(N)}},[G]);let[ee,Y]=wt(""),[le,Te]=wt([]),Fe=G==="submitted"||G==="streaming",xt=we(b=>{Te(N=>N.filter(H=>H.id!==b))},[]),Lt=Fe&&le.length>0,wu=we(b=>{let N=!!b.text?.trim(),H=!!b.files?.length;if(N||H){if(Fe){if(le.length>0)return;Te(Ie=>[...Ie,{id:Yt(),text:b.text||"",files:b.files??[],modelContext:b.modelContext}]),Y("");return}p.current=b.modelContext,Z({text:b.text||"",files:b.files}),r?.(b.text||""),Y("")}},[Z,r,Fe,le.length]),xu=we(b=>new Promise((N,H)=>{Ce.current={resolve:N,reject:H},Z({text:b}),r?.(b)}),[Z,r]);Ee(()=>{if(G!=="ready"||le.length===0)return;let[b,...N]=le;Te(N),p.current=b.modelContext,Z({text:b.text,files:b.files.length>0?b.files:void 0}),r?.(b.text)},[G,Z,r,le]);let Lu=we(()=>{ne([]),Te([]),ie(),Y(""),ye.current={},Ke(b=>b+1),fe()},[ne,ie,fe]),Ca=we(()=>{if(!d.current)return;let b=m.current?.memoryUserId,N=x.current,H=V.current;if(!(!b||!N||H.length===0)){if(R.current||(R.current=Io()),!_.current){let Ie=H.find(ue=>ue.role==="user"),pe=Ie?Ie.parts.map(ue=>"text"in ue&&typeof ue.text=="string"?ue.text:"").join(" "):"";_.current=eu(pe)}return{threadId:N,memoryUserId:b,title:_.current,messages:H,sessionId:L.current,createdAt:R.current,updatedAt:Io()}}},[]),jr=we(async()=>{let b=Ca();b&&(await Ur(b),await v())},[Ca,v]);Ee(()=>{if(s&&A&&!(G==="submitted"||G==="streaming")&&re.length!==0)return D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{D.current=void 0;let b=jr().finally(()=>{O.current===b&&(O.current=void 0)});O.current=b},Jh),()=>{D.current&&clearTimeout(D.current)}},[s,A,re,G,jr]);let Ia=we(()=>{let b=O.current,N=D.current,H=N?Ca():void 0;return N&&(clearTimeout(N),D.current=void 0),(async()=>{b&&await b,H&&(await Ur(H),await v())})()},[Ca,v]),Cu=we(()=>{k.current+=1,Ia(),ne([]),Te([]),ie(),Y("");let b=ou();return R.current=Io(),_.current=void 0,T(b),v(),b},[ne,ie,T,v,Ia]),So=we(async b=>{k.current+=1;let N=k.current;if(await Ia(),N!==k.current)return;let H=await Co(b);N===k.current&&H&&(T(H.threadId),R.current=H.createdAt,_.current=H.title,H.sessionId?(L.current=H.sessionId,I(H.sessionId)):ie(),ne(H.messages),Te([]),Y(""))},[ne,ie,T,Ia]),Iu=we(async b=>{if(x.current===b){k.current+=1,D.current&&(clearTimeout(D.current),D.current=void 0);let N=O.current;N&&await N}await Yl(b),await v(),x.current===b&&(ne([]),Te([]),ie(),Y(""),x.current=void 0,C(void 0),R.current=void 0,_.current=void 0)},[ne,ie,v]);Ee(()=>{s&&A&&i!==void 0&&i!==x.current&&So(i)},[i,s,A,So]);let Su=we(b=>{Y(b.target.value)},[]),zr=re[re.length-1],Vr=re.length>0,yu=Fe&&(!Vr||zr.role==="user"),bu=ye.current;return{messages:re,status:G,text:ee,setText:Y,handleSubmit:wu,handleTextChange:Su,isLoading:Fe,showLoaderBubble:yu,lastMessage:zr,hasMessages:Vr,sendMessage:Z,sendMessageAndWait:xu,reset:Lu,queuedMessages:le,queueFull:Lt,removeQueuedMessage:xt,sessionId:h,toolDefinitions:bu,refreshToolDefinitions:fe,threads:y,activeThreadId:S,isThreadHistoryReady:A,startNewThread:Cu,switchThread:So,deleteThread:Iu}}f();import{useEffect as su,useRef as Yh,useState as eg}from"react";var tg={debug:!1,eval:!1};function iu(e="/api/waniwani",t,a=!1){let[o,r]=eg(tg),n=Yh(t);return su(()=>{n.current=t},[t]),su(()=>{a||(async()=>{try{let s=n.current,l=await(await fetch(Rt(e,"/config"),{headers:s?{...s}:void 0})).json();r({debug:l.debug===!0,eval:l.eval===!0})}catch{}})()},[e,a]),o}f();import{useCallback as ag,useEffect as Wr,useRef as og,useState as rg}from"react";function ng(e){for(let t of e.parts){let a=t;if(a.type==="data"||a.type==="data-suggestions"){let o=a.data;if(o&&Array.isArray(o.suggestions))return o.suggestions}}return null}function lu(e){return typeof e=="object"&&e!==null&&"initial"in e}function uu(e){let{messages:t,status:a,config:o}=e,r=lu(o)&&o.initial?o.initial:void 0,[n,s]=rg(r??[]),i=og(a),l=o===!0||lu(o)&&o.dynamic!==!1,u=ag(()=>{s([])},[]),c=t.length>0;Wr(()=>{!c&&r&&r.length>0&&s(r)},[r,c]);let d=t[t.length-1];return Wr(()=>{d?.role==="user"&&u()},[d,u]),Wr(()=>{let p=i.current;if(i.current=a,p==="streaming"&&a==="ready"&&l){let m=[...t].reverse().find(I=>I.role==="assistant");if(!m)return;let h=ng(m);h&&s(h)}},[a,l,t]),{suggestions:n,isLoading:!1,clear:u}}f();import{useEffect as sg,useRef as ig,useState as lg}from"react";var ug=80,dg=50,cg=15e3,du=500;function cu(e,t=!0){let[a,o]=lg(""),r=ig(void 0);return sg(()=>{if(!t){o("");return}let n=0,s=!1,i=!1,l=()=>{i||(s?(n--,o(e.slice(0,n)),n<=0?(s=!1,r.current=setTimeout(l,du)):r.current=setTimeout(l,dg)):(n++,o(e.slice(0,n)),n>=e.length?(s=!0,r.current=setTimeout(l,cg)):r.current=setTimeout(l,ug)))};return r.current=setTimeout(l,du),()=>{i=!0,clearTimeout(r.current)}},[e,t]),a}f();function fu(e,t){let a=t?.Authorization,o=typeof a=="string"&&a.startsWith("Bearer ")?a.slice(7):null;return Rt(e,"/resource",o?{token:o}:void 0)}f();var fg={primaryColor:"#6366f1",primaryForeground:"#1f2937",backgroundColor:"#ffffff",textColor:"#1f2937",mutedColor:"#6b7280",borderColor:"#e5e7eb",borderWidth:0,boxShadow:"none",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 pg={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"],borderWidth:["--ww-border-width"],boxShadow:["--ww-shadow"],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 pu(e){return{...fg,...e}}function mu(e){let t={};for(let[a,o]of Object.entries(pg)){let r=e[a];if(r===void 0)continue;let n=typeof r=="number"?`${r}px`:String(r);for(let s of o)t[s]=n}return t}import{jsx as xe,jsxs as La}from"react/jsx-runtime";var wg=mg(function(t,a){let{theme:o,title:r="Assistant",width:n,height:s,className:i,allowAttachments:l=!1,welcomeMessage:u,welcome:c,placeholder:d="Ask me anything...",triggerEvent:p="triggerDemoRequest",api:m,debug:h,enableThreadHistory:I=!1,showToolCalls:L=!0}=t,S=m??"/api/waniwani",C=fu(S,t.headers),x=pu(o),y=mu(x),P=x.backgroundColor.replace("#",""),A=parseInt(P.substring(0,2),16),M=parseInt(P.substring(2,4),16),R=parseInt(P.substring(4,6),16),_=(A*299+M*587+R*114)/1e3<128,D=iu(S,t.headers,t.skipRemoteConfig),O=h??D.debug,k=nu({...t,api:S}),B=$l({...t,api:S,sessionId:k.sessionId}),T=cu(d,!k.text),[v,q]=gu(!1),[Le,ie]=gu(null),X=hu(null),Ce=hu(void 0),Pe=Gr(()=>{let U=X.current;if(!U)return;U.scrollIntoView({behavior:"smooth",block:"center"});let fe=U.querySelector("textarea");fe&&setTimeout(()=>fe.focus(),300),q(!0),clearTimeout(Ce.current),Ce.current=setTimeout(()=>q(!1),2e3)},[]),ye=uu({messages:k.messages,status:k.status,config:t.suggestions}),ke=Gr(U=>{let fe=U.content.map(re=>re.text??"").join("").trim();fe&&k.handleSubmit({text:fe,files:[],modelContext:U.modelContext})},[k.handleSubmit]),Ke=Gr(U=>{ye.clear(),k.handleSubmit({text:U,files:[]})},[ye.clear,k.handleSubmit]);return gg(a,()=>({sendMessage:U=>{k.handleSubmit({text:U,files:[]}),Pe()},sendMessageAndWait:U=>k.sendMessageAndWait(U),reset:k.reset,focus:Pe,get messages(){return k.messages},get sessionId(){return k.sessionId}}),[k.handleSubmit,k.sendMessageAndWait,k.reset,k.messages,k.sessionId,Pe]),hg(()=>{if(!p)return;let U=fe=>{let re=fe.detail,Z=typeof re?.message=="string"?re.message:void 0;Z&&k.handleSubmit({text:Z,files:[]}),Pe()};return window.addEventListener(p,U),()=>window.removeEventListener(p,U)},[p,k.handleSubmit,Pe]),La("div",{ref:X,style:{...y,width:n,height:s},"data-waniwani-chat":"","data-waniwani-layout":"card",..._?{"data-waniwani-dark":""}:{},className:F("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",v&&"ww:ring-2 ww:ring-blue-400/70 ww:ring-offset-2 ww:ring-offset-background",i),children:[La("div",{className:"ww:shrink-0 ww:flex ww:items-center ww:gap-2 ww:px-6 ww:py-3",style:{backgroundColor:x.headerBackgroundColor,color:x.headerTextColor},children:[xe("div",{className:"ww:text-sm ww:font-semibold ww:truncate ww:flex-1 ww:min-w-0",children:r}),xe(Ps,{messages:k.messages,evalEnabled:D.eval,api:S}),I&&xe(Vl,{threads:k.threads,activeThreadId:k.activeThreadId,onNewThread:k.startNewThread,onSelectThread:U=>{k.switchThread(U)},onDeleteThread:U=>{k.deleteThread(U)}})]}),La(ns,{className:"ww:flex-1 ww:min-h-0 ww:bg-background",children:[xe(ss,{scrollClassName:Le?"ww:!relative ww:!overflow-hidden":void 0,children:xe(ql,{messages:k.messages,status:k.status,welcomeMessage:u,welcome:c,onSuggestionSelect:Ke,resourceEndpoint:C,chatSessionId:k.sessionId,isDark:_,onFollowUp:ke,onCallTool:B,fullscreenToolCallId:Le,debug:O,showToolCalls:L,toolDefinitions:k.toolDefinitions,onWidgetDisplayModeChange:(U,fe)=>{ie(U==="fullscreen"?fe.toolCallId:null)}})}),xe(is,{})]}),xe("div",{style:Le?{display:"none"}:void 0,children:xe(jl,{suggestions:ye.suggestions,isLoading:ye.isLoading,onSelect:Ke})}),xe("div",{style:Le?{display:"none"}:void 0,children:xe(ks,{queuedMessages:k.queuedMessages,onRemove:k.removeQueuedMessage})}),xe("div",{style:Le?{display:"none"}:void 0,children:xe("div",{className:"ww:shrink-0 ww:px-4 ww:pb-8 ww:pt-2 ww:bg-background",children:La("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:[xe(ps,{onSubmit:k.handleSubmit,globalDrop:l,multiple:l,className:"ww:rounded-2xl ww:border-border ww:bg-input",children:La("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[l&&xe(gs,{}),xe(ms,{onChange:k.handleTextChange,value:k.text,placeholder:T,className:"ww:min-h-0 ww:py-1 ww:px-0"}),xe(hs,{status:k.status,disabled:k.queueFull})]})}),xe(Gl,{})]})})})]})});export{wg as ChatCard,mn as DevModeProvider,Du as InitializeNextJsInIframe,md as LoadingWidget,Sn as WidgetProvider,un as createResource,Au as createTool,yo as detectPlatform,va as getMockState,Et as initializeMockOpenAI,vu as isMCPApps,Tu as isOpenAI,Ru as registerTools,DL as toNextJsHandler,xn as unstable_useSendFollowUpWithGhostGuard,Ot as updateMockDisplayMode,ot as updateMockGlobal,Nt as updateMockTheme,_t as updateMockToolOutput,yn as useCallTool,bn as useDisplayMode,kn as useFlowAction,Tn as useIsChatGptApp,vn as useLocale,Pn as useMaxHeight,An as useOpenExternal,Rn as useRequestDisplayMode,Mn as useSafeArea,Fn as useSendFollowUp,Dn as useTheme,Aa as useToolOutput,Bn as useToolResponseMetadata,En as useUpdateModelContext,z as useWidgetClient,_n as useWidgetState};
83
83
  /*! Bundled license information:
84
84