@siteboon/claude-code-ui 1.10.4 → 1.11.0

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.
@@ -1,913 +0,0 @@
1
- import{j as t,S as Pn,F as ks,T as Tl,P as Dl,E as Ht,V as vs,a as qa,g as Au,R as Mu,D as mr,b as os,G as Va,W as Ga,l as Pl,h as pa,c as Ll,C as Tu,d as Du,e as Jr,f as Pu,i as Lu,u as Ru,k as Ri,s as _u,m as zu,n as Fu,o as $u,p as Rl,q as _l,r as zl,t as Ou,v as Bu,w as Uu,x as Wu,y as Hu}from"./vendor-codemirror-B7BYDWj-.js";import{b as qu,g as Ln,a as f,R as cr,B as Vu,c as Gu,d as _i,u as Ku,e as Ju}from"./vendor-react-7V_UDHjJ.js";import{r as Yu,a as Qu,b as Xu,c as Zu}from"./vendor-xterm-jI4BCHEb.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var qn={},zi;function em(){if(zi)return qn;zi=1;var e=qu();return qn.createRoot=e.createRoot,qn.hydrateRoot=e.hydrateRoot,qn}var tm=em();const rm=Ln(tm);function Fl(e){var r,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(n=Fl(e[r]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function $l(){for(var e,r,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(r=Fl(e))&&(s&&(s+=" "),s+=r);return s}const Ka="-",nm=e=>{const r=am(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const l=o.split(Ka);return l[0]===""&&l.length!==1&&l.shift(),Ol(l,r)||sm(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&s[o]?[...c,...s[o]]:c}}},Ol=(e,r)=>{if(e.length===0)return r.classGroupId;const n=e[0],s=r.nextPart.get(n),a=s?Ol(e.slice(1),s):void 0;if(a)return a;if(r.validators.length===0)return;const i=e.join(Ka);return r.validators.find(({validator:o})=>o(i))?.classGroupId},Fi=/^\[(.+)\]$/,sm=e=>{if(Fi.test(e)){const r=Fi.exec(e)[1],n=r?.substring(0,r.indexOf(":"));if(n)return"arbitrary.."+n}},am=e=>{const{theme:r,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const a in n)ha(n[a],s,a,r);return s},ha=(e,r,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?r:$i(r,a);i.classGroupId=n;return}if(typeof a=="function"){if(im(a)){ha(a(s),r,n,s);return}r.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{ha(o,$i(r,i),n,s)})})},$i=(e,r)=>{let n=e;return r.split(Ka).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},im=e=>e.isThemeGetter,om=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,n=new Map,s=new Map;const a=(i,o)=>{n.set(i,o),r++,r>e&&(r=0,s=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},fa="!",ga=":",lm=ga.length,cm=e=>{const{prefix:r,experimentalParseClassName:n}=e;let s=a=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let x=a[g];if(o===0&&l===0){if(x===ga){i.push(a.slice(c,g)),c=g+lm;continue}if(x==="/"){d=g;continue}}x==="["?o++:x==="]"?o--:x==="("?l++:x===")"&&l--}const u=i.length===0?a:a.substring(c),m=dm(u),h=m!==u,p=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:p}};if(r){const a=r+ga,i=s;s=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const a=s;s=i=>n({className:i,parseClassName:a})}return s},dm=e=>e.endsWith(fa)?e.substring(0,e.length-1):e.startsWith(fa)?e.substring(1):e,um=e=>{const r=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const a=[];let i=[];return s.forEach(o=>{o[0]==="["||r[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},mm=e=>({cache:om(e.cacheSize),parseClassName:cm(e),sortModifiers:um(e),...nm(e)}),pm=/\s+/,hm=(e,r)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:i}=r,o=[],l=e.trim().split(pm);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:h,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(u);if(m){c=u+(c.length>0?" "+c:c);continue}let b=!!x,k=s(b?g.substring(0,x):g);if(!k){if(!b){c=u+(c.length>0?" "+c:c);continue}if(k=s(g),!k){c=u+(c.length>0?" "+c:c);continue}b=!1}const C=i(h).join(":"),y=p?C+fa:C,R=y+k;if(o.includes(R))continue;o.push(R);const H=a(k,b);for(let M=0;M<H.length;++M){const O=H[M];o.push(y+O)}c=u+(c.length>0?" "+c:c)}return c};function fm(){let e=0,r,n,s="";for(;e<arguments.length;)(r=arguments[e++])&&(n=Bl(r))&&(s&&(s+=" "),s+=n);return s}const Bl=e=>{if(typeof e=="string")return e;let r,n="";for(let s=0;s<e.length;s++)e[s]&&(r=Bl(e[s]))&&(n&&(n+=" "),n+=r);return n};function gm(e,...r){let n,s,a,i=o;function o(c){const d=r.reduce((u,m)=>m(u),e());return n=mm(d),s=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=hm(c,n);return a(c,u),u}return function(){return i(fm.apply(null,arguments))}}const yt=e=>{const r=n=>n[e]||[];return r.isThemeGetter=!0,r},Ul=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Wl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xm=/^\d+\/\d+$/,bm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ym=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,km=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ur=e=>xm.test(e),Ve=e=>!!e&&!Number.isNaN(Number(e)),xr=e=>!!e&&Number.isInteger(Number(e)),_s=e=>e.endsWith("%")&&Ve(e.slice(0,-1)),or=e=>bm.test(e),jm=()=>!0,Nm=e=>ym.test(e)&&!km.test(e),Hl=()=>!1,Cm=e=>vm.test(e),Sm=e=>wm.test(e),Em=e=>!ge(e)&&!xe(e),Im=e=>sn(e,Gl,Hl),ge=e=>Ul.test(e),Sr=e=>sn(e,Kl,Nm),zs=e=>sn(e,Pm,Ve),Oi=e=>sn(e,ql,Hl),Am=e=>sn(e,Vl,Sm),Vn=e=>sn(e,Jl,Cm),xe=e=>Wl.test(e),hn=e=>an(e,Kl),Mm=e=>an(e,Lm),Bi=e=>an(e,ql),Tm=e=>an(e,Gl),Dm=e=>an(e,Vl),Gn=e=>an(e,Jl,!0),sn=(e,r,n)=>{const s=Ul.exec(e);return s?s[1]?r(s[1]):n(s[2]):!1},an=(e,r,n=!1)=>{const s=Wl.exec(e);return s?s[1]?r(s[1]):n:!1},ql=e=>e==="position"||e==="percentage",Vl=e=>e==="image"||e==="url",Gl=e=>e==="length"||e==="size"||e==="bg-size",Kl=e=>e==="length",Pm=e=>e==="number",Lm=e=>e==="family-name",Jl=e=>e==="shadow",Rm=()=>{const e=yt("color"),r=yt("font"),n=yt("text"),s=yt("font-weight"),a=yt("tracking"),i=yt("leading"),o=yt("breakpoint"),l=yt("container"),c=yt("spacing"),d=yt("radius"),u=yt("shadow"),m=yt("inset-shadow"),h=yt("text-shadow"),p=yt("drop-shadow"),g=yt("blur"),x=yt("perspective"),b=yt("aspect"),k=yt("ease"),C=yt("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],H=()=>[...R(),xe,ge],M=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],L=()=>[xe,ge,c],q=()=>[Ur,"full","auto",...L()],j=()=>[xr,"none","subgrid",xe,ge],T=()=>["auto",{span:["full",xr,xe,ge]},xr,xe,ge],I=()=>[xr,"auto",xe,ge],_=()=>["auto","min","max","fr",xe,ge],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...L()],$=()=>[Ur,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],K=()=>[e,xe,ge],ce=()=>[...R(),Bi,Oi,{position:[xe,ge]}],S=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ae=()=>["auto","cover","contain",Tm,Im,{size:[xe,ge]}],$e=()=>[_s,hn,Sr],v=()=>["","none","full",d,xe,ge],ae=()=>["",Ve,hn,Sr],me=()=>["solid","dashed","dotted","double"],Ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[Ve,_s,Bi,Oi],qe=()=>["","none",g,xe,ge],re=()=>["none",Ve,xe,ge],le=()=>["none",Ve,xe,ge],fe=()=>[Ve,xe,ge],we=()=>[Ur,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[or],breakpoint:[or],color:[jm],container:[or],"drop-shadow":[or],ease:["in","out","in-out"],font:[Em],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[or],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[or],shadow:[or],spacing:["px",Ve],text:[or],"text-shadow":[or],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ur,ge,xe,b]}],container:["container"],columns:[{columns:[Ve,ge,xe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:H()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[xr,"auto",xe,ge]}],basis:[{basis:[Ur,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ve,Ur,"auto","initial","none",ge]}],grow:[{grow:["",Ve,xe,ge]}],shrink:[{shrink:["",Ve,xe,ge]}],order:[{order:[xr,"first","last","none",xe,ge]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[l,"screen",...$()]}],"min-w":[{"min-w":[l,"screen","none",...$()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",n,hn,Sr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,xe,zs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_s,ge]}],"font-family":[{font:[Mm,ge,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,xe,ge]}],"line-clamp":[{"line-clamp":[Ve,"none",xe,zs]}],leading:[{leading:[i,...L()]}],"list-image":[{"list-image":["none",xe,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ve,"from-font","auto",xe,Sr]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[Ve,"auto",xe,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:S()}],"bg-size":[{bg:Ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},xr,xe,ge],radial:["",xe,ge],conic:[xr,xe,ge]},Dm,Am]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:$e()}],"gradient-via-pos":[{via:$e()}],"gradient-to-pos":[{to:$e()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:v()}],"rounded-s":[{"rounded-s":v()}],"rounded-e":[{"rounded-e":v()}],"rounded-t":[{"rounded-t":v()}],"rounded-r":[{"rounded-r":v()}],"rounded-b":[{"rounded-b":v()}],"rounded-l":[{"rounded-l":v()}],"rounded-ss":[{"rounded-ss":v()}],"rounded-se":[{"rounded-se":v()}],"rounded-ee":[{"rounded-ee":v()}],"rounded-es":[{"rounded-es":v()}],"rounded-tl":[{"rounded-tl":v()}],"rounded-tr":[{"rounded-tr":v()}],"rounded-br":[{"rounded-br":v()}],"rounded-bl":[{"rounded-bl":v()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ve,xe,ge]}],"outline-w":[{outline:["",Ve,hn,Sr]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",u,Gn,Vn]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",m,Gn,Vn]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[Ve,Sr]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,Gn,Vn]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[Ve,xe,ge]}],"mix-blend":[{"mix-blend":[...Ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[xe,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[Ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:S()}],"mask-size":[{mask:Ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,ge]}],filter:[{filter:["","none",xe,ge]}],blur:[{blur:qe()}],brightness:[{brightness:[Ve,xe,ge]}],contrast:[{contrast:[Ve,xe,ge]}],"drop-shadow":[{"drop-shadow":["","none",p,Gn,Vn]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",Ve,xe,ge]}],"hue-rotate":[{"hue-rotate":[Ve,xe,ge]}],invert:[{invert:["",Ve,xe,ge]}],saturate:[{saturate:[Ve,xe,ge]}],sepia:[{sepia:["",Ve,xe,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,ge]}],"backdrop-blur":[{"backdrop-blur":qe()}],"backdrop-brightness":[{"backdrop-brightness":[Ve,xe,ge]}],"backdrop-contrast":[{"backdrop-contrast":[Ve,xe,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ve,xe,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ve,xe,ge]}],"backdrop-invert":[{"backdrop-invert":["",Ve,xe,ge]}],"backdrop-opacity":[{"backdrop-opacity":[Ve,xe,ge]}],"backdrop-saturate":[{"backdrop-saturate":[Ve,xe,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Ve,xe,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ve,"initial",xe,ge]}],ease:[{ease:["linear","initial",k,xe,ge]}],delay:[{delay:[Ve,xe,ge]}],animate:[{animate:["none",C,xe,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,xe,ge]}],"perspective-origin":[{"perspective-origin":H()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[xe,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:H()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,ge]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[Ve,hn,Sr,zs]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},_m=gm(Rm);function Ce(...e){return _m($l(e))}const Ja=f.forwardRef(({className:e,children:r,...n},s)=>t.jsx("div",{ref:s,className:Ce("relative overflow-hidden",e),...n,children:t.jsx("div",{className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Ja.displayName="ScrollArea";const Ui=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Wi=$l,Yl=(e,r)=>n=>{var s;if(r?.variants==null)return Wi(e,n?.class,n?.className);const{variants:a,defaultVariants:i}=r,o=Object.keys(a).map(d=>{const u=n?.[d],m=i?.[d];if(u===null)return null;const h=Ui(u)||Ui(m);return a[d][h]}),l=n&&Object.entries(n).reduce((d,u)=>{let[m,h]=u;return h===void 0||(d[m]=h),d},{}),c=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((d,u)=>{let{class:m,className:h,...p}=u;return Object.entries(p).every(g=>{let[x,b]=g;return Array.isArray(b)?b.includes({...i,...l}[x]):{...i,...l}[x]===b})?[...d,m,h]:d},[]);return Wi(e,o,c,n?.class,n?.className)},zm=Yl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Me=f.forwardRef(({className:e,variant:r,size:n,...s},a)=>t.jsx("button",{className:Ce(zm({variant:r,size:n,className:e})),ref:a,...s}));Me.displayName="Button";const Fm=Yl("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Tr({className:e,variant:r,...n}){return t.jsx("div",{className:Ce(Fm({variant:r}),e),...n})}const wt=f.forwardRef(({className:e,type:r,...n},s)=>t.jsx("input",{type:r,className:Ce("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...n}));wt.displayName="Input";/**
2
- * @license lucide-react v0.515.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const $m=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Om=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,s)=>s?s.toUpperCase():n.toLowerCase()),Hi=e=>{const r=Om(e);return r.charAt(0).toUpperCase()+r.slice(1)},Ql=(...e)=>e.filter((r,n,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===n).join(" ").trim(),Bm=e=>{for(const r in e)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};/**
7
- * @license lucide-react v0.515.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */var Um={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
12
- * @license lucide-react v0.515.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Wm=f.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},c)=>f.createElement("svg",{ref:c,...Um,width:r,height:r,stroke:e,strokeWidth:s?Number(n)*24/Number(r):n,className:Ql("lucide",a),...!i&&!Bm(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,u])=>f.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
17
- * @license lucide-react v0.515.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const ue=(e,r)=>{const n=f.forwardRef(({className:s,...a},i)=>f.createElement(Wm,{ref:i,iconNode:r,className:Ql(`lucide-${$m(Hi(e))}`,`lucide-${e}`,s),...a}));return n.displayName=Hi(e),n};/**
22
- * @license lucide-react v0.515.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const Hm=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Xl=ue("arrow-down",Hm);/**
27
- * @license lucide-react v0.515.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const qm=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ya=ue("arrow-right",qm);/**
32
- * @license lucide-react v0.515.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const Vm=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Gm=ue("arrow-up-down",Vm);/**
37
- * @license lucide-react v0.515.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const Km=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Jm=ue("arrow-up",Km);/**
42
- * @license lucide-react v0.515.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const Ym=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Zl=ue("brain",Ym);/**
47
- * @license lucide-react v0.515.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const Qm=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Dr=ue("check",Qm);/**
52
- * @license lucide-react v0.515.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const Xm=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Wt=ue("chevron-down",Xm);/**
57
- * @license lucide-react v0.515.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const Zm=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ep=ue("chevron-left",Zm);/**
62
- * @license lucide-react v0.515.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const tp=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wr=ue("chevron-right",tp);/**
67
- * @license lucide-react v0.515.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const rp=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],np=ue("chevron-up",rp);/**
72
- * @license lucide-react v0.515.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const sp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Qa=ue("circle-alert",sp);/**
77
- * @license lucide-react v0.515.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const ap=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Rn=ue("circle-check-big",ap);/**
82
- * @license lucide-react v0.515.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const ip=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],op=ue("circle-check",ip);/**
87
- * @license lucide-react v0.515.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const lp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],cp=ue("circle-help",lp);/**
92
- * @license lucide-react v0.515.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const dp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Vr=ue("circle",dp);/**
97
- * @license lucide-react v0.515.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const up=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],In=ue("clock",up);/**
102
- * @license lucide-react v0.515.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const mp=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],pp=ue("columns-2",mp);/**
107
- * @license lucide-react v0.515.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const hp=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ec=ue("copy",hp);/**
112
- * @license lucide-react v0.515.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const fp=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ls=ue("download",fp);/**
117
- * @license lucide-react v0.515.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const gp=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],xp=ue("external-link",gp);/**
122
- * @license lucide-react v0.515.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const bp=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],on=ue("eye",bp);/**
127
- * @license lucide-react v0.515.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const yp=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],tc=ue("eye-off",yp);/**
132
- * @license lucide-react v0.515.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const kp=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],vp=ue("file-code",kp);/**
137
- * @license lucide-react v0.515.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const wp=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Tt=ue("file-text",wp);/**
142
- * @license lucide-react v0.515.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const jp=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],qi=ue("file",jp);/**
147
- * @license lucide-react v0.515.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const Np=[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]],rc=ue("flag",Np);/**
152
- * @license lucide-react v0.515.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const Cp=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Pr=ue("folder-open",Cp);/**
157
- * @license lucide-react v0.515.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const Sp=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Kn=ue("folder-plus",Sp);/**
162
- * @license lucide-react v0.515.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const Ep=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],er=ue("folder",Ep);/**
167
- * @license lucide-react v0.515.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const Ip=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ap=ue("funnel",Ip);/**
172
- * @license lucide-react v0.515.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const Mp=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],xa=ue("git-branch",Mp);/**
177
- * @license lucide-react v0.515.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const Tp=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Vi=ue("git-commit-horizontal",Tp);/**
182
- * @license lucide-react v0.515.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const Dp=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Pp=ue("github",Dp);/**
187
- * @license lucide-react v0.515.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const Lp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Fs=ue("globe",Lp);/**
192
- * @license lucide-react v0.515.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const Rp=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],_p=ue("grid-3x3",Rp);/**
197
- * @license lucide-react v0.515.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const zp=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Gi=ue("history",zp);/**
202
- * @license lucide-react v0.515.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const Fp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],$p=ue("info",Fp);/**
207
- * @license lucide-react v0.515.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const Op=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],nc=ue("key",Op);/**
212
- * @license lucide-react v0.515.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const Bp=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Up=ue("languages",Bp);/**
217
- * @license lucide-react v0.515.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const Wp=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],cs=ue("list",Wp);/**
222
- * @license lucide-react v0.515.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const Hp=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qp=ue("loader-circle",Hp);/**
227
- * @license lucide-react v0.515.0 - ISC
228
- *
229
- * This source code is licensed under the ISC license.
230
- * See the LICENSE file in the root directory of this source tree.
231
- */const Vp=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Jn=ue("log-in",Vp);/**
232
- * @license lucide-react v0.515.0 - ISC
233
- *
234
- * This source code is licensed under the ISC license.
235
- * See the LICENSE file in the root directory of this source tree.
236
- */const Gp=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Xa=ue("maximize-2",Gp);/**
237
- * @license lucide-react v0.515.0 - ISC
238
- *
239
- * This source code is licensed under the ISC license.
240
- * See the LICENSE file in the root directory of this source tree.
241
- */const Kp=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],An=ue("message-square",Kp);/**
242
- * @license lucide-react v0.515.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */const Jp=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],as=ue("mic",Jp);/**
247
- * @license lucide-react v0.515.0 - ISC
248
- *
249
- * This source code is licensed under the ISC license.
250
- * See the LICENSE file in the root directory of this source tree.
251
- */const Yp=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],sc=ue("minimize-2",Yp);/**
252
- * @license lucide-react v0.515.0 - ISC
253
- *
254
- * This source code is licensed under the ISC license.
255
- * See the LICENSE file in the root directory of this source tree.
256
- */const Qp=[["path",{d:"M5 12h14",key:"1ays0h"}]],Xp=ue("minus",Qp);/**
257
- * @license lucide-react v0.515.0 - ISC
258
- *
259
- * This source code is licensed under the ISC license.
260
- * See the LICENSE file in the root directory of this source tree.
261
- */const Zp=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],ac=ue("moon",Zp);/**
262
- * @license lucide-react v0.515.0 - ISC
263
- *
264
- * This source code is licensed under the ISC license.
265
- * See the LICENSE file in the root directory of this source tree.
266
- */const eh=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],ic=ue("pause",eh);/**
267
- * @license lucide-react v0.515.0 - ISC
268
- *
269
- * This source code is licensed under the ISC license.
270
- * See the LICENSE file in the root directory of this source tree.
271
- */const th=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],ba=ue("pen-line",th);/**
272
- * @license lucide-react v0.515.0 - ISC
273
- *
274
- * This source code is licensed under the ISC license.
275
- * See the LICENSE file in the root directory of this source tree.
276
- */const rh=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],nh=ue("pen",rh);/**
277
- * @license lucide-react v0.515.0 - ISC
278
- *
279
- * This source code is licensed under the ISC license.
280
- * See the LICENSE file in the root directory of this source tree.
281
- */const sh=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ah=ue("play",sh);/**
282
- * @license lucide-react v0.515.0 - ISC
283
- *
284
- * This source code is licensed under the ISC license.
285
- * See the LICENSE file in the root directory of this source tree.
286
- */const ih=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],St=ue("plus",ih);/**
287
- * @license lucide-react v0.515.0 - ISC
288
- *
289
- * This source code is licensed under the ISC license.
290
- * See the LICENSE file in the root directory of this source tree.
291
- */const oh=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],vr=ue("refresh-cw",oh);/**
292
- * @license lucide-react v0.515.0 - ISC
293
- *
294
- * This source code is licensed under the ISC license.
295
- * See the LICENSE file in the root directory of this source tree.
296
- */const lh=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ds=ue("save",lh);/**
297
- * @license lucide-react v0.515.0 - ISC
298
- *
299
- * This source code is licensed under the ISC license.
300
- * See the LICENSE file in the root directory of this source tree.
301
- */const ch=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yr=ue("search",ch);/**
302
- * @license lucide-react v0.515.0 - ISC
303
- *
304
- * This source code is licensed under the ISC license.
305
- * See the LICENSE file in the root directory of this source tree.
306
- */const dh=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Ki=ue("server",dh);/**
307
- * @license lucide-react v0.515.0 - ISC
308
- *
309
- * This source code is licensed under the ISC license.
310
- * See the LICENSE file in the root directory of this source tree.
311
- */const uh=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qr=ue("settings",uh);/**
312
- * @license lucide-react v0.515.0 - ISC
313
- *
314
- * This source code is licensed under the ISC license.
315
- * See the LICENSE file in the root directory of this source tree.
316
- */const mh=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ph=ue("settings-2",mh);/**
317
- * @license lucide-react v0.515.0 - ISC
318
- *
319
- * This source code is licensed under the ISC license.
320
- * See the LICENSE file in the root directory of this source tree.
321
- */const hh=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],$s=ue("shield",hh);/**
322
- * @license lucide-react v0.515.0 - ISC
323
- *
324
- * This source code is licensed under the ISC license.
325
- * See the LICENSE file in the root directory of this source tree.
326
- */const fh=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],Lr=ue("sparkles",fh);/**
327
- * @license lucide-react v0.515.0 - ISC
328
- *
329
- * This source code is licensed under the ISC license.
330
- * See the LICENSE file in the root directory of this source tree.
331
- */const gh=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],xh=ue("square-check-big",gh);/**
332
- * @license lucide-react v0.515.0 - ISC
333
- *
334
- * This source code is licensed under the ISC license.
335
- * See the LICENSE file in the root directory of this source tree.
336
- */const bh=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],yh=ue("square-pen",bh);/**
337
- * @license lucide-react v0.515.0 - ISC
338
- *
339
- * This source code is licensed under the ISC license.
340
- * See the LICENSE file in the root directory of this source tree.
341
- */const kh=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Ji=ue("star",kh);/**
342
- * @license lucide-react v0.515.0 - ISC
343
- *
344
- * This source code is licensed under the ISC license.
345
- * See the LICENSE file in the root directory of this source tree.
346
- */const vh=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],oc=ue("sun",vh);/**
347
- * @license lucide-react v0.515.0 - ISC
348
- *
349
- * This source code is licensed under the ISC license.
350
- * See the LICENSE file in the root directory of this source tree.
351
- */const wh=[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],jh=ue("table-properties",wh);/**
352
- * @license lucide-react v0.515.0 - ISC
353
- *
354
- * This source code is licensed under the ISC license.
355
- * See the LICENSE file in the root directory of this source tree.
356
- */const Nh=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ch=ue("target",Nh);/**
357
- * @license lucide-react v0.515.0 - ISC
358
- *
359
- * This source code is licensed under the ISC license.
360
- * See the LICENSE file in the root directory of this source tree.
361
- */const Sh=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Xr=ue("terminal",Sh);/**
362
- * @license lucide-react v0.515.0 - ISC
363
- *
364
- * This source code is licensed under the ISC license.
365
- * See the LICENSE file in the root directory of this source tree.
366
- */const Eh=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Jt=ue("trash-2",Eh);/**
367
- * @license lucide-react v0.515.0 - ISC
368
- *
369
- * This source code is licensed under the ISC license.
370
- * See the LICENSE file in the root directory of this source tree.
371
- */const Ih=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Nn=ue("triangle-alert",Ih);/**
372
- * @license lucide-react v0.515.0 - ISC
373
- *
374
- * This source code is licensed under the ISC license.
375
- * See the LICENSE file in the root directory of this source tree.
376
- */const Ah=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Yn=ue("upload",Ah);/**
377
- * @license lucide-react v0.515.0 - ISC
378
- *
379
- * This source code is licensed under the ISC license.
380
- * See the LICENSE file in the root directory of this source tree.
381
- */const Mh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ot=ue("x",Mh);/**
382
- * @license lucide-react v0.515.0 - ISC
383
- *
384
- * This source code is licensed under the ISC license.
385
- * See the LICENSE file in the root directory of this source tree.
386
- */const Th=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ya=ue("zap",Th),tr=({className:e="w-5 h-5"})=>t.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),lr=({className:e="w-5 h-5"})=>t.jsx("img",{src:"/icons/cursor.svg",alt:"Cursor",className:e}),Dh=({status:e="not-configured",size:r="sm",className:n="",showLabel:s=!1})=>{const i=(()=>{switch(e){case"fully-configured":return{icon:Rn,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Qr,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:Qa,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:ot,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),o=i.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},c={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return s?t.jsxs("div",{className:Ce("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",i.bgColor,i.color,n),title:i.title,children:[t.jsx(o,{className:l[r]}),t.jsx("span",{className:"font-medium",children:i.label})]}):t.jsx("div",{className:Ce("inline-flex items-center justify-center rounded-full transition-colors",i.bgColor,c[r],n),title:i.title,children:t.jsx(o,{className:Ce(l[r],i.color)})})},Pe=(e,r={})=>{const n=localStorage.getItem("auth-token"),s={"Content-Type":"application/json"};return n&&(s.Authorization=`Bearer ${n}`),fetch(e,{...r,headers:{...s,...r.headers}})},Fe={auth:{status:()=>fetch("/api/auth/status"),login:(e,r)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:r})}),register:(e,r)=>fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:r})}),user:()=>Pe("/api/auth/user"),logout:()=>Pe("/api/auth/logout",{method:"POST"})},config:()=>Pe("/api/config"),projects:()=>Pe("/api/projects"),sessions:(e,r=5,n=0)=>Pe(`/api/projects/${e}/sessions?limit=${r}&offset=${n}`),sessionMessages:(e,r,n=null,s=0)=>{const a=new URLSearchParams;n!==null&&(a.append("limit",n),a.append("offset",s));const i=a.toString(),o=`/api/projects/${e}/sessions/${r}/messages${i?`?${i}`:""}`;return Pe(o)},renameProject:(e,r)=>Pe(`/api/projects/${e}/rename`,{method:"PUT",body:JSON.stringify({displayName:r})}),deleteSession:(e,r)=>Pe(`/api/projects/${e}/sessions/${r}`,{method:"DELETE"}),deleteProject:e=>Pe(`/api/projects/${e}`,{method:"DELETE"}),createProject:e=>Pe("/api/projects/create",{method:"POST",body:JSON.stringify({path:e})}),readFile:(e,r)=>Pe(`/api/projects/${e}/file?filePath=${encodeURIComponent(r)}`),saveFile:(e,r,n)=>Pe(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({filePath:r,content:n})}),getFiles:e=>Pe(`/api/projects/${e}/files`),transcribe:e=>Pe("/api/transcribe",{method:"POST",body:e,headers:{}}),taskmaster:{init:e=>Pe(`/api/taskmaster/init/${e}`,{method:"POST"}),addTask:(e,{prompt:r,title:n,description:s,priority:a,dependencies:i})=>Pe(`/api/taskmaster/add-task/${e}`,{method:"POST",body:JSON.stringify({prompt:r,title:n,description:s,priority:a,dependencies:i})}),parsePRD:(e,{fileName:r,numTasks:n,append:s})=>Pe(`/api/taskmaster/parse-prd/${e}`,{method:"POST",body:JSON.stringify({fileName:r,numTasks:n,append:s})}),getTemplates:()=>Pe("/api/taskmaster/prd-templates"),applyTemplate:(e,{templateId:r,fileName:n,customizations:s})=>Pe(`/api/taskmaster/apply-template/${e}`,{method:"POST",body:JSON.stringify({templateId:r,fileName:n,customizations:s})}),updateTask:(e,r,n)=>Pe(`/api/taskmaster/update-task/${e}/${r}`,{method:"PUT",body:JSON.stringify(n)})},browseFilesystem:(e=null)=>{const r=new URLSearchParams;return e&&r.append("path",e),Pe(`/api/browse-filesystem?${r}`)},get:e=>Pe(`/api${e}`)},lc=f.createContext({user:null,token:null,login:()=>{},register:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,error:null}),ws=()=>{const e=f.useContext(lc);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ph=({children:e})=>{const[r,n]=f.useState(null),[s,a]=f.useState(localStorage.getItem("auth-token")),[i,o]=f.useState(!0),[l,c]=f.useState(!1),[d,u]=f.useState(null);f.useEffect(()=>{m()},[]);const m=async()=>{try{if(o(!0),u(null),(await(await Fe.auth.status()).json()).needsSetup){c(!0),o(!1);return}if(s)try{const C=await Fe.auth.user();if(C.ok){const y=await C.json();n(y.user),c(!1)}else localStorage.removeItem("auth-token"),a(null),n(null)}catch(C){console.error("Token verification failed:",C),localStorage.removeItem("auth-token"),a(null),n(null)}}catch(b){console.error("Auth status check failed:",b),u("Failed to check authentication status")}finally{o(!1)}},x={user:r,token:s,login:async(b,k)=>{try{u(null);const C=await Fe.auth.login(b,k),y=await C.json();return C.ok?(a(y.token),n(y.user),localStorage.setItem("auth-token",y.token),{success:!0}):(u(y.error||"Login failed"),{success:!1,error:y.error||"Login failed"})}catch(C){console.error("Login error:",C);const y="Network error. Please try again.";return u(y),{success:!1,error:y}}},register:async(b,k)=>{try{u(null);const C=await Fe.auth.register(b,k),y=await C.json();return C.ok?(a(y.token),n(y.user),c(!1),localStorage.setItem("auth-token",y.token),{success:!0}):(u(y.error||"Registration failed"),{success:!1,error:y.error||"Registration failed"})}catch(C){console.error("Registration error:",C);const y="Network error. Please try again.";return u(y),{success:!1,error:y}}},logout:()=>{a(null),n(null),localStorage.removeItem("auth-token"),s&&Fe.auth.logout().catch(b=>{console.error("Logout endpoint error:",b)})},isLoading:i,needsSetup:l,error:d};return t.jsx(lc.Provider,{value:x,children:e})};function Lh(){const[e,r]=f.useState(null),[n,s]=f.useState([]),[a,i]=f.useState(!1),o=f.useRef(null);f.useEffect(()=>(l(),()=>{o.current&&clearTimeout(o.current),e&&e.close()}),[]);const l=async()=>{try{const d=localStorage.getItem("auth-token");if(!d){console.warn("No authentication token found for WebSocket connection");return}let u;try{if(u=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${d}`}})).json()).wsUrl,u.includes("localhost")&&!window.location.hostname.includes("localhost")){const x=window.location.protocol==="https:"?"wss:":"ws:",b=window.location.port==="3001"?"3002":window.location.port;u=`${x}//${window.location.hostname}:${b}`}}catch{console.warn("Could not fetch server config, falling back to current host with API server port");const g=window.location.protocol==="https:"?"wss:":"ws:",x=window.location.port==="3001"?"3002":window.location.port;u=`${g}//${window.location.hostname}:${x}`}const m=`${u}/ws?token=${encodeURIComponent(d)}`,h=new WebSocket(m);h.onopen=()=>{i(!0),r(h)},h.onmessage=p=>{try{const g=JSON.parse(p.data);s(x=>[...x,g])}catch(g){console.error("Error parsing WebSocket message:",g)}},h.onclose=()=>{i(!1),r(null),o.current=setTimeout(()=>{l()},3e3)},h.onerror=p=>{console.error("WebSocket error:",p)}}catch(d){console.error("Error creating WebSocket connection:",d)}};return{ws:e,sendMessage:d=>{e&&a?e.send(JSON.stringify(d)):console.warn("WebSocket not connected")},messages:n,isConnected:a}}const cc=f.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),dc=()=>{const e=f.useContext(cc);if(!e)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return e},Rh=({children:e})=>{const r=Lh();return t.jsx(cc.Provider,{value:r,children:e})},uc=f.createContext({projects:[],currentProject:null,projectTaskMaster:null,mcpServerStatus:null,tasks:[],nextTask:null,isLoading:!1,isLoadingTasks:!1,isLoadingMCP:!1,error:null,refreshProjects:()=>{},setCurrentProject:()=>{},refreshTasks:()=>{},refreshMCPStatus:()=>{},clearError:()=>{}}),_n=()=>{const e=f.useContext(uc);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e},_h=({children:e})=>{const{messages:r}=dc(),{user:n,token:s,isLoading:a}=ws(),[i,o]=f.useState([]),[l,c]=f.useState(null),[d,u]=f.useState(null),[m,h]=f.useState(null),[p,g]=f.useState([]),[x,b]=f.useState(null),[k,C]=f.useState(!1),[y,R]=f.useState(!1),[H,M]=f.useState(!1),[O,L]=f.useState(null),q=(F,$)=>{console.error(`TaskMaster ${$} error:`,F),L({message:F.message||`Failed to ${$}`,context:$,timestamp:new Date().toISOString()})},j=f.useCallback(()=>{L(null)},[]),T=f.useCallback(async()=>{if(!n||!s){o([]),c(null);return}try{C(!0),j();const F=await Fe.get("/projects");if(!F.ok)throw new Error(`Failed to fetch projects: ${F.status}`);const $=await F.json();if(!Array.isArray($)){console.error("Projects API returned non-array data:",$),o([]);return}const K=$.map(ce=>({...ce,taskMasterConfigured:ce.taskmaster?.hasTaskmaster||!1,taskMasterStatus:ce.taskmaster?.status||"not-configured",taskCount:ce.taskmaster?.metadata?.taskCount||0,completedCount:ce.taskmaster?.metadata?.completed||0}));if(o(K),l){const ce=K.find(S=>S.name===l.name);ce&&(c(ce),u(ce.taskmaster))}}catch(F){q(F,"load projects")}finally{C(!1)}},[n,s]),I=f.useCallback(async F=>{try{if(c(F),g([]),b(null),u(null),F?.name)try{const $=await Fe.get(`/taskmaster/detect/${encodeURIComponent(F.name)}`);if($.ok){const K=await $.json();u(K.taskmaster)}else console.warn("Individual TaskMaster detection failed, using project data:",$.status),u(F.taskmaster||null)}catch($){console.warn("TaskMaster detection error, using project data:",$.message),u(F.taskmaster||null)}else u(null)}catch($){console.error("Error in setCurrentProject:",$),q($,"set current project"),u(F?.taskmaster||null)}},[]),_=f.useCallback(async()=>{if(!n||!s){h(null);return}try{M(!0),j();const F=await Fe.get("/mcp-utils/taskmaster-server");h(F)}catch(F){q(F,"check MCP server status")}finally{M(!1)}},[n,s]),w=f.useCallback(async()=>{if(!l){g([]),b(null);return}if(!n||!s){g([]),b(null);return}try{R(!0),j();const F=await Fe.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!F.ok){const ce=await F.json();throw new Error(ce.message||"Failed to load tasks")}const $=await F.json();g($.tasks||[]);const K=$.tasks?.find(ce=>ce.status==="pending"||ce.status==="in-progress")||null;b(K)}catch(F){console.error("Error loading tasks:",F),q(F,"load tasks"),g([]),b(null)}finally{R(!1)}},[l,n,s]);f.useEffect(()=>{!a&&n&&s?(T(),_()):console.log("Auth not ready or no user, skipping project load:",{authLoading:a,user:!!n,token:!!s})},[T,_,a,n,s]),f.useEffect(()=>{n&&s&&j()},[n,s,j]),f.useEffect(()=>{l?.name&&n&&s&&w()},[l?.name,n,s,w]),f.useEffect(()=>{const F=r[r.length-1];if(F)switch(F.type){case"taskmaster-project-updated":F.projectName&&T();break;case"taskmaster-tasks-updated":F.projectName===l?.name&&w();break;case"taskmaster-mcp-status-changed":_();break}},[r,T,w,_,l]);const W={projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:m,tasks:p,nextTask:x,isLoading:k,isLoadingTasks:y,isLoadingMCP:H,error:O,refreshProjects:T,setCurrentProject:I,refreshTasks:w,refreshMCPStatus:_,clearError:j};return t.jsx(uc.Provider,{value:W,children:e})},mc=f.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),zn=()=>{const e=f.useContext(mc);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},zh=({children:e})=>{const[r,n]=f.useState(()=>{const p=localStorage.getItem("tasks-enabled");return p!==null?JSON.parse(p):!0}),[s,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(null),[d,u]=f.useState(!0);f.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(r))},[r]),f.useEffect(()=>{setTimeout(async()=>{try{const g=await Fe.get("/taskmaster/installation-status");if(g.ok){const x=await g.json();c(x),a(x.installation?.isInstalled||!1),o(x.isReady||!1);const b=localStorage.getItem("tasks-enabled");!x.installation?.isInstalled&&!b&&n(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:r,setTasksEnabled:n,toggleTasksEnabled:()=>{n(p=>!p)},isTaskMasterInstalled:s,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return t.jsx(mc.Provider,{value:h,children:e})},Yi=(e,r)=>{const n=new Date(e),s=r;if(isNaN(n.getTime()))return"Unknown";const a=s-n,i=Math.floor(a/1e3),o=Math.floor(a/(1e3*60)),l=Math.floor(a/(1e3*60*60)),c=Math.floor(a/(1e3*60*60*24));return i<60?"Just now":o===1?"1 min ago":o<60?`${o} mins ago`:l===1?"1 hour ago":l<24?`${l} hours ago`:c===1?"1 day ago":c<7?`${c} days ago`:n.toLocaleDateString()};function Qi({projects:e,selectedProject:r,selectedSession:n,onProjectSelect:s,onSessionSelect:a,onNewSession:i,onSessionDelete:o,onProjectDelete:l,isLoading:c,onRefresh:d,onShowSettings:u,updateAvailable:m,latestVersion:h,currentVersion:p,releaseInfo:g,onShowVersionModal:x,isPWA:b,isMobile:k}){const[C,y]=f.useState(new Set),[R,H]=f.useState(null),[M,O]=f.useState(!1),[L,q]=f.useState(""),[j,T]=f.useState(""),[I,_]=f.useState(!1),[w,W]=f.useState({}),[F,$]=f.useState({}),[K,ce]=f.useState(new Set),[S,Ae]=f.useState(new Date),[$e,v]=f.useState("name"),[ae,me]=f.useState(!1),[Ee,ie]=f.useState(null),[qe,re]=f.useState(""),[le,fe]=f.useState({}),[we,ve]=f.useState(""),[Ye,Ue]=f.useState(!1),[at,De]=f.useState([]),[ye,ke]=f.useState([]),[Oe,st]=f.useState(-1),{setCurrentProject:Ie,mcpServerStatus:Lt}=_n(),{tasksEnabled:te}=zn(),[de,z]=f.useState(()=>{try{const A=localStorage.getItem("starredProjects");return A?new Set(JSON.parse(A)):new Set}catch(A){return console.error("Error loading starred projects:",A),new Set}}),D=A=>ne=>{ne.target.closest(".overflow-y-auto")||ne.target.closest("[data-scroll-container]")||(ne.preventDefault(),ne.stopPropagation(),A())};f.useEffect(()=>{const A=setInterval(()=>{Ae(new Date)},6e4);return()=>clearInterval(A)},[]),f.useEffect(()=>{$({}),ce(new Set)},[e]),f.useEffect(()=>{n&&r&&y(A=>new Set([...A,r.name]))},[n,r]),f.useEffect(()=>{if(e.length>0&&!c){const A=new Set;e.forEach(ne=>{ne.sessions&&ne.sessions.length>=0&&A.add(ne.name)}),ce(A)}},[e,c]),f.useEffect(()=>{const A=()=>{try{const U=localStorage.getItem("claude-settings");if(U){const B=JSON.parse(U);v(B.projectSortOrder||"name")}}catch(U){console.error("Error loading sort order:",U)}};A();const ne=U=>{U.key==="claude-settings"&&A()};window.addEventListener("storage",ne);const P=setInterval(()=>{document.hasFocus()&&A()},1e3);return()=>{window.removeEventListener("storage",ne),clearInterval(P)}},[]),f.useEffect(()=>{(async()=>{try{const ne=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),U=await(await Fe.browseFilesystem()).json();if(U.suggestions){const B=U.suggestions.map(X=>({name:X.name,path:X.path})),N=[...ne.map(X=>({name:X.split("/").pop(),path:X})),...B];De(N)}else De(ne.map(B=>({name:B.split("/").pop(),path:B})))}catch(ne){console.error("Error loading paths:",ne);const P=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]");De(P.map(U=>({name:U.split("/").pop(),path:U})))}})()},[]),f.useEffect(()=>{const A=j.trim();if(A.length===0){Ue(!1);return}Ue(!0),(async()=>{const P=at.filter(B=>B.name.toLowerCase().includes(A.toLowerCase())||B.path.toLowerCase().includes(A.toLowerCase()));if(A.includes("/")&&A.length>1)try{let B;if(A.endsWith("/"))B=A.slice(0,-1);else{const N=A.lastIndexOf("/");B=A.substring(0,N)}if(B&&B!==""){const X=await(await Fe.browseFilesystem(B)).json();if(X.suggestions){const pe=A.substring(A.lastIndexOf("/")+1),ut=[...X.suggestions.filter(kt=>{const gt=kt.name;return pe?gt.toLowerCase().startsWith(pe.toLowerCase()):!0}).map(kt=>({name:kt.name,path:kt.path})).slice(0,8),...P].slice(0,8);ke(ut),st(-1);return}}}catch(B){console.debug("Dynamic browsing failed:",B.message)}ke(P.slice(0,8)),st(-1)})()},[j,at]);const Y=A=>{T(A.path),Ue(!1),st(-1)},Z=A=>{try{const ne=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),P=[A,...ne.filter(U=>U!==A)].slice(0,10);localStorage.setItem("recentProjectPaths",JSON.stringify(P))}catch(ne){console.error("Error saving recent paths:",ne)}},se=A=>{const ne=new Set;C.has(A)||ne.add(A),y(ne)},je=(A,ne)=>{a({...A,__projectName:ne})},_e=A=>{const ne=new Set(de);ne.has(A)?ne.delete(A):ne.add(A),z(ne);try{localStorage.setItem("starredProjects",JSON.stringify([...ne]))}catch(P){console.error("Error saving starred projects:",P)}},Le=A=>de.has(A),Ge=A=>{const ne=[...A.sessions||[],...F[A.name]||[]].map(B=>({...B,__provider:"claude"})),P=(A.cursorSessions||[]).map(B=>({...B,__provider:"cursor"})),U=B=>new Date(B.__provider==="cursor"?B.createdAt:B.lastActivity);return[...ne,...P].sort((B,N)=>U(N)-U(B))},et=A=>{const ne=Ge(A);return ne.length===0?new Date(0):ne.reduce((U,B)=>{const N=new Date(B.lastActivity);return N>U?N:U},new Date(0))},We=[...e].sort((A,ne)=>{const P=Le(A.name),U=Le(ne.name);if(P&&!U)return-1;if(!P&&U)return 1;if($e==="date")return et(ne)-et(A);{const B=A.displayName||A.name,N=ne.displayName||ne.name;return B.localeCompare(N)}}),nt=A=>{H(A.name),q(A.displayName)},ct=()=>{H(null),q("")},Rt=async A=>{try{(await Fe.renameProject(A,L)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(ne){console.error("Error renaming project:",ne)}H(null),q("")},Ot=async(A,ne)=>{if(confirm("Are you sure you want to delete this session? This action cannot be undone."))try{(await Fe.deleteSession(A,ne)).ok?o&&o(ne):(console.error("Failed to delete session"),alert("Failed to delete session. Please try again."))}catch(P){console.error("Error deleting session:",P),alert("Error deleting session. Please try again.")}},Qt=async A=>{if(confirm("Are you sure you want to delete this empty project? This action cannot be undone."))try{const ne=await Fe.deleteProject(A);if(ne.ok)l&&l(A);else{const P=await ne.json();console.error("Failed to delete project"),alert(P.error||"Failed to delete project. Please try again.")}}catch(ne){console.error("Error deleting project:",ne),alert("Error deleting project. Please try again.")}},vt=async()=>{if(!j.trim()){alert("Please enter a project path");return}_(!0);try{const A=await Fe.createProject(j.trim());if(A.ok){const ne=await A.json();Z(j.trim()),O(!1),T(""),setShowSuggestions(!1),window.refreshProjects?window.refreshProjects():window.location.reload()}else{const ne=await A.json();alert(ne.error||"Failed to create project. Please try again.")}}catch(A){console.error("Error creating project:",A),alert("Error creating project. Please try again.")}finally{_(!1)}},Vt=()=>{O(!1),T(""),setShowSuggestions(!1)},Ct=async A=>{if(!(!(A.sessionMeta?.hasMore!==!1)||w[A.name])){W(P=>({...P,[A.name]:!0}));try{const P=(A.sessions?.length||0)+(F[A.name]?.length||0),U=await Fe.sessions(A.name,5,P);if(U.ok){const B=await U.json();$(N=>({...N,[A.name]:[...N[A.name]||[],...B.sessions]})),B.hasMore===!1&&(A.sessionMeta={...A.sessionMeta,hasMore:!1})}}catch(P){console.error("Error loading more sessions:",P)}finally{W(P=>({...P,[A.name]:!1}))}}},Gt=We.filter(A=>{if(!we.trim())return!0;const ne=we.toLowerCase(),P=(A.displayName||A.name).toLowerCase(),U=A.name.toLowerCase();return P.includes(ne)||U.includes(ne)}),ft=A=>{s(A),Ie(A)};return t.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:b&&k?{paddingTop:"44px"}:{},children:[t.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[t.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(An,{className:"w-4 h-4 text-primary-foreground"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Claude Code UI"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"AI coding assistant interface"})]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{variant:"ghost",size:"sm",className:"h-9 w-9 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{me(!0);try{await d()}finally{me(!1)}},disabled:ae,title:"Refresh projects and sessions (Ctrl+R)",children:t.jsx(vr,{className:`w-4 h-4 ${ae?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})}),t.jsx(Me,{variant:"default",size:"sm",className:"h-9 w-9 px-0 bg-primary hover:bg-primary/90 transition-all duration-200 shadow-sm hover:shadow-md",onClick:()=>O(!0),title:"Create new project (Ctrl+N)",children:t.jsx(Kn,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"md:hidden p-3 border-b border-border",style:b&&k?{paddingTop:"16px"}:{},children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:t.jsx(An,{className:"w-4 h-4 text-primary-foreground"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Claude Code UI"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Projects"})]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{me(!0);try{await d()}finally{me(!1)}},disabled:ae,children:t.jsx(vr,{className:`w-4 h-4 text-foreground ${ae?"animate-spin":""}`})}),t.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>O(!0),children:t.jsx(Kn,{className:"w-4 h-4"})})]})]})})]}),M&&t.jsxs("div",{className:"md:p-3 md:border-b md:border-border md:bg-muted/30",children:[t.jsxs("div",{className:"hidden md:block space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t.jsx(Kn,{className:"w-4 h-4"}),"Create New Project"]}),t.jsxs("div",{className:"relative",children:[t.jsx(wt,{value:j,onChange:A=>T(A.target.value),placeholder:"/path/to/project or relative/path",className:"text-sm focus:ring-2 focus:ring-primary/20",autoFocus:!0,onKeyDown:A=>{if(Ye&&ye.length>0){if(A.key==="ArrowDown")A.preventDefault(),st(ne=>ne<ye.length-1?ne+1:0);else if(A.key==="ArrowUp")A.preventDefault(),st(ne=>ne>0?ne-1:ye.length-1);else if(A.key==="Enter"){A.preventDefault(),Oe>=0?Y(ye[Oe]):ye.length>0?Y(ye[0]):vt();return}else if(A.key==="Escape"){A.preventDefault(),Ue(!1);return}else if(A.key==="Tab"){A.preventDefault(),Oe>=0?Y(ye[Oe]):ye.length>0&&Y(ye[0]);return}}A.key==="Enter"&&vt(),A.key==="Escape"&&Vt()}}),Ye&&ye.length>0&&t.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-md shadow-lg max-h-48 overflow-y-auto z-50",children:ye.map((A,ne)=>t.jsx("div",{className:`px-3 py-2 cursor-pointer border-b border-border last:border-b-0 ${ne===Oe?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:P=>{P.preventDefault(),P.stopPropagation()},onClick:P=>{P.preventDefault(),P.stopPropagation(),Y(A)},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(er,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-sm",children:A.name}),t.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:A.path})]})]})},A.path))})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{size:"sm",onClick:vt,disabled:!j.trim()||I,className:"flex-1 h-8 text-xs hover:bg-primary/90 transition-colors",children:I?"Creating...":"Create Project"}),t.jsx(Me,{size:"sm",variant:"outline",onClick:Vt,disabled:I,className:"h-8 text-xs hover:bg-accent transition-colors",children:"Cancel"})]})]}),t.jsx("div",{className:"md:hidden fixed inset-0 z-[70] bg-black/50 backdrop-blur-sm flex items-end justify-center px-4 pb-24",children:t.jsxs("div",{className:"w-full max-w-sm bg-card rounded-t-lg border-t border-border p-4 space-y-4 animate-in slide-in-from-bottom duration-300",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-6 h-6 bg-primary/10 rounded-md flex items-center justify-center",children:t.jsx(Kn,{className:"w-3 h-3 text-primary"})}),t.jsx("div",{children:t.jsx("h2",{className:"text-base font-semibold text-foreground",children:"New Project"})})]}),t.jsx("button",{onClick:Vt,disabled:I,className:"w-6 h-6 rounded-md bg-muted flex items-center justify-center active:scale-95 transition-transform",children:t.jsx(ot,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(wt,{value:j,onChange:A=>T(A.target.value),placeholder:"/path/to/project or relative/path",className:"text-sm h-10 rounded-md focus:border-primary transition-colors",autoFocus:!0,onKeyDown:A=>{if(Ye&&ye.length>0){if(A.key==="ArrowDown")A.preventDefault(),st(ne=>ne<ye.length-1?ne+1:0);else if(A.key==="ArrowUp")A.preventDefault(),st(ne=>ne>0?ne-1:ye.length-1);else if(A.key==="Enter"){A.preventDefault(),Oe>=0?Y(ye[Oe]):ye.length>0?Y(ye[0]):vt();return}else if(A.key==="Escape"){A.preventDefault(),Ue(!1);return}}A.key==="Enter"&&vt(),A.key==="Escape"&&Vt()},style:{fontSize:"16px",WebkitAppearance:"none"}}),Ye&&ye.length>0&&t.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-popover border border-border rounded-md shadow-lg max-h-40 overflow-y-auto",children:ye.map((A,ne)=>t.jsx("div",{className:`px-3 py-2.5 cursor-pointer border-b border-border last:border-b-0 active:scale-95 transition-all ${ne===Oe?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:P=>{P.preventDefault(),P.stopPropagation()},onClick:P=>{P.preventDefault(),P.stopPropagation(),Y(A)},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(er,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-sm",children:A.name}),t.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:A.path})]})]})},A.path))})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{onClick:Vt,disabled:I,variant:"outline",className:"flex-1 h-9 text-sm rounded-md active:scale-95 transition-transform",children:"Cancel"}),t.jsx(Me,{onClick:vt,disabled:!j.trim()||I,className:"flex-1 h-9 text-sm rounded-md bg-primary hover:bg-primary/90 active:scale-95 transition-all",children:I?"Creating...":"Create"})]})]}),t.jsx("div",{className:"h-4"})]})})]}),e.length>0&&!c&&t.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:t.jsxs("div",{className:"relative",children:[t.jsx(Yr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),t.jsx(wt,{type:"text",placeholder:"Search projects...",value:we,onChange:A=>ve(A.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),we&&t.jsx("button",{onClick:()=>ve(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:t.jsx(ot,{className:"w-3 h-3 text-muted-foreground"})})]})}),t.jsx(Ja,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:t.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:c?t.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:t.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),t.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"Loading projects..."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching your Claude projects and sessions"})]}):e.length===0?t.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:t.jsx(er,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No projects found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Run Claude CLI in a project directory to get started"})]}):Gt.length===0?t.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:t.jsx(Yr,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No matching projects"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your search term"})]}):Gt.map(A=>{const ne=C.has(A.name),P=r?.name===A.name,U=Le(A.name);return t.jsxs("div",{className:"md:space-y-1",children:[t.jsxs("div",{className:"group md:group",children:[t.jsx("div",{className:"md:hidden",children:t.jsx("div",{className:Ce("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",P&&"bg-primary/5 border-primary/20",U&&!P&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{se(A.name)},onTouchEnd:D(()=>se(A.name)),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx("div",{className:Ce("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",ne?"bg-primary/10":"bg-muted"),children:ne?t.jsx(Pr,{className:"w-4 h-4 text-primary"}):t.jsx(er,{className:"w-4 h-4 text-muted-foreground"})}),t.jsx("div",{className:"min-w-0 flex-1",children:R===A.name?t.jsx("input",{type:"text",value:L,onChange:B=>q(B.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:"Project name",autoFocus:!0,autoComplete:"off",onClick:B=>B.stopPropagation(),onKeyDown:B=>{B.key==="Enter"&&Rt(A.name),B.key==="Escape"&&ct()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:A.displayName}),te&&t.jsx(Dh,{status:(()=>{const B=A.taskmaster?.hasTaskmaster,N=Lt?.hasMCPServer&&Lt?.isConfigured;return B&&N?"fully-configured":B?"taskmaster-only":N?"mcp-only":"not-configured"})(),size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const B=Ge(A).length,X=A.sessionMeta?.hasMore!==!1&&B>=5?`${B}+`:B;return`${X} session${X===1?"":"s"}`})()})]})})]}),t.jsx("div",{className:"flex items-center gap-1",children:R===A.name?t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:B=>{B.stopPropagation(),Rt(A.name)},children:t.jsx(Dr,{className:"w-4 h-4 text-white"})}),t.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:B=>{B.stopPropagation(),ct()},children:t.jsx(ot,{className:"w-4 h-4 text-white"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:Ce("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",U?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:B=>{B.stopPropagation(),_e(A.name)},onTouchEnd:D(()=>_e(A.name)),title:U?"Remove from favorites":"Add to favorites",children:t.jsx(Ji,{className:Ce("w-4 h-4 transition-colors",U?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),Ge(A).length===0&&t.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:B=>{B.stopPropagation(),Qt(A.name)},onTouchEnd:D(()=>Qt(A.name)),children:t.jsx(Jt,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),t.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:B=>{B.stopPropagation(),nt(A)},onTouchEnd:D(()=>nt(A)),children:t.jsx(ba,{className:"w-4 h-4 text-primary"})}),t.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:ne?t.jsx(Wt,{className:"w-3 h-3 text-muted-foreground"}):t.jsx(wr,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),t.jsxs(Me,{variant:"ghost",className:Ce("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",P&&"bg-accent text-accent-foreground",U&&!P&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{r?.name!==A.name&&ft(A),se(A.name)},onTouchEnd:D(()=>{r?.name!==A.name&&ft(A),se(A.name)}),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[ne?t.jsx(Pr,{className:"w-4 h-4 text-primary flex-shrink-0"}):t.jsx(er,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),t.jsx("div",{className:"min-w-0 flex-1 text-left",children:R===A.name?t.jsxs("div",{className:"space-y-1",children:[t.jsx("input",{type:"text",value:L,onChange:B=>q(B.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:"Project name",autoFocus:!0,onKeyDown:B=>{B.key==="Enter"&&Rt(A.name),B.key==="Escape"&&ct()}}),t.jsx("div",{className:"text-xs text-muted-foreground truncate",title:A.fullPath,children:A.fullPath})]}):t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:A.displayName,children:A.displayName}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const B=Ge(A).length;return A.sessionMeta?.hasMore!==!1&&B>=5?`${B}+`:B})(),A.fullPath!==A.displayName&&t.jsxs("span",{className:"ml-1 opacity-60",title:A.fullPath,children:["• ",A.fullPath.length>25?"..."+A.fullPath.slice(-22):A.fullPath]})]})]})})]}),t.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:R===A.name?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:B=>{B.stopPropagation(),Rt(A.name)},children:t.jsx(Dr,{className:"w-3 h-3"})}),t.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:B=>{B.stopPropagation(),ct()},children:t.jsx(ot,{className:"w-3 h-3"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:Ce("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",U?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:B=>{B.stopPropagation(),_e(A.name)},title:U?"Remove from favorites":"Add to favorites",children:t.jsx(Ji,{className:Ce("w-3 h-3 transition-colors",U?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),t.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:B=>{B.stopPropagation(),nt(A)},title:"Rename project (F2)",children:t.jsx(ba,{className:"w-3 h-3"})}),Ge(A).length===0&&t.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:B=>{B.stopPropagation(),Qt(A.name)},title:"Delete empty project (Delete)",children:t.jsx(Jt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),ne?t.jsx(Wt,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):t.jsx(wr,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),ne&&t.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[K.has(A.name)?Ge(A).length===0&&!w[A.name]?t.jsx("div",{className:"py-2 px-3 text-left",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions yet"})}):Ge(A).map(B=>{const N=B.__provider==="cursor",X=new Date(N?B.createdAt:B.lastActivity),Ke=Math.floor((S-X)/(1e3*60))<10,ut=N?B.name||"Untitled Session":B.summary||"New Session",kt=N?B.createdAt:B.lastActivity,gt=B.messageCount||0;return t.jsxs("div",{className:"group relative",children:[Ke&&t.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:t.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),t.jsx("div",{className:"md:hidden",children:t.jsx("div",{className:Ce("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",n?.id===B.id?"bg-primary/5 border-primary/20":Ke?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{ft(A),je(B,A.name)},onTouchEnd:D(()=>{ft(A),je(B,A.name)}),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:Ce("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",n?.id===B.id?"bg-primary/10":"bg-muted/50"),children:N?t.jsx(lr,{className:"w-3 h-3"}):t.jsx(tr,{className:"w-3 h-3"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:ut}),t.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[t.jsx(In,{className:"w-2.5 h-2.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Yi(kt,S)}),gt>0&&t.jsx(Tr,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:gt}),t.jsx("span",{className:"ml-1 opacity-70",children:N?t.jsx(lr,{className:"w-3 h-3"}):t.jsx(tr,{className:"w-3 h-3"})})]})]}),!N&&t.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:mt=>{mt.stopPropagation(),Ot(A.name,B.id)},onTouchEnd:D(()=>Ot(A.name,B.id)),children:t.jsx(Jt,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),t.jsxs("div",{className:"hidden md:block",children:[t.jsx(Me,{variant:"ghost",className:Ce("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",n?.id===B.id&&"bg-accent text-accent-foreground"),onClick:()=>je(B,A.name),onTouchEnd:D(()=>je(B,A.name)),children:t.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[N?t.jsx(lr,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):t.jsx(tr,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:ut}),t.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[t.jsx(In,{className:"w-2.5 h-2.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Yi(kt,S)}),gt>0&&t.jsx(Tr,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:gt}),t.jsx("span",{className:"ml-1 opacity-70",children:N?t.jsx(lr,{className:"w-3 h-3"}):t.jsx(tr,{className:"w-3 h-3"})})]})]})]})}),!N&&t.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:Ee===B.id?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"text",value:qe,onChange:mt=>re(mt.target.value),onKeyDown:mt=>{mt.stopPropagation(),mt.key==="Enter"?updateSessionSummary(A.name,B.id,qe):mt.key==="Escape"&&(ie(null),re(""))},onClick:mt=>mt.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),t.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:mt=>{mt.stopPropagation(),updateSessionSummary(A.name,B.id,qe)},title:"Save",children:t.jsx(Dr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),t.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:mt=>{mt.stopPropagation(),ie(null),re("")},title:"Cancel",children:t.jsx(ot,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:mt=>{mt.stopPropagation(),ie(B.id),re(B.summary||"New Session")},title:"Manually edit session name",children:t.jsx(nh,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),t.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:mt=>{mt.stopPropagation(),Ot(A.name,B.id)},title:"Delete this session permanently",children:t.jsx(Jt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},B.id)}):Array.from({length:3}).map((B,N)=>t.jsx("div",{className:"p-2 rounded-md",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+N*15}%`}}),t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},N)),Ge(A).length>0&&A.sessionMeta?.hasMore!==!1&&t.jsx(Me,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>Ct(A),disabled:w[A.name],children:w[A.name]?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"Loading..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Wt,{className:"w-3 h-3"}),"Show more sessions"]})}),t.jsx("div",{className:"md:hidden px-3 pb-2",children:t.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{ft(A),i(A)},children:[t.jsx(St,{className:"w-3 h-3"}),"New Session"]})}),t.jsxs(Me,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>i(A),children:[t.jsx(St,{className:"w-3 h-3"}),"New Session"]})]})]},A.name)})})}),m&&t.jsxs("div",{className:"md:p-2 border-t border-border/50 flex-shrink-0",children:[t.jsx("div",{className:"hidden md:block",children:t.jsxs(Me,{variant:"ghost",className:"w-full justify-start gap-3 p-3 h-auto font-normal text-left hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors duration-200 border border-blue-200 dark:border-blue-700 rounded-lg mb-2",onClick:x,children:[t.jsxs("div",{className:"relative",children:[t.jsx("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),t.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:g?.title||`Version ${h}`}),t.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Update available"})]})]})}),t.jsx("div",{className:"md:hidden p-3 pb-2",children:t.jsxs("button",{className:"w-full h-12 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-xl flex items-center justify-start gap-3 px-4 active:scale-[0.98] transition-all duration-150",onClick:x,children:[t.jsxs("div",{className:"relative",children:[t.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),t.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),t.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[t.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:g?.title||`Version ${h}`}),t.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Update available"})]})]})})]}),t.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[t.jsx("div",{className:"md:hidden p-4 pb-20 border-t border-border/50",children:t.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:u,children:[t.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:t.jsx(Qr,{className:"w-5 h-5 text-muted-foreground"})}),t.jsx("span",{className:"text-lg font-medium text-foreground",children:"Settings"})]})}),t.jsxs(Me,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:u,children:[t.jsx(Qr,{className:"w-3 h-3"}),t.jsx("span",{className:"text-xs",children:"Settings"})]})]})]})}function Fh(e,r){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $h=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oh=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bh={};function Xi(e,r){return(Bh.jsx?Oh:$h).test(e)}const Uh=/[ \t\n\f\r]/g;function Wh(e){return typeof e=="object"?e.type==="text"?Zi(e.value):!1:Zi(e)}function Zi(e){return e.replace(Uh,"")===""}class Fn{constructor(r,n,s){this.normal=n,this.property=r,s&&(this.space=s)}}Fn.prototype.normal={};Fn.prototype.property={};Fn.prototype.space=void 0;function pc(e,r){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Fn(n,s,r)}function ka(e){return e.toLowerCase()}class Pt{constructor(r,n){this.attribute=n,this.property=r}}Pt.prototype.attribute="";Pt.prototype.booleanish=!1;Pt.prototype.boolean=!1;Pt.prototype.commaOrSpaceSeparated=!1;Pt.prototype.commaSeparated=!1;Pt.prototype.defined=!1;Pt.prototype.mustUseProperty=!1;Pt.prototype.number=!1;Pt.prototype.overloadedBoolean=!1;Pt.prototype.property="";Pt.prototype.spaceSeparated=!1;Pt.prototype.space=void 0;let Hh=0;const Be=Fr(),xt=Fr(),va=Fr(),oe=Fr(),dt=Fr(),Gr=Fr(),_t=Fr();function Fr(){return 2**++Hh}const wa=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:xt,commaOrSpaceSeparated:_t,commaSeparated:Gr,number:oe,overloadedBoolean:va,spaceSeparated:dt},Symbol.toStringTag,{value:"Module"})),Os=Object.keys(wa);class Za extends Pt{constructor(r,n,s,a){let i=-1;if(super(r,n),eo(this,"space",a),typeof s=="number")for(;++i<Os.length;){const o=Os[i];eo(this,Os[i],(s&wa[o])===wa[o])}}}Za.prototype.defined=!0;function eo(e,r,n){n&&(e[r]=n)}function ln(e){const r={},n={};for(const[s,a]of Object.entries(e.properties)){const i=new Za(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),r[s]=i,n[ka(s)]=s,n[ka(i.attribute)]=s}return new Fn(r,n,e.space)}const hc=ln({properties:{ariaActiveDescendant:null,ariaAtomic:xt,ariaAutoComplete:null,ariaBusy:xt,ariaChecked:xt,ariaColCount:oe,ariaColIndex:oe,ariaColSpan:oe,ariaControls:dt,ariaCurrent:null,ariaDescribedBy:dt,ariaDetails:null,ariaDisabled:xt,ariaDropEffect:dt,ariaErrorMessage:null,ariaExpanded:xt,ariaFlowTo:dt,ariaGrabbed:xt,ariaHasPopup:null,ariaHidden:xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dt,ariaLevel:oe,ariaLive:null,ariaModal:xt,ariaMultiLine:xt,ariaMultiSelectable:xt,ariaOrientation:null,ariaOwns:dt,ariaPlaceholder:null,ariaPosInSet:oe,ariaPressed:xt,ariaReadOnly:xt,ariaRelevant:null,ariaRequired:xt,ariaRoleDescription:dt,ariaRowCount:oe,ariaRowIndex:oe,ariaRowSpan:oe,ariaSelected:xt,ariaSetSize:oe,ariaSort:null,ariaValueMax:oe,ariaValueMin:oe,ariaValueNow:oe,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function fc(e,r){return r in e?e[r]:r}function gc(e,r){return fc(e,r.toLowerCase())}const qh=ln({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Gr,acceptCharset:dt,accessKey:dt,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:dt,autoFocus:Be,autoPlay:Be,blocking:dt,capture:null,charSet:null,checked:Be,cite:null,className:dt,cols:oe,colSpan:null,content:null,contentEditable:xt,controls:Be,controlsList:dt,coords:oe|Gr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:va,draggable:xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:dt,height:oe,hidden:va,high:oe,href:null,hrefLang:null,htmlFor:dt,httpEquiv:dt,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:dt,itemRef:dt,itemScope:Be,itemType:dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:oe,manifest:null,max:null,maxLength:oe,media:null,method:null,min:null,minLength:oe,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Be,optimum:oe,pattern:null,ping:dt,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:dt,required:Be,reversed:Be,rows:oe,rowSpan:oe,sandbox:dt,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:oe,sizes:null,slot:null,span:oe,spellCheck:xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oe,step:null,style:null,tabIndex:oe,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:xt,width:oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dt,axis:null,background:null,bgColor:null,border:oe,borderColor:null,bottomMargin:oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:oe,leftMargin:oe,link:null,longDesc:null,lowSrc:null,marginHeight:oe,marginWidth:oe,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:oe,rules:null,scheme:null,scrolling:xt,standby:null,summary:null,text:null,topMargin:oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:oe,security:null,unselectable:null},space:"html",transform:gc}),Vh=ln({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:_t,accentHeight:oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oe,amplitude:oe,arabicForm:null,ascent:oe,attributeName:null,attributeType:null,azimuth:oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oe,by:null,calcMode:null,capHeight:oe,className:dt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:oe,diffuseConstant:oe,direction:null,display:null,dur:null,divisor:oe,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:oe,enableBackground:null,end:null,event:null,exponent:oe,externalResourcesRequired:null,fill:null,fillOpacity:oe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Gr,g2:Gr,glyphName:Gr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oe,horizOriginX:oe,horizOriginY:oe,id:null,ideographic:oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oe,k:oe,k1:oe,k2:oe,k3:oe,k4:oe,kernelMatrix:_t,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:oe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:oe,overlineThickness:oe,paintOrder:null,panose1:null,path:null,pathLength:oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oe,pointsAtY:oe,pointsAtZ:oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_t,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_t,rev:_t,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_t,requiredFeatures:_t,requiredFonts:_t,requiredFormats:_t,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:oe,specularExponent:oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oe,strikethroughThickness:oe,string:null,stroke:null,strokeDashArray:_t,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oe,strokeOpacity:oe,strokeWidth:null,style:null,surfaceScale:oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_t,tabIndex:oe,tableValues:null,target:null,targetX:oe,targetY:oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_t,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oe,underlineThickness:oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oe,values:null,vAlphabetic:oe,vMathematical:oe,vectorEffect:null,vHanging:oe,vIdeographic:oe,version:null,vertAdvY:oe,vertOriginX:oe,vertOriginY:oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fc}),xc=ln({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),bc=ln({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gc}),yc=ln({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),Gh={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Kh=/[A-Z]/g,to=/-[a-z]/g,Jh=/^data[-\w.:]+$/i;function Yh(e,r){const n=ka(r);let s=r,a=Pt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Jh.test(r)){if(r.charAt(4)==="-"){const i=r.slice(5).replace(to,Xh);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=r.slice(4);if(!to.test(i)){let o=i.replace(Kh,Qh);o.charAt(0)!=="-"&&(o="-"+o),r="data"+o}}a=Za}return new a(s,r)}function Qh(e){return"-"+e.toLowerCase()}function Xh(e){return e.charAt(1).toUpperCase()}const Zh=pc([hc,qh,xc,bc,yc],"html"),ei=pc([hc,Vh,xc,bc,yc],"svg");function e0(e){return e.join(" ").trim()}var Wr={},Bs,ro;function t0(){if(ro)return Bs;ro=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
387
- `,d="/",u="*",m="",h="comment",p="declaration";Bs=function(x,b){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];b=b||{};var k=1,C=1;function y(_){var w=_.match(r);w&&(k+=w.length);var W=_.lastIndexOf(c);C=~W?_.length-W:C+_.length}function R(){var _={line:k,column:C};return function(w){return w.position=new H(_),L(),w}}function H(_){this.start=_,this.end={line:k,column:C},this.source=b.source}H.prototype.content=x;function M(_){var w=new Error(b.source+":"+k+":"+C+": "+_);if(w.reason=_,w.filename=b.source,w.line=k,w.column=C,w.source=x,!b.silent)throw w}function O(_){var w=_.exec(x);if(w){var W=w[0];return y(W),x=x.slice(W.length),w}}function L(){O(n)}function q(_){var w;for(_=_||[];w=j();)w!==!1&&_.push(w);return _}function j(){var _=R();if(!(d!=x.charAt(0)||u!=x.charAt(1))){for(var w=2;m!=x.charAt(w)&&(u!=x.charAt(w)||d!=x.charAt(w+1));)++w;if(w+=2,m===x.charAt(w-1))return M("End of comment missing");var W=x.slice(2,w-2);return C+=2,y(W),x=x.slice(w),C+=2,_({type:h,comment:W})}}function T(){var _=R(),w=O(s);if(w){if(j(),!O(a))return M("property missing ':'");var W=O(i),F=_({type:p,property:g(w[0].replace(e,m)),value:W?g(W[0].replace(e,m)):m});return O(o),F}}function I(){var _=[];q(_);for(var w;w=T();)w!==!1&&(_.push(w),q(_));return _}return L(),I()};function g(x){return x?x.replace(l,m):m}return Bs}var no;function r0(){if(no)return Wr;no=1;var e=Wr&&Wr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.default=n;var r=e(t0());function n(s,a){var i=null;if(!s||typeof s!="string")return i;var o=(0,r.default)(s),l=typeof a=="function";return o.forEach(function(c){if(c.type==="declaration"){var d=c.property,u=c.value;l?a(d,u,c):u&&(i=i||{},i[d]=u)}}),i}return Wr}var fn={},so;function n0(){if(so)return fn;so=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(d){return!d||n.test(d)||e.test(d)},o=function(d,u){return u.toUpperCase()},l=function(d,u){return"".concat(u,"-")},c=function(d,u){return u===void 0&&(u={}),i(d)?d:(d=d.toLowerCase(),u.reactCompat?d=d.replace(a,l):d=d.replace(s,l),d.replace(r,o))};return fn.camelCase=c,fn}var gn,ao;function s0(){if(ao)return gn;ao=1;var e=gn&&gn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},r=e(r0()),n=n0();function s(a,i){var o={};return!a||typeof a!="string"||(0,r.default)(a,function(l,c){l&&c&&(o[(0,n.camelCase)(l,i)]=c)}),o}return s.default=s,gn=s,gn}var a0=s0();const i0=Ln(a0),kc=vc("end"),ti=vc("start");function vc(e){return r;function r(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function o0(e){const r=ti(e),n=kc(e);if(r&&n)return{start:r,end:n}}function Cn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?io(e.position):"start"in e||"end"in e?io(e):"line"in e||"column"in e?ja(e):""}function ja(e){return oo(e&&e.line)+":"+oo(e&&e.column)}function io(e){return ja(e&&e.start)+"-"+ja(e&&e.end)}function oo(e){return e&&typeof e=="number"?e:1}class Nt extends Error{constructor(r,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof r=="string"?a=r:!i.cause&&r&&(o=!0,a=r.message,i.cause=r),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=l?l.line:void 0,this.name=Cn(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Nt.prototype.file="";Nt.prototype.name="";Nt.prototype.reason="";Nt.prototype.message="";Nt.prototype.stack="";Nt.prototype.column=void 0;Nt.prototype.line=void 0;Nt.prototype.ancestors=void 0;Nt.prototype.cause=void 0;Nt.prototype.fatal=void 0;Nt.prototype.place=void 0;Nt.prototype.ruleId=void 0;Nt.prototype.source=void 0;const ri={}.hasOwnProperty,l0=new Map,c0=/[A-Z]/g,d0=new Set(["table","tbody","thead","tfoot","tr"]),u0=new Set(["td","th"]),wc="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m0(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=k0(n,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=y0(n,r.jsx,r.jsxs)}const a={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?ei:Zh,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},i=jc(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function jc(e,r,n){if(r.type==="element")return p0(e,r,n);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return h0(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return g0(e,r,n);if(r.type==="mdxjsEsm")return f0(e,r);if(r.type==="root")return x0(e,r,n);if(r.type==="text")return b0(e,r)}function p0(e,r,n){const s=e.schema;let a=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=ei,e.schema=a),e.ancestors.push(r);const i=Cc(e,r.tagName,!1),o=v0(e,r);let l=si(e,r);return d0.has(r.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Wh(c):!0})),Nc(e,o,i,r),ni(o,l),e.ancestors.pop(),e.schema=s,e.create(r,i,o,n)}function h0(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Mn(e,r.position)}function f0(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Mn(e,r.position)}function g0(e,r,n){const s=e.schema;let a=s;r.name==="svg"&&s.space==="html"&&(a=ei,e.schema=a),e.ancestors.push(r);const i=r.name===null?e.Fragment:Cc(e,r.name,!0),o=w0(e,r),l=si(e,r);return Nc(e,o,i,r),ni(o,l),e.ancestors.pop(),e.schema=s,e.create(r,i,o,n)}function x0(e,r,n){const s={};return ni(s,si(e,r)),e.create(r,e.Fragment,s,n)}function b0(e,r){return r.value}function Nc(e,r,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(r.node=s)}function ni(e,r){if(r.length>0){const n=r.length>1?r:r[0];n&&(e.children=n)}}function y0(e,r,n){return s;function s(a,i,o,l){const d=Array.isArray(o.children)?n:r;return l?d(i,o,l):d(i,o)}}function k0(e,r){return n;function n(s,a,i,o){const l=Array.isArray(i.children),c=ti(s);return r(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function v0(e,r){const n={};let s,a;for(a in r.properties)if(a!=="children"&&ri.call(r.properties,a)){const i=j0(e,a,r.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&u0.has(r.tagName)?s=l:n[o]=l}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function w0(e,r){const n={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Mn(e,r.position);else{const a=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Mn(e,r.position);else i=s.value===null?!0:s.value;n[a]=i}return n}function si(e,r){const n=[];let s=-1;const a=e.passKeys?new Map:l0;for(;++s<r.children.length;){const i=r.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=a.get(c)||0;o=c+"-"+d,a.set(c,d+1)}}const l=jc(e,i,o);l!==void 0&&n.push(l)}return n}function j0(e,r,n){const s=Yh(e.schema,r);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?Fh(n):e0(n)),s.property==="style"){let a=typeof n=="object"?n:N0(e,String(n));return e.stylePropertyNameCase==="css"&&(a=C0(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?Gh[s.property]||s.property:s.attribute,n]}}function N0(e,r){try{return i0(r,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Nt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=wc+"#cannot-parse-style-attribute",a}}function Cc(e,r,n){let s;if(!n)s={type:"Literal",value:r};else if(r.includes(".")){const a=r.split(".");let i=-1,o;for(;++i<a.length;){const l=Xi(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}s=o}else s=Xi(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const a=s.value;return ri.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);Mn(e)}function Mn(e,r){const n=new Nt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=wc+"#cannot-handle-mdx-estrees-without-createevaluater",n}function C0(e){const r={};let n;for(n in e)ri.call(e,n)&&(r[S0(n)]=e[n]);return r}function S0(e){let r=e.replace(c0,E0);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function E0(e){return"-"+e.toLowerCase()}const Us={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},I0={};function ai(e,r){const n=I0,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Sc(e,s,a)}function Sc(e,r,n){if(A0(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return lo(e.children,r,n)}return Array.isArray(e)?lo(e,r,n):""}function lo(e,r,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=Sc(e[a],r,n);return s.join("")}function A0(e){return!!(e&&typeof e=="object")}const co=document.createElement("i");function ii(e){const r="&"+e+";";co.innerHTML=r;const n=co.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===r?!1:n}function $t(e,r,n,s){const a=e.length;let i=0,o;if(r<0?r=-r>a?0:a+r:r=r>a?a:r,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(r,n),e.splice(...o);else for(n&&e.splice(r,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(r,0),e.splice(...o),i+=1e4,r+=1e4}function Ut(e,r){return e.length>0?($t(e,e.length,0,r),e):r}const uo={}.hasOwnProperty;function Ec(e){const r={};let n=-1;for(;++n<e.length;)M0(r,e[n]);return r}function M0(e,r){let n;for(n in r){const a=(uo.call(e,n)?e[n]:void 0)||(e[n]={}),i=r[n];let o;if(i)for(o in i){uo.call(a,o)||(a[o]=[]);const l=i[o];T0(a[o],Array.isArray(l)?l:l?[l]:[])}}}function T0(e,r){let n=-1;const s=[];for(;++n<r.length;)(r[n].add==="after"?e:s).push(r[n]);$t(e,0,0,s)}function Ic(e,r){const n=Number.parseInt(e,r);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Yt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Et=jr(/[A-Za-z]/),jt=jr(/[\dA-Za-z]/),D0=jr(/[#-'*+\--9=?A-Z^-~]/);function us(e){return e!==null&&(e<32||e===127)}const Na=jr(/\d/),P0=jr(/[\dA-Fa-f]/),L0=jr(/[!-/:-@[-`{-~]/);function Te(e){return e!==null&&e<-2}function lt(e){return e!==null&&(e<0||e===32)}function Xe(e){return e===-2||e===-1||e===32}const js=jr(new RegExp("\\p{P}|\\p{S}","u")),_r=jr(/\s/);function jr(e){return r;function r(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function cn(e){const r=[];let n=-1,s=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&jt(e.charCodeAt(n+1))&&jt(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(r.push(e.slice(s,n),encodeURIComponent(o)),s=n+a+1,o=""),a&&(n+=a,a=0)}return r.join("")+e.slice(s)}function rt(e,r,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Xe(c)?(e.enter(n),l(c)):r(c)}function l(c){return Xe(c)&&i++<a?(e.consume(c),l):(e.exit(n),r(c))}}const R0={tokenize:_0};function _0(e){const r=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),rt(e,r,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Te(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const z0={tokenize:F0},mo={tokenize:$0};function F0(e){const r=this,n=[];let s=0,a,i,o;return l;function l(y){if(s<n.length){const R=n[s];return r.containerState=R[1],e.attempt(R[0].continuation,c,d)(y)}return d(y)}function c(y){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,a&&C();const R=r.events.length;let H=R,M;for(;H--;)if(r.events[H][0]==="exit"&&r.events[H][1].type==="chunkFlow"){M=r.events[H][1].end;break}k(s);let O=R;for(;O<r.events.length;)r.events[O][1].end={...M},O++;return $t(r.events,H+1,0,r.events.slice(R)),r.events.length=O,d(y)}return l(y)}function d(y){if(s===n.length){if(!a)return h(y);if(a.currentConstruct&&a.currentConstruct.concrete)return g(y);r.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(mo,u,m)(y)}function u(y){return a&&C(),k(s),h(y)}function m(y){return r.parser.lazy[r.now().line]=s!==n.length,o=r.now().offset,g(y)}function h(y){return r.containerState={},e.attempt(mo,p,g)(y)}function p(y){return s++,n.push([r.currentConstruct,r.containerState]),h(y)}function g(y){if(y===null){a&&C(),k(0),e.consume(y);return}return a=a||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),x(y)}function x(y){if(y===null){b(e.exit("chunkFlow"),!0),k(0),e.consume(y);return}return Te(y)?(e.consume(y),b(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(y),x)}function b(y,R){const H=r.sliceStream(y);if(R&&H.push(null),y.previous=i,i&&(i.next=y),i=y,a.defineSkip(y.start),a.write(H),r.parser.lazy[y.start.line]){let M=a.events.length;for(;M--;)if(a.events[M][1].start.offset<o&&(!a.events[M][1].end||a.events[M][1].end.offset>o))return;const O=r.events.length;let L=O,q,j;for(;L--;)if(r.events[L][0]==="exit"&&r.events[L][1].type==="chunkFlow"){if(q){j=r.events[L][1].end;break}q=!0}for(k(s),M=O;M<r.events.length;)r.events[M][1].end={...j},M++;$t(r.events,L+1,0,r.events.slice(O)),r.events.length=M}}function k(y){let R=n.length;for(;R-- >y;){const H=n[R];r.containerState=H[1],H[0].exit.call(r,e)}n.length=y}function C(){a.write([null]),i=void 0,a=void 0,r.containerState._closeFlow=void 0}}function $0(e,r,n){return rt(e,e.attempt(this.parser.constructs.document,r,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Zr(e){if(e===null||lt(e)||_r(e))return 1;if(js(e))return 2}function Ns(e,r,n){const s=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!s.includes(i)&&(r=i(r,n),s.push(i))}return r}const Ca={name:"attention",resolveAll:O0,tokenize:B0};function O0(e,r){let n=-1,s,a,i,o,l,c,d,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[s][1].end},h={...e[n][1].start};po(m,-c),po(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[s][1].end={...o.start},e[n][1].start={...l.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=Ut(d,[["enter",e[s][1],r],["exit",e[s][1],r]])),d=Ut(d,[["enter",a,r],["enter",o,r],["exit",o,r],["enter",i,r]]),d=Ut(d,Ns(r.parser.constructs.insideSpan.null,e.slice(s+1,n),r)),d=Ut(d,[["exit",i,r],["enter",l,r],["exit",l,r],["exit",a,r]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,d=Ut(d,[["enter",e[n][1],r],["exit",e[n][1],r]])):u=0,$t(e,s-1,n-s+3,d),n=s+d.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function B0(e,r){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Zr(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),u=Zr(c),m=!u||u===2&&a||n.includes(c),h=!a||a===2&&u||n.includes(s);return d._open=!!(i===42?m:m&&(a||!h)),d._close=!!(i===42?h:h&&(u||!m)),r(c)}}function po(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const U0={name:"autolink",tokenize:W0};function W0(e,r,n){let s=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Et(p)?(e.consume(p),o):p===64?n(p):d(p)}function o(p){return p===43||p===45||p===46||jt(p)?(s=1,l(p)):d(p)}function l(p){return p===58?(e.consume(p),s=0,c):(p===43||p===45||p===46||jt(p))&&s++<32?(e.consume(p),l):(s=0,d(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),r):p===null||p===32||p===60||us(p)?n(p):(e.consume(p),c)}function d(p){return p===64?(e.consume(p),u):D0(p)?(e.consume(p),d):n(p)}function u(p){return jt(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),s=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),r):h(p)}function h(p){if((p===45||jt(p))&&s++<63){const g=p===45?h:m;return e.consume(p),g}return n(p)}}const $n={partial:!0,tokenize:H0};function H0(e,r,n){return s;function s(i){return Xe(i)?rt(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Te(i)?r(i):n(i)}}const Ac={continuation:{tokenize:V0},exit:G0,name:"blockQuote",tokenize:q0};function q0(e,r,n){const s=this;return a;function a(o){if(o===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Xe(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(o))}}function V0(e,r,n){const s=this;return a;function a(o){return Xe(o)?rt(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Ac,r,n)(o)}}function G0(e){e.exit("blockQuote")}const Mc={name:"characterEscape",tokenize:K0};function K0(e,r,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return L0(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):n(i)}}const Tc={name:"characterReference",tokenize:J0};function J0(e,r,n){const s=this;let a=0,i,o;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),c}function c(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,o=jt,u(m))}function d(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=P0,u):(e.enter("characterReferenceValue"),i=7,o=Na,u(m))}function u(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return o===jt&&!ii(s.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return o(m)&&a++<i?(e.consume(m),u):n(m)}}const ho={partial:!0,tokenize:Q0},fo={concrete:!0,name:"codeFenced",tokenize:Y0};function Y0(e,r,n){const s=this,a={partial:!0,tokenize:H};let i=0,o=0,l;return c;function c(M){return d(M)}function d(M){const O=s.events[s.events.length-1];return i=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,l=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(M)}function u(M){return M===l?(o++,e.consume(M),u):o<3?n(M):(e.exit("codeFencedFenceSequence"),Xe(M)?rt(e,m,"whitespace")(M):m(M))}function m(M){return M===null||Te(M)?(e.exit("codeFencedFence"),s.interrupt?r(M):e.check(ho,x,R)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(M))}function h(M){return M===null||Te(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(M)):Xe(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),rt(e,p,"whitespace")(M)):M===96&&M===l?n(M):(e.consume(M),h)}function p(M){return M===null||Te(M)?m(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(M))}function g(M){return M===null||Te(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(M)):M===96&&M===l?n(M):(e.consume(M),g)}function x(M){return e.attempt(a,R,b)(M)}function b(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),k}function k(M){return i>0&&Xe(M)?rt(e,C,"linePrefix",i+1)(M):C(M)}function C(M){return M===null||Te(M)?e.check(ho,x,R)(M):(e.enter("codeFlowValue"),y(M))}function y(M){return M===null||Te(M)?(e.exit("codeFlowValue"),C(M)):(e.consume(M),y)}function R(M){return e.exit("codeFenced"),r(M)}function H(M,O,L){let q=0;return j;function j(W){return M.enter("lineEnding"),M.consume(W),M.exit("lineEnding"),T}function T(W){return M.enter("codeFencedFence"),Xe(W)?rt(M,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):I(W)}function I(W){return W===l?(M.enter("codeFencedFenceSequence"),_(W)):L(W)}function _(W){return W===l?(q++,M.consume(W),_):q>=o?(M.exit("codeFencedFenceSequence"),Xe(W)?rt(M,w,"whitespace")(W):w(W)):L(W)}function w(W){return W===null||Te(W)?(M.exit("codeFencedFence"),O(W)):L(W)}}}function Q0(e,r,n){const s=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):r(o)}}const Ws={name:"codeIndented",tokenize:Z0},X0={partial:!0,tokenize:ef};function Z0(e,r,n){const s=this;return a;function a(d){return e.enter("codeIndented"),rt(e,i,"linePrefix",5)(d)}function i(d){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?c(d):Te(d)?e.attempt(X0,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||Te(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),r(d)}}function ef(e,r,n){const s=this;return a;function a(o){return s.parser.lazy[s.now().line]?n(o):Te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):rt(e,i,"linePrefix",5)(o)}function i(o){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(o):Te(o)?a(o):n(o)}}const tf={name:"codeText",previous:nf,resolve:rf,tokenize:sf};function rf(e){let r=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=n;++s<r;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[r][1].type="codeTextPadding",n+=2,r-=2;break}}for(s=n-1,r++;++s<=r;)a===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(a=s):(s===r||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),r-=s-a-2,s=a+2),a=void 0);return e}function nf(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sf(e,r,n){let s=0,a,i;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(i=e.enter("codeTextSequence"),a=0,u(m)):Te(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||Te(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),d)}function u(m){return m===96?(e.consume(m),a++,u):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(i.type="codeTextData",d(m))}}class af{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,n,s){const a=n||0;this.setCursor(Math.trunc(r));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&xn(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),xn(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),xn(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const n=this.left.splice(r,Number.POSITIVE_INFINITY);xn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);xn(this.left,n.reverse())}}}function xn(e,r){let n=0;if(r.length<1e4)e.push(...r);else for(;n<r.length;)e.push(...r.slice(n,n+1e4)),n+=1e4}function Dc(e){const r={};let n=-1,s,a,i,o,l,c,d;const u=new af(e);for(;++n<u.length;){for(;n in r;)n=r[n];if(s=u.get(n),n&&s[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,of(u,n)),n=r[n],d=!0);else if(s[1]._container){for(i=n,a=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(u.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(s[1].end={...u.get(a)[1].start},l=u.slice(a,n),l.unshift(s),u.splice(a,n-a+1,l))}}return $t(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function of(e,r){const n=e.get(r)[1],s=e.get(r)[2];let a=r-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,m,h=-1,p=n,g=0,x=0;const b=[x];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(u=s.sliceStream(p),p.next||u.push(null),m&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(x=h+1,b.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const k=l.slice(b[h],b[h+1]),C=i.pop();c.push([C,C+k.length-1]),e.splice(C,2,k)}for(c.reverse(),h=-1;++h<c.length;)d[g+c[h][0]]=g+c[h][1],g+=c[h][1]-c[h][0]-1;return d}const lf={resolve:df,tokenize:uf},cf={partial:!0,tokenize:mf};function df(e){return Dc(e),e}function uf(e,r){let n;return s;function s(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):Te(l)?e.check(cf,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function mf(e,r,n){const s=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),rt(e,i,"linePrefix")}function i(o){if(o===null||Te(o))return n(o);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(o):e.interrupt(s.parser.constructs.flow,n,r)(o)}}function Pc(e,r,n,s,a,i,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return m;function m(k){return k===60?(e.enter(s),e.enter(a),e.enter(i),e.consume(k),e.exit(i),h):k===null||k===32||k===41||us(k)?n(k):(e.enter(s),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(k))}function h(k){return k===62?(e.enter(i),e.consume(k),e.exit(i),e.exit(a),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===62?(e.exit("chunkString"),e.exit(l),h(k)):k===null||k===60||Te(k)?n(k):(e.consume(k),k===92?g:p)}function g(k){return k===60||k===62||k===92?(e.consume(k),p):p(k)}function x(k){return!u&&(k===null||k===41||lt(k))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(s),r(k)):u<d&&k===40?(e.consume(k),u++,x):k===41?(e.consume(k),u--,x):k===null||k===32||k===40||us(k)?n(k):(e.consume(k),k===92?b:x)}function b(k){return k===40||k===41||k===92?(e.consume(k),x):x(k)}}function Lc(e,r,n,s,a,i){const o=this;let l=0,c;return d;function d(p){return e.enter(s),e.enter(a),e.consume(p),e.exit(a),e.enter(i),u}function u(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(s),r):Te(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||Te(p)||l++>999?(e.exit("chunkString"),u(p)):(e.consume(p),c||(c=!Xe(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,m):m(p)}}function Rc(e,r,n,s,a,i){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(s),e.enter(a),e.consume(h),e.exit(a),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(a),e.consume(h),e.exit(a),e.exit(s),r):(e.enter(i),d(h))}function d(h){return h===o?(e.exit(i),c(o)):h===null?n(h):Te(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),rt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||Te(h)?(e.exit("chunkString"),d(h)):(e.consume(h),h===92?m:u)}function m(h){return h===o||h===92?(e.consume(h),u):u(h)}}function Sn(e,r){let n;return s;function s(a){return Te(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Xe(a)?rt(e,s,n?"linePrefix":"lineSuffix")(a):r(a)}}const pf={name:"definition",tokenize:ff},hf={partial:!0,tokenize:gf};function ff(e,r,n){const s=this;let a;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return Lc.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return a=Yt(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return lt(p)?Sn(e,d)(p):d(p)}function d(p){return Pc(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(hf,m,m)(p)}function m(p){return Xe(p)?rt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Te(p)?(e.exit("definition"),s.parser.defined.push(a),r(p)):n(p)}}function gf(e,r,n){return s;function s(l){return lt(l)?Sn(e,a)(l):n(l)}function a(l){return Rc(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Xe(l)?rt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Te(l)?r(l):n(l)}}const xf={name:"hardBreakEscape",tokenize:bf};function bf(e,r,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Te(i)?(e.exit("hardBreakEscape"),r(i)):n(i)}}const yf={name:"headingAtx",resolve:kf,tokenize:vf};function kf(e,r){let n=e.length-2,s=3,a,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},$t(e,s,n-s+1,[["enter",a,r],["enter",i,r],["exit",i,r],["exit",a,r]])),e}function vf(e,r,n){let s=0;return a;function a(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&s++<6?(e.consume(u),o):u===null||lt(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||Te(u)?(e.exit("atxHeading"),r(u)):Xe(u)?rt(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||lt(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const wf=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],go=["pre","script","style","textarea"],jf={concrete:!0,name:"htmlFlow",resolveTo:Sf,tokenize:Ef},Nf={partial:!0,tokenize:Af},Cf={partial:!0,tokenize:If};function Sf(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function Ef(e,r,n){const s=this;let a,i,o,l,c;return d;function d(v){return u(v)}function u(v){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(v),m}function m(v){return v===33?(e.consume(v),h):v===47?(e.consume(v),i=!0,x):v===63?(e.consume(v),a=3,s.interrupt?r:S):Et(v)?(e.consume(v),o=String.fromCharCode(v),b):n(v)}function h(v){return v===45?(e.consume(v),a=2,p):v===91?(e.consume(v),a=5,l=0,g):Et(v)?(e.consume(v),a=4,s.interrupt?r:S):n(v)}function p(v){return v===45?(e.consume(v),s.interrupt?r:S):n(v)}function g(v){const ae="CDATA[";return v===ae.charCodeAt(l++)?(e.consume(v),l===ae.length?s.interrupt?r:I:g):n(v)}function x(v){return Et(v)?(e.consume(v),o=String.fromCharCode(v),b):n(v)}function b(v){if(v===null||v===47||v===62||lt(v)){const ae=v===47,me=o.toLowerCase();return!ae&&!i&&go.includes(me)?(a=1,s.interrupt?r(v):I(v)):wf.includes(o.toLowerCase())?(a=6,ae?(e.consume(v),k):s.interrupt?r(v):I(v)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(v):i?C(v):y(v))}return v===45||jt(v)?(e.consume(v),o+=String.fromCharCode(v),b):n(v)}function k(v){return v===62?(e.consume(v),s.interrupt?r:I):n(v)}function C(v){return Xe(v)?(e.consume(v),C):j(v)}function y(v){return v===47?(e.consume(v),j):v===58||v===95||Et(v)?(e.consume(v),R):Xe(v)?(e.consume(v),y):j(v)}function R(v){return v===45||v===46||v===58||v===95||jt(v)?(e.consume(v),R):H(v)}function H(v){return v===61?(e.consume(v),M):Xe(v)?(e.consume(v),H):y(v)}function M(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),c=v,O):Xe(v)?(e.consume(v),M):L(v)}function O(v){return v===c?(e.consume(v),c=null,q):v===null||Te(v)?n(v):(e.consume(v),O)}function L(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||lt(v)?H(v):(e.consume(v),L)}function q(v){return v===47||v===62||Xe(v)?y(v):n(v)}function j(v){return v===62?(e.consume(v),T):n(v)}function T(v){return v===null||Te(v)?I(v):Xe(v)?(e.consume(v),T):n(v)}function I(v){return v===45&&a===2?(e.consume(v),F):v===60&&a===1?(e.consume(v),$):v===62&&a===4?(e.consume(v),Ae):v===63&&a===3?(e.consume(v),S):v===93&&a===5?(e.consume(v),ce):Te(v)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Nf,$e,_)(v)):v===null||Te(v)?(e.exit("htmlFlowData"),_(v)):(e.consume(v),I)}function _(v){return e.check(Cf,w,$e)(v)}function w(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),W}function W(v){return v===null||Te(v)?_(v):(e.enter("htmlFlowData"),I(v))}function F(v){return v===45?(e.consume(v),S):I(v)}function $(v){return v===47?(e.consume(v),o="",K):I(v)}function K(v){if(v===62){const ae=o.toLowerCase();return go.includes(ae)?(e.consume(v),Ae):I(v)}return Et(v)&&o.length<8?(e.consume(v),o+=String.fromCharCode(v),K):I(v)}function ce(v){return v===93?(e.consume(v),S):I(v)}function S(v){return v===62?(e.consume(v),Ae):v===45&&a===2?(e.consume(v),S):I(v)}function Ae(v){return v===null||Te(v)?(e.exit("htmlFlowData"),$e(v)):(e.consume(v),Ae)}function $e(v){return e.exit("htmlFlow"),r(v)}}function If(e,r,n){const s=this;return a;function a(o){return Te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):r(o)}}function Af(e,r,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt($n,r,n)}}const Mf={name:"htmlText",tokenize:Tf};function Tf(e,r,n){const s=this;let a,i,o;return l;function l(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),c}function c(S){return S===33?(e.consume(S),d):S===47?(e.consume(S),H):S===63?(e.consume(S),y):Et(S)?(e.consume(S),L):n(S)}function d(S){return S===45?(e.consume(S),u):S===91?(e.consume(S),i=0,g):Et(S)?(e.consume(S),C):n(S)}function u(S){return S===45?(e.consume(S),p):n(S)}function m(S){return S===null?n(S):S===45?(e.consume(S),h):Te(S)?(o=m,$(S)):(e.consume(S),m)}function h(S){return S===45?(e.consume(S),p):m(S)}function p(S){return S===62?F(S):S===45?h(S):m(S)}function g(S){const Ae="CDATA[";return S===Ae.charCodeAt(i++)?(e.consume(S),i===Ae.length?x:g):n(S)}function x(S){return S===null?n(S):S===93?(e.consume(S),b):Te(S)?(o=x,$(S)):(e.consume(S),x)}function b(S){return S===93?(e.consume(S),k):x(S)}function k(S){return S===62?F(S):S===93?(e.consume(S),k):x(S)}function C(S){return S===null||S===62?F(S):Te(S)?(o=C,$(S)):(e.consume(S),C)}function y(S){return S===null?n(S):S===63?(e.consume(S),R):Te(S)?(o=y,$(S)):(e.consume(S),y)}function R(S){return S===62?F(S):y(S)}function H(S){return Et(S)?(e.consume(S),M):n(S)}function M(S){return S===45||jt(S)?(e.consume(S),M):O(S)}function O(S){return Te(S)?(o=O,$(S)):Xe(S)?(e.consume(S),O):F(S)}function L(S){return S===45||jt(S)?(e.consume(S),L):S===47||S===62||lt(S)?q(S):n(S)}function q(S){return S===47?(e.consume(S),F):S===58||S===95||Et(S)?(e.consume(S),j):Te(S)?(o=q,$(S)):Xe(S)?(e.consume(S),q):F(S)}function j(S){return S===45||S===46||S===58||S===95||jt(S)?(e.consume(S),j):T(S)}function T(S){return S===61?(e.consume(S),I):Te(S)?(o=T,$(S)):Xe(S)?(e.consume(S),T):q(S)}function I(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),a=S,_):Te(S)?(o=I,$(S)):Xe(S)?(e.consume(S),I):(e.consume(S),w)}function _(S){return S===a?(e.consume(S),a=void 0,W):S===null?n(S):Te(S)?(o=_,$(S)):(e.consume(S),_)}function w(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||lt(S)?q(S):(e.consume(S),w)}function W(S){return S===47||S===62||lt(S)?q(S):n(S)}function F(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),r):n(S)}function $(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),K}function K(S){return Xe(S)?rt(e,ce,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):ce(S)}function ce(S){return e.enter("htmlTextData"),o(S)}}const oi={name:"labelEnd",resolveAll:Rf,resolveTo:_f,tokenize:zf},Df={tokenize:Ff},Pf={tokenize:$f},Lf={tokenize:Of};function Rf(e){let r=-1;const n=[];for(;++r<e.length;){const s=e[r][1];if(n.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",r+=a}}return e.length!==n.length&&$t(e,0,e.length,n),e}function _f(e,r){let n=e.length,s=0,a,i,o,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,r],["enter",d,r]],l=Ut(l,e.slice(i+1,i+s+3)),l=Ut(l,[["enter",u,r]]),l=Ut(l,Ns(r.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),r)),l=Ut(l,[["exit",u,r],e[o-2],e[o-1],["exit",d,r]]),l=Ut(l,e.slice(o+1)),l=Ut(l,[["exit",c,r]]),$t(e,i,e.length,l),e}function zf(e,r,n){const s=this;let a=s.events.length,i,o;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){i=s.events[a][1];break}return l;function l(h){return i?i._inactive?m(h):(o=s.parser.defined.includes(Yt(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(Df,u,o?u:m)(h):h===91?e.attempt(Pf,u,o?d:m)(h):o?u(h):m(h)}function d(h){return e.attempt(Lf,u,m)(h)}function u(h){return r(h)}function m(h){return i._balanced=!0,n(h)}}function Ff(e,r,n){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return lt(m)?Sn(e,i)(m):i(m)}function i(m){return m===41?u(m):Pc(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return lt(m)?Sn(e,c)(m):u(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?Rc(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):u(m)}function d(m){return lt(m)?Sn(e,u)(m):u(m)}function u(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):n(m)}}function $f(e,r,n){const s=this;return a;function a(l){return Lc.call(s,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return s.parser.defined.includes(Yt(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):n(l)}function o(l){return n(l)}}function Of(e,r,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),r):n(i)}}const Bf={name:"labelStartImage",resolveAll:oi.resolveAll,tokenize:Uf};function Uf(e,r,n){const s=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):r(l)}}const Wf={name:"labelStartLink",resolveAll:oi.resolveAll,tokenize:Hf};function Hf(e,r,n){const s=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):r(o)}}const Hs={name:"lineEnding",tokenize:qf};function qf(e,r){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),rt(e,r,"linePrefix")}}const is={name:"thematicBreak",tokenize:Vf};function Vf(e,r,n){let s=0,a;return i;function i(d){return e.enter("thematicBreak"),o(d)}function o(d){return a=d,l(d)}function l(d){return d===a?(e.enter("thematicBreakSequence"),c(d)):s>=3&&(d===null||Te(d))?(e.exit("thematicBreak"),r(d)):n(d)}function c(d){return d===a?(e.consume(d),s++,c):(e.exit("thematicBreakSequence"),Xe(d)?rt(e,l,"whitespace")(d):l(d))}}const Mt={continuation:{tokenize:Yf},exit:Xf,name:"list",tokenize:Jf},Gf={partial:!0,tokenize:Zf},Kf={partial:!0,tokenize:Qf};function Jf(e,r,n){const s=this,a=s.events[s.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(p){const g=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:Na(p)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(is,n,d)(p):d(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Na(p)&&++o<10?(e.consume(p),c):(!s.interrupt||o<2)&&(s.containerState.marker?p===s.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),d(p)):n(p)}function d(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||p,e.check($n,s.interrupt?n:u,e.attempt(Gf,h,m))}function u(p){return s.containerState.initialBlankLine=!0,i++,h(p)}function m(p){return Xe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(p)}}function Yf(e,r,n){const s=this;return s.containerState._closeFlow=void 0,e.check($n,a,i);function a(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,rt(e,r,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!Xe(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Kf,r,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,rt(e,e.attempt(Mt,r,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Qf(e,r,n){const s=this;return rt(e,a,"listItemIndent",s.containerState.size+1);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?r(i):n(i)}}function Xf(e){e.exit(this.containerState.type)}function Zf(e,r,n){const s=this;return rt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=s.events[s.events.length-1];return!Xe(i)&&o&&o[1].type==="listItemPrefixWhitespace"?r(i):n(i)}}const xo={name:"setextUnderline",resolveTo:eg,tokenize:tg};function eg(e,r){let n=e.length,s,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,r]),e.splice(i+1,0,["exit",e[s][1],r]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,r]),e}function tg(e,r,n){const s=this;let a;return i;function i(d){let u=s.events.length,m;for(;u--;)if(s.events[u][1].type!=="lineEnding"&&s.events[u][1].type!=="linePrefix"&&s.events[u][1].type!=="content"){m=s.events[u][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),a=d,o(d)):n(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===a?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Xe(d)?rt(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||Te(d)?(e.exit("setextHeadingLine"),r(d)):n(d)}}const rg={tokenize:ng};function ng(e){const r=this,n=e.attempt($n,s,e.attempt(this.parser.constructs.flowInitial,a,rt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(lf,a)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),r.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r.currentConstruct=void 0,n}}const sg={resolveAll:zc()},ag=_c("string"),ig=_c("text");function _c(e){return{resolveAll:zc(e==="text"?og:void 0),tokenize:r};function r(n){const s=this,a=this.parser.constructs[e],i=n.attempt(a,o,l);return o;function o(u){return d(u)?i(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),c}function c(u){return d(u)?(n.exit("data"),i(u)):(n.consume(u),c)}function d(u){if(u===null)return!0;const m=a[u];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function zc(e){return r;function r(n,s){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,s):n}}function og(e,r){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=r.sliceStream(s);let i=a.length,o=-1,l=0,c;for(;i--;){const d=a[i];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(r._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(n,0,["enter",d,r],["exit",d,r]),n+=2)}n++}return e}const lg={42:Mt,43:Mt,45:Mt,48:Mt,49:Mt,50:Mt,51:Mt,52:Mt,53:Mt,54:Mt,55:Mt,56:Mt,57:Mt,62:Ac},cg={91:pf},dg={[-2]:Ws,[-1]:Ws,32:Ws},ug={35:yf,42:is,45:[xo,is],60:jf,61:xo,95:is,96:fo,126:fo},mg={38:Tc,92:Mc},pg={[-5]:Hs,[-4]:Hs,[-3]:Hs,33:Bf,38:Tc,42:Ca,60:[U0,Mf],91:Wf,92:[xf,Mc],93:oi,95:Ca,96:tf},hg={null:[Ca,sg]},fg={null:[42,95]},gg={null:[]},xg=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:fg,contentInitial:cg,disable:gg,document:lg,flow:ug,flowInitial:dg,insideSpan:hg,string:mg,text:pg},Symbol.toStringTag,{value:"Module"}));function bg(e,r,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:O(H),check:O(M),consume:C,enter:y,exit:R,interrupt:O(M,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:m};let u=r.tokenize.call(d,c);return r.resolveAll&&i.push(r),d;function m(T){return o=Ut(o,T),b(),o[o.length-1]!==null?[]:(L(r,0),d.events=Ns(i,d.events,d),d.events)}function h(T,I){return kg(p(T),I)}function p(T){return yg(o,T)}function g(){const{_bufferIndex:T,_index:I,line:_,column:w,offset:W}=s;return{_bufferIndex:T,_index:I,line:_,column:w,offset:W}}function x(T){a[T.line]=T.column,j()}function b(){let T;for(;s._index<o.length;){const I=o[s._index];if(typeof I=="string")for(T=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===T&&s._bufferIndex<I.length;)k(I.charCodeAt(s._bufferIndex));else k(I)}}function k(T){u=u(T)}function C(T){Te(T)?(s.line++,s.column=1,s.offset+=T===-3?2:1,j()):T!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=T}function y(T,I){const _=I||{};return _.type=T,_.start=g(),d.events.push(["enter",_,d]),l.push(_),_}function R(T){const I=l.pop();return I.end=g(),d.events.push(["exit",I,d]),I}function H(T,I){L(T,I.from)}function M(T,I){I.restore()}function O(T,I){return _;function _(w,W,F){let $,K,ce,S;return Array.isArray(w)?$e(w):"tokenize"in w?$e([w]):Ae(w);function Ae(Ee){return ie;function ie(qe){const re=qe!==null&&Ee[qe],le=qe!==null&&Ee.null,fe=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(le)?le:le?[le]:[]];return $e(fe)(qe)}}function $e(Ee){return $=Ee,K=0,Ee.length===0?F:v(Ee[K])}function v(Ee){return ie;function ie(qe){return S=q(),ce=Ee,Ee.partial||(d.currentConstruct=Ee),Ee.name&&d.parser.constructs.disable.null.includes(Ee.name)?me():Ee.tokenize.call(I?Object.assign(Object.create(d),I):d,c,ae,me)(qe)}}function ae(Ee){return T(ce,S),W}function me(Ee){return S.restore(),++K<$.length?v($[K]):F}}}function L(T,I){T.resolveAll&&!i.includes(T)&&i.push(T),T.resolve&&$t(d.events,I,d.events.length-I,T.resolve(d.events.slice(I),d)),T.resolveTo&&(d.events=T.resolveTo(d.events,d))}function q(){const T=g(),I=d.previous,_=d.currentConstruct,w=d.events.length,W=Array.from(l);return{from:w,restore:F};function F(){s=T,d.previous=I,d.currentConstruct=_,d.events.length=w,l=W,j()}}function j(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function yg(e,r){const n=r.start._index,s=r.start._bufferIndex,a=r.end._index,i=r.end._bufferIndex;let o;if(n===a)o=[e[n].slice(s,i)];else{if(o=e.slice(n,a),s>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(s):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function kg(e,r){let n=-1;const s=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
388
- `;break}case-3:{o=`\r
389
- `;break}case-2:{o=r?" ":" ";break}case-1:{if(!r&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,s.push(o)}return s.join("")}function vg(e){const s={constructs:Ec([xg,...(e||{}).extensions||[]]),content:a(R0),defined:[],document:a(z0),flow:a(rg),lazy:{},string:a(ag),text:a(ig)};return s;function a(i){return o;function o(l){return bg(s,i,l)}}}function wg(e){for(;!Dc(e););return e}const bo=/[\0\t\n\r]/g;function jg(){let e=1,r="",n=!0,s;return a;function a(i,o,l){const c=[];let d,u,m,h,p;for(i=r+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),m=0,r="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(bo.lastIndex=m,d=bo.exec(i),h=d&&d.index!==void 0?d.index:i.length,p=i.charCodeAt(h),!d){r=i.slice(m);break}if(p===10&&m===h&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),m<h&&(c.push(i.slice(m,h)),e+=h-m),p){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}m=h+1}return l&&(s&&c.push(-5),r&&c.push(r),c.push(null)),c}}const Ng=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Cg(e){return e.replace(Ng,Sg)}function Sg(e,r,n){if(r)return r;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Ic(n.slice(i?2:1),i?16:10)}return ii(n)||e}const Fc={}.hasOwnProperty;function Eg(e,r,n){return typeof r!="string"&&(n=r,r=void 0),Ig(n)(wg(vg(n).document().write(jg()(e,r,!0))))}function Ig(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ke),autolinkProtocol:q,autolinkEmail:q,atxHeading:i(Ue),blockQuote:i(le),characterEscape:q,characterReference:q,codeFenced:i(fe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(fe,o),codeText:i(we,o),codeTextData:q,data:q,codeFlowValue:q,definition:i(ve),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ye),hardBreakEscape:i(at),hardBreakTrailing:i(at),htmlFlow:i(De,o),htmlFlowData:q,htmlText:i(De,o),htmlTextData:q,image:i(ye),label:o,link:i(ke),listItem:i(st),listItemValue:h,listOrdered:i(Oe,m),listUnordered:i(Oe),paragraph:i(Ie),reference:v,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ue),strong:i(Lt),thematicBreak:i(de)},exit:{atxHeading:c(),atxHeadingSequence:H,autolink:c(),autolinkEmail:re,autolinkProtocol:qe,blockQuote:c(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:Ee,characterReference:ie,codeFenced:c(b),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:c(k),codeText:c(W),codeTextData:j,data:j,definition:c(),definitionDestinationString:R,definitionLabelString:C,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(I),hardBreakTrailing:c(I),htmlFlow:c(_),htmlFlowData:j,htmlText:c(w),htmlTextData:j,image:c($),label:ce,labelText:K,lineEnding:T,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:S,resourceTitleString:Ae,resource:$e,setextHeading:c(L),setextHeadingLineSequence:O,setextHeadingText:M,strong:c(),thematicBreak:c()}};$c(r,(e||{}).mdastExtensions||[]);const n={};return s;function s(z){let D={type:"root",children:[]};const Y={stack:[D],tokenStack:[],config:r,enter:l,exit:d,buffer:o,resume:u,data:n},Z=[];let se=-1;for(;++se<z.length;)if(z[se][1].type==="listOrdered"||z[se][1].type==="listUnordered")if(z[se][0]==="enter")Z.push(se);else{const je=Z.pop();se=a(z,je,se)}for(se=-1;++se<z.length;){const je=r[z[se][0]];Fc.call(je,z[se][1].type)&&je[z[se][1].type].call(Object.assign({sliceSerialize:z[se][2].sliceSerialize},Y),z[se][1])}if(Y.tokenStack.length>0){const je=Y.tokenStack[Y.tokenStack.length-1];(je[1]||yo).call(Y,void 0,je[0])}for(D.position={start:br(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:br(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},se=-1;++se<r.transforms.length;)D=r.transforms[se](D)||D;return D}function a(z,D,Y){let Z=D-1,se=-1,je=!1,_e,Le,Ge,et;for(;++Z<=Y;){const We=z[Z];switch(We[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{We[0]==="enter"?se++:se--,et=void 0;break}case"lineEndingBlank":{We[0]==="enter"&&(_e&&!et&&!se&&!Ge&&(Ge=Z),et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:et=void 0}if(!se&&We[0]==="enter"&&We[1].type==="listItemPrefix"||se===-1&&We[0]==="exit"&&(We[1].type==="listUnordered"||We[1].type==="listOrdered")){if(_e){let nt=Z;for(Le=void 0;nt--;){const ct=z[nt];if(ct[1].type==="lineEnding"||ct[1].type==="lineEndingBlank"){if(ct[0]==="exit")continue;Le&&(z[Le][1].type="lineEndingBlank",je=!0),ct[1].type="lineEnding",Le=nt}else if(!(ct[1].type==="linePrefix"||ct[1].type==="blockQuotePrefix"||ct[1].type==="blockQuotePrefixWhitespace"||ct[1].type==="blockQuoteMarker"||ct[1].type==="listItemIndent"))break}Ge&&(!Le||Ge<Le)&&(_e._spread=!0),_e.end=Object.assign({},Le?z[Le][1].start:We[1].end),z.splice(Le||Z,0,["exit",_e,We[2]]),Z++,Y++}if(We[1].type==="listItemPrefix"){const nt={type:"listItem",_spread:!1,start:Object.assign({},We[1].start),end:void 0};_e=nt,z.splice(Z,0,["enter",nt,We[2]]),Z++,Y++,Ge=void 0,et=!0}}}return z[D][1]._spread=je,Y}function i(z,D){return Y;function Y(Z){l.call(this,z(Z),Z),D&&D.call(this,Z)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(z,D,Y){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([D,Y||void 0]),z.position={start:br(D.start),end:void 0}}function c(z){return D;function D(Y){z&&z.call(this,Y),d.call(this,Y)}}function d(z,D){const Y=this.stack.pop(),Z=this.tokenStack.pop();if(Z)Z[0].type!==z.type&&(D?D.call(this,z,Z[0]):(Z[1]||yo).call(this,z,Z[0]));else throw new Error("Cannot close `"+z.type+"` ("+Cn({start:z.start,end:z.end})+"): it’s not open");Y.position.end=br(z.end)}function u(){return ai(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(z){if(this.data.expectingFirstListItemValue){const D=this.stack[this.stack.length-2];D.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function p(){const z=this.resume(),D=this.stack[this.stack.length-1];D.lang=z}function g(){const z=this.resume(),D=this.stack[this.stack.length-1];D.meta=z}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const z=this.resume(),D=this.stack[this.stack.length-1];D.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const z=this.resume(),D=this.stack[this.stack.length-1];D.value=z.replace(/(\r?\n|\r)$/g,"")}function C(z){const D=this.resume(),Y=this.stack[this.stack.length-1];Y.label=D,Y.identifier=Yt(this.sliceSerialize(z)).toLowerCase()}function y(){const z=this.resume(),D=this.stack[this.stack.length-1];D.title=z}function R(){const z=this.resume(),D=this.stack[this.stack.length-1];D.url=z}function H(z){const D=this.stack[this.stack.length-1];if(!D.depth){const Y=this.sliceSerialize(z).length;D.depth=Y}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function O(z){const D=this.stack[this.stack.length-1];D.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function q(z){const Y=this.stack[this.stack.length-1].children;let Z=Y[Y.length-1];(!Z||Z.type!=="text")&&(Z=te(),Z.position={start:br(z.start),end:void 0},Y.push(Z)),this.stack.push(Z)}function j(z){const D=this.stack.pop();D.value+=this.sliceSerialize(z),D.position.end=br(z.end)}function T(z){const D=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Y=D.children[D.children.length-1];Y.position.end=br(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(D.type)&&(q.call(this,z),j.call(this,z))}function I(){this.data.atHardBreak=!0}function _(){const z=this.resume(),D=this.stack[this.stack.length-1];D.value=z}function w(){const z=this.resume(),D=this.stack[this.stack.length-1];D.value=z}function W(){const z=this.resume(),D=this.stack[this.stack.length-1];D.value=z}function F(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=D,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function $(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=D,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function K(z){const D=this.sliceSerialize(z),Y=this.stack[this.stack.length-2];Y.label=Cg(D),Y.identifier=Yt(D).toLowerCase()}function ce(){const z=this.stack[this.stack.length-1],D=this.resume(),Y=this.stack[this.stack.length-1];if(this.data.inReference=!0,Y.type==="link"){const Z=z.children;Y.children=Z}else Y.alt=D}function S(){const z=this.resume(),D=this.stack[this.stack.length-1];D.url=z}function Ae(){const z=this.resume(),D=this.stack[this.stack.length-1];D.title=z}function $e(){this.data.inReference=void 0}function v(){this.data.referenceType="collapsed"}function ae(z){const D=this.resume(),Y=this.stack[this.stack.length-1];Y.label=D,Y.identifier=Yt(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function me(z){this.data.characterReferenceType=z.type}function Ee(z){const D=this.sliceSerialize(z),Y=this.data.characterReferenceType;let Z;Y?(Z=Ic(D,Y==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Z=ii(D);const se=this.stack[this.stack.length-1];se.value+=Z}function ie(z){const D=this.stack.pop();D.position.end=br(z.end)}function qe(z){j.call(this,z);const D=this.stack[this.stack.length-1];D.url=this.sliceSerialize(z)}function re(z){j.call(this,z);const D=this.stack[this.stack.length-1];D.url="mailto:"+this.sliceSerialize(z)}function le(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function we(){return{type:"inlineCode",value:""}}function ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ye(){return{type:"emphasis",children:[]}}function Ue(){return{type:"heading",depth:0,children:[]}}function at(){return{type:"break"}}function De(){return{type:"html",value:""}}function ye(){return{type:"image",title:null,url:"",alt:null}}function ke(){return{type:"link",title:null,url:"",children:[]}}function Oe(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function st(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function Ie(){return{type:"paragraph",children:[]}}function Lt(){return{type:"strong",children:[]}}function te(){return{type:"text",value:""}}function de(){return{type:"thematicBreak"}}}function br(e){return{line:e.line,column:e.column,offset:e.offset}}function $c(e,r){let n=-1;for(;++n<r.length;){const s=r[n];Array.isArray(s)?$c(e,s):Ag(e,s)}}function Ag(e,r){let n;for(n in r)if(Fc.call(r,n))switch(n){case"canContainEols":{const s=r[n];s&&e[n].push(...s);break}case"transforms":{const s=r[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=r[n];s&&Object.assign(e[n],s);break}}}function yo(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Cn({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Cn({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Cn({start:r.start,end:r.end})+") is still open")}function Mg(e){const r=this;r.parser=n;function n(s){return Eg(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Tg(e,r){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,n),e.applyData(r,n)}function Dg(e,r){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,n),[e.applyData(r,n),{type:"text",value:`
390
- `}]}function Pg(e,r){const n=r.value?r.value+`
391
- `:"",s={};r.lang&&(s.className=["language-"+r.lang]);let a={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return r.meta&&(a.data={meta:r.meta}),e.patch(r,a),a=e.applyData(r,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(r,a),a}function Lg(e,r){const n={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Rg(e,r){const n={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function _g(e,r){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),a=cn(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(r,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(r,d),e.applyData(r,d)}function zg(e,r){const n={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Fg(e,r){if(e.options.allowDangerousHtml){const n={type:"raw",value:r.value};return e.patch(r,n),e.applyData(r,n)}}function Oc(e,r){const n=r.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const a=e.all(r),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=s:a.push({type:"text",value:s}),a}function $g(e,r){const n=String(r.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Oc(e,r);const a={src:cn(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(r,i),e.applyData(r,i)}function Og(e,r){const n={src:cn(r.url)};r.alt!==null&&r.alt!==void 0&&(n.alt=r.alt),r.title!==null&&r.title!==void 0&&(n.title=r.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(r,s),e.applyData(r,s)}function Bg(e,r){const n={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(r,s),e.applyData(r,s)}function Ug(e,r){const n=String(r.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Oc(e,r);const a={href:cn(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"a",properties:a,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Wg(e,r){const n={href:cn(r.url)};r.title!==null&&r.title!==void 0&&(n.title=r.title);const s={type:"element",tagName:"a",properties:n,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function Hg(e,r,n){const s=e.all(r),a=n?qg(n):Bc(r),i={},o=[];if(typeof r.checked=="boolean"){const u=s[0];let m;u&&u.type==="element"&&u.tagName==="p"?m=u:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const u=s[l];(a||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
392
- `}),u.type==="element"&&u.tagName==="p"&&!a?o.push(...u.children):o.push(u)}const c=s[s.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
393
- `});const d={type:"element",tagName:"li",properties:i,children:o};return e.patch(r,d),e.applyData(r,d)}function qg(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const n=e.children;let s=-1;for(;!r&&++s<n.length;)r=Bc(n[s])}return r}function Bc(e){const r=e.spread;return r??e.children.length>1}function Vg(e,r){const n={},s=e.all(r);let a=-1;for(typeof r.start=="number"&&r.start!==1&&(n.start=r.start);++a<s.length;){const o=s[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:r.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(r,i),e.applyData(r,i)}function Gg(e,r){const n={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Kg(e,r){const n={type:"root",children:e.wrap(e.all(r))};return e.patch(r,n),e.applyData(r,n)}function Jg(e,r){const n={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Yg(e,r){const n=e.all(r),s=n.shift(),a=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ti(r.children[1]),c=kc(r.children[r.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(r,i),e.applyData(r,i)}function Qg(e,r,n){const s=n?n.children:void 0,i=(s?s.indexOf(r):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:r.children.length;let c=-1;const d=[];for(;++c<l;){const m=r.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};m&&(g.children=e.all(m),e.patch(m,g),g=e.applyData(m,g)),d.push(g)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(r,u),e.applyData(r,u)}function Xg(e,r){const n={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}const ko=9,vo=32;function Zg(e){const r=String(e),n=/\r?\n|\r/g;let s=n.exec(r),a=0;const i=[];for(;s;)i.push(wo(r.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(r);return i.push(wo(r.slice(a),a>0,!1)),i.join("")}function wo(e,r,n){let s=0,a=e.length;if(r){let i=e.codePointAt(s);for(;i===ko||i===vo;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(a-1);for(;i===ko||i===vo;)a--,i=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function ex(e,r){const n={type:"text",value:Zg(String(r.value))};return e.patch(r,n),e.applyData(r,n)}function tx(e,r){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,n),e.applyData(r,n)}const rx={blockquote:Tg,break:Dg,code:Pg,delete:Lg,emphasis:Rg,footnoteReference:_g,heading:zg,html:Fg,imageReference:$g,image:Og,inlineCode:Bg,linkReference:Ug,link:Wg,listItem:Hg,list:Vg,paragraph:Gg,root:Kg,strong:Jg,table:Yg,tableCell:Xg,tableRow:Qg,text:ex,thematicBreak:tx,toml:Qn,yaml:Qn,definition:Qn,footnoteDefinition:Qn};function Qn(){}const Uc=-1,Cs=0,En=1,ms=2,li=3,ci=4,di=5,ui=6,Wc=7,Hc=8,jo=typeof self=="object"?self:globalThis,nx=(e,r)=>{const n=(a,i)=>(e.set(i,a),a),s=a=>{if(e.has(a))return e.get(a);const[i,o]=r[a];switch(i){case Cs:case Uc:return n(o,a);case En:{const l=n([],a);for(const c of o)l.push(s(c));return l}case ms:{const l=n({},a);for(const[c,d]of o)l[s(c)]=s(d);return l}case li:return n(new Date(o),a);case ci:{const{source:l,flags:c}=o;return n(new RegExp(l,c),a)}case di:{const l=n(new Map,a);for(const[c,d]of o)l.set(s(c),s(d));return l}case ui:{const l=n(new Set,a);for(const c of o)l.add(s(c));return l}case Wc:{const{name:l,message:c}=o;return n(new jo[l](c),a)}case Hc:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new jo[i](o),a)};return s},No=e=>nx(new Map,e)(0),Hr="",{toString:sx}={},{keys:ax}=Object,bn=e=>{const r=typeof e;if(r!=="object"||!e)return[Cs,r];const n=sx.call(e).slice(8,-1);switch(n){case"Array":return[En,Hr];case"Object":return[ms,Hr];case"Date":return[li,Hr];case"RegExp":return[ci,Hr];case"Map":return[di,Hr];case"Set":return[ui,Hr];case"DataView":return[En,n]}return n.includes("Array")?[En,n]:n.includes("Error")?[Wc,n]:[ms,n]},Xn=([e,r])=>e===Cs&&(r==="function"||r==="symbol"),ix=(e,r,n,s)=>{const a=(o,l)=>{const c=s.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=bn(o);switch(l){case Cs:{let u=o;switch(c){case"bigint":l=Hc,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return a([Uc],o)}return a([l,u],o)}case En:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),a([c,[...h]],o)}const u=[],m=a([l,u],o);for(const h of o)u.push(i(h));return m}case ms:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(r&&"toJSON"in o)return i(o.toJSON());const u=[],m=a([l,u],o);for(const h of ax(o))(e||!Xn(bn(o[h])))&&u.push([i(h),i(o[h])]);return m}case li:return a([l,o.toISOString()],o);case ci:{const{source:u,flags:m}=o;return a([l,{source:u,flags:m}],o)}case di:{const u=[],m=a([l,u],o);for(const[h,p]of o)(e||!(Xn(bn(h))||Xn(bn(p))))&&u.push([i(h),i(p)]);return m}case ui:{const u=[],m=a([l,u],o);for(const h of o)(e||!Xn(bn(h)))&&u.push(i(h));return m}}const{message:d}=o;return a([l,{name:c,message:d}],o)};return i},Co=(e,{json:r,lossy:n}={})=>{const s=[];return ix(!(r||n),!!r,new Map,s)(e),s},ps=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?No(Co(e,r)):structuredClone(e):(e,r)=>No(Co(e,r));function ox(e,r){const n=[{type:"text",value:"↩"}];return r>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),n}function lx(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function cx(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ox,s=e.options.footnoteBackLabel||lx,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const u=e.all(d),m=String(d.identifier).toUpperCase(),h=cn(m.toLowerCase());let p=0;const g=[],x=e.footnoteCounts.get(m);for(;x!==void 0&&++p<=x;){g.length>0&&g.push({type:"text",value:" "});let C=typeof n=="string"?n:n(c,p);typeof C=="string"&&(C={type:"text",value:C}),g.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const C=b.children[b.children.length-1];C&&C.type==="text"?C.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else u.push(...g);const k={type:"element",tagName:"li",properties:{id:r+"fn-"+h},children:e.wrap(u,!0)};e.patch(d,k),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ps(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
394
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
395
- `}]}}const Ss=function(e){if(e==null)return px;if(typeof e=="function")return Es(e);if(typeof e=="object")return Array.isArray(e)?dx(e):ux(e);if(typeof e=="string")return mx(e);throw new Error("Expected function, string, or object as test")};function dx(e){const r=[];let n=-1;for(;++n<e.length;)r[n]=Ss(e[n]);return Es(s);function s(...a){let i=-1;for(;++i<r.length;)if(r[i].apply(this,a))return!0;return!1}}function ux(e){const r=e;return Es(n);function n(s){const a=s;let i;for(i in e)if(a[i]!==r[i])return!1;return!0}}function mx(e){return Es(r);function r(n){return n&&n.type===e}}function Es(e){return r;function r(n,s,a){return!!(hx(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function px(){return!0}function hx(e){return e!==null&&typeof e=="object"&&"type"in e}const qc=[],fx=!0,Sa=!1,gx="skip";function Vc(e,r,n,s){let a;typeof r=="function"&&typeof n!="function"?(s=n,n=r):a=r;const i=Ss(a),o=s?-1:1;l(e,void 0,[])();function l(c,d,u){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const p=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=qc,g,x,b;if((!r||i(c,d,u[u.length-1]||void 0))&&(p=xx(n(c,u)),p[0]===Sa))return p;if("children"in c&&c.children){const k=c;if(k.children&&p[0]!==gx)for(x=(s?k.children.length:-1)+o,b=u.concat(k);x>-1&&x<k.children.length;){const C=k.children[x];if(g=l(C,x,b)(),g[0]===Sa)return g;x=typeof g[1]=="number"?g[1]:x+o}}return p}}}function xx(e){return Array.isArray(e)?e:typeof e=="number"?[fx,e]:e==null?qc:[e]}function mi(e,r,n,s){let a,i,o;typeof r=="function"&&typeof n!="function"?(i=void 0,o=r,a=n):(i=r,o=n,a=s),Vc(e,i,l,a);function l(c,d){const u=d[d.length-1],m=u?u.children.indexOf(c):void 0;return o(c,m,u)}}const Ea={}.hasOwnProperty,bx={};function yx(e,r){const n=r||bx,s=new Map,a=new Map,i=new Map,o={...rx,...n.handlers},l={all:d,applyData:vx,definitionById:s,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:kx,wrap:jx};return mi(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const m=u.type==="definition"?s:a,h=String(u.identifier).toUpperCase();m.has(h)||m.set(h,u)}}),l;function c(u,m){const h=u.type,p=l.handlers[h];if(Ea.call(l.handlers,h)&&p)return p(l,u,m);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in u){const{children:x,...b}=u,k=ps(b);return k.children=l.all(u),k}return ps(u)}return(l.options.unknownHandler||wx)(l,u,m)}function d(u){const m=[];if("children"in u){const h=u.children;let p=-1;for(;++p<h.length;){const g=l.one(h[p],u);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=So(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=So(x.value))}Array.isArray(g)?m.push(...g):m.push(g)}}}return m}}function kx(e,r){e.position&&(r.position=o0(e))}function vx(e,r){let n=r;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,ps(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function wx(e,r){const n=r.data||{},s="value"in r&&!(Ea.call(n,"hProperties")||Ea.call(n,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function jx(e,r){const n=[];let s=-1;for(r&&n.push({type:"text",value:`
396
- `});++s<e.length;)s&&n.push({type:"text",value:`
397
- `}),n.push(e[s]);return r&&e.length>0&&n.push({type:"text",value:`
398
- `}),n}function So(e){let r=0,n=e.charCodeAt(r);for(;n===9||n===32;)r++,n=e.charCodeAt(r);return e.slice(r)}function Eo(e,r){const n=yx(e,r),s=n.one(e,void 0),a=cx(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
399
- `},a),i}function Nx(e,r){return e&&"run"in e?async function(n,s){const a=Eo(n,{file:s,...r});await e.run(a,s)}:function(n,s){return Eo(n,{file:s,...e||r})}}function Io(e){if(e)throw e}var qs,Ao;function Cx(){if(Ao)return qs;Ao=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(d){return typeof Array.isArray=="function"?Array.isArray(d):r.call(d)==="[object Array]"},i=function(d){if(!d||r.call(d)!=="[object Object]")return!1;var u=e.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!u&&!m)return!1;var h;for(h in d);return typeof h>"u"||e.call(d,h)},o=function(d,u){n&&u.name==="__proto__"?n(d,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):d[u.name]=u.newValue},l=function(d,u){if(u==="__proto__")if(e.call(d,u)){if(s)return s(d,u).value}else return;return d[u]};return qs=function c(){var d,u,m,h,p,g,x=arguments[0],b=1,k=arguments.length,C=!1;for(typeof x=="boolean"&&(C=x,x=arguments[1]||{},b=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});b<k;++b)if(d=arguments[b],d!=null)for(u in d)m=l(x,u),h=l(d,u),x!==h&&(C&&h&&(i(h)||(p=a(h)))?(p?(p=!1,g=m&&a(m)?m:[]):g=m&&i(m)?m:{},o(x,{name:u,newValue:c(C,g,h)})):typeof h<"u"&&o(x,{name:u,newValue:h}));return x},qs}var Sx=Cx();const Vs=Ln(Sx);function Ia(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Ex(){const e=[],r={run:n,use:s};return r;function n(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...d){const u=e[++i];let m=-1;if(c){o(c);return}for(;++m<a.length;)(d[m]===null||d[m]===void 0)&&(d[m]=a[m]);a=d,u?Ix(u,l)(...d):o(null,...d)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),r}}function Ix(e,r){let n;return s;function s(...o){const l=e.length>o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(d){const u=d;if(l&&n)throw u;return a(u)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){n||(n=!0,r(o,...l))}function i(o){a(null,o)}}const Zt={basename:Ax,dirname:Mx,extname:Tx,join:Dx,sep:"/"};function Ax(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');On(e);let n=0,s=-1,a=e.length,i;if(r===void 0||r.length===0||r.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1);return s<0?"":e.slice(n,s)}if(r===e)return"";let o=-1,l=r.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===r.codePointAt(l--)?l<0&&(s=a):(l=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function Mx(e){if(On(e),e.length===0)return".";let r=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){r=n;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function Tx(e){On(e);let r=e.length,n=-1,s=0,a=-1,i=0,o;for(;r--;){const l=e.codePointAt(r);if(l===47){if(o){s=r+1;break}continue}n<0&&(o=!0,n=r+1),l===46?a<0?a=r:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function Dx(...e){let r=-1,n;for(;++r<e.length;)On(e[r]),e[r]&&(n=n===void 0?e[r]:n+"/"+e[r]);return n===void 0?".":Px(n)}function Px(e){On(e);const r=e.codePointAt(0)===47;let n=Lx(e,!r);return n.length===0&&!r&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),r?"/"+n:n}function Lx(e,r){let n="",s=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),a=o,i=0;continue}}else if(n.length>0){n="",s=0,a=o,i=0;continue}}r&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),s=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function On(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Rx={cwd:_x};function _x(){return"/"}function Aa(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function zx(e){if(typeof e=="string")e=new URL(e);else if(!Aa(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return Fx(e)}function Fx(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let n=-1;for(;++n<r.length;)if(r.codePointAt(n)===37&&r.codePointAt(n+1)===50){const s=r.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(r)}const Gs=["history","path","basename","stem","extname","dirname"];class Gc{constructor(r){let n;r?Aa(r)?n={path:r}:typeof r=="string"||$x(r)?n={value:r}:n=r:n={},this.cwd="cwd"in n?"":Rx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Gs.length;){const i=Gs[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Gs.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Zt.basename(this.path):void 0}set basename(r){Js(r,"basename"),Ks(r,"basename"),this.path=Zt.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Zt.dirname(this.path):void 0}set dirname(r){Mo(this.basename,"dirname"),this.path=Zt.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Zt.extname(this.path):void 0}set extname(r){if(Ks(r,"extname"),Mo(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Zt.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Aa(r)&&(r=zx(r)),Js(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?Zt.basename(this.path,this.extname):void 0}set stem(r){Js(r,"stem"),Ks(r,"stem"),this.path=Zt.join(this.dirname||"",r+(this.extname||""))}fail(r,n,s){const a=this.message(r,n,s);throw a.fatal=!0,a}info(r,n,s){const a=this.message(r,n,s);return a.fatal=void 0,a}message(r,n,s){const a=new Nt(r,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Ks(e,r){if(e&&e.includes(Zt.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Zt.sep+"`")}function Js(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Mo(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function $x(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ox=function(e){const s=this.constructor.prototype,a=s[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},Bx={}.hasOwnProperty;class pi extends Ox{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ex()}copy(){const r=new pi;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];r.use(...s)}return r.data(Vs(!0,{},this.namespace)),r}data(r,n){return typeof r=="string"?arguments.length===2?(Xs("data",this.frozen),this.namespace[r]=n,this):Bx.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Xs("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(r,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const n=Zn(r),s=this.parser||this.Parser;return Ys("parse",s),s(String(n),n)}process(r,n){const s=this;return this.freeze(),Ys("process",this.parser||this.Parser),Qs("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,o){const l=Zn(r),c=s.parse(l);s.run(c,l,function(u,m,h){if(u||!m||!h)return d(u);const p=m,g=s.stringify(p,h);Hx(g)?h.value=g:h.result=g,d(u,h)});function d(u,m){u||!m?o(u):i?i(m):n(void 0,m)}}}processSync(r){let n=!1,s;return this.freeze(),Ys("processSync",this.parser||this.Parser),Qs("processSync",this.compiler||this.Compiler),this.process(r,a),Do("processSync","process",n),s;function a(i,o){n=!0,Io(i),s=o}}run(r,n,s){To(r),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,l){const c=Zn(n);a.run(r,c,d);function d(u,m,h){const p=m||r;u?l(u):o?o(p):s(void 0,p,h)}}}runSync(r,n){let s=!1,a;return this.run(r,n,i),Do("runSync","run",s),a;function i(o,l){Io(o),a=l,s=!0}}stringify(r,n){this.freeze();const s=Zn(n),a=this.compiler||this.Compiler;return Qs("stringify",a),To(r),a(r,s)}use(r,...n){const s=this.attachers,a=this.namespace;if(Xs("use",this.frozen),r!=null)if(typeof r=="function")c(r,n);else if(typeof r=="object")Array.isArray(r)?l(r):o(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...m]=d;c(u,m)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(a.settings=Vs(!0,a.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const m=d[u];i(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let m=-1,h=-1;for(;++m<s.length;)if(s[m][0]===d){h=m;break}if(h===-1)s.push([d,...u]);else if(u.length>0){let[p,...g]=u;const x=s[h][1];Ia(x)&&Ia(p)&&(p=Vs(!0,x,p)),s[h]=[d,p,...g]}}}}const Ux=new pi().freeze();function Ys(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qs(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xs(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function To(e){if(!Ia(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Do(e,r,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Zn(e){return Wx(e)?e:new Gc(e)}function Wx(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Hx(e){return typeof e=="string"||qx(e)}function qx(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vx="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Po=[],Lo={allowDangerousHtml:!0},Gx=/^(https?|ircs?|mailto|xmpp)$/i,Kx=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jx(e){const r=Yx(e),n=Qx(e);return Xx(r.runSync(r.parse(n),n),e)}function Yx(e){const r=e.rehypePlugins||Po,n=e.remarkPlugins||Po,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Lo}:Lo;return Ux().use(Mg).use(n).use(Nx,s).use(r)}function Qx(e){const r=e.children||"",n=new Gc;return typeof r=="string"&&(n.value=r),n}function Xx(e,r){const n=r.allowedElements,s=r.allowElement,a=r.components,i=r.disallowedElements,o=r.skipHtml,l=r.unwrapDisallowed,c=r.urlTransform||Zx;for(const u of Kx)Object.hasOwn(r,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Vx+u.id,void 0);return mi(e,d),m0(e,{Fragment:t.Fragment,components:a,ignoreInvalidStyle:!0,jsx:t.jsx,jsxs:t.jsxs,passKeys:!0,passNode:!0});function d(u,m,h){if(u.type==="raw"&&h&&typeof m=="number")return o?h.children.splice(m,1):h.children[m]={type:"text",value:u.value},m;if(u.type==="element"){let p;for(p in Us)if(Object.hasOwn(Us,p)&&Object.hasOwn(u.properties,p)){const g=u.properties[p],x=Us[p];(x===null||x.includes(u.tagName))&&(u.properties[p]=c(String(g||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&s&&typeof m=="number"&&(p=!s(u,m,h)),p&&h&&typeof m=="number")return l&&u.children?h.children.splice(m,1,...u.children):h.children.splice(m,1),m}}}function Zx(e){const r=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return r===-1||a!==-1&&r>a||n!==-1&&r>n||s!==-1&&r>s||Gx.test(e.slice(0,r))?e:""}function Ro(e,r){const n=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(r);for(;a!==-1;)s++,a=n.indexOf(r,a+r.length);return s}function eb(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tb(e,r,n){const a=Ss((n||{}).ignore||[]),i=rb(r);let o=-1;for(;++o<i.length;)Vc(e,"text",l);function l(d,u){let m=-1,h;for(;++m<u.length;){const p=u[m],g=h?h.children:void 0;if(a(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return c(d,u)}function c(d,u){const m=u[u.length-1],h=i[o][0],p=i[o][1];let g=0;const b=m.children.indexOf(d);let k=!1,C=[];h.lastIndex=0;let y=h.exec(d.value);for(;y;){const R=y.index,H={index:y.index,input:y.input,stack:[...u,d]};let M=p(...y,H);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?h.lastIndex=R+1:(g!==R&&C.push({type:"text",value:d.value.slice(g,R)}),Array.isArray(M)?C.push(...M):M&&C.push(M),g=R+y[0].length,k=!0),!h.global)break;y=h.exec(d.value)}return k?(g<d.value.length&&C.push({type:"text",value:d.value.slice(g)}),m.children.splice(b,1,...C)):C=[d],b+C.length}}function rb(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];r.push([nb(a[0]),sb(a[1])])}return r}function nb(e){return typeof e=="string"?new RegExp(eb(e),"g"):e}function sb(e){return typeof e=="function"?e:function(){return e}}const Zs="phrasing",ea=["autolink","link","image","label"];function ab(){return{transforms:[mb],enter:{literalAutolink:ob,literalAutolinkEmail:ta,literalAutolinkHttp:ta,literalAutolinkWww:ta},exit:{literalAutolink:ub,literalAutolinkEmail:db,literalAutolinkHttp:lb,literalAutolinkWww:cb}}}function ib(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Zs,notInConstruct:ea},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Zs,notInConstruct:ea},{character:":",before:"[ps]",after:"\\/",inConstruct:Zs,notInConstruct:ea}]}}function ob(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ta(e){this.config.enter.autolinkProtocol.call(this,e)}function lb(e){this.config.exit.autolinkProtocol.call(this,e)}function cb(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function db(e){this.config.exit.autolinkEmail.call(this,e)}function ub(e){this.exit(e)}function mb(e){tb(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pb],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),hb]],{ignore:["link","linkReference"]})}function pb(e,r,n,s,a){let i="";if(!Kc(a)||(/^w/i.test(r)&&(n=r+n,r="",i="http://"),!fb(n)))return!1;const o=gb(n+s);if(!o[0])return!1;const l={type:"link",title:null,url:i+r+o[0],children:[{type:"text",value:r+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function hb(e,r,n,s){return!Kc(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+n,children:[{type:"text",value:r+"@"+n}]}}function fb(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function gb(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let n=r[0],s=n.indexOf(")");const a=Ro(e,"(");let i=Ro(e,")");for(;s!==-1&&a>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function Kc(e,r){const n=e.input.charCodeAt(e.index-1);return(e.index===0||_r(n)||js(n))&&(!r||n!==47)}Jc.peek=Cb;function xb(){this.buffer()}function bb(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yb(){this.buffer()}function kb(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vb(e){const r=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yt(this.sliceSerialize(e)).toLowerCase(),n.label=r}function wb(e){this.exit(e)}function jb(e){const r=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yt(this.sliceSerialize(e)).toLowerCase(),n.label=r}function Nb(e){this.exit(e)}function Cb(){return"["}function Jc(e,r,n,s){const a=n.createTracker(s);let i=a.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=a.move("]"),i}function Sb(){return{enter:{gfmFootnoteCallString:xb,gfmFootnoteCall:bb,gfmFootnoteDefinitionLabelString:yb,gfmFootnoteDefinition:kb},exit:{gfmFootnoteCallString:vb,gfmFootnoteCall:wb,gfmFootnoteDefinitionLabelString:jb,gfmFootnoteDefinition:Nb}}}function Eb(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:n,footnoteReference:Jc},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,i,o){const l=i.createTracker(o);let c=l.move("[^");const d=i.enter("footnoteDefinition"),u=i.enter("label");return c+=l.move(i.safe(i.associationId(s),{before:c,after:"]"})),u(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((r?`
400
- `:" ")+i.indentLines(i.containerFlow(s,l.current()),r?Yc:Ib))),d(),c}}function Ib(e,r,n){return r===0?e:Yc(e,r,n)}function Yc(e,r,n){return(n?"":" ")+e}const Ab=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Qc.peek=Lb;function Mb(){return{canContainEols:["delete"],enter:{strikethrough:Db},exit:{strikethrough:Pb}}}function Tb(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ab}],handlers:{delete:Qc}}}function Db(e){this.enter({type:"delete",children:[]},e)}function Pb(e){this.exit(e)}function Qc(e,r,n,s){const a=n.createTracker(s),i=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function Lb(){return"~"}function Rb(e){return e.length}function _b(e,r){const n=r||{},s=(n.align||[]).concat(),a=n.stringLength||Rb,i=[],o=[],l=[],c=[];let d=0,u=-1;for(;++u<e.length;){const x=[],b=[];let k=-1;for(e[u].length>d&&(d=e[u].length);++k<e[u].length;){const C=zb(e[u][k]);if(n.alignDelimiters!==!1){const y=a(C);b[k]=y,(c[k]===void 0||y>c[k])&&(c[k]=y)}x.push(C)}o[u]=x,l[u]=b}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<d;)i[m]=_o(s[m]);else{const x=_o(s);for(;++m<d;)i[m]=x}m=-1;const h=[],p=[];for(;++m<d;){const x=i[m];let b="",k="";x===99?(b=":",k=":"):x===108?b=":":x===114&&(k=":");let C=n.alignDelimiters===!1?1:Math.max(1,c[m]-b.length-k.length);const y=b+"-".repeat(C)+k;n.alignDelimiters!==!1&&(C=b.length+C+k.length,C>c[m]&&(c[m]=C),p[m]=C),h[m]=y}o.splice(1,0,h),l.splice(1,0,p),u=-1;const g=[];for(;++u<o.length;){const x=o[u],b=l[u];m=-1;const k=[];for(;++m<d;){const C=x[m]||"";let y="",R="";if(n.alignDelimiters!==!1){const H=c[m]-(b[m]||0),M=i[m];M===114?y=" ".repeat(H):M===99?H%2?(y=" ".repeat(H/2+.5),R=" ".repeat(H/2-.5)):(y=" ".repeat(H/2),R=y):R=" ".repeat(H)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(y),k.push(C),n.alignDelimiters!==!1&&k.push(R),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==d-1)&&k.push("|")}g.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return g.join(`
401
- `)}function zb(e){return e==null?"":String(e)}function _o(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function Fb(e,r,n,s){const a=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),$b);return a(),o}function $b(e,r,n){return">"+(n?"":" ")+e}function Ob(e,r){return zo(e,r.inConstruct,!0)&&!zo(e,r.notInConstruct,!1)}function zo(e,r,n){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return n;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Fo(e,r,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
402
- `&&Ob(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
403
- `}function Bb(e,r){const n=String(e);let s=n.indexOf(r),a=s,i=0,o=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++i>o&&(o=i):i=1,a=s+r.length,s=n.indexOf(r,a);return o}function Ub(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Wb(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function Hb(e,r,n,s){const a=Wb(n),i=e.value||"",o=a==="`"?"GraveAccent":"Tilde";if(Ub(e,n)){const m=n.enter("codeIndented"),h=n.indentLines(i,qb);return m(),h}const l=n.createTracker(s),c=a.repeat(Math.max(Bb(i,a)+1,3)),d=n.enter("codeFenced");let u=l.move(c);if(e.lang){const m=n.enter(`codeFencedLang${o}`);u+=l.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(n.safe(e.meta,{before:u,after:`
404
- `,encode:["`"],...l.current()})),m()}return u+=l.move(`
405
- `),i&&(u+=l.move(i+`
406
- `)),u+=l.move(c),d(),u}function qb(e,r,n){return(n?"":" ")+e}function hi(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function Vb(e,r,n,s){const a=hi(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(s);let d=c.move("[");return d+=c.move(n.safe(n.associationId(e),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":`
407
- `,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),d+=c.move(" "+a),d+=c.move(n.safe(e.title,{before:d,after:a,...c.current()})),d+=c.move(a),l()),o(),d}function Gb(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Tn(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hs(e,r,n){const s=Zr(e),a=Zr(r);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Xc.peek=Kb;function Xc(e,r,n,s){const a=Gb(n),i=n.enter("emphasis"),o=n.createTracker(s),l=o.move(a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const d=c.charCodeAt(0),u=hs(s.before.charCodeAt(s.before.length-1),d,a);u.inside&&(c=Tn(d)+c.slice(1));const m=c.charCodeAt(c.length-1),h=hs(s.after.charCodeAt(0),m,a);h.inside&&(c=c.slice(0,-1)+Tn(m));const p=o.move(a);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+c+p}function Kb(e,r,n){return n.options.emphasis||"*"}function Jb(e,r){let n=!1;return mi(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Sa}),!!((!e.depth||e.depth<3)&&ai(e)&&(r.options.setext||n))}function Yb(e,r,n,s){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(Jb(e,n)){const u=n.enter("headingSetext"),m=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
408
- `,after:`
409
- `});return m(),u(),h+`
410
- `+(a===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
411
- `))+1))}const o="#".repeat(a),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
412
- `,...i.current()});return/^[\t ]/.test(d)&&(d=Tn(d.charCodeAt(0))+d.slice(1)),d=d?o+" "+d:o,n.options.closeAtx&&(d+=" "+o),c(),l(),d}Zc.peek=Qb;function Zc(e){return e.value||""}function Qb(){return"<"}ed.peek=Xb;function ed(e,r,n,s){const a=hi(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(s);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),d+=c.move(" "+a),d+=c.move(n.safe(e.title,{before:d,after:a,...c.current()})),d+=c.move(a),l()),d+=c.move(")"),o(),d}function Xb(){return"!"}td.peek=Zb;function td(e,r,n,s){const a=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const d=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const m=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=u,i(),a==="full"||!d||d!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Zb(){return"!"}rd.peek=ey;function rd(e,r,n){let s=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(s);){let d=c.index;s.charCodeAt(d)===10&&s.charCodeAt(d-1)===13&&d--,s=s.slice(0,d)+" "+s.slice(c.index+1)}}return a+s+a}function ey(){return"`"}function nd(e,r){const n=ai(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}sd.peek=ty;function sd(e,r,n,s){const a=hi(n),i=a==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let l,c;if(nd(e,n)){const u=n.stack;n.stack=[],l=n.enter("autolink");let m=o.move("<");return m+=o.move(n.containerPhrasing(e,{before:m,after:">",...o.current()})),m+=o.move(">"),l(),n.stack=u,m}l=n.enter("link"),c=n.enter("label");let d=o.move("[");return d+=o.move(n.containerPhrasing(e,{before:d,after:"](",...o.current()})),d+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=o.move("<"),d+=o.move(n.safe(e.url,{before:d,after:">",...o.current()})),d+=o.move(">")):(c=n.enter("destinationRaw"),d+=o.move(n.safe(e.url,{before:d,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),d+=o.move(" "+a),d+=o.move(n.safe(e.title,{before:d,after:a,...o.current()})),d+=o.move(a),c()),d+=o.move(")"),l(),d}function ty(e,r,n){return nd(e,n)?"<":"["}ad.peek=ry;function ad(e,r,n,s){const a=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const m=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=u,i(),a==="full"||!d||d!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function ry(){return"["}function fi(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 ny(e){const r=fi(e),n=e.options.bulletOther;if(!n)return r==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+n+"`) to be different");return n}function sy(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 id(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 ay(e,r,n,s){const a=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?sy(n):fi(n);const l=e.ordered?o==="."?")":".":ny(n);let c=r&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),id(n)===o&&u){let m=-1;for(;++m<e.children.length;){const h=e.children[m];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const d=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,a(),d}function iy(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 oy(e,r,n,s){const a=iy(n);let i=n.bulletCurrent||fi(n);r&&r.type==="list"&&r.ordered&&(i=(typeof r.start=="number"&&r.start>-1?r.start:1)+(n.options.incrementListMarker===!1?0:r.children.indexOf(e))+i);let o=i.length+1;(a==="tab"||a==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(s);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,l.current()),u);return c(),d;function u(m,h,p){return h?(p?"":" ".repeat(o))+m:(p?i:i+" ".repeat(o-i.length))+m}}function ly(e,r,n,s){const a=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),a(),o}const cy=Ss(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dy(e,r,n,s){return(e.children.some(function(o){return cy(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function uy(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}od.peek=my;function od(e,r,n,s){const a=uy(n),i=n.enter("strong"),o=n.createTracker(s),l=o.move(a+a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const d=c.charCodeAt(0),u=hs(s.before.charCodeAt(s.before.length-1),d,a);u.inside&&(c=Tn(d)+c.slice(1));const m=c.charCodeAt(c.length-1),h=hs(s.after.charCodeAt(0),m,a);h.inside&&(c=c.slice(0,-1)+Tn(m));const p=o.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+c+p}function my(e,r,n){return n.options.strong||"*"}function py(e,r,n,s){return n.safe(e.value,s)}function hy(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 fy(e,r,n){const s=(id(n)+(n.options.ruleSpaces?" ":"")).repeat(hy(n));return n.options.ruleSpaces?s.slice(0,-1):s}const ld={blockquote:Fb,break:Fo,code:Hb,definition:Vb,emphasis:Xc,hardBreak:Fo,heading:Yb,html:Zc,image:ed,imageReference:td,inlineCode:rd,link:sd,linkReference:ad,list:ay,listItem:oy,paragraph:ly,root:dy,strong:od,text:py,thematicBreak:fy};function gy(){return{enter:{table:xy,tableData:$o,tableHeader:$o,tableRow:yy},exit:{codeText:ky,table:by,tableData:ra,tableHeader:ra,tableRow:ra}}}function xy(e){const r=e._align;this.enter({type:"table",align:r.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function by(e){this.exit(e),this.data.inTable=void 0}function yy(e){this.enter({type:"tableRow",children:[]},e)}function ra(e){this.exit(e)}function $o(e){this.enter({type:"tableCell",children:[]},e)}function ky(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,vy));const n=this.stack[this.stack.length-1];n.type,n.value=r,this.exit(e)}function vy(e,r){return r==="|"?r:e}function wy(e){const r=e||{},n=r.tableCellPadding,s=r.tablePipeAlign,a=r.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
413
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(p,g,x,b){return d(u(p,x,b),p.align)}function l(p,g,x,b){const k=m(p,x,b),C=d([k]);return C.slice(0,C.indexOf(`
414
- `))}function c(p,g,x,b){const k=x.enter("tableCell"),C=x.enter("phrasing"),y=x.containerPhrasing(p,{...b,before:i,after:i});return C(),k(),y}function d(p,g){return _b(p,{align:g,alignDelimiters:s,padding:n,stringLength:a})}function u(p,g,x){const b=p.children;let k=-1;const C=[],y=g.enter("table");for(;++k<b.length;)C[k]=m(b[k],g,x);return y(),C}function m(p,g,x){const b=p.children;let k=-1;const C=[],y=g.enter("tableRow");for(;++k<b.length;)C[k]=c(b[k],p,g,x);return y(),C}function h(p,g,x){let b=ld.inlineCode(p,g,x);return x.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function jy(){return{exit:{taskListCheckValueChecked:Oo,taskListCheckValueUnchecked:Oo,paragraph:Cy}}}function Ny(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sy}}}function Oo(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function Cy(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=r.children;let i=-1,o;for(;++i<a.length;){const l=a[i];if(l.type==="paragraph"){o=l;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function Sy(e,r,n,s){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(s);i&&l.move(o);let c=ld.listItem(e,r,n,{...s,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(u){return u+o}}function Ey(){return[ab(),Sb(),Mb(),gy(),jy()]}function Iy(e){return{extensions:[ib(),Eb(e),Tb(),wy(e),Ny()]}}const Ay={tokenize:Ry,partial:!0},cd={tokenize:_y,partial:!0},dd={tokenize:zy,partial:!0},ud={tokenize:Fy,partial:!0},My={tokenize:$y,partial:!0},md={name:"wwwAutolink",tokenize:Py,previous:hd},pd={name:"protocolAutolink",tokenize:Ly,previous:fd},pr={name:"emailAutolink",tokenize:Dy,previous:gd},nr={};function Ty(){return{text:nr}}let Er=48;for(;Er<123;)nr[Er]=pr,Er++,Er===58?Er=65:Er===91&&(Er=97);nr[43]=pr;nr[45]=pr;nr[46]=pr;nr[95]=pr;nr[72]=[pr,pd];nr[104]=[pr,pd];nr[87]=[pr,md];nr[119]=[pr,md];function Dy(e,r,n){const s=this;let a,i;return o;function o(m){return!Ma(m)||!gd.call(s,s.previous)||gi(s.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return Ma(m)?(e.consume(m),l):m===64?(e.consume(m),c):n(m)}function c(m){return m===46?e.check(My,u,d)(m):m===45||m===95||jt(m)?(i=!0,e.consume(m),c):u(m)}function d(m){return e.consume(m),a=!0,c}function u(m){return i&&a&&Et(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):n(m)}}function Py(e,r,n){const s=this;return a;function a(o){return o!==87&&o!==119||!hd.call(s,s.previous)||gi(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Ay,e.attempt(cd,e.attempt(dd,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(o)}}function Ly(e,r,n){const s=this;let a="",i=!1;return o;function o(m){return(m===72||m===104)&&fd.call(s,s.previous)&&!gi(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),l):n(m)}function l(m){if(Et(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const h=a.toLowerCase();if(h==="http"||h==="https")return e.consume(m),c}return n(m)}function c(m){return m===47?(e.consume(m),i?d:(i=!0,c)):n(m)}function d(m){return m===null||us(m)||lt(m)||_r(m)||js(m)?n(m):e.attempt(cd,e.attempt(dd,u),n)(m)}function u(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function Ry(e,r,n){let s=0;return a;function a(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),a):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):r(o)}}function _y(e,r,n){let s,a,i;return o;function o(d){return d===46||d===95?e.check(ud,c,l)(d):d===null||lt(d)||_r(d)||d!==45&&js(d)?c(d):(i=!0,e.consume(d),o)}function l(d){return d===95?s=!0:(a=s,s=void 0),e.consume(d),o}function c(d){return a||s||!i?n(d):r(d)}}function zy(e,r){let n=0,s=0;return a;function a(o){return o===40?(n++,e.consume(o),a):o===41&&s<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(ud,r,i)(o):o===null||lt(o)||_r(o)?r(o):(e.consume(o),a)}function i(o){return o===41&&s++,e.consume(o),a}}function Fy(e,r,n){return s;function s(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),s):l===38?(e.consume(l),i):l===93?(e.consume(l),a):l===60||l===null||lt(l)||_r(l)?r(l):n(l)}function a(l){return l===null||l===40||l===91||lt(l)||_r(l)?r(l):s(l)}function i(l){return Et(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),s):Et(l)?(e.consume(l),o):n(l)}}function $y(e,r,n){return s;function s(i){return e.consume(i),a}function a(i){return jt(i)?n(i):r(i)}}function hd(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||lt(e)}function fd(e){return!Et(e)}function gd(e){return!(e===47||Ma(e))}function Ma(e){return e===43||e===45||e===46||e===95||jt(e)}function gi(e){let r=e.length,n=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Oy={tokenize:Ky,partial:!0};function By(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qy,continuation:{tokenize:Vy},exit:Gy}},text:{91:{name:"gfmFootnoteCall",tokenize:Hy},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Uy,resolveTo:Wy}}}}function Uy(e,r,n){const s=this;let a=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;a--;){const c=s.events[a][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const d=Yt(s.sliceSerialize({start:o.end,end:s.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),r(c))}}function Wy(e,r){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",s,r],e[n+3],e[n+4],["enter",a,r],["exit",a,r],["enter",i,r],["enter",o,r],["exit",o,r],["exit",i,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(n,e.length-n+1,...l),e}function Hy(e,r,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(m){if(i>999||m===93&&!o||m===null||m===91||lt(m))return n(m);if(m===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return a.includes(Yt(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):n(m)}return lt(m)||(o=!0),i++,e.consume(m),m===92?u:d}function u(m){return m===91||m===92||m===93?(e.consume(m),i++,d):d(m)}}function qy(e,r,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(g)}function u(g){if(o>999||g===93&&!l||g===null||g===91||lt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=Yt(s.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return lt(g)||(l=!0),o++,e.consume(g),g===92?m:u}function m(g){return g===91||g===92||g===93?(e.consume(g),o++,u):u(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),a.includes(i)||a.push(i),rt(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return r(g)}}function Vy(e,r,n){return e.check($n,r,e.attempt(Oy,r,n))}function Gy(e){e.exit("gfmFootnoteDefinition")}function Ky(e,r,n){const s=this;return rt(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?r(i):n(i)}}function Jy(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let d=c;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[c][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[c][1].end)},m={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",u,l],["enter",o[d][1],l],["exit",o[d][1],l],["enter",m,l]],p=l.parser.constructs.insideSpan.null;p&&$t(h,h.length,0,Ns(p,o.slice(d+1,c),l)),$t(h,h.length,0,[["exit",m,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",u,l]]),$t(o,d-1,c-d+3,h),c=d+h.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const d=this.previous,u=this.events;let m=0;return h;function h(g){return d===126&&u[u.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=Zr(d);if(g===126)return m>1?c(g):(o.consume(g),m++,p);if(m<2&&!n)return c(g);const b=o.exit("strikethroughSequenceTemporary"),k=Zr(g);return b._open=!k||k===2&&!!x,b._close=!x||x===2&&!!k,l(g)}}}class Yy{constructor(){this.map=[]}add(r,n,s){Qy(this,r,n,s)}consume(r){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(r.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),r.length=this.map[n][0];s.push(r.slice()),r.length=0;let a=s.pop();for(;a;){for(const i of a)r.push(i);a=s.pop()}this.map.length=0}}function Qy(e,r,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===r){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([r,n,s])}}function Xy(e,r){let n=!1;const s=[];for(;r<e.length;){const a=e[r];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);r+=1}return s}function Zy(){return{flow:{null:{name:"table",tokenize:ek,resolveAll:tk}}}}function ek(e,r,n){const s=this;let a=0,i=0,o;return l;function l(j){let T=s.events.length-1;for(;T>-1;){const w=s.events[T][1].type;if(w==="lineEnding"||w==="linePrefix")T--;else break}const I=T>-1?s.events[T][1].type:null,_=I==="tableHead"||I==="tableRow"?M:c;return _===M&&s.parser.lazy[s.now().line]?n(j):_(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),d(j)}function d(j){return j===124||(o=!0,i+=1),u(j)}function u(j){return j===null?n(j):Te(j)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):Xe(j)?rt(e,u,"whitespace")(j):(i+=1,o&&(o=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),m(j)))}function m(j){return j===null||j===124||lt(j)?(e.exit("data"),u(j)):(e.consume(j),j===92?h:m)}function h(j){return j===92||j===124?(e.consume(j),m):m(j)}function p(j){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(j):(e.enter("tableDelimiterRow"),o=!1,Xe(j)?rt(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):g(j))}function g(j){return j===45||j===58?b(j):j===124?(o=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),x):H(j)}function x(j){return Xe(j)?rt(e,b,"whitespace")(j):b(j)}function b(j){return j===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),k):j===45?(i+=1,k(j)):j===null||Te(j)?R(j):H(j)}function k(j){return j===45?(e.enter("tableDelimiterFiller"),C(j)):H(j)}function C(j){return j===45?(e.consume(j),C):j===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(j))}function y(j){return Xe(j)?rt(e,R,"whitespace")(j):R(j)}function R(j){return j===124?g(j):j===null||Te(j)?!o||a!==i?H(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(j)):H(j)}function H(j){return n(j)}function M(j){return e.enter("tableRow"),O(j)}function O(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),O):j===null||Te(j)?(e.exit("tableRow"),r(j)):Xe(j)?rt(e,O,"whitespace")(j):(e.enter("data"),L(j))}function L(j){return j===null||j===124||lt(j)?(e.exit("data"),O(j)):(e.consume(j),j===92?q:L)}function q(j){return j===92||j===124?(e.consume(j),L):L(j)}}function tk(e,r){let n=-1,s=!0,a=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,d,u,m;const h=new Yy;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(Bo(h,r,c,d,u),u=void 0,c=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",d,r]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(s=!0,m=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,u={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,r]])),a=g.type==="tableDelimiterRow"?2:u?3:1):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],m=es(h,r,i,a,void 0,m),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],m=es(h,r,i,a,void 0,m)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],m=es(h,r,i,a,n,m)):o[1]!==0&&(m=es(h,r,o,a,n,m)),a=0):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Bo(h,r,c,d,u),h.consume(r.events),n=-1;++n<r.events.length;){const p=r.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Xy(r.events,n))}return e}function es(e,r,n,s,a,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},qr(r.events,n[0])),e.add(n[0],0,[["exit",i,r]]));const c=qr(r.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,r]]),n[2]!==0){const d=qr(r.events,n[2]),u=qr(r.events,n[3]),m={type:l,start:Object.assign({},d),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",m,r]]),s!==2){const h=r.events[n[2]],p=r.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",m,r]])}return a!==void 0&&(i.end=Object.assign({},qr(r.events,a)),e.add(a,0,[["exit",i,r]]),i=void 0),i}function Bo(e,r,n,s,a){const i=[],o=qr(r.events,n);a&&(a.end=Object.assign({},o),i.push(["exit",a,r])),s.end=Object.assign({},o),i.push(["exit",s,r]),e.add(n+1,0,i)}function qr(e,r){const n=e[r],s=n[0]==="enter"?"start":"end";return n[1][s]}const rk={name:"tasklistCheck",tokenize:sk};function nk(){return{text:{91:rk}}}function sk(e,r,n){const s=this;return a;function a(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return lt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Te(c)?r(c):Xe(c)?e.check({tokenize:ak},r,n)(c):n(c)}}function ak(e,r,n){return rt(e,s,"whitespace");function s(a){return a===null?n(a):r(a)}}function ik(e){return Ec([Ty(),By(),Jy(e),Zy(),nk()])}const ok={};function lk(e){const r=this,n=e||ok,s=r.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(ik(n)),i.push(Ey()),o.push(Iy(n))}var na={exports:{}},sa,Uo;function ck(){if(Uo)return sa;Uo=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return sa=e,sa}var aa,Wo;function dk(){if(Wo)return aa;Wo=1;var e=ck();function r(){}function n(){}return n.resetWarningCache=r,aa=function(){function s(o,l,c,d,u,m){if(m!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}s.isRequired=s;function a(){return s}var i={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:a,element:s,elementType:s,instanceOf:a,node:s,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:r};return i.PropTypes=i,i},aa}var Ho;function uk(){return Ho||(Ho=1,na.exports=dk()()),na.exports}var mk=uk();const it=Ln(mk);function $r(e,r,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(m){o(m)}}function c(u){try{d(s.throw(u))}catch(m){o(m)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,r||[])).next())})}const pk=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function en(e,r,n){const s=hk(e),{webkitRelativePath:a}=e,i=typeof r=="string"?r:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof s.path!="string"&&qo(s,"path",i),qo(s,"relativePath",i),s}function hk(e){const{name:r}=e;if(r&&r.lastIndexOf(".")!==-1&&!e.type){const s=r.split(".").pop().toLowerCase(),a=pk.get(s);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function qo(e,r,n){Object.defineProperty(e,r,{value:n,writable:!1,configurable:!1,enumerable:!0})}const fk=[".DS_Store","Thumbs.db"];function gk(e){return $r(this,void 0,void 0,function*(){return fs(e)&&xk(e.dataTransfer)?vk(e.dataTransfer,e.type):bk(e)?yk(e):Array.isArray(e)&&e.every(r=>"getFile"in r&&typeof r.getFile=="function")?kk(e):[]})}function xk(e){return fs(e)}function bk(e){return fs(e)&&fs(e.target)}function fs(e){return typeof e=="object"&&e!==null}function yk(e){return Ta(e.target.files).map(r=>en(r))}function kk(e){return $r(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>en(n))})}function vk(e,r){return $r(this,void 0,void 0,function*(){if(e.items){const n=Ta(e.items).filter(a=>a.kind==="file");if(r!=="drop")return n;const s=yield Promise.all(n.map(wk));return Vo(xd(s))}return Vo(Ta(e.files).map(n=>en(n)))})}function Vo(e){return e.filter(r=>fk.indexOf(r.name)===-1)}function Ta(e){if(e===null)return[];const r=[];for(let n=0;n<e.length;n++){const s=e[n];r.push(s)}return r}function wk(e){if(typeof e.webkitGetAsEntry!="function")return Go(e);const r=e.webkitGetAsEntry();return r&&r.isDirectory?bd(r):Go(e,r)}function xd(e){return e.reduce((r,n)=>[...r,...Array.isArray(n)?xd(n):[n]],[])}function Go(e,r){return $r(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){const o=yield i.getFile();return o.handle=i,en(o)}}const s=e.getAsFile();if(!s)throw new Error(`${e} is not a File`);return en(s,(n=r?.fullPath)!==null&&n!==void 0?n:void 0)})}function jk(e){return $r(this,void 0,void 0,function*(){return e.isDirectory?bd(e):Nk(e)})}function bd(e){const r=e.createReader();return new Promise((n,s)=>{const a=[];function i(){r.readEntries(o=>$r(this,void 0,void 0,function*(){if(o.length){const l=Promise.all(o.map(jk));a.push(l),i()}else try{const l=yield Promise.all(a);n(l)}catch(l){s(l)}}),o=>{s(o)})}i()})}function Nk(e){return $r(this,void 0,void 0,function*(){return new Promise((r,n)=>{e.file(s=>{const a=en(s,e.fullPath);r(a)},s=>{n(s)})})})}var ts={},Ko;function Ck(){return Ko||(Ko=1,ts.__esModule=!0,ts.default=function(e,r){if(e&&r){var n=Array.isArray(r)?r:r.split(",");if(n.length===0)return!0;var s=e.name||"",a=(e.type||"").toLowerCase(),i=a.replace(/\/.*$/,"");return n.some(function(o){var l=o.trim().toLowerCase();return l.charAt(0)==="."?s.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):a===l})}return!0}),ts}var Sk=Ck();const ia=Ln(Sk);function Jo(e){return Ak(e)||Ik(e)||kd(e)||Ek()}function Ek(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
415
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ik(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ak(e){if(Array.isArray(e))return Da(e)}function Yo(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Qo(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Yo(Object(n),!0).forEach(function(s){yd(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yo(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function yd(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Dn(e,r){return Dk(e)||Tk(e,r)||kd(e,r)||Mk()}function Mk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
416
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kd(e,r){if(e){if(typeof e=="string")return Da(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Da(e,r)}}function Da(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=e[n];return s}function Tk(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s=[],a=!0,i=!1,o,l;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(s.push(o.value),!(r&&s.length===r));a=!0);}catch(c){i=!0,l=c}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return s}}function Dk(e){if(Array.isArray(e))return e}var Pk=typeof ia=="function"?ia:ia.default,Lk="file-invalid-type",Rk="file-too-large",_k="file-too-small",zk="too-many-files",Fk=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=r.split(","),s=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:Lk,message:"File type must be ".concat(s)}},Xo=function(r){return{code:Rk,message:"File is larger than ".concat(r," ").concat(r===1?"byte":"bytes")}},Zo=function(r){return{code:_k,message:"File is smaller than ".concat(r," ").concat(r===1?"byte":"bytes")}},$k={code:zk,message:"Too many files"};function vd(e,r){var n=e.type==="application/x-moz-file"||Pk(e,r);return[n,n?null:Fk(r)]}function wd(e,r,n){if(Ar(e.size))if(Ar(r)&&Ar(n)){if(e.size>n)return[!1,Xo(n)];if(e.size<r)return[!1,Zo(r)]}else{if(Ar(r)&&e.size<r)return[!1,Zo(r)];if(Ar(n)&&e.size>n)return[!1,Xo(n)]}return[!0,null]}function Ar(e){return e!=null}function Ok(e){var r=e.files,n=e.accept,s=e.minSize,a=e.maxSize,i=e.multiple,o=e.maxFiles,l=e.validator;return!i&&r.length>1||i&&o>=1&&r.length>o?!1:r.every(function(c){var d=vd(c,n),u=Dn(d,1),m=u[0],h=wd(c,s,a),p=Dn(h,1),g=p[0],x=l?l(c):null;return m&&g&&!x})}function gs(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function rs(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(r){return r==="Files"||r==="application/x-moz-file"}):!!e.target&&!!e.target.files}function el(e){e.preventDefault()}function Bk(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Uk(e){return e.indexOf("Edge/")!==-1}function Wk(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Bk(e)||Uk(e)}function Xt(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(s){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return r.some(function(l){return!gs(s)&&l&&l.apply(void 0,[s].concat(i)),gs(s)})}}function Hk(){return"showOpenFilePicker"in window}function qk(e){if(Ar(e)){var r=Object.entries(e).filter(function(n){var s=Dn(n,2),a=s[0],i=s[1],o=!0;return jd(a)||(console.warn('Skipped "'.concat(a,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(i)||!i.every(Nd))&&(console.warn('Skipped "'.concat(a,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(n,s){var a=Dn(s,2),i=a[0],o=a[1];return Qo(Qo({},n),{},yd({},i,o))},{});return[{description:"Files",accept:r}]}return e}function Vk(e){if(Ar(e))return Object.entries(e).reduce(function(r,n){var s=Dn(n,2),a=s[0],i=s[1];return[].concat(Jo(r),[a],Jo(i))},[]).filter(function(r){return jd(r)||Nd(r)}).join(",")}function Gk(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Kk(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function jd(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function Nd(e){return/^.*\.[\w]+$/.test(e)}var Jk=["children"],Yk=["open"],Qk=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Xk=["refKey","onChange","onClick"];function Zk(e){return rv(e)||tv(e)||Cd(e)||ev()}function ev(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
417
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tv(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rv(e){if(Array.isArray(e))return Pa(e)}function oa(e,r){return av(e)||sv(e,r)||Cd(e,r)||nv()}function nv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
418
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cd(e,r){if(e){if(typeof e=="string")return Pa(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pa(e,r)}}function Pa(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=e[n];return s}function sv(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s=[],a=!0,i=!1,o,l;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(s.push(o.value),!(r&&s.length===r));a=!0);}catch(c){i=!0,l=c}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return s}}function av(e){if(Array.isArray(e))return e}function tl(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function ht(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?tl(Object(n),!0).forEach(function(s){La(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function La(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function xs(e,r){if(e==null)return{};var n=iv(e,r),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function iv(e,r){if(e==null)return{};var n={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(r.indexOf(a)>=0)&&(n[a]=e[a]);return n}var xi=f.forwardRef(function(e,r){var n=e.children,s=xs(e,Jk),a=Ed(s),i=a.open,o=xs(a,Yk);return f.useImperativeHandle(r,function(){return{open:i}},[i]),cr.createElement(f.Fragment,null,n(ht(ht({},o),{},{open:i})))});xi.displayName="Dropzone";var Sd={disabled:!1,getFilesFromEvent:gk,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};xi.defaultProps=Sd;xi.propTypes={children:it.func,accept:it.objectOf(it.arrayOf(it.string)),multiple:it.bool,preventDropOnDocument:it.bool,noClick:it.bool,noKeyboard:it.bool,noDrag:it.bool,noDragEventsBubbling:it.bool,minSize:it.number,maxSize:it.number,maxFiles:it.number,disabled:it.bool,getFilesFromEvent:it.func,onFileDialogCancel:it.func,onFileDialogOpen:it.func,useFsAccessApi:it.bool,autoFocus:it.bool,onDragEnter:it.func,onDragLeave:it.func,onDragOver:it.func,onDrop:it.func,onDropAccepted:it.func,onDropRejected:it.func,onError:it.func,validator:it.func};var Ra={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Ed(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=ht(ht({},Sd),e),n=r.accept,s=r.disabled,a=r.getFilesFromEvent,i=r.maxSize,o=r.minSize,l=r.multiple,c=r.maxFiles,d=r.onDragEnter,u=r.onDragLeave,m=r.onDragOver,h=r.onDrop,p=r.onDropAccepted,g=r.onDropRejected,x=r.onFileDialogCancel,b=r.onFileDialogOpen,k=r.useFsAccessApi,C=r.autoFocus,y=r.preventDropOnDocument,R=r.noClick,H=r.noKeyboard,M=r.noDrag,O=r.noDragEventsBubbling,L=r.onError,q=r.validator,j=f.useMemo(function(){return Vk(n)},[n]),T=f.useMemo(function(){return qk(n)},[n]),I=f.useMemo(function(){return typeof b=="function"?b:rl},[b]),_=f.useMemo(function(){return typeof x=="function"?x:rl},[x]),w=f.useRef(null),W=f.useRef(null),F=f.useReducer(ov,Ra),$=oa(F,2),K=$[0],ce=$[1],S=K.isFocused,Ae=K.isFileDialogActive,$e=f.useRef(typeof window<"u"&&window.isSecureContext&&k&&Hk()),v=function(){!$e.current&&Ae&&setTimeout(function(){if(W.current){var de=W.current.files;de.length||(ce({type:"closeDialog"}),_())}},300)};f.useEffect(function(){return window.addEventListener("focus",v,!1),function(){window.removeEventListener("focus",v,!1)}},[W,Ae,_,$e]);var ae=f.useRef([]),me=function(de){w.current&&w.current.contains(de.target)||(de.preventDefault(),ae.current=[])};f.useEffect(function(){return y&&(document.addEventListener("dragover",el,!1),document.addEventListener("drop",me,!1)),function(){y&&(document.removeEventListener("dragover",el),document.removeEventListener("drop",me))}},[w,y]),f.useEffect(function(){return!s&&C&&w.current&&w.current.focus(),function(){}},[w,C,s]);var Ee=f.useCallback(function(te){L?L(te):console.error(te)},[L]),ie=f.useCallback(function(te){te.preventDefault(),te.persist(),Oe(te),ae.current=[].concat(Zk(ae.current),[te.target]),rs(te)&&Promise.resolve(a(te)).then(function(de){if(!(gs(te)&&!O)){var z=de.length,D=z>0&&Ok({files:de,accept:j,minSize:o,maxSize:i,multiple:l,maxFiles:c,validator:q}),Y=z>0&&!D;ce({isDragAccept:D,isDragReject:Y,isDragActive:!0,type:"setDraggedFiles"}),d&&d(te)}}).catch(function(de){return Ee(de)})},[a,d,Ee,O,j,o,i,l,c,q]),qe=f.useCallback(function(te){te.preventDefault(),te.persist(),Oe(te);var de=rs(te);if(de&&te.dataTransfer)try{te.dataTransfer.dropEffect="copy"}catch{}return de&&m&&m(te),!1},[m,O]),re=f.useCallback(function(te){te.preventDefault(),te.persist(),Oe(te);var de=ae.current.filter(function(D){return w.current&&w.current.contains(D)}),z=de.indexOf(te.target);z!==-1&&de.splice(z,1),ae.current=de,!(de.length>0)&&(ce({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),rs(te)&&u&&u(te))},[w,u,O]),le=f.useCallback(function(te,de){var z=[],D=[];te.forEach(function(Y){var Z=vd(Y,j),se=oa(Z,2),je=se[0],_e=se[1],Le=wd(Y,o,i),Ge=oa(Le,2),et=Ge[0],We=Ge[1],nt=q?q(Y):null;if(je&&et&&!nt)z.push(Y);else{var ct=[_e,We];nt&&(ct=ct.concat(nt)),D.push({file:Y,errors:ct.filter(function(Rt){return Rt})})}}),(!l&&z.length>1||l&&c>=1&&z.length>c)&&(z.forEach(function(Y){D.push({file:Y,errors:[$k]})}),z.splice(0)),ce({acceptedFiles:z,fileRejections:D,isDragReject:D.length>0,type:"setFiles"}),h&&h(z,D,de),D.length>0&&g&&g(D,de),z.length>0&&p&&p(z,de)},[ce,l,j,o,i,c,h,p,g,q]),fe=f.useCallback(function(te){te.preventDefault(),te.persist(),Oe(te),ae.current=[],rs(te)&&Promise.resolve(a(te)).then(function(de){gs(te)&&!O||le(de,te)}).catch(function(de){return Ee(de)}),ce({type:"reset"})},[a,le,Ee,O]),we=f.useCallback(function(){if($e.current){ce({type:"openDialog"}),I();var te={multiple:l,types:T};window.showOpenFilePicker(te).then(function(de){return a(de)}).then(function(de){le(de,null),ce({type:"closeDialog"})}).catch(function(de){Gk(de)?(_(de),ce({type:"closeDialog"})):Kk(de)?($e.current=!1,W.current?(W.current.value=null,W.current.click()):Ee(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Ee(de)});return}W.current&&(ce({type:"openDialog"}),I(),W.current.value=null,W.current.click())},[ce,I,_,k,le,Ee,T,l]),ve=f.useCallback(function(te){!w.current||!w.current.isEqualNode(te.target)||(te.key===" "||te.key==="Enter"||te.keyCode===32||te.keyCode===13)&&(te.preventDefault(),we())},[w,we]),Ye=f.useCallback(function(){ce({type:"focus"})},[]),Ue=f.useCallback(function(){ce({type:"blur"})},[]),at=f.useCallback(function(){R||(Wk()?setTimeout(we,0):we())},[R,we]),De=function(de){return s?null:de},ye=function(de){return H?null:De(de)},ke=function(de){return M?null:De(de)},Oe=function(de){O&&de.stopPropagation()},st=f.useMemo(function(){return function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},de=te.refKey,z=de===void 0?"ref":de,D=te.role,Y=te.onKeyDown,Z=te.onFocus,se=te.onBlur,je=te.onClick,_e=te.onDragEnter,Le=te.onDragOver,Ge=te.onDragLeave,et=te.onDrop,We=xs(te,Qk);return ht(ht(La({onKeyDown:ye(Xt(Y,ve)),onFocus:ye(Xt(Z,Ye)),onBlur:ye(Xt(se,Ue)),onClick:De(Xt(je,at)),onDragEnter:ke(Xt(_e,ie)),onDragOver:ke(Xt(Le,qe)),onDragLeave:ke(Xt(Ge,re)),onDrop:ke(Xt(et,fe)),role:typeof D=="string"&&D!==""?D:"presentation"},z,w),!s&&!H?{tabIndex:0}:{}),We)}},[w,ve,Ye,Ue,at,ie,qe,re,fe,H,M,s]),Ie=f.useCallback(function(te){te.stopPropagation()},[]),Lt=f.useMemo(function(){return function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},de=te.refKey,z=de===void 0?"ref":de,D=te.onChange,Y=te.onClick,Z=xs(te,Xk),se=La({accept:j,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:De(Xt(D,fe)),onClick:De(Xt(Y,Ie)),tabIndex:-1},z,W);return ht(ht({},se),Z)}},[W,n,l,fe,s]);return ht(ht({},K),{},{isFocused:S&&!s,getRootProps:st,getInputProps:Lt,rootRef:w,inputRef:W,open:De(we)})}function ov(e,r){switch(r.type){case"focus":return ht(ht({},e),{},{isFocused:!0});case"blur":return ht(ht({},e),{},{isFocused:!1});case"openDialog":return ht(ht({},Ra),{},{isFileDialogActive:!0});case"closeDialog":return ht(ht({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return ht(ht({},e),{},{isDragActive:r.isDragActive,isDragAccept:r.isDragAccept,isDragReject:r.isDragReject});case"setFiles":return ht(ht({},e),{},{acceptedFiles:r.acceptedFiles,fileRejections:r.fileRejections,isDragReject:r.isDragReject});case"reset":return ht({},Ra);default:return e}}function rl(){}const la=({todos:e,isResult:r=!1})=>{if(!e||!Array.isArray(e))return null;const n=i=>{switch(i){case"completed":return t.jsx(op,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"in_progress":return t.jsx(In,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"});case"pending":default:return t.jsx(Vr,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},s=i=>{switch(i){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800";case"in_progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800";case"pending":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},a=i=>{switch(i){case"high":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800";case"medium":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800";case"low":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}};return t.jsxs("div",{className:"space-y-3",children:[r&&t.jsxs("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Todo List (",e.length," ",e.length===1?"item":"items",")"]}),e.map((i,o)=>t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md dark:shadow-gray-900/50 transition-shadow",children:[t.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n(i.status)}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[t.jsx("p",{className:`text-sm font-medium ${i.status==="completed"?"line-through text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:i.content}),t.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[t.jsx(Tr,{variant:"outline",className:`text-xs px-2 py-0.5 ${a(i.priority)}`,children:i.priority}),t.jsx(Tr,{variant:"outline",className:`text-xs px-2 py-0.5 ${s(i.status)}`,children:i.status.replace("_"," ")})]})]})})]},i.id||`todo-${o}`))]})};var lv=Yu(),cv=Qu(),dv=Xu(),uv=Zu();const mv=`
419
- .xterm .xterm-screen {
420
- outline: none !important;
421
- }
422
- .xterm:focus .xterm-screen {
423
- outline: none !important;
424
- }
425
- .xterm-screen:focus {
426
- outline: none !important;
427
- }
428
- `;if(typeof document<"u"){const e=document.createElement("style");e.type="text/css",e.innerText=mv,document.head.appendChild(e)}const Ir=new Map;function bi({selectedProject:e,selectedSession:r,isActive:n,initialCommand:s,isPlainShell:a=!1,onProcessComplete:i}){const o=f.useRef(null),l=f.useRef(null),c=f.useRef(null),d=f.useRef(null),[u,m]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(!1),[b,k]=f.useState(null),[C,y]=f.useState(!1),R=()=>{!h||u||C||(y(!0),O())},H=()=>{d.current&&(d.current.close(),d.current=null),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H")),m(!1),y(!1)},M=()=>{x(!0),Array.from(Ir.keys()).filter(q=>q.includes(e.name)).forEach(q=>Ir.delete(q)),d.current&&(d.current.close(),d.current=null),l.current&&(l.current.dispose(),l.current=null,c.current=null),m(!1),p(!1),setTimeout(()=>{x(!1)},200)};f.useEffect(()=>{const L=r?.id||null;b!==null&&b!==L&&h&&(H(),Array.from(Ir.keys()).forEach(j=>{j.includes(e.name)&&Ir.delete(j)})),k(L)},[r?.id,h]),f.useEffect(()=>{if(!o.current||!e||g)return;const L=r?.id||`project-${e.name}`,q=Ir.get(L);if(q&&!l.current)try{l.current=q.terminal,c.current=q.fitAddon,d.current=q.ws,m(q.isConnected),l.current.element&&l.current.element.parentNode&&l.current.element.parentNode.removeChild(l.current.element),l.current.open(o.current),setTimeout(()=>{c.current&&(c.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100),p(!0);return}catch{Ir.delete(L),l.current=null,c.current=null,d.current=null}if(l.current)return;l.current=new lv.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",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",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),c.current=new cv.FitAddon;const j=new dv.ClipboardAddon,T=new uv.WebglAddon;l.current.loadAddon(c.current),l.current.loadAddon(j);try{l.current.loadAddon(T)}catch{}l.current.open(o.current),setTimeout(()=>{c.current&&c.current.fit()},50),l.current.attachCustomKeyEventHandler(_=>(_.ctrlKey||_.metaKey)&&_.key==="c"&&l.current.hasSelection()?(document.execCommand("copy"),!1):(_.ctrlKey||_.metaKey)&&_.key==="v"?(navigator.clipboard.readText().then(w=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:w}))}).catch(w=>{}),!1):!0),setTimeout(()=>{c.current&&(c.current.fit(),l.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100),p(!0),l.current.onData(_=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:_}))});const I=new ResizeObserver(()=>{c.current&&l.current&&setTimeout(()=>{c.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows}))},50)});return o.current&&I.observe(o.current),()=>{if(I.disconnect(),l.current&&e){const _=r?.id||`project-${e.name}`;try{Ir.set(_,{terminal:l.current,fitAddon:c.current,ws:d.current,isConnected:u})}catch{}}}},[o.current,e,r,g]),f.useEffect(()=>{!n||!h||setTimeout(()=>{c.current&&(c.current.fit(),l.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100)},[n,h]);const O=async()=>{if(!(C||u))try{const L=localStorage.getItem("auth-token");if(!L){console.error("No authentication token found for Shell WebSocket connection");return}let q;try{if(q=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${L}`}})).json()).wsUrl,q.includes("localhost")&&!window.location.hostname.includes("localhost")){const _=window.location.protocol==="https:"?"wss:":"ws:",w=window.location.port==="3001"?"3002":window.location.port;q=`${_}//${window.location.hostname}:${w}`}}catch{const I=window.location.protocol==="https:"?"wss:":"ws:",_=window.location.port==="3001"?"3002":window.location.port;q=`${I}//${window.location.hostname}:${_}`}const j=`${q}/shell?token=${encodeURIComponent(L)}`;d.current=new WebSocket(j),d.current.onopen=()=>{m(!0),y(!1),setTimeout(()=>{c.current&&l.current&&(c.current.fit(),setTimeout(()=>{const T={type:"init",projectPath:e.fullPath||e.path,sessionId:a?null:r?.id,hasSession:a?!1:!!r,provider:a?"plain-shell":r?.__provider||"claude",cols:l.current.cols,rows:l.current.rows,initialCommand:s,isPlainShell:a};console.log("Shell init payload:",T),d.current.send(JSON.stringify(T)),setTimeout(()=>{l.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows}))},100)},50))},200)},d.current.onmessage=T=>{try{const I=JSON.parse(T.data);if(I.type==="output"){const _=/(https?:\/\/[^\s\x1b\x07]+)/g;let w=I.data;const W=[];let F;for(;(F=_.exec(w.replace(/\x1b\[[0-9;]*m/g,"")))!==null;)W.push(F[1]);if(a&&i){const $=w.replace(/\x1b\[[0-9;]*m/g,"");if($.includes("Process exited with code 0"))i(0);else if($.match(/Process exited with code (\d+)/)){const K=parseInt($.match(/Process exited with code (\d+)/)[1]);K!==0&&i(K)}}l.current.write(w)}else I.type==="url_open"&&window.open(I.url,"_blank")}catch{}},d.current.onclose=T=>{m(!1),y(!1),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H"))},d.current.onerror=T=>{m(!1),y(!1)}}catch{m(!1),y(!1)}};return e?t.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[t.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${u?"bg-green-500":"bg-red-500"}`}),r&&(()=>{const L=r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session";return t.jsxs("span",{className:"text-xs text-blue-300",children:["(",L.slice(0,30),"...)"]})})(),!r&&t.jsx("span",{className:"text-xs text-gray-400",children:"(New Session)"}),!h&&t.jsx("span",{className:"text-xs text-yellow-400",children:"(Initializing...)"}),g&&t.jsx("span",{className:"text-xs text-blue-400",children:"(Restarting...)"})]}),t.jsxs("div",{className:"flex items-center space-x-3",children:[u&&t.jsxs("button",{onClick:H,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"Disconnect from shell",children:[t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),t.jsx("span",{children:"Disconnect"})]}),t.jsxs("button",{onClick:M,disabled:g||u,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"Restart Shell (disconnect first)",children:[t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t.jsx("span",{children:"Restart"})]})]})]})}),t.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[t.jsx("div",{ref:o,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!h&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:t.jsx("div",{className:"text-white",children:"Loading terminal..."})}),h&&!u&&!C&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:t.jsxs("div",{className:"text-center max-w-sm w-full",children:[t.jsxs("button",{onClick:R,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:"Connect to shell",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),t.jsx("span",{children:"Continue in Shell"})]}),t.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Run ${s||"command"} in ${e.displayName}`:r?`Resume session: ${(r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session").slice(0,50)}...`:"Start a new Claude session"})]})}),C&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:t.jsxs("div",{className:"text-center max-w-sm w-full",children:[t.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[t.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),t.jsx("span",{className:"text-base font-medium",children:"Connecting to shell..."})]}),t.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Running ${s||"command"} in ${e.displayName}`:`Starting Claude CLI in ${e.displayName}`})]})})]})]}):t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[t.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Select a Project"}),t.jsx("p",{children:"Choose a project to open an interactive shell in that directory"})]})})}const Id=({task:e,onClose:r,onEdit:n,onStatusChange:s,onTaskClick:a,isOpen:i=!0,className:o=""})=>{const[l,c]=f.useState(!1),[d,u]=f.useState(e||{}),[m,h]=f.useState(!1),[p,g]=f.useState(!1),[x,b]=f.useState(!1),{currentProject:k,refreshTasks:C}=_n();if(!i||!e)return null;const y=async()=>{if(k){h(!0);try{const j={};if(d.title!==e.title&&(j.title=d.title),d.description!==e.description&&(j.description=d.description),d.details!==e.details&&(j.details=d.details),Object.keys(j).length>0){const T=await Fe.taskmaster.updateTask(k.name,e.id,j);if(T.ok)C?.(),n?.(d),c(!1);else{const I=await T.json();console.error("Failed to update task:",I),alert(`Failed to update task: ${I.message}`)}}else c(!1)}catch(j){console.error("Error updating task:",j),alert("Error updating task. Please try again.")}finally{h(!1)}}},R=()=>{navigator.clipboard.writeText(e.id.toString())},H=j=>{switch(j){case"done":return{icon:Rn,color:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-950"};case"in-progress":return{icon:In,color:"text-blue-600 dark:text-blue-400",bg:"bg-blue-50 dark:bg-blue-950"};case"review":return{icon:Qa,color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-50 dark:bg-amber-950"};case"deferred":return{icon:ic,color:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800"};case"cancelled":return{icon:ot,color:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-950"};default:return{icon:Vr,color:"text-slate-500 dark:text-slate-400",bg:"bg-slate-50 dark:bg-slate-800"}}},M=H(e.status),O=M.icon,L=j=>{switch(j){case"high":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-950";case"medium":return"text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-950";case"low":return"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-950";default:return"text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-800"}},q=[{value:"pending",label:"Pending"},{value:"in-progress",label:"In Progress"},{value:"review",label:"Review"},{value:"done",label:"Done"},{value:"deferred",label:"Deferred"},{value:"cancelled",label:"Cancelled"}];return t.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[100] md:p-4 bg-black/50",children:t.jsxs("div",{className:Ce("bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 md:rounded-lg shadow-xl","w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",o),children:[t.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx(O,{className:Ce("w-6 h-6",M.color)}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsxs("button",{onClick:R,className:"flex items-center gap-1 px-2 py-1 text-xs bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Click to copy task ID",children:[t.jsxs("span",{children:["Task ",e.id]}),t.jsx(ec,{className:"w-3 h-3"})]}),e.parentId&&t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Subtask of Task ",e.parentId]})]}),l?t.jsx("input",{type:"text",value:d.title||"",onChange:j=>u({...d,title:j.target.value}),className:"w-full text-lg font-semibold bg-transparent border-b-2 border-blue-500 focus:outline-none text-gray-900 dark:text-white",placeholder:"Task title"}):t.jsx("h1",{className:"text-lg md:text-xl font-semibold text-gray-900 dark:text-white line-clamp-2",children:e.title})]})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:y,disabled:m,className:"p-2 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:m?"Saving...":"Save changes",children:t.jsx(ds,{className:Ce("w-5 h-5",m&&"animate-spin")})}),t.jsx("button",{onClick:()=>{c(!1),u(e)},disabled:m,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Cancel editing",children:t.jsx(ot,{className:"w-5 h-5"})})]}):t.jsx("button",{onClick:()=>c(!0),className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Edit task",children:t.jsx(yh,{className:"w-5 h-5"})}),t.jsx("button",{onClick:r,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Close",children:t.jsx(ot,{className:"w-5 h-5"})})]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6 space-y-6 min-h-0",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"}),t.jsx("div",{className:Ce("w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600",M.bg,M.color),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium capitalize",children:q.find(j=>j.value===e.status)?.label||e.status})]})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Priority"}),t.jsxs("div",{className:Ce("px-3 py-2 rounded-md text-sm font-medium capitalize",L(e.priority)),children:[t.jsx(rc,{className:"w-4 h-4 inline mr-2"}),e.priority||"Not set"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Dependencies"}),e.dependencies&&e.dependencies.length>0?t.jsx("div",{className:"flex flex-wrap gap-1",children:e.dependencies.map(j=>t.jsxs("button",{onClick:()=>a&&a({id:j}),className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded text-sm hover:bg-blue-200 dark:hover:bg-blue-800 transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50",disabled:!a,title:a?`Click to view Task ${j}`:`Task ${j}`,children:[t.jsx(Ya,{className:"w-3 h-3 inline mr-1"}),j]},j))}):t.jsx("span",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No dependencies"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description"}),l?t.jsx("textarea",{value:d.description||"",onChange:j=>u({...d,description:j.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Task description"}):t.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.description||"No description provided"})]}),e.details&&t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsxs("button",{onClick:()=>g(!p),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Implementation Details"}),p?t.jsx(Wt,{className:"w-4 h-4 text-gray-500"}):t.jsx(wr,{className:"w-4 h-4 text-gray-500"})]}),p&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:l?t.jsx("textarea",{value:d.details||"",onChange:j=>u({...d,details:j.target.value}),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Implementation details"}):t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-4",children:t.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.details})})})]}),e.testStrategy&&t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsxs("button",{onClick:()=>b(!x),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Test Strategy"}),x?t.jsx(Wt,{className:"w-4 h-4 text-gray-500"}):t.jsx(wr,{className:"w-4 h-4 text-gray-500"})]}),x&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:t.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 rounded-md p-4",children:t.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.testStrategy})})})]}),e.subtasks&&e.subtasks.length>0&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Subtasks (",e.subtasks.length,")"]}),t.jsx("div",{className:"space-y-2",children:e.subtasks.map(j=>{const T=H(j.status),I=T.icon;return t.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx(I,{className:Ce("w-4 h-4",T.color)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white truncate",children:j.title}),j.description&&t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:j.description})]}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:j.id})]},j.id)})})]})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Task ID: ",e.id]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Close"})})]})]})})},nl=({onShowAllTasks:e,onStartTask:r,className:n=""})=>{const{nextTask:s,tasks:a,currentProject:i,isLoadingTasks:o,projectTaskMaster:l,refreshTasks:c,refreshProjects:d}=_n(),[u,m]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(!1),[b,k]=f.useState(!1),[C,y]=f.useState(!1),[R,H]=f.useState(!1),[M,O]=f.useState(!1),L=()=>{x(!0),p(!1)},q=()=>{k(!0),p(!1)};if(!i||o)return null;let j;if((!a||a.length===0)&&!l?.hasTaskmaster)j=t.jsxs("div",{className:Ce("bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-3 mb-4",n),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(cs,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"TaskMaster AI is not configured"}),t.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5"})]})]}),t.jsx("div",{className:"flex items-center gap-1",children:t.jsxs("button",{onClick:()=>p(!h),className:"text-xs px-2 py-1 bg-blue-600 hover:bg-blue-700 text-white rounded transition-colors flex items-center gap-1",children:[t.jsx(Qr,{className:"w-3 h-3"}),"Initialize TaskMaster AI"]})})]}),h&&t.jsxs("div",{className:"mt-3 pt-3 border-t border-blue-200 dark:border-blue-800",children:[!l?.hasTaskmaster&&t.jsxs("div",{className:"mb-3 p-3 bg-blue-50 dark:bg-blue-900/50 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 What is TaskMaster?"}),t.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[t.jsxs("p",{children:["• ",t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),t.jsx("div",{className:"flex flex-col gap-2",children:l?.hasTaskmaster?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 p-2 bg-green-50 dark:bg-green-900/30 rounded text-xs text-green-800 dark:text-green-200",children:[t.jsx("strong",{children:"Add more tasks:"})," Create additional tasks manually or generate them from a PRD template"]}),t.jsxs("button",{className:"text-xs px-3 py-2 bg-green-100 dark:bg-green-900 hover:bg-green-200 dark:hover:bg-green-800 text-green-800 dark:text-green-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:L,disabled:M,children:[t.jsx(St,{className:"w-3 h-3"}),"Create a new task manually"]}),t.jsxs("button",{className:"text-xs px-3 py-2 bg-purple-100 dark:bg-purple-900 hover:bg-purple-200 dark:hover:bg-purple-800 text-purple-800 dark:text-purple-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:q,disabled:M,children:[t.jsx(Tt,{className:"w-3 h-3"}),M?"Parsing...":"Generate tasks from PRD template"]})]}):t.jsxs("button",{className:"text-xs px-3 py-2 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-800 dark:text-slate-200 rounded transition-colors text-left flex items-center gap-2",onClick:()=>y(!0),children:[t.jsx(Xr,{className:"w-3 h-3"}),"Initialize TaskMaster"]})})]})]});else if(s)j=t.jsx("div",{className:Ce("bg-slate-50 dark:bg-slate-900/30 border border-slate-200 dark:border-slate-700 rounded-lg p-3 mb-4",n),children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("div",{className:"w-5 h-5 bg-blue-100 dark:bg-blue-900/50 rounded-full flex items-center justify-center flex-shrink-0",children:t.jsx(Ch,{className:"w-3 h-3 text-blue-600 dark:text-blue-400"})}),t.jsxs("span",{className:"text-xs text-slate-600 dark:text-slate-400 font-medium",children:["Task ",s.id]}),s.priority==="high"&&t.jsx("div",{className:"w-4 h-4 rounded bg-red-100 dark:bg-red-900/50 flex items-center justify-center",title:"High Priority",children:t.jsx(ya,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})}),s.priority==="medium"&&t.jsx("div",{className:"w-4 h-4 rounded bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center",title:"Medium Priority",children:t.jsx(rc,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})}),s.priority==="low"&&t.jsx("div",{className:"w-4 h-4 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center",title:"Low Priority",children:t.jsx(Vr,{className:"w-2.5 h-2.5 text-gray-400 dark:text-gray-500"})})]}),t.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 line-clamp-1",children:s.title})]}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsxs("button",{onClick:()=>r?.(),className:"text-xs px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-md font-medium transition-colors shadow-sm flex items-center gap-1",children:[t.jsx(ah,{className:"w-3 h-3"}),"Start Task"]}),t.jsx("button",{onClick:()=>H(!0),className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View task details",children:t.jsx(on,{className:"w-3 h-3"})}),e&&t.jsx("button",{onClick:e,className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View all tasks",children:t.jsx(cs,{className:"w-3 h-3"})})]})]})});else if(a&&a.length>0){const T=a.filter(_=>_.status==="done").length,I=a.length;j=t.jsx("div",{className:Ce("bg-purple-50 dark:bg-purple-950 border border-purple-200 dark:border-purple-800 rounded-lg p-3 mb-4",n),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Rn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:T===I?"All done! 🎉":"No pending tasks"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:[T,"/",I]}),t.jsx("button",{onClick:e,className:"text-xs px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white rounded transition-colors",children:"Review"})]})]})})}else j=null;return t.jsxs(t.Fragment,{children:[j,g&&t.jsx(pv,{currentProject:i,onClose:()=>x(!1),onTaskCreated:()=>{c(),x(!1)}}),b&&t.jsx(hv,{currentProject:i,onClose:()=>k(!1),onTemplateApplied:()=>{c(),k(!1)}}),C&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:t.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Xr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),t.jsx("button",{onClick:()=>y(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:t.jsx(ot,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"flex-1 p-4",children:t.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",children:t.jsx(bi,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0})})}),t.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster initialization will start automatically"}),t.jsx("button",{onClick:()=>y(!1),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Close"})]})})]})}),R&&s&&t.jsx(Id,{task:s,isOpen:R,onClose:()=>H(!1),onStatusChange:()=>c?.(),onTaskClick:null})]})},pv=({currentProject:e,onClose:r,onTaskCreated:n})=>{const[s,a]=f.useState({title:"",description:"",priority:"medium",useAI:!1,prompt:""}),[i,o]=f.useState(!1),l=async c=>{if(c.preventDefault(),!!e){o(!0);try{const d=s.useAI?{prompt:s.prompt,priority:s.priority}:{title:s.title,description:s.description,priority:s.priority},u=await Fe.taskmaster.addTask(e.name,d);if(u.ok)n();else{const m=await u.json();console.error("Failed to create task:",m),alert(`Failed to create task: ${m.message}`)}}catch(d){console.error("Error creating task:",d),alert("Error creating task. Please try again.")}finally{o(!1)}}};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create New Task"}),t.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:t.jsx(ot,{className:"w-4 h-4"})})]}),t.jsxs("form",{onSubmit:l,className:"space-y-4",children:[t.jsx("div",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[t.jsx("input",{type:"checkbox",checked:s.useAI,onChange:c=>a(d=>({...d,useAI:c.target.checked}))}),"Use AI to generate task details"]})}),s.useAI?t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Description (AI will generate details)"}),t.jsx("textarea",{value:s.prompt,onChange:c=>a(d=>({...d,prompt:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe what you want to accomplish...",required:!0})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Title"}),t.jsx("input",{type:"text",value:s.title,onChange:c=>a(d=>({...d,title:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Enter task title...",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Description"}),t.jsx("textarea",{value:s.description,onChange:c=>a(d=>({...d,description:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe the task...",required:!0})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Priority"}),t.jsxs("select",{value:s.priority,onChange:c=>a(d=>({...d,priority:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"medium",children:"Medium"}),t.jsx("option",{value:"high",children:"High"})]})]}),t.jsxs("div",{className:"flex gap-2 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:i,children:"Cancel"}),t.jsx("button",{type:"submit",className:"flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded disabled:opacity-50",disabled:i||s.useAI&&!s.prompt.trim()||!s.useAI&&(!s.title.trim()||!s.description.trim()),children:i?"Creating...":"Create Task"})]})]})]})})},hv=({currentProject:e,onClose:r,onTemplateApplied:n})=>{const[s,a]=f.useState([]),[i,o]=f.useState(null),[l,c]=f.useState({}),[d,u]=f.useState("prd.txt"),[m,h]=f.useState(!0),[p,g]=f.useState(!1),[x,b]=f.useState("select");useEffect(()=>{(async()=>{try{const R=await Fe.taskmaster.getTemplates();if(R.ok){const H=await R.json();a(H.templates)}}catch(R){console.error("Error loading templates:",R)}finally{h(!1)}})()},[]);const k=y=>{o(y);const R=y.content.match(/\[([^\]]+)\]/g)||[],H=[...new Set(R.map(O=>O.slice(1,-1)))],M={};H.forEach(O=>{M[O]=""}),c(M),b("customize")},C=async()=>{if(!(!i||!e)){g(!0);try{const y=await Fe.taskmaster.applyTemplate(e.name,{templateId:i.id,fileName:d,customizations:l});if(!y.ok){const H=await y.json();throw new Error(H.message||"Failed to apply template")}const R=await Fe.taskmaster.parsePRD(e.name,{fileName:d,numTasks:10});if(!R.ok){const H=await R.json();throw new Error(H.message||"Failed to generate tasks")}b("generate"),setTimeout(()=>{n()},2e3)}catch(y){console.error("Error applying template:",y),alert(`Error: ${y.message}`),g(!1)}}};return m?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading templates..."})]})})}):t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-2xl max-h-[80vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:x==="select"?"Select PRD Template":x==="customize"?"Customize Template":"Generating Tasks"}),t.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:t.jsx(ot,{className:"w-4 h-4"})})]}),x==="select"&&t.jsx("div",{className:"space-y-3",children:s.map(y=>t.jsx("div",{className:"p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer transition-colors",onClick:()=>k(y),children:t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white",children:y.name}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:y.description}),t.jsx("span",{className:"inline-block text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded mt-2",children:y.category})]}),t.jsx(Ya,{className:"w-4 h-4 text-gray-400 mt-1"})]})},y.id))}),x==="customize"&&i&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"File Name"}),t.jsx("input",{type:"text",value:d,onChange:y=>u(y.target.value),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"prd.txt"})]}),Object.keys(l).length>0&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Customize Template"}),t.jsx("div",{className:"space-y-3",children:Object.entries(l).map(([y,R])=>t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-gray-600 dark:text-gray-400 mb-1",children:y.replace(/([A-Z])/g," $1").replace(/^./,H=>H.toUpperCase())}),t.jsx("input",{type:"text",value:R,onChange:H=>c(M=>({...M,[y]:H.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:`Enter ${y.toLowerCase()}`})]},y))})]}),t.jsxs("div",{className:"flex gap-2 pt-4",children:[t.jsx("button",{onClick:()=>b("select"),className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",children:"Back"}),t.jsx("button",{onClick:C,className:"flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded disabled:opacity-50",disabled:p,children:p?"Applying...":"Apply & Generate Tasks"})]})]}),x==="generate"&&t.jsxs("div",{className:"text-center py-8",children:[t.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center mx-auto mb-4",children:t.jsx(Rn,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),t.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Template Applied Successfully!"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Your PRD has been created and tasks are being generated..."})]})]})})};function fv({status:e,onAbort:r,isLoading:n,provider:s="claude"}){const[a,i]=f.useState(0),[o,l]=f.useState(0),[c,d]=f.useState(0);if(f.useEffect(()=>{if(!n){i(0),d(0);return}const k=Date.now(),C=30+Math.random()*20,y=setInterval(()=>{const R=Math.floor((Date.now()-k)/1e3);i(R),d(Math.floor(R*C))},1e3);return()=>clearInterval(y)},[n]),f.useEffect(()=>{if(!n)return;const k=setInterval(()=>{l(C=>(C+1)%4)},500);return()=>clearInterval(k)},[n]),!n)return null;const u=["Thinking","Processing","Analyzing","Working","Computing","Reasoning"],m=Math.floor(a/3)%u.length,h=e?.text||u[m],p=e?.tokens||c,g=e?.can_interrupt!==!1,b=["✻","✹","✸","✶"][o];return t.jsx("div",{className:"w-full mb-6 animate-in slide-in-from-bottom duration-300",children:t.jsxs("div",{className:"flex items-center justify-between max-w-4xl mx-auto bg-gray-900 dark:bg-gray-950 text-white rounded-lg shadow-lg px-4 py-3",children:[t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:Ce("text-xl transition-all duration-500",o%2===0?"text-blue-400 scale-110":"text-blue-300"),children:b}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"font-medium text-sm",children:[h,"..."]}),t.jsxs("span",{className:"text-gray-400 text-sm",children:["(",a,"s)"]}),p>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-gray-400",children:"·"}),t.jsxs("span",{className:"text-gray-300 text-sm hidden sm:inline",children:["⚒ ",p.toLocaleString()," tokens"]}),t.jsxs("span",{className:"text-gray-300 text-sm sm:hidden",children:["⚒ ",p.toLocaleString()]})]}),t.jsx("span",{className:"text-gray-400 hidden sm:inline",children:"·"}),t.jsx("span",{className:"text-gray-300 text-sm hidden sm:inline",children:"esc to interrupt"})]}),t.jsx("div",{className:"text-xs text-gray-400 sm:hidden mt-1",children:"esc to interrupt"})]})]})}),g&&r&&t.jsxs("button",{onClick:r,className:"ml-3 text-xs bg-red-600 hover:bg-red-700 text-white px-2.5 py-1 sm:px-3 sm:py-1.5 rounded-md transition-colors flex items-center gap-1.5 flex-shrink-0",children:[t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),t.jsx("span",{className:"hidden sm:inline",children:"Stop"})]})]})})}function gv({used:e,total:r}){if(e==null||r==null||r<=0)return null;const n=Math.min(100,e/r*100),s=10,a=2*Math.PI*s,i=a-n/100*a,o=()=>n<50?"#3b82f6":n<75?"#f59e0b":"#ef4444";return t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"transform -rotate-90",children:[t.jsx("circle",{cx:"12",cy:"12",r:s,fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-gray-300 dark:text-gray-600"}),t.jsx("circle",{cx:"12",cy:"12",r:s,fill:"none",stroke:o(),strokeWidth:"2",strokeDasharray:a,strokeDashoffset:i,strokeLinecap:"round"})]}),t.jsxs("span",{title:`${e.toLocaleString()} / ${r.toLocaleString()} tokens`,children:[n.toFixed(1),"%"]})]})}async function xv(e,r){const n=new FormData,s=`recording_${Date.now()}.webm`,a=new File([e],s,{type:e.type});n.append("audio",a);const i=window.localStorage.getItem("whisperMode")||"default";n.append("mode",i);try{const o=await Fe.transcribe(n);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.error||`Transcription error: ${o.status} ${o.statusText}`)}return(await o.json()).text||""}catch(o){throw o.name==="TypeError"&&o.message.includes("fetch")?new Error("Cannot connect to server. Please ensure the backend is running."):o}}function Ad({onTranscript:e,className:r=""}){const[n,s]=f.useState("idle"),[a,i]=f.useState(null),[o,l]=f.useState(!0),c=f.useRef(null),d=f.useRef(null),u=f.useRef([]),m=f.useRef(0);f.useEffect(()=>{(()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){l(!1),i("Microphone not supported. Please use HTTPS or a modern browser.");return}if(location.protocol!=="https:"&&location.hostname!=="localhost"){l(!1),i("Microphone requires HTTPS. Please use a secure connection.");return}l(!0),i(null)})()},[]);const h=async()=>{try{if(console.log("Starting recording..."),i(null),u.current=[],!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Microphone access not available. Please use HTTPS or a supported browser.");const y=await navigator.mediaDevices.getUserMedia({audio:!0});d.current=y;const R=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",H=new MediaRecorder(y,{mimeType:R});c.current=H,H.ondataavailable=M=>{M.data.size>0&&u.current.push(M.data)},H.onstop=async()=>{console.log("Recording stopped, creating blob...");const M=new Blob(u.current,{type:R});d.current&&(d.current.getTracks().forEach(j=>j.stop()),d.current=null),s("transcribing");const O=window.localStorage.getItem("whisperMode")||"default",L=O==="prompt"||O==="vibe"||O==="instructions"||O==="architect";let q;L&&(q=setTimeout(()=>{s("processing")},2e3));try{const j=await xv(M);j&&e&&e(j)}catch(j){console.error("Transcription error:",j),i(j.message)}finally{q&&clearTimeout(q),s("idle")}},H.start(),s("recording"),console.log("Recording started successfully")}catch(y){console.error("Failed to start recording:",y);let R="Microphone access failed";y.name==="NotAllowedError"?R="Microphone access denied. Please allow microphone permissions.":y.name==="NotFoundError"?R="No microphone found. Please check your audio devices.":y.name==="NotSupportedError"?R="Microphone not supported by this browser.":y.name==="NotReadableError"?R="Microphone is being used by another application.":y.message.includes("HTTPS")&&(R=y.message),i(R),s("idle")}},p=()=>{console.log("Stopping recording..."),c.current&&c.current.state==="recording"?c.current.stop():(console.log("Recorder not in recording state, forcing cleanup"),d.current&&(d.current.getTracks().forEach(y=>y.stop()),d.current=null),s("idle"))},g=y=>{if(y&&(y.preventDefault(),y.stopPropagation()),!o)return;const R=Date.now();if(R-m.current<300){console.log("Ignoring rapid tap");return}m.current=R,console.log("Button clicked, current state:",n),n==="idle"?h():n==="recording"&&p()};f.useEffect(()=>()=>{d.current&&d.current.getTracks().forEach(y=>y.stop())},[]);const x=()=>{if(!o)return{icon:t.jsx(as,{className:"w-5 h-5"}),className:"bg-gray-400 cursor-not-allowed",disabled:!0};switch(n){case"recording":return{icon:t.jsx(as,{className:"w-5 h-5 text-white"}),className:"bg-red-500 hover:bg-red-600 animate-pulse",disabled:!1};case"transcribing":return{icon:t.jsx(qp,{className:"w-5 h-5 animate-spin"}),className:"bg-blue-500 hover:bg-blue-600",disabled:!0};case"processing":return{icon:t.jsx(Zl,{className:"w-5 h-5 animate-pulse"}),className:"bg-purple-500 hover:bg-purple-600",disabled:!0};default:return{icon:t.jsx(as,{className:"w-5 h-5"}),className:"bg-gray-700 hover:bg-gray-600",disabled:!1}}},{icon:b,className:k,disabled:C}=x();return t.jsxs("div",{className:"relative",children:[t.jsx("button",{type:"button",style:{backgroundColor:n==="recording"?"#ef4444":n==="transcribing"?"#3b82f6":n==="processing"?"#a855f7":"#374151"},className:`
429
- flex items-center justify-center
430
- w-12 h-12 rounded-full
431
- text-white transition-all duration-200
432
- focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
433
- dark:ring-offset-gray-800
434
- touch-action-manipulation
435
- ${C?"cursor-not-allowed opacity-75":"cursor-pointer"}
436
- ${n==="recording"?"animate-pulse":""}
437
- hover:opacity-90
438
- ${r}
439
- `,onClick:g,disabled:C,children:b}),a&&t.jsx("div",{className:`absolute top-full mt-2 left-1/2 transform -translate-x-1/2
440
- bg-red-500 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10
441
- animate-fade-in`,children:a}),n==="recording"&&t.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-red-500 animate-ping pointer-events-none"}),n==="processing"&&t.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-purple-500 animate-ping pointer-events-none"})]})}function dr(e){return Array.isArray?Array.isArray(e):Dd(e)==="[object Array]"}function bv(e){if(typeof e=="string")return e;let r=e+"";return r=="0"&&1/e==-1/0?"-0":r}function yv(e){return e==null?"":bv(e)}function rr(e){return typeof e=="string"}function Md(e){return typeof e=="number"}function kv(e){return e===!0||e===!1||vv(e)&&Dd(e)=="[object Boolean]"}function Td(e){return typeof e=="object"}function vv(e){return Td(e)&&e!==null}function Ft(e){return e!=null}function ca(e){return!e.trim().length}function Dd(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const wv="Incorrect 'index' type",jv=e=>`Invalid value for key ${e}`,Nv=e=>`Pattern length exceeds max of ${e}.`,Cv=e=>`Missing ${e} property in key`,Sv=e=>`Property 'weight' in key '${e}' must be a positive integer`,sl=Object.prototype.hasOwnProperty;class Ev{constructor(r){this._keys=[],this._keyMap={};let n=0;r.forEach(s=>{let a=Pd(s);this._keys.push(a),this._keyMap[a.id]=a,n+=a.weight}),this._keys.forEach(s=>{s.weight/=n})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Pd(e){let r=null,n=null,s=null,a=1,i=null;if(rr(e)||dr(e))s=e,r=al(e),n=_a(e);else{if(!sl.call(e,"name"))throw new Error(Cv("name"));const o=e.name;if(s=o,sl.call(e,"weight")&&(a=e.weight,a<=0))throw new Error(Sv(o));r=al(o),n=_a(o),i=e.getFn}return{path:r,id:n,weight:a,src:s,getFn:i}}function al(e){return dr(e)?e:e.split(".")}function _a(e){return dr(e)?e.join("."):e}function Iv(e,r){let n=[],s=!1;const a=(i,o,l)=>{if(Ft(i))if(!o[l])n.push(i);else{let c=o[l];const d=i[c];if(!Ft(d))return;if(l===o.length-1&&(rr(d)||Md(d)||kv(d)))n.push(yv(d));else if(dr(d)){s=!0;for(let u=0,m=d.length;u<m;u+=1)a(d[u],o,l+1)}else o.length&&a(d,o,l+1)}};return a(e,rr(r)?r.split("."):r,0),s?n:n[0]}const Av={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Mv={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,r)=>e.score===r.score?e.idx<r.idx?-1:1:e.score<r.score?-1:1},Tv={location:0,threshold:.6,distance:100},Dv={useExtendedSearch:!1,getFn:Iv,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Re={...Mv,...Av,...Tv,...Dv};const Pv=/[^ ]+/g;function Lv(e=1,r=3){const n=new Map,s=Math.pow(10,r);return{get(a){const i=a.match(Pv).length;if(n.has(i))return n.get(i);const o=1/Math.pow(i,.5*e),l=parseFloat(Math.round(o*s)/s);return n.set(i,l),l},clear(){n.clear()}}}class yi{constructor({getFn:r=Re.getFn,fieldNormWeight:n=Re.fieldNormWeight}={}){this.norm=Lv(n,3),this.getFn=r,this.isCreated=!1,this.setIndexRecords()}setSources(r=[]){this.docs=r}setIndexRecords(r=[]){this.records=r}setKeys(r=[]){this.keys=r,this._keysMap={},r.forEach((n,s)=>{this._keysMap[n.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,rr(this.docs[0])?this.docs.forEach((r,n)=>{this._addString(r,n)}):this.docs.forEach((r,n)=>{this._addObject(r,n)}),this.norm.clear())}add(r){const n=this.size();rr(r)?this._addString(r,n):this._addObject(r,n)}removeAt(r){this.records.splice(r,1);for(let n=r,s=this.size();n<s;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(r,n){return r[this._keysMap[n]]}size(){return this.records.length}_addString(r,n){if(!Ft(r)||ca(r))return;let s={v:r,i:n,n:this.norm.get(r)};this.records.push(s)}_addObject(r,n){let s={i:n,$:{}};this.keys.forEach((a,i)=>{let o=a.getFn?a.getFn(r):this.getFn(r,a.path);if(Ft(o)){if(dr(o)){let l=[];const c=[{nestedArrIndex:-1,value:o}];for(;c.length;){const{nestedArrIndex:d,value:u}=c.pop();if(Ft(u))if(rr(u)&&!ca(u)){let m={v:u,i:d,n:this.norm.get(u)};l.push(m)}else dr(u)&&u.forEach((m,h)=>{c.push({nestedArrIndex:h,value:m})})}s.$[i]=l}else if(rr(o)&&!ca(o)){let l={v:o,n:this.norm.get(o)};s.$[i]=l}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function Ld(e,r,{getFn:n=Re.getFn,fieldNormWeight:s=Re.fieldNormWeight}={}){const a=new yi({getFn:n,fieldNormWeight:s});return a.setKeys(e.map(Pd)),a.setSources(r),a.create(),a}function Rv(e,{getFn:r=Re.getFn,fieldNormWeight:n=Re.fieldNormWeight}={}){const{keys:s,records:a}=e,i=new yi({getFn:r,fieldNormWeight:n});return i.setKeys(s),i.setIndexRecords(a),i}function ns(e,{errors:r=0,currentLocation:n=0,expectedLocation:s=0,distance:a=Re.distance,ignoreLocation:i=Re.ignoreLocation}={}){const o=r/e.length;if(i)return o;const l=Math.abs(s-n);return a?o+l/a:l?1:o}function _v(e=[],r=Re.minMatchCharLength){let n=[],s=-1,a=-1,i=0;for(let o=e.length;i<o;i+=1){let l=e[i];l&&s===-1?s=i:!l&&s!==-1&&(a=i-1,a-s+1>=r&&n.push([s,a]),s=-1)}return e[i-1]&&i-s>=r&&n.push([s,i-1]),n}const Mr=32;function zv(e,r,n,{location:s=Re.location,distance:a=Re.distance,threshold:i=Re.threshold,findAllMatches:o=Re.findAllMatches,minMatchCharLength:l=Re.minMatchCharLength,includeMatches:c=Re.includeMatches,ignoreLocation:d=Re.ignoreLocation}={}){if(r.length>Mr)throw new Error(Nv(Mr));const u=r.length,m=e.length,h=Math.max(0,Math.min(s,m));let p=i,g=h;const x=l>1||c,b=x?Array(m):[];let k;for(;(k=e.indexOf(r,g))>-1;){let O=ns(r,{currentLocation:k,expectedLocation:h,distance:a,ignoreLocation:d});if(p=Math.min(O,p),g=k+u,x){let L=0;for(;L<u;)b[k+L]=1,L+=1}}g=-1;let C=[],y=1,R=u+m;const H=1<<u-1;for(let O=0;O<u;O+=1){let L=0,q=R;for(;L<q;)ns(r,{errors:O,currentLocation:h+q,expectedLocation:h,distance:a,ignoreLocation:d})<=p?L=q:R=q,q=Math.floor((R-L)/2+L);R=q;let j=Math.max(1,h-q+1),T=o?m:Math.min(h+q,m)+u,I=Array(T+2);I[T+1]=(1<<O)-1;for(let w=T;w>=j;w-=1){let W=w-1,F=n[e.charAt(W)];if(x&&(b[W]=+!!F),I[w]=(I[w+1]<<1|1)&F,O&&(I[w]|=(C[w+1]|C[w])<<1|1|C[w+1]),I[w]&H&&(y=ns(r,{errors:O,currentLocation:W,expectedLocation:h,distance:a,ignoreLocation:d}),y<=p)){if(p=y,g=W,g<=h)break;j=Math.max(1,2*h-g)}}if(ns(r,{errors:O+1,currentLocation:h,expectedLocation:h,distance:a,ignoreLocation:d})>p)break;C=I}const M={isMatch:g>=0,score:Math.max(.001,y)};if(x){const O=_v(b,l);O.length?c&&(M.indices=O):M.isMatch=!1}return M}function Fv(e){let r={};for(let n=0,s=e.length;n<s;n+=1){const a=e.charAt(n);r[a]=(r[a]||0)|1<<s-n-1}return r}const bs=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class Rd{constructor(r,{location:n=Re.location,threshold:s=Re.threshold,distance:a=Re.distance,includeMatches:i=Re.includeMatches,findAllMatches:o=Re.findAllMatches,minMatchCharLength:l=Re.minMatchCharLength,isCaseSensitive:c=Re.isCaseSensitive,ignoreDiacritics:d=Re.ignoreDiacritics,ignoreLocation:u=Re.ignoreLocation}={}){if(this.options={location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u},r=c?r:r.toLowerCase(),r=d?bs(r):r,this.pattern=r,this.chunks=[],!this.pattern.length)return;const m=(p,g)=>{this.chunks.push({pattern:p,alphabet:Fv(p),startIndex:g})},h=this.pattern.length;if(h>Mr){let p=0;const g=h%Mr,x=h-g;for(;p<x;)m(this.pattern.substr(p,Mr),p),p+=Mr;if(g){const b=h-Mr;m(this.pattern.substr(b),b)}}else m(this.pattern,0)}searchIn(r){const{isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a}=this.options;if(r=n?r:r.toLowerCase(),r=s?bs(r):r,this.pattern===r){let x={isMatch:!0,score:0};return a&&(x.indices=[[0,r.length-1]]),x}const{location:i,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let m=[],h=0,p=!1;this.chunks.forEach(({pattern:x,alphabet:b,startIndex:k})=>{const{isMatch:C,score:y,indices:R}=zv(r,x,b,{location:i+k,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,includeMatches:a,ignoreLocation:u});C&&(p=!0),h+=y,C&&R&&(m=[...m,...R])});let g={isMatch:p,score:p?h/this.chunks.length:1};return p&&a&&(g.indices=m),g}}class Nr{constructor(r){this.pattern=r}static isMultiMatch(r){return il(r,this.multiRegex)}static isSingleMatch(r){return il(r,this.singleRegex)}search(){}}function il(e,r){const n=e.match(r);return n?n[1]:null}class $v extends Nr{constructor(r){super(r)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(r){const n=r===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Ov extends Nr{constructor(r){super(r)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(r){const s=r.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}}class Bv extends Nr{constructor(r){super(r)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(r){const n=r.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Uv extends Nr{constructor(r){super(r)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(r){const n=!r.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,r.length-1]}}}class Wv extends Nr{constructor(r){super(r)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(r){const n=r.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[r.length-this.pattern.length,r.length-1]}}}class Hv extends Nr{constructor(r){super(r)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(r){const n=!r.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,r.length-1]}}}class _d extends Nr{constructor(r,{location:n=Re.location,threshold:s=Re.threshold,distance:a=Re.distance,includeMatches:i=Re.includeMatches,findAllMatches:o=Re.findAllMatches,minMatchCharLength:l=Re.minMatchCharLength,isCaseSensitive:c=Re.isCaseSensitive,ignoreDiacritics:d=Re.ignoreDiacritics,ignoreLocation:u=Re.ignoreLocation}={}){super(r),this._bitapSearch=new Rd(r,{location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(r){return this._bitapSearch.searchIn(r)}}class zd extends Nr{constructor(r){super(r)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(r){let n=0,s;const a=[],i=this.pattern.length;for(;(s=r.indexOf(this.pattern,n))>-1;)n=s+i,a.push([s,n-1]);const o=!!a.length;return{isMatch:o,score:o?0:1,indices:a}}}const za=[$v,zd,Bv,Uv,Hv,Wv,Ov,_d],ol=za.length,qv=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Vv="|";function Gv(e,r={}){return e.split(Vv).map(n=>{let s=n.trim().split(qv).filter(i=>i&&!!i.trim()),a=[];for(let i=0,o=s.length;i<o;i+=1){const l=s[i];let c=!1,d=-1;for(;!c&&++d<ol;){const u=za[d];let m=u.isMultiMatch(l);m&&(a.push(new u(m,r)),c=!0)}if(!c)for(d=-1;++d<ol;){const u=za[d];let m=u.isSingleMatch(l);if(m){a.push(new u(m,r));break}}}return a})}const Kv=new Set([_d.type,zd.type]);class Jv{constructor(r,{isCaseSensitive:n=Re.isCaseSensitive,ignoreDiacritics:s=Re.ignoreDiacritics,includeMatches:a=Re.includeMatches,minMatchCharLength:i=Re.minMatchCharLength,ignoreLocation:o=Re.ignoreLocation,findAllMatches:l=Re.findAllMatches,location:c=Re.location,threshold:d=Re.threshold,distance:u=Re.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a,minMatchCharLength:i,findAllMatches:l,ignoreLocation:o,location:c,threshold:d,distance:u},r=n?r:r.toLowerCase(),r=s?bs(r):r,this.pattern=r,this.query=Gv(this.pattern,this.options)}static condition(r,n){return n.useExtendedSearch}searchIn(r){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:a,ignoreDiacritics:i}=this.options;r=a?r:r.toLowerCase(),r=i?bs(r):r;let o=0,l=[],c=0;for(let d=0,u=n.length;d<u;d+=1){const m=n[d];l.length=0,o=0;for(let h=0,p=m.length;h<p;h+=1){const g=m[h],{isMatch:x,indices:b,score:k}=g.search(r);if(x){if(o+=1,c+=k,s){const C=g.constructor.type;Kv.has(C)?l=[...l,...b]:l.push(b)}}else{c=0,o=0,l.length=0;break}}if(o){let h={isMatch:!0,score:c/o};return s&&(h.indices=l),h}}return{isMatch:!1,score:1}}}const Fa=[];function Yv(...e){Fa.push(...e)}function $a(e,r){for(let n=0,s=Fa.length;n<s;n+=1){let a=Fa[n];if(a.condition(e,r))return new a(e,r)}return new Rd(e,r)}const ys={AND:"$and",OR:"$or"},Oa={PATH:"$path",PATTERN:"$val"},Ba=e=>!!(e[ys.AND]||e[ys.OR]),Qv=e=>!!e[Oa.PATH],Xv=e=>!dr(e)&&Td(e)&&!Ba(e),ll=e=>({[ys.AND]:Object.keys(e).map(r=>({[r]:e[r]}))});function Fd(e,r,{auto:n=!0}={}){const s=a=>{let i=Object.keys(a);const o=Qv(a);if(!o&&i.length>1&&!Ba(a))return s(ll(a));if(Xv(a)){const c=o?a[Oa.PATH]:i[0],d=o?a[Oa.PATTERN]:a[c];if(!rr(d))throw new Error(jv(c));const u={keyId:_a(c),pattern:d};return n&&(u.searcher=$a(d,r)),u}let l={children:[],operator:i[0]};return i.forEach(c=>{const d=a[c];dr(d)&&d.forEach(u=>{l.children.push(s(u))})}),l};return Ba(e)||(e=ll(e)),s(e)}function Zv(e,{ignoreFieldNorm:r=Re.ignoreFieldNorm}){e.forEach(n=>{let s=1;n.matches.forEach(({key:a,norm:i,score:o})=>{const l=a?a.weight:null;s*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(r?1:i))}),n.score=s})}function ew(e,r){const n=e.matches;r.matches=[],Ft(n)&&n.forEach(s=>{if(!Ft(s.indices)||!s.indices.length)return;const{indices:a,value:i}=s;let o={indices:a,value:i};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),r.matches.push(o)})}function tw(e,r){r.score=e.score}function rw(e,r,{includeMatches:n=Re.includeMatches,includeScore:s=Re.includeScore}={}){const a=[];return n&&a.push(ew),s&&a.push(tw),e.map(i=>{const{idx:o}=i,l={item:r[o],refIndex:o};return a.length&&a.forEach(c=>{c(i,l)}),l})}class dn{constructor(r,n={},s){this.options={...Re,...n},this.options.useExtendedSearch,this._keyStore=new Ev(this.options.keys),this.setCollection(r,s)}setCollection(r,n){if(this._docs=r,n&&!(n instanceof yi))throw new Error(wv);this._myIndex=n||Ld(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(r){Ft(r)&&(this._docs.push(r),this._myIndex.add(r))}remove(r=()=>!1){const n=[];for(let s=0,a=this._docs.length;s<a;s+=1){const i=this._docs[s];r(i,s)&&(this.removeAt(s),s-=1,a-=1,n.push(i))}return n}removeAt(r){this._docs.splice(r,1),this._myIndex.removeAt(r)}getIndex(){return this._myIndex}search(r,{limit:n=-1}={}){const{includeMatches:s,includeScore:a,shouldSort:i,sortFn:o,ignoreFieldNorm:l}=this.options;let c=rr(r)?rr(this._docs[0])?this._searchStringList(r):this._searchObjectList(r):this._searchLogical(r);return Zv(c,{ignoreFieldNorm:l}),i&&c.sort(o),Md(n)&&n>-1&&(c=c.slice(0,n)),rw(c,this._docs,{includeMatches:s,includeScore:a})}_searchStringList(r){const n=$a(r,this.options),{records:s}=this._myIndex,a=[];return s.forEach(({v:i,i:o,n:l})=>{if(!Ft(i))return;const{isMatch:c,score:d,indices:u}=n.searchIn(i);c&&a.push({item:i,idx:o,matches:[{score:d,value:i,norm:l,indices:u}]})}),a}_searchLogical(r){const n=Fd(r,this.options),s=(l,c,d)=>{if(!l.children){const{keyId:m,searcher:h}=l,p=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(c,m),searcher:h});return p&&p.length?[{idx:d,item:c,matches:p}]:[]}const u=[];for(let m=0,h=l.children.length;m<h;m+=1){const p=l.children[m],g=s(p,c,d);if(g.length)u.push(...g);else if(l.operator===ys.AND)return[]}return u},a=this._myIndex.records,i={},o=[];return a.forEach(({$:l,i:c})=>{if(Ft(l)){let d=s(n,l,c);d.length&&(i[c]||(i[c]={idx:c,item:l,matches:[]},o.push(i[c])),d.forEach(({matches:u})=>{i[c].matches.push(...u)}))}}),o}_searchObjectList(r){const n=$a(r,this.options),{keys:s,records:a}=this._myIndex,i=[];return a.forEach(({$:o,i:l})=>{if(!Ft(o))return;let c=[];s.forEach((d,u)=>{c.push(...this._findMatches({key:d,value:o[u],searcher:n}))}),c.length&&i.push({idx:l,item:o,matches:c})}),i}_findMatches({key:r,value:n,searcher:s}){if(!Ft(n))return[];let a=[];if(dr(n))n.forEach(({v:i,i:o,n:l})=>{if(!Ft(i))return;const{isMatch:c,score:d,indices:u}=s.searchIn(i);c&&a.push({score:d,key:r,value:i,idx:o,norm:l,indices:u})});else{const{v:i,n:o}=n,{isMatch:l,score:c,indices:d}=s.searchIn(i);l&&a.push({score:c,key:r,value:i,norm:o,indices:d})}return a}}dn.version="7.1.0";dn.createIndex=Ld;dn.parseIndex=Rv;dn.config=Re;dn.parseQuery=Fd;Yv(Jv);const nw=({commands:e=[],selectedIndex:r=-1,onSelect:n,onClose:s,position:a={top:0,left:0},isOpen:i=!1,frequentCommands:o=[]})=>{const l=f.useRef(null),c=f.useRef(null),u=(()=>{const C=window.innerWidth<640,y=window.innerHeight;return C?{position:"fixed",bottom:`${a.bottom||90}px`,left:"16px",right:"16px",width:"auto",maxWidth:"calc(100vw - 32px)",maxHeight:"min(50vh, 300px)"}:{position:"fixed",top:`${Math.max(16,Math.min(a.top,y-316))}px`,left:`${a.left}px`,width:"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",maxHeight:"300px"}})();if(f.useEffect(()=>{const C=y=>{l.current&&!l.current.contains(y.target)&&i&&s()};if(i)return document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[i,s]),f.useEffect(()=>{if(c.current&&l.current){const C=l.current.getBoundingClientRect(),y=c.current.getBoundingClientRect();y.bottom>C.bottom?c.current.scrollIntoView({block:"nearest",behavior:"smooth"}):y.top<C.top&&c.current.scrollIntoView({block:"nearest",behavior:"smooth"})}},[r]),!i)return null;if(e.length===0)return t.jsx("div",{ref:l,className:"command-menu command-menu-empty",style:{...u,maxHeight:"300px",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"20px",opacity:1,transform:"translateY(0)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out",textAlign:"center"},children:"No commands available"});const m=o.length>0,h=e.reduce((C,y)=>{const R=y.namespace||y.type||"other";return C[R]||(C[R]=[]),C[R].push(y),C},{});m&&(h.frequent=o);const g=(m?["frequent","builtin","project","user","other"]:["builtin","project","user","other"]).filter(C=>h[C]),x={frequent:"⭐ Frequently Used",builtin:"Built-in Commands",project:"Project Commands",user:"User Commands",other:"Other Commands"};let b=0;const k=[];return g.forEach(C=>{h[C].forEach(y=>{k.push({...y,globalIndex:b++,namespace:C})})}),t.jsxs("div",{ref:l,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...u,maxHeight:"300px",overflowY:"auto",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"8px",opacity:i?1:0,transform:i?"translateY(0)":"translateY(-10px)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out"},children:[g.map(C=>t.jsxs("div",{className:"command-group",children:[g.length>1&&t.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:"#6b7280",padding:"8px 12px 4px",letterSpacing:"0.05em"},children:x[C]||C}),h[C].map(y=>{const R=k.find(M=>M.name===y.name&&M.namespace===C),H=R&&R.globalIndex===r;return t.jsxs("div",{ref:H?c:null,role:"option","aria-selected":H,className:"command-item",onMouseEnter:()=>n&&n(y,R.globalIndex,!0),onClick:()=>n&&n(y,R.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:H?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:M=>M.preventDefault(),children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:y.description?"4px":0},children:[t.jsxs("span",{style:{fontSize:"16px",flexShrink:0},children:[C==="builtin"&&"⚡",C==="project"&&"📁",C==="user"&&"👤",C==="other"&&"📝"]}),t.jsx("span",{style:{fontWeight:600,fontSize:"14px",color:"#111827",fontFamily:"monospace"},children:y.name}),y.metadata?.type&&t.jsx("span",{className:"command-metadata-badge",style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",fontWeight:500},children:y.metadata.type})]}),y.description&&t.jsx("div",{style:{fontSize:"13px",color:"#6b7280",marginLeft:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:y.description})]}),H&&t.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"↵"})]},`${C}-${y.name}`)})]},C)),t.jsx("style",{children:`
442
- .command-menu {
443
- background-color: white;
444
- border: 1px solid #e5e7eb;
445
- }
446
- .command-menu-empty {
447
- color: #6b7280;
448
- }
449
-
450
- @media (prefers-color-scheme: dark) {
451
- .command-menu {
452
- background-color: #1f2937 !important;
453
- border: 1px solid #374151 !important;
454
- }
455
- .command-menu-empty {
456
- color: #9ca3af !important;
457
- }
458
- .command-item[aria-selected="true"] {
459
- background-color: #1e40af !important;
460
- }
461
- .command-item span:not(.command-metadata-badge) {
462
- color: #f3f4f6 !important;
463
- }
464
- .command-metadata-badge {
465
- background-color: #f3f4f6 !important;
466
- color: #6b7280 !important;
467
- }
468
- .command-item div {
469
- color: #d1d5db !important;
470
- }
471
- .command-group > div:first-child {
472
- color: #9ca3af !important;
473
- }
474
- }
475
- `})]})};function yr(e){return e&&e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function sw(e){if(!e||typeof e!="string")return e;try{return e.replace(/```\s*([^\n\r]+?)\s*```/g,"`$1`")}catch{return e}}const yn=({children:e,className:r})=>{const n=sw(String(e??""));return t.jsx("div",{className:r,children:t.jsx(Jx,{remarkPlugins:[lk],components:aw,children:n})})};function Ua(e){try{return typeof e!="string"?e:e.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(r,n)=>{let s=parseInt(n,10);if(!Number.isFinite(s))return r;s<1e12&&(s*=1e3);const a=new Date(s),i=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(a),o=-a.getTimezoneOffset(),l=o>=0?"+":"-",c=Math.abs(o),d=Math.floor(c/60),u=c%60,m=`GMT${l}${d}${u?":"+String(u).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,C=>C.toUpperCase()),x=g?`${m} (${g})`:m,b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],k=`${a.getDate()} ${b[a.getMonth()]} ${a.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${i} ${x}** - ${k}`})}catch{return e}}const At={setItem:(e,r)=>{try{if(e.startsWith("chat_messages_")&&typeof r=="string")try{const n=JSON.parse(r);if(Array.isArray(n)&&n.length>50){console.warn(`Truncating chat history for ${e} from ${n.length} to 50 messages`);const s=n.slice(-50);r=JSON.stringify(s)}}catch(n){console.warn("Could not parse chat messages for truncation:",n)}localStorage.setItem(e,r)}catch(n){if(n.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data");const s=Object.keys(localStorage),a=s.filter(o=>o.startsWith("chat_messages_")).sort();a.length>3&&a.slice(0,a.length-3).forEach(o=>{localStorage.removeItem(o),console.log(`Removed old chat data: ${o}`)}),s.filter(o=>o.startsWith("draft_input_")).forEach(o=>{localStorage.removeItem(o)});try{localStorage.setItem(e,r)}catch(o){if(console.error("Failed to save to localStorage even after cleanup:",o),e.startsWith("chat_messages_")&&typeof r=="string")try{const l=JSON.parse(r);if(Array.isArray(l)&&l.length>10){const c=l.slice(-10);localStorage.setItem(e,JSON.stringify(c)),console.warn("Saved only last 10 messages due to quota constraints")}}catch(l){console.error("Final save attempt failed:",l)}}}else console.error("localStorage error:",n)}},getItem:e=>{try{return localStorage.getItem(e)}catch(r){return console.error("localStorage getItem error:",r),null}},removeItem:e=>{try{localStorage.removeItem(e)}catch(r){console.error("localStorage removeItem error:",r)}}},aw={code:({node:e,inline:r,className:n,children:s,...a})=>{const[i,o]=cr.useState(!1),l=Array.isArray(s)?s.join(""):String(s??""),c=/[\r\n]/.test(l);if(r||e&&e.type==="inlineCode"||!c)return t.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${n||""}`,...a,children:s});const m=l,h=()=>{const p=()=>{o(!0),setTimeout(()=>o(!1),1500)};try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(m).then(p).catch(()=>{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select();try{document.execCommand("copy")}catch{}document.body.removeChild(g),p()});else{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select();try{document.execCommand("copy")}catch{}document.body.removeChild(g),p()}}catch{}};return t.jsxs("div",{className:"relative group my-2",children:[t.jsx("button",{type:"button",onClick:h,className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 focus:opacity-100 active:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",title:i?"Copied":"Copy code","aria-label":i?"Copied":"Copy code",children:i?t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Copied"]}):t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})}),t.jsx("pre",{className:"bg-gray-900 dark:bg-gray-900 border border-gray-700/40 rounded-lg p-3 overflow-x-auto",children:t.jsx("code",{className:`text-gray-100 dark:text-gray-100 text-sm font-mono ${n||""}`,...a,children:s})})]})},blockquote:({children:e})=>t.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),a:({href:e,children:r})=>t.jsx("a",{href:e,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:r}),p:({children:e})=>t.jsx("div",{className:"mb-2 last:mb-0",children:e}),table:({children:e})=>t.jsx("div",{className:"overflow-x-auto my-2",children:t.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>t.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:e}),td:({children:e})=>t.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:e})},iw=f.memo(({message:e,index:r,prevMessage:n,createDiff:s,onFileOpen:a,onShowSettings:i,autoExpandTools:o,showRawParameters:l,showThinking:c,selectedProject:d})=>{const u=n&&n.type===e.type&&(n.type==="assistant"||n.type==="user"||n.type==="tool"||n.type==="error"),m=cr.useRef(null),[h,p]=cr.useState(!1);return cr.useEffect(()=>{if(!o||!m.current||!e.isToolUse)return;const g=new IntersectionObserver(x=>{x.forEach(b=>{b.isIntersecting&&!h&&(p(!0),m.current.querySelectorAll("details").forEach(C=>{C.open=!0}))})},{threshold:.1});return g.observe(m.current),()=>{m.current&&g.unobserve(m.current)}},[o,h,e.isToolUse]),t.jsx("div",{ref:m,className:`chat-message ${e.type} ${u?"grouped":""} ${e.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:e.type==="user"?t.jsxs("div",{className:"flex items-end space-x-0 sm:space-x-3 w-full sm:w-auto sm:max-w-[85%] md:max-w-md lg:max-w-lg xl:max-w-xl",children:[t.jsxs("div",{className:"bg-blue-600 text-white rounded-2xl rounded-br-md px-3 sm:px-4 py-2 shadow-sm flex-1 sm:flex-initial",children:[t.jsx("div",{className:"text-sm whitespace-pre-wrap break-words",children:e.content}),e.images&&e.images.length>0&&t.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:e.images.map((g,x)=>t.jsx("img",{src:g.data,alt:g.name,className:"rounded-lg max-w-full h-auto cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(g.data,"_blank")},x))}),t.jsx("div",{className:"text-xs text-blue-100 mt-1 text-right",children:new Date(e.timestamp).toLocaleTimeString()})]}),!u&&t.jsx("div",{className:"hidden sm:flex w-8 h-8 bg-blue-600 rounded-full items-center justify-center text-white text-sm flex-shrink-0",children:"U"})]}):t.jsxs("div",{className:"w-full",children:[!u&&t.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.type==="error"?t.jsx("div",{className:"w-8 h-8 bg-red-600 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"!"}):e.type==="tool"?t.jsx("div",{className:"w-8 h-8 bg-gray-600 dark:bg-gray-700 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"🔧"}):t.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?t.jsx(lr,{className:"w-full h-full"}):t.jsx(tr,{className:"w-full h-full"})}),t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.type==="error"?"Error":e.type==="tool"?"Tool":(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":"Claude"})]}),t.jsxs("div",{className:"w-full",children:[e.isToolUse&&!["Read","TodoWrite","TodoRead"].includes(e.toolName)?["Grep","Glob"].includes(e.toolName)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"group relative bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-blue-400 dark:border-blue-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 flex-1 min-w-0",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),t.jsx("span",{className:"font-medium flex-shrink-0",children:e.toolName}),t.jsx("span",{className:"text-gray-400 dark:text-gray-500 flex-shrink-0",children:"•"}),e.toolInput&&(()=>{try{const x=JSON.parse(e.toolInput);return t.jsxs("span",{className:"font-mono truncate flex-1 min-w-0",children:[x.pattern&&t.jsxs("span",{children:["pattern: ",t.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:x.pattern})]}),x.path&&t.jsxs("span",{className:"ml-2",children:["in: ",x.path]})]})}catch{return null}})()]}),e.toolResult&&t.jsxs("a",{href:`#tool-result-${e.toolId}`,className:"flex-shrink-0 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors flex items-center gap-1",children:[t.jsx("span",{children:"results"}),t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]})})}):t.jsxs("div",{className:"group relative bg-gradient-to-br from-blue-50/50 to-indigo-50/50 dark:from-blue-950/20 dark:to-indigo-950/20 border border-blue-100/30 dark:border-blue-800/30 rounded-lg p-3 mb-2",children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/3 to-indigo-500/3 dark:from-blue-400/3 dark:to-indigo-400/3 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),t.jsxs("div",{className:"relative flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative w-8 h-8 bg-gradient-to-br from-blue-500 to-indigo-600 dark:from-blue-400 dark:to-indigo-500 rounded-lg flex items-center justify-center shadow-lg shadow-blue-500/20 dark:shadow-blue-400/20",children:[t.jsxs("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),t.jsx("div",{className:"absolute inset-0 rounded-lg bg-blue-500 dark:bg-blue-400 animate-pulse opacity-20"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.toolName}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:e.toolId})]})]}),i&&t.jsx("button",{onClick:x=>{x.stopPropagation(),i()},className:"p-2 rounded-lg hover:bg-white/60 dark:hover:bg-gray-800/60 transition-all duration-200 group/btn backdrop-blur-sm",title:"Tool Settings",children:t.jsxs("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-400 group-hover/btn:text-blue-600 dark:group-hover/btn:text-blue-400 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]}),e.toolInput&&e.toolName==="Edit"&&(()=>{try{const x=JSON.parse(e.toolInput);if(x.file_path&&x.old_string&&x.new_string)return t.jsxs("details",{className:"relative mt-3 group/details",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/details:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-lg leading-none",children:"📝"}),t.jsx("span",{children:"View edit diff for"})]}),t.jsx("button",{onClick:async b=>{if(b.preventDefault(),b.stopPropagation(),!!a)try{const k=await Fe.readFile(d?.name,x.file_path),C=await k.json();if(!k.ok||C.error){console.error("Failed to fetch file:",C.error),a(x.file_path);return}const y=C.content||"",R=y.replace(x.new_string,x.old_string);a(x.file_path,{old_string:R,new_string:y})}catch(k){console.error("Error preparing diff:",k),a(x.file_path)}},className:"px-2.5 py-1 rounded-md bg-white/60 dark:bg-gray-800/60 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 font-mono text-xs font-medium transition-all duration-200 shadow-sm",children:x.file_path.split("/").pop()})]}),t.jsxs("div",{className:"mt-3 pl-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gradient-to-r from-gray-50 to-gray-100/50 dark:from-gray-800/80 dark:to-gray-800/40 border-b border-gray-200/60 dark:border-gray-700/60 backdrop-blur-sm",children:[t.jsx("button",{onClick:async()=>{if(a)try{const b=await Fe.readFile(d?.name,x.file_path),k=await b.json();if(!b.ok||k.error){console.error("Failed to fetch file:",k.error),a(x.file_path);return}const C=k.content||"",y=C.replace(x.new_string,x.old_string);a(x.file_path,{old_string:y,new_string:C})}catch(b){console.error("Error preparing diff:",b),a(x.file_path)}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate cursor-pointer font-medium transition-colors",children:x.file_path}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium px-2 py-0.5 bg-gray-100 dark:bg-gray-700/50 rounded",children:"Diff"})]}),t.jsx("div",{className:"text-xs font-mono",children:s(x.old_string,x.new_string).map((b,k)=>t.jsxs("div",{className:"flex",children:[t.jsx("span",{className:`w-8 text-center border-r ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:b.type==="removed"?"-":"+"}),t.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:b.content})]},k))})]}),l&&t.jsxs("details",{className:"relative mt-3 pl-6 group/raw",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),t.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}return t.jsxs("details",{className:"relative mt-3 group/params",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/params:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),t.jsx("pre",{className:"mt-3 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})})(),e.toolInput&&e.toolName!=="Edit"&&(()=>{if(e.toolName==="Write")try{let x;if(typeof e.toolInput=="string"?x=JSON.parse(e.toolInput):x=e.toolInput,x.file_path&&x.content!==void 0)return t.jsxs("details",{className:"relative mt-3 group/details",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/details:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-lg leading-none",children:"📄"}),t.jsx("span",{children:"Creating new file:"})]}),t.jsx("button",{onClick:async b=>{if(b.preventDefault(),b.stopPropagation(),!!a)try{const k=await Fe.readFile(d?.name,x.file_path),C=await k.json(),y=k.ok&&!C.error?C.content||"":x.content||"";a(x.file_path,{old_string:"",new_string:y})}catch(k){console.error("Error preparing diff:",k),a(x.file_path,{old_string:"",new_string:x.content||""})}},className:"px-2.5 py-1 rounded-md bg-white/60 dark:bg-gray-800/60 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 font-mono text-xs font-medium transition-all duration-200 shadow-sm",children:x.file_path.split("/").pop()})]}),t.jsxs("div",{className:"mt-3 pl-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gradient-to-r from-gray-50 to-gray-100/50 dark:from-gray-800/80 dark:to-gray-800/40 border-b border-gray-200/60 dark:border-gray-700/60 backdrop-blur-sm",children:[t.jsx("button",{onClick:async()=>{if(a)try{const b=await Fe.readFile(d?.name,x.file_path),k=await b.json(),C=b.ok&&!k.error?k.content||"":x.content||"";a(x.file_path,{old_string:"",new_string:C})}catch(b){console.error("Error preparing diff:",b),a(x.file_path,{old_string:"",new_string:x.content||""})}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate cursor-pointer font-medium transition-colors",children:x.file_path}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium px-2 py-0.5 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded",children:"New File"})]}),t.jsx("div",{className:"text-xs font-mono",children:s("",x.content).map((b,k)=>t.jsxs("div",{className:"flex",children:[t.jsx("span",{className:`w-8 text-center border-r ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:b.type==="removed"?"-":"+"}),t.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:b.content})]},k))})]}),l&&t.jsxs("details",{className:"relative mt-3 pl-6 group/raw",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),t.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}if(e.toolName==="TodoWrite")try{const x=JSON.parse(e.toolInput);if(x.todos&&Array.isArray(x.todos))return t.jsxs("details",{className:"relative mt-3 group/todo",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/todo:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-lg leading-none",children:"✓"}),t.jsx("span",{children:"Updating Todo List"})]})]}),t.jsxs("div",{className:"mt-3",children:[t.jsx(la,{todos:x.todos}),l&&t.jsxs("details",{className:"relative mt-3 group/raw",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),t.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg overflow-x-auto text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}if(e.toolName==="Bash")try{const x=JSON.parse(e.toolInput);return t.jsxs("div",{className:"my-2",children:[t.jsxs("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-md px-3 py-2 font-mono text-sm",children:[t.jsx("span",{className:"text-green-400",children:"$"}),t.jsx("span",{className:"text-gray-100 ml-2",children:x.command})]}),x.description&&t.jsx("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 italic ml-1",children:x.description})]})}catch{}if(e.toolName==="Read")try{const x=JSON.parse(e.toolInput);if(x.file_path){const b=x.file_path.split("/").pop();return t.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-300",children:["Read"," ",t.jsx("button",{onClick:()=>a&&a(x.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:b})]})}}catch{}if(e.toolName==="exit_plan_mode")try{const x=JSON.parse(e.toolInput);if(x.plan){const b=x.plan.replace(/\\n/g,`
476
- `);return t.jsxs("details",{className:"mt-2",open:o,children:[t.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"📋 View implementation plan"]}),t.jsx(yn,{className:"mt-3 prose prose-sm max-w-none dark:prose-invert",children:b})]})}}catch{}return t.jsxs("details",{className:"relative mt-3 group/params",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/params:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),t.jsx("pre",{className:"mt-3 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})})(),e.toolResult&&(!e.toolResult.isError&&(e.toolName==="Edit"||e.toolName==="Write"||e.toolName==="ApplyPatch"||e.toolName==="Bash")?null:t.jsxs("div",{id:`tool-result-${e.toolId}`,className:`relative mt-4 p-4 rounded-lg border backdrop-blur-sm scroll-mt-4 ${e.toolResult.isError?"bg-gradient-to-br from-red-50 to-rose-50 dark:from-red-950/20 dark:to-rose-950/20 border-red-200/60 dark:border-red-800/60":"bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20 border-green-200/60 dark:border-green-800/60"}`,children:[t.jsx("div",{className:`absolute inset-0 rounded-lg opacity-50 ${e.toolResult.isError?"bg-gradient-to-br from-red-500/5 to-rose-500/5 dark:from-red-400/5 dark:to-rose-400/5":"bg-gradient-to-br from-green-500/5 to-emerald-500/5 dark:from-green-400/5 dark:to-emerald-400/5"}`}),t.jsxs("div",{className:"relative flex items-center gap-2.5 mb-3",children:[t.jsx("div",{className:`w-6 h-6 rounded-lg flex items-center justify-center shadow-md ${e.toolResult.isError?"bg-gradient-to-br from-red-500 to-rose-600 dark:from-red-400 dark:to-rose-500 shadow-red-500/20":"bg-gradient-to-br from-green-500 to-emerald-600 dark:from-green-400 dark:to-emerald-500 shadow-green-500/20"}`,children:t.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.toolResult.isError?t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"}):t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})}),t.jsx("span",{className:`text-sm font-semibold ${e.toolResult.isError?"text-red-800 dark:text-red-200":"text-green-800 dark:text-green-200"}`,children:e.toolResult.isError?"Tool Error":"Tool Result"})]}),t.jsx("div",{className:`relative text-sm ${e.toolResult.isError?"text-red-900 dark:text-red-100":"text-green-900 dark:text-green-100"}`,children:(()=>{const b=String(e.toolResult.content||"");if((e.toolName==="TodoWrite"||e.toolName==="TodoRead")&&(b.includes("Todos have been modified successfully")||b.includes("Todo list")||b.startsWith("[")&&b.includes('"content"')&&b.includes('"status"')))try{let y=null;if(b.startsWith("["))y=JSON.parse(b);else if(b.includes("Todos have been modified successfully"))return t.jsx("div",{children:t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("span",{className:"font-medium",children:"Todo list has been updated successfully"})})});if(y&&Array.isArray(y))return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-3",children:t.jsx("span",{className:"font-medium",children:"Current Todo List"})}),t.jsx(la,{todos:y,isResult:!0})]})}catch{}if(e.toolName==="exit_plan_mode")try{const y=JSON.parse(b);if(y.plan){const R=y.plan.replace(/\\n/g,`
477
- `);return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-3",children:t.jsx("span",{className:"font-medium",children:"Implementation Plan"})}),t.jsx(yn,{className:"prose prose-sm max-w-none dark:prose-invert",children:R})]})}}catch{}if((e.toolName==="Grep"||e.toolName==="Glob")&&e.toolResult?.toolUseResult){const y=e.toolResult.toolUseResult;if(y.filenames&&Array.isArray(y.filenames)&&y.filenames.length>0)return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-3",children:t.jsxs("span",{className:"font-medium",children:["Found ",y.numFiles||y.filenames.length," ",y.numFiles===1||y.filenames.length===1?"file":"files"]})}),t.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:y.filenames.map((R,H)=>{const M=R.split("/").pop(),O=R.substring(0,R.lastIndexOf("/"));return t.jsxs("div",{onClick:()=>{a&&a(R)},className:"group flex items-center gap-2 px-2 py-1.5 rounded hover:bg-green-100/50 dark:hover:bg-green-800/20 cursor-pointer transition-colors",children:[t.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-mono text-sm font-medium text-green-800 dark:text-green-200 truncate group-hover:text-green-900 dark:group-hover:text-green-100",children:M}),t.jsx("div",{className:"font-mono text-xs text-green-600/70 dark:text-green-400/70 truncate",children:O})]}),t.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},H)})})]})}if(b.includes("Do you want to proceed?")&&e.toolName==="Bash"){const y=b.split(`
478
- `),R=y.findIndex(T=>T.includes("Do you want to proceed?")),H=y.slice(0,R).join(`
479
- `),M=y.slice(R),O=M.find(T=>T.includes("Do you want to proceed?"))||"",L=[];M.forEach(T=>{const I=T.match(/^\s*(\d+)\.\s+(.+)$/);I&&L.push({number:I[1],text:I[2].trim()})});const q=b.match(/>\s*(\d+)/),j=q?q[1]:null;return t.jsxs("div",{className:"space-y-3",children:[H&&t.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words",children:H})}),t.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-2",children:"Interactive Prompt"}),t.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:O}),t.jsx("div",{className:"space-y-2 mb-4",children:L.map(T=>t.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${j===T.number?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700 hover:border-amber-400 dark:hover:border-amber-600 hover:shadow-sm"} ${j?"cursor-default":"cursor-not-allowed opacity-75"}`,disabled:!0,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${j===T.number?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:T.number}),t.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:T.text}),j===T.number&&t.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]})},T.number))}),j&&t.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[t.jsxs("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:["✓ Claude selected option ",j]}),t.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"In the CLI, you would select this option interactively using arrow keys or by typing the number."})]})]})]})})]})}const k=b.match(/The file (.+?) has been updated\./);if(k)return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("span",{className:"font-medium",children:"File updated successfully"})}),t.jsx("button",{onClick:async()=>{if(a)try{const R=await(await Pe(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(k[1])}`)).json();!R.error&&R.oldContent!==void 0&&R.currentContent!==void 0?a(k[1],{old_string:R.oldContent||"",new_string:R.currentContent||""}):a(k[1])}catch(y){console.error("Error fetching file diff:",y),a(k[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:k[1]})]});const C=b.match(/(?:The file|File) (.+?) has been (?:created|written)(?: successfully)?\.?/);return C?t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("span",{className:"font-medium",children:"File created successfully"})}),t.jsx("button",{onClick:async()=>{if(a)try{const R=await(await Pe(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(C[1])}`)).json();!R.error&&R.oldContent!==void 0&&R.currentContent!==void 0?a(C[1],{old_string:R.oldContent||"",new_string:R.currentContent||""}):a(C[1])}catch(y){console.error("Error fetching file diff:",y),a(C[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:C[1]})]}):e.toolName==="Write"&&!e.toolResult.isError?t.jsxs("div",{className:"text-green-700 dark:text-green-300",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),t.jsx("span",{className:"font-medium",children:"File written successfully"})]}),t.jsx("p",{className:"text-xs mt-1 text-green-600 dark:text-green-400",children:"The file content is displayed in the diff view above"})]}):b.includes("cat -n")&&b.includes("→")?t.jsxs("details",{open:o,children:[t.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View file content"]}),t.jsx("div",{className:"mt-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:t.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:b})})]}):b.length>300?t.jsxs("details",{open:o,children:[t.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View full output (",b.length," chars)"]}),t.jsx(yn,{className:"mt-2 prose prose-sm max-w-none prose-green dark:prose-invert",children:b})]}):t.jsx(yn,{className:"prose prose-sm max-w-none prose-green dark:prose-invert",children:b})})()})]}))]}):e.isInteractivePrompt?t.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"Interactive Prompt"}),(()=>{const g=e.content.split(`
480
- `).filter(k=>k.trim()),x=g.find(k=>k.includes("?"))||g[0]||"",b=[];return g.forEach(k=>{const C=k.match(/[❯\s]*(\d+)\.\s+(.+)/);if(C){const y=k.includes("❯");b.push({number:C[1],text:C[2].trim(),isSelected:y})}}),t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:x}),t.jsx("div",{className:"space-y-2 mb-4",children:b.map(k=>t.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${k.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${k.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:k.number}),t.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:k.text}),k.isSelected&&t.jsx("span",{className:"text-lg",children:"❯"})]})},k.number))}),t.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[t.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ Waiting for your response in the CLI"}),t.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"Please select an option in your terminal where Claude is running."})]})]})})()]})]})}):e.isToolUse&&e.toolName==="Read"?(()=>{try{const g=JSON.parse(e.toolInput);if(g.file_path){const x=g.file_path.split("/").pop();return t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),t.jsx("span",{className:"font-medium",children:"Read"}),t.jsx("button",{onClick:()=>a&&a(g.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:x})]})})}}catch{return t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),t.jsx("span",{className:"font-medium",children:"Read file"})]})})}})():e.isToolUse&&e.toolName==="TodoWrite"?(()=>{try{const g=JSON.parse(e.toolInput);if(g.todos&&Array.isArray(g.todos))return t.jsxs("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),t.jsx("span",{className:"font-medium",children:"Update todo list"})]}),t.jsx(la,{todos:g.todos})]})}catch{return t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),t.jsx("span",{className:"font-medium",children:"Update todo list"})]})})}})():e.isToolUse&&e.toolName==="TodoRead"?t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),t.jsx("span",{className:"font-medium",children:"Read todo list"})]})}):t.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[c&&e.reasoning&&t.jsxs("details",{className:"mb-3",children:[t.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 font-medium",children:"💭 Thinking..."}),t.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 italic text-gray-600 dark:text-gray-400 text-sm",children:t.jsx("div",{className:"whitespace-pre-wrap",children:e.reasoning})})]}),(()=>{const g=Ua(String(e.content||"")),x=g.trim();if((x.startsWith("{")||x.startsWith("["))&&(x.endsWith("}")||x.endsWith("]")))try{const b=JSON.parse(x),k=JSON.stringify(b,null,2);return t.jsxs("div",{className:"my-2",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),t.jsx("span",{className:"font-medium",children:"JSON Response"})]}),t.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:t.jsx("pre",{className:"p-4 overflow-x-auto",children:t.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:k})})})]})}catch{}return e.type==="assistant"?t.jsx(yn,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:g}):t.jsx("div",{className:"whitespace-pre-wrap",children:g})})()]}),t.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 ${u?"opacity-0 group-hover:opacity-100":""}`,children:new Date(e.timestamp).toLocaleTimeString()})]})]})})}),ow=({file:e,onRemove:r,uploadProgress:n,error:s})=>{const[a,i]=f.useState(null);return f.useEffect(()=>{const o=URL.createObjectURL(e);return i(o),()=>URL.revokeObjectURL(o)},[e]),t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:a,alt:e.name,className:"w-20 h-20 object-cover rounded"}),n!==void 0&&n<100&&t.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:t.jsxs("div",{className:"text-white text-xs",children:[n,"%"]})}),s&&t.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:t.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),t.jsx("button",{onClick:r,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function lw({selectedProject:e,selectedSession:r,ws:n,sendMessage:s,messages:a,onFileOpen:i,onInputFocusChange:o,onSessionActive:l,onSessionInactive:c,onSessionProcessing:d,onSessionNotProcessing:u,processingSessions:m,onReplaceTemporarySession:h,onNavigateToSession:p,onShowSettings:g,autoExpandTools:x,showRawParameters:b,showThinking:k,autoScrollToBottom:C,sendByCtrlEnter:y,externalMessageUpdate:R,onTaskClick:H,onShowAllTasks:M}){const{tasksEnabled:O}=zn(),[L,q]=f.useState(()=>typeof window<"u"&&e&&At.getItem(`draft_input_${e.name}`)||""),[j,T]=f.useState(()=>{if(typeof window<"u"&&e){const E=At.getItem(`chat_messages_${e.name}`);return E?JSON.parse(E):[]}return[]}),[I,_]=f.useState(!1),[w,W]=f.useState(r?.id||null),[F,$]=f.useState(!1),[K,ce]=f.useState([]),[S,Ae]=f.useState(!1),[$e,v]=f.useState(!1),[ae,me]=f.useState(0),[Ee,ie]=f.useState(!1),[qe,re]=f.useState(0),le=20,[fe,we]=f.useState(!1),[ve,Ye]=f.useState("default"),[Ue,at]=f.useState([]),[De,ye]=f.useState(new Map),[ke,Oe]=f.useState(new Map),st=f.useRef(null),Ie=f.useRef(null),Lt=f.useRef(null),te=f.useRef(null),de=f.useRef(!1),z=f.useRef(""),D=f.useRef(null),Y=f.useRef(null),[Z,se]=f.useState(""),[je,_e]=f.useState(!1),[Le,Ge]=f.useState([]),[et,We]=f.useState([]),[nt,ct]=f.useState(-1),[Rt,Ot]=f.useState(0),[Qt,vt]=f.useState(-1),[Vt,Ct]=f.useState(!1),[Gt,ft]=f.useState(!1),A=f.useRef({height:0,top:0}),[ne,P]=f.useState(!1),[U,B]=f.useState([]),[N,X]=f.useState([]),[pe,Ke]=f.useState(""),[ut,kt]=f.useState(!1),[gt,mt]=f.useState(null),[As,sr]=f.useState(-1),[Si,hr]=f.useState(-1),[un,ou]=f.useState(100),[lu,Or]=f.useState(null),[pt,Ms]=f.useState(()=>localStorage.getItem("selected-provider")||"claude"),[Br,Ei]=f.useState(()=>localStorage.getItem("cursor-model")||"gpt-5");f.useEffect(()=>{if(r?.id){const E=localStorage.getItem(`permissionMode-${r.id}`);Ye(E||"default")}},[r?.id]),f.useEffect(()=>{r&&r.__provider&&r.__provider!==pt&&(Ms(r.__provider),localStorage.setItem("selected-provider",r.__provider))},[r]),f.useEffect(()=>{pt==="cursor"&&fetch("/api/cursor/config",{headers:{Authorization:`Bearer ${localStorage.getItem("auth-token")}`}}).then(E=>E.json()).then(E=>{if(E.success&&E.config?.model?.modelId){const G={"gpt-5":"gpt-5","claude-4-sonnet":"sonnet-4","sonnet-4":"sonnet-4","claude-4-opus":"opus-4.1","opus-4.1":"opus-4.1"}[E.config.model.modelId]||E.config.model.modelId;localStorage.getItem("cursor-model")||Ei(G)}}).catch(E=>console.error("Error loading Cursor config:",E))},[pt]),f.useEffect(()=>{(async()=>{if(e)try{const J=await Pe("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!J.ok)throw new Error("Failed to fetch commands");const G=await J.json(),V=[...(G.builtIn||[]).map(Ne=>({...Ne,type:"built-in"})),...(G.custom||[]).map(Ne=>({...Ne,type:"custom"}))];B(V);const ee=`command_history_${e.name}`,be=At.getItem(ee);if(be)try{const Ne=JSON.parse(be),Qe=V.sort((Se,Q)=>{const he=Ne[Se.name]||0;return(Ne[Q.name]||0)-he});B(Qe)}catch(Ne){console.error("Error parsing command history:",Ne)}}catch(J){console.error("Error fetching slash commands:",J),B([])}})()},[e]);const Ts=f.useMemo(()=>U.length?new dn(U,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[U]);f.useEffect(()=>{if(!pe){X(U);return}if(!Ts){X([]);return}const E=Ts.search(pe);X(E.map(J=>J.item))},[pe,U,Ts]);const cu=f.useMemo(()=>{if(!e||U.length===0)return[];const E=`command_history_${e.name}`,J=At.getItem(E);if(!J)return[];try{const G=JSON.parse(J);return U.map(ee=>({...ee,usageCount:G[ee.name]||0})).filter(ee=>ee.usageCount>0).sort((ee,be)=>be.usageCount-ee.usageCount).slice(0,5)}catch(G){return console.error("Error parsing command history:",G),[]}},[e,U]),du=f.useCallback((E,J,G)=>{if(!E||!e)return;if(G){sr(J);return}const V=`command_history_${e.name}`,ee=At.getItem(V);let be={};try{be=ee?JSON.parse(ee):{}}catch(Ne){console.error("Error parsing command history:",Ne)}be[E.name]=(be[E.name]||0)+1,At.setItem(V,JSON.stringify(be)),Ii(E)},[e]),uu=f.useCallback(E=>{const{action:J,data:G}=E;switch(J){case"clear":T([]),ce([]);break;case"help":T(V=>[...V,{role:"assistant",content:G.content,timestamp:Date.now()}]);break;case"model":T(V=>[...V,{role:"assistant",content:`**Current Model**: ${G.current.model}
481
-
482
- **Available Models**:
483
-
484
- Claude: ${G.available.claude.join(", ")}
485
-
486
- Cursor: ${G.available.cursor.join(", ")}`,timestamp:Date.now()}]);break;case"cost":{const V=`**Token Usage**: ${G.tokenUsage.used.toLocaleString()} / ${G.tokenUsage.total.toLocaleString()} (${G.tokenUsage.percentage}%)
487
-
488
- **Estimated Cost**:
489
- - Input: $${G.cost.input}
490
- - Output: $${G.cost.output}
491
- - **Total**: $${G.cost.total}
492
-
493
- **Model**: ${G.model}`;T(ee=>[...ee,{role:"assistant",content:V,timestamp:Date.now()}]);break}case"status":{const V=`**System Status**
494
-
495
- - Version: ${G.version}
496
- - Uptime: ${G.uptime}
497
- - Model: ${G.model}
498
- - Provider: ${G.provider}
499
- - Node.js: ${G.nodeVersion}
500
- - Platform: ${G.platform}`;T(ee=>[...ee,{role:"assistant",content:V,timestamp:Date.now()}]);break}case"memory":G.error?T(V=>[...V,{role:"assistant",content:`⚠️ ${G.message}`,timestamp:Date.now()}]):(T(V=>[...V,{role:"assistant",content:`📝 ${G.message}
501
-
502
- Path: \`${G.path}\``,timestamp:Date.now()}]),G.exists&&i&&i(G.path));break;case"config":g&&g();break;case"rewind":G.error?T(V=>[...V,{role:"assistant",content:`⚠️ ${G.message}`,timestamp:Date.now()}]):(T(V=>V.slice(0,-G.steps*2)),T(V=>[...V,{role:"assistant",content:`⏪ ${G.message}`,timestamp:Date.now()}]));break;default:console.warn("Unknown built-in command action:",J)}},[i,g]),Ds=f.useRef(null),mu=f.useCallback(async(E,J)=>{const{content:G,hasBashCommands:V,hasFileIncludes:ee}=E;if(V&&!window.confirm("This command contains bash commands that will be executed. Do you want to proceed?")){T(Ne=>[...Ne,{role:"assistant",content:"❌ Command execution cancelled",timestamp:Date.now()}]);return}q(G),setTimeout(()=>{if(Ds.current){const be={preventDefault:()=>{}};Ds.current(be)}},50)},[]),Ii=f.useCallback(async E=>{if(!(!E||!e))try{const J=L.match(new RegExp(`${E.name}\\s*(.*)`)),G=J&&J[1]?J[1].trim().split(/\s+/):[],V={projectPath:e.path,projectName:e.name,sessionId:w,provider:pt,model:pt==="cursor"?Br:"claude-sonnet-4.5",tokenUsage:gt},ee=await Pe("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:E.name,commandPath:E.path,args:G,context:V})});if(!ee.ok)throw new Error("Failed to execute command");const be=await ee.json();be.type==="builtin"?uu(be):be.type==="custom"&&await mu(be,G),q(""),P(!1),hr(-1),Ke(""),sr(-1)}catch(J){console.error("Error executing command:",J),T(G=>[...G,{role:"assistant",content:`Error executing command: ${J.message}`,timestamp:Date.now()}])}},[L,e,w,pt,Br,gt]),pu=f.useMemo(()=>{const E=new Map;return(J,G)=>{const V=`${J.length}-${G.length}-${J.slice(0,50)}`;if(E.has(V))return E.get(V);const ee=hu(J,G);if(E.set(V,ee),E.size>100){const be=E.keys().next().value;E.delete(be)}return ee}},[]),mn=f.useCallback(async(E,J,G=!1)=>{if(!E||!J)return[];const V=!G;V?Ae(!0):v(!0);try{const ee=G?ae:0,be=await Fe.sessionMessages(E,J,le,ee);if(!be.ok)throw new Error("Failed to load session messages");const Ne=await be.json();if(Ne.hasMore!==void 0)return ie(Ne.hasMore),re(Ne.total),me(ee+(Ne.messages?.length||0)),Ne.messages||[];{const Qe=Ne.messages||[];return ie(!1),re(Qe.length),Qe}}catch(ee){return console.error("Error loading session messages:",ee),[]}finally{V?Ae(!1):v(!1)}},[ae]),Bn=f.useCallback(async(E,J)=>{if(!E||!J)return[];Ae(!0);try{const G=`/api/cursor/sessions/${encodeURIComponent(J)}?projectPath=${encodeURIComponent(E)}`,V=await Pe(G);if(!V.ok)return[];const be=(await V.json())?.session?.messages||[],Ne=[],Qe={};for(let Se=0;Se<be.length;Se++){const Q=be[Se],he=Q.content;let ze="",tt="assistant",Ze=null;try{if(he?.role&&he?.content){if(he.role==="system")continue;if(he.role==="tool"){if(Array.isArray(he.content)){for(const He of he.content)if(He?.type==="tool-result"){let Je=He.toolName||"Unknown Tool";Je==="ApplyPatch"&&(Je="Edit");const Bt=He.toolCallId||he.id,fr=He.result||"";Qe[Bt]?Qe[Bt].toolResult={content:fr,isError:!1}:Ne.push({type:"assistant",content:"",timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid,isToolUse:!0,toolName:Je,toolId:Bt,toolInput:null,toolResult:{content:fr,isError:!1}})}}continue}else if(tt=he.role==="user"?"user":"assistant",Array.isArray(he.content)){const He=[];for(const Je of he.content)if(Je?.type==="text"&&Je?.text)He.push(yr(Je.text));else if(Je?.type==="reasoning"&&Je?.text)Ze=yr(Je.text);else if(Je?.type==="tool-call"){(He.length>0||Ze)&&(Ne.push({type:tt,content:He.join(`
503
- `),reasoning:Ze,timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid}),He.length=0,Ze=null);let Bt=Je.toolName||"Unknown Tool";Bt==="ApplyPatch"&&(Bt="Edit");const fr=Je.toolCallId||`tool_${Se}`;let ir=Je.args;if(Bt==="Edit"&&Je.args)if(Je.args.patch){const Kt=Je.args.patch.split(`
504
- `);let pn=[],Rs=[],Li=!1;for(const gr of Kt)gr.startsWith("@@")?Li=!0:Li&&(gr.startsWith("-")?pn.push(gr.substring(1)):gr.startsWith("+")?Rs.push(gr.substring(1)):gr.startsWith(" ")&&(pn.push(gr.substring(1)),Rs.push(gr.substring(1))));const Hn=Je.args.file_path;ir={file_path:Hn&&!Hn.startsWith("/")?`${E}/${Hn}`:Hn,old_string:pn.join(`
505
- `)||Je.args.patch,new_string:Rs.join(`
506
- `)||Je.args.patch}}else ir=Je.args;else if(Bt==="Read"&&Je.args){const Kt=Je.args.path||Je.args.file_path;ir={file_path:Kt&&!Kt.startsWith("/")?`${E}/${Kt}`:Kt}}else if(Bt==="Write"&&Je.args){const Kt=Je.args.path||Je.args.file_path;ir={file_path:Kt&&!Kt.startsWith("/")?`${E}/${Kt}`:Kt,content:Je.args.contents||Je.args.content}}const Pi={type:"assistant",content:"",timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid,isToolUse:!0,toolName:Bt,toolId:fr,toolInput:ir?JSON.stringify(ir):null,toolResult:null};Ne.push(Pi),Qe[fr]=Pi}else if(Je?.type==="tool_use"){(He.length>0||Ze)&&(Ne.push({type:tt,content:He.join(`
507
- `),reasoning:Ze,timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid}),He.length=0,Ze=null);const Bt=Je.name||"Unknown Tool",fr=Je.id||`tool_${Se}`,ir={type:"assistant",content:"",timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid,isToolUse:!0,toolName:Bt,toolId:fr,toolInput:Je.input?JSON.stringify(Je.input):null,toolResult:null};Ne.push(ir),Qe[fr]=ir}else typeof Je=="string"&&He.push(Je);He.length>0?(ze=He.join(`
508
- `),Ze&&!ze&&(Ne.push({type:tt,content:"",reasoning:Ze,timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid}),ze="")):ze=""}else typeof he.content=="string"&&(ze=he.content)}else if(he?.message?.role&&he?.message?.content){if(he.message.role==="system")continue;tt=he.message.role==="user"?"user":"assistant",Array.isArray(he.message.content)?ze=he.message.content.map(He=>typeof He=="string"?He:He?.text||"").filter(Boolean).join(`
509
- `):typeof he.message.content=="string"&&(ze=he.message.content)}}catch(He){console.log("Error parsing blob content:",He)}if(ze&&ze.trim()){const He={type:tt,content:ze,timestamp:new Date(Date.now()+Se*1e3),blobId:Q.id,sequence:Q.sequence,rowid:Q.rowid};Ze&&(He.reasoning=Ze),Ne.push(He)}}return Ne.sort((Se,Q)=>Se.sequence!==void 0&&Q.sequence!==void 0?Se.sequence-Q.sequence:Se.rowid!==void 0&&Q.rowid!==void 0?Se.rowid-Q.rowid:new Date(Se.timestamp)-new Date(Q.timestamp)),Ne}catch(G){return console.error("Error loading Cursor session messages:",G),[]}finally{Ae(!1)}},[]),hu=(E,J)=>{const G=E.split(`
510
- `),V=J.split(`
511
- `),ee=[];let be=0,Ne=0;for(;be<G.length||Ne<V.length;){const Qe=G[be],Se=V[Ne];be>=G.length?(ee.push({type:"added",content:Se,lineNum:Ne+1}),Ne++):Ne>=V.length?(ee.push({type:"removed",content:Qe,lineNum:be+1}),be++):Qe===Se?(be++,Ne++):(ee.push({type:"removed",content:Qe,lineNum:be+1}),ee.push({type:"added",content:Se,lineNum:Ne+1}),be++,Ne++)}return ee},fu=E=>{const J=[],G=new Map;for(const V of E)if(V.message?.role==="user"&&Array.isArray(V.message?.content))for(const ee of V.message.content)ee.type==="tool_result"&&G.set(ee.tool_use_id,{content:ee.content,isError:ee.is_error,timestamp:new Date(V.timestamp||Date.now()),toolUseResult:V.toolUseResult||null});for(const V of E)if(V.message?.role==="user"&&V.message?.content){let ee="",be="user";if(Array.isArray(V.message.content)){const Qe=[];for(const Se of V.message.content)Se.type==="text"&&Qe.push(yr(Se.text));ee=Qe.join(`
512
- `)}else typeof V.message.content=="string"?ee=yr(V.message.content):ee=yr(String(V.message.content));!ee||ee.startsWith("<command-name>")||ee.startsWith("<command-message>")||ee.startsWith("<command-args>")||ee.startsWith("<local-command-stdout>")||ee.startsWith("<system-reminder>")||ee.startsWith("Caveat:")||ee.startsWith("This session is being continued from a previous")||ee.startsWith("[Request interrupted")||(ee=ee.replace(/\\n/g,`
513
- `).replace(/\\t/g," ").replace(/\\r/g,"\r"),J.push({type:be,content:ee,timestamp:V.timestamp||new Date().toISOString()}))}else if(V.message?.role==="assistant"&&V.message?.content){if(Array.isArray(V.message.content)){for(const ee of V.message.content)if(ee.type==="text"){let be=ee.text;typeof be=="string"&&(be=be.replace(/\\n/g,`
514
- `).replace(/\\t/g," ").replace(/\\r/g,"\r")),J.push({type:"assistant",content:be,timestamp:V.timestamp||new Date().toISOString()})}else if(ee.type==="tool_use"){const be=G.get(ee.id);J.push({type:"assistant",content:"",timestamp:V.timestamp||new Date().toISOString(),isToolUse:!0,toolName:ee.name,toolInput:JSON.stringify(ee.input),toolResult:be?{content:typeof be.content=="string"?be.content:JSON.stringify(be.content),isError:be.isError,toolUseResult:be.toolUseResult}:null,toolError:be?.isError||!1,toolResultTimestamp:be?.timestamp||new Date})}}else if(typeof V.message.content=="string"){let ee=V.message.content;ee=ee.replace(/\\n/g,`
515
- `).replace(/\\t/g," ").replace(/\\r/g,"\r"),J.push({type:"assistant",content:ee,timestamp:V.timestamp||new Date().toISOString()})}}return J},Ai=f.useMemo(()=>fu(K),[K]),ar=f.useCallback(()=>{te.current&&(te.current.scrollTop=te.current.scrollHeight,ft(!1))},[]),Un=f.useCallback(()=>{if(!te.current)return!1;const{scrollTop:E,scrollHeight:J,clientHeight:G}=te.current;return J-E-G<50},[]),Ps=f.useCallback(async()=>{if(te.current){const E=te.current,J=Un();ft(!J);const G=E.scrollTop<100,V=localStorage.getItem("selected-provider")||"claude";if(G&&Ee&&!$e&&r&&e&&V!=="cursor"){const ee=E.scrollHeight,be=E.scrollTop,Ne=await mn(e.name,r.id,!0);Ne.length>0&&(ce(Qe=>[...Ne,...Qe]),setTimeout(()=>{if(te.current){const Se=te.current.scrollHeight-ee;te.current.scrollTop=be+Se}},0))}}},[Un,Ee,$e,r,e,mn]);f.useEffect(()=>{(async()=>{if(r&&e){const J=localStorage.getItem("selected-provider")||"claude";if(de.current=!0,w!==null&&w!==r.id?(me(0),ie(!1),re(0),mt(null),_(!1),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:J})):w===null&&(me(0),ie(!1),re(0),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:J})),J==="cursor")if(W(r.id),sessionStorage.setItem("cursorSessionId",r.id),fe)we(!1);else{const V=e.fullPath||e.path,ee=await Bn(V,r.id);ce([]),T(ee)}else if(W(r.id),fe)we(!1);else{const V=await mn(e.name,r.id,!1);ce(V)}}else!fe&&!I&&(T([]),ce([])),W(null),sessionStorage.removeItem("cursorSessionId"),me(0),ie(!1),re(0);setTimeout(()=>{de.current=!1},250)})()},[r,e,Bn,ar,fe]),f.useEffect(()=>{R>0&&r&&e&&(async()=>{try{if((localStorage.getItem("selected-provider")||"claude")==="cursor"){const G=e.fullPath||e.path,V=await Bn(G,r.id);ce([]),T(V)}else{const G=await mn(e.name,r.id,!1);ce(G),Un&&C&&setTimeout(()=>ar(),200)}}catch(J){console.error("Error reloading messages from external update:",J)}})()},[R,r,e,Bn,mn,Un,C,ar]),f.useEffect(()=>{K.length>0&&T(Ai)},[Ai,K]),f.useEffect(()=>{o&&o(F)},[F,o]),f.useEffect(()=>{e&&L!==""?At.setItem(`draft_input_${e.name}`,L):e&&L===""&&At.removeItem(`draft_input_${e.name}`)},[L,e]),f.useEffect(()=>{e&&j.length>0&&At.setItem(`chat_messages_${e.name}`,JSON.stringify(j))},[j,e]),f.useEffect(()=>{if(e){const E=At.getItem(`draft_input_${e.name}`)||"";E!==L&&q(E)}},[e?.name]),f.useEffect(()=>{w&&I&&d&&d(w)},[I,w,d]),f.useEffect(()=>{w&&m&&m.has(w)&&!I&&(_(!0),Ct(!0))},[w,m]),f.useEffect(()=>{if(a.length>0){const E=a[a.length-1];if(!["projects_updated","taskmaster-project-updated","session-created","claude-complete"].includes(E.type)&&E.sessionId&&w&&E.sessionId!==w){console.log("⏭️ Skipping message for different session:",E.sessionId,"current:",w);return}switch(E.type){case"session-created":E.sessionId&&!w&&(sessionStorage.setItem("pendingSessionId",E.sessionId),h&&h(E.sessionId));break;case"token-budget":break;case"claude-response":const V=E.data.message||E.data;if(V&&typeof V=="object"&&V.type){if(V.type==="content_block_delta"&&V.delta?.text){const Q=yr(V.delta.text);z.current+=Q,D.current||(D.current=setTimeout(()=>{const he=z.current;z.current="",D.current=null,he&&T(ze=>{const tt=[...ze],Ze=tt[tt.length-1];return Ze&&Ze.type==="assistant"&&!Ze.isToolUse&&Ze.isStreaming?Ze.content=(Ze.content||"")+he:tt.push({type:"assistant",content:he,timestamp:new Date,isStreaming:!0}),tt})},100));return}if(V.type==="content_block_stop"){D.current&&(clearTimeout(D.current),D.current=null);const Q=z.current;z.current="",Q&&T(he=>{const ze=[...he],tt=ze[ze.length-1];return tt&&tt.type==="assistant"&&!tt.isToolUse&&tt.isStreaming?tt.content=(tt.content||"")+Q:ze.push({type:"assistant",content:Q,timestamp:new Date,isStreaming:!0}),ze}),T(he=>{const ze=[...he],tt=ze[ze.length-1];return tt&&tt.type==="assistant"&&tt.isStreaming&&(tt.isStreaming=!1),ze});return}}if(E.data.type==="system"&&E.data.subtype==="init"&&E.data.session_id&&w&&E.data.session_id!==w){console.log("🔄 Claude CLI session duplication detected:",{originalSession:w,newSession:E.data.session_id}),we(!0),p&&p(E.data.session_id);return}if(E.data.type==="system"&&E.data.subtype==="init"&&E.data.session_id&&!w){console.log("🔄 New session init detected:",{newSession:E.data.session_id}),we(!0),p&&p(E.data.session_id);return}if(E.data.type==="system"&&E.data.subtype==="init"&&E.data.session_id&&w&&E.data.session_id===w){console.log("🔄 System init message for current session, ignoring");return}if(Array.isArray(V.content)){for(const Q of V.content)if(Q.type==="tool_use"){const he=Q.input?JSON.stringify(Q.input,null,2):"";T(ze=>[...ze,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:Q.name,toolInput:he,toolId:Q.id,toolResult:null}])}else if(Q.type==="text"&&Q.text?.trim()){let he=yr(Q.text);he=Ua(he),T(ze=>[...ze,{type:"assistant",content:he,timestamp:new Date}])}}else if(typeof V.content=="string"&&V.content.trim()){let Q=yr(V.content);Q=Ua(Q),T(he=>[...he,{type:"assistant",content:Q,timestamp:new Date}])}if(V.role==="user"&&Array.isArray(V.content))for(const Q of V.content)Q.type==="tool_result"&&T(he=>he.map(ze=>ze.isToolUse&&ze.toolId===Q.tool_use_id?{...ze,toolResult:{content:Q.content,isError:Q.is_error,timestamp:new Date}}:ze));break;case"claude-output":{const Q=String(E.data||"");Q.trim()&&(z.current+=z.current?`
516
- ${Q}`:Q,D.current||(D.current=setTimeout(()=>{const he=z.current;z.current="",D.current=null,he&&T(ze=>{const tt=[...ze],Ze=tt[tt.length-1];return Ze&&Ze.type==="assistant"&&!Ze.isToolUse&&Ze.isStreaming?Ze.content=Ze.content?`${Ze.content}
517
- ${he}`:he:tt.push({type:"assistant",content:he,timestamp:new Date,isStreaming:!0}),tt})},100)))}break;case"claude-interactive-prompt":T(Q=>[...Q,{type:"assistant",content:E.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-error":T(Q=>[...Q,{type:"error",content:`Error: ${E.error}`,timestamp:new Date}]);break;case"cursor-system":try{const Q=E.data;if(Q&&Q.type==="system"&&Q.subtype==="init"&&Q.session_id){if(w&&Q.session_id!==w){console.log("🔄 Cursor session switch detected:",{originalSession:w,newSession:Q.session_id}),we(!0),p&&p(Q.session_id);return}if(!w){console.log("🔄 Cursor new session init detected:",{newSession:Q.session_id}),we(!0),p&&p(Q.session_id);return}}}catch(Q){console.warn("Error handling cursor-system message:",Q)}break;case"cursor-user":break;case"cursor-tool-use":T(Q=>[...Q,{type:"assistant",content:`Using tool: ${E.tool} ${E.input?`with ${E.input}`:""}`,timestamp:new Date,isToolUse:!0,toolName:E.tool,toolInput:E.input}]);break;case"cursor-error":T(Q=>[...Q,{type:"error",content:`Cursor error: ${E.error||"Unknown error"}`,timestamp:new Date}]);break;case"cursor-result":const ee=E.sessionId||w;if(ee===w&&(_(!1),Ct(!1),Or(null)),ee&&(c&&c(ee),u&&u(ee)),ee===w)try{const Q=E.data||{},he=typeof Q.result=="string"?Q.result:"";D.current&&(clearTimeout(D.current),D.current=null);const ze=z.current;z.current="",T(tt=>{const Ze=[...tt],He=Ze[Ze.length-1];if(He&&He.type==="assistant"&&!He.isToolUse&&He.isStreaming){const Je=he&&he.trim()?he:(He.content||"")+(ze||"");He.content=Je,He.isStreaming=!1}else he&&he.trim()&&Ze.push({type:Q.is_error?"error":"assistant",content:he,timestamp:new Date,isStreaming:!1});return Ze})}catch(Q){console.warn("Error handling cursor-result message:",Q)}const be=sessionStorage.getItem("pendingSessionId");ee&&!w&&ee===be&&(W(ee),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects(),500));break;case"cursor-output":try{const he=String(E.data??"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").trim();he&&(z.current+=z.current?`
518
- ${he}`:he,D.current||(D.current=setTimeout(()=>{const ze=z.current;z.current="",D.current=null,ze&&T(tt=>{const Ze=[...tt],He=Ze[Ze.length-1];return He&&He.type==="assistant"&&!He.isToolUse&&He.isStreaming?He.content=He.content?`${He.content}
519
- ${ze}`:ze:Ze.push({type:"assistant",content:ze,timestamp:new Date,isStreaming:!0}),Ze})},100)))}catch(Q){console.warn("Error handling cursor-output message:",Q)}break;case"claude-complete":const Ne=E.sessionId||w||sessionStorage.getItem("pendingSessionId");(Ne===w||!w)&&(_(!1),Ct(!1),Or(null),e&&r?.id&&(async()=>{try{const he=`/api/projects/${e.name}/sessions/${r.id}/token-usage`,ze=await Pe(he);if(ze.ok){const tt=await ze.json();mt(tt)}}catch(he){console.error("Failed to fetch updated token usage:",he)}})()),Ne&&(c&&c(Ne),u&&u(Ne));const Qe=sessionStorage.getItem("pendingSessionId");Qe&&!w&&E.exitCode===0&&(W(Qe),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",Qe)),e&&E.exitCode===0&&At.removeItem(`chat_messages_${e.name}`);break;case"session-aborted":{const Q=E.sessionId||w;Q===w&&(_(!1),Ct(!1),Or(null)),Q&&(c&&c(Q),u&&u(Q)),T(he=>[...he,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const Q=E.sessionId;(Q===w||r&&Q===r.id)&&E.isProcessing&&(_(!0),Ct(!0),d&&d(Q));break}case"claude-status":const Se=E.data;if(Se){let Q={text:"Working...",tokens:0,can_interrupt:!0};Se.message?Q.text=Se.message:Se.status?Q.text=Se.status:typeof Se=="string"&&(Q.text=Se),Se.tokens?Q.tokens=Se.tokens:Se.token_count&&(Q.tokens=Se.token_count),Se.can_interrupt!==void 0&&(Q.can_interrupt=Se.can_interrupt),Or(Q),_(!0),Ct(Q.can_interrupt)}break}}},[a]),f.useEffect(()=>{e&&gu()},[e]);const gu=async()=>{try{const E=await Fe.getFiles(e.name);if(E.ok){const J=await E.json(),G=Mi(J);Ge(G)}}catch(E){console.error("Error fetching files:",E)}},Mi=(E,J="")=>{let G=[];for(const V of E){const ee=J?`${J}/${V.name}`:V.name;V.type==="directory"&&V.children?G=G.concat(Mi(V.children,ee)):V.type==="file"&&G.push({name:V.name,path:ee,relativePath:V.path})}return G};f.useEffect(()=>{const E=L.slice(0,Rt),J=E.lastIndexOf("@");if(J!==-1){const G=E.slice(J+1);if(G.includes(" "))_e(!1),vt(-1);else{vt(J),_e(!0);const V=Le.filter(ee=>ee.name.toLowerCase().includes(G.toLowerCase())||ee.path.toLowerCase().includes(G.toLowerCase())).slice(0,10);We(V),ct(-1)}}else _e(!1),vt(-1)},[L,Rt,Le]),f.useEffect(()=>{const E=setTimeout(()=>{se(L)},150);return()=>clearTimeout(E)},[L]);const Ti=f.useMemo(()=>j.length<=un?j:j.slice(-un),[j,un]);f.useEffect(()=>{if(!C&&te.current){const E=te.current;A.current={height:E.scrollHeight,top:E.scrollTop}}}),f.useEffect(()=>{if(te.current&&j.length>0)if(C)Gt||setTimeout(()=>ar(),50);else{const E=te.current,J=A.current.height,G=A.current.top,ee=E.scrollHeight-J;ee>0&&G>0&&(E.scrollTop=G+ee)}},[j.length,Gt,ar,C]),f.useEffect(()=>{te.current&&j.length>0&&!de.current&&(ft(!1),setTimeout(()=>ar(),200))},[r?.id,e?.name]),f.useEffect(()=>{const E=te.current;if(E)return E.addEventListener("scroll",Ps),()=>E.removeEventListener("scroll",Ps)},[Ps]),f.useEffect(()=>{if(Ie.current){Ie.current.style.height="auto",Ie.current.style.height=Ie.current.scrollHeight+"px";const E=parseInt(window.getComputedStyle(Ie.current).lineHeight),J=Ie.current.scrollHeight>E*2;kt(J)}},[]),f.useEffect(()=>{Ie.current&&!L.trim()&&(Ie.current.style.height="auto",kt(!1))},[L]),f.useEffect(()=>{if(!e||!r?.id||r.id.startsWith("new-session-")){mt(null);return}(async()=>{try{const J=`/api/projects/${e.name}/sessions/${r.id}/token-usage`,G=await Pe(J);if(G.ok){const V=await G.json();mt(V)}else mt(null)}catch(J){console.error("Failed to fetch initial token usage:",J)}})()},[r?.id,e?.path]);const xu=f.useCallback(E=>{E.trim()&&q(J=>{const G=J.trim()?`${J} ${E}`:E;return setTimeout(()=>{if(Ie.current){Ie.current.style.height="auto",Ie.current.style.height=Ie.current.scrollHeight+"px";const V=parseInt(window.getComputedStyle(Ie.current).lineHeight),ee=Ie.current.scrollHeight>V*2;kt(ee)}},0),G})},[]),bu=f.useCallback(()=>{ou(E=>E+100)},[]),Wn=f.useCallback(E=>{const J=E.filter(G=>{try{if(!G||typeof G!="object")return console.warn("Invalid file object:",G),!1;if(!G.type||!G.type.startsWith("image/"))return!1;if(!G.size||G.size>5242880){const V=G.name||"Unknown file";return Oe(ee=>{const be=new Map(ee);return be.set(V,"File too large (max 5MB)"),be}),!1}return!0}catch(V){return console.error("Error validating file:",V,G),!1}});J.length>0&&at(G=>[...G,...J].slice(0,5))},[]),yu=f.useCallback(async E=>{const J=Array.from(E.clipboardData.items);for(const G of J)if(G.type.startsWith("image/")){const V=G.getAsFile();V&&Wn([V])}if(J.length===0&&E.clipboardData.files.length>0){const V=Array.from(E.clipboardData.files).filter(ee=>ee.type.startsWith("image/"));V.length>0&&Wn(V)}},[Wn]),{getRootProps:ku,getInputProps:vu,isDragActive:wu,open:ju}=Ed({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:Wn,noClick:!0,noKeyboard:!0}),Cr=f.useCallback(async E=>{if(E.preventDefault(),!L.trim()||I||!e)return;let J=[];if(Ue.length>0){const Qe=new FormData;Ue.forEach(Se=>{Qe.append("images",Se)});try{const Se=At.getItem("auth-token"),Q={};Se&&(Q.Authorization=`Bearer ${Se}`);const he=await fetch(`/api/projects/${e.name}/upload-images`,{method:"POST",headers:Q,body:Qe});if(!he.ok)throw new Error("Failed to upload images");J=(await he.json()).images}catch(Se){console.error("Image upload failed:",Se),T(Q=>[...Q,{type:"error",content:`Failed to upload images: ${Se.message}`,timestamp:new Date}]);return}}const G={type:"user",content:L,images:J,timestamp:new Date};T(Qe=>[...Qe,G]),_(!0),Ct(!0),Or({text:"Processing",tokens:0,can_interrupt:!0}),ft(!1),setTimeout(()=>ar(),100);const V=w||r?.id||sessionStorage.getItem("cursorSessionId"),ee=V||`new-session-${Date.now()}`;l&&l(ee);const Ne=(()=>{try{const Qe=pt==="cursor"?"cursor-tools-settings":"claude-settings",Se=At.getItem(Qe);if(Se)return JSON.parse(Se)}catch(Qe){console.error("Error loading tools settings:",Qe)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();s(pt==="cursor"?{type:"cursor-command",command:L,sessionId:V,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:V,resume:!!V,model:Br,skipPermissions:Ne?.skipPermissions||!1,toolsSettings:Ne}}:{type:"claude-command",command:L,options:{projectPath:e.path,cwd:e.fullPath,sessionId:w,resume:!!w,toolsSettings:Ne,permissionMode:ve,images:J}}),q(""),at([]),ye(new Map),Oe(new Map),kt(!1),Ie.current&&(Ie.current.style.height="auto"),e&&At.removeItem(`draft_input_${e.name}`)},[L,I,e,Ue,w,r,pt,ve,l,Br,s,q,at,ye,Oe,kt,Ie,T,_,Ct,Or,ft,ar]);f.useEffect(()=>{Ds.current=Cr},[Cr]);const Di=E=>{if(!E)return;const J=L.slice(0,Si),G=L.slice(Si),V=G.indexOf(" "),ee=V!==-1?G.slice(V):"",be=J+E.name+" "+ee;q(be),P(!1),hr(-1),Ke(""),sr(-1),Y.current&&clearTimeout(Y.current),Ii(E)},Nu=E=>{if(ne&&N.length>0){if(E.key==="ArrowDown"){E.preventDefault(),sr(J=>J<N.length-1?J+1:0);return}if(E.key==="ArrowUp"){E.preventDefault(),sr(J=>J>0?J-1:N.length-1);return}if(E.key==="Tab"||E.key==="Enter"){E.preventDefault(),As>=0?Di(N[As]):N.length>0&&Di(N[0]);return}if(E.key==="Escape"){E.preventDefault(),P(!1),hr(-1),Ke(""),sr(-1),Y.current&&clearTimeout(Y.current);return}}if(je&&et.length>0){if(E.key==="ArrowDown"){E.preventDefault(),ct(J=>J<et.length-1?J+1:0);return}if(E.key==="ArrowUp"){E.preventDefault(),ct(J=>J>0?J-1:et.length-1);return}if(E.key==="Tab"||E.key==="Enter"){E.preventDefault(),nt>=0?Ls(et[nt]):et.length>0&&Ls(et[0]);return}if(E.key==="Escape"){E.preventDefault(),_e(!1);return}}if(E.key==="Tab"&&!je&&!ne){E.preventDefault();const J=["default","acceptEdits","bypassPermissions","plan"],V=(J.indexOf(ve)+1)%J.length,ee=J[V];Ye(ee),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,ee);return}if(E.key==="Enter"){if(E.nativeEvent.isComposing)return;(E.ctrlKey||E.metaKey)&&!E.shiftKey?(E.preventDefault(),Cr(E)):!E.shiftKey&&!E.ctrlKey&&!E.metaKey&&(y||(E.preventDefault(),Cr(E)))}},Ls=E=>{const J=L.slice(0,Qt),G=L.slice(Qt),V=G.indexOf(" "),ee=V!==-1?G.slice(V):"",be=J+"@"+E.path+" "+ee,Ne=J.length+1+E.path.length+1;Ie.current&&!Ie.current.matches(":focus")&&Ie.current.focus(),q(be),Ot(Ne),_e(!1),vt(-1),Ie.current&&requestAnimationFrame(()=>{Ie.current&&(Ie.current.setSelectionRange(Ne,Ne),Ie.current.matches(":focus")||Ie.current.focus())})},Cu=E=>{const J=E.target.value,G=E.target.selectionStart;if(!w&&J.trim(),q(J),Ot(G),!J.trim()){E.target.style.height="auto",kt(!1),P(!1),hr(-1),Ke("");return}const V=J.slice(0,G);if((V.match(/```/g)||[]).length%2===1){P(!1),hr(-1),Ke("");return}const Ne=/(^|\s)\/(\S*)$/,Qe=V.match(Ne);if(Qe){const Se=Qe.index+Qe[1].length,Q=Qe[2];hr(Se),P(!0),sr(-1),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{Ke(Q)},150)}else P(!1),hr(-1),Ke(""),Y.current&&clearTimeout(Y.current)},Su=E=>{Ot(E.target.selectionStart)},Eu=()=>{w&&Vt&&s({type:"abort-session",sessionId:w,provider:pt})},Iu=()=>{const E=["default","acceptEdits","bypassPermissions","plan"],G=(E.indexOf(ve)+1)%E.length,V=E[G];Ye(V),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,V)};return e?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
520
- details[open] .details-chevron {
521
- transform: rotate(180deg);
522
- }
523
- `}),t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{ref:te,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[S&&j.length===0?t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),t.jsx("p",{children:"Loading session messages..."})]})}):j.length===0?t.jsxs("div",{className:"flex items-center justify-center h-full",children:[!r&&!w&&t.jsxs("div",{className:"text-center px-6 sm:px-4 py-8",children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:"Choose Your AI Assistant"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:"Select a provider to start a new conversation"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-8",children:[t.jsxs("button",{onClick:()=>{Ms("claude"),localStorage.setItem("selected-provider","claude"),setTimeout(()=>Ie.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${pt==="claude"?"border-blue-500 shadow-lg ring-2 ring-blue-500/20":"border-gray-200 dark:border-gray-700 hover:border-blue-400"}`,children:[t.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[t.jsx(tr,{className:"w-10 h-10"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Claude"}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"by Anthropic"})]})]}),pt==="claude"&&t.jsx("div",{className:"absolute top-2 right-2",children:t.jsx("div",{className:"w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),t.jsxs("button",{onClick:()=>{Ms("cursor"),localStorage.setItem("selected-provider","cursor"),setTimeout(()=>Ie.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${pt==="cursor"?"border-purple-500 shadow-lg ring-2 ring-purple-500/20":"border-gray-200 dark:border-gray-700 hover:border-purple-400"}`,children:[t.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[t.jsx(lr,{className:"w-10 h-10"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Cursor"}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"AI Code Editor"})]})]}),pt==="cursor"&&t.jsx("div",{className:"absolute top-2 right-2",children:t.jsx("div",{className:"w-5 h-5 bg-purple-500 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]})]}),t.jsxs("div",{className:`mb-6 transition-opacity duration-200 ${pt==="cursor"?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:pt==="cursor"?"Select Model":" "}),t.jsxs("select",{value:Br,onChange:E=>{const J=E.target.value;Ei(J),localStorage.setItem("cursor-model",J)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",disabled:pt!=="cursor",children:[t.jsx("option",{value:"gpt-5",children:"GPT-5"}),t.jsx("option",{value:"sonnet-4",children:"Sonnet-4"}),t.jsx("option",{value:"opus-4.1",children:"Opus 4.1"})]})]}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:pt==="claude"?"Ready to use Claude AI. Start typing your message below.":pt==="cursor"?`Ready to use Cursor with ${Br}. Start typing your message below.`:"Select a provider above to begin"}),pt&&O&&t.jsx("div",{className:"mt-4 px-4 sm:px-0",children:t.jsx(nl,{onStartTask:()=>q("Start the next task"),onShowAllTasks:M})})]}),r&&t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[t.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:"Continue your conversation"}),t.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:"Ask questions about your code, request changes, or get help with development tasks"}),O&&t.jsx("div",{className:"mt-4 px-4 sm:px-0",children:t.jsx(nl,{onStartTask:()=>q("Start the next task"),onShowAllTasks:M})})]})]}):t.jsxs(t.Fragment,{children:[$e&&t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),t.jsx("p",{className:"text-sm",children:"Loading older messages..."})]})}),Ee&&!$e&&t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:qe>0&&t.jsxs("span",{children:["Showing ",K.length," of ",qe," messages •",t.jsx("span",{className:"text-xs",children:"Scroll up to load more"})]})}),!Ee&&j.length>un&&t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:["Showing last ",un," messages (",j.length," total) •",t.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:bu,children:"Load earlier messages"})]}),Ti.map((E,J)=>{const G=J>0?Ti[J-1]:null;return t.jsx(iw,{message:E,index:J,prevMessage:G,createDiff:pu,onFileOpen:i,onShowSettings:g,autoExpandTools:x,showRawParameters:b,showThinking:k,selectedProject:e},J)})]}),I&&t.jsx("div",{className:"chat-message assistant",children:t.jsxs("div",{className:"w-full",children:[t.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[t.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?t.jsx(lr,{className:"w-full h-full"}):t.jsx(tr,{className:"w-full h-full"})}),t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":"Claude"})]}),t.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("div",{className:"animate-pulse",children:"●"}),t.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),t.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),t.jsx("span",{className:"ml-2",children:"Thinking..."})]})})]})}),t.jsx("div",{ref:st})]}),t.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 pb-2 sm:pb-4 md:pb-6",children:[t.jsx("div",{className:"flex-1",children:t.jsx(fv,{status:lu,isLoading:I,onAbort:Eu,provider:pt,showThinking:k})}),t.jsx("div",{ref:Lt,className:"max-w-4xl mx-auto mb-3",children:t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[t.jsx("button",{type:"button",onClick:Iu,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${ve==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":ve==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":ve==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:"Click to change permission mode (or press Tab in input)",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${ve==="default"?"bg-gray-500":ve==="acceptEdits"?"bg-green-500":ve==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),t.jsxs("span",{children:[ve==="default"&&"Default Mode",ve==="acceptEdits"&&"Accept Edits",ve==="bypassPermissions"&&"Bypass Permissions",ve==="plan"&&"Plan Mode"]})]})}),t.jsx(gv,{used:gt?.used||0,total:gt?.total||parseInt(void 0)||16e4}),L.trim()&&t.jsx("button",{type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),q(""),Ie.current&&(Ie.current.style.height="auto",Ie.current.focus()),kt(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"Clear input",children:t.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),Gt&&j.length>0&&t.jsx("button",{onClick:ar,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Scroll to bottom",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})}),t.jsxs("form",{onSubmit:Cr,className:"relative max-w-4xl mx-auto",children:[wu&&t.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[t.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),t.jsx("p",{className:"text-sm font-medium",children:"Drop images here"})]})}),Ue.length>0&&t.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:t.jsx("div",{className:"flex flex-wrap gap-2",children:Ue.map((E,J)=>t.jsx(ow,{file:E,onRemove:()=>{at(G=>G.filter((V,ee)=>ee!==J))},uploadProgress:De.get(E.name),error:ke.get(E.name)},J))})}),je&&et.length>0&&t.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:et.map((E,J)=>t.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${J===nt?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:G=>{G.preventDefault(),G.stopPropagation()},onClick:G=>{G.preventDefault(),G.stopPropagation(),Ls(E)},children:[t.jsx("div",{className:"font-medium text-sm",children:E.name}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:E.path})]},E.path))}),t.jsx(nw,{commands:N,selectedIndex:As,onSelect:du,onClose:()=>{P(!1),hr(-1),Ke(""),sr(-1)},position:{top:Ie.current?Math.max(16,Ie.current.getBoundingClientRect().top-316):0,left:Ie.current?Ie.current.getBoundingClientRect().left:16,bottom:Ie.current?window.innerHeight-Ie.current.getBoundingClientRect().top+8:90},isOpen:ne,frequentCommands:pe?[]:cu}),t.jsxs("div",{...ku(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${ut?"chat-input-expanded":""}`,children:[t.jsx("input",{...vu()}),t.jsx("textarea",{ref:Ie,value:L,onChange:Cu,onClick:Su,onKeyDown:Nu,onPaste:yu,onFocus:()=>$(!0),onBlur:()=>$(!1),onInput:E=>{E.target.style.height="auto",E.target.style.height=E.target.scrollHeight+"px",Ot(E.target.selectionStart);const J=parseInt(window.getComputedStyle(E.target).lineHeight),G=E.target.scrollHeight>J*2;kt(G)},placeholder:`Type / for commands, @ for files, or ask ${pt==="cursor"?"Cursor":"Claude"} anything...`,disabled:I,className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-sm sm:text-base leading-[21px] sm:leading-6 transition-all duration-200",style:{height:"50px"}}),t.jsx("button",{type:"button",onClick:ju,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Attach images",children:t.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),t.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:t.jsx(Ad,{onTranscript:xu,className:"w-10 h-10 sm:w-10 sm:h-10"})}),t.jsxs("button",{type:"button",onClick:()=>{const E=!ne;P(E),Ke(""),sr(-1),E&&X(U),Ie.current&&Ie.current.focus()},className:"absolute right-14 sm:right-36 top-1/2 transform -translate-y-1/2 w-10 h-10 sm:w-10 sm:h-10 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800 relative z-10",title:"Show all commands",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),U.length>0&&t.jsx("span",{className:"absolute -top-1 -right-1 bg-blue-600 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:U.length})]}),t.jsx("button",{type:"submit",disabled:!L.trim()||I,onMouseDown:E=>{E.preventDefault(),Cr(E)},onTouchStart:E=>{E.preventDefault(),Cr(E)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:t.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),t.jsx("div",{className:"absolute bottom-1 left-12 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block",children:y?"Ctrl+Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands":"Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands"}),t.jsx("div",{className:`absolute bottom-1 left-12 right-14 text-xs text-gray-400 dark:text-gray-500 pointer-events-none sm:hidden transition-opacity duration-200 ${F?"opacity-100":"opacity-0"}`,children:y?"Ctrl+Enter to send • Tab for modes • / for commands":"Enter to send • Tab for modes • / for commands"})]})]})]})]})]}):t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:t.jsx("p",{children:"Select a project to start chatting with Claude"})})})}const cw=cr.memo(lw);class bt{constructor(r,n,s,a){this.fromA=r,this.toA=n,this.fromB=s,this.toB=a}offset(r,n=r){return new bt(this.fromA+r,this.toA+r,this.fromB+n,this.toB+n)}}function zr(e,r,n,s,a,i){if(e==s)return[];let o=vi(e,r,n,s,a,i),l=wi(e,r+o,n,s,a+o,i);r+=o,n-=l,a+=o,i-=l;let c=n-r,d=i-a;if(!c||!d)return[new bt(r,n,a,i)];if(c>d){let m=e.slice(r,n).indexOf(s.slice(a,i));if(m>-1)return[new bt(r,r+m,a,a),new bt(r+m+d,n,i,i)]}else if(d>c){let m=s.slice(a,i).indexOf(e.slice(r,n));if(m>-1)return[new bt(r,r,a,a+m),new bt(n,n,a+m+c,i)]}if(c==1||d==1)return[new bt(r,n,a,i)];let u=Bd(e,r,n,s,a,i);if(u){let[m,h,p]=u;return zr(e,r,m,s,a,h).concat(zr(e,m+p,n,s,h+p,i))}return dw(e,r,n,s,a,i)}let vn=1e9,wn=0,ki=!1;function dw(e,r,n,s,a,i){let o=n-r,l=i-a;if(vn<1e9&&Math.min(o,l)>vn*16||wn>0&&Date.now()>wn)return Math.min(o,l)>vn*64?[new bt(r,n,a,i)]:cl(e,r,n,s,a,i);let c=Math.ceil((o+l)/2);da.reset(c),ua.reset(c);let d=(p,g)=>e.charCodeAt(r+p)==s.charCodeAt(a+g),u=(p,g)=>e.charCodeAt(n-p-1)==s.charCodeAt(i-g-1),m=(o-l)%2!=0?ua:null,h=m?null:da;for(let p=0;p<c;p++){if(p>vn||wn>0&&!(p&63)&&Date.now()>wn)return cl(e,r,n,s,a,i);let g=da.advance(p,o,l,c,m,!1,d)||ua.advance(p,o,l,c,h,!0,u);if(g)return uw(e,r,n,r+g[0],s,a,i,a+g[1])}return[new bt(r,n,a,i)]}class $d{constructor(){this.vec=[]}reset(r){this.len=r<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[r+1]=0,this.start=this.end=0}advance(r,n,s,a,i,o,l){for(let c=-r+this.start;c<=r-this.end;c+=2){let d=a+c,u=c==-r||c!=r&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,m=u-c;for(;u<n&&m<s&&l(u,m);)u++,m++;if(this.vec[d]=u,u>n)this.end+=2;else if(m>s)this.start+=2;else if(i){let h=a+(n-s)-c;if(h>=0&&h<this.len&&i.vec[h]!=-1)if(o){let p=i.vec[h];if(p>=n-u)return[p,a+p-h]}else{let p=n-i.vec[h];if(u>=p)return[u,m]}}}return null}}const da=new $d,ua=new $d;function uw(e,r,n,s,a,i,o,l){let c=!1;return!tn(e,s)&&++s==n&&(c=!0),!tn(a,l)&&++l==o&&(c=!0),c?[new bt(r,n,i,o)]:zr(e,r,s,a,i,l).concat(zr(e,s,n,a,l,o))}function Od(e,r){let n=1,s=Math.min(e,r);for(;n<s;)n=n<<1;return n}function vi(e,r,n,s,a,i){if(r==n||r==i||e.charCodeAt(r)!=s.charCodeAt(a))return 0;let o=Od(n-r,i-a);for(let l=r,c=a;;){let d=l+o,u=c+o;if(d>n||u>i||e.slice(l,d)!=s.slice(c,u)){if(o==1)return l-r-(tn(e,l)?0:1);o=o>>1}else{if(d==n||u==i)return d-r;l=d,c=u}}}function wi(e,r,n,s,a,i){if(r==n||a==i||e.charCodeAt(n-1)!=s.charCodeAt(i-1))return 0;let o=Od(n-r,i-a);for(let l=n,c=i;;){let d=l-o,u=c-o;if(d<r||u<a||e.slice(d,l)!=s.slice(u,c)){if(o==1)return n-l-(tn(e,l)?0:1);o=o>>1}else{if(d==r||u==a)return n-d;l=d,c=u}}}function Wa(e,r,n,s,a,i,o,l){let c=s.slice(a,i),d=null;for(;;){if(d||o<l)return d;for(let u=r+o;;){tn(e,u)||u++;let m=u+o;if(tn(e,m)||(m+=m==u+1?1:-1),m>=n)break;let h=e.slice(u,m),p=-1;for(;(p=c.indexOf(h,p+1))!=-1;){let g=vi(e,m,n,s,a+p+h.length,i),x=wi(e,r,u,s,a,a+p),b=h.length+g+x;(!d||d[2]<b)&&(d=[u-x,a+p-x,b])}u=m}if(l<0)return d;o=o>>1}}function Bd(e,r,n,s,a,i){let o=n-r,l=i-a;if(o<l){let c=Bd(s,a,i,e,r,n);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Wa(e,r,n,s,a,i,Math.floor(o/4),-1)}function cl(e,r,n,s,a,i){ki=!0;let o=n-r,l=i-a,c;if(o<l){let h=Wa(s,a,i,e,r,n,Math.floor(o/6),50);c=h&&[h[1],h[0],h[2]]}else c=Wa(e,r,n,s,a,i,Math.floor(l/6),50);if(!c)return[new bt(r,n,a,i)];let[d,u,m]=c;return zr(e,r,d,s,a,u).concat(zr(e,d+m,n,s,u+m,i))}function Ud(e,r){for(let n=1;n<e.length;n++){let s=e[n-1],a=e[n];s.toA>a.fromA-r&&s.toB>a.fromB-r&&(e[n-1]=new bt(s.fromA,a.toA,s.fromB,a.toB),e.splice(n--,1))}}function mw(e,r,n){for(;;){Ud(n,1);let s=!1;for(let a=0;a<n.length;a++){let i=n[a],o,l;(o=vi(e,i.fromA,i.toA,r,i.fromB,i.toB))&&(i=n[a]=new bt(i.fromA+o,i.toA,i.fromB+o,i.toB)),(l=wi(e,i.fromA,i.toA,r,i.fromB,i.toB))&&(i=n[a]=new bt(i.fromA,i.toA-l,i.fromB,i.toB-l));let c=i.toA-i.fromA,d=i.toB-i.fromB;if(c&&d)continue;let u=i.fromA-(a?n[a-1].toA:0),m=(a<n.length-1?n[a+1].fromA:e.length)-i.toA;if(!u||!m)continue;let h=c?e.slice(i.fromA,i.toA):r.slice(i.fromB,i.toB);u<=h.length&&e.slice(i.fromA-u,i.fromA)==h.slice(h.length-u)?(n[a]=new bt(i.fromA-u,i.toA-u,i.fromB-u,i.toB-u),s=!0):m<=h.length&&e.slice(i.toA,i.toA+m)==h.slice(0,m)&&(n[a]=new bt(i.fromA+m,i.toA+m,i.fromB+m,i.toB+m),s=!0)}if(!s)break}return n}function pw(e,r,n){for(let s=0,a=0;a<e.length;a++){let i=e[a],o=i.toA-i.fromA,l=i.toB-i.fromB;if(o&&l||o>3||l>3){let c=a==e.length-1?r.length:e[a+1].fromA,d=i.fromA-s,u=c-i.toA,m=ul(r,i.fromA,d),h=dl(r,i.toA,u),p=i.fromA-m,g=h-i.toA;if((!o||!l)&&p&&g){let x=Math.max(o,l),[b,k,C]=o?[r,i.fromA,i.toA]:[n,i.fromB,i.toB];x>p&&r.slice(m,i.fromA)==b.slice(C-p,C)?(i=e[a]=new bt(m,m+o,i.fromB-p,i.toB-p),m=i.fromA,h=dl(r,i.toA,c-i.toA)):x>g&&r.slice(i.toA,h)==b.slice(k,k+g)&&(i=e[a]=new bt(h-o,h,i.fromB+g,i.toB+g),h=i.toA,m=ul(r,i.fromA,i.fromA-s)),p=i.fromA-m,g=h-i.toA}if(p||g)i=e[a]=new bt(i.fromA-p,i.toA+g,i.fromB-p,i.toB+g);else if(o){if(!l){let x=pl(r,i.fromA,i.toA),b,k=x<0?-1:ml(r,i.toA,i.fromA);x>-1&&(b=x-i.fromA)<=u&&r.slice(i.fromA,x)==r.slice(i.toA,i.toA+b)?i=e[a]=i.offset(b):k>-1&&(b=i.toA-k)<=d&&r.slice(i.fromA-b,i.fromA)==r.slice(k,i.toA)&&(i=e[a]=i.offset(-b))}}else{let x=pl(n,i.fromB,i.toB),b,k=x<0?-1:ml(n,i.toB,i.fromB);x>-1&&(b=x-i.fromB)<=u&&n.slice(i.fromB,x)==n.slice(i.toB,i.toB+b)?i=e[a]=i.offset(b):k>-1&&(b=i.toB-k)<=d&&n.slice(i.fromB-b,i.fromB)==n.slice(k,i.toB)&&(i=e[a]=i.offset(-b))}}s=i.toA}return Ud(e,3),e}let Rr;try{Rr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Wd(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Hd(e,r){if(r==e.length)return 0;let n=e.charCodeAt(r);return n<192?Wd(n)?1:0:Rr?!Gd(n)||r==e.length-1?Rr.test(String.fromCharCode(n))?1:0:Rr.test(e.slice(r,r+2))?2:0:0}function qd(e,r){if(!r)return 0;let n=e.charCodeAt(r-1);return n<192?Wd(n)?1:0:Rr?!Kd(n)||r==1?Rr.test(String.fromCharCode(n))?1:0:Rr.test(e.slice(r-2,r))?2:0:0}const Vd=8;function dl(e,r,n){if(r==e.length||!qd(e,r))return r;for(let s=r,a=r+n,i=0;i<Vd;i++){let o=Hd(e,s);if(!o||s+o>a)return s;s+=o}return r}function ul(e,r,n){if(!r||!Hd(e,r))return r;for(let s=r,a=r-n,i=0;i<Vd;i++){let o=qd(e,s);if(!o||s-o<a)return s;s-=o}return r}function ml(e,r,n){for(;r!=n;r--)if(e.charCodeAt(r-1)==10)return r;return-1}function pl(e,r,n){for(;r!=n;r++)if(e.charCodeAt(r)==10)return r;return-1}const Gd=e=>e>=55296&&e<=56319,Kd=e=>e>=56320&&e<=57343;function tn(e,r){return!r||r==e.length||!Gd(e.charCodeAt(r-1))||!Kd(e.charCodeAt(r))}function hw(e,r,n){var s;return vn=((s=n?.scanLimit)!==null&&s!==void 0?s:1e9)>>1,wn=n?.timeout?Date.now()+n.timeout:0,ki=!1,mw(e,r,zr(e,0,e.length,r,0,r.length))}function Jd(){return!ki}function Yd(e,r,n){return pw(hw(e,r,n),e,r)}const ur=ks.define({combine:e=>e[0]}),fw=qa.define(),Qd=ks.define(),qt=Pn.define({create(e){return null},update(e,r){for(let n of r.effects)n.is(fw)&&(e=n.value);for(let n of r.state.facet(Qd))e=n(e,r);return e}});function ma(e){let r=e.field(qt,!1);if(!r)return null;let n=e.facet(ur);return{chunks:r,side:n?n.side:null}}class Kr{constructor(r,n,s,a,i,o=!0){this.changes=r,this.fromA=n,this.toA=s,this.fromB=a,this.toB=i,this.precise=o}offset(r,n){return r||n?new Kr(this.changes,this.fromA+r,this.toA+r,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(r,n,s){let a=Yd(r.toString(),n.toString(),s);return Xd(a,r,n,0,0,Jd())}static updateA(r,n,s,a,i){return bl(xl(r,a,!0,s.length),r,n,s,i)}static updateB(r,n,s,a,i){return bl(xl(r,a,!1,n.length),r,n,s,i)}}function hl(e,r,n,s){let a=n.lineAt(e),i=s.lineAt(r);return a.to==e&&i.to==r&&e<n.length&&r<s.length?[e+1,r+1]:[a.from,i.from]}function fl(e,r,n,s){let a=n.lineAt(e),i=s.lineAt(r);return a.from==e&&i.from==r?[e,r]:[a.to+1,i.to+1]}function Xd(e,r,n,s,a,i){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=hl(c.fromA+s,c.fromB+a,r,n),[m,h]=fl(c.toA+s,c.toB+a,r,n),p=[c.offset(-d+s,-u+a)];for(;l<e.length-1;){let g=e[l+1],[x,b]=hl(g.fromA+s,g.fromB+a,r,n);if(x>m+1&&b>h+1)break;p.push(g.offset(-d+s,-u+a)),[m,h]=fl(g.toA+s,g.toB+a,r,n),l++}o.push(new Kr(p,d,Math.max(d,m),u,Math.max(u,h),i))}return o}const ss=1e3;function gl(e,r,n,s){let a=0,i=e.length;for(;;){if(a==i){let u=0,m=0;a&&({toA:u,toB:m}=e[a-1]);let h=r-(n?u:m);return[u+h,m+h]}let o=a+i>>1,l=e[o],[c,d]=n?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>r)i=o;else if(d<=r)a=o+1;else return s?[l.fromA,l.fromB]:[l.toA,l.toB]}}function xl(e,r,n,s){let a=[];return r.iterChangedRanges((i,o,l,c)=>{let d=0,u=n?r.length:s,m=0,h=n?s:r.length;i>ss&&([d,m]=gl(e,i-ss,n,!0)),o<r.length-ss&&([u,h]=gl(e,o+ss,n,!1));let p=c-l-(o-i),g,[x,b]=n?[p,0]:[0,p];a.length&&(g=a[a.length-1]).toA>=d?a[a.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:h,diffA:g.diffA+x,diffB:g.diffB+b}:a.push({fromA:d,toA:u,fromB:m,toB:h,diffA:x,diffB:b})}),a}function bl(e,r,n,s,a){if(!e.length)return r;let i=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],m=u?u.fromA+l:n.length,h=u?u.fromB+c:s.length;for(;d<r.length;){let b=r[d];if(b.toA+l>m||b.toB+c>h)break;i.push(b.offset(l,c)),d++}if(!u)break;let p=u.toA+l+u.diffA,g=u.toB+c+u.diffB,x=Yd(n.sliceString(m,p),s.sliceString(h,g),a);for(let b of Xd(x,n,s,m,h,Jd()))i.push(b);for(l+=u.diffA,c+=u.diffB;d<r.length;){let b=r[d];if(b.fromA+l>p&&b.fromB+c>g)break;d++}}return i}const gw={scanLimit:500},Zd=vs.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=vl(e))}update(e){(e.docChanged||e.viewportChanged||xw(e.startState,e.state)||bw(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=vl(e.view))}},{decorations:e=>e.deco});function xw(e,r){return e.field(qt,!1)!=r.field(qt,!1)}function bw(e,r){return e.facet(ur)!=r.facet(ur)}const yl=mr.line({class:"cm-changedLine"}),eu=mr.mark({class:"cm-changedText"}),yw=mr.mark({tagName:"ins",class:"cm-insertedLine"}),kw=mr.mark({tagName:"del",class:"cm-deletedLine"}),kl=new class extends Va{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function vw(e,r,n,s,a,i){let o=n?e.fromA:e.fromB,l=n?e.toA:e.toB,c=0;if(o!=l){a.add(o,o,yl),a.add(o,l,n?kw:yw),i&&i.add(o,o,kl);for(let d=r.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,a.add(u,u,yl),i&&i.add(u,u,kl);continue}let m=u+d.value.length;if(s)for(;c<e.changes.length;){let h=e.changes[c],p=o+(n?h.fromA:h.fromB),g=o+(n?h.toA:h.toB),x=Math.max(u,p),b=Math.min(m,g);if(x<b&&a.add(x,b,eu),g<m)c++;else break}u=m}}}function vl(e){let r=e.state.field(qt),{side:n,highlightChanges:s,markGutter:a,overrideChunk:i}=e.state.facet(ur),o=n=="a",l=new os,c=a?new os:null,{from:d,to:u}=e.viewport;for(let m of r){if((o?m.fromA:m.fromB)>=u)break;(o?m.toA:m.toB)>d&&(!i||!i(e.state,m,l,c))&&vw(m,e.state.doc,o,s,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const Ha=qa.define({map:(e,r)=>r.mapPos(e)});class ww extends Ga{constructor(r){super(),this.lines=r}eq(r){return this.lines==r.lines}toDOM(r){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=r.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",s=>{let a=r.posAtDOM(s.target);r.dispatch({effects:Ha.of(a)});let{side:i,sibling:o}=r.state.facet(ur);o&&o().dispatch({effects:Ha.of(jw(a,r.state.field(qt),i=="a"))})}),n}ignoreEvent(r){return r instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function jw(e,r,n){let s=0,a=0;for(let i=0;;i++){let o=i<r.length?r[i]:null;if(!o||(n?o.fromA:o.fromB)>=e)return a+(e-s);[s,a]=n?[o.toA,o.toB]:[o.toB,o.toA]}}const Nw=Pn.define({create(e){return mr.none},update(e,r){e=e.map(r.changes);for(let n of r.effects)n.is(Ha)&&(e=e.update({filter:s=>s!=n.value}));return e},provide:e=>Ht.decorations.from(e)});function Cw({margin:e=3,minSize:r=4}){return Nw.init(n=>Sw(n,e,r))}function Sw(e,r,n){let s=new os,a=e.facet(ur).side=="a",i=e.field(qt),o=1;for(let l=0;;l++){let c=l<i.length?i[l]:null,d=l?o+r:1,u=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-r:e.doc.lines,m=u-d+1;if(m>=n&&s.add(e.doc.line(d).from,e.doc.line(u).to,mr.replace({widget:new ww(m),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return s.finish()}const Ew=Ht.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Iw=new class extends Va{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Aw=Dl.low(Au({class:"cm-changeGutter",markers:e=>{var r;return((r=e.plugin(Zd))===null||r===void 0?void 0:r.gutter)||Mu.empty},widgetMarker:(e,r)=>r instanceof tu?Iw:null}));function Mw(e){var r;let n=typeof e.original=="string"?Tl.of(e.original.split(/\r?\n/)):e.original,s=e.diffConfig||gw;return[Dl.low(Zd),Lw,Ew,Ht.editorAttributes.of({class:"cm-merge-b"}),Qd.of((a,i)=>{let o=i.effects.find(l=>l.is(ji));return o&&(a=Kr.updateA(a,o.value.doc,i.startState.doc,o.value.changes,s)),i.docChanged&&(a=Kr.updateB(a,i.state.field(rn),i.newDoc,i.changes,s)),a}),ur.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(r=e.mergeControls)!==null&&r!==void 0?r:!0,overrideChunk:e.allowInlineDiffs?Fw:void 0,side:"b"}),rn.init(()=>n),e.gutter!==!1?Aw:[],e.collapseUnchanged?Cw(e.collapseUnchanged):[],qt.init(a=>Kr.build(n,a.doc,s))]}const ji=qa.define(),rn=Pn.define({create:()=>Tl.empty,update(e,r){for(let n of r.effects)n.is(ji)&&(e=n.value.doc);return e}}),wl=new WeakMap;class tu extends Ga{constructor(r){super(),this.buildDOM=r,this.dom=null}eq(r){return this.dom==r.dom}toDOM(r){return this.dom||(this.dom=this.buildDOM(r))}}function Tw(e,r,n){let s=wl.get(r.changes);if(s)return s;let a=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(ur),m=document.createElement("div");if(m.className="cm-deletedChunk",u){let R=m.appendChild(document.createElement("div"));R.className="cm-chunkButtons";let H=O=>{O.preventDefault(),Dw(o,o.posAtDOM(m))},M=O=>{O.preventDefault(),Pw(o,o.posAtDOM(m))};if(typeof u=="function")R.appendChild(u("accept",H)),R.appendChild(u("reject",M));else{let O=R.appendChild(document.createElement("button"));O.name="accept",O.textContent=e.phrase("Accept"),O.onmousedown=H;let L=R.appendChild(document.createElement("button"));L.name="reject",L.textContent=e.phrase("Reject"),L.onmousedown=M}}if(n||r.fromA>=r.toA)return m;let h=o.state.field(rn).sliceString(r.fromA,r.endA),p=c&&e.facet(Pl),g=C(),x=r.changes,b=0,k=!1;function C(){let R=m.appendChild(document.createElement("div"));return R.className="cm-deletedLine",R.appendChild(document.createElement("del"))}function y(R,H,M){for(let O=R;O<H;){if(h.charAt(O)==`
524
- `){g.firstChild||g.appendChild(document.createElement("br")),g=C(),O++;continue}let L=H,q=M+(k?" cm-deletedText":""),j=!1,T=h.indexOf(`
525
- `,O);if(T>-1&&T<H&&(L=T),l&&b<x.length){let I=Math.max(0,k?x[b].toA:x[b].fromA);I<=L&&(L=I,k&&b++,j=!0)}if(L>O){let I=document.createTextNode(h.slice(O,L));if(q){let _=g.appendChild(document.createElement("span"));_.className=q,_.appendChild(I)}else g.appendChild(I);O=L}j&&(k=!k)}}if(p&&r.toA-r.fromA<=d){let R=p.parser.parse(h),H=0;pa(R,{style:M=>Ll(e,M)},(M,O,L)=>{M>H&&y(H,M,""),y(M,O,L),H=O}),y(H,h.length,"")}else y(0,h.length,"");return g.firstChild||g.appendChild(document.createElement("br")),m},i=mr.widget({block:!0,side:-1,widget:new tu(a)});return wl.set(r.changes,i),i}function Dw(e,r){let{state:n}=e,s=r??n.selection.main.head,a=e.state.field(qt).find(c=>c.fromB<=s&&c.endB>=s);if(!a)return!1;let i=e.state.sliceDoc(a.fromB,Math.max(a.fromB,a.toB-1)),o=e.state.field(rn);a.fromB!=a.toB&&a.toA<=o.length&&(i+=e.state.lineBreak);let l=Tu.of({from:a.fromA,to:Math.min(o.length,a.toA),insert:i},o.length);return e.dispatch({effects:ji.of({doc:l.apply(o),changes:l}),userEvent:"accept"}),!0}function Pw(e,r){let{state:n}=e,s=r??n.selection.main.head,a=n.field(qt).find(l=>l.fromB<=s&&l.endB>=s);if(!a)return!1;let o=n.field(rn).sliceString(a.fromA,Math.max(a.fromA,a.toA-1));return a.fromA!=a.toA&&a.toB<=n.doc.length&&(o+=n.lineBreak),e.dispatch({changes:{from:a.fromB,to:Math.min(n.doc.length,a.toB),insert:o},userEvent:"revert"}),!0}function jl(e){let r=new os;for(let n of e.field(qt)){let s=e.facet(ur).overrideChunk&&ru(e,n);r.add(n.fromB,n.fromB,Tw(e,n,!!s))}return r.finish()}const Lw=Pn.define({create:e=>jl(e),update(e,r){return r.state.field(qt,!1)!=r.startState.field(qt,!1)?jl(r.state):e},provide:e=>Ht.decorations.from(e)}),Nl=new WeakMap;function ru(e,r){let n=Nl.get(r);if(n!==void 0)return n;n=null;let s=e.field(rn),a=e.doc,i=s.lineAt(r.endA).number-s.lineAt(r.fromA).number+1,o=a.lineAt(r.endB).number-a.lineAt(r.fromB).number+1;e:if(i==o&&i<10){let l=[],c=0,d=r.fromA,u=r.fromB;for(let m of r.changes){if(m.fromA<m.toA){c+=m.toA-m.fromA;let h=s.sliceString(d+m.fromA,d+m.toA);if(/\n/.test(h))break e;l.push(mr.widget({widget:new Rw(h),side:-1}).range(u+m.fromB))}m.fromB<m.toB&&l.push(eu.range(u+m.fromB,u+m.toB))}c<r.endA-r.fromA-i*2&&(n=l)}return Nl.set(r,n),n}class Rw extends Ga{constructor(r){super(),this.text=r}eq(r){return this.text==r.text}toDOM(r){let n=document.createElement("del");return n.className="cm-deletedText",n.textContent=this.text,n}}const _w=new class extends Va{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},zw=mr.line({class:"cm-inlineChangedLine"});function Fw(e,r,n,s){let a=ru(e,r),i=0;if(!a)return!1;for(let o=e.doc.lineAt(r.fromB);;){for(s&&s.add(o.from,o.from,_w),n.add(o.from,o.from,zw);i<a.length&&a[i].to<=o.to;){let l=a[i++];n.add(l.from,l.to,l.value)}if(o.to>=r.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var $w=function(e,r){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)r.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n};const It=ks.define({combine:e=>{const r=[];for(let n of e){if(!n)continue;const{create:s,gutters:a}=n,i=$w(n,["create","gutters"]);r.push(Object.assign(Object.assign({},i),{enabled:!0,gutters:a?a.filter(o=>Object.keys(o).length>0):void 0}))}return Du(r,{enabled:r.length>0,displayText:"characters",eventHandlers:{},showOverlay:"always",gutters:[]})}}),zt={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},Ow=Ht.theme({".cm-minimap-overlay-container":{position:"absolute",top:0,height:"100%",width:"100%","&.cm-minimap-overlay-mouse-over":{opacity:0,transition:"visibility 0s linear 300ms, opacity 300ms"},"&.cm-minimap-overlay-mouse-over:hover":{opacity:1,transition:"visibility 0s linear 0ms, opacity 300ms"},"&.cm-minimap-overlay-off":{display:"none"},"& .cm-minimap-overlay":{background:"rgb(121, 121, 121)",opacity:"0.2",position:"absolute",right:0,top:0,width:"100%",transition:"top 0s ease-in 0ms","&:hover":{opacity:"0.3"}},"&.cm-minimap-overlay-active":{opacity:1,visibility:"visible",transition:"visibility 0s linear 0ms, opacity 300ms","& .cm-minimap-overlay":{opacity:"0.4"}}}}),kr=zt.PixelMultiplier*zt.SizeRatio,Bw=vs.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(It).enabled&&this.create(e)}create(e){this.container=Jr("div",{class:"cm-minimap-overlay-container"}),this.dom=Jr("div",{class:"cm-minimap-overlay"}),this.container.appendChild(this.dom),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),window.addEventListener("mouseup",this.onMouseUp.bind(this)),window.addEventListener("mousemove",this.onMouseMove.bind(this));const r=e.dom.querySelector(".cm-minimap-inner");r&&r.appendChild(this.container),this.computeShowOverlay(),this.computeHeight(),this.computeTop()}remove(){this.container&&(this.container.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),this.container.remove())}update(e){const r=e.startState.facet(It).enabled,n=e.state.facet(It).enabled;if(r&&!n){this.remove();return}!r&&n&&this.create(e.view),n&&(this.computeShowOverlay(),e.geometryChanged&&(this.computeHeight(),this.computeTop()))}computeHeight(){if(!this.dom)return;const e=this.view.dom.clientHeight/kr;this.dom.style.height=e+"px"}computeTop(){if(!this._isDragging&&this.dom){const{clientHeight:e,scrollHeight:r,scrollTop:n}=this.view.scrollDOM,s=r-e,a=n/kr,i=e/kr,o=e-i;let l=n/s;isNaN(l)&&(l=0);const c=o*l,d=Math.min(c,a);this.dom.style.top=d+"px"}}computeShowOverlay(){if(!this.container)return;const{showOverlay:e}=this.view.state.facet(It);e==="mouse-over"?this.container.classList.add("cm-minimap-overlay-mouse-over"):this.container.classList.remove("cm-minimap-overlay-mouse-over");const{clientHeight:r,scrollHeight:n}=this.view.scrollDOM;r===n?this.container.classList.add("cm-minimap-overlay-off"):this.container.classList.remove("cm-minimap-overlay-off")}onMouseDown(e){if(!this.container||e.button===2)return;const{clientY:r,target:n}=e;if(n===this.dom){this._dragStartY=e.clientY,this._isDragging=!0,this.container.classList.add("cm-minimap-overlay-active");return}const{clientHeight:s,scrollHeight:a,scrollTop:i}=this.view.scrollDOM,o=n.getBoundingClientRect().top,l=(r-o)*kr,c=i/(a-s),u=(s*kr-s)*c,m=Math.max(0,i-u);this.view.scrollDOM.scrollTop=m+l-s/2}onMouseUp(e){this._isDragging&&this.container&&(this._dragStartY=void 0,this._isDragging=!1,this.container.classList.remove("cm-minimap-overlay-active"))}onMouseMove(e){if(!this._isDragging||!this.dom)return;if(e.preventDefault(),e.stopPropagation(),!this._dragStartY){this._dragStartY=e.clientY;return}const r=e.clientY-this._dragStartY,n=r<0,s=r>0;this._dragStartY=e.clientY;const a=this.dom.getBoundingClientRect().height,i=this.dom.getBoundingClientRect().y,o=i+a,l=parseFloat(this.dom.style.top),c=this.view.scrollDOM.scrollTop,d=this.view.scrollDOM.clientHeight,u=this.view.scrollDOM.scrollHeight,m=c===0,h=Math.round(c)>=Math.round(u-d);if(m&&n||m&&e.clientY<i||h&&s||h&&e.clientY>o)return;const p=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,x=(p-g)/kr,b=g-g/kr,k=l+r,C=k/b,y=(p-g)*C,R=k*kr;this.view.scrollDOM.scrollTop=Math.max(y,R);const H=Math.min(Math.max(0,k),Math.min(b,x));this.dom.style.top=H+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),Uw=[Ow,Bw];class Ni{constructor(r){this.map=new Map,this.view=r}get(r){return this.map.get(r)}set(r,n){this.map.set(r,n)}}function Cl(e){var r;if(!e.facet(It).enabled)return[];const n=[],s=e.doc.iterLines(),a=Pu(e).iter();let i=0;for(s.next();!s.done;){const o=s.value;let l=i,c=l+o.length;for(;a.value&&a.to<l;)a.next();const{from:d,to:u}=a,m=l>=d&&l<u,h=c>d&&c<=u;if(m){let p=(r=n.pop())!==null&&r!==void 0?r:[],g=p.pop();g&&g.folded&&(g.to=u),g&&p.push(g),(!g||!g.folded)&&p.push({from:d,to:u,folded:!0}),h||p.push({from:u,to:c,folded:!1}),n.push(p)}else h?n.push([{from:l,to:d,folded:!1},{from:d,to:u,folded:!0}]):n.push([{from:l,to:c,folded:!1}]);i=c+1,s.next()}return n}const nn=Pn.define({create:e=>Cl(e),update:(e,r)=>Is([r])||r.docChanged?Cl(r.state):e});function Is(e){return e.find(r=>r.effects.find(n=>n.is(Lu)||n.is(Ru)))}class Ww extends Ni{constructor(r){super(r),this.count=void 0}shouldUpdate(r){if(!r.state.facet(It).enabled)return!1;if(r.docChanged)return!0;for(const n of r.transactions)for(const s of n.effects)if(s.is(_u))return!0;return!!(Is(r.transactions)||this.count===void 0)}update(r){if(!this.shouldUpdate(r))return;this.map.clear();const n=r.state.field(nn);this.count=zu(r.state),Fu(r.state,(s,a,i)=>{const o=this.findLine(a,n),l=this.findLine(i,n);let c=s.severity;for(let d=o;d<=l;d++){const u=this.get(d);u&&(c=[c,u].sort(this.sort.bind(this)).slice(0,1)[0]),this.set(d,c)}})}drawLine(r,n){const{context:s,lineHeight:a,offsetX:i,offsetY:o}=r,l=this.get(n);l&&(s.globalAlpha=.65,s.beginPath(),s.rect(i,o,s.canvas.width-i,a),s.fillStyle=this.color(l),s.fill())}findLine(r,n){return n.findIndex(a=>{const i=a.slice(0,1)[0],o=a.slice(-1)[0];return!i||!o?!1:i.from<=r&&r<=o.to})+1}color(r){return r==="error"?"#d11":r==="warning"?"orange":"#999"}sort(r,n){return this.score(n)-this.score(r)}score(r){switch(r){case"error":return 3;case"warning":return 2;default:return 1}}}function Hw(e){return new Ww(e)}class qw extends Ni{constructor(r){super(r),this.getDrawInfo(),this._themeClasses=r.dom.classList.value}shouldUpdate(r){return r.state.facet(It).enabled?!!(r.docChanged||r.selectionSet||this._themeClasses!==this.view.dom.classList.value||Is(r.transactions)):!1}update(r){if(!this.shouldUpdate(r))return;this.map.clear(),this._themeClasses!==this.view.dom.classList.value&&(this._drawInfo=void 0,this._themeClasses=this.view.dom.classList.value);const{ranges:n}=r.state.selection;let s=0;for(const[a,i]of r.state.field(nn).entries()){const o=[];let l=0;for(const d of i){do{if(s>=n.length||d.to<n[s].from)continue;if(n[s].from===n[s].to){s++;continue}const u=n[s],m={from:l+Math.max(d.from,u.from)-d.from,to:l+Math.min(d.to,u.to)-d.from,extends:u.to>d.to},h=o.slice(-1)[0];if(h&&h.to===m.from){let{to:p}=m;d.folded&&m.extends?p=m.from+1:d.folded&&!m.extends&&(p=h.to),o[o.length-1]=Object.assign(Object.assign({},h),{to:p,extends:m.extends})}else d.folded||o.push(m);if(m.extends)break;s++}while(s<n.length&&d.to>=n[s].from);l+=d.folded?1:d.to-d.from}if(o.length===0)continue;const c=a+1;this.map.set(c,o)}}drawLine(r,n){let{context:s,lineHeight:a,charWidth:i,offsetX:o,offsetY:l}=r;const c=this.get(n);if(c)for(const d of c){const u=o+d.from*i,m=(d.to-d.from)*i,h=s.canvas.width-u;d.extends&&(s.globalAlpha=.65,s.beginPath(),s.rect(u,l,h,a),s.fillStyle=this.getDrawInfo().backgroundColor,s.fill()),s.globalAlpha=1,s.beginPath(),s.rect(u,l,m,a),s.fillStyle=this.getDrawInfo().backgroundColor,s.fill()}}getDrawInfo(){if(this._drawInfo)return this._drawInfo;const r=document.createElement("span");r.setAttribute("class","cm-selectionBackground"),this.view.dom.appendChild(r);const s={backgroundColor:window.getComputedStyle(r).backgroundColor};return this._drawInfo=s,this.view.dom.removeChild(r),s}}function Vw(e){return new qw(e)}class Gw extends Ni{constructor(r){super(r),this._fontInfoMap=new Map,this._themeClasses=new Set(r.dom.classList.values()),r.state.facet(It).enabled&&this.updateImpl(r.state)}shouldUpdate(r){return!!(r.docChanged||r.state.facet(It)!==r.startState.facet(It)||this.themeChanged()||Is(r.transactions))}update(r){this.shouldUpdate(r)&&(this._highlightingCallbackId&&(typeof window.requestIdleCallback<"u"?cancelIdleCallback(this._highlightingCallbackId):clearTimeout(this._highlightingCallbackId)),this.updateImpl(r.state,r.changes))}updateImpl(r,n){var s;this.map.clear(),this._displayText=r.facet(It).displayText,this.themeChanged()&&this._fontInfoMap.clear();let a;if(this._previousTree&&n){const m=Ri.addTree(this._previousTree),h=[];n.iterChangedRanges((p,g,x,b)=>h.push({fromA:p,toA:g,fromB:x,toB:b})),a=Ri.applyChanges(m,h)}const i=r.doc.toString(),o=(s=r.facet(Pl))===null||s===void 0?void 0:s.parser,l=o?o.parse(i,a):void 0;this._previousTree=l;const c={style:m=>Ll(r,m)};let d=[];if(l){const m=r.doc.lineAt(this.view.viewport.from).number,h=r.doc.lineAt(this.view.viewport.to).number,p=h-m,g=m/(r.doc.lines-p),{SizeRatio:x,PixelMultiplier:b}=zt,k=p*x*b,C=g*k,y=Math.max(1,Math.floor(m-C)),R=Math.min(h+Math.floor(k-C),r.doc.lines);pa(l,c,(H,M,O)=>{d.push({from:H,to:M,tags:O})},r.doc.line(y).from,r.doc.line(R).to)}this.updateMapImpl(r,d),d=[];const u=()=>{l&&(pa(l,c,(m,h,p)=>{d.push({from:m,to:h,tags:p})}),this.updateMapImpl(r,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(u):setTimeout(u)}updateMapImpl(r,n){this.map.clear();const s=r.doc.toString(),a=n.values();let i=a.next();for(const[o,l]of r.field(nn).entries()){const c=[];for(const u of l){if(u.from===u.to)continue;if(u.folded){c.push({text:"…",tags:""});continue}let m=u.from;for(;!i.done&&i.value.from<u.to;){const{from:h,to:p,tags:g}=i.value;if(p<m){i=a.next();continue}h>m&&c.push({text:s.slice(m,h),tags:""});const x=Math.max(h,u.from),b=Math.min(p,u.to);if(c.push({text:s.slice(x,b),tags:g}),m=b,p>b)break;i=a.next()}m!==u.to&&c.push({text:s.slice(m,u.to),tags:""})}const d=o+1;this.map.set(d,c)}}measure(r){const{color:n,font:s,lineHeight:a}=this.getFontInfo("");return r.textBaseline="ideographic",r.fillStyle=n,r.font=s,{charWidth:r.measureText("_").width,lineHeight:a}}beforeDraw(){this._fontInfoMap.clear()}drawLine(r,n){const s=this.get(n);if(!s)return;let{context:a,charWidth:i,lineHeight:o,offsetX:l,offsetY:c}=r,d;a.textBaseline="ideographic";for(const u of s){const m=this.getFontInfo(u.tags);switch((!d||d.color!==m.color)&&(a.fillStyle=m.color),(!d||d.font!==m.font)&&(a.font=m.font),d=m,o=Math.max(o,m.lineHeight),this._displayText){case"characters":{a.fillText(u.text,l,c+o),l+=u.text.length*i;break}case"blocks":{const h=/\S+/g;let p;for(;(p=h.exec(u.text))!==null;){const g=l+p.index*i;let x=(h.lastIndex-p.index)*i;if(g>a.canvas.width)break;g+x>a.canvas.width&&(x=a.canvas.width-g);const b=2/zt.SizeRatio,k=o-b;a.fillStyle=m.color,a.globalAlpha=.65,a.beginPath(),a.rect(g,c,x,k),a.fill()}l+=u.text.length*i;break}}}}getFontInfo(r){const n=this._fontInfoMap.get(r);if(n)return n;const s=Jr("span",{class:r}),a=Jr("div",{class:"cm-line",style:"display: none"},s);this.view.contentDOM.appendChild(a);const i=window.getComputedStyle(s),o=parseFloat(i.lineHeight)/zt.SizeRatio,l={color:i.color,font:`${i.fontStyle} ${i.fontWeight} ${o}px ${i.fontFamily}`,lineHeight:o};return this._fontInfoMap.set(r,l),this.view.contentDOM.removeChild(a),l}themeChanged(){const r=this._themeClasses,n=new Set(this.view.dom.classList.values());if(this._themeClasses=n,!r||(r.delete("cm-focused"),n.delete("cm-focused"),r.size!==n.size))return!0;let s=!0;return r.forEach(a=>{n.has(a)||(s=!1)}),!s}}function Kw(e){return new Gw(e)}const nu=4;function Jw(e,r,n){const s=e[n];s&&(r.context.fillStyle=s,r.context.globalAlpha=1,r.context.beginPath(),r.context.rect(r.offsetX,r.offsetY,nu,r.lineHeight),r.context.fill())}const Yw=Ht.theme({"&":{height:"100%",overflowY:"auto"},"& .cm-minimap-gutter":{borderRight:0,flexShrink:0,left:"unset",position:"sticky",right:0,top:0},"& .cm-minimap-inner":{height:"100%",position:"absolute",right:0,top:0,overflowY:"hidden","& canvas":{display:"block"}},"& .cm-minimap-box-shadow":{boxShadow:"12px 0px 20px 5px #6c6c6c"}}),Sl=6,Qw=vs.fromClass(class{constructor(e){this.view=e,this.text=Kw(e),this.selection=Vw(e),this.diagnostic=Hw(e),e.state.facet(jn)&&this.create(e)}create(e){const r=e.state.facet(jn);if(!r)throw Error("Expected nonnull");this.inner=Jr("div",{class:"cm-minimap-inner"}),this.canvas=Jr("canvas"),this.dom=r.create(e).dom,this.dom.classList.add("cm-gutters"),this.dom.classList.add("cm-minimap-gutter"),this.inner.appendChild(this.canvas),this.dom.appendChild(this.inner),this.view.scrollDOM.insertBefore(this.dom,this.view.contentDOM.nextSibling);for(const n in this.view.state.facet(It).eventHandlers){const s=this.view.state.facet(It).eventHandlers[n];s&&this.dom.addEventListener(n,a=>s(a,this.view))}}remove(){this.dom&&this.dom.remove()}update(e){const r=e.startState.facet(jn),n=e.state.facet(jn);if(r&&!n){this.remove();return}!r&&n&&this.create(e.view),n&&(this.text.update(e),this.selection.update(e),this.diagnostic.update(e),this.render())}getWidth(){const e=this.view.dom.clientWidth;if(e<=zt.MaxWidth*Sl){const r=e/(zt.MaxWidth*Sl);return zt.MaxWidth*r}return zt.MaxWidth}render(){if(!this.dom||!this.canvas||!this.inner)return;this.text.beforeDraw(),this.updateBoxShadow(),this.dom.style.width=this.getWidth()+"px",this.canvas.style.maxWidth=this.getWidth()+"px",this.canvas.width=this.getWidth()*zt.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*zt.PixelMultiplier,this.canvas.style.height=e+"px";const r=this.canvas.getContext("2d");if(!r)return;r.clearRect(0,0,this.canvas.width,this.canvas.height);const{charWidth:n,lineHeight:s}=this.text.measure(r);let{startIndex:a,endIndex:i,offsetY:o}=this.canvasStartAndEndIndex(r,s);const l=this.view.state.facet(It).gutters;for(let c=a;c<i;c++){const d=this.view.state.field(nn);if(c>=d.length)break;const u={offsetX:0,offsetY:o,context:r,lineHeight:s,charWidth:n};if(l.length){u.offsetX+=2;for(let m of l)Jw(m,u,c+1),u.offsetX+=nu;u.offsetX+=2}this.text.drawLine(u,c+1),this.selection.drawLine(u,c+1),this.diagnostic.drawLine(u,c+1),o+=s}r.restore()}canvasStartAndEndIndex(e,r){let{top:n,bottom:s}=this.view.documentPadding;n/=zt.SizeRatio,s/=zt.SizeRatio;const a=e.canvas.height,{clientHeight:i,scrollHeight:o,scrollTop:l}=this.view.scrollDOM;let c=l/(o-i);isNaN(c)&&(c=0);const d=this.view.state.field(nn).length,u=n+s+d*r,m=Math.max(0,c*(u-a)),h=Math.max(0,n-m),p=Math.round(Math.max(0,m-n)/r),g=Math.round((a-h)/r);return{startIndex:p,endIndex:p+g,offsetY:h}}updateBoxShadow(){if(!this.canvas)return;const{clientWidth:e,scrollWidth:r,scrollLeft:n}=this.view.scrollDOM;e+n<r?this.canvas.classList.add("cm-minimap-box-shadow"):this.canvas.classList.remove("cm-minimap-box-shadow")}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.render())}},provide:e=>Ht.scrollMargins.of(r=>{var n;const s=(n=r.plugin(e))===null||n===void 0?void 0:n.getWidth();return s?{right:s}:null})}),jn=ks.define({combine:e=>{var r;return(r=e.find(n=>n!==null))!==null&&r!==void 0?r:null},enables:e=>[[It.compute([e],r=>r.facet(e)),Yw,nn,Qw,Uw]]});function su({file:e,onClose:r,projectPath:n}){const[s,a]=f.useState(""),[i,o]=f.useState(!0),[l,c]=f.useState(!1),[d,u]=f.useState(!1),[m,h]=f.useState(!0),[p,g]=f.useState(!1),[x,b]=f.useState(!!e.diffInfo),[k,C]=f.useState(!1),y=f.useRef(null),R=f.useMemo(()=>{if(!e.diffInfo||!x)return[];const T={};return[jn.compute(["doc"],I=>{const w=ma(I)?.chunks||[];return Object.keys(T).forEach(W=>delete T[W]),w.forEach(W=>{const F=I.doc.lineAt(W.fromB).number,$=I.doc.lineAt(Math.min(W.toB,I.doc.length)).number;for(let K=F;K<=$;K++)T[K]=m?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[T]}})]},[e.diffInfo,x,m]),H=f.useMemo(()=>!e.diffInfo||!x?[]:[vs.fromClass(class{constructor(T){setTimeout(()=>{const _=ma(T.state)?.chunks||[];if(_.length>0){const w=_[0];T.dispatch({effects:Ht.scrollIntoView(w.fromB,{y:"center"})})}},100)}update(){}destroy(){}})],[e.diffInfo,x]),M=f.useMemo(()=>{if(!e.diffInfo||!x)return[];const T=I=>{const _=document.createElement("div");_.className="cm-diff-navigation-panel";let w=0;const W=()=>{const $=ma(I.state)?.chunks||[],K=$.length;_.innerHTML=`
526
- <div style="display: flex; align-items: center; gap: 8px;">
527
- <span style="font-weight: 500;">${K>0?`${w+1}/${K}`:"0"} changes</span>
528
- <button class="cm-diff-nav-btn cm-diff-nav-prev" title="Previous change" ${K===0?"disabled":""}>
529
- <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
530
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7" />
531
- </svg>
532
- </button>
533
- <button class="cm-diff-nav-btn cm-diff-nav-next" title="Next change" ${K===0?"disabled":""}>
534
- <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
535
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
536
- </svg>
537
- </button>
538
- </div>
539
- `;const ce=_.querySelector(".cm-diff-nav-prev"),S=_.querySelector(".cm-diff-nav-next");ce?.addEventListener("click",()=>{if($.length===0)return;w=w>0?w-1:$.length-1;const Ae=$[w];Ae&&I.dispatch({effects:Ht.scrollIntoView(Ae.fromB,{y:"center"})}),W()}),S?.addEventListener("click",()=>{if($.length===0)return;w=w<$.length-1?w+1:0;const Ae=$[w];Ae&&I.dispatch({effects:Ht.scrollIntoView(Ae.fromB,{y:"center"})}),W()})};return W(),{top:!0,dom:_,update:W}};return[$u.of(T)]},[e.diffInfo,x]),O=T=>{const I=T.split(".").pop()?.toLowerCase();switch(I){case"js":case"jsx":case"ts":case"tsx":return[Hu({jsx:!0,typescript:I.includes("ts")})];case"py":return[Wu()];case"html":case"htm":return[Uu()];case"css":case"scss":case"less":return[Bu()];case"json":return[Ou()];case"md":case"markdown":return[zl()];default:return[]}};f.useEffect(()=>{(async()=>{try{if(o(!0),e.diffInfo&&e.diffInfo.new_string!==void 0&&e.diffInfo.old_string!==void 0){a(e.diffInfo.new_string),o(!1);return}const I=await Fe.readFile(e.projectName,e.path);if(!I.ok)throw new Error(`Failed to load file: ${I.status} ${I.statusText}`);const _=await I.json();a(_.content)}catch(I){console.error("Error loading file:",I),a(`// Error loading file: ${I.message}
540
- // File: ${e.name}
541
- // Path: ${e.path}`)}finally{o(!1)}})()},[e,n]);const L=async()=>{c(!0);try{console.log("Saving file:",{projectName:e.projectName,path:e.path,contentLength:s?.length});const T=await Fe.saveFile(e.projectName,e.path,s);if(console.log("Save response:",{status:T.status,ok:T.ok,contentType:T.headers.get("content-type")}),!T.ok){const _=T.headers.get("content-type");if(_&&_.includes("application/json")){const w=await T.json();throw new Error(w.error||`Save failed: ${T.status}`)}else{const w=await T.text();throw console.error("Non-JSON error response:",w),new Error(`Save failed: ${T.status} ${T.statusText}`)}}const I=await T.json();console.log("Save successful:",I),g(!0),setTimeout(()=>g(!1),2e3)}catch(T){console.error("Error saving file:",T),alert(`Error saving file: ${T.message}`)}finally{c(!1)}},q=()=>{const T=new Blob([s],{type:"text/plain"}),I=URL.createObjectURL(T),_=document.createElement("a");_.href=I,_.download=e.name,document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL(I)},j=()=>{u(!d)};return f.useEffect(()=>{const T=I=>{(I.ctrlKey||I.metaKey)&&(I.key==="s"?(I.preventDefault(),L()):I.key==="Escape"&&(I.preventDefault(),r()))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[s]),i?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
542
- .code-editor-loading {
543
- background-color: ${m?"#111827":"#ffffff"} !important;
544
- }
545
- .code-editor-loading:hover {
546
- background-color: ${m?"#111827":"#ffffff"} !important;
547
- }
548
- `}),t.jsx("div",{className:"fixed inset-0 z-50 md:bg-black/50 md:flex md:items-center md:justify-center",children:t.jsx("div",{className:"code-editor-loading w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsxs("span",{className:"text-gray-900 dark:text-white",children:["Loading ",e.name,"..."]})]})})})]}):t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
549
- /* Light background for full line changes */
550
- .cm-deletedChunk {
551
- background-color: ${m?"rgba(239, 68, 68, 0.15)":"rgba(255, 235, 235, 1)"} !important;
552
- border-left: 3px solid ${m?"rgba(239, 68, 68, 0.6)":"rgb(239, 68, 68)"} !important;
553
- padding-left: 4px !important;
554
- }
555
-
556
- .cm-insertedChunk {
557
- background-color: ${m?"rgba(34, 197, 94, 0.15)":"rgba(230, 255, 237, 1)"} !important;
558
- border-left: 3px solid ${m?"rgba(34, 197, 94, 0.6)":"rgb(34, 197, 94)"} !important;
559
- padding-left: 4px !important;
560
- }
561
-
562
- /* Override linear-gradient underline and use solid darker background for partial changes */
563
- .cm-editor.cm-merge-b .cm-changedText {
564
- background: ${m?"rgba(34, 197, 94, 0.4)":"rgba(34, 197, 94, 0.3)"} !important;
565
- padding-top: 2px !important;
566
- padding-bottom: 2px !important;
567
- margin-top: -2px !important;
568
- margin-bottom: -2px !important;
569
- }
570
-
571
- .cm-editor .cm-deletedChunk .cm-changedText {
572
- background: ${m?"rgba(239, 68, 68, 0.4)":"rgba(239, 68, 68, 0.3)"} !important;
573
- padding-top: 2px !important;
574
- padding-bottom: 2px !important;
575
- margin-top: -2px !important;
576
- margin-bottom: -2px !important;
577
- }
578
-
579
- /* Minimap gutter styling */
580
- .cm-gutter.cm-gutter-minimap {
581
- background-color: ${m?"#1e1e1e":"#f5f5f5"};
582
- }
583
-
584
- /* Diff navigation panel styling */
585
- .cm-diff-navigation-panel {
586
- padding: 8px 12px;
587
- background-color: ${m?"#1f2937":"#ffffff"};
588
- border-bottom: 1px solid ${m?"#374151":"#e5e7eb"};
589
- color: ${m?"#d1d5db":"#374151"};
590
- font-size: 14px;
591
- }
592
-
593
- .cm-diff-nav-btn {
594
- padding: 4px;
595
- background: transparent;
596
- border: none;
597
- cursor: pointer;
598
- border-radius: 4px;
599
- display: inline-flex;
600
- align-items: center;
601
- justify-content: center;
602
- color: inherit;
603
- }
604
-
605
- .cm-diff-nav-btn:hover {
606
- background-color: ${m?"#374151":"#f3f4f6"};
607
- }
608
-
609
- .cm-diff-nav-btn:disabled {
610
- opacity: 0.5;
611
- cursor: not-allowed;
612
- }
613
- `}),t.jsx("div",{className:`fixed inset-0 z-50 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${d?"md:p-0":""}`,children:t.jsxs("div",{className:`bg-white shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(d?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 flex-shrink-0 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded flex items-center justify-center flex-shrink-0",children:t.jsx("span",{className:"text-white text-sm font-mono",children:e.name.split(".").pop()?.toUpperCase()||"FILE"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h3",{className:"font-medium text-gray-900 truncate",children:e.name}),e.diffInfo&&t.jsx("span",{className:"text-xs bg-blue-100 text-blue-600 px-2 py-1 rounded whitespace-nowrap",children:"📝 Has changes"})]}),t.jsx("p",{className:"text-sm text-gray-500 truncate",children:e.path})]})]}),t.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[e.diffInfo&&t.jsx("button",{onClick:()=>b(!x),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:x?"Hide diff highlighting":"Show diff highlighting",children:x?t.jsx(tc,{className:"w-5 h-5 md:w-4 md:h-4"}):t.jsx(on,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:()=>C(!k),className:`p-2 md:p-2 rounded-md hover:bg-gray-100 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center ${k?"text-blue-600 bg-blue-50":"text-gray-600 hover:text-gray-900"}`,title:k?"Disable word wrap":"Enable word wrap",children:t.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),t.jsx("button",{onClick:()=>h(!m),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:t.jsx("span",{className:"text-lg md:text-base",children:m?"☀️":"🌙"})}),t.jsx("button",{onClick:q,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download file",children:t.jsx(ls,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:L,disabled:l,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${p?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:p?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ds,{className:"w-5 h-5 md:w-4 md:h-4"}),t.jsx("span",{className:"hidden sm:inline",children:l?"Saving...":"Save"})]})}),t.jsx("button",{onClick:j,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:d?"Exit fullscreen":"Fullscreen",children:d?t.jsx(sc,{className:"w-4 h-4"}):t.jsx(Xa,{className:"w-4 h-4"})}),t.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:t.jsx(ot,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(Rl,{ref:y,value:s,onChange:a,extensions:[...O(e.name),...e.diffInfo&&x&&e.diffInfo.old_string!==void 0?[Mw({original:e.diffInfo.old_string,mergeControls:!1,highlightChanges:!0,syntaxHighlightDeletions:!1,gutter:!0}),...R,...H,...M]:[],...k?[Ht.lineWrapping]:[]],theme:m?_l:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),t.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("span",{children:["Lines: ",s.split(`
614
- `).length]}),t.jsxs("span",{children:["Characters: ",s.length]}),t.jsxs("span",{children:["Language: ",e.name.split(".").pop()?.toUpperCase()||"Text"]})]}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]})})]})}function Xw({file:e,onClose:r}){const n=`/api/projects/${e.projectName}/files/content?path=${encodeURIComponent(e.path)}`;return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:e.name}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:t.jsx(ot,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[t.jsx("img",{src:n,alt:e.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md",onError:s=>{s.target.style.display="none",s.target.nextSibling.style.display="block"}}),t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",style:{display:"none"},children:[t.jsx("p",{children:"Unable to load image"}),t.jsx("p",{className:"text-sm mt-2",children:e.path})]})]}),t.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.path})})]})})}function Zw({selectedProject:e}){const[r,n]=f.useState([]),[s,a]=f.useState(!1),[i,o]=f.useState(new Set),[l,c]=f.useState(null),[d,u]=f.useState(null),[m,h]=f.useState("detailed"),[p,g]=f.useState(""),[x,b]=f.useState([]);f.useEffect(()=>{e&&C()},[e]),f.useEffect(()=>{const I=localStorage.getItem("file-tree-view-mode");I&&["simple","detailed","compact"].includes(I)&&h(I)},[]),f.useEffect(()=>{if(!p.trim())b(r);else{const I=k(r,p.toLowerCase());b(I);const _=w=>{w.forEach(W=>{W.type==="directory"&&W.children&&W.children.length>0&&(o(F=>new Set(F.add(W.path))),_(W.children))})};_(I)}},[r,p]);const k=(I,_)=>I.reduce((w,W)=>{const F=W.name.toLowerCase().includes(_);let $=[];return W.type==="directory"&&W.children&&($=k(W.children,_)),(F||$.length>0)&&w.push({...W,children:$}),w},[]),C=async()=>{a(!0);try{const I=await Fe.getFiles(e.name);if(!I.ok){const w=await I.text();console.error("❌ File fetch failed:",I.status,w),n([]);return}const _=await I.json();n(_)}catch(I){console.error("❌ Error fetching files:",I),n([])}finally{a(!1)}},y=I=>{const _=new Set(i);_.has(I)?_.delete(I):_.add(I),o(_)},R=I=>{h(I),localStorage.setItem("file-tree-view-mode",I)},H=I=>{if(!I||I===0)return"0 B";const _=1024,w=["B","KB","MB","GB"],W=Math.floor(Math.log(I)/Math.log(_));return parseFloat((I/Math.pow(_,W)).toFixed(1))+" "+w[W]},M=I=>{if(!I)return"-";const _=new Date,w=new Date(I),W=Math.floor((_-w)/1e3);return W<60?"just now":W<3600?`${Math.floor(W/60)} min ago`:W<86400?`${Math.floor(W/3600)} hours ago`:W<2592e3?`${Math.floor(W/86400)} days ago`:w.toLocaleDateString()},O=(I,_=0)=>I.map(w=>t.jsxs("div",{className:"select-none",children:[t.jsx(Me,{variant:"ghost",className:Ce("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent"),style:{paddingLeft:`${_*16+12}px`},onClick:()=>{w.type==="directory"?y(w.path):L(w.name)?u({name:w.name,path:w.path,projectPath:e.path,projectName:e.name}):c({name:w.name,path:w.path,projectPath:e.path,projectName:e.name})},children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[w.type==="directory"?i.has(w.path)?t.jsx(Pr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(er,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):q(w.name),t.jsx("span",{className:"text-sm truncate text-foreground",children:w.name})]})}),w.type==="directory"&&i.has(w.path)&&w.children&&w.children.length>0&&t.jsx("div",{children:O(w.children,_+1)})]},w.path)),L=I=>{const _=I.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(_)},q=I=>{const _=I.split(".").pop()?.toLowerCase(),w=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],W=["md","txt","doc","pdf"],F=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return w.includes(_)?t.jsx(vp,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):W.includes(_)?t.jsx(Tt,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):F.includes(_)?t.jsx(qi,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):t.jsx(qi,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},j=(I,_=0)=>I.map(w=>t.jsxs("div",{className:"select-none",children:[t.jsxs("div",{className:Ce("grid grid-cols-12 gap-2 p-2 hover:bg-accent cursor-pointer items-center"),style:{paddingLeft:`${_*16+12}px`},onClick:()=>{w.type==="directory"?y(w.path):L(w.name)?u({name:w.name,path:w.path,projectPath:e.path,projectName:e.name}):c({name:w.name,path:w.path,projectPath:e.path,projectName:e.name})},children:[t.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[w.type==="directory"?i.has(w.path)?t.jsx(Pr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(er,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):q(w.name),t.jsx("span",{className:"text-sm truncate text-foreground",children:w.name})]}),t.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:w.type==="file"?H(w.size):"-"}),t.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:M(w.modified)}),t.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:w.permissionsRwx||"-"})]}),w.type==="directory"&&i.has(w.path)&&w.children&&j(w.children,_+1)]},w.path)),T=(I,_=0)=>I.map(w=>t.jsxs("div",{className:"select-none",children:[t.jsxs("div",{className:Ce("flex items-center justify-between p-2 hover:bg-accent cursor-pointer"),style:{paddingLeft:`${_*16+12}px`},onClick:()=>{w.type==="directory"?y(w.path):L(w.name)?u({name:w.name,path:w.path,projectPath:e.path,projectName:e.name}):c({name:w.name,path:w.path,projectPath:e.path,projectName:e.name})},children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w.type==="directory"?i.has(w.path)?t.jsx(Pr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(er,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):q(w.name),t.jsx("span",{className:"text-sm truncate text-foreground",children:w.name})]}),t.jsx("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:w.type==="file"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:H(w.size)}),t.jsx("span",{className:"font-mono",children:w.permissionsRwx})]})})]}),w.type==="directory"&&i.has(w.path)&&w.children&&T(w.children,_+1)]},w.path));return s?t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading files..."})}):t.jsxs("div",{className:"h-full flex flex-col bg-card",children:[t.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Files"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(Me,{variant:m==="simple"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>R("simple"),title:"Simple view",children:t.jsx(cs,{className:"w-4 h-4"})}),t.jsx(Me,{variant:m==="compact"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>R("compact"),title:"Compact view",children:t.jsx(on,{className:"w-4 h-4"})}),t.jsx(Me,{variant:m==="detailed"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>R("detailed"),title:"Detailed view",children:t.jsx(jh,{className:"w-4 h-4"})})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx(Yr,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),t.jsx(wt,{type:"text",placeholder:"Search files and folders...",value:p,onChange:I=>g(I.target.value),className:"pl-8 pr-8 h-8 text-sm"}),p&&t.jsx(Me,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>g(""),title:"Clear search",children:t.jsx(ot,{className:"w-3 h-3"})})]})]}),m==="detailed"&&x.length>0&&t.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:t.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[t.jsx("div",{className:"col-span-5",children:"Name"}),t.jsx("div",{className:"col-span-2",children:"Size"}),t.jsx("div",{className:"col-span-3",children:"Modified"}),t.jsx("div",{className:"col-span-2",children:"Permissions"})]})}),t.jsx(Ja,{className:"flex-1 p-4",children:r.length===0?t.jsxs("div",{className:"text-center py-8",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:t.jsx(er,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No files found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Check if the project path is accessible"})]}):x.length===0&&p?t.jsxs("div",{className:"text-center py-8",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:t.jsx(Yr,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No matches found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Try a different search term or clear the search"})]}):t.jsxs("div",{className:m==="detailed"?"":"space-y-1",children:[m==="simple"&&O(x),m==="compact"&&T(x),m==="detailed"&&j(x)]})}),l&&t.jsx(su,{file:l,onClose:()=>c(null),projectPath:l.projectPath}),d&&t.jsx(Xw,{file:d,onClose:()=>u(null)})]})}function au({project:e,session:r=null,command:n=null,isActive:s=!0,isPlainShell:a=null,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:m=!1}){const[h,p]=f.useState(!1),g=a!==null?a:n!==null,x=b=>{p(!0),o&&o(b)};return e?t.jsxs("div",{className:`h-full flex flex-col ${d}`,children:[u&&c&&t.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-200",children:c}),h&&t.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),l&&t.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"Close",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),t.jsx("div",{className:"flex-1",children:t.jsx(bi,{selectedProject:e,selectedSession:r,isActive:s,initialCommand:n,isPlainShell:g,onProcessComplete:x})})]}):t.jsx("div",{className:`h-full flex items-center justify-center ${d}`,children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[t.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),t.jsx("p",{children:"A project is required to open a shell"})]})})}function El({diff:e,fileName:r,isMobile:n,wrapText:s}){if(!e)return t.jsx("div",{className:"p-4 text-center text-gray-500 dark:text-gray-400 text-sm",children:"No diff available"});const a=(i,o)=>{const l=i.startsWith("+")&&!i.startsWith("+++"),c=i.startsWith("-")&&!i.startsWith("---"),d=i.startsWith("@@");return t.jsx("div",{className:`font-mono text-xs p-2 ${n&&s?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${l?"bg-green-50 dark:bg-green-950 text-green-700 dark:text-green-300":c?"bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300":d?"bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`,children:i},o)};return t.jsx("div",{className:"diff-viewer",children:e.split(`
615
- `).map((i,o)=>a(i,o))})}function e1({selectedProject:e,isMobile:r,onFileOpen:n}){const[s,a]=f.useState(null),[i,o]=f.useState({}),[l,c]=f.useState(!1),[d,u]=f.useState(""),[m,h]=f.useState(new Set),[p,g]=f.useState(new Set),[x,b]=f.useState(!1),[k,C]=f.useState(""),[y,R]=f.useState([]),[H,M]=f.useState(!0),[O,L]=f.useState(!1),[q,j]=f.useState(!1),[T,I]=f.useState(!1),[_,w]=f.useState(""),[W,F]=f.useState(!1),[$,K]=f.useState("changes"),[ce,S]=f.useState([]),[Ae,$e]=f.useState(new Set),[v,ae]=f.useState({}),[me,Ee]=f.useState(!1),[ie,qe]=f.useState(null),[re,le]=f.useState(!1),[fe,we]=f.useState(!1),[ve,Ye]=f.useState(!1),[Ue,at]=f.useState(!1),[De,ye]=f.useState(r),[ke,Oe]=f.useState(null),st=f.useRef(null),Ie=f.useRef(null),[Lt,te]=f.useState(()=>localStorage.getItem("selected-provider")||"claude");f.useEffect(()=>{const P=()=>{const U=localStorage.getItem("selected-provider")||"claude";te(U)};return window.addEventListener("storage",P),()=>window.removeEventListener("storage",P)},[]),f.useEffect(()=>{e&&(de(),z(),D(),$==="history"&&Rt())},[e,$]),f.useEffect(()=>{const P=U=>{Ie.current&&!Ie.current.contains(U.target)&&j(!1)};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);const de=async()=>{if(e){c(!0);try{const U=await(await Pe(`/api/git/status?project=${encodeURIComponent(e.name)}`)).json();if(U.error)console.error("Git status error:",U.error),a({error:U.error,details:U.details});else{a(U),C(U.branch||"main");const B=new Set([...U.modified||[],...U.added||[],...U.deleted||[],...U.untracked||[]]);g(B);for(const N of U.modified||[])nt(N);for(const N of U.added||[])nt(N);for(const N of U.deleted||[])nt(N);for(const N of U.untracked||[])nt(N)}}catch(P){console.error("Error fetching git status:",P)}finally{c(!1)}}},z=async()=>{try{const U=await(await Pe(`/api/git/branches?project=${encodeURIComponent(e.name)}`)).json();!U.error&&U.branches&&R(U.branches)}catch(P){console.error("Error fetching branches:",P)}},D=async()=>{if(e)try{const U=await(await Pe(`/api/git/remote-status?project=${encodeURIComponent(e.name)}`)).json();U.error?qe(null):qe(U)}catch(P){console.error("Error fetching remote status:",P),qe(null)}},Y=async P=>{try{const B=await(await Pe("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:P})})).json();B.success?(C(P),j(!1),de()):console.error("Failed to switch branch:",B.error)}catch(U){console.error("Error switching branch:",U)}},Z=async()=>{if(_.trim()){F(!0);try{const U=await(await Pe("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:_.trim()})})).json();U.success?(C(_.trim()),I(!1),j(!1),w(""),z(),de()):console.error("Failed to create branch:",U.error)}catch(P){console.error("Error creating branch:",P)}finally{F(!1)}}},se=async()=>{le(!0);try{const U=await(await Pe("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();U.success?(de(),D()):console.error("Fetch failed:",U.error)}catch(P){console.error("Error fetching from remote:",P)}finally{le(!1)}},je=async()=>{we(!0);try{const U=await(await Pe("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();U.success?(de(),D()):console.error("Pull failed:",U.error)}catch(P){console.error("Error pulling from remote:",P)}finally{we(!1)}},_e=async()=>{Ye(!0);try{const U=await(await Pe("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();U.success?(de(),D()):console.error("Push failed:",U.error)}catch(P){console.error("Error pushing to remote:",P)}finally{Ye(!1)}},Le=async()=>{at(!0);try{const U=await(await Pe("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:k})})).json();U.success?(de(),D()):console.error("Publish failed:",U.error)}catch(P){console.error("Error publishing branch:",P)}finally{at(!1)}},Ge=async P=>{try{const B=await(await Pe("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:P})})).json();B.success?(g(N=>{const X=new Set(N);return X.delete(P),X}),de()):console.error("Discard failed:",B.error)}catch(U){console.error("Error discarding changes:",U)}},et=async P=>{try{const B=await(await Pe("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:P})})).json();B.success?(g(N=>{const X=new Set(N);return X.delete(P),X}),de()):console.error("Delete failed:",B.error)}catch(U){console.error("Error deleting untracked file:",U)}},We=async()=>{if(!ke)return;const{type:P,file:U,message:B}=ke;Oe(null);try{switch(P){case"discard":await Ge(U);break;case"delete":await et(U);break;case"commit":await Gt();break;case"pull":await je();break;case"push":await _e();break;case"publish":await Le();break}}catch(N){console.error(`Error executing ${P}:`,N)}},nt=async P=>{try{const B=await(await Pe(`/api/git/diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(P)}`)).json();!B.error&&B.diff&&o(N=>({...N,[P]:B.diff}))}catch(U){console.error("Error fetching file diff:",U)}},ct=async P=>{if(n)try{const B=await(await Pe(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(P)}`)).json();if(B.error){console.error("Error fetching file with diff:",B.error),n(P);return}const N={old_string:B.oldContent||"",new_string:B.currentContent||""};n(P,N)}catch(U){console.error("Error opening file:",U),n(P)}},Rt=async()=>{try{const U=await(await Pe(`/api/git/commits?project=${encodeURIComponent(e.name)}&limit=10`)).json();!U.error&&U.commits&&S(U.commits)}catch(P){console.error("Error fetching commits:",P)}},Ot=async P=>{try{const B=await(await Pe(`/api/git/commit-diff?project=${encodeURIComponent(e.name)}&commit=${P}`)).json();!B.error&&B.diff&&ae(N=>({...N,[P]:B.diff}))}catch(U){console.error("Error fetching commit diff:",U)}},Qt=async()=>{Ee(!0);try{const U=await(await Pe("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,files:Array.from(p),provider:Lt})})).json();U.message?u(U.message):console.error("Failed to generate commit message:",U.error)}catch(P){console.error("Error generating commit message:",P)}finally{Ee(!1)}},vt=P=>{h(U=>{const B=new Set(U);return B.has(P)?B.delete(P):B.add(P),B})},Vt=P=>{$e(U=>{const B=new Set(U);return B.has(P)?B.delete(P):(B.add(P),v[P]||Ot(P)),B})},Ct=P=>{g(U=>{const B=new Set(U);return B.has(P)?B.delete(P):B.add(P),B})},Gt=async()=>{if(!(!d.trim()||p.size===0)){b(!0);try{const U=await(await Pe("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,message:d,files:Array.from(p)})})).json();U.success?(u(""),g(new Set),de(),D()):console.error("Commit failed:",U.error)}catch(P){console.error("Error committing changes:",P)}finally{b(!1)}}},ft=P=>{switch(P){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return P}},A=P=>{const U=Ae.has(P.hash),B=v[P.hash];return t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[t.jsxs("div",{className:"flex items-start p-3 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer",onClick:()=>Vt(P.hash),children:[t.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:U?t.jsx(Wt,{className:"w-3 h-3"}):t.jsx(wr,{className:"w-3 h-3"})}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:P.message}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[P.author," • ",P.date]})]}),t.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:P.hash.substring(0,7)})]})})]}),U&&B&&t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:t.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[t.jsx("div",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 mb-2",children:P.stats}),t.jsx(El,{diff:B,fileName:"commit",isMobile:r,wrapText:H})]})})]},P.hash)},ne=(P,U)=>{const B=m.has(P),N=p.has(P),X=i[P];return t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[t.jsxs("div",{className:`flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 ${r?"px-2 py-1.5":"px-3 py-2"}`,children:[t.jsx("input",{type:"checkbox",checked:N,onChange:()=>Ct(P),onClick:pe=>pe.stopPropagation(),className:`rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600 ${r?"mr-1.5":"mr-2"}`}),t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:`p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer ${r?"mr-1":"mr-2"}`,onClick:pe=>{pe.stopPropagation(),vt(P)},children:t.jsx(wr,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${B?"rotate-90":"rotate-0"}`})}),t.jsx("span",{className:`flex-1 truncate ${r?"text-xs":"text-sm"} cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 hover:underline`,onClick:pe=>{pe.stopPropagation(),ct(P)},title:"Click to open file",children:P}),t.jsxs("div",{className:"flex items-center gap-1",children:[(U==="M"||U==="D")&&t.jsxs("button",{onClick:pe=>{pe.stopPropagation(),Oe({type:"discard",file:P,message:`Discard all changes to "${P}"? This action cannot be undone.`})},className:`${r?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Discard changes",children:[t.jsx(Jt,{className:"w-3 h-3"}),r&&t.jsx("span",{children:"Discard"})]}),U==="U"&&t.jsxs("button",{onClick:pe=>{pe.stopPropagation(),Oe({type:"delete",file:P,message:`Delete untracked file "${P}"? This action cannot be undone.`})},className:`${r?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Delete untracked file",children:[t.jsx(Jt,{className:"w-3 h-3"}),r&&t.jsx("span",{children:"Delete"})]}),t.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${U==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":U==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":U==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,title:ft(U),children:U})]})]})]}),t.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${B&&X?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[t.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${U==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":U==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":U==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,children:U}),t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:ft(U)})]}),r&&t.jsx("button",{onClick:pe=>{pe.stopPropagation(),M(!H)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:H?"Switch to horizontal scroll":"Switch to text wrap",children:H?"↔️ Scroll":"↩️ Wrap"})]}),t.jsx("div",{className:"max-h-96 overflow-y-auto",children:X&&t.jsx(El,{diff:X,fileName:P,isMobile:r,wrapText:H})})]})]},P)};return e?t.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[t.jsxs("div",{className:`flex items-center justify-between border-b border-gray-200 dark:border-gray-700 ${r?"px-3 py-2":"px-4 py-3"}`,children:[t.jsxs("div",{className:"relative",ref:Ie,children:[t.jsxs("button",{onClick:()=>j(!q),className:`flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors ${r?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[t.jsx(xa,{className:`text-gray-600 dark:text-gray-400 ${r?"w-3 h-3":"w-4 h-4"}`}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:`font-medium ${r?"text-xs":"text-sm"}`,children:k}),ie?.hasRemote&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[ie.ahead>0&&t.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${ie.ahead} commit${ie.ahead!==1?"s":""} ahead`,children:["↑",ie.ahead]}),ie.behind>0&&t.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${ie.behind} commit${ie.behind!==1?"s":""} behind`,children:["↓",ie.behind]}),ie.isUpToDate&&t.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"✓"})]})]}),t.jsx(Wt,{className:`w-3 h-3 text-gray-500 transition-transform ${q?"rotate-180":""}`})]}),q&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:[t.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:y.map(P=>t.jsx("button",{onClick:()=>Y(P),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${P===k?"bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[P===k&&t.jsx(Dr,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),t.jsx("span",{className:P===k?"font-medium":"",children:P})]})},P))}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:t.jsxs("button",{onClick:()=>{I(!0),j(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2",children:[t.jsx(St,{className:"w-3 h-3"}),t.jsx("span",{children:"Create new branch"})]})})]})]}),t.jsxs("div",{className:`flex items-center ${r?"gap-1":"gap-2"}`,children:[ie?.hasRemote&&t.jsxs(t.Fragment,{children:[!ie?.hasUpstream&&t.jsxs("button",{onClick:()=>Oe({type:"publish",message:`Publish branch "${k}" to ${ie.remoteName}?`}),disabled:Ue,className:"px-2 py-1 text-xs bg-purple-600 text-white rounded hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1",title:`Publish branch "${k}" to ${ie.remoteName}`,children:[t.jsx(Yn,{className:`w-3 h-3 ${Ue?"animate-pulse":""}`}),t.jsx("span",{children:Ue?"Publishing...":"Publish"})]}),ie?.hasUpstream&&!ie?.isUpToDate&&t.jsxs(t.Fragment,{children:[ie.behind>0&&t.jsxs("button",{onClick:()=>Oe({type:"pull",message:`Pull ${ie.behind} commit${ie.behind!==1?"s":""} from ${ie.remoteName}?`}),disabled:fe,className:"px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center gap-1",title:`Pull ${ie.behind} commit${ie.behind!==1?"s":""} from ${ie.remoteName}`,children:[t.jsx(ls,{className:`w-3 h-3 ${fe?"animate-pulse":""}`}),t.jsx("span",{children:fe?"Pulling...":`Pull ${ie.behind}`})]}),ie.ahead>0&&t.jsxs("button",{onClick:()=>Oe({type:"push",message:`Push ${ie.ahead} commit${ie.ahead!==1?"s":""} to ${ie.remoteName}?`}),disabled:ve,className:"px-2 py-1 text-xs bg-orange-600 text-white rounded hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1",title:`Push ${ie.ahead} commit${ie.ahead!==1?"s":""} to ${ie.remoteName}`,children:[t.jsx(Yn,{className:`w-3 h-3 ${ve?"animate-pulse":""}`}),t.jsx("span",{children:ve?"Pushing...":`Push ${ie.ahead}`})]}),(ie.ahead>0||ie.behind>0&&ie.ahead>0)&&t.jsxs("button",{onClick:se,disabled:re,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1",title:`Fetch from ${ie.remoteName}`,children:[t.jsx(vr,{className:`w-3 h-3 ${re?"animate-spin":""}`}),t.jsx("span",{children:re?"Fetching...":"Fetch"})]})]})]}),t.jsx("button",{onClick:()=>{de(),z(),D()},disabled:l,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${r?"p-1":"p-1.5"}`,children:t.jsx(vr,{className:`${l?"animate-spin":""} ${r?"w-3 h-3":"w-4 h-4"}`})})]})]}),s?.error?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 px-6 py-12",children:[t.jsx(xa,{className:"w-20 h-20 mb-6 opacity-30"}),t.jsx("h3",{className:"text-xl font-medium mb-3 text-center",children:s.error}),s.details&&t.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:s.details}),t.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 max-w-md",children:t.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300 text-center",children:[t.jsx("strong",{children:"Tip:"})," Run ",t.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`flex border-b border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out ${m.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[t.jsx("button",{onClick:()=>K("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${$==="changes"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx(Tt,{className:"w-4 h-4"}),t.jsx("span",{children:"Changes"})]})}),t.jsx("button",{onClick:()=>K("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${$==="history"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx(Gi,{className:"w-4 h-4"}),t.jsx("span",{children:"History"})]})})]}),$==="changes"&&t.jsx(t.Fragment,{children:t.jsx("div",{className:`transition-all duration-300 ease-in-out ${m.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:r&&De?t.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("button",{onClick:()=>ye(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700",children:[t.jsx(Vi,{className:"w-4 h-4"}),t.jsxs("span",{children:["Commit ",p.size," file",p.size!==1?"s":""]}),t.jsx(Wt,{className:"w-3 h-3"})]})}):t.jsx(t.Fragment,{children:t.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[r&&t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Commit Changes"}),t.jsx("button",{onClick:()=>ye(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:t.jsx(Wt,{className:"w-4 h-4 rotate-180"})})]}),t.jsxs("div",{className:"relative",children:[t.jsx("textarea",{ref:st,value:d,onChange:P=>u(P.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 resize-none pr-20",rows:"3",onKeyDown:P=>{P.key==="Enter"&&(P.ctrlKey||P.metaKey)&&Gt()}}),t.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[t.jsx("button",{onClick:Qt,disabled:p.size===0||me,className:"p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",title:"Generate commit message",children:me?t.jsx(vr,{className:"w-4 h-4 animate-spin"}):t.jsx(Lr,{className:"w-4 h-4"})}),t.jsx("div",{style:{display:"none"},children:t.jsx(Ad,{onTranscript:P=>u(P),mode:"default",className:"p-1.5"})})]})]}),t.jsxs("div",{className:"flex items-center justify-between mt-2",children:[t.jsxs("span",{className:"text-xs text-gray-500",children:[p.size," file",p.size!==1?"s":""," selected"]}),t.jsxs("button",{onClick:()=>Oe({type:"commit",message:`Commit ${p.size} file${p.size!==1?"s":""} with message: "${d.trim()}"?`}),disabled:!d.trim()||p.size===0||x,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",children:[t.jsx(Dr,{className:"w-3 h-3"}),t.jsx("span",{children:x?"Committing...":"Commit"})]})]})]})})})}),$==="changes"&&s&&!s.error&&t.jsxs("div",{className:`border-b border-gray-200 dark:border-gray-700 flex items-center justify-between transition-all duration-300 ease-in-out ${r?"px-3 py-1.5":"px-4 py-2"} ${m.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[t.jsxs("span",{className:"text-gray-600 dark:text-gray-400 text-xs",children:[p.size," of ",(s?.modified?.length||0)+(s?.added?.length||0)+(s?.deleted?.length||0)+(s?.untracked?.length||0)," ",r?"":"files"," selected"]}),t.jsxs("div",{className:`flex ${r?"gap-1":"gap-2"}`,children:[t.jsx("button",{onClick:()=>{const P=new Set([...s?.modified||[],...s?.added||[],...s?.deleted||[],...s?.untracked||[]]);g(P)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:r?"All":"Select All"}),t.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),t.jsx("button",{onClick:()=>g(new Set),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:r?"None":"Deselect All"})]})]}),!s?.error&&!r&&t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("button",{onClick:()=>L(!O),className:"w-full px-4 py-2 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750 text-xs text-gray-600 dark:text-gray-400 flex items-center justify-center gap-1",children:[t.jsx($p,{className:"w-3 h-3"}),t.jsx("span",{children:"File Status Guide"}),O?t.jsx(Wt,{className:"w-3 h-3"}):t.jsx(wr,{className:"w-3 h-3"})]}),O&&t.jsx("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-800 text-xs",children:t.jsxs("div",{className:`${r?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800 font-bold text-xs",children:"M"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Modified"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 rounded border border-green-200 dark:border-green-800 font-bold text-xs",children:"A"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Added"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 rounded border border-red-200 dark:border-red-800 font-bold text-xs",children:"D"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Deleted"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 rounded border border-gray-300 dark:border-gray-600 font-bold text-xs",children:"U"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Untracked"})]})]})})]})]}),$==="changes"&&!s?.error&&t.jsx("div",{className:`flex-1 overflow-y-auto ${r?"pb-20":""}`,children:l?t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(vr,{className:"w-6 h-6 animate-spin text-gray-400"})}):!s||!s.modified?.length&&!s.added?.length&&!s.deleted?.length&&!s.untracked?.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[t.jsx(Vi,{className:"w-12 h-12 mb-2 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No changes detected"})]}):t.jsxs("div",{className:r?"pb-4":"",children:[s.modified?.map(P=>ne(P,"M")),s.added?.map(P=>ne(P,"A")),s.deleted?.map(P=>ne(P,"D")),s.untracked?.map(P=>ne(P,"U"))]})}),$==="history"&&!s?.error&&t.jsx("div",{className:`flex-1 overflow-y-auto ${r?"pb-20":""}`,children:l?t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(vr,{className:"w-6 h-6 animate-spin text-gray-400"})}):ce.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[t.jsx(Gi,{className:"w-12 h-12 mb-2 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No commits found"})]}):t.jsx("div",{className:r?"pb-4":"",children:ce.map(P=>A(P))})}),T&&t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>I(!1)}),t.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:t.jsxs("div",{className:"p-6",children:[t.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Branch"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Branch Name"}),t.jsx("input",{type:"text",value:_,onChange:P=>w(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!W&&Z()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:["This will create a new branch from the current branch (",k,")"]}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>{I(!1),w("")},className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),t.jsx("button",{onClick:Z,disabled:!_.trim()||W,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:W?t.jsxs(t.Fragment,{children:[t.jsx(vr,{className:"w-3 h-3 animate-spin"}),t.jsx("span",{children:"Creating..."})]}):t.jsxs(t.Fragment,{children:[t.jsx(St,{className:"w-3 h-3"}),t.jsx("span",{children:"Create Branch"})]})})]})]})})]}),ke&&t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>Oe(null)}),t.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:`p-2 rounded-full mr-3 ${ke.type==="discard"||ke.type==="delete"?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"}`,children:t.jsx(Nn,{className:`w-5 h-5 ${ke.type==="discard"||ke.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),t.jsx("h3",{className:"text-lg font-semibold",children:ke.type==="discard"?"Discard Changes":ke.type==="delete"?"Delete File":ke.type==="commit"?"Confirm Commit":ke.type==="pull"?"Confirm Pull":ke.type==="publish"?"Publish Branch":"Confirm Push"})]}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:ke.message}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>Oe(null),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),t.jsx("button",{onClick:We,className:`px-4 py-2 text-sm text-white rounded-md ${ke.type==="discard"||ke.type==="delete"?"bg-red-600 hover:bg-red-700":ke.type==="commit"?"bg-blue-600 hover:bg-blue-700":ke.type==="pull"?"bg-green-600 hover:bg-green-700":ke.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:ke.type==="discard"?t.jsxs(t.Fragment,{children:[t.jsx(Jt,{className:"w-4 h-4"}),t.jsx("span",{children:"Discard"})]}):ke.type==="delete"?t.jsxs(t.Fragment,{children:[t.jsx(Jt,{className:"w-4 h-4"}),t.jsx("span",{children:"Delete"})]}):ke.type==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(Dr,{className:"w-4 h-4"}),t.jsx("span",{children:"Commit"})]}):ke.type==="pull"?t.jsxs(t.Fragment,{children:[t.jsx(ls,{className:"w-4 h-4"}),t.jsx("span",{children:"Pull"})]}):ke.type==="publish"?t.jsxs(t.Fragment,{children:[t.jsx(Yn,{className:"w-4 h-4"}),t.jsx("span",{children:"Publish"})]}):t.jsxs(t.Fragment,{children:[t.jsx(Yn,{className:"w-4 h-4"}),t.jsx("span",{children:"Push"})]})})]})]})})]})]}):t.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:t.jsx("p",{children:"Select a project to view source control"})})}class t1 extends cr.Component{constructor(r){super(r),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(r){return{hasError:!0}}componentDidCatch(r,n){console.error("ErrorBoundary caught an error:",r,n),this.setState({error:r,errorInfo:n})}render(){return this.state.hasError?t.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:t.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),t.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),t.jsxs("div",{className:"text-sm text-red-700",children:[t.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),this.props.showDetails&&this.state.error&&t.jsxs("details",{className:"mt-4",children:[t.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"Error Details"}),t.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})}):this.props.children}}const Dt=({children:e,content:r,position:n="top",className:s="",delay:a=500})=>{const[i,o]=f.useState(!1),[l,c]=f.useState(null),d=()=>{const p=setTimeout(()=>{o(!0)},a);c(p)},u=()=>{l&&(clearTimeout(l),c(null)),o(!1)},m=()=>{switch(n){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},h=()=>{switch(n){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}};return r?t.jsxs("div",{className:"relative inline-block",onMouseEnter:d,onMouseLeave:u,children:[e,i&&t.jsxs("div",{className:Ce("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",m(),s),children:[r,t.jsx("div",{className:Ce("absolute w-0 h-0 border-4 border-transparent",h())})]})]}):e},Il=({task:e,onClick:r,showParent:n=!1,className:s=""})=>{const i=(l=>{switch(l){case"done":return{icon:Rn,bgColor:"bg-green-50 dark:bg-green-950",borderColor:"border-green-200 dark:border-green-800",iconColor:"text-green-600 dark:text-green-400",textColor:"text-green-900 dark:text-green-100",statusText:"Done"};case"in-progress":return{icon:In,bgColor:"bg-blue-50 dark:bg-blue-950",borderColor:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-600 dark:text-blue-400",textColor:"text-blue-900 dark:text-blue-100",statusText:"In Progress"};case"review":return{icon:Qa,bgColor:"bg-amber-50 dark:bg-amber-950",borderColor:"border-amber-200 dark:border-amber-800",iconColor:"text-amber-600 dark:text-amber-400",textColor:"text-amber-900 dark:text-amber-100",statusText:"Review"};case"deferred":return{icon:ic,bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-gray-200 dark:border-gray-700",iconColor:"text-gray-500 dark:text-gray-400",textColor:"text-gray-700 dark:text-gray-300",statusText:"Deferred"};case"cancelled":return{icon:ot,bgColor:"bg-red-50 dark:bg-red-950",borderColor:"border-red-200 dark:border-red-800",iconColor:"text-red-600 dark:text-red-400",textColor:"text-red-900 dark:text-red-100",statusText:"Cancelled"};case"pending":default:return{icon:Vr,bgColor:"bg-slate-50 dark:bg-slate-800",borderColor:"border-slate-200 dark:border-slate-700",iconColor:"text-slate-500 dark:text-slate-400",textColor:"text-slate-900 dark:text-slate-100",statusText:"Pending"}}})(e.status);i.icon;const o=l=>{switch(l){case"high":return t.jsx(Dt,{content:"High Priority",children:t.jsx("div",{className:"w-4 h-4 bg-red-100 dark:bg-red-900/30 rounded flex items-center justify-center",children:t.jsx(np,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})});case"medium":return t.jsx(Dt,{content:"Medium Priority",children:t.jsx("div",{className:"w-4 h-4 bg-amber-100 dark:bg-amber-900/30 rounded flex items-center justify-center",children:t.jsx(Xp,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})})});case"low":return t.jsx(Dt,{content:"Low Priority",children:t.jsx("div",{className:"w-4 h-4 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center",children:t.jsx(Vr,{className:"w-1.5 h-1.5 text-blue-600 dark:text-blue-400 fill-current"})})});default:return t.jsx(Dt,{content:"No Priority Set",children:t.jsx("div",{className:"w-4 h-4 bg-gray-100 dark:bg-gray-800 rounded flex items-center justify-center",children:t.jsx(Vr,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return t.jsxs("div",{className:Ce("bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700","hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200 cursor-pointer","p-3 space-y-3",r&&"hover:-translate-y-0.5",s),onClick:r,children:[t.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx(Dt,{content:`Task ID: ${e.id}`,children:t.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:e.id})})}),t.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-white line-clamp-2 leading-tight",children:e.title}),n&&e.parentId&&t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["Task ",e.parentId]})]}),t.jsx("div",{className:"flex-shrink-0",children:o(e.priority)})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex items-center",children:e.dependencies&&Array.isArray(e.dependencies)&&e.dependencies.length>0&&t.jsx(Dt,{content:`Depends on: ${e.dependencies.map(l=>`Task ${l}`).join(", ")}`,children:t.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[t.jsx(Ya,{className:"w-3 h-3"}),t.jsxs("span",{children:["Depends on: ",e.dependencies.join(", ")]})]})})}),t.jsx(Dt,{content:`Status: ${i.statusText}`,children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:Ce("w-2 h-2 rounded-full",i.iconColor.replace("text-","bg-"))}),t.jsx("span",{className:Ce("text-xs font-medium",i.textColor),children:i.statusText})]})})]}),e.subtasks&&e.subtasks.length>0&&t.jsx("div",{className:"ml-3",children:t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Progress:"}),t.jsx(Dt,{content:`${e.subtasks.filter(l=>l.status==="done").length} of ${e.subtasks.length} subtasks completed`,children:t.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5",children:t.jsx("div",{className:Ce("h-full rounded-full transition-all duration-300",e.status==="done"?"bg-green-500":"bg-blue-500"),style:{width:`${Math.round(e.subtasks.filter(l=>l.status==="done").length/e.subtasks.length*100)}%`}})})}),t.jsx(Dt,{content:`${e.subtasks.filter(l=>l.status==="done").length} completed, ${e.subtasks.filter(l=>l.status==="pending").length} pending, ${e.subtasks.filter(l=>l.status==="in-progress").length} in progress`,children:t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.subtasks.filter(l=>l.status==="done").length,"/",e.subtasks.length]})})]})})]})},r1=({currentProject:e,onClose:r,onTaskCreated:n})=>t.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Lr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create AI-Generated Task"})]}),t.jsx("button",{onClick:r,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:t.jsx(ot,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"p-6 space-y-6",children:[t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(Lr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),t.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"You can simply ask Claude Code in the chat to create tasks for you. The AI assistant will automatically generate detailed tasks with research-backed insights."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-blue-200 dark:border-blue-700 p-3 mb-3",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Example:"}),t.jsx("p",{className:"text-sm text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),t.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[t.jsx("strong",{children:"This runs:"})," ",t.jsx("code",{className:"bg-blue-100 dark:bg-blue-900/50 px-1 rounded text-xs",children:'task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research'})]})]})]})}),t.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),t.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),t.jsx("div",{className:"pt-4",children:t.jsx("button",{onClick:r,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),n1=({tasks:e=[],onTaskClick:r,className:n="",showParentTasks:s=!1,defaultView:a="kanban",currentProject:i,onTaskCreated:o,onShowPRDEditor:l,existingPRDs:c=[],onRefreshPRDs:d})=>{const[u,m]=f.useState(""),[h,p]=f.useState("all"),[g,x]=f.useState("all"),[b,k]=f.useState("id"),[C,y]=f.useState("asc"),[R,H]=f.useState(a),[M,O]=f.useState(!1),[L,q]=f.useState(!1),[j,T]=f.useState(!1),[I,_]=f.useState(!1),[w,W]=f.useState(!1),[F,$]=f.useState(!1),{projectTaskMaster:K,refreshProjects:ce,refreshTasks:S,setCurrentProject:Ae}=_n();f.useEffect(()=>{const re=le=>{F&&!le.target.closest(".relative")&&$(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[F]);const $e=f.useMemo(()=>{const re=new Set(e.map(le=>le.status).filter(Boolean));return Array.from(re).sort()},[e]),v=f.useMemo(()=>{const re=new Set(e.map(le=>le.priority).filter(Boolean));return Array.from(re).sort()},[e]),ae=f.useMemo(()=>{let re=e.filter(le=>{const fe=u.toLowerCase(),we=!u||le.title.toLowerCase().includes(fe)||le.description?.toLowerCase().includes(fe)||le.id.toString().includes(fe),ve=h==="all"||le.status===h,Ye=g==="all"||le.priority===g;return we&&ve&&Ye});return re.sort((le,fe)=>{let we,ve;switch(b){case"title":we=le.title.toLowerCase(),ve=fe.title.toLowerCase();break;case"status":const Ye={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};we=Ye[le.status]||99,ve=Ye[fe.status]||99;break;case"priority":const Ue={high:3,medium:2,low:1};we=Ue[le.priority]||0,ve=Ue[fe.priority]||0;break;case"updated":we=new Date(le.updatedAt||le.createdAt||0),ve=new Date(fe.updatedAt||fe.createdAt||0);break;case"id":default:const at=ke=>ke.toString().split(".").map(st=>parseInt(st,10)),De=at(le.id),ye=at(fe.id);for(let ke=0;ke<Math.max(De.length,ye.length);ke++){const Oe=De[ke]||0,st=ye[ke]||0;if(Oe!==st){we=Oe,ve=st;break}}break}return b==="updated"?C==="asc"?we-ve:ve-we:typeof we=="string"?C==="asc"?we.localeCompare(ve):ve.localeCompare(we):C==="asc"?we-ve:ve-we}),re},[e,u,h,g,b,C]),me=f.useMemo(()=>{const re=[{id:"pending",title:"📋 To Do",status:"pending",color:"bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-700",headerColor:"bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200"},{id:"in-progress",title:"🚀 In Progress",status:"in-progress",color:"bg-blue-50 dark:bg-blue-900/50 border-blue-200 dark:border-blue-700",headerColor:"bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200"},{id:"done",title:"✅ Done",status:"done",color:"bg-emerald-50 dark:bg-emerald-900/50 border-emerald-200 dark:border-emerald-700",headerColor:"bg-emerald-100 dark:bg-emerald-800 text-emerald-800 dark:text-emerald-200"},{id:"blocked",title:"🚫 Blocked",status:"blocked",color:"bg-red-50 dark:bg-red-900/50 border-red-200 dark:border-red-700",headerColor:"bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-200"},{id:"deferred",title:"⏳ Deferred",status:"deferred",color:"bg-amber-50 dark:bg-amber-900/50 border-amber-200 dark:border-amber-700",headerColor:"bg-amber-100 dark:bg-amber-800 text-amber-800 dark:text-amber-200"},{id:"cancelled",title:"❌ Cancelled",status:"cancelled",color:"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700",headerColor:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200"}],le=["pending","in-progress","done"];return re.filter(we=>{const ve=ae.some(Ue=>Ue.status===we.status),Ye=le.includes(we.status);return ve||Ye}).map(we=>({...we,tasks:ae.filter(ve=>ve.status===we.status)}))},[ae]),Ee=re=>{b===re?y(C==="asc"?"desc":"asc"):(k(re),y("asc"))},ie=()=>{m(""),p("all"),x("all")},qe=re=>b!==re?t.jsx(Gm,{className:"w-4 h-4"}):C==="asc"?t.jsx(Jm,{className:"w-4 h-4"}):t.jsx(Xl,{className:"w-4 h-4"});if(e.length===0){const re=i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||K?.hasTaskmaster;return t.jsxs("div",{className:Ce("text-center py-12",n),children:[re?t.jsxs("div",{className:"max-w-4xl mx-auto",children:[t.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-xl border border-blue-200 dark:border-blue-800 p-6 mb-6",children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Tt,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster is initialized! Here's what to do next:"})]})]}),t.jsxs("div",{className:"space-y-4 text-left",children:[t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"1"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Create a Product Requirements Document (PRD)"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Discuss your project idea and create a PRD that describes what you want to build."}),t.jsxs("button",{onClick:()=>{l?.()},className:"inline-flex items-center gap-1 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-1 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[t.jsx(Tt,{className:"w-3 h-3"}),"Add PRD"]}),c.length>0&&t.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Existing PRDs:"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(le=>t.jsxs("button",{onClick:async()=>{try{const fe=await Fe.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(le.name)}`);if(fe.ok){const we=await fe.json();l?.({name:le.name,content:we.content,isExisting:!0})}else console.error("Failed to load PRD:",fe.statusText)}catch(fe){console.error("Error loading PRD:",fe)}},className:"inline-flex items-center gap-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 px-2 py-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[t.jsx(Tt,{className:"w-3 h-3"}),le.name]},le.name))})]})]})]}),t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"2"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Generate Tasks from PRD"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."})]})]}),t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"3"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Analyze & Expand Tasks"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."})]})]}),t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"4"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Start Building"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."})]})]})]}),t.jsx("div",{className:"flex gap-3 pt-4 border-t border-blue-200 dark:border-blue-700",children:t.jsxs("button",{onClick:le=>{le.preventDefault(),le.stopPropagation(),l?.()},className:"flex items-center gap-2 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-colors cursor-pointer",style:{zIndex:10},children:[t.jsx(Tt,{className:"w-4 h-4"}),"Add PRD"]})})]})]}),t.jsx("div",{className:"text-center",children:t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:["💡 ",t.jsx("strong",{children:"Tip:"})," Start with a PRD to get the most out of TaskMaster's AI-powered task generation"]})})]}):t.jsxs("div",{className:"max-w-md mx-auto",children:[t.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-4",children:t.jsx(Qr,{className:"w-12 h-12 mx-auto mb-4"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"TaskMaster AI is not configured"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance"}),t.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-950 rounded-lg text-left",children:[t.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-3",children:"🎯 What is TaskMaster?"}),t.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[t.jsxs("p",{children:["• ",t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),t.jsxs("button",{onClick:()=>{W(!1),T(!0)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors flex items-center gap-2 mx-auto",children:[t.jsx(Xr,{className:"w-4 h-4"}),"Initialize TaskMaster AI"]})]}),j&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center p-4 pt-16 bg-black/50 backdrop-blur-sm",children:t.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Xr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),t.jsx("button",{onClick:()=>{T(!1),setTimeout(()=>{ce(),i&&Ae(i)},1e3)},className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:t.jsx(St,{className:"w-5 h-5 rotate-45"})})]}),t.jsx("div",{className:"flex-1 p-4",children:t.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",onClick:le=>{const fe=le.currentTarget.querySelector(".xterm-screen");fe&&fe.focus()},children:t.jsx(bi,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:le=>{W(!0),le===0&&setTimeout(()=>{ce(),i&&Ae(i)},1e3)}})})}),t.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:w?t.jsxs("span",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[t.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"TaskMaster setup completed! You can now close this window."]}):"TaskMaster initialization will start automatically"}),t.jsx("button",{onClick:()=>{T(!1),W(!1),setTimeout(()=>{ce(),i&&Ae(i)},1e3)},className:Ce("px-4 py-2 text-sm font-medium rounded-md transition-colors",w?"bg-green-600 hover:bg-green-700 text-white":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"),children:w?"Close & Continue":"Close"})]})})]})})]})}return t.jsxs("div",{className:Ce("space-y-4",n),children:[t.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[t.jsxs("div",{className:"relative flex-1 max-w-md",children:[t.jsx(Yr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),t.jsx("input",{type:"text",placeholder:"Search tasks...",value:u,onChange:re=>m(re.target.value),className:"pl-10 pr-4 py-2 w-full border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[t.jsx("button",{onClick:()=>H("kanban"),className:Ce("p-2 rounded-md transition-colors",R==="kanban"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Kanban view",children:t.jsx(pp,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>H("list"),className:Ce("p-2 rounded-md transition-colors",R==="list"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"List view",children:t.jsx(cs,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>H("grid"),className:Ce("p-2 rounded-md transition-colors",R==="grid"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Grid view",children:t.jsx(_p,{className:"w-4 h-4"})})]}),t.jsxs("button",{onClick:()=>O(!M),className:Ce("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",M?"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700 text-blue-700 dark:text-blue-300":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),children:[t.jsx(Ap,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),t.jsx(Wt,{className:Ce("w-4 h-4 transition-transform",M&&"rotate-180")})]}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>_(!0),className:"p-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors border border-gray-300 dark:border-gray-600",title:"TaskMaster Getting Started Guide",children:t.jsx(cp,{className:"w-4 h-4"})}),t.jsx("div",{className:"relative",children:c.length>0?t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>$(!F),className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:`${c.length} PRD${c.length>1?"s":""} available`,children:[t.jsx(Tt,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"PRDs"}),t.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-500 rounded-full min-w-[1.25rem] text-center",children:c.length}),t.jsx(Wt,{className:Ce("w-3 h-3 transition-transform hidden sm:block",F&&"rotate-180")})]}),F&&t.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl z-30",children:t.jsxs("div",{className:"p-2",children:[t.jsxs("button",{onClick:()=>{l?.(),$(!1)},className:"w-full text-left px-3 py-2 text-sm font-medium text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded flex items-center gap-2",children:[t.jsx(St,{className:"w-4 h-4"}),"Create New PRD"]}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1 font-medium",children:"Existing PRDs:"}),c.map(re=>t.jsxs("button",{onClick:async()=>{try{const le=await Fe.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(re.name)}`);if(le.ok){const fe=await le.json();l?.({name:re.name,content:fe.content,isExisting:!0}),$(!1)}}catch(le){console.error("Error loading PRD:",le)}},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded flex items-center gap-2",title:`Modified: ${new Date(re.modified).toLocaleDateString()}`,children:[t.jsx(Tt,{className:"w-4 h-4"}),t.jsx("span",{className:"truncate",children:re.name})]},re.name))]})})]}):t.jsxs("button",{onClick:()=>{l?.()},className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:"Create Product Requirements Document",children:[t.jsx(Tt,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Add PRD"})]})}),(i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||K?.hasTaskmaster||e.length>0)&&t.jsxs("button",{onClick:()=>q(!0),className:"flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium",title:"Add a new task",children:[t.jsx(St,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),M&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),t.jsxs("select",{value:h,onChange:re=>p(re.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All Statuses"}),$e.map(re=>t.jsx("option",{value:re,children:re.charAt(0).toUpperCase()+re.slice(1).replace("-"," ")},re))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),t.jsxs("select",{value:g,onChange:re=>x(re.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All Priorities"}),v.map(re=>t.jsx("option",{value:re,children:re.charAt(0).toUpperCase()+re.slice(1)},re))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sort By"}),t.jsxs("select",{value:`${b}-${C}`,onChange:re=>{const[le,fe]=re.target.value.split("-");k(le),y(fe)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"id-asc",children:"ID (Ascending)"}),t.jsx("option",{value:"id-desc",children:"ID (Descending)"}),t.jsx("option",{value:"title-asc",children:"Title (A-Z)"}),t.jsx("option",{value:"title-desc",children:"Title (Z-A)"}),t.jsx("option",{value:"status-asc",children:"Status (Pending First)"}),t.jsx("option",{value:"status-desc",children:"Status (Done First)"}),t.jsx("option",{value:"priority-asc",children:"Priority (High First)"}),t.jsx("option",{value:"priority-desc",children:"Priority (Low First)"})]})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",ae.length," of ",e.length," tasks"]}),t.jsx("button",{onClick:ie,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Clear Filters"})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsxs("button",{onClick:()=>Ee("id"),className:Ce("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",b==="id"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["ID ",qe("id")]}),t.jsxs("button",{onClick:()=>Ee("status"),className:Ce("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",b==="status"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Status ",qe("status")]}),t.jsxs("button",{onClick:()=>Ee("priority"),className:Ce("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",b==="priority"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Priority ",qe("priority")]})]}),ae.length===0?t.jsx("div",{className:"text-center py-12",children:t.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:[t.jsx(Yr,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tasks match your filters"}),t.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria."})]})}):R==="kanban"?t.jsx("div",{className:Ce("grid gap-6",me.length===1&&"grid-cols-1 max-w-md mx-auto",me.length===2&&"grid-cols-1 md:grid-cols-2",me.length===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",me.length===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",me.length===5&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",me.length>=6&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"),children:me.map(re=>t.jsxs("div",{className:Ce("rounded-xl border shadow-sm transition-shadow hover:shadow-md",re.color),children:[t.jsx("div",{className:Ce("px-4 py-3 rounded-t-xl border-b",re.headerColor),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"font-semibold text-sm",children:re.title}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("span",{className:"text-xs font-medium px-2 py-1 bg-white/60 dark:bg-black/20 rounded-full",children:re.tasks.length})})]})}),t.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:re.tasks.length===0?t.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[t.jsx("div",{className:"w-8 h-8 mx-auto mb-2 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:t.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-300 dark:bg-gray-600"})}),t.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"No tasks yet"}),t.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:re.status==="pending"?"Tasks will appear here":re.status==="in-progress"?"Move tasks here when started":re.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):re.tasks.map(le=>t.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:t.jsx(Il,{task:le,onClick:()=>r?.(le),showParent:s,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},le.id))})]},re.id))}):t.jsx("div",{className:Ce("gap-4",R==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:ae.map(re=>t.jsx(Il,{task:re,onClick:()=>r?.(re),showParent:s,className:R==="grid"?"h-full":""},re.id))}),L&&t.jsx(r1,{currentProject:i,onClose:()=>q(!1),onTaskCreated:()=>{q(!1),o&&o()}}),I&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:t.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Tt,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Your guide to productive task management"})]})]}),t.jsx("button",{onClick:()=>_(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:t.jsx(ot,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-120px)]",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-blue-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"1"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Create a Product Requirements Document (PRD)"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Discuss your project idea and create a PRD that describes what you want to build."}),t.jsxs("button",{onClick:()=>{l?.(),_(!1)},className:"inline-flex items-center gap-2 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-3 py-1.5 rounded-lg hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[t.jsx(Tt,{className:"w-4 h-4"}),"Add PRD"]})]})]}),t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/50 dark:to-emerald-950/50 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"2"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Generate Tasks from PRD"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-green-200 dark:border-green-700/50 p-3 mb-2",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`})]})]})]}),t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/50 dark:to-orange-950/50 rounded-lg border border-amber-200 dark:border-amber-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-amber-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"3"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Analyze & Expand Tasks"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-amber-200 dark:border-amber-700/50 p-3 mb-2",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Task 5 seems complex. Can you break it down into subtasks?"'})]})]})]}),t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950/50 dark:to-pink-950/50 rounded-lg border border-purple-200 dark:border-purple-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-purple-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"4"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Start Building"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-purple-200 dark:border-purple-700/50 p-3 mb-3",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),t.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"View more examples and usage patterns →"})]})]}),t.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-3",children:"💡 Pro Tips"}),t.jsxs("ul",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),"Use the search bar to quickly find specific tasks"]}),t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full mt-2 flex-shrink-0"}),"Switch between Kanban, List, and Grid views using the view toggles"]}),t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-purple-500 rounded-full mt-2 flex-shrink-0"}),"Use filters to focus on specific task statuses or priorities"]}),t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-orange-500 rounded-full mt-2 flex-shrink-0"}),"Click on any task to view detailed information and manage subtasks"]})]})]}),t.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-3",children:"📚 Learn More"}),t.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project."}),t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded-lg font-medium transition-colors",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})})]})})]})},s1=({file:e,onClose:r,projectPath:n,project:s,initialContent:a="",isNewFile:i=!1,onSave:o})=>{const[l,c]=f.useState(a),[d,u]=f.useState(!i),[m,h]=f.useState(!1),[p,g]=f.useState(!1),[x,b]=f.useState(!0),[k,C]=f.useState(!1),[y,R]=f.useState(!1),[H,M]=f.useState(!0),[O,L]=f.useState(""),[q,j]=f.useState(!1),[T,I]=f.useState(!1),[_,w]=f.useState([]),W=f.useRef(null),F=`# Product Requirements Document - Example Project
616
-
617
- ## 1. Overview
618
- **Product Name:** AI-Powered Task Manager
619
- **Version:** 1.0
620
- **Date:** 2024-12-27
621
- **Author:** Development Team
622
-
623
- This document outlines the requirements for building an AI-powered task management application that integrates with development workflows and provides intelligent task breakdown and prioritization.
624
-
625
- ## 2. Objectives
626
- - Create an intuitive task management system that works seamlessly with developer tools
627
- - Provide AI-powered task generation from high-level requirements
628
- - Enable real-time collaboration and progress tracking
629
- - Integrate with popular development environments (VS Code, Cursor, etc.)
630
-
631
- ### Success Metrics
632
- - User adoption rate > 80% within development teams
633
- - Task completion rate improvement of 25%
634
- - Time-to-delivery reduction of 15%
635
-
636
- ## 3. User Stories
637
-
638
- ### Core Functionality
639
- - As a project manager, I want to create PRDs that automatically generate detailed tasks so I can save time on project planning
640
- - As a developer, I want to see my next task clearly highlighted so I can maintain focus
641
- - As a team lead, I want to track progress across multiple projects so I can provide accurate status updates
642
- - As a developer, I want tasks to be broken down into implementable subtasks so I can work more efficiently
643
-
644
- ### AI Integration
645
- - As a user, I want to describe a feature in natural language and get detailed implementation tasks so I can start working immediately
646
- - As a project manager, I want the AI to analyze task complexity and suggest appropriate time estimates
647
- - As a developer, I want intelligent task prioritization based on dependencies and deadlines
648
-
649
- ### Collaboration
650
- - As a team member, I want to see real-time updates when tasks are completed so I can coordinate my work
651
- - As a stakeholder, I want to view project progress through intuitive dashboards
652
- - As a developer, I want to add implementation notes to tasks for future reference
653
-
654
- ## 4. Functional Requirements
655
-
656
- ### Task Management
657
- - Create, edit, and delete tasks with rich metadata (priority, status, dependencies, estimates)
658
- - Hierarchical task structure with subtasks and sub-subtasks
659
- - Real-time status updates and progress tracking
660
- - Dependency management with circular dependency detection
661
- - Bulk operations (move, update status, assign)
662
-
663
- ### AI Features
664
- - Natural language PRD parsing to generate structured tasks
665
- - Intelligent task breakdown with complexity analysis
666
- - Automated subtask generation with implementation details
667
- - Smart dependency suggestion
668
- - Progress prediction based on historical data
669
-
670
- ### Integration Features
671
- - VS Code/Cursor extension for in-editor task management
672
- - Git integration for linking commits to tasks
673
- - API for third-party tool integration
674
- - Webhook support for external notifications
675
- - CLI tool for command-line task management
676
-
677
- ### User Interface
678
- - Responsive web application (desktop and mobile)
679
- - Multiple view modes (Kanban, list, calendar)
680
- - Dark/light theme support
681
- - Drag-and-drop task organization
682
- - Advanced filtering and search capabilities
683
- - Keyboard shortcuts for power users
684
-
685
- ## 5. Technical Requirements
686
-
687
- ### Frontend
688
- - React.js with TypeScript for type safety
689
- - Modern UI framework (Tailwind CSS)
690
- - State management (Context API or Redux)
691
- - Real-time updates via WebSockets
692
- - Progressive Web App (PWA) support
693
- - Accessibility compliance (WCAG 2.1 AA)
694
-
695
- ### Backend
696
- - Node.js with Express.js framework
697
- - RESTful API design with OpenAPI documentation
698
- - Real-time communication via Socket.io
699
- - Background job processing
700
- - Rate limiting and security middleware
701
-
702
- ### AI Integration
703
- - Integration with multiple AI providers (OpenAI, Anthropic, etc.)
704
- - Fallback model support
705
- - Context-aware prompt engineering
706
- - Token usage optimization
707
- - Model response caching
708
-
709
- ### Database
710
- - Primary: PostgreSQL for relational data
711
- - Cache: Redis for session management and real-time features
712
- - Full-text search capabilities
713
- - Database migrations and seeding
714
- - Backup and recovery procedures
715
-
716
- ### Infrastructure
717
- - Docker containerization
718
- - Cloud deployment (AWS/GCP/Azure)
719
- - Auto-scaling capabilities
720
- - Monitoring and logging (structured logging)
721
- - CI/CD pipeline with automated testing
722
-
723
- ## 6. Non-Functional Requirements
724
-
725
- ### Performance
726
- - Page load time < 2 seconds
727
- - API response time < 500ms for 95% of requests
728
- - Support for 1000+ concurrent users
729
- - Efficient handling of large task lists (10,000+ tasks)
730
-
731
- ### Security
732
- - JWT-based authentication with refresh tokens
733
- - Role-based access control (RBAC)
734
- - Data encryption at rest and in transit
735
- - Regular security audits and penetration testing
736
- - GDPR and privacy compliance
737
-
738
- ### Reliability
739
- - 99.9% uptime SLA
740
- - Graceful error handling and recovery
741
- - Data backup every 6 hours with point-in-time recovery
742
- - Disaster recovery plan with RTO < 4 hours
743
-
744
- ### Scalability
745
- - Horizontal scaling for both frontend and backend
746
- - Database read replicas for query optimization
747
- - CDN for static asset delivery
748
- - Microservices architecture for future expansion
749
-
750
- ## 7. User Experience Design
751
-
752
- ### Information Architecture
753
- - Intuitive navigation with breadcrumbs
754
- - Context-aware menus and actions
755
- - Progressive disclosure of complex features
756
- - Consistent design patterns throughout
757
-
758
- ### Interaction Design
759
- - Smooth animations and transitions
760
- - Immediate feedback for user actions
761
- - Undo/redo functionality for critical operations
762
- - Smart defaults and auto-save features
763
-
764
- ### Visual Design
765
- - Modern, clean interface with plenty of whitespace
766
- - Consistent color scheme and typography
767
- - Clear visual hierarchy with proper contrast ratios
768
- - Iconography that supports comprehension
769
-
770
- ## 8. Integration Requirements
771
-
772
- ### Development Tools
773
- - VS Code extension with task panel and quick actions
774
- - Cursor IDE integration with AI task suggestions
775
- - Terminal CLI for command-line workflow
776
- - Browser extension for web-based tools
777
-
778
- ### Third-Party Services
779
- - GitHub/GitLab integration for issue sync
780
- - Slack/Discord notifications
781
- - Calendar integration (Google Calendar, Outlook)
782
- - Time tracking tools (Toggl, Harvest)
783
-
784
- ### APIs and Webhooks
785
- - RESTful API with comprehensive documentation
786
- - GraphQL endpoint for complex queries
787
- - Webhook system for external integrations
788
- - SDK development for major programming languages
789
-
790
- ## 9. Implementation Phases
791
-
792
- ### Phase 1: Core MVP (8-10 weeks)
793
- - Basic task management (CRUD operations)
794
- - Simple AI task generation
795
- - Web interface with essential features
796
- - User authentication and basic permissions
797
-
798
- ### Phase 2: Enhanced Features (6-8 weeks)
799
- - Advanced AI features (complexity analysis, subtask generation)
800
- - Real-time collaboration
801
- - Mobile-responsive design
802
- - Integration with one development tool (VS Code)
803
-
804
- ### Phase 3: Enterprise Features (4-6 weeks)
805
- - Advanced user management and permissions
806
- - API and webhook system
807
- - Performance optimization
808
- - Comprehensive testing and security audit
809
-
810
- ### Phase 4: Ecosystem Expansion (4-6 weeks)
811
- - Additional tool integrations
812
- - Mobile app development
813
- - Advanced analytics and reporting
814
- - Third-party marketplace preparation
815
-
816
- ## 10. Risk Assessment
817
-
818
- ### Technical Risks
819
- - AI model reliability and cost management
820
- - Real-time synchronization complexity
821
- - Database performance with large datasets
822
- - Integration complexity with multiple tools
823
-
824
- ### Business Risks
825
- - User adoption in competitive market
826
- - AI provider dependency
827
- - Data privacy and security concerns
828
- - Feature scope creep and timeline delays
829
-
830
- ### Mitigation Strategies
831
- - Implement robust error handling and fallback systems
832
- - Develop comprehensive testing strategy
833
- - Create detailed documentation and user guides
834
- - Establish clear project scope and change management process
835
-
836
- ## 11. Success Criteria
837
-
838
- ### Development Milestones
839
- - Alpha version with core features completed
840
- - Beta version with selected user group feedback
841
- - Production-ready version with full feature set
842
- - Post-launch iterations based on user feedback
843
-
844
- ### Business Metrics
845
- - User engagement and retention rates
846
- - Task completion and productivity metrics
847
- - Customer satisfaction scores (NPS > 50)
848
- - Revenue targets and subscription growth
849
-
850
- ## 12. Appendices
851
-
852
- ### Glossary
853
- - **PRD**: Product Requirements Document
854
- - **AI**: Artificial Intelligence
855
- - **CRUD**: Create, Read, Update, Delete
856
- - **API**: Application Programming Interface
857
- - **CI/CD**: Continuous Integration/Continuous Deployment
858
-
859
- ### References
860
- - Industry best practices for task management
861
- - AI integration patterns and examples
862
- - Security and compliance requirements
863
- - Performance benchmarking data
864
-
865
- ---
866
-
867
- **Document Control:**
868
- - Version: 1.0
869
- - Last Updated: December 27, 2024
870
- - Next Review: January 15, 2025
871
- - Approved By: Product Owner, Technical Lead`;f.useEffect(()=>{(async()=>{if(e?.name)L(e.name.replace(/\.(txt|md)$/,""));else if(i){const me=new Date().toISOString().split("T")[0];L(`prd-${me}`)}if(i){c(F),u(!1);return}if(e.content){c(e.content),u(!1);return}try{u(!0);const ae=await Fe.readFile(e.projectName,e.path);if(!ae.ok)throw new Error(`Failed to load file: ${ae.status} ${ae.statusText}`);const me=await ae.json();c(me.content||F)}catch(ae){console.error("Error loading PRD file:",ae),c(`# Error Loading PRD
872
-
873
- Error: ${ae.message}
874
-
875
- File: ${e?.name||"New PRD"}
876
- Path: ${e?.path||"Not saved yet"}
877
-
878
- ${F}`)}finally{u(!1)}})()},[e,n,i]),f.useEffect(()=>{(async()=>{if(!s?.name){console.log("No project name available:",s);return}try{console.log("Fetching PRDs for project:",s.name);const ae=await Fe.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(ae.ok){const me=await ae.json();console.log("Fetched existing PRDs:",me.prds),w(me.prds||[])}else console.log("Failed to fetch PRDs:",ae.status,ae.statusText)}catch(ae){console.error("Error fetching existing PRDs:",ae)}})()},[s?.name]);const $=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!O.trim()){alert("Please provide a filename for the PRD.");return}const v=O.endsWith(".txt")||O.endsWith(".md")?O:`${O}.txt`,ae=_.find(me=>me.name===v);if(console.log("Save check:",{fullFileName:v,existingPRDs:_,existingFile:ae,isExisting:e?.isExisting,fileObject:e,shouldShowModal:ae&&!e?.isExisting}),ae&&!e?.isExisting){console.log("Showing overwrite confirmation modal"),I(!0);return}await K()},K=async()=>{h(!0);try{const v=O.endsWith(".txt")||O.endsWith(".md")?O:`${O}.txt`,ae=await Pe(`/api/taskmaster/prd/${encodeURIComponent(s?.name)}`,{method:"POST",body:JSON.stringify({fileName:v,content:l})});if(!ae.ok){const Ee=await ae.json();throw new Error(Ee.message||`Save failed: ${ae.status}`)}C(!0),setTimeout(()=>C(!1),2e3);const me=await Fe.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(me.ok){const Ee=await me.json();w(Ee.prds||[])}o&&await o()}catch(v){console.error("Error saving PRD:",v),alert(`Error saving PRD: ${v.message}`)}finally{h(!1)}},ce=()=>{const v=new Blob([l],{type:"text/markdown"}),ae=URL.createObjectURL(v),me=document.createElement("a");me.href=ae;const Ee=O?`${O}.txt`:"prd.txt";me.download=Ee,document.body.appendChild(me),me.click(),document.body.removeChild(me),URL.revokeObjectURL(ae)},S=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}j(!0)},Ae=()=>{g(!p)};f.useEffect(()=>{const v=ae=>{(ae.ctrlKey||ae.metaKey)&&(ae.key==="s"?(ae.preventDefault(),$()):ae.key==="Escape"&&(ae.preventDefault(),r()))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]);const $e=v=>v.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return d?t.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:t.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):t.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${p?"md:p-0":""}`,children:[t.jsxs("div",{className:Ce("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",p?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:t.jsx(Tt,{className:"w-4 h-4 text-white"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[t.jsx("input",{type:"text",value:O,onChange:v=>{const ae=v.target.value.replace(/[<>:"/\\|?*]/g,"");L(ae)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),t.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),t.jsx("button",{onClick:()=>document.querySelector('input[placeholder="Enter PRD filename"]')?.focus(),className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[t.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"📋 PRD"}),i&&t.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"✨ New"})]})]}),t.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),t.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[t.jsx("button",{onClick:()=>R(!y),className:Ce("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",y?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:y?"Switch to edit mode":"Preview markdown",children:t.jsx(on,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:()=>M(!H),className:Ce("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",H?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:H?"Disable word wrap":"Enable word wrap",children:t.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),t.jsx("button",{onClick:()=>b(!x),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:t.jsx("span",{className:"text-lg md:text-base",children:x?"☀️":"🌙"})}),t.jsx("button",{onClick:ce,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:t.jsx(ls,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsxs("button",{onClick:S,disabled:!l.trim(),className:Ce("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[t.jsx(Lr,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),t.jsx("button",{onClick:$,disabled:m,className:Ce("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",k?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:k?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ds,{className:"w-5 h-5 md:w-4 md:h-4"}),t.jsx("span",{className:"hidden sm:inline",children:m?"Saving...":"Save PRD"})]})}),t.jsx("button",{onClick:Ae,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:p?"Exit fullscreen":"Fullscreen",children:p?t.jsx(sc,{className:"w-4 h-4"}):t.jsx(Xa,{className:"w-4 h-4"})}),t.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:t.jsx(ot,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:y?t.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:t.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:$e(l)}})}):t.jsx(Rl,{ref:W,value:l,onChange:c,extensions:[zl(),...H?[Ht.lineWrapping]:[]],theme:x?_l:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),t.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("span",{children:["Lines: ",l.split(`
879
- `).length]}),t.jsxs("span",{children:["Characters: ",l.length]}),t.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(v=>v.length>0).length]}),t.jsx("span",{children:"Format: Markdown"})]}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),q&&t.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Lr,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),t.jsx("button",{onClick:()=>j(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:t.jsx(ot,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(Lr,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),t.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,O.endsWith(".txt")||O.endsWith(".md")?O:`${O}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),t.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[t.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),t.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),t.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),t.jsx("div",{className:"pt-4",children:t.jsx("button",{onClick:()=>j(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),T&&t.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>I(!1)}),t.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:t.jsx(Nn,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),t.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',O.endsWith(".txt")||O.endsWith(".md")?O:`${O}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>I(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),t.jsxs("button",{onClick:async()=>{I(!1),await K()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[t.jsx(ds,{className:"w-4 h-4"}),t.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function a1({selectedProject:e,selectedSession:r,activeTab:n,setActiveTab:s,ws:a,sendMessage:i,messages:o,isMobile:l,isPWA:c,onMenuClick:d,isLoading:u,onInputFocusChange:m,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:x,processingSessions:b,onReplaceTemporarySession:k,onNavigateToSession:C,onShowSettings:y,autoExpandTools:R,showRawParameters:H,showThinking:M,autoScrollToBottom:O,sendByCtrlEnter:L,externalMessageUpdate:q}){const[j,T]=f.useState(null),[I,_]=f.useState(null),[w,W]=f.useState(!1),[F,$]=f.useState(!1),[K,ce]=f.useState(null),[S,Ae]=f.useState([]),[$e,v]=f.useState(null),{tasks:ae,currentProject:me,refreshTasks:Ee,setCurrentProject:ie}=_n(),{tasksEnabled:qe,isTaskMasterInstalled:re,isTaskMasterReady:le}=zn(),fe=qe&&re;f.useEffect(()=>{e&&e!==me&&ie(e)},[e,me,ie]),f.useEffect(()=>{!fe&&n==="tasks"&&s("chat")},[fe,n,s]),f.useEffect(()=>{(async()=>{if(!me?.name){Ae([]);return}try{const ye=await Fe.get(`/taskmaster/prd/${encodeURIComponent(me.name)}`);if(ye.ok){const ke=await ye.json();Ae(ke.prdFiles||[])}else Ae([])}catch(ye){console.error("Failed to load existing PRDs:",ye),Ae([])}})()},[me?.name]);const we=(De,ye=null)=>{const ke={name:De.split("/").pop(),path:De,projectName:e?.name,diffInfo:ye};T(ke)},ve=()=>{T(null)},Ye=De=>{if(typeof De=="object"&&De.id&&!De.title){const ye=ae?.find(ke=>ke.id===De.id);ye&&(_(ye),W(!0))}else _(De),W(!0)},Ue=()=>{W(!1),_(null)},at=(De,ye)=>{console.log("Update task status:",De,ye),Ee?.()};return u?t.jsxs("div",{className:"h-full flex flex-col",children:[l&&t.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:t.jsx("button",{onClick:d,className:"p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[t.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:t.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),t.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Loading Claude Code UI"}),t.jsx("p",{children:"Setting up your workspace..."})]})})]}):e?t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2 sm:space-x-3",children:[l&&t.jsx("button",{onClick:d,onTouchStart:De=>{De.preventDefault(),d()},className:"p-2.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button",children:t.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),t.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[n==="chat"&&r&&t.jsx("div",{className:"w-6 h-6 flex-shrink-0 flex items-center justify-center",children:r.__provider==="cursor"?t.jsx(lr,{className:"w-5 h-5"}):t.jsx(tr,{className:"w-5 h-5"})}),t.jsx("div",{className:"flex-1 min-w-0",children:n==="chat"&&r?t.jsxs("div",{children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white truncate",children:r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session"}),t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:[e.displayName," ",t.jsxs("span",{className:"hidden sm:inline",children:["• ",r.id]})]})]}):n==="chat"&&!r?t.jsxs("div",{children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white",children:"New Session"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):t.jsxs("div",{children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white",children:n==="files"?"Project Files":n==="git"?"Source Control":n==="tasks"&&fe?"TaskMaster":"Project"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),t.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:t.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[t.jsx(Dt,{content:"Chat",position:"bottom",children:t.jsx("button",{onClick:()=>s("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${n==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Chat"})]})})}),t.jsx(Dt,{content:"Shell",position:"bottom",children:t.jsx("button",{onClick:()=>s("shell"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Shell"})]})})}),t.jsx(Dt,{content:"Files",position:"bottom",children:t.jsx("button",{onClick:()=>s("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Files"})]})})}),t.jsx(Dt,{content:"Source Control",position:"bottom",children:t.jsx("button",{onClick:()=>s("git"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="git"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Source Control"})]})})}),fe&&t.jsx(Dt,{content:"Tasks",position:"bottom",children:t.jsx("button",{onClick:()=>s("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Tasks"})]})})})]})})]})}),t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[t.jsx("div",{className:`h-full ${n==="chat"?"block":"hidden"}`,children:t.jsx(t1,{showDetails:!0,children:t.jsx(cw,{selectedProject:e,selectedSession:r,ws:a,sendMessage:i,messages:o,onFileOpen:we,onInputFocusChange:m,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:x,processingSessions:b,onReplaceTemporarySession:k,onNavigateToSession:C,onShowSettings:y,autoExpandTools:R,showRawParameters:H,showThinking:M,autoScrollToBottom:O,sendByCtrlEnter:L,externalMessageUpdate:q,onShowAllTasks:qe?()=>s("tasks"):null})})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="files"?"block":"hidden"}`,children:t.jsx(Zw,{selectedProject:e})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="shell"?"block":"hidden"}`,children:t.jsx(au,{project:e,session:r,isActive:n==="shell",showHeader:!1})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="git"?"block":"hidden"}`,children:t.jsx(e1,{selectedProject:e,isMobile:l,onFileOpen:we})}),fe&&t.jsx("div",{className:`h-full ${n==="tasks"?"block":"hidden"}`,children:t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:t.jsx(n1,{tasks:ae||[],onTaskClick:Ye,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:me,onTaskCreated:Ee,onShowPRDEditor:(De=null)=>{ce(De),$(!0)},existingPRDs:S,onRefreshPRDs:(De=!1)=>{me?.name&&Fe.get(`/taskmaster/prd/${encodeURIComponent(me.name)}`).then(ye=>ye.ok?ye.json():Promise.reject()).then(ye=>{Ae(ye.prdFiles||[]),De&&(v("PRD saved successfully!"),setTimeout(()=>v(null),3e3))}).catch(ye=>console.error("Failed to refresh PRDs:",ye))}})})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="preview"?"block":"hidden"}`})]}),j&&t.jsx(su,{file:j,onClose:ve,projectPath:e?.path}),fe&&w&&I&&t.jsx(Id,{task:I,isOpen:w,onClose:Ue,onStatusChange:at,onTaskClick:Ye}),F&&t.jsx(s1,{project:me,projectPath:me?.fullPath||me?.path,onClose:()=>{$(!1),ce(null)},isNewFile:!K?.isExisting,file:{name:K?.name||"prd.txt",content:K?.content||""},onSave:async()=>{$(!1),ce(null);try{const De=await Fe.get(`/taskmaster/prd/${encodeURIComponent(me.name)}`);if(De.ok){const ye=await De.json();Ae(ye.prdFiles||[]),v("PRD saved successfully!"),setTimeout(()=>v(null),3e3)}}catch(De){console.error("Failed to refresh PRDs:",De)}Ee?.()}}),$e&&t.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:t.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"font-medium",children:$e})]})})]}):t.jsxs("div",{className:"h-full flex flex-col",children:[l&&t.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:t.jsx("button",{onClick:d,className:"p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[t.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),t.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:"Choose Your Project"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history."}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:t.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",t.jsx("strong",{children:"Tip:"})," ",l?"Tap the menu button above to access projects":"Create a new project by clicking the folder icon in the sidebar"]})})]})})]})}const i1=cr.memo(a1);function o1({activeTab:e,setActiveTab:r,isInputFocused:n}){const{tasksEnabled:s}=zn(),a=document.documentElement.classList.contains("dark"),i=[{id:"chat",icon:An,onClick:()=>r("chat")},{id:"shell",icon:Xr,onClick:()=>r("shell")},{id:"files",icon:er,onClick:()=>r("files")},{id:"git",icon:xa,onClick:()=>r("git")},...s?[{id:"tasks",icon:xh,onClick:()=>r("tasks")}]:[]];return t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
880
- .mobile-nav-container {
881
- background-color: ${a?"#1f2937":"#ffffff"} !important;
882
- }
883
- .mobile-nav-container:hover {
884
- background-color: ${a?"#1f2937":"#ffffff"} !important;
885
- }
886
- `}),t.jsx("div",{className:`mobile-nav-container fixed bottom-0 left-0 right-0 border-t border-gray-200 dark:border-gray-700 z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${n?"translate-y-full":"translate-y-0"}`,children:t.jsx("div",{className:"flex items-center justify-around py-1",children:i.map(o=>{const l=o.icon,c=e===o.id;return t.jsxs("button",{onClick:o.onClick,onTouchStart:d=>{d.preventDefault(),o.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${c?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":o.id,children:[t.jsx(l,{className:"w-5 h-5"}),c&&t.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},o.id)})})})]})}const iu=f.createContext(),Ci=()=>{const e=f.useContext(iu);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},l1=({children:e})=>{const[r,n]=f.useState(()=>{const i=localStorage.getItem("theme");return i?i==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});f.useEffect(()=>{if(r){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","black-translucent");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","default");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#ffffff")}},[r]),f.useEffect(()=>{if(!window.matchMedia)return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=l=>{localStorage.getItem("theme")||n(l.matches)};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]);const a={isDarkMode:r,toggleDarkMode:()=>{n(i=>!i)}};return t.jsx(iu.Provider,{value:a,children:e})};function c1(){const[e,r]=f.useState([]),[n,s]=f.useState([]),[a,i]=f.useState(!0),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[u,m]=f.useState(""),[h,p]=f.useState(""),[g,x]=f.useState(""),[b,k]=f.useState(""),[C,y]=f.useState({}),[R,H]=f.useState(null),[M,O]=f.useState(null);f.useEffect(()=>{L()},[]);const L=async()=>{try{i(!0);const F=localStorage.getItem("auth-token"),K=await(await fetch("/api/settings/api-keys",{headers:{Authorization:`Bearer ${F}`}})).json();r(K.apiKeys||[]);const S=await(await fetch("/api/settings/credentials?type=github_token",{headers:{Authorization:`Bearer ${F}`}})).json();s(S.credentials||[])}catch(F){console.error("Error fetching settings:",F)}finally{i(!1)}},q=async()=>{if(u.trim())try{const F=localStorage.getItem("auth-token"),K=await(await fetch("/api/settings/api-keys",{method:"POST",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"},body:JSON.stringify({keyName:u})})).json();K.success&&(O(K.apiKey),m(""),l(!1),L())}catch(F){console.error("Error creating API key:",F)}},j=async F=>{if(confirm("Are you sure you want to delete this API key?"))try{const $=localStorage.getItem("auth-token");await fetch(`/api/settings/api-keys/${F}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`}}),L()}catch($){console.error("Error deleting API key:",$)}},T=async(F,$)=>{try{const K=localStorage.getItem("auth-token");await fetch(`/api/settings/api-keys/${F}/toggle`,{method:"PATCH",headers:{Authorization:`Bearer ${K}`,"Content-Type":"application/json"},body:JSON.stringify({isActive:!$})}),L()}catch(K){console.error("Error toggling API key:",K)}},I=async()=>{if(!(!h.trim()||!g.trim()))try{const F=localStorage.getItem("auth-token");(await(await fetch("/api/settings/credentials",{method:"POST",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"},body:JSON.stringify({credentialName:h,credentialType:"github_token",credentialValue:g,description:b})})).json()).success&&(p(""),x(""),k(""),d(!1),L())}catch(F){console.error("Error creating GitHub credential:",F)}},_=async F=>{if(confirm("Are you sure you want to delete this GitHub token?"))try{const $=localStorage.getItem("auth-token");await fetch(`/api/settings/credentials/${F}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`}}),L()}catch($){console.error("Error deleting GitHub credential:",$)}},w=async(F,$)=>{try{const K=localStorage.getItem("auth-token");await fetch(`/api/settings/credentials/${F}/toggle`,{method:"PATCH",headers:{Authorization:`Bearer ${K}`,"Content-Type":"application/json"},body:JSON.stringify({isActive:!$})}),L()}catch(K){console.error("Error toggling GitHub credential:",K)}},W=(F,$)=>{navigator.clipboard.writeText(F),H($),setTimeout(()=>H(null),2e3)};return a?t.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):t.jsxs("div",{className:"space-y-8",children:[M&&t.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[t.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:"⚠️ Save Your API Key"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"This is the only time you'll see this key. Store it securely."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:M.apiKey}),t.jsx(Me,{size:"sm",variant:"outline",onClick:()=>W(M.apiKey,"new"),children:R==="new"?t.jsx(Dr,{className:"h-4 w-4"}):t.jsx(ec,{className:"h-4 w-4"})})]}),t.jsx(Me,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>O(null),children:"I've saved it"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(nc,{className:"h-5 w-5"}),t.jsx("h3",{className:"text-lg font-semibold",children:"API Keys"})]}),t.jsxs(Me,{size:"sm",onClick:()=>l(!o),children:[t.jsx(St,{className:"h-4 w-4 mr-1"}),"New API Key"]})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Generate API keys to access the external API from other applications."}),t.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:["API Documentation",t.jsx(xp,{className:"h-3 w-3"})]})]}),o&&t.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[t.jsx(wt,{placeholder:"API Key Name (e.g., Production Server)",value:u,onChange:F=>m(F.target.value),className:"mb-2"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{onClick:q,children:"Create"}),t.jsx(Me,{variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]}),t.jsx("div",{className:"space-y-2",children:e.length===0?t.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No API keys created yet."}):e.map(F=>t.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium",children:F.key_name}),t.jsx("code",{className:"text-xs text-muted-foreground",children:F.api_key}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Created: ",new Date(F.created_at).toLocaleDateString(),F.last_used&&` • Last used: ${new Date(F.last_used).toLocaleDateString()}`]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Me,{size:"sm",variant:F.is_active?"outline":"secondary",onClick:()=>T(F.id,F.is_active),children:F.is_active?"Active":"Inactive"}),t.jsx(Me,{size:"sm",variant:"ghost",onClick:()=>j(F.id),children:t.jsx(Jt,{className:"h-4 w-4"})})]})]},F.id))})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Pp,{className:"h-5 w-5"}),t.jsx("h3",{className:"text-lg font-semibold",children:"GitHub Credentials"})]}),t.jsxs(Me,{size:"sm",onClick:()=>d(!c),children:[t.jsx(St,{className:"h-4 w-4 mr-1"}),"Add Token"]})]}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them."}),c&&t.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[t.jsx(wt,{placeholder:"Token Name (e.g., Personal Repos)",value:h,onChange:F=>p(F.target.value)}),t.jsxs("div",{className:"relative",children:[t.jsx(wt,{type:C.new?"text":"password",placeholder:"GitHub Personal Access Token (ghp_...)",value:g,onChange:F=>x(F.target.value),className:"pr-10"}),t.jsx("button",{type:"button",onClick:()=>y({...C,new:!C.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:C.new?t.jsx(tc,{className:"h-4 w-4"}):t.jsx(on,{className:"h-4 w-4"})})]}),t.jsx(wt,{placeholder:"Description (optional)",value:b,onChange:F=>k(F.target.value)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{onClick:I,children:"Add Token"}),t.jsx(Me,{variant:"outline",onClick:()=>{d(!1),p(""),x(""),k("")},children:"Cancel"})]}),t.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:"How to create a GitHub Personal Access Token →"})]}),t.jsx("div",{className:"space-y-2",children:n.length===0?t.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No GitHub tokens added yet."}):n.map(F=>t.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium",children:F.credential_name}),F.description&&t.jsx("div",{className:"text-xs text-muted-foreground",children:F.description}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Added: ",new Date(F.created_at).toLocaleDateString()]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Me,{size:"sm",variant:F.is_active?"outline":"secondary",onClick:()=>w(F.id,F.is_active),children:F.is_active?"Active":"Inactive"}),t.jsx(Me,{size:"sm",variant:"ghost",onClick:()=>_(F.id),children:t.jsx(Jt,{className:"h-4 w-4"})})]})]},F.id))})]})]})}function d1({isOpen:e,onClose:r,projects:n=[]}){const{isDarkMode:s,toggleDarkMode:a}=Ci(),{tasksEnabled:i,setTasksEnabled:o,isTaskMasterInstalled:l,isTaskMasterReady:c,installationStatus:d,isCheckingInstallation:u}=zn(),[m,h]=f.useState([]),[p,g]=f.useState([]),[x,b]=f.useState(""),[k,C]=f.useState(""),[y,R]=f.useState(!1),[H,M]=f.useState(!1),[O,L]=f.useState(null),[q,j]=f.useState("name"),[T,I]=f.useState([]),[_,w]=f.useState(!1),[W,F]=f.useState(null),[$,K]=f.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[ce,S]=f.useState(!1),[Ae,$e]=f.useState({}),[v,ae]=f.useState({}),[me,Ee]=f.useState({}),[ie,qe]=f.useState("tools"),[re,le]=f.useState(""),[fe,we]=f.useState("claude"),[ve,Ye]=f.useState([]),[Ue,at]=f.useState([]),[De,ye]=f.useState(!1),[ke,Oe]=f.useState(""),[st,Ie]=f.useState(""),[Lt,te]=f.useState([]),[de,z]=f.useState(!1),[D,Y]=f.useState(""),[Z,se]=f.useState(null),je=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],_e=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"],Le=async()=>{try{const N=localStorage.getItem("auth-token"),X=await fetch("/api/cursor/mcp",{headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"}});if(X.ok){const pe=await X.json();te(pe.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(N){console.error("Error fetching Cursor MCP servers:",N)}},Ge=async()=>{try{const N=localStorage.getItem("auth-token"),X=await fetch("/api/mcp/config/read",{headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"}});if(X.ok){const ut=await X.json();if(ut.success&&ut.servers){I(ut.servers);return}}const pe=await fetch("/api/mcp/cli/list",{headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"}});if(pe.ok){const ut=await pe.json();if(ut.success&&ut.servers){const kt=ut.servers.map(gt=>({id:gt.name,name:gt.name,type:gt.type,scope:"user",config:{command:gt.command||"",args:gt.args||[],env:gt.env||{},url:gt.url||"",headers:gt.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));I(kt);return}}const Ke=await fetch("/api/mcp/servers?scope=user",{headers:{Authorization:`Bearer ${N}`,"Content-Type":"application/json"}});if(Ke.ok){const ut=await Ke.json();I(ut.servers||[])}else console.error("Failed to fetch MCP servers")}catch(N){console.error("Error fetching MCP servers:",N)}},et=async N=>{try{const X=localStorage.getItem("auth-token");W&&await We(W.id,"user");const pe=await fetch("/api/mcp/cli/add",{method:"POST",headers:{Authorization:`Bearer ${X}`,"Content-Type":"application/json"},body:JSON.stringify({name:N.name,type:N.type,scope:N.scope,projectPath:N.projectPath,command:N.config?.command,args:N.config?.args||[],url:N.config?.url,headers:N.config?.headers||{},env:N.config?.env||{}})});if(pe.ok){const Ke=await pe.json();if(Ke.success)return await Ge(),!0;throw new Error(Ke.error||"Failed to save server via Claude CLI")}else{const Ke=await pe.json();throw new Error(Ke.error||"Failed to save server")}}catch(X){throw console.error("Error saving MCP server:",X),X}},We=async(N,X="user")=>{try{const pe=localStorage.getItem("auth-token"),Ke=await fetch(`/api/mcp/cli/remove/${N}?scope=${X}`,{method:"DELETE",headers:{Authorization:`Bearer ${pe}`,"Content-Type":"application/json"}});if(Ke.ok){const ut=await Ke.json();if(ut.success)return await Ge(),!0;throw new Error(ut.error||"Failed to delete server via Claude CLI")}else{const ut=await Ke.json();throw new Error(ut.error||"Failed to delete server")}}catch(pe){throw console.error("Error deleting MCP server:",pe),pe}};f.useEffect(()=>{e&&nt()},[e]);const nt=async()=>{try{const N=localStorage.getItem("claude-settings");if(N){const pe=JSON.parse(N);h(pe.allowedTools||[]),g(pe.disallowedTools||[]),R(pe.skipPermissions||!1),j(pe.projectSortOrder||"name")}else h([]),g([]),R(!1),j("name");const X=localStorage.getItem("cursor-tools-settings");if(X){const pe=JSON.parse(X);Ye(pe.allowedCommands||[]),at(pe.disallowedCommands||[]),ye(pe.skipPermissions||!1)}else Ye([]),at([]),ye(!1);await Ge(),await Le()}catch(N){console.error("Error loading tool settings:",N),h([]),g([]),R(!1),j("name")}},ct=()=>{Y("claude"),se(n?.[0]||{name:"default",fullPath:process.cwd()}),z(!0)},Rt=()=>{Y("cursor"),se(n?.[0]||{name:"default",fullPath:process.cwd()}),z(!0)},Ot=N=>{z(!1)},Qt=()=>{M(!0),L(null);try{const N={allowedTools:m,disallowedTools:p,skipPermissions:y,projectSortOrder:q,lastUpdated:new Date().toISOString()},X={allowedCommands:ve,disallowedCommands:Ue,skipPermissions:De,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(N)),localStorage.setItem("cursor-tools-settings",JSON.stringify(X)),L("success"),setTimeout(()=>{r()},1e3)}catch(N){console.error("Error saving tool settings:",N),L("error")}finally{M(!1)}},vt=N=>{N&&!m.includes(N)&&(h([...m,N]),b(""))},Vt=N=>{h(m.filter(X=>X!==N))},Ct=N=>{N&&!p.includes(N)&&(g([...p,N]),C(""))},Gt=N=>{g(p.filter(X=>X!==N))},ft=()=>{K({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),F(null),w(!1),le("")},A=(N=null)=>{N?(F(N),K({name:N.name,type:N.type,scope:N.scope,projectPath:N.projectPath||"",config:{...N.config},raw:N.raw,importMode:"form",jsonInput:""})):ft(),w(!0)},ne=async N=>{N.preventDefault(),S(!0);try{if($.importMode==="json"){const X=localStorage.getItem("auth-token"),pe=await fetch("/api/mcp/cli/add-json",{method:"POST",headers:{Authorization:`Bearer ${X}`,"Content-Type":"application/json"},body:JSON.stringify({name:$.name,jsonConfig:$.jsonInput,scope:$.scope,projectPath:$.projectPath})});if(pe.ok){const Ke=await pe.json();if(Ke.success)await Ge(),ft(),L("success");else throw new Error(Ke.error||"Failed to add server via JSON")}else{const Ke=await pe.json();throw new Error(Ke.error||"Failed to add server")}}else await et($),ft(),L("success")}catch(X){alert(`Error: ${X.message}`),L("error")}finally{S(!1)}},P=async(N,X)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await We(N,X),L("success")}catch(pe){alert(`Error: ${pe.message}`),L("error")}},U=(N,X)=>{K(pe=>({...pe,config:{...pe.config,[N]:X}}))},B=N=>{switch(N){case"stdio":return t.jsx(Xr,{className:"w-4 h-4"});case"sse":return t.jsx(ya,{className:"w-4 h-4"});case"http":return t.jsx(Fs,{className:"w-4 h-4"});default:return t.jsx(Ki,{className:"w-4 h-4"})}};return e?t.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[100] md:p-4 bg-background/95",children:[t.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Qr,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),t.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"Settings"})]}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:t.jsx(ot,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:"flex px-4 md:px-6",children:[t.jsx("button",{onClick:()=>qe("tools"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ie==="tools"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tools"}),t.jsx("button",{onClick:()=>qe("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ie==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Appearance"}),t.jsx("button",{onClick:()=>qe("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ie==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tasks"}),t.jsxs("button",{onClick:()=>qe("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ie==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[t.jsx(nc,{className:"w-4 h-4 inline mr-2"}),"API & Tokens"]})]})}),t.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[ie==="appearance"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:ie==="appearance"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsx("div",{className:"space-y-4",children:t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Dark Mode"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Toggle between light and dark themes"})]}),t.jsxs("button",{onClick:a,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":s,"aria-label":"Toggle dark mode",children:[t.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),t.jsx("span",{className:`${s?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:s?t.jsx(ac,{className:"w-3.5 h-3.5 text-gray-700"}):t.jsx(oc,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),t.jsx("div",{className:"space-y-4",children:t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Project Sorting"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"How projects are ordered in the sidebar"})]}),t.jsxs("select",{value:q,onChange:N=>j(N.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[t.jsx("option",{value:"name",children:"Alphabetical"}),t.jsx("option",{value:"date",children:"Recent Activity"})]})]})})})]})}),ie==="tools"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsx("div",{className:"border-b border-gray-300 dark:border-gray-600",children:t.jsxs("div",{className:"flex gap-4",children:[t.jsx("button",{onClick:()=>we("claude"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${fe==="claude"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tr,{className:"w-4 h-4"}),t.jsx("span",{children:"Claude"})]})}),t.jsx("button",{onClick:()=>we("cursor"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${fe==="cursor"?"border-purple-600 text-purple-600 dark:text-purple-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(lr,{className:"w-4 h-4"}),t.jsx("span",{children:"Cursor"})]})})]})}),fe==="claude"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Nn,{className:"w-5 h-5 text-orange-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Permission Settings"})]}),t.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("label",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"checkbox",checked:y,onChange:N=>R(N.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),t.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to --dangerously-skip-permissions flag"})]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Jn,{className:"w-5 h-5 text-blue-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100",children:"Claude CLI Login"}),t.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:"Sign in to your Claude account to enable AI features"})]}),t.jsxs(Me,{onClick:ct,className:"bg-blue-600 hover:bg-blue-700 text-white",size:"sm",children:[t.jsx(Jn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($s,{className:"w-5 h-5 text-green-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Tools"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically allowed without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(wt,{value:x,onChange:N=>b(N.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:N=>{N.key==="Enter"&&vt(x)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>vt(x),disabled:!x,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(St,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Tool"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common tools:"}),t.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:je.map(N=>t.jsx(Me,{variant:"outline",size:"sm",onClick:()=>vt(N),disabled:m.includes(N),className:"text-xs h-8 touch-manipulation truncate",children:N},N))})]}),t.jsxs("div",{className:"space-y-2",children:[m.map(N=>t.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:N}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>Vt(N),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:t.jsx(ot,{className:"w-4 h-4"})})]},N)),m.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed tools configured"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Nn,{className:"w-5 h-5 text-red-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Tools"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically blocked without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(wt,{value:k,onChange:N=>C(N.target.value),placeholder:'e.g., "Bash(rm:*)" or "Write"',onKeyPress:N=>{N.key==="Enter"&&Ct(k)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>Ct(k),disabled:!k,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(St,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Tool"})]})]}),t.jsxs("div",{className:"space-y-2",children:[p.map(N=>t.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:N}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>Gt(N),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ot,{className:"w-4 h-4"})})]},N)),p.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed tools configured"})]})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Tool Pattern Examples:"}),t.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," - Allow all git log commands"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," - Allow all git diff commands"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," - Allow all Write tool usage"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Read"'})," - Allow all Read tool usage"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," - Block all rm commands (dangerous)"]})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ki,{className:"w-5 h-5 text-purple-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP Servers"})]}),t.jsx("div",{className:"space-y-2",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Model Context Protocol servers provide additional tools and data sources to Claude"})}),t.jsx("div",{className:"flex justify-between items-center",children:t.jsxs(Me,{onClick:()=>A(),className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(St,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),t.jsxs("div",{className:"space-y-2",children:[T.map(N=>t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[B(N.type),t.jsx("span",{className:"font-medium text-foreground",children:N.name}),t.jsx(Tr,{variant:"outline",className:"text-xs",children:N.type}),t.jsx(Tr,{variant:"outline",className:"text-xs",children:N.scope==="local"?"📁 local":N.scope==="user"?"👤 user":N.scope}),N.projectPath&&t.jsx(Tr,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20",title:N.projectPath,children:N.projectPath.split("/").pop()})]}),t.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[N.type==="stdio"&&N.config.command&&t.jsxs("div",{children:["Command: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:N.config.command})]}),(N.type==="sse"||N.type==="http")&&N.config.url&&t.jsxs("div",{children:["URL: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:N.config.url})]}),N.config.args&&N.config.args.length>0&&t.jsxs("div",{children:["Args: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:N.config.args.join(" ")})]}),N.config.env&&Object.keys(N.config.env).length>0&&t.jsxs("div",{children:["Environment: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(N.config.env).map(([X,pe])=>`${X}=${pe}`).join(", ")})]}),N.raw&&t.jsxs("details",{className:"mt-2",children:[t.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"View full config"}),t.jsx("pre",{className:"mt-1 text-xs bg-gray-100 dark:bg-gray-800 p-2 rounded overflow-x-auto",children:JSON.stringify(N.raw,null,2)})]})]}),Ae[N.id]&&t.jsxs("div",{className:`mt-2 p-2 rounded text-xs ${Ae[N.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:[t.jsx("div",{className:"font-medium",children:Ae[N.id].message}),Ae[N.id].details&&Ae[N.id].details.length>0&&t.jsx("ul",{className:"mt-1 space-y-0.5",children:Ae[N.id].details.map((X,pe)=>t.jsxs("li",{children:["• ",X]},pe))})]}),v[N.id]&&t.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200 border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"font-medium mb-2",children:"Available Tools & Resources"}),v[N.id].tools&&v[N.id].tools.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Tools (",v[N.id].tools.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:v[N.id].tools.map((X,pe)=>t.jsxs("li",{className:"flex items-start gap-1",children:[t.jsx("span",{className:"text-blue-400 mt-0.5",children:"•"}),t.jsxs("div",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:X.name}),X.description&&X.description!=="No description provided"&&t.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",X.description]})]})]},pe))})]}),v[N.id].resources&&v[N.id].resources.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Resources (",v[N.id].resources.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:v[N.id].resources.map((X,pe)=>t.jsxs("li",{className:"flex items-start gap-1",children:[t.jsx("span",{className:"text-blue-400 mt-0.5",children:"•"}),t.jsxs("div",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:X.name}),X.description&&X.description!=="No description provided"&&t.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",X.description]})]})]},pe))})]}),v[N.id].prompts&&v[N.id].prompts.length>0&&t.jsxs("div",{children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Prompts (",v[N.id].prompts.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:v[N.id].prompts.map((X,pe)=>t.jsxs("li",{className:"flex items-start gap-1",children:[t.jsx("span",{className:"text-blue-400 mt-0.5",children:"•"}),t.jsxs("div",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:X.name}),X.description&&X.description!=="No description provided"&&t.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",X.description]})]})]},pe))})]}),(!v[N.id].tools||v[N.id].tools.length===0)&&(!v[N.id].resources||v[N.id].resources.length===0)&&(!v[N.id].prompts||v[N.id].prompts.length===0)&&t.jsx("div",{className:"text-xs opacity-75",children:"No tools, resources, or prompts discovered"})]})]}),t.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[t.jsx(Me,{onClick:()=>A(N),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",title:"Edit server",children:t.jsx(ba,{className:"w-4 h-4"})}),t.jsx(Me,{onClick:()=>P(N.id,N.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",title:"Delete server",children:t.jsx(Jt,{className:"w-4 h-4"})})]})]})},N.id)),T.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]})]}),_&&t.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:t.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[t.jsx("h3",{className:"text-lg font-medium text-foreground",children:W?"Edit MCP Server":"Add MCP Server"}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:ft,children:t.jsx(ot,{className:"w-4 h-4"})})]}),t.jsxs("form",{onSubmit:ne,className:"p-4 space-y-4",children:[!W&&t.jsxs("div",{className:"flex gap-2 mb-4",children:[t.jsx("button",{type:"button",onClick:()=>K(N=>({...N,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${$.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"Form Input"}),t.jsx("button",{type:"button",onClick:()=>K(N=>({...N,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${$.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"JSON Import"})]}),$.importMode==="form"&&W&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope"}),t.jsxs("div",{className:"flex items-center gap-2",children:[$.scope==="user"?t.jsx(Fs,{className:"w-4 h-4"}):t.jsx(Pr,{className:"w-4 h-4"}),t.jsx("span",{className:"text-sm",children:$.scope==="user"?"User (Global)":"Project (Local)"}),$.scope==="local"&&$.projectPath&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",$.projectPath]})]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Scope cannot be changed when editing an existing server"})]}),$.importMode==="form"&&!W&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope *"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"button",onClick:()=>K(N=>({...N,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${$.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx(Fs,{className:"w-4 h-4"}),t.jsx("span",{children:"User (Global)"})]})}),t.jsx("button",{type:"button",onClick:()=>K(N=>({...N,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${$.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx(Pr,{className:"w-4 h-4"}),t.jsx("span",{children:"Project (Local)"})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:$.scope==="user"?"User scope: Available across all projects on your machine":"Local scope: Only available in the selected project"})]}),$.scope==="local"&&!W&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Project *"}),t.jsxs("select",{value:$.projectPath,onChange:N=>K(X=>({...X,projectPath:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:$.scope==="local",children:[t.jsx("option",{value:"",children:"Select a project..."}),n.map(N=>t.jsx("option",{value:N.path||N.fullPath,children:N.displayName||N.name},N.name))]}),$.projectPath&&t.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path: ",$.projectPath]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{className:$.importMode==="json"?"md:col-span-2":"",children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Server Name *"}),t.jsx(wt,{value:$.name,onChange:N=>{K(X=>({...X,name:N.target.value}))},placeholder:"my-server",required:!0})]}),$.importMode==="form"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Transport Type *"}),t.jsxs("select",{value:$.type,onChange:N=>{K(X=>({...X,type:N.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[t.jsx("option",{value:"stdio",children:"stdio"}),t.jsx("option",{value:"sse",children:"SSE"}),t.jsx("option",{value:"http",children:"HTTP"})]})]})]}),W&&$.raw&&$.importMode==="form"&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[t.jsxs("h4",{className:"text-sm font-medium text-foreground mb-2",children:["Configuration Details (from ",W.scope==="global"?"~/.claude.json":"project config",")"]}),t.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify($.raw,null,2)})]}),$.importMode==="json"&&t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"JSON Configuration *"}),t.jsx("textarea",{value:$.jsonInput,onChange:N=>{K(X=>({...X,jsonInput:N.target.value}));try{if(N.target.value.trim()){const X=JSON.parse(N.target.value);X.type?X.type==="stdio"&&!X.command?le("stdio type requires a command field"):(X.type==="http"||X.type==="sse")&&!X.url?le(`${X.type} type requires a url field`):le(""):le("Missing required field: type")}}catch{N.target.value.trim()?le("Invalid JSON format"):le("")}},className:`w-full px-3 py-2 border ${re?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
887
- "type": "stdio",
888
- "command": "/path/to/server",
889
- "args": ["--api-key", "abc123"],
890
- "env": {
891
- "CACHE_DIR": "/tmp"
892
- }
893
- }`,required:!0}),re&&t.jsx("p",{className:"text-xs text-red-500 mt-1",children:re}),t.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Paste your MCP server configuration in JSON format. Example formats:",t.jsx("br",{}),"• stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',t.jsx("br",{}),"• http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),$.importMode==="form"&&$.type==="stdio"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Command *"}),t.jsx(wt,{value:$.config.command,onChange:N=>U("command",N.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Arguments (one per line)"}),t.jsx("textarea",{value:Array.isArray($.config.args)?$.config.args.join(`
894
- `):"",onChange:N=>U("args",N.target.value.split(`
895
- `).filter(X=>X.trim())),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`--api-key
896
- abc123`})]})]}),$.importMode==="form"&&($.type==="sse"||$.type==="http")&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"URL *"}),t.jsx(wt,{value:$.config.url,onChange:N=>U("url",N.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),$.importMode==="form"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Environment Variables (KEY=value, one per line)"}),t.jsx("textarea",{value:Object.entries($.config.env||{}).map(([N,X])=>`${N}=${X}`).join(`
897
- `),onChange:N=>{const X={};N.target.value.split(`
898
- `).forEach(pe=>{const[Ke,...ut]=pe.split("=");Ke&&Ke.trim()&&(X[Ke.trim()]=ut.join("=").trim())}),U("env",X)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
899
- DEBUG=true`})]}),$.importMode==="form"&&($.type==="sse"||$.type==="http")&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Headers (KEY=value, one per line)"}),t.jsx("textarea",{value:Object.entries($.config.headers||{}).map(([N,X])=>`${N}=${X}`).join(`
900
- `),onChange:N=>{const X={};N.target.value.split(`
901
- `).forEach(pe=>{const[Ke,...ut]=pe.split("=");Ke&&Ke.trim()&&(X[Ke.trim()]=ut.join("=").trim())}),U("headers",X)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
902
- X-API-Key=your-key`})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[t.jsx(Me,{type:"button",variant:"outline",onClick:ft,children:"Cancel"}),t.jsx(Me,{type:"submit",disabled:ce,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:ce?"Saving...":W?"Update Server":"Add Server"})]})]})]})})]}),fe==="cursor"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Nn,{className:"w-5 h-5 text-orange-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Cursor Permission Settings"})]}),t.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("label",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"checkbox",checked:De,onChange:N=>ye(N.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),t.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to -f flag in Cursor CLI"})]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Jn,{className:"w-5 h-5 text-purple-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),t.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-purple-900 dark:text-purple-100",children:"Cursor CLI Login"}),t.jsx("div",{className:"text-sm text-purple-700 dark:text-purple-300",children:"Sign in to your Cursor account to enable AI features"})]}),t.jsxs(Me,{onClick:Rt,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(Jn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($s,{className:"w-5 h-5 text-green-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically allowed without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(wt,{value:ke,onChange:N=>Oe(N.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:N=>{N.key==="Enter"&&ke&&!ve.includes(ke)&&(Ye([...ve,ke]),Oe(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>{ke&&!ve.includes(ke)&&(Ye([...ve,ke]),Oe(""))},disabled:!ke,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(St,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common commands:"}),t.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:_e.map(N=>t.jsx(Me,{variant:"outline",size:"sm",onClick:()=>{ve.includes(N)||Ye([...ve,N])},disabled:ve.includes(N),className:"text-xs h-8 touch-manipulation truncate",children:N},N))})]}),t.jsxs("div",{className:"space-y-2",children:[ve.map(N=>t.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:N}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>Ye(ve.filter(X=>X!==N)),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:t.jsx(ot,{className:"w-4 h-4"})})]},N)),ve.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed shell commands configured"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx($s,{className:"w-5 h-5 text-red-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that should always be denied"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(wt,{value:st,onChange:N=>Ie(N.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:N=>{N.key==="Enter"&&st&&!Ue.includes(st)&&(at([...Ue,st]),Ie(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>{st&&!Ue.includes(st)&&(at([...Ue,st]),Ie(""))},disabled:!st,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(St,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[Ue.map(N=>t.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:N}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>at(Ue.filter(X=>X!==N)),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ot,{className:"w-4 h-4"})})]},N)),Ue.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed shell commands configured"})]})]}),t.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:"Cursor Shell Command Examples:"}),t.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," - Allow ls command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," - Allow git status command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(mkdir)"'})," - Allow mkdir command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"-f"'})," flag - Skip all permission prompts (dangerous)"]})]})]})]})]}),ie==="tasks"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:u?t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking TaskMaster installation..."})]})}):t.jsxs(t.Fragment,{children:[!l&&t.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:"TaskMaster AI CLI Not Installed"}),t.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[t.jsx("p",{children:"TaskMaster CLI is required to use task management features. Install it to get started:"}),t.jsxs("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:[t.jsx("code",{children:"npm install -g task-master-ai"}),t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"font-medium",children:"After installation:"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[t.jsx("li",{children:"Restart this application"}),t.jsx("li",{children:"TaskMaster features will automatically become available"}),t.jsxs("li",{children:["Use ",t.jsx("code",{className:"bg-orange-100 dark:bg-orange-800 px-1 rounded",children:"task-master init"})," in your project directory"]})]})]})]})]})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Enable TaskMaster Integration"}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}),!l&&t.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400 mt-1",children:"TaskMaster CLI must be installed first"})]}),t.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:i,onChange:N=>o(N.target.checked),disabled:!l,className:"sr-only peer"}),t.jsx("div",{className:`w-11 h-6 ${l?"bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800":"bg-gray-300 dark:bg-gray-600"} rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600`})]})]})}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(ya,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 About TaskMaster AI"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:[t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks with AI assistance"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"PRD:"})," Generate structured tasks from Product Requirements Documents"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards, and detailed task views"]})]})]}),t.jsx("div",{className:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-700",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-6 h-6 bg-blue-100 dark:bg-blue-800 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-3 h-3 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"📚 Learn More & Tutorial"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:["TaskMaster AI (aka ",t.jsx("strong",{children:"claude-task-master"})," ) is an advanced AI-powered task management system built for developers."]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]}),t.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Find documentation, setup guides, and examples for advanced TaskMaster workflows"})]})]})]})]})})]})})]})]})}),ie==="api"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:t.jsx(c1,{})})]})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[t.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[O==="success"&&t.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Settings saved successfully!"]}),O==="error"&&t.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"Failed to save settings"]})]}),t.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[t.jsx(Me,{variant:"outline",onClick:r,disabled:H,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),t.jsx(Me,{onClick:Qt,disabled:H,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:H?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Saving..."]}):"Save Settings"})]})]})]}),de&&t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 max-md:items-stretch max-md:justify-stretch",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:D==="claude"?"Claude CLI Login":"Cursor CLI Login"}),t.jsx("button",{onClick:()=>z(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:t.jsx(ot,{className:"w-6 h-6"})})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(au,{project:Z,command:D==="claude"?"claude /login":"cursor-agent login",onComplete:Ot,showHeader:!1})})]})})]}):null}function u1(){const{isDarkMode:e,toggleDarkMode:r}=Ci();return t.jsxs("button",{onClick:r,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[t.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),t.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):t.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const m1=({isOpen:e,onToggle:r,autoExpandTools:n,onAutoExpandChange:s,showRawParameters:a,onShowRawParametersChange:i,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:m,isMobile:h})=>{const[p,g]=f.useState(e),[x,b]=f.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:k}=Ci();f.useEffect(()=>{g(e)},[e]);const C=()=>{const y=!p;g(y),r(y)};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`fixed ${h?"bottom-44":"top-1/2 -translate-y-1/2"} ${p?"right-64":"right-0"} z-50 transition-all duration-150 ease-out`,children:t.jsx("button",{onClick:C,className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg","aria-label":p?"Close settings panel":"Open settings panel",children:p?t.jsx(wr,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):t.jsx(ep,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}),t.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl transform transition-transform duration-150 ease-out z-40 ${p?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:t.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[t.jsx(ph,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),"Quick Settings"]})}),t.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-white dark:bg-gray-900 ${h?"pb-20":""}`,children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Appearance"}),t.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[k?t.jsx(ac,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):t.jsx(oc,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Dark Mode"]}),t.jsx(u1,{})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Tool Display"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Xa,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-expand tools"]}),t.jsx("input",{type:"checkbox",checked:n,onChange:y=>s(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(on,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show raw parameters"]}),t.jsx("input",{type:"checkbox",checked:a,onChange:y=>i(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Zl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show thinking"]}),t.jsx("input",{type:"checkbox",checked:o,onChange:y=>l(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"View Options"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Xl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-scroll to bottom"]}),t.jsx("input",{type:"checkbox",checked:c,onChange:y=>d(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Input Settings"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Up,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),t.jsx("input",{type:"checkbox",checked:u,onChange:y=>m(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends."})]}),t.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Whisper Dictation"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:x==="default",onChange:()=>{b("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(as,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Default Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Direct transcription of your speech"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:x==="prompt",onChange:()=>{b("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(Lr,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Prompt Enhancement"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Transform rough ideas into clear, detailed AI prompts"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:x==="vibe"||x==="instructions"||x==="architect",onChange:()=>{b("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(Tt,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Vibe Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Format ideas as clear agent instructions with details"})]})]})]})]})]})]})}),p&&t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:C})]})},p1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(""),{register:u}=ws(),m=async h=>{if(h.preventDefault(),d(""),n!==a){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(n.length<6){d("Password must be at least 6 characters long");return}l(!0);const p=await u(e,n);p.success||d(p.error),l(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(tr,{size:64})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),t.jsxs("form",{onSubmit:m,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:h=>r(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),t.jsx("input",{type:"password",id:"confirmPassword",value:a,onChange:h=>i(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),t.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},h1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(!1),[o,l]=f.useState(""),{login:c}=ws(),d=async u=>{if(u.preventDefault(),l(""),!e||!n){l("Please enter both username and password");return}i(!0);const m=await c(e,n);m.success||l(m.error),i(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(An,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome Back"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to your Claude Code UI account"})]}),t.jsxs("form",{onSubmit:d,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:u=>r(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:a})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:u=>s(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:a})]}),o&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),t.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"Signing in...":"Sign In"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},f1=()=>t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(An,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),g1=({children:e})=>{const{user:r,isLoading:n,needsSetup:s}=ws();return n?t.jsx(f1,{}):s?t.jsx(p1,{}):r?e:t.jsx(h1,{})},Al="1.10.3",x1=(e,r)=>{const[n,s]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null);return f.useEffect(()=>{const c=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${r}/releases/latest`)).json();if(m.tag_name){const h=m.tag_name.replace(/^v/,"");i(h),s(Al!==h),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${r}/releases/latest`,publishedAt:m.published_at})}else s(!1),i(null),l(null)}catch(u){console.error("Version check failed:",u),s(!1),i(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,r]),{updateAvailable:n,latestVersion:a,currentVersion:Al,releaseInfo:o}};function kn(e,r){const[n,s]=f.useState(()=>{if(typeof window>"u")return r;try{const i=window.localStorage.getItem(e);return i?JSON.parse(i):r}catch(i){return console.log(i),r}});return[n,i=>{if(!(typeof window>"u"))try{const o=i instanceof Function?i(n):i;window.localStorage.setItem(e,JSON.stringify(o)),s(o)}catch(o){console.log(o)}}]}function Ml(){const e=Ku(),{sessionId:r}=Ju(),{updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i}=x1("siteboon","claudecodeui"),[o,l]=f.useState(!1),[c,d]=f.useState([]),[u,m]=f.useState(null),[h,p]=f.useState(null),[g,x]=f.useState("chat"),[b,k]=f.useState(!1),[C,y]=f.useState(!1),[R,H]=f.useState(!0),[M,O]=f.useState(!1),[L,q]=f.useState(!1),[j,T]=f.useState(!1),[I,_]=kn("autoExpandTools",!1),[w,W]=kn("showRawParameters",!1),[F,$]=kn("showThinking",!0),[K,ce]=kn("autoScrollToBottom",!0),[S,Ae]=kn("sendByCtrlEnter",!1),[$e,v]=f.useState(new Set),[ae,me]=f.useState(new Set),[Ee,ie]=f.useState(0),{ws:qe,sendMessage:re,messages:le}=dc(),[fe,we]=f.useState(!1);f.useEffect(()=>{const D=()=>{const Y=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");we(Y),Y?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return D(),window.matchMedia("(display-mode: standalone)").addEventListener("change",D),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",D)}},[]),f.useEffect(()=>{const D=()=>{k(window.innerWidth<768)};return D(),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),f.useEffect(()=>{Ye()},[]);const ve=(D,Y,Z,se)=>{if(!Z||!se)return!0;const je=D?.find(We=>We.name===Z.name),_e=Y?.find(We=>We.name===Z.name);if(!je||!_e)return!1;const Le=je.sessions?.find(We=>We.id===se.id),Ge=_e.sessions?.find(We=>We.id===se.id);return!Le||!Ge?!1:Le.id===Ge.id&&Le.title===Ge.title&&Le.created_at===Ge.created_at&&Le.updated_at===Ge.updated_at};f.useEffect(()=>{if(le.length>0){const D=le[le.length-1];if(D.type==="projects_updated"){if(D.changedFile&&h&&u){const se=D.changedFile.split("/");se.length>=2&&se[se.length-1].replace(".jsonl","")===h.id&&($e.has(h.id)||ie(Ge=>Ge+1))}if(h&&$e.has(h.id)||$e.size>0&&Array.from($e).some(se=>se.startsWith("new-session-"))){const se=D.projects;if(!ve(c,se,u,h))return}const Z=D.projects;if(d(Z),u){const se=Z.find(je=>je.name===u.name);se&&(JSON.stringify(se)!==JSON.stringify(u)&&m(se),h&&(se.sessions?.find(_e=>_e.id===h.id)||p(null)))}}}},[le,u,h,$e]);const Ye=async()=>{try{H(!0);const Y=await(await Fe.projects()).json();for(let Z of Y)try{const se=`/api/cursor/sessions?projectPath=${encodeURIComponent(Z.fullPath||Z.path)}`,je=await Pe(se);if(je.ok){const _e=await je.json();_e.success&&_e.sessions?Z.cursorSessions=_e.sessions:Z.cursorSessions=[]}else Z.cursorSessions=[]}catch(se){console.error(`Error fetching Cursor sessions for project ${Z.name}:`,se),Z.cursorSessions=[]}d(Z=>Z.length===0||Y.some((je,_e)=>{const Le=Z[_e];return Le?je.name!==Le.name||je.displayName!==Le.displayName||je.fullPath!==Le.fullPath||JSON.stringify(je.sessionMeta)!==JSON.stringify(Le.sessionMeta)||JSON.stringify(je.sessions)!==JSON.stringify(Le.sessions)||JSON.stringify(je.cursorSessions)!==JSON.stringify(Le.cursorSessions):!0})||Y.length!==Z.length?Y:Z)}catch(D){console.error("Error fetching projects:",D)}finally{H(!1)}};window.refreshProjects=Ye,f.useEffect(()=>{if(r&&c.length>0){const D=!h||h.id!==r;for(const Y of c){let Z=Y.sessions?.find(je=>je.id===r);if(Z){m(Y),p({...Z,__provider:"claude"}),D&&x("chat");return}const se=Y.cursorSessions?.find(je=>je.id===r);if(se){m(Y),p({...se,__provider:"cursor"}),D&&x("chat");return}}}},[r,c,e]);const Ue=D=>{m(D),p(null),e("/"),b&&y(!1)},at=D=>{if(p(D),g!=="git"&&g!=="preview"&&x("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",D.id),b){const Z=D.__projectName,se=u?.name;Z!==se&&y(!1)}e(`/session/${D.id}`)},De=D=>{m(D),p(null),x("chat"),e("/"),b&&y(!1)},ye=D=>{h?.id===D&&(p(null),e("/")),d(Y=>Y.map(Z=>({...Z,sessions:Z.sessions?.filter(se=>se.id!==D)||[],sessionMeta:{...Z.sessionMeta,total:Math.max(0,(Z.sessionMeta?.total||0)-1)}})))},ke=async()=>{try{const Y=await(await Fe.projects()).json();if(d(Z=>Y.some((je,_e)=>{const Le=Z[_e];return Le?je.name!==Le.name||je.displayName!==Le.displayName||je.fullPath!==Le.fullPath||JSON.stringify(je.sessionMeta)!==JSON.stringify(Le.sessionMeta)||JSON.stringify(je.sessions)!==JSON.stringify(Le.sessions):!0})||Y.length!==Z.length?Y:Z),u){const Z=Y.find(se=>se.name===u.name);if(Z&&(JSON.stringify(Z)!==JSON.stringify(u)&&m(Z),h)){const se=Z.sessions?.find(je=>je.id===h.id);se&&JSON.stringify(se)!==JSON.stringify(h)&&p(se)}}}catch(D){console.error("Error refreshing sidebar:",D)}},Oe=D=>{u?.name===D&&(m(null),p(null),e("/")),d(Y=>Y.filter(Z=>Z.name!==D))},st=f.useCallback(D=>{D&&v(Y=>new Set([...Y,D]))},[]),Ie=f.useCallback(D=>{D&&v(Y=>{const Z=new Set(Y);return Z.delete(D),Z})},[]),Lt=f.useCallback(D=>{D&&me(Y=>new Set([...Y,D]))},[]),te=f.useCallback(D=>{D&&me(Y=>{const Z=new Set(Y);return Z.delete(D),Z})},[]),de=f.useCallback(D=>{D&&v(Y=>{const Z=new Set;for(const se of Y)se.startsWith("new-session-")||Z.add(se);return Z.add(D),Z})},[]),z=()=>{const[D,Y]=f.useState(!1),[Z,se]=f.useState(""),[je,_e]=f.useState("");if(!o)return null;const Le=et=>et?et.replace(/\b[0-9a-f]{40}\b/gi,"").replace(/(?:^|\s|-)([0-9a-f]{7,10})\b/gi,"").replace(/\*\*Full Changelog\*\*:.*$/gim,"").replace(/https?:\/\/github\.com\/[^\/]+\/[^\/]+\/compare\/[^\s)]+/gi,"").replace(/\n\s*\n\s*\n/g,`
903
-
904
- `).trim():"",Ge=async()=>{Y(!0),se(`Starting update...
905
- `),_e("");try{const et=await Pe("/api/system/update",{method:"POST"}),We=await et.json();et.ok?(se(nt=>nt+We.output+`
906
- `),se(nt=>nt+`
907
- ✅ Update completed successfully!
908
- `),se(nt=>nt+`Please restart the server to apply changes.
909
- `)):(_e(We.error||"Update failed"),se(nt=>nt+`
910
- ❌ Update failed: `+(We.error||"Unknown error")+`
911
- `))}catch(et){_e(et.message),se(We=>We+`
912
- ❌ Update failed: `+et.message+`
913
- `)}finally{Y(!1)}};return t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[t.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>l(!1),"aria-label":"Close version upgrade modal"}),t.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-2xl mx-4 p-6 space-y-4 max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center",children:t.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Update Available"}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i?.title||"A new version is ready"})]})]}),t.jsx("button",{onClick:()=>l(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Current Version"}),t.jsx("span",{className:"text-sm text-gray-900 dark:text-white font-mono",children:a})]}),t.jsxs("div",{className:"flex justify-between items-center p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700",children:[t.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Latest Version"}),t.jsx("span",{className:"text-sm text-blue-900 dark:text-blue-100 font-mono",children:s})]})]}),i?.body&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"What's New:"}),i?.htmlUrl&&t.jsxs("a",{href:i.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:underline flex items-center gap-1",children:["View full release",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600 max-h-64 overflow-y-auto",children:t.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap prose prose-sm dark:prose-invert max-w-none",children:Le(i.body)})})]}),Z&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Update Progress:"}),t.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-lg p-4 border border-gray-700 max-h-48 overflow-y-auto",children:t.jsx("pre",{className:"text-xs text-green-400 font-mono whitespace-pre-wrap",children:Z})})]}),!D&&!Z&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Manual upgrade:"}),t.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 border",children:t.jsx("code",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono",children:"git checkout main && git pull && npm install"})}),t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:'Or click "Update Now" to run the update automatically.'})]}),t.jsxs("div",{className:"flex gap-2 pt-2",children:[t.jsx("button",{onClick:()=>l(!1),className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:Z?"Close":"Later"}),!Z&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install")},className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:"Copy Command"}),t.jsx("button",{onClick:Ge,disabled:D,className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed rounded-md transition-colors flex items-center justify-center gap-2",children:D?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Updating..."]}):"Update Now"})]})]})]})]})};return t.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!b&&t.jsx("div",{className:"w-80 flex-shrink-0 border-r border-border bg-card",children:t.jsx("div",{className:"h-full overflow-hidden",children:t.jsx(Qi,{projects:c,selectedProject:u,selectedSession:h,onProjectSelect:Ue,onSessionSelect:at,onNewSession:De,onSessionDelete:ye,onProjectDelete:Oe,isLoading:R,onRefresh:ke,onShowSettings:()=>q(!0),updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i,onShowVersionModal:()=>l(!0),isPWA:fe,isMobile:b})})}),b&&t.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${C?"opacity-100 visible":"opacity-0 invisible"}`,children:[t.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:D=>{D.stopPropagation(),y(!1)},onTouchStart:D=>{D.preventDefault(),D.stopPropagation(),y(!1)},"aria-label":"Close sidebar"}),t.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 bg-card border-r border-border transform transition-transform duration-150 ease-out ${C?"translate-x-0":"-translate-x-full"}`,style:{height:"calc(100vh - 80px)"},onClick:D=>D.stopPropagation(),onTouchStart:D=>D.stopPropagation(),children:t.jsx(Qi,{projects:c,selectedProject:u,selectedSession:h,onProjectSelect:Ue,onSessionSelect:at,onNewSession:De,onSessionDelete:ye,onProjectDelete:Oe,isLoading:R,onRefresh:ke,onShowSettings:()=>q(!0),updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i,onShowVersionModal:()=>l(!0),isPWA:fe,isMobile:b})})]}),t.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${b&&!M?"pb-16":""}`,children:t.jsx(i1,{selectedProject:u,selectedSession:h,activeTab:g,setActiveTab:x,ws:qe,sendMessage:re,messages:le,isMobile:b,isPWA:fe,onMenuClick:()=>y(!0),isLoading:R,onInputFocusChange:O,onSessionActive:st,onSessionInactive:Ie,onSessionProcessing:Lt,onSessionNotProcessing:te,processingSessions:ae,onReplaceTemporarySession:de,onNavigateToSession:D=>e(`/session/${D}`),onShowSettings:()=>q(!0),autoExpandTools:I,showRawParameters:w,showThinking:F,autoScrollToBottom:K,sendByCtrlEnter:S,externalMessageUpdate:Ee})}),b&&t.jsx(o1,{activeTab:g,setActiveTab:x,isInputFocused:M}),g==="chat"&&t.jsx(m1,{isOpen:j,onToggle:T,autoExpandTools:I,onAutoExpandChange:_,showRawParameters:w,onShowRawParametersChange:W,showThinking:F,onShowThinkingChange:$,autoScrollToBottom:K,onAutoScrollChange:ce,sendByCtrlEnter:S,onSendByCtrlEnterChange:Ae,isMobile:b}),t.jsx(d1,{isOpen:L,onClose:()=>q(!1),projects:c}),t.jsx(z,{})]})}function b1(){return t.jsx(l1,{children:t.jsx(Ph,{children:t.jsx(Rh,{children:t.jsx(zh,{children:t.jsx(_h,{children:t.jsx(g1,{children:t.jsx(Vu,{children:t.jsxs(Gu,{children:[t.jsx(_i,{path:"/",element:t.jsx(Ml,{})}),t.jsx(_i,{path:"/session/:sessionId",element:t.jsx(Ml,{})})]})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(r=>{r.unregister()})}).catch(e=>{console.warn("Failed to unregister service workers:",e)});rm.createRoot(document.getElementById("root")).render(t.jsx(cr.StrictMode,{children:t.jsx(b1,{})}));