mcp-memory-bucket 0.4.2 → 0.4.3

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.
@@ -6,18 +6,18 @@
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Et,defineProperty:Ct,getOwnPropertyDescriptor:Pt,getOwnPropertyNames:zt,getOwnPropertySymbols:Lt,getPrototypeOf:It}=Object,re=globalThis,Oe=re.trustedTypes,Mt=Oe?Oe.emptyScript:"",Ot=re.reactiveElementPolyfillSupport,Z=(i,e)=>i,pe={toAttribute(i,e){switch(e){case Boolean:i=i?Mt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},rt=(i,e)=>!Et(i,e),De={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let D=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=De){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);r!==void 0&&Ct(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{get:r,set:n}=Pt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??De}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=It(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,s=[...zt(t),...Lt(t)];for(const r of s)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,r]of t)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const r=this._$Eu(t,s);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const r of s)t.unshift(Me(r))}else e!==void 0&&t.push(Me(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Rt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:pe).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:pe;this._$Em=r;const a=o.fromAttribute(t,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,s,r=!1,n){if(e!==void 0){const o=this.constructor;if(r===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??rt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:r,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,n]of s){const{wrapped:o}=n,a=this[r];o!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[Z("elementProperties")]=new Map,D[Z("finalized")]=new Map,Ot?.({ReactiveElement:D}),(re.reactiveElementVersions??=[]).push("2.1.2");/**
9
+ */const{is:Et,defineProperty:Ct,getOwnPropertyDescriptor:zt,getOwnPropertyNames:Pt,getOwnPropertySymbols:Lt,getPrototypeOf:It}=Object,re=globalThis,Oe=re.trustedTypes,Mt=Oe?Oe.emptyScript:"",Ot=re.reactiveElementPolyfillSupport,Z=(i,e)=>i,pe={toAttribute(i,e){switch(e){case Boolean:i=i?Mt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},rt=(i,e)=>!Et(i,e),De={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let D=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=De){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);r!==void 0&&Ct(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{get:r,set:n}=zt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??De}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=It(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,s=[...Pt(t),...Lt(t)];for(const r of s)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,r]of t)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const r=this._$Eu(t,s);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const r of s)t.unshift(Me(r))}else e!==void 0&&t.push(Me(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Rt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:pe).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:pe;this._$Em=r;const a=o.fromAttribute(t,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,s,r=!1,n){if(e!==void 0){const o=this.constructor;if(r===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??rt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:r,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,n]of s){const{wrapped:o}=n,a=this[r];o!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[Z("elementProperties")]=new Map,D[Z("finalized")]=new Map,Ot?.({ReactiveElement:D}),(re.reactiveElementVersions??=[]).push("2.1.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const ke=globalThis,Ne=i=>i,ee=ke.trustedTypes,qe=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,nt="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+R,Dt=`<${ot}>`,z=document,Q=()=>z.createComment(""),K=i=>i===null||typeof i!="object"&&typeof i!="function",$e=Array.isArray,Nt=i=>$e(i)||typeof i?.[Symbol.iterator]=="function",le=`[
13
+ */const ke=globalThis,Ne=i=>i,ee=ke.trustedTypes,qe=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,nt="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+R,Dt=`<${ot}>`,P=document,Q=()=>P.createComment(""),K=i=>i===null||typeof i!="object"&&typeof i!="function",$e=Array.isArray,Nt=i=>$e(i)||typeof i?.[Symbol.iterator]=="function",le=`[
14
14
  \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,He=/>/g,E=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,je=/"/g,at=/^(?:script|style|textarea|title)$/i,qt=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=qt(1),L=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Fe=new WeakMap,P=z.createTreeWalker(z,129);function lt(i,e){if(!$e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return qe!==void 0?qe.createHTML(e):e}const Ut=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=i[a];let c,p,h=-1,g=0;for(;g<l.length&&(o.lastIndex=g,p=o.exec(l),p!==null);)g=o.lastIndex,o===B?p[1]==="!--"?o=Ue:p[1]!==void 0?o=He:p[2]!==void 0?(at.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=r??B,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?je:Be):o===je||o===Be?o=E:o===Ue||o===He?o=B:(o=E,r=void 0);const m=o===E&&i[a+1].startsWith("/>")?" ":"";n+=o===B?l+Dt:h>=0?(s.push(c),l.slice(0,h)+nt+l.slice(h)+R+m):l+R+(h===-2?a:m)}return[lt(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ue=class ct{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Ut(e,t);if(this.el=ct.createElement(c,s),P.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=P.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(nt)){const g=p[o++],m=r.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:b[2],strings:m,ctor:b[1]==="."?Bt:b[1]==="?"?jt:b[1]==="@"?Ft:ne}),r.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(at.test(r.tagName)){const h=r.textContent.split(R),g=h.length-1;if(g>0){r.textContent=ee?ee.emptyScript:"";for(let m=0;m<g;m++)r.append(h[m],Q()),P.nextNode(),l.push({type:2,index:++n});r.append(h[g],Q())}}}else if(r.nodeType===8)if(r.data===ot)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=z.createElement("template");return s.innerHTML=e,s}};function N(i,e,t=i,s){if(e===L)return e;let r=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??=[])[s]=r:t._$Cl=r),r!==void 0&&(e=N(i,r._$AS(i,e.values),r,s)),e}let Ht=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=(e?.creationScope??z).importNode(t,!0);P.currentNode=r;let n=P.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new V(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Zt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=P.nextNode(),o++)}return P.currentNode=z,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class V{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),K(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ue.createElement(lt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new Ht(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new ue(e)),t}k(e){$e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new V(this.O(Q()),this.O(Q()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ne(e).nextSibling;Ne(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===k?e=k:e!==k&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!r&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Bt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},jt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ft=class extends ne{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??k)===L)return;const s=this._$AH,r=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==k&&(s===k||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Zt=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){N(this,e)}};const Qt=ke.litHtmlPolyfillSupport;Qt?.(ue,V),(ke.litHtmlVersions??=[]).push("3.3.3");const Kt=(i,e,t)=>{const s=t?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const n=t?.renderBefore??null;s._$litPart$=r=new V(e.insertBefore(Q(),n),n,void 0,t??{})}return r._$AI(i),r};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,je=/"/g,at=/^(?:script|style|textarea|title)$/i,qt=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=qt(1),L=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Fe=new WeakMap,z=P.createTreeWalker(P,129);function lt(i,e){if(!$e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return qe!==void 0?qe.createHTML(e):e}const Ut=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=i[a];let c,p,h=-1,g=0;for(;g<l.length&&(o.lastIndex=g,p=o.exec(l),p!==null);)g=o.lastIndex,o===B?p[1]==="!--"?o=Ue:p[1]!==void 0?o=He:p[2]!==void 0?(at.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=r??B,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?je:Be):o===je||o===Be?o=E:o===Ue||o===He?o=B:(o=E,r=void 0);const m=o===E&&i[a+1].startsWith("/>")?" ":"";n+=o===B?l+Dt:h>=0?(s.push(c),l.slice(0,h)+nt+l.slice(h)+R+m):l+R+(h===-2?a:m)}return[lt(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ue=class ct{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Ut(e,t);if(this.el=ct.createElement(c,s),z.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=z.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(nt)){const g=p[o++],m=r.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:b[2],strings:m,ctor:b[1]==="."?Bt:b[1]==="?"?jt:b[1]==="@"?Ft:ne}),r.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(at.test(r.tagName)){const h=r.textContent.split(R),g=h.length-1;if(g>0){r.textContent=ee?ee.emptyScript:"";for(let m=0;m<g;m++)r.append(h[m],Q()),z.nextNode(),l.push({type:2,index:++n});r.append(h[g],Q())}}}else if(r.nodeType===8)if(r.data===ot)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=P.createElement("template");return s.innerHTML=e,s}};function N(i,e,t=i,s){if(e===L)return e;let r=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??=[])[s]=r:t._$Cl=r),r!==void 0&&(e=N(i,r._$AS(i,e.values),r,s)),e}let Ht=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=(e?.creationScope??P).importNode(t,!0);z.currentNode=r;let n=z.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new V(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Zt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=z.nextNode(),o++)}return z.currentNode=P,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class V{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),K(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(P.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ue.createElement(lt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new Ht(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new ue(e)),t}k(e){$e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new V(this.O(Q()),this.O(Q()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ne(e).nextSibling;Ne(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===k?e=k:e!==k&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!r&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Bt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},jt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ft=class extends ne{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??k)===L)return;const s=this._$AH,r=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==k&&(s===k||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Zt=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){N(this,e)}};const Qt=ke.litHtmlPolyfillSupport;Qt?.(ue,V),(ke.litHtmlVersions??=[]).push("3.3.3");const Kt=(i,e,t)=>{const s=t?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const n=t?.renderBefore??null;s._$litPart$=r=new V(e.insertBefore(Q(),n),n,void 0,t??{})}return r._$AI(i),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const ve=globalThis;let S=class extends D{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Kt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};S._$litElement$=!0,S.finalized=!0,ve.litElementHydrateSupport?.({LitElement:S});const Wt=ve.litElementPolyfillSupport;Wt?.({LitElement:S});(ve.litElementVersions??=[]).push("4.2.2");var ht;let ce=0;const Ze=new Set;function Vt(i){ce++;try{i()}finally{ce--,ce===0&&Gt()}}function Gt(){const i=new Set(Ze);Ze.clear();for(const e of i)e()}function Yt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Jt(i){return i&&typeof i.deref=="function"}class ye{static#e=0;#t;#s;#i=new Set;#r=ht.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return Yt(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(Jt(t)){if(s=t.deref(),!s){this.#i.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}ht=ye;class u extends ye{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){Vt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xt extends ye{#e;#t=!0;#s=!1;#i=new Map;_debugParent;#r;#o=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#o,this.#r);this.#i.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
20
- ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return u.activeConsumer||this.get(),s}}class we{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,r=this;t.update=function(n){u.push(r);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}function es(i){if(!i)return"unknown age";const e=new Date(i);return Number.isNaN(e.getTime())?"unknown age":e.toISOString().slice(0,10)}class ts extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=W`
19
+ */const ve=globalThis;let S=class extends D{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Kt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};S._$litElement$=!0,S.finalized=!0,ve.litElementHydrateSupport?.({LitElement:S});const Wt=ve.litElementPolyfillSupport;Wt?.({LitElement:S});(ve.litElementVersions??=[]).push("4.2.2");var ht;let ce=0;const Ze=new Set;function Vt(i){ce++;try{i()}finally{ce--,ce===0&&Gt()}}function Gt(){const i=new Set(Ze);Ze.clear();for(const e of i)e()}function Jt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Yt(i){return i&&typeof i.deref=="function"}class ye{static#e=0;#t;#s;#i=new Set;#r=ht.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return Jt(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(Yt(t)){if(s=t.deref(),!s){this.#i.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}ht=ye;class u extends ye{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){Vt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xt extends ye{#e;#t=!0;#s=!1;#i=new Map;_debugParent;#r;#a=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#a,this.#r);this.#i.set(e,t)}dispose(){this.#o()}#o(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
20
+ ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#o(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return u.activeConsumer||this.get(),s}}class we{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,r=this;t.update=function(n){u.push(r);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}function es(i){if(!i)return"unknown age";const e=new Date(i);return Number.isNaN(e.getTime())?"unknown age":e.toISOString().slice(0,10)}class ts extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=W`
21
21
  :host { display: block; }
22
22
  .count-header {
23
23
  padding: 8px 14px;
@@ -84,11 +84,11 @@
84
84
  </div>
85
85
  `})}
86
86
  `}}customElements.define("result-list",ts);function _e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var M=_e();function pt(i){M=i}var C={exec:()=>null};function O(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function f(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace($.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var ss=((i="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+i)}catch{return!1}})(),$={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:O(i=>new RegExp(`^ {0,${i}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:O(i=>new RegExp(`^ {0,${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:O(i=>new RegExp(`^ {0,${i}}(?:\`\`\`|~~~)`)),headingBeginRegex:O(i=>new RegExp(`^ {0,${i}}#`)),htmlBeginRegex:O(i=>new RegExp(`^ {0,${i}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:O(i=>new RegExp(`^ {0,${i}}>`))},is=/^(?:[ \t]*(?:\n|$))+/,rs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ns=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,G=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ut=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dt=f(ut).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),as=f(ut).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ae=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ls=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cs=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hs=f(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),oe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ps=f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Re).replace("tag",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gt=i=>f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",i).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),us=gt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ds=gt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),gs=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ds).getRegex(),Ee={blockquote:gs,code:rs,def:cs,fences:ns,heading:os,hr:G,html:ps,lheading:dt,list:hs,newline:is,paragraph:us,table:C,text:ls},Qe=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),fs={...Ee,lheading:as,table:Qe,paragraph:f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex()},bs={...Ee,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Re).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:C,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(Ae).replace("hr",G).replace("heading",` *#{1,6} *[^
87
- ]`).replace("lheading",dt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ms=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ft=/^( {2,}|\\)\n(?!\s*$)/,ks=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,Y=/[^\s\p{P}\p{S}]/u,$s=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),vs=/[\p{Pi}\p{Ps}"']/u,bt=/(?!~)[\p{P}\p{S}]/u,ys=/(?!~)[\s\p{P}\p{S}]/u,ws=/(?:[^\s\p{P}\p{S}]|~)/u,_s=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ss?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ss=f(xt,"u").replace(/punct/g,A).getRegex(),As=f(xt,"u").replace(/punct/g,bt).getRegex(),Ts=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Rs=f(Ts,"u").replace(/openQuote/g,vs).replace(/punct/g,A).getRegex(),mt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Es=f(mt,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Cs=f(mt,"gu").replace(/notPunctSpace/g,ws).replace(/punctSpace/g,ys).replace(/punct/g,bt).getRegex(),Ps="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",zs=f(Ps,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ls=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Is="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ms=f(Is,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Os=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ds="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ns=f(Ds,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),qs=f(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Us=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Hs=f(Re).replace("(?:-->|$)","-->").getRegex(),Bs=f("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Hs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,js=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kt=f(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),$t=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Fs=f("reflink|nolink(?!\\()","g").replace("reflink",kt).replace("nolink",$t).getRegex(),Ke=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ce={_backpedal:C,anyPunctuation:qs,autolink:Us,blockSkip:_s,br:ft,code:ms,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:Ss,emStrongRDelimAst:Es,emStrongRDelimUnd:Ls,escape:xs,link:js,nolink:$t,punctuation:$s,reflink:kt,reflinkSearch:Fs,tag:Bs,text:ks,url:C},Zs={...Ce,emStrongLDelim:Rs,emStrongRDelimAst:zs,emStrongRDelimUnd:Ms,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Ce,emStrongRDelimAst:Cs,emStrongLDelim:As,delLDelim:Os,delRDelim:Ns,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ke).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:f(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ke).getRegex()},Qs={...de,br:f(ft).replace("{2,}","*").getRegex(),text:f(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},J={normal:Ee,gfm:fs,pedantic:bs},j={normal:Ce,gfm:de,breaks:Qs,pedantic:Zs},Ks={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},We=i=>Ks[i];function _(i,e){if(e){if($.escapeTest.test(i))return i.replace($.escapeReplace,We)}else if($.escapeTestNoEncode.test(i))return i.replace($.escapeReplaceNoEncode,We);return i}function Ve(i){try{i=encodeURI(i).replace($.percentDecode,"%")}catch{return null}return i}function Ge(i,e){let t=i.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace($.slashPipe,"|");return s}function T(i,e,t){let s=i.length;if(s===0)return"";let r=0;for(;r<s&&i.charAt(s-r-1)===e;)r++;return i.slice(0,s-r)}function Ye(i){let e=i.split(`
87
+ ]`).replace("lheading",dt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ms=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ft=/^( {2,}|\\)\n(?!\s*$)/,ks=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,$s=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),vs=/[\p{Pi}\p{Ps}"']/u,bt=/(?!~)[\p{P}\p{S}]/u,ys=/(?!~)[\s\p{P}\p{S}]/u,ws=/(?:[^\s\p{P}\p{S}]|~)/u,_s=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ss?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ss=f(xt,"u").replace(/punct/g,A).getRegex(),As=f(xt,"u").replace(/punct/g,bt).getRegex(),Ts=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Rs=f(Ts,"u").replace(/openQuote/g,vs).replace(/punct/g,A).getRegex(),mt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Es=f(mt,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Cs=f(mt,"gu").replace(/notPunctSpace/g,ws).replace(/punctSpace/g,ys).replace(/punct/g,bt).getRegex(),zs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Ps=f(zs,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ls=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Is="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ms=f(Is,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Os=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ds="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ns=f(Ds,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),qs=f(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Us=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Hs=f(Re).replace("(?:-->|$)","-->").getRegex(),Bs=f("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Hs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,js=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kt=f(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),$t=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Fs=f("reflink|nolink(?!\\()","g").replace("reflink",kt).replace("nolink",$t).getRegex(),Ke=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ce={_backpedal:C,anyPunctuation:qs,autolink:Us,blockSkip:_s,br:ft,code:ms,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:Ss,emStrongRDelimAst:Es,emStrongRDelimUnd:Ls,escape:xs,link:js,nolink:$t,punctuation:$s,reflink:kt,reflinkSearch:Fs,tag:Bs,text:ks,url:C},Zs={...Ce,emStrongLDelim:Rs,emStrongRDelimAst:Ps,emStrongRDelimUnd:Ms,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Ce,emStrongRDelimAst:Cs,emStrongLDelim:As,delLDelim:Os,delRDelim:Ns,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ke).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:f(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ke).getRegex()},Qs={...de,br:f(ft).replace("{2,}","*").getRegex(),text:f(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Y={normal:Ee,gfm:fs,pedantic:bs},j={normal:Ce,gfm:de,breaks:Qs,pedantic:Zs},Ks={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},We=i=>Ks[i];function _(i,e){if(e){if($.escapeTest.test(i))return i.replace($.escapeReplace,We)}else if($.escapeTestNoEncode.test(i))return i.replace($.escapeReplaceNoEncode,We);return i}function Ve(i){try{i=encodeURI(i).replace($.percentDecode,"%")}catch{return null}return i}function Ge(i,e){let t=i.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace($.slashPipe,"|");return s}function T(i,e,t){let s=i.length;if(s===0)return"";let r=0;for(;r<s&&i.charAt(s-r-1)===e;)r++;return i.slice(0,s-r)}function Je(i){let e=i.split(`
88
88
  `),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(`
89
- `)}function Ws(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Vs(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function Je(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Gs(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
89
+ `)}function Ws(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Vs(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function Ye(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Gs(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
90
90
  `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(`
91
- `)}var se=class{options;rules;lexer;constructor(i){this.options=i||M}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=this.options.pedantic?e[0]:Ye(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],s=Gs(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
91
+ `)}var se=class{options;rules;lexer;constructor(i){this.options=i||M}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=this.options.pedantic?e[0]:Je(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],s=Gs(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
92
92
  `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:T(e[0],`
93
93
  `)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=T(e[0],`
94
94
  `).split(`
@@ -105,16 +105,16 @@ ${b}`,r=r.substring(0,r.length-m.text.length)+U.text;break}else if(g?.type==="li
105
105
  `);continue}}return{type:"blockquote",raw:s,tokens:n,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;i;){let l=!1,c="",p="";if(!(e=n.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let h=Vs(e[2].split(`
106
106
  `,1)[0],e[1].length),g=i.split(`
107
107
  `,1)[0],m=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):m?b=e[1].length+1:(b=h.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=h.slice(b),b+=e[1].length),m&&this.rules.other.blankLine.test(g)&&(c+=g+`
108
- `,i=i.substring(g.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),U=this.rules.other.hrRegex(b),ze=this.rules.other.fencesBeginRegex(b),Le=this.rules.other.headingBeginRegex(b),St=this.rules.other.htmlBeginRegex(b),At=this.rules.other.blockquoteBeginRegex(b);for(;i;){let ae=i.split(`
109
- `,1)[0],H;if(g=ae,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),H=g):H=g.replace(this.rules.other.tabCharGlobal," "),ze.test(g)||Le.test(g)||St.test(g)||At.test(g)||w.test(g)||U.test(g))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
110
- `+H.slice(b);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ze.test(h)||Le.test(h)||U.test(h))break;p+=`
108
+ `,i=i.substring(g.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),U=this.rules.other.hrRegex(b),Pe=this.rules.other.fencesBeginRegex(b),Le=this.rules.other.headingBeginRegex(b),St=this.rules.other.htmlBeginRegex(b),At=this.rules.other.blockquoteBeginRegex(b);for(;i;){let ae=i.split(`
109
+ `,1)[0],H;if(g=ae,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),H=g):H=g.replace(this.rules.other.tabCharGlobal," "),Pe.test(g)||Le.test(g)||St.test(g)||At.test(g)||w.test(g)||U.test(g))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
110
+ `+H.slice(b);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Pe.test(h)||Le.test(h)||U.test(h))break;p+=`
111
111
  `+g}m=!g.trim(),c+=ae+`
112
- `,i=i.substring(ae.length+1),h=H.slice(b)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!r.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=p}for(let l of r.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(i){let e=this.rules.block.html.exec(i);if(e){let t=Ye(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
112
+ `,i=i.substring(ae.length+1),h=H.slice(b)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!r.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=p}for(let l of r.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(i){let e=this.rules.block.html.exec(i);if(e){let t=Je(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
113
113
  `),href:s,title:r}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ge(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
114
114
  `):[],n={type:"table",raw:T(e[0],`
115
115
  `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of r)n.rows.push(Ge(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
116
116
  `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
117
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Ws(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Je(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Je(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=0,c=s[0][0],p=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(r%3&&!((r+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let g=[...s[0]][0].length,m=i.slice(0,r+s.index+g+o);if(Math.min(r,o)%2){let w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}let b=m.slice(2,-2);return{type:"strong",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let s=this.rules.inline.delLDelim.exec(i);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*i.length+r);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=i.slice(0,r+s.index+c+o),h=p.slice(r,-r);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class ge{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||M,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:J.normal,inline:j.normal};this.options.pedantic?(t.block=J.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=J.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:J,inline:j}}static lex(e,t){return new ge(t).lex(e)}static lexInline(e,t){return new ge(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
117
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Ws(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Ye(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Ye(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=0,c=s[0][0],p=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(r%3&&!((r+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let g=[...s[0]][0].length,m=i.slice(0,r+s.index+g+o);if(Math.min(r,o)%2){let w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}let b=m.slice(2,-2);return{type:"strong",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let s=this.rules.inline.delLDelim.exec(i);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*i.length+r);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=i.slice(0,r+s.index+c+o),h=p.slice(r,-r);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class ge{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||M,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:Y.normal,inline:j.normal};this.options.pedantic?(t.block=Y.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=Y.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:Y,inline:j}}static lex(e,t){return new ge(t).lex(e)}static lexInline(e,t){return new ge(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
118
118
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
119
119
  `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
120
120
  `)?"":`
@@ -146,8 +146,8 @@ ${this.parser.parse(i)}</blockquote>
146
146
  `}tablerow({text:i}){return`<tr>
147
147
  ${i}</tr>
148
148
  `}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
149
- `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},Pe=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class fe{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pe}static parse(e,t){return new fe(t).parse(e)}static parseInline(e,t){return new fe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=r,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=r;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let n=e[r];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},F=class{options;block;constructor(i){this.options=i||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?v.lex:v.lexInline}provideParser(i=this.block){return i?y.parse:y.parseInline}},Ys=class{defaults=_e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=Pe;Lexer=v;Tokenizer=se;Hooks=F;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let s of i)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let n of r.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of r.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(n=>{let o=r[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=e.renderers[r.name];n?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[r.level];n?n.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new F;for(let n in t.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=r[o];F.passThroughHooks.has(n)?r[o]=c=>{if(this.defaults.async&&F.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(r,c);return l.call(r,h)})();let p=a.call(r,c);return l.call(r,p)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(r,c);return h===!1&&(h=await l.apply(r,c)),h})();let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let s={...t},r={...this.defaults,...s},n=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(e):e,a=await(r.hooks?await r.hooks.provideLexer(i):i?v.lex:v.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(i):i?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(n);try{r.hooks&&(e=r.hooks.preprocess(e));let o=(r.hooks?r.hooks.provideLexer(i):i?v.lex:v.lexInline)(e,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(i):i?y.parse:y.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(i,e){return t=>{if(t.message+=`
150
- Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},I=new Ys;function x(i,e){return I.parse(i,e)}x.options=x.setOptions=function(i){return I.setOptions(i),x.defaults=I.defaults,pt(x.defaults),x};x.getDefaults=_e;x.defaults=M;function Js(...i){return I.use(...i),x.defaults=I.defaults,pt(x.defaults),x}x.use=Js;x.walkTokens=function(i,e){return I.walkTokens(i,e)};x.parseInline=I.parseInline;x.Parser=y;x.parser=y.parse;x.Renderer=ie;x.TextRenderer=Pe;x.Lexer=v;x.lexer=v.lex;x.Tokenizer=se;x.Hooks=F;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;y.parse;v.lex;/**
149
+ `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},ze=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class fe{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ze}static parse(e,t){return new fe(t).parse(e)}static parseInline(e,t){return new fe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=r,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=r;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let n=e[r];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},F=class{options;block;constructor(i){this.options=i||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?v.lex:v.lexInline}provideParser(i=this.block){return i?y.parse:y.parseInline}},Js=class{defaults=_e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=ze;Lexer=v;Tokenizer=se;Hooks=F;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let s of i)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let n of r.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of r.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(n=>{let o=r[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=e.renderers[r.name];n?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[r.level];n?n.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new F;for(let n in t.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=r[o];F.passThroughHooks.has(n)?r[o]=c=>{if(this.defaults.async&&F.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(r,c);return l.call(r,h)})();let p=a.call(r,c);return l.call(r,p)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(r,c);return h===!1&&(h=await l.apply(r,c)),h})();let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let s={...t},r={...this.defaults,...s},n=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(e):e,a=await(r.hooks?await r.hooks.provideLexer(i):i?v.lex:v.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(i):i?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(n);try{r.hooks&&(e=r.hooks.preprocess(e));let o=(r.hooks?r.hooks.provideLexer(i):i?v.lex:v.lexInline)(e,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(i):i?y.parse:y.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(i,e){return t=>{if(t.message+=`
150
+ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},I=new Js;function x(i,e){return I.parse(i,e)}x.options=x.setOptions=function(i){return I.setOptions(i),x.defaults=I.defaults,pt(x.defaults),x};x.getDefaults=_e;x.defaults=M;function Ys(...i){return I.use(...i),x.defaults=I.defaults,pt(x.defaults),x}x.use=Ys;x.walkTokens=function(i,e){return I.walkTokens(i,e)};x.parseInline=I.parseInline;x.Parser=y;x.parser=y.parse;x.Renderer=ie;x.TextRenderer=ze;x.Lexer=v;x.lexer=v.lex;x.Tokenizer=se;x.Hooks=F;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;y.parse;v.lex;/**
151
151
  * @license
152
152
  * Copyright 2017 Google LLC
153
153
  * SPDX-License-Identifier: BSD-3-Clause
@@ -232,7 +232,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
232
232
  border-color: var(--danger);
233
233
  color: var(--danger);
234
234
  }
235
- `}updated(e){e.has("selected")&&this.selected&&(this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(Xe,e)}async#i(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#o(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}render(){if(!this.selected)return d`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return k;const e=this._doc,t=this.selected.table==="skills"&&e.root==="builtin";return d`
235
+ `}updated(e){e.has("selected")&&this.selected&&(this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(Xe,e)}async#i(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#a(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}render(){if(!this.selected)return d`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return k;const e=this._doc,t=this.selected.table==="skills"&&e.root==="builtin";return d`
236
236
  <h2>${e.name??e.key??e.id}</h2>
237
237
  <div class="meta">
238
238
  ${e.tags?.join(", ")||"no tags"} · ${e.status}${e.owner?` · owner: ${e.owner}`:""}
@@ -244,7 +244,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
244
244
  <div class="actions">
245
245
  <button @click=${()=>this.#i()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
246
246
  <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
247
- <button class="danger" @click=${()=>this.#o()}>Delete</button>
247
+ <button class="danger" @click=${()=>this.#a()}>Delete</button>
248
248
  </div>
249
249
  `}
250
250
  <div class="view-toggle">
@@ -263,7 +263,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
263
263
  </div>
264
264
  ${this._viewMode==="markdown"?d`<div class="markdown-body">${si(x.parse(e.body??"",{async:!1}))}</div>`:d`<pre>${e.body}</pre>`}
265
265
  <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
266
- `}}customElements.define("detail-panel",ii);class ri extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("");#s=new u([]);#i=new u(null);#r=new u("");#o=new u("");#a=new u("");#l=new u(!1);#h=new u(!1);static{this.styles=W`
266
+ `}}customElements.define("detail-panel",ii);class ri extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("");#s=new u([]);#i=new u(null);#r=new u("");#a=new u("");#o=new u("");#l=new u(!1);#h=new u(!1);#c=new u(!1);#p=new u("");static{this.styles=W`
267
267
  :host { display: block; }
268
268
  .backdrop {
269
269
  position: fixed; inset: 0; background: var(--overlay);
@@ -299,6 +299,23 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
299
299
  font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
300
300
  cursor: pointer; white-space: nowrap; user-select: none;
301
301
  }
302
+ .new-folder-btn {
303
+ font-size: 11px; opacity: 0.7; background: none; border: none; color: inherit;
304
+ cursor: pointer; white-space: nowrap; padding: 0;
305
+ }
306
+ .new-folder-btn:hover { opacity: 1; }
307
+ .new-folder-row {
308
+ padding: 8px 20px; display: flex; align-items: center; gap: 8px;
309
+ border-top: 1px solid var(--border);
310
+ }
311
+ .new-folder-row input[type='text'] {
312
+ flex: 1; padding: 5px 8px; font-size: 12px;
313
+ border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
314
+ }
315
+ .new-folder-row button {
316
+ font-size: 11px; padding: 5px 10px; border: 1px solid var(--border-strong); background: none;
317
+ color: inherit; border-radius: 6px; cursor: pointer;
318
+ }
302
319
  .browser {
303
320
  flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
304
321
  min-height: 200px;
@@ -329,7 +346,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
329
346
  border-radius: 6px; cursor: pointer; font-size: 13px;
330
347
  }
331
348
  .error { color: var(--danger); font-size: 12px; }
332
- `}constructor(){super(),new we(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#c()}async#c(e){const t=new URLSearchParams;e&&t.set("path",e),this.#h.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#a.set((await s.json()).error??"failed to list directory");return}const r=await s.json();this.#t.set(r.path),this.#i.set(r.parent),this.#s.set(r.entries),this.#a.set("")}#u(){this.#h.set(!this.#h.value),this.#c(this.#t.value)}#d(){this.#r.set(this.#t.value),this.#o.value||this.#o.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#g(){const e=this.#r.value||this.#t.value;if(e){this.#l.set(!0),this.#a.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#o.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#a.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#l.set(!1)}}}render(){const e=this.#s.value;return d`
349
+ `}constructor(){super(),new we(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#u()}async#u(e){const t=new URLSearchParams;e&&t.set("path",e),this.#h.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#o.set((await s.json()).error??"failed to list directory");return}const r=await s.json();this.#t.set(r.path),this.#i.set(r.parent),this.#s.set(r.entries),this.#o.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#f(){this.#h.set(!this.#h.value),this.#u(this.#t.value)}#b(){this.#p.set(""),this.#c.set(!0)}#x(){this.#c.set(!1),this.#p.set("")}async#m(){const e=this.#p.value.trim();if(e){this.#o.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#t.value,name:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to create folder");return}this.#c.set(!1),this.#p.set(""),await this.#u(this.#t.value)}catch(t){this.#o.set(t.message)}}}#k(){this.#r.set(this.#t.value),this.#a.value||this.#a.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#g(){const e=this.#r.value||this.#t.value;if(e){this.#l.set(!0),this.#o.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#l.set(!1)}}}render(){const e=this.#s.value;return d`
333
350
  <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
334
351
  <div class="modal">
335
352
  <div class="header"><h2>Add a root</h2></div>
@@ -351,21 +368,35 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
351
368
  `}
352
369
  <div class="breadcrumb-row">
353
370
  <div class="breadcrumb">${this.#t.value}</div>
371
+ <button class="new-folder-btn" @click=${()=>this.#b()}>+ New folder</button>
354
372
  <label class="hidden-toggle">
355
- <input type="checkbox" .checked=${this.#h.value} @change=${()=>this.#u()} />
373
+ <input type="checkbox" .checked=${this.#h.value} @change=${()=>this.#f()} />
356
374
  Show hidden
357
375
  </label>
358
376
  </div>
377
+ ${this.#c.value?d`
378
+ <div class="new-folder-row">
379
+ <input
380
+ type="text"
381
+ placeholder="Folder name"
382
+ .value=${this.#p.value}
383
+ @input=${t=>this.#p.set(t.target.value)}
384
+ @keydown=${t=>{t.key==="Enter"&&this.#m(),t.key==="Escape"&&this.#x()}}
385
+ />
386
+ <button @click=${()=>this.#m()}>Create</button>
387
+ <button @click=${()=>this.#x()}>Cancel</button>
388
+ </div>
389
+ `:""}
359
390
  <div class="browser">
360
- ${this.#i.value?d`<div class="entry up" @click=${()=>this.#c(this.#i.value)}>
391
+ ${this.#i.value?d`<div class="entry up" @click=${()=>this.#u(this.#i.value)}>
361
392
  <span class="icon">📁</span> ..
362
393
  </div>`:""}
363
- ${e.length===0&&!this.#i.value?d`<div class="empty">No subdirectories here.</div>`:e.map(t=>d`<div class="entry" @click=${()=>this.#c(t.path)}>
394
+ ${e.length===0&&!this.#i.value?d`<div class="empty">No subdirectories here.</div>`:e.map(t=>d`<div class="entry" @click=${()=>this.#u(t.path)}>
364
395
  <span class="icon">📁</span> ${t.name}
365
396
  </div>`)}
366
397
  </div>
367
398
  <div class="footer">
368
- <button class="secondary" @click=${()=>this.#d()}>
399
+ <button class="secondary" @click=${()=>this.#k()}>
369
400
  Select this folder
370
401
  </button>
371
402
  ${this.#r.value?d`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
@@ -373,12 +404,12 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
373
404
  <label>Root name</label>
374
405
  <input
375
406
  type="text"
376
- .value=${this.#o.value}
407
+ .value=${this.#a.value}
377
408
  placeholder="e.g. personal, company"
378
- @input=${t=>this.#o.set(t.target.value)}
409
+ @input=${t=>this.#a.set(t.target.value)}
379
410
  />
380
411
  </div>
381
- ${this.#a.value?d`<div class="error">${this.#a.value}</div>`:""}
412
+ ${this.#o.value?d`<div class="error">${this.#o.value}</div>`:""}
382
413
  <div class="actions">
383
414
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
384
415
  <button
@@ -496,7 +527,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
496
527
  .option:hover, .option.highlighted { background: var(--hover); }
497
528
  .option input { margin: 0; pointer-events: none; }
498
529
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
499
- `}constructor(){super(),new we(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++et}`,this.#r=`tag-multiselect-listbox-${et}`}#o=e=>{e.composedPath().includes(this)||this.#h()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#o)}disconnectedCallback(){document.removeEventListener("click",this.#o),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#l(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#h(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#c(){this.#t.value?this.#h():(this.#l(),this.renderRoot.querySelector(".input")?.focus())}#u(e){this.#e.set(e.target.value),this.#s.set(-1),this.#l()}#d(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}#g(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#l()}#x(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#d(s))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#h()}render(){const e=this.active,t=this.#a,s=this.#t.value,r=this.#s.value;return d`
530
+ `}constructor(){super(),new we(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++et}`,this.#r=`tag-multiselect-listbox-${et}`}#a=e=>{e.composedPath().includes(this)||this.#h()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#a)}disconnectedCallback(){document.removeEventListener("click",this.#a),super.disconnectedCallback()}get#o(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#l(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#h(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#c(){this.#t.value?this.#h():(this.#l(),this.renderRoot.querySelector(".input")?.focus())}#p(e){this.#e.set(e.target.value),this.#s.set(-1),this.#l()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}#f(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#l()}#b(e){const t=this.#o;if(e.key==="ArrowDown")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#u(s))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#h()}render(){const e=this.active,t=this.#o,s=this.#t.value,r=this.#s.value;return d`
500
531
  <div class="field" style=${`anchor-name: ${this.#i}`}>
501
532
  ${e.map(n=>d`
502
533
  <span class="selected-chip">
@@ -513,12 +544,12 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
513
544
  aria-activedescendant=${r>=0?`${this.#r}-opt-${r}`:""}
514
545
  placeholder=${e.length===0?"Filter by tag…":""}
515
546
  .value=${this.#e.value}
516
- @input=${n=>this.#u(n)}
547
+ @input=${n=>this.#p(n)}
517
548
  @focus=${()=>this.#l()}
518
549
  @click=${()=>this.#l()}
519
- @keydown=${n=>this.#x(n)}
550
+ @keydown=${n=>this.#b(n)}
520
551
  />
521
- ${e.length>0?d`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#g(n)}>✕</button>`:""}
552
+ ${e.length>0?d`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#f(n)}>✕</button>`:""}
522
553
  <button
523
554
  class="chevron-btn ${s?"open":""}"
524
555
  tabindex="-1"
@@ -544,7 +575,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
544
575
  aria-selected=${e.includes(n)}
545
576
  class=${o===r?"option highlighted":"option"}
546
577
  @mousedown=${a=>a.preventDefault()}
547
- @click=${()=>this.#d(n)}
578
+ @click=${()=>this.#u(n)}
548
579
  >
549
580
  <input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
550
581
  ${n}
@@ -733,17 +764,17 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
733
764
  cursor: pointer;
734
765
  }
735
766
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
736
- `}#e=di();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#i=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeRoots??[]);#o=new u([]);#a=new u(ai);#l=new u(null);#h=new u(li);#c=new u(!1);#u=new u("");#d=new u(!1);#g=new u(ci());#x=new u(!1);#m=new u(this.#e.sort??"mtime_desc");#k=new u(this.#e.deprecatedFilter??"all");#$=new u(this.#e.pausedFilter??"all");#f=new u(this.#e.dateFrom??"");#b=new u(this.#e.dateTo??"");#p=new u(new Set);#v=new u(ui());#S=e=>this.#I(e);#A=()=>this.#M();constructor(){super(),new we(this),st(this.#v.value)}#P(e){this.#v.set(e),localStorage.setItem(_t,e),st(e)}#z(){const e=he[(he.indexOf(this.#v.value)+1)%he.length];this.#P(e)}#L(e){e.preventDefault(),this.#x.set(!0),document.addEventListener("pointermove",this.#S),document.addEventListener("pointerup",this.#A)}#I(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;this.#g.set(Math.min(wt,Math.max(yt,r)))}#M(){this.#x.set(!1),document.removeEventListener("pointermove",this.#S),document.removeEventListener("pointerup",this.#A),localStorage.setItem(vt,String(this.#g.value))}#O=new Xt(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#i.value)e.append("tag",t);for(const t of this.#r.value)e.append("root",t);return this.#m.value!=="mtime_desc"&&e.set("sort",this.#m.value),this.#k.value==="hide"?e.set("deprecated","0"):this.#k.value==="only"&&e.set("deprecated","1"),this.#$.value==="hide"?e.set("paused","0"):this.#$.value==="only"&&e.set("paused","1"),this.#f.value&&e.set("date_from",this.#f.value),this.#b.value&&e.set("date_to",this.#b.value),e.toString()});connectedCallback(){super.connectedCallback(),this.#n(),this.#y(),this.#w()}async#n(){const e=this.#O.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#o.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#y(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#w(){const e=await fetch("/api/roots");this.#h.set(await e.json()),this.#d.set(!0)}#D(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}async#N(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#u.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#w(),this.#y(),this.#n()])}finally{this.#u.set("")}}}#T(){this.#c.set(!1),this.#w(),this.#y(),this.#n()}#q(){return[...this.#h.value.skill,...this.#h.value.memory]}#U(e){this.#s.set(e),this.#i.set([]),this.#y(),this.#n()}#H(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}#B(e){this.#t.set(e.target.value),this.#n()}#j(){this.#t.set(""),this.#n()}#F(e){this.#l.set({table:e._table,id:e.id})}#Z(e){this.#m.set(e.target.value),this.#n()}#Q(e){this.#k.set(e.target.value),this.#n()}#K(e){this.#$.set(e.target.value),this.#n()}#W(e){this.#f.set(e.target.value),this.#n()}#V(e){this.#b.set(e.target.value),this.#n()}#G(){this.#f.set(""),this.#b.set(""),this.#n()}#Y(e){const t=new Set(this.#p.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#p.set(t)}#J(){return new Map(this.#o.value.map(e=>[e.id,e]))}#_(){const e=new Map,t=this.#J();for(const s of this.#p.value){const r=t.get(s);if(!r)continue;const n=e.get(r._table)??[];n.push(s),e.set(r._table,n)}return e}async#R(e){const t=this.#_();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,deprecated:e})}))),this.#p.set(new Set),await this.#n()}async#E(e){const t=this.#_();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,paused:e})}))),this.#p.set(new Set),await this.#n()}async#X(){if(!window.confirm(`Delete ${this.#p.value.size} doc(s)? This can't be undone.`))return;const e=this.#_();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#p.set(new Set),await this.#n()}#C(){const e=this.#v.value;return d`
767
+ `}#e=di();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#i=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeRoots??[]);#a=new u([]);#o=new u(ai);#l=new u(null);#h=new u(li);#c=new u(!1);#p=new u("");#u=new u(!1);#f=new u(ci());#b=new u(!1);#x=new u(this.#e.sort??"mtime_desc");#m=new u(this.#e.deprecatedFilter??"all");#k=new u(this.#e.pausedFilter??"all");#g=new u(this.#e.dateFrom??"");#$=new u(this.#e.dateTo??"");#d=new u(new Set);#y=new u(ui());#A=e=>this.#M(e);#T=()=>this.#O();constructor(){super(),new we(this),st(this.#y.value)}#P(e){this.#y.set(e),localStorage.setItem(_t,e),st(e)}#L(){const e=he[(he.indexOf(this.#y.value)+1)%he.length];this.#P(e)}#I(e){e.preventDefault(),this.#b.set(!0),document.addEventListener("pointermove",this.#A),document.addEventListener("pointerup",this.#T)}#M(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;this.#f.set(Math.min(wt,Math.max(yt,r)))}#O(){this.#b.set(!1),document.removeEventListener("pointermove",this.#A),document.removeEventListener("pointerup",this.#T),localStorage.setItem(vt,String(this.#f.value))}#D=new Xt(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#i.value)e.append("tag",t);for(const t of this.#r.value)e.append("root",t);return this.#x.value!=="mtime_desc"&&e.set("sort",this.#x.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#k.value==="hide"?e.set("paused","0"):this.#k.value==="only"&&e.set("paused","1"),this.#g.value&&e.set("date_from",this.#g.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#w=()=>this.#N();connectedCallback(){super.connectedCallback(),this.#n(),this.#v(),this.#_(),window.addEventListener("focus",this.#w),document.addEventListener("visibilitychange",this.#w)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#w),document.removeEventListener("visibilitychange",this.#w)}#N(){document.visibilityState==="visible"&&(this.#n(),this.#v(),this.#_())}async#n(){const e=this.#D.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#a.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#v(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#o.set(await t.json())}async#_(){const e=await fetch("/api/roots");this.#h.set(await e.json()),this.#u.set(!0)}#q(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}async#U(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#p.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#_(),this.#v(),this.#n()])}finally{this.#p.set("")}}}#R(){this.#c.set(!1),this.#_(),this.#v(),this.#n()}#H(){return[...this.#h.value.skill,...this.#h.value.memory]}#B(e){this.#s.set(e),this.#i.set([]),this.#v(),this.#n()}#j(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}#F(e){this.#t.set(e.target.value),this.#n()}#Z(){this.#t.set(""),this.#n()}#Q(e){this.#l.set({table:e._table,id:e.id})}#K(e){this.#x.set(e.target.value),this.#n()}#W(e){this.#m.set(e.target.value),this.#n()}#V(e){this.#k.set(e.target.value),this.#n()}#G(e){this.#g.set(e.target.value),this.#n()}#J(e){this.#$.set(e.target.value),this.#n()}#Y(){this.#g.set(""),this.#$.set(""),this.#n()}#X(e){const t=new Set(this.#d.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#d.set(t)}#ee(){return new Map(this.#a.value.map(e=>[e.id,e]))}#S(){const e=new Map,t=this.#ee();for(const s of this.#d.value){const r=t.get(s);if(!r)continue;const n=e.get(r._table)??[];n.push(s),e.set(r._table,n)}return e}async#E(e){const t=this.#S();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,deprecated:e})}))),this.#d.set(new Set),await this.#n()}async#C(e){const t=this.#S();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,paused:e})}))),this.#d.set(new Set),await this.#n()}async#te(){if(!window.confirm(`Delete ${this.#d.value.size} doc(s)? This can't be undone.`))return;const e=this.#S();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#d.set(new Set),await this.#n()}#z(){const e=this.#y.value;return d`
737
768
  <button
738
769
  class="theme-toggle"
739
770
  title=${`Theme: ${pi[e]} (click to change)`}
740
771
  aria-label="Toggle color theme"
741
- @click=${()=>this.#z()}
772
+ @click=${()=>this.#L()}
742
773
  >
743
774
  ${hi[e]}
744
775
  </button>
745
- `}render(){const e=this.#a.value,t=this.#q();return this.#d.value&&t.length===0&&!this.#c.value?d`
746
- ${this.#C()}
776
+ `}render(){const e=this.#o.value,t=this.#H();return this.#u.value&&t.length===0&&!this.#c.value?d`
777
+ ${this.#z()}
747
778
  <div class="first-run">
748
779
  <h1>No roots configured yet</h1>
749
780
  <p>
@@ -755,25 +786,25 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
755
786
  ${this.#c.value?d`<add-root-modal
756
787
  .defaultKind=${"skill"}
757
788
  .lockKind=${!1}
758
- .onAdded=${()=>this.#T()}
789
+ .onAdded=${()=>this.#R()}
759
790
  .onCancel=${()=>this.#c.set(!1)}
760
791
  ></add-root-modal>`:""}
761
792
  `:d`
762
- ${this.#C()}
793
+ ${this.#z()}
763
794
  <div class="roots-bar">
764
795
  <span class="filter-label">Roots:</span>
765
796
  ${t.map(s=>d`
766
797
  <button
767
798
  class="root-chip ${this.#r.value.includes(s.name)?"active":""}"
768
799
  title=${s.path}
769
- @click=${()=>this.#D(s.name)}
800
+ @click=${()=>this.#q(s.name)}
770
801
  >
771
802
  ${s.name}
772
803
  <span
773
804
  class="remove"
774
805
  title="Remove root"
775
- @click=${r=>this.#N(s,r)}
776
- >${this.#u.value===s.name?"…":"✕"}</span
806
+ @click=${r=>this.#U(s,r)}
807
+ >${this.#p.value===s.name?"…":"✕"}</span
777
808
  >
778
809
  </button>
779
810
  `)}
@@ -786,14 +817,14 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
786
817
  type="search"
787
818
  placeholder="Search descriptions, bodies, tags..."
788
819
  .value=${this.#t.value}
789
- @input=${s=>this.#B(s)}
820
+ @input=${s=>this.#F(s)}
790
821
  />
791
822
  ${this.#t.value?d`
792
823
  <button
793
824
  class="search-clear-btn"
794
825
  title="Clear search"
795
826
  aria-label="Clear search"
796
- @click=${()=>this.#j()}
827
+ @click=${()=>this.#Z()}
797
828
  >
798
829
 
799
830
  </button>
@@ -803,7 +834,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
803
834
  ${oi.map(s=>d`
804
835
  <button
805
836
  class=${this.#s.value===s.value?"active":""}
806
- @click=${()=>this.#U(s.value)}
837
+ @click=${()=>this.#B(s.value)}
807
838
  >
808
839
  ${s.label}
809
840
  </button>
@@ -813,7 +844,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
813
844
  <tag-multiselect
814
845
  .tags=${e.tags}
815
846
  .active=${this.#i.value}
816
- .onToggle=${s=>this.#H(s)}
847
+ .onToggle=${s=>this.#j(s)}
817
848
  ></tag-multiselect>
818
849
  `}
819
850
  <span class="filter-label">Dates:</span>
@@ -821,74 +852,74 @@ Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error
821
852
  <input
822
853
  type="date"
823
854
  aria-label="From date"
824
- .value=${this.#f.value}
825
- @change=${s=>this.#W(s)}
855
+ .value=${this.#g.value}
856
+ @change=${s=>this.#G(s)}
826
857
  />
827
858
  <span class="date-range-sep">–</span>
828
859
  <input
829
860
  type="date"
830
861
  aria-label="To date"
831
- .value=${this.#b.value}
832
- @change=${s=>this.#V(s)}
862
+ .value=${this.#$.value}
863
+ @change=${s=>this.#J(s)}
833
864
  />
834
- ${this.#f.value||this.#b.value?d`
865
+ ${this.#g.value||this.#$.value?d`
835
866
  <button
836
867
  class="date-range-clear"
837
868
  title="Clear date range"
838
869
  aria-label="Clear date range"
839
- @click=${()=>this.#G()}
870
+ @click=${()=>this.#Y()}
840
871
  >
841
872
 
842
873
  </button>
843
874
  `:""}
844
875
  </div>
845
876
  <span class="filter-label">Sort:</span>
846
- <select .value=${this.#m.value} @change=${s=>this.#Z(s)}>
877
+ <select .value=${this.#x.value} @change=${s=>this.#K(s)}>
847
878
  <option value="mtime_desc">Recently touched</option>
848
879
  <option value="mtime_asc">Least recently touched</option>
849
880
  <option value="created_at_asc">Oldest first</option>
850
881
  <option value="name_asc">Name</option>
851
882
  </select>
852
883
  <span class="filter-label">Deprecated:</span>
853
- <select .value=${this.#k.value} @change=${s=>this.#Q(s)}>
884
+ <select .value=${this.#m.value} @change=${s=>this.#W(s)}>
854
885
  ${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
855
886
  </select>
856
887
  <span class="filter-label">Paused:</span>
857
- <select .value=${this.#$.value} @change=${s=>this.#K(s)}>
888
+ <select .value=${this.#k.value} @change=${s=>this.#V(s)}>
858
889
  ${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
859
890
  </select>
860
891
  </div>
861
892
  </div>
862
- ${this.#p.value.size>0?d`
893
+ ${this.#d.value.size>0?d`
863
894
  <div class="bulk-bar">
864
- <span>${this.#p.value.size} selected</span>
865
- <button @click=${()=>this.#R(!0)}>Mark deprecated</button>
866
- <button @click=${()=>this.#R(!1)}>Un-deprecate</button>
867
- <button @click=${()=>this.#E(!0)}>Pause</button>
868
- <button @click=${()=>this.#E(!1)}>Resume</button>
869
- <button class="danger" @click=${()=>this.#X()}>Delete</button>
870
- <button @click=${()=>this.#p.set(new Set)}>Clear</button>
895
+ <span>${this.#d.value.size} selected</span>
896
+ <button @click=${()=>this.#E(!0)}>Mark deprecated</button>
897
+ <button @click=${()=>this.#E(!1)}>Un-deprecate</button>
898
+ <button @click=${()=>this.#C(!0)}>Pause</button>
899
+ <button @click=${()=>this.#C(!1)}>Resume</button>
900
+ <button class="danger" @click=${()=>this.#te()}>Delete</button>
901
+ <button @click=${()=>this.#d.set(new Set)}>Clear</button>
871
902
  </div>
872
903
  `:""}
873
904
  <div class="body-region">
874
905
  <result-list
875
- style=${`width: ${this.#g.value}%; border-right: 1px solid var(--border);`}
876
- .results=${this.#o.value}
906
+ style=${`width: ${this.#f.value}%; border-right: 1px solid var(--border);`}
907
+ .results=${this.#a.value}
877
908
  .showRoot=${t.length>1}
878
- .onSelect=${s=>this.#F(s)}
879
- .selectedIds=${this.#p.value}
880
- .onToggleSelect=${s=>this.#Y(s)}
909
+ .onSelect=${s=>this.#Q(s)}
910
+ .selectedIds=${this.#d.value}
911
+ .onToggleSelect=${s=>this.#X(s)}
881
912
  ></result-list>
882
913
  <div
883
- class="splitter ${this.#x.value?"dragging":""}"
884
- @pointerdown=${s=>this.#L(s)}
914
+ class="splitter ${this.#b.value?"dragging":""}"
915
+ @pointerdown=${s=>this.#I(s)}
885
916
  ></div>
886
917
  <detail-panel .selected=${this.#l.value} .onChanged=${()=>this.#n()}></detail-panel>
887
918
  </div>
888
919
  ${this.#c.value?d`<add-root-modal
889
920
  .defaultKind=${"skill"}
890
921
  .lockKind=${!1}
891
- .onAdded=${()=>this.#T()}
922
+ .onAdded=${()=>this.#R()}
892
923
  .onCancel=${()=>this.#c.set(!1)}
893
924
  ></add-root-modal>`:""}
894
925
  `}}customElements.define("mem-bucket-app",gi);
@@ -27,7 +27,7 @@
27
27
  :root[data-theme='dark'] { color-scheme: dark; }
28
28
  body { font-family: system-ui, sans-serif; margin: 0; background: var(--bg); color: var(--fg); }
29
29
  </style>
30
- <script type="module" crossorigin src="/assets/index-BXCTjiGA.js"></script>
30
+ <script type="module" crossorigin src="/assets/index-DvTP9na1.js"></script>
31
31
  </head>
32
32
  <body>
33
33
  <mem-bucket-app></mem-bucket-app>
@@ -4,6 +4,8 @@ import chokidar, {} from 'chokidar';
4
4
  import { readMarkdownFile } from './markdown-file.js';
5
5
  import { flattenTags } from './db.js';
6
6
  import { extractDates, toLocalDate } from './date-extract.js';
7
+ import { slugify } from './slug.js';
8
+ import { normalizeKey } from '../types.js';
7
9
  // `paused` is deliberately absent from both lists: it's a local-only cache column (see
8
10
  // SkillRepository/MemoryRepository#setPaused) that never round-trips through frontmatter, so a
9
11
  // file add/change/rescan must never overwrite it via the INSERT/ON CONFLICT UPDATE below.
@@ -36,6 +38,21 @@ export function memorySyncSpec(sources) {
36
38
  matchesFile: (filePath) => filePath.endsWith('.md'),
37
39
  columns: memoryColumns,
38
40
  getId: (fm) => fm.id,
41
+ deriveFrontmatter: (fm, filePath) => {
42
+ const basename = path.basename(filePath, '.md');
43
+ const fallbackId = slugify(basename) || 'untitled';
44
+ return {
45
+ ...fm,
46
+ id: fm.id ?? fallbackId,
47
+ key: fm.key ?? normalizeKey(fallbackId),
48
+ key_type: fm.key_type ?? 'freeform',
49
+ description: fm.description ?? basename,
50
+ doc_type: fm.doc_type ?? 'other',
51
+ status: fm.status ?? 'active',
52
+ tags: fm.tags ?? [],
53
+ related_to: fm.related_to ?? null,
54
+ };
55
+ },
39
56
  toRow: (fm) => ({
40
57
  id: fm.id,
41
58
  key: fm.key,
@@ -76,12 +93,15 @@ export function upsertFile(db, spec, filePath) {
76
93
  const parsed = readMarkdownFile(filePath);
77
94
  if (existing && existing.mtime_ms === parsed.mtimeMs)
78
95
  return; // unchanged, skip reprocessing
79
- const id = spec.getId(parsed.frontmatter);
96
+ const frontmatter = spec.deriveFrontmatter
97
+ ? spec.deriveFrontmatter(parsed.frontmatter, filePath)
98
+ : parsed.frontmatter;
99
+ const id = spec.getId(frontmatter);
80
100
  if (!id) {
81
101
  console.error(`[memory-bucket] skipping ${filePath}: missing required id field in frontmatter`);
82
102
  return;
83
103
  }
84
- const row = spec.toRow(parsed.frontmatter, filePath);
104
+ const row = spec.toRow(frontmatter, filePath);
85
105
  const root = rootForFile(spec.sources, filePath);
86
106
  const cols = [...spec.columns, 'source_path', 'root', 'body', 'mtime_ms'];
87
107
  const values = [...spec.columns.map((c) => row[c]), filePath, root, parsed.body, parsed.mtimeMs];
@@ -479,5 +479,32 @@ export function buildWebRouter(db, config, skillRepo, memoryRepo) {
479
479
  const parent = path.dirname(dirPath) !== dirPath ? path.dirname(dirPath) : null;
480
480
  res.json({ path: dirPath, parent, entries });
481
481
  });
482
+ router.post('/api/fs/mkdir', (req, res) => {
483
+ const { path: parentPath, name } = req.body;
484
+ if (!parentPath || !path.isAbsolute(parentPath)) {
485
+ res.status(400).json({ error: 'path must be an absolute directory path' });
486
+ return;
487
+ }
488
+ if (!name || name.trim() !== name || name.includes('/') || name === '.' || name === '..') {
489
+ res.status(400).json({ error: 'invalid folder name' });
490
+ return;
491
+ }
492
+ if (!fs.existsSync(parentPath) || !fs.statSync(parentPath).isDirectory()) {
493
+ res.status(400).json({ error: `not a directory: ${parentPath}` });
494
+ return;
495
+ }
496
+ const newDirPath = path.join(parentPath, name);
497
+ if (fs.existsSync(newDirPath)) {
498
+ res.status(409).json({ error: `already exists: ${newDirPath}` });
499
+ return;
500
+ }
501
+ try {
502
+ fs.mkdirSync(newDirPath);
503
+ res.json({ path: newDirPath, name });
504
+ }
505
+ catch (err) {
506
+ res.status(500).json({ error: err.message });
507
+ }
508
+ });
482
509
  return router;
483
510
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-memory-bucket",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "MCP server exposing skill_* (reusable coding patterns) and memory_* (point-in-time working context) tools over a markdown+frontmatter source, cached into SQLite at runtime.",
6
6
  "repository": {