@rsktash/beads-ui 0.1.17 → 0.1.18

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.
@@ -114,7 +114,9 @@ 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 L1(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=u_);const m=k1(s,i.properties),y=s.all(u.space==="html"&&i.tagName==="template"?i.content:i);return s.schema=u,y&&(d=!1),(m||!f||!T1(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 k1(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=zS(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?s1:o1)(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 w1=["<","&"];function m_(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:w1}))}function M1(i,l,r,s){return s.settings.allowDangerousHtml?i.value:m_(i,l,r,s)}function z1(i,l,r,s){return s.all(i)}const j1=HS("type",{invalid:U1,unknown:B1,handlers:{comment:i1,doctype:r1,element:L1,raw:M1,root:z1,text:m_}});function U1(i){throw new Error("Expected node, not `"+i+"`")}function B1(i){const l=i;throw new Error("Cannot compile unknown node `"+l.type+"`")}const H1={},V1={},G1=[];function I1(i,l){const r=H1,s=r.quote||'"',u=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:q1,all:P1,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||DS,characterReferences:r.characterReferences||V1,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?u_:BS,quote:s,alternative:u}.one(Array.isArray(i)?{type:"root",children:i}:i,void 0,void 0)}function q1(i,l,r){return j1(i,l,r,this)}function P1(i){const l=[],r=i&&i.children||G1;let s=-1;for(;++s<r.length;)l[s]=this.one(r[s],s,i);return l.join("")}function Y1(i){return Array.isArray(i)?i:[i]}function _o(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 p_(i){return i==="ansi"||Lf(i)}function kf(i){return i==="none"}function g_(i){return kf(i)}function __(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 X1(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 Q1(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?X1(u,f):u})):i}async function y_(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 v_(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 Z1(i){return typeof i=="string"?i:Object.entries(i).map(([l,r])=>`${l}:${r}`).join(";")}function K1(i){const l=_o(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 b_=new WeakMap;function yo(i,l){b_.set(i,l)}function mr(i){return b_.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(Y1(r).map(s=>[s,rf])),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 $1(i,l){if(!(i instanceof Ka))throw new Rt("Invalid grammar state");return i.getInternalStack(l)}function J1(){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=K1(r.source),f=(r.options.decorations||[]).map(d=>({...d,start:s(d.start),end:s(d.end)}));W1(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 Q1(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(S=>S.type==="element"&&S.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(S,E,A,C){const B=u[S];let P="",U=-1,I=-1;if(E===0&&(U=0),A===0&&(I=0),A===Number.POSITIVE_INFINITY&&(I=B.children.length),U===-1||I===-1)for(let Z=0;Z<B.children.length;Z++)P+=S_(B.children[Z]),U===-1&&P.length===E&&(U=Z+1),I===-1&&P.length===A&&(I=Z+1);if(U===-1)throw new Rt(`Failed to find start index for decoration ${JSON.stringify(C.start)}`);if(I===-1)throw new Rt(`Failed to find end index for decoration ${JSON.stringify(C.end)}`);const Y=B.children.slice(U,I);if(!C.alwaysWrap&&Y.length===B.children.length)g(B,C,"line");else if(!C.alwaysWrap&&Y.length===1&&Y[0].type==="element")g(Y[0],C,"token");else{const Z={type:"element",tagName:"span",properties:{},children:Y};g(Z,C,"wrapper"),B.children.splice(U,Y.length,Z)}}function d(S,E){u[S]=g(u[S],E,"line")}function g(S,E,A){var P;const C=E.properties||{},B=E.transform||(U=>U);return S.tagName=E.tagName||"span",S.properties={...S.properties,...C,class:S.properties.class},(P=E.properties)!=null&&P.class&&__(S,E.properties.class),S=B(S,A)||S,S}const p=[],m=s.decorations.sort((S,E)=>E.start.offset-S.start.offset);for(const S of m){const{start:E,end:A}=S;if(E.line===A.line)f(E.line,E.character,A.character,S);else if(E.line<A.line){f(E.line,E.character,Number.POSITIVE_INFINITY,S);for(let C=E.line+1;C<A.line;C++)p.unshift(()=>d(C,S));f(A.line,0,A.character,S)}}p.forEach(S=>S())}}}function W1(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 S_(i){return i.type==="text"?i.value:i.type==="element"?i.children.map(S_).join(""):""}const F1=[J1()];function oo(i){return[...i.transformers||[],...F1]}var na=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Qc={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function eE(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 tE(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)Qc[u]&&l.push({type:"setDecoration",value:Qc[u]});else if(u<=29){const f=Qc[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 nE(){let i=null,l=null,r=new Set;return{parse(s){const u=[];let f=0;do{const d=eE(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=tE(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 lE={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 aE(i=lE){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 S=0;S<6;S++)s.push(r([g[m],g[y],g[S]]));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 iE(i,l,r){const s=so(i,r),u=_o(l),f=aE(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=nE();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=rE(m));let S=rl.None;return p.decorations.has("bold")&&(S|=rl.Bold),p.decorations.has("italic")&&(S|=rl.Italic),p.decorations.has("underline")&&(S|=rl.Underline),{content:p.value,offset:g[1],color:m,bgColor:y,fontStyle:S}}))}function rE(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 Nf(i,l,r={}){const{lang:s="text",theme:u=i.getLoadedThemes()[0]}=r;if(Lf(s)||kf(u))return _o(l).map(p=>[{content:p[0],offset:p[1]}]);const{theme:f,colorMap:d}=i.setTheme(u);if(s==="ansi")return iE(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 oE(l,g,f,d,r)}function sE(...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)||kf(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 oE(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 yo(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=_o(i);let m=u.grammarState?$1(u.grammarState,r.name)??rf:u.grammarContextCode!=null?uo(u.grammarContextCode,l,r,s,{...u,grammarState:void 0,grammarContextCode:void 0}).stateStack:rf,y=[];const S=[];for(let E=0,A=p.length;E<A;E++){const[C,B]=p[E];if(C===""){y=[],S.push([]);continue}if(d>0&&C.length>=d){y=[],S.push([{content:C,offset:B,color:"",fontStyle:0}]);continue}let P,U,I;u.includeExplanation&&(P=l.tokenizeLine(C,m),U=P.tokens,I=0);const Y=l.tokenizeLine2(C,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]:C.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:C.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 kt=0;for(;fe+kt<te;){const Ye=U[I],Fe=C.substring(Ye.startIndex,Ye.endIndex);kt+=Fe.length,Re.explanation.push({content:Fe,scopes:u.includeExplanation==="scopeName"?uE(Ye.scopes):cE(Ke,Ye.scopes)}),I+=1}}y.push(Re)}S.push(y),y=[],m=Y.ruleStack}return{tokens:S,stateStack:m}}function uE(i){return i.map(l=>({scopeName:l}))}function cE(i,l){const r=[];for(let s=0,u=l.length;s<u;s++){const f=l[s];r[s]={scopeName:f,themeMatches:dE(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 fE(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 dE(i,l,r){const s=[];for(const{selectors:u,settings:f}of i)for(const d of u)if(fE(d,l,r)){s.push(f);break}return s}function E_(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=Nf(i,l,{...r,theme:p.theme}),y=mr(m),S=typeof p.theme=="string"?p.theme:p.theme.name;return{tokens:m,state:y,theme:S}}),f=hE(...u.map(p=>p.tokens)),d=f[0].map((p,m)=>p.map((y,S)=>{const E={content:y.content,variants:{},offset:y.offset};return"includeExplanation"in r&&r.includeExplanation&&(E.explanation=y.explanation),f.forEach((A,C)=>{const{content:B,explanation:P,offset:U,...I}=A[m][S];E.variants[s[C].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&&yo(d,g),d}function hE(...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,S=Object.entries(r.themes).filter(P=>P[1]).map(P=>({color:P[0],theme:P[1]})).sort((P,U)=>P.color===m?-1:U.color===m?1:0);if(S.length===0)throw new sl("`themes` option must not be empty");const E=E_(i,l,r);if(p=mr(E),m&&!S.find(P=>P.color===m))throw new sl(`\`themes\` option must contain the defaultColor key \`${m}\``);const A=S.map(P=>i.getTheme(P.theme)),C=S.map(P=>P.color);f=E.map(P=>P.map(U=>mE(U,C,y,m))),p&&yo(f,p);const B=S.map(P=>so(P.theme,r));u=S.map((P,U)=>(U===0&&m?"":`${y+P.color}:`)+(ta(A[U].fg,B[U])||"inherit")).join(";"),s=S.map((P,U)=>(U===0&&m?"":`${y+P.color}-bg:`)+(ta(A[U].bg,B[U])||"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=Nf(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 mE(i,l,r,s){const u={content:i.content,explanation:i.explanation,offset:i.offset},f=l.map(p=>v_(i.variants[p])),d=new Set(f.flatMap(p=>Object.keys(p))),g={};return f.forEach((p,m)=>{for(const y of d){const S=p[y]||"inherit";if(m===0&&s)g[y]=S;else{const E=y==="color"?"":y==="background-color"?"-bg":`-${y}`,A=r+l[m]+(y==="color"?"":E);g[A]=S}}}),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,C;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:S=!0}=r;S===!0?f=gE(f):S==="never"&&(f=_E(f));const E={...s,get source(){return u}};for(const B of oo(r))f=((C=B.tokens)==null?void 0:C.call(E,f))||f;return pE(f,{...r,fg:d,bg:g,themeName:p,rootStyle:m},E,y)}function pE(i,l,r,s=mr(i)){var C,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(([U])=>!U.startsWith("_")))},children:[]},y={type:"element",tagName:"code",properties:{},children:f};const S=[],E={...r,structure:g,addClassToHast:__,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 S}};if(i.forEach((U,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 U){let Ue={type:"element",tagName:"span",properties:{...te.htmlAttrs},children:[{type:"text",value:te.content}]};te.htmlStyle;const pt=Z1(te.htmlStyle||v_(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;S.push(Y),f.push(Y)}}),g==="classic"){for(const U of u)y=((C=U==null?void 0:U.code)==null?void 0:C.call(E,y))||y;m.children.push(y);for(const U of u)m=((B=U==null?void 0:U.pre)==null?void 0:B.call(E,m))||m;d.children.push(m)}let A=d;for(const U of u)A=((P=U==null?void 0:U.root)==null?void 0:P.call(E,A))||A;return s&&yo(A,s),A}function gE(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 _E(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 yE(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=I1(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,S;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 C;if(f.has(E))return f.get(E);u+=1;const A=`#${u.toString(16).padStart(8,"0").toLowerCase()}`;return(C=l.colorReplacements)!=null&&C[`#${A}`]?d(E):(f.set(E,A),A)}l.settings=l.settings.map(E=>{var P,U;const A=((P=E.settings)==null?void 0:P.foreground)&&!E.settings.foreground.startsWith("#"),C=((U=E.settings)==null?void 0:U.background)&&!E.settings.background.startsWith("#");if(!A&&!C)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(C){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"))&&!((S=l.colors[E])!=null&&S.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 x_(i){return Array.from(new Set((await Promise.all(i.filter(l=>!p_(l)).map(async l=>await y_(l).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function T_(i){return(await Promise.all(i.map(async r=>g_(r)?null:wf(await y_(r))))).filter(r=>!!r)}class vE extends CS{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 S;return(S=y.embeddedLangsLazy)==null?void 0:S.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 bE{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 SE(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 bE(i.engine,r),f=new vE(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 S(){return P(),f.getLoadedLanguages()}function E(...I){P(),f.loadLanguages(I.flat(1))}async function A(...I){return E(await x_(I))}function C(...I){P();for(const Y of I.flat(1))f.loadTheme(Y)}async function B(...I){return P(),C(await T_(I))}function P(){if(l)throw new Rt("Shiki instance has been disposed")}function U(){l||(l=!0,f.dispose(),ir-=1)}return{setTheme:m,getTheme:p,getLanguage:g,getLoadedThemes:y,getLoadedLanguages:S,loadLanguage:A,loadLanguageSync:E,loadTheme:B,loadThemeSync:C,dispose:U,[Symbol.dispose]:U}}async function EE(i={}){i.loadWasm;const[l,r,s]=await Promise.all([T_(i.themes||[]),x_(i.langs||[]),i.engine||Vg(i.loadWasm||Ib())]);return SE({...i,themes:l,langs:r,engine:s})}async function xE(i={}){const l=await EE(i);return{getLastGrammarState:(...r)=>sE(l,...r),codeToTokensBase:(r,s)=>Nf(l,r,s),codeToTokensWithThemes:(r,s)=>E_(l,r,s),codeToTokens:(r,s)=>co(l,r,s),codeToHast:(r,s)=>fo(l,r,s),codeToHtml:(r,s)=>yE(l,r,s),...l,getInternalContext:()=>l}}function TE(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(p_(A))return[];const C=s[A];if(!C)throw new sl(`Language \`${A}\` is not included in this bundle. You may want to load it from external source.`);return C}return A}function m(A){if(g_(A))return"none";if(typeof A=="string"){const C=u[A];if(!C)throw new sl(`Theme \`${A}\` is not included in this bundle. You may want to load it from external source.`);return C}return A}const y=(g.themes??[]).map(A=>m(A)),S=(g.langs??[]).map(A=>p(A)),E=await xE({engine:g.engine??f(),...g,themes:y,langs:S});return{...E,loadLanguage(...A){return E.loadLanguage(...A.map(p))},loadTheme(...A){return E.loadTheme(...A.map(m))}}}return d}function AE(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 RE(i){const l=AE(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 OE=TE({langs:Eb,themes:Tb,engine:()=>Vg(b(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:CE}=RE(OE);let rr=null;async function DE(){if(rr)return rr;try{rr={attachmentBaseUrl:(await(await fetch("/api/config")).json()).fileAttachmentBaseUrl||""}}catch{rr={attachmentBaseUrl:""}}return rr}function LE(i,l){return l?i.replace(/attach:\/\/([^\s)]+)/g,(r,s)=>`${l}/${s}`):i}function kE(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}const NE={heading({text:i,depth:l}){const r=kE(i);return`<h${l} id="${r}">${i}</h${l}>`}};Te.use({renderer:NE});function wE(i){return i.replace(new RegExp("(?<![[\\w/])#([a-z0-9]+-[a-z0-9]+)(?![(\\]\\w])","gi"),(l,r)=>`[#${r}](#/detail/${r})`)}const yg=new Map;function ME({issue:i,style:l}){return v.jsxs("div",{className:"fixed z-50 rounded-lg shadow-lg text-sm max-w-xs pointer-events-none",style:{...l,background:"var(--bg-elevated)",border:"1px solid var(--border-default)",padding:"10px 12px"},children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{background:i.status==="closed"?"#8b8b8b":i.status==="in_progress"?"#f59e0b":i.status==="blocked"?"#ef4444":"#3b82f6"}}),v.jsx("span",{className:"font-medium truncate",style:{color:"var(--text-primary)"},children:i.title})]}),v.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{color:"var(--text-tertiary)"},children:[v.jsx("span",{children:i.issue_type}),v.jsx("span",{children:"·"}),v.jsx("span",{children:i.status.replace("_"," ")}),i.assignee&&v.jsxs(v.Fragment,{children:[v.jsx("span",{children:"·"}),v.jsx("span",{children:i.assignee})]})]})]})}function vg({content:i}){const[l,r]=$.useState(""),[s,u]=$.useState(null),f=$.useRef(null),d=$.useRef(),g=ho(),p=$.useCallback(y=>{var C,B,P;const S=(B=(C=y.target).closest)==null?void 0:B.call(C,"a[href*='#/detail/']");if(!S)return;const E=(P=S.getAttribute("href"))==null?void 0:P.match(/#\/detail\/(.+)/);if(!E)return;const A=E[1];clearTimeout(d.current),d.current=setTimeout(async()=>{let U=yg.get(A)??null;if(U||(U=await g.fetchIssue(A),U&&yg.set(A,U)),U){const I=S.getBoundingClientRect();u({issue:U,x:I.left,y:I.bottom+6})}},300)},[g]),m=$.useCallback(y=>{var E,A;(A=(E=y.target).closest)!=null&&A.call(E,"a[href*='#/detail/']")&&(clearTimeout(d.current),u(null))},[]);return $.useEffect(()=>{const y=f.current;if(y)return y.addEventListener("mouseover",p),y.addEventListener("mouseout",m),()=>{y.removeEventListener("mouseover",p),y.removeEventListener("mouseout",m),clearTimeout(d.current)}},[p,m]),$.useEffect(()=>{if(!i){r("");return}let y=!1;async function S(){const E=await DE();let A=LE(i,E.attachmentBaseUrl);A=wE(A);const C=Te.lexer(A),B=[];Te.walkTokens(C,Z=>{Z.type==="code"&&B.push({code:Z.text,lang:Z.lang||"text"})});const P=await Promise.all(B.map(async Z=>{try{return await CE(Z.code,{lang:Z.lang,theme:"github-light"})}catch{return`<pre><code>${Zp.sanitize(Z.code)}</code></pre>`}}));let U=Te.parser(C),I=0;U=U.replace(/<pre><code[^>]*>[\s\S]*?<\/code><\/pre>/g,()=>P[I++]||"");const Y=Zp.sanitize(U,{ADD_TAGS:["span"],ADD_ATTR:["style","class","id"]});y||r(Y)}return S(),()=>{y=!0}},[i]),v.jsxs(v.Fragment,{children:[v.jsx("div",{ref:f,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 U){let Ue={type:"element",tagName:"span",properties:{...te.htmlAttrs},children:[{type:"text",value:te.content}]};te.htmlStyle;const pt=Z1(te.htmlStyle||v_(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;S.push(Y),f.push(Y)}}),g==="classic"){for(const U of u)y=((C=U==null?void 0:U.code)==null?void 0:C.call(E,y))||y;m.children.push(y);for(const U of u)m=((B=U==null?void 0:U.pre)==null?void 0:B.call(E,m))||m;d.children.push(m)}let A=d;for(const U of u)A=((P=U==null?void 0:U.root)==null?void 0:P.call(E,A))||A;return s&&yo(A,s),A}function gE(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 _E(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 yE(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=I1(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,S;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 C;if(f.has(E))return f.get(E);u+=1;const A=`#${u.toString(16).padStart(8,"0").toLowerCase()}`;return(C=l.colorReplacements)!=null&&C[`#${A}`]?d(E):(f.set(E,A),A)}l.settings=l.settings.map(E=>{var P,U;const A=((P=E.settings)==null?void 0:P.foreground)&&!E.settings.foreground.startsWith("#"),C=((U=E.settings)==null?void 0:U.background)&&!E.settings.background.startsWith("#");if(!A&&!C)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(C){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"))&&!((S=l.colors[E])!=null&&S.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 x_(i){return Array.from(new Set((await Promise.all(i.filter(l=>!p_(l)).map(async l=>await y_(l).then(r=>Array.isArray(r)?r:[r])))).flat()))}async function T_(i){return(await Promise.all(i.map(async r=>g_(r)?null:wf(await y_(r))))).filter(r=>!!r)}class vE extends CS{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 S;return(S=y.embeddedLangsLazy)==null?void 0:S.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 bE{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 SE(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 bE(i.engine,r),f=new vE(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 S(){return P(),f.getLoadedLanguages()}function E(...I){P(),f.loadLanguages(I.flat(1))}async function A(...I){return E(await x_(I))}function C(...I){P();for(const Y of I.flat(1))f.loadTheme(Y)}async function B(...I){return P(),C(await T_(I))}function P(){if(l)throw new Rt("Shiki instance has been disposed")}function U(){l||(l=!0,f.dispose(),ir-=1)}return{setTheme:m,getTheme:p,getLanguage:g,getLoadedThemes:y,getLoadedLanguages:S,loadLanguage:A,loadLanguageSync:E,loadTheme:B,loadThemeSync:C,dispose:U,[Symbol.dispose]:U}}async function EE(i={}){i.loadWasm;const[l,r,s]=await Promise.all([T_(i.themes||[]),x_(i.langs||[]),i.engine||Vg(i.loadWasm||Ib())]);return SE({...i,themes:l,langs:r,engine:s})}async function xE(i={}){const l=await EE(i);return{getLastGrammarState:(...r)=>sE(l,...r),codeToTokensBase:(r,s)=>Nf(l,r,s),codeToTokensWithThemes:(r,s)=>E_(l,r,s),codeToTokens:(r,s)=>co(l,r,s),codeToHast:(r,s)=>fo(l,r,s),codeToHtml:(r,s)=>yE(l,r,s),...l,getInternalContext:()=>l}}function TE(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(p_(A))return[];const C=s[A];if(!C)throw new sl(`Language \`${A}\` is not included in this bundle. You may want to load it from external source.`);return C}return A}function m(A){if(g_(A))return"none";if(typeof A=="string"){const C=u[A];if(!C)throw new sl(`Theme \`${A}\` is not included in this bundle. You may want to load it from external source.`);return C}return A}const y=(g.themes??[]).map(A=>m(A)),S=(g.langs??[]).map(A=>p(A)),E=await xE({engine:g.engine??f(),...g,themes:y,langs:S});return{...E,loadLanguage(...A){return E.loadLanguage(...A.map(p))},loadTheme(...A){return E.loadTheme(...A.map(m))}}}return d}function AE(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 RE(i){const l=AE(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 OE=TE({langs:Eb,themes:Tb,engine:()=>Vg(b(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:CE}=RE(OE);let rr=null;async function DE(){if(rr)return rr;try{rr={attachmentBaseUrl:(await(await fetch("/api/config")).json()).fileAttachmentBaseUrl||""}}catch{rr={attachmentBaseUrl:""}}return rr}function LE(i,l){return l?i.replace(/attach:\/\/([^\s)]+)/g,(r,s)=>`${l}/${s}`):i}function kE(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}const NE={heading({text:i,depth:l}){const r=kE(i),s=i.replace(/#([a-z0-9]+-[a-z0-9]+)/gi,(u,f)=>`<a href="#/detail/${f}">#${f}</a>`);return`<h${l} id="${r}">${s}</h${l}>`}};Te.use({renderer:NE});function wE(i){return i.split(`
118
+ `).map(l=>/^\s*#{1,6}\s/.test(l)?l:l.replace(new RegExp("(?<![[\\w/])#([a-z0-9]+-[a-z0-9]+)(?![(\\]\\w])","gi"),(r,s)=>`[#${s}](#/detail/${s})`)).join(`
119
+ `)}const yg=new Map;function ME({issue:i,style:l}){return v.jsxs("div",{className:"fixed z-50 rounded-lg shadow-lg text-sm max-w-xs pointer-events-none",style:{...l,background:"var(--bg-elevated)",border:"1px solid var(--border-default)",padding:"10px 12px"},children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0",style:{background:i.status==="closed"?"#8b8b8b":i.status==="in_progress"?"#f59e0b":i.status==="blocked"?"#ef4444":"#3b82f6"}}),v.jsx("span",{className:"font-medium truncate",style:{color:"var(--text-primary)"},children:i.title})]}),v.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{color:"var(--text-tertiary)"},children:[v.jsx("span",{children:i.issue_type}),v.jsx("span",{children:"·"}),v.jsx("span",{children:i.status.replace("_"," ")}),i.assignee&&v.jsxs(v.Fragment,{children:[v.jsx("span",{children:"·"}),v.jsx("span",{children:i.assignee})]})]})]})}function vg({content:i}){const[l,r]=$.useState(""),[s,u]=$.useState(null),f=$.useRef(null),d=$.useRef(),g=ho(),p=$.useCallback(y=>{var C,B,P;const S=(B=(C=y.target).closest)==null?void 0:B.call(C,"a[href*='#/detail/']");if(!S)return;const E=(P=S.getAttribute("href"))==null?void 0:P.match(/#\/detail\/(.+)/);if(!E)return;const A=E[1];clearTimeout(d.current),d.current=setTimeout(async()=>{let U=yg.get(A)??null;if(U||(U=await g.fetchIssue(A),U&&yg.set(A,U)),U){const I=S.getBoundingClientRect();u({issue:U,x:I.left,y:I.bottom+6})}},300)},[g]),m=$.useCallback(y=>{var E,A;(A=(E=y.target).closest)!=null&&A.call(E,"a[href*='#/detail/']")&&(clearTimeout(d.current),u(null))},[]);return $.useEffect(()=>{const y=f.current;if(y)return y.addEventListener("mouseover",p),y.addEventListener("mouseout",m),()=>{y.removeEventListener("mouseover",p),y.removeEventListener("mouseout",m),clearTimeout(d.current)}},[p,m]),$.useEffect(()=>{if(!i){r("");return}let y=!1;async function S(){const E=await DE();let A=LE(i,E.attachmentBaseUrl);A=wE(A);const C=Te.lexer(A),B=[];Te.walkTokens(C,Z=>{Z.type==="code"&&B.push({code:Z.text,lang:Z.lang||"text"})});const P=await Promise.all(B.map(async Z=>{try{return await CE(Z.code,{lang:Z.lang,theme:"github-light"})}catch{return`<pre><code>${Zp.sanitize(Z.code)}</code></pre>`}}));let U=Te.parser(C),I=0;U=U.replace(/<pre><code[^>]*>[\s\S]*?<\/code><\/pre>/g,()=>P[I++]||"");const Y=Zp.sanitize(U,{ADD_TAGS:["span"],ADD_ATTR:["style","class","id"]});y||r(Y)}return S(),()=>{y=!0}},[i]),v.jsxs(v.Fragment,{children:[v.jsx("div",{ref:f,className:`prose prose-stone prose-sm max-w-none
118
120
  prose-pre:bg-stone-50 prose-pre:border prose-pre:border-stone-200 prose-pre:rounded
119
121
  prose-code:text-sm prose-code:font-mono
120
122
  prose-headings:font-semibold prose-headings:text-stone-900
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-DyJM0kO4.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DrUENR-w.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-D-em53VA.css">
9
9
  </head>
10
10
  <body style="background: #FDFBF7; color: #1A1A1A;">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsktash/beads-ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rsktash/beads-ui.git"