@siteboon/claude-code-ui 1.9.0 → 1.10.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.
- package/README.md +44 -2
- package/dist/api-docs.html +857 -0
- package/dist/assets/index-BHQThXog.css +32 -0
- package/dist/assets/index-DPk7rbtA.js +902 -0
- package/dist/assets/{vendor-codemirror-D2k1L1JZ.js → vendor-codemirror-B7BYDWj-.js} +17 -17
- package/dist/index.html +3 -3
- package/package.json +8 -4
- package/server/claude-sdk.js +5 -0
- package/server/cursor-cli.js +5 -0
- package/server/database/db.js +180 -3
- package/server/database/init.sql +34 -1
- package/server/index.js +36 -15
- package/server/projects.js +8 -4
- package/server/routes/agent.js +1161 -0
- package/server/routes/git.js +264 -54
- package/server/routes/settings.js +178 -0
- package/dist/assets/index-Bmo7Hu70.css +0 -32
- package/dist/assets/index-D3NZxyU6.js +0 -793
|
@@ -0,0 +1,902 @@
|
|
|
1
|
+
import{j as t,S as Pn,F as ks,T as Tl,P as Dl,E as qt,V as vs,a as qa,g as Au,R as Mu,D as dr,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 Kr,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 Wu,x as Uu,y as Hu}from"./vendor-codemirror-B7BYDWj-.js";import{b as qu,g as Ln,a as f,R as or,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 m=i.length===0?a:a.substring(c),u=dm(m),h=u!==m,p=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:u,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 m=l[d],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(m);if(u){c=m+(c.length>0?" "+c:c);continue}let b=!!x,k=s(b?g.substring(0,x):g);if(!k){if(!b){c=m+(c.length>0?" "+c:c);continue}if(k=s(g),!k){c=m+(c.length>0?" "+c:c);continue}b=!1}const N=i(h).join(":"),y=p?N+fa:N,_=y+k;if(o.includes(_))continue;o.push(_);const U=a(k,b);for(let D=0;D<U.length;++D){const B=U[D];o.push(y+B)}c=m+(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((m,u)=>u(m),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 m=hm(c,n);return a(c,m),m}return function(){return i(fm.apply(null,arguments))}}const bt=e=>{const r=n=>n[e]||[];return r.isThemeGetter=!0,r},Wl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ul=/^\((?:(\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)\(.+\)$/,Br=e=>xm.test(e),qe=e=>!!e&&!Number.isNaN(Number(e)),fr=e=>!!e&&Number.isInteger(Number(e)),_s=e=>e.endsWith("%")&&qe(e.slice(0,-1)),ar=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=>!be(e)&&!ye(e),Im=e=>nn(e,Gl,Hl),be=e=>Wl.test(e),Cr=e=>nn(e,Kl,Nm),zs=e=>nn(e,Pm,qe),Oi=e=>nn(e,ql,Hl),Am=e=>nn(e,Vl,Sm),Vn=e=>nn(e,Jl,Cm),ye=e=>Ul.test(e),hn=e=>sn(e,Kl),Mm=e=>sn(e,Lm),Bi=e=>sn(e,ql),Tm=e=>sn(e,Gl),Dm=e=>sn(e,Vl),Gn=e=>sn(e,Jl,!0),nn=(e,r,n)=>{const s=Wl.exec(e);return s?s[1]?r(s[1]):n(s[2]):!1},sn=(e,r,n=!1)=>{const s=Ul.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=bt("color"),r=bt("font"),n=bt("text"),s=bt("font-weight"),a=bt("tracking"),i=bt("leading"),o=bt("breakpoint"),l=bt("container"),c=bt("spacing"),d=bt("radius"),m=bt("shadow"),u=bt("inset-shadow"),h=bt("text-shadow"),p=bt("drop-shadow"),g=bt("blur"),x=bt("perspective"),b=bt("aspect"),k=bt("ease"),N=bt("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],U=()=>[..._(),ye,be],D=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],L=()=>[ye,be,c],H=()=>[Br,"full","auto",...L()],j=()=>[fr,"none","subgrid",ye,be],P=()=>["auto",{span:["full",fr,ye,be]},fr,ye,be],M=()=>[fr,"auto",ye,be],R=()=>["auto","min","max","fr",ye,be],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...L()],$=()=>[Br,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],G=()=>[e,ye,be],ce=()=>[..._(),Bi,Oi,{position:[ye,be]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],je=()=>["auto","cover","contain",Tm,Im,{size:[ye,be]}],We=()=>[_s,hn,Cr],v=()=>["","none","full",d,ye,be],te=()=>["",qe,hn,Cr],me=()=>["solid","dashed","dotted","double"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[qe,_s,Bi,Oi],Oe=()=>["","none",g,ye,be],ee=()=>["none",qe,ye,be],oe=()=>["none",qe,ye,be],he=()=>[qe,ye,be],Ce=()=>[Br,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ar],breakpoint:[ar],color:[jm],container:[ar],"drop-shadow":[ar],ease:["in","out","in-out"],font:[Em],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ar],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ar],shadow:[ar],spacing:["px",qe],text:[ar],"text-shadow":[ar],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Br,be,ye,b]}],container:["container"],columns:[{columns:[qe,be,ye,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:U()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{start:H()}],end:[{end:H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[fr,"auto",ye,be]}],basis:[{basis:[Br,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,Br,"auto","initial","none",be]}],grow:[{grow:["",qe,ye,be]}],shrink:[{shrink:["",qe,ye,be]}],order:[{order:[fr,"first","last","none",ye,be]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],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:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"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,Cr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,ye,zs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_s,be]}],"font-family":[{font:[Mm,be,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,ye,be]}],"line-clamp":[{"line-clamp":[qe,"none",ye,zs]}],leading:[{leading:[i,...L()]}],"list-image":[{"list-image":["none",ye,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",ye,Cr]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[qe,"auto",ye,be]}],"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",ye,be]}],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",ye,be]}],"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:I()}],"bg-size":[{bg:je()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fr,ye,be],radial:["",ye,be],conic:[fr,ye,be]},Dm,Am]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:We()}],"gradient-via-pos":[{via:We()}],"gradient-to-pos":[{to:We()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],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:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,ye,be]}],"outline-w":[{outline:["",qe,hn,Cr]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",m,Gn,Vn]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",u,Gn,Vn]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[qe,Cr]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",h,Gn,Vn]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[qe,ye,be]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ne()}],"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":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[ye,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:je()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,be]}],filter:[{filter:["","none",ye,be]}],blur:[{blur:Oe()}],brightness:[{brightness:[qe,ye,be]}],contrast:[{contrast:[qe,ye,be]}],"drop-shadow":[{"drop-shadow":["","none",p,Gn,Vn]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",qe,ye,be]}],"hue-rotate":[{"hue-rotate":[qe,ye,be]}],invert:[{invert:["",qe,ye,be]}],saturate:[{saturate:[qe,ye,be]}],sepia:[{sepia:["",qe,ye,be]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,be]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[qe,ye,be]}],"backdrop-contrast":[{"backdrop-contrast":[qe,ye,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,ye,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,ye,be]}],"backdrop-invert":[{"backdrop-invert":["",qe,ye,be]}],"backdrop-opacity":[{"backdrop-opacity":[qe,ye,be]}],"backdrop-saturate":[{"backdrop-saturate":[qe,ye,be]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,ye,be]}],"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",ye,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",ye,be]}],ease:[{ease:["linear","initial",k,ye,be]}],delay:[{delay:[qe,ye,be]}],animate:[{animate:["none",N,ye,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ye,be]}],"perspective-origin":[{"perspective-origin":U()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[ye,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:U()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"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",ye,be]}],"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",ye,be]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[qe,hn,Cr,zs]}],stroke:[{stroke:["none",...G()]}],"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 Ee(...e){return _m($l(e))}const Ja=f.forwardRef(({className:e,children:r,...n},s)=>t.jsx("div",{ref:s,className:Ee("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 Wi=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ui=$l,Yl=(e,r)=>n=>{var s;if(r?.variants==null)return Ui(e,n?.class,n?.className);const{variants:a,defaultVariants:i}=r,o=Object.keys(a).map(d=>{const m=n?.[d],u=i?.[d];if(m===null)return null;const h=Wi(m)||Wi(u);return a[d][h]}),l=n&&Object.entries(n).reduce((d,m)=>{let[u,h]=m;return h===void 0||(d[u]=h),d},{}),c=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((d,m)=>{let{class:u,className:h,...p}=m;return Object.entries(p).every(g=>{let[x,b]=g;return Array.isArray(b)?b.includes({...i,...l}[x]):{...i,...l}[x]===b})?[...d,u,h]:d},[]);return Ui(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:Ee(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 Mr({className:e,variant:r,...n}){return t.jsx("div",{className:Ee(Fm({variant:r}),e),...n})}const wt=f.forwardRef(({className:e,type:r,...n},s)=>t.jsx("input",{type:r,className:Ee("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 Wm={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 Um=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,...Wm,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,m])=>f.createElement(d,m)),...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 de=(e,r)=>{const n=f.forwardRef(({className:s,...a},i)=>f.createElement(Um,{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=de("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=de("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=de("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=de("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=de("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"}]],Tr=de("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"}]],Ht=de("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=de("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"}]],kr=de("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=de("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=de("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=de("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=de("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=de("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"}]],qr=de("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=de("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=de("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=de("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=de("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=de("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"}]],an=de("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=de("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=de("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=de("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=de("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=de("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"}]],Dr=de("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=de("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"}]],Xt=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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"}]],Wp=de("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 Up=[["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=de("list",Up);/**
|
|
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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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=de("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"}]],Ct=de("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"}]],yr=de("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=de("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"}]],Jr=de("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=de("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"}]],Yr=de("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=de("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=de("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"}]],Pr=de("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=de("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=de("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=de("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=de("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=de("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=de("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"}]],Qr=de("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"}]],Kt=de("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=de("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=de("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=de("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=de("zap",Th),Zt=({className:e="w-5 h-5"})=>t.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),ir=({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:Yr,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:Ee("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:Ee("inline-flex items-center justify-center rounded-full transition-colors",i.bgColor,c[r],n),title:i.title,children:t.jsx(o,{className:Ee(l[r],i.color)})})},De=(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:()=>De("/api/auth/user"),logout:()=>De("/api/auth/logout",{method:"POST"})},config:()=>De("/api/config"),projects:()=>De("/api/projects"),sessions:(e,r=5,n=0)=>De(`/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 De(o)},renameProject:(e,r)=>De(`/api/projects/${e}/rename`,{method:"PUT",body:JSON.stringify({displayName:r})}),deleteSession:(e,r)=>De(`/api/projects/${e}/sessions/${r}`,{method:"DELETE"}),deleteProject:e=>De(`/api/projects/${e}`,{method:"DELETE"}),createProject:e=>De("/api/projects/create",{method:"POST",body:JSON.stringify({path:e})}),readFile:(e,r)=>De(`/api/projects/${e}/file?filePath=${encodeURIComponent(r)}`),saveFile:(e,r,n)=>De(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({filePath:r,content:n})}),getFiles:e=>De(`/api/projects/${e}/files`),transcribe:e=>De("/api/transcribe",{method:"POST",body:e,headers:{}}),taskmaster:{init:e=>De(`/api/taskmaster/init/${e}`,{method:"POST"}),addTask:(e,{prompt:r,title:n,description:s,priority:a,dependencies:i})=>De(`/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})=>De(`/api/taskmaster/parse-prd/${e}`,{method:"POST",body:JSON.stringify({fileName:r,numTasks:n,append:s})}),getTemplates:()=>De("/api/taskmaster/prd-templates"),applyTemplate:(e,{templateId:r,fileName:n,customizations:s})=>De(`/api/taskmaster/apply-template/${e}`,{method:"POST",body:JSON.stringify({templateId:r,fileName:n,customizations:s})}),updateTask:(e,r,n)=>De(`/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),De(`/api/browse-filesystem?${r}`)},get:e=>De(`/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,m]=f.useState(null);f.useEffect(()=>{u()},[]);const u=async()=>{try{if(o(!0),m(null),(await(await Fe.auth.status()).json()).needsSetup){c(!0),o(!1);return}if(s)try{const N=await Fe.auth.user();if(N.ok){const y=await N.json();n(y.user),c(!1)}else localStorage.removeItem("auth-token"),a(null),n(null)}catch(N){console.error("Token verification failed:",N),localStorage.removeItem("auth-token"),a(null),n(null)}}catch(b){console.error("Auth status check failed:",b),m("Failed to check authentication status")}finally{o(!1)}},x={user:r,token:s,login:async(b,k)=>{try{m(null);const N=await Fe.auth.login(b,k),y=await N.json();return N.ok?(a(y.token),n(y.user),localStorage.setItem("auth-token",y.token),{success:!0}):(m(y.error||"Login failed"),{success:!1,error:y.error||"Login failed"})}catch(N){console.error("Login error:",N);const y="Network error. Please try again.";return m(y),{success:!1,error:y}}},register:async(b,k)=>{try{m(null);const N=await Fe.auth.register(b,k),y=await N.json();return N.ok?(a(y.token),n(y.user),c(!1),localStorage.setItem("auth-token",y.token),{success:!0}):(m(y.error||"Registration failed"),{success:!1,error:y.error||"Registration failed"})}catch(N){console.error("Registration error:",N);const y="Network error. Please try again.";return m(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 m;try{if(m=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${d}`}})).json()).wsUrl,m.includes("localhost")&&!window.location.hostname.includes("localhost")){const x=window.location.protocol==="https:"?"wss:":"ws:",b=window.location.port==="3001"?"3002":window.location.port;m=`${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;m=`${g}//${window.location.hostname}:${x}`}const u=`${m}/ws?token=${encodeURIComponent(d)}`,h=new WebSocket(u);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,m]=f.useState(null),[u,h]=f.useState(null),[p,g]=f.useState([]),[x,b]=f.useState(null),[k,N]=f.useState(!1),[y,_]=f.useState(!1),[U,D]=f.useState(!1),[B,L]=f.useState(null),H=(O,$)=>{console.error(`TaskMaster ${$} error:`,O),L({message:O.message||`Failed to ${$}`,context:$,timestamp:new Date().toISOString()})},j=f.useCallback(()=>{L(null)},[]),P=f.useCallback(async()=>{if(!n||!s){o([]),c(null);return}try{N(!0),j();const O=await Fe.get("/projects");if(!O.ok)throw new Error(`Failed to fetch projects: ${O.status}`);const $=await O.json();if(!Array.isArray($)){console.error("Projects API returned non-array data:",$),o([]);return}const G=$.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(G),l){const ce=G.find(I=>I.name===l.name);ce&&(c(ce),m(ce.taskmaster))}}catch(O){H(O,"load projects")}finally{N(!1)}},[n,s]),M=f.useCallback(async O=>{try{if(c(O),g([]),b(null),m(null),O?.name)try{const $=await Fe.get(`/taskmaster/detect/${encodeURIComponent(O.name)}`);if($.ok){const G=await $.json();m(G.taskmaster)}else console.warn("Individual TaskMaster detection failed, using project data:",$.status),m(O.taskmaster||null)}catch($){console.warn("TaskMaster detection error, using project data:",$.message),m(O.taskmaster||null)}else m(null)}catch($){console.error("Error in setCurrentProject:",$),H($,"set current project"),m(O?.taskmaster||null)}},[]),R=f.useCallback(async()=>{if(!n||!s){h(null);return}try{D(!0),j();const O=await Fe.get("/mcp-utils/taskmaster-server");h(O)}catch(O){H(O,"check MCP server status")}finally{D(!1)}},[n,s]),w=f.useCallback(async()=>{if(!l){g([]),b(null);return}if(!n||!s){g([]),b(null);return}try{_(!0),j();const O=await Fe.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!O.ok){const ce=await O.json();throw new Error(ce.message||"Failed to load tasks")}const $=await O.json();g($.tasks||[]);const G=$.tasks?.find(ce=>ce.status==="pending"||ce.status==="in-progress")||null;b(G)}catch(O){console.error("Error loading tasks:",O),H(O,"load tasks"),g([]),b(null)}finally{_(!1)}},[l,n,s]);f.useEffect(()=>{!a&&n&&s?(P(),R()):console.log("Auth not ready or no user, skipping project load:",{authLoading:a,user:!!n,token:!!s})},[P,R,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 O=r[r.length-1];if(O)switch(O.type){case"taskmaster-project-updated":O.projectName&&P();break;case"taskmaster-tasks-updated":O.projectName===l?.name&&w();break;case"taskmaster-mcp-status-changed":R();break}},[r,P,w,R,l]);const W={projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:u,tasks:p,nextTask:x,isLoading:k,isLoadingTasks:y,isLoadingMCP:U,error:B,refreshProjects:P,setCurrentProject:M,refreshTasks:w,refreshMCPStatus:R,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,m]=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{m(!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:m,updateAvailable:u,latestVersion:h,currentVersion:p,onShowVersionModal:g,isPWA:x,isMobile:b}){const[k,N]=f.useState(new Set),[y,_]=f.useState(null),[U,D]=f.useState(!1),[B,L]=f.useState(""),[H,j]=f.useState(""),[P,M]=f.useState(!1),[R,w]=f.useState({}),[W,O]=f.useState({}),[$,G]=f.useState(new Set),[ce,I]=f.useState(new Date),[je,We]=f.useState("name"),[v,te]=f.useState(!1),[me,Ne]=f.useState(null),[ne,Oe]=f.useState(""),[ee,oe]=f.useState({}),[he,Ce]=f.useState(""),[ke,Ve]=f.useState(!1),[Ke,rt]=f.useState([]),[xe,Re]=f.useState([]),[pe,Ue]=f.useState(-1),{setCurrentProject:mt,mcpServerStatus:Ie}=_n(),{tasksEnabled:$t}=zn(),[Z,ue]=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}}),S=A=>re=>{re.target.closest(".overflow-y-auto")||re.target.closest("[data-scroll-container]")||(re.preventDefault(),re.stopPropagation(),A())};f.useEffect(()=>{const A=setInterval(()=>{I(new Date)},6e4);return()=>clearInterval(A)},[]),f.useEffect(()=>{O({}),G(new Set)},[e]),f.useEffect(()=>{n&&r&&N(A=>new Set([...A,r.name]))},[n,r]),f.useEffect(()=>{if(e.length>0&&!c){const A=new Set;e.forEach(re=>{re.sessions&&re.sessions.length>=0&&A.add(re.name)}),G(A)}},[e,c]),f.useEffect(()=>{const A=()=>{try{const z=localStorage.getItem("claude-settings");if(z){const T=JSON.parse(z);We(T.projectSortOrder||"name")}}catch(z){console.error("Error loading sort order:",z)}};A();const re=z=>{z.key==="claude-settings"&&A()};window.addEventListener("storage",re);const we=setInterval(()=>{document.hasFocus()&&A()},1e3);return()=>{window.removeEventListener("storage",re),clearInterval(we)}},[]),f.useEffect(()=>{(async()=>{try{const re=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),z=await(await Fe.browseFilesystem()).json();if(z.suggestions){const T=z.suggestions.map(C=>({name:C.name,path:C.path})),ie=[...re.map(C=>({name:C.split("/").pop(),path:C})),...T];rt(ie)}else rt(re.map(T=>({name:T.split("/").pop(),path:T})))}catch(re){console.error("Error loading paths:",re);const we=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]");rt(we.map(z=>({name:z.split("/").pop(),path:z})))}})()},[]),f.useEffect(()=>{const A=H.trim();if(A.length===0){Ve(!1);return}Ve(!0),(async()=>{const we=Ke.filter(T=>T.name.toLowerCase().includes(A.toLowerCase())||T.path.toLowerCase().includes(A.toLowerCase()));if(A.includes("/")&&A.length>1)try{let T;if(A.endsWith("/"))T=A.slice(0,-1);else{const ie=A.lastIndexOf("/");T=A.substring(0,ie)}if(T&&T!==""){const C=await(await Fe.browseFilesystem(T)).json();if(C.suggestions){const X=A.substring(A.lastIndexOf("/")+1),He=[...C.suggestions.filter(at=>{const yt=at.name;return X?yt.toLowerCase().startsWith(X.toLowerCase()):!0}).map(at=>({name:at.name,path:at.path})).slice(0,8),...we].slice(0,8);Re(He),Ue(-1);return}}}catch(T){console.debug("Dynamic browsing failed:",T.message)}Re(we.slice(0,8)),Ue(-1)})()},[H,Ke]);const F=A=>{j(A.path),Ve(!1),Ue(-1)},K=A=>{try{const re=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),we=[A,...re.filter(z=>z!==A)].slice(0,10);localStorage.setItem("recentProjectPaths",JSON.stringify(we))}catch(re){console.error("Error saving recent paths:",re)}},se=A=>{const re=new Set;k.has(A)||re.add(A),N(re)},le=(A,re)=>{a({...A,__projectName:re})},ze=A=>{const re=new Set(Z);re.has(A)?re.delete(A):re.add(A),ue(re);try{localStorage.setItem("starredProjects",JSON.stringify([...re]))}catch(we){console.error("Error saving starred projects:",we)}},Le=A=>Z.has(A),Je=A=>{const re=[...A.sessions||[],...W[A.name]||[]].map(T=>({...T,__provider:"claude"})),we=(A.cursorSessions||[]).map(T=>({...T,__provider:"cursor"})),z=T=>new Date(T.__provider==="cursor"?T.createdAt:T.lastActivity);return[...re,...we].sort((T,ie)=>z(ie)-z(T))},pt=A=>{const re=Je(A);return re.length===0?new Date(0):re.reduce((z,T)=>{const ie=new Date(T.lastActivity);return ie>z?ie:z},new Date(0))},tt=[...e].sort((A,re)=>{const we=Le(A.name),z=Le(re.name);if(we&&!z)return-1;if(!we&&z)return 1;if(je==="date")return pt(re)-pt(A);{const T=A.displayName||A.name,ie=re.displayName||re.name;return T.localeCompare(ie)}}),st=A=>{_(A.name),L(A.displayName)},ct=()=>{_(null),L("")},dt=async A=>{try{(await Fe.renameProject(A,B)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(re){console.error("Error renaming project:",re)}_(null),L("")},Ot=async(A,re)=>{if(confirm("Are you sure you want to delete this session? This action cannot be undone."))try{(await Fe.deleteSession(A,re)).ok?o&&o(re):(console.error("Failed to delete session"),alert("Failed to delete session. Please try again."))}catch(we){console.error("Error deleting session:",we),alert("Error deleting session. Please try again.")}},Bt=async A=>{if(confirm("Are you sure you want to delete this empty project? This action cannot be undone."))try{const re=await Fe.deleteProject(A);if(re.ok)l&&l(A);else{const we=await re.json();console.error("Failed to delete project"),alert(we.error||"Failed to delete project. Please try again.")}}catch(re){console.error("Error deleting project:",re),alert("Error deleting project. Please try again.")}},Lt=async()=>{if(!H.trim()){alert("Please enter a project path");return}M(!0);try{const A=await Fe.createProject(H.trim());if(A.ok){const re=await A.json();K(H.trim()),D(!1),j(""),setShowSuggestions(!1),window.refreshProjects?window.refreshProjects():window.location.reload()}else{const re=await A.json();alert(re.error||"Failed to create project. Please try again.")}}catch(A){console.error("Error creating project:",A),alert("Error creating project. Please try again.")}finally{M(!1)}},kt=()=>{D(!1),j(""),setShowSuggestions(!1)},jr=async A=>{if(!(!(A.sessionMeta?.hasMore!==!1)||R[A.name])){w(we=>({...we,[A.name]:!0}));try{const we=(A.sessions?.length||0)+(W[A.name]?.length||0),z=await Fe.sessions(A.name,5,we);if(z.ok){const T=await z.json();O(ie=>({...ie,[A.name]:[...ie[A.name]||[],...T.sessions]})),T.hasMore===!1&&(A.sessionMeta={...A.sessionMeta,hasMore:!1})}}catch(we){console.error("Error loading more sessions:",we)}finally{w(we=>({...we,[A.name]:!1}))}}},vt=tt.filter(A=>{if(!he.trim())return!0;const re=he.toLowerCase(),we=(A.displayName||A.name).toLowerCase(),z=A.name.toLowerCase();return we.includes(re)||z.includes(re)}),It=A=>{s(A),mt(A)};return t.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:x&&b?{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()=>{te(!0);try{await d()}finally{te(!1)}},disabled:v,title:"Refresh projects and sessions (Ctrl+R)",children:t.jsx(yr,{className:`w-4 h-4 ${v?"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:()=>D(!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:x&&b?{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()=>{te(!0);try{await d()}finally{te(!1)}},disabled:v,children:t.jsx(yr,{className:`w-4 h-4 text-foreground ${v?"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:()=>D(!0),children:t.jsx(Kn,{className:"w-4 h-4"})})]})]})})]}),U&&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:H,onChange:A=>j(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(ke&&xe.length>0){if(A.key==="ArrowDown")A.preventDefault(),Ue(re=>re<xe.length-1?re+1:0);else if(A.key==="ArrowUp")A.preventDefault(),Ue(re=>re>0?re-1:xe.length-1);else if(A.key==="Enter"){A.preventDefault(),pe>=0?F(xe[pe]):xe.length>0?F(xe[0]):Lt();return}else if(A.key==="Escape"){A.preventDefault(),Ve(!1);return}else if(A.key==="Tab"){A.preventDefault(),pe>=0?F(xe[pe]):xe.length>0&&F(xe[0]);return}}A.key==="Enter"&&Lt(),A.key==="Escape"&&kt()}}),ke&&xe.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:xe.map((A,re)=>t.jsx("div",{className:`px-3 py-2 cursor-pointer border-b border-border last:border-b-0 ${re===pe?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:we=>{we.preventDefault(),we.stopPropagation()},onClick:we=>{we.preventDefault(),we.stopPropagation(),F(A)},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Xt,{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:Lt,disabled:!H.trim()||P,className:"flex-1 h-8 text-xs hover:bg-primary/90 transition-colors",children:P?"Creating...":"Create Project"}),t.jsx(Me,{size:"sm",variant:"outline",onClick:kt,disabled:P,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:kt,disabled:P,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:H,onChange:A=>j(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(ke&&xe.length>0){if(A.key==="ArrowDown")A.preventDefault(),Ue(re=>re<xe.length-1?re+1:0);else if(A.key==="ArrowUp")A.preventDefault(),Ue(re=>re>0?re-1:xe.length-1);else if(A.key==="Enter"){A.preventDefault(),pe>=0?F(xe[pe]):xe.length>0?F(xe[0]):Lt();return}else if(A.key==="Escape"){A.preventDefault(),Ve(!1);return}}A.key==="Enter"&&Lt(),A.key==="Escape"&&kt()},style:{fontSize:"16px",WebkitAppearance:"none"}}),ke&&xe.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:xe.map((A,re)=>t.jsx("div",{className:`px-3 py-2.5 cursor-pointer border-b border-border last:border-b-0 active:scale-95 transition-all ${re===pe?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:we=>{we.preventDefault(),we.stopPropagation()},onClick:we=>{we.preventDefault(),we.stopPropagation(),F(A)},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Xt,{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:kt,disabled:P,variant:"outline",className:"flex-1 h-9 text-sm rounded-md active:scale-95 transition-transform",children:"Cancel"}),t.jsx(Me,{onClick:Lt,disabled:!H.trim()||P,className:"flex-1 h-9 text-sm rounded-md bg-primary hover:bg-primary/90 active:scale-95 transition-all",children:P?"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(Jr,{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:he,onChange:A=>Ce(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"}),he&&t.jsx("button",{onClick:()=>Ce(""),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(Xt,{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"})]}):vt.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(Jr,{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"})]}):vt.map(A=>{const re=k.has(A.name),we=r?.name===A.name,z=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:Ee("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",we&&"bg-primary/5 border-primary/20",z&&!we&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{se(A.name)},onTouchEnd:S(()=>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:Ee("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",re?"bg-primary/10":"bg-muted"),children:re?t.jsx(Dr,{className:"w-4 h-4 text-primary"}):t.jsx(Xt,{className:"w-4 h-4 text-muted-foreground"})}),t.jsx("div",{className:"min-w-0 flex-1",children:y===A.name?t.jsx("input",{type:"text",value:B,onChange:T=>L(T.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:T=>T.stopPropagation(),onKeyDown:T=>{T.key==="Enter"&&dt(A.name),T.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}),$t&&t.jsx(Dh,{status:(()=>{const T=A.taskmaster?.hasTaskmaster,ie=Ie?.hasMCPServer&&Ie?.isConfigured;return T&&ie?"fully-configured":T?"taskmaster-only":ie?"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 T=Je(A).length,C=A.sessionMeta?.hasMore!==!1&&T>=5?`${T}+`:T;return`${C} session${C===1?"":"s"}`})()})]})})]}),t.jsx("div",{className:"flex items-center gap-1",children:y===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:T=>{T.stopPropagation(),dt(A.name)},children:t.jsx(Tr,{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:T=>{T.stopPropagation(),ct()},children:t.jsx(ot,{className:"w-4 h-4 text-white"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:Ee("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",z?"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:T=>{T.stopPropagation(),ze(A.name)},onTouchEnd:S(()=>ze(A.name)),title:z?"Remove from favorites":"Add to favorites",children:t.jsx(Ji,{className:Ee("w-4 h-4 transition-colors",z?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),Je(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:T=>{T.stopPropagation(),Bt(A.name)},onTouchEnd:S(()=>Bt(A.name)),children:t.jsx(Kt,{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:T=>{T.stopPropagation(),st(A)},onTouchEnd:S(()=>st(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:re?t.jsx(Ht,{className:"w-3 h-3 text-muted-foreground"}):t.jsx(kr,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),t.jsxs(Me,{variant:"ghost",className:Ee("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",we&&"bg-accent text-accent-foreground",z&&!we&&"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&&It(A),se(A.name)},onTouchEnd:S(()=>{r?.name!==A.name&&It(A),se(A.name)}),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[re?t.jsx(Dr,{className:"w-4 h-4 text-primary flex-shrink-0"}):t.jsx(Xt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),t.jsx("div",{className:"min-w-0 flex-1 text-left",children:y===A.name?t.jsxs("div",{className:"space-y-1",children:[t.jsx("input",{type:"text",value:B,onChange:T=>L(T.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:T=>{T.key==="Enter"&&dt(A.name),T.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 T=Je(A).length;return A.sessionMeta?.hasMore!==!1&&T>=5?`${T}+`:T})(),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:y===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:T=>{T.stopPropagation(),dt(A.name)},children:t.jsx(Tr,{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:T=>{T.stopPropagation(),ct()},children:t.jsx(ot,{className:"w-3 h-3"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:Ee("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",z?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:T=>{T.stopPropagation(),ze(A.name)},title:z?"Remove from favorites":"Add to favorites",children:t.jsx(Ji,{className:Ee("w-3 h-3 transition-colors",z?"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:T=>{T.stopPropagation(),st(A)},title:"Rename project (F2)",children:t.jsx(ba,{className:"w-3 h-3"})}),Je(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:T=>{T.stopPropagation(),Bt(A.name)},title:"Delete empty project (Delete)",children:t.jsx(Kt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),re?t.jsx(Ht,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):t.jsx(kr,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),re&&t.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[$.has(A.name)?Je(A).length===0&&!R[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"})}):Je(A).map(T=>{const ie=T.__provider==="cursor",C=new Date(ie?T.createdAt:T.lastActivity),fe=Math.floor((ce-C)/(1e3*60))<10,He=ie?T.name||"Untitled Session":T.summary||"New Session",at=ie?T.createdAt:T.lastActivity,yt=T.messageCount||0;return t.jsxs("div",{className:"group relative",children:[fe&&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:Ee("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",n?.id===T.id?"bg-primary/5 border-primary/20":fe?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{It(A),le(T,A.name)},onTouchEnd:S(()=>{It(A),le(T,A.name)}),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:Ee("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",n?.id===T.id?"bg-primary/10":"bg-muted/50"),children:ie?t.jsx(ir,{className:"w-3 h-3"}):t.jsx(Zt,{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:He}),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(at,ce)}),yt>0&&t.jsx(Mr,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:yt}),t.jsx("span",{className:"ml-1 opacity-70",children:ie?t.jsx(ir,{className:"w-3 h-3"}):t.jsx(Zt,{className:"w-3 h-3"})})]})]}),!ie&&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:nt=>{nt.stopPropagation(),Ot(A.name,T.id)},onTouchEnd:S(()=>Ot(A.name,T.id)),children:t.jsx(Kt,{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:Ee("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",n?.id===T.id&&"bg-accent text-accent-foreground"),onClick:()=>le(T,A.name),onTouchEnd:S(()=>le(T,A.name)),children:t.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[ie?t.jsx(ir,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):t.jsx(Zt,{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:He}),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(at,ce)}),yt>0&&t.jsx(Mr,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:yt}),t.jsx("span",{className:"ml-1 opacity-70",children:ie?t.jsx(ir,{className:"w-3 h-3"}):t.jsx(Zt,{className:"w-3 h-3"})})]})]})]})}),!ie&&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:me===T.id?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"text",value:ne,onChange:nt=>Oe(nt.target.value),onKeyDown:nt=>{nt.stopPropagation(),nt.key==="Enter"?updateSessionSummary(A.name,T.id,ne):nt.key==="Escape"&&(Ne(null),Oe(""))},onClick:nt=>nt.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:nt=>{nt.stopPropagation(),updateSessionSummary(A.name,T.id,ne)},title:"Save",children:t.jsx(Tr,{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:nt=>{nt.stopPropagation(),Ne(null),Oe("")},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:nt=>{nt.stopPropagation(),Ne(T.id),Oe(T.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:nt=>{nt.stopPropagation(),Ot(A.name,T.id)},title:"Delete this session permanently",children:t.jsx(Kt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},T.id)}):Array.from({length:3}).map((T,ie)=>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+ie*15}%`}}),t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},ie)),Je(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:()=>jr(A),disabled:R[A.name],children:R[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(Ht,{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:()=>{It(A),i(A)},children:[t.jsx(Ct,{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(Ct,{className:"w-3 h-3"}),"New Session"]})]})]},A.name)})})}),u&&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:g,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:"Update Available"}),t.jsxs("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:["Version ",h," is ready"]})]})]})}),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:g,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:"Update Available"}),t.jsxs("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:["Version ",h," is ready"]})]})]})})]}),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:m,children:[t.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:t.jsx(Yr,{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:m,children:[t.jsx(Yr,{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 Wh=/[ \t\n\f\r]/g;function Uh(e){return typeof e=="object"?e.type==="text"?Zi(e.value):!1:Zi(e)}function Zi(e){return e.replace(Wh,"")===""}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 $e=zr(),gt=zr(),va=zr(),ae=zr(),ut=zr(),Vr=zr(),Rt=zr();function zr(){return 2**++Hh}const wa=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:gt,commaOrSpaceSeparated:Rt,commaSeparated:Vr,number:ae,overloadedBoolean:va,spaceSeparated:ut},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 on(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=on({properties:{ariaActiveDescendant:null,ariaAtomic:gt,ariaAutoComplete:null,ariaBusy:gt,ariaChecked:gt,ariaColCount:ae,ariaColIndex:ae,ariaColSpan:ae,ariaControls:ut,ariaCurrent:null,ariaDescribedBy:ut,ariaDetails:null,ariaDisabled:gt,ariaDropEffect:ut,ariaErrorMessage:null,ariaExpanded:gt,ariaFlowTo:ut,ariaGrabbed:gt,ariaHasPopup:null,ariaHidden:gt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ut,ariaLevel:ae,ariaLive:null,ariaModal:gt,ariaMultiLine:gt,ariaMultiSelectable:gt,ariaOrientation:null,ariaOwns:ut,ariaPlaceholder:null,ariaPosInSet:ae,ariaPressed:gt,ariaReadOnly:gt,ariaRelevant:null,ariaRequired:gt,ariaRoleDescription:ut,ariaRowCount:ae,ariaRowIndex:ae,ariaRowSpan:ae,ariaSelected:gt,ariaSetSize:ae,ariaSort:null,ariaValueMax:ae,ariaValueMin:ae,ariaValueNow:ae,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=on({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vr,acceptCharset:ut,accessKey:ut,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:ut,autoFocus:$e,autoPlay:$e,blocking:ut,capture:null,charSet:null,checked:$e,cite:null,className:ut,cols:ae,colSpan:null,content:null,contentEditable:gt,controls:$e,controlsList:ut,coords:ae|Vr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:va,draggable:gt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:ut,height:ae,hidden:va,high:ae,href:null,hrefLang:null,htmlFor:ut,httpEquiv:ut,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:ut,itemRef:ut,itemScope:$e,itemType:ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:ae,manifest:null,max:null,maxLength:ae,media:null,method:null,min:null,minLength:ae,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,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:$e,optimum:ae,pattern:null,ping:ut,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:ut,required:$e,reversed:$e,rows:ae,rowSpan:ae,sandbox:ut,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shape:null,size:ae,sizes:null,slot:null,span:ae,spellCheck:gt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ae,step:null,style:null,tabIndex:ae,target:null,title:null,translate:null,type:null,typeMustMatch:$e,useMap:null,value:gt,width:ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ut,axis:null,background:null,bgColor:null,border:ae,borderColor:null,bottomMargin:ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:ae,leftMargin:ae,link:null,longDesc:null,lowSrc:null,marginHeight:ae,marginWidth:ae,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:ae,rules:null,scheme:null,scrolling:gt,standby:null,summary:null,text:null,topMargin:ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$e,disableRemotePlayback:$e,prefix:null,property:null,results:ae,security:null,unselectable:null},space:"html",transform:gc}),Vh=on({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:Rt,accentHeight:ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ae,amplitude:ae,arabicForm:null,ascent:ae,attributeName:null,attributeType:null,azimuth:ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ae,by:null,calcMode:null,capHeight:ae,className:ut,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:ae,diffuseConstant:ae,direction:null,display:null,dur:null,divisor:ae,dominantBaseline:null,download:$e,dx:null,dy:null,edgeMode:null,editable:null,elevation:ae,enableBackground:null,end:null,event:null,exponent:ae,externalResourcesRequired:null,fill:null,fillOpacity:ae,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:Vr,g2:Vr,glyphName:Vr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ae,horizOriginX:ae,horizOriginY:ae,id:null,ideographic:ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ae,k:ae,k1:ae,k2:ae,k3:ae,k4:ae,kernelMatrix:Rt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ae,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:ae,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:ae,overlineThickness:ae,paintOrder:null,panose1:null,path:null,pathLength:ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ut,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ae,pointsAtY:ae,pointsAtZ:ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Rt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rt,rev:Rt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rt,requiredFeatures:Rt,requiredFonts:Rt,requiredFormats:Rt,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:ae,specularExponent:ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ae,strikethroughThickness:ae,string:null,stroke:null,strokeDashArray:Rt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ae,strokeOpacity:ae,strokeWidth:null,style:null,surfaceScale:ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Rt,tabIndex:ae,tableValues:null,target:null,targetX:ae,targetY:ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Rt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ae,underlineThickness:ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ae,values:null,vAlphabetic:ae,vMathematical:ae,vectorEffect:null,vHanging:ae,vIdeographic:ae,version:null,vertAdvY:ae,vertOriginX:ae,vertOriginY:ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fc}),xc=on({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=on({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gc}),yc=on({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 ef(e){return e.join(" ").trim()}var Wr={},Bs,ro;function tf(){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="/",m="*",u="",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,N=1;function y(R){var w=R.match(r);w&&(k+=w.length);var W=R.lastIndexOf(c);N=~W?R.length-W:N+R.length}function _(){var R={line:k,column:N};return function(w){return w.position=new U(R),L(),w}}function U(R){this.start=R,this.end={line:k,column:N},this.source=b.source}U.prototype.content=x;function D(R){var w=new Error(b.source+":"+k+":"+N+": "+R);if(w.reason=R,w.filename=b.source,w.line=k,w.column=N,w.source=x,!b.silent)throw w}function B(R){var w=R.exec(x);if(w){var W=w[0];return y(W),x=x.slice(W.length),w}}function L(){B(n)}function H(R){var w;for(R=R||[];w=j();)w!==!1&&R.push(w);return R}function j(){var R=_();if(!(d!=x.charAt(0)||m!=x.charAt(1))){for(var w=2;u!=x.charAt(w)&&(m!=x.charAt(w)||d!=x.charAt(w+1));)++w;if(w+=2,u===x.charAt(w-1))return D("End of comment missing");var W=x.slice(2,w-2);return N+=2,y(W),x=x.slice(w),N+=2,R({type:h,comment:W})}}function P(){var R=_(),w=B(s);if(w){if(j(),!B(a))return D("property missing ':'");var W=B(i),O=R({type:p,property:g(w[0].replace(e,u)),value:W?g(W[0].replace(e,u)):u});return B(o),O}}function M(){var R=[];H(R);for(var w;w=P();)w!==!1&&(R.push(w),H(R));return R}return L(),M()};function g(x){return x?x.replace(l,u):u}return Bs}var no;function rf(){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(tf());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,m=c.value;l?a(d,m,c):m&&(i=i||{},i[d]=m)}}),i}return Wr}var fn={},so;function nf(){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,m){return m.toUpperCase()},l=function(d,m){return"".concat(m,"-")},c=function(d,m){return m===void 0&&(m={}),i(d)?d:(d=d.toLowerCase(),m.reactCompat?d=d.replace(a,l):d=d.replace(s,l),d.replace(r,o))};return fn.camelCase=c,fn}var gn,ao;function sf(){if(ao)return gn;ao=1;var e=gn&&gn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},r=e(rf()),n=nf();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 af=sf();const of=Ln(af),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 lf(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,cf=new Map,df=/[A-Z]/g,uf=new Set(["table","tbody","thead","tfoot","tr"]),mf=new Set(["td","th"]),wc="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pf(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=vf(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=kf(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 hf(e,r,n);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return ff(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return xf(e,r,n);if(r.type==="mdxjsEsm")return gf(e,r);if(r.type==="root")return bf(e,r,n);if(r.type==="text")return yf(e,r)}function hf(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=wf(e,r);let l=si(e,r);return uf.has(r.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Uh(c):!0})),Nc(e,o,i,r),ni(o,l),e.ancestors.pop(),e.schema=s,e.create(r,i,o,n)}function ff(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 gf(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Mn(e,r.position)}function xf(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=jf(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 bf(e,r,n){const s={};return ni(s,si(e,r)),e.create(r,e.Fragment,s,n)}function yf(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 kf(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 vf(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 wf(e,r){const n={};let s,a;for(a in r.properties)if(a!=="children"&&ri.call(r.properties,a)){const i=Nf(e,a,r.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&mf.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 jf(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:cf;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 Nf(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):ef(n)),s.property==="style"){let a=typeof n=="object"?n:Cf(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Sf(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?Gh[s.property]||s.property:s.attribute,n]}}function Cf(e,r){try{return of(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 Sf(e){const r={};let n;for(n in e)ri.call(e,n)&&(r[Ef(n)]=e[n]);return r}function Ef(e){let r=e.replace(df,If);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function If(e){return"-"+e.toLowerCase()}const Ws={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"]},Af={};function ai(e,r){const n=Af,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(Mf(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 Mf(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 Ft(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?(Ft(e,e.length,0,r),e):r}const uo={}.hasOwnProperty;function Ec(e){const r={};let n=-1;for(;++n<e.length;)Tf(r,e[n]);return r}function Tf(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];Df(a[o],Array.isArray(l)?l:l?[l]:[])}}}function Df(e,r){let n=-1;const s=[];for(;++n<r.length;)(r[n].add==="after"?e:s).push(r[n]);Ft(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 Jt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const St=vr(/[A-Za-z]/),jt=vr(/[\dA-Za-z]/),Pf=vr(/[#-'*+\--9=?A-Z^-~]/);function us(e){return e!==null&&(e<32||e===127)}const Na=vr(/\d/),Lf=vr(/[\dA-Fa-f]/),Rf=vr(/[!-/:-@[-`{-~]/);function Te(e){return e!==null&&e<-2}function lt(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const js=vr(new RegExp("\\p{P}|\\p{S}","u")),Rr=vr(/\s/);function vr(e){return r;function r(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ln(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 et(e,r,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Qe(c)?(e.enter(n),l(c)):r(c)}function l(c){return Qe(c)&&i++<a?(e.consume(c),l):(e.exit(n),r(c))}}const _f={tokenize:zf};function zf(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"),et(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 Ff={tokenize:$f},mo={tokenize:Of};function $f(e){const r=this,n=[];let s=0,a,i,o;return l;function l(y){if(s<n.length){const _=n[s];return r.containerState=_[1],e.attempt(_[0].continuation,c,d)(y)}return d(y)}function c(y){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,a&&N();const _=r.events.length;let U=_,D;for(;U--;)if(r.events[U][0]==="exit"&&r.events[U][1].type==="chunkFlow"){D=r.events[U][1].end;break}k(s);let B=_;for(;B<r.events.length;)r.events[B][1].end={...D},B++;return Ft(r.events,U+1,0,r.events.slice(_)),r.events.length=B,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,m,u)(y)}function m(y){return a&&N(),k(s),h(y)}function u(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&&N(),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,_){const U=r.sliceStream(y);if(_&&U.push(null),y.previous=i,i&&(i.next=y),i=y,a.defineSkip(y.start),a.write(U),r.parser.lazy[y.start.line]){let D=a.events.length;for(;D--;)if(a.events[D][1].start.offset<o&&(!a.events[D][1].end||a.events[D][1].end.offset>o))return;const B=r.events.length;let L=B,H,j;for(;L--;)if(r.events[L][0]==="exit"&&r.events[L][1].type==="chunkFlow"){if(H){j=r.events[L][1].end;break}H=!0}for(k(s),D=B;D<r.events.length;)r.events[D][1].end={...j},D++;Ft(r.events,L+1,0,r.events.slice(B)),r.events.length=D}}function k(y){let _=n.length;for(;_-- >y;){const U=n[_];r.containerState=U[1],U[0].exit.call(r,e)}n.length=y}function N(){a.write([null]),i=void 0,a=void 0,r.containerState._closeFlow=void 0}}function Of(e,r,n){return et(e,e.attempt(this.parser.constructs.document,r,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xr(e){if(e===null||lt(e)||Rr(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:Bf,tokenize:Wf};function Bf(e,r){let n=-1,s,a,i,o,l,c,d,m;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 u={...e[s][1].end},h={...e[n][1].start};po(u,-c),po(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:u,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?(m=2,d=Ut(d,[["enter",e[n][1],r],["exit",e[n][1],r]])):m=0,Ft(e,s-1,n-s+3,d),n=s+d.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Wf(e,r){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Xr(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"),m=Xr(c),u=!m||m===2&&a||n.includes(c),h=!a||a===2&&m||n.includes(s);return d._open=!!(i===42?u:u&&(a||!h)),d._close=!!(i===42?h:h&&(m||!u)),r(c)}}function po(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const Uf={name:"autolink",tokenize:Hf};function Hf(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 St(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),m):Pf(p)?(e.consume(p),d):n(p)}function m(p){return jt(p)?u(p):n(p)}function u(p){return p===46?(e.consume(p),s=0,m):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:u;return e.consume(p),g}return n(p)}}const $n={partial:!0,tokenize:qf};function qf(e,r,n){return s;function s(i){return Qe(i)?et(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Te(i)?r(i):n(i)}}const Ac={continuation:{tokenize:Gf},exit:Kf,name:"blockQuote",tokenize:Vf};function Vf(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 Qe(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(o))}}function Gf(e,r,n){const s=this;return a;function a(o){return Qe(o)?et(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 Kf(e){e.exit("blockQuote")}const Mc={name:"characterEscape",tokenize:Jf};function Jf(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 Rf(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):n(i)}}const Tc={name:"characterReference",tokenize:Yf};function Yf(e,r,n){const s=this;let a=0,i,o;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),c}function c(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,o=jt,m(u))}function d(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Lf,m):(e.enter("characterReferenceValue"),i=7,o=Na,m(u))}function m(u){if(u===59&&a){const h=e.exit("characterReferenceValue");return o===jt&&!ii(s.sliceSerialize(h))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return o(u)&&a++<i?(e.consume(u),m):n(u)}}const ho={partial:!0,tokenize:Xf},fo={concrete:!0,name:"codeFenced",tokenize:Qf};function Qf(e,r,n){const s=this,a={partial:!0,tokenize:U};let i=0,o=0,l;return c;function c(D){return d(D)}function d(D){const B=s.events[s.events.length-1];return i=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,l=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(D)}function m(D){return D===l?(o++,e.consume(D),m):o<3?n(D):(e.exit("codeFencedFenceSequence"),Qe(D)?et(e,u,"whitespace")(D):u(D))}function u(D){return D===null||Te(D)?(e.exit("codeFencedFence"),s.interrupt?r(D):e.check(ho,x,_)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(D))}function h(D){return D===null||Te(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(D)):Qe(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),et(e,p,"whitespace")(D)):D===96&&D===l?n(D):(e.consume(D),h)}function p(D){return D===null||Te(D)?u(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(D))}function g(D){return D===null||Te(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(D)):D===96&&D===l?n(D):(e.consume(D),g)}function x(D){return e.attempt(a,_,b)(D)}function b(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),k}function k(D){return i>0&&Qe(D)?et(e,N,"linePrefix",i+1)(D):N(D)}function N(D){return D===null||Te(D)?e.check(ho,x,_)(D):(e.enter("codeFlowValue"),y(D))}function y(D){return D===null||Te(D)?(e.exit("codeFlowValue"),N(D)):(e.consume(D),y)}function _(D){return e.exit("codeFenced"),r(D)}function U(D,B,L){let H=0;return j;function j(W){return D.enter("lineEnding"),D.consume(W),D.exit("lineEnding"),P}function P(W){return D.enter("codeFencedFence"),Qe(W)?et(D,M,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):M(W)}function M(W){return W===l?(D.enter("codeFencedFenceSequence"),R(W)):L(W)}function R(W){return W===l?(H++,D.consume(W),R):H>=o?(D.exit("codeFencedFenceSequence"),Qe(W)?et(D,w,"whitespace")(W):w(W)):L(W)}function w(W){return W===null||Te(W)?(D.exit("codeFencedFence"),B(W)):L(W)}}}function Xf(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 Us={name:"codeIndented",tokenize:e0},Zf={partial:!0,tokenize:t0};function e0(e,r,n){const s=this;return a;function a(d){return e.enter("codeIndented"),et(e,i,"linePrefix",5)(d)}function i(d){const m=s.events[s.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?c(d):Te(d)?e.attempt(Zf,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 t0(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):et(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 r0={name:"codeText",previous:s0,resolve:n0,tokenize:a0};function n0(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 s0(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function a0(e,r,n){let s=0,a,i;return o;function o(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),s++,l):(e.exit("codeTextSequence"),c(u))}function c(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),c):u===96?(i=e.enter("codeTextSequence"),a=0,m(u)):Te(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(u))}function d(u){return u===null||u===32||u===96||Te(u)?(e.exit("codeTextData"),c(u)):(e.consume(u),d)}function m(u){return u===96?(e.consume(u),a++,m):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(u)):(i.type="codeTextData",d(u))}}class i0{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 m=new i0(e);for(;++n<m.length;){for(;n in r;)n=r[n];if(s=m.get(n),n&&s[1].type==="chunkFlow"&&m.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,o0(m,n)),n=r[n],d=!0);else if(s[1]._container){for(i=n,a=void 0;i--;)if(o=m.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(m.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={...m.get(a)[1].start},l=m.slice(a,n),l.unshift(s),m.splice(a,n-a+1,l))}}return Ft(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!d}function o0(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 m,u,h=-1,p=n,g=0,x=0;const b=[x];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(m=s.sliceStream(p),p.next||m.push(null),u&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(m),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),u=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]),N=i.pop();c.push([N,N+k.length-1]),e.splice(N,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 l0={resolve:d0,tokenize:u0},c0={partial:!0,tokenize:m0};function d0(e){return Dc(e),e}function u0(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(c0,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 m0(e,r,n){const s=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),et(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 m=0;return u;function u(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!m&&(k===null||k===41||lt(k))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(s),r(k)):m<d&&k===40?(e.consume(k),m++,x):k===41?(e.consume(k),m--,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),m}function m(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"),m):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===null||p===91||p===93||Te(p)||l++>999?(e.exit("chunkString"),m(p)):(e.consume(p),c||(c=!Qe(p)),p===92?h:u)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,u):u(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"),et(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(h))}function m(h){return h===o||h===null||Te(h)?(e.exit("chunkString"),d(h)):(e.consume(h),h===92?u:m)}function u(h){return h===o||h===92?(e.consume(h),m):m(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):Qe(a)?et(e,s,n?"linePrefix":"lineSuffix")(a):r(a)}}const p0={name:"definition",tokenize:f0},h0={partial:!0,tokenize:g0};function f0(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=Jt(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,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function m(p){return e.attempt(h0,u,u)(p)}function u(p){return Qe(p)?et(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 g0(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 Qe(l)?et(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Te(l)?r(l):n(l)}}const x0={name:"hardBreakEscape",tokenize:b0};function b0(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 y0={name:"headingAtx",resolve:k0,tokenize:v0};function k0(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"},Ft(e,s,n-s+1,[["enter",a,r],["enter",i,r],["exit",i,r],["exit",a,r]])),e}function v0(e,r,n){let s=0;return a;function a(m){return e.enter("atxHeading"),i(m)}function i(m){return e.enter("atxHeadingSequence"),o(m)}function o(m){return m===35&&s++<6?(e.consume(m),o):m===null||lt(m)?(e.exit("atxHeadingSequence"),l(m)):n(m)}function l(m){return m===35?(e.enter("atxHeadingSequence"),c(m)):m===null||Te(m)?(e.exit("atxHeading"),r(m)):Qe(m)?et(e,l,"whitespace")(m):(e.enter("atxHeadingText"),d(m))}function c(m){return m===35?(e.consume(m),c):(e.exit("atxHeadingSequence"),l(m))}function d(m){return m===null||m===35||lt(m)?(e.exit("atxHeadingText"),l(m)):(e.consume(m),d)}}const w0=["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"],j0={concrete:!0,name:"htmlFlow",resolveTo:S0,tokenize:E0},N0={partial:!0,tokenize:A0},C0={partial:!0,tokenize:I0};function S0(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 E0(e,r,n){const s=this;let a,i,o,l,c;return d;function d(v){return m(v)}function m(v){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(v),u}function u(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:I):St(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):St(v)?(e.consume(v),a=4,s.interrupt?r:I):n(v)}function p(v){return v===45?(e.consume(v),s.interrupt?r:I):n(v)}function g(v){const te="CDATA[";return v===te.charCodeAt(l++)?(e.consume(v),l===te.length?s.interrupt?r:M:g):n(v)}function x(v){return St(v)?(e.consume(v),o=String.fromCharCode(v),b):n(v)}function b(v){if(v===null||v===47||v===62||lt(v)){const te=v===47,me=o.toLowerCase();return!te&&!i&&go.includes(me)?(a=1,s.interrupt?r(v):M(v)):w0.includes(o.toLowerCase())?(a=6,te?(e.consume(v),k):s.interrupt?r(v):M(v)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(v):i?N(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:M):n(v)}function N(v){return Qe(v)?(e.consume(v),N):j(v)}function y(v){return v===47?(e.consume(v),j):v===58||v===95||St(v)?(e.consume(v),_):Qe(v)?(e.consume(v),y):j(v)}function _(v){return v===45||v===46||v===58||v===95||jt(v)?(e.consume(v),_):U(v)}function U(v){return v===61?(e.consume(v),D):Qe(v)?(e.consume(v),U):y(v)}function D(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),c=v,B):Qe(v)?(e.consume(v),D):L(v)}function B(v){return v===c?(e.consume(v),c=null,H):v===null||Te(v)?n(v):(e.consume(v),B)}function L(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||lt(v)?U(v):(e.consume(v),L)}function H(v){return v===47||v===62||Qe(v)?y(v):n(v)}function j(v){return v===62?(e.consume(v),P):n(v)}function P(v){return v===null||Te(v)?M(v):Qe(v)?(e.consume(v),P):n(v)}function M(v){return v===45&&a===2?(e.consume(v),O):v===60&&a===1?(e.consume(v),$):v===62&&a===4?(e.consume(v),je):v===63&&a===3?(e.consume(v),I):v===93&&a===5?(e.consume(v),ce):Te(v)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(N0,We,R)(v)):v===null||Te(v)?(e.exit("htmlFlowData"),R(v)):(e.consume(v),M)}function R(v){return e.check(C0,w,We)(v)}function w(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),W}function W(v){return v===null||Te(v)?R(v):(e.enter("htmlFlowData"),M(v))}function O(v){return v===45?(e.consume(v),I):M(v)}function $(v){return v===47?(e.consume(v),o="",G):M(v)}function G(v){if(v===62){const te=o.toLowerCase();return go.includes(te)?(e.consume(v),je):M(v)}return St(v)&&o.length<8?(e.consume(v),o+=String.fromCharCode(v),G):M(v)}function ce(v){return v===93?(e.consume(v),I):M(v)}function I(v){return v===62?(e.consume(v),je):v===45&&a===2?(e.consume(v),I):M(v)}function je(v){return v===null||Te(v)?(e.exit("htmlFlowData"),We(v)):(e.consume(v),je)}function We(v){return e.exit("htmlFlow"),r(v)}}function I0(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 A0(e,r,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt($n,r,n)}}const M0={name:"htmlText",tokenize:T0};function T0(e,r,n){const s=this;let a,i,o;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),d):I===47?(e.consume(I),U):I===63?(e.consume(I),y):St(I)?(e.consume(I),L):n(I)}function d(I){return I===45?(e.consume(I),m):I===91?(e.consume(I),i=0,g):St(I)?(e.consume(I),N):n(I)}function m(I){return I===45?(e.consume(I),p):n(I)}function u(I){return I===null?n(I):I===45?(e.consume(I),h):Te(I)?(o=u,$(I)):(e.consume(I),u)}function h(I){return I===45?(e.consume(I),p):u(I)}function p(I){return I===62?O(I):I===45?h(I):u(I)}function g(I){const je="CDATA[";return I===je.charCodeAt(i++)?(e.consume(I),i===je.length?x:g):n(I)}function x(I){return I===null?n(I):I===93?(e.consume(I),b):Te(I)?(o=x,$(I)):(e.consume(I),x)}function b(I){return I===93?(e.consume(I),k):x(I)}function k(I){return I===62?O(I):I===93?(e.consume(I),k):x(I)}function N(I){return I===null||I===62?O(I):Te(I)?(o=N,$(I)):(e.consume(I),N)}function y(I){return I===null?n(I):I===63?(e.consume(I),_):Te(I)?(o=y,$(I)):(e.consume(I),y)}function _(I){return I===62?O(I):y(I)}function U(I){return St(I)?(e.consume(I),D):n(I)}function D(I){return I===45||jt(I)?(e.consume(I),D):B(I)}function B(I){return Te(I)?(o=B,$(I)):Qe(I)?(e.consume(I),B):O(I)}function L(I){return I===45||jt(I)?(e.consume(I),L):I===47||I===62||lt(I)?H(I):n(I)}function H(I){return I===47?(e.consume(I),O):I===58||I===95||St(I)?(e.consume(I),j):Te(I)?(o=H,$(I)):Qe(I)?(e.consume(I),H):O(I)}function j(I){return I===45||I===46||I===58||I===95||jt(I)?(e.consume(I),j):P(I)}function P(I){return I===61?(e.consume(I),M):Te(I)?(o=P,$(I)):Qe(I)?(e.consume(I),P):H(I)}function M(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),a=I,R):Te(I)?(o=M,$(I)):Qe(I)?(e.consume(I),M):(e.consume(I),w)}function R(I){return I===a?(e.consume(I),a=void 0,W):I===null?n(I):Te(I)?(o=R,$(I)):(e.consume(I),R)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||lt(I)?H(I):(e.consume(I),w)}function W(I){return I===47||I===62||lt(I)?H(I):n(I)}function O(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),r):n(I)}function $(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),G}function G(I){return Qe(I)?et(e,ce,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):ce(I)}function ce(I){return e.enter("htmlTextData"),o(I)}}const oi={name:"labelEnd",resolveAll:R0,resolveTo:_0,tokenize:z0},D0={tokenize:F0},P0={tokenize:$0},L0={tokenize:O0};function R0(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&&Ft(e,0,e.length,n),e}function _0(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}},m={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",m,r]]),l=Ut(l,Ns(r.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),r)),l=Ut(l,[["exit",m,r],e[o-2],e[o-1],["exit",d,r]]),l=Ut(l,e.slice(o+1)),l=Ut(l,[["exit",c,r]]),Ft(e,i,e.length,l),e}function z0(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?u(h):(o=s.parser.defined.includes(Jt(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(D0,m,o?m:u)(h):h===91?e.attempt(P0,m,o?d:u)(h):o?m(h):u(h)}function d(h){return e.attempt(L0,m,u)(h)}function m(h){return r(h)}function u(h){return i._balanced=!0,n(h)}}function F0(e,r,n){return s;function s(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),a}function a(u){return lt(u)?Sn(e,i)(u):i(u)}function i(u){return u===41?m(u):Pc(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return lt(u)?Sn(e,c)(u):m(u)}function l(u){return n(u)}function c(u){return u===34||u===39||u===40?Rc(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):m(u)}function d(u){return lt(u)?Sn(e,m)(u):m(u)}function m(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),r):n(u)}}function $0(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(Jt(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):n(l)}function o(l){return n(l)}}function O0(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 B0={name:"labelStartImage",resolveAll:oi.resolveAll,tokenize:W0};function W0(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 U0={name:"labelStartLink",resolveAll:oi.resolveAll,tokenize:H0};function H0(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:q0};function q0(e,r){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),et(e,r,"linePrefix")}}const is={name:"thematicBreak",tokenize:V0};function V0(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"),Qe(d)?et(e,l,"whitespace")(d):l(d))}}const Mt={continuation:{tokenize:Y0},exit:X0,name:"list",tokenize:J0},G0={partial:!0,tokenize:Z0},K0={partial:!0,tokenize:Q0};function J0(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:m,e.attempt(G0,h,u))}function m(p){return s.containerState.initialBlankLine=!0,i++,h(p)}function u(p){return Qe(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 Y0(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,et(e,r,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!Qe(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(K0,r,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,et(e,e.attempt(Mt,r,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Q0(e,r,n){const s=this;return et(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 X0(e){e.exit(this.containerState.type)}function Z0(e,r,n){const s=this;return et(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!Qe(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 m=s.events.length,u;for(;m--;)if(s.events[m][1].type!=="lineEnding"&&s.events[m][1].type!=="linePrefix"&&s.events[m][1].type!=="content"){u=s.events[m][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||u)?(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"),Qe(d)?et(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,et(e,e.attempt(this.parser.constructs.flow,a,e.attempt(l0,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(m){return d(m)?i(m):l(m)}function l(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),c}function c(m){return d(m)?(n.exit("data"),i(m)):(n.consume(m),c)}function d(m){if(m===null)return!0;const u=a[m];let h=-1;if(u)for(;++h<u.length;){const p=u[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:p0},dg={[-2]:Us,[-1]:Us,32:Us},ug={35:y0,42:is,45:[xo,is],60:j0,61:xo,95:is,96:fo,126:fo},mg={38:Tc,92:Mc},pg={[-5]:Hs,[-4]:Hs,[-3]:Hs,33:B0,38:Tc,42:Ca,60:[Uf,M0],91:U0,92:[x0,Mc],93:oi,95:Ca,96:r0},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:B(U),check:B(D),consume:N,enter:y,exit:_,interrupt:B(D,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:u};let m=r.tokenize.call(d,c);return r.resolveAll&&i.push(r),d;function u(P){return o=Ut(o,P),b(),o[o.length-1]!==null?[]:(L(r,0),d.events=Ns(i,d.events,d),d.events)}function h(P,M){return kg(p(P),M)}function p(P){return yg(o,P)}function g(){const{_bufferIndex:P,_index:M,line:R,column:w,offset:W}=s;return{_bufferIndex:P,_index:M,line:R,column:w,offset:W}}function x(P){a[P.line]=P.column,j()}function b(){let P;for(;s._index<o.length;){const M=o[s._index];if(typeof M=="string")for(P=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===P&&s._bufferIndex<M.length;)k(M.charCodeAt(s._bufferIndex));else k(M)}}function k(P){m=m(P)}function N(P){Te(P)?(s.line++,s.column=1,s.offset+=P===-3?2:1,j()):P!==-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=P}function y(P,M){const R=M||{};return R.type=P,R.start=g(),d.events.push(["enter",R,d]),l.push(R),R}function _(P){const M=l.pop();return M.end=g(),d.events.push(["exit",M,d]),M}function U(P,M){L(P,M.from)}function D(P,M){M.restore()}function B(P,M){return R;function R(w,W,O){let $,G,ce,I;return Array.isArray(w)?We(w):"tokenize"in w?We([w]):je(w);function je(Ne){return ne;function ne(Oe){const ee=Oe!==null&&Ne[Oe],oe=Oe!==null&&Ne.null,he=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return We(he)(Oe)}}function We(Ne){return $=Ne,G=0,Ne.length===0?O:v(Ne[G])}function v(Ne){return ne;function ne(Oe){return I=H(),ce=Ne,Ne.partial||(d.currentConstruct=Ne),Ne.name&&d.parser.constructs.disable.null.includes(Ne.name)?me():Ne.tokenize.call(M?Object.assign(Object.create(d),M):d,c,te,me)(Oe)}}function te(Ne){return P(ce,I),W}function me(Ne){return I.restore(),++G<$.length?v($[G]):O}}}function L(P,M){P.resolveAll&&!i.includes(P)&&i.push(P),P.resolve&&Ft(d.events,M,d.events.length-M,P.resolve(d.events.slice(M),d)),P.resolveTo&&(d.events=P.resolveTo(d.events,d))}function H(){const P=g(),M=d.previous,R=d.currentConstruct,w=d.events.length,W=Array.from(l);return{from:w,restore:O};function O(){s=P,d.previous=M,d.currentConstruct=R,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(_f),defined:[],document:a(Ff),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,m,u,h,p;for(i=r+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),u=0,r="",n&&(i.charCodeAt(0)===65279&&u++,n=void 0);u<i.length;){if(bo.lastIndex=u,d=bo.exec(i),h=d&&d.index!==void 0?d.index:i.length,p=i.charCodeAt(h),!d){r=i.slice(u);break}if(p===10&&u===h&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),u<h&&(c.push(i.slice(u,h)),e+=h-u),p){case 0:{c.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,c.push(-2);e++<m;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}u=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(pe),autolinkProtocol:H,autolinkEmail:H,atxHeading:i(Ke),blockQuote:i(oe),characterEscape:H,characterReference:H,codeFenced:i(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(he,o),codeText:i(Ce,o),codeTextData:H,data:H,codeFlowValue:H,definition:i(ke),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ve),hardBreakEscape:i(rt),hardBreakTrailing:i(rt),htmlFlow:i(xe,o),htmlFlowData:H,htmlText:i(xe,o),htmlTextData:H,image:i(Re),label:o,link:i(pe),listItem:i(mt),listItemValue:h,listOrdered:i(Ue,u),listUnordered:i(Ue),paragraph:i(Ie),reference:v,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ke),strong:i($t),thematicBreak:i(ue)},exit:{atxHeading:c(),atxHeadingSequence:U,autolink:c(),autolinkEmail:ee,autolinkProtocol:Oe,blockQuote:c(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:Ne,characterReference:ne,codeFenced:c(b),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:c(k),codeText:c(W),codeTextData:j,data:j,definition:c(),definitionDestinationString:_,definitionLabelString:N,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(M),hardBreakTrailing:c(M),htmlFlow:c(R),htmlFlowData:j,htmlText:c(w),htmlTextData:j,image:c($),label:ce,labelText:G,lineEnding:P,link:c(O),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:I,resourceTitleString:je,resource:We,setextHeading:c(L),setextHeadingLineSequence:B,setextHeadingText:D,strong:c(),thematicBreak:c()}};$c(r,(e||{}).mdastExtensions||[]);const n={};return s;function s(S){let F={type:"root",children:[]};const K={stack:[F],tokenStack:[],config:r,enter:l,exit:d,buffer:o,resume:m,data:n},se=[];let le=-1;for(;++le<S.length;)if(S[le][1].type==="listOrdered"||S[le][1].type==="listUnordered")if(S[le][0]==="enter")se.push(le);else{const ze=se.pop();le=a(S,ze,le)}for(le=-1;++le<S.length;){const ze=r[S[le][0]];Fc.call(ze,S[le][1].type)&&ze[S[le][1].type].call(Object.assign({sliceSerialize:S[le][2].sliceSerialize},K),S[le][1])}if(K.tokenStack.length>0){const ze=K.tokenStack[K.tokenStack.length-1];(ze[1]||yo).call(K,void 0,ze[0])}for(F.position={start:gr(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:gr(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},le=-1;++le<r.transforms.length;)F=r.transforms[le](F)||F;return F}function a(S,F,K){let se=F-1,le=-1,ze=!1,Le,Je,pt,tt;for(;++se<=K;){const st=S[se];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?le++:le--,tt=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(Le&&!tt&&!le&&!pt&&(pt=se),tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:tt=void 0}if(!le&&st[0]==="enter"&&st[1].type==="listItemPrefix"||le===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(Le){let ct=se;for(Je=void 0;ct--;){const dt=S[ct];if(dt[1].type==="lineEnding"||dt[1].type==="lineEndingBlank"){if(dt[0]==="exit")continue;Je&&(S[Je][1].type="lineEndingBlank",ze=!0),dt[1].type="lineEnding",Je=ct}else if(!(dt[1].type==="linePrefix"||dt[1].type==="blockQuotePrefix"||dt[1].type==="blockQuotePrefixWhitespace"||dt[1].type==="blockQuoteMarker"||dt[1].type==="listItemIndent"))break}pt&&(!Je||pt<Je)&&(Le._spread=!0),Le.end=Object.assign({},Je?S[Je][1].start:st[1].end),S.splice(Je||se,0,["exit",Le,st[2]]),se++,K++}if(st[1].type==="listItemPrefix"){const ct={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};Le=ct,S.splice(se,0,["enter",ct,st[2]]),se++,K++,pt=void 0,tt=!0}}}return S[F][1]._spread=ze,K}function i(S,F){return K;function K(se){l.call(this,S(se),se),F&&F.call(this,se)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(S,F,K){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([F,K||void 0]),S.position={start:gr(F.start),end:void 0}}function c(S){return F;function F(K){S&&S.call(this,K),d.call(this,K)}}function d(S,F){const K=this.stack.pop(),se=this.tokenStack.pop();if(se)se[0].type!==S.type&&(F?F.call(this,S,se[0]):(se[1]||yo).call(this,S,se[0]));else throw new Error("Cannot close `"+S.type+"` ("+Cn({start:S.start,end:S.end})+"): it’s not open");K.position.end=gr(S.end)}function m(){return ai(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function h(S){if(this.data.expectingFirstListItemValue){const F=this.stack[this.stack.length-2];F.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function p(){const S=this.resume(),F=this.stack[this.stack.length-1];F.lang=S}function g(){const S=this.resume(),F=this.stack[this.stack.length-1];F.meta=S}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const S=this.resume(),F=this.stack[this.stack.length-1];F.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const S=this.resume(),F=this.stack[this.stack.length-1];F.value=S.replace(/(\r?\n|\r)$/g,"")}function N(S){const F=this.resume(),K=this.stack[this.stack.length-1];K.label=F,K.identifier=Jt(this.sliceSerialize(S)).toLowerCase()}function y(){const S=this.resume(),F=this.stack[this.stack.length-1];F.title=S}function _(){const S=this.resume(),F=this.stack[this.stack.length-1];F.url=S}function U(S){const F=this.stack[this.stack.length-1];if(!F.depth){const K=this.sliceSerialize(S).length;F.depth=K}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function B(S){const F=this.stack[this.stack.length-1];F.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function H(S){const K=this.stack[this.stack.length-1].children;let se=K[K.length-1];(!se||se.type!=="text")&&(se=Z(),se.position={start:gr(S.start),end:void 0},K.push(se)),this.stack.push(se)}function j(S){const F=this.stack.pop();F.value+=this.sliceSerialize(S),F.position.end=gr(S.end)}function P(S){const F=this.stack[this.stack.length-1];if(this.data.atHardBreak){const K=F.children[F.children.length-1];K.position.end=gr(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(F.type)&&(H.call(this,S),j.call(this,S))}function M(){this.data.atHardBreak=!0}function R(){const S=this.resume(),F=this.stack[this.stack.length-1];F.value=S}function w(){const S=this.resume(),F=this.stack[this.stack.length-1];F.value=S}function W(){const S=this.resume(),F=this.stack[this.stack.length-1];F.value=S}function O(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=F,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function $(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const F=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=F,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function G(S){const F=this.sliceSerialize(S),K=this.stack[this.stack.length-2];K.label=Cg(F),K.identifier=Jt(F).toLowerCase()}function ce(){const S=this.stack[this.stack.length-1],F=this.resume(),K=this.stack[this.stack.length-1];if(this.data.inReference=!0,K.type==="link"){const se=S.children;K.children=se}else K.alt=F}function I(){const S=this.resume(),F=this.stack[this.stack.length-1];F.url=S}function je(){const S=this.resume(),F=this.stack[this.stack.length-1];F.title=S}function We(){this.data.inReference=void 0}function v(){this.data.referenceType="collapsed"}function te(S){const F=this.resume(),K=this.stack[this.stack.length-1];K.label=F,K.identifier=Jt(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function me(S){this.data.characterReferenceType=S.type}function Ne(S){const F=this.sliceSerialize(S),K=this.data.characterReferenceType;let se;K?(se=Ic(F,K==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):se=ii(F);const le=this.stack[this.stack.length-1];le.value+=se}function ne(S){const F=this.stack.pop();F.position.end=gr(S.end)}function Oe(S){j.call(this,S);const F=this.stack[this.stack.length-1];F.url=this.sliceSerialize(S)}function ee(S){j.call(this,S);const F=this.stack[this.stack.length-1];F.url="mailto:"+this.sliceSerialize(S)}function oe(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function Ke(){return{type:"heading",depth:0,children:[]}}function rt(){return{type:"break"}}function xe(){return{type:"html",value:""}}function Re(){return{type:"image",title:null,url:"",alt:null}}function pe(){return{type:"link",title:null,url:"",children:[]}}function Ue(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function mt(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function Ie(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function Z(){return{type:"text",value:""}}function ue(){return{type:"thematicBreak"}}}function gr(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=ln(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:ln(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:ln(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 Wg(e,r){const n=String(r.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Oc(e,r);const a={href:ln(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 Ug(e,r){const n={href:ln(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 m=s[0];let u;m&&m.type==="element"&&m.tagName==="p"?u=m:(u={type:"element",tagName:"p",properties:{},children:[]},s.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.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 m=s[l];(a||l!==0||m.type!=="element"||m.tagName!=="p")&&o.push({type:"text",value:`
|
|
392
|
+
`}),m.type==="element"&&m.tagName==="p"&&!a?o.push(...m.children):o.push(m)}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 u=r.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};u&&(g.children=e.all(u),e.patch(u,g),g=e.applyData(u,g)),d.push(g)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(r,m),e.applyData(r,m)}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:Wg,link:Ug,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 Wc=-1,Cs=0,En=1,ms=2,li=3,ci=4,di=5,ui=6,Uc=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 Wc: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 Uc:{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),Ur="",{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,Ur];case"Object":return[ms,Ur];case"Date":return[li,Ur];case"RegExp":return[ci,Ur];case"Map":return[di,Ur];case"Set":return[ui,Ur];case"DataView":return[En,n]}return n.includes("Array")?[En,n]:n.includes("Error")?[Uc,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 m=o;switch(c){case"bigint":l=Hc,m=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);m=null;break;case"undefined":return a([Wc],o)}return a([l,m],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 m=[],u=a([l,m],o);for(const h of o)m.push(i(h));return u}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 m=[],u=a([l,m],o);for(const h of ax(o))(e||!Xn(bn(o[h])))&&m.push([i(h),i(o[h])]);return u}case li:return a([l,o.toISOString()],o);case ci:{const{source:m,flags:u}=o;return a([l,{source:m,flags:u}],o)}case di:{const m=[],u=a([l,m],o);for(const[h,p]of o)(e||!(Xn(bn(h))||Xn(bn(p))))&&m.push([i(h),i(p)]);return u}case ui:{const m=[],u=a([l,m],o);for(const h of o)(e||!Xn(bn(h)))&&m.push(i(h));return u}}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 m=e.all(d),u=String(d.identifier).toUpperCase(),h=ln(u.toLowerCase());let p=0;const g=[],x=e.footnoteCounts.get(u);for(;x!==void 0&&++p<=x;){g.length>0&&g.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,p);typeof N=="string"&&(N={type:"text",value:N}),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(N)?N:[N]})}const b=m[m.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const N=b.children[b.children.length-1];N&&N.type==="text"?N.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else m.push(...g);const k={type:"element",tagName:"li",properties:{id:r+"fn-"+h},children:e.wrap(m,!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,m){const u=c&&typeof c=="object"?c:{};if(typeof u.type=="string"){const p=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.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,m[m.length-1]||void 0))&&(p=xx(n(c,m)),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=m.concat(k);x>-1&&x<k.children.length;){const N=k.children[x];if(g=l(N,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 m=d[d.length-1],u=m?m.children.indexOf(c):void 0;return o(c,u,m)}}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(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const u=m.type==="definition"?s:a,h=String(m.identifier).toUpperCase();u.has(h)||u.set(h,m)}}),l;function c(m,u){const h=m.type,p=l.handlers[h];if(Ea.call(l.handlers,h)&&p)return p(l,m,u);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in m){const{children:x,...b}=m,k=ps(b);return k.children=l.all(m),k}return ps(m)}return(l.options.unknownHandler||wx)(l,m,u)}function d(m){const u=[];if("children"in m){const h=m.children;let p=-1;for(;++p<h.length;){const g=l.one(h[p],m);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)?u.push(...g):u.push(g)}}}return u}}function kx(e,r){e.position&&(r.position=lf(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 m=e.call(d,"constructor"),u=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!m&&!u)return!1;var h;for(h in d);return typeof h>"u"||e.call(d,h)},o=function(d,m){n&&m.name==="__proto__"?n(d,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):d[m.name]=m.newValue},l=function(d,m){if(m==="__proto__")if(e.call(d,m)){if(s)return s(d,m).value}else return;return d[m]};return qs=function c(){var d,m,u,h,p,g,x=arguments[0],b=1,k=arguments.length,N=!1;for(typeof x=="boolean"&&(N=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(m in d)u=l(x,m),h=l(d,m),x!==h&&(N&&h&&(i(h)||(p=a(h)))?(p?(p=!1,g=u&&a(u)?u:[]):g=u&&i(u)?u:{},o(x,{name:m,newValue:c(N,g,h)})):typeof h<"u"&&o(x,{name:m,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 m=e[++i];let u=-1;if(c){o(c);return}for(;++u<a.length;)(d[u]===null||d[u]===void 0)&&(d[u]=a[u]);a=d,m?Ix(m,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 m=d;if(l&&n)throw m;return a(m)}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 Qt={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"?Qt.basename(this.path):void 0}set basename(r){Js(r,"basename"),Ks(r,"basename"),this.path=Qt.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?Qt.dirname(this.path):void 0}set dirname(r){Mo(this.basename,"dirname"),this.path=Qt.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?Qt.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=Qt.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"?Qt.basename(this.path,this.extname):void 0}set stem(r){Js(r,"stem"),Ks(r,"stem"),this.path=Qt.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(Qt.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+Qt.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(m,u,h){if(m||!u||!h)return d(m);const p=u,g=s.stringify(p,h);Hx(g)?h.value=g:h.result=g,d(m,h)});function d(m,u){m||!u?o(m):i?i(u):n(void 0,u)}}}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(m,u,h){const p=u||r;m?l(m):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[m,...u]=d;c(m,u)}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 m=-1;if(d!=null)if(Array.isArray(d))for(;++m<d.length;){const u=d[m];i(u)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,m){let u=-1,h=-1;for(;++u<s.length;)if(s[u][0]===d){h=u;break}if(h===-1)s.push([d,...m]);else if(m.length>0){let[p,...g]=m;const x=s[h][1];Ia(x)&&Ia(p)&&(p=Vs(!0,x,p)),s[h]=[d,p,...g]}}}}const Wx=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 Ux(e)?e:new Gc(e)}function Ux(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 Wx().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 m of Kx)Object.hasOwn(r,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Vx+m.id,void 0);return mi(e,d),pf(e,{Fragment:t.Fragment,components:a,ignoreInvalidStyle:!0,jsx:t.jsx,jsxs:t.jsxs,passKeys:!0,passNode:!0});function d(m,u,h){if(m.type==="raw"&&h&&typeof u=="number")return o?h.children.splice(u,1):h.children[u]={type:"text",value:m.value},u;if(m.type==="element"){let p;for(p in Ws)if(Object.hasOwn(Ws,p)&&Object.hasOwn(m.properties,p)){const g=m.properties[p],x=Ws[p];(x===null||x.includes(m.tagName))&&(m.properties[p]=c(String(g||""),p,m))}}if(m.type==="element"){let p=n?!n.includes(m.tagName):i?i.includes(m.tagName):!1;if(!p&&s&&typeof u=="number"&&(p=!s(m,u,h)),p&&h&&typeof u=="number")return l&&m.children?h.children.splice(u,1,...m.children):h.children.splice(u,1),u}}}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,m){let u=-1,h;for(;++u<m.length;){const p=m[u],g=h?h.children:void 0;if(a(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return c(d,m)}function c(d,m){const u=m[m.length-1],h=i[o][0],p=i[o][1];let g=0;const b=u.children.indexOf(d);let k=!1,N=[];h.lastIndex=0;let y=h.exec(d.value);for(;y;){const _=y.index,U={index:y.index,input:y.input,stack:[...m,d]};let D=p(...y,U);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?h.lastIndex=_+1:(g!==_&&N.push({type:"text",value:d.value.slice(g,_)}),Array.isArray(D)?N.push(...D):D&&N.push(D),g=_+y[0].length,k=!0),!h.global)break;y=h.exec(d.value)}return k?(g<d.value.length&&N.push({type:"text",value:d.value.slice(g)}),u.children.splice(b,1,...N)):N=[d],b+N.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||Rr(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=Jt(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=Jt(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"),m=i.enter("label");return c+=l.move(i.safe(i.associationId(s),{before:c,after:"]"})),m(),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,m=-1;for(;++m<e.length;){const x=[],b=[];let k=-1;for(e[m].length>d&&(d=e[m].length);++k<e[m].length;){const N=zb(e[m][k]);if(n.alignDelimiters!==!1){const y=a(N);b[k]=y,(c[k]===void 0||y>c[k])&&(c[k]=y)}x.push(N)}o[m]=x,l[m]=b}let u=-1;if(typeof s=="object"&&"length"in s)for(;++u<d;)i[u]=_o(s[u]);else{const x=_o(s);for(;++u<d;)i[u]=x}u=-1;const h=[],p=[];for(;++u<d;){const x=i[u];let b="",k="";x===99?(b=":",k=":"):x===108?b=":":x===114&&(k=":");let N=n.alignDelimiters===!1?1:Math.max(1,c[u]-b.length-k.length);const y=b+"-".repeat(N)+k;n.alignDelimiters!==!1&&(N=b.length+N+k.length,N>c[u]&&(c[u]=N),p[u]=N),h[u]=y}o.splice(1,0,h),l.splice(1,0,p),m=-1;const g=[];for(;++m<o.length;){const x=o[m],b=l[m];u=-1;const k=[];for(;++u<d;){const N=x[u]||"";let y="",_="";if(n.alignDelimiters!==!1){const U=c[u]-(b[u]||0),D=i[u];D===114?y=" ".repeat(U):D===99?U%2?(y=" ".repeat(U/2+.5),_=" ".repeat(U/2-.5)):(y=" ".repeat(U/2),_=y):_=" ".repeat(U)}n.delimiterStart!==!1&&!u&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||u)&&k.push(" "),n.alignDelimiters!==!1&&k.push(y),k.push(N),n.alignDelimiters!==!1&&k.push(_),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||u!==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 Wb(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 Ub(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=Ub(n),i=e.value||"",o=a==="`"?"GraveAccent":"Tilde";if(Wb(e,n)){const u=n.enter("codeIndented"),h=n.indentLines(i,qb);return u(),h}const l=n.createTracker(s),c=a.repeat(Math.max(Bb(i,a)+1,3)),d=n.enter("codeFenced");let m=l.move(c);if(e.lang){const u=n.enter(`codeFencedLang${o}`);m+=l.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=n.enter(`codeFencedMeta${o}`);m+=l.move(" "),m+=l.move(n.safe(e.meta,{before:m,after:`
|
|
404
|
+
`,encode:["`"],...l.current()})),u()}return m+=l.move(`
|
|
405
|
+
`),i&&(m+=l.move(i+`
|
|
406
|
+
`)),m+=l.move(c),d(),m}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=Xr(e),a=Xr(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),m=hs(s.before.charCodeAt(s.before.length-1),d,a);m.inside&&(c=Tn(d)+c.slice(1));const u=c.charCodeAt(c.length-1),h=hs(s.after.charCodeAt(0),u,a);h.inside&&(c=c.slice(0,-1)+Tn(u));const p=o.move(a);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:m.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 m=n.enter("headingSetext"),u=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
|
|
408
|
+
`,after:`
|
|
409
|
+
`});return u(),m(),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 m=n.stack;n.stack=[],o=n.enter("reference");const u=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=m,i(),a==="full"||!d||d!==u?c+=l.move(u+"]"):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 m=n.stack;n.stack=[],l=n.enter("autolink");let u=o.move("<");return u+=o.move(n.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),n.stack=m,u}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 m=n.stack;n.stack=[],o=n.enter("reference");const u=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=m,i(),a==="full"||!d||d!==u?c+=l.move(u+"]"):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 m=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&m&&(!m.children||!m.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&&m){let u=-1;for(;++u<e.children.length;){const h=e.children[u];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()),m);return c(),d;function m(u,h,p){return h?(p?"":" ".repeat(o))+u:(p?i:i+" ".repeat(o-i.length))+u}}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),m=hs(s.before.charCodeAt(s.before.length-1),d,a);m.inside&&(c=Tn(d)+c.slice(1));const u=c.charCodeAt(c.length-1),h=hs(s.after.charCodeAt(0),u,a);h.inside&&(c=c.slice(0,-1)+Tn(u));const p=o.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:m.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(m(p,x,b),p.align)}function l(p,g,x,b){const k=u(p,x,b),N=d([k]);return N.slice(0,N.indexOf(`
|
|
414
|
+
`))}function c(p,g,x,b){const k=x.enter("tableCell"),N=x.enter("phrasing"),y=x.containerPhrasing(p,{...b,before:i,after:i});return N(),k(),y}function d(p,g){return _b(p,{align:g,alignDelimiters:s,padding:n,stringLength:a})}function m(p,g,x){const b=p.children;let k=-1;const N=[],y=g.enter("table");for(;++k<b.length;)N[k]=u(b[k],g,x);return y(),N}function u(p,g,x){const b=p.children;let k=-1;const N=[],y=g.enter("tableRow");for(;++k<b.length;)N[k]=c(b[k],p,g,x);return y(),N}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(m){return m+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},ur={name:"emailAutolink",tokenize:Dy,previous:gd},tr={};function Ty(){return{text:tr}}let Sr=48;for(;Sr<123;)tr[Sr]=ur,Sr++,Sr===58?Sr=65:Sr===91&&(Sr=97);tr[43]=ur;tr[45]=ur;tr[46]=ur;tr[95]=ur;tr[72]=[ur,pd];tr[104]=[ur,pd];tr[87]=[ur,md];tr[119]=[ur,md];function Dy(e,r,n){const s=this;let a,i;return o;function o(u){return!Ma(u)||!gd.call(s,s.previous)||gi(s.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return Ma(u)?(e.consume(u),l):u===64?(e.consume(u),c):n(u)}function c(u){return u===46?e.check(My,m,d)(u):u===45||u===95||jt(u)?(i=!0,e.consume(u),c):m(u)}function d(u){return e.consume(u),a=!0,c}function m(u){return i&&a&&St(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(u)):n(u)}}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(u){return(u===72||u===104)&&fd.call(s,s.previous)&&!gi(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(u),e.consume(u),l):n(u)}function l(u){if(St(u)&&a.length<5)return a+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const h=a.toLowerCase();if(h==="http"||h==="https")return e.consume(u),c}return n(u)}function c(u){return u===47?(e.consume(u),i?d:(i=!0,c)):n(u)}function d(u){return u===null||us(u)||lt(u)||Rr(u)||js(u)?n(u):e.attempt(cd,e.attempt(dd,m),n)(u)}function m(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(u)}}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)||Rr(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)||Rr(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)||Rr(l)?r(l):n(l)}function a(l){return l===null||l===40||l===91||lt(l)||Rr(l)?r(l):s(l)}function i(l){return St(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),s):St(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!St(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:Wy,resolveTo:Uy}}}}function Wy(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=Jt(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 Uy(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(u){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),c}function c(u){return u!==94?n(u):(e.enter("gfmFootnoteCallMarker"),e.consume(u),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(u){if(i>999||u===93&&!o||u===null||u===91||lt(u))return n(u);if(u===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return a.includes(Jt(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):n(u)}return lt(u)||(o=!0),i++,e.consume(u),u===92?m:d}function m(u){return u===91||u===92||u===93?(e.consume(u),i++,d):d(u)}}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",m):n(g)}function m(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=Jt(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?u:m}function u(g){return g===91||g===92||g===93?(e.consume(g),o++,m):m(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),a.includes(i)||a.push(i),et(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 et(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 m={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[c][1].end)},u={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",m,l],["enter",o[d][1],l],["exit",o[d][1],l],["enter",u,l]],p=l.parser.constructs.insideSpan.null;p&&Ft(h,h.length,0,Ns(p,o.slice(d+1,c),l)),Ft(h,h.length,0,[["exit",u,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",m,l]]),Ft(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,m=this.events;let u=0;return h;function h(g){return d===126&&m[m.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=Xr(d);if(g===126)return u>1?c(g):(o.consume(g),u++,p);if(u<2&&!n)return c(g);const b=o.exit("strikethroughSequenceTemporary"),k=Xr(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 P=s.events.length-1;for(;P>-1;){const w=s.events[P][1].type;if(w==="lineEnding"||w==="linePrefix")P--;else break}const M=P>-1?s.events[P][1].type:null,R=M==="tableHead"||M==="tableRow"?D:c;return R===D&&s.parser.lazy[s.now().line]?n(j):R(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),d(j)}function d(j){return j===124||(o=!0,i+=1),m(j)}function m(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):Qe(j)?et(e,m,"whitespace")(j):(i+=1,o&&(o=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),o=!0,m):(e.enter("data"),u(j)))}function u(j){return j===null||j===124||lt(j)?(e.exit("data"),m(j)):(e.consume(j),j===92?h:u)}function h(j){return j===92||j===124?(e.consume(j),u):u(j)}function p(j){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(j):(e.enter("tableDelimiterRow"),o=!1,Qe(j)?et(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):U(j)}function x(j){return Qe(j)?et(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)?_(j):U(j)}function k(j){return j===45?(e.enter("tableDelimiterFiller"),N(j)):U(j)}function N(j){return j===45?(e.consume(j),N):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 Qe(j)?et(e,_,"whitespace")(j):_(j)}function _(j){return j===124?g(j):j===null||Te(j)?!o||a!==i?U(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(j)):U(j)}function U(j){return n(j)}function D(j){return e.enter("tableRow"),B(j)}function B(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),B):j===null||Te(j)?(e.exit("tableRow"),r(j)):Qe(j)?et(e,B,"whitespace")(j):(e.enter("data"),L(j))}function L(j){return j===null||j===124||lt(j)?(e.exit("data"),B(j)):(e.consume(j),j===92?H:L)}function H(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,m,u;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,m),m=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,u=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,m={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",m,r]])),a=g.type==="tableDelimiterRow"?2:m?3:1):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],u=es(h,r,i,a,void 0,u),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],u=es(h,r,i,a,void 0,u)),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],u=es(h,r,i,a,n,u)):o[1]!==0&&(u=es(h,r,o,a,n,u)),a=0):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Bo(h,r,c,d,m),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({},Hr(r.events,n[0])),e.add(n[0],0,[["exit",i,r]]));const c=Hr(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=Hr(r.events,n[2]),m=Hr(r.events,n[3]),u={type:l,start:Object.assign({},d),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",u,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",u,r]])}return a!==void 0&&(i.end=Object.assign({},Hr(r.events,a)),e.add(a,0,[["exit",i,r]]),i=void 0),i}function Bo(e,r,n,s,a){const i=[],o=Hr(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 Hr(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):Qe(c)?e.check({tokenize:ak},r,n)(c):n(c)}}function ak(e,r,n){return et(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,Wo;function ck(){if(Wo)return sa;Wo=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return sa=e,sa}var aa,Uo;function dk(){if(Uo)return aa;Uo=1;var e=ck();function r(){}function n(){}return n.resetWarningCache=r,aa=function(){function s(o,l,c,d,m,u){if(u!==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 Fr(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(m){try{d(s.next(m))}catch(u){o(u)}}function c(m){try{d(s.throw(m))}catch(u){o(u)}}function d(m){m.done?i(m.value):a(m.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 Zr(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 Fr(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=>Zr(r))}function kk(e){return Fr(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Zr(n))})}function vk(e,r){return Fr(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=>Zr(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 Fr(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,Zr(o)}}const s=e.getAsFile();if(!s)throw new Error(`${e} is not a File`);return Zr(s,(n=r?.fullPath)!==null&&n!==void 0?n:void 0)})}function jk(e){return Fr(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=>Fr(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 Fr(this,void 0,void 0,function*(){return new Promise((r,n)=>{e.file(s=>{const a=Zr(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(Ir(e.size))if(Ir(r)&&Ir(n)){if(e.size>n)return[!1,Xo(n)];if(e.size<r)return[!1,Zo(r)]}else{if(Ir(r)&&e.size<r)return[!1,Zo(r)];if(Ir(n)&&e.size>n)return[!1,Xo(n)]}return[!0,null]}function Ir(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),m=Dn(d,1),u=m[0],h=wd(c,s,a),p=Dn(h,1),g=p[0],x=l?l(c):null;return u&&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 Wk(e){return e.indexOf("Edge/")!==-1}function Uk(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Bk(e)||Wk(e)}function Yt(){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(Ir(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(Ir(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 ft(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]),or.createElement(f.Fragment,null,n(ft(ft({},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=ft(ft({},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,m=r.onDragLeave,u=r.onDragOver,h=r.onDrop,p=r.onDropAccepted,g=r.onDropRejected,x=r.onFileDialogCancel,b=r.onFileDialogOpen,k=r.useFsAccessApi,N=r.autoFocus,y=r.preventDropOnDocument,_=r.noClick,U=r.noKeyboard,D=r.noDrag,B=r.noDragEventsBubbling,L=r.onError,H=r.validator,j=f.useMemo(function(){return Vk(n)},[n]),P=f.useMemo(function(){return qk(n)},[n]),M=f.useMemo(function(){return typeof b=="function"?b:rl},[b]),R=f.useMemo(function(){return typeof x=="function"?x:rl},[x]),w=f.useRef(null),W=f.useRef(null),O=f.useReducer(ov,Ra),$=oa(O,2),G=$[0],ce=$[1],I=G.isFocused,je=G.isFileDialogActive,We=f.useRef(typeof window<"u"&&window.isSecureContext&&k&&Hk()),v=function(){!We.current&&je&&setTimeout(function(){if(W.current){var ue=W.current.files;ue.length||(ce({type:"closeDialog"}),R())}},300)};f.useEffect(function(){return window.addEventListener("focus",v,!1),function(){window.removeEventListener("focus",v,!1)}},[W,je,R,We]);var te=f.useRef([]),me=function(ue){w.current&&w.current.contains(ue.target)||(ue.preventDefault(),te.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&&N&&w.current&&w.current.focus(),function(){}},[w,N,s]);var Ne=f.useCallback(function(Z){L?L(Z):console.error(Z)},[L]),ne=f.useCallback(function(Z){Z.preventDefault(),Z.persist(),Ue(Z),te.current=[].concat(Zk(te.current),[Z.target]),rs(Z)&&Promise.resolve(a(Z)).then(function(ue){if(!(gs(Z)&&!B)){var S=ue.length,F=S>0&&Ok({files:ue,accept:j,minSize:o,maxSize:i,multiple:l,maxFiles:c,validator:H}),K=S>0&&!F;ce({isDragAccept:F,isDragReject:K,isDragActive:!0,type:"setDraggedFiles"}),d&&d(Z)}}).catch(function(ue){return Ne(ue)})},[a,d,Ne,B,j,o,i,l,c,H]),Oe=f.useCallback(function(Z){Z.preventDefault(),Z.persist(),Ue(Z);var ue=rs(Z);if(ue&&Z.dataTransfer)try{Z.dataTransfer.dropEffect="copy"}catch{}return ue&&u&&u(Z),!1},[u,B]),ee=f.useCallback(function(Z){Z.preventDefault(),Z.persist(),Ue(Z);var ue=te.current.filter(function(F){return w.current&&w.current.contains(F)}),S=ue.indexOf(Z.target);S!==-1&&ue.splice(S,1),te.current=ue,!(ue.length>0)&&(ce({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),rs(Z)&&m&&m(Z))},[w,m,B]),oe=f.useCallback(function(Z,ue){var S=[],F=[];Z.forEach(function(K){var se=vd(K,j),le=oa(se,2),ze=le[0],Le=le[1],Je=wd(K,o,i),pt=oa(Je,2),tt=pt[0],st=pt[1],ct=H?H(K):null;if(ze&&tt&&!ct)S.push(K);else{var dt=[Le,st];ct&&(dt=dt.concat(ct)),F.push({file:K,errors:dt.filter(function(Ot){return Ot})})}}),(!l&&S.length>1||l&&c>=1&&S.length>c)&&(S.forEach(function(K){F.push({file:K,errors:[$k]})}),S.splice(0)),ce({acceptedFiles:S,fileRejections:F,isDragReject:F.length>0,type:"setFiles"}),h&&h(S,F,ue),F.length>0&&g&&g(F,ue),S.length>0&&p&&p(S,ue)},[ce,l,j,o,i,c,h,p,g,H]),he=f.useCallback(function(Z){Z.preventDefault(),Z.persist(),Ue(Z),te.current=[],rs(Z)&&Promise.resolve(a(Z)).then(function(ue){gs(Z)&&!B||oe(ue,Z)}).catch(function(ue){return Ne(ue)}),ce({type:"reset"})},[a,oe,Ne,B]),Ce=f.useCallback(function(){if(We.current){ce({type:"openDialog"}),M();var Z={multiple:l,types:P};window.showOpenFilePicker(Z).then(function(ue){return a(ue)}).then(function(ue){oe(ue,null),ce({type:"closeDialog"})}).catch(function(ue){Gk(ue)?(R(ue),ce({type:"closeDialog"})):Kk(ue)?(We.current=!1,W.current?(W.current.value=null,W.current.click()):Ne(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."))):Ne(ue)});return}W.current&&(ce({type:"openDialog"}),M(),W.current.value=null,W.current.click())},[ce,M,R,k,oe,Ne,P,l]),ke=f.useCallback(function(Z){!w.current||!w.current.isEqualNode(Z.target)||(Z.key===" "||Z.key==="Enter"||Z.keyCode===32||Z.keyCode===13)&&(Z.preventDefault(),Ce())},[w,Ce]),Ve=f.useCallback(function(){ce({type:"focus"})},[]),Ke=f.useCallback(function(){ce({type:"blur"})},[]),rt=f.useCallback(function(){_||(Uk()?setTimeout(Ce,0):Ce())},[_,Ce]),xe=function(ue){return s?null:ue},Re=function(ue){return U?null:xe(ue)},pe=function(ue){return D?null:xe(ue)},Ue=function(ue){B&&ue.stopPropagation()},mt=f.useMemo(function(){return function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=Z.refKey,S=ue===void 0?"ref":ue,F=Z.role,K=Z.onKeyDown,se=Z.onFocus,le=Z.onBlur,ze=Z.onClick,Le=Z.onDragEnter,Je=Z.onDragOver,pt=Z.onDragLeave,tt=Z.onDrop,st=xs(Z,Qk);return ft(ft(La({onKeyDown:Re(Yt(K,ke)),onFocus:Re(Yt(se,Ve)),onBlur:Re(Yt(le,Ke)),onClick:xe(Yt(ze,rt)),onDragEnter:pe(Yt(Le,ne)),onDragOver:pe(Yt(Je,Oe)),onDragLeave:pe(Yt(pt,ee)),onDrop:pe(Yt(tt,he)),role:typeof F=="string"&&F!==""?F:"presentation"},S,w),!s&&!U?{tabIndex:0}:{}),st)}},[w,ke,Ve,Ke,rt,ne,Oe,ee,he,U,D,s]),Ie=f.useCallback(function(Z){Z.stopPropagation()},[]),$t=f.useMemo(function(){return function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=Z.refKey,S=ue===void 0?"ref":ue,F=Z.onChange,K=Z.onClick,se=xs(Z,Xk),le=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:xe(Yt(F,he)),onClick:xe(Yt(K,Ie)),tabIndex:-1},S,W);return ft(ft({},le),se)}},[W,n,l,he,s]);return ft(ft({},G),{},{isFocused:I&&!s,getRootProps:mt,getInputProps:$t,rootRef:w,inputRef:W,open:xe(Ce)})}function ov(e,r){switch(r.type){case"focus":return ft(ft({},e),{},{isFocused:!0});case"blur":return ft(ft({},e),{},{isFocused:!1});case"openDialog":return ft(ft({},Ra),{},{isFileDialogActive:!0});case"closeDialog":return ft(ft({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return ft(ft({},e),{},{isDragActive:r.isDragActive,isDragAccept:r.isDragAccept,isDragReject:r.isDragReject});case"setFiles":return ft(ft({},e),{},{acceptedFiles:r.acceptedFiles,fileRejections:r.fileRejections,isDragReject:r.isDragReject});case"reset":return ft({},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(qr,{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(Mr,{variant:"outline",className:`text-xs px-2 py-0.5 ${a(i.priority)}`,children:i.priority}),t.jsx(Mr,{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 Er=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),[m,u]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(!1),[b,k]=f.useState(null),[N,y]=f.useState(!1),_=()=>{!h||m||N||(y(!0),B())},U=()=>{d.current&&(d.current.close(),d.current=null),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H")),u(!1),y(!1)},D=()=>{x(!0),Array.from(Er.keys()).filter(H=>H.includes(e.name)).forEach(H=>Er.delete(H)),d.current&&(d.current.close(),d.current=null),l.current&&(l.current.dispose(),l.current=null,c.current=null),u(!1),p(!1),setTimeout(()=>{x(!1)},200)};f.useEffect(()=>{const L=r?.id||null;b!==null&&b!==L&&h&&(U(),Array.from(Er.keys()).forEach(j=>{j.includes(e.name)&&Er.delete(j)})),k(L)},[r?.id,h]),f.useEffect(()=>{if(!o.current||!e||g)return;const L=r?.id||`project-${e.name}`,H=Er.get(L);if(H&&!l.current)try{l.current=H.terminal,c.current=H.fitAddon,d.current=H.ws,u(H.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{Er.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,P=new uv.WebglAddon;l.current.loadAddon(c.current),l.current.loadAddon(j);try{l.current.loadAddon(P)}catch{}l.current.open(o.current),setTimeout(()=>{c.current&&c.current.fit()},50),l.current.attachCustomKeyEventHandler(R=>(R.ctrlKey||R.metaKey)&&R.key==="c"&&l.current.hasSelection()?(document.execCommand("copy"),!1):(R.ctrlKey||R.metaKey)&&R.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(R=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:R}))});const M=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&&M.observe(o.current),()=>{if(M.disconnect(),l.current&&e){const R=r?.id||`project-${e.name}`;try{Er.set(R,{terminal:l.current,fitAddon:c.current,ws:d.current,isConnected:m})}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 B=async()=>{if(!(N||m))try{const L=localStorage.getItem("auth-token");if(!L){console.error("No authentication token found for Shell WebSocket connection");return}let H;try{if(H=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${L}`}})).json()).wsUrl,H.includes("localhost")&&!window.location.hostname.includes("localhost")){const R=window.location.protocol==="https:"?"wss:":"ws:",w=window.location.port==="3001"?"3002":window.location.port;H=`${R}//${window.location.hostname}:${w}`}}catch{const M=window.location.protocol==="https:"?"wss:":"ws:",R=window.location.port==="3001"?"3002":window.location.port;H=`${M}//${window.location.hostname}:${R}`}const j=`${H}/shell?token=${encodeURIComponent(L)}`;d.current=new WebSocket(j),d.current.onopen=()=>{u(!0),y(!1),setTimeout(()=>{c.current&&l.current&&(c.current.fit(),setTimeout(()=>{const P={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:",P),d.current.send(JSON.stringify(P)),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=P=>{try{const M=JSON.parse(P.data);if(M.type==="output"){const R=/(https?:\/\/[^\s\x1b\x07]+)/g;let w=M.data;const W=[];let O;for(;(O=R.exec(w.replace(/\x1b\[[0-9;]*m/g,"")))!==null;)W.push(O[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 G=parseInt($.match(/Process exited with code (\d+)/)[1]);G!==0&&i(G)}}l.current.write(w)}else M.type==="url_open"&&window.open(M.url,"_blank")}catch{}},d.current.onclose=P=>{u(!1),y(!1),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H"))},d.current.onerror=P=>{u(!1),y(!1)}}catch{u(!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 ${m?"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:[m&&t.jsxs("button",{onClick:U,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:D,disabled:g||m,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&&!m&&!N&&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:_,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"})]})}),N&&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,m]=f.useState(e||{}),[u,h]=f.useState(!1),[p,g]=f.useState(!1),[x,b]=f.useState(!1),{currentProject:k,refreshTasks:N}=_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 P=await Fe.taskmaster.updateTask(k.name,e.id,j);if(P.ok)N?.(),n?.(d),c(!1);else{const M=await P.json();console.error("Failed to update task:",M),alert(`Failed to update task: ${M.message}`)}}else c(!1)}catch(j){console.error("Error updating task:",j),alert("Error updating task. Please try again.")}finally{h(!1)}}},_=()=>{navigator.clipboard.writeText(e.id.toString())},U=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:qr,color:"text-slate-500 dark:text-slate-400",bg:"bg-slate-50 dark:bg-slate-800"}}},D=U(e.status),B=D.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"}},H=[{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:Ee("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(B,{className:Ee("w-6 h-6",D.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:_,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=>m({...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:u,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:u?"Saving...":"Save changes",children:t.jsx(ds,{className:Ee("w-5 h-5",u&&"animate-spin")})}),t.jsx("button",{onClick:()=>{c(!1),m(e)},disabled:u,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:Ee("w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600",D.bg,D.color),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(B,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium capitalize",children:H.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:Ee("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=>m({...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(Ht,{className:"w-4 h-4 text-gray-500"}):t.jsx(kr,{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=>m({...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(Ht,{className:"w-4 h-4 text-gray-500"}):t.jsx(kr,{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 P=U(j.status),M=P.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(M,{className:Ee("w-4 h-4",P.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(),[m,u]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(!1),[b,k]=f.useState(!1),[N,y]=f.useState(!1),[_,U]=f.useState(!1),[D,B]=f.useState(!1),L=()=>{x(!0),p(!1)},H=()=>{k(!0),p(!1)};if(!i||o)return null;let j;if((!a||a.length===0)&&!l?.hasTaskmaster)j=t.jsxs("div",{className:Ee("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(Yr,{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:D,children:[t.jsx(Ct,{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:H,disabled:D,children:[t.jsx(Tt,{className:"w-3 h-3"}),D?"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(Qr,{className:"w-3 h-3"}),"Initialize TaskMaster"]})})]})]});else if(s)j=t.jsx("div",{className:Ee("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(qr,{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:()=>U(!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(an,{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 P=a.filter(R=>R.status==="done").length,M=a.length;j=t.jsx("div",{className:Ee("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:P===M?"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:[P,"/",M]}),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)}}),N&&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(Qr,{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"})]})})]})}),_&&s&&t.jsx(Id,{task:s,isOpen:_,onClose:()=>U(!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},m=await Fe.taskmaster.addTask(e.name,d);if(m.ok)n();else{const u=await m.json();console.error("Failed to create task:",u),alert(`Failed to create task: ${u.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,m]=f.useState("prd.txt"),[u,h]=f.useState(!0),[p,g]=f.useState(!1),[x,b]=f.useState("select");useEffect(()=>{(async()=>{try{const _=await Fe.taskmaster.getTemplates();if(_.ok){const U=await _.json();a(U.templates)}}catch(_){console.error("Error loading templates:",_)}finally{h(!1)}})()},[]);const k=y=>{o(y);const _=y.content.match(/\[([^\]]+)\]/g)||[],U=[...new Set(_.map(B=>B.slice(1,-1)))],D={};U.forEach(B=>{D[B]=""}),c(D),b("customize")},N=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 U=await y.json();throw new Error(U.message||"Failed to apply template")}const _=await Fe.taskmaster.parsePRD(e.name,{fileName:d,numTasks:10});if(!_.ok){const U=await _.json();throw new Error(U.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 u?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=>m(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,_])=>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(/^./,U=>U.toUpperCase())}),t.jsx("input",{type:"text",value:_,onChange:U=>c(D=>({...D,[y]:U.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:N,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(),N=30+Math.random()*20,y=setInterval(()=>{const _=Math.floor((Date.now()-k)/1e3);i(_),d(Math.floor(_*N))},1e3);return()=>clearInterval(y)},[n]),f.useEffect(()=>{if(!n)return;const k=setInterval(()=>{l(N=>(N+1)%4)},500);return()=>clearInterval(k)},[n]),!n)return null;const m=["Thinking","Processing","Analyzing","Working","Computing","Reasoning"],u=Math.floor(a/3)%m.length,h=e?.text||m[u],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:Ee("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),m=f.useRef([]),u=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),m.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 _=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",U=new MediaRecorder(y,{mimeType:_});c.current=U,U.ondataavailable=D=>{D.data.size>0&&m.current.push(D.data)},U.onstop=async()=>{console.log("Recording stopped, creating blob...");const D=new Blob(m.current,{type:_});d.current&&(d.current.getTracks().forEach(j=>j.stop()),d.current=null),s("transcribing");const B=window.localStorage.getItem("whisperMode")||"default",L=B==="prompt"||B==="vibe"||B==="instructions"||B==="architect";let H;L&&(H=setTimeout(()=>{s("processing")},2e3));try{const j=await xv(D);j&&e&&e(j)}catch(j){console.error("Transcription error:",j),i(j.message)}finally{H&&clearTimeout(H),s("idle")}},U.start(),s("recording"),console.log("Recording started successfully")}catch(y){console.error("Failed to start recording:",y);let _="Microphone access failed";y.name==="NotAllowedError"?_="Microphone access denied. Please allow microphone permissions.":y.name==="NotFoundError"?_="No microphone found. Please check your audio devices.":y.name==="NotSupportedError"?_="Microphone not supported by this browser.":y.name==="NotReadableError"?_="Microphone is being used by another application.":y.message.includes("HTTPS")&&(_=y.message),i(_),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 _=Date.now();if(_-u.current<300){console.log("Ignoring rapid tap");return}u.current=_,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:N}=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
|
+
${N?"cursor-not-allowed opacity-75":"cursor-pointer"}
|
|
436
|
+
${n==="recording"?"animate-pulse":""}
|
|
437
|
+
hover:opacity-90
|
|
438
|
+
${r}
|
|
439
|
+
`,onClick:g,disabled:N,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 lr(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 er(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 zt(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(er(e)||lr(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 lr(e)?e:e.split(".")}function _a(e){return lr(e)?e.join("."):e}function Iv(e,r){let n=[],s=!1;const a=(i,o,l)=>{if(zt(i))if(!o[l])n.push(i);else{let c=o[l];const d=i[c];if(!zt(d))return;if(l===o.length-1&&(er(d)||Md(d)||kv(d)))n.push(yv(d));else if(lr(d)){s=!0;for(let m=0,u=d.length;m<u;m+=1)a(d[m],o,l+1)}else o.length&&a(d,o,l+1)}};return a(e,er(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 Pe={...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=Pe.getFn,fieldNormWeight:n=Pe.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,er(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();er(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(!zt(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(zt(o)){if(lr(o)){let l=[];const c=[{nestedArrIndex:-1,value:o}];for(;c.length;){const{nestedArrIndex:d,value:m}=c.pop();if(zt(m))if(er(m)&&!ca(m)){let u={v:m,i:d,n:this.norm.get(m)};l.push(u)}else lr(m)&&m.forEach((u,h)=>{c.push({nestedArrIndex:h,value:u})})}s.$[i]=l}else if(er(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=Pe.getFn,fieldNormWeight:s=Pe.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=Pe.getFn,fieldNormWeight:n=Pe.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=Pe.distance,ignoreLocation:i=Pe.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=Pe.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 Ar=32;function zv(e,r,n,{location:s=Pe.location,distance:a=Pe.distance,threshold:i=Pe.threshold,findAllMatches:o=Pe.findAllMatches,minMatchCharLength:l=Pe.minMatchCharLength,includeMatches:c=Pe.includeMatches,ignoreLocation:d=Pe.ignoreLocation}={}){if(r.length>Ar)throw new Error(Nv(Ar));const m=r.length,u=e.length,h=Math.max(0,Math.min(s,u));let p=i,g=h;const x=l>1||c,b=x?Array(u):[];let k;for(;(k=e.indexOf(r,g))>-1;){let B=ns(r,{currentLocation:k,expectedLocation:h,distance:a,ignoreLocation:d});if(p=Math.min(B,p),g=k+m,x){let L=0;for(;L<m;)b[k+L]=1,L+=1}}g=-1;let N=[],y=1,_=m+u;const U=1<<m-1;for(let B=0;B<m;B+=1){let L=0,H=_;for(;L<H;)ns(r,{errors:B,currentLocation:h+H,expectedLocation:h,distance:a,ignoreLocation:d})<=p?L=H:_=H,H=Math.floor((_-L)/2+L);_=H;let j=Math.max(1,h-H+1),P=o?u:Math.min(h+H,u)+m,M=Array(P+2);M[P+1]=(1<<B)-1;for(let w=P;w>=j;w-=1){let W=w-1,O=n[e.charAt(W)];if(x&&(b[W]=+!!O),M[w]=(M[w+1]<<1|1)&O,B&&(M[w]|=(N[w+1]|N[w])<<1|1|N[w+1]),M[w]&U&&(y=ns(r,{errors:B,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:B+1,currentLocation:h,expectedLocation:h,distance:a,ignoreLocation:d})>p)break;N=M}const D={isMatch:g>=0,score:Math.max(.001,y)};if(x){const B=_v(b,l);B.length?c&&(D.indices=B):D.isMatch=!1}return D}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=Pe.location,threshold:s=Pe.threshold,distance:a=Pe.distance,includeMatches:i=Pe.includeMatches,findAllMatches:o=Pe.findAllMatches,minMatchCharLength:l=Pe.minMatchCharLength,isCaseSensitive:c=Pe.isCaseSensitive,ignoreDiacritics:d=Pe.ignoreDiacritics,ignoreLocation:m=Pe.ignoreLocation}={}){if(this.options={location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:m},r=c?r:r.toLowerCase(),r=d?bs(r):r,this.pattern=r,this.chunks=[],!this.pattern.length)return;const u=(p,g)=>{this.chunks.push({pattern:p,alphabet:Fv(p),startIndex:g})},h=this.pattern.length;if(h>Ar){let p=0;const g=h%Ar,x=h-g;for(;p<x;)u(this.pattern.substr(p,Ar),p),p+=Ar;if(g){const b=h-Ar;u(this.pattern.substr(b),b)}}else u(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:m}=this.options;let u=[],h=0,p=!1;this.chunks.forEach(({pattern:x,alphabet:b,startIndex:k})=>{const{isMatch:N,score:y,indices:_}=zv(r,x,b,{location:i+k,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,includeMatches:a,ignoreLocation:m});N&&(p=!0),h+=y,N&&_&&(u=[...u,..._])});let g={isMatch:p,score:p?h/this.chunks.length:1};return p&&a&&(g.indices=u),g}}class wr{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 wr{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 wr{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 wr{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 Wv extends wr{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 Uv extends wr{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 wr{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 wr{constructor(r,{location:n=Pe.location,threshold:s=Pe.threshold,distance:a=Pe.distance,includeMatches:i=Pe.includeMatches,findAllMatches:o=Pe.findAllMatches,minMatchCharLength:l=Pe.minMatchCharLength,isCaseSensitive:c=Pe.isCaseSensitive,ignoreDiacritics:d=Pe.ignoreDiacritics,ignoreLocation:m=Pe.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:m})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(r){return this._bitapSearch.searchIn(r)}}class zd extends wr{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,Wv,Hv,Uv,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 m=za[d];let u=m.isMultiMatch(l);u&&(a.push(new m(u,r)),c=!0)}if(!c)for(d=-1;++d<ol;){const m=za[d];let u=m.isSingleMatch(l);if(u){a.push(new m(u,r));break}}}return a})}const Kv=new Set([_d.type,zd.type]);class Jv{constructor(r,{isCaseSensitive:n=Pe.isCaseSensitive,ignoreDiacritics:s=Pe.ignoreDiacritics,includeMatches:a=Pe.includeMatches,minMatchCharLength:i=Pe.minMatchCharLength,ignoreLocation:o=Pe.ignoreLocation,findAllMatches:l=Pe.findAllMatches,location:c=Pe.location,threshold:d=Pe.threshold,distance:m=Pe.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a,minMatchCharLength:i,findAllMatches:l,ignoreLocation:o,location:c,threshold:d,distance:m},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,m=n.length;d<m;d+=1){const u=n[d];l.length=0,o=0;for(let h=0,p=u.length;h<p;h+=1){const g=u[h],{isMatch:x,indices:b,score:k}=g.search(r);if(x){if(o+=1,c+=k,s){const N=g.constructor.type;Kv.has(N)?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=>!lr(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(!er(d))throw new Error(jv(c));const m={keyId:_a(c),pattern:d};return n&&(m.searcher=$a(d,r)),m}let l={children:[],operator:i[0]};return i.forEach(c=>{const d=a[c];lr(d)&&d.forEach(m=>{l.children.push(s(m))})}),l};return Ba(e)||(e=ll(e)),s(e)}function Zv(e,{ignoreFieldNorm:r=Pe.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=[],zt(n)&&n.forEach(s=>{if(!zt(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=Pe.includeMatches,includeScore:s=Pe.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 cn{constructor(r,n={},s){this.options={...Pe,...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){zt(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=er(r)?er(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(!zt(i))return;const{isMatch:c,score:d,indices:m}=n.searchIn(i);c&&a.push({item:i,idx:o,matches:[{score:d,value:i,norm:l,indices:m}]})}),a}_searchLogical(r){const n=Fd(r,this.options),s=(l,c,d)=>{if(!l.children){const{keyId:u,searcher:h}=l,p=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(c,u),searcher:h});return p&&p.length?[{idx:d,item:c,matches:p}]:[]}const m=[];for(let u=0,h=l.children.length;u<h;u+=1){const p=l.children[u],g=s(p,c,d);if(g.length)m.push(...g);else if(l.operator===ys.AND)return[]}return m},a=this._myIndex.records,i={},o=[];return a.forEach(({$:l,i:c})=>{if(zt(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:m})=>{i[c].matches.push(...m)}))}}),o}_searchObjectList(r){const n=$a(r,this.options),{keys:s,records:a}=this._myIndex,i=[];return a.forEach(({$:o,i:l})=>{if(!zt(o))return;let c=[];s.forEach((d,m)=>{c.push(...this._findMatches({key:d,value:o[m],searcher:n}))}),c.length&&i.push({idx:l,item:o,matches:c})}),i}_findMatches({key:r,value:n,searcher:s}){if(!zt(n))return[];let a=[];if(lr(n))n.forEach(({v:i,i:o,n:l})=>{if(!zt(i))return;const{isMatch:c,score:d,indices:m}=s.searchIn(i);c&&a.push({score:d,key:r,value:i,idx:o,norm:l,indices:m})});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}}cn.version="7.1.0";cn.createIndex=Ld;cn.parseIndex=Rv;cn.config=Pe;cn.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),m=(()=>{const N=window.innerWidth<640,y=window.innerHeight;return N?{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 N=y=>{l.current&&!l.current.contains(y.target)&&i&&s()};if(i)return document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}},[i,s]),f.useEffect(()=>{if(c.current&&l.current){const N=l.current.getBoundingClientRect(),y=c.current.getBoundingClientRect();y.bottom>N.bottom?c.current.scrollIntoView({block:"nearest",behavior:"smooth"}):y.top<N.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:{...m,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 u=o.length>0,h=e.reduce((N,y)=>{const _=y.namespace||y.type||"other";return N[_]||(N[_]=[]),N[_].push(y),N},{});u&&(h.frequent=o);const g=(u?["frequent","builtin","project","user","other"]:["builtin","project","user","other"]).filter(N=>h[N]),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(N=>{h[N].forEach(y=>{k.push({...y,globalIndex:b++,namespace:N})})}),t.jsxs("div",{ref:l,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...m,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(N=>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[N]||N}),h[N].map(y=>{const _=k.find(D=>D.name===y.name&&D.namespace===N),U=_&&_.globalIndex===r;return t.jsxs("div",{ref:U?c:null,role:"option","aria-selected":U,className:"command-item",onMouseEnter:()=>n&&n(y,_.globalIndex,!0),onClick:()=>n&&n(y,_.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:U?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:D=>D.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:[N==="builtin"&&"⚡",N==="project"&&"📁",N==="user"&&"👤",N==="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})]}),U&&t.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"↵"})]},`${N}-${y.name}`)})]},N)),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 xr(e){return e&&e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/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 Wa(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),m=c%60,u=`GMT${l}${d}${m?":"+String(m).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,N=>N.toUpperCase()),x=g?`${u} (${g})`:u,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]=or.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 u=l,h=()=>{const p=()=>{o(!0),setTimeout(()=>o(!1),1500)};try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(u).then(p).catch(()=>{const g=document.createElement("textarea");g.value=u,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=u,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 m=n&&n.type===e.type&&(n.type==="assistant"||n.type==="user"||n.type==="tool"||n.type==="error"),u=or.useRef(null),[h,p]=or.useState(!1);return or.useEffect(()=>{if(!o||!u.current||!e.isToolUse)return;const g=new IntersectionObserver(x=>{x.forEach(b=>{b.isIntersecting&&!h&&(p(!0),u.current.querySelectorAll("details").forEach(N=>{N.open=!0}))})},{threshold:.1});return g.observe(u.current),()=>{u.current&&g.unobserve(u.current)}},[o,h,e.isToolUse]),t.jsx("div",{ref:u,className:`chat-message ${e.type} ${m?"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()})]}),!m&&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:[!m&&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(ir,{className:"w-full h-full"}):t.jsx(Zt,{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),N=await k.json();if(!k.ok||N.error){console.error("Failed to fetch file:",N.error),a(x.file_path);return}const y=N.content||"",_=y.replace(x.new_string,x.old_string);a(x.file_path,{old_string:_,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 N=k.content||"",y=N.replace(x.new_string,x.old_string);a(x.file_path,{old_string:y,new_string:N})}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),N=await k.json(),y=k.ok&&!N.error?N.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(),N=b.ok&&!k.error?k.content||"":x.content||"";a(x.file_path,{old_string:"",new_string:N})}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 _=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:_})]})}}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((_,U)=>{const D=_.split("/").pop(),B=_.substring(0,_.lastIndexOf("/"));return t.jsxs("div",{onClick:()=>{a&&a(_)},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:D}),t.jsx("div",{className:"font-mono text-xs text-green-600/70 dark:text-green-400/70 truncate",children:B})]}),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"})})]},U)})})]})}if(b.includes("Do you want to proceed?")&&e.toolName==="Bash"){const y=b.split(`
|
|
478
|
+
`),_=y.findIndex(P=>P.includes("Do you want to proceed?")),U=y.slice(0,_).join(`
|
|
479
|
+
`),D=y.slice(_),B=D.find(P=>P.includes("Do you want to proceed?"))||"",L=[];D.forEach(P=>{const M=P.match(/^\s*(\d+)\.\s+(.+)$/);M&&L.push({number:M[1],text:M[2].trim()})});const H=b.match(/>\s*(\d+)/),j=H?H[1]:null;return t.jsxs("div",{className:"space-y-3",children:[U&&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:U})}),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:B}),t.jsx("div",{className:"space-y-2 mb-4",children:L.map(P=>t.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${j===P.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===P.number?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:P.number}),t.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:P.text}),j===P.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"})})]})},P.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 _=await(await De(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(k[1])}`)).json();!_.error&&_.oldContent!==void 0&&_.currentContent!==void 0?a(k[1],{old_string:_.oldContent||"",new_string:_.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 N=b.match(/(?:The file|File) (.+?) has been (?:created|written)(?: successfully)?\.?/);return N?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 _=await(await De(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(N[1])}`)).json();!_.error&&_.oldContent!==void 0&&_.currentContent!==void 0?a(N[1],{old_string:_.oldContent||"",new_string:_.currentContent||""}):a(N[1])}catch(y){console.error("Error fetching file diff:",y),a(N[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:N[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 N=k.match(/[❯\s]*(\d+)\.\s+(.+)/);if(N){const y=k.includes("❯");b.push({number:N[1],text:N[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=Wa(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 ${m?"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:m,processingSessions:u,onReplaceTemporarySession:h,onNavigateToSession:p,onShowSettings:g,autoExpandTools:x,showRawParameters:b,showThinking:k,autoScrollToBottom:N,sendByCtrlEnter:y,externalMessageUpdate:_,onTaskClick:U,onShowAllTasks:D}){const{tasksEnabled:B}=zn(),[L,H]=f.useState(()=>typeof window<"u"&&e&&At.getItem(`draft_input_${e.name}`)||""),[j,P]=f.useState(()=>{if(typeof window<"u"&&e){const E=At.getItem(`chat_messages_${e.name}`);return E?JSON.parse(E):[]}return[]}),[M,R]=f.useState(!1),[w,W]=f.useState(r?.id||null),[O,$]=f.useState(!1),[G,ce]=f.useState([]),[I,je]=f.useState(!1),[We,v]=f.useState(!1),[te,me]=f.useState(0),[Ne,ne]=f.useState(!1),[Oe,ee]=f.useState(0),oe=20,[he,Ce]=f.useState(!1),[ke,Ve]=f.useState("default"),[Ke,rt]=f.useState([]),[xe,Re]=f.useState(new Map),[pe,Ue]=f.useState(new Map),mt=f.useRef(null),Ie=f.useRef(null),$t=f.useRef(null),Z=f.useRef(null),ue=f.useRef(!1),S=f.useRef(""),F=f.useRef(null),K=f.useRef(null),[se,le]=f.useState(""),[ze,Le]=f.useState(!1),[Je,pt]=f.useState([]),[tt,st]=f.useState([]),[ct,dt]=f.useState(-1),[Ot,Bt]=f.useState(0),[Lt,kt]=f.useState(-1),[jr,vt]=f.useState(!1),[It,A]=f.useState(!1),re=f.useRef({height:0,top:0}),[we,z]=f.useState(!1),[T,ie]=f.useState([]),[C,X]=f.useState([]),[fe,He]=f.useState(""),[at,yt]=f.useState(!1),[nt,dn]=f.useState(null),[As,rr]=f.useState(-1),[Si,mr]=f.useState(-1),[un,ou]=f.useState(100),[lu,$r]=f.useState(null),[ht,Ms]=f.useState(()=>localStorage.getItem("selected-provider")||"claude"),[Or,Ei]=f.useState(()=>localStorage.getItem("cursor-model")||"gpt-5");f.useEffect(()=>{if(r?.id){const E=localStorage.getItem(`permissionMode-${r.id}`);Ve(E||"default")}},[r?.id]),f.useEffect(()=>{r&&r.__provider&&r.__provider!==ht&&(Ms(r.__provider),localStorage.setItem("selected-provider",r.__provider))},[r]),f.useEffect(()=>{ht==="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 V={"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(V)}}).catch(E=>console.error("Error loading Cursor config:",E))},[ht]),f.useEffect(()=>{(async()=>{if(e)try{const J=await De("/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 V=await J.json(),q=[...(V.builtIn||[]).map(Se=>({...Se,type:"built-in"})),...(V.custom||[]).map(Se=>({...Se,type:"custom"}))];ie(q);const Q=`command_history_${e.name}`,ve=At.getItem(Q);if(ve)try{const Se=JSON.parse(ve),Ye=q.sort((Ae,Y)=>{const ge=Se[Ae.name]||0;return(Se[Y.name]||0)-ge});ie(Ye)}catch(Se){console.error("Error parsing command history:",Se)}}catch(J){console.error("Error fetching slash commands:",J),ie([])}})()},[e]);const Ts=f.useMemo(()=>T.length?new cn(T,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[T]);f.useEffect(()=>{if(!fe){X(T);return}if(!Ts){X([]);return}const E=Ts.search(fe);X(E.map(J=>J.item))},[fe,T,Ts]);const cu=f.useMemo(()=>{if(!e||T.length===0)return[];const E=`command_history_${e.name}`,J=At.getItem(E);if(!J)return[];try{const V=JSON.parse(J);return T.map(Q=>({...Q,usageCount:V[Q.name]||0})).filter(Q=>Q.usageCount>0).sort((Q,ve)=>ve.usageCount-Q.usageCount).slice(0,5)}catch(V){return console.error("Error parsing command history:",V),[]}},[e,T]),du=f.useCallback((E,J,V)=>{if(!E||!e)return;if(V){rr(J);return}const q=`command_history_${e.name}`,Q=At.getItem(q);let ve={};try{ve=Q?JSON.parse(Q):{}}catch(Se){console.error("Error parsing command history:",Se)}ve[E.name]=(ve[E.name]||0)+1,At.setItem(q,JSON.stringify(ve)),Ii(E)},[e]),uu=f.useCallback(E=>{const{action:J,data:V}=E;switch(J){case"clear":P([]),ce([]);break;case"help":P(q=>[...q,{role:"assistant",content:V.content,timestamp:Date.now()}]);break;case"model":P(q=>[...q,{role:"assistant",content:`**Current Model**: ${V.current.model}
|
|
481
|
+
|
|
482
|
+
**Available Models**:
|
|
483
|
+
|
|
484
|
+
Claude: ${V.available.claude.join(", ")}
|
|
485
|
+
|
|
486
|
+
Cursor: ${V.available.cursor.join(", ")}`,timestamp:Date.now()}]);break;case"cost":{const q=`**Token Usage**: ${V.tokenUsage.used.toLocaleString()} / ${V.tokenUsage.total.toLocaleString()} (${V.tokenUsage.percentage}%)
|
|
487
|
+
|
|
488
|
+
**Estimated Cost**:
|
|
489
|
+
- Input: $${V.cost.input}
|
|
490
|
+
- Output: $${V.cost.output}
|
|
491
|
+
- **Total**: $${V.cost.total}
|
|
492
|
+
|
|
493
|
+
**Model**: ${V.model}`;P(Q=>[...Q,{role:"assistant",content:q,timestamp:Date.now()}]);break}case"status":{const q=`**System Status**
|
|
494
|
+
|
|
495
|
+
- Version: ${V.version}
|
|
496
|
+
- Uptime: ${V.uptime}
|
|
497
|
+
- Model: ${V.model}
|
|
498
|
+
- Provider: ${V.provider}
|
|
499
|
+
- Node.js: ${V.nodeVersion}
|
|
500
|
+
- Platform: ${V.platform}`;P(Q=>[...Q,{role:"assistant",content:q,timestamp:Date.now()}]);break}case"memory":V.error?P(q=>[...q,{role:"assistant",content:`⚠️ ${V.message}`,timestamp:Date.now()}]):(P(q=>[...q,{role:"assistant",content:`📝 ${V.message}
|
|
501
|
+
|
|
502
|
+
Path: \`${V.path}\``,timestamp:Date.now()}]),V.exists&&i&&i(V.path));break;case"config":g&&g();break;case"rewind":V.error?P(q=>[...q,{role:"assistant",content:`⚠️ ${V.message}`,timestamp:Date.now()}]):(P(q=>q.slice(0,-V.steps*2)),P(q=>[...q,{role:"assistant",content:`⏪ ${V.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:V,hasBashCommands:q,hasFileIncludes:Q}=E;if(q&&!window.confirm("This command contains bash commands that will be executed. Do you want to proceed?")){P(Se=>[...Se,{role:"assistant",content:"❌ Command execution cancelled",timestamp:Date.now()}]);return}H(V),setTimeout(()=>{if(Ds.current){const ve={preventDefault:()=>{}};Ds.current(ve)}},50)},[]),Ii=f.useCallback(async E=>{if(!(!E||!e))try{const J=L.match(new RegExp(`${E.name}\\s*(.*)`)),V=J&&J[1]?J[1].trim().split(/\s+/):[],q={projectPath:e.path,projectName:e.name,sessionId:w,provider:ht,model:ht==="cursor"?Or:"claude-sonnet-4.5",tokenUsage:nt},Q=await De("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:E.name,commandPath:E.path,args:V,context:q})});if(!Q.ok)throw new Error("Failed to execute command");const ve=await Q.json();ve.type==="builtin"?uu(ve):ve.type==="custom"&&await mu(ve,V),H(""),z(!1),mr(-1),He(""),rr(-1)}catch(J){console.error("Error executing command:",J),P(V=>[...V,{role:"assistant",content:`Error executing command: ${J.message}`,timestamp:Date.now()}])}},[L,e,w,ht,Or,nt]),pu=f.useMemo(()=>{const E=new Map;return(J,V)=>{const q=`${J.length}-${V.length}-${J.slice(0,50)}`;if(E.has(q))return E.get(q);const Q=hu(J,V);if(E.set(q,Q),E.size>100){const ve=E.keys().next().value;E.delete(ve)}return Q}},[]),mn=f.useCallback(async(E,J,V=!1)=>{if(!E||!J)return[];const q=!V;q?je(!0):v(!0);try{const Q=V?te:0,ve=await Fe.sessionMessages(E,J,oe,Q);if(!ve.ok)throw new Error("Failed to load session messages");const Se=await ve.json();if(Se.hasMore!==void 0)return ne(Se.hasMore),ee(Se.total),me(Q+(Se.messages?.length||0)),Se.messages||[];{const Ye=Se.messages||[];return ne(!1),ee(Ye.length),Ye}}catch(Q){return console.error("Error loading session messages:",Q),[]}finally{q?je(!1):v(!1)}},[te]),Bn=f.useCallback(async(E,J)=>{if(!E||!J)return[];je(!0);try{const V=`/api/cursor/sessions/${encodeURIComponent(J)}?projectPath=${encodeURIComponent(E)}`,q=await De(V);if(!q.ok)return[];const ve=(await q.json())?.session?.messages||[],Se=[],Ye={};for(let Ae=0;Ae<ve.length;Ae++){const Y=ve[Ae],ge=Y.content;let _e="",Ze="assistant",Xe=null;try{if(ge?.role&&ge?.content){if(ge.role==="system")continue;if(ge.role==="tool"){if(Array.isArray(ge.content)){for(const Be of ge.content)if(Be?.type==="tool-result"){let Ge=Be.toolName||"Unknown Tool";Ge==="ApplyPatch"&&(Ge="Edit");const Wt=Be.toolCallId||ge.id,pr=Be.result||"";Ye[Wt]?Ye[Wt].toolResult={content:pr,isError:!1}:Se.push({type:"assistant",content:"",timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:Ge,toolId:Wt,toolInput:null,toolResult:{content:pr,isError:!1}})}}continue}else if(Ze=ge.role==="user"?"user":"assistant",Array.isArray(ge.content)){const Be=[];for(const Ge of ge.content)if(Ge?.type==="text"&&Ge?.text)Be.push(xr(Ge.text));else if(Ge?.type==="reasoning"&&Ge?.text)Xe=xr(Ge.text);else if(Ge?.type==="tool-call"){(Be.length>0||Xe)&&(Se.push({type:Ze,content:Be.join(`
|
|
503
|
+
`),reasoning:Xe,timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),Be.length=0,Xe=null);let Wt=Ge.toolName||"Unknown Tool";Wt==="ApplyPatch"&&(Wt="Edit");const pr=Ge.toolCallId||`tool_${Ae}`;let sr=Ge.args;if(Wt==="Edit"&&Ge.args)if(Ge.args.patch){const Gt=Ge.args.patch.split(`
|
|
504
|
+
`);let pn=[],Rs=[],Li=!1;for(const hr of Gt)hr.startsWith("@@")?Li=!0:Li&&(hr.startsWith("-")?pn.push(hr.substring(1)):hr.startsWith("+")?Rs.push(hr.substring(1)):hr.startsWith(" ")&&(pn.push(hr.substring(1)),Rs.push(hr.substring(1))));const Hn=Ge.args.file_path;sr={file_path:Hn&&!Hn.startsWith("/")?`${E}/${Hn}`:Hn,old_string:pn.join(`
|
|
505
|
+
`)||Ge.args.patch,new_string:Rs.join(`
|
|
506
|
+
`)||Ge.args.patch}}else sr=Ge.args;else if(Wt==="Read"&&Ge.args){const Gt=Ge.args.path||Ge.args.file_path;sr={file_path:Gt&&!Gt.startsWith("/")?`${E}/${Gt}`:Gt}}else if(Wt==="Write"&&Ge.args){const Gt=Ge.args.path||Ge.args.file_path;sr={file_path:Gt&&!Gt.startsWith("/")?`${E}/${Gt}`:Gt,content:Ge.args.contents||Ge.args.content}}const Pi={type:"assistant",content:"",timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:Wt,toolId:pr,toolInput:sr?JSON.stringify(sr):null,toolResult:null};Se.push(Pi),Ye[pr]=Pi}else if(Ge?.type==="tool_use"){(Be.length>0||Xe)&&(Se.push({type:Ze,content:Be.join(`
|
|
507
|
+
`),reasoning:Xe,timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),Be.length=0,Xe=null);const Wt=Ge.name||"Unknown Tool",pr=Ge.id||`tool_${Ae}`,sr={type:"assistant",content:"",timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:Wt,toolId:pr,toolInput:Ge.input?JSON.stringify(Ge.input):null,toolResult:null};Se.push(sr),Ye[pr]=sr}else typeof Ge=="string"&&Be.push(Ge);Be.length>0?(_e=Be.join(`
|
|
508
|
+
`),Xe&&!_e&&(Se.push({type:Ze,content:"",reasoning:Xe,timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),_e="")):_e=""}else typeof ge.content=="string"&&(_e=ge.content)}else if(ge?.message?.role&&ge?.message?.content){if(ge.message.role==="system")continue;Ze=ge.message.role==="user"?"user":"assistant",Array.isArray(ge.message.content)?_e=ge.message.content.map(Be=>typeof Be=="string"?Be:Be?.text||"").filter(Boolean).join(`
|
|
509
|
+
`):typeof ge.message.content=="string"&&(_e=ge.message.content)}}catch(Be){console.log("Error parsing blob content:",Be)}if(_e&&_e.trim()){const Be={type:Ze,content:_e,timestamp:new Date(Date.now()+Ae*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid};Xe&&(Be.reasoning=Xe),Se.push(Be)}}return Se.sort((Ae,Y)=>Ae.sequence!==void 0&&Y.sequence!==void 0?Ae.sequence-Y.sequence:Ae.rowid!==void 0&&Y.rowid!==void 0?Ae.rowid-Y.rowid:new Date(Ae.timestamp)-new Date(Y.timestamp)),Se}catch(V){return console.error("Error loading Cursor session messages:",V),[]}finally{je(!1)}},[]),hu=(E,J)=>{const V=E.split(`
|
|
510
|
+
`),q=J.split(`
|
|
511
|
+
`),Q=[];let ve=0,Se=0;for(;ve<V.length||Se<q.length;){const Ye=V[ve],Ae=q[Se];ve>=V.length?(Q.push({type:"added",content:Ae,lineNum:Se+1}),Se++):Se>=q.length?(Q.push({type:"removed",content:Ye,lineNum:ve+1}),ve++):Ye===Ae?(ve++,Se++):(Q.push({type:"removed",content:Ye,lineNum:ve+1}),Q.push({type:"added",content:Ae,lineNum:Se+1}),ve++,Se++)}return Q},fu=E=>{const J=[],V=new Map;for(const q of E)if(q.message?.role==="user"&&Array.isArray(q.message?.content))for(const Q of q.message.content)Q.type==="tool_result"&&V.set(Q.tool_use_id,{content:Q.content,isError:Q.is_error,timestamp:new Date(q.timestamp||Date.now()),toolUseResult:q.toolUseResult||null});for(const q of E)if(q.message?.role==="user"&&q.message?.content){let Q="",ve="user";if(Array.isArray(q.message.content)){const Ye=[];for(const Ae of q.message.content)Ae.type==="text"&&Ye.push(xr(Ae.text));Q=Ye.join(`
|
|
512
|
+
`)}else typeof q.message.content=="string"?Q=xr(q.message.content):Q=xr(String(q.message.content));!Q||Q.startsWith("<command-name>")||Q.startsWith("<command-message>")||Q.startsWith("<command-args>")||Q.startsWith("<local-command-stdout>")||Q.startsWith("<system-reminder>")||Q.startsWith("Caveat:")||Q.startsWith("This session is being continued from a previous")||Q.startsWith("[Request interrupted")||(Q=Q.replace(/\\n/g,`
|
|
513
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r"),J.push({type:ve,content:Q,timestamp:q.timestamp||new Date().toISOString()}))}else if(q.message?.role==="assistant"&&q.message?.content){if(Array.isArray(q.message.content)){for(const Q of q.message.content)if(Q.type==="text"){let ve=Q.text;typeof ve=="string"&&(ve=ve.replace(/\\n/g,`
|
|
514
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r")),J.push({type:"assistant",content:ve,timestamp:q.timestamp||new Date().toISOString()})}else if(Q.type==="tool_use"){const ve=V.get(Q.id);J.push({type:"assistant",content:"",timestamp:q.timestamp||new Date().toISOString(),isToolUse:!0,toolName:Q.name,toolInput:JSON.stringify(Q.input),toolResult:ve?{content:typeof ve.content=="string"?ve.content:JSON.stringify(ve.content),isError:ve.isError,toolUseResult:ve.toolUseResult}:null,toolError:ve?.isError||!1,toolResultTimestamp:ve?.timestamp||new Date})}}else if(typeof q.message.content=="string"){let Q=q.message.content;Q=Q.replace(/\\n/g,`
|
|
515
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r"),J.push({type:"assistant",content:Q,timestamp:q.timestamp||new Date().toISOString()})}}return J},Ai=f.useMemo(()=>fu(G),[G]),nr=f.useCallback(()=>{Z.current&&(Z.current.scrollTop=Z.current.scrollHeight,A(!1))},[]),Wn=f.useCallback(()=>{if(!Z.current)return!1;const{scrollTop:E,scrollHeight:J,clientHeight:V}=Z.current;return J-E-V<50},[]),Ps=f.useCallback(async()=>{if(Z.current){const E=Z.current,J=Wn();A(!J);const V=E.scrollTop<100,q=localStorage.getItem("selected-provider")||"claude";if(V&&Ne&&!We&&r&&e&&q!=="cursor"){const Q=E.scrollHeight,ve=E.scrollTop,Se=await mn(e.name,r.id,!0);Se.length>0&&(ce(Ye=>[...Se,...Ye]),setTimeout(()=>{if(Z.current){const Ae=Z.current.scrollHeight-Q;Z.current.scrollTop=ve+Ae}},0))}}},[Wn,Ne,We,r,e,mn]);f.useEffect(()=>{(async()=>{if(r&&e){const J=localStorage.getItem("selected-provider")||"claude";if(ue.current=!0,w!==null&&w!==r.id?(me(0),ne(!1),ee(0),dn(null),R(!1),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:J})):w===null&&(me(0),ne(!1),ee(0),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:J})),J==="cursor")if(W(r.id),sessionStorage.setItem("cursorSessionId",r.id),he)Ce(!1);else{const q=e.fullPath||e.path,Q=await Bn(q,r.id);ce([]),P(Q)}else if(W(r.id),he)Ce(!1);else{const q=await mn(e.name,r.id,!1);ce(q)}}else!he&&!M&&(P([]),ce([])),W(null),sessionStorage.removeItem("cursorSessionId"),me(0),ne(!1),ee(0);setTimeout(()=>{ue.current=!1},250)})()},[r,e,Bn,nr,he]),f.useEffect(()=>{_>0&&r&&e&&(async()=>{try{if((localStorage.getItem("selected-provider")||"claude")==="cursor"){const V=e.fullPath||e.path,q=await Bn(V,r.id);ce([]),P(q)}else{const V=await mn(e.name,r.id,!1);ce(V),Wn&&N&&setTimeout(()=>nr(),200)}}catch(J){console.error("Error reloading messages from external update:",J)}})()},[_,r,e,Bn,mn,Wn,N,nr]),f.useEffect(()=>{G.length>0&&P(Ai)},[Ai,G]),f.useEffect(()=>{o&&o(O)},[O,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&&H(E)}},[e?.name]),f.useEffect(()=>{w&&M&&d&&d(w)},[M,w,d]),f.useEffect(()=>{w&&u&&u.has(w)&&!M&&(R(!0),vt(!0))},[w,u]),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 q=E.data.message||E.data;if(q&&typeof q=="object"&&q.type){if(q.type==="content_block_delta"&&q.delta?.text){const Y=xr(q.delta.text);S.current+=Y,F.current||(F.current=setTimeout(()=>{const ge=S.current;S.current="",F.current=null,ge&&P(_e=>{const Ze=[..._e],Xe=Ze[Ze.length-1];return Xe&&Xe.type==="assistant"&&!Xe.isToolUse&&Xe.isStreaming?Xe.content=(Xe.content||"")+ge:Ze.push({type:"assistant",content:ge,timestamp:new Date,isStreaming:!0}),Ze})},100));return}if(q.type==="content_block_stop"){F.current&&(clearTimeout(F.current),F.current=null);const Y=S.current;S.current="",Y&&P(ge=>{const _e=[...ge],Ze=_e[_e.length-1];return Ze&&Ze.type==="assistant"&&!Ze.isToolUse&&Ze.isStreaming?Ze.content=(Ze.content||"")+Y:_e.push({type:"assistant",content:Y,timestamp:new Date,isStreaming:!0}),_e}),P(ge=>{const _e=[...ge],Ze=_e[_e.length-1];return Ze&&Ze.type==="assistant"&&Ze.isStreaming&&(Ze.isStreaming=!1),_e});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}),Ce(!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}),Ce(!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(q.content)){for(const Y of q.content)if(Y.type==="tool_use"){const ge=Y.input?JSON.stringify(Y.input,null,2):"";P(_e=>[..._e,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:Y.name,toolInput:ge,toolId:Y.id,toolResult:null}])}else if(Y.type==="text"&&Y.text?.trim()){let ge=xr(Y.text);ge=Wa(ge),P(_e=>[..._e,{type:"assistant",content:ge,timestamp:new Date}])}}else if(typeof q.content=="string"&&q.content.trim()){let Y=xr(q.content);Y=Wa(Y),P(ge=>[...ge,{type:"assistant",content:Y,timestamp:new Date}])}if(q.role==="user"&&Array.isArray(q.content))for(const Y of q.content)Y.type==="tool_result"&&P(ge=>ge.map(_e=>_e.isToolUse&&_e.toolId===Y.tool_use_id?{..._e,toolResult:{content:Y.content,isError:Y.is_error,timestamp:new Date}}:_e));break;case"claude-output":{const Y=String(E.data||"");Y.trim()&&(S.current+=S.current?`
|
|
516
|
+
${Y}`:Y,F.current||(F.current=setTimeout(()=>{const ge=S.current;S.current="",F.current=null,ge&&P(_e=>{const Ze=[..._e],Xe=Ze[Ze.length-1];return Xe&&Xe.type==="assistant"&&!Xe.isToolUse&&Xe.isStreaming?Xe.content=Xe.content?`${Xe.content}
|
|
517
|
+
${ge}`:ge:Ze.push({type:"assistant",content:ge,timestamp:new Date,isStreaming:!0}),Ze})},100)))}break;case"claude-interactive-prompt":P(Y=>[...Y,{type:"assistant",content:E.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-error":P(Y=>[...Y,{type:"error",content:`Error: ${E.error}`,timestamp:new Date}]);break;case"cursor-system":try{const Y=E.data;if(Y&&Y.type==="system"&&Y.subtype==="init"&&Y.session_id){if(w&&Y.session_id!==w){console.log("🔄 Cursor session switch detected:",{originalSession:w,newSession:Y.session_id}),Ce(!0),p&&p(Y.session_id);return}if(!w){console.log("🔄 Cursor new session init detected:",{newSession:Y.session_id}),Ce(!0),p&&p(Y.session_id);return}}}catch(Y){console.warn("Error handling cursor-system message:",Y)}break;case"cursor-user":break;case"cursor-tool-use":P(Y=>[...Y,{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":P(Y=>[...Y,{type:"error",content:`Cursor error: ${E.error||"Unknown error"}`,timestamp:new Date}]);break;case"cursor-result":const Q=E.sessionId||w;if(Q===w&&(R(!1),vt(!1),$r(null)),Q&&(c&&c(Q),m&&m(Q)),Q===w)try{const Y=E.data||{},ge=typeof Y.result=="string"?Y.result:"";F.current&&(clearTimeout(F.current),F.current=null);const _e=S.current;S.current="",P(Ze=>{const Xe=[...Ze],Be=Xe[Xe.length-1];if(Be&&Be.type==="assistant"&&!Be.isToolUse&&Be.isStreaming){const Ge=ge&&ge.trim()?ge:(Be.content||"")+(_e||"");Be.content=Ge,Be.isStreaming=!1}else ge&&ge.trim()&&Xe.push({type:Y.is_error?"error":"assistant",content:ge,timestamp:new Date,isStreaming:!1});return Xe})}catch(Y){console.warn("Error handling cursor-result message:",Y)}const ve=sessionStorage.getItem("pendingSessionId");Q&&!w&&Q===ve&&(W(Q),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects(),500));break;case"cursor-output":try{const ge=String(E.data??"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").trim();ge&&(S.current+=S.current?`
|
|
518
|
+
${ge}`:ge,F.current||(F.current=setTimeout(()=>{const _e=S.current;S.current="",F.current=null,_e&&P(Ze=>{const Xe=[...Ze],Be=Xe[Xe.length-1];return Be&&Be.type==="assistant"&&!Be.isToolUse&&Be.isStreaming?Be.content=Be.content?`${Be.content}
|
|
519
|
+
${_e}`:_e:Xe.push({type:"assistant",content:_e,timestamp:new Date,isStreaming:!0}),Xe})},100)))}catch(Y){console.warn("Error handling cursor-output message:",Y)}break;case"claude-complete":const Se=E.sessionId||w||sessionStorage.getItem("pendingSessionId");(Se===w||!w)&&(R(!1),vt(!1),$r(null),e&&r?.id&&(async()=>{try{const ge=`/api/projects/${e.name}/sessions/${r.id}/token-usage`,_e=await De(ge);if(_e.ok){const Ze=await _e.json();dn(Ze)}}catch(ge){console.error("Failed to fetch updated token usage:",ge)}})()),Se&&(c&&c(Se),m&&m(Se));const Ye=sessionStorage.getItem("pendingSessionId");Ye&&!w&&E.exitCode===0&&(W(Ye),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",Ye)),e&&E.exitCode===0&&At.removeItem(`chat_messages_${e.name}`);break;case"session-aborted":{const Y=E.sessionId||w;Y===w&&(R(!1),vt(!1),$r(null)),Y&&(c&&c(Y),m&&m(Y)),P(ge=>[...ge,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const Y=E.sessionId;(Y===w||r&&Y===r.id)&&E.isProcessing&&(R(!0),vt(!0),d&&d(Y));break}case"claude-status":const Ae=E.data;if(Ae){let Y={text:"Working...",tokens:0,can_interrupt:!0};Ae.message?Y.text=Ae.message:Ae.status?Y.text=Ae.status:typeof Ae=="string"&&(Y.text=Ae),Ae.tokens?Y.tokens=Ae.tokens:Ae.token_count&&(Y.tokens=Ae.token_count),Ae.can_interrupt!==void 0&&(Y.can_interrupt=Ae.can_interrupt),$r(Y),R(!0),vt(Y.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(),V=Mi(J);pt(V)}}catch(E){console.error("Error fetching files:",E)}},Mi=(E,J="")=>{let V=[];for(const q of E){const Q=J?`${J}/${q.name}`:q.name;q.type==="directory"&&q.children?V=V.concat(Mi(q.children,Q)):q.type==="file"&&V.push({name:q.name,path:Q,relativePath:q.path})}return V};f.useEffect(()=>{const E=L.slice(0,Ot),J=E.lastIndexOf("@");if(J!==-1){const V=E.slice(J+1);if(V.includes(" "))Le(!1),kt(-1);else{kt(J),Le(!0);const q=Je.filter(Q=>Q.name.toLowerCase().includes(V.toLowerCase())||Q.path.toLowerCase().includes(V.toLowerCase())).slice(0,10);st(q),dt(-1)}}else Le(!1),kt(-1)},[L,Ot,Je]),f.useEffect(()=>{const E=setTimeout(()=>{le(L)},150);return()=>clearTimeout(E)},[L]);const Ti=f.useMemo(()=>j.length<=un?j:j.slice(-un),[j,un]);f.useEffect(()=>{if(!N&&Z.current){const E=Z.current;re.current={height:E.scrollHeight,top:E.scrollTop}}}),f.useEffect(()=>{if(Z.current&&j.length>0)if(N)It||setTimeout(()=>nr(),50);else{const E=Z.current,J=re.current.height,V=re.current.top,Q=E.scrollHeight-J;Q>0&&V>0&&(E.scrollTop=V+Q)}},[j.length,It,nr,N]),f.useEffect(()=>{Z.current&&j.length>0&&!ue.current&&(A(!1),setTimeout(()=>nr(),200))},[r?.id,e?.name]),f.useEffect(()=>{const E=Z.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;yt(J)}},[]),f.useEffect(()=>{Ie.current&&!L.trim()&&(Ie.current.style.height="auto",yt(!1))},[L]),f.useEffect(()=>{if(!e||!r?.id||r.id.startsWith("new-session-")){dn(null);return}(async()=>{try{const J=`/api/projects/${e.name}/sessions/${r.id}/token-usage`,V=await De(J);if(V.ok){const q=await V.json();dn(q)}else dn(null)}catch(J){console.error("Failed to fetch initial token usage:",J)}})()},[r?.id,e?.path]);const xu=f.useCallback(E=>{E.trim()&&H(J=>{const V=J.trim()?`${J} ${E}`:E;return setTimeout(()=>{if(Ie.current){Ie.current.style.height="auto",Ie.current.style.height=Ie.current.scrollHeight+"px";const q=parseInt(window.getComputedStyle(Ie.current).lineHeight),Q=Ie.current.scrollHeight>q*2;yt(Q)}},0),V})},[]),bu=f.useCallback(()=>{ou(E=>E+100)},[]),Un=f.useCallback(E=>{const J=E.filter(V=>{try{if(!V||typeof V!="object")return console.warn("Invalid file object:",V),!1;if(!V.type||!V.type.startsWith("image/"))return!1;if(!V.size||V.size>5242880){const q=V.name||"Unknown file";return Ue(Q=>{const ve=new Map(Q);return ve.set(q,"File too large (max 5MB)"),ve}),!1}return!0}catch(q){return console.error("Error validating file:",q,V),!1}});J.length>0&&rt(V=>[...V,...J].slice(0,5))},[]),yu=f.useCallback(async E=>{const J=Array.from(E.clipboardData.items);for(const V of J)if(V.type.startsWith("image/")){const q=V.getAsFile();q&&Un([q])}if(J.length===0&&E.clipboardData.files.length>0){const q=Array.from(E.clipboardData.files).filter(Q=>Q.type.startsWith("image/"));q.length>0&&Un(q)}},[Un]),{getRootProps:ku,getInputProps:vu,isDragActive:wu,open:ju}=Ed({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:Un,noClick:!0,noKeyboard:!0}),Nr=f.useCallback(async E=>{if(E.preventDefault(),!L.trim()||M||!e)return;let J=[];if(Ke.length>0){const Ye=new FormData;Ke.forEach(Ae=>{Ye.append("images",Ae)});try{const Ae=At.getItem("auth-token"),Y={};Ae&&(Y.Authorization=`Bearer ${Ae}`);const ge=await fetch(`/api/projects/${e.name}/upload-images`,{method:"POST",headers:Y,body:Ye});if(!ge.ok)throw new Error("Failed to upload images");J=(await ge.json()).images}catch(Ae){console.error("Image upload failed:",Ae),P(Y=>[...Y,{type:"error",content:`Failed to upload images: ${Ae.message}`,timestamp:new Date}]);return}}const V={type:"user",content:L,images:J,timestamp:new Date};P(Ye=>[...Ye,V]),R(!0),vt(!0),$r({text:"Processing",tokens:0,can_interrupt:!0}),A(!1),setTimeout(()=>nr(),100);const q=w||r?.id||sessionStorage.getItem("cursorSessionId"),Q=q||`new-session-${Date.now()}`;l&&l(Q);const Se=(()=>{try{const Ye=ht==="cursor"?"cursor-tools-settings":"claude-settings",Ae=At.getItem(Ye);if(Ae)return JSON.parse(Ae)}catch(Ye){console.error("Error loading tools settings:",Ye)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();s(ht==="cursor"?{type:"cursor-command",command:L,sessionId:q,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:q,resume:!!q,model:Or,skipPermissions:Se?.skipPermissions||!1,toolsSettings:Se}}:{type:"claude-command",command:L,options:{projectPath:e.path,cwd:e.fullPath,sessionId:w,resume:!!w,toolsSettings:Se,permissionMode:ke,images:J}}),H(""),rt([]),Re(new Map),Ue(new Map),yt(!1),Ie.current&&(Ie.current.style.height="auto"),e&&At.removeItem(`draft_input_${e.name}`)},[L,M,e,Ke,w,r,ht,ke,l,Or,s,H,rt,Re,Ue,yt,Ie,P,R,vt,$r,A,nr]);f.useEffect(()=>{Ds.current=Nr},[Nr]);const Di=E=>{if(!E)return;const J=L.slice(0,Si),V=L.slice(Si),q=V.indexOf(" "),Q=q!==-1?V.slice(q):"",ve=J+E.name+" "+Q;H(ve),z(!1),mr(-1),He(""),rr(-1),K.current&&clearTimeout(K.current),Ii(E)},Nu=E=>{if(we&&C.length>0){if(E.key==="ArrowDown"){E.preventDefault(),rr(J=>J<C.length-1?J+1:0);return}if(E.key==="ArrowUp"){E.preventDefault(),rr(J=>J>0?J-1:C.length-1);return}if(E.key==="Tab"||E.key==="Enter"){E.preventDefault(),As>=0?Di(C[As]):C.length>0&&Di(C[0]);return}if(E.key==="Escape"){E.preventDefault(),z(!1),mr(-1),He(""),rr(-1),K.current&&clearTimeout(K.current);return}}if(ze&&tt.length>0){if(E.key==="ArrowDown"){E.preventDefault(),dt(J=>J<tt.length-1?J+1:0);return}if(E.key==="ArrowUp"){E.preventDefault(),dt(J=>J>0?J-1:tt.length-1);return}if(E.key==="Tab"||E.key==="Enter"){E.preventDefault(),ct>=0?Ls(tt[ct]):tt.length>0&&Ls(tt[0]);return}if(E.key==="Escape"){E.preventDefault(),Le(!1);return}}if(E.key==="Tab"&&!ze&&!we){E.preventDefault();const J=["default","acceptEdits","bypassPermissions","plan"],q=(J.indexOf(ke)+1)%J.length,Q=J[q];Ve(Q),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,Q);return}if(E.key==="Enter"){if(E.nativeEvent.isComposing)return;(E.ctrlKey||E.metaKey)&&!E.shiftKey?(E.preventDefault(),Nr(E)):!E.shiftKey&&!E.ctrlKey&&!E.metaKey&&(y||(E.preventDefault(),Nr(E)))}},Ls=E=>{const J=L.slice(0,Lt),V=L.slice(Lt),q=V.indexOf(" "),Q=q!==-1?V.slice(q):"",ve=J+"@"+E.path+" "+Q,Se=J.length+1+E.path.length+1;Ie.current&&!Ie.current.matches(":focus")&&Ie.current.focus(),H(ve),Bt(Se),Le(!1),kt(-1),Ie.current&&requestAnimationFrame(()=>{Ie.current&&(Ie.current.setSelectionRange(Se,Se),Ie.current.matches(":focus")||Ie.current.focus())})},Cu=E=>{const J=E.target.value,V=E.target.selectionStart;if(!w&&J.trim(),H(J),Bt(V),!J.trim()){E.target.style.height="auto",yt(!1),z(!1),mr(-1),He("");return}const q=J.slice(0,V);if((q.match(/```/g)||[]).length%2===1){z(!1),mr(-1),He("");return}const Se=/(^|\s)\/(\S*)$/,Ye=q.match(Se);if(Ye){const Ae=Ye.index+Ye[1].length,Y=Ye[2];mr(Ae),z(!0),rr(-1),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{He(Y)},150)}else z(!1),mr(-1),He(""),K.current&&clearTimeout(K.current)},Su=E=>{Bt(E.target.selectionStart)},Eu=()=>{w&&jr&&s({type:"abort-session",sessionId:w,provider:ht})},Iu=()=>{const E=["default","acceptEdits","bypassPermissions","plan"],V=(E.indexOf(ke)+1)%E.length,q=E[V];Ve(q),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,q)};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:Z,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:[I&&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 ${ht==="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(Zt,{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"})]})]}),ht==="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 ${ht==="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(ir,{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"})]})]}),ht==="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 ${ht==="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:ht==="cursor"?"Select Model":" "}),t.jsxs("select",{value:Or,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:ht!=="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:ht==="claude"?"Ready to use Claude AI. Start typing your message below.":ht==="cursor"?`Ready to use Cursor with ${Or}. Start typing your message below.`:"Select a provider above to begin"}),ht&&B&&t.jsx("div",{className:"mt-4 px-4 sm:px-0",children:t.jsx(nl,{onStartTask:()=>H("Start the next task"),onShowAllTasks:D})})]}),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"}),B&&t.jsx("div",{className:"mt-4 px-4 sm:px-0",children:t.jsx(nl,{onStartTask:()=>H("Start the next task"),onShowAllTasks:D})})]})]}):t.jsxs(t.Fragment,{children:[We&&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..."})]})}),Ne&&!We&&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:Oe>0&&t.jsxs("span",{children:["Showing ",G.length," of ",Oe," messages •",t.jsx("span",{className:"text-xs",children:"Scroll up to load more"})]})}),!Ne&&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 V=J>0?Ti[J-1]:null;return t.jsx(iw,{message:E,index:J,prevMessage:V,createDiff:pu,onFileOpen:i,onShowSettings:g,autoExpandTools:x,showRawParameters:b,showThinking:k,selectedProject:e},J)})]}),M&&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(ir,{className:"w-full h-full"}):t.jsx(Zt,{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:mt})]}),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:M,onAbort:Eu,provider:ht,showThinking:k})}),t.jsx("div",{ref:$t,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 ${ke==="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":ke==="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":ke==="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 ${ke==="default"?"bg-gray-500":ke==="acceptEdits"?"bg-green-500":ke==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),t.jsxs("span",{children:[ke==="default"&&"Default Mode",ke==="acceptEdits"&&"Accept Edits",ke==="bypassPermissions"&&"Bypass Permissions",ke==="plan"&&"Plan Mode"]})]})}),t.jsx(gv,{used:nt?.used||0,total:nt?.total||parseInt(void 0)||16e4}),L.trim()&&t.jsx("button",{type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),H(""),Ie.current&&(Ie.current.style.height="auto",Ie.current.focus()),yt(!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"})})}),It&&j.length>0&&t.jsx("button",{onClick:nr,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:Nr,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"})]})}),Ke.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:Ke.map((E,J)=>t.jsx(ow,{file:E,onRemove:()=>{rt(V=>V.filter((q,Q)=>Q!==J))},uploadProgress:xe.get(E.name),error:pe.get(E.name)},J))})}),ze&&tt.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:tt.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===ct?"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:V=>{V.preventDefault(),V.stopPropagation()},onClick:V=>{V.preventDefault(),V.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:C,selectedIndex:As,onSelect:du,onClose:()=>{z(!1),mr(-1),He(""),rr(-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:we,frequentCommands:fe?[]: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 ${at?"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",Bt(E.target.selectionStart);const J=parseInt(window.getComputedStyle(E.target).lineHeight),V=E.target.scrollHeight>J*2;yt(V)},placeholder:`Type / for commands, @ for files, or ask ${ht==="cursor"?"Cursor":"Claude"} anything...`,disabled:M,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=!we;z(E),He(""),rr(-1),E&&X(T),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"})}),T.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:T.length})]}),t.jsx("button",{type:"submit",disabled:!L.trim()||M,onMouseDown:E=>{E.preventDefault(),Nr(E)},onTouchStart:E=>{E.preventDefault(),Nr(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 ${O?"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=or.memo(lw);class xt{constructor(r,n,s,a){this.fromA=r,this.toA=n,this.fromB=s,this.toB=a}offset(r,n=r){return new xt(this.fromA+r,this.toA+r,this.fromB+n,this.toB+n)}}function _r(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 xt(r,n,a,i)];if(c>d){let u=e.slice(r,n).indexOf(s.slice(a,i));if(u>-1)return[new xt(r,r+u,a,a),new xt(r+u+d,n,i,i)]}else if(d>c){let u=s.slice(a,i).indexOf(e.slice(r,n));if(u>-1)return[new xt(r,r,a,a+u),new xt(n,n,a+u+c,i)]}if(c==1||d==1)return[new xt(r,n,a,i)];let m=Bd(e,r,n,s,a,i);if(m){let[u,h,p]=m;return _r(e,r,u,s,a,h).concat(_r(e,u+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 xt(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),m=(p,g)=>e.charCodeAt(n-p-1)==s.charCodeAt(i-g-1),u=(o-l)%2!=0?ua:null,h=u?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,u,!1,d)||ua.advance(p,o,l,c,h,!0,m);if(g)return uw(e,r,n,r+g[0],s,a,i,a+g[1])}return[new xt(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,m=c==-r||c!=r&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,u=m-c;for(;m<n&&u<s&&l(m,u);)m++,u++;if(this.vec[d]=m,m>n)this.end+=2;else if(u>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-m)return[p,a+p-h]}else{let p=n-i.vec[h];if(m>=p)return[m,u]}}}return null}}const da=new $d,ua=new $d;function uw(e,r,n,s,a,i,o,l){let c=!1;return!en(e,s)&&++s==n&&(c=!0),!en(a,l)&&++l==o&&(c=!0),c?[new xt(r,n,i,o)]:_r(e,r,s,a,i,l).concat(_r(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,m=c+o;if(d>n||m>i||e.slice(l,d)!=s.slice(c,m)){if(o==1)return l-r-(en(e,l)?0:1);o=o>>1}else{if(d==n||m==i)return d-r;l=d,c=m}}}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,m=c-o;if(d<r||m<a||e.slice(d,l)!=s.slice(m,c)){if(o==1)return n-l-(en(e,l)?0:1);o=o>>1}else{if(d==r||m==a)return n-d;l=d,c=m}}}function Ua(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 m=r+o;;){en(e,m)||m++;let u=m+o;if(en(e,u)||(u+=u==m+1?1:-1),u>=n)break;let h=e.slice(m,u),p=-1;for(;(p=c.indexOf(h,p+1))!=-1;){let g=vi(e,u,n,s,a+p+h.length,i),x=wi(e,r,m,s,a,a+p),b=h.length+g+x;(!d||d[2]<b)&&(d=[m-x,a+p-x,b])}m=u}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:Ua(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=Ua(s,a,i,e,r,n,Math.floor(o/6),50);c=h&&[h[1],h[0],h[2]]}else c=Ua(e,r,n,s,a,i,Math.floor(l/6),50);if(!c)return[new xt(r,n,a,i)];let[d,m,u]=c;return _r(e,r,d,s,a,m).concat(_r(e,d+u,n,s,m+u,i))}function Wd(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 xt(s.fromA,a.toA,s.fromB,a.toB),e.splice(n--,1))}}function mw(e,r,n){for(;;){Wd(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 xt(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 xt(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 m=i.fromA-(a?n[a-1].toA:0),u=(a<n.length-1?n[a+1].fromA:e.length)-i.toA;if(!m||!u)continue;let h=c?e.slice(i.fromA,i.toA):r.slice(i.fromB,i.toB);m<=h.length&&e.slice(i.fromA-m,i.fromA)==h.slice(h.length-m)?(n[a]=new xt(i.fromA-m,i.toA-m,i.fromB-m,i.toB-m),s=!0):u<=h.length&&e.slice(i.toA,i.toA+u)==h.slice(0,u)&&(n[a]=new xt(i.fromA+u,i.toA+u,i.fromB+u,i.toB+u),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,m=c-i.toA,u=ul(r,i.fromA,d),h=dl(r,i.toA,m),p=i.fromA-u,g=h-i.toA;if((!o||!l)&&p&&g){let x=Math.max(o,l),[b,k,N]=o?[r,i.fromA,i.toA]:[n,i.fromB,i.toB];x>p&&r.slice(u,i.fromA)==b.slice(N-p,N)?(i=e[a]=new xt(u,u+o,i.fromB-p,i.toB-p),u=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 xt(h-o,h,i.fromB+g,i.toB+g),h=i.toA,u=ul(r,i.fromA,i.fromA-s)),p=i.fromA-u,g=h-i.toA}if(p||g)i=e[a]=new xt(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)<=m&&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)<=m&&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 Wd(e,3),e}let Lr;try{Lr=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Ud(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?Ud(n)?1:0:Lr?!Gd(n)||r==e.length-1?Lr.test(String.fromCharCode(n))?1:0:Lr.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?Ud(n)?1:0:Lr?!Kd(n)||r==1?Lr.test(String.fromCharCode(n))?1:0:Lr.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 en(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,_r(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 cr=ks.define({combine:e=>e[0]}),fw=qa.define(),Qd=ks.define(),Vt=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(Vt,!1);if(!r)return null;let n=e.facet(cr);return{chunks:r,side:n?n.side:null}}class Gr{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 Gr(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,m]=hl(c.fromA+s,c.fromB+a,r,n),[u,h]=fl(c.toA+s,c.toB+a,r,n),p=[c.offset(-d+s,-m+a)];for(;l<e.length-1;){let g=e[l+1],[x,b]=hl(g.fromA+s,g.fromB+a,r,n);if(x>u+1&&b>h+1)break;p.push(g.offset(-d+s,-m+a)),[u,h]=fl(g.toA+s,g.toB+a,r,n),l++}o.push(new Gr(p,d,Math.max(d,u),m,Math.max(m,h),i))}return o}const ss=1e3;function gl(e,r,n,s){let a=0,i=e.length;for(;;){if(a==i){let m=0,u=0;a&&({toA:m,toB:u}=e[a-1]);let h=r-(n?m:u);return[m+h,u+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,m=n?r.length:s,u=0,h=n?s:r.length;i>ss&&([d,u]=gl(e,i-ss,n,!0)),o<r.length-ss&&([m,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:m,toB:h,diffA:g.diffA+x,diffB:g.diffB+b}:a.push({fromA:d,toA:m,fromB:u,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 m=o==e.length?null:e[o],u=m?m.fromA+l:n.length,h=m?m.fromB+c:s.length;for(;d<r.length;){let b=r[d];if(b.toA+l>u||b.toB+c>h)break;i.push(b.offset(l,c)),d++}if(!m)break;let p=m.toA+l+m.diffA,g=m.toB+c+m.diffB,x=Yd(n.sliceString(u,p),s.sliceString(h,g),a);for(let b of Xd(x,n,s,u,h,Jd()))i.push(b);for(l+=m.diffA,c+=m.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(Vt,!1)!=r.field(Vt,!1)}function bw(e,r){return e.facet(cr)!=r.facet(cr)}const yl=dr.line({class:"cm-changedLine"}),eu=dr.mark({class:"cm-changedText"}),yw=dr.mark({tagName:"ins",class:"cm-insertedLine"}),kw=dr.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),m=o;!d.next().done;){if(d.lineBreak){m++,a.add(m,m,yl),i&&i.add(m,m,kl);continue}let u=m+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(m,p),b=Math.min(u,g);if(x<b&&a.add(x,b,eu),g<u)c++;else break}m=u}}}function vl(e){let r=e.state.field(Vt),{side:n,highlightChanges:s,markGutter:a,overrideChunk:i}=e.state.facet(cr),o=n=="a",l=new os,c=a?new os:null,{from:d,to:m}=e.viewport;for(let u of r){if((o?u.fromA:u.fromB)>=m)break;(o?u.toA:u.toB)>d&&(!i||!i(e.state,u,l,c))&&vw(u,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(cr);o&&o().dispatch({effects:Ha.of(jw(a,r.state.field(Vt),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 dr.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=>qt.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(cr).side=="a",i=e.field(Vt),o=1;for(let l=0;;l++){let c=l<i.length?i[l]:null,d=l?o+r:1,m=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-r:e.doc.lines,u=m-d+1;if(u>=n&&s.add(e.doc.line(d).from,e.doc.line(m).to,dr.replace({widget:new ww(u),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return s.finish()}const Ew=qt.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,qt.editorAttributes.of({class:"cm-merge-b"}),Qd.of((a,i)=>{let o=i.effects.find(l=>l.is(ji));return o&&(a=Gr.updateA(a,o.value.doc,i.startState.doc,o.value.changes,s)),i.docChanged&&(a=Gr.updateB(a,i.state.field(tn),i.newDoc,i.changes,s)),a}),cr.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"}),tn.init(()=>n),e.gutter!==!1?Aw:[],e.collapseUnchanged?Cw(e.collapseUnchanged):[],Vt.init(a=>Gr.build(n,a.doc,s))]}const ji=qa.define(),tn=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:m}=e.facet(cr),u=document.createElement("div");if(u.className="cm-deletedChunk",m){let _=u.appendChild(document.createElement("div"));_.className="cm-chunkButtons";let U=B=>{B.preventDefault(),Dw(o,o.posAtDOM(u))},D=B=>{B.preventDefault(),Pw(o,o.posAtDOM(u))};if(typeof m=="function")_.appendChild(m("accept",U)),_.appendChild(m("reject",D));else{let B=_.appendChild(document.createElement("button"));B.name="accept",B.textContent=e.phrase("Accept"),B.onmousedown=U;let L=_.appendChild(document.createElement("button"));L.name="reject",L.textContent=e.phrase("Reject"),L.onmousedown=D}}if(n||r.fromA>=r.toA)return u;let h=o.state.field(tn).sliceString(r.fromA,r.endA),p=c&&e.facet(Pl),g=N(),x=r.changes,b=0,k=!1;function N(){let _=u.appendChild(document.createElement("div"));return _.className="cm-deletedLine",_.appendChild(document.createElement("del"))}function y(_,U,D){for(let B=_;B<U;){if(h.charAt(B)==`
|
|
524
|
+
`){g.firstChild||g.appendChild(document.createElement("br")),g=N(),B++;continue}let L=U,H=D+(k?" cm-deletedText":""),j=!1,P=h.indexOf(`
|
|
525
|
+
`,B);if(P>-1&&P<U&&(L=P),l&&b<x.length){let M=Math.max(0,k?x[b].toA:x[b].fromA);M<=L&&(L=M,k&&b++,j=!0)}if(L>B){let M=document.createTextNode(h.slice(B,L));if(H){let R=g.appendChild(document.createElement("span"));R.className=H,R.appendChild(M)}else g.appendChild(M);B=L}j&&(k=!k)}}if(p&&r.toA-r.fromA<=d){let _=p.parser.parse(h),U=0;pa(_,{style:D=>Ll(e,D)},(D,B,L)=>{D>U&&y(U,D,""),y(D,B,L),U=B}),y(U,h.length,"")}else y(0,h.length,"");return g.firstChild||g.appendChild(document.createElement("br")),u},i=dr.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(Vt).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(tn);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(Vt).find(l=>l.fromB<=s&&l.endB>=s);if(!a)return!1;let o=n.field(tn).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(Vt)){let s=e.facet(cr).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(Vt,!1)!=r.startState.field(Vt,!1)?jl(r.state):e},provide:e=>qt.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(tn),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,m=r.fromB;for(let u of r.changes){if(u.fromA<u.toA){c+=u.toA-u.fromA;let h=s.sliceString(d+u.fromA,d+u.toA);if(/\n/.test(h))break e;l.push(dr.widget({widget:new Rw(h),side:-1}).range(m+u.fromB))}u.fromB<u.toB&&l.push(eu.range(m+u.fromB,m+u.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=dr.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 Et=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:[]})}}),_t={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},Ow=qt.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"}}}}),br=_t.PixelMultiplier*_t.SizeRatio,Bw=vs.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(Et).enabled&&this.create(e)}create(e){this.container=Kr("div",{class:"cm-minimap-overlay-container"}),this.dom=Kr("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(Et).enabled,n=e.state.facet(Et).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/br;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/br,i=e/br,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(Et);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)*br,c=i/(a-s),m=(s*br-s)*c,u=Math.max(0,i-m);this.view.scrollDOM.scrollTop=u+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,m=this.view.scrollDOM.scrollHeight,u=c===0,h=Math.round(c)>=Math.round(m-d);if(u&&n||u&&e.clientY<i||h&&s||h&&e.clientY>o)return;const p=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,x=(p-g)/br,b=g-g/br,k=l+r,N=k/b,y=(p-g)*N,_=k*br;this.view.scrollDOM.scrollTop=Math.max(y,_);const U=Math.min(Math.max(0,k),Math.min(b,x));this.dom.style.top=U+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),Ww=[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(Et).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:m}=a,u=l>=d&&l<m,h=c>d&&c<=m;if(u){let p=(r=n.pop())!==null&&r!==void 0?r:[],g=p.pop();g&&g.folded&&(g.to=m),g&&p.push(g),(!g||!g.folded)&&p.push({from:d,to:m,folded:!0}),h||p.push({from:m,to:c,folded:!1}),n.push(p)}else h?n.push([{from:l,to:d,folded:!1},{from:d,to:m,folded:!0}]):n.push([{from:l,to:c,folded:!1}]);i=c+1,s.next()}return n}const rn=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 Uw extends Ni{constructor(r){super(r),this.count=void 0}shouldUpdate(r){if(!r.state.facet(Et).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(rn);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 m=this.get(d);m&&(c=[c,m].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 Uw(e)}class qw extends Ni{constructor(r){super(r),this.getDrawInfo(),this._themeClasses=r.dom.classList.value}shouldUpdate(r){return r.state.facet(Et).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(rn).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 m=n[s],u={from:l+Math.max(d.from,m.from)-d.from,to:l+Math.min(d.to,m.to)-d.from,extends:m.to>d.to},h=o.slice(-1)[0];if(h&&h.to===u.from){let{to:p}=u;d.folded&&u.extends?p=u.from+1:d.folded&&!u.extends&&(p=h.to),o[o.length-1]=Object.assign(Object.assign({},h),{to:p,extends:u.extends})}else d.folded||o.push(u);if(u.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 m=o+d.from*i,u=(d.to-d.from)*i,h=s.canvas.width-m;d.extends&&(s.globalAlpha=.65,s.beginPath(),s.rect(m,l,h,a),s.fillStyle=this.getDrawInfo().backgroundColor,s.fill()),s.globalAlpha=1,s.beginPath(),s.rect(m,l,u,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(Et).enabled&&this.updateImpl(r.state)}shouldUpdate(r){return!!(r.docChanged||r.state.facet(Et)!==r.startState.facet(Et)||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(Et).displayText,this.themeChanged()&&this._fontInfoMap.clear();let a;if(this._previousTree&&n){const u=Ri.addTree(this._previousTree),h=[];n.iterChangedRanges((p,g,x,b)=>h.push({fromA:p,toA:g,fromB:x,toB:b})),a=Ri.applyChanges(u,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:u=>Ll(r,u)};let d=[];if(l){const u=r.doc.lineAt(this.view.viewport.from).number,h=r.doc.lineAt(this.view.viewport.to).number,p=h-u,g=u/(r.doc.lines-p),{SizeRatio:x,PixelMultiplier:b}=_t,k=p*x*b,N=g*k,y=Math.max(1,Math.floor(u-N)),_=Math.min(h+Math.floor(k-N),r.doc.lines);pa(l,c,(U,D,B)=>{d.push({from:U,to:D,tags:B})},r.doc.line(y).from,r.doc.line(_).to)}this.updateMapImpl(r,d),d=[];const m=()=>{l&&(pa(l,c,(u,h,p)=>{d.push({from:u,to:h,tags:p})}),this.updateMapImpl(r,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(m):setTimeout(m)}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(rn).entries()){const c=[];for(const m of l){if(m.from===m.to)continue;if(m.folded){c.push({text:"…",tags:""});continue}let u=m.from;for(;!i.done&&i.value.from<m.to;){const{from:h,to:p,tags:g}=i.value;if(p<u){i=a.next();continue}h>u&&c.push({text:s.slice(u,h),tags:""});const x=Math.max(h,m.from),b=Math.min(p,m.to);if(c.push({text:s.slice(x,b),tags:g}),u=b,p>b)break;i=a.next()}u!==m.to&&c.push({text:s.slice(u,m.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 m of s){const u=this.getFontInfo(m.tags);switch((!d||d.color!==u.color)&&(a.fillStyle=u.color),(!d||d.font!==u.font)&&(a.font=u.font),d=u,o=Math.max(o,u.lineHeight),this._displayText){case"characters":{a.fillText(m.text,l,c+o),l+=m.text.length*i;break}case"blocks":{const h=/\S+/g;let p;for(;(p=h.exec(m.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/_t.SizeRatio,k=o-b;a.fillStyle=u.color,a.globalAlpha=.65,a.beginPath(),a.rect(g,c,x,k),a.fill()}l+=m.text.length*i;break}}}}getFontInfo(r){const n=this._fontInfoMap.get(r);if(n)return n;const s=Kr("span",{class:r}),a=Kr("div",{class:"cm-line",style:"display: none"},s);this.view.contentDOM.appendChild(a);const i=window.getComputedStyle(s),o=parseFloat(i.lineHeight)/_t.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=qt.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=Kr("div",{class:"cm-minimap-inner"}),this.canvas=Kr("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(Et).eventHandlers){const s=this.view.state.facet(Et).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<=_t.MaxWidth*Sl){const r=e/(_t.MaxWidth*Sl);return _t.MaxWidth*r}return _t.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()*_t.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*_t.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(Et).gutters;for(let c=a;c<i;c++){const d=this.view.state.field(rn);if(c>=d.length)break;const m={offsetX:0,offsetY:o,context:r,lineHeight:s,charWidth:n};if(l.length){m.offsetX+=2;for(let u of l)Jw(u,m,c+1),m.offsetX+=nu;m.offsetX+=2}this.text.drawLine(m,c+1),this.selection.drawLine(m,c+1),this.diagnostic.drawLine(m,c+1),o+=s}r.restore()}canvasStartAndEndIndex(e,r){let{top:n,bottom:s}=this.view.documentPadding;n/=_t.SizeRatio,s/=_t.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(rn).length,m=n+s+d*r,u=Math.max(0,c*(m-a)),h=Math.max(0,n-u),p=Math.round(Math.max(0,u-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=>qt.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=>[[Et.compute([e],r=>r.facet(e)),Yw,rn,Qw,Ww]]});function su({file:e,onClose:r,projectPath:n}){const[s,a]=f.useState(""),[i,o]=f.useState(!0),[l,c]=f.useState(!1),[d,m]=f.useState(!1),[u,h]=f.useState(!0),[p,g]=f.useState(!1),[x,b]=f.useState(!!e.diffInfo),[k,N]=f.useState(!1),y=f.useRef(null),_=f.useMemo(()=>{if(!e.diffInfo||!x)return[];const P={};return[jn.compute(["doc"],M=>{const w=ma(M)?.chunks||[];return Object.keys(P).forEach(W=>delete P[W]),w.forEach(W=>{const O=M.doc.lineAt(W.fromB).number,$=M.doc.lineAt(Math.min(W.toB,M.doc.length)).number;for(let G=O;G<=$;G++)P[G]=u?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[P]}})]},[e.diffInfo,x,u]),U=f.useMemo(()=>!e.diffInfo||!x?[]:[vs.fromClass(class{constructor(P){setTimeout(()=>{const R=ma(P.state)?.chunks||[];if(R.length>0){const w=R[0];P.dispatch({effects:qt.scrollIntoView(w.fromB,{y:"center"})})}},100)}update(){}destroy(){}})],[e.diffInfo,x]),D=f.useMemo(()=>{if(!e.diffInfo||!x)return[];const P=M=>{const R=document.createElement("div");R.className="cm-diff-navigation-panel";let w=0;const W=()=>{const $=ma(M.state)?.chunks||[],G=$.length;R.innerHTML=`
|
|
526
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
527
|
+
<span style="font-weight: 500;">${G>0?`${w+1}/${G}`:"0"} changes</span>
|
|
528
|
+
<button class="cm-diff-nav-btn cm-diff-nav-prev" title="Previous change" ${G===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" ${G===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=R.querySelector(".cm-diff-nav-prev"),I=R.querySelector(".cm-diff-nav-next");ce?.addEventListener("click",()=>{if($.length===0)return;w=w>0?w-1:$.length-1;const je=$[w];je&&M.dispatch({effects:qt.scrollIntoView(je.fromB,{y:"center"})}),W()}),I?.addEventListener("click",()=>{if($.length===0)return;w=w<$.length-1?w+1:0;const je=$[w];je&&M.dispatch({effects:qt.scrollIntoView(je.fromB,{y:"center"})}),W()})};return W(),{top:!0,dom:R,update:W}};return[$u.of(P)]},[e.diffInfo,x]),B=P=>{const M=P.split(".").pop()?.toLowerCase();switch(M){case"js":case"jsx":case"ts":case"tsx":return[Hu({jsx:!0,typescript:M.includes("ts")})];case"py":return[Uu()];case"html":case"htm":return[Wu()];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 M=await Fe.readFile(e.projectName,e.path);if(!M.ok)throw new Error(`Failed to load file: ${M.status} ${M.statusText}`);const R=await M.json();a(R.content)}catch(M){console.error("Error loading file:",M),a(`// Error loading file: ${M.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 P=await Fe.saveFile(e.projectName,e.path,s);if(console.log("Save response:",{status:P.status,ok:P.ok,contentType:P.headers.get("content-type")}),!P.ok){const R=P.headers.get("content-type");if(R&&R.includes("application/json")){const w=await P.json();throw new Error(w.error||`Save failed: ${P.status}`)}else{const w=await P.text();throw console.error("Non-JSON error response:",w),new Error(`Save failed: ${P.status} ${P.statusText}`)}}const M=await P.json();console.log("Save successful:",M),g(!0),setTimeout(()=>g(!1),2e3)}catch(P){console.error("Error saving file:",P),alert(`Error saving file: ${P.message}`)}finally{c(!1)}},H=()=>{const P=new Blob([s],{type:"text/plain"}),M=URL.createObjectURL(P),R=document.createElement("a");R.href=M,R.download=e.name,document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(M)},j=()=>{m(!d)};return f.useEffect(()=>{const P=M=>{(M.ctrlKey||M.metaKey)&&(M.key==="s"?(M.preventDefault(),L()):M.key==="Escape"&&(M.preventDefault(),r()))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[s]),i?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
|
|
542
|
+
.code-editor-loading {
|
|
543
|
+
background-color: ${u?"#111827":"#ffffff"} !important;
|
|
544
|
+
}
|
|
545
|
+
.code-editor-loading:hover {
|
|
546
|
+
background-color: ${u?"#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: ${u?"rgba(239, 68, 68, 0.15)":"rgba(255, 235, 235, 1)"} !important;
|
|
552
|
+
border-left: 3px solid ${u?"rgba(239, 68, 68, 0.6)":"rgb(239, 68, 68)"} !important;
|
|
553
|
+
padding-left: 4px !important;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.cm-insertedChunk {
|
|
557
|
+
background-color: ${u?"rgba(34, 197, 94, 0.15)":"rgba(230, 255, 237, 1)"} !important;
|
|
558
|
+
border-left: 3px solid ${u?"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: ${u?"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: ${u?"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: ${u?"#1e1e1e":"#f5f5f5"};
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* Diff navigation panel styling */
|
|
585
|
+
.cm-diff-navigation-panel {
|
|
586
|
+
padding: 8px 12px;
|
|
587
|
+
background-color: ${u?"#1f2937":"#ffffff"};
|
|
588
|
+
border-bottom: 1px solid ${u?"#374151":"#e5e7eb"};
|
|
589
|
+
color: ${u?"#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: ${u?"#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(an,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:()=>N(!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(!u),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:u?"☀️":"🌙"})}),t.jsx("button",{onClick:H,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:[...B(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}),..._,...U,...D]:[],...k?[qt.lineWrapping]:[]],theme:u?_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,m]=f.useState(null),[u,h]=f.useState("detailed"),[p,g]=f.useState(""),[x,b]=f.useState([]);f.useEffect(()=>{e&&N()},[e]),f.useEffect(()=>{const M=localStorage.getItem("file-tree-view-mode");M&&["simple","detailed","compact"].includes(M)&&h(M)},[]),f.useEffect(()=>{if(!p.trim())b(r);else{const M=k(r,p.toLowerCase());b(M);const R=w=>{w.forEach(W=>{W.type==="directory"&&W.children&&W.children.length>0&&(o(O=>new Set(O.add(W.path))),R(W.children))})};R(M)}},[r,p]);const k=(M,R)=>M.reduce((w,W)=>{const O=W.name.toLowerCase().includes(R);let $=[];return W.type==="directory"&&W.children&&($=k(W.children,R)),(O||$.length>0)&&w.push({...W,children:$}),w},[]),N=async()=>{a(!0);try{const M=await Fe.getFiles(e.name);if(!M.ok){const w=await M.text();console.error("❌ File fetch failed:",M.status,w),n([]);return}const R=await M.json();n(R)}catch(M){console.error("❌ Error fetching files:",M),n([])}finally{a(!1)}},y=M=>{const R=new Set(i);R.has(M)?R.delete(M):R.add(M),o(R)},_=M=>{h(M),localStorage.setItem("file-tree-view-mode",M)},U=M=>{if(!M||M===0)return"0 B";const R=1024,w=["B","KB","MB","GB"],W=Math.floor(Math.log(M)/Math.log(R));return parseFloat((M/Math.pow(R,W)).toFixed(1))+" "+w[W]},D=M=>{if(!M)return"-";const R=new Date,w=new Date(M),W=Math.floor((R-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()},B=(M,R=0)=>M.map(w=>t.jsxs("div",{className:"select-none",children:[t.jsx(Me,{variant:"ghost",className:Ee("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent"),style:{paddingLeft:`${R*16+12}px`},onClick:()=>{w.type==="directory"?y(w.path):L(w.name)?m({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(Dr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(Xt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):H(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:B(w.children,R+1)})]},w.path)),L=M=>{const R=M.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(R)},H=M=>{const R=M.split(".").pop()?.toLowerCase(),w=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],W=["md","txt","doc","pdf"],O=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return w.includes(R)?t.jsx(vp,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):W.includes(R)?t.jsx(Tt,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):O.includes(R)?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=(M,R=0)=>M.map(w=>t.jsxs("div",{className:"select-none",children:[t.jsxs("div",{className:Ee("grid grid-cols-12 gap-2 p-2 hover:bg-accent cursor-pointer items-center"),style:{paddingLeft:`${R*16+12}px`},onClick:()=>{w.type==="directory"?y(w.path):L(w.name)?m({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(Dr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(Xt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):H(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"?U(w.size):"-"}),t.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:D(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,R+1)]},w.path)),P=(M,R=0)=>M.map(w=>t.jsxs("div",{className:"select-none",children:[t.jsxs("div",{className:Ee("flex items-center justify-between p-2 hover:bg-accent cursor-pointer"),style:{paddingLeft:`${R*16+12}px`},onClick:()=>{w.type==="directory"?y(w.path):L(w.name)?m({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(Dr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(Xt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):H(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:U(w.size)}),t.jsx("span",{className:"font-mono",children:w.permissionsRwx})]})})]}),w.type==="directory"&&i.has(w.path)&&w.children&&P(w.children,R+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:u==="simple"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>_("simple"),title:"Simple view",children:t.jsx(cs,{className:"w-4 h-4"})}),t.jsx(Me,{variant:u==="compact"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>_("compact"),title:"Compact view",children:t.jsx(an,{className:"w-4 h-4"})}),t.jsx(Me,{variant:u==="detailed"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>_("detailed"),title:"Detailed view",children:t.jsx(jh,{className:"w-4 h-4"})})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx(Jr,{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:M=>g(M.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"})})]})]}),u==="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(Xt,{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(Jr,{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:u==="detailed"?"":"space-y-1",children:[u==="simple"&&B(x),u==="compact"&&P(x),u==="detailed"&&j(x)]})}),l&&t.jsx(su,{file:l,onClose:()=>c(null),projectPath:l.projectPath}),d&&t.jsx(Xw,{file:d,onClose:()=>m(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:m=!0,compact:u=!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:[m&&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,m]=f.useState(""),[u,h]=f.useState(new Set),[p,g]=f.useState(new Set),[x,b]=f.useState(!1),[k,N]=f.useState(""),[y,_]=f.useState([]),[U,D]=f.useState(!0),[B,L]=f.useState(!1),[H,j]=f.useState(!1),[P,M]=f.useState(!1),[R,w]=f.useState(""),[W,O]=f.useState(!1),[$,G]=f.useState("changes"),[ce,I]=f.useState([]),[je,We]=f.useState(new Set),[v,te]=f.useState({}),[me,Ne]=f.useState(!1),[ne,Oe]=f.useState(null),[ee,oe]=f.useState(!1),[he,Ce]=f.useState(!1),[ke,Ve]=f.useState(!1),[Ke,rt]=f.useState(!1),[xe,Re]=f.useState(r),[pe,Ue]=f.useState(null),mt=f.useRef(null),Ie=f.useRef(null),[$t,Z]=f.useState(()=>localStorage.getItem("selected-provider")||"claude");f.useEffect(()=>{const z=()=>{const T=localStorage.getItem("selected-provider")||"claude";Z(T)};return window.addEventListener("storage",z),()=>window.removeEventListener("storage",z)},[]),f.useEffect(()=>{e&&(ue(),S(),F(),$==="history"&&Ot())},[e,$]),f.useEffect(()=>{const z=T=>{Ie.current&&!Ie.current.contains(T.target)&&j(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);const ue=async()=>{if(e){c(!0);try{const T=await(await De(`/api/git/status?project=${encodeURIComponent(e.name)}`)).json();if(T.error)console.error("Git status error:",T.error),a({error:T.error,details:T.details});else{a(T),N(T.branch||"main");const ie=new Set([...T.modified||[],...T.added||[],...T.deleted||[],...T.untracked||[]]);g(ie);for(const C of T.modified||[])ct(C);for(const C of T.added||[])ct(C);for(const C of T.deleted||[])ct(C);for(const C of T.untracked||[])ct(C)}}catch(z){console.error("Error fetching git status:",z)}finally{c(!1)}}},S=async()=>{try{const T=await(await De(`/api/git/branches?project=${encodeURIComponent(e.name)}`)).json();!T.error&&T.branches&&_(T.branches)}catch(z){console.error("Error fetching branches:",z)}},F=async()=>{if(e)try{const T=await(await De(`/api/git/remote-status?project=${encodeURIComponent(e.name)}`)).json();T.error?Oe(null):Oe(T)}catch(z){console.error("Error fetching remote status:",z),Oe(null)}},K=async z=>{try{const ie=await(await De("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:z})})).json();ie.success?(N(z),j(!1),ue()):console.error("Failed to switch branch:",ie.error)}catch(T){console.error("Error switching branch:",T)}},se=async()=>{if(R.trim()){O(!0);try{const T=await(await De("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:R.trim()})})).json();T.success?(N(R.trim()),M(!1),j(!1),w(""),S(),ue()):console.error("Failed to create branch:",T.error)}catch(z){console.error("Error creating branch:",z)}finally{O(!1)}}},le=async()=>{oe(!0);try{const T=await(await De("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();T.success?(ue(),F()):console.error("Fetch failed:",T.error)}catch(z){console.error("Error fetching from remote:",z)}finally{oe(!1)}},ze=async()=>{Ce(!0);try{const T=await(await De("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();T.success?(ue(),F()):console.error("Pull failed:",T.error)}catch(z){console.error("Error pulling from remote:",z)}finally{Ce(!1)}},Le=async()=>{Ve(!0);try{const T=await(await De("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();T.success?(ue(),F()):console.error("Push failed:",T.error)}catch(z){console.error("Error pushing to remote:",z)}finally{Ve(!1)}},Je=async()=>{rt(!0);try{const T=await(await De("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:k})})).json();T.success?(ue(),F()):console.error("Publish failed:",T.error)}catch(z){console.error("Error publishing branch:",z)}finally{rt(!1)}},pt=async z=>{try{const ie=await(await De("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:z})})).json();ie.success?(g(C=>{const X=new Set(C);return X.delete(z),X}),ue()):console.error("Discard failed:",ie.error)}catch(T){console.error("Error discarding changes:",T)}},tt=async z=>{try{const ie=await(await De("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:z})})).json();ie.success?(g(C=>{const X=new Set(C);return X.delete(z),X}),ue()):console.error("Delete failed:",ie.error)}catch(T){console.error("Error deleting untracked file:",T)}},st=async()=>{if(!pe)return;const{type:z,file:T,message:ie}=pe;Ue(null);try{switch(z){case"discard":await pt(T);break;case"delete":await tt(T);break;case"commit":await It();break;case"pull":await ze();break;case"push":await Le();break;case"publish":await Je();break}}catch(C){console.error(`Error executing ${z}:`,C)}},ct=async z=>{try{const ie=await(await De(`/api/git/diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(z)}`)).json();!ie.error&&ie.diff&&o(C=>({...C,[z]:ie.diff}))}catch(T){console.error("Error fetching file diff:",T)}},dt=async z=>{if(n)try{const ie=await(await De(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(z)}`)).json();if(ie.error){console.error("Error fetching file with diff:",ie.error),n(z);return}const C={old_string:ie.oldContent||"",new_string:ie.currentContent||""};n(z,C)}catch(T){console.error("Error opening file:",T),n(z)}},Ot=async()=>{try{const T=await(await De(`/api/git/commits?project=${encodeURIComponent(e.name)}&limit=10`)).json();!T.error&&T.commits&&I(T.commits)}catch(z){console.error("Error fetching commits:",z)}},Bt=async z=>{try{const ie=await(await De(`/api/git/commit-diff?project=${encodeURIComponent(e.name)}&commit=${z}`)).json();!ie.error&&ie.diff&&te(C=>({...C,[z]:ie.diff}))}catch(T){console.error("Error fetching commit diff:",T)}},Lt=async()=>{Ne(!0);try{const T=await(await De("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,files:Array.from(p),provider:$t})})).json();T.message?m(T.message):console.error("Failed to generate commit message:",T.error)}catch(z){console.error("Error generating commit message:",z)}finally{Ne(!1)}},kt=z=>{h(T=>{const ie=new Set(T);return ie.has(z)?ie.delete(z):ie.add(z),ie})},jr=z=>{We(T=>{const ie=new Set(T);return ie.has(z)?ie.delete(z):(ie.add(z),v[z]||Bt(z)),ie})},vt=z=>{g(T=>{const ie=new Set(T);return ie.has(z)?ie.delete(z):ie.add(z),ie})},It=async()=>{if(!(!d.trim()||p.size===0)){b(!0);try{const T=await(await De("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,message:d,files:Array.from(p)})})).json();T.success?(m(""),g(new Set),ue(),F()):console.error("Commit failed:",T.error)}catch(z){console.error("Error committing changes:",z)}finally{b(!1)}}},A=z=>{switch(z){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return z}},re=z=>{const T=je.has(z.hash),ie=v[z.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:()=>jr(z.hash),children:[t.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:T?t.jsx(Ht,{className:"w-3 h-3"}):t.jsx(kr,{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:z.message}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[z.author," • ",z.date]})]}),t.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:z.hash.substring(0,7)})]})})]}),T&&ie&&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:z.stats}),t.jsx(El,{diff:ie,fileName:"commit",isMobile:r,wrapText:U})]})})]},z.hash)},we=(z,T)=>{const ie=u.has(z),C=p.has(z),X=i[z];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:C,onChange:()=>vt(z),onClick:fe=>fe.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:fe=>{fe.stopPropagation(),kt(z)},children:t.jsx(kr,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${ie?"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:fe=>{fe.stopPropagation(),dt(z)},title:"Click to open file",children:z}),t.jsxs("div",{className:"flex items-center gap-1",children:[(T==="M"||T==="D")&&t.jsxs("button",{onClick:fe=>{fe.stopPropagation(),Ue({type:"discard",file:z,message:`Discard all changes to "${z}"? 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(Kt,{className:"w-3 h-3"}),r&&t.jsx("span",{children:"Discard"})]}),T==="U"&&t.jsxs("button",{onClick:fe=>{fe.stopPropagation(),Ue({type:"delete",file:z,message:`Delete untracked file "${z}"? 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(Kt,{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 ${T==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":T==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":T==="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:A(T),children:T})]})]})]}),t.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${ie&&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 ${T==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":T==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":T==="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:T}),t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:A(T)})]}),r&&t.jsx("button",{onClick:fe=>{fe.stopPropagation(),D(!U)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:U?"Switch to horizontal scroll":"Switch to text wrap",children:U?"↔️ Scroll":"↩️ Wrap"})]}),t.jsx("div",{className:"max-h-96 overflow-y-auto",children:X&&t.jsx(El,{diff:X,fileName:z,isMobile:r,wrapText:U})})]})]},z)};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(!H),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}),ne?.hasRemote&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[ne.ahead>0&&t.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${ne.ahead} commit${ne.ahead!==1?"s":""} ahead`,children:["↑",ne.ahead]}),ne.behind>0&&t.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${ne.behind} commit${ne.behind!==1?"s":""} behind`,children:["↓",ne.behind]}),ne.isUpToDate&&t.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"✓"})]})]}),t.jsx(Ht,{className:`w-3 h-3 text-gray-500 transition-transform ${H?"rotate-180":""}`})]}),H&&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(z=>t.jsx("button",{onClick:()=>K(z),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${z===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:[z===k&&t.jsx(Tr,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),t.jsx("span",{className:z===k?"font-medium":"",children:z})]})},z))}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:t.jsxs("button",{onClick:()=>{M(!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(Ct,{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:[ne?.hasRemote&&t.jsxs(t.Fragment,{children:[!ne?.hasUpstream&&t.jsxs("button",{onClick:()=>Ue({type:"publish",message:`Publish branch "${k}" to ${ne.remoteName}?`}),disabled:Ke,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 ${ne.remoteName}`,children:[t.jsx(Yn,{className:`w-3 h-3 ${Ke?"animate-pulse":""}`}),t.jsx("span",{children:Ke?"Publishing...":"Publish"})]}),ne?.hasUpstream&&!ne?.isUpToDate&&t.jsxs(t.Fragment,{children:[ne.behind>0&&t.jsxs("button",{onClick:()=>Ue({type:"pull",message:`Pull ${ne.behind} commit${ne.behind!==1?"s":""} from ${ne.remoteName}?`}),disabled:he,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 ${ne.behind} commit${ne.behind!==1?"s":""} from ${ne.remoteName}`,children:[t.jsx(ls,{className:`w-3 h-3 ${he?"animate-pulse":""}`}),t.jsx("span",{children:he?"Pulling...":`Pull ${ne.behind}`})]}),ne.ahead>0&&t.jsxs("button",{onClick:()=>Ue({type:"push",message:`Push ${ne.ahead} commit${ne.ahead!==1?"s":""} to ${ne.remoteName}?`}),disabled:ke,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 ${ne.ahead} commit${ne.ahead!==1?"s":""} to ${ne.remoteName}`,children:[t.jsx(Yn,{className:`w-3 h-3 ${ke?"animate-pulse":""}`}),t.jsx("span",{children:ke?"Pushing...":`Push ${ne.ahead}`})]}),(ne.ahead>0||ne.behind>0&&ne.ahead>0)&&t.jsxs("button",{onClick:le,disabled:ee,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 ${ne.remoteName}`,children:[t.jsx(yr,{className:`w-3 h-3 ${ee?"animate-spin":""}`}),t.jsx("span",{children:ee?"Fetching...":"Fetch"})]})]})]}),t.jsx("button",{onClick:()=>{ue(),S(),F()},disabled:l,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${r?"p-1":"p-1.5"}`,children:t.jsx(yr,{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 ${u.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:()=>G("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:()=>G("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 ${u.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:r&&xe?t.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("button",{onClick:()=>Re(!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(Ht,{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:()=>Re(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:t.jsx(Ht,{className:"w-4 h-4 rotate-180"})})]}),t.jsxs("div",{className:"relative",children:[t.jsx("textarea",{ref:mt,value:d,onChange:z=>m(z.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:z=>{z.key==="Enter"&&(z.ctrlKey||z.metaKey)&&It()}}),t.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[t.jsx("button",{onClick:Lt,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(yr,{className:"w-4 h-4 animate-spin"}):t.jsx(Pr,{className:"w-4 h-4"})}),t.jsx("div",{style:{display:"none"},children:t.jsx(Ad,{onTranscript:z=>m(z),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:()=>Ue({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(Tr,{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"} ${u.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 z=new Set([...s?.modified||[],...s?.added||[],...s?.deleted||[],...s?.untracked||[]]);g(z)},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(!B),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"}),B?t.jsx(Ht,{className:"w-3 h-3"}):t.jsx(kr,{className:"w-3 h-3"})]}),B&&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(yr,{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(z=>we(z,"M")),s.added?.map(z=>we(z,"A")),s.deleted?.map(z=>we(z,"D")),s.untracked?.map(z=>we(z,"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(yr,{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(z=>re(z))})}),P&&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:()=>M(!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:R,onChange:z=>w(z.target.value),onKeyDown:z=>{z.key==="Enter"&&!W&&se()},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:()=>{M(!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:se,disabled:!R.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(yr,{className:"w-3 h-3 animate-spin"}),t.jsx("span",{children:"Creating..."})]}):t.jsxs(t.Fragment,{children:[t.jsx(Ct,{className:"w-3 h-3"}),t.jsx("span",{children:"Create Branch"})]})})]})]})})]}),pe&&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:()=>Ue(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 ${pe.type==="discard"||pe.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 ${pe.type==="discard"||pe.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:pe.type==="discard"?"Discard Changes":pe.type==="delete"?"Delete File":pe.type==="commit"?"Confirm Commit":pe.type==="pull"?"Confirm Pull":pe.type==="publish"?"Publish Branch":"Confirm Push"})]}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:pe.message}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>Ue(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:st,className:`px-4 py-2 text-sm text-white rounded-md ${pe.type==="discard"||pe.type==="delete"?"bg-red-600 hover:bg-red-700":pe.type==="commit"?"bg-blue-600 hover:bg-blue-700":pe.type==="pull"?"bg-green-600 hover:bg-green-700":pe.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:pe.type==="discard"?t.jsxs(t.Fragment,{children:[t.jsx(Kt,{className:"w-4 h-4"}),t.jsx("span",{children:"Discard"})]}):pe.type==="delete"?t.jsxs(t.Fragment,{children:[t.jsx(Kt,{className:"w-4 h-4"}),t.jsx("span",{children:"Delete"})]}):pe.type==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(Tr,{className:"w-4 h-4"}),t.jsx("span",{children:"Commit"})]}):pe.type==="pull"?t.jsxs(t.Fragment,{children:[t.jsx(ls,{className:"w-4 h-4"}),t.jsx("span",{children:"Pull"})]}):pe.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 or.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)},m=()=>{l&&(clearTimeout(l),c(null)),o(!1)},u=()=>{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:m,children:[e,i&&t.jsxs("div",{className:Ee("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",u(),s),children:[r,t.jsx("div",{className:Ee("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:qr,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(qr,{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(qr,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return t.jsxs("div",{className:Ee("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:Ee("w-2 h-2 rounded-full",i.iconColor.replace("text-","bg-"))}),t.jsx("span",{className:Ee("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:Ee("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(Pr,{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(Pr,{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[m,u]=f.useState(""),[h,p]=f.useState("all"),[g,x]=f.useState("all"),[b,k]=f.useState("id"),[N,y]=f.useState("asc"),[_,U]=f.useState(a),[D,B]=f.useState(!1),[L,H]=f.useState(!1),[j,P]=f.useState(!1),[M,R]=f.useState(!1),[w,W]=f.useState(!1),[O,$]=f.useState(!1),{projectTaskMaster:G,refreshProjects:ce,refreshTasks:I,setCurrentProject:je}=_n();f.useEffect(()=>{const ee=oe=>{O&&!oe.target.closest(".relative")&&$(!1)};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[O]);const We=f.useMemo(()=>{const ee=new Set(e.map(oe=>oe.status).filter(Boolean));return Array.from(ee).sort()},[e]),v=f.useMemo(()=>{const ee=new Set(e.map(oe=>oe.priority).filter(Boolean));return Array.from(ee).sort()},[e]),te=f.useMemo(()=>{let ee=e.filter(oe=>{const he=m.toLowerCase(),Ce=!m||oe.title.toLowerCase().includes(he)||oe.description?.toLowerCase().includes(he)||oe.id.toString().includes(he),ke=h==="all"||oe.status===h,Ve=g==="all"||oe.priority===g;return Ce&&ke&&Ve});return ee.sort((oe,he)=>{let Ce,ke;switch(b){case"title":Ce=oe.title.toLowerCase(),ke=he.title.toLowerCase();break;case"status":const Ve={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};Ce=Ve[oe.status]||99,ke=Ve[he.status]||99;break;case"priority":const Ke={high:3,medium:2,low:1};Ce=Ke[oe.priority]||0,ke=Ke[he.priority]||0;break;case"updated":Ce=new Date(oe.updatedAt||oe.createdAt||0),ke=new Date(he.updatedAt||he.createdAt||0);break;case"id":default:const rt=pe=>pe.toString().split(".").map(mt=>parseInt(mt,10)),xe=rt(oe.id),Re=rt(he.id);for(let pe=0;pe<Math.max(xe.length,Re.length);pe++){const Ue=xe[pe]||0,mt=Re[pe]||0;if(Ue!==mt){Ce=Ue,ke=mt;break}}break}return b==="updated"?N==="asc"?Ce-ke:ke-Ce:typeof Ce=="string"?N==="asc"?Ce.localeCompare(ke):ke.localeCompare(Ce):N==="asc"?Ce-ke:ke-Ce}),ee},[e,m,h,g,b,N]),me=f.useMemo(()=>{const ee=[{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"}],oe=["pending","in-progress","done"];return ee.filter(Ce=>{const ke=te.some(Ke=>Ke.status===Ce.status),Ve=oe.includes(Ce.status);return ke||Ve}).map(Ce=>({...Ce,tasks:te.filter(ke=>ke.status===Ce.status)}))},[te]),Ne=ee=>{b===ee?y(N==="asc"?"desc":"asc"):(k(ee),y("asc"))},ne=()=>{u(""),p("all"),x("all")},Oe=ee=>b!==ee?t.jsx(Gm,{className:"w-4 h-4"}):N==="asc"?t.jsx(Jm,{className:"w-4 h-4"}):t.jsx(Xl,{className:"w-4 h-4"});if(e.length===0){const ee=i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||G?.hasTaskmaster;return t.jsxs("div",{className:Ee("text-center py-12",n),children:[ee?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(oe=>t.jsxs("button",{onClick:async()=>{try{const he=await Fe.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(oe.name)}`);if(he.ok){const Ce=await he.json();l?.({name:oe.name,content:Ce.content,isExisting:!0})}else console.error("Failed to load PRD:",he.statusText)}catch(he){console.error("Error loading PRD:",he)}},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"}),oe.name]},oe.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:oe=>{oe.preventDefault(),oe.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(Yr,{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),P(!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(Qr,{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(Qr,{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:()=>{P(!1),setTimeout(()=>{ce(),i&&je(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(Ct,{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:oe=>{const he=oe.currentTarget.querySelector(".xterm-screen");he&&he.focus()},children:t.jsx(bi,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:oe=>{W(!0),oe===0&&setTimeout(()=>{ce(),i&&je(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:()=>{P(!1),W(!1),setTimeout(()=>{ce(),i&&je(i)},1e3)},className:Ee("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:Ee("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(Jr,{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:m,onChange:ee=>u(ee.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:()=>U("kanban"),className:Ee("p-2 rounded-md transition-colors",_==="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:()=>U("list"),className:Ee("p-2 rounded-md transition-colors",_==="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:()=>U("grid"),className:Ee("p-2 rounded-md transition-colors",_==="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:()=>B(!D),className:Ee("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",D?"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(Ht,{className:Ee("w-4 h-4 transition-transform",D&&"rotate-180")})]}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>R(!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:()=>$(!O),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(Ht,{className:Ee("w-3 h-3 transition-transform hidden sm:block",O&&"rotate-180")})]}),O&&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(Ct,{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(ee=>t.jsxs("button",{onClick:async()=>{try{const oe=await Fe.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(ee.name)}`);if(oe.ok){const he=await oe.json();l?.({name:ee.name,content:he.content,isExisting:!0}),$(!1)}}catch(oe){console.error("Error loading PRD:",oe)}},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(ee.modified).toLocaleDateString()}`,children:[t.jsx(Tt,{className:"w-4 h-4"}),t.jsx("span",{className:"truncate",children:ee.name})]},ee.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||G?.hasTaskmaster||e.length>0)&&t.jsxs("button",{onClick:()=>H(!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(Ct,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),D&&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:ee=>p(ee.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"}),We.map(ee=>t.jsx("option",{value:ee,children:ee.charAt(0).toUpperCase()+ee.slice(1).replace("-"," ")},ee))]})]}),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:ee=>x(ee.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(ee=>t.jsx("option",{value:ee,children:ee.charAt(0).toUpperCase()+ee.slice(1)},ee))]})]}),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}-${N}`,onChange:ee=>{const[oe,he]=ee.target.value.split("-");k(oe),y(he)},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 ",te.length," of ",e.length," tasks"]}),t.jsx("button",{onClick:ne,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:()=>Ne("id"),className:Ee("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 ",Oe("id")]}),t.jsxs("button",{onClick:()=>Ne("status"),className:Ee("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 ",Oe("status")]}),t.jsxs("button",{onClick:()=>Ne("priority"),className:Ee("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 ",Oe("priority")]})]}),te.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(Jr,{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."})]})}):_==="kanban"?t.jsx("div",{className:Ee("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(ee=>t.jsxs("div",{className:Ee("rounded-xl border shadow-sm transition-shadow hover:shadow-md",ee.color),children:[t.jsx("div",{className:Ee("px-4 py-3 rounded-t-xl border-b",ee.headerColor),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"font-semibold text-sm",children:ee.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:ee.tasks.length})})]})}),t.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:ee.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:ee.status==="pending"?"Tasks will appear here":ee.status==="in-progress"?"Move tasks here when started":ee.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):ee.tasks.map(oe=>t.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:t.jsx(Il,{task:oe,onClick:()=>r?.(oe),showParent:s,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},oe.id))})]},ee.id))}):t.jsx("div",{className:Ee("gap-4",_==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:te.map(ee=>t.jsx(Il,{task:ee,onClick:()=>r?.(ee),showParent:s,className:_==="grid"?"h-full":""},ee.id))}),L&&t.jsx(r1,{currentProject:i,onClose:()=>H(!1),onTaskCreated:()=>{H(!1),o&&o()}}),M&&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:()=>R(!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?.(),R(!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,m]=f.useState(!i),[u,h]=f.useState(!1),[p,g]=f.useState(!1),[x,b]=f.useState(!0),[k,N]=f.useState(!1),[y,_]=f.useState(!1),[U,D]=f.useState(!0),[B,L]=f.useState(""),[H,j]=f.useState(!1),[P,M]=f.useState(!1),[R,w]=f.useState([]),W=f.useRef(null),O=`# 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(O),m(!1);return}if(e.content){c(e.content),m(!1);return}try{m(!0);const te=await Fe.readFile(e.projectName,e.path);if(!te.ok)throw new Error(`Failed to load file: ${te.status} ${te.statusText}`);const me=await te.json();c(me.content||O)}catch(te){console.error("Error loading PRD file:",te),c(`# Error Loading PRD
|
|
872
|
+
|
|
873
|
+
Error: ${te.message}
|
|
874
|
+
|
|
875
|
+
File: ${e?.name||"New PRD"}
|
|
876
|
+
Path: ${e?.path||"Not saved yet"}
|
|
877
|
+
|
|
878
|
+
${O}`)}finally{m(!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 te=await Fe.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(te.ok){const me=await te.json();console.log("Fetched existing PRDs:",me.prds),w(me.prds||[])}else console.log("Failed to fetch PRDs:",te.status,te.statusText)}catch(te){console.error("Error fetching existing PRDs:",te)}})()},[s?.name]);const $=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!B.trim()){alert("Please provide a filename for the PRD.");return}const v=B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.txt`,te=R.find(me=>me.name===v);if(console.log("Save check:",{fullFileName:v,existingPRDs:R,existingFile:te,isExisting:e?.isExisting,fileObject:e,shouldShowModal:te&&!e?.isExisting}),te&&!e?.isExisting){console.log("Showing overwrite confirmation modal"),M(!0);return}await G()},G=async()=>{h(!0);try{const v=B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.txt`,te=await De(`/api/taskmaster/prd/${encodeURIComponent(s?.name)}`,{method:"POST",body:JSON.stringify({fileName:v,content:l})});if(!te.ok){const Ne=await te.json();throw new Error(Ne.message||`Save failed: ${te.status}`)}N(!0),setTimeout(()=>N(!1),2e3);const me=await Fe.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(me.ok){const Ne=await me.json();w(Ne.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"}),te=URL.createObjectURL(v),me=document.createElement("a");me.href=te;const Ne=B?`${B}.txt`:"prd.txt";me.download=Ne,document.body.appendChild(me),me.click(),document.body.removeChild(me),URL.revokeObjectURL(te)},I=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}j(!0)},je=()=>{g(!p)};f.useEffect(()=>{const v=te=>{(te.ctrlKey||te.metaKey)&&(te.key==="s"?(te.preventDefault(),$()):te.key==="Escape"&&(te.preventDefault(),r()))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]);const We=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:Ee("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:B,onChange:v=>{const te=v.target.value.replace(/[<>:"/\\|?*]/g,"");L(te)},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:()=>_(!y),className:Ee("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(an,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:()=>D(!U),className:Ee("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",U?"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:U?"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:I,disabled:!l.trim(),className:Ee("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(Pr,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),t.jsx("button",{onClick:$,disabled:u,className:Ee("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:u?"Saving...":"Save PRD"})]})}),t.jsx("button",{onClick:je,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:We(l)}})}):t.jsx(Rl,{ref:W,value:l,onChange:c,extensions:[zl(),...U?[qt.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"})]})]}),H&&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(Pr,{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(Pr,{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/`,B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.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"})})]})]})}),P&&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:()=>M(!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 "',B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.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:()=>M(!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()=>{M(!1),await G()},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:m,onInputFocusChange:u,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:x,processingSessions:b,onReplaceTemporarySession:k,onNavigateToSession:N,onShowSettings:y,autoExpandTools:_,showRawParameters:U,showThinking:D,autoScrollToBottom:B,sendByCtrlEnter:L,externalMessageUpdate:H}){const[j,P]=f.useState(null),[M,R]=f.useState(null),[w,W]=f.useState(!1),[O,$]=f.useState(!1),[G,ce]=f.useState(null),[I,je]=f.useState([]),[We,v]=f.useState(null),{tasks:te,currentProject:me,refreshTasks:Ne,setCurrentProject:ne}=_n(),{tasksEnabled:Oe,isTaskMasterInstalled:ee,isTaskMasterReady:oe}=zn(),he=Oe&ⅇf.useEffect(()=>{e&&e!==me&&ne(e)},[e,me,ne]),f.useEffect(()=>{!he&&n==="tasks"&&s("chat")},[he,n,s]),f.useEffect(()=>{(async()=>{if(!me?.name){je([]);return}try{const Re=await Fe.get(`/taskmaster/prd/${encodeURIComponent(me.name)}`);if(Re.ok){const pe=await Re.json();je(pe.prdFiles||[])}else je([])}catch(Re){console.error("Failed to load existing PRDs:",Re),je([])}})()},[me?.name]);const Ce=(xe,Re=null)=>{const pe={name:xe.split("/").pop(),path:xe,projectName:e?.name,diffInfo:Re};P(pe)},ke=()=>{P(null)},Ve=xe=>{if(typeof xe=="object"&&xe.id&&!xe.title){const Re=te?.find(pe=>pe.id===xe.id);Re&&(R(Re),W(!0))}else R(xe),W(!0)},Ke=()=>{W(!1),R(null)},rt=(xe,Re)=>{console.log("Update task status:",xe,Re),Ne?.()};return m?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:xe=>{xe.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(ir,{className:"w-5 h-5"}):t.jsx(Zt,{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"&&he?"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"})]})})}),he&&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:Ce,onInputFocusChange:u,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:x,processingSessions:b,onReplaceTemporarySession:k,onNavigateToSession:N,onShowSettings:y,autoExpandTools:_,showRawParameters:U,showThinking:D,autoScrollToBottom:B,sendByCtrlEnter:L,externalMessageUpdate:H,onShowAllTasks:Oe?()=>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:Ce})}),he&&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:te||[],onTaskClick:Ve,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:me,onTaskCreated:Ne,onShowPRDEditor:(xe=null)=>{ce(xe),$(!0)},existingPRDs:I,onRefreshPRDs:(xe=!1)=>{me?.name&&Fe.get(`/taskmaster/prd/${encodeURIComponent(me.name)}`).then(Re=>Re.ok?Re.json():Promise.reject()).then(Re=>{je(Re.prdFiles||[]),xe&&(v("PRD saved successfully!"),setTimeout(()=>v(null),3e3))}).catch(Re=>console.error("Failed to refresh PRDs:",Re))}})})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="preview"?"block":"hidden"}`})]}),j&&t.jsx(su,{file:j,onClose:ke,projectPath:e?.path}),he&&w&&M&&t.jsx(Id,{task:M,isOpen:w,onClose:Ke,onStatusChange:rt,onTaskClick:Ve}),O&&t.jsx(s1,{project:me,projectPath:me?.fullPath||me?.path,onClose:()=>{$(!1),ce(null)},isNewFile:!G?.isExisting,file:{name:G?.name||"prd.txt",content:G?.content||""},onSave:async()=>{$(!1),ce(null);try{const xe=await Fe.get(`/taskmaster/prd/${encodeURIComponent(me.name)}`);if(xe.ok){const Re=await xe.json();je(Re.prdFiles||[]),v("PRD saved successfully!"),setTimeout(()=>v(null),3e3)}}catch(xe){console.error("Failed to refresh PRDs:",xe)}Ne?.()}}),We&&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:We})]})})]}):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=or.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:Qr,onClick:()=>r("shell")},{id:"files",icon:Xt,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),[m,u]=f.useState(""),[h,p]=f.useState(""),[g,x]=f.useState(""),[b,k]=f.useState(""),[N,y]=f.useState({}),[_,U]=f.useState(null),[D,B]=f.useState(null);f.useEffect(()=>{L()},[]);const L=async()=>{try{i(!0);const O=localStorage.getItem("auth-token"),G=await(await fetch("/api/settings/api-keys",{headers:{Authorization:`Bearer ${O}`}})).json();r(G.apiKeys||[]);const I=await(await fetch("/api/settings/credentials?type=github_token",{headers:{Authorization:`Bearer ${O}`}})).json();s(I.credentials||[])}catch(O){console.error("Error fetching settings:",O)}finally{i(!1)}},H=async()=>{if(m.trim())try{const O=localStorage.getItem("auth-token"),G=await(await fetch("/api/settings/api-keys",{method:"POST",headers:{Authorization:`Bearer ${O}`,"Content-Type":"application/json"},body:JSON.stringify({keyName:m})})).json();G.success&&(B(G.apiKey),u(""),l(!1),L())}catch(O){console.error("Error creating API key:",O)}},j=async O=>{if(confirm("Are you sure you want to delete this API key?"))try{const $=localStorage.getItem("auth-token");await fetch(`/api/settings/api-keys/${O}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`}}),L()}catch($){console.error("Error deleting API key:",$)}},P=async(O,$)=>{try{const G=localStorage.getItem("auth-token");await fetch(`/api/settings/api-keys/${O}/toggle`,{method:"PATCH",headers:{Authorization:`Bearer ${G}`,"Content-Type":"application/json"},body:JSON.stringify({isActive:!$})}),L()}catch(G){console.error("Error toggling API key:",G)}},M=async()=>{if(!(!h.trim()||!g.trim()))try{const O=localStorage.getItem("auth-token");(await(await fetch("/api/settings/credentials",{method:"POST",headers:{Authorization:`Bearer ${O}`,"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(O){console.error("Error creating GitHub credential:",O)}},R=async O=>{if(confirm("Are you sure you want to delete this GitHub token?"))try{const $=localStorage.getItem("auth-token");await fetch(`/api/settings/credentials/${O}`,{method:"DELETE",headers:{Authorization:`Bearer ${$}`}}),L()}catch($){console.error("Error deleting GitHub credential:",$)}},w=async(O,$)=>{try{const G=localStorage.getItem("auth-token");await fetch(`/api/settings/credentials/${O}/toggle`,{method:"PATCH",headers:{Authorization:`Bearer ${G}`,"Content-Type":"application/json"},body:JSON.stringify({isActive:!$})}),L()}catch(G){console.error("Error toggling GitHub credential:",G)}},W=(O,$)=>{navigator.clipboard.writeText(O),U($),setTimeout(()=>U(null),2e3)};return a?t.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):t.jsxs("div",{className:"space-y-8",children:[D&&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:D.apiKey}),t.jsx(Me,{size:"sm",variant:"outline",onClick:()=>W(D.apiKey,"new"),children:_==="new"?t.jsx(Tr,{className:"h-4 w-4"}):t.jsx(ec,{className:"h-4 w-4"})})]}),t.jsx(Me,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>B(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(Ct,{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:m,onChange:O=>u(O.target.value),className:"mb-2"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{onClick:H,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(O=>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:O.key_name}),t.jsx("code",{className:"text-xs text-muted-foreground",children:O.api_key}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Created: ",new Date(O.created_at).toLocaleDateString(),O.last_used&&` • Last used: ${new Date(O.last_used).toLocaleDateString()}`]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Me,{size:"sm",variant:O.is_active?"outline":"secondary",onClick:()=>P(O.id,O.is_active),children:O.is_active?"Active":"Inactive"}),t.jsx(Me,{size:"sm",variant:"ghost",onClick:()=>j(O.id),children:t.jsx(Kt,{className:"h-4 w-4"})})]})]},O.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(Ct,{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:O=>p(O.target.value)}),t.jsxs("div",{className:"relative",children:[t.jsx(wt,{type:N.new?"text":"password",placeholder:"GitHub Personal Access Token (ghp_...)",value:g,onChange:O=>x(O.target.value),className:"pr-10"}),t.jsx("button",{type:"button",onClick:()=>y({...N,new:!N.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:N.new?t.jsx(tc,{className:"h-4 w-4"}):t.jsx(an,{className:"h-4 w-4"})})]}),t.jsx(wt,{placeholder:"Description (optional)",value:b,onChange:O=>k(O.target.value)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Me,{onClick:M,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(O=>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:O.credential_name}),O.description&&t.jsx("div",{className:"text-xs text-muted-foreground",children:O.description}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Added: ",new Date(O.created_at).toLocaleDateString()]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Me,{size:"sm",variant:O.is_active?"outline":"secondary",onClick:()=>w(O.id,O.is_active),children:O.is_active?"Active":"Inactive"}),t.jsx(Me,{size:"sm",variant:"ghost",onClick:()=>R(O.id),children:t.jsx(Kt,{className:"h-4 w-4"})})]})]},O.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:m}=zn(),[u,h]=f.useState([]),[p,g]=f.useState([]),[x,b]=f.useState(""),[k,N]=f.useState(""),[y,_]=f.useState(!1),[U,D]=f.useState(!1),[B,L]=f.useState(null),[H,j]=f.useState("name"),[P,M]=f.useState([]),[R,w]=f.useState(!1),[W,O]=f.useState(null),[$,G]=f.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[ce,I]=f.useState(!1),[je,We]=f.useState({}),[v,te]=f.useState({}),[me,Ne]=f.useState({}),[ne,Oe]=f.useState("tools"),[ee,oe]=f.useState(""),[he,Ce]=f.useState("claude"),[ke,Ve]=f.useState([]),[Ke,rt]=f.useState([]),[xe,Re]=f.useState(!1),[pe,Ue]=f.useState(""),[mt,Ie]=f.useState(""),[$t,Z]=f.useState([]),[ue,S]=f.useState(!1),[F,K]=f.useState(""),[se,le]=f.useState(null),ze=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],Le=["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)"],Je=async()=>{try{const C=localStorage.getItem("auth-token"),X=await fetch("/api/cursor/mcp",{headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"}});if(X.ok){const fe=await X.json();Z(fe.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(C){console.error("Error fetching Cursor MCP servers:",C)}},pt=async()=>{try{const C=localStorage.getItem("auth-token"),X=await fetch("/api/mcp/config/read",{headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"}});if(X.ok){const at=await X.json();if(at.success&&at.servers){M(at.servers);return}}const fe=await fetch("/api/mcp/cli/list",{headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"}});if(fe.ok){const at=await fe.json();if(at.success&&at.servers){const yt=at.servers.map(nt=>({id:nt.name,name:nt.name,type:nt.type,scope:"user",config:{command:nt.command||"",args:nt.args||[],env:nt.env||{},url:nt.url||"",headers:nt.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));M(yt);return}}const He=await fetch("/api/mcp/servers?scope=user",{headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"}});if(He.ok){const at=await He.json();M(at.servers||[])}else console.error("Failed to fetch MCP servers")}catch(C){console.error("Error fetching MCP servers:",C)}},tt=async C=>{try{const X=localStorage.getItem("auth-token");W&&await st(W.id,"user");const fe=await fetch("/api/mcp/cli/add",{method:"POST",headers:{Authorization:`Bearer ${X}`,"Content-Type":"application/json"},body:JSON.stringify({name:C.name,type:C.type,scope:C.scope,projectPath:C.projectPath,command:C.config?.command,args:C.config?.args||[],url:C.config?.url,headers:C.config?.headers||{},env:C.config?.env||{}})});if(fe.ok){const He=await fe.json();if(He.success)return await pt(),!0;throw new Error(He.error||"Failed to save server via Claude CLI")}else{const He=await fe.json();throw new Error(He.error||"Failed to save server")}}catch(X){throw console.error("Error saving MCP server:",X),X}},st=async(C,X="user")=>{try{const fe=localStorage.getItem("auth-token"),He=await fetch(`/api/mcp/cli/remove/${C}?scope=${X}`,{method:"DELETE",headers:{Authorization:`Bearer ${fe}`,"Content-Type":"application/json"}});if(He.ok){const at=await He.json();if(at.success)return await pt(),!0;throw new Error(at.error||"Failed to delete server via Claude CLI")}else{const at=await He.json();throw new Error(at.error||"Failed to delete server")}}catch(fe){throw console.error("Error deleting MCP server:",fe),fe}};f.useEffect(()=>{e&&ct()},[e]);const ct=async()=>{try{const C=localStorage.getItem("claude-settings");if(C){const fe=JSON.parse(C);h(fe.allowedTools||[]),g(fe.disallowedTools||[]),_(fe.skipPermissions||!1),j(fe.projectSortOrder||"name")}else h([]),g([]),_(!1),j("name");const X=localStorage.getItem("cursor-tools-settings");if(X){const fe=JSON.parse(X);Ve(fe.allowedCommands||[]),rt(fe.disallowedCommands||[]),Re(fe.skipPermissions||!1)}else Ve([]),rt([]),Re(!1);await pt(),await Je()}catch(C){console.error("Error loading tool settings:",C),h([]),g([]),_(!1),j("name")}},dt=()=>{K("claude"),le(n?.[0]||{name:"default",fullPath:process.cwd()}),S(!0)},Ot=()=>{K("cursor"),le(n?.[0]||{name:"default",fullPath:process.cwd()}),S(!0)},Bt=C=>{S(!1)},Lt=()=>{D(!0),L(null);try{const C={allowedTools:u,disallowedTools:p,skipPermissions:y,projectSortOrder:H,lastUpdated:new Date().toISOString()},X={allowedCommands:ke,disallowedCommands:Ke,skipPermissions:xe,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(C)),localStorage.setItem("cursor-tools-settings",JSON.stringify(X)),L("success"),setTimeout(()=>{r()},1e3)}catch(C){console.error("Error saving tool settings:",C),L("error")}finally{D(!1)}},kt=C=>{C&&!u.includes(C)&&(h([...u,C]),b(""))},jr=C=>{h(u.filter(X=>X!==C))},vt=C=>{C&&!p.includes(C)&&(g([...p,C]),N(""))},It=C=>{g(p.filter(X=>X!==C))},A=()=>{G({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),O(null),w(!1),oe("")},re=(C=null)=>{C?(O(C),G({name:C.name,type:C.type,scope:C.scope,projectPath:C.projectPath||"",config:{...C.config},raw:C.raw,importMode:"form",jsonInput:""})):A(),w(!0)},we=async C=>{C.preventDefault(),I(!0);try{if($.importMode==="json"){const X=localStorage.getItem("auth-token"),fe=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(fe.ok){const He=await fe.json();if(He.success)await pt(),A(),L("success");else throw new Error(He.error||"Failed to add server via JSON")}else{const He=await fe.json();throw new Error(He.error||"Failed to add server")}}else await tt($),A(),L("success")}catch(X){alert(`Error: ${X.message}`),L("error")}finally{I(!1)}},z=async(C,X)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await st(C,X),L("success")}catch(fe){alert(`Error: ${fe.message}`),L("error")}},T=(C,X)=>{G(fe=>({...fe,config:{...fe.config,[C]:X}}))},ie=C=>{switch(C){case"stdio":return t.jsx(Qr,{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(Yr,{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:()=>Oe("tools"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ne==="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:()=>Oe("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ne==="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:()=>Oe("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ne==="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:()=>Oe("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ne==="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:[ne==="appearance"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:ne==="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:H,onChange:C=>j(C.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"})]})]})})})]})}),ne==="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:()=>Ce("claude"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${he==="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(Zt,{className:"w-4 h-4"}),t.jsx("span",{children:"Claude"})]})}),t.jsx("button",{onClick:()=>Ce("cursor"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${he==="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(ir,{className:"w-4 h-4"}),t.jsx("span",{children:"Cursor"})]})})]})}),he==="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:C=>_(C.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:dt,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:C=>b(C.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:C=>{C.key==="Enter"&&kt(x)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>kt(x),disabled:!x,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Ct,{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:ze.map(C=>t.jsx(Me,{variant:"outline",size:"sm",onClick:()=>kt(C),disabled:u.includes(C),className:"text-xs h-8 touch-manipulation truncate",children:C},C))})]}),t.jsxs("div",{className:"space-y-2",children:[u.map(C=>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:C}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>jr(C),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"})})]},C)),u.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:C=>N(C.target.value),placeholder:'e.g., "Bash(rm:*)" or "Write"',onKeyPress:C=>{C.key==="Enter"&&vt(k)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>vt(k),disabled:!k,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Ct,{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(C=>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:C}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>It(C),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"})})]},C)),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:()=>re(),className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(Ct,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),t.jsxs("div",{className:"space-y-2",children:[P.map(C=>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:[ie(C.type),t.jsx("span",{className:"font-medium text-foreground",children:C.name}),t.jsx(Mr,{variant:"outline",className:"text-xs",children:C.type}),t.jsx(Mr,{variant:"outline",className:"text-xs",children:C.scope==="local"?"📁 local":C.scope==="user"?"👤 user":C.scope}),C.projectPath&&t.jsx(Mr,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20",title:C.projectPath,children:C.projectPath.split("/").pop()})]}),t.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[C.type==="stdio"&&C.config.command&&t.jsxs("div",{children:["Command: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:C.config.command})]}),(C.type==="sse"||C.type==="http")&&C.config.url&&t.jsxs("div",{children:["URL: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:C.config.url})]}),C.config.args&&C.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:C.config.args.join(" ")})]}),C.config.env&&Object.keys(C.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(C.config.env).map(([X,fe])=>`${X}=${fe}`).join(", ")})]}),C.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(C.raw,null,2)})]})]}),je[C.id]&&t.jsxs("div",{className:`mt-2 p-2 rounded text-xs ${je[C.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:je[C.id].message}),je[C.id].details&&je[C.id].details.length>0&&t.jsx("ul",{className:"mt-1 space-y-0.5",children:je[C.id].details.map((X,fe)=>t.jsxs("li",{children:["• ",X]},fe))})]}),v[C.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[C.id].tools&&v[C.id].tools.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Tools (",v[C.id].tools.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:v[C.id].tools.map((X,fe)=>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]})]})]},fe))})]}),v[C.id].resources&&v[C.id].resources.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Resources (",v[C.id].resources.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:v[C.id].resources.map((X,fe)=>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]})]})]},fe))})]}),v[C.id].prompts&&v[C.id].prompts.length>0&&t.jsxs("div",{children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Prompts (",v[C.id].prompts.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:v[C.id].prompts.map((X,fe)=>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]})]})]},fe))})]}),(!v[C.id].tools||v[C.id].tools.length===0)&&(!v[C.id].resources||v[C.id].resources.length===0)&&(!v[C.id].prompts||v[C.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:()=>re(C),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:()=>z(C.id,C.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(Kt,{className:"w-4 h-4"})})]})]})},C.id)),P.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]})]}),R&&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:A,children:t.jsx(ot,{className:"w-4 h-4"})})]}),t.jsxs("form",{onSubmit:we,className:"p-4 space-y-4",children:[!W&&t.jsxs("div",{className:"flex gap-2 mb-4",children:[t.jsx("button",{type:"button",onClick:()=>G(C=>({...C,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:()=>G(C=>({...C,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(Dr,{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:()=>G(C=>({...C,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:()=>G(C=>({...C,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(Dr,{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:C=>G(X=>({...X,projectPath:C.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(C=>t.jsx("option",{value:C.path||C.fullPath,children:C.displayName||C.name},C.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:C=>{G(X=>({...X,name:C.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:C=>{G(X=>({...X,type:C.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:C=>{G(X=>({...X,jsonInput:C.target.value}));try{if(C.target.value.trim()){const X=JSON.parse(C.target.value);X.type?X.type==="stdio"&&!X.command?oe("stdio type requires a command field"):(X.type==="http"||X.type==="sse")&&!X.url?oe(`${X.type} type requires a url field`):oe(""):oe("Missing required field: type")}}catch{C.target.value.trim()?oe("Invalid JSON format"):oe("")}},className:`w-full px-3 py-2 border ${ee?"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}),ee&&t.jsx("p",{className:"text-xs text-red-500 mt-1",children:ee}),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:C=>T("command",C.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:C=>T("args",C.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:C=>T("url",C.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(([C,X])=>`${C}=${X}`).join(`
|
|
897
|
+
`),onChange:C=>{const X={};C.target.value.split(`
|
|
898
|
+
`).forEach(fe=>{const[He,...at]=fe.split("=");He&&He.trim()&&(X[He.trim()]=at.join("=").trim())}),T("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(([C,X])=>`${C}=${X}`).join(`
|
|
900
|
+
`),onChange:C=>{const X={};C.target.value.split(`
|
|
901
|
+
`).forEach(fe=>{const[He,...at]=fe.split("=");He&&He.trim()&&(X[He.trim()]=at.join("=").trim())}),T("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:A,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"})]})]})]})})]}),he==="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:xe,onChange:C=>Re(C.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:Ot,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:pe,onChange:C=>Ue(C.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:C=>{C.key==="Enter"&&pe&&!ke.includes(pe)&&(Ve([...ke,pe]),Ue(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>{pe&&!ke.includes(pe)&&(Ve([...ke,pe]),Ue(""))},disabled:!pe,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Ct,{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:Le.map(C=>t.jsx(Me,{variant:"outline",size:"sm",onClick:()=>{ke.includes(C)||Ve([...ke,C])},disabled:ke.includes(C),className:"text-xs h-8 touch-manipulation truncate",children:C},C))})]}),t.jsxs("div",{className:"space-y-2",children:[ke.map(C=>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:C}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>Ve(ke.filter(X=>X!==C)),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"})})]},C)),ke.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:mt,onChange:C=>Ie(C.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:C=>{C.key==="Enter"&&mt&&!Ke.includes(mt)&&(rt([...Ke,mt]),Ie(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Me,{onClick:()=>{mt&&!Ke.includes(mt)&&(rt([...Ke,mt]),Ie(""))},disabled:!mt,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Ct,{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:[Ke.map(C=>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:C}),t.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>rt(Ke.filter(X=>X!==C)),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"})})]},C)),Ke.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)"]})]})]})]})]}),ne==="tasks"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:m?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:C=>o(C.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"})]})]})]})]})})]})})]})]})}),ne==="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:[B==="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!"]}),B==="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:U,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),t.jsx(Me,{onClick:Lt,disabled:U,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:U?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"})]})]})]}),ue&&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:F==="claude"?"Claude CLI Login":"Cursor CLI Login"}),t.jsx("button",{onClick:()=>S(!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:se,command:F==="claude"?"claude /login":"cursor-agent login",onComplete:Bt,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:m,onSendByCtrlEnterChange:u,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 N=()=>{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:N,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(kr,{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(an,{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(Wp,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),t.jsx("input",{type:"checkbox",checked:m,onChange:y=>u(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(Pr,{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:N})]})},p1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(""),{register:m}=ws(),u=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 m(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(Zt,{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:u,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 m=>{if(m.preventDefault(),l(""),!e||!n){l("Please enter both username and password");return}i(!0);const u=await c(e,n);u.success||l(u.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:m=>r(m.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:m=>s(m.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.9.1",x1=(e,r)=>{const[n,s]=f.useState(!1),[a,i]=f.useState(null);return f.useEffect(()=>{const o=async()=>{try{const d=await(await fetch(`https://api.github.com/repos/${e}/${r}/releases/latest`)).json();if(d.tag_name){const m=d.tag_name.replace(/^v/,"");i(m),s(Al!==m)}else s(!1),i(null)}catch(c){console.error("Version check failed:",c),s(!1),i(null)}};o();const l=setInterval(o,300*1e3);return()=>clearInterval(l)},[e,r]),{updateAvailable:n,latestVersion:a,currentVersion:Al}};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}=x1("siteboon","claudecodeui"),[i,o]=f.useState(!1),[l,c]=f.useState([]),[d,m]=f.useState(null),[u,h]=f.useState(null),[p,g]=f.useState("chat"),[x,b]=f.useState(!1),[k,N]=f.useState(!1),[y,_]=f.useState(!0),[U,D]=f.useState(!1),[B,L]=f.useState(!1),[H,j]=f.useState(!1),[P,M]=kn("autoExpandTools",!1),[R,w]=kn("showRawParameters",!1),[W,O]=kn("showThinking",!0),[$,G]=kn("autoScrollToBottom",!0),[ce,I]=kn("sendByCtrlEnter",!1),[je,We]=f.useState(new Set),[v,te]=f.useState(new Set),[me,Ne]=f.useState(0),{ws:ne,sendMessage:Oe,messages:ee}=dc(),[oe,he]=f.useState(!1);f.useEffect(()=>{const S=()=>{const F=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");he(F),F?(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 S(),window.matchMedia("(display-mode: standalone)").addEventListener("change",S),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",S)}},[]),f.useEffect(()=>{const S=()=>{b(window.innerWidth<768)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]),f.useEffect(()=>{ke()},[]);const Ce=(S,F,K,se)=>{if(!K||!se)return!0;const le=S?.find(tt=>tt.name===K.name),ze=F?.find(tt=>tt.name===K.name);if(!le||!ze)return!1;const Le=le.sessions?.find(tt=>tt.id===se.id),Je=ze.sessions?.find(tt=>tt.id===se.id);return!Le||!Je?!1:Le.id===Je.id&&Le.title===Je.title&&Le.created_at===Je.created_at&&Le.updated_at===Je.updated_at};f.useEffect(()=>{if(ee.length>0){const S=ee[ee.length-1];if(S.type==="projects_updated"){if(S.changedFile&&u&&d){const se=S.changedFile.split("/");se.length>=2&&se[se.length-1].replace(".jsonl","")===u.id&&(je.has(u.id)||Ne(Je=>Je+1))}if(u&&je.has(u.id)||je.size>0&&Array.from(je).some(se=>se.startsWith("new-session-"))){const se=S.projects;if(!Ce(l,se,d,u))return}const K=S.projects;if(c(K),d){const se=K.find(le=>le.name===d.name);se&&(JSON.stringify(se)!==JSON.stringify(d)&&m(se),u&&(se.sessions?.find(ze=>ze.id===u.id)||h(null)))}}}},[ee,d,u,je]);const ke=async()=>{try{_(!0);const F=await(await Fe.projects()).json();for(let K of F)try{const se=`/api/cursor/sessions?projectPath=${encodeURIComponent(K.fullPath||K.path)}`,le=await De(se);if(le.ok){const ze=await le.json();ze.success&&ze.sessions?K.cursorSessions=ze.sessions:K.cursorSessions=[]}else K.cursorSessions=[]}catch(se){console.error(`Error fetching Cursor sessions for project ${K.name}:`,se),K.cursorSessions=[]}c(K=>K.length===0||F.some((le,ze)=>{const Le=K[ze];return Le?le.name!==Le.name||le.displayName!==Le.displayName||le.fullPath!==Le.fullPath||JSON.stringify(le.sessionMeta)!==JSON.stringify(Le.sessionMeta)||JSON.stringify(le.sessions)!==JSON.stringify(Le.sessions)||JSON.stringify(le.cursorSessions)!==JSON.stringify(Le.cursorSessions):!0})||F.length!==K.length?F:K)}catch(S){console.error("Error fetching projects:",S)}finally{_(!1)}};window.refreshProjects=ke,f.useEffect(()=>{if(r&&l.length>0){const S=!u||u.id!==r;for(const F of l){let K=F.sessions?.find(le=>le.id===r);if(K){m(F),h({...K,__provider:"claude"}),S&&g("chat");return}const se=F.cursorSessions?.find(le=>le.id===r);if(se){m(F),h({...se,__provider:"cursor"}),S&&g("chat");return}}}},[r,l,e]);const Ve=S=>{m(S),h(null),e("/"),x&&N(!1)},Ke=S=>{if(h(S),p!=="git"&&p!=="preview"&&g("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",S.id),x){const K=S.__projectName,se=d?.name;K!==se&&N(!1)}e(`/session/${S.id}`)},rt=S=>{m(S),h(null),g("chat"),e("/"),x&&N(!1)},xe=S=>{u?.id===S&&(h(null),e("/")),c(F=>F.map(K=>({...K,sessions:K.sessions?.filter(se=>se.id!==S)||[],sessionMeta:{...K.sessionMeta,total:Math.max(0,(K.sessionMeta?.total||0)-1)}})))},Re=async()=>{try{const F=await(await Fe.projects()).json();if(c(K=>F.some((le,ze)=>{const Le=K[ze];return Le?le.name!==Le.name||le.displayName!==Le.displayName||le.fullPath!==Le.fullPath||JSON.stringify(le.sessionMeta)!==JSON.stringify(Le.sessionMeta)||JSON.stringify(le.sessions)!==JSON.stringify(Le.sessions):!0})||F.length!==K.length?F:K),d){const K=F.find(se=>se.name===d.name);if(K&&(JSON.stringify(K)!==JSON.stringify(d)&&m(K),u)){const se=K.sessions?.find(le=>le.id===u.id);se&&JSON.stringify(se)!==JSON.stringify(u)&&h(se)}}}catch(S){console.error("Error refreshing sidebar:",S)}},pe=S=>{d?.name===S&&(m(null),h(null),e("/")),c(F=>F.filter(K=>K.name!==S))},Ue=f.useCallback(S=>{S&&We(F=>new Set([...F,S]))},[]),mt=f.useCallback(S=>{S&&We(F=>{const K=new Set(F);return K.delete(S),K})},[]),Ie=f.useCallback(S=>{S&&te(F=>new Set([...F,S]))},[]),$t=f.useCallback(S=>{S&&te(F=>{const K=new Set(F);return K.delete(S),K})},[]),Z=f.useCallback(S=>{S&&We(F=>{const K=new Set;for(const se of F)se.startsWith("new-session-")||K.add(se);return K.add(S),K})},[]),ue=()=>i?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:()=>o(!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-md mx-4 p-6 space-y-4",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:"A new version is ready"})]})]}),t.jsx("button",{onClick:()=>o(!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})]})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"How to 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:"Run this command in your Claude Code UI directory to update to the latest version."})]}),t.jsxs("div",{className:"flex gap-2 pt-2",children:[t.jsx("button",{onClick:()=>o(!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:"Later"}),t.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install"),o(!1)},className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors",children:"Copy Command"})]})]})]}):null;return t.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!x&&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:l,selectedProject:d,selectedSession:u,onProjectSelect:Ve,onSessionSelect:Ke,onNewSession:rt,onSessionDelete:xe,onProjectDelete:pe,isLoading:y,onRefresh:Re,onShowSettings:()=>L(!0),updateAvailable:n,latestVersion:s,currentVersion:a,onShowVersionModal:()=>o(!0),isPWA:oe,isMobile:x})})}),x&&t.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${k?"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:S=>{S.stopPropagation(),N(!1)},onTouchStart:S=>{S.preventDefault(),S.stopPropagation(),N(!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 ${k?"translate-x-0":"-translate-x-full"}`,style:{height:"calc(100vh - 80px)"},onClick:S=>S.stopPropagation(),onTouchStart:S=>S.stopPropagation(),children:t.jsx(Qi,{projects:l,selectedProject:d,selectedSession:u,onProjectSelect:Ve,onSessionSelect:Ke,onNewSession:rt,onSessionDelete:xe,onProjectDelete:pe,isLoading:y,onRefresh:Re,onShowSettings:()=>L(!0),updateAvailable:n,latestVersion:s,currentVersion:a,onShowVersionModal:()=>o(!0),isPWA:oe,isMobile:x})})]}),t.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${x&&!U?"pb-16":""}`,children:t.jsx(i1,{selectedProject:d,selectedSession:u,activeTab:p,setActiveTab:g,ws:ne,sendMessage:Oe,messages:ee,isMobile:x,isPWA:oe,onMenuClick:()=>N(!0),isLoading:y,onInputFocusChange:D,onSessionActive:Ue,onSessionInactive:mt,onSessionProcessing:Ie,onSessionNotProcessing:$t,processingSessions:v,onReplaceTemporarySession:Z,onNavigateToSession:S=>e(`/session/${S}`),onShowSettings:()=>L(!0),autoExpandTools:P,showRawParameters:R,showThinking:W,autoScrollToBottom:$,sendByCtrlEnter:ce,externalMessageUpdate:me})}),x&&t.jsx(o1,{activeTab:p,setActiveTab:g,isInputFocused:U}),p==="chat"&&t.jsx(m1,{isOpen:H,onToggle:j,autoExpandTools:P,onAutoExpandChange:M,showRawParameters:R,onShowRawParametersChange:w,showThinking:W,onShowThinkingChange:O,autoScrollToBottom:$,onAutoScrollChange:G,sendByCtrlEnter:ce,onSendByCtrlEnterChange:I,isMobile:x}),t.jsx(d1,{isOpen:B,onClose:()=>L(!1),projects:l}),t.jsx(ue,{})]})}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(or.StrictMode,{children:t.jsx(b1,{})}));
|