mcp-memory-bucket 0.10.2 → 0.10.4

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.
@@ -1,23 +1,23 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const Yt="modulepreload",Jt=function(n){return"/"+n},Me={},$t=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=Jt(d),d in Me)return;Me[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Yt,p||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),p)return new Promise((x,b)=>{f.addEventListener("load",x),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/**
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const Yt="modulepreload",Jt=function(n){return"/"+n},Me={},$t=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=Jt(d),d in Me)return;Me[d]=!0;const p=d.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Yt,p||(f.as="script"),f.crossOrigin="",f.href=d,c&&f.setAttribute("nonce",c),document.head.appendChild(f),p)return new Promise((x,b)=>{f.addEventListener("load",x),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const te=globalThis,ke=te.ShadowRoot&&(te.ShadyCSS===void 0||te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap;let wt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ke&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ne.set(t,e))}return e}toString(){return this.cssText}};const Xt=n=>new wt(typeof n=="string"?n:n+"",void 0,$e),T=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new wt(t,n,$e)},es=(n,e)=>{if(ke)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=te.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},qe=ke?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Xt(t)})(n):n;/**
5
+ */const te=globalThis,ke=te.ShadowRoot&&(te.ShadyCSS===void 0||te.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap;let wt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ke&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ne.set(t,e))}return e}toString(){return this.cssText}};const Xt=n=>new wt(typeof n=="string"?n:n+"",void 0,$e),A=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new wt(t,n,$e)},es=(n,e)=>{if(ke)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=te.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},qe=ke?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Xt(t)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:ts,defineProperty:ss,getOwnPropertyDescriptor:is,getOwnPropertyNames:ns,getOwnPropertySymbols:rs,getPrototypeOf:os}=Object,ae=globalThis,Ue=ae.trustedTypes,as=Ue?Ue.emptyScript:"",ls=ae.reactiveElementPolyfillSupport,W=(n,e)=>n,ge={toAttribute(n,e){switch(e){case Boolean:n=n?as:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},_t=(n,e)=>!ts(n,e),je={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:_t};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;let N=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=je){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(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&ss(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=is(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);r?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=os(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,s=[...ns(t),...rs(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,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 i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(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 es(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),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:ge).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:ge;this._$Em=i;const a=o.fromAttribute(t,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,r){if(e!==void 0){const o=this.constructor;if(i===!1&&(r=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??_t)(r,t)||s.useDefault&&s.reflect&&r===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:i,wrapped:r},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!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[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:o}=r,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,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){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[W("elementProperties")]=new Map,N[W("finalized")]=new Map,ls?.({ReactiveElement:N}),(ae.reactiveElementVersions??=[]).push("2.1.2");/**
9
+ */const{is:ts,defineProperty:ss,getOwnPropertyDescriptor:is,getOwnPropertyNames:ns,getOwnPropertySymbols:rs,getPrototypeOf:os}=Object,ae=globalThis,Ue=ae.trustedTypes,as=Ue?Ue.emptyScript:"",ls=ae.reactiveElementPolyfillSupport,Z=(n,e)=>n,ge={toAttribute(n,e){switch(e){case Boolean:n=n?as:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},_t=(n,e)=>!ts(n,e),je={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:_t};Symbol.metadata??=Symbol("metadata"),ae.litPropertyMetadata??=new WeakMap;let N=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=je){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(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&ss(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=is(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);r?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=os(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=[...ns(t),...rs(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,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 i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(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 es(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),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:ge).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:ge;this._$Em=i;const a=o.fromAttribute(t,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,r){if(e!==void 0){const o=this.constructor;if(i===!1&&(r=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??_t)(r,t)||s.useDefault&&s.reflect&&r===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:i,wrapped:r},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!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[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:o}=r,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,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){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[Z("elementProperties")]=new Map,N[Z("finalized")]=new Map,ls?.({ReactiveElement:N}),(ae.reactiveElementVersions??=[]).push("2.1.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const we=globalThis,Be=n=>n,se=we.trustedTypes,He=se?se.createPolicy("lit-html",{createHTML:n=>n}):void 0,St="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,Ct="?"+R,cs=`<${Ct}>`,I=document,Q=()=>I.createComment(""),G=n=>n===null||typeof n!="object"&&typeof n!="function",_e=Array.isArray,ds=n=>_e(n)||typeof n?.[Symbol.iterator]=="function",he=`[
14
14
  \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ve=/>/g,P=RegExp(`>|${he}(?:([^\\s"'>=/]+)(${he}*=${he}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ze=/'/g,We=/"/g,Tt=/^(?:script|style|textarea|title)$/i,hs=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),c=hs(1),O=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Qe=new WeakMap,L=I.createTreeWalker(I,129);function At(n,e){if(!_e(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return He!==void 0?He.createHTML(e):e}const ps=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=H;for(let a=0;a<t;a++){const l=n[a];let d,p,h=-1,f=0;for(;f<l.length&&(o.lastIndex=f,p=o.exec(l),p!==null);)f=o.lastIndex,o===H?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ve:p[2]!==void 0?(Tt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=P):p[3]!==void 0&&(o=P):o===P?p[0]===">"?(o=i??H,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?P:p[3]==='"'?We:Ze):o===We||o===Ze?o=P:o===Ke||o===Ve?o=H:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===H?l+cs:h>=0?(s.push(d),l.slice(0,h)+St+l.slice(h)+R+x):l+R+(h===-2?a:x)}return[At(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let be=class Et{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,l=this.parts,[d,p]=ps(e,t);if(this.el=Et.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=L.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(St)){const f=p[o++],x=i.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(f);l.push({type:1,index:r,name:b[2],strings:x,ctor:b[1]==="."?fs:b[1]==="?"?gs:b[1]==="@"?bs:le}),i.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(Tt.test(i.tagName)){const h=i.textContent.split(R),f=h.length-1;if(f>0){i.textContent=se?se.emptyScript:"";for(let x=0;x<f;x++)i.append(h[x],Q()),L.nextNode(),l.push({type:2,index:++r});i.append(h[f],Q())}}}else if(i.nodeType===8)if(i.data===Ct)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:r}),h+=R.length-1}r++}}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}};function q(n,e,t=n,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=G(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(n,i._$AS(n,e.values),i,s)),e}let us=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,i=(e?.creationScope??I).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let d;l.type===2?d=new Se(r,r.nextSibling,this,e):l.type===1?d=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(d=new ms(r,this,e)),this._$AV.push(d),l=s[++a]}o!==l?.index&&(r=L.nextNode(),o++)}return L.currentNode=I,i}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++}},Se=class Rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.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=q(this,e,t),G(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ds(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!==m&&G(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=be.createElement(At(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new us(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new be(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new Rt(this.O(Q()),this.O(Q()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Be(e).nextSibling;Be(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=q(this,e,t,0),o=!G(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let l,d;for(e=r[0],l=0;l<r.length-1;l++)d=q(this,a[s+l],t,l),d===O&&(d=this._$AH[l]),o||=!G(d)||d!==this._$AH[l],d===m?e=m:e!==m&&(e+=(d??"")+r[l+1]),this._$AH[l]=d}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},fs=class extends le{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},gs=class extends le{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},bs=class extends le{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===O)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),r&&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)}},ms=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){q(this,e)}};const vs=we.litHtmlPolyfillSupport;vs?.(be,Se),(we.litHtmlVersions??=[]).push("3.3.3");const xs=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new Se(e.insertBefore(Q(),r),r,void 0,t??{})}return i._$AI(n),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),We=/'/g,Ze=/"/g,At=/^(?:script|style|textarea|title)$/i,hs=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=hs(1),O=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Qe=new WeakMap,L=I.createTreeWalker(I,129);function Tt(n,e){if(!_e(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return He!==void 0?He.createHTML(e):e}const ps=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=H;for(let a=0;a<t;a++){const c=n[a];let d,p,h=-1,f=0;for(;f<c.length&&(o.lastIndex=f,p=o.exec(c),p!==null);)f=o.lastIndex,o===H?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ve:p[2]!==void 0?(At.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=P):p[3]!==void 0&&(o=P):o===P?p[0]===">"?(o=i??H,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?P:p[3]==='"'?Ze:We):o===Ze||o===We?o=P:o===Ke||o===Ve?o=H:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===H?c+cs:h>=0?(s.push(d),c.slice(0,h)+St+c.slice(h)+R+x):c+R+(h===-2?a:x)}return[Tt(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let be=class Et{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[d,p]=ps(e,t);if(this.el=Et.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=L.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(St)){const f=p[o++],x=i.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(f);c.push({type:1,index:r,name:b[2],strings:x,ctor:b[1]==="."?fs:b[1]==="?"?gs:b[1]==="@"?bs:le}),i.removeAttribute(h)}else h.startsWith(R)&&(c.push({type:6,index:r}),i.removeAttribute(h));if(At.test(i.tagName)){const h=i.textContent.split(R),f=h.length-1;if(f>0){i.textContent=se?se.emptyScript:"";for(let x=0;x<f;x++)i.append(h[x],Q()),L.nextNode(),c.push({type:2,index:++r});i.append(h[f],Q())}}}else if(i.nodeType===8)if(i.data===Ct)c.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)c.push({type:7,index:r}),h+=R.length-1}r++}}static createElement(e,t){const s=I.createElement("template");return s.innerHTML=e,s}};function q(n,e,t=n,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=G(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(n,i._$AS(n,e.values),i,s)),e}let us=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,i=(e?.creationScope??I).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new Se(r,r.nextSibling,this,e):c.type===1?d=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(d=new ms(r,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(r=L.nextNode(),o++)}return L.currentNode=I,i}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++}},Se=class Rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.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=q(this,e,t),G(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ds(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!==m&&G(this._$AH)?this._$AA.nextSibling.data=e:this.T(I.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=be.createElement(Tt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new us(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new be(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new Rt(this.O(Q()),this.O(Q()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Be(e).nextSibling;Be(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=q(this,e,t,0),o=!G(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let c,d;for(e=r[0],c=0;c<r.length-1;c++)d=q(this,a[s+c],t,c),d===O&&(d=this._$AH[c]),o||=!G(d)||d!==this._$AH[c],d===m?e=m:e!==m&&(e+=(d??"")+r[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},fs=class extends le{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},gs=class extends le{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},bs=class extends le{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===O)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),r&&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)}},ms=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){q(this,e)}};const vs=we.litHtmlPolyfillSupport;vs?.(be,Se),(we.litHtmlVersions??=[]).push("3.3.3");const xs=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new Se(e.insertBefore(Q(),r),r,void 0,t??{})}return i._$AI(n),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const Ce=globalThis;let k=class extends N{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=xs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:k});const ys=Ce.litElementPolyfillSupport;ys?.({LitElement:k});(Ce.litElementVersions??=[]).push("4.2.2");var Pt;let pe=0;const Ge=new Set;function ks(n){pe++;try{n()}finally{pe--,pe===0&&$s()}}function $s(){const n=new Set(Ge);Ge.clear();for(const e of n)e()}function ws(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function _s(n){return n&&typeof n.deref=="function"}class Te{static#e=0;#t;#s;#r=new Set;#n=Pt.#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 ws(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.#r.add(s),()=>this.#r.delete(s)}_notify(){const e=[...this.#r];for(const t of e){let s;if(_s(t)){if(s=t.deref(),!s){this.#r.delete(t);continue}}else s=t;s()}}get id(){return this.#n}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}Pt=Te;class u extends Te{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){ks(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Ye extends Te{#e;#t=!0;#s=!1;#r=new Map;_debugParent;#n;#d=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#n=s?.weak??!0}track(e){if(this.#r.has(e))return;const t=e.subscribe(this.#d,this.#n);this.#r.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#r.values())e();this.#r.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 Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(r){u.push(i);try{s.call(this,r)}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"})`}}const Ss=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Cs(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Ss.format(e)}function Ts(n){const e=[],t=new Map,s=[];for(const r of n){if(r._table!=="memory_docs"){s.push(r);continue}t.has(r.name)||(t.set(r.name,[]),e.push(r.name)),t.get(r.name).push(r)}const i=e.map(r=>({key:r,items:t.get(r)}));return s.length>0&&i.push({key:null,items:s}),i}class As extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=T`
19
+ */const Ce=globalThis;let k=class extends N{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=xs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:k});const ys=Ce.litElementPolyfillSupport;ys?.({LitElement:k});(Ce.litElementVersions??=[]).push("4.2.2");var Pt;let pe=0;const Ge=new Set;function ks(n){pe++;try{n()}finally{pe--,pe===0&&$s()}}function $s(){const n=new Set(Ge);Ge.clear();for(const e of n)e()}function ws(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function _s(n){return n&&typeof n.deref=="function"}class Ae{static#e=0;#t;#s;#r=new Set;#n=Pt.#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 ws(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.#r.add(s),()=>this.#r.delete(s)}_notify(){const e=[...this.#r];for(const t of e){let s;if(_s(t)){if(s=t.deref(),!s){this.#r.delete(t);continue}}else s=t;s()}}get id(){return this.#n}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}Pt=Ae;class u extends Ae{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){ks(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Ye extends Ae{#e;#t=!0;#s=!1;#r=new Map;_debugParent;#n;#d=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#n=s?.weak??!0}track(e){if(this.#r.has(e))return;const t=e.subscribe(this.#d,this.#n);this.#r.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#r.values())e();this.#r.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 Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(r){u.push(i);try{s.call(this,r)}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"})`}}const Ss=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Cs(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Ss.format(e)}function As(n){const e=[],t=new Map,s=[];for(const r of n){if(r._table!=="memory_docs"){s.push(r);continue}t.has(r.name)||(t.set(r.name,[]),e.push(r.name)),t.get(r.name).push(r)}const i=e.map(r=>({key:r,items:t.get(r)}));return s.length>0&&i.push({key:null,items:s}),i}class Ts extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=A`
21
21
  :host { display: block; }
22
22
  .count-header {
23
23
  padding: 8px 14px;
@@ -78,10 +78,10 @@
78
78
  color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
79
79
  }
80
80
  .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
81
- `}render(){return!this.results||this.results.length===0?c`<div class="empty">No results.</div>`:c`
81
+ `}render(){return!this.results||this.results.length===0?l`<div class="empty">No results.</div>`:l`
82
82
  <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
83
- ${Ts(this.results).map(e=>c`
84
- ${e.key?c`<div class="key-group-header">
83
+ ${As(this.results).map(e=>l`
84
+ ${e.key?l`<div class="key-group-header">
85
85
  🔑
86
86
  <button
87
87
  class="key-group-link"
@@ -94,7 +94,7 @@
94
94
  </div>`:""}
95
95
  ${e.items.map(t=>this.#e(t))}
96
96
  `)}
97
- `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return c`
97
+ `}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return l`
98
98
  <div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
99
99
  <input
100
100
  type="checkbox"
@@ -114,25 +114,25 @@
114
114
  </span>
115
115
  <span class="meta">${Cs(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
116
116
  </div>
117
- ${this.showFolder&&e.folder?c`<div class="folder-path">📁 ${e.folder}</div>`:""}
117
+ ${this.showFolder&&e.folder?l`<div class="folder-path">📁 ${e.folder}</div>`:""}
118
118
  <div class="desc">${e.description}</div>
119
119
  <div class="tags">
120
- ${e.deprecated?c`<span class="deprecated-badge">deprecated</span>`:""}
121
- ${e.paused?c`<span class="paused-badge">paused</span>`:""}
122
- ${e.tags.map(s=>c`<span class="tag">${s}</span>`)}
120
+ ${e.deprecated?l`<span class="deprecated-badge">deprecated</span>`:""}
121
+ ${e.paused?l`<span class="paused-badge">paused</span>`:""}
122
+ ${e.tags.map(s=>l`<span class="tag">${s}</span>`)}
123
123
  </div>
124
124
  </div>
125
125
  </div>
126
- `}}customElements.define("result-list",As);function Ae(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=Ae();function zt(n){F=n}var z={exec:()=>null};function M(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=n(s),e[s]=i),i}}function g(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Es=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),y={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:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:M(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(n=>new RegExp(`^ {0,${n}}>`))},Rs=/^(?:[ \t]*(?:\n|$))+/,Ps=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,J=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ls=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Lt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,It=g(Lt).replace(/bull/g,Ee).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(),Is=g(Lt).replace(/bull/g,Ee).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(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Os=/^[^\n]+/,Pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ds=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fs=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),ce="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",ze=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ms=g("^ {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",ze).replace("tag",ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ot=n=>g(Re).replace("hr",J).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",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ns=Ot(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),qs=Ot(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Us=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qs).getRegex(),Le={blockquote:Us,code:Ps,def:Ds,fences:zs,heading:Ls,hr:J,html:Ms,lheading:It,list:Fs,newline:Rs,paragraph:Ns,table:z,text:Os},Je=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",J).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",ce).getRegex(),js={...Le,lheading:Is,table:Je,paragraph:g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Je).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",ce).getRegex()},Bs={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ze).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:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",J).replace("heading",` *#{1,6} *[^
127
- ]`).replace("lheading",It).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ks=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Dt=/^( {2,}|\\)\n(?!\s*$)/,Vs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,Zs=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),Ws=/[\p{Pi}\p{Ps}"']/u,Ft=/(?!~)[\p{P}\p{S}]/u,Qs=/(?!~)[\s\p{P}\p{S}]/u,Gs=/(?:[^\s\p{P}\p{S}]|~)/u,Ys=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Es?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Mt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Js=g(Mt,"u").replace(/punct/g,A).getRegex(),Xs=g(Mt,"u").replace(/punct/g,Ft).getRegex(),ei=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ti=g(ei,"u").replace(/openQuote/g,Ws).replace(/punct/g,A).getRegex(),Nt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",si=g(Nt,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ii=g(Nt,"gu").replace(/notPunctSpace/g,Gs).replace(/punctSpace/g,Qs).replace(/punct/g,Ft).getRegex(),ni="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",ri=g(ni,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),oi=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ai="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),ci=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),di="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),pi=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),ui=g(/^<(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(),fi=g(ze).replace("(?:-->|$)","-->").getRegex(),gi=g("^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",fi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ie=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,bi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ie).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",ie).replace("ref",Pe).getRegex(),Ut=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pe).getRegex(),mi=g("reflink|nolink(?!\\()","g").replace("reflink",qt).replace("nolink",Ut).getRegex(),Xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:z,anyPunctuation:pi,autolink:ui,blockSkip:Ys,br:Dt,code:Ks,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Js,emStrongRDelimAst:si,emStrongRDelimUnd:oi,escape:Hs,link:bi,nolink:Ut,punctuation:Zs,reflink:qt,reflinkSearch:mi,tag:gi,text:Vs,url:z},vi={...Ie,emStrongLDelim:ti,emStrongRDelimAst:ri,emStrongRDelimUnd:li,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",ie).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie).getRegex()},me={...Ie,emStrongRDelimAst:ii,emStrongLDelim:Xs,delLDelim:ci,delRDelim:hi,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xe).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:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Xe).getRegex()},xi={...me,br:g(Dt).replace("{2,}","*").getRegex(),text:g(me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:Le,gfm:js,pedantic:Bs},K={normal:Ie,gfm:me,breaks:xi,pedantic:vi},yi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},et=n=>yi[n];function C(n,e){if(e){if(y.escapeTest.test(n))return n.replace(y.escapeReplace,et)}else if(y.escapeTestNoEncode.test(n))return n.replace(y.escapeReplaceNoEncode,et);return n}function tt(n){try{n=encodeURI(n).replace(y.percentDecode,"%")}catch{return null}return n}function st(n,e){let t=n.replace(y.findPipe,(r,o,a)=>{let l=!1,d=o;for(;--d>=0&&a[d]==="\\";)l=!l;return l?"|":" |"}),s=t.split(y.splitPipe),i=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(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function E(n,e,t){let s=n.length;if(s===0)return"";let i=0;for(;i<s&&n.charAt(s-i-1)===e;)i++;return n.slice(0,s-i)}function it(n){let e=n.split(`
126
+ `}}customElements.define("result-list",Ts);function Te(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=Te();function zt(n){F=n}var z={exec:()=>null};function M(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=n(s),e[s]=i),i}}function g(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Es=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),y={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:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:M(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(n=>new RegExp(`^ {0,${n}}>`))},Rs=/^(?:[ \t]*(?:\n|$))+/,Ps=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,J=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ls=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Lt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,It=g(Lt).replace(/bull/g,Ee).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(),Is=g(Lt).replace(/bull/g,Ee).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(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Os=/^[^\n]+/,Pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ds=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fs=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),ce="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",ze=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ms=g("^ {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",ze).replace("tag",ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ot=n=>g(Re).replace("hr",J).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",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ns=Ot(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),qs=Ot(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Us=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qs).getRegex(),Le={blockquote:Us,code:Ps,def:Ds,fences:zs,heading:Ls,hr:J,html:Ms,lheading:It,list:Fs,newline:Rs,paragraph:Ns,table:z,text:Os},Je=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",J).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",ce).getRegex(),js={...Le,lheading:Is,table:Je,paragraph:g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Je).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",ce).getRegex()},Bs={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ze).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:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",J).replace("heading",` *#{1,6} *[^
127
+ ]`).replace("lheading",It).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ks=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Dt=/^( {2,}|\\)\n(?!\s*$)/,Vs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,Ws=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),Zs=/[\p{Pi}\p{Ps}"']/u,Ft=/(?!~)[\p{P}\p{S}]/u,Qs=/(?!~)[\s\p{P}\p{S}]/u,Gs=/(?:[^\s\p{P}\p{S}]|~)/u,Ys=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Es?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Mt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Js=g(Mt,"u").replace(/punct/g,T).getRegex(),Xs=g(Mt,"u").replace(/punct/g,Ft).getRegex(),ei=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ti=g(ei,"u").replace(/openQuote/g,Zs).replace(/punct/g,T).getRegex(),Nt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",si=g(Nt,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,T).getRegex(),ii=g(Nt,"gu").replace(/notPunctSpace/g,Gs).replace(/punctSpace/g,Qs).replace(/punct/g,Ft).getRegex(),ni="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",ri=g(ni,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,T).getRegex(),oi=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,T).getRegex(),ai="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,T).getRegex(),ci=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),di="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,U).replace(/punct/g,T).getRegex(),pi=g(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),ui=g(/^<(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(),fi=g(ze).replace("(?:-->|$)","-->").getRegex(),gi=g("^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",fi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ie=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,bi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ie).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",ie).replace("ref",Pe).getRegex(),Ut=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pe).getRegex(),mi=g("reflink|nolink(?!\\()","g").replace("reflink",qt).replace("nolink",Ut).getRegex(),Xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:z,anyPunctuation:pi,autolink:ui,blockSkip:Ys,br:Dt,code:Ks,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:Js,emStrongRDelimAst:si,emStrongRDelimUnd:oi,escape:Hs,link:bi,nolink:Ut,punctuation:Ws,reflink:qt,reflinkSearch:mi,tag:gi,text:Vs,url:z},vi={...Ie,emStrongLDelim:ti,emStrongRDelimAst:ri,emStrongRDelimUnd:li,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",ie).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie).getRegex()},me={...Ie,emStrongRDelimAst:ii,emStrongLDelim:Xs,delLDelim:ci,delRDelim:hi,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xe).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:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Xe).getRegex()},xi={...me,br:g(Dt).replace("{2,}","*").getRegex(),text:g(me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:Le,gfm:js,pedantic:Bs},K={normal:Ie,gfm:me,breaks:xi,pedantic:vi},yi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},et=n=>yi[n];function C(n,e){if(e){if(y.escapeTest.test(n))return n.replace(y.escapeReplace,et)}else if(y.escapeTestNoEncode.test(n))return n.replace(y.escapeReplaceNoEncode,et);return n}function tt(n){try{n=encodeURI(n).replace(y.percentDecode,"%")}catch{return null}return n}function st(n,e){let t=n.replace(y.findPipe,(r,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split(y.splitPipe),i=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(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function E(n,e,t){let s=n.length;if(s===0)return"";let i=0;for(;i<s&&n.charAt(s-i-1)===e;)i++;return n.slice(0,s-i)}function it(n){let e=n.split(`
128
128
  `),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
129
- `)}function ki(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function $i(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function nt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),l=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,p=s.state.inRawBlock;s.state.linkEmitted=!1;let h=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!l){if(f){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:l?"image":"link",raw:t,href:r,title:o,text:a,tokens:h}}function wi(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
129
+ `)}function ki(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function $i(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function nt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,p=s.state.inRawBlock;s.state.linkEmitted=!1;let h=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(f){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:r,title:o,text:a,tokens:h}}function wi(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
130
130
  `).map(r=>{let o=r.match(t.other.beginningSpace);if(o===null)return r;let[a]=o;return a.length>=i.length?r.slice(i.length):r}).join(`
131
131
  `)}var ne=class{options;rules;lexer;constructor(n){this.options=n||F}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:it(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=wi(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(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=E(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:E(e[0],`
132
132
  `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:E(e[0],`
133
133
  `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=E(e[0],`
134
134
  `).split(`
135
- `),s="",i="",r=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let d=a.join(`
135
+ `),s="",i="",r=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
136
136
  `),p=d.replace(this.rules.other.blockquoteSetextReplace,`
137
137
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
138
138
  ${d}`:d,i=i?`${i}
@@ -142,19 +142,19 @@ ${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
142
142
  ${b}`,i=i.substring(0,i.length-x.text.length)+j.text;break}else if(f?.type==="list"){let x=f,b=x.raw+`
143
143
  `+t.join(`
144
144
  `),S=this.list(b);r[r.length-1]=S,s=s.substring(0,s.length-f.raw.length)+S.raw,i=i.substring(0,i.length-x.raw.length)+S.raw,t=b.substring(r.at(-1).raw.length).split(`
145
- `);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,i={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 r=this.rules.other.listItemRegex(t),o=!1;for(;n;){let l=!1,d="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let h=$i(e[2].split(`
145
+ `);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,i={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 r=this.rules.other.listItemRegex(t),o=!1;for(;n;){let c=!1,d="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let h=$i(e[2].split(`
146
146
  `,1)[0],e[1].length),f=n.split(`
147
147
  `,1)[0],x=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):x?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),x&&this.rules.other.blankLine.test(f)&&(d+=f+`
148
- `,n=n.substring(f.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),De=this.rules.other.fencesBeginRegex(b),Fe=this.rules.other.headingBeginRegex(b),Qt=this.rules.other.htmlBeginRegex(b),Gt=this.rules.other.blockquoteBeginRegex(b);for(;n;){let de=n.split(`
148
+ `,n=n.substring(f.length+1),c=!0),!c){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),De=this.rules.other.fencesBeginRegex(b),Fe=this.rules.other.headingBeginRegex(b),Qt=this.rules.other.htmlBeginRegex(b),Gt=this.rules.other.blockquoteBeginRegex(b);for(;n;){let de=n.split(`
149
149
  `,1)[0],B;if(f=de,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),B=f):B=f.replace(this.rules.other.tabCharGlobal," "),De.test(f)||Fe.test(f)||Qt.test(f)||Gt.test(f)||S.test(f)||j.test(f))break;if(B.search(this.rules.other.nonSpaceChar)>=b||!f.trim())p+=`
150
150
  `+B.slice(b);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||De.test(h)||Fe.test(h)||j.test(h))break;p+=`
151
151
  `+f}x=!f.trim(),d+=de+`
152
- `,n=n.substring(de.length+1),h=B.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=d}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let d=l.tokens.filter(h=>h.type==="space"),p=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=p}for(let l of i.items){let d=l.tokens[0];if(l.task&&(d?.type==="text"||d?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.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,i.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(i.loose)for(let l of i.items){l.loose=!0;for(let d of l.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=it(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);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"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:E(e[0],`
152
+ `,n=n.substring(de.length+1),h=B.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=d}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!i.loose){let d=c.tokens.filter(h=>h.type==="space"),p=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=p}for(let c of i.items){let d=c.tokens[0];if(c.task&&(d?.type==="text"||d?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.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(c.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=h.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=h.raw+c.tokens[0].raw,c.tokens[0].text=h.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(h)):c.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):c.tokens.unshift(h)}}else c.task&&(c.task=!1)}if(i.loose)for(let c of i.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=it(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);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"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:E(e[0],`
153
153
  `),href:s,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=st(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
154
154
  `):[],r={type:"table",raw:E(e[0],`
155
- `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<t.length;o++)r.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:r.align[o]});for(let o of i)r.rows.push(st(o,r.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[l]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
155
+ `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<t.length;o++)r.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:r.align[o]});for(let o of i)r.rows.push(st(o,r.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[c]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
156
156
  `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
157
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);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(n){let e=this.rules.inline.link.exec(n);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 r=E(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=ki(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=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)),nt(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return nt(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);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 i=[...s[0]].length-1,r,o,a=i,l=0,d=s[0][0],p=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+i);(s=h.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let f=[...s[0]][0].length,x=n.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let S=x.slice(1,-1);return{type:"em",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}let b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(s=l.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(o=[...r].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,p=n.slice(0,i+s.index+d+o),h=p.slice(i,-i);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);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(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==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(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ve{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:ee.normal,inline:K.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:K}}static lex(e,t){return new ve(t).lex(e)}static lexInline(e,t){return new ve(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
157
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);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(n){let e=this.rules.inline.link.exec(n);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 r=E(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=ki(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=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)),nt(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return nt(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);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 i=[...s[0]].length-1,r,o,a=i,c=0,d=s[0][0],p=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+i);(s=h.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let f=[...s[0]][0].length,x=n.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let S=x.slice(1,-1);return{type:"em",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}let b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(s=c.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(o=[...r].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,p=n.slice(0,i+s.index+d+o),h=p.slice(i,-i);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);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(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==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(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ve{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:ee.normal,inline:K.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:K}}static lex(e,t){return new ve(t).lex(e)}static lexInline(e,t){return new ve(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
158
158
  `),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(y.tabCharGlobal," ").replace(y.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
159
159
  `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
160
160
  `)?"":`
@@ -162,13 +162,13 @@ ${b}`,i=i.substring(0,i.length-x.text.length)+j.text;break}else if(f?.type==="li
162
162
  `+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
163
163
  `)?"":`
164
164
  `)+r.raw,a.text+=`
165
- `+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},l),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
165
+ `+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},c),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
166
166
  `)?"":`
167
167
  `)+r.raw,a.text+=`
168
168
  `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),s=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
169
169
  `)?"":`
170
170
  `)+r.raw,a.text+=`
171
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],r=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(r+1,-1)))&&!(r>1&&this.linkInText(i.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,l=d=>{let p=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(p+1,-1)))return d;if(p>1&&d.charAt(0)!=="!"){let h=d.slice(1,p-1);if(this.linkInText(h))return"["+h.replace(a,l)+"]["+"a".repeat(d.length-p-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,l)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,d)=>{let p=d?d.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,r="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(r=""),i=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let d=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(l=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),i=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},re=class{options;parser;constructor(n){this.options=n||F}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],i=n.replace(y.endingNewline,"")+`
171
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],r=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(r+1,-1)))&&!(r>1&&this.linkInText(i.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let p=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(p+1,-1)))return d;if(p>1&&d.charAt(0)!=="!"){let h=d.slice(1,p-1);if(this.linkInText(h))return"["+h.replace(a,c)+"]["+"a".repeat(d.length-p-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let p=d?d.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,r="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(r=""),i=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},p),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),i=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},re=class{options;parser;constructor(n){this.options=n||F}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(y.notSpaceStart)?.[0],i=n.replace(y.endingNewline,"")+`
172
172
  `;return s?'<pre><code class="language-'+C(s)+'">'+(t?i:C(i,!0))+`</code></pre>
173
173
  `:"<pre><code>"+(t?i:C(i,!0))+`</code></pre>
174
174
  `}blockquote({tokens:n}){return`<blockquote>
@@ -186,16 +186,16 @@ ${this.parser.parse(n)}</blockquote>
186
186
  `}tablerow({text:n}){return`<tr>
187
187
  ${n}</tr>
188
188
  `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
189
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${C(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),i=tt(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+C(e)+'"'),r+=">"+s+"</a>",r}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=tt(n);if(i===null)return C(t);n=i;let r=`<img src="${n}" alt="${C(t)}"`;return e&&(r+=` title="${C(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:C(n.text)}},Oe=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},_=class xe{options;renderer;textRenderer;constructor(e){this.options=e||F,this.options.renderer=this.options.renderer||new re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oe}static parse(e,t){return new xe(t).parse(e)}static parseInline(e,t){return new xe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,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 r=i;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let o='Token with "'+r.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 i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){s+=a||"";continue}}let o=r;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}},V=class{options;block;constructor(n){this.options=n||F}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?w.lex:w.lexInline}provideParser(n=this.block){return n?_.parse:_.parseInline}},_i=class{defaults=Ae();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=re;TextRenderer=Oe;Lexer=w;Tokenizer=ne;Hooks=V;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let o of r)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new re(this.defaults);for(let r in t.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=t.renderer[o],l=i[o];i[o]=(...d)=>{let p=a.apply(i,d);return p===!1&&(p=l.apply(i,d)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ne(this.defaults);for(let r in t.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=t.tokenizer[o],l=i[o];i[o]=(...d)=>{let p=a.apply(i,d);return p===!1&&(p=l.apply(i,d)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new V;for(let r in t.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=t.hooks[o],l=i[o];V.passThroughHooks.has(r)?i[o]=d=>{if(this.defaults.async&&V.passThroughHooksRespectAsync.has(r))return(async()=>{let h=await a.call(i,d);return l.call(i,h)})();let p=a.call(i,d);return l.call(i,p)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,d);return h===!1&&(h=await l.apply(i,d)),h})();let p=a.apply(i,d);return p===!1&&(p=l.apply(i,d)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,r=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return w.lex(n,e??this.defaults)}parser(n,e){return _.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},i={...this.defaults,...s},r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return r(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 r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(n):n?w.lex:w.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(n):n?_.parse:_.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(n):n?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(n):n?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(n,e){return t=>{if(t.message+=`
190
- Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new _i;function v(n,e){return D.parse(n,e)}v.options=v.setOptions=function(n){return D.setOptions(n),v.defaults=D.defaults,zt(v.defaults),v};v.getDefaults=Ae;v.defaults=F;function Si(...n){return D.use(...n),v.defaults=D.defaults,zt(v.defaults),v}v.use=Si;v.walkTokens=function(n,e){return D.walkTokens(n,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=re;v.TextRenderer=Oe;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ne;v.Hooks=V;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
189
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${C(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),i=tt(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+C(e)+'"'),r+=">"+s+"</a>",r}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=tt(n);if(i===null)return C(t);n=i;let r=`<img src="${n}" alt="${C(t)}"`;return e&&(r+=` title="${C(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:C(n.text)}},Oe=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},_=class xe{options;renderer;textRenderer;constructor(e){this.options=e||F,this.options.renderer=this.options.renderer||new re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Oe}static parse(e,t){return new xe(t).parse(e)}static parseInline(e,t){return new xe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,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 r=i;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let o='Token with "'+r.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 i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){s+=a||"";continue}}let o=r;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}},V=class{options;block;constructor(n){this.options=n||F}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?w.lex:w.lexInline}provideParser(n=this.block){return n?_.parse:_.parseInline}},_i=class{defaults=Te();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=re;TextRenderer=Oe;Lexer=w;Tokenizer=ne;Hooks=V;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let o of r)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new re(this.defaults);for(let r in t.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=t.renderer[o],c=i[o];i[o]=(...d)=>{let p=a.apply(i,d);return p===!1&&(p=c.apply(i,d)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ne(this.defaults);for(let r in t.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=t.tokenizer[o],c=i[o];i[o]=(...d)=>{let p=a.apply(i,d);return p===!1&&(p=c.apply(i,d)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new V;for(let r in t.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=t.hooks[o],c=i[o];V.passThroughHooks.has(r)?i[o]=d=>{if(this.defaults.async&&V.passThroughHooksRespectAsync.has(r))return(async()=>{let h=await a.call(i,d);return c.call(i,h)})();let p=a.call(i,d);return c.call(i,p)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,d);return h===!1&&(h=await c.apply(i,d)),h})();let p=a.apply(i,d);return p===!1&&(p=c.apply(i,d)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,r=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return w.lex(n,e??this.defaults)}parser(n,e){return _.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},i={...this.defaults,...s},r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return r(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 r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(n):n?w.lex:w.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(n):n?_.parse:_.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(n):n?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(n):n?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(n,e){return t=>{if(t.message+=`
190
+ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new _i;function v(n,e){return D.parse(n,e)}v.options=v.setOptions=function(n){return D.setOptions(n),v.defaults=D.defaults,zt(v.defaults),v};v.getDefaults=Te;v.defaults=F;function Si(...n){return D.use(...n),v.defaults=D.defaults,zt(v.defaults),v}v.use=Si;v.walkTokens=function(n,e){return D.walkTokens(n,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=re;v.TextRenderer=Oe;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ne;v.Hooks=V;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
191
191
  * @license
192
192
  * Copyright 2017 Google LLC
193
193
  * SPDX-License-Identifier: BSD-3-Clause
194
- */const Ci={CHILD:2},Ti=n=>(...e)=>({_$litDirective$:n,values:e});class Ai{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
194
+ */const Ci={CHILD:2},Ai=n=>(...e)=>({_$litDirective$:n,values:e});class Ti{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
195
195
  * @license
196
196
  * Copyright 2017 Google LLC
197
197
  * SPDX-License-Identifier: BSD-3-Clause
198
- */class ye extends Ai{constructor(e){if(super(e),this.it=m,e.type!==Ci.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ye.directiveName="unsafeHTML",ye.resultType=1;const Ei=Ti(ye);let rt=0;class Ri extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#r;#n;static{this.styles=T`
198
+ */class ye extends Ti{constructor(e){if(super(e),this.it=m,e.type!==Ci.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===O)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ye.directiveName="unsafeHTML",ye.resultType=1;const Ei=Ai(ye);let rt=0;class Ri extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#r;#n;static{this.styles=A`
199
199
  :host {
200
200
  display: inline-block;
201
201
  position: relative;
@@ -309,10 +309,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
309
309
  .option input { margin: 0; pointer-events: none; }
310
310
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
311
311
  .create-option { color: var(--accent); font-style: italic; }
312
- `}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#r=`--tag-multiselect-${++rt}`,this.#n=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#d=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#d)}disconnectedCallback(){document.removeEventListener("click",this.#d),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#p(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#g(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#y(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#u(s)):this.#o&&(e.preventDefault(),this.#u(this.#e.value.trim()))}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.#l()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return c`
312
+ `}constructor(){super(),new Y(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#r=`--tag-multiselect-${++rt}`,this.#n=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#d=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#d)}disconnectedCallback(){document.removeEventListener("click",this.#d),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#p(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#g(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#k(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#u(s)):this.#o&&(e.preventDefault(),this.#u(this.#e.value.trim()))}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.#l()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
313
313
  <div class="field" style=${`anchor-name: ${this.#r}`}>
314
314
  <div class="chips-and-input">
315
- ${e.map(r=>c`
315
+ ${e.map(r=>l`
316
316
  <span class="selected-chip">
317
317
  ${r}
318
318
  <span class="remove" @click=${()=>this.onToggle(r)}>✕</span>
@@ -330,10 +330,10 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
330
330
  @input=${r=>this.#h(r)}
331
331
  @focus=${()=>this.#i()}
332
332
  @click=${()=>this.#i()}
333
- @keydown=${r=>this.#y(r)}
333
+ @keydown=${r=>this.#k(r)}
334
334
  />
335
335
  </div>
336
- ${e.length>0?c`<button class="clear-btn" tabindex="-1" @mousedown=${r=>r.preventDefault()} @click=${r=>this.#g(r)}>✕</button>`:""}
336
+ ${e.length>0?l`<button class="clear-btn" tabindex="-1" @mousedown=${r=>r.preventDefault()} @click=${r=>this.#g(r)}>✕</button>`:""}
337
337
  <button
338
338
  class="chevron-btn ${s?"open":""}"
339
339
  tabindex="-1"
@@ -352,7 +352,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
352
352
  popover="manual"
353
353
  style=${`position-anchor: ${this.#r}`}
354
354
  >
355
- ${t.length?t.map((r,o)=>c`
355
+ ${t.length?t.map((r,o)=>l`
356
356
  <li
357
357
  id=${`${this.#n}-opt-${o}`}
358
358
  role="option"
@@ -364,7 +364,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
364
364
  <input type="checkbox" .checked=${e.includes(r)} tabindex="-1" />
365
365
  ${r}
366
366
  </li>
367
- `):this.#o?c`
367
+ `):this.#o?l`
368
368
  <li
369
369
  class="option create-option"
370
370
  @mousedown=${r=>r.preventDefault()}
@@ -372,9 +372,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
372
372
  >
373
373
  No match. Create '${this.#e.value.trim()}'
374
374
  </li>
375
- `:c`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
375
+ `:l`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
376
376
  </ul>
377
- `}}customElements.define("tag-multiselect",Ri);let ot=0;class Pi extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#r;#n;static{this.styles=T`
377
+ `}}customElements.define("tag-multiselect",Ri);let ot=0;class Pi extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#r;#n;static{this.styles=A`
378
378
  :host {
379
379
  display: inline-block;
380
380
  position: relative;
@@ -461,7 +461,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
461
461
  .option.selected { font-weight: 600; }
462
462
  .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
463
463
  .create-option { color: var(--accent); font-style: italic; }
464
- `}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#r=`--status-select-${++ot}`,this.#n=`status-select-listbox-${ot}`}#d=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#d)}disconnectedCallback(){document.removeEventListener("click",this.#d),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#p(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#u(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#u(e);if(!t)return this.#l();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#l()}get#g(){const e=this.#u(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#y(){return this.#a.length+(this.#g?1:0)}#$(e){const t=this.#y;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#a,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#g?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#l())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return c`
464
+ `}constructor(){super(),new Y(this),this.options=[],this.value="",this.onChange=()=>{},this.#r=`--status-select-${++ot}`,this.#n=`status-select-listbox-${ot}`}#d=e=>{e.composedPath().includes(this)||this.#l()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#d)}disconnectedCallback(){document.removeEventListener("click",this.#d),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#l(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#p(){this.#t.value?this.#l():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#u(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#u(e);if(!t)return this.#l();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#l()}get#g(){const e=this.#u(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#k(){return this.#a.length+(this.#g?1:0)}#$(e){const t=this.#k;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#a,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#g?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#l())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
465
465
  <div class="field" style=${`anchor-name: ${this.#r}`}>
466
466
  <input
467
467
  class="input"
@@ -494,7 +494,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
494
494
  popover="manual"
495
495
  style=${`position-anchor: ${this.#r}`}
496
496
  >
497
- ${t.map((r,o)=>c`
497
+ ${t.map((r,o)=>l`
498
498
  <li
499
499
  id=${`${this.#n}-opt-${o}`}
500
500
  role="option"
@@ -506,7 +506,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
506
506
  ${r}
507
507
  </li>
508
508
  `)}
509
- ${this.#g?c`
509
+ ${this.#g?l`
510
510
  <li
511
511
  id=${`${this.#n}-opt-${t.length}`}
512
512
  role="option"
@@ -517,9 +517,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
517
517
  ${t.length?"Create":"No match. Create"} '${this.#u(this.#e.value)}'
518
518
  </li>
519
519
  `:""}
520
- ${!t.length&&!this.#g?c`<li class="empty">No options</li>`:""}
520
+ ${!t.length&&!this.#g?l`<li class="empty">No options</li>`:""}
521
521
  </ul>
522
- `}}customElements.define("status-select",Pi);let zi=0;const Li={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},Ii=["top","bottom","left","right"];class Oi extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=T`
522
+ `}}customElements.define("status-select",Pi);let zi=0;const Li={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},Ii=["top","bottom","left","right"];class Oi extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=A`
523
523
  :host {
524
524
  display: inline-flex;
525
525
  position: relative;
@@ -603,7 +603,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
603
603
  translate: 0 -50%;
604
604
  margin: 0 0 0 6px;
605
605
  }
606
- `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++zi}`}get#s(){const e=Ii.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#r(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#n(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return c`
606
+ `}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++zi}`}get#s(){const e=Ii.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#r(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#n(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return l`
607
607
  <button
608
608
  type="button"
609
609
  class="icon"
@@ -625,7 +625,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
625
625
  >
626
626
  ${this.text}
627
627
  </div>
628
- `}}customElements.define("help-tooltip",Oi);const at="mem-bucket-detail-view-mode";function Di(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Fi=["stable","beta","unreviewed"],Mi=["active","shipped","abandoned"],lt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Ni=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ct(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class qi extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(at)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue=""}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0}}}static{this.styles=T`
628
+ `}}customElements.define("help-tooltip",Oi);const at="mem-bucket-detail-view-mode";function Di(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Fi=["stable","beta","unreviewed"],Mi=["active","shipped","abandoned"],lt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Ni=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ct(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class qi extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(at)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0},_viewingAttachment:{state:!0}}}static{this.styles=A`
629
629
  :host { display: block; padding: 16px; }
630
630
  h2 { margin: 0 0 4px; font-size: 16px; }
631
631
  .title-row {
@@ -738,6 +738,50 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
738
738
  margin-left: 2px;
739
739
  }
740
740
  .attachment-download:hover { opacity: 1; }
741
+ .attachment-view-header {
742
+ display: flex;
743
+ align-items: center;
744
+ gap: 10px;
745
+ margin-bottom: 8px;
746
+ }
747
+ .back-button {
748
+ font-size: 11px;
749
+ padding: 3px 8px;
750
+ border: 1px solid var(--border);
751
+ background: transparent;
752
+ color: inherit;
753
+ border-radius: 4px;
754
+ cursor: pointer;
755
+ }
756
+ .back-button:hover { background: var(--hover); }
757
+ .attachment-view-title {
758
+ font-size: 12px;
759
+ font-weight: 600;
760
+ flex: 1;
761
+ overflow: hidden;
762
+ text-overflow: ellipsis;
763
+ white-space: nowrap;
764
+ }
765
+ .attachment-view-download {
766
+ font-size: 11px;
767
+ text-decoration: none;
768
+ color: inherit;
769
+ opacity: 0.75;
770
+ }
771
+ .attachment-view-download:hover { opacity: 1; }
772
+ .attachment-frame {
773
+ width: 100%;
774
+ height: 65vh;
775
+ border: 1px solid var(--border);
776
+ border-radius: 6px;
777
+ background: var(--bg-subtle);
778
+ }
779
+ .attachment-image {
780
+ display: block;
781
+ max-width: 100%;
782
+ max-height: 65vh;
783
+ border-radius: 6px;
784
+ }
741
785
  .source-path {
742
786
  font-family: monospace;
743
787
  font-size: 11px;
@@ -912,9 +956,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error
912
956
  color: inherit;
913
957
  }
914
958
  .hint { font-size: 11px; opacity: 0.6; }
915
- `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,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)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return;const r=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=r)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(at,e)}async#r(){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#n(){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#d(){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?.()}#a(){this._doc&&(this._draft=ct(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#i(){this._doc&&(this._draft=ct(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#l(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#p(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#h(e){this._draft&&(this._draft={...this._draft,...e})}#u(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#h({tags:t})}#o(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#h({trigger_phrases:t})}async#g(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const r=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!r.ok){const o=await r.json().catch(()=>({}));window.alert(`Save failed: ${o.error??r.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#y(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
959
+ `}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this._viewingAttachment=null,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)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return;const r=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=r)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(at,e)}async#r(){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#n(){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#d(){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?.()}#a(){this._doc&&(this._draft=ct(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#i(){this._doc&&(this._draft=ct(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#l(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#p(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#h(e){this._draft&&(this._draft={...this._draft,...e})}#u(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#h({tags:t})}#o(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#h({trigger_phrases:t})}async#g(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const r=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!r.ok){const o=await r.json().catch(()=>({}));window.alert(`Save failed: ${o.error??r.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#k(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
916
960
 
917
- This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Delete failed: ${r.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#$(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#b(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#m(){return c`
961
+ This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Delete failed: ${r.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#$(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#m(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#v(){return l`
918
962
  <div class="edit-form">
919
963
  <div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
920
964
  <div class="field">
@@ -923,21 +967,21 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
923
967
  @change=${e=>this.#l(e.target.value)}
924
968
  >
925
969
  <option value="" selected disabled>Choose…</option>
926
- ${lt.map(e=>c`<option value=${e}>${e}</option>`)}
970
+ ${lt.map(e=>l`<option value=${e}>${e}</option>`)}
927
971
  </select>
928
972
  </div>
929
973
  <div class="form-actions">
930
974
  <button class="cancel" @click=${()=>this.#p()}>Cancel</button>
931
975
  </div>
932
976
  </div>
933
- `}#x(e){const t=this._draft,s=this.facets;return c`
977
+ `}#y(e){const t=this._draft,s=this.facets;return l`
934
978
  <div class="edit-form">
935
- ${e?c`
979
+ ${e?l`
936
980
  <div class="field">
937
981
  <label>name <help-tooltip .text=${$.name}></help-tooltip></label>
938
982
  <div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
939
983
  </div>
940
- `:c`
984
+ `:l`
941
985
  <div class="field-row">
942
986
  <div class="field">
943
987
  <label>key <help-tooltip .text=${$.key}></help-tooltip></label>
@@ -953,7 +997,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
953
997
  .value=${t.key_type}
954
998
  @change=${i=>this.#h({key_type:i.target.value})}
955
999
  >
956
- ${Ni.map(i=>c`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
1000
+ ${Ni.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
957
1001
  </select>
958
1002
  </div>
959
1003
  </div>
@@ -963,7 +1007,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
963
1007
  .value=${t.doc_type}
964
1008
  @change=${i=>this.#h({doc_type:i.target.value})}
965
1009
  >
966
- ${lt.map(i=>c`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
1010
+ ${lt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
967
1011
  </select>
968
1012
  </div>
969
1013
  `}
@@ -991,7 +1035,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
991
1035
  .onChange=${i=>this.#h({status:i})}
992
1036
  ></status-select>
993
1037
  </div>
994
- ${e?c`
1038
+ ${e?l`
995
1039
  <div class="field-row">
996
1040
  <div class="field">
997
1041
  <label>owner <help-tooltip .text=${$.owner}></help-tooltip></label>
@@ -1019,7 +1063,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1019
1063
  .onToggle=${i=>this.#o(i)}
1020
1064
  ></tag-multiselect>
1021
1065
  </div>
1022
- `:c`
1066
+ `:l`
1023
1067
  <div class="field">
1024
1068
  <label>related_to <help-tooltip .text=${$.related_to}></help-tooltip></label>
1025
1069
  <input
@@ -1034,10 +1078,10 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1034
1078
  <button class="cancel" @click=${()=>this.#p()}>Cancel</button>
1035
1079
  </div>
1036
1080
  </div>
1037
- `}#v(e,t){const s=t?void 0:e.key;return c`
1081
+ `}#b(e,t){const s=t?void 0:e.key;return l`
1038
1082
  <div class="title-row">
1039
1083
  <h2>
1040
- ${s?c`<button class="title-link" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
1084
+ ${s?l`<button class="title-link" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
1041
1085
  ${e.name??s??e.id}
1042
1086
  </button>`:e.name??e.key??e.id}
1043
1087
  </h2>
@@ -1045,33 +1089,33 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1045
1089
  📁 ${e.folder}
1046
1090
  </button>
1047
1091
  </div>
1048
- `}#f(e,t){const s=e.created_at?Di(e.created_at):null;return c`
1092
+ `}#f(e,t){const s=e.created_at?Di(e.created_at):null;return l`
1049
1093
  <dl class="info-grid">
1050
1094
  <dt>Description</dt>
1051
1095
  <dd class="description">${e.description||"—"}</dd>
1052
1096
 
1053
1097
  <dt>Tags</dt>
1054
1098
  <dd>
1055
- ${e.tags?.length?e.tags.map(i=>c`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):c`<span class="hint">no tags</span>`}
1099
+ ${e.tags?.length?e.tags.map(i=>l`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):l`<span class="hint">no tags</span>`}
1056
1100
  </dd>
1057
1101
 
1058
1102
  <dt>Status</dt>
1059
1103
  <dd>${e.status}</dd>
1060
1104
 
1061
- ${e.deprecated||e.paused?c`
1105
+ ${e.deprecated||e.paused?l`
1062
1106
  <dt>Flags</dt>
1063
1107
  <dd>
1064
- ${e.deprecated?c`<span class="pill warn-pill">deprecated</span>`:m}
1065
- ${e.paused?c`<span class="pill muted-pill">paused</span>`:m}
1108
+ ${e.deprecated?l`<span class="pill warn-pill">deprecated</span>`:m}
1109
+ ${e.paused?l`<span class="pill muted-pill">paused</span>`:m}
1066
1110
  </dd>
1067
1111
  `:m}
1068
1112
 
1069
- ${t?c`
1070
- ${e.owner?c`<dt>Owner</dt>
1113
+ ${t?l`
1114
+ ${e.owner?l`<dt>Owner</dt>
1071
1115
  <dd>${e.owner}</dd>`:m}
1072
- ${e.extends?c`<dt>Extends</dt>
1116
+ ${e.extends?l`<dt>Extends</dt>
1073
1117
  <dd>${e.extends}</dd>`:m}
1074
- `:c`
1118
+ `:l`
1075
1119
  <dt>Key</dt>
1076
1120
  <dd>
1077
1121
  <button class="key-link" title="Search for this key" @click=${()=>e.key&&this.onKeyClick?.(e.key)}>
@@ -1085,24 +1129,28 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1085
1129
  <dt>Doc type</dt>
1086
1130
  <dd>${e.doc_type}</dd>
1087
1131
 
1088
- ${e.related_to?c`<dt>Related to</dt>
1132
+ ${e.related_to?l`<dt>Related to</dt>
1089
1133
  <dd>${e.related_to}</dd>`:m}
1090
1134
  `}
1091
1135
 
1092
1136
  <dt>Created</dt>
1093
1137
  <dd>
1094
- ${s?c`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
1138
+ ${s?l`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
1095
1139
  >${s}</span
1096
- >`:c`<span class="hint">unknown</span>`}
1140
+ >`:l`<span class="hint">unknown</span>`}
1097
1141
  </dd>
1098
1142
  </dl>
1099
- `}#w(e,t){const s=new v.Renderer,i=s.link.bind(s);return s.link=r=>{if(typeof r.href=="string"&&r.href.startsWith("attachment://")){const o=r.href.slice(13);return i({...r,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(r)},s}#_(e,t){return e.attachments?.length?c`
1143
+ `}#w(e,t){const s=new v.Renderer,i=s.link.bind(s);return s.link=r=>{if(typeof r.href=="string"&&r.href.startsWith("attachment://")){const o=r.href.slice(13);return i({...r,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(r)},s}#_(e,t){return e.attachments?.length?l`
1100
1144
  <div class="attachments-section">
1101
1145
  <h4>Attachments</h4>
1102
1146
  <ul>
1103
- ${e.attachments.map(s=>c`
1147
+ ${e.attachments.map(s=>l`
1104
1148
  <li>
1105
- <a href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view" target="_blank" rel="noopener"
1149
+ <a
1150
+ href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view"
1151
+ target="_blank"
1152
+ rel="noopener"
1153
+ @click=${i=>{i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||(i.preventDefault(),this._viewingAttachment=s)}}
1106
1154
  >${s.filename}</a
1107
1155
  >
1108
1156
  <span class="attachment-meta">(${s.mime_type}, ${s.size} bytes)</span>
@@ -1116,29 +1164,38 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1116
1164
  `)}
1117
1165
  </ul>
1118
1166
  </div>
1119
- `:m}render(){if(!this.selected)return c`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?c`${this.#v(e,t)}${this.#m()}`:this._editing&&this._draft?c`${this.#v(e,t)}${this.#x(t)}`:c`
1120
- ${this.#v(e,t)}
1121
- ${i?c`<div class="bare-notice">No frontmatter this is a plain, unmanaged file.</div>`:this.#f(e,t)}
1122
- ${s?m:c`
1167
+ `:m}#x(e,t,s){const i=document.documentElement.getAttribute("data-theme"),r=i==="light"||i==="dark"?`?theme=${i}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view${r}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}`;return l`
1168
+ <div class="attachment-view-header">
1169
+ <button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
1170
+ ← Back
1171
+ </button>
1172
+ <span class="attachment-view-title" title=${s.filename}>${s.filename}</span>
1173
+ <a class="attachment-view-download" href=${a} title="Download ${s.filename}">⇩ Download</a>
1174
+ </div>
1175
+ ${s.mime_type.startsWith("image/")?l`<img class="attachment-image" src=${o} alt=${s.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${s.filename}></iframe>`}
1176
+ `}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#b(e,t)}${this.#v()}`:this._editing&&this._draft?l`${this.#b(e,t)}${this.#y(t)}`:this._viewingAttachment?l`${this.#b(e,t)}${this.#x(e,this.selected.table,this._viewingAttachment)}`:l`
1177
+ ${this.#b(e,t)}
1178
+ ${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#f(e,t)}
1179
+ ${s?m:l`
1123
1180
  <div class="actions">
1124
- ${i?c`<button class="primary" @click=${()=>this.#i()}>Add frontmatter</button>`:c`
1181
+ ${i?l`<button class="primary" @click=${()=>this.#i()}>Add frontmatter</button>`:l`
1125
1182
  <button @click=${()=>this.#a()}>Edit</button>
1126
- ${t?c`<button @click=${()=>this.#$()}>Rename</button>`:m}
1183
+ ${t?l`<button @click=${()=>this.#$()}>Rename</button>`:m}
1127
1184
  <button @click=${()=>this.#r()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
1128
1185
  <button @click=${()=>this.#n()}>${e.paused?"Resume":"Pause"}</button>
1129
- ${t?m:c`<button class="danger" @click=${()=>this.#y()}>Delete frontmatter</button>`}
1186
+ ${t?m:l`<button class="danger" @click=${()=>this.#k()}>Delete frontmatter</button>`}
1130
1187
  `}
1131
1188
  <button class="danger" @click=${()=>this.#d()}>Delete</button>
1132
1189
  </div>
1133
- ${this._renaming?c`
1190
+ ${this._renaming?l`
1134
1191
  <div class="rename-row">
1135
1192
  <input
1136
1193
  type="text"
1137
1194
  .value=${this._renameValue}
1138
1195
  @input=${r=>this._renameValue=r.target.value}
1139
- @keydown=${r=>r.key==="Enter"&&this.#b()}
1196
+ @keydown=${r=>r.key==="Enter"&&this.#m()}
1140
1197
  />
1141
- <button @click=${()=>this.#b()}>Save</button>
1198
+ <button @click=${()=>this.#m()}>Save</button>
1142
1199
  <button @click=${()=>this._renaming=!1}>Cancel</button>
1143
1200
  </div>
1144
1201
  `:m}
@@ -1158,9 +1215,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1158
1215
  Raw
1159
1216
  </button>
1160
1217
  </div>
1161
- ${this._viewMode==="markdown"?c`<div class="markdown-body">${Ei(v.parse(e.body??"",{async:!1,renderer:this.#w(this.selected.table,e.id)}))}</div>`:c`<pre>${e.raw_file??e.body}</pre>`}
1218
+ ${this._viewMode==="markdown"?l`<div class="markdown-body">${Ei(v.parse(e.body??"",{async:!1,renderer:this.#w(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
1162
1219
  <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
1163
- `}}customElements.define("detail-panel",qi);const oe="membkt";let ue;function Z(){return ue||(ue=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ue}class Ui extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#s=new u("");#r=new u([]);#n=new u(null);#d=new u("");#a=new u("");#i=new u("");#l=new u(!1);#p=new u(!1);#h=new u(!1);#u=new u("");#o=new u("");#g=new u(!1);#y=new u("");#$=new u(!1);#b=new u("");#m=new u(!1);#x=new u(!1);#v=new u([]);#f=new u("");#w=new u(!1);#_;static{this.styles=T`
1220
+ `}}customElements.define("detail-panel",qi);const oe="membkt";let ue;function W(){return ue||(ue=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ue}class Ui extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#s=new u("");#r=new u([]);#n=new u(null);#d=new u("");#a=new u("");#i=new u("");#l=new u(!1);#p=new u(!1);#h=new u(!1);#u=new u("");#o=new u("");#g=new u(!1);#k=new u("");#$=new u(!1);#m=new u("");#v=new u(!1);#y=new u(!1);#b=new u([]);#f=new u("");#w=new u(!1);#_;static{this.styles=A`
1164
1221
  :host { display: block; }
1165
1222
  .backdrop {
1166
1223
  position: fixed; inset: 0; background: var(--overlay);
@@ -1263,7 +1320,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1263
1320
  .ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
1264
1321
  .ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
1265
1322
  .ff-widget-slot { display: flex; }
1266
- `}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#k()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#_)}async#k(e){const t=new URLSearchParams;e&&t.set("path",e),this.#p.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#n.set(i.parent),this.#r.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#R(){this.#p.set(!this.#p.value),this.#k(this.#s.value)}#P(){this.#u.set(""),this.#h.set(!0)}#C(){this.#h.set(!1),this.#u.set("")}async#A(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#h.set(!1),this.#u.set(""),await this.#k(this.#s.value)}catch(t){this.#i.set(t.message)}}}#E(){this.#d.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#z(){const e=this.#d.value||this.#s.value;if(e){this.#l.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{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.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#l.set(!1)}}}async#L(){if(this.#m.value)return;const{folderfooMode:e,folderfooHost:t}=await Z();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#b.set(oe),this.#$.set(!0),this.#D(s))}async#I(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await $t(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#g.set(!0),this.#y.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#_=setInterval(()=>this.#O(),800),this.#O()}catch(e){this.#y.set(e.message)}}#O(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#m.value||(clearInterval(this.#_),this.#D(e))}async#D(e){this.#x.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#m.set(!0),this.#b.set(oe),await this.#N()}finally{this.#x.set(!1)}}async#N(){this.#w.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#b.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folderfoo folders");return}this.#v.set(s)}finally{this.#w.set(!1)}}#q(e){this.#f.set(e),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#b.value)}async#U(){if(this.#f.value){this.#l.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#o.value,tenantId:this.#b.value,folderPath:this.#f.value})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#l.set(!1)}}}#j(){const e=this.#r.value;return c`
1323
+ `}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#x()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#_)}async#x(e){const t=new URLSearchParams;e&&t.set("path",e),this.#p.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#n.set(i.parent),this.#r.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#R(){this.#p.set(!this.#p.value),this.#x(this.#s.value)}#P(){this.#u.set(""),this.#h.set(!0)}#C(){this.#h.set(!1),this.#u.set("")}async#T(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#h.set(!1),this.#u.set(""),await this.#x(this.#s.value)}catch(t){this.#i.set(t.message)}}}#E(){this.#d.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#z(){const e=this.#d.value||this.#s.value;if(e){this.#l.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{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.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#l.set(!1)}}}async#L(){if(this.#v.value)return;const{folderfooMode:e,folderfooHost:t}=await W();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#m.set(oe),this.#$.set(!0),this.#D(s))}async#I(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await $t(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#g.set(!0),this.#k.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#_=setInterval(()=>this.#O(),800),this.#O()}catch(e){this.#k.set(e.message)}}#O(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#v.value||(clearInterval(this.#_),this.#D(e))}async#D(e){this.#y.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#v.set(!0),this.#m.set(oe),await this.#N()}finally{this.#y.set(!1)}}async#N(){this.#w.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#m.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folderfoo folders");return}this.#b.set(s)}finally{this.#w.set(!1)}}#q(e){this.#f.set(e),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#m.value)}async#U(){if(this.#f.value){this.#l.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#o.value,tenantId:this.#m.value,folderPath:this.#f.value})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#l.set(!1)}}}#j(){const e=this.#r.value;return l`
1267
1324
  <div class="breadcrumb-row">
1268
1325
  <div class="breadcrumb">${this.#s.value}</div>
1269
1326
  <button class="new-folder-btn" @click=${()=>this.#P()}>+ New folder</button>
@@ -1272,24 +1329,24 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1272
1329
  Show hidden
1273
1330
  </label>
1274
1331
  </div>
1275
- ${this.#h.value?c`
1332
+ ${this.#h.value?l`
1276
1333
  <div class="new-folder-row">
1277
1334
  <input
1278
1335
  type="text"
1279
1336
  placeholder="Folder name"
1280
1337
  .value=${this.#u.value}
1281
1338
  @input=${t=>this.#u.set(t.target.value)}
1282
- @keydown=${t=>{t.key==="Enter"&&this.#A(),t.key==="Escape"&&this.#C()}}
1339
+ @keydown=${t=>{t.key==="Enter"&&this.#T(),t.key==="Escape"&&this.#C()}}
1283
1340
  />
1284
- <button @click=${()=>this.#A()}>Create</button>
1341
+ <button @click=${()=>this.#T()}>Create</button>
1285
1342
  <button @click=${()=>this.#C()}>Cancel</button>
1286
1343
  </div>
1287
1344
  `:""}
1288
1345
  <div class="browser">
1289
- ${this.#n.value?c`<div class="entry up" @click=${()=>this.#k(this.#n.value)}>
1346
+ ${this.#n.value?l`<div class="entry up" @click=${()=>this.#x(this.#n.value)}>
1290
1347
  <span class="icon">📁</span> ..
1291
1348
  </div>`:""}
1292
- ${e.length===0&&!this.#n.value?c`<div class="empty">No subdirectories here.</div>`:e.map(t=>c`<div class="entry" @click=${()=>this.#k(t.path)}>
1349
+ ${e.length===0&&!this.#n.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#x(t.path)}>
1293
1350
  <span class="icon">📁</span> ${t.name}
1294
1351
  </div>`)}
1295
1352
  </div>
@@ -1297,7 +1354,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1297
1354
  <button class="secondary" @click=${()=>this.#E()}>
1298
1355
  Select this folder
1299
1356
  </button>
1300
- ${this.#d.value?c`<div class="selected-row">Selected: <span class="path">${this.#d.value}</span></div>`:""}
1357
+ ${this.#d.value?l`<div class="selected-row">Selected: <span class="path">${this.#d.value}</span></div>`:""}
1301
1358
  <div>
1302
1359
  <label>Folder name</label>
1303
1360
  <input
@@ -1307,7 +1364,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1307
1364
  @input=${t=>this.#a.set(t.target.value)}
1308
1365
  />
1309
1366
  </div>
1310
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1367
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1311
1368
  <div class="actions">
1312
1369
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1313
1370
  <button
@@ -1319,28 +1376,28 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1319
1376
  </button>
1320
1377
  </div>
1321
1378
  </div>
1322
- `}#B(){const e=this.#v.value;return this.#$.value&&!this.#m.value?c`
1379
+ `}#B(){const e=this.#b.value;return this.#$.value&&!this.#v.value?l`
1323
1380
  <div class="ff-body">
1324
1381
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
1325
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1382
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1326
1383
  <div class="actions">
1327
1384
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1328
1385
  </div>
1329
1386
  </div>
1330
- `:this.#m.value?c`
1387
+ `:this.#v.value?l`
1331
1388
  <div class="ff-body">
1332
1389
  <div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#o.value}</div>
1333
- ${e.length>0?c`
1390
+ ${e.length>0?l`
1334
1391
  <div class="ff-folder-list">
1335
- ${e.map(t=>c`<div
1392
+ ${e.map(t=>l`<div
1336
1393
  class="ff-folder-entry ${this.#f.value===t.path?"selected":""}"
1337
1394
  @click=${()=>this.#q(t.path)}
1338
1395
  >
1339
1396
  ${t.path}
1340
1397
  </div>`)}
1341
1398
  </div>
1342
- `:this.#w.value?c`<div class="ff-hint">Loading folders…</div>`:c`<div class="ff-empty">No folders found.</div>`}
1343
- ${this.#f.value?c`<div class="selected-row">Selected: <span class="path">${this.#f.value}</span></div>`:""}
1399
+ `:this.#w.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No folders found.</div>`}
1400
+ ${this.#f.value?l`<div class="selected-row">Selected: <span class="path">${this.#f.value}</span></div>`:""}
1344
1401
  <div>
1345
1402
  <label>Folder name</label>
1346
1403
  <input
@@ -1350,7 +1407,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1350
1407
  @input=${t=>this.#a.set(t.target.value)}
1351
1408
  />
1352
1409
  </div>
1353
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1410
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1354
1411
  <div class="actions">
1355
1412
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1356
1413
  <button
@@ -1362,7 +1419,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1362
1419
  </button>
1363
1420
  </div>
1364
1421
  </div>
1365
- `:c`
1422
+ `:l`
1366
1423
  <div class="ff-body">
1367
1424
  <div class="ff-hint">
1368
1425
  Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
@@ -1380,26 +1437,26 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1380
1437
  @keydown=${t=>t.key==="Enter"&&this.#I()}
1381
1438
  />
1382
1439
  </div>
1383
- ${this.#g.value?c`
1440
+ ${this.#g.value?l`
1384
1441
  <div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
1385
1442
  <div class="ff-widget-slot"></div>
1386
- ${this.#x.value?c`<div class="ff-hint">Finishing connection…</div>`:""}
1387
- `:c`
1443
+ ${this.#y.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
1444
+ `:l`
1388
1445
  <div class="actions" style="justify-content: flex-start; margin-top: 0;">
1389
1446
  <button class="secondary" @click=${()=>this.#I()}>Continue</button>
1390
1447
  </div>
1391
1448
  `}
1392
- ${this.#y.value?c`<div class="error">${this.#y.value}</div>`:""}
1393
- ${this.#i.value?c`<div class="error">${this.#i.value}</div>`:""}
1449
+ ${this.#k.value?l`<div class="error">${this.#k.value}</div>`:""}
1450
+ ${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
1394
1451
  <div class="actions">
1395
1452
  <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
1396
1453
  </div>
1397
1454
  </div>
1398
- `}render(){return c`
1455
+ `}render(){return l`
1399
1456
  <div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
1400
1457
  <div class="modal">
1401
1458
  <div class="header"><h2>Add a folder</h2></div>
1402
- ${this.lockKind?c``:c`
1459
+ ${this.lockKind?l``:l`
1403
1460
  <div class="kind-toggle">
1404
1461
  <button
1405
1462
  class=${this.#e.value==="skill"?"active":""}
@@ -1429,7 +1486,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1429
1486
  ${this.#t.value==="local"?this.#j():this.#B()}
1430
1487
  </div>
1431
1488
  </div>
1432
- `}}customElements.define("add-folder-modal",Ui);function dt(n){const e=Date.now()-n,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class ji extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=T`
1489
+ `}}customElements.define("add-folder-modal",Ui);function dt(n){const e=Date.now()-n,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class ji extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=A`
1433
1490
  :host { display: flex; flex: 1 1 auto; min-height: 0; }
1434
1491
  .nav {
1435
1492
  flex: 0 0 260px;
@@ -1488,7 +1545,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1488
1545
  opacity: 0.5; font-size: 13px; padding-top: 46px;
1489
1546
  }
1490
1547
  .placeholder-empty { opacity: 0.5; font-style: italic; }
1491
- `}#e(){return!this.channels||this.channels.length===0?c`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>c`
1548
+ `}#e(){return!this.channels||this.channels.length===0?l`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>l`
1492
1549
  <div
1493
1550
  class="channel-row ${this.selected===t.name?"active":""}"
1494
1551
  @click=${()=>this.onSelect(t.name)}
@@ -1496,15 +1553,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1496
1553
  <span class="channel-name">${t.name}</span>
1497
1554
  <span class="channel-meta">${dt(t.lastActivityAt)}</span>
1498
1555
  </div>
1499
- `)}#t(){return this.selected?this.loading?c`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?c`
1556
+ `)}#t(){return this.selected?this.loading?l`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?l`
1500
1557
  <div class="content-pane">
1501
1558
  <div class="content-header">
1502
1559
  <span class="content-title">${this.detail.name}</span>
1503
1560
  <span class="content-meta">last activity ${dt(this.detail.lastActivityAt)}</span>
1504
1561
  </div>
1505
- ${this.detail.content?c`<div class="content-body">${this.detail.content}</div>`:c`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1562
+ ${this.detail.content?l`<div class="content-body">${this.detail.content}</div>`:l`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
1506
1563
  </div>
1507
- `:c`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:c`<div class="no-selection">Select a channel to view its content.</div>`}render(){return c`
1564
+ `:l`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:l`<div class="no-selection">Select a channel to view its content.</div>`}render(){return l`
1508
1565
  <div class="nav">
1509
1566
  <div class="nav-header">
1510
1567
  <span>Live channels</span>
@@ -1513,7 +1570,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1513
1570
  ${this.#e()}
1514
1571
  </div>
1515
1572
  ${this.#t()}
1516
- `}}customElements.define("channel-view",ji);function Bi(n){const e=new Map;for(const t of n){const s=t.tags.length>0?t.tags:[null];for(const i of s){const r=e.get(i);r?r.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function Hi(n,e){const t=new Map;for(const r of n){const o=t.get(r.folder);o?o.push(r):t.set(r.folder,[r])}const s=[],i=[];for(const r of e){const o=t.get(r.name);if(!o)continue;const a={folder:r,tagGroups:[{tag:null,items:o}]};(r.remote?i:s).push(a)}return{local:s,remote:i}}const jt="mem-bucket-folder-view-mode",Bt="mem-bucket-folder-view-expanded",ht="mem-bucket-folder-view-tree-split-pct",pt="mem-bucket-folder-view-list-split-pct",ut=12,ft=40,gt=20,bt=80;function mt(n,e,t,s){const i=Number(localStorage.getItem(n));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ki=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Vi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Zi(){const n=localStorage.getItem(jt);return n==="a"||n==="b"||n==="c"?n:"a"}function Wi(){try{const n=localStorage.getItem(Bt);if(!n)return new Set;const e=JSON.parse(n);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function vt(n){localStorage.setItem(Bt,JSON.stringify([...n]))}class Qi extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new u(Zi());#t=new u(Wi());#s=new u([]);#r=new u(null);#n=new u(null);#d=new u(mt(ht,20,ut,ft));#a=new u(mt(pt,40,gt,bt));#i=new u(null);#l=e=>this.#g(e);#p=()=>this.#y();static{this.styles=T`
1573
+ `}}customElements.define("channel-view",ji);function Bi(n){const e=new Map;for(const t of n){const s=t.tags.length>0?t.tags:[null];for(const i of s){const r=e.get(i);r?r.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function Hi(n,e){const t=new Map;for(const r of n){const o=t.get(r.folder);o?o.push(r):t.set(r.folder,[r])}const s=[],i=[];for(const r of e){const o=t.get(r.name);if(!o)continue;const a={folder:r,tagGroups:[{tag:null,items:o}]};(r.remote?i:s).push(a)}return{local:s,remote:i}}const jt="mem-bucket-folder-view-mode",Bt="mem-bucket-folder-view-expanded",ht="mem-bucket-folder-view-tree-split-pct",pt="mem-bucket-folder-view-list-split-pct",ut=12,ft=40,gt=20,bt=80;function mt(n,e,t,s){const i=Number(localStorage.getItem(n));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ki=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Vi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Wi(){const n=localStorage.getItem(jt);return n==="a"||n==="b"||n==="c"?n:"a"}function Zi(){try{const n=localStorage.getItem(Bt);if(!n)return new Set;const e=JSON.parse(n);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function vt(n){localStorage.setItem(Bt,JSON.stringify([...n]))}class Qi extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new u(Wi());#t=new u(Zi());#s=new u([]);#r=new u(null);#n=new u(null);#d=new u(mt(ht,20,ut,ft));#a=new u(mt(pt,40,gt,bt));#i=new u(null);#l=e=>this.#g(e);#p=()=>this.#k();static{this.styles=A`
1517
1574
  :host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
1518
1575
  .mode-row {
1519
1576
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
@@ -1589,83 +1646,83 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1589
1646
  border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
1590
1647
  }
1591
1648
  .folder-card:hover { background: var(--hover); }
1592
- `}constructor(){super(),new Y(this)}#h(e){this.#e.set(e),localStorage.setItem(jt,e),this.#t.set(new Set),vt(new Set),this.#s.set([]),this.#r.set(null),this.#n.set(null)}#u(e){this.#h(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#l),document.addEventListener("pointerup",this.#p)}#g(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),r=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#d.set(Math.min(ft,Math.max(ut,r)));else{const o=100-this.#d.value,a=o>0?(r-this.#d.value)/o*100:0;this.#a.set(Math.min(bt,Math.max(gt,a)))}}#y(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#l),document.removeEventListener("pointerup",this.#p),e==="tree"?localStorage.setItem(ht,String(this.#d.value)):e==="list"&&localStorage.setItem(pt,String(this.#a.value))}#$(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),vt(t)}#b(e,t){this.#r.set({folder:e,tag:t})}#m(e){this.#r.set(null),this.#n.set({table:e._table,id:e.id})}#x(e){this.#n.set({table:e._table,id:e.id})}#v(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#r.value?.folder===e.folder.name&&this.#r.value?.tag===null;return c`
1649
+ `}constructor(){super(),new Y(this)}#h(e){this.#e.set(e),localStorage.setItem(jt,e),this.#t.set(new Set),vt(new Set),this.#s.set([]),this.#r.set(null),this.#n.set(null)}#u(e){this.#h(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#l),document.addEventListener("pointerup",this.#p)}#g(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),r=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#d.set(Math.min(ft,Math.max(ut,r)));else{const o=100-this.#d.value,a=o>0?(r-this.#d.value)/o*100:0;this.#a.set(Math.min(bt,Math.max(gt,a)))}}#k(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#l),document.removeEventListener("pointerup",this.#p),e==="tree"?localStorage.setItem(ht,String(this.#d.value)):e==="list"&&localStorage.setItem(pt,String(this.#a.value))}#$(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),vt(t)}#m(e,t){this.#r.set({folder:e,tag:t})}#v(e){this.#r.set(null),this.#n.set({table:e._table,id:e.id})}#y(e){this.#n.set({table:e._table,id:e.id})}#b(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#r.value?.folder===e.folder.name&&this.#r.value?.tag===null;return l`
1593
1650
  <button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#$(t)}>
1594
1651
  <span class="caret">${s?"▾":"▸"}</span>
1595
1652
  <span class="icon">${e.folder.remote?"☁":"📁"}</span>
1596
1653
  <span
1597
1654
  class="label"
1598
- @click=${o=>{o.stopPropagation(),this.#b(e.folder.name,null)}}
1655
+ @click=${o=>{o.stopPropagation(),this.#m(e.folder.name,null)}}
1599
1656
  >${e.folder.name}</span
1600
1657
  >
1601
1658
  <span class="count">${i}</span>
1602
1659
  </button>
1603
- `}#f(e){const t=(s,i)=>s.length===0?"":c`
1660
+ `}#f(e){const t=(s,i)=>s.length===0?"":l`
1604
1661
  <div class="section-header">${i}</div>
1605
- ${s.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),l=r.tagGroups[0]?.items??[];return c`
1606
- ${this.#v(r,o)}
1607
- ${a?l.map(d=>c`
1608
- <button class="node indent-1" @click=${()=>this.#m(d)}>
1662
+ ${s.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),c=r.tagGroups[0]?.items??[];return l`
1663
+ ${this.#b(r,o)}
1664
+ ${a?c.map(d=>l`
1665
+ <button class="node indent-1" @click=${()=>this.#v(d)}>
1609
1666
  <span class="caret"></span>
1610
1667
  <span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
1611
1668
  <span class="label">${d.name}</span>
1612
1669
  </button>
1613
1670
  `):""}
1614
1671
  `})}
1615
- `;return e.local.length===0&&e.remote.length===0?c`<div class="empty">No entries.</div>`:c`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#w(e){const t=this.#s.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?c`<div class="empty">No entries.</div>`:o.map(a=>{const l=a.tagGroups.reduce((d,p)=>d+p.items.length,0);return c`
1672
+ `;return e.local.length===0&&e.remote.length===0?l`<div class="empty">No entries.</div>`:l`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#w(e){const t=this.#s.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?l`<div class="empty">No entries.</div>`:o.map(a=>{const c=a.tagGroups.reduce((d,p)=>d+p.items.length,0);return l`
1616
1673
  <button
1617
1674
  class="folder-card ${a.folder.remote?"remote":""}"
1618
1675
  @click=${()=>this.#s.set([a.folder.name])}
1619
1676
  >
1620
1677
  <span class="icon">${a.folder.remote?"☁":"📁"}</span>
1621
1678
  <span class="label">${a.folder.name}</span>
1622
- <span class="count">${l}</span>
1679
+ <span class="count">${c}</span>
1623
1680
  </button>
1624
- `})}const s=t[0],r=[...e.local,...e.remote].find(o=>o.folder.name===s)?.tagGroups[0]?.items??[];return c`
1681
+ `})}const s=t[0],r=[...e.local,...e.remote].find(o=>o.folder.name===s)?.tagGroups[0]?.items??[];return l`
1625
1682
  <div class="breadcrumb-bar">
1626
1683
  <button @click=${()=>this.#s.set([])}>🏠 Folders</button>
1627
1684
  <span class="breadcrumb-sep">›</span>
1628
1685
  <span>${s}</span>
1629
1686
  </div>
1630
- ${r.length===0?c`<div class="empty">No entries in this folder.</div>`:r.map(o=>c`
1631
- <button class="node" @click=${()=>this.#m(o)}>
1687
+ ${r.length===0?l`<div class="empty">No entries in this folder.</div>`:r.map(o=>l`
1688
+ <button class="node" @click=${()=>this.#v(o)}>
1632
1689
  <span class="caret"></span>
1633
1690
  <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1634
1691
  <span class="label">${o.name}</span>
1635
1692
  </button>
1636
1693
  `)}
1637
- `}#_(e){return e.length===0?c`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),r=this.#r.value?.folder===null&&this.#r.value?.tag===t.tag;return c`
1694
+ `}#_(e){return e.length===0?l`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),r=this.#r.value?.folder===null&&this.#r.value?.tag===t.tag;return l`
1638
1695
  <button class="node ${r?"active":""}" @click=${()=>this.#$(s)}>
1639
1696
  <span class="caret">${i?"▾":"▸"}</span>
1640
1697
  <span class="icon">${t.tag===null?"":"🏷"}</span>
1641
1698
  <span
1642
1699
  class="label"
1643
- @click=${o=>{o.stopPropagation(),this.#b(null,t.tag)}}
1700
+ @click=${o=>{o.stopPropagation(),this.#m(null,t.tag)}}
1644
1701
  >${t.tag??"(untagged)"}</span
1645
1702
  >
1646
1703
  <span class="count">${t.items.length}</span>
1647
1704
  </button>
1648
- ${i?t.items.map(o=>c`
1649
- <button class="node indent-1" @click=${()=>this.#m(o)}>
1705
+ ${i?t.items.map(o=>l`
1706
+ <button class="node indent-1" @click=${()=>this.#v(o)}>
1650
1707
  <span class="caret"></span>
1651
1708
  <span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
1652
1709
  <span class="label">${o.name}</span>
1653
1710
  <span class="count">${o.folder}</span>
1654
1711
  </button>
1655
1712
  `):""}
1656
- `})}#k(){const e=this.#r.value;return e?(this.entries??[]).filter(s=>(e.folder===null||s.folder===e.folder)&&(e.tag===null||s.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],s=this.allFolders??[],i=e==="c"?null:Hi(t,s),r=e==="c"?Bi(t):null,o=this.#r.value,a=this.#n.value;return c`
1713
+ `})}#x(){const e=this.#r.value;return e?(this.entries??[]).filter(s=>(e.folder===null||s.folder===e.folder)&&(e.tag===null||s.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],s=this.allFolders??[],i=e==="c"?null:Hi(t,s),r=e==="c"?Bi(t):null,o=this.#r.value,a=this.#n.value;return l`
1657
1714
  <div class="mode-row">
1658
1715
  <span class="filter-label">View:</span>
1659
- <select .value=${e} @change=${l=>this.#u(l)}>
1660
- ${Vi.map(l=>c`<option value=${l.value}>${l.label}</option>`)}
1716
+ <select .value=${e} @change=${c=>this.#u(c)}>
1717
+ ${Vi.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
1661
1718
  </select>
1662
1719
  <div class="type-toggle">
1663
- ${Ki.map(l=>c`
1720
+ ${Ki.map(c=>l`
1664
1721
  <button
1665
- class=${this.typeFilter===l.value?"active":""}
1666
- @click=${()=>this.onTypeChange(l.value)}
1722
+ class=${this.typeFilter===c.value?"active":""}
1723
+ @click=${()=>this.onTypeChange(c.value)}
1667
1724
  >
1668
- ${l.label}
1725
+ ${c.label}
1669
1726
  </button>
1670
1727
  `)}
1671
1728
  </div>
@@ -1678,31 +1735,31 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1678
1735
  >
1679
1736
  ${e==="a"?this.#f(i):e==="b"?this.#w(i):this.#_(r)}
1680
1737
  </div>
1681
- ${o?c`
1738
+ ${o?l`
1682
1739
  <div
1683
1740
  class="splitter ${this.#i.value==="tree"?"dragging":""}"
1684
- @pointerdown=${l=>this.#o("tree",l)}
1741
+ @pointerdown=${c=>this.#o("tree",c)}
1685
1742
  ></div>
1686
1743
  <result-list
1687
1744
  style=${`width: ${this.#a.value}%; border-right: 1px solid var(--border);`}
1688
- .results=${this.#k()}
1745
+ .results=${this.#x()}
1689
1746
  .showFolder=${!0}
1690
- .onSelect=${l=>this.#x(l)}
1747
+ .onSelect=${c=>this.#y(c)}
1691
1748
  .selectedIds=${new Set}
1692
1749
  .onToggleSelect=${()=>{}}
1693
1750
  .onKeyClick=${this.onKeyClick}
1694
1751
  ></result-list>
1695
1752
  <div
1696
1753
  class="splitter ${this.#i.value==="list"?"dragging":""}"
1697
- @pointerdown=${l=>this.#o("list",l)}
1754
+ @pointerdown=${c=>this.#o("list",c)}
1698
1755
  ></div>
1699
- `:c`
1756
+ `:l`
1700
1757
  <div
1701
1758
  class="splitter ${this.#i.value==="tree"?"dragging":""}"
1702
- @pointerdown=${l=>this.#o("tree",l)}
1759
+ @pointerdown=${c=>this.#o("tree",c)}
1703
1760
  ></div>
1704
1761
  `}
1705
- ${a?c`
1762
+ ${a?l`
1706
1763
  <detail-panel
1707
1764
  .selected=${a}
1708
1765
  .facets=${this.facets}
@@ -1712,9 +1769,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1712
1769
  .onDateClick=${this.onDateClick}
1713
1770
  .onKeyClick=${this.onKeyClick}
1714
1771
  ></detail-panel>
1715
- `:c`<div class="no-selection">Select an item to view it.</div>`}
1772
+ `:l`<div class="no-selection">Select an item to view it.</div>`}
1716
1773
  </div>
1717
- `}}customElements.define("folder-view",Qi);const Gi={system:"◐",light:"☀",dark:"☾"},Yi={system:"Auto",light:"Light",dark:"Dark"};class Ji extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=T`
1774
+ `}}customElements.define("folder-view",Qi);const Gi={system:"◐",light:"☀",dark:"☾"},Yi={system:"Auto",light:"Light",dark:"Dark"};class Ji extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=A`
1718
1775
  :host {
1719
1776
  display: flex;
1720
1777
  align-items: center;
@@ -1766,7 +1823,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1766
1823
  .channels-toggle.active, .folder-view-toggle.active {
1767
1824
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg); opacity: 1;
1768
1825
  }
1769
- `}#e(){return c`
1826
+ `}#e(){return l`
1770
1827
  <button
1771
1828
  class=${`reindex-toggle${this.reindexing?" spinning":""}`}
1772
1829
  title=${this.reindexing?"Reindexing…":"Rebuild cache from disk"}
@@ -1776,7 +1833,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1776
1833
  >
1777
1834
 
1778
1835
  </button>
1779
- `}render(){return c`
1836
+ `}render(){return l`
1780
1837
  ${this.showReindex?this.#e():""}
1781
1838
  <button
1782
1839
  class="channels-toggle ${this.channelsActive?"active":""}"
@@ -1801,7 +1858,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
1801
1858
  ${Gi[this.theme]}
1802
1859
  </button>
1803
1860
  <div class="folderfoo-slot"></div>
1804
- `}}customElements.define("app-toolbar",Ji);function Xi(n){const e=n.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[r,o]=e;return r.includes("/")?{folderPath:r,name:o}:{owner:r,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const Ht=new u({mode:"off",username:null});let xt=!1;function en(){if(xt)return;xt=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{Ht.set(JSON.parse(e.data))}catch{}}}const tn=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],yt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],sn={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},nn={skill:[],memory:[]},Kt="mem-bucket-split-pct",Vt=20,Zt=80;function rn(){const n=Number(localStorage.getItem(Kt));return Number.isFinite(n)&&n>=Vt&&n<=Zt?n:40}const Wt="mem-bucket-theme",fe=["system","light","dark"];function on(){const n=localStorage.getItem(Wt);return n==="light"||n==="dark"?n:"system"}function kt(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function an(){const n=location.hash.slice(1);if(!n)return{};const e=new URLSearchParams(n),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const r=e.getAll("tag");r.length&&(t.activeTags=r);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const l=e.get("deprecated");l==="0"?t.deprecatedFilter="hide":l==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const h=e.get("date_to");return h&&(t.dateTo=h),t}class ln extends k{static{this.styles=T`
1861
+ `}}customElements.define("app-toolbar",Ji);function Xi(n){const e=n.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[r,o]=e;return r.includes("/")?{folderPath:r,name:o}:{owner:r,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const Ht=new u({mode:"off",username:null});let xt=!1;function en(){if(xt)return;xt=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{Ht.set(JSON.parse(e.data))}catch{}}}const tn=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],yt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],sn={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},nn={skill:[],memory:[]},Kt="mem-bucket-split-pct",Vt=20,Wt=80;function rn(){const n=Number(localStorage.getItem(Kt));return Number.isFinite(n)&&n>=Vt&&n<=Wt?n:40}const Zt="mem-bucket-theme",fe=["system","light","dark"];function on(){const n=localStorage.getItem(Zt);return n==="light"||n==="dark"?n:"system"}function kt(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function an(){const n=location.hash.slice(1);if(!n)return{};const e=new URLSearchParams(n),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const r=e.getAll("tag");r.length&&(t.activeTags=r);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const c=e.get("deprecated");c==="0"?t.deprecatedFilter="hide":c==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const p=e.get("date_from");p&&(t.dateFrom=p);const h=e.get("date_to");return h&&(t.dateTo=h),t}class ln extends k{static{this.styles=A`
1805
1862
  :host { display: flex; flex-direction: column; height: 100vh; }
1806
1863
  app-toolbar { margin-left: auto; flex-shrink: 0; }
1807
1864
  .filters {
@@ -2000,29 +2057,29 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2000
2057
  cursor: pointer;
2001
2058
  }
2002
2059
  .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
2003
- `}#e=an();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#r=new u(this.#e.activeTags??[]);#n=new u(this.#e.activeFolders??[]);#d=new u([]);#a=new u(sn);#i=new u(null);#l=new u(nn);#p=new u(!1);#h=new u("");#u=new u(!1);#o=new u(rn());#g=new u("");#y=new u(!1);#$=new u(this.#e.sort??"");#b=new u(this.#e.deprecatedFilter??"all");#m=new u(this.#e.pausedFilter??"all");#x=new u(this.#e.dateFrom??"");#v=new u(this.#e.dateTo??"");#f=new u(new Set);#w=new u(on());#_=new u(!1);#k=new u("entries");#R=new u([]);#P=new u([]);#C=new u(null);#A=new u(null);#E=new u(!1);#z=e=>this.#q(e);#L=()=>this.#U();constructor(){super(),new Y(this),kt(this.#w.value)}#I(e){this.#w.set(e),localStorage.setItem(Wt,e),kt(e)}#O(){const e=fe[(fe.indexOf(this.#w.value)+1)%fe.length];this.#I(e)}async#D(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#T(),this.#S(),this.#c()])}finally{this.#_.set(!1)}}}#N(e){e.preventDefault(),this.#y.set(!0),document.addEventListener("pointermove",this.#z),document.addEventListener("pointerup",this.#L)}#q(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Zt,Math.max(Vt,i)))}#U(){this.#y.set(!1),document.removeEventListener("pointermove",this.#z),document.removeEventListener("pointerup",this.#L),localStorage.setItem(Kt,String(this.#o.value))}#j=new Ye(()=>{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.#r.value)e.append("tag",t);for(const t of this.#n.value)e.append("folder",t);return this.#$.value&&e.set("sort",this.#$.value),this.#b.value==="hide"?e.set("deprecated","0"):this.#b.value==="only"&&e.set("deprecated","1"),this.#m.value==="hide"?e.set("paused","0"):this.#m.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#v.value&&e.set("date_to",this.#v.value),e.toString()});#B=new Ye(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#b.value==="hide"?e.set("deprecated","0"):this.#b.value==="only"&&e.set("deprecated","1"),this.#m.value==="hide"?e.set("paused","0"):this.#m.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#v.value&&e.set("date_to",this.#v.value),e.toString()});#F=()=>this.#X();#Z=e=>this.#de(e);#W=e=>this.#he(e);#Q=()=>this.#J();#G;connectedCallback(){super.connectedCallback(),this.#c(),this.#S(),this.#T().then(()=>this.#X()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#Z),document.addEventListener("folderfoo-folder-changed",this.#W),window.addEventListener("folderfoo-auth-change",this.#Q),this.#J(),en(),this.#G=Ht.subscribe(()=>this.#T())}async#de(e){const t=e.detail?.name;if(!t)return;const s=Xi(t);if(s.owner){this.#g.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await Z();if(!(i==="off"||!r))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,tenantId:oe,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#g.set(a.error??`couldn't open "${s.name}"`);return}this.#g.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#g.set(o.message)}}async#he(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:r}=await Z();if(!r)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,oldPath:t,newPath:i})})}catch{}}this.#T()}}#Y(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}async#pe(){const e=this.#Y();if(!e||e.querySelector("folderfoo-profile-circle")||e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await Z();t==="off"||!s||$t(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{await this.updateComplete;const i=document.createElement("folderfoo-profile-circle");i.setAttribute("app-name","Memory Bucket"),i.setAttribute("tenant-id",oe),i.style.zoom="0.875",this.#Y()?.appendChild(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#Z),document.removeEventListener("folderfoo-folder-changed",this.#W),window.removeEventListener("folderfoo-auth-change",this.#Q),this.#G?.()}async#J(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await Z();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#H=!1;async#X(){if(document.visibilityState==="visible"){if(this.#re().some(e=>e.remote)&&!this.#H){this.#H=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#H=!1}}this.#c(),this.#S(),this.#T(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#j.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#d.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#k.value==="folder-view"&&this.#ee()}async#ee(){const e=await fetch(`/api/entries?${this.#B.value}`);this.#R.set(await e.json())}async#S(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#T(){const t=await(await fetch("/api/folders")).json();this.#l.set(t),this.#u.set(!0);const s=new Set([...t.skill,...t.memory].map(r=>r.name)),i=this.#n.value.filter(r=>s.has(r));i.length!==this.#n.value.length&&(this.#n.set(i),this.#c())}#te(e){this.#k.set(e),e==="channels"?this.#se():e==="folder-view"&&this.#ee()}async#se(){const e=await fetch("/api/channels");this.#P.set(await e.json()),this.#C.value&&this.#ie(this.#C.value)}async#ie(e){this.#C.set(e),this.#E.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#A.set(t.ok?await t.json():null)}finally{this.#E.set(!1)}}#ue(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#fe(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#n.set(this.#n.value.filter(i=>i!==e.name)),await Promise.all([this.#T(),this.#S(),this.#c()])}finally{this.#h.set("")}}}#ne(){this.#p.set(!1),this.#T(),this.#S(),this.#c()}#re(){return[...this.#l.value.skill,...this.#l.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#oe(e){this.#s.set(e),this.#r.set([]),this.#S(),this.#c()}#ge(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#be(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#me(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#ae(e){this.#x.set(e),this.#v.set(e),this.#c()}#ve(e){this.#t.set(e.target.value),this.#c()}#K(e){this.#t.set(e),this.#c()}#xe(){this.#t.set(""),this.#c()}#ye(e){this.#i.set({table:e._table,id:e.id})}#ke(e){this.#$.set(e.target.value),this.#c()}#$e(e){this.#b.set(e.target.value),this.#c()}#we(e){this.#m.set(e.target.value),this.#c()}#_e(e){this.#x.set(e.target.value),this.#c()}#Se(e){this.#v.set(e.target.value),this.#c()}#Ce(){this.#x.set(""),this.#v.set(""),this.#c()}#Te(e){const t=new Set(this.#f.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#f.set(t)}#Ae(){return new Map(this.#d.value.map(e=>[e.id,e]))}#V(){const e=new Map,t=this.#Ae();for(const s of this.#f.value){const i=t.get(s);if(!i)continue;const r=e.get(i._table)??[];r.push(s),e.set(i._table,r)}return e}async#le(e){const t=this.#V();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#f.set(new Set),await this.#c()}async#ce(e){const t=this.#V();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#f.set(new Set),await this.#c()}async#Ee(){if(!window.confirm(`Delete ${this.#f.value.size} doc(s)? This can't be undone.`))return;const e=this.#V();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.#f.set(new Set),await this.#c()}#M(e){return c`
2060
+ `}#e=an();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#r=new u(this.#e.activeTags??[]);#n=new u(this.#e.activeFolders??[]);#d=new u([]);#a=new u(sn);#i=new u(null);#l=new u(nn);#p=new u(!1);#h=new u("");#u=new u(!1);#o=new u(rn());#g=new u("");#k=new u(!1);#$=new u(this.#e.sort??"");#m=new u(this.#e.deprecatedFilter??"all");#v=new u(this.#e.pausedFilter??"all");#y=new u(this.#e.dateFrom??"");#b=new u(this.#e.dateTo??"");#f=new u(new Set);#w=new u(on());#_=new u(!1);#x=new u("entries");#R=new u([]);#P=new u([]);#C=new u(null);#T=new u(null);#E=new u(!1);#z=e=>this.#q(e);#L=()=>this.#U();constructor(){super(),new Y(this),kt(this.#w.value)}#I(e){this.#w.set(e),localStorage.setItem(Zt,e),kt(e)}#O(){const e=fe[(fe.indexOf(this.#w.value)+1)%fe.length];this.#I(e)}async#D(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#A(),this.#S(),this.#c()])}finally{this.#_.set(!1)}}}#N(e){e.preventDefault(),this.#k.set(!0),document.addEventListener("pointermove",this.#z),document.addEventListener("pointerup",this.#L)}#q(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Wt,Math.max(Vt,i)))}#U(){this.#k.set(!1),document.removeEventListener("pointermove",this.#z),document.removeEventListener("pointerup",this.#L),localStorage.setItem(Kt,String(this.#o.value))}#j=new Ye(()=>{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.#r.value)e.append("tag",t);for(const t of this.#n.value)e.append("folder",t);return this.#$.value&&e.set("sort",this.#$.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#v.value==="hide"?e.set("paused","0"):this.#v.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#b.value&&e.set("date_to",this.#b.value),e.toString()});#B=new Ye(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#v.value==="hide"?e.set("paused","0"):this.#v.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#b.value&&e.set("date_to",this.#b.value),e.toString()});#F=()=>this.#X();#W=e=>this.#de(e);#Z=e=>this.#he(e);#Q=()=>this.#J();#G;connectedCallback(){super.connectedCallback(),this.#c(),this.#S(),this.#A().then(()=>this.#X()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#W),document.addEventListener("folderfoo-folder-changed",this.#Z),window.addEventListener("folderfoo-auth-change",this.#Q),this.#J(),en(),this.#G=Ht.subscribe(()=>this.#A())}async#de(e){const t=e.detail?.name;if(!t)return;const s=Xi(t);if(s.owner){this.#g.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await W();if(!(i==="off"||!r))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,tenantId:oe,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#g.set(a.error??`couldn't open "${s.name}"`);return}this.#g.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#g.set(o.message)}}async#he(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:r}=await W();if(!r)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,oldPath:t,newPath:i})})}catch{}}this.#A()}}#Y(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}async#pe(){const e=this.#Y();if(!e||e.querySelector("folderfoo-profile-circle")||e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await W();t==="off"||!s||$t(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{await this.updateComplete;const i=document.createElement("folderfoo-profile-circle");i.setAttribute("app-name","Memory Bucket"),i.setAttribute("tenant-id",oe),i.style.zoom="0.875",this.#Y()?.appendChild(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#W),document.removeEventListener("folderfoo-folder-changed",this.#Z),window.removeEventListener("folderfoo-auth-change",this.#Q),this.#G?.()}async#J(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await W();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#H=!1;async#X(){if(document.visibilityState==="visible"){if(this.#re().some(e=>e.remote)&&!this.#H){this.#H=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#H=!1}}this.#c(),this.#S(),this.#A(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#j.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#d.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#x.value==="folder-view"&&this.#ee()}async#ee(){const e=await fetch(`/api/entries?${this.#B.value}`);this.#R.set(await e.json())}async#S(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#A(){const t=await(await fetch("/api/folders")).json();this.#l.set(t),this.#u.set(!0);const s=new Set([...t.skill,...t.memory].map(r=>r.name)),i=this.#n.value.filter(r=>s.has(r));i.length!==this.#n.value.length&&(this.#n.set(i),this.#c())}#te(e){this.#x.set(e),e==="channels"?this.#se():e==="folder-view"&&this.#ee()}async#se(){const e=await fetch("/api/channels");this.#P.set(await e.json()),this.#C.value&&this.#ie(this.#C.value)}async#ie(e){this.#C.set(e),this.#E.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#T.set(t.ok?await t.json():null)}finally{this.#E.set(!1)}}#ue(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#fe(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#n.set(this.#n.value.filter(i=>i!==e.name)),await Promise.all([this.#A(),this.#S(),this.#c()])}finally{this.#h.set("")}}}#ne(){this.#p.set(!1),this.#A(),this.#S(),this.#c()}#re(){return[...this.#l.value.skill,...this.#l.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#oe(e){this.#s.set(e),this.#r.set([]),this.#S(),this.#c()}#ge(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#be(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#me(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#ae(e){this.#y.set(e),this.#b.set(e),this.#c()}#ve(e){this.#t.set(e.target.value),this.#c()}#K(e){this.#t.set(e),this.#c()}#xe(){this.#t.set(""),this.#c()}#ye(e){this.#i.set({table:e._table,id:e.id})}#ke(e){this.#$.set(e.target.value),this.#c()}#$e(e){this.#m.set(e.target.value),this.#c()}#we(e){this.#v.set(e.target.value),this.#c()}#_e(e){this.#y.set(e.target.value),this.#c()}#Se(e){this.#b.set(e.target.value),this.#c()}#Ce(){this.#y.set(""),this.#b.set(""),this.#c()}#Ae(e){const t=new Set(this.#f.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#f.set(t)}#Te(){return new Map(this.#d.value.map(e=>[e.id,e]))}#V(){const e=new Map,t=this.#Te();for(const s of this.#f.value){const i=t.get(s);if(!i)continue;const r=e.get(i._table)??[];r.push(s),e.set(i._table,r)}return e}async#le(e){const t=this.#V();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#f.set(new Set),await this.#c()}async#ce(e){const t=this.#V();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#f.set(new Set),await this.#c()}async#Ee(){if(!window.confirm(`Delete ${this.#f.value.size} doc(s)? This can't be undone.`))return;const e=this.#V();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.#f.set(new Set),await this.#c()}#M(e){return l`
2004
2061
  <app-toolbar
2005
2062
  .showReindex=${e}
2006
2063
  .reindexing=${this.#_.value}
2007
- .channelsActive=${this.#k.value==="channels"}
2008
- .folderViewActive=${this.#k.value==="folder-view"}
2064
+ .channelsActive=${this.#x.value==="channels"}
2065
+ .folderViewActive=${this.#x.value==="folder-view"}
2009
2066
  .theme=${this.#w.value}
2010
2067
  .onReindex=${()=>this.#D()}
2011
- .onToggleChannels=${()=>this.#te(this.#k.value==="channels"?"entries":"channels")}
2012
- .onToggleFolderView=${()=>this.#te(this.#k.value==="folder-view"?"entries":"folder-view")}
2068
+ .onToggleChannels=${()=>this.#te(this.#x.value==="channels"?"entries":"channels")}
2069
+ .onToggleFolderView=${()=>this.#te(this.#x.value==="folder-view"?"entries":"folder-view")}
2013
2070
  .onCycleTheme=${()=>this.#O()}
2014
2071
  ></app-toolbar>
2015
- `}updated(){this.#pe()}render(){const e=this.#a.value,t=this.#re();return this.#k.value==="channels"?c`
2072
+ `}updated(){this.#pe()}render(){const e=this.#a.value,t=this.#re();return this.#x.value==="channels"?l`
2016
2073
  <div class="toolbar-bar">${this.#M(!1)}</div>
2017
2074
  <channel-view
2018
2075
  .channels=${this.#P.value}
2019
2076
  .selected=${this.#C.value}
2020
- .detail=${this.#A.value}
2077
+ .detail=${this.#T.value}
2021
2078
  .loading=${this.#E.value}
2022
2079
  .onSelect=${s=>this.#ie(s)}
2023
2080
  .onRefresh=${()=>this.#se()}
2024
2081
  ></channel-view>
2025
- `:this.#k.value==="folder-view"?c`
2082
+ `:this.#x.value==="folder-view"?l`
2026
2083
  <folder-view
2027
2084
  .entries=${this.#R.value}
2028
2085
  .allFolders=${t}
@@ -2035,7 +2092,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2035
2092
  >
2036
2093
  <div slot="toolbar">${this.#M(!0)}</div>
2037
2094
  </folder-view>
2038
- `:this.#u.value&&t.length===0&&!this.#p.value?c`
2095
+ `:this.#u.value&&t.length===0&&!this.#p.value?l`
2039
2096
  <div class="toolbar-bar">${this.#M(!1)}</div>
2040
2097
  <div class="first-run">
2041
2098
  <h1>No folders configured yet</h1>
@@ -2045,23 +2102,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2045
2102
  </p>
2046
2103
  <button class="add-folder-btn" @click=${()=>this.#p.set(!0)}>+ Add your first folder</button>
2047
2104
  </div>
2048
- ${this.#p.value?c`<add-folder-modal
2105
+ ${this.#p.value?l`<add-folder-modal
2049
2106
  .defaultKind=${"skill"}
2050
2107
  .lockKind=${!1}
2051
2108
  .onAdded=${()=>this.#ne()}
2052
2109
  .onCancel=${()=>this.#p.set(!1)}
2053
2110
  ></add-folder-modal>`:""}
2054
- `:c`
2111
+ `:l`
2055
2112
  <div class="folders-bar">
2056
2113
  <span class="filter-label">Folders:</span>
2057
2114
  <div class="folder-chips">
2058
- ${t.map(s=>c`
2115
+ ${t.map(s=>l`
2059
2116
  <button
2060
2117
  class="folder-chip ${s.remote?"remote":""} ${this.#n.value.includes(s.name)?"active":""}"
2061
2118
  title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
2062
2119
  @click=${()=>this.#ue(s.name)}
2063
2120
  >
2064
- ${s.remote?c`<span class="remote-dot"></span>`:"📁"} ${s.name}
2121
+ ${s.remote?l`<span class="remote-dot"></span>`:"📁"} ${s.name}
2065
2122
  <span class="kind">(${s.kind==="skill"?"s":"m"})</span>
2066
2123
  <span
2067
2124
  class="remove"
@@ -2075,7 +2132,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2075
2132
  </div>
2076
2133
  ${this.#M(!0)}
2077
2134
  </div>
2078
- ${this.#g.value?c`
2135
+ ${this.#g.value?l`
2079
2136
  <div class="folderfoo-open-banner">
2080
2137
  ${this.#g.value}
2081
2138
  <button class="dismiss" @click=${()=>this.#g.set("")}>✕</button>
@@ -2090,7 +2147,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2090
2147
  .value=${this.#t.value}
2091
2148
  @input=${s=>this.#ve(s)}
2092
2149
  />
2093
- ${this.#t.value?c`
2150
+ ${this.#t.value?l`
2094
2151
  <button
2095
2152
  class="search-clear-btn"
2096
2153
  title="Clear search"
@@ -2102,7 +2159,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2102
2159
  `:""}
2103
2160
  </div>
2104
2161
  <div class="row type-toggle">
2105
- ${tn.map(s=>c`
2162
+ ${tn.map(s=>l`
2106
2163
  <button
2107
2164
  class=${this.#s.value===s.value?"active":""}
2108
2165
  @click=${()=>this.#oe(s.value)}
@@ -2111,7 +2168,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2111
2168
  </button>
2112
2169
  `)}
2113
2170
  </div>
2114
- ${e.tags.length===0?c`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:c`
2171
+ ${e.tags.length===0?l`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:l`
2115
2172
  <tag-multiselect
2116
2173
  .tags=${e.tags}
2117
2174
  .active=${this.#r.value}
@@ -2124,17 +2181,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2124
2181
  <input
2125
2182
  type="date"
2126
2183
  aria-label="From date"
2127
- .value=${this.#x.value}
2184
+ .value=${this.#y.value}
2128
2185
  @change=${s=>this.#_e(s)}
2129
2186
  />
2130
2187
  <span class="date-range-sep">–</span>
2131
2188
  <input
2132
2189
  type="date"
2133
2190
  aria-label="To date"
2134
- .value=${this.#v.value}
2191
+ .value=${this.#b.value}
2135
2192
  @change=${s=>this.#Se(s)}
2136
2193
  />
2137
- ${this.#x.value||this.#v.value?c`
2194
+ ${this.#y.value||this.#b.value?l`
2138
2195
  <button
2139
2196
  class="date-range-clear"
2140
2197
  title="Clear date range"
@@ -2150,23 +2207,23 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2150
2207
  .value=${this.#$.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
2151
2208
  @change=${s=>this.#ke(s)}
2152
2209
  >
2153
- ${this.#t.value.trim()?c`<option value="relevance">Relevance</option>`:""}
2210
+ ${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
2154
2211
  <option value="mtime_desc">Recently touched</option>
2155
2212
  <option value="mtime_asc">Least recently touched</option>
2156
2213
  <option value="created_at_asc">Oldest first</option>
2157
2214
  <option value="name_asc">Name</option>
2158
2215
  </select>
2159
2216
  <span class="filter-label">Deprecated:</span>
2160
- <select .value=${this.#b.value} @change=${s=>this.#$e(s)}>
2161
- ${yt.map(s=>c`<option value=${s.value}>${s.label}</option>`)}
2217
+ <select .value=${this.#m.value} @change=${s=>this.#$e(s)}>
2218
+ ${yt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2162
2219
  </select>
2163
2220
  <span class="filter-label">Paused:</span>
2164
- <select .value=${this.#m.value} @change=${s=>this.#we(s)}>
2165
- ${yt.map(s=>c`<option value=${s.value}>${s.label}</option>`)}
2221
+ <select .value=${this.#v.value} @change=${s=>this.#we(s)}>
2222
+ ${yt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
2166
2223
  </select>
2167
2224
  </div>
2168
2225
  </div>
2169
- ${this.#f.value.size>0?c`
2226
+ ${this.#f.value.size>0?l`
2170
2227
  <div class="bulk-bar">
2171
2228
  <span>${this.#f.value.size} selected</span>
2172
2229
  <button @click=${()=>this.#le(!0)}>Mark deprecated</button>
@@ -2184,11 +2241,11 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2184
2241
  .showFolder=${t.length>1}
2185
2242
  .onSelect=${s=>this.#ye(s)}
2186
2243
  .selectedIds=${this.#f.value}
2187
- .onToggleSelect=${s=>this.#Te(s)}
2244
+ .onToggleSelect=${s=>this.#Ae(s)}
2188
2245
  .onKeyClick=${s=>this.#K(s)}
2189
2246
  ></result-list>
2190
2247
  <div
2191
- class="splitter ${this.#y.value?"dragging":""}"
2248
+ class="splitter ${this.#k.value?"dragging":""}"
2192
2249
  @pointerdown=${s=>this.#N(s)}
2193
2250
  ></div>
2194
2251
  <detail-panel
@@ -2201,7 +2258,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
2201
2258
  .onKeyClick=${s=>this.#K(s)}
2202
2259
  ></detail-panel>
2203
2260
  </div>
2204
- ${this.#p.value?c`<add-folder-modal
2261
+ ${this.#p.value?l`<add-folder-modal
2205
2262
  .defaultKind=${"skill"}
2206
2263
  .lockKind=${!1}
2207
2264
  .onAdded=${()=>this.#ne()}