@cuadra-ai/uikit 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/uikit.css +1 -1
- package/dist/widget/cuadra-uikit.css +1 -1
- package/dist/widget/cuadra-uikit.umd.js +1 -1
- package/dist/widget/cuadra-uikit.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
`))+1))}const a="#".repeat(i),l=t.enter("headingAtx"),s=t.enter("phrasing");o.move(a+" ");let u=t.containerPhrasing(e,{before:"# ",after:`
|
|
16
16
|
`,...o.current()});return/^[\t ]/.test(u)&&(u=X(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,t.options.closeAtx&&(u+=" "+a),s(),l(),u}ot.peek=mn;function ot(e){return e.value||""}function mn(){return"<"}st.peek=pn;function st(e,r,t,n){const i=ve(t),o=i==='"'?"Quote":"Apostrophe",a=t.enter("image");let l=t.enter("label");const s=t.createTracker(n);let u=s.move("![");return u+=s.move(t.safe(e.alt,{before:u,after:"]",...s.current()})),u+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=t.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(t.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=t.enter("destinationRaw"),u+=s.move(t.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=t.enter(`title${o}`),u+=s.move(" "+i),u+=s.move(t.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),a(),u}function pn(){return"!"}lt.peek=gn;function lt(e,r,t,n){const i=e.referenceType,o=t.enter("imageReference");let a=t.enter("label");const l=t.createTracker(n);let s=l.move("![");const u=t.safe(e.alt,{before:s,after:"]",...l.current()});s+=l.move(u+"]["),a();const f=t.stack;t.stack=[],a=t.enter("reference");const c=t.safe(t.associationId(e),{before:s,after:"]",...l.current()});return a(),t.stack=f,o(),i==="full"||!u||u!==c?s+=l.move(c+"]"):i==="shortcut"?s=s.slice(0,-1):s+=l.move("]"),s}function gn(){return"!"}ut.peek=xn;function ut(e,r,t){let n=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++o<t.unsafe.length;){const a=t.unsafe[o],l=t.compilePattern(a);let s;if(a.atBreak)for(;s=l.exec(n);){let u=s.index;n.charCodeAt(u)===10&&n.charCodeAt(u-1)===13&&u--,n=n.slice(0,u)+" "+n.slice(s.index+1)}}return i+n+i}function xn(){return"`"}function ct(e,r){const t=at(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(t===e.url||"mailto:"+t===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}dt.peek=bn;function dt(e,r,t,n){const i=ve(t),o=i==='"'?"Quote":"Apostrophe",a=t.createTracker(n);let l,s;if(ct(e,t)){const f=t.stack;t.stack=[],l=t.enter("autolink");let c=a.move("<");return c+=a.move(t.containerPhrasing(e,{before:c,after:">",...a.current()})),c+=a.move(">"),l(),t.stack=f,c}l=t.enter("link"),s=t.enter("label");let u=a.move("[");return u+=a.move(t.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=t.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(t.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(s=t.enter("destinationRaw"),u+=a.move(t.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),s(),e.title&&(s=t.enter(`title${o}`),u+=a.move(" "+i),u+=a.move(t.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),s()),u+=a.move(")"),l(),u}function bn(e,r,t){return ct(e,t)?"<":"["}ft.peek=kn;function ft(e,r,t,n){const i=e.referenceType,o=t.enter("linkReference");let a=t.enter("label");const l=t.createTracker(n);let s=l.move("[");const u=t.containerPhrasing(e,{before:s,after:"]",...l.current()});s+=l.move(u+"]["),a();const f=t.stack;t.stack=[],a=t.enter("reference");const c=t.safe(t.associationId(e),{before:s,after:"]",...l.current()});return a(),t.stack=f,o(),i==="full"||!u||u!==c?s+=l.move(c+"]"):i==="shortcut"?s=s.slice(0,-1):s+=l.move("]"),s}function kn(){return"["}function je(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function wn(e){const r=je(e),t=e.options.bulletOther;if(!t)return r==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+t+"`) to be different");return t}function yn(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function ht(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function Cn(e,r,t,n){const i=t.enter("list"),o=t.bulletCurrent;let a=e.ordered?yn(t):je(t);const l=e.ordered?a==="."?")":".":wn(t);let s=r&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!e.ordered){const f=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(s=!0),ht(t)===a&&f){let c=-1;for(;++c<e.children.length;){const p=e.children[c];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){s=!0;break}}}}s&&(a=l),t.bulletCurrent=a;const u=t.containerFlow(e,n);return t.bulletLastUsed=a,t.bulletCurrent=o,i(),u}function vn(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function jn(e,r,t,n){const i=vn(t);let o=t.bulletCurrent||je(t);r&&r.type==="list"&&r.ordered&&(o=(typeof r.start=="number"&&r.start>-1?r.start:1)+(t.options.incrementListMarker===!1?0:r.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=t.createTracker(n);l.move(o+" ".repeat(a-o.length)),l.shift(a);const s=t.enter("listItem"),u=t.indentLines(t.containerFlow(e,l.current()),f);return s(),u;function f(c,p,x){return p?(x?"":" ".repeat(a))+c:(x?o:o+" ".repeat(a-o.length))+c}}function Tn(e,r,t,n){const i=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(e,n);return o(),i(),a}const An=ue(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function In(e,r,t,n){return(e.children.some(function(a){return An(a)})?t.containerPhrasing:t.containerFlow).call(t,e,n)}function Sn(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}mt.peek=Nn;function mt(e,r,t,n){const i=Sn(t),o=t.enter("strong"),a=t.createTracker(n),l=a.move(i+i);let s=a.move(t.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=s.charCodeAt(0),f=oe(n.before.charCodeAt(n.before.length-1),u,i);f.inside&&(s=X(u)+s.slice(1));const c=s.charCodeAt(s.length-1),p=oe(n.after.charCodeAt(0),c,i);p.inside&&(s=s.slice(0,-1)+X(c));const x=a.move(i+i);return o(),t.attentionEncodeSurroundingInfo={after:p.outside,before:f.outside},l+s+x}function Nn(e,r,t){return t.options.strong||"*"}function Mn(e,r,t,n){return t.safe(e.value,n)}function Ln(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function Pn(e,r,t){const n=(ht(t)+(t.options.ruleSpaces?" ":"")).repeat(Ln(t));return t.options.ruleSpaces?n.slice(0,-1):n}const pt={blockquote:Qr,break:_e,code:nn,definition:on,emphasis:nt,hardBreak:_e,heading:hn,html:ot,image:st,imageReference:lt,inlineCode:ut,link:dt,linkReference:ft,list:Cn,listItem:jn,paragraph:Tn,root:In,strong:mt,text:Mn,thematicBreak:Pn};function Dn(){return{enter:{table:Rn,tableData:$e,tableHeader:$e,tableRow:En},exit:{codeText:_n,table:Fn,tableData:ge,tableHeader:ge,tableRow:ge}}}function Rn(e){const r=e._align;this.enter({type:"table",align:r.map(function(t){return t==="none"?null:t}),children:[]},e),this.data.inTable=!0}function Fn(e){this.exit(e),this.data.inTable=void 0}function En(e){this.enter({type:"tableRow",children:[]},e)}function ge(e){this.exit(e)}function $e(e){this.enter({type:"tableCell",children:[]},e)}function _n(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,zn));const t=this.stack[this.stack.length-1];t.type,t.value=r,this.exit(e)}function zn(e,r){return r==="|"?r:e}function $n(e){const r=e||{},t=r.tableCellPadding,n=r.tablePipeAlign,i=r.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
17
17
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:a,tableCell:s,tableRow:l}};function a(x,h,b,g){return u(f(x,b,g),x.align)}function l(x,h,b,g){const k=c(x,b,g),y=u([k]);return y.slice(0,y.indexOf(`
|
|
18
|
-
`))}function s(x,h,b,g){const k=b.enter("tableCell"),y=b.enter("phrasing"),C=b.containerPhrasing(x,{...g,before:o,after:o});return y(),k(),C}function u(x,h){return Zr(x,{align:h,alignDelimiters:n,padding:t,stringLength:i})}function f(x,h,b){const g=x.children;let k=-1;const y=[],C=h.enter("table");for(;++k<g.length;)y[k]=c(g[k],h,b);return C(),y}function c(x,h,b){const g=x.children;let k=-1;const y=[],C=h.enter("tableRow");for(;++k<g.length;)y[k]=s(g[k],x,h,b);return C(),y}function p(x,h,b){let g=pt.inlineCode(x,h,b);return b.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function On(){return{exit:{taskListCheckValueChecked:Oe,taskListCheckValueUnchecked:Oe,paragraph:Bn}}}function Un(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Wn}}}function Oe(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function Bn(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const n=t.children[0];if(n&&n.type==="text"){const i=r.children;let o=-1,a;for(;++o<i.length;){const l=i[o];if(l.type==="paragraph"){a=l;break}}a===t&&(n.value=n.value.slice(1),n.value.length===0?t.children.shift():t.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,t.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Wn(e,r,t,n){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",l=t.createTracker(n);o&&l.move(a);let s=pt.listItem(e,r,t,{...n,...l.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(f){return f+a}}function Hn(){return[br(),$r(),Wr(),Dn(),On()]}function qn(e){return{extensions:[kr(),Or(e),Hr(),$n(e),Un()]}}function ae(e,r,t,n){const i=e.length;let o=0,a;if(r<0?r=-r>i?0:i+r:r=r>i?i:r,t=t>0?t:0,n.length<1e4)a=Array.from(n),a.unshift(r,t),e.splice(...a);else for(t&&e.splice(r,t);o<n.length;)a=n.slice(o,o+1e4),a.unshift(r,0),e.splice(...a),o+=1e4,r+=1e4}const Ue={}.hasOwnProperty;function Kn(e){const r={};let t=-1;for(;++t<e.length;)Vn(r,e[t]);return r}function Vn(e,r){let t;for(t in r){const i=(Ue.call(e,t)?e[t]:void 0)||(e[t]={}),o=r[t];let a;if(o)for(a in o){Ue.call(i,a)||(i[a]=[]);const l=o[a];Gn(i[a],Array.isArray(l)?l:l?[l]:[])}}}function Gn(e,r){let t=-1;const n=[];for(;++t<r.length;)(r[t].add==="after"?e:n).push(r[t]);ae(e,0,0,n)}const Zn={tokenize:ta,partial:!0},gt={tokenize:ra,partial:!0},xt={tokenize:na,partial:!0},bt={tokenize:aa,partial:!0},Jn={tokenize:ia,partial:!0},kt={name:"wwwAutolink",tokenize:Yn,previous:yt},wt={name:"protocolAutolink",tokenize:ea,previous:Ct},z={name:"emailAutolink",tokenize:Xn,previous:vt},P={};function Qn(){return{text:P}}let O=48;for(;O<123;)P[O]=z,O++,O===58?O=65:O===91&&(O=97);P[43]=z;P[45]=z;P[46]=z;P[95]=z;P[72]=[z,wt];P[104]=[z,wt];P[87]=[z,kt];P[119]=[z,kt];function Xn(e,r,t){const n=this;let i,o;return a;function a(c){return!ye(c)||!vt.call(n,n.previous)||Te(n.events)?t(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(c))}function l(c){return ye(c)?(e.consume(c),l):c===64?(e.consume(c),s):t(c)}function s(c){return c===46?e.check(Jn,f,u)(c):c===45||c===95||Ce(c)?(o=!0,e.consume(c),s):f(c)}function u(c){return e.consume(c),i=!0,s}function f(c){return o&&i&&Q(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(c)):t(c)}}function Yn(e,r,t){const n=this;return i;function i(a){return a!==87&&a!==119||!yt.call(n,n.previous)||Te(n.events)?t(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Zn,e.attempt(gt,e.attempt(xt,o),t),t)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(a)}}function ea(e,r,t){const n=this;let i="",o=!1;return a;function a(c){return(c===72||c===104)&&Ct.call(n,n.previous)&&!Te(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),l):t(c)}function l(c){if(Q(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),l;if(c===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(c),s}return t(c)}function s(c){return c===47?(e.consume(c),o?u:(o=!0,s)):t(c)}function u(c){return c===null||ar(c)||N(c)||U(c)||se(c)?t(c):e.attempt(gt,e.attempt(xt,f),t)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(c)}}function ta(e,r,t){let n=0;return i;function i(a){return(a===87||a===119)&&n<3?(n++,e.consume(a),i):a===46&&n===3?(e.consume(a),o):t(a)}function o(a){return a===null?t(a):r(a)}}function ra(e,r,t){let n,i,o;return a;function a(u){return u===46||u===95?e.check(bt,s,l)(u):u===null||N(u)||U(u)||u!==45&&se(u)?s(u):(o=!0,e.consume(u),a)}function l(u){return u===95?n=!0:(i=n,n=void 0),e.consume(u),a}function s(u){return i||n||!o?t(u):r(u)}}function na(e,r){let t=0,n=0;return i;function i(a){return a===40?(t++,e.consume(a),i):a===41&&n<t?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(bt,r,o)(a):a===null||N(a)||U(a)?r(a):(e.consume(a),i)}function o(a){return a===41&&n++,e.consume(a),i}}function aa(e,r,t){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),o):l===93?(e.consume(l),i):l===60||l===null||N(l)||U(l)?r(l):t(l)}function i(l){return l===null||l===40||l===91||N(l)||U(l)?r(l):n(l)}function o(l){return Q(l)?a(l):t(l)}function a(l){return l===59?(e.consume(l),n):Q(l)?(e.consume(l),a):t(l)}}function ia(e,r,t){return n;function n(o){return e.consume(o),i}function i(o){return Ce(o)?t(o):r(o)}}function yt(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||N(e)}function Ct(e){return!Q(e)}function vt(e){return!(e===47||ye(e))}function ye(e){return e===43||e===45||e===46||e===95||Ce(e)}function Te(e){let r=e.length,t=!1;for(;r--;){const n=e[r][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){t=!0;break}if(n._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}function oa(e,r,t){const n=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!n.includes(o)&&(r=o(r,t),n.push(o))}return r}function E(e,r,t,n){const i=n?n-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(s){return F(s)?(e.enter(t),l(s)):r(s)}function l(s){return F(s)&&o++<i?(e.consume(s),l):(e.exit(t),r(s))}}const sa={partial:!0,tokenize:la};function la(e,r,t){return n;function n(o){return F(o)?E(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||K(o)?r(o):t(o)}}const ua={tokenize:xa,partial:!0};function ca(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ma,continuation:{tokenize:pa},exit:ga}},text:{91:{name:"gfmFootnoteCall",tokenize:ha},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:da,resolveTo:fa}}}}function da(e,r,t){const n=this;let i=n.events.length;const o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a;for(;i--;){const s=n.events[i][1];if(s.type==="labelImage"){a=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return l;function l(s){if(!a||!a._balanced)return t(s);const u=Y(n.sliceSerialize({start:a.end,end:n.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?t(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),r(s))}}function fa(e,r){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[t+1],e[t+2],["enter",n,r],e[t+3],e[t+4],["enter",i,r],["exit",i,r],["enter",o,r],["enter",a,r],["exit",a,r],["exit",o,r],e[e.length-2],e[e.length-1],["exit",n,r]];return e.splice(t,e.length-t+1,...l),e}function ha(e,r,t){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o=0,a;return l;function l(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),s}function s(c){return c!==94?t(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!a||c===null||c===91||N(c))return t(c);if(c===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(Y(n.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):t(c)}return N(c)||(a=!0),o++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function ma(e,r,t){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o,a=0,l;return s;function s(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):t(h)}function f(h){if(a>999||h===93&&!l||h===null||h===91||N(h))return t(h);if(h===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return o=Y(n.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return N(h)||(l=!0),a++,e.consume(h),h===92?c:f}function c(h){return h===91||h===92||h===93?(e.consume(h),a++,f):f(h)}function p(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(o)||i.push(o),E(e,x,"gfmFootnoteDefinitionWhitespace")):t(h)}function x(h){return r(h)}}function pa(e,r,t){return e.check(sa,r,e.attempt(ua,r,t))}function ga(e){e.exit("gfmFootnoteDefinition")}function xa(e,r,t){const n=this;return E(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=n.events[n.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?r(o):t(o)}}function ba(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:o,resolveAll:i};return t==null&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(a,l){let s=-1;for(;++s<a.length;)if(a[s][0]==="enter"&&a[s][1].type==="strikethroughSequenceTemporary"&&a[s][1]._close){let u=s;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[s][1].end.offset-a[s][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[s][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[s][1].end)},c={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[s][1].start)},p=[["enter",f,l],["enter",a[u][1],l],["exit",a[u][1],l],["enter",c,l]],x=l.parser.constructs.insideSpan.null;x&&ae(p,p.length,0,oa(x,a.slice(u+1,s),l)),ae(p,p.length,0,[["exit",c,l],["enter",a[s][1],l],["exit",a[s][1],l],["exit",f,l]]),ae(a,u-1,s-u+3,p),s=u+p.length-2;break}}for(s=-1;++s<a.length;)a[s][1].type==="strikethroughSequenceTemporary"&&(a[s][1].type="data");return a}function o(a,l,s){const u=this.previous,f=this.events;let c=0;return p;function p(h){return u===126&&f[f.length-1][1].type!=="characterEscape"?s(h):(a.enter("strikethroughSequenceTemporary"),x(h))}function x(h){const b=ie(u);if(h===126)return c>1?s(h):(a.consume(h),c++,x);if(c<2&&!t)return s(h);const g=a.exit("strikethroughSequenceTemporary"),k=ie(h);return g._open=!k||k===2&&!!b,g._close=!b||b===2&&!!k,l(h)}}}class ka{constructor(){this.map=[]}add(r,t,n){wa(this,r,t,n)}consume(r){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(r.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),r.length=this.map[t][0];n.push(r.slice()),r.length=0;let i=n.pop();for(;i;){for(const o of i)r.push(o);i=n.pop()}this.map.length=0}}function wa(e,r,t,n){let i=0;if(!(t===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===r){e.map[i][1]+=t,e.map[i][2].push(...n);return}i+=1}e.map.push([r,t,n])}}function ya(e,r){let t=!1;const n=[];for(;r<e.length;){const i=e[r];if(t){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const o=n.length-1;n[o]=n[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(t=!0);r+=1}return n}function Ca(){return{flow:{null:{name:"table",tokenize:va,resolveAll:ja}}}}function va(e,r,t){const n=this;let i=0,o=0,a;return l;function l(m){let L=n.events.length-1;for(;L>-1;){const V=n.events[L][1].type;if(V==="lineEnding"||V==="linePrefix")L--;else break}const ee=L>-1?n.events[L][1].type:null,$=ee==="tableHead"||ee==="tableRow"?v:s;return $===v&&n.parser.lazy[n.now().line]?t(m):$(m)}function s(m){return e.enter("tableHead"),e.enter("tableRow"),u(m)}function u(m){return m===124||(a=!0,o+=1),f(m)}function f(m){return m===null?t(m):K(m)?o>1?(o=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),x):t(m):F(m)?E(e,f,"whitespace")(m):(o+=1,a&&(a=!1,i+=1),m===124?(e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),a=!0,f):(e.enter("data"),c(m)))}function c(m){return m===null||m===124||N(m)?(e.exit("data"),f(m)):(e.consume(m),m===92?p:c)}function p(m){return m===92||m===124?(e.consume(m),c):c(m)}function x(m){return n.interrupt=!1,n.parser.lazy[n.now().line]?t(m):(e.enter("tableDelimiterRow"),a=!1,F(m)?E(e,h,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):h(m))}function h(m){return m===45||m===58?g(m):m===124?(a=!0,e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),b):j(m)}function b(m){return F(m)?E(e,g,"whitespace")(m):g(m)}function g(m){return m===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(m),e.exit("tableDelimiterMarker"),k):m===45?(o+=1,k(m)):m===null||K(m)?A(m):j(m)}function k(m){return m===45?(e.enter("tableDelimiterFiller"),y(m)):j(m)}function y(m){return m===45?(e.consume(m),y):m===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(m),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(m))}function C(m){return F(m)?E(e,A,"whitespace")(m):A(m)}function A(m){return m===124?h(m):m===null||K(m)?!a||i!==o?j(m):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(m)):j(m)}function j(m){return t(m)}function v(m){return e.enter("tableRow"),M(m)}function M(m){return m===124?(e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),M):m===null||K(m)?(e.exit("tableRow"),r(m)):F(m)?E(e,M,"whitespace")(m):(e.enter("data"),D(m))}function D(m){return m===null||m===124||N(m)?(e.exit("data"),M(m)):(e.consume(m),m===92?B:D)}function B(m){return m===92||m===124?(e.consume(m),D):D(m)}}function ja(e,r){let t=-1,n=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],l=!1,s=0,u,f,c;const p=new ka;for(;++t<e.length;){const x=e[t],h=x[1];x[0]==="enter"?h.type==="tableHead"?(l=!1,s!==0&&(Be(p,r,s,u,f),f=void 0,s=0),u={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},p.add(t,0,[["enter",u,r]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(n=!0,c=void 0,o=[0,0,0,0],a=[0,t+1,0,0],l&&(l=!1,f={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},p.add(t,0,[["enter",f,r]])),i=h.type==="tableDelimiterRow"?2:f?3:1):i&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(n=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],c=ne(p,r,o,i,void 0,c),o=[0,0,0,0]),a[2]=t)):h.type==="tableCellDivider"&&(n?n=!1:(o[1]!==0&&(a[0]=a[1],c=ne(p,r,o,i,void 0,c)),o=a,a=[o[1],t,0,0])):h.type==="tableHead"?(l=!0,s=t):h.type==="tableRow"||h.type==="tableDelimiterRow"?(s=t,o[1]!==0?(a[0]=a[1],c=ne(p,r,o,i,t,c)):a[1]!==0&&(c=ne(p,r,a,i,t,c)),i=0):i&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=t)}for(s!==0&&Be(p,r,s,u,f),p.consume(r.events),t=-1;++t<r.events.length;){const x=r.events[t];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=ya(r.events,t))}return e}function ne(e,r,t,n,i,o){const a=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";t[0]!==0&&(o.end=Object.assign({},q(r.events,t[0])),e.add(t[0],0,[["exit",o,r]]));const s=q(r.events,t[1]);if(o={type:a,start:Object.assign({},s),end:Object.assign({},s)},e.add(t[1],0,[["enter",o,r]]),t[2]!==0){const u=q(r.events,t[2]),f=q(r.events,t[3]),c={type:l,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(t[2],0,[["enter",c,r]]),n!==2){const p=r.events[t[2]],x=r.events[t[3]];if(p[1].end=Object.assign({},x[1].end),p[1].type="chunkText",p[1].contentType="text",t[3]>t[2]+1){const h=t[2]+1,b=t[3]-t[2]-1;e.add(h,b,[])}}e.add(t[3]+1,0,[["exit",c,r]])}return i!==void 0&&(o.end=Object.assign({},q(r.events,i)),e.add(i,0,[["exit",o,r]]),o=void 0),o}function Be(e,r,t,n,i){const o=[],a=q(r.events,t);i&&(i.end=Object.assign({},a),o.push(["exit",i,r])),n.end=Object.assign({},a),o.push(["exit",n,r]),e.add(t+1,0,o)}function q(e,r){const t=e[r],n=t[0]==="enter"?"start":"end";return t[1][n]}const Ta={name:"tasklistCheck",tokenize:Ia};function Aa(){return{text:{91:Ta}}}function Ia(e,r,t){const n=this;return i;function i(s){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?t(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return N(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),a):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),a):t(s)}function a(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):t(s)}function l(s){return K(s)?r(s):F(s)?e.check({tokenize:Sa},r,t)(s):t(s)}}function Sa(e,r,t){return E(e,n,"whitespace");function n(i){return i===null?t(i):r(i)}}function Na(e){return Kn([Qn(),ca(),ba(e),Ca(),Aa()])}const Ma={};function La(e){const r=this,t=e||Ma,n=r.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(Na(t)),o.push(Hn()),a.push(qn(t))}function I(...e){return e.filter(Boolean).join(" ")}const Pa=({content:e})=>d.jsx(ke.MarkdownTextPrimitive,{remarkPlugins:[La],className:"cuadra-aui-md",components:Fa,children:e}),jt=w.memo(Pa),Da=({language:e,code:r})=>{const{isCopied:t,copyToClipboard:n}=Ra(),i=()=>{!r||t||n(r)};return d.jsxs("div",{className:"cuadra-flex cuadra-items-center cuadra-justify-between cuadra-gap-4 cuadra-mt-4 cuadra-rounded-t-lg cuadra-bg-muted/50 cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-2 cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-font-brand",children:[d.jsx("span",{className:"cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand",children:e}),d.jsxs("button",{onClick:i,className:"cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors","aria-label":"Copy code",children:[!t&&d.jsx(Wt,{className:"cuadra-h-4 cuadra-w-4"}),t&&d.jsx(_t,{className:"cuadra-h-4 cuadra-w-4"})]})]})},Ra=({copiedDuration:e=3e3}={})=>{const[r,t]=w.useState(!1);return{isCopied:r,copyToClipboard:i=>{i&&navigator.clipboard.writeText(i).then(()=>{t(!0),setTimeout(()=>t(!1),e)})}}},Fa=ke.unstable_memoizeMarkdownComponents({h1:({className:e,...r})=>d.jsx("h1",{className:I("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand",e),...r}),h2:({className:e,...r})=>d.jsx("h2",{className:I("cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h3:({className:e,...r})=>d.jsx("h3",{className:I("cuadra-mb-3 cuadra-mt-5 cuadra-scroll-m-20 cuadra-text-lg cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h4:({className:e,...r})=>d.jsx("h4",{className:I("cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h5:({className:e,...r})=>d.jsx("h5",{className:I("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h6:({className:e,...r})=>d.jsx("h6",{className:I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand",e),...r}),p:({className:e,...r})=>d.jsx("p",{className:I("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),a:({className:e,...r})=>d.jsx("a",{className:I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand",e),...r}),blockquote:({className:e,...r})=>d.jsx("blockquote",{className:I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand",e),...r}),ul:({className:e,...r})=>d.jsx("ul",{className:I("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand",e),...r}),ol:({className:e,...r})=>d.jsx("ol",{className:I("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand",e),...r}),hr:({className:e,...r})=>d.jsx("hr",{className:I("cuadra-my-5 cuadra-border-b",e),...r}),table:({className:e,...r})=>d.jsx("table",{className:I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand",e),...r}),th:({className:e,...r})=>d.jsx("th",{className:I("cuadra-bg-muted cuadra-px-4 cuadra-py-2 cuadra-text-left cuadra-font-normal first:cuadra-rounded-tl-lg last:cuadra-rounded-tr-lg [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",e),...r}),td:({className:e,...r})=>d.jsx("td",{className:I("cuadra-border-b cuadra-border-l cuadra-px-4 cuadra-py-2 cuadra-text-left last:cuadra-border-r [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",e),...r}),tr:({className:e,...r})=>d.jsx("tr",{className:I("cuadra-m-0 cuadra-border-b cuadra-p-0 first:cuadra-border-t [&:last-child>td:first-child]:cuadra-rounded-bl-lg [&:last-child>td:last-child]:cuadra-rounded-br-lg",e),...r}),sup:({className:e,...r})=>d.jsx("sup",{className:I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand",e),...r}),pre:({className:e,...r})=>d.jsx("pre",{className:I("cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",e),...r}),code:function({className:r,...t}){const n=ke.useIsMarkdownCodeBlock();return d.jsx("code",{className:I(!n&&"cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand",r),...t})},CodeHeader:Da}),We=["Sending question…","Understanding your need…","Scanning data…","Comparing results…","Composing answer…"];function Ea({active:e}){const[r,t]=w.useState(0);return w.useEffect(()=>{if(!e){t(0);return}const n=window.setInterval(()=>{t(i=>i>=We.length-1?(window.clearInterval(n),i):i+1)},2500);return()=>window.clearInterval(n)},[e]),e?d.jsxs("span",{className:"cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand",children:["Thinking… ",We[r]]}):null}function He({welcomeTitle:e="Hi, how can I help you today?",welcomeSubtitle:r="Start exploring our platform and discover what you can build.",extraTopPadding:t,suggestions:n,inputPlaceholder:i="Type your message..."}={}){const o=T.useThreadRuntime(),[a,l]=w.useState(!1),[s,u]=w.useState(null),[f,c]=w.useState(!1);return w.useEffect(()=>{if(!o){l(!1);return}try{const p=o?.store;if(!p){l(!1);return}const x=p.subscribe?.(b=>{const g=b?.threadId,k=b?.messages||[],y=b?.isLoadingHistory||!1,C=k.length;g&&g!==s&&u(g),l(y&&C===0);const j=k.some(v=>v.role==="assistant"&&!!v.content&&(Array.isArray(v.content)?v.content.some(M=>typeof M=="object"&&M?.text?M.text.trim().length>0:!1):typeof v.content=="string"?v.content.trim().length>0:!1));c(j)}),h=p.getState?.();if(h){const b=h?.threadId,g=h?.messages||[],k=h?.isLoadingHistory||!1,y=g.length;b&&b!==s&&u(b),l(k&&y===0);const A=g.some(j=>j.role==="assistant"&&!!j.content&&(Array.isArray(j.content)?j.content.some(v=>typeof v=="object"&&v?.text?v.text.trim().length>0:!1):typeof j.content=="string"?j.content.trim().length>0:!1));c(A)}return()=>{x&&x()}}catch{l(!1)}},[o,s]),d.jsxs(T.ThreadPrimitive.Root,{className:"cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full",children:[d.jsx(T.ThreadPrimitive.Viewport,{className:"cuadra-w-full cuadra-bg-inherit cuadra-px-4 cuadra-flex-1 cuadra-min-h-0 cuadra-overflow-y-auto cuadra-relative scrollbar-thin cuadra-pt-4",style:t?{paddingTop:t}:void 0,children:a?d.jsx("div",{className:"cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center",children:d.jsxs("div",{className:"cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2",children:[d.jsx(Ge,{className:"cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground"}),d.jsx("p",{className:"cuadra-text-sm cuadra-text-muted-foreground font-brand",children:"Loading messages..."})]})}):d.jsxs(d.Fragment,{children:[d.jsx(T.ThreadPrimitive.Empty,{children:d.jsx(_a,{title:e,subtitle:r,suggestions:n})}),d.jsx(T.ThreadPrimitive.Messages,{components:{UserMessage:za,AssistantMessage:$a}}),d.jsx(T.ThreadPrimitive.If,{running:!0,children:!f&&d.jsx("div",{className:"cuadra-mt-2 cuadra-max-w-2xl",children:d.jsx(Ea,{active:!0})})})]})}),d.jsx("div",{className:"cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4",children:d.jsxs(T.ComposerPrimitive.Root,{className:"cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full",children:[d.jsx(T.ComposerPrimitive.Input,{asChild:!0,children:d.jsx("textarea",{rows:3,placeholder:i,className:"cuadra-flex cuadra-min-h-[80px] cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-border cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-base placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-resize-none cuadra-pr-10 font-brand",style:{paddingRight:"2.5rem",fontSize:"1rem",borderWidth:"1px"}})}),d.jsx(T.ComposerPrimitive.Send,{asChild:!0,children:d.jsx("button",{className:"!cuadra-absolute !cuadra-bottom-2 !cuadra-right-2 cuadra-size-8 cuadra-rounded-md cuadra-shadow-sm hover:cuadra-opacity-90 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed cuadra-flex cuadra-items-center cuadra-justify-center",style:{position:"absolute",bottom:"0.5rem",right:"0.5rem",backgroundColor:"var(--primary)",color:"hsl(var(--primary-foreground))"},"aria-label":"Send message",type:"button",children:d.jsx(Ft,{className:"cuadra-h-4 cuadra-w-4"})})})]})})]})}function _a({title:e,subtitle:r,suggestions:t}){const n=T.useAssistantApi(),i=async o=>{try{n.composer().setText(o),await new Promise(a=>setTimeout(a,10)),n.composer().send()}catch{}};return d.jsx("div",{className:"cuadra-flex cuadra-flex-col cuadra-items-center cuadra-h-full cuadra-py-12 cuadra-px-4 cuadra-overflow-y-auto scrollbar-hide",children:d.jsxs("div",{className:"cuadra-text-center cuadra-max-w-3xl cuadra-w-full cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-min-h-full",children:[d.jsxs("div",{className:"cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8",children:[d.jsx("h2",{className:"cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand",children:e}),d.jsx("p",{className:"cuadra-text-muted-foreground font-brand",children:r})]}),t&&t.length>0&&d.jsx("div",{className:"cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl",children:t.map((o,a)=>d.jsx("button",{type:"button",onClick:()=>i(o.prompt),className:"cuadra-w-full cuadra-text-center cuadra-px-4 cuadra-py-3 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-background cuadra-text-sm font-brand cuadra-cursor-pointer focus:cuadra-outline-none focus:cuadra-ring-0",style:{borderWidth:"1px"},children:o.prompt},`suggestion-${a}`))})]})})}function za(){return d.jsx(T.MessagePrimitive.Root,{className:"cuadra-grid cuadra-w-full cuadra-auto-rows-auto cuadra-grid-cols-[minmax(72px,1fr)_auto] cuadra-gap-y-2 cuadra-py-3 [&:where(>*)]:cuadra-col-start-2",children:d.jsx("div",{className:"cuadra-bg-muted cuadra-text-foreground cuadra-col-start-2 cuadra-row-start-2 cuadra-max-w-[calc(42rem*0.8)] cuadra-break-words cuadra-rounded-3xl cuadra-border cuadra-border-border cuadra-px-5 cuadra-py-2.5 font-brand",style:{maxWidth:"calc(42rem * 0.8)",borderRadius:"1.5rem",backgroundColor:"hsl(var(--muted))",color:"hsl(var(--foreground))",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",wordBreak:"break-word",borderWidth:"1px"},children:d.jsx(T.MessagePrimitive.Parts,{components:{Text:({text:e})=>d.jsx(jt,{content:e||""})}})})})}function $a(){return d.jsx(T.MessagePrimitive.Root,{className:"cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3",children:d.jsx("div",{className:"cuadra-text-foreground cuadra-col-span-2 cuadra-col-start-2 cuadra-row-start-1 cuadra-my-1.5 cuadra-max-w-[90%] cuadra-break-words cuadra-leading-7 font-brand",style:{maxWidth:"90%",marginTop:"0.375rem",marginBottom:"0.375rem"},children:d.jsx(T.MessagePrimitive.Parts,{components:{Text:({text:e})=>d.jsx(jt,{content:e||""})}})})})}function Oa({onThreadSelect:e}){const r=T.useThreadListItem(),t=T.useThread(g=>g.threadId),[n,i]=w.useState(null),o=r?.id===t,a=n===r?.id,[l,s]=w.useState(!1),[u,f]=w.useState(r?.title||""),[c,p]=w.useState(!1),[x,h]=w.useState(!1),b=async()=>{if(!r?.remoteId||!u||u===r.title){s(!1);return}try{h(!0);const g=window.__cuadraThreadListAdapter;g&&typeof g.rename=="function"&&await g.rename(r.remoteId,u),s(!1),p(!1)}catch{s(!1),p(!1)}finally{h(!1)}};return w.useEffect(()=>{r?.title&&!l&&f(r.title)},[r?.title,l]),r?d.jsx(T.ThreadListItemPrimitive.Root,{className:`group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-rounded-lg cuadra-transition-colors cuadra-cursor-pointer cuadra-border cuadra-mb-2 ${o?"cuadra-bg-muted cuadra-border-border":"cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border"}`,style:{marginBottom:"0.5rem"},onMouseEnter:()=>i(r.id),onMouseLeave:()=>i(null),children:d.jsxs(T.ThreadListItemPrimitive.Trigger,{className:"cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-justify-between cuadra-w-full cuadra-min-w-0 cuadra-cursor-pointer",onClick:()=>e?.(),children:[d.jsx("div",{className:"cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left",children:l?d.jsx("input",{className:"cuadra-flex cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 font-brand",value:u,onChange:g=>f(g.target.value),onKeyDown:g=>{g.key==="Enter"&&b(),g.key==="Escape"&&(s(!1),f(r.title||""))},disabled:x,autoFocus:!0,onClick:g=>g.stopPropagation()}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-truncate font-brand",children:(r.title?.length||0)>60?`${r.title?.slice(0,60)}…`:r.title||"Chat"}),r.updatedAt&&d.jsx("span",{className:"cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand",children:new Date(r.updatedAt).toLocaleDateString()})]})}),d.jsx("div",{className:"cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center",children:(a||o||c)&&d.jsxs("div",{className:"cuadra-relative",children:[d.jsx("button",{className:"cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",onClick:g=>{g.stopPropagation(),p(!c)},"aria-label":"Thread options",children:d.jsx(qt,{className:"cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground"})}),c&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"cuadra-fixed cuadra-inset-0 cuadra-z-40",onClick:()=>p(!1)}),d.jsx("div",{className:"cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden",children:l?d.jsx("button",{className:"cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",onClick:g=>{g.stopPropagation(),b()},disabled:x,children:"Save"}):d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",onClick:g=>{g.stopPropagation(),s(!0),f(r.title||""),p(!1)},children:"Rename"}),d.jsx("div",{className:"cuadra-border-t cuadra-border-border"}),d.jsx(T.ThreadListItemPrimitive.Delete,{asChild:!0,children:d.jsx("button",{className:"cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left cuadra-text-destructive hover:cuadra-bg-muted cuadra-transition-colors font-brand",onClick:g=>{g.stopPropagation(),p(!1)},children:"Delete"})})]})})]})]})})]})}):null}function qe({onThreadSelect:e}){return d.jsxs(T.ThreadListPrimitive.Root,{className:"!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80",style:{borderRightWidth:"1px"},children:[d.jsx("div",{className:"cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4",children:d.jsx("h3",{className:"cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand",children:"Chat History"})}),d.jsxs("div",{className:"cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin",children:[d.jsx(T.ThreadListPrimitive.New,{className:"group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-p-3 cuadra-rounded-lg cuadra-cursor-pointer cuadra-transition-colors cuadra-border cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border",onClick:()=>e?.(),children:d.jsx("div",{className:"cuadra-flex-1 cuadra-min-w-0",children:d.jsxs("div",{className:"cuadra-flex cuadra-items-center cuadra-gap-2",children:[d.jsx(Jt,{className:"cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground"}),d.jsx("h4",{className:"cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand",children:"New Chat"})]})})}),d.jsx("div",{className:"cuadra-my-2 cuadra-border-t cuadra-border-border"}),d.jsx(T.ThreadListPrimitive.Items,{components:{ThreadListItem:r=>d.jsx(Oa,{...r,onThreadSelect:e})}})]})]})}const Ua=`
|
|
18
|
+
`))}function s(x,h,b,g){const k=b.enter("tableCell"),y=b.enter("phrasing"),C=b.containerPhrasing(x,{...g,before:o,after:o});return y(),k(),C}function u(x,h){return Zr(x,{align:h,alignDelimiters:n,padding:t,stringLength:i})}function f(x,h,b){const g=x.children;let k=-1;const y=[],C=h.enter("table");for(;++k<g.length;)y[k]=c(g[k],h,b);return C(),y}function c(x,h,b){const g=x.children;let k=-1;const y=[],C=h.enter("tableRow");for(;++k<g.length;)y[k]=s(g[k],x,h,b);return C(),y}function p(x,h,b){let g=pt.inlineCode(x,h,b);return b.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function On(){return{exit:{taskListCheckValueChecked:Oe,taskListCheckValueUnchecked:Oe,paragraph:Bn}}}function Un(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Wn}}}function Oe(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function Bn(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const n=t.children[0];if(n&&n.type==="text"){const i=r.children;let o=-1,a;for(;++o<i.length;){const l=i[o];if(l.type==="paragraph"){a=l;break}}a===t&&(n.value=n.value.slice(1),n.value.length===0?t.children.shift():t.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,t.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Wn(e,r,t,n){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",l=t.createTracker(n);o&&l.move(a);let s=pt.listItem(e,r,t,{...n,...l.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(f){return f+a}}function Hn(){return[br(),$r(),Wr(),Dn(),On()]}function qn(e){return{extensions:[kr(),Or(e),Hr(),$n(e),Un()]}}function ae(e,r,t,n){const i=e.length;let o=0,a;if(r<0?r=-r>i?0:i+r:r=r>i?i:r,t=t>0?t:0,n.length<1e4)a=Array.from(n),a.unshift(r,t),e.splice(...a);else for(t&&e.splice(r,t);o<n.length;)a=n.slice(o,o+1e4),a.unshift(r,0),e.splice(...a),o+=1e4,r+=1e4}const Ue={}.hasOwnProperty;function Kn(e){const r={};let t=-1;for(;++t<e.length;)Vn(r,e[t]);return r}function Vn(e,r){let t;for(t in r){const i=(Ue.call(e,t)?e[t]:void 0)||(e[t]={}),o=r[t];let a;if(o)for(a in o){Ue.call(i,a)||(i[a]=[]);const l=o[a];Gn(i[a],Array.isArray(l)?l:l?[l]:[])}}}function Gn(e,r){let t=-1;const n=[];for(;++t<r.length;)(r[t].add==="after"?e:n).push(r[t]);ae(e,0,0,n)}const Zn={tokenize:ta,partial:!0},gt={tokenize:ra,partial:!0},xt={tokenize:na,partial:!0},bt={tokenize:aa,partial:!0},Jn={tokenize:ia,partial:!0},kt={name:"wwwAutolink",tokenize:Yn,previous:yt},wt={name:"protocolAutolink",tokenize:ea,previous:Ct},z={name:"emailAutolink",tokenize:Xn,previous:vt},P={};function Qn(){return{text:P}}let O=48;for(;O<123;)P[O]=z,O++,O===58?O=65:O===91&&(O=97);P[43]=z;P[45]=z;P[46]=z;P[95]=z;P[72]=[z,wt];P[104]=[z,wt];P[87]=[z,kt];P[119]=[z,kt];function Xn(e,r,t){const n=this;let i,o;return a;function a(c){return!ye(c)||!vt.call(n,n.previous)||Te(n.events)?t(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(c))}function l(c){return ye(c)?(e.consume(c),l):c===64?(e.consume(c),s):t(c)}function s(c){return c===46?e.check(Jn,f,u)(c):c===45||c===95||Ce(c)?(o=!0,e.consume(c),s):f(c)}function u(c){return e.consume(c),i=!0,s}function f(c){return o&&i&&Q(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(c)):t(c)}}function Yn(e,r,t){const n=this;return i;function i(a){return a!==87&&a!==119||!yt.call(n,n.previous)||Te(n.events)?t(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Zn,e.attempt(gt,e.attempt(xt,o),t),t)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(a)}}function ea(e,r,t){const n=this;let i="",o=!1;return a;function a(c){return(c===72||c===104)&&Ct.call(n,n.previous)&&!Te(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),l):t(c)}function l(c){if(Q(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),l;if(c===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(c),s}return t(c)}function s(c){return c===47?(e.consume(c),o?u:(o=!0,s)):t(c)}function u(c){return c===null||ar(c)||N(c)||U(c)||se(c)?t(c):e.attempt(gt,e.attempt(xt,f),t)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(c)}}function ta(e,r,t){let n=0;return i;function i(a){return(a===87||a===119)&&n<3?(n++,e.consume(a),i):a===46&&n===3?(e.consume(a),o):t(a)}function o(a){return a===null?t(a):r(a)}}function ra(e,r,t){let n,i,o;return a;function a(u){return u===46||u===95?e.check(bt,s,l)(u):u===null||N(u)||U(u)||u!==45&&se(u)?s(u):(o=!0,e.consume(u),a)}function l(u){return u===95?n=!0:(i=n,n=void 0),e.consume(u),a}function s(u){return i||n||!o?t(u):r(u)}}function na(e,r){let t=0,n=0;return i;function i(a){return a===40?(t++,e.consume(a),i):a===41&&n<t?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(bt,r,o)(a):a===null||N(a)||U(a)?r(a):(e.consume(a),i)}function o(a){return a===41&&n++,e.consume(a),i}}function aa(e,r,t){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),o):l===93?(e.consume(l),i):l===60||l===null||N(l)||U(l)?r(l):t(l)}function i(l){return l===null||l===40||l===91||N(l)||U(l)?r(l):n(l)}function o(l){return Q(l)?a(l):t(l)}function a(l){return l===59?(e.consume(l),n):Q(l)?(e.consume(l),a):t(l)}}function ia(e,r,t){return n;function n(o){return e.consume(o),i}function i(o){return Ce(o)?t(o):r(o)}}function yt(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||N(e)}function Ct(e){return!Q(e)}function vt(e){return!(e===47||ye(e))}function ye(e){return e===43||e===45||e===46||e===95||Ce(e)}function Te(e){let r=e.length,t=!1;for(;r--;){const n=e[r][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){t=!0;break}if(n._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}function oa(e,r,t){const n=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!n.includes(o)&&(r=o(r,t),n.push(o))}return r}function E(e,r,t,n){const i=n?n-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(s){return F(s)?(e.enter(t),l(s)):r(s)}function l(s){return F(s)&&o++<i?(e.consume(s),l):(e.exit(t),r(s))}}const sa={partial:!0,tokenize:la};function la(e,r,t){return n;function n(o){return F(o)?E(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||K(o)?r(o):t(o)}}const ua={tokenize:xa,partial:!0};function ca(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ma,continuation:{tokenize:pa},exit:ga}},text:{91:{name:"gfmFootnoteCall",tokenize:ha},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:da,resolveTo:fa}}}}function da(e,r,t){const n=this;let i=n.events.length;const o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a;for(;i--;){const s=n.events[i][1];if(s.type==="labelImage"){a=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return l;function l(s){if(!a||!a._balanced)return t(s);const u=Y(n.sliceSerialize({start:a.end,end:n.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?t(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),r(s))}}function fa(e,r){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[t+1],e[t+2],["enter",n,r],e[t+3],e[t+4],["enter",i,r],["exit",i,r],["enter",o,r],["enter",a,r],["exit",a,r],["exit",o,r],e[e.length-2],e[e.length-1],["exit",n,r]];return e.splice(t,e.length-t+1,...l),e}function ha(e,r,t){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o=0,a;return l;function l(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),s}function s(c){return c!==94?t(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!a||c===null||c===91||N(c))return t(c);if(c===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(Y(n.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):t(c)}return N(c)||(a=!0),o++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function ma(e,r,t){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o,a=0,l;return s;function s(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):t(h)}function f(h){if(a>999||h===93&&!l||h===null||h===91||N(h))return t(h);if(h===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return o=Y(n.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return N(h)||(l=!0),a++,e.consume(h),h===92?c:f}function c(h){return h===91||h===92||h===93?(e.consume(h),a++,f):f(h)}function p(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(o)||i.push(o),E(e,x,"gfmFootnoteDefinitionWhitespace")):t(h)}function x(h){return r(h)}}function pa(e,r,t){return e.check(sa,r,e.attempt(ua,r,t))}function ga(e){e.exit("gfmFootnoteDefinition")}function xa(e,r,t){const n=this;return E(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=n.events[n.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?r(o):t(o)}}function ba(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:o,resolveAll:i};return t==null&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(a,l){let s=-1;for(;++s<a.length;)if(a[s][0]==="enter"&&a[s][1].type==="strikethroughSequenceTemporary"&&a[s][1]._close){let u=s;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[s][1].end.offset-a[s][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[s][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[s][1].end)},c={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[s][1].start)},p=[["enter",f,l],["enter",a[u][1],l],["exit",a[u][1],l],["enter",c,l]],x=l.parser.constructs.insideSpan.null;x&&ae(p,p.length,0,oa(x,a.slice(u+1,s),l)),ae(p,p.length,0,[["exit",c,l],["enter",a[s][1],l],["exit",a[s][1],l],["exit",f,l]]),ae(a,u-1,s-u+3,p),s=u+p.length-2;break}}for(s=-1;++s<a.length;)a[s][1].type==="strikethroughSequenceTemporary"&&(a[s][1].type="data");return a}function o(a,l,s){const u=this.previous,f=this.events;let c=0;return p;function p(h){return u===126&&f[f.length-1][1].type!=="characterEscape"?s(h):(a.enter("strikethroughSequenceTemporary"),x(h))}function x(h){const b=ie(u);if(h===126)return c>1?s(h):(a.consume(h),c++,x);if(c<2&&!t)return s(h);const g=a.exit("strikethroughSequenceTemporary"),k=ie(h);return g._open=!k||k===2&&!!b,g._close=!b||b===2&&!!k,l(h)}}}class ka{constructor(){this.map=[]}add(r,t,n){wa(this,r,t,n)}consume(r){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(r.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),r.length=this.map[t][0];n.push(r.slice()),r.length=0;let i=n.pop();for(;i;){for(const o of i)r.push(o);i=n.pop()}this.map.length=0}}function wa(e,r,t,n){let i=0;if(!(t===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===r){e.map[i][1]+=t,e.map[i][2].push(...n);return}i+=1}e.map.push([r,t,n])}}function ya(e,r){let t=!1;const n=[];for(;r<e.length;){const i=e[r];if(t){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const o=n.length-1;n[o]=n[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(t=!0);r+=1}return n}function Ca(){return{flow:{null:{name:"table",tokenize:va,resolveAll:ja}}}}function va(e,r,t){const n=this;let i=0,o=0,a;return l;function l(m){let L=n.events.length-1;for(;L>-1;){const V=n.events[L][1].type;if(V==="lineEnding"||V==="linePrefix")L--;else break}const ee=L>-1?n.events[L][1].type:null,$=ee==="tableHead"||ee==="tableRow"?v:s;return $===v&&n.parser.lazy[n.now().line]?t(m):$(m)}function s(m){return e.enter("tableHead"),e.enter("tableRow"),u(m)}function u(m){return m===124||(a=!0,o+=1),f(m)}function f(m){return m===null?t(m):K(m)?o>1?(o=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),x):t(m):F(m)?E(e,f,"whitespace")(m):(o+=1,a&&(a=!1,i+=1),m===124?(e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),a=!0,f):(e.enter("data"),c(m)))}function c(m){return m===null||m===124||N(m)?(e.exit("data"),f(m)):(e.consume(m),m===92?p:c)}function p(m){return m===92||m===124?(e.consume(m),c):c(m)}function x(m){return n.interrupt=!1,n.parser.lazy[n.now().line]?t(m):(e.enter("tableDelimiterRow"),a=!1,F(m)?E(e,h,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):h(m))}function h(m){return m===45||m===58?g(m):m===124?(a=!0,e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),b):j(m)}function b(m){return F(m)?E(e,g,"whitespace")(m):g(m)}function g(m){return m===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(m),e.exit("tableDelimiterMarker"),k):m===45?(o+=1,k(m)):m===null||K(m)?A(m):j(m)}function k(m){return m===45?(e.enter("tableDelimiterFiller"),y(m)):j(m)}function y(m){return m===45?(e.consume(m),y):m===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(m),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(m))}function C(m){return F(m)?E(e,A,"whitespace")(m):A(m)}function A(m){return m===124?h(m):m===null||K(m)?!a||i!==o?j(m):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(m)):j(m)}function j(m){return t(m)}function v(m){return e.enter("tableRow"),M(m)}function M(m){return m===124?(e.enter("tableCellDivider"),e.consume(m),e.exit("tableCellDivider"),M):m===null||K(m)?(e.exit("tableRow"),r(m)):F(m)?E(e,M,"whitespace")(m):(e.enter("data"),D(m))}function D(m){return m===null||m===124||N(m)?(e.exit("data"),M(m)):(e.consume(m),m===92?B:D)}function B(m){return m===92||m===124?(e.consume(m),D):D(m)}}function ja(e,r){let t=-1,n=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],l=!1,s=0,u,f,c;const p=new ka;for(;++t<e.length;){const x=e[t],h=x[1];x[0]==="enter"?h.type==="tableHead"?(l=!1,s!==0&&(Be(p,r,s,u,f),f=void 0,s=0),u={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},p.add(t,0,[["enter",u,r]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(n=!0,c=void 0,o=[0,0,0,0],a=[0,t+1,0,0],l&&(l=!1,f={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},p.add(t,0,[["enter",f,r]])),i=h.type==="tableDelimiterRow"?2:f?3:1):i&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(n=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],c=ne(p,r,o,i,void 0,c),o=[0,0,0,0]),a[2]=t)):h.type==="tableCellDivider"&&(n?n=!1:(o[1]!==0&&(a[0]=a[1],c=ne(p,r,o,i,void 0,c)),o=a,a=[o[1],t,0,0])):h.type==="tableHead"?(l=!0,s=t):h.type==="tableRow"||h.type==="tableDelimiterRow"?(s=t,o[1]!==0?(a[0]=a[1],c=ne(p,r,o,i,t,c)):a[1]!==0&&(c=ne(p,r,a,i,t,c)),i=0):i&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=t)}for(s!==0&&Be(p,r,s,u,f),p.consume(r.events),t=-1;++t<r.events.length;){const x=r.events[t];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=ya(r.events,t))}return e}function ne(e,r,t,n,i,o){const a=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";t[0]!==0&&(o.end=Object.assign({},q(r.events,t[0])),e.add(t[0],0,[["exit",o,r]]));const s=q(r.events,t[1]);if(o={type:a,start:Object.assign({},s),end:Object.assign({},s)},e.add(t[1],0,[["enter",o,r]]),t[2]!==0){const u=q(r.events,t[2]),f=q(r.events,t[3]),c={type:l,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(t[2],0,[["enter",c,r]]),n!==2){const p=r.events[t[2]],x=r.events[t[3]];if(p[1].end=Object.assign({},x[1].end),p[1].type="chunkText",p[1].contentType="text",t[3]>t[2]+1){const h=t[2]+1,b=t[3]-t[2]-1;e.add(h,b,[])}}e.add(t[3]+1,0,[["exit",c,r]])}return i!==void 0&&(o.end=Object.assign({},q(r.events,i)),e.add(i,0,[["exit",o,r]]),o=void 0),o}function Be(e,r,t,n,i){const o=[],a=q(r.events,t);i&&(i.end=Object.assign({},a),o.push(["exit",i,r])),n.end=Object.assign({},a),o.push(["exit",n,r]),e.add(t+1,0,o)}function q(e,r){const t=e[r],n=t[0]==="enter"?"start":"end";return t[1][n]}const Ta={name:"tasklistCheck",tokenize:Ia};function Aa(){return{text:{91:Ta}}}function Ia(e,r,t){const n=this;return i;function i(s){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?t(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return N(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),a):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),a):t(s)}function a(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):t(s)}function l(s){return K(s)?r(s):F(s)?e.check({tokenize:Sa},r,t)(s):t(s)}}function Sa(e,r,t){return E(e,n,"whitespace");function n(i){return i===null?t(i):r(i)}}function Na(e){return Kn([Qn(),ca(),ba(e),Ca(),Aa()])}const Ma={};function La(e){const r=this,t=e||Ma,n=r.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(Na(t)),o.push(Hn()),a.push(qn(t))}function I(...e){return e.filter(Boolean).join(" ")}const Pa=({content:e})=>d.jsx(ke.MarkdownTextPrimitive,{remarkPlugins:[La],className:"cuadra-aui-md",components:Fa,children:e}),jt=w.memo(Pa),Da=({language:e,code:r})=>{const{isCopied:t,copyToClipboard:n}=Ra(),i=()=>{!r||t||n(r)};return d.jsxs("div",{className:"cuadra-flex cuadra-items-center cuadra-justify-between cuadra-gap-4 cuadra-mt-4 cuadra-rounded-t-lg cuadra-bg-muted/50 cuadra-border-b cuadra-border-border cuadra-px-4 cuadra-py-2 cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-font-brand",children:[d.jsx("span",{className:"cuadra-lowercase [&>span]:cuadra-text-xs cuadra-font-brand",children:e}),d.jsxs("button",{onClick:i,className:"cuadra-p-1 cuadra-rounded hover:cuadra-bg-muted cuadra-transition-colors","aria-label":"Copy code",children:[!t&&d.jsx(Wt,{className:"cuadra-h-4 cuadra-w-4"}),t&&d.jsx(_t,{className:"cuadra-h-4 cuadra-w-4"})]})]})},Ra=({copiedDuration:e=3e3}={})=>{const[r,t]=w.useState(!1);return{isCopied:r,copyToClipboard:i=>{i&&navigator.clipboard.writeText(i).then(()=>{t(!0),setTimeout(()=>t(!1),e)})}}},Fa=ke.unstable_memoizeMarkdownComponents({h1:({className:e,...r})=>d.jsx("h1",{className:I("cuadra-mb-6 cuadra-scroll-m-20 cuadra-text-2xl cuadra-font-normal cuadra-tracking-tight last:cuadra-mb-0 font-brand",e),...r}),h2:({className:e,...r})=>d.jsx("h2",{className:I("cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h3:({className:e,...r})=>d.jsx("h3",{className:I("cuadra-mb-3 cuadra-mt-5 cuadra-scroll-m-20 cuadra-text-lg cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h4:({className:e,...r})=>d.jsx("h4",{className:I("cuadra-mb-4 cuadra-mt-6 cuadra-scroll-m-20 cuadra-text-xl cuadra-font-normal cuadra-tracking-tight first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h5:({className:e,...r})=>d.jsx("h5",{className:I("cuadra-my-4 cuadra-text-lg cuadra-font-normal first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),h6:({className:e,...r})=>d.jsx("h6",{className:I("cuadra-my-4 cuadra-font-normal first:cuadra-mb-0 font-brand",e),...r}),p:({className:e,...r})=>d.jsx("p",{className:I("cuadra-mb-5 cuadra-mt-5 cuadra-leading-7 first:cuadra-mt-0 last:cuadra-mb-0 font-brand",e),...r}),a:({className:e,...r})=>d.jsx("a",{className:I("cuadra-text-primary cuadra-font-medium cuadra-underline cuadra-underline-offset-4 font-brand",e),...r}),blockquote:({className:e,...r})=>d.jsx("blockquote",{className:I("cuadra-border-l-2 cuadra-pl-6 cuadra-italic font-brand",e),...r}),ul:({className:e,...r})=>d.jsx("ul",{className:I("cuadra-my-5 cuadra-ml-6 cuadra-list-disc [&>li]:cuadra-mt-2 font-brand",e),...r}),ol:({className:e,...r})=>d.jsx("ol",{className:I("cuadra-my-5 cuadra-ml-6 cuadra-list-decimal [&>li]:cuadra-mt-2 font-brand",e),...r}),hr:({className:e,...r})=>d.jsx("hr",{className:I("cuadra-my-5 cuadra-border-b",e),...r}),table:({className:e,...r})=>d.jsx("table",{className:I("cuadra-my-5 cuadra-w-full cuadra-border-separate cuadra-border-spacing-0 cuadra-overflow-y-auto font-brand",e),...r}),th:({className:e,...r})=>d.jsx("th",{className:I("cuadra-bg-muted cuadra-px-4 cuadra-py-2 cuadra-text-left cuadra-font-normal first:cuadra-rounded-tl-lg last:cuadra-rounded-tr-lg [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",e),...r}),td:({className:e,...r})=>d.jsx("td",{className:I("cuadra-border-b cuadra-border-l cuadra-px-4 cuadra-py-2 cuadra-text-left last:cuadra-border-r [&[align=center]]:cuadra-text-center [&[align=right]]:cuadra-text-right font-brand",e),...r}),tr:({className:e,...r})=>d.jsx("tr",{className:I("cuadra-m-0 cuadra-border-b cuadra-p-0 first:cuadra-border-t [&:last-child>td:first-child]:cuadra-rounded-bl-lg [&:last-child>td:last-child]:cuadra-rounded-br-lg",e),...r}),sup:({className:e,...r})=>d.jsx("sup",{className:I("[&>a]:cuadra-text-xs [&>a]:cuadra-no-underline font-brand",e),...r}),pre:({className:e,...r})=>d.jsx("pre",{className:I("cuadra-overflow-x-auto cuadra-rounded-b-lg !cuadra-rounded-t-none cuadra-bg-muted cuadra-p-4 cuadra-text-foreground font-brand",e),...r}),code:function({className:r,...t}){const n=ke.useIsMarkdownCodeBlock();return d.jsx("code",{className:I(!n&&"cuadra-bg-muted cuadra-rounded cuadra-border cuadra-font-normal font-brand",r),...t})},CodeHeader:Da}),We=["Sending question…","Understanding your need…","Scanning data…","Comparing results…","Composing answer…"];function Ea({active:e}){const[r,t]=w.useState(0);return w.useEffect(()=>{if(!e){t(0);return}const n=window.setInterval(()=>{t(i=>i>=We.length-1?(window.clearInterval(n),i):i+1)},2500);return()=>window.clearInterval(n)},[e]),e?d.jsxs("span",{className:"cuadra-text-xs cuadra-text-muted-foreground cuadra-font-brand",children:["Thinking… ",We[r]]}):null}function He({welcomeTitle:e="Hi, how can I help you today?",welcomeSubtitle:r="Start exploring our platform and discover what you can build.",extraTopPadding:t,suggestions:n,inputPlaceholder:i="Type your message..."}={}){const o=T.useThreadRuntime(),[a,l]=w.useState(!1),[s,u]=w.useState(null),[f,c]=w.useState(!1);return w.useEffect(()=>{if(!o){l(!1);return}try{const p=o?.store;if(!p){l(!1);return}const x=p.subscribe?.(b=>{const g=b?.threadId,k=b?.messages||[],y=b?.isLoadingHistory||!1,C=k.length;g&&g!==s&&u(g),l(y&&C===0);const j=k.some(v=>v.role==="assistant"&&!!v.content&&(Array.isArray(v.content)?v.content.some(M=>typeof M=="object"&&M?.text?M.text.trim().length>0:!1):typeof v.content=="string"?v.content.trim().length>0:!1));c(j)}),h=p.getState?.();if(h){const b=h?.threadId,g=h?.messages||[],k=h?.isLoadingHistory||!1,y=g.length;b&&b!==s&&u(b),l(k&&y===0);const A=g.some(j=>j.role==="assistant"&&!!j.content&&(Array.isArray(j.content)?j.content.some(v=>typeof v=="object"&&v?.text?v.text.trim().length>0:!1):typeof j.content=="string"?j.content.trim().length>0:!1));c(A)}return()=>{x&&x()}}catch{l(!1)}},[o,s]),d.jsxs(T.ThreadPrimitive.Root,{className:"cuadra-bg-inherit cuadra-flex cuadra-flex-col cuadra-w-full cuadra-h-full",children:[d.jsx(T.ThreadPrimitive.Viewport,{className:"cuadra-w-full cuadra-bg-inherit cuadra-px-4 cuadra-flex-1 cuadra-min-h-0 cuadra-overflow-y-auto cuadra-relative scrollbar-thin cuadra-pt-4",style:t?{paddingTop:t}:void 0,children:a?d.jsx("div",{className:"cuadra-absolute cuadra-inset-0 cuadra-flex cuadra-items-center cuadra-justify-center",children:d.jsxs("div",{className:"cuadra-flex cuadra-flex-col cuadra-items-center cuadra-gap-2",children:[d.jsx(Ge,{className:"cuadra-h-6 cuadra-w-6 cuadra-animate-spin cuadra-text-muted-foreground"}),d.jsx("p",{className:"cuadra-text-sm cuadra-text-muted-foreground font-brand",children:"Loading messages..."})]})}):d.jsxs(d.Fragment,{children:[d.jsx(T.ThreadPrimitive.Empty,{children:d.jsx(_a,{title:e,subtitle:r,suggestions:n})}),d.jsx(T.ThreadPrimitive.Messages,{components:{UserMessage:za,AssistantMessage:$a}}),d.jsx(T.ThreadPrimitive.If,{running:!0,children:!f&&d.jsx("div",{className:"cuadra-mt-2 cuadra-max-w-2xl",children:d.jsx(Ea,{active:!0})})})]})}),d.jsx("div",{className:"cuadra-w-full cuadra-mt-3 cuadra-border-t cuadra-border-border cuadra-pt-4",children:d.jsxs(T.ComposerPrimitive.Root,{className:"cuadra-relative !cuadra-relative cuadra-flex-1 cuadra-w-full",children:[d.jsx(T.ComposerPrimitive.Input,{asChild:!0,children:d.jsx("textarea",{rows:3,placeholder:i,className:"cuadra-flex cuadra-min-h-[80px] cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-border cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-base placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 cuadra-resize-none cuadra-pr-10 font-brand",style:{paddingRight:"2.5rem",fontSize:"1rem",borderWidth:"1px"}})}),d.jsx(T.ComposerPrimitive.Send,{asChild:!0,children:d.jsx("button",{className:"!cuadra-absolute !cuadra-bottom-2 !cuadra-right-2 cuadra-size-8 cuadra-rounded-md cuadra-shadow-sm hover:cuadra-opacity-90 disabled:cuadra-opacity-50 disabled:cuadra-cursor-not-allowed cuadra-flex cuadra-items-center cuadra-justify-center",style:{position:"absolute",bottom:"0.5rem",right:"0.5rem",backgroundColor:"var(--primary)",color:"hsl(var(--primary-foreground))"},"aria-label":"Send message",type:"button",children:d.jsx(Ft,{className:"cuadra-h-4 cuadra-w-4"})})})]})})]})}function _a({title:e,subtitle:r,suggestions:t}){const n=T.useAssistantApi(),i=async o=>{try{n.composer().setText(o),await new Promise(a=>setTimeout(a,10)),n.composer().send()}catch{}};return d.jsx("div",{className:"cuadra-flex cuadra-flex-col cuadra-items-center cuadra-h-full cuadra-py-12 cuadra-px-4 cuadra-overflow-y-auto scrollbar-hide",children:d.jsxs("div",{className:"cuadra-text-center cuadra-max-w-3xl cuadra-w-full cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-min-h-full",children:[d.jsxs("div",{className:"cuadra-flex cuadra-flex-col cuadra-items-center cuadra-justify-center cuadra-mb-8",children:[d.jsx("h2",{className:"cuadra-text-lg cuadra-font-normal cuadra-text-foreground cuadra-mb-2 font-brand",children:e}),d.jsx("p",{className:"cuadra-text-muted-foreground font-brand",children:r})]}),t&&t.length>0&&d.jsx("div",{className:"cuadra-grid cuadra-grid-cols-2 cuadra-gap-2 cuadra-pb-4 cuadra-w-full cuadra-max-w-2xl",children:t.map((o,a)=>d.jsx("button",{type:"button",onClick:()=>i(o.prompt),className:"cuadra-w-full cuadra-text-center cuadra-px-4 cuadra-py-3 cuadra-rounded-lg cuadra-border cuadra-border-border cuadra-bg-background cuadra-text-sm font-brand cuadra-cursor-pointer focus:cuadra-outline-none focus:cuadra-ring-0",style:{borderWidth:"1px"},children:o.prompt},`suggestion-${a}`))})]})})}function za(){return d.jsx(T.MessagePrimitive.Root,{className:"cuadra-grid cuadra-w-full cuadra-auto-rows-auto cuadra-grid-cols-[minmax(72px,1fr)_auto] cuadra-gap-y-2 cuadra-py-3 [&:where(>*)]:cuadra-col-start-2",children:d.jsx("div",{className:"cuadra-bg-muted cuadra-text-foreground cuadra-col-start-2 cuadra-row-start-2 cuadra-max-w-[calc(42rem*0.8)] cuadra-break-words cuadra-rounded-3xl cuadra-border cuadra-border-border cuadra-px-5 cuadra-py-2.5 font-brand",style:{maxWidth:"calc(42rem * 0.8)",borderRadius:"1.5rem",backgroundColor:"var(--muted)",color:"hsl(var(--foreground))",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",wordBreak:"break-word",borderWidth:"1px"},children:d.jsx(T.MessagePrimitive.Parts,{components:{Text:({text:e})=>d.jsx(jt,{content:e||""})}})})})}function $a(){return d.jsx(T.MessagePrimitive.Root,{className:"cuadra-relative cuadra-grid cuadra-w-full cuadra-grid-cols-[auto_auto_1fr] cuadra-grid-rows-[auto_1fr] cuadra-py-3",children:d.jsx("div",{className:"cuadra-text-foreground cuadra-col-span-2 cuadra-col-start-2 cuadra-row-start-1 cuadra-my-1.5 cuadra-max-w-[90%] cuadra-break-words cuadra-leading-7 font-brand",style:{maxWidth:"90%",marginTop:"0.375rem",marginBottom:"0.375rem"},children:d.jsx(T.MessagePrimitive.Parts,{components:{Text:({text:e})=>d.jsx(jt,{content:e||""})}})})})}function Oa({onThreadSelect:e}){const r=T.useThreadListItem(),t=T.useThread(g=>g.threadId),[n,i]=w.useState(null),o=r?.id===t,a=n===r?.id,[l,s]=w.useState(!1),[u,f]=w.useState(r?.title||""),[c,p]=w.useState(!1),[x,h]=w.useState(!1),b=async()=>{if(!r?.remoteId||!u||u===r.title){s(!1);return}try{h(!0);const g=window.__cuadraThreadListAdapter;g&&typeof g.rename=="function"&&await g.rename(r.remoteId,u),s(!1),p(!1)}catch{s(!1),p(!1)}finally{h(!1)}};return w.useEffect(()=>{r?.title&&!l&&f(r.title)},[r?.title,l]),r?d.jsx(T.ThreadListItemPrimitive.Root,{className:`group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-rounded-lg cuadra-transition-colors cuadra-cursor-pointer cuadra-border cuadra-mb-2 ${o?"cuadra-bg-muted cuadra-border-border":"cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border"}`,style:{marginBottom:"0.5rem"},onMouseEnter:()=>i(r.id),onMouseLeave:()=>i(null),children:d.jsxs(T.ThreadListItemPrimitive.Trigger,{className:"cuadra-p-3 cuadra-flex-1 cuadra-flex cuadra-items-center cuadra-justify-between cuadra-w-full cuadra-min-w-0 cuadra-cursor-pointer",onClick:()=>e?.(),children:[d.jsx("div",{className:"cuadra-flex cuadra-flex-col cuadra-min-w-0 cuadra-flex-1 cuadra-items-start cuadra-text-left",children:l?d.jsx("input",{className:"cuadra-flex cuadra-w-full cuadra-rounded-md cuadra-border cuadra-border-input cuadra-bg-background cuadra-px-3 cuadra-py-2 cuadra-text-sm placeholder:cuadra-text-muted-foreground focus-visible:cuadra-outline-none disabled:cuadra-cursor-not-allowed disabled:cuadra-opacity-50 font-brand",value:u,onChange:g=>f(g.target.value),onKeyDown:g=>{g.key==="Enter"&&b(),g.key==="Escape"&&(s(!1),f(r.title||""))},disabled:x,autoFocus:!0,onClick:g=>g.stopPropagation()}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-truncate font-brand",children:(r.title?.length||0)>60?`${r.title?.slice(0,60)}…`:r.title||"Chat"}),r.updatedAt&&d.jsx("span",{className:"cuadra-text-xs cuadra-text-muted-foreground cuadra-mt-1 font-brand",children:new Date(r.updatedAt).toLocaleDateString()})]})}),d.jsx("div",{className:"cuadra-ml-2 cuadra-flex-shrink-0 cuadra-w-6 cuadra-h-6 cuadra-flex cuadra-items-center cuadra-justify-center",children:(a||o||c)&&d.jsxs("div",{className:"cuadra-relative",children:[d.jsx("button",{className:"cuadra-p-1 cuadra-rounded hover:cuadra-bg-background/50 cuadra-transition-colors",onClick:g=>{g.stopPropagation(),p(!c)},"aria-label":"Thread options",children:d.jsx(qt,{className:"cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground"})}),c&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"cuadra-fixed cuadra-inset-0 cuadra-z-40",onClick:()=>p(!1)}),d.jsx("div",{className:"cuadra-absolute cuadra-right-0 cuadra-top-8 cuadra-z-50 cuadra-bg-background cuadra-border cuadra-border-border cuadra-rounded-lg cuadra-shadow-lg cuadra-min-w-[120px] cuadra-overflow-hidden",children:l?d.jsx("button",{className:"cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",onClick:g=>{g.stopPropagation(),b()},disabled:x,children:"Save"}):d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left hover:cuadra-bg-muted cuadra-transition-colors font-brand",onClick:g=>{g.stopPropagation(),s(!0),f(r.title||""),p(!1)},children:"Rename"}),d.jsx("div",{className:"cuadra-border-t cuadra-border-border"}),d.jsx(T.ThreadListItemPrimitive.Delete,{asChild:!0,children:d.jsx("button",{className:"cuadra-w-full cuadra-px-3 cuadra-py-2 cuadra-text-sm cuadra-text-left cuadra-text-destructive hover:cuadra-bg-muted cuadra-transition-colors font-brand",onClick:g=>{g.stopPropagation(),p(!1)},children:"Delete"})})]})})]})]})})]})}):null}function qe({onThreadSelect:e}){return d.jsxs(T.ThreadListPrimitive.Root,{className:"!cuadra-border-r cuadra-border-border cuadra-flex cuadra-flex-col cuadra-bg-background cuadra-transition-all cuadra-duration-300 cuadra-ease-in-out cuadra-h-full cuadra-w-80",style:{borderRightWidth:"1px"},children:[d.jsx("div",{className:"cuadra-border-b cuadra-border-border cuadra-flex cuadra-items-center cuadra-justify-between cuadra-transition-all cuadra-duration-300 cuadra-h-16 cuadra-px-4",children:d.jsx("h3",{className:"cuadra-text-sm cuadra-font-normal cuadra-text-foreground cuadra-text-nowrap font-brand",children:"Chat History"})}),d.jsxs("div",{className:"cuadra-flex-1 cuadra-overflow-y-auto cuadra-p-2 scrollbar-thin",children:[d.jsx(T.ThreadListPrimitive.New,{className:"group cuadra-relative cuadra-flex cuadra-items-center cuadra-gap-3 cuadra-p-3 cuadra-rounded-lg cuadra-cursor-pointer cuadra-transition-colors cuadra-border cuadra-border-transparent hover:cuadra-bg-muted hover:cuadra-border-border",onClick:()=>e?.(),children:d.jsx("div",{className:"cuadra-flex-1 cuadra-min-w-0",children:d.jsxs("div",{className:"cuadra-flex cuadra-items-center cuadra-gap-2",children:[d.jsx(Jt,{className:"cuadra-h-4 cuadra-w-4 cuadra-text-muted-foreground"}),d.jsx("h4",{className:"cuadra-text-sm cuadra-font-normal cuadra-text-foreground font-brand",children:"New Chat"})]})})}),d.jsx("div",{className:"cuadra-my-2 cuadra-border-t cuadra-border-border"}),d.jsx(T.ThreadListPrimitive.Items,{components:{ThreadListItem:r=>d.jsx(Oa,{...r,onThreadSelect:e})}})]})]})}const Ua=`
|
|
19
19
|
@keyframes rotate {
|
|
20
20
|
100% { transform: rotate(1turn); }
|
|
21
21
|
}
|