kaizen-agent 1.9.4 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/agents/kaizen-builder.md +4 -1
- package/cli/board.test.ts +48 -0
- package/cli/install.test.ts +85 -0
- package/cli/install.ts +46 -10
- package/cli/notes.test.ts +1 -1
- package/cli/settings.test.ts +50 -0
- package/cli/settings.ts +90 -35
- package/cli/sources.test.ts +44 -5
- package/cli/sources.ts +11 -6
- package/cli/state.test.ts +214 -2
- package/cli/state.ts +211 -14
- package/cli/web.ts +70 -14
- package/package.json +1 -1
- package/skills/kaizen/SKILL.md +1 -0
- package/skills/kaizen/config.default.yml +10 -4
- package/skills/kaizen/spec-build.md +17 -0
- package/skills/kaizen/spec-plan.md +6 -1
- package/web/board.html +214 -49
- package/web/notebook.js +2 -2
- package/web/notes-lib.ts +1 -1
- package/web/notes.html +1 -0
package/web/notebook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen notebook
|
|
1
|
+
/* kaizen notebook fbde35e41747e8e6 -- generated by bun run build:web from web/notebook.ts; do not edit */
|
|
2
2
|
var Ss=[],ua=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map((t)=>t?parseInt(t,36):1);for(let t=0,i=0;t<e.length;t++)(t%2?ua:Ss).push(i=i+e[t])})();function op(e){if(e<768)return!1;for(let t=0,i=Ss.length;;){let n=t+i>>1;if(e<Ss[n])i=n;else if(e>=ua[n])t=n+1;else return!0;if(t==i)return!1}}function ha(e){return e>=127462&&e<=127487}var fa=8205;function da(e,t,i=!0,n=!0){return(i?Oa:lp)(e,t,n)}function Oa(e,t,i){if(t==e.length)return t;if(t&&pa(e.charCodeAt(t))&&ma(e.charCodeAt(t-1)))t--;let n=bs(e,t);t+=ca(n);while(t<e.length){let r=bs(e,t);if(n==fa||r==fa||i&&op(r))t+=ca(r),n=r;else if(ha(r)){let s=0,o=t-2;while(o>=0&&ha(bs(e,o)))s++,o-=2;if(s%2==0)break;else t+=2}else break}return t}function lp(e,t,i){while(t>1){let n=Oa(e,t-2,i);if(n<t)return n;t--}return 0}function bs(e,t){let i=e.charCodeAt(t);if(!ma(i)||t+1==e.length)return i;let n=e.charCodeAt(t+1);if(!pa(n))return i;return(i-55296<<10)+(n-56320)+65536}function pa(e){return e>=56320&&e<57344}function ma(e){return e>=55296&&e<56320}function ca(e){return e<65536?1:2}class _{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=vi(this,e,t);let n=[];if(this.decompose(0,e,n,2),i.length)i.decompose(0,i.length,n,3);return this.decompose(t,this.length,n,1),ft.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vi(this,e,t);let i=[];return this.decompose(e,t,i,0),ft.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new wi(this),r=new wi(e);for(let s=t,o=t;;){if(n.next(s),r.next(s),s=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new wi(this,e)}iterRange(e,t=this.length){return new Ts(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{if(t==null)t=this.lines+1;let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new As(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return _.empty;return e.length<=32?new oe(e):ft.from(oe.split(e,[]))}}class oe extends _{constructor(e,t=ap(e)){super();this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let r=0;;r++){let s=this.text[r],o=n+s.length;if((t?i:o)>=e)return new ka(n,o,i,s);n=o+1,i++}}decompose(e,t,i,n){let r=e<=0&&t>=this.length?this:new oe(ga(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let s=i.pop(),o=cr(r.text,s.text.slice(),0,r.length);if(o.length<=32)i.push(new oe(o,s.length+r.length));else{let l=o.length>>1;i.push(new oe(o.slice(0,l)),new oe(o.slice(l)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof oe))return super.replace(e,t,i);[e,t]=vi(this,e,t);let n=cr(this.text,cr(i.text,ga(this.text,0,e)),t),r=this.length+i.length-(t-e);if(n.length<=32)return new oe(n,r);return ft.from(oe.split(n,[]),r)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=vi(this,e,t);let n="";for(let r=0,s=0;r<=t&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;if(r>e&&s)n+=i;if(e<l&&t>r)n+=o.slice(Math.max(0,e-r),t-r);r=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let r of e)if(i.push(r),n+=r.length+1,i.length==32)t.push(new oe(i,n)),i=[],n=-1;if(n>-1)t.push(new oe(i,n));return t}}class ft extends _{constructor(e,t){super();this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let r=0;;r++){let s=this.children[r],o=n+s.length,l=i+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,i,n);n=o+1,i=l+1}}decompose(e,t,i,n){for(let r=0,s=0;s<=t&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e<=l&&t>=s){let a=n&((s<=e?1:0)|(l>=t?2:0));if(s>=e&&l<=t&&!a)i.push(o);else o.decompose(e-s,t-s,i,a)}s=l+1}}replace(e,t,i){if([e,t]=vi(this,e,t),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],o=r+s.length;if(e>=r&&t<=o){let l=s.replace(e-r,t-r,i),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let h=this.children.slice();return h[n]=l,new ft(h,this.length-(t-e)+i.length)}return super.replace(r,o,l)}r=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
4
4
|
`){[e,t]=vi(this,e,t);let n="";for(let r=0,s=0;r<this.children.length&&s<=t;r++){let o=this.children[r],l=s+o.length;if(s>e&&r)n+=i;if(e<l&&t>s)n+=o.sliceString(e-s,t-s,i);s=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ft))return 0;let i=0,[n,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==s||r==o)return i;let l=this.children[n],a=e.children[r];if(l!=a)return i+l.scanIdentical(a,t);i+=l.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let d of e)d.flatten(u);return new oe(u,t)}let n=Math.max(32,i>>5),r=n<<1,s=n>>1,o=[],l=0,a=-1,h=[];function f(u){let d;if(u.lines>r&&u instanceof ft)for(let O of u.children)f(O);else if(u.lines>s&&(l>s||!l))c(),o.push(u);else if(u instanceof oe&&l&&(d=h[h.length-1])instanceof oe&&u.lines+d.lines<=32)l+=u.lines,a+=u.length+1,h[h.length-1]=new oe(d.text.concat(u.text),d.length+1+u.length);else{if(l+u.lines>n)c();l+=u.lines,a+=u.length+1,h.push(u)}}function c(){if(l==0)return;o.push(h.length==1?h[0]:ft.from(h,a)),a=-1,l=h.length=0}for(let u of e)f(u);return c(),o.length==1?o[0]:new ft(o,t)}}_.empty=new oe([""],0);function ap(e){let t=-1;for(let i of e)t+=i.length+1;return t}function cr(e,t,i=0,n=1e9){for(let r=0,s=0,o=!0;s<e.length&&r<=n;s++){let l=e[s],a=r+l.length;if(a>=i){if(a>n)l=l.slice(0,n-r);if(r<i)l=l.slice(i-r);if(o)t[t.length-1]+=l,o=!1;else t.push(l)}r=a+1}return t}function ga(e,t,i){return cr(e,[""],t,i)}class wi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof oe?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=!1;for(;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],s=r>>1,o=n instanceof oe?n.text.length:n.children.length;if(s==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;if(t>0)this.offsets[i-1]++;this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
@@ -27,7 +27,7 @@ var Ss=[],ua=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,
|
|
|
27
27
|
}
|
|
28
28
|
}`,{label:"class",detail:"definition",type:"keyword"}),xe('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),xe('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],kS=lO.concat([xe("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),xe("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),xe("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),rO=new Tn,aO=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function er(e){return(t,i)=>{let n=t.node.getChild("VariableDefinition");if(n)i(n,e);return!0}}var xS=["FunctionDeclaration"],wS={FunctionDeclaration:er("function"),ClassDeclaration:er("class"),ClassExpression:()=>!0,EnumDeclaration:er("constant"),TypeAliasDeclaration:er("type"),NamespaceDeclaration:er("namespace"),VariableDefinition(e,t){if(!e.matchContext(xS))t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function hO(e,t){let i=rO.get(t);if(i)return i;let n=[],r=!0;function s(o,l){let a=e.sliceString(o.from,o.to);n.push({label:a,type:l})}return t.cursor(E.IncludeAnonymous).iterate((o)=>{if(r)r=!1;else if(o.name){let l=wS[o.name];if(l&&l(o,s)||aO.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of hO(e,o.node))n.push(l);return!1}}),rO.set(t,n),n}var sO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,fO=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function $S(e){let t=Y(e.state).resolveInner(e.pos,-1);if(fO.indexOf(t.name)>-1)return null;let i=t.name=="VariableName"||t.to-t.from<20&&sO.test(e.state.sliceDoc(t.from,t.to));if(!i&&!e.explicit)return null;let n=[];for(let r=t;r;r=r.parent)if(aO.has(r.name))n=n.concat(hO(e.state.doc,r));return{options:n,from:i?t.from:e.pos,validFor:sO}}var at=vt.define({name:"javascript",parser:nO.configure({props:[Pt.add({IfStatement:qi({except:/^\s*({|else\b)/}),TryStatement:qi({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ac,SwitchBody:(e)=>{let t=e.textAfter,i=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(i?0:n?1:2)*e.unit},Block:oc({closing:"}"}),ArrowFunction:(e)=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":qi({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Ct.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Nr,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let i=e.lastChild;return{from:t.to,to:i.type.isError?e.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let i=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;if(!i||i.type.isError)return null;return{from:i.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),cO={test:(e)=>/^JSX/.test(e.name),facet:Rn({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zl=at.configure({dialect:"ts"},"typescript"),Yl=at.configure({dialect:"jsx",props:[Vr.add((e)=>e.isTop?[cO]:void 0)]}),Wl=at.configure({dialect:"jsx ts",props:[Vr.add((e)=>e.isTop?[cO]:void 0)]},"typescript"),uO=(e)=>({label:e,type:"keyword"}),dO="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(uO),vS=dO.concat(["declare","implements","private","protected","public"].map(uO));function OO(e={}){let t=e.jsx?e.typescript?Wl:Yl:e.typescript?zl:at,i=e.typescript?kS.concat(vS):lO.concat(dO);return new gt(t,[at.data.of({autocomplete:fu(fO,il(i))}),at.data.of({autocomplete:$S}),e.jsx?XS:[]])}function PS(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function oO(e,t,i=e.length){for(let n=t===null||t===void 0?void 0:t.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,i));return""}var CS=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),XS=C.inputHandler.of((e,t,i,n,r)=>{if((CS?e.composing:e.compositionStarted)||e.state.readOnly||t!=i||n!=">"&&n!="/"||!at.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange((a)=>{var h;let{head:f}=a,c=Y(o).resolveInner(f-1,-1),u;if(c.name=="JSXStartTag")c=c.parent;if(o.doc.sliceString(f-1,f)!=n||c.name=="JSXAttributeValue"&&c.to>f);else if(n==">"&&c.name=="JSXFragmentTag")return{range:a,changes:{from:f,insert:"</>"}};else if(n=="/"&&c.name=="JSXStartCloseTag"){let d=c.parent,O=d.parent;if(O&&d.from==f-2&&((u=oO(o.doc,O.firstChild,f))||((h=O.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let m=`${u}>`;return{range:y.cursor(f+m.length,-1),changes:{from:f,insert:m}}}}else if(n==">"){let d=PS(c);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(f,f+2))&&(u=oO(o.doc,d,f)))return{range:a,changes:{from:f,insert:`</${u}>`}}}return{range:a}});if(l.changes.empty)return!1;return e.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0});var tr=["_blank","_self","_top","_parent"],ql=["ascii","utf-8","utf-16","latin1","latin1"],Dl=["get","post","put","delete"],Bl=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Le=["true","false"],X={},TS={a:{attrs:{href:null,ping:null,type:null,media:null,target:tr,hreflang:null}},abbr:X,address:X,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:X,aside:X,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:X,base:{attrs:{href:null,target:tr}},bdi:X,bdo:X,blockquote:{attrs:{cite:null}},body:X,br:X,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Bl,formmethod:Dl,formnovalidate:["novalidate"],formtarget:tr,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:X,center:X,cite:X,code:X,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:X,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:X,div:X,dl:X,dt:X,em:X,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:X,figure:X,footer:X,form:{attrs:{action:null,name:null,"accept-charset":ql,autocomplete:["on","off"],enctype:Bl,method:Dl,novalidate:["novalidate"],target:tr}},h1:X,h2:X,h3:X,h4:X,h5:X,h6:X,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:X,hgroup:X,hr:X,html:{attrs:{manifest:null}},i:X,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Bl,formmethod:Dl,formnovalidate:["novalidate"],formtarget:tr,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:X,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:X,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:X,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:ql,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:X,noscript:X,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:X,param:{attrs:{name:null,value:null}},pre:X,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:X,rt:X,ruby:X,samp:X,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:ql}},section:X,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:X,source:{attrs:{src:null,type:null,media:null}},span:X,strong:X,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:X,summary:X,sup:X,table:X,tbody:X,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:X,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:X,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:X,time:{attrs:{datetime:null}},title:X,tr:X,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:X,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:X},bO={accesskey:null,class:null,contenteditable:Le,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Le,autocorrect:Le,autocapitalize:Le,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Le,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Le,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Le,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Le,"aria-hidden":Le,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Le,"aria-multiselectable":Le,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Le,"aria-relevant":null,"aria-required":Le,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},SO="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((e)=>"on"+e);for(let e of SO)bO[e]=null;class Fi{constructor(e,t){this.tags={...TS,...e},this.globalAttrs={...bO,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Fi.default=new Fi;function gi(e,t,i=e.length){if(!t)return"";let n=t.firstChild,r=n&&n.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,i)):""}function Hi(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function yO(e,t,i){let n=i.tags[gi(e,Hi(t))];return(n===null||n===void 0?void 0:n.children)||i.allTags}function Il(e,t){let i=[];for(let n=Hi(t);n&&!n.type.isTop;n=Hi(n.parent)){let r=gi(e,n);if(r&&n.lastChild.name=="CloseTag")break;if(r&&i.indexOf(r)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to))i.push(r)}return i}var QO=/^[:\-\.\w\u00b7-\uffff]*$/;function pO(e,t,i,n,r){let s=/\s*>/.test(e.sliceDoc(r,r+5))?"":">",o=Hi(i,i.name=="StartTag"||i.name=="TagName");return{from:n,to:r,options:yO(e.doc,o,t).map((l)=>({label:l,type:"type"})).concat(Il(e.doc,i).map((l,a)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function mO(e,t,i,n){let r=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Il(e.doc,t).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:QO}}function AS(e,t,i,n){let r=[],s=0;for(let o of yO(e.doc,i,t))r.push({label:"<"+o,type:"type"});for(let o of Il(e.doc,i))r.push({label:"</"+o+">",type:"type",boost:99-s++});return{from:n,to:n,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ZS(e,t,i,n,r){let s=Hi(i),o=s?t.tags[gi(e.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:r,options:a.map((h)=>({label:h,type:"property"})),validFor:QO}}function RS(e,t,i,n,r){var s;let o=(s=i.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],a=void 0;if(o){let h=e.sliceDoc(o.from,o.to),f=t.globalAttrs[h];if(!f){let c=Hi(i),u=c?t.tags[gi(e.doc,c)]:null;f=(u===null||u===void 0?void 0:u.attrs)&&u.attrs[h]}if(f){let c=e.sliceDoc(n,r).toLowerCase(),u='"',d='"';if(/^['"]/.test(c))a=c[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",d=e.sliceDoc(r,r+1)==c[0]?"":c[0],c=c.slice(1),n++;else a=/^[^\s<>='"]*$/;for(let O of f)l.push({label:O,apply:u+O+d,type:"constant"})}}return{from:n,to:r,options:l,validFor:a}}function kO(e,t){let{state:i,pos:n}=t,r=Y(i).resolveInner(n,-1),s=r.resolve(n);for(let o=n,l;s==r&&(l=r.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.from<a.to)break;s=r=l,o=a.from}if(r.name=="TagName")return r.parent&&/CloseTag$/.test(r.parent.name)?mO(i,r,r.from,n):pO(i,e,r,r.from,n);else if(r.name=="StartTag"||r.name=="IncompleteTag")return pO(i,e,r,n,n);else if(r.name=="StartCloseTag"||r.name=="IncompleteCloseTag")return mO(i,r,n,n);else if(r.name=="OpenTag"||r.name=="SelfClosingTag"||r.name=="AttributeName")return ZS(i,e,r,r.name=="AttributeName"?r.from:n,n);else if(r.name=="Is"||r.name=="AttributeValue"||r.name=="UnquotedAttributeValue")return RS(i,e,r,r.name=="Is"?n:r.from,n);else if(t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document"))return AS(i,e,r,n);else return null}function xO(e){return kO(Fi.default,e)}function MS(e){let{extraTags:t,extraGlobalAttributes:i}=e,n=i||t?new Fi(t,i):Fi.default;return(r)=>kO(n,r)}var jS=at.parser.configure({top:"SingleExpression"}),wO=[{tag:"script",attrs:(e)=>e.type=="text/typescript"||e.lang=="ts",parser:zl.parser},{tag:"script",attrs:(e)=>e.type=="text/babel"||e.type=="text/jsx",parser:Yl.parser},{tag:"script",attrs:(e)=>e.type=="text/typescript-jsx",parser:Wl.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:jS},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:at.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:Jn.parser}],$O=[{name:"style",parser:Jn.parser.configure({top:"Styles"})}].concat(SO.map((e)=>({name:e,parser:at.parser}))),vO=vt.define({name:"html",parser:Yd.configure({props:[Pt.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);if(e.node.to<=e.pos+t[0].length)return e.continue();return e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,i;for(let n=e.node;;){let r=n.lastChild;if(!r||r.name!="Element"||r.to!=n.to)break;t=n=r}if(t&&!((i=t.lastChild)&&(i.name=="CloseTag"||i.name=="SelfClosingTag")))return e.lineIndent(t.from)+e.unit;return null}}),Ct.add({Element(e){let{firstChild:t,lastChild:i}=e;if(!t||t.name!="OpenTag")return null;return{from:t.to,to:i.name=="CloseTag"?i.from:e.to}}}),Io.add({"OpenTag CloseTag":(e)=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ds=vO.configure({wrap:Zl(wO,$O)});function PO(e={}){let t="",i;if(e.matchClosingTags===!1)t="noMatch";if(e.selfClosingTags===!0)t=(t?t+" ":"")+"selfClosing";if(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)i=Zl((e.nestedLanguages||[]).concat(wO),(e.nestedAttributes||[]).concat($O));let n=i?vO.configure({wrap:i,dialect:t}):t?ds.configure({dialect:t}):ds;return new gt(n,[ds.data.of({autocomplete:MS(e)}),e.autoCloseTags!==!1?_S:[],OO().support,eO().support])}var gO=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function LS(e,t,i){var n;for(;;){if(((n=t.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag")return!1;let r=t.parent;if(!r||gi(e,r)!=i)return!0;t=r}}var _S=C.inputHandler.of((e,t,i,n,r)=>{if(e.composing||e.state.readOnly||t!=i||n!=">"&&n!="/"||!ds.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange((a)=>{var h;let f=o.doc.sliceString(a.from-1,a.to)==n,{head:c}=a,u=Y(o).resolveInner(c,-1),d;if(f&&n==">"&&u.name=="EndTag"){let O=u.parent;if((d=gi(o.doc,O.parent,c))&&!gO.has(d)&&!LS(o.doc,O.parent,d)){let m=c+(o.doc.sliceString(c,c+1)===">"?1:0),g=`</${d}>`;return{range:a,changes:{from:c,to:m,insert:g}}}}else if(f&&n=="/"&&u.name=="IncompleteCloseTag"){let O=u.parent;if(u.from==c-2&&((h=O.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(d=gi(o.doc,O,c))&&!gO.has(d)){let m=c+(o.doc.sliceString(c,c+1)===">"?1:0),g=`${d}>`;return{range:y.cursor(c+g.length,-1),changes:{from:c,to:m,insert:g}}}}return{range:a}});if(l.changes.empty)return!1;return e.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0});var TO=Rn({commentTokens:{block:{open:"<!--",close:"-->"}}}),AO=new Z,ZO=nd.configure({props:[Ct.add((e)=>!e.is("Block")||e.is("Document")||Nl(e)!=null||ES(e)?void 0:(t,i)=>({from:i.doc.lineAt(t.from).to,to:t.to})),AO.add(Nl),Pt.add({Document:()=>null}),Nt.add({Document:TO})]});function Nl(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function ES(e){return e.name=="OrderedList"||e.name=="BulletList"}function zS(e,t){let i=e;for(;;){let n=i.nextSibling,r;if(!n||(r=Nl(n.type))!=null&&r<=t)break;i=n}return i.to}var YS=hc.of((e,t,i)=>{for(let n=Y(e).resolveInner(i,-1);n;n=n.parent){if(n.from<t)break;let r=n.type.prop(AO);if(r==null)continue;let s=zS(n,r);if(s>i)return{from:i,to:s}}return null});function Gl(e){return new ve(TO,e,[],"markdown")}var WS=Gl(ZO),qS=ZO.configure([ld,fd,hd,cd,{props:[Ct.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),Ki=Gl(qS);function DS(e,t){return(i)=>{if(i&&e){let n=null;if(i=/\S*/.exec(i)[0],typeof e=="function")n=e(i);else n=Mn.matchLanguageName(e,i,!0);if(n instanceof Mn)return n.support?n.support.language.parser:Ei.getSkippingParser(n.load());else if(n)return n.parser}return t?t.parser:null}}class Os{constructor(e,t,i,n,r,s,o){this.node=e,this.from=t,this.to=i,this.spaceBefore=n,this.spaceAfter=r,this.type=s,this.item=o}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){while(i.length<e)i+=" ";return i}else{for(let n=this.to-this.from-i.length-this.spaceAfter.length;n>0;n--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+MO(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function RO(e,t){let i=[],n=[];for(let r=e;r;r=r.parent){if(r.name=="FencedCode")return n;if(r.name=="ListItem"||r.name=="Blockquote")i.push(r)}for(let r=i.length-1;r>=0;r--){let s=i[r],o,l=t.lineAt(s.from),a=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))n.push(new Os(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let h=o[3],f=o[0].length;if(h.length>=4)h=h.slice(0,h.length-4),f-=4;n.push(new Os(s.parent,a,a+f,o[1],h,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let h=o[4],f=o[0].length;if(h.length>4)h=h.slice(0,h.length-4),f-=4;let c=o[2];if(o[3])c+=o[3].replace(/[xX]/," ");n.push(new Os(s.parent,a,a+f,o[1],h,c,s))}}return n}function MO(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function Ul(e,t,i,n=0){for(let r=-1,s=e;;){if(s.name=="ListItem"){let l=MO(s,t),a=+l[2];if(r>=0){if(a!=r+1)return;i.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+n)})}r=a}let o=s.nextSibling;if(!o)break;s=o}}function Fl(e,t){let i=/^[ \t]*/.exec(e)[0].length;if(!i||t.facet(Gt)!="\t")return e;let n=Ae(e,4,i),r="";for(let s=n;s>0;)if(s>=4)r+="\t",s-=4;else r+=" ",s--;return r+e.slice(i)}var BS=(e={})=>({state:t,dispatch:i})=>{let n=Y(t),{doc:r}=t,s=null,o=t.changeByRange((l)=>{if(!l.empty||!Ki.isActiveAt(t,l.from,-1)&&!Ki.isActiveAt(t,l.from,1))return s={range:l};let a=l.from,h=r.lineAt(a),f=RO(n.resolveInner(a,-1),r);while(f.length&&f[f.length-1].from>a-h.from)f.pop();if(!f.length)return s={range:l};let c=f[f.length-1];if(c.to-c.spaceAfter.length>a-h.from)return s={range:l};let u=a>=c.to-c.spaceAfter.length&&!/\S/.test(h.text.slice(c.to));if(c.item&&u){if(c.item.from<h.from&&!/^[\s>]*$/.test(h.text.slice(0,c.to)))return s={range:l};let b=c.node.firstChild,S=c.node.getChild("ListItem","ListItem");if(b.to>=a||S&&S.to<a||h.from>0&&!/[^\s>]/.test(r.lineAt(h.from-1).text)||e.nonTightLists===!1){let k=f.length>1?f[f.length-2]:null,w,P="";if(k&&k.item)w=h.from+k.from,P=k.marker(r,1);else w=h.from+(k?k.to:0);let R=[{from:w,to:a,insert:P}];if(c.node.name=="OrderedList")Ul(c.item,r,R,-2);if(k&&k.node.name=="OrderedList")Ul(k.item,r,R);return{range:y.cursor(w+P.length),changes:R}}else{let k=XO(f,t,h);return{range:y.cursor(a+k.length+1),changes:{from:h.from,insert:k+t.lineBreak}}}}if(c.node.name=="Blockquote"&&u&&h.from){let b=r.lineAt(h.from-1),S=/>\s*$/.exec(b.text);if(S&&S.index==c.from){let k=t.changes([{from:b.from+S.index,to:b.to},{from:h.from+c.from,to:h.to}]);return{range:l.map(k),changes:k}}}let d=[];if(c.node.name=="OrderedList")Ul(c.item,r,d);let O=c.item&&c.item.from<h.from,m="";if(!O||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=c.to)for(let b=0,S=f.length-1;b<=S;b++)m+=b==S&&!O?f[b].marker(r,1):f[b].blank(b<S?Ae(h.text,4,f[b+1].from)-m.length:null);let g=a;while(g>h.from&&/\s/.test(h.text.charAt(g-h.from-1)))g--;if(m=Fl(m,t),US(c.node,t.doc))m=XO(f,t,h)+t.lineBreak+m;return d.push({from:g,to:a,insert:t.lineBreak+m}),{range:y.cursor(g+m.length+1),changes:d}});if(s)return!1;return i(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0},IS=BS();function CO(e){return e.name=="QuoteMark"||e.name=="ListMark"}function US(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let i=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let r=t.lineAt(i.to),s=t.lineAt(n.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<s.number}function XO(e,t,i){let n="";for(let r=0,s=e.length-2;r<=s;r++)n+=e[r].blank(r<s?Ae(i.text,4,e[r+1].from)-n.length:null,r<s);return Fl(n,t)}function VS(e,t){let i=e.resolveInner(t,-1),n=t;if(CO(i))n=i.from,i=i.parent;for(let r;r=i.childBefore(n);)if(CO(r))n=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")i=r.lastChild,n=i.to;else break;return i}var NS=({state:e,dispatch:t})=>{let i=Y(e),n=null,r=e.changeByRange((s)=>{let o=s.from,{doc:l}=e;if(s.empty&&Ki.isActiveAt(e,s.from)){let a=l.lineAt(o),h=RO(VS(i,o),l);if(h.length){let f=h[h.length-1],c=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(o-a.from>c&&!/\S/.test(a.text.slice(c,o-a.from)))return{range:y.cursor(a.from+c),changes:{from:a.from+c,to:o}};if(o-a.from==c&&(f.item&&a.from<=f.item.from||/^[\s>]*$/.test(a.text.slice(0,f.to)))){let u=a.from+f.from;if(f.item&&f.node.from<f.item.from&&/\S/.test(a.text.slice(f.from,f.to))){let d=f.blank(Ae(a.text,4,f.to)-Ae(a.text,4,f.from));if(u==a.from)d=Fl(d,e);return{range:y.cursor(u+d.length),changes:{from:u,to:a.from+f.to,insert:d}}}if(u<o)return{range:y.cursor(u),changes:{from:u,to:o}}}}}return n={range:s}});if(n)return!1;return t(e.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0},Hl=[{key:"Enter",run:IS},{key:"Backspace",run:NS}],jO=PO({matchClosingTags:!1});function LO(e={}){let{codeLanguages:t,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:r}=WS,completeHTMLTags:s=!0,pasteURLAsLink:o=!0,htmlTagLanguage:l=jO}=e;if(!(r instanceof Nn))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let a=e.extensions?[e.extensions]:[],h=[l.support,YS],f;if(o)h.push(KS);if(i instanceof gt)h.push(i.support),f=i.language;else if(i)f=i;let c=t||f?DS(t,f):void 0;if(a.push(rd({codeParser:c,htmlParser:l.language.parser})),n)h.push(De.high(Dt.of(Hl)));let u=Gl(r.configure(a));if(s)h.push(u.data.of({autocomplete:GS}));return new gt(u,h)}function GS(e){let{state:t,pos:i}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(i-25,i));if(!n)return null;let r=Y(t).resolveInner(i,-1);while(r&&!r.type.isTop){if(r.name=="CodeBlock"||r.name=="FencedCode"||r.name=="ProcessingInstructionBlock"||r.name=="CommentBlock"||r.name=="Link"||r.name=="Image")return null;r=r.parent}return{from:i-n[0].length,to:i,options:FS(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var Vl=null;function FS(){if(Vl)return Vl;let e=xO(new qn(L.create({extensions:jO}),0,!0));return Vl=e?e.options:[]}var HS=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,KS=C.domEventHandlers({paste:(e,t)=>{var i;let{main:n}=t.state.selection;if(n.empty)return!1;let r=(i=e.clipboardData)===null||i===void 0?void 0:i.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r))return!1;if(/^www\./.test(r))r="https://"+r;if(!Ki.isActiveAt(t.state,n.from,1))return!1;let s=Y(t.state),o=!1;if(s.iterate({from:n.from,to:n.to,enter:(l)=>{if(l.from>n.from||HS.test(l.name))o=!0},leave:(l)=>{if(l.to<n.to)o=!0}}),o)return!1;return t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${r})`}],userEvent:"input.paste",scrollIntoView:!0}),!0}});function _O(e){let t=(s)=>s.replace(/[^\n]/g," "),i="",n=!1;return e.replace(/^(```|~~~)[^\n]*\n[\s\S]*?(?:^\1[^\n]*$|(?![\s\S]))/gm,t).split(`
|
|
29
29
|
`).map((s)=>(n=/^( {4}|\t)/.test(s)&&s.trim()!==""?n||i.trim()==="":s.trim()===""&&n,i=s,n?t(s):s)).join(`
|
|
30
|
-
`).replace(/(`+)[^`\n]+?\1/g,t)}var JS=/\[\[([^\[\]|\n]+?)(?:\|([^\[\]\n]+?))?\]\]/g;function Kl(e){let t=[];for(let i of _O(e).matchAll(JS)){let n=i[1].trim(),r=n.indexOf("#"),s=(r<0?n:n.slice(0,r)).trim(),o=r<0?"":n.slice(r+1).trim();if(s)t.push({from:i.index,to:i.index+i[0].length,name:s,label:(i[2]??i[1]).trim(),target:n,anchor:o})}return t}var Jl=["request","notes","plan","work","preview","review","backlog"];function EO(e){let t=/^idea:\s*(.+)$/i.exec(e.target);if(t)return{kind:"idea",text:t[1].trim()};let i=/^run:\s*([\w.-]+)$/i.exec(e.name);if(!i)return null;let n=e.anchor.toLowerCase(),r=/^(finding|backlog)-(\d+)$/.exec(n);if(r)return{kind:"run",id:i[1],tab:r[1]==="finding"?"review":"backlog",item:{type:r[1],n:Number(r[2])}};return{kind:"run",id:i[1],...Jl.includes(n)?{tab:n}:{}}}function ea(e,t){if(t.includes(e))return e;return t.filter((i)=>/^\d{4}-\d{2}-\d{2}-/.test(i)&&i.slice(11)===e).sort().pop()??null}function zO(e){if(e.kind!=="run")return"";return e.item?`${e.item.type} ${e.item.n}`:e.tab??""}var ey=/(^|[ \t(])#([\p{L}\p{N}_\-/]*[\p{L}_\-][\p{L}\p{N}_\-/]*)/gmu;function ps(e){let t=[];for(let i of _O(e).matchAll(ey)){let n=i.index+i[1].length;t.push({from:n,to:n+1+i[2].length,tag:i[2].replace(/\/+$/,"").toLowerCase()})}return t}function ir(e,t){let i=e.trim().replace(/\.md$/i,"").toLowerCase(),n=t.find((r)=>r.toLowerCase()===i);if(n)return n;return[...t].sort().find((r)=>r.toLowerCase().split("/").pop()===i)??null}function ms(e){let t=e.trim();if(!t||/[\x00-\x1f]/.test(t))return null;let i=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!i)return t.startsWith("//")?null:t;return["http","https","mailto"].includes(i[1].toLowerCase())?t:null}function YO(e){let t={folders:new Map,notes:[]};for(let n of e){let r=n.split("/"),s=t;for(let o of r.slice(0,-1)){if(!s.folders.has(o))s.folders.set(o,{folders:new Map,notes:[]});s=s.folders.get(o)}s.notes.push(n)}let i=(n)=>({folders:new Map([...n.folders].sort(([r],[s])=>r.localeCompare(s)).map(([r,s])=>[r,i(s)])),notes:n.notes.sort((r,s)=>r.localeCompare(s))});return i(t)}function WO(e,t="",i="Untitled"){let n=new Set(e.map((s)=>s.toLowerCase())),r=(s)=>(t?t+"/":"")+s;for(let s=1;;s++){let o=r(s===1?i:`${i} ${s}`);if(!n.has(o.toLowerCase()))return o}}function qO(e){let t=(o)=>o.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,"").split(/(?<!\\)\|/).map((l)=>l.trim().replace(/\\\|/g,"|")),i=e.split(/\r?\n/).filter((o)=>o.trim()),n=t(i[0]??""),r=t(i[1]??"").map((o)=>o.startsWith(":")&&o.endsWith(":")?"center":o.endsWith(":")?"right":o.startsWith(":")?"left":""),s=i.slice(2).map((o)=>{let l=t(o);return n.map((a,h)=>l[h]??"")});return{head:n,align:r,rows:s}}var V=(e)=>document.getElementById(e),_e=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]),rr=(e)=>`<svg><use href="#i-${e}"/></svg>`,UO=(e)=>e.split("/").pop(),Mt=(e)=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",Zt={runs:[],ideas:[]},Ee="",J=[],B=null,St=0,ze=!1,Ji=null,nn,Fe=null,nr=!1,ia=new Set;function Ye(e){let t=V("toast");t.textContent=e,t.classList.add("on"),setTimeout(()=>t.classList.remove("on"),2600)}async function gs(e){try{let t=await fetch("/vault",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:Ee,...e})});return{status:t.status,...await t.json().catch(()=>({}))}}catch{return{status:0,error:"The board is not running"}}}class VO extends ke{on;at;constructor(e,t){super();this.on=e;this.at=t}eq(e){return e.on===this.on&&e.at===this.at}toDOM(e){let t=document.createElement("input");return t.type="checkbox",t.checked=this.on,t.className="cm-task",t.setAttribute("aria-label",this.on?"done":"to do"),t.addEventListener("mousedown",(i)=>{i.preventDefault(),e.dispatch({changes:{from:this.at,to:this.at+3,insert:this.on?"[ ]":"[x]"}})}),t}ignoreEvent(){return!0}}class NO extends ke{eq(){return!0}toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="•",e}}class GO extends ke{eq(){return!0}toDOM(){let e=document.createElement("span");return e.className="cm-rule",e}}class FO extends ke{src;alt;constructor(e,t){super();this.src=e;this.alt=t}eq(e){return e.src===this.src&&e.alt===this.alt}toDOM(){let e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="cm-img",e}}class HO extends ke{src;at;constructor(e,t){super();this.src=e;this.at=t}eq(e){return e.src===this.src&&e.at===this.at}toDOM(e){let t=qO(this.src),i=document.createElement("div"),n=document.createElement("table");i.className="cm-table";let r=(l,a)=>{let h=document.createElement("tr");return l.forEach((f,c)=>{let u=document.createElement(a);if(u.textContent=f,t.align[c])u.style.textAlign=t.align[c];h.append(u)}),h},s=document.createElement("thead"),o=document.createElement("tbody");return s.append(r(t.head,"th")),t.rows.forEach((l)=>o.append(r(l,"td"))),n.append(s,o),i.append(n),i.addEventListener("mousedown",(l)=>{l.preventDefault(),e.dispatch({selection:{anchor:this.at}}),e.focus()}),i}ignoreEvent(){return!0}}var ra=z.define(),KO=ue.define({create:()=>!1,update:(e,t)=>t.effects.reduce((i,n)=>n.is(ra)?n.value:i,e)});function DO(e){let t=[],i=e.selection.main,n=e.field(KO,!1);return Y(e).iterate({enter(r){if(r.name!=="Table")return;let s=e.doc.lineAt(r.from).from,o=e.doc.lineAt(r.to).to;if(n&&i.to>=s&&i.from<=o)return!1;return t.push(M.replace({widget:new HO(e.sliceDoc(s,o),s),block:!0}).range(s,o)),!1}}),M.set(t)}var ty=ue.define({create:DO,update:(e,t)=>t.docChanged||t.selection||t.effects.some((i)=>i.is(ra))||Y(t.startState)!==Y(t.state)?DO(t.state):e,provide:(e)=>C.decorations.from(e)}),BO={idea:"idea",starting:"idea",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"};function iy(e){let t=(o)=>"/?"+new URLSearchParams({all:"1",dir:Ee,...o}).toString();if(e.kind==="idea"){let o=e.text.toLowerCase(),l=Zt.ideas.find((a)=>a.text.toLowerCase()===o)??Zt.ideas.find((a)=>a.text.toLowerCase().startsWith(o));return{name:l?.text??e.text,sub:"idea",status:l?.status??"",href:l?t({idea:l.text}):null}}let i=ea(e.id,Zt.runs.map((o)=>o.id)),n=Zt.runs.find((o)=>o.id===i),r=e.item&&n&&(e.item.type==="finding"?n.findings:n.backlog).some((o)=>o.n===e.item.n),s=!!n&&(!e.item||r);return{name:n?.short??e.id,sub:zO(e),status:n?.status??"",href:s?t({run:n.id,...e.tab?{tab:e.tab}:{},...e.item?{item:`${e.item.type}-${e.item.n}`}:{}}):null}}async function ny(e){if(await Si(),ze){Ye("This note is not saved yet");return}location.href=e}class JO extends ke{name;sub;status;href;constructor(e,t,i,n){super();this.name=e;this.sub=t;this.status=i;this.href=n}eq(e){return e.name===this.name&&e.sub===this.sub&&e.status===this.status&&e.href===this.href}toDOM(){let e=document.createElement("span");if(e.className="cm-board"+(this.href?"":" cm-board-missing"),e.title=this.href?"Open on the board":"Not on the board",this.status){let t=document.createElement("span");t.className="st d-"+(BO[this.status]??"idea"),t.innerHTML=`<svg><use href="#s-${BO[this.status]??"idea"}"/></svg>`,e.append(t)}if(e.append(this.name),this.sub){let t=document.createElement("span");t.className="sub",t.textContent="› "+this.sub,e.append(t)}return e.addEventListener("mousedown",(t)=>{if(t.preventDefault(),this.href)ny(this.href);else Ye("That is not on the board")}),e}ignoreEvent(){return!0}}var Kt=M.replace({}),ep=z.define();function IO(e){let{state:t}=e,i=t.doc,n=[],r=new Set;if(e.hasFocus)for(let f of t.selection.ranges)for(let c=i.lineAt(f.from).number;c<=i.lineAt(f.to).number;c++)r.add(c);let s=(f)=>r.has(i.lineAt(f).number),o=(f,c,u)=>{if(i.lineAt(c).number===i.lineAt(u).number)n.push(f.range(c,u))},l=(f,c,u)=>{for(let d=i.lineAt(f).number;d<=i.lineAt(c).number;d++)n.push(M.line({class:u}).range(i.line(d).from))};for(let{from:f,to:c}of e.visibleRanges)Y(t).iterate({from:f,to:c,enter(u){let d=u.name,O=/^ATXHeading(\d)$/.exec(d);if(O){l(u.from,u.from,`cm-h cm-h${Math.min(+O[1],4)}`);return}if(d==="HeaderMark"&&u.node.parent?.name.startsWith("ATX")){if(!s(u.from))o(Kt,u.from,Math.min(u.to+(i.sliceString(u.to,u.to+1)===" "?1:0),i.lineAt(u.from).to));return}if(d==="EmphasisMark"||d==="StrikethroughMark"||d==="CodeMark"&&u.node.parent?.name==="InlineCode"){if(!s(u.from))o(Kt,u.from,u.to);return}if(d==="Blockquote"){l(u.from,u.to,"cm-quote");return}if(d==="QuoteMark"){if(!s(u.from))o(Kt,u.from,Math.min(u.to+(i.sliceString(u.to,u.to+1)===" "?1:0),i.lineAt(u.from).to));return}if(d==="FencedCode")return l(u.from,u.to,"cm-fence"),n.push(M.line({class:"cm-fence-a"}).range(i.lineAt(u.from).from),M.line({class:"cm-fence-z"}).range(i.lineAt(u.to).from)),!1;if(d==="HorizontalRule"){if(!s(u.from))o(M.replace({widget:new GO}),u.from,u.to);return}if(d==="ListMark"&&u.node.parent?.parent?.name==="BulletList"){if(s(u.from))return;let m=u.node.nextSibling?.name==="Task";o(m?Kt:M.replace({widget:new NO}),u.from,m?Math.min(u.to+1,i.lineAt(u.from).to):u.to);return}if(d==="TaskMarker"){if(!s(u.from))o(M.replace({widget:new VO(/x/i.test(i.sliceString(u.from,u.to)),u.from)}),u.from,u.to);return}if(d==="Image"){let m=u.node.getChild("URL"),g=u.node.getChildren("LinkMark");if(s(u.from)||!m||g.length<2)return!1;let b=ms(i.sliceString(m.from,m.to));if(b&&/^https?:/i.test(b))o(M.replace({widget:new FO(b,i.sliceString(g[0].to,g[1].from))}),u.from,u.to);return!1}if(d==="Link"){let m=u.node.getChild("URL"),g=u.node.getChildren("LinkMark");if(!m||g.length<4)return;let b=ms(i.sliceString(m.from,m.to)),S={from:g[0].to,to:g[1].from};if(s(u.from)||!b){n.push(M.mark({class:"cm-link-src"}).range(u.from,u.to));return}if(S.to>S.from)n.push(M.mark({class:"cm-link",attributes:{"data-href":b}}).range(S.from,S.to));o(Kt,g[0].from,g[0].to),o(Kt,g[1].from,u.to);return}if(d==="URL"&&u.node.parent?.name!=="Link"&&u.node.parent?.name!=="Image"){let m=ms(i.sliceString(u.from,u.to));n.push(M.mark({class:"cm-link",attributes:m&&!s(u.from)?{"data-href":m}:{}}).range(u.from,u.to))}}});let a=i.toString(),h=J.map((f)=>f.name);for(let f of Kl(a)){let c=EO(f);if(c){if(s(f.from)){n.push(M.mark({class:"cm-wiki"}).range(f.from,f.to));continue}let b=iy(c);o(M.replace({widget:new JO(f.label!==f.target?f.label:b.name,b.sub,b.status,b.href)}),f.from,f.to);continue}let u=ir(f.name,h),d="cm-wiki"+(u?"":" cm-wiki-missing");if(s(f.from)){n.push(M.mark({class:d}).range(f.from,f.to));continue}let O=a.lastIndexOf(f.label,f.to-2),m=O>f.from?O:f.from+2,g=m+f.label.length;o(Kt,f.from,m),n.push(M.mark({class:d,attributes:{"data-note":u??f.name}}).range(m,g)),o(Kt,g,f.to)}for(let f of ps(a))n.push(M.mark({class:"cm-tag",attributes:s(f.from)?{}:{"data-tag":f.tag}}).range(f.from,f.to));return M.set(n,!0)}var ry=Re.fromClass(class{decorations;constructor(e){this.decorations=IO(e)}update(e){if(e.docChanged||e.viewportChanged||e.selectionSet||e.focusChanged||Y(e.startState)!==Y(e.state)||e.transactions.some((t)=>t.effects.some((i)=>i.is(ep))))this.decorations=IO(e.view)}},{decorations:(e)=>e.decorations}),sy=Di.define([{tag:p.emphasis,fontStyle:"italic"},{tag:p.strong,fontWeight:"600"},{tag:p.strikethrough,textDecoration:"line-through"},{tag:p.monospace,fontFamily:"var(--mono)",fontSize:"0.86em",background:"var(--bg)",borderRadius:"var(--r-s)",padding:"1px 4px"},{tag:[p.processingInstruction,p.meta,p.url,p.labelName,p.contentSeparator],color:"var(--dim)"},{tag:p.link,color:"var(--accent)"},{tag:p.quote,color:"var(--dim)"}]),oy=C.domEventHandlers({mousedown(e){let t=e.target.closest?.("[data-href],[data-note],[data-tag]");if(!t||e.button!==0)return!1;e.preventDefault();let i=t.dataset.href;if(i&&!/^[a-z][a-z0-9+.-]*:/i.test(i)){let n=i;try{n=decodeURIComponent(i)}catch{}let r=ir(n.split("#")[0],J.map((s)=>s.name));r?yi(r):Ye(`No note named ${n}`)}else if(i)window.open(i,"_blank","noopener");else if(t.dataset.note)uy(t.dataset.note);else if(t.dataset.tag)V("q").value="#"+t.dataset.tag,sn();return!0}}),ly=[["Checkbox","- [ ] |","to do"],["Divider",`---
|
|
30
|
+
`).replace(/(`+)[^`\n]+?\1/g,t)}var JS=/\[\[([^\[\]|\n]+?)(?:\|([^\[\]\n]+?))?\]\]/g;function Kl(e){let t=[];for(let i of _O(e).matchAll(JS)){let n=i[1].trim(),r=n.indexOf("#"),s=(r<0?n:n.slice(0,r)).trim(),o=r<0?"":n.slice(r+1).trim();if(s)t.push({from:i.index,to:i.index+i[0].length,name:s,label:(i[2]??i[1]).trim(),target:n,anchor:o})}return t}var Jl=["request","notes","plan","backlog","work","review","preview"];function EO(e){let t=/^idea:\s*(.+)$/i.exec(e.target);if(t)return{kind:"idea",text:t[1].trim()};let i=/^run:\s*([\w.-]+)$/i.exec(e.name);if(!i)return null;let n=e.anchor.toLowerCase(),r=/^(finding|backlog)-(\d+)$/.exec(n);if(r)return{kind:"run",id:i[1],tab:r[1]==="finding"?"review":"backlog",item:{type:r[1],n:Number(r[2])}};return{kind:"run",id:i[1],...Jl.includes(n)?{tab:n}:{}}}function ea(e,t){if(t.includes(e))return e;return t.filter((i)=>/^\d{4}-\d{2}-\d{2}-/.test(i)&&i.slice(11)===e).sort().pop()??null}function zO(e){if(e.kind!=="run")return"";return e.item?`${e.item.type} ${e.item.n}`:e.tab??""}var ey=/(^|[ \t(])#([\p{L}\p{N}_\-/]*[\p{L}_\-][\p{L}\p{N}_\-/]*)/gmu;function ps(e){let t=[];for(let i of _O(e).matchAll(ey)){let n=i.index+i[1].length;t.push({from:n,to:n+1+i[2].length,tag:i[2].replace(/\/+$/,"").toLowerCase()})}return t}function ir(e,t){let i=e.trim().replace(/\.md$/i,"").toLowerCase(),n=t.find((r)=>r.toLowerCase()===i);if(n)return n;return[...t].sort().find((r)=>r.toLowerCase().split("/").pop()===i)??null}function ms(e){let t=e.trim();if(!t||/[\x00-\x1f]/.test(t))return null;let i=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!i)return t.startsWith("//")?null:t;return["http","https","mailto"].includes(i[1].toLowerCase())?t:null}function YO(e){let t={folders:new Map,notes:[]};for(let n of e){let r=n.split("/"),s=t;for(let o of r.slice(0,-1)){if(!s.folders.has(o))s.folders.set(o,{folders:new Map,notes:[]});s=s.folders.get(o)}s.notes.push(n)}let i=(n)=>({folders:new Map([...n.folders].sort(([r],[s])=>r.localeCompare(s)).map(([r,s])=>[r,i(s)])),notes:n.notes.sort((r,s)=>r.localeCompare(s))});return i(t)}function WO(e,t="",i="Untitled"){let n=new Set(e.map((s)=>s.toLowerCase())),r=(s)=>(t?t+"/":"")+s;for(let s=1;;s++){let o=r(s===1?i:`${i} ${s}`);if(!n.has(o.toLowerCase()))return o}}function qO(e){let t=(o)=>o.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,"").split(/(?<!\\)\|/).map((l)=>l.trim().replace(/\\\|/g,"|")),i=e.split(/\r?\n/).filter((o)=>o.trim()),n=t(i[0]??""),r=t(i[1]??"").map((o)=>o.startsWith(":")&&o.endsWith(":")?"center":o.endsWith(":")?"right":o.startsWith(":")?"left":""),s=i.slice(2).map((o)=>{let l=t(o);return n.map((a,h)=>l[h]??"")});return{head:n,align:r,rows:s}}var V=(e)=>document.getElementById(e),_e=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]),rr=(e)=>`<svg><use href="#i-${e}"/></svg>`,UO=(e)=>e.split("/").pop(),Mt=(e)=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",Zt={runs:[],ideas:[]},Ee="",J=[],B=null,St=0,ze=!1,Ji=null,nn,Fe=null,nr=!1,ia=new Set;function Ye(e){let t=V("toast");t.textContent=e,t.classList.add("on"),setTimeout(()=>t.classList.remove("on"),2600)}async function gs(e){try{let t=await fetch("/vault",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({dir:Ee,...e})});return{status:t.status,...await t.json().catch(()=>({}))}}catch{return{status:0,error:"The board is not running"}}}class VO extends ke{on;at;constructor(e,t){super();this.on=e;this.at=t}eq(e){return e.on===this.on&&e.at===this.at}toDOM(e){let t=document.createElement("input");return t.type="checkbox",t.checked=this.on,t.className="cm-task",t.setAttribute("aria-label",this.on?"done":"to do"),t.addEventListener("mousedown",(i)=>{i.preventDefault(),e.dispatch({changes:{from:this.at,to:this.at+3,insert:this.on?"[ ]":"[x]"}})}),t}ignoreEvent(){return!0}}class NO extends ke{eq(){return!0}toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="•",e}}class GO extends ke{eq(){return!0}toDOM(){let e=document.createElement("span");return e.className="cm-rule",e}}class FO extends ke{src;alt;constructor(e,t){super();this.src=e;this.alt=t}eq(e){return e.src===this.src&&e.alt===this.alt}toDOM(){let e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="cm-img",e}}class HO extends ke{src;at;constructor(e,t){super();this.src=e;this.at=t}eq(e){return e.src===this.src&&e.at===this.at}toDOM(e){let t=qO(this.src),i=document.createElement("div"),n=document.createElement("table");i.className="cm-table";let r=(l,a)=>{let h=document.createElement("tr");return l.forEach((f,c)=>{let u=document.createElement(a);if(u.textContent=f,t.align[c])u.style.textAlign=t.align[c];h.append(u)}),h},s=document.createElement("thead"),o=document.createElement("tbody");return s.append(r(t.head,"th")),t.rows.forEach((l)=>o.append(r(l,"td"))),n.append(s,o),i.append(n),i.addEventListener("mousedown",(l)=>{l.preventDefault(),e.dispatch({selection:{anchor:this.at}}),e.focus()}),i}ignoreEvent(){return!0}}var ra=z.define(),KO=ue.define({create:()=>!1,update:(e,t)=>t.effects.reduce((i,n)=>n.is(ra)?n.value:i,e)});function DO(e){let t=[],i=e.selection.main,n=e.field(KO,!1);return Y(e).iterate({enter(r){if(r.name!=="Table")return;let s=e.doc.lineAt(r.from).from,o=e.doc.lineAt(r.to).to;if(n&&i.to>=s&&i.from<=o)return!1;return t.push(M.replace({widget:new HO(e.sliceDoc(s,o),s),block:!0}).range(s,o)),!1}}),M.set(t)}var ty=ue.define({create:DO,update:(e,t)=>t.docChanged||t.selection||t.effects.some((i)=>i.is(ra))||Y(t.startState)!==Y(t.state)?DO(t.state):e,provide:(e)=>C.decorations.from(e)}),BO={idea:"idea",starting:"idea",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"};function iy(e){let t=(o)=>"/?"+new URLSearchParams({all:"1",dir:Ee,...o}).toString();if(e.kind==="idea"){let o=e.text.toLowerCase(),l=Zt.ideas.find((a)=>a.text.toLowerCase()===o)??Zt.ideas.find((a)=>a.text.toLowerCase().startsWith(o));return{name:l?.text??e.text,sub:"idea",status:l?.status??"",href:l?t({idea:l.text}):null}}let i=ea(e.id,Zt.runs.map((o)=>o.id)),n=Zt.runs.find((o)=>o.id===i),r=e.item&&n&&(e.item.type==="finding"?n.findings:n.backlog).some((o)=>o.n===e.item.n),s=!!n&&(!e.item||r);return{name:n?.short??e.id,sub:zO(e),status:n?.status??"",href:s?t({run:n.id,...e.tab?{tab:e.tab}:{},...e.item?{item:`${e.item.type}-${e.item.n}`}:{}}):null}}async function ny(e){if(await Si(),ze){Ye("This note is not saved yet");return}location.href=e}class JO extends ke{name;sub;status;href;constructor(e,t,i,n){super();this.name=e;this.sub=t;this.status=i;this.href=n}eq(e){return e.name===this.name&&e.sub===this.sub&&e.status===this.status&&e.href===this.href}toDOM(){let e=document.createElement("span");if(e.className="cm-board"+(this.href?"":" cm-board-missing"),e.title=this.href?"Open on the board":"Not on the board",this.status){let t=document.createElement("span");t.className="st d-"+(BO[this.status]??"idea"),t.innerHTML=`<svg><use href="#s-${BO[this.status]??"idea"}"/></svg>`,e.append(t)}if(e.append(this.name),this.sub){let t=document.createElement("span");t.className="sub",t.textContent="› "+this.sub,e.append(t)}return e.addEventListener("mousedown",(t)=>{if(t.preventDefault(),this.href)ny(this.href);else Ye("That is not on the board")}),e}ignoreEvent(){return!0}}var Kt=M.replace({}),ep=z.define();function IO(e){let{state:t}=e,i=t.doc,n=[],r=new Set;if(e.hasFocus)for(let f of t.selection.ranges)for(let c=i.lineAt(f.from).number;c<=i.lineAt(f.to).number;c++)r.add(c);let s=(f)=>r.has(i.lineAt(f).number),o=(f,c,u)=>{if(i.lineAt(c).number===i.lineAt(u).number)n.push(f.range(c,u))},l=(f,c,u)=>{for(let d=i.lineAt(f).number;d<=i.lineAt(c).number;d++)n.push(M.line({class:u}).range(i.line(d).from))};for(let{from:f,to:c}of e.visibleRanges)Y(t).iterate({from:f,to:c,enter(u){let d=u.name,O=/^ATXHeading(\d)$/.exec(d);if(O){l(u.from,u.from,`cm-h cm-h${Math.min(+O[1],4)}`);return}if(d==="HeaderMark"&&u.node.parent?.name.startsWith("ATX")){if(!s(u.from))o(Kt,u.from,Math.min(u.to+(i.sliceString(u.to,u.to+1)===" "?1:0),i.lineAt(u.from).to));return}if(d==="EmphasisMark"||d==="StrikethroughMark"||d==="CodeMark"&&u.node.parent?.name==="InlineCode"){if(!s(u.from))o(Kt,u.from,u.to);return}if(d==="Blockquote"){l(u.from,u.to,"cm-quote");return}if(d==="QuoteMark"){if(!s(u.from))o(Kt,u.from,Math.min(u.to+(i.sliceString(u.to,u.to+1)===" "?1:0),i.lineAt(u.from).to));return}if(d==="FencedCode")return l(u.from,u.to,"cm-fence"),n.push(M.line({class:"cm-fence-a"}).range(i.lineAt(u.from).from),M.line({class:"cm-fence-z"}).range(i.lineAt(u.to).from)),!1;if(d==="HorizontalRule"){if(!s(u.from))o(M.replace({widget:new GO}),u.from,u.to);return}if(d==="ListMark"&&u.node.parent?.parent?.name==="BulletList"){if(s(u.from))return;let m=u.node.nextSibling?.name==="Task";o(m?Kt:M.replace({widget:new NO}),u.from,m?Math.min(u.to+1,i.lineAt(u.from).to):u.to);return}if(d==="TaskMarker"){if(!s(u.from))o(M.replace({widget:new VO(/x/i.test(i.sliceString(u.from,u.to)),u.from)}),u.from,u.to);return}if(d==="Image"){let m=u.node.getChild("URL"),g=u.node.getChildren("LinkMark");if(s(u.from)||!m||g.length<2)return!1;let b=ms(i.sliceString(m.from,m.to));if(b&&/^https?:/i.test(b))o(M.replace({widget:new FO(b,i.sliceString(g[0].to,g[1].from))}),u.from,u.to);return!1}if(d==="Link"){let m=u.node.getChild("URL"),g=u.node.getChildren("LinkMark");if(!m||g.length<4)return;let b=ms(i.sliceString(m.from,m.to)),S={from:g[0].to,to:g[1].from};if(s(u.from)||!b){n.push(M.mark({class:"cm-link-src"}).range(u.from,u.to));return}if(S.to>S.from)n.push(M.mark({class:"cm-link",attributes:{"data-href":b}}).range(S.from,S.to));o(Kt,g[0].from,g[0].to),o(Kt,g[1].from,u.to);return}if(d==="URL"&&u.node.parent?.name!=="Link"&&u.node.parent?.name!=="Image"){let m=ms(i.sliceString(u.from,u.to));n.push(M.mark({class:"cm-link",attributes:m&&!s(u.from)?{"data-href":m}:{}}).range(u.from,u.to))}}});let a=i.toString(),h=J.map((f)=>f.name);for(let f of Kl(a)){let c=EO(f);if(c){if(s(f.from)){n.push(M.mark({class:"cm-wiki"}).range(f.from,f.to));continue}let b=iy(c);o(M.replace({widget:new JO(f.label!==f.target?f.label:b.name,b.sub,b.status,b.href)}),f.from,f.to);continue}let u=ir(f.name,h),d="cm-wiki"+(u?"":" cm-wiki-missing");if(s(f.from)){n.push(M.mark({class:d}).range(f.from,f.to));continue}let O=a.lastIndexOf(f.label,f.to-2),m=O>f.from?O:f.from+2,g=m+f.label.length;o(Kt,f.from,m),n.push(M.mark({class:d,attributes:{"data-note":u??f.name}}).range(m,g)),o(Kt,g,f.to)}for(let f of ps(a))n.push(M.mark({class:"cm-tag",attributes:s(f.from)?{}:{"data-tag":f.tag}}).range(f.from,f.to));return M.set(n,!0)}var ry=Re.fromClass(class{decorations;constructor(e){this.decorations=IO(e)}update(e){if(e.docChanged||e.viewportChanged||e.selectionSet||e.focusChanged||Y(e.startState)!==Y(e.state)||e.transactions.some((t)=>t.effects.some((i)=>i.is(ep))))this.decorations=IO(e.view)}},{decorations:(e)=>e.decorations}),sy=Di.define([{tag:p.emphasis,fontStyle:"italic"},{tag:p.strong,fontWeight:"600"},{tag:p.strikethrough,textDecoration:"line-through"},{tag:p.monospace,fontFamily:"var(--mono)",fontSize:"0.86em",background:"var(--bg)",borderRadius:"var(--r-s)",padding:"1px 4px"},{tag:[p.processingInstruction,p.meta,p.url,p.labelName,p.contentSeparator],color:"var(--dim)"},{tag:p.link,color:"var(--accent)"},{tag:p.quote,color:"var(--dim)"}]),oy=C.domEventHandlers({mousedown(e){let t=e.target.closest?.("[data-href],[data-note],[data-tag]");if(!t||e.button!==0)return!1;e.preventDefault();let i=t.dataset.href;if(i&&!/^[a-z][a-z0-9+.-]*:/i.test(i)){let n=i;try{n=decodeURIComponent(i)}catch{}let r=ir(n.split("#")[0],J.map((s)=>s.name));r?yi(r):Ye(`No note named ${n}`)}else if(i)window.open(i,"_blank","noopener");else if(t.dataset.note)uy(t.dataset.note);else if(t.dataset.tag)V("q").value="#"+t.dataset.tag,sn();return!0}}),ly=[["Checkbox","- [ ] |","to do"],["Divider",`---
|
|
31
31
|
|`,"line across"],["Heading 1","# |","big"],["Heading 2","## |","medium"],["Heading 3","### |","small"],["Bullet list","- |","•"],["Numbered list","1. |","1."],["Quote","> |","aside"],["Code block","```\n|\n```","monospace"],["Table",`| Column | Column |
|
|
32
32
|
| --- | --- |
|
|
33
33
|
| | |`,"rows"],["Link to note","[[|]]","[[ ]]"],["Link to run","[[run:|]]","board"],["Tag","#|","#"]];function ay(e){let t=e.matchBefore(/^[ \t]*\/[\w ]*$/);if(!t)return null;return{from:t.from+t.text.indexOf("/"),filter:!0,validFor:/^\/[\w ]*$/,options:ly.map(([n,r,s],o)=>({label:"/"+n.toLowerCase(),displayLabel:n,detail:s,boost:50-o,apply:(l,a,h,f)=>{let c=l.state.doc.lineAt(h),u=(n==="Divider"||n==="Table")&&c.number>1&&l.state.doc.line(c.number-1).text.trim()?`
|
package/web/notes-lib.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function wikilinks(text: string): Wikilink[] {
|
|
|
36
36
|
// A link to the board instead of a note: `run:<id>` with an optional anchor naming a
|
|
37
37
|
// tab, `finding-<n>` or `backlog-<n>`, or `idea:<text>` (the whole target, `#` and all).
|
|
38
38
|
// Null for a note link. Note names can never hold `:`, so the two never collide.
|
|
39
|
-
export const TABS = ["request", "notes", "plan", "
|
|
39
|
+
export const TABS = ["request", "notes", "plan", "backlog", "work", "review", "preview"] as const;
|
|
40
40
|
export type BoardLink =
|
|
41
41
|
| { kind: "run"; id: string; tab?: (typeof TABS)[number]; item?: { type: "finding" | "backlog"; n: number } }
|
|
42
42
|
| { kind: "idea"; text: string };
|
package/web/notes.html
CHANGED
|
@@ -160,6 +160,7 @@ select.sel{cursor:pointer;appearance:none;padding-right:30px;max-width:min(320px
|
|
|
160
160
|
<body>
|
|
161
161
|
<svg style="display:none"><defs>
|
|
162
162
|
<symbol id="s-idea" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" stroke-dasharray="2 2.5"/></symbol>
|
|
163
|
+
<symbol id="s-start" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" stroke-dasharray="2 2.5"/><path d="M6.5 5.5v5l4-2.5z" fill="currentColor" stroke="none"/></symbol>
|
|
163
164
|
<symbol id="s-run" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 2a6 6 0 0 1 0 12z" fill="currentColor" stroke="none"/></symbol>
|
|
164
165
|
<symbol id="s-stall" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 2a6 6 0 0 1 0 12z" fill="currentColor" stroke="none" opacity=".35"/></symbol>
|
|
165
166
|
<symbol id="s-wait" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 5v3.5M8 11v.1"/></symbol>
|