mcp-memory-bucket 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,925 +0,0 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(r){if(r.ep)return;r.ep=!0;const n=t(r);fetch(r.href,n)}})();/**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const X=globalThis,xe=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,me=Symbol(),Ie=new WeakMap;let it=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==me)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(xe&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ie.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ie.set(t,e))}return e}toString(){return this.cssText}};const Tt=i=>new it(typeof i=="string"?i:i+"",void 0,me),W=(i,...e)=>{const t=i.length===1?i[0]:e.reduce((s,r,n)=>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.")})(r)+i[n+1],i[0]);return new it(t,i,me)},Rt=(i,e)=>{if(xe)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),r=X.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=t.cssText,i.appendChild(s)}},Me=xe?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Tt(t)})(i):i;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Et,defineProperty:Ct,getOwnPropertyDescriptor:zt,getOwnPropertyNames:Pt,getOwnPropertySymbols:Lt,getPrototypeOf:It}=Object,re=globalThis,Oe=re.trustedTypes,Mt=Oe?Oe.emptyScript:"",Ot=re.reactiveElementPolyfillSupport,Z=(i,e)=>i,pe={toAttribute(i,e){switch(e){case Boolean:i=i?Mt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},rt=(i,e)=>!Et(i,e),De={attribute:!0,type:String,converter:pe,reflect:!1,useDefault:!1,hasChanged:rt};Symbol.metadata??=Symbol("metadata"),re.litPropertyMetadata??=new WeakMap;let D=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=De){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);r!==void 0&&Ct(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{get:r,set:n}=zt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??De}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=It(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,s=[...Pt(t),...Lt(t)];for(const r of s)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,r]of t)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const r=this._$Eu(t,s);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const r of s)t.unshift(Me(r))}else e!==void 0&&t.push(Me(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Rt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:pe).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=s.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:pe;this._$Em=r;const a=o.fromAttribute(t,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,s,r=!1,n){if(e!==void 0){const o=this.constructor;if(r===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??rt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:r,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,n]of s){const{wrapped:o}=n,a=this[r];o!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[Z("elementProperties")]=new Map,D[Z("finalized")]=new Map,Ot?.({ReactiveElement:D}),(re.reactiveElementVersions??=[]).push("2.1.2");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const ke=globalThis,Ne=i=>i,ee=ke.trustedTypes,qe=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,nt="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+R,Dt=`<${ot}>`,P=document,Q=()=>P.createComment(""),K=i=>i===null||typeof i!="object"&&typeof i!="function",$e=Array.isArray,Nt=i=>$e(i)||typeof i?.[Symbol.iterator]=="function",le=`[
14
- \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ue=/-->/g,He=/>/g,E=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Be=/'/g,je=/"/g,at=/^(?:script|style|textarea|title)$/i,qt=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),d=qt(1),L=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Fe=new WeakMap,z=P.createTreeWalker(P,129);function lt(i,e){if(!$e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return qe!==void 0?qe.createHTML(e):e}const Ut=(i,e)=>{const t=i.length-1,s=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=i[a];let c,p,h=-1,g=0;for(;g<l.length&&(o.lastIndex=g,p=o.exec(l),p!==null);)g=o.lastIndex,o===B?p[1]==="!--"?o=Ue:p[1]!==void 0?o=He:p[2]!==void 0?(at.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=r??B,h=-1):p[1]===void 0?h=-2:(h=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?je:Be):o===je||o===Be?o=E:o===Ue||o===He?o=B:(o=E,r=void 0);const m=o===E&&i[a+1].startsWith("/>")?" ":"";n+=o===B?l+Dt:h>=0?(s.push(c),l.slice(0,h)+nt+l.slice(h)+R+m):l+R+(h===-2?a:m)}return[lt(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ue=class ct{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Ut(e,t);if(this.el=ct.createElement(c,s),z.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=z.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(nt)){const g=p[o++],m=r.getAttribute(h).split(R),b=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:b[2],strings:m,ctor:b[1]==="."?Bt:b[1]==="?"?jt:b[1]==="@"?Ft:ne}),r.removeAttribute(h)}else h.startsWith(R)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(at.test(r.tagName)){const h=r.textContent.split(R),g=h.length-1;if(g>0){r.textContent=ee?ee.emptyScript:"";for(let m=0;m<g;m++)r.append(h[m],Q()),z.nextNode(),l.push({type:2,index:++n});r.append(h[g],Q())}}}else if(r.nodeType===8)if(r.data===ot)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(R,h+1))!==-1;)l.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=P.createElement("template");return s.innerHTML=e,s}};function N(i,e,t=i,s){if(e===L)return e;let r=s!==void 0?t._$Co?.[s]:t._$Cl;const n=K(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,t,s)),s!==void 0?(t._$Co??=[])[s]=r:t._$Cl=r),r!==void 0&&(e=N(i,r._$AS(i,e.values),r,s)),e}let Ht=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,r=(e?.creationScope??P).importNode(t,!0);z.currentNode=r;let n=z.nextNode(),o=0,a=0,l=s[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new V(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Zt(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=z.nextNode(),o++)}return z.currentNode=P,r}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class V{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,r){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=N(this,e,t),K(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==L&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&K(this._$AH)?this._$AA.nextSibling.data=e:this.T(P.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=ue.createElement(lt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new Ht(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new ue(e)),t}k(e){$e(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const n of e)r===t.length?t.push(s=new V(this.O(Q()),this.O(Q()),this,this.options)):s=t[r],s._$AI(n),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ne(e).nextSibling;Ne(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,r,n){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=k}_$AI(e,t=this,s,r){const n=this.strings;let o=!1;if(n===void 0)e=N(this,e,t,0),o=!K(e)||e!==this._$AH&&e!==L,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=N(this,a[s+l],t,l),c===L&&(c=this._$AH[l]),o||=!K(c)||c!==this._$AH[l],c===k?e=k:e!==k&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!r&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Bt=class extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},jt=class extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ft=class extends ne{constructor(e,t,s,r,n){super(e,t,s,r,n),this.type=5}_$AI(e,t=this){if((e=N(this,e,t,0)??k)===L)return;const s=this._$AH,r=e===k&&s!==k||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==k&&(s===k||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Zt=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){N(this,e)}};const Qt=ke.litHtmlPolyfillSupport;Qt?.(ue,V),(ke.litHtmlVersions??=[]).push("3.3.3");const Kt=(i,e,t)=>{const s=t?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const n=t?.renderBefore??null;s._$litPart$=r=new V(e.insertBefore(Q(),n),n,void 0,t??{})}return r._$AI(i),r};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */const ve=globalThis;let S=class extends D{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Kt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};S._$litElement$=!0,S.finalized=!0,ve.litElementHydrateSupport?.({LitElement:S});const Wt=ve.litElementPolyfillSupport;Wt?.({LitElement:S});(ve.litElementVersions??=[]).push("4.2.2");var ht;let ce=0;const Ze=new Set;function Vt(i){ce++;try{i()}finally{ce--,ce===0&&Gt()}}function Gt(){const i=new Set(Ze);Ze.clear();for(const e of i)e()}function Jt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Yt(i){return i&&typeof i.deref=="function"}class ye{static#e=0;#t;#s;#i=new Set;#r=ht.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return u.activeConsumer&&u.activeConsumer.track(this),this.#t}_set(e){return Jt(e,this.#t)?(this.#s=this.#t,this.#t=e,this._notify(),!0):!1}subscribe(e,t=!1){let s=e;return t&&(s=new WeakRef(e)),this.#i.add(s),()=>this.#i.delete(s)}_notify(){const e=[...this.#i];for(const t of e){let s;if(Yt(t)){if(s=t.deref(),!s){this.#i.delete(t);continue}}else s=t;s()}}get id(){return this.#r}get previousValue(){return this.#s}toString(){return this.name?`${this.constructor.name}(${this.name})`:`${this.constructor.name}#${this.id}`}}ht=ye;class u extends ye{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){Vt(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xt extends ye{#e;#t=!0;#s=!1;#i=new Map;_debugParent;#r;#a=()=>{this.#t||(this.#t=!0,this._notify())};constructor(e,t,s){super(void 0,t),this.#e=e,this.#r=s?.weak??!0}track(e){if(this.#i.has(e))return;const t=e.subscribe(this.#a,this.#r);this.#i.set(e,t)}dispose(){this.#o()}#o(){for(const e of this.#i.values())e();this.#i.clear()}get(){if(u.activeConsumer&&u.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
20
- ↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#o(),u.push(this);try{const e=this.#e();this._set(e)}finally{u.pop(),this.#t=!1,this.#s=!1}return this._get()}get value(){return this.get()}set value(e){throw new Error(`Cannot set value of Computed ${this}. Computed values are read-only.`)}subscribe(e,t=!1){const s=super.subscribe(e,t);return u.activeConsumer||this.get(),s}}class we{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,r=this;t.update=function(n){u.push(r);try{s.call(this,n)}finally{u.pop()}}}track(e){this.#t.has(e)||this.#t.set(e,e.subscribe(this.#s,!0))}#s=()=>{this.#e.requestUpdate()};hostUpdate(){for(const e of this.#t.values())e();this.#t.clear()}hostDisconnected(){for(const e of this.#t.values())e();this.#t.clear()}toString(){const e=this.#e;return`SignalWatcher(${e?.localName??e?.tagName??e?.constructor?.name??"unknown"})`}}function es(i){if(!i)return"unknown age";const e=new Date(i);return Number.isNaN(e.getTime())?"unknown age":e.toISOString().slice(0,10)}class ts extends S{static{this.properties={results:{attribute:!1},showRoot:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1}}}static{this.styles=W`
21
- :host { display: block; }
22
- .count-header {
23
- padding: 8px 14px;
24
- font-size: 11px;
25
- font-weight: 600;
26
- text-transform: uppercase;
27
- opacity: 0.6;
28
- background: var(--bg);
29
- border-bottom: 1px solid var(--border);
30
- }
31
- .row { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 8px; }
32
- .row:hover { background: var(--hover); }
33
- .row.deprecated { opacity: 0.55; }
34
- .row.paused { opacity: 0.6; }
35
- .row-checkbox { flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
36
- .row-body { flex: 1 1 auto; min-width: 0; }
37
- .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
38
- .name { font-weight: 600; }
39
- .deprecated .name { text-decoration: line-through; }
40
- .meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
41
- .desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
42
- .tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
43
- .tag { font-size: 10px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px; }
44
- .type-badge { font-size: 10px; text-transform: uppercase; opacity: 0.6; }
45
- .root-badge {
46
- font-size: 10px; text-transform: uppercase; opacity: 0.9; border: 1px solid var(--purple);
47
- color: var(--purple-fg); background: var(--purple-tint); border-radius: 4px; padding: 0 4px;
48
- }
49
- .deprecated-badge {
50
- font-size: 10px; text-transform: uppercase; border: 1px solid var(--danger);
51
- color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-radius: 4px; padding: 0 4px;
52
- }
53
- .paused-badge {
54
- font-size: 10px; text-transform: uppercase; border: 1px solid var(--accent);
55
- color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
56
- }
57
- .empty { padding: 24px; opacity: 0.6; font-size: 13px; }
58
- `}render(){return!this.results||this.results.length===0?d`<div class="empty">No results.</div>`:d`
59
- <div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
60
- ${this.results.map(e=>{const t=e._table==="skills"&&e.root==="builtin";return d`
61
- <div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
62
- <input
63
- type="checkbox"
64
- class="row-checkbox"
65
- .checked=${this.selectedIds?.has(e.id)??!1}
66
- .disabled=${t}
67
- title=${t?"Builtin skills can't be bulk-deprecated, paused, or deleted":""}
68
- @click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
69
- />
70
- <div class="row-body">
71
- <div class="top">
72
- <span class="name">${e.name}</span>
73
- <span class="meta">${es(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
74
- </div>
75
- <div class="desc">${e.description}</div>
76
- <div class="tags">
77
- <span class="type-badge">${e._table==="skills"?"skill":"memory"}</span>
78
- ${this.showRoot&&e.root?d`<span class="root-badge">${e.root}</span>`:""}
79
- ${e.deprecated?d`<span class="deprecated-badge">deprecated</span>`:""}
80
- ${e.paused?d`<span class="paused-badge">paused</span>`:""}
81
- ${e.tags.map(s=>d`<span class="tag">${s}</span>`)}
82
- </div>
83
- </div>
84
- </div>
85
- `})}
86
- `}}customElements.define("result-list",ts);function _e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var M=_e();function pt(i){M=i}var C={exec:()=>null};function O(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function f(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace($.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var ss=((i="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+i)}catch{return!1}})(),$={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:O(i=>new RegExp(`^ {0,${i}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:O(i=>new RegExp(`^ {0,${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:O(i=>new RegExp(`^ {0,${i}}(?:\`\`\`|~~~)`)),headingBeginRegex:O(i=>new RegExp(`^ {0,${i}}#`)),htmlBeginRegex:O(i=>new RegExp(`^ {0,${i}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:O(i=>new RegExp(`^ {0,${i}}>`))},is=/^(?:[ \t]*(?:\n|$))+/,rs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ns=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,G=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ut=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dt=f(ut).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),as=f(ut).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ae=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ls=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cs=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hs=f(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),oe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ps=f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Re).replace("tag",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gt=i=>f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",i).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),us=gt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ds=gt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),gs=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ds).getRegex(),Ee={blockquote:gs,code:rs,def:cs,fences:ns,heading:os,hr:G,html:ps,lheading:dt,list:hs,newline:is,paragraph:us,table:C,text:ls},Qe=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),fs={...Ee,lheading:as,table:Qe,paragraph:f(Ae).replace("hr",G).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex()},bs={...Ee,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Re).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:C,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(Ae).replace("hr",G).replace("heading",` *#{1,6} *[^
87
- ]`).replace("lheading",dt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ms=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ft=/^( {2,}|\\)\n(?!\s*$)/,ks=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,$s=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),vs=/[\p{Pi}\p{Ps}"']/u,bt=/(?!~)[\p{P}\p{S}]/u,ys=/(?!~)[\s\p{P}\p{S}]/u,ws=/(?:[^\s\p{P}\p{S}]|~)/u,_s=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ss?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ss=f(xt,"u").replace(/punct/g,A).getRegex(),As=f(xt,"u").replace(/punct/g,bt).getRegex(),Ts=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Rs=f(Ts,"u").replace(/openQuote/g,vs).replace(/punct/g,A).getRegex(),mt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Es=f(mt,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Cs=f(mt,"gu").replace(/notPunctSpace/g,ws).replace(/punctSpace/g,ys).replace(/punct/g,bt).getRegex(),zs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Ps=f(zs,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Ls=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Is="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ms=f(Is,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),Os=f(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ds="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ns=f(Ds,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,q).replace(/punct/g,A).getRegex(),qs=f(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Us=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Hs=f(Re).replace("(?:-->|$)","-->").getRegex(),Bs=f("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Hs).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,js=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kt=f(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),$t=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Fs=f("reflink|nolink(?!\\()","g").replace("reflink",kt).replace("nolink",$t).getRegex(),Ke=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ce={_backpedal:C,anyPunctuation:qs,autolink:Us,blockSkip:_s,br:ft,code:ms,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:Ss,emStrongRDelimAst:Es,emStrongRDelimUnd:Ls,escape:xs,link:js,nolink:$t,punctuation:$s,reflink:kt,reflinkSearch:Fs,tag:Bs,text:ks,url:C},Zs={...Ce,emStrongLDelim:Rs,emStrongRDelimAst:Ps,emStrongRDelimUnd:Ms,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Ce,emStrongRDelimAst:Cs,emStrongLDelim:As,delLDelim:Os,delRDelim:Ns,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ke).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:f(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ke).getRegex()},Qs={...de,br:f(ft).replace("{2,}","*").getRegex(),text:f(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Y={normal:Ee,gfm:fs,pedantic:bs},j={normal:Ce,gfm:de,breaks:Qs,pedantic:Zs},Ks={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},We=i=>Ks[i];function _(i,e){if(e){if($.escapeTest.test(i))return i.replace($.escapeReplace,We)}else if($.escapeTestNoEncode.test(i))return i.replace($.escapeReplaceNoEncode,We);return i}function Ve(i){try{i=encodeURI(i).replace($.percentDecode,"%")}catch{return null}return i}function Ge(i,e){let t=i.replace($.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split($.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace($.slashPipe,"|");return s}function T(i,e,t){let s=i.length;if(s===0)return"";let r=0;for(;r<s&&i.charAt(s-r-1)===e;)r++;return i.slice(0,s-r)}function Je(i){let e=i.split(`
88
- `),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(`
89
- `)}function Ws(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Vs(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function Ye(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Gs(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
90
- `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(`
91
- `)}var se=class{options;rules;lexer;constructor(i){this.options=i||M}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=this.options.pedantic?e[0]:Je(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],s=Gs(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=T(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:T(e[0],`
92
- `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:T(e[0],`
93
- `)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=T(e[0],`
94
- `).split(`
95
- `),s="",r="",n=[];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 c=a.join(`
96
- `),p=c.replace(this.rules.other.blockquoteSetextReplace,`
97
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
98
- ${c}`:c,r=r?`${r}
99
- ${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=h,t.length===0)break;let g=n.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let m=g,b=t.join(`
100
- `),w=m.raw+`
101
- `+b.replace(this.rules.other.blockquoteSetextReplace2,""),U=this.blockquote(w);n[n.length-1]=U,s=`${s}
102
- ${b}`,r=r.substring(0,r.length-m.text.length)+U.text;break}else if(g?.type==="list"){let m=g,b=m.raw+`
103
- `+t.join(`
104
- `),w=this.list(b);n[n.length-1]=w,s=s.substring(0,s.length-g.raw.length)+w.raw,r=r.substring(0,r.length-m.raw.length)+w.raw,t=b.substring(n.at(-1).raw.length).split(`
105
- `);continue}}return{type:"blockquote",raw:s,tokens:n,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;i;){let l=!1,c="",p="";if(!(e=n.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let h=Vs(e[2].split(`
106
- `,1)[0],e[1].length),g=i.split(`
107
- `,1)[0],m=!h.trim(),b=0;if(this.options.pedantic?(b=2,p=h.trimStart()):m?b=e[1].length+1:(b=h.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=h.slice(b),b+=e[1].length),m&&this.rules.other.blankLine.test(g)&&(c+=g+`
108
- `,i=i.substring(g.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),U=this.rules.other.hrRegex(b),Pe=this.rules.other.fencesBeginRegex(b),Le=this.rules.other.headingBeginRegex(b),St=this.rules.other.htmlBeginRegex(b),At=this.rules.other.blockquoteBeginRegex(b);for(;i;){let ae=i.split(`
109
- `,1)[0],H;if(g=ae,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),H=g):H=g.replace(this.rules.other.tabCharGlobal," "),Pe.test(g)||Le.test(g)||St.test(g)||At.test(g)||w.test(g)||U.test(g))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
110
- `+H.slice(b);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Pe.test(h)||Le.test(h)||U.test(h))break;p+=`
111
- `+g}m=!g.trim(),c+=ae+`
112
- `,i=i.substring(ae.length+1),h=H.slice(b)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!r.loose){let c=l.tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));r.loose=p}for(let l of r.items){let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=h.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=h.raw+l.tokens[0].raw,l.tokens[0].text=h.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(h)):l.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):l.tokens.unshift(h)}}else l.task&&(l.task=!1)}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(i){let e=this.rules.block.html.exec(i);if(e){let t=Je(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
113
- `),href:s,title:r}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ge(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
114
- `):[],n={type:"table",raw:T(e[0],`
115
- `),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of r)n.rows.push(Ge(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
116
- `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
117
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=T(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=Ws(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],r=n[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),Ye(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return Ye(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=0,c=s[0][0],p=t===c,h=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(r%3&&!((r+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let g=[...s[0]][0].length,m=i.slice(0,r+s.index+g+o);if(Math.min(r,o)%2){let w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}let b=m.slice(2,-2);return{type:"strong",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let s=this.rules.inline.delLDelim.exec(i);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,n,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*i.length+r);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=i.slice(0,r+s.index+c+o),h=p.slice(r,-r);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class ge{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||M,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:$,block:Y.normal,inline:j.normal};this.options.pedantic?(t.block=Y.pedantic,t.inline=j.pedantic):this.options.gfm&&(t.block=Y.gfm,this.options.breaks?t.inline=j.breaks:t.inline=j.gfm),this.tokenizer.rules=t}static get rules(){return{block:Y,inline:j}}static lex(e,t){return new ge(t).lex(e)}static lexInline(e,t){return new ge(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
118
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
119
- `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
120
- `)?"":`
121
- `)+n.raw,a.text+=`
122
- `+n.text,this.inlineQueue.at(-1).src=a.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
123
- `)?"":`
124
- `)+n.raw,a.text+=`
125
- `+n.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),c;this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
126
- `)?"":`
127
- `)+n.raw,a.text+=`
128
- `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n),s=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
129
- `)?"":`
130
- `)+n.raw,a.text+=`
131
- `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(n);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}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(n=""),r=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.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 c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,n)){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,n)){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 c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(n=a.raw.slice(-1)),r=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.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)}},ie=class{options;parser;constructor(i){this.options=i||M}space(i){return""}code({text:i,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],r=i.replace($.endingNewline,"")+`
132
- `;return s?'<pre><code class="language-'+_(s)+'">'+(t?r:_(r,!0))+`</code></pre>
133
- `:"<pre><code>"+(t?r:_(r,!0))+`</code></pre>
134
- `}blockquote({tokens:i}){return`<blockquote>
135
- ${this.parser.parse(i)}</blockquote>
136
- `}html({text:i}){return i}def(i){return""}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
137
- `}hr(i){return`<hr>
138
- `}list(i){let e=i.ordered,t=i.start,s="";for(let o=0;o<i.items.length;o++){let a=i.items[o];s+=this.listitem(a)}let r=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+r+n+`>
139
- `+s+"</"+r+`>
140
- `}listitem(i){return`<li>${this.parser.parse(i.tokens)}</li>
141
- `}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
142
- `}table(i){let e="",t="";for(let r=0;r<i.header.length;r++)t+=this.tablecell(i.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<i.rows.length;r++){let n=i.rows[r];t="";for(let o=0;o<n.length;o++)t+=this.tablecell(n[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
143
- <thead>
144
- `+e+`</thead>
145
- `+s+`</table>
146
- `}tablerow({text:i}){return`<tr>
147
- ${i}</tr>
148
- `}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
149
- `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${_(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Ve(i);if(r===null)return s;i=r;let n='<a href="'+i+'"';return e&&(n+=' title="'+_(e)+'"'),n+=">"+s+"</a>",n}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Ve(i);if(r===null)return _(t);i=r;let n=`<img src="${i}" alt="${_(t)}"`;return e&&(n+=` title="${_(e)}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:_(i.text)}},ze=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class fe{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ze}static parse(e,t){return new fe(t).parse(e)}static parseInline(e,t){return new fe(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let o=r,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=r;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let n=e[r];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},F=class{options;block;constructor(i){this.options=i||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(i=this.block){return i?v.lex:v.lexInline}provideParser(i=this.block){return i?y.parse:y.parseInline}},Js=class{defaults=_e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=ie;TextRenderer=ze;Lexer=v;Tokenizer=se;Hooks=F;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let s of i)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let n of r.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of r.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(n=>{let o=r[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let n=e.renderers[r.name];n?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[r.level];n?n.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new ie(this.defaults);for(let n in t.renderer){if(!(n in r))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new se(this.defaults);for(let n in t.tokenizer){if(!(n in r))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new F;for(let n in t.hooks){if(!(n in r))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=r[o];F.passThroughHooks.has(n)?r[o]=c=>{if(this.defaults.async&&F.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(r,c);return l.call(r,h)})();let p=a.call(r,c);return l.call(r,p)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(r,c);return h===!1&&(h=await l.apply(r,c)),h})();let p=a.apply(r,c);return p===!1&&(p=l.apply(r,c)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let s={...t},r={...this.defaults,...s},n=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(e):e,a=await(r.hooks?await r.hooks.provideLexer(i):i?v.lex:v.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(i):i?y.parse:y.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(n);try{r.hooks&&(e=r.hooks.preprocess(e));let o=(r.hooks?r.hooks.provideLexer(i):i?v.lex:v.lexInline)(e,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(i):i?y.parse:y.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(i,e){return t=>{if(t.message+=`
150
- Please report this to https://github.com/markedjs/marked.`,i){let s="<p>An error occurred:</p><pre>"+_(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},I=new Js;function x(i,e){return I.parse(i,e)}x.options=x.setOptions=function(i){return I.setOptions(i),x.defaults=I.defaults,pt(x.defaults),x};x.getDefaults=_e;x.defaults=M;function Ys(...i){return I.use(...i),x.defaults=I.defaults,pt(x.defaults),x}x.use=Ys;x.walkTokens=function(i,e){return I.walkTokens(i,e)};x.parseInline=I.parseInline;x.Parser=y;x.parser=y.parse;x.Renderer=ie;x.TextRenderer=ze;x.Lexer=v;x.lexer=v.lex;x.Tokenizer=se;x.Hooks=F;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;y.parse;v.lex;/**
151
- * @license
152
- * Copyright 2017 Google LLC
153
- * SPDX-License-Identifier: BSD-3-Clause
154
- */const Xs={CHILD:2},ei=i=>(...e)=>({_$litDirective$:i,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)}}/**
155
- * @license
156
- * Copyright 2017 Google LLC
157
- * SPDX-License-Identifier: BSD-3-Clause
158
- */class be extends ti{constructor(e){if(super(e),this.it=k,e.type!==Xs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===L)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:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const si=ei(be),Xe="mem-bucket-detail-view-mode";class ii extends S{constructor(){super(...arguments),this._viewMode=localStorage.getItem(Xe)??"markdown"}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0}}}static{this.styles=W`
159
- :host { display: block; padding: 16px; }
160
- h2 { margin: 0 0 4px; font-size: 16px; }
161
- .meta { font-size: 12px; opacity: 0.7; margin-bottom: 12px; }
162
- .source-path {
163
- font-family: monospace;
164
- font-size: 11px;
165
- opacity: 0.6;
166
- cursor: pointer;
167
- word-break: break-all;
168
- }
169
- pre {
170
- white-space: pre-wrap;
171
- font-size: 12px;
172
- background: var(--bg-subtle);
173
- padding: 12px;
174
- border-radius: 6px;
175
- max-height: 60vh;
176
- overflow-y: auto;
177
- }
178
- .empty { opacity: 0.5; font-size: 13px; }
179
- .view-toggle {
180
- display: flex;
181
- gap: 4px;
182
- margin-bottom: 8px;
183
- }
184
- .view-toggle button {
185
- font-size: 11px;
186
- padding: 3px 8px;
187
- border: 1px solid var(--border);
188
- background: transparent;
189
- border-radius: 4px;
190
- cursor: pointer;
191
- opacity: 0.6;
192
- }
193
- .view-toggle button.active {
194
- opacity: 1;
195
- background: var(--hover);
196
- font-weight: 600;
197
- }
198
- .markdown-body {
199
- font-size: 13px;
200
- line-height: 1.5;
201
- max-height: 60vh;
202
- overflow-y: auto;
203
- padding: 12px;
204
- background: var(--bg-subtle);
205
- border-radius: 6px;
206
- }
207
- .markdown-body :first-child { margin-top: 0; }
208
- .markdown-body :last-child { margin-bottom: 0; }
209
- .markdown-body pre {
210
- background: var(--hover);
211
- max-height: none;
212
- }
213
- .markdown-body code {
214
- font-family: monospace;
215
- font-size: 12px;
216
- }
217
- .actions {
218
- display: flex;
219
- gap: 8px;
220
- margin-bottom: 12px;
221
- }
222
- .actions button {
223
- font-size: 11px;
224
- padding: 4px 10px;
225
- border: 1px solid var(--border);
226
- background: transparent;
227
- color: inherit;
228
- border-radius: 4px;
229
- cursor: pointer;
230
- }
231
- .actions button.danger {
232
- border-color: var(--danger);
233
- color: var(--danger);
234
- }
235
- `}updated(e){e.has("selected")&&this.selected&&(this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(Xe,e)}async#i(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#a(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}render(){if(!this.selected)return d`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return k;const e=this._doc,t=this.selected.table==="skills"&&e.root==="builtin";return d`
236
- <h2>${e.name??e.key??e.id}</h2>
237
- <div class="meta">
238
- ${e.tags?.join(", ")||"no tags"} · ${e.status}${e.owner?` · owner: ${e.owner}`:""}
239
- ${e.deprecated?" · deprecated":""}${e.paused?" · paused":""} · created
240
- ${e.created_at?e.created_at.slice(0,10):"unknown"}
241
- </div>
242
- <div class="meta">${e.description}</div>
243
- ${t?k:d`
244
- <div class="actions">
245
- <button @click=${()=>this.#i()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
246
- <button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
247
- <button class="danger" @click=${()=>this.#a()}>Delete</button>
248
- </div>
249
- `}
250
- <div class="view-toggle">
251
- <button
252
- class=${this._viewMode==="markdown"?"active":""}
253
- @click=${()=>this.#s("markdown")}
254
- >
255
- Preview
256
- </button>
257
- <button
258
- class=${this._viewMode==="raw"?"active":""}
259
- @click=${()=>this.#s("raw")}
260
- >
261
- Raw
262
- </button>
263
- </div>
264
- ${this._viewMode==="markdown"?d`<div class="markdown-body">${si(x.parse(e.body??"",{async:!1}))}</div>`:d`<pre>${e.body}</pre>`}
265
- <div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
266
- `}}customElements.define("detail-panel",ii);class ri extends S{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("");#s=new u([]);#i=new u(null);#r=new u("");#a=new u("");#o=new u("");#l=new u(!1);#h=new u(!1);#c=new u(!1);#p=new u("");static{this.styles=W`
267
- :host { display: block; }
268
- .backdrop {
269
- position: fixed; inset: 0; background: var(--overlay);
270
- display: flex; align-items: center; justify-content: center; z-index: 100;
271
- }
272
- .modal {
273
- background: var(--bg);
274
- color: inherit;
275
- border-radius: 10px;
276
- width: min(560px, 92vw);
277
- max-height: 82vh;
278
- display: flex;
279
- flex-direction: column;
280
- box-shadow: 0 8px 40px var(--shadow);
281
- border: 1px solid var(--border);
282
- }
283
- .header { padding: 16px 20px 8px; }
284
- h2 { margin: 0; font-size: 16px; }
285
- .kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
286
- .kind-toggle button {
287
- flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
288
- border-radius: 6px; cursor: pointer; font-size: 13px;
289
- }
290
- .kind-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
291
- .breadcrumb-row {
292
- padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
293
- }
294
- .breadcrumb {
295
- font-size: 12px; opacity: 0.7; font-family: monospace;
296
- word-break: break-all;
297
- }
298
- .hidden-toggle {
299
- font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
300
- cursor: pointer; white-space: nowrap; user-select: none;
301
- }
302
- .new-folder-btn {
303
- font-size: 11px; opacity: 0.7; background: none; border: none; color: inherit;
304
- cursor: pointer; white-space: nowrap; padding: 0;
305
- }
306
- .new-folder-btn:hover { opacity: 1; }
307
- .new-folder-row {
308
- padding: 8px 20px; display: flex; align-items: center; gap: 8px;
309
- border-top: 1px solid var(--border);
310
- }
311
- .new-folder-row input[type='text'] {
312
- flex: 1; padding: 5px 8px; font-size: 12px;
313
- border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
314
- }
315
- .new-folder-row button {
316
- font-size: 11px; padding: 5px 10px; border: 1px solid var(--border-strong); background: none;
317
- color: inherit; border-radius: 6px; cursor: pointer;
318
- }
319
- .browser {
320
- flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
321
- min-height: 200px;
322
- }
323
- .entry {
324
- padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
325
- }
326
- .entry:hover { background: var(--hover); }
327
- .entry .icon { opacity: 0.6; }
328
- .up { opacity: 0.7; }
329
- .empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
330
- .footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
331
- .selected-row { font-size: 12px; }
332
- .selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
333
- label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
334
- input[type='text'] {
335
- width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px;
336
- border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
337
- }
338
- .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
339
- button.primary {
340
- background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); padding: 7px 16px;
341
- border-radius: 6px; cursor: pointer; font-size: 13px;
342
- }
343
- button.primary:disabled { opacity: 0.5; cursor: default; }
344
- button.secondary {
345
- background: none; border: 1px solid var(--border-strong); color: inherit; padding: 7px 16px;
346
- border-radius: 6px; cursor: pointer; font-size: 13px;
347
- }
348
- .error { color: var(--danger); font-size: 12px; }
349
- `}constructor(){super(),new we(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#u()}async#u(e){const t=new URLSearchParams;e&&t.set("path",e),this.#h.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#o.set((await s.json()).error??"failed to list directory");return}const r=await s.json();this.#t.set(r.path),this.#i.set(r.parent),this.#s.set(r.entries),this.#o.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#f(){this.#h.set(!this.#h.value),this.#u(this.#t.value)}#b(){this.#p.set(""),this.#c.set(!0)}#x(){this.#c.set(!1),this.#p.set("")}async#m(){const e=this.#p.value.trim();if(e){this.#o.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#t.value,name:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to create folder");return}this.#c.set(!1),this.#p.set(""),await this.#u(this.#t.value)}catch(t){this.#o.set(t.message)}}}#k(){this.#r.set(this.#t.value),this.#a.value||this.#a.set(this.#t.value.split("/").filter(Boolean).pop()??"")}async#g(){const e=this.#r.value||this.#t.value;if(e){this.#l.set(!0),this.#o.set("");try{const t=await fetch("/api/roots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#o.set(s.error??"failed to add root");return}this.onAdded()}finally{this.#l.set(!1)}}}render(){const e=this.#s.value;return d`
350
- <div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onCancel()}>
351
- <div class="modal">
352
- <div class="header"><h2>Add a root</h2></div>
353
- ${this.lockKind?d``:d`
354
- <div class="kind-toggle">
355
- <button
356
- class=${this.#e.value==="skill"?"active":""}
357
- @click=${()=>this.#e.set("skill")}
358
- >
359
- Skill root
360
- </button>
361
- <button
362
- class=${this.#e.value==="memory"?"active":""}
363
- @click=${()=>this.#e.set("memory")}
364
- >
365
- Memory root
366
- </button>
367
- </div>
368
- `}
369
- <div class="breadcrumb-row">
370
- <div class="breadcrumb">${this.#t.value}</div>
371
- <button class="new-folder-btn" @click=${()=>this.#b()}>+ New folder</button>
372
- <label class="hidden-toggle">
373
- <input type="checkbox" .checked=${this.#h.value} @change=${()=>this.#f()} />
374
- Show hidden
375
- </label>
376
- </div>
377
- ${this.#c.value?d`
378
- <div class="new-folder-row">
379
- <input
380
- type="text"
381
- placeholder="Folder name"
382
- .value=${this.#p.value}
383
- @input=${t=>this.#p.set(t.target.value)}
384
- @keydown=${t=>{t.key==="Enter"&&this.#m(),t.key==="Escape"&&this.#x()}}
385
- />
386
- <button @click=${()=>this.#m()}>Create</button>
387
- <button @click=${()=>this.#x()}>Cancel</button>
388
- </div>
389
- `:""}
390
- <div class="browser">
391
- ${this.#i.value?d`<div class="entry up" @click=${()=>this.#u(this.#i.value)}>
392
- <span class="icon">📁</span> ..
393
- </div>`:""}
394
- ${e.length===0&&!this.#i.value?d`<div class="empty">No subdirectories here.</div>`:e.map(t=>d`<div class="entry" @click=${()=>this.#u(t.path)}>
395
- <span class="icon">📁</span> ${t.name}
396
- </div>`)}
397
- </div>
398
- <div class="footer">
399
- <button class="secondary" @click=${()=>this.#k()}>
400
- Select this folder
401
- </button>
402
- ${this.#r.value?d`<div class="selected-row">Selected: <span class="path">${this.#r.value}</span></div>`:""}
403
- <div>
404
- <label>Root name</label>
405
- <input
406
- type="text"
407
- .value=${this.#a.value}
408
- placeholder="e.g. personal, company"
409
- @input=${t=>this.#a.set(t.target.value)}
410
- />
411
- </div>
412
- ${this.#o.value?d`<div class="error">${this.#o.value}</div>`:""}
413
- <div class="actions">
414
- <button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
415
- <button
416
- class="primary"
417
- ?disabled=${!this.#r.value||this.#l.value}
418
- @click=${()=>this.#g()}
419
- >
420
- ${this.#l.value?"Adding…":"Add root"}
421
- </button>
422
- </div>
423
- </div>
424
- </div>
425
- </div>
426
- `}}customElements.define("add-root-modal",ri);let et=0;class ni extends S{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#i;#r;static{this.styles=W`
427
- :host {
428
- display: inline-block;
429
- position: relative;
430
- width: 260px;
431
- font: inherit;
432
- font-size: 13px;
433
- }
434
- .field {
435
- display: flex;
436
- align-items: center;
437
- flex-wrap: wrap;
438
- gap: 4px;
439
- border: 1px solid var(--border-strong);
440
- border-radius: 6px;
441
- background: none;
442
- padding: 3px 4px 3px 8px;
443
- min-height: 30px;
444
- box-sizing: border-box;
445
- }
446
- .field:focus-within {
447
- border-color: var(--accent);
448
- box-shadow: 0 0 0 2px var(--accent-tint);
449
- }
450
- .selected-chip {
451
- display: inline-flex;
452
- align-items: center;
453
- gap: 4px;
454
- background: var(--accent);
455
- color: var(--accent-fg);
456
- border-radius: 999px;
457
- padding: 2px 6px 2px 10px;
458
- font-size: 12px;
459
- white-space: nowrap;
460
- }
461
- .selected-chip .remove {
462
- cursor: pointer;
463
- opacity: 0.85;
464
- line-height: 1;
465
- padding: 2px;
466
- border-radius: 50%;
467
- }
468
- .selected-chip .remove:hover { opacity: 1; background: #ffffff33; }
469
- .input {
470
- flex: 1 1 60px;
471
- min-width: 60px;
472
- border: none;
473
- outline: none;
474
- padding: 5px 2px;
475
- font: inherit;
476
- font-size: 13px;
477
- background: transparent;
478
- color: inherit;
479
- }
480
- .clear-btn, .chevron-btn {
481
- border: none;
482
- background: transparent;
483
- cursor: pointer;
484
- color: inherit;
485
- opacity: 0.6;
486
- font-size: 12px;
487
- padding: 2px 5px;
488
- line-height: 1;
489
- }
490
- .clear-btn:hover, .chevron-btn:hover { opacity: 1; }
491
- .chevron-btn { transition: transform 0.15s ease; }
492
- .chevron-btn.open { transform: rotate(180deg); }
493
-
494
- .menu {
495
- position: fixed;
496
- margin: 0;
497
- inset: auto;
498
- top: anchor(bottom);
499
- left: anchor(left);
500
- width: anchor-size(width);
501
- position-try-fallbacks: flip-block;
502
- list-style: none;
503
- padding: 4px;
504
- margin: 0;
505
- border: 1px solid var(--border);
506
- border-radius: 8px;
507
- background: var(--bg);
508
- color: inherit;
509
- box-shadow: 0 8px 24px var(--shadow);
510
- max-height: 260px;
511
- overflow-y: auto;
512
- box-sizing: border-box;
513
- }
514
- .menu:popover-open { margin-top: 4px; }
515
- .menu[popover] { display: none; }
516
- .menu.visible[popover] { display: block; }
517
-
518
- .option {
519
- display: flex;
520
- align-items: center;
521
- gap: 8px;
522
- padding: 6px 8px;
523
- border-radius: 5px;
524
- cursor: pointer;
525
- font-size: 13px;
526
- }
527
- .option:hover, .option.highlighted { background: var(--hover); }
528
- .option input { margin: 0; pointer-events: none; }
529
- .empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
530
- `}constructor(){super(),new we(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.#i=`--tag-multiselect-${++et}`,this.#r=`tag-multiselect-listbox-${et}`}#a=e=>{e.composedPath().includes(this)||this.#h()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#a)}disconnectedCallback(){document.removeEventListener("click",this.#a),super.disconnectedCallback()}get#o(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#l(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#h(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#c(){this.#t.value?this.#h():(this.#l(),this.renderRoot.querySelector(".input")?.focus())}#p(e){this.#e.set(e.target.value),this.#s.set(-1),this.#l()}#u(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}#f(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#l()}#b(e){const t=this.#o;if(e.key==="ArrowDown")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#l(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"){const s=t[this.#s.value];s!==void 0&&(e.preventDefault(),this.#u(s))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#h()}render(){const e=this.active,t=this.#o,s=this.#t.value,r=this.#s.value;return d`
531
- <div class="field" style=${`anchor-name: ${this.#i}`}>
532
- ${e.map(n=>d`
533
- <span class="selected-chip">
534
- ${n}
535
- <span class="remove" @click=${()=>this.onToggle(n)}>✕</span>
536
- </span>
537
- `)}
538
- <input
539
- class="input"
540
- role="combobox"
541
- aria-autocomplete="list"
542
- aria-expanded=${s}
543
- aria-controls=${this.#r}
544
- aria-activedescendant=${r>=0?`${this.#r}-opt-${r}`:""}
545
- placeholder=${e.length===0?"Filter by tag…":""}
546
- .value=${this.#e.value}
547
- @input=${n=>this.#p(n)}
548
- @focus=${()=>this.#l()}
549
- @click=${()=>this.#l()}
550
- @keydown=${n=>this.#b(n)}
551
- />
552
- ${e.length>0?d`<button class="clear-btn" tabindex="-1" @mousedown=${n=>n.preventDefault()} @click=${n=>this.#f(n)}>✕</button>`:""}
553
- <button
554
- class="chevron-btn ${s?"open":""}"
555
- tabindex="-1"
556
- @mousedown=${n=>n.preventDefault()}
557
- @click=${()=>this.#c()}
558
- >
559
- ▾
560
- </button>
561
- </div>
562
-
563
- <ul
564
- id=${this.#r}
565
- class="menu ${s?"visible":""}"
566
- role="listbox"
567
- aria-multiselectable="true"
568
- popover="manual"
569
- style=${`position-anchor: ${this.#i}`}
570
- >
571
- ${t.length?t.map((n,o)=>d`
572
- <li
573
- id=${`${this.#r}-opt-${o}`}
574
- role="option"
575
- aria-selected=${e.includes(n)}
576
- class=${o===r?"option highlighted":"option"}
577
- @mousedown=${a=>a.preventDefault()}
578
- @click=${()=>this.#u(n)}
579
- >
580
- <input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
581
- ${n}
582
- </li>
583
- `):d`<li class="empty">No matches</li>`}
584
- </ul>
585
- `}}customElements.define("tag-multiselect",ni);const oi=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],tt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],ai={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],roots:[]},li={skill:[],memory:[]},vt="mem-bucket-split-pct",yt=20,wt=80;function ci(){const i=Number(localStorage.getItem(vt));return Number.isFinite(i)&&i>=yt&&i<=wt?i:40}const _t="mem-bucket-theme",he=["system","light","dark"],hi={system:"◐",light:"☀",dark:"☾"},pi={system:"Auto",light:"Light",dark:"Dark"};function ui(){const i=localStorage.getItem(_t);return i==="light"||i==="dark"?i:"system"}function st(i){i==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",i)}function di(){const i=location.hash.slice(1);if(!i)return{};const e=new URLSearchParams(i),t={},s=e.get("q");s&&(t.query=s);const r=e.get("type");(r==="skill"||r==="memory"||r==="all")&&(t.typeFilter=r);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("root");o.length&&(t.activeRoots=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 c=e.get("paused");c==="0"?t.pausedFilter="hide":c==="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 gi extends S{static{this.styles=W`
586
- :host { display: flex; flex-direction: column; height: 100vh; }
587
- .theme-toggle {
588
- position: fixed;
589
- top: 10px;
590
- right: 12px;
591
- z-index: 10;
592
- width: 28px;
593
- height: 28px;
594
- border: 1px solid var(--border-strong);
595
- border-radius: 50%;
596
- background: var(--bg);
597
- color: inherit;
598
- cursor: pointer;
599
- font-size: 14px;
600
- line-height: 1;
601
- display: flex;
602
- align-items: center;
603
- justify-content: center;
604
- opacity: 0.75;
605
- }
606
- .theme-toggle:hover { opacity: 1; background: var(--hover); }
607
- .filters {
608
- padding: 12px 16px;
609
- border-bottom: 1px solid var(--border);
610
- display: flex;
611
- flex-direction: column;
612
- gap: 8px;
613
- }
614
- .search-field {
615
- position: relative;
616
- flex: 1 1 240px;
617
- max-width: 480px;
618
- }
619
- .filters input[type='search'] {
620
- font-size: 13px;
621
- padding: 6px 28px 6px 10px;
622
- width: 100%;
623
- box-sizing: border-box;
624
- border: 1px solid var(--border-strong);
625
- border-radius: 6px;
626
- background: none;
627
- color: inherit;
628
- height: 30px;
629
- }
630
- .filters input[type='search']::-webkit-search-cancel-button { display: none; }
631
- .search-clear-btn {
632
- position: absolute;
633
- right: 4px;
634
- top: 50%;
635
- transform: translateY(-50%);
636
- border: none;
637
- background: transparent;
638
- cursor: pointer;
639
- color: inherit;
640
- opacity: 0.6;
641
- font-size: 12px;
642
- line-height: 1;
643
- padding: 4px 6px;
644
- border-radius: 50%;
645
- }
646
- .search-clear-btn:hover { opacity: 1; background: var(--hover); }
647
- .date-range { display: flex; align-items: center; gap: 4px; }
648
- .date-range input[type='date'] {
649
- font-size: 13px;
650
- padding: 5px 8px;
651
- border: 1px solid var(--border-strong);
652
- border-radius: 6px;
653
- background: none;
654
- color: inherit;
655
- height: 30px;
656
- box-sizing: border-box;
657
- }
658
- .date-range-sep { opacity: 0.5; font-size: 12px; }
659
- .date-range-clear {
660
- position: static;
661
- transform: none;
662
- opacity: 0.6;
663
- font-size: 12px;
664
- line-height: 1;
665
- padding: 4px 6px;
666
- border: none;
667
- background: transparent;
668
- cursor: pointer;
669
- color: inherit;
670
- border-radius: 50%;
671
- }
672
- .date-range-clear:hover { opacity: 1; background: var(--hover); }
673
- .search-row { align-items: center; }
674
- .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
675
- .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
676
- .type-toggle { gap: 0; }
677
- .type-toggle button {
678
- border: 1px solid var(--border-strong);
679
- background: none;
680
- color: inherit;
681
- padding: 6px 12px;
682
- font-size: 13px;
683
- cursor: pointer;
684
- height: 30px;
685
- box-sizing: border-box;
686
- }
687
- .type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
688
- .type-toggle button:first-child { border-radius: 6px 0 0 6px; }
689
- .type-toggle button:last-child { border-radius: 0 6px 6px 0; }
690
- .type-toggle button:not(:first-child) { border-left: none; }
691
- .body-region { display: flex; flex: 1 1 auto; min-height: 0; }
692
- result-list { overflow-y: auto; flex: 0 0 auto; }
693
- detail-panel { overflow-y: auto; flex: 1 1 auto; min-width: 0; }
694
- .splitter {
695
- flex: 0 0 auto;
696
- width: 6px;
697
- cursor: col-resize;
698
- background: var(--hover);
699
- position: relative;
700
- }
701
- .splitter:hover, .splitter.dragging { background: var(--accent-tint); }
702
- .splitter::after {
703
- content: '';
704
- position: absolute;
705
- top: 0; bottom: 0;
706
- left: -3px; right: -3px;
707
- }
708
- label.small { font-size: 12px; opacity: 0.7; }
709
- .roots-bar {
710
- display: flex;
711
- gap: 6px;
712
- align-items: center;
713
- flex-wrap: wrap;
714
- padding: 10px 16px;
715
- border-bottom: 1px solid var(--border);
716
- background: var(--bg-subtle);
717
- }
718
- .root-chip {
719
- border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
720
- cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
721
- }
722
- .root-chip.active { background: var(--purple-tint); border-color: var(--purple); color: var(--purple-fg); }
723
- .root-chip .remove {
724
- opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
725
- }
726
- .root-chip .remove:hover { opacity: 1; background: var(--hover-strong); }
727
- .add-root-btn {
728
- border: 1px dashed var(--border-strong); border-radius: 999px; padding: 3px 10px; font-size: 12px;
729
- cursor: pointer; background: none; color: inherit; opacity: 0.75;
730
- }
731
- .add-root-btn:hover { opacity: 1; }
732
- .first-run {
733
- display: flex; flex-direction: column; align-items: center; justify-content: center;
734
- flex: 1 1 auto; gap: 16px; text-align: center; padding: 24px;
735
- }
736
- .first-run h1 { font-size: 18px; margin: 0; }
737
- .first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
738
- select {
739
- font-size: 13px;
740
- padding: 6px 8px;
741
- height: 30px;
742
- box-sizing: border-box;
743
- border: 1px solid var(--border-strong);
744
- border-radius: 6px;
745
- background: none;
746
- color: inherit;
747
- }
748
- .bulk-bar {
749
- display: flex;
750
- gap: 8px;
751
- align-items: center;
752
- padding: 6px 16px;
753
- border-bottom: 1px solid var(--border);
754
- background: var(--accent-tint);
755
- font-size: 12px;
756
- }
757
- .bulk-bar button {
758
- font-size: 11px;
759
- padding: 4px 10px;
760
- border: 1px solid var(--border);
761
- background: transparent;
762
- color: inherit;
763
- border-radius: 4px;
764
- cursor: pointer;
765
- }
766
- .bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
767
- `}#e=di();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#i=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeRoots??[]);#a=new u([]);#o=new u(ai);#l=new u(null);#h=new u(li);#c=new u(!1);#p=new u("");#u=new u(!1);#f=new u(ci());#b=new u(!1);#x=new u(this.#e.sort??"mtime_desc");#m=new u(this.#e.deprecatedFilter??"all");#k=new u(this.#e.pausedFilter??"all");#g=new u(this.#e.dateFrom??"");#$=new u(this.#e.dateTo??"");#d=new u(new Set);#y=new u(ui());#A=e=>this.#M(e);#T=()=>this.#O();constructor(){super(),new we(this),st(this.#y.value)}#P(e){this.#y.set(e),localStorage.setItem(_t,e),st(e)}#L(){const e=he[(he.indexOf(this.#y.value)+1)%he.length];this.#P(e)}#I(e){e.preventDefault(),this.#b.set(!0),document.addEventListener("pointermove",this.#A),document.addEventListener("pointerup",this.#T)}#M(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),r=(e.clientX-s.left)/s.width*100;this.#f.set(Math.min(wt,Math.max(yt,r)))}#O(){this.#b.set(!1),document.removeEventListener("pointermove",this.#A),document.removeEventListener("pointerup",this.#T),localStorage.setItem(vt,String(this.#f.value))}#D=new Xt(()=>{const e=new URLSearchParams;this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim());for(const t of this.#i.value)e.append("tag",t);for(const t of this.#r.value)e.append("root",t);return this.#x.value!=="mtime_desc"&&e.set("sort",this.#x.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#k.value==="hide"?e.set("paused","0"):this.#k.value==="only"&&e.set("paused","1"),this.#g.value&&e.set("date_from",this.#g.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#w=()=>this.#N();connectedCallback(){super.connectedCallback(),this.#n(),this.#v(),this.#_(),window.addEventListener("focus",this.#w),document.addEventListener("visibilitychange",this.#w)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#w),document.removeEventListener("visibilitychange",this.#w)}#N(){document.visibilityState==="visible"&&(this.#n(),this.#v(),this.#_())}async#n(){const e=this.#D.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#a.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#v(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#o.set(await t.json())}async#_(){const e=await fetch("/api/roots");this.#h.set(await e.json()),this.#u.set(!0)}#q(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}async#U(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} root (files on disk are untouched):`)===e.name){this.#p.set(e.name);try{await fetch(`/api/roots/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#_(),this.#v(),this.#n()])}finally{this.#p.set("")}}}#R(){this.#c.set(!1),this.#_(),this.#v(),this.#n()}#H(){return[...this.#h.value.skill,...this.#h.value.memory]}#B(e){this.#s.set(e),this.#i.set([]),this.#v(),this.#n()}#j(e){const t=this.#i.value;this.#i.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#n()}#F(e){this.#t.set(e.target.value),this.#n()}#Z(){this.#t.set(""),this.#n()}#Q(e){this.#l.set({table:e._table,id:e.id})}#K(e){this.#x.set(e.target.value),this.#n()}#W(e){this.#m.set(e.target.value),this.#n()}#V(e){this.#k.set(e.target.value),this.#n()}#G(e){this.#g.set(e.target.value),this.#n()}#J(e){this.#$.set(e.target.value),this.#n()}#Y(){this.#g.set(""),this.#$.set(""),this.#n()}#X(e){const t=new Set(this.#d.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#d.set(t)}#ee(){return new Map(this.#a.value.map(e=>[e.id,e]))}#S(){const e=new Map,t=this.#ee();for(const s of this.#d.value){const r=t.get(s);if(!r)continue;const n=e.get(r._table)??[];n.push(s),e.set(r._table,n)}return e}async#E(e){const t=this.#S();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,deprecated:e})}))),this.#d.set(new Set),await this.#n()}async#C(e){const t=this.#S();await Promise.all([...t.entries()].map(([s,r])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r,paused:e})}))),this.#d.set(new Set),await this.#n()}async#te(){if(!window.confirm(`Delete ${this.#d.value.size} doc(s)? This can't be undone.`))return;const e=this.#S();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#d.set(new Set),await this.#n()}#z(){const e=this.#y.value;return d`
768
- <button
769
- class="theme-toggle"
770
- title=${`Theme: ${pi[e]} (click to change)`}
771
- aria-label="Toggle color theme"
772
- @click=${()=>this.#L()}
773
- >
774
- ${hi[e]}
775
- </button>
776
- `}render(){const e=this.#o.value,t=this.#H();return this.#u.value&&t.length===0&&!this.#c.value?d`
777
- ${this.#z()}
778
- <div class="first-run">
779
- <h1>No roots configured yet</h1>
780
- <p>
781
- Add a folder of skills or memory docs to get started. You can add more roots later —
782
- e.g. a personal skills repo plus a shared company repo.
783
- </p>
784
- <button class="add-root-btn" @click=${()=>this.#c.set(!0)}>+ Add your first root</button>
785
- </div>
786
- ${this.#c.value?d`<add-root-modal
787
- .defaultKind=${"skill"}
788
- .lockKind=${!1}
789
- .onAdded=${()=>this.#R()}
790
- .onCancel=${()=>this.#c.set(!1)}
791
- ></add-root-modal>`:""}
792
- `:d`
793
- ${this.#z()}
794
- <div class="roots-bar">
795
- <span class="filter-label">Roots:</span>
796
- ${t.map(s=>d`
797
- <button
798
- class="root-chip ${this.#r.value.includes(s.name)?"active":""}"
799
- title=${s.path}
800
- @click=${()=>this.#q(s.name)}
801
- >
802
- ${s.name}
803
- <span
804
- class="remove"
805
- title="Remove root"
806
- @click=${r=>this.#U(s,r)}
807
- >${this.#p.value===s.name?"…":"✕"}</span
808
- >
809
- </button>
810
- `)}
811
- <button class="add-root-btn" @click=${()=>this.#c.set(!0)}>+ Add root</button>
812
- </div>
813
- <div class="filters">
814
- <div class="row search-row">
815
- <div class="search-field">
816
- <input
817
- type="search"
818
- placeholder="Search descriptions, bodies, tags..."
819
- .value=${this.#t.value}
820
- @input=${s=>this.#F(s)}
821
- />
822
- ${this.#t.value?d`
823
- <button
824
- class="search-clear-btn"
825
- title="Clear search"
826
- aria-label="Clear search"
827
- @click=${()=>this.#Z()}
828
- >
829
- ✕
830
- </button>
831
- `:""}
832
- </div>
833
- <div class="row type-toggle">
834
- ${oi.map(s=>d`
835
- <button
836
- class=${this.#s.value===s.value?"active":""}
837
- @click=${()=>this.#B(s.value)}
838
- >
839
- ${s.label}
840
- </button>
841
- `)}
842
- </div>
843
- ${e.tags.length===0?d`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:d`
844
- <tag-multiselect
845
- .tags=${e.tags}
846
- .active=${this.#i.value}
847
- .onToggle=${s=>this.#j(s)}
848
- ></tag-multiselect>
849
- `}
850
- <span class="filter-label">Dates:</span>
851
- <div class="date-range">
852
- <input
853
- type="date"
854
- aria-label="From date"
855
- .value=${this.#g.value}
856
- @change=${s=>this.#G(s)}
857
- />
858
- <span class="date-range-sep">–</span>
859
- <input
860
- type="date"
861
- aria-label="To date"
862
- .value=${this.#$.value}
863
- @change=${s=>this.#J(s)}
864
- />
865
- ${this.#g.value||this.#$.value?d`
866
- <button
867
- class="date-range-clear"
868
- title="Clear date range"
869
- aria-label="Clear date range"
870
- @click=${()=>this.#Y()}
871
- >
872
- ✕
873
- </button>
874
- `:""}
875
- </div>
876
- <span class="filter-label">Sort:</span>
877
- <select .value=${this.#x.value} @change=${s=>this.#K(s)}>
878
- <option value="mtime_desc">Recently touched</option>
879
- <option value="mtime_asc">Least recently touched</option>
880
- <option value="created_at_asc">Oldest first</option>
881
- <option value="name_asc">Name</option>
882
- </select>
883
- <span class="filter-label">Deprecated:</span>
884
- <select .value=${this.#m.value} @change=${s=>this.#W(s)}>
885
- ${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
886
- </select>
887
- <span class="filter-label">Paused:</span>
888
- <select .value=${this.#k.value} @change=${s=>this.#V(s)}>
889
- ${tt.map(s=>d`<option value=${s.value}>${s.label}</option>`)}
890
- </select>
891
- </div>
892
- </div>
893
- ${this.#d.value.size>0?d`
894
- <div class="bulk-bar">
895
- <span>${this.#d.value.size} selected</span>
896
- <button @click=${()=>this.#E(!0)}>Mark deprecated</button>
897
- <button @click=${()=>this.#E(!1)}>Un-deprecate</button>
898
- <button @click=${()=>this.#C(!0)}>Pause</button>
899
- <button @click=${()=>this.#C(!1)}>Resume</button>
900
- <button class="danger" @click=${()=>this.#te()}>Delete</button>
901
- <button @click=${()=>this.#d.set(new Set)}>Clear</button>
902
- </div>
903
- `:""}
904
- <div class="body-region">
905
- <result-list
906
- style=${`width: ${this.#f.value}%; border-right: 1px solid var(--border);`}
907
- .results=${this.#a.value}
908
- .showRoot=${t.length>1}
909
- .onSelect=${s=>this.#Q(s)}
910
- .selectedIds=${this.#d.value}
911
- .onToggleSelect=${s=>this.#X(s)}
912
- ></result-list>
913
- <div
914
- class="splitter ${this.#b.value?"dragging":""}"
915
- @pointerdown=${s=>this.#I(s)}
916
- ></div>
917
- <detail-panel .selected=${this.#l.value} .onChanged=${()=>this.#n()}></detail-panel>
918
- </div>
919
- ${this.#c.value?d`<add-root-modal
920
- .defaultKind=${"skill"}
921
- .lockKind=${!1}
922
- .onAdded=${()=>this.#R()}
923
- .onCancel=${()=>this.#c.set(!1)}
924
- ></add-root-modal>`:""}
925
- `}}customElements.define("mem-bucket-app",gi);