@rsktash/beads-ui 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -105,6 +105,17 @@ Normal `http(s)://` URLs in markdown are rendered as-is.
|
|
|
105
105
|
|
|
106
106
|
This keeps bead content portable across environments (local dev, staging, production) without rewriting markdown.
|
|
107
107
|
|
|
108
|
+
## Issue Mentions
|
|
109
|
+
|
|
110
|
+
Reference other issues in markdown using `#issue-id`:
|
|
111
|
+
|
|
112
|
+
```md
|
|
113
|
+
See #yuklar-985 for the original audit.
|
|
114
|
+
Depends on #yuklar-eb2 and #yuklar-g57.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
These are automatically rendered as clickable links to the issue detail page. Mentions inside existing links or code blocks are left unchanged.
|
|
118
|
+
|
|
108
119
|
## License
|
|
109
120
|
|
|
110
121
|
MIT
|
|
@@ -114,8 +114,8 @@ Please report this to https://github.com/markedjs/marked.`,i){const s="<p>An err
|
|
|
114
114
|
\f\r "&'<=>\``.split("")],[`\0
|
|
115
115
|
\f\r "&'<=>\``.split(""),`\0
|
|
116
116
|
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function D1(i,l,r,s){const u=s.schema,f=u.space==="svg"?!1:s.settings.omitOptionalTags;let d=u.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(i.tagName.toLowerCase());const g=[];let p;u.space==="html"&&i.tagName==="svg"&&(s.schema=o_);const m=L1(s,i.properties),y=s.all(u.space==="html"&&i.tagName==="template"?i.content:i);return s.schema=u,y&&(d=!1),(m||!f||!x1(i,l,r))&&(g.push("<",i.tagName,m?" "+m:""),d&&(u.space==="svg"||s.settings.closeSelfClosing)&&(p=m.charAt(m.length-1),(!s.settings.tightSelfClosing||p==="/"||p&&p!=='"'&&p!=="'")&&g.push(" "),g.push("/")),g.push(">")),g.push(y),!d&&(!f||!Df(i,l,r))&&g.push("</"+i.tagName+">"),g.join("")}function L1(i,l){const r=[];let s=-1,u;if(l){for(u in l)if(l[u]!==null&&l[u]!==void 0){const f=N1(i,u,l[u]);f&&r.push(f)}}for(;++s<r.length;){const f=i.settings.tightAttributes?r[s].charAt(r[s].length-1):void 0;s!==r.length-1&&f!=='"'&&f!=="'"&&(r[s]+=" ")}return r.join("")}function N1(i,l,r){const s=MS(i.schema,l),u=i.settings.allowParseErrors&&i.schema.space==="html"?0:1,f=i.settings.allowDangerousCharacters?0:1;let d=i.quote,g;if(s.overloadedBoolean&&(r===s.attribute||r==="")?r=!0:(s.boolean||s.overloadedBoolean)&&(typeof r!="string"||r===s.attribute||r==="")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";const p=Ya(s.attribute,Object.assign({},i.settings.characterReferences,{subset:Xs.name[u][f]}));return r===!0||(r=Array.isArray(r)?(s.commaSeparated?r1:s1)(r,{padLeft:!i.settings.tightCommaSeparatedLists}):String(r),i.settings.collapseEmptyAttributes&&!r)?p:(i.settings.preferUnquoted&&(g=Ya(r,Object.assign({},i.settings.characterReferences,{attribute:!0,subset:Xs.unquoted[u][f]}))),g!==r&&(i.settings.quoteSmart&&og(r,d)>og(r,i.alternative)&&(d=i.alternative),g=d+Ya(r,Object.assign({},i.settings.characterReferences,{subset:(d==="'"?Xs.single:Xs.double)[u][f],attribute:!0}))+d),p+(g&&"="+g))}const k1=["<","&"];function h_(i,l,r,s){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?i.value:Ya(i.value,Object.assign({},s.settings.characterReferences,{subset:k1}))}function w1(i,l,r,s){return s.settings.allowDangerousHtml?i.value:h_(i,l,r,s)}function M1(i,l,r,s){return s.all(i)}const z1=BS("type",{invalid:j1,unknown:U1,handlers:{comment:a1,doctype:i1,element:D1,raw:w1,root:M1,text:h_}});function j1(i){throw new Error("Expected node, not `"+i+"`")}function U1(i){const l=i;throw new Error("Cannot compile unknown node `"+l.type+"`")}const B1={},H1={},V1=[];function G1(i,l){const r=B1,s=r.quote||'"',u=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:I1,all:q1,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||CS,characterReferences:r.characterReferences||H1,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?o_:US,quote:s,alternative:u}.one(Array.isArray(i)?{type:"root",children:i}:i,void 0,void 0)}function I1(i,l,r){return z1(i,l,r,this)}function q1(i){const l=[],r=i&&i.children||V1;let s=-1;for(;++s<r.length;)l[s]=this.one(r[s],s,i);return l.join("")}function P1(i){return Array.isArray(i)?i:[i]}function go(i,l=!1){var f;const r=i.split(/(\r?\n)/g);let s=0;const u=[];for(let d=0;d<r.length;d+=2){const g=l?r[d]+(r[d+1]||""):r[d];u.push([g,s]),s+=r[d].length,s+=((f=r[d+1])==null?void 0:f.length)||0}return u}function Lf(i){return!i||["plaintext","txt","text","plain"].includes(i)}function m_(i){return i==="ansi"||Lf(i)}function Nf(i){return i==="none"}function p_(i){return Nf(i)}function g_(i,l){var s;if(!l)return i;i.properties||(i.properties={}),(s=i.properties).class||(s.class=[]),typeof i.properties.class=="string"&&(i.properties.class=i.properties.class.split(/\s+/g)),Array.isArray(i.properties.class)||(i.properties.class=[]);const r=Array.isArray(l)?l:l.split(/\s+/g);for(const u of r)u&&!i.properties.class.includes(u)&&i.properties.class.push(u);return i}function Y1(i,l){let r=0;const s=[];for(const u of l)u>r&&s.push({...i,content:i.content.slice(r,u),offset:i.offset+r}),r=u;return r<i.content.length&&s.push({...i,content:i.content.slice(r),offset:i.offset+r}),s}function X1(i,l){const r=Array.from(l instanceof Set?l:new Set(l)).sort((s,u)=>s-u);return r.length?i.map(s=>s.flatMap(u=>{const f=r.filter(d=>u.offset<d&&d<u.offset+u.content.length).map(d=>d-u.offset).sort((d,g)=>d-g);return f.length?Y1(u,f):u})):i}async function __(i){return Promise.resolve(typeof i=="function"?i():i).then(l=>l.default||l)}function so(i,l){const r=typeof i=="string"?{}:{...i.colorReplacements},s=typeof i=="string"?i:i.name;for(const[u,f]of Object.entries((l==null?void 0:l.colorReplacements)||{}))typeof f=="string"?r[u]=f:u===s&&Object.assign(r,f);return r}function ta(i,l){return i&&((l==null?void 0:l[i==null?void 0:i.toLowerCase()])||i)}function y_(i){const l={};return i.color&&(l.color=i.color),i.bgColor&&(l["background-color"]=i.bgColor),i.fontStyle&&(i.fontStyle&rl.Italic&&(l["font-style"]="italic"),i.fontStyle&rl.Bold&&(l["font-weight"]="bold"),i.fontStyle&rl.Underline&&(l["text-decoration"]="underline")),l}function Q1(i){return typeof i=="string"?i:Object.entries(i).map(([l,r])=>`${l}:${r}`).join(";")}function Z1(i){const l=go(i,!0).map(([u])=>u);function r(u){if(u===i.length)return{line:l.length-1,character:l[l.length-1].length};let f=u,d=0;for(const g of l){if(f<g.length)break;f-=g.length,d++}return{line:d,character:f}}function s(u,f){let d=0;for(let g=0;g<u;g++)d+=l[g].length;return d+=f,d}return{lines:l,indexToPos:r,posToIndex:s}}class Rt extends Error{constructor(l){super(l),this.name="ShikiError"}}const v_=new WeakMap;function _o(i,l){v_.set(i,l)}function mr(i){return v_.get(i)}class Ka{constructor(...l){w(this,"_stacks",{});w(this,"lang");if(l.length===2){const[r,s]=l;this.lang=s,this._stacks=r}else{const[r,s,u]=l;this.lang=s,this._stacks={[u]:r}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(l,r){return new Ka(Object.fromEntries(P1(r).map(s=>[s,af])),l)}getInternalStack(l=this.theme){return this._stacks[l]}get scopes(){return dg(this._stacks[this.theme])}getScopes(l=this.theme){return dg(this._stacks[l])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function dg(i){const l=[],r=new Set;function s(u){var d;if(r.has(u))return;r.add(u);const f=(d=u==null?void 0:u.nameScopesList)==null?void 0:d.scopeName;f&&l.push(f),u.parent&&s(u.parent)}return s(i),l}function K1(i,l){if(!(i instanceof Ka))throw new Rt("Invalid grammar state");return i.getInternalStack(l)}function $1(){const i=new WeakMap;function l(r){if(!i.has(r.meta)){let s=function(d){if(typeof d=="number"){if(d<0||d>r.source.length)throw new Rt(`Invalid decoration offset: ${d}. Code length: ${r.source.length}`);return{...u.indexToPos(d),offset:d}}else{const g=u.lines[d.line];if(g===void 0)throw new Rt(`Invalid decoration position ${JSON.stringify(d)}. Lines length: ${u.lines.length}`);if(d.character<0||d.character>g.length)throw new Rt(`Invalid decoration position ${JSON.stringify(d)}. Line ${d.line} length: ${g.length}`);return{...d,offset:u.posToIndex(d.line,d.character)}}};const u=Z1(r.source),f=(r.options.decorations||[]).map(d=>({...d,start:s(d.start),end:s(d.end)}));J1(f),i.set(r.meta,{decorations:f,converter:u,source:r.source})}return i.get(r.meta)}return{name:"shiki:decorations",tokens(r){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const u=l(this).decorations.flatMap(g=>[g.start.offset,g.end.offset]);return X1(r,u)},code(r){var y;if(!((y=this.options.decorations)!=null&&y.length))return;const s=l(this),u=Array.from(r.children).filter(b=>b.type==="element"&&b.tagName==="span");if(u.length!==s.converter.lines.length)throw new Rt(`Number of lines in code element (${u.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function f(b,E,A,D){const B=u[b];let P="",V=-1,I=-1;if(E===0&&(V=0),A===0&&(I=0),A===Number.POSITIVE_INFINITY&&(I=B.children.length),V===-1||I===-1)for(let Z=0;Z<B.children.length;Z++)P+=b_(B.children[Z]),V===-1&&P.length===E&&(V=Z+1),I===-1&&P.length===A&&(I=Z+1);if(V===-1)throw new Rt(`Failed to find start index for decoration ${JSON.stringify(D.start)}`);if(I===-1)throw new Rt(`Failed to find end index for decoration ${JSON.stringify(D.end)}`);const Y=B.children.slice(V,I);if(!D.alwaysWrap&&Y.length===B.children.length)g(B,D,"line");else if(!D.alwaysWrap&&Y.length===1&&Y[0].type==="element")g(Y[0],D,"token");else{const Z={type:"element",tagName:"span",properties:{},children:Y};g(Z,D,"wrapper"),B.children.splice(V,Y.length,Z)}}function d(b,E){u[b]=g(u[b],E,"line")}function g(b,E,A){var P;const D=E.properties||{},B=E.transform||(V=>V);return b.tagName=E.tagName||"span",b.properties={...b.properties,...D,class:b.properties.class},(P=E.properties)!=null&&P.class&&g_(b,E.properties.class),b=B(b,A)||b,b}const p=[],m=s.decorations.sort((b,E)=>E.start.offset-b.start.offset);for(const b of m){const{start:E,end:A}=b;if(E.line===A.line)f(E.line,E.character,A.character,b);else if(E.line<A.line){f(E.line,E.character,Number.POSITIVE_INFINITY,b);for(let D=E.line+1;D<A.line;D++)p.unshift(()=>d(D,b));f(A.line,0,A.character,b)}}p.forEach(b=>b())}}}function J1(i){for(let l=0;l<i.length;l++){const r=i[l];if(r.start.offset>r.end.offset)throw new Rt(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);for(let s=l+1;s<i.length;s++){const u=i[s],f=r.start.offset<u.start.offset&&u.start.offset<r.end.offset,d=r.start.offset<u.end.offset&&u.end.offset<r.end.offset,g=u.start.offset<r.start.offset&&r.start.offset<u.end.offset,p=u.start.offset<r.end.offset&&r.end.offset<u.end.offset;if(f||d||g||p){if(d&&d||g&&p)continue;throw new Rt(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(u.start)} intersect.`)}}}}function b_(i){return i.type==="text"?i.value:i.type==="element"?i.children.map(b_).join(""):""}const W1=[$1()];function oo(i){return[...i.transformers||[],...W1]}var na=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Xc={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function F1(i,l){const r=i.indexOf("\x1B[",l);if(r!==-1){const s=i.indexOf("m",r);return{sequence:i.substring(r+2,s).split(";"),startPosition:r,position:s+1}}return{position:i.length}}function hg(i,l){let r=1;const s=i[l+r++];let u;if(s==="2"){const f=[i[l+r++],i[l+r++],i[l+r]].map(d=>Number.parseInt(d));f.length===3&&!f.some(d=>Number.isNaN(d))&&(u={type:"rgb",rgb:f})}else if(s==="5"){const f=Number.parseInt(i[l+r]);Number.isNaN(f)||(u={type:"table",index:Number(f)})}return[r,u]}function eE(i){const l=[];for(let r=0;r<i.length;r++){const s=i[r],u=Number.parseInt(s);if(!Number.isNaN(u))if(u===0)l.push({type:"resetAll"});else if(u<=9)Xc[u]&&l.push({type:"setDecoration",value:Xc[u]});else if(u<=29){const f=Xc[u-20];f&&l.push({type:"resetDecoration",value:f})}else if(u<=37)l.push({type:"setForegroundColor",value:{type:"named",name:na[u-30]}});else if(u===38){const[f,d]=hg(i,r);d&&l.push({type:"setForegroundColor",value:d}),r+=f}else if(u===39)l.push({type:"resetForegroundColor"});else if(u<=47)l.push({type:"setBackgroundColor",value:{type:"named",name:na[u-40]}});else if(u===48){const[f,d]=hg(i,r);d&&l.push({type:"setBackgroundColor",value:d}),r+=f}else u===49?l.push({type:"resetBackgroundColor"}):u>=90&&u<=97?l.push({type:"setForegroundColor",value:{type:"named",name:na[u-90+8]}}):u>=100&&u<=107&&l.push({type:"setBackgroundColor",value:{type:"named",name:na[u-100+8]}})}return l}function tE(){let i=null,l=null,r=new Set;return{parse(s){const u=[];let f=0;do{const d=F1(s,f),g=d.sequence?s.substring(f,d.startPosition):s.substring(f);if(g.length>0&&u.push({value:g,foreground:i,background:l,decorations:new Set(r)}),d.sequence){const p=eE(d.sequence);for(const m of p)m.type==="resetAll"?(i=null,l=null,r.clear()):m.type==="resetForegroundColor"?i=null:m.type==="resetBackgroundColor"?l=null:m.type==="resetDecoration"&&r.delete(m.value);for(const m of p)m.type==="setForegroundColor"?i=m.value:m.type==="setBackgroundColor"?l=m.value:m.type==="setDecoration"&&r.add(m.value)}f=d.position}while(f<s.length);return u}}}var nE={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function lE(i=nE){function l(g){return i[g]}function r(g){return`#${g.map(p=>Math.max(0,Math.min(p,255)).toString(16).padStart(2,"0")).join("")}`}let s;function u(){if(s)return s;s=[];for(let m=0;m<na.length;m++)s.push(l(na[m]));let g=[0,95,135,175,215,255];for(let m=0;m<6;m++)for(let y=0;y<6;y++)for(let b=0;b<6;b++)s.push(r([g[m],g[y],g[b]]));let p=8;for(let m=0;m<24;m++,p+=10)s.push(r([p,p,p]));return s}function f(g){return u()[g]}function d(g){switch(g.type){case"named":return l(g.name);case"rgb":return r(g.rgb);case"table":return f(g.index)}}return{value:d}}function aE(i,l,r){const s=so(i,r),u=go(l),f=lE(Object.fromEntries(na.map(g=>{var p;return[g,(p=i.colors)==null?void 0:p[`terminal.ansi${g[0].toUpperCase()}${g.substring(1)}`]]}))),d=tE();return u.map(g=>d.parse(g[0]).map(p=>{let m,y;p.decorations.has("reverse")?(m=p.background?f.value(p.background):i.bg,y=p.foreground?f.value(p.foreground):i.fg):(m=p.foreground?f.value(p.foreground):i.fg,y=p.background?f.value(p.background):void 0),m=ta(m,s),y=ta(y,s),p.decorations.has("dim")&&(m=iE(m));let b=rl.None;return p.decorations.has("bold")&&(b|=rl.Bold),p.decorations.has("italic")&&(b|=rl.Italic),p.decorations.has("underline")&&(b|=rl.Underline),{content:p.value,offset:g[1],color:m,bgColor:y,fontStyle:b}}))}function iE(i){const l=i.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(l)if(l[3]){const s=Math.round(Number.parseInt(l[3],16)/2).toString(16).padStart(2,"0");return`#${l[1]}${l[2]}${s}`}else return l[2]?`#${l[1]}${l[2]}80`:`#${Array.from(l[1]).map(s=>`${s}${s}`).join("")}80`;const r=i.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return r?`var(${r[1]}-dim)`:i}function kf(i,l,r={}){const{lang:s="text",theme:u=i.getLoadedThemes()[0]}=r;if(Lf(s)||Nf(u))return go(l).map(p=>[{content:p[0],offset:p[1]}]);const{theme:f,colorMap:d}=i.setTheme(u);if(s==="ansi")return aE(f,l,r);const g=i.getLanguage(s);if(r.grammarState){if(r.grammarState.lang!==g.name)throw new sl(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${g.name}"`);if(!r.grammarState.themes.includes(f.name))throw new sl(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${f.name}"`)}return sE(l,g,f,d,r)}function rE(...i){if(i.length===2)return mr(i[1]);const[l,r,s={}]=i,{lang:u="text",theme:f=l.getLoadedThemes()[0]}=s;if(Lf(u)||Nf(f))throw new sl("Plain language does not have grammar state");if(u==="ansi")throw new sl("ANSI language does not have grammar state");const{theme:d,colorMap:g}=l.setTheme(f),p=l.getLanguage(u);return new Ka(uo(r,p,d,g,s).stateStack,p.name,d.name)}function sE(i,l,r,s,u){const f=uo(i,l,r,s,u),d=new Ka(uo(i,l,r,s,u).stateStack,l.name,r.name);return _o(f.tokens,d),f.tokens}function uo(i,l,r,s,u){const f=so(r,u),{tokenizeMaxLineLength:d=0,tokenizeTimeLimit:g=500}=u,p=go(i);let m=u.grammarState?K1(u.grammarState,r.name)??af:u.grammarContextCode!=null?uo(u.grammarContextCode,l,r,s,{...u,grammarState:void 0,grammarContextCode:void 0}).stateStack:af,y=[];const b=[];for(let E=0,A=p.length;E<A;E++){const[D,B]=p[E];if(D===""){y=[],b.push([]);continue}if(d>0&&D.length>=d){y=[],b.push([{content:D,offset:B,color:"",fontStyle:0}]);continue}let P,V,I;u.includeExplanation&&(P=l.tokenizeLine(D,m),V=P.tokens,I=0);const Y=l.tokenizeLine2(D,m,g),Z=Y.tokens.length/2;for(let ae=0;ae<Z;ae++){const fe=Y.tokens[2*ae],te=ae+1<Z?Y.tokens[2*ae+2]:D.length;if(fe===te)continue;const Ue=Y.tokens[2*ae+1],pt=ta(s[Qa.getForeground(Ue)],f),Lt=Qa.getFontStyle(Ue),Re={content:D.substring(fe,te),offset:B+fe,color:pt,fontStyle:Lt};if(u.includeExplanation){const Ke=[];if(u.includeExplanation!=="scopeName")for(const Ye of r.settings){let Fe;switch(typeof Ye.scope){case"string":Fe=Ye.scope.split(/,/).map(z=>z.trim());break;case"object":Fe=Ye.scope;break;default:continue}Ke.push({settings:Ye,selectors:Fe.map(z=>z.split(/ /))})}Re.explanation=[];let Nt=0;for(;fe+Nt<te;){const Ye=V[I],Fe=D.substring(Ye.startIndex,Ye.endIndex);Nt+=Fe.length,Re.explanation.push({content:Fe,scopes:u.includeExplanation==="scopeName"?oE(Ye.scopes):uE(Ke,Ye.scopes)}),I+=1}}y.push(Re)}b.push(y),y=[],m=Y.ruleStack}return{tokens:b,stateStack:m}}function oE(i){return i.map(l=>({scopeName:l}))}function uE(i,l){const r=[];for(let s=0,u=l.length;s<u;s++){const f=l[s];r[s]={scopeName:f,themeMatches:fE(i,f,l.slice(0,s))}}return r}function mg(i,l){return i===l||l.substring(0,i.length)===i&&l[i.length]==="."}function cE(i,l,r){if(!mg(i[i.length-1],l))return!1;let s=i.length-2,u=r.length-1;for(;s>=0&&u>=0;)mg(i[s],r[u])&&(s-=1),u-=1;return s===-1}function fE(i,l,r){const s=[];for(const{selectors:u,settings:f}of i)for(const d of u)if(cE(d,l,r)){s.push(f);break}return s}function S_(i,l,r){const s=Object.entries(r.themes).filter(p=>p[1]).map(p=>({color:p[0],theme:p[1]})),u=s.map(p=>{const m=kf(i,l,{...r,theme:p.theme}),y=mr(m),b=typeof p.theme=="string"?p.theme:p.theme.name;return{tokens:m,state:y,theme:b}}),f=dE(...u.map(p=>p.tokens)),d=f[0].map((p,m)=>p.map((y,b)=>{const E={content:y.content,variants:{},offset:y.offset};return"includeExplanation"in r&&r.includeExplanation&&(E.explanation=y.explanation),f.forEach((A,D)=>{const{content:B,explanation:P,offset:V,...I}=A[m][b];E.variants[s[D].color]=I}),E})),g=u[0].state?new Ka(Object.fromEntries(u.map(p=>{var m;return[p.theme,(m=p.state)==null?void 0:m.getInternalStack(p.theme)]})),u[0].state.lang):void 0;return g&&_o(d,g),d}function dE(...i){const l=i.map(()=>[]),r=i.length;for(let s=0;s<i[0].length;s++){const u=i.map(p=>p[s]),f=l.map(()=>[]);l.forEach((p,m)=>p.push(f[m]));const d=u.map(()=>0),g=u.map(p=>p[0]);for(;g.every(p=>p);){const p=Math.min(...g.map(m=>m.content.length));for(let m=0;m<r;m++){const y=g[m];y.content.length===p?(f[m].push(y),d[m]+=1,g[m]=u[m][d[m]]):(f[m].push({...y,content:y.content.slice(0,p)}),g[m]={...y,content:y.content.slice(p),offset:y.offset+p})}}}return l}function co(i,l,r){let s,u,f,d,g,p;if("themes"in r){const{defaultColor:m="light",cssVariablePrefix:y="--shiki-"}=r,b=Object.entries(r.themes).filter(P=>P[1]).map(P=>({color:P[0],theme:P[1]})).sort((P,V)=>P.color===m?-1:V.color===m?1:0);if(b.length===0)throw new sl("`themes` option must not be empty");const E=S_(i,l,r);if(p=mr(E),m&&!b.find(P=>P.color===m))throw new sl(`\`themes\` option must contain the defaultColor key \`${m}\``);const A=b.map(P=>i.getTheme(P.theme)),D=b.map(P=>P.color);f=E.map(P=>P.map(V=>hE(V,D,y,m))),p&&_o(f,p);const B=b.map(P=>so(P.theme,r));u=b.map((P,V)=>(V===0&&m?"":`${y+P.color}:`)+(ta(A[V].fg,B[V])||"inherit")).join(";"),s=b.map((P,V)=>(V===0&&m?"":`${y+P.color}-bg:`)+(ta(A[V].bg,B[V])||"inherit")).join(";"),d=`shiki-themes ${A.map(P=>P.name).join(" ")}`,g=m?void 0:[u,s].join(";")}else if("theme"in r){const m=so(r.theme,r);f=kf(i,l,r);const y=i.getTheme(r.theme);s=ta(y.bg,m),u=ta(y.fg,m),d=y.name,p=mr(f)}else throw new sl("Invalid options, either `theme` or `themes` must be provided");return{tokens:f,fg:u,bg:s,themeName:d,rootStyle:g,grammarState:p}}function hE(i,l,r,s){const u={content:i.content,explanation:i.explanation,offset:i.offset},f=l.map(p=>y_(i.variants[p])),d=new Set(f.flatMap(p=>Object.keys(p))),g={};return f.forEach((p,m)=>{for(const y of d){const b=p[y]||"inherit";if(m===0&&s)g[y]=b;else{const E=y==="color"?"":y==="background-color"?"-bg":`-${y}`,A=r+l[m]+(y==="color"?"":E);g[A]=b}}}),u.htmlStyle=g,u}function fo(i,l,r,s={meta:{},options:r,codeToHast:(u,f)=>fo(i,u,f),codeToTokens:(u,f)=>co(i,u,f)}){var A,D;let u=l;for(const B of oo(r))u=((A=B.preprocess)==null?void 0:A.call(s,u,r))||u;let{tokens:f,fg:d,bg:g,themeName:p,rootStyle:m,grammarState:y}=co(i,u,r);const{mergeWhitespaces:b=!0}=r;b===!0?f=pE(f):b==="never"&&(f=gE(f));const E={...s,get source(){return u}};for(const B of oo(r))f=((D=B.tokens)==null?void 0:D.call(E,f))||f;return mE(f,{...r,fg:d,bg:g,themeName:p,rootStyle:m},E,y)}function mE(i,l,r,s=mr(i)){var D,B,P;const u=oo(l),f=[],d={type:"root",children:[]},{structure:g="classic",tabindex:p="0"}=l;let m={type:"element",tagName:"pre",properties:{class:`shiki ${l.themeName||""}`,style:l.rootStyle||`background-color:${l.bg};color:${l.fg}`,...p!==!1&&p!=null?{tabindex:p.toString()}:{},...Object.fromEntries(Array.from(Object.entries(l.meta||{})).filter(([V])=>!V.startsWith("_")))},children:[]},y={type:"element",tagName:"code",properties:{},children:f};const b=[],E={...r,structure:g,addClassToHast:g_,get source(){return r.source},get tokens(){return i},get options(){return l},get root(){return d},get pre(){return m},get code(){return y},get lines(){return b}};if(i.forEach((V,I)=>{var ae,fe;I&&(g==="inline"?d.children.push({type:"element",tagName:"br",properties:{},children:[]}):g==="classic"&&f.push({type:"text",value:`
|
|
117
|
-
`}));let Y={type:"element",tagName:"span",properties:{class:"line"},children:[]},Z=0;for(const te of V){let Ue={type:"element",tagName:"span",properties:{...te.htmlAttrs},children:[{type:"text",value:te.content}]};te.htmlStyle;const pt=Q1(te.htmlStyle||y_(te));pt&&(Ue.properties.style=pt);for(const Lt of u)Ue=((ae=Lt==null?void 0:Lt.span)==null?void 0:ae.call(E,Ue,I+1,Z,Y,te))||Ue;g==="inline"?d.children.push(Ue):g==="classic"&&Y.children.push(Ue),Z+=te.content.length}if(g==="classic"){for(const te of u)Y=((fe=te==null?void 0:te.line)==null?void 0:fe.call(E,Y,I+1))||Y;b.push(Y),f.push(Y)}}),g==="classic"){for(const V of u)y=((D=V==null?void 0:V.code)==null?void 0:D.call(E,y))||y;m.children.push(y);for(const V of u)m=((B=V==null?void 0:V.pre)==null?void 0:B.call(E,m))||m;d.children.push(m)}let A=d;for(const V of u)A=((P=V==null?void 0:V.root)==null?void 0:P.call(E,A))||A;return s&&_o(A,s),A}function pE(i){return i.map(l=>{const r=[];let s="",u=0;return l.forEach((f,d)=>{const p=!(f.fontStyle&&f.fontStyle&rl.Underline);p&&f.content.match(/^\s+$/)&&l[d+1]?(u||(u=f.offset),s+=f.content):s?(p?r.push({...f,offset:u,content:s+f.content}):r.push({content:s,offset:u},f),u=0,s=""):r.push(f)}),r})}function gE(i){return i.map(l=>l.flatMap(r=>{if(r.content.match(/^\s+$/))return r;const s=r.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return r;const[,u,f,d]=s;if(!u&&!d)return r;const g=[{...r,offset:r.offset+u.length,content:f}];return u&&g.unshift({content:u,offset:r.offset}),d&&g.push({content:d,offset:r.offset+u.length+f.length}),g}))}function _E(i,l,r){var f;const s={meta:{},options:r,codeToHast:(d,g)=>fo(i,d,g),codeToTokens:(d,g)=>co(i,d,g)};let u=G1(fo(i,l,r,s));for(const d of oo(r))u=((f=d.postprocess)==null?void 0:f.call(s,u,r))||u;return u}const pg={light:"#333333",dark:"#bbbbbb"},gg={light:"#fffffe",dark:"#1e1e1e"},_g="__shiki_resolved";function wf(i){var g,p,m,y,b;if(i!=null&&i[_g])return i;const l={...i};l.tokenColors&&!l.settings&&(l.settings=l.tokenColors,delete l.tokenColors),l.type||(l.type="dark"),l.colorReplacements={...l.colorReplacements},l.settings||(l.settings=[]);let{bg:r,fg:s}=l;if(!r||!s){const E=l.settings?l.settings.find(A=>!A.name&&!A.scope):void 0;(g=E==null?void 0:E.settings)!=null&&g.foreground&&(s=E.settings.foreground),(p=E==null?void 0:E.settings)!=null&&p.background&&(r=E.settings.background),!s&&((m=l==null?void 0:l.colors)!=null&&m["editor.foreground"])&&(s=l.colors["editor.foreground"]),!r&&((y=l==null?void 0:l.colors)!=null&&y["editor.background"])&&(r=l.colors["editor.background"]),s||(s=l.type==="light"?pg.light:pg.dark),r||(r=l.type==="light"?gg.light:gg.dark),l.fg=s,l.bg=r}l.settings[0]&&l.settings[0].settings&&!l.settings[0].scope||l.settings.unshift({settings:{foreground:l.fg,background:l.bg}});let u=0;const f=new Map;function d(E){var D;if(f.has(E))return f.get(E);u+=1;const A=`#${u.toString(16).padStart(8,"0").toLowerCase()}`;return(D=l.colorReplacements)!=null&&D[`#${A}`]?d(E):(f.set(E,A),A)}l.settings=l.settings.map(E=>{var P,V;const A=((P=E.settings)==null?void 0:P.foreground)&&!E.settings.foreground.startsWith("#"),D=((V=E.settings)==null?void 0:V.background)&&!E.settings.background.startsWith("#");if(!A&&!D)return E;const B={...E,settings:{...E.settings}};if(A){const I=d(E.settings.foreground);l.colorReplacements[I]=E.settings.foreground,B.settings.foreground=I}if(D){const I=d(E.settings.background);l.colorReplacements[I]=E.settings.background,B.settings.background=I}return B});for(const E of Object.keys(l.colors||{}))if((E==="editor.foreground"||E==="editor.background"||E.startsWith("terminal.ansi"))&&!((b=l.colors[E])!=null&&b.startsWith("#"))){const A=d(l.colors[E]);l.colorReplacements[A]=l.colors[E],l.colors[E]=A}return Object.defineProperty(l,_g,{enumerable:!1,writable:!1,value:!0}),l}async function E_(i){return Array.from(new Set((await Promise.all(i.filter(l=>!m_(l)).map(async l=>await __(l).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function x_(i){return(await Promise.all(i.map(async r=>p_(r)?null:wf(await __(r))))).filter(r=>!!r)}class yE extends OS{constructor(r,s,u,f={}){super(r);w(this,"_resolvedThemes",new Map);w(this,"_resolvedGrammars",new Map);w(this,"_langMap",new Map);w(this,"_langGraph",new Map);w(this,"_textmateThemeCache",new WeakMap);w(this,"_loadedThemesCache",null);w(this,"_loadedLanguagesCache",null);this._resolver=r,this._themes=s,this._langs=u,this._alias=f,this._themes.map(d=>this.loadTheme(d)),this.loadLanguages(this._langs)}getTheme(r){return typeof r=="string"?this._resolvedThemes.get(r):this.loadTheme(r)}loadTheme(r){const s=wf(r);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(r){let s=this._textmateThemeCache.get(r);s||(s=no.createFromRawTheme(r),this._textmateThemeCache.set(r,s)),this._syncRegistry.setTheme(s)}getGrammar(r){if(this._alias[r]){const s=new Set([r]);for(;this._alias[r];){if(r=this._alias[r],s.has(r))throw new Rt(`Circular alias \`${Array.from(s).join(" -> ")} -> ${r}\``);s.add(r)}}return this._resolvedGrammars.get(r)}loadLanguage(r){var d,g,p,m;if(this.getGrammar(r.name))return;const s=new Set([...this._langMap.values()].filter(y=>{var b;return(b=y.embeddedLangsLazy)==null?void 0:b.includes(r.name)}));this._resolver.addLanguage(r);const u={balancedBracketSelectors:r.balancedBracketSelectors||["*"],unbalancedBracketSelectors:r.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(r.scopeName,r);const f=this.loadGrammarWithConfiguration(r.scopeName,1,u);if(f.name=r.name,this._resolvedGrammars.set(r.name,f),r.aliases&&r.aliases.forEach(y=>{this._alias[y]=r.name}),this._loadedLanguagesCache=null,s.size)for(const y of s)this._resolvedGrammars.delete(y.name),this._loadedLanguagesCache=null,(g=(d=this._syncRegistry)==null?void 0:d._injectionGrammars)==null||g.delete(y.scopeName),(m=(p=this._syncRegistry)==null?void 0:p._grammars)==null||m.delete(y.scopeName),this.loadLanguage(this._langMap.get(y.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(r){for(const f of r)this.resolveEmbeddedLanguages(f);const s=Array.from(this._langGraph.entries()),u=s.filter(([f,d])=>!d);if(u.length){const f=s.filter(([d,g])=>{var p;return g&&((p=g.embeddedLangs)==null?void 0:p.some(m=>u.map(([y])=>y).includes(m)))}).filter(d=>!u.includes(d));throw new Rt(`Missing languages ${u.map(([d])=>`\`${d}\``).join(", ")}, required by ${f.map(([d])=>`\`${d}\``).join(", ")}`)}for(const[f,d]of s)this._resolver.addLanguage(d);for(const[f,d]of s)this.loadLanguage(d)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(r){if(this._langMap.set(r.name,r),this._langGraph.set(r.name,r),r.embeddedLangs)for(const s of r.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class vE{constructor(l,r){w(this,"_langs",new Map);w(this,"_scopeToLang",new Map);w(this,"_injections",new Map);w(this,"_onigLib");this._onigLib={createOnigScanner:s=>l.createScanner(s),createOnigString:s=>l.createString(s)},r.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(l){return this._langs.get(l)}loadGrammar(l){return this._scopeToLang.get(l)}addLanguage(l){this._langs.set(l.name,l),l.aliases&&l.aliases.forEach(r=>{this._langs.set(r,l)}),this._scopeToLang.set(l.scopeName,l),l.injectTo&&l.injectTo.forEach(r=>{this._injections.get(r)||this._injections.set(r,[]),this._injections.get(r).push(l.scopeName)})}getInjections(l){const r=l.split(".");let s=[];for(let u=1;u<=r.length;u++){const f=r.slice(0,u).join(".");s=[...s,...this._injections.get(f)||[]]}return s}}let ir=0;function bE(i){ir+=1,i.warnings!==!1&&ir>=10&&ir%10===0&&console.warn(`[Shiki] ${ir} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let l=!1;if(!i.engine)throw new Rt("`engine` option is required for synchronous mode");const r=(i.langs||[]).flat(1),s=(i.themes||[]).flat(1).map(wf),u=new vE(i.engine,r),f=new yE(u,s,r,i.langAlias);let d;function g(I){P();const Y=f.getGrammar(typeof I=="string"?I:I.name);if(!Y)throw new Rt(`Language \`${I}\` not found, you may need to load it first`);return Y}function p(I){if(I==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};P();const Y=f.getTheme(I);if(!Y)throw new Rt(`Theme \`${I}\` not found, you may need to load it first`);return Y}function m(I){P();const Y=p(I);d!==I&&(f.setTheme(Y),d=I);const Z=f.getColorMap();return{theme:Y,colorMap:Z}}function y(){return P(),f.getLoadedThemes()}function b(){return P(),f.getLoadedLanguages()}function E(...I){P(),f.loadLanguages(I.flat(1))}async function A(...I){return E(await E_(I))}function D(...I){P();for(const Y of I.flat(1))f.loadTheme(Y)}async function B(...I){return P(),D(await x_(I))}function P(){if(l)throw new Rt("Shiki instance has been disposed")}function V(){l||(l=!0,f.dispose(),ir-=1)}return{setTheme:m,getTheme:p,getLanguage:g,getLoadedThemes:y,getLoadedLanguages:b,loadLanguage:A,loadLanguageSync:E,loadTheme:B,loadThemeSync:D,dispose:V,[Symbol.dispose]:V}}async function SE(i={}){i.loadWasm;const[l,r,s]=await Promise.all([x_(i.themes||[]),E_(i.langs||[]),i.engine||Hg(i.loadWasm||Gb())]);return bE({...i,themes:l,langs:r,engine:s})}async function EE(i={}){const l=await SE(i);return{getLastGrammarState:(...r)=>rE(l,...r),codeToTokensBase:(r,s)=>kf(l,r,s),codeToTokensWithThemes:(r,s)=>S_(l,r,s),codeToTokens:(r,s)=>co(l,r,s),codeToHast:(r,s)=>fo(l,r,s),codeToHtml:(r,s)=>_E(l,r,s),...l,getInternalContext:()=>l}}function xE(i,l,r){let s,u,f;{const g=i;s=g.langs,u=g.themes,f=g.engine}async function d(g){function p(A){if(typeof A=="string"){if(m_(A))return[];const D=s[A];if(!D)throw new sl(`Language \`${A}\` is not included in this bundle. You may want to load it from external source.`);return D}return A}function m(A){if(p_(A))return"none";if(typeof A=="string"){const D=u[A];if(!D)throw new sl(`Theme \`${A}\` is not included in this bundle. You may want to load it from external source.`);return D}return A}const y=(g.themes??[]).map(A=>m(A)),b=(g.langs??[]).map(A=>p(A)),E=await EE({engine:g.engine??f(),...g,themes:y,langs:b});return{...E,loadLanguage(...A){return E.loadLanguage(...A.map(p))},loadTheme(...A){return E.loadTheme(...A.map(m))}}}return d}function TE(i){let l;async function r(s={}){if(l){const u=await l;return await Promise.all([u.loadTheme(...s.themes||[]),u.loadLanguage(...s.langs||[])]),u}else return l=i({...s,themes:s.themes||[],langs:s.langs||[]}),l}return r}function AE(i){const l=TE(i);return{getSingletonHighlighter(r){return l(r)},async codeToHtml(r,s){return(await l({langs:[s.lang],themes:"theme"in s?[s.theme]:Object.values(s.themes)})).codeToHtml(r,s)},async codeToHast(r,s){return(await l({langs:[s.lang],themes:"theme"in s?[s.theme]:Object.values(s.themes)})).codeToHast(r,s)},async codeToTokens(r,s){return(await l({langs:[s.lang],themes:"theme"in s?[s.theme]:Object.values(s.themes)})).codeToTokens(r,s)},async codeToTokensBase(r,s){return(await l({langs:[s.lang],themes:[s.theme]})).codeToTokensBase(r,s)},async codeToTokensWithThemes(r,s){return(await l({langs:[s.lang],themes:Object.values(s.themes).filter(Boolean)})).codeToTokensWithThemes(r,s)},async getLastGrammarState(r,s){return(await l({langs:[s.lang],themes:[s.theme]})).getLastGrammarState(r,s)}}}const RE=xE({langs:Sb,themes:xb,engine:()=>Hg(v(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:OE}=AE(RE);let rr=null;async function CE(){if(rr!==null)return rr;try{rr=(await(await fetch("/api/config")).json()).fileAttachmentBaseUrl||""}catch{rr=""}return rr}function DE(i,l){return l?i.replace(/attach:\/\/([^\s)]+)/g,(r,s)=>`${l}/${s}`):i}function yg({content:i}){const[l,r]=F.useState("");return F.useEffect(()=>{if(!i){r("");return}let s=!1;async function u(){const f=await CE(),d=DE(i,f),g=Ae.lexer(d),p=[];Ae.walkTokens(g,A=>{A.type==="code"&&p.push({code:A.text,lang:A.lang||"text"})});const m=await Promise.all(p.map(async A=>{try{return await OE(A.code,{lang:A.lang,theme:"github-light"})}catch{return`<pre><code>${Zp.sanitize(A.code)}</code></pre>`}}));let y=Ae.parser(g),b=0;y=y.replace(/<pre><code[^>]*>[\s\S]*?<\/code><\/pre>/g,()=>m[b++]||"");const E=Zp.sanitize(y,{ADD_TAGS:["span"],ADD_ATTR:["style","class"]});s||r(E)}return u(),()=>{s=!0}},[i]),S.jsx("div",{className:`prose prose-stone prose-sm max-w-none
|
|
117
|
+
`}));let Y={type:"element",tagName:"span",properties:{class:"line"},children:[]},Z=0;for(const te of V){let Ue={type:"element",tagName:"span",properties:{...te.htmlAttrs},children:[{type:"text",value:te.content}]};te.htmlStyle;const pt=Q1(te.htmlStyle||y_(te));pt&&(Ue.properties.style=pt);for(const Lt of u)Ue=((ae=Lt==null?void 0:Lt.span)==null?void 0:ae.call(E,Ue,I+1,Z,Y,te))||Ue;g==="inline"?d.children.push(Ue):g==="classic"&&Y.children.push(Ue),Z+=te.content.length}if(g==="classic"){for(const te of u)Y=((fe=te==null?void 0:te.line)==null?void 0:fe.call(E,Y,I+1))||Y;b.push(Y),f.push(Y)}}),g==="classic"){for(const V of u)y=((D=V==null?void 0:V.code)==null?void 0:D.call(E,y))||y;m.children.push(y);for(const V of u)m=((B=V==null?void 0:V.pre)==null?void 0:B.call(E,m))||m;d.children.push(m)}let A=d;for(const V of u)A=((P=V==null?void 0:V.root)==null?void 0:P.call(E,A))||A;return s&&_o(A,s),A}function pE(i){return i.map(l=>{const r=[];let s="",u=0;return l.forEach((f,d)=>{const p=!(f.fontStyle&&f.fontStyle&rl.Underline);p&&f.content.match(/^\s+$/)&&l[d+1]?(u||(u=f.offset),s+=f.content):s?(p?r.push({...f,offset:u,content:s+f.content}):r.push({content:s,offset:u},f),u=0,s=""):r.push(f)}),r})}function gE(i){return i.map(l=>l.flatMap(r=>{if(r.content.match(/^\s+$/))return r;const s=r.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return r;const[,u,f,d]=s;if(!u&&!d)return r;const g=[{...r,offset:r.offset+u.length,content:f}];return u&&g.unshift({content:u,offset:r.offset}),d&&g.push({content:d,offset:r.offset+u.length+f.length}),g}))}function _E(i,l,r){var f;const s={meta:{},options:r,codeToHast:(d,g)=>fo(i,d,g),codeToTokens:(d,g)=>co(i,d,g)};let u=G1(fo(i,l,r,s));for(const d of oo(r))u=((f=d.postprocess)==null?void 0:f.call(s,u,r))||u;return u}const pg={light:"#333333",dark:"#bbbbbb"},gg={light:"#fffffe",dark:"#1e1e1e"},_g="__shiki_resolved";function wf(i){var g,p,m,y,b;if(i!=null&&i[_g])return i;const l={...i};l.tokenColors&&!l.settings&&(l.settings=l.tokenColors,delete l.tokenColors),l.type||(l.type="dark"),l.colorReplacements={...l.colorReplacements},l.settings||(l.settings=[]);let{bg:r,fg:s}=l;if(!r||!s){const E=l.settings?l.settings.find(A=>!A.name&&!A.scope):void 0;(g=E==null?void 0:E.settings)!=null&&g.foreground&&(s=E.settings.foreground),(p=E==null?void 0:E.settings)!=null&&p.background&&(r=E.settings.background),!s&&((m=l==null?void 0:l.colors)!=null&&m["editor.foreground"])&&(s=l.colors["editor.foreground"]),!r&&((y=l==null?void 0:l.colors)!=null&&y["editor.background"])&&(r=l.colors["editor.background"]),s||(s=l.type==="light"?pg.light:pg.dark),r||(r=l.type==="light"?gg.light:gg.dark),l.fg=s,l.bg=r}l.settings[0]&&l.settings[0].settings&&!l.settings[0].scope||l.settings.unshift({settings:{foreground:l.fg,background:l.bg}});let u=0;const f=new Map;function d(E){var D;if(f.has(E))return f.get(E);u+=1;const A=`#${u.toString(16).padStart(8,"0").toLowerCase()}`;return(D=l.colorReplacements)!=null&&D[`#${A}`]?d(E):(f.set(E,A),A)}l.settings=l.settings.map(E=>{var P,V;const A=((P=E.settings)==null?void 0:P.foreground)&&!E.settings.foreground.startsWith("#"),D=((V=E.settings)==null?void 0:V.background)&&!E.settings.background.startsWith("#");if(!A&&!D)return E;const B={...E,settings:{...E.settings}};if(A){const I=d(E.settings.foreground);l.colorReplacements[I]=E.settings.foreground,B.settings.foreground=I}if(D){const I=d(E.settings.background);l.colorReplacements[I]=E.settings.background,B.settings.background=I}return B});for(const E of Object.keys(l.colors||{}))if((E==="editor.foreground"||E==="editor.background"||E.startsWith("terminal.ansi"))&&!((b=l.colors[E])!=null&&b.startsWith("#"))){const A=d(l.colors[E]);l.colorReplacements[A]=l.colors[E],l.colors[E]=A}return Object.defineProperty(l,_g,{enumerable:!1,writable:!1,value:!0}),l}async function E_(i){return Array.from(new Set((await Promise.all(i.filter(l=>!m_(l)).map(async l=>await __(l).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function x_(i){return(await Promise.all(i.map(async r=>p_(r)?null:wf(await __(r))))).filter(r=>!!r)}class yE extends OS{constructor(r,s,u,f={}){super(r);w(this,"_resolvedThemes",new Map);w(this,"_resolvedGrammars",new Map);w(this,"_langMap",new Map);w(this,"_langGraph",new Map);w(this,"_textmateThemeCache",new WeakMap);w(this,"_loadedThemesCache",null);w(this,"_loadedLanguagesCache",null);this._resolver=r,this._themes=s,this._langs=u,this._alias=f,this._themes.map(d=>this.loadTheme(d)),this.loadLanguages(this._langs)}getTheme(r){return typeof r=="string"?this._resolvedThemes.get(r):this.loadTheme(r)}loadTheme(r){const s=wf(r);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(r){let s=this._textmateThemeCache.get(r);s||(s=no.createFromRawTheme(r),this._textmateThemeCache.set(r,s)),this._syncRegistry.setTheme(s)}getGrammar(r){if(this._alias[r]){const s=new Set([r]);for(;this._alias[r];){if(r=this._alias[r],s.has(r))throw new Rt(`Circular alias \`${Array.from(s).join(" -> ")} -> ${r}\``);s.add(r)}}return this._resolvedGrammars.get(r)}loadLanguage(r){var d,g,p,m;if(this.getGrammar(r.name))return;const s=new Set([...this._langMap.values()].filter(y=>{var b;return(b=y.embeddedLangsLazy)==null?void 0:b.includes(r.name)}));this._resolver.addLanguage(r);const u={balancedBracketSelectors:r.balancedBracketSelectors||["*"],unbalancedBracketSelectors:r.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(r.scopeName,r);const f=this.loadGrammarWithConfiguration(r.scopeName,1,u);if(f.name=r.name,this._resolvedGrammars.set(r.name,f),r.aliases&&r.aliases.forEach(y=>{this._alias[y]=r.name}),this._loadedLanguagesCache=null,s.size)for(const y of s)this._resolvedGrammars.delete(y.name),this._loadedLanguagesCache=null,(g=(d=this._syncRegistry)==null?void 0:d._injectionGrammars)==null||g.delete(y.scopeName),(m=(p=this._syncRegistry)==null?void 0:p._grammars)==null||m.delete(y.scopeName),this.loadLanguage(this._langMap.get(y.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(r){for(const f of r)this.resolveEmbeddedLanguages(f);const s=Array.from(this._langGraph.entries()),u=s.filter(([f,d])=>!d);if(u.length){const f=s.filter(([d,g])=>{var p;return g&&((p=g.embeddedLangs)==null?void 0:p.some(m=>u.map(([y])=>y).includes(m)))}).filter(d=>!u.includes(d));throw new Rt(`Missing languages ${u.map(([d])=>`\`${d}\``).join(", ")}, required by ${f.map(([d])=>`\`${d}\``).join(", ")}`)}for(const[f,d]of s)this._resolver.addLanguage(d);for(const[f,d]of s)this.loadLanguage(d)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(r){if(this._langMap.set(r.name,r),this._langGraph.set(r.name,r),r.embeddedLangs)for(const s of r.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class vE{constructor(l,r){w(this,"_langs",new Map);w(this,"_scopeToLang",new Map);w(this,"_injections",new Map);w(this,"_onigLib");this._onigLib={createOnigScanner:s=>l.createScanner(s),createOnigString:s=>l.createString(s)},r.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(l){return this._langs.get(l)}loadGrammar(l){return this._scopeToLang.get(l)}addLanguage(l){this._langs.set(l.name,l),l.aliases&&l.aliases.forEach(r=>{this._langs.set(r,l)}),this._scopeToLang.set(l.scopeName,l),l.injectTo&&l.injectTo.forEach(r=>{this._injections.get(r)||this._injections.set(r,[]),this._injections.get(r).push(l.scopeName)})}getInjections(l){const r=l.split(".");let s=[];for(let u=1;u<=r.length;u++){const f=r.slice(0,u).join(".");s=[...s,...this._injections.get(f)||[]]}return s}}let ir=0;function bE(i){ir+=1,i.warnings!==!1&&ir>=10&&ir%10===0&&console.warn(`[Shiki] ${ir} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let l=!1;if(!i.engine)throw new Rt("`engine` option is required for synchronous mode");const r=(i.langs||[]).flat(1),s=(i.themes||[]).flat(1).map(wf),u=new vE(i.engine,r),f=new yE(u,s,r,i.langAlias);let d;function g(I){P();const Y=f.getGrammar(typeof I=="string"?I:I.name);if(!Y)throw new Rt(`Language \`${I}\` not found, you may need to load it first`);return Y}function p(I){if(I==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};P();const Y=f.getTheme(I);if(!Y)throw new Rt(`Theme \`${I}\` not found, you may need to load it first`);return Y}function m(I){P();const Y=p(I);d!==I&&(f.setTheme(Y),d=I);const Z=f.getColorMap();return{theme:Y,colorMap:Z}}function y(){return P(),f.getLoadedThemes()}function b(){return P(),f.getLoadedLanguages()}function E(...I){P(),f.loadLanguages(I.flat(1))}async function A(...I){return E(await E_(I))}function D(...I){P();for(const Y of I.flat(1))f.loadTheme(Y)}async function B(...I){return P(),D(await x_(I))}function P(){if(l)throw new Rt("Shiki instance has been disposed")}function V(){l||(l=!0,f.dispose(),ir-=1)}return{setTheme:m,getTheme:p,getLanguage:g,getLoadedThemes:y,getLoadedLanguages:b,loadLanguage:A,loadLanguageSync:E,loadTheme:B,loadThemeSync:D,dispose:V,[Symbol.dispose]:V}}async function SE(i={}){i.loadWasm;const[l,r,s]=await Promise.all([x_(i.themes||[]),E_(i.langs||[]),i.engine||Hg(i.loadWasm||Gb())]);return bE({...i,themes:l,langs:r,engine:s})}async function EE(i={}){const l=await SE(i);return{getLastGrammarState:(...r)=>rE(l,...r),codeToTokensBase:(r,s)=>kf(l,r,s),codeToTokensWithThemes:(r,s)=>S_(l,r,s),codeToTokens:(r,s)=>co(l,r,s),codeToHast:(r,s)=>fo(l,r,s),codeToHtml:(r,s)=>_E(l,r,s),...l,getInternalContext:()=>l}}function xE(i,l,r){let s,u,f;{const g=i;s=g.langs,u=g.themes,f=g.engine}async function d(g){function p(A){if(typeof A=="string"){if(m_(A))return[];const D=s[A];if(!D)throw new sl(`Language \`${A}\` is not included in this bundle. You may want to load it from external source.`);return D}return A}function m(A){if(p_(A))return"none";if(typeof A=="string"){const D=u[A];if(!D)throw new sl(`Theme \`${A}\` is not included in this bundle. You may want to load it from external source.`);return D}return A}const y=(g.themes??[]).map(A=>m(A)),b=(g.langs??[]).map(A=>p(A)),E=await EE({engine:g.engine??f(),...g,themes:y,langs:b});return{...E,loadLanguage(...A){return E.loadLanguage(...A.map(p))},loadTheme(...A){return E.loadTheme(...A.map(m))}}}return d}function TE(i){let l;async function r(s={}){if(l){const u=await l;return await Promise.all([u.loadTheme(...s.themes||[]),u.loadLanguage(...s.langs||[])]),u}else return l=i({...s,themes:s.themes||[],langs:s.langs||[]}),l}return r}function AE(i){const l=TE(i);return{getSingletonHighlighter(r){return l(r)},async codeToHtml(r,s){return(await l({langs:[s.lang],themes:"theme"in s?[s.theme]:Object.values(s.themes)})).codeToHtml(r,s)},async codeToHast(r,s){return(await l({langs:[s.lang],themes:"theme"in s?[s.theme]:Object.values(s.themes)})).codeToHast(r,s)},async codeToTokens(r,s){return(await l({langs:[s.lang],themes:"theme"in s?[s.theme]:Object.values(s.themes)})).codeToTokens(r,s)},async codeToTokensBase(r,s){return(await l({langs:[s.lang],themes:[s.theme]})).codeToTokensBase(r,s)},async codeToTokensWithThemes(r,s){return(await l({langs:[s.lang],themes:Object.values(s.themes).filter(Boolean)})).codeToTokensWithThemes(r,s)},async getLastGrammarState(r,s){return(await l({langs:[s.lang],themes:[s.theme]})).getLastGrammarState(r,s)}}}const RE=xE({langs:Sb,themes:xb,engine:()=>Hg(v(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:OE}=AE(RE);let rr=null;async function CE(){if(rr)return rr;try{const l=await(await fetch("/api/config")).json();rr={attachmentBaseUrl:l.fileAttachmentBaseUrl||"",projectPrefix:l.projectPrefix||""}}catch{rr={attachmentBaseUrl:"",projectPrefix:""}}return rr}function DE(i,l){return l?i.replace(/attach:\/\/([^\s)]+)/g,(r,s)=>`${l}/${s}`):i}function LE(i){return i.replace(new RegExp("(?<![[\\w/])#([a-z0-9]+-[a-z0-9]+)(?![(\\]\\w])","gi"),(l,r)=>`[#${r}](#/detail/${r})`)}function yg({content:i}){const[l,r]=F.useState("");return F.useEffect(()=>{if(!i){r("");return}let s=!1;async function u(){const f=await CE();let d=DE(i,f.attachmentBaseUrl);d=LE(d);const g=Ae.lexer(d),p=[];Ae.walkTokens(g,A=>{A.type==="code"&&p.push({code:A.text,lang:A.lang||"text"})});const m=await Promise.all(p.map(async A=>{try{return await OE(A.code,{lang:A.lang,theme:"github-light"})}catch{return`<pre><code>${Zp.sanitize(A.code)}</code></pre>`}}));let y=Ae.parser(g),b=0;y=y.replace(/<pre><code[^>]*>[\s\S]*?<\/code><\/pre>/g,()=>m[b++]||"");const E=Zp.sanitize(y,{ADD_TAGS:["span"],ADD_ATTR:["style","class"]});s||r(E)}return u(),()=>{s=!0}},[i]),S.jsx("div",{className:`prose prose-stone prose-sm max-w-none
|
|
118
118
|
prose-pre:bg-stone-50 prose-pre:border prose-pre:border-stone-200 prose-pre:rounded
|
|
119
119
|
prose-code:text-sm prose-code:font-mono
|
|
120
120
|
prose-headings:font-semibold prose-headings:text-stone-900
|
|
121
|
-
prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline`,dangerouslySetInnerHTML:{__html:l}})}function Qs({label:i,value:l,placeholder:r,onSave:s}){const[u,f]=F.useState(!1),[d,g]=F.useState(l),[p,m]=F.useState("edit"),[y,b]=F.useState(!1);F.useEffect(()=>{u||g(l)},[l,u]);const E=F.useCallback(async()=>{b(!0);try{await s(d),f(!1),m("edit")}finally{b(!1)}},[d,s]),A=F.useCallback(()=>{g(l),f(!1),m("edit")},[l]),D=F.useCallback(B=>{B.key==="s"&&(B.metaKey||B.ctrlKey)&&(B.preventDefault(),E()),B.key==="Escape"&&(B.preventDefault(),A())},[E,A]);return u?S.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--accent)",boxShadow:"var(--shadow-card)"},onKeyDown:D,children:[S.jsxs("div",{className:"flex items-center justify-between mb-2",children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),S.jsxs("div",{className:"flex overflow-hidden text-xs rounded-md",style:{border:"1px solid var(--border-default)"},children:[S.jsx("button",{onClick:()=>m("edit"),className:"px-2.5 py-1 font-medium",style:{background:p==="edit"?"var(--bg-hover)":"var(--bg-elevated)",color:p==="edit"?"var(--text-primary)":"var(--text-secondary)"},children:"Edit"}),S.jsx("button",{onClick:()=>m("preview"),className:"px-2.5 py-1 font-medium",style:{background:p==="preview"?"var(--bg-hover)":"var(--bg-elevated)",color:p==="preview"?"var(--text-primary)":"var(--text-secondary)",borderLeft:"1px solid var(--border-default)"},children:"Preview"})]})]}),p==="edit"?S.jsx("textarea",{value:d,onChange:B=>g(B.target.value),rows:10,className:"w-full p-3 text-sm font-mono rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:B=>{B.currentTarget.style.borderColor="var(--accent)"},onBlur:B=>{B.currentTarget.style.borderColor="var(--border-default)"},autoFocus:!0}):S.jsx("div",{className:"p-3 rounded-md min-h-[160px]",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)"},children:S.jsx(yg,{content:d})}),S.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[S.jsx("span",{className:"text-xs mr-auto",style:{color:"var(--text-tertiary)"},children:"Cmd+S to save, Esc to cancel"}),S.jsx("button",{onClick:A,className:"px-3 py-1.5 text-sm rounded-md transition-colors",style:{color:"var(--text-secondary)",border:"1px solid var(--border-default)",background:"var(--bg-elevated)"},onMouseEnter:B=>{B.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:B=>{B.currentTarget.style.background="var(--bg-elevated)"},children:"Cancel"}),S.jsx("button",{onClick:E,disabled:y,className:"px-3 py-1.5 text-sm rounded-md font-medium disabled:opacity-50 transition-colors",style:{background:"var(--accent)",color:"white"},onMouseEnter:B=>{B.currentTarget.style.opacity="0.9"},onMouseLeave:B=>{B.currentTarget.style.opacity="1"},children:y?"Saving...":"Save"})]})]}):S.jsxs("div",{className:"group rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-2",children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),S.jsx("button",{onClick:()=>f(!0),className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"var(--text-tertiary)"},onMouseEnter:B=>{B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.color="var(--text-tertiary)"},title:`Edit ${i}`,children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.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"})})})]}),l?S.jsx(yg,{content:l}):S.jsx("p",{className:"text-sm italic",style:{color:"var(--text-tertiary)"},children:r||`Add ${i.toLowerCase()}...`})]})}function nl({label:i,children:l}){return S.jsxs("div",{className:"px-3 py-2.5 rounded-md",style:{border:"1px solid var(--border-subtle)"},children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider mb-1.5",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),l]})}function LE({issue:i,onUpdate:l}){const r=i.parent_id||i.parent,s=i.parent_title||i.parent_title,u=i.parent_status||i.parent_status,f=new Date(i.updated_at).toLocaleDateString();return S.jsxs("aside",{className:"shrink-0 p-4 space-y-3 overflow-y-auto",style:{width:"280px",borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-base)"},children:[S.jsx(nl,{label:"Status",children:S.jsxs("select",{value:i.status,onChange:d=>l.updateStatus(i.id,d.target.value),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[S.jsx("option",{value:"open",children:"Open"}),S.jsx("option",{value:"in_progress",children:"In Progress"}),S.jsx("option",{value:"closed",children:"Closed"})]})}),S.jsx(nl,{label:"Priority",children:S.jsx("select",{value:i.priority,onChange:d=>l.updatePriority(i.id,Number(d.target.value)),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[0,1,2,3,4].map(d=>S.jsxs("option",{value:d,children:["P",d]},d))})}),S.jsx(nl,{label:"Type",children:S.jsx(hf,{type:i.issue_type})}),S.jsx(nl,{label:"Assignee",children:i.assignee?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("div",{className:"flex items-center justify-center rounded-full text-[10px] font-bold shrink-0",style:{width:"24px",height:"24px",backgroundColor:pf(i.assignee),color:"var(--text-inverse)"},children:mf(i.assignee)}),S.jsx("span",{className:"text-sm",style:{color:"var(--text-primary)"},children:i.assignee})]}):S.jsx("span",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Unassigned"})}),S.jsx(nl,{label:"Updated",children:S.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:f})}),i.labels&&i.labels.length>0&&S.jsx(nl,{label:"Labels",children:S.jsx("div",{className:"flex flex-wrap gap-1",children:i.labels.map(d=>S.jsx("span",{className:"px-2 py-0.5 text-xs rounded",style:{background:"var(--bg-hover)",color:"var(--text-secondary)"},children:d},d))})}),r&&S.jsx(nl,{label:"Parent",children:S.jsxs("a",{href:`#/detail/${r}`,className:"block rounded px-1 py-1 -mx-1 transition-colors",style:{color:"var(--text-primary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[S.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[u&&S.jsx(cr,{status:u}),S.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-tertiary)"},children:r})]}),s&&S.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:s})]})}),(()=>{const d=(i.dependencies||[]).filter(g=>g.type==="blocks"&&g.issue_id===i.id);return d.length===0?null:S.jsx(nl,{label:"Blocked By",children:S.jsx("div",{className:"space-y-1",children:d.map(g=>S.jsx("a",{href:`#/detail/${g.depends_on_id}`,className:"block text-xs font-mono px-1 py-0.5 transition-colors",style:{color:"var(--accent)"},onMouseEnter:p=>{p.currentTarget.style.textDecoration="underline"},onMouseLeave:p=>{p.currentTarget.style.textDecoration="none"},children:g.depends_on_id},g.depends_on_id))})})})(),i.dependents&&i.dependents.length>0&&S.jsx(nl,{label:"Children / Dependents",children:S.jsx("div",{className:"space-y-1",children:i.dependents.map(d=>S.jsxs("a",{href:`#/detail/${d.id}`,className:"block text-xs rounded px-1 py-1.5 -mx-1 transition-colors",onMouseEnter:g=>{g.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:[S.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[S.jsx(cr,{status:d.status}),S.jsx("span",{className:"font-mono",style:{color:"var(--text-tertiary)"},children:d.id})]}),d.title&&S.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:d.title})]},d.id))})})]})}function NE({issueId:i}){const l=Eg(),[r,s]=F.useState(""),u=async()=>{r.trim()&&(await l.addComment(i,r.trim()),s(""))};return S.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:"Comments"}),S.jsx("div",{className:"flex gap-2",children:S.jsx("textarea",{value:r,onChange:f=>s(f.target.value),placeholder:"Add a comment... (Ctrl+Enter to submit)",rows:3,className:"flex-1 p-2 text-sm rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:f=>{f.currentTarget.style.borderColor="var(--accent)"},onBlur:f=>{f.currentTarget.style.borderColor="var(--border-default)"},onKeyDown:f=>{f.key==="Enter"&&(f.ctrlKey||f.metaKey)&&u()}})}),S.jsx("button",{onClick:u,className:"mt-2 px-3 py-1.5 text-sm rounded-md font-medium transition-colors",style:{background:"var(--bg-hover)",color:"var(--text-primary)",border:"1px solid var(--border-default)"},onMouseEnter:f=>{f.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:f=>{f.currentTarget.style.borderColor="var(--border-default)"},children:"Add Comment"})]})}function kE({issueId:i}){const{issues:l,loading:r}=Xa("issue-detail",{id:i}),s=Eg(),u=l[0];return r?S.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Loading..."}):u?S.jsxs("div",{className:"flex h-full",style:{background:"var(--bg-base)"},children:[S.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[S.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--text-tertiary)"},children:[S.jsx("a",{href:"#/list",className:"flex items-center gap-1 transition-colors",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.color="var(--accent)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--text-tertiary)"},children:"← List"}),S.jsx("span",{children:"/"}),S.jsx("span",{className:"font-mono",children:u.id})]}),S.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--text-primary)"},children:u.title}),S.jsx(Qs,{label:"Description",value:u.description||"",onSave:f=>s.editText({id:u.id,field:"description",value:f})}),S.jsx(Qs,{label:"Acceptance Criteria",value:u.acceptance||"",placeholder:"Add acceptance criteria...",onSave:f=>s.editText({id:u.id,field:"acceptance",value:f})}),S.jsx(Qs,{label:"Notes",value:u.notes||"",placeholder:"Add notes...",onSave:f=>s.editText({id:u.id,field:"notes",value:f})}),S.jsx(Qs,{label:"Design",value:u.design||"",placeholder:"Add design notes...",onSave:f=>s.editText({id:u.id,field:"design",value:f})}),u.issue_type==="epic"&&u.dependents&&u.dependents.length>0&&S.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[S.jsxs("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:["Children (",u.closed_children??0," / ",u.total_children??u.dependents.length,")"]}),S.jsx("div",{className:"space-y-0.5",children:u.dependents.map(f=>S.jsxs("a",{href:`#/detail/${f.id}`,className:"flex items-center gap-2.5 px-2 py-2 rounded-md transition-colors",style:{opacity:f.status==="closed"?.6:1},onMouseEnter:d=>{d.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[S.jsx(cr,{status:f.status}),S.jsx("span",{className:"text-xs font-mono",style:{color:"var(--text-tertiary)"},children:f.id}),S.jsx("span",{className:"text-sm truncate",style:{color:"var(--text-primary)"},children:f.title})]},f.id))})]}),S.jsx(NE,{issueId:u.id})]}),S.jsx(LE,{issue:u,onUpdate:s})]}):S.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Issue not found"})}function wE(i){const[l,r]=F.useState(""),s=F.useMemo(()=>{if(!l.trim())return i;const u=l.toLowerCase();return i.filter(f=>f.id.toLowerCase().includes(u)||f.title.toLowerCase().includes(u)||(f.description||"").toLowerCase().includes(u))},[i,l]);return{query:l,setQuery:r,results:s}}function ME(){const[i,l]=F.useState(!1),{issues:r}=Xa("all-issues"),{query:s,setQuery:u,results:f}=wE(r),[d,g]=F.useState(0),p=F.useRef(null);F.useEffect(()=>{const b=E=>{var D;const A=(D=E.target)==null?void 0:D.tagName;E.key==="k"&&(E.metaKey||E.ctrlKey)&&A!=="TEXTAREA"&&(E.preventDefault(),l(!0)),E.key==="Escape"&&i&&(E.preventDefault(),l(!1),u(""),g(0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[i,u]),F.useEffect(()=>{i&&setTimeout(()=>{var b;return(b=p.current)==null?void 0:b.focus()},0)},[i]),F.useEffect(()=>g(0),[f]);const m=b=>{const E=f.slice(0,20);b.key==="ArrowDown"&&(b.preventDefault(),g(A=>Math.min(A+1,E.length-1))),b.key==="ArrowUp"&&(b.preventDefault(),g(A=>Math.max(A-1,0))),b.key==="Enter"&&E[d]&&(window.location.hash=`#/detail/${E[d].id}`,l(!1),u(""))};if(!i)return null;const y=f.slice(0,20);return S.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:()=>{l(!1),u("")},children:[S.jsx("div",{className:"absolute inset-0",style:{background:"var(--bg-overlay)"}}),S.jsxs("div",{className:"relative w-full max-w-lg overflow-hidden",style:{background:"var(--bg-elevated)",borderRadius:"var(--radius-lg)",border:"1px solid var(--border-subtle)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.15)"},onClick:b=>b.stopPropagation(),children:[S.jsx("input",{ref:p,type:"text",value:s,onChange:b=>u(b.target.value),onKeyDown:m,placeholder:"Search issues...",className:"w-full px-4 py-3 text-sm outline-none",style:{borderBottom:"1px solid var(--border-subtle)",background:"transparent",color:"var(--text-primary)"}}),S.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[y.length===0&&s&&S.jsx("div",{className:"px-4 py-6 text-sm text-center",style:{color:"var(--text-tertiary)"},children:"No results"}),y.map((b,E)=>S.jsxs("button",{onClick:()=>{window.location.hash=`#/detail/${b.id}`,l(!1),u("")},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors",style:{background:E===d?"var(--bg-hover)":"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:A=>{A.currentTarget.style.background=E===d?"var(--bg-hover)":"transparent"},children:[S.jsx("span",{className:"font-mono text-xs w-28 shrink-0",style:{color:"var(--text-tertiary)"},children:b.id}),S.jsx(cr,{status:b.status}),S.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:b.title}),S.jsx(df,{priority:b.priority})]},b.id))]}),S.jsx("div",{className:"px-4 py-2 text-xs",style:{color:"var(--text-tertiary)",borderTop:"1px solid var(--border-subtle)"},children:"↑↓ navigate · ↵ open · esc close"})]})]})}function zE(){return S.jsxs(Xv,{children:[S.jsx(ME,{}),S.jsx($v,{children:i=>{if(i.startsWith("#/detail/")){const l=i.replace("#/detail/","");return S.jsx(kE,{issueId:l},l)}return i.startsWith("#/list")?S.jsx(h0,{}):i.startsWith("#/board")||i===""||i==="#/"||i==="#"?S.jsx(a0,{}):S.jsx("div",{className:"p-6 text-stone-400",children:"View not implemented yet"})}})]})}qv.createRoot(document.getElementById("root")).render(S.jsx(F.StrictMode,{children:S.jsx(zE,{})}));
|
|
121
|
+
prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline`,dangerouslySetInnerHTML:{__html:l}})}function Qs({label:i,value:l,placeholder:r,onSave:s}){const[u,f]=F.useState(!1),[d,g]=F.useState(l),[p,m]=F.useState("edit"),[y,b]=F.useState(!1);F.useEffect(()=>{u||g(l)},[l,u]);const E=F.useCallback(async()=>{b(!0);try{await s(d),f(!1),m("edit")}finally{b(!1)}},[d,s]),A=F.useCallback(()=>{g(l),f(!1),m("edit")},[l]),D=F.useCallback(B=>{B.key==="s"&&(B.metaKey||B.ctrlKey)&&(B.preventDefault(),E()),B.key==="Escape"&&(B.preventDefault(),A())},[E,A]);return u?S.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--accent)",boxShadow:"var(--shadow-card)"},onKeyDown:D,children:[S.jsxs("div",{className:"flex items-center justify-between mb-2",children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),S.jsxs("div",{className:"flex overflow-hidden text-xs rounded-md",style:{border:"1px solid var(--border-default)"},children:[S.jsx("button",{onClick:()=>m("edit"),className:"px-2.5 py-1 font-medium",style:{background:p==="edit"?"var(--bg-hover)":"var(--bg-elevated)",color:p==="edit"?"var(--text-primary)":"var(--text-secondary)"},children:"Edit"}),S.jsx("button",{onClick:()=>m("preview"),className:"px-2.5 py-1 font-medium",style:{background:p==="preview"?"var(--bg-hover)":"var(--bg-elevated)",color:p==="preview"?"var(--text-primary)":"var(--text-secondary)",borderLeft:"1px solid var(--border-default)"},children:"Preview"})]})]}),p==="edit"?S.jsx("textarea",{value:d,onChange:B=>g(B.target.value),rows:10,className:"w-full p-3 text-sm font-mono rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:B=>{B.currentTarget.style.borderColor="var(--accent)"},onBlur:B=>{B.currentTarget.style.borderColor="var(--border-default)"},autoFocus:!0}):S.jsx("div",{className:"p-3 rounded-md min-h-[160px]",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)"},children:S.jsx(yg,{content:d})}),S.jsxs("div",{className:"flex items-center justify-end gap-2 mt-3",children:[S.jsx("span",{className:"text-xs mr-auto",style:{color:"var(--text-tertiary)"},children:"Cmd+S to save, Esc to cancel"}),S.jsx("button",{onClick:A,className:"px-3 py-1.5 text-sm rounded-md transition-colors",style:{color:"var(--text-secondary)",border:"1px solid var(--border-default)",background:"var(--bg-elevated)"},onMouseEnter:B=>{B.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:B=>{B.currentTarget.style.background="var(--bg-elevated)"},children:"Cancel"}),S.jsx("button",{onClick:E,disabled:y,className:"px-3 py-1.5 text-sm rounded-md font-medium disabled:opacity-50 transition-colors",style:{background:"var(--accent)",color:"white"},onMouseEnter:B=>{B.currentTarget.style.opacity="0.9"},onMouseLeave:B=>{B.currentTarget.style.opacity="1"},children:y?"Saving...":"Save"})]})]}):S.jsxs("div",{className:"group rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[S.jsxs("div",{className:"flex items-center justify-between mb-2",children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),S.jsx("button",{onClick:()=>f(!0),className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"var(--text-tertiary)"},onMouseEnter:B=>{B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.color="var(--text-tertiary)"},title:`Edit ${i}`,children:S.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:S.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"})})})]}),l?S.jsx(yg,{content:l}):S.jsx("p",{className:"text-sm italic",style:{color:"var(--text-tertiary)"},children:r||`Add ${i.toLowerCase()}...`})]})}function nl({label:i,children:l}){return S.jsxs("div",{className:"px-3 py-2.5 rounded-md",style:{border:"1px solid var(--border-subtle)"},children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider mb-1.5",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:i}),l]})}function NE({issue:i,onUpdate:l}){const r=i.parent_id||i.parent,s=i.parent_title||i.parent_title,u=i.parent_status||i.parent_status,f=new Date(i.updated_at).toLocaleDateString();return S.jsxs("aside",{className:"shrink-0 p-4 space-y-3 overflow-y-auto",style:{width:"280px",borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-base)"},children:[S.jsx(nl,{label:"Status",children:S.jsxs("select",{value:i.status,onChange:d=>l.updateStatus(i.id,d.target.value),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[S.jsx("option",{value:"open",children:"Open"}),S.jsx("option",{value:"in_progress",children:"In Progress"}),S.jsx("option",{value:"closed",children:"Closed"})]})}),S.jsx(nl,{label:"Priority",children:S.jsx("select",{value:i.priority,onChange:d=>l.updatePriority(i.id,Number(d.target.value)),className:"w-full px-2 py-1 text-sm rounded-md outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-elevated)",color:"var(--text-primary)"},children:[0,1,2,3,4].map(d=>S.jsxs("option",{value:d,children:["P",d]},d))})}),S.jsx(nl,{label:"Type",children:S.jsx(hf,{type:i.issue_type})}),S.jsx(nl,{label:"Assignee",children:i.assignee?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("div",{className:"flex items-center justify-center rounded-full text-[10px] font-bold shrink-0",style:{width:"24px",height:"24px",backgroundColor:pf(i.assignee),color:"var(--text-inverse)"},children:mf(i.assignee)}),S.jsx("span",{className:"text-sm",style:{color:"var(--text-primary)"},children:i.assignee})]}):S.jsx("span",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Unassigned"})}),S.jsx(nl,{label:"Updated",children:S.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:f})}),i.labels&&i.labels.length>0&&S.jsx(nl,{label:"Labels",children:S.jsx("div",{className:"flex flex-wrap gap-1",children:i.labels.map(d=>S.jsx("span",{className:"px-2 py-0.5 text-xs rounded",style:{background:"var(--bg-hover)",color:"var(--text-secondary)"},children:d},d))})}),r&&S.jsx(nl,{label:"Parent",children:S.jsxs("a",{href:`#/detail/${r}`,className:"block rounded px-1 py-1 -mx-1 transition-colors",style:{color:"var(--text-primary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[S.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[u&&S.jsx(cr,{status:u}),S.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-tertiary)"},children:r})]}),s&&S.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:s})]})}),(()=>{const d=(i.dependencies||[]).filter(g=>g.type==="blocks"&&g.issue_id===i.id);return d.length===0?null:S.jsx(nl,{label:"Blocked By",children:S.jsx("div",{className:"space-y-1",children:d.map(g=>S.jsx("a",{href:`#/detail/${g.depends_on_id}`,className:"block text-xs font-mono px-1 py-0.5 transition-colors",style:{color:"var(--accent)"},onMouseEnter:p=>{p.currentTarget.style.textDecoration="underline"},onMouseLeave:p=>{p.currentTarget.style.textDecoration="none"},children:g.depends_on_id},g.depends_on_id))})})})(),i.dependents&&i.dependents.length>0&&S.jsx(nl,{label:"Children / Dependents",children:S.jsx("div",{className:"space-y-1",children:i.dependents.map(d=>S.jsxs("a",{href:`#/detail/${d.id}`,className:"block text-xs rounded px-1 py-1.5 -mx-1 transition-colors",onMouseEnter:g=>{g.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:[S.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[S.jsx(cr,{status:d.status}),S.jsx("span",{className:"font-mono",style:{color:"var(--text-tertiary)"},children:d.id})]}),d.title&&S.jsx("p",{className:"text-xs leading-snug pl-0.5 line-clamp-2",style:{color:"var(--text-secondary)"},children:d.title})]},d.id))})})]})}function kE({issueId:i}){const l=Eg(),[r,s]=F.useState(""),u=async()=>{r.trim()&&(await l.addComment(i,r.trim()),s(""))};return S.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[S.jsx("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:"Comments"}),S.jsx("div",{className:"flex gap-2",children:S.jsx("textarea",{value:r,onChange:f=>s(f.target.value),placeholder:"Add a comment... (Ctrl+Enter to submit)",rows:3,className:"flex-1 p-2 text-sm rounded-md resize-y outline-none",style:{border:"1px solid var(--border-default)",background:"var(--bg-base)",color:"var(--text-primary)"},onFocus:f=>{f.currentTarget.style.borderColor="var(--accent)"},onBlur:f=>{f.currentTarget.style.borderColor="var(--border-default)"},onKeyDown:f=>{f.key==="Enter"&&(f.ctrlKey||f.metaKey)&&u()}})}),S.jsx("button",{onClick:u,className:"mt-2 px-3 py-1.5 text-sm rounded-md font-medium transition-colors",style:{background:"var(--bg-hover)",color:"var(--text-primary)",border:"1px solid var(--border-default)"},onMouseEnter:f=>{f.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:f=>{f.currentTarget.style.borderColor="var(--border-default)"},children:"Add Comment"})]})}function wE({issueId:i}){const{issues:l,loading:r}=Xa("issue-detail",{id:i}),s=Eg(),u=l[0];return r?S.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Loading..."}):u?S.jsxs("div",{className:"flex h-full",style:{background:"var(--bg-base)"},children:[S.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:[S.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--text-tertiary)"},children:[S.jsx("a",{href:"#/list",className:"flex items-center gap-1 transition-colors",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.color="var(--accent)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--text-tertiary)"},children:"← List"}),S.jsx("span",{children:"/"}),S.jsx("span",{className:"font-mono",children:u.id})]}),S.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--text-primary)"},children:u.title}),S.jsx(Qs,{label:"Description",value:u.description||"",onSave:f=>s.editText({id:u.id,field:"description",value:f})}),S.jsx(Qs,{label:"Acceptance Criteria",value:u.acceptance||"",placeholder:"Add acceptance criteria...",onSave:f=>s.editText({id:u.id,field:"acceptance",value:f})}),S.jsx(Qs,{label:"Notes",value:u.notes||"",placeholder:"Add notes...",onSave:f=>s.editText({id:u.id,field:"notes",value:f})}),S.jsx(Qs,{label:"Design",value:u.design||"",placeholder:"Add design notes...",onSave:f=>s.editText({id:u.id,field:"design",value:f})}),u.issue_type==="epic"&&u.dependents&&u.dependents.length>0&&S.jsxs("div",{className:"rounded-lg p-4",style:{background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-card)"},children:[S.jsxs("h3",{className:"font-semibold uppercase tracking-wider mb-3",style:{fontSize:"11px",color:"var(--text-tertiary)"},children:["Children (",u.closed_children??0," / ",u.total_children??u.dependents.length,")"]}),S.jsx("div",{className:"space-y-0.5",children:u.dependents.map(f=>S.jsxs("a",{href:`#/detail/${f.id}`,className:"flex items-center gap-2.5 px-2 py-2 rounded-md transition-colors",style:{opacity:f.status==="closed"?.6:1},onMouseEnter:d=>{d.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[S.jsx(cr,{status:f.status}),S.jsx("span",{className:"text-xs font-mono",style:{color:"var(--text-tertiary)"},children:f.id}),S.jsx("span",{className:"text-sm truncate",style:{color:"var(--text-primary)"},children:f.title})]},f.id))})]}),S.jsx(kE,{issueId:u.id})]}),S.jsx(NE,{issue:u,onUpdate:s})]}):S.jsx("div",{className:"p-6",style:{color:"var(--text-tertiary)"},children:"Issue not found"})}function ME(i){const[l,r]=F.useState(""),s=F.useMemo(()=>{if(!l.trim())return i;const u=l.toLowerCase();return i.filter(f=>f.id.toLowerCase().includes(u)||f.title.toLowerCase().includes(u)||(f.description||"").toLowerCase().includes(u))},[i,l]);return{query:l,setQuery:r,results:s}}function zE(){const[i,l]=F.useState(!1),{issues:r}=Xa("all-issues"),{query:s,setQuery:u,results:f}=ME(r),[d,g]=F.useState(0),p=F.useRef(null);F.useEffect(()=>{const b=E=>{var D;const A=(D=E.target)==null?void 0:D.tagName;E.key==="k"&&(E.metaKey||E.ctrlKey)&&A!=="TEXTAREA"&&(E.preventDefault(),l(!0)),E.key==="Escape"&&i&&(E.preventDefault(),l(!1),u(""),g(0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[i,u]),F.useEffect(()=>{i&&setTimeout(()=>{var b;return(b=p.current)==null?void 0:b.focus()},0)},[i]),F.useEffect(()=>g(0),[f]);const m=b=>{const E=f.slice(0,20);b.key==="ArrowDown"&&(b.preventDefault(),g(A=>Math.min(A+1,E.length-1))),b.key==="ArrowUp"&&(b.preventDefault(),g(A=>Math.max(A-1,0))),b.key==="Enter"&&E[d]&&(window.location.hash=`#/detail/${E[d].id}`,l(!1),u(""))};if(!i)return null;const y=f.slice(0,20);return S.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",onClick:()=>{l(!1),u("")},children:[S.jsx("div",{className:"absolute inset-0",style:{background:"var(--bg-overlay)"}}),S.jsxs("div",{className:"relative w-full max-w-lg overflow-hidden",style:{background:"var(--bg-elevated)",borderRadius:"var(--radius-lg)",border:"1px solid var(--border-subtle)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.15)"},onClick:b=>b.stopPropagation(),children:[S.jsx("input",{ref:p,type:"text",value:s,onChange:b=>u(b.target.value),onKeyDown:m,placeholder:"Search issues...",className:"w-full px-4 py-3 text-sm outline-none",style:{borderBottom:"1px solid var(--border-subtle)",background:"transparent",color:"var(--text-primary)"}}),S.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[y.length===0&&s&&S.jsx("div",{className:"px-4 py-6 text-sm text-center",style:{color:"var(--text-tertiary)"},children:"No results"}),y.map((b,E)=>S.jsxs("button",{onClick:()=>{window.location.hash=`#/detail/${b.id}`,l(!1),u("")},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors",style:{background:E===d?"var(--bg-hover)":"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:A=>{A.currentTarget.style.background=E===d?"var(--bg-hover)":"transparent"},children:[S.jsx("span",{className:"font-mono text-xs w-28 shrink-0",style:{color:"var(--text-tertiary)"},children:b.id}),S.jsx(cr,{status:b.status}),S.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:b.title}),S.jsx(df,{priority:b.priority})]},b.id))]}),S.jsx("div",{className:"px-4 py-2 text-xs",style:{color:"var(--text-tertiary)",borderTop:"1px solid var(--border-subtle)"},children:"↑↓ navigate · ↵ open · esc close"})]})]})}function jE(){return S.jsxs(Xv,{children:[S.jsx(zE,{}),S.jsx($v,{children:i=>{if(i.startsWith("#/detail/")){const l=i.replace("#/detail/","");return S.jsx(wE,{issueId:l},l)}return i.startsWith("#/list")?S.jsx(h0,{}):i.startsWith("#/board")||i===""||i==="#/"||i==="#"?S.jsx(a0,{}):S.jsx("div",{className:"p-6 text-stone-400",children:"View not implemented yet"})}})]})}qv.createRoot(document.getElementById("root")).render(S.jsx(F.StrictMode,{children:S.jsx(jE,{})}));
|
package/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Beads UI</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-r2l91WqA.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Ux6DCth7.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="background: #FDFBF7; color: #1A1A1A;">
|
package/package.json
CHANGED
package/server/cli/usage.js
CHANGED
|
@@ -37,6 +37,10 @@ export function printUsage(out_stream) {
|
|
|
37
37
|
' Set FILE_ATTACHMENT_BASE_URL to resolve them at render time.',
|
|
38
38
|
' Example: attach://bead-42/shot.png becomes',
|
|
39
39
|
' ${FILE_ATTACHMENT_BASE_URL}/bead-42/shot.png',
|
|
40
|
+
'',
|
|
41
|
+
'Issue mentions:',
|
|
42
|
+
' Use #issue-id to mention issues in markdown (e.g., #yuklar-985).',
|
|
43
|
+
' These are auto-linked to the issue detail page.',
|
|
40
44
|
''
|
|
41
45
|
];
|
|
42
46
|
for (const line of lines) {
|