mcp-memory-bucket 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/client/assets/{index-Cr5jNKWL.js → index-BfU_uQyK.js} +397 -262
- package/dist/client/index.html +7 -1
- package/dist/src/attachments/repository.js +22 -22
- package/dist/src/attachments/tools.js +12 -12
- package/dist/src/config.js +70 -3
- package/dist/src/memory/repository.js +142 -39
- package/dist/src/memory/tools.js +32 -13
- package/dist/src/remote/credentials.js +31 -0
- package/dist/src/remote/folderfoo-client.js +149 -0
- package/dist/src/remote/remote-sync.js +176 -0
- package/dist/src/server.js +18 -3
- package/dist/src/shared/body-edits.js +87 -0
- package/dist/src/shared/relocate-tool.js +2 -2
- package/dist/src/shared/relocate.js +9 -5
- package/dist/src/skills/repository.js +141 -47
- package/dist/src/skills/tools.js +34 -15
- package/dist/src/store/sync.js +19 -2
- package/dist/src/web/routes.js +220 -25
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)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(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();/**
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const n of i)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(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(i){if(i.ep)return;i.ep=!0;const n=t(i);fetch(i.href,n)}})();const Ot="modulepreload",Mt=function(r){return"/"+r},Fe={},dt=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(c){return Promise.all(c.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=o(t.map(c=>{if(c=Mt(c),c in Fe)return;Fe[c]=!0;const p=c.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Ot,p||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),p)return new Promise((v,b)=>{f.addEventListener("load",v),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return e().catch(n)})};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const ee=globalThis
|
|
5
|
+
*/const ee=globalThis,$e=ee.ShadowRoot&&(ee.ShadyCSS===void 0||ee.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,we=Symbol(),Ne=new WeakMap;let pt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==we)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($e&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ne.set(t,e))}return e}toString(){return this.cssText}};const Ft=r=>new pt(typeof r=="string"?r:r+"",void 0,we),O=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((s,i,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.")})(i)+r[n+1],r[0]);return new pt(t,r,we)},Nt=(r,e)=>{if($e)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=ee.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,r.appendChild(s)}},qe=$e?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Ft(t)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:qt,defineProperty:Ut,getOwnPropertyDescriptor:jt,getOwnPropertyNames:Ht,getOwnPropertySymbols:Bt,getPrototypeOf:Kt}=Object,oe=globalThis,Ue=oe.trustedTypes,Zt=Ue?Ue.emptyScript:"",Wt=oe.reactiveElementPolyfillSupport,W=(r,e)=>r,ge={toAttribute(r,e){switch(e){case Boolean:r=r?Zt:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},ut=(r,e)=>!qt(r,e),je={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:ut};Symbol.metadata??=Symbol("metadata"),oe.litPropertyMetadata??=new WeakMap;let N=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=je){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Ut(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=jt(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??je}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=Kt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,s=[...Ht(t),...Bt(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:ge).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:ge;this._$Em=i;const a=o.fromAttribute(t,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const o=this.constructor;if(i===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??ut)(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:i,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)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,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){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[W("elementProperties")]=new Map,N[W("finalized")]=new Map,Wt?.({ReactiveElement:N}),(oe.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const _e=globalThis,He=r=>r,te=_e.trustedTypes,Be=te?te.createPolicy("lit-html",{createHTML:r=>r}):void 0,ft="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,gt="?"+E,Qt=`<${gt}>`,L=document,Q=()=>L.createComment(""),V=r=>r===null||typeof r!="object"&&typeof r!="function",Se=Array.isArray,Vt=r=>Se(r)||typeof r?.[Symbol.iterator]=="function",de=`[
|
|
14
|
+
\f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ze=/>/g,R=RegExp(`>|${de}(?:([^\\s"'>=/]+)(${de}*=${de}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),We=/'/g,Qe=/"/g,bt=/^(?:script|style|textarea|title)$/i,Yt=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),h=Yt(1),I=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Ve=new WeakMap,z=L.createTreeWalker(L,129);function mt(r,e){if(!Se(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Be!==void 0?Be.createHTML(e):e}const Jt=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const l=r[a];let c,p,d=-1,f=0;for(;f<l.length&&(o.lastIndex=f,p=o.exec(l),p!==null);)f=o.lastIndex,o===B?p[1]==="!--"?o=Ke:p[1]!==void 0?o=Ze:p[2]!==void 0?(bt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=R):p[3]!==void 0&&(o=R):o===R?p[0]===">"?(o=i??B,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?R:p[3]==='"'?Qe:We):o===Qe||o===We?o=R:o===Ke||o===Ze?o=B:(o=R,i=void 0);const v=o===R&&r[a+1].startsWith("/>")?" ":"";n+=o===B?l+Qt:d>=0?(s.push(c),l.slice(0,d)+ft+l.slice(d)+E+v):l+E+(d===-2?a:v)}return[mt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let be=class xt{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,p]=Jt(e,t);if(this.el=xt.createElement(c,s),z.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=z.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(ft)){const f=p[o++],v=i.getAttribute(d).split(E),b=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:b[2],strings:v,ctor:b[1]==="."?Xt:b[1]==="?"?es:b[1]==="@"?ts:ae}),i.removeAttribute(d)}else d.startsWith(E)&&(l.push({type:6,index:n}),i.removeAttribute(d));if(bt.test(i.tagName)){const d=i.textContent.split(E),f=d.length-1;if(f>0){i.textContent=te?te.emptyScript:"";for(let v=0;v<f;v++)i.append(d[v],Q()),z.nextNode(),l.push({type:2,index:++n});i.append(d[f],Q())}}}else if(i.nodeType===8)if(i.data===gt)l.push({type:2,index:n});else{let d=-1;for(;(d=i.data.indexOf(E,d+1))!==-1;)l.push({type:7,index:n}),d+=E.length-1}n++}}static createElement(e,t){const s=L.createElement("template");return s.innerHTML=e,s}};function q(r,e,t=r,s){if(e===I)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=V(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(r,i._$AS(r,e.values),i,s)),e}let Gt=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??L).importNode(t,!0);z.currentNode=i;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 Y(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new ss(n,this,e)),this._$AV.push(c),l=s[++a]}o!==l?.index&&(n=z.nextNode(),o++)}return z.currentNode=L,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),V(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==I&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Vt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&V(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=be.createElement(mt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new Gt(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Ve.get(e.strings);return t===void 0&&Ve.set(e.strings,t=new be(e)),t}k(e){Se(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new Y(this.O(Q()),this.O(Q()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=He(e).nextSibling;He(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}let ae=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=q(this,e,t,0),o=!V(e)||e!==this._$AH&&e!==I,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=q(this,a[s+l],t,l),c===I&&(c=this._$AH[l]),o||=!V(c)||c!==this._$AH[l],c===m?e=m:e!==m&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Xt=class extends ae{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}},es=class extends ae{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}},ts=class extends ae{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??m)===I)return;const s=this._$AH,i=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==m&&(s===m||i);i&&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)}},ss=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const is=_e.litHtmlPolyfillSupport;is?.(be,Y),(_e.litHtmlVersions??=[]).push("3.3.3");const rs=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new Y(e.insertBefore(Q(),n),n,void 0,t??{})}return i._$AI(r),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
20
|
-
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#
|
|
19
|
+
*/const Ce=globalThis;let _=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return I}};_._$litElement$=!0,_.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:_});const ns=Ce.litElementPolyfillSupport;ns?.({LitElement:_});(Ce.litElementVersions??=[]).push("4.2.2");var vt;let pe=0;const Ye=new Set;function os(r){pe++;try{r()}finally{pe--,pe===0&&as()}}function as(){const r=new Set(Ye);Ye.clear();for(const e of r)e()}function ls(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function cs(r){return r&&typeof r.deref=="function"}class Ae{static#e=0;#t;#s;#n=new Set;#r=vt.#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 ls(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.#n.add(s),()=>this.#n.delete(s)}_notify(){const e=[...this.#n];for(const t of e){let s;if(cs(t)){if(s=t.deref(),!s){this.#n.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}`}}vt=Ae;class u extends Ae{static#e=[];constructor(e,t){super(e,t)}static get activeConsumer(){return this.#e[this.#e.length-1]}static push(e){this.#e.push(e)}static pop(){this.#e.pop()}get(){return this._get()}set(e){os(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class hs extends Ae{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#g=()=>{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.#n.has(e))return;const t=e.subscribe(this.#g,this.#r);this.#n.set(e,t)}dispose(){this.#l()}#l(){for(const e of this.#n.values())e();this.#n.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.#l(),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 le{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){u.push(i);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"})`}}const ds=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function ps(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":ds.format(e)}function us(r){const e=[],t=new Map,s=[];for(const n of r){if(n._table!=="memory_docs"){s.push(n);continue}t.has(n.name)||(t.set(n.name,[]),e.push(n.name)),t.get(n.name).push(n)}const i=e.map(n=>({key:n,items:t.get(n)}));return s.length>0&&i.push({key:null,items:s}),i}class fs extends _{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1}}}static{this.styles=O`
|
|
21
21
|
:host { display: block; }
|
|
22
22
|
.count-header {
|
|
23
23
|
padding: 8px 14px;
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
75
75
|
`}render(){return!this.results||this.results.length===0?h`<div class="empty">No results.</div>`:h`
|
|
76
76
|
<div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
|
|
77
|
-
${
|
|
77
|
+
${us(this.results).map(e=>h`
|
|
78
78
|
${e.key?h`<div class="key-group-header">
|
|
79
79
|
🔑
|
|
80
80
|
<button
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class="row-body">
|
|
102
102
|
<div class="top">
|
|
103
103
|
<span class="name">${e.name}</span>
|
|
104
|
-
<span class="meta">${
|
|
104
|
+
<span class="meta">${ps(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
|
|
105
105
|
</div>
|
|
106
106
|
<div class="desc">${e.description}</div>
|
|
107
107
|
<div class="tags">
|
|
@@ -113,54 +113,54 @@
|
|
|
113
113
|
</div>
|
|
114
114
|
</div>
|
|
115
115
|
</div>
|
|
116
|
-
`}}customElements.define("result-list",
|
|
117
|
-
]`).replace("lheading"
|
|
118
|
-
`),t=e.length-1;for(;t>=0&&
|
|
119
|
-
`)}function
|
|
116
|
+
`}}customElements.define("result-list",fs);function Te(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var M=Te();function kt(r){M=r}var P={exec:()=>null};function F(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(k.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var gs=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),k={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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:F(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:F(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:F(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:F(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:F(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:F(r=>new RegExp(`^ {0,${r}}>`))},bs=/^(?:[ \t]*(?:\n|$))+/,ms=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,xs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,J=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,yt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$t=g(yt).replace(/bull/g,Ee).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ks=g(yt).replace(/bull/g,Ee).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ys=/^[^\n]+/,Pe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$s=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ws=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),ce="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ze=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_s=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ze).replace("tag",ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wt=r=>g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ss=wt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Cs=wt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),As=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Cs).getRegex(),Le={blockquote:As,code:ms,def:$s,fences:xs,heading:vs,hr:J,html:_s,lheading:$t,list:ws,newline:bs,paragraph:Ss,table:P,text:ys},Je=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex(),Ts={...Le,lheading:ks,table:Je,paragraph:g(Re).replace("hr",J).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ce).getRegex()},Es={...Le,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ze).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(Re).replace("hr",J).replace("heading",` *#{1,6} *[^
|
|
117
|
+
]`).replace("lheading",$t).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Rs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ps=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_t=/^( {2,}|\\)\n(?!\s*$)/,zs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,G=/[^\s\p{P}\p{S}]/u,Ls=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,U).getRegex(),Is=/[\p{Pi}\p{Ps}"']/u,St=/(?!~)[\p{P}\p{S}]/u,Ds=/(?!~)[\s\p{P}\p{S}]/u,Os=/(?:[^\s\p{P}\p{S}]|~)/u,Ms=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",gs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ct=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Fs=g(Ct,"u").replace(/punct/g,A).getRegex(),Ns=g(Ct,"u").replace(/punct/g,St).getRegex(),qs=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Us=g(qs,"u").replace(/openQuote/g,Is).replace(/punct/g,A).getRegex(),At="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",js=g(At,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Hs=g(At,"gu").replace(/notPunctSpace/g,Os).replace(/punctSpace/g,Ds).replace(/punct/g,St).getRegex(),Bs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Ks=g(Bs,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Zs=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Ws="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Qs=g(Ws,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Vs=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),Ys="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Js=g(Ys,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,U).replace(/punct/g,A).getRegex(),Gs=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),Xs=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ei=g(ze).replace("(?:-->|$)","-->").getRegex(),ti=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ei).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),se=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,si=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",se).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Tt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",se).replace("ref",Pe).getRegex(),Et=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pe).getRegex(),ii=g("reflink|nolink(?!\\()","g").replace("reflink",Tt).replace("nolink",Et).getRegex(),Ge=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ie={_backpedal:P,anyPunctuation:Gs,autolink:Xs,blockSkip:Ms,br:_t,code:Ps,del:P,delLDelim:P,delRDelim:P,emStrongLDelim:Fs,emStrongRDelimAst:js,emStrongRDelimUnd:Zs,escape:Rs,link:si,nolink:Et,punctuation:Ls,reflink:Tt,reflinkSearch:ii,tag:ti,text:zs,url:P},ri={...Ie,emStrongLDelim:Us,emStrongRDelimAst:Ks,emStrongRDelimUnd:Qs,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",se).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se).getRegex()},me={...Ie,emStrongRDelimAst:Hs,emStrongLDelim:Ns,delLDelim:Vs,delRDelim:Js,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ge).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ge).getRegex()},ni={...me,br:g(_t).replace("{2,}","*").getRegex(),text:g(me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},X={normal:Le,gfm:Ts,pedantic:Es},K={normal:Ie,gfm:me,breaks:ni,pedantic:ri},oi={"&":"&","<":"<",">":">",'"':""","'":"'"},Xe=r=>oi[r];function C(r,e){if(e){if(k.escapeTest.test(r))return r.replace(k.escapeReplace,Xe)}else if(k.escapeTestNoEncode.test(r))return r.replace(k.escapeReplaceNoEncode,Xe);return r}function et(r){try{r=encodeURI(r).replace(k.percentDecode,"%")}catch{return null}return r}function tt(r,e){let t=r.replace(k.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split(k.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(k.slashPipe,"|");return s}function T(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function st(r){let e=r.split(`
|
|
118
|
+
`),t=e.length-1;for(;t>=0&&k.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
|
|
119
|
+
`)}function ai(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function li(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function it(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function ci(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
120
120
|
`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=i.length?n.slice(i.length):n}).join(`
|
|
121
|
-
`)}var ie=class{options;rules;lexer;constructor(r){this.options=r||M}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:
|
|
122
|
-
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:
|
|
123
|
-
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=
|
|
121
|
+
`)}var ie=class{options;rules;lexer;constructor(r){this.options=r||M}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:st(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=ci(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(r){let e=this.rules.block.heading.exec(r);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],`
|
|
122
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:T(e[0],`
|
|
123
|
+
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=T(e[0],`
|
|
124
124
|
`).split(`
|
|
125
125
|
`),s="",i="",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(`
|
|
126
|
-
`),
|
|
126
|
+
`),p=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
127
127
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
128
128
|
${c}`:c,i=i?`${i}
|
|
129
|
-
${
|
|
130
|
-
`),S=
|
|
131
|
-
`+
|
|
132
|
-
${
|
|
129
|
+
${p}`:p;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,n,!0),this.lexer.state.top=d,t.length===0)break;let f=n.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let v=f,b=t.join(`
|
|
130
|
+
`),S=v.raw+`
|
|
131
|
+
`+b.replace(this.rules.other.blockquoteSetextReplace2,""),j=this.blockquote(S);n[n.length-1]=j,s=`${s}
|
|
132
|
+
${b}`,i=i.substring(0,i.length-v.text.length)+j.text;break}else if(f?.type==="list"){let v=f,b=v.raw+`
|
|
133
133
|
`+t.join(`
|
|
134
|
-
`),S=this.list(
|
|
135
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,c="",
|
|
136
|
-
`,1)[0],e[1].length),
|
|
137
|
-
`,1)[0],
|
|
138
|
-
`,r=r.substring(
|
|
139
|
-
`,1)[0],
|
|
140
|
-
`+
|
|
141
|
-
`+
|
|
142
|
-
`,r=r.substring(
|
|
143
|
-
`),href:s,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=
|
|
144
|
-
`):[],n={type:"table",raw:
|
|
145
|
-
`),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 i)n.rows.push(
|
|
134
|
+
`),S=this.list(b);n[n.length-1]=S,s=s.substring(0,s.length-f.raw.length)+S.raw,i=i.substring(0,i.length-v.raw.length)+S.raw,t=b.substring(n.at(-1).raw.length).split(`
|
|
135
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:n,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let n=this.rules.other.listItemRegex(t),o=!1;for(;r;){let l=!1,c="",p="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let d=li(e[2].split(`
|
|
136
|
+
`,1)[0],e[1].length),f=r.split(`
|
|
137
|
+
`,1)[0],v=!d.trim(),b=0;if(this.options.pedantic?(b=2,p=d.trimStart()):v?b=e[1].length+1:(b=d.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=d.slice(b),b+=e[1].length),v&&this.rules.other.blankLine.test(f)&&(c+=f+`
|
|
138
|
+
`,r=r.substring(f.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(b),j=this.rules.other.hrRegex(b),Oe=this.rules.other.fencesBeginRegex(b),Me=this.rules.other.headingBeginRegex(b),It=this.rules.other.htmlBeginRegex(b),Dt=this.rules.other.blockquoteBeginRegex(b);for(;r;){let he=r.split(`
|
|
139
|
+
`,1)[0],H;if(f=he,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),H=f):H=f.replace(this.rules.other.tabCharGlobal," "),Oe.test(f)||Me.test(f)||It.test(f)||Dt.test(f)||S.test(f)||j.test(f))break;if(H.search(this.rules.other.nonSpaceChar)>=b||!f.trim())p+=`
|
|
140
|
+
`+H.slice(b);else{if(v||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Oe.test(d)||Me.test(d)||j.test(d))break;p+=`
|
|
141
|
+
`+f}v=!f.trim(),c+=he+`
|
|
142
|
+
`,r=r.substring(he.length+1),d=H.slice(b)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!i.loose){let c=l.tokens.filter(d=>d.type==="space"),p=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=p}for(let l of i.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 d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}else l.task&&(l.task=!1)}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=st(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:T(e[0],`
|
|
143
|
+
`),href:s,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=tt(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
144
|
+
`):[],n={type:"table",raw:T(e[0],`
|
|
145
|
+
`),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 i)n.rows.push(tt(o,n.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[l]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:T(e[0],`
|
|
146
146
|
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
147
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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(r){let e=this.rules.inline.link.exec(r);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=
|
|
148
|
-
`),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(
|
|
147
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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(r){let e=this.rules.inline.link.exec(r);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=ai(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],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),it(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return it(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,l=0,c=s[0][0],p=t===c,d=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*r.length+i);(s=d.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(i%3&&!((i+o)%3)){l+=o;continue}if(p)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let f=[...s[0]][0].length,v=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let S=v.slice(1,-1);return{type:"em",raw:v,text:S,tokens:this.lexer.inlineTokens(S)}}let b=v.slice(2,-2);return{type:"strong",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+i);(s=l.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,p=r.slice(0,i+s.index+c+o),d=p.slice(i,-i);return{type:"del",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);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(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},$=class xe{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 ie,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:k,block:X.normal,inline:K.normal};this.options.pedantic?(t.block=X.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=X.gfm,this.options.breaks?t.inline=K.breaks:t.inline=K.gfm),this.tokenizer.rules=t}static get rules(){return{block:X,inline:K}}static lex(e,t){return new xe(t).lex(e)}static lexInline(e,t){return new xe(t).inlineTokens(e)}lex(e){e=e.replace(k.carriageReturn,`
|
|
148
|
+
`),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(k.tabCharGlobal," ").replace(k.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=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+=`
|
|
149
149
|
`: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(`
|
|
150
150
|
`)?"":`
|
|
151
151
|
`)+n.raw,a.text+=`
|
|
152
152
|
`+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(`
|
|
153
153
|
`)?"":`
|
|
154
154
|
`)+n.raw,a.text+=`
|
|
155
|
-
`+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(
|
|
155
|
+
`+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(`
|
|
156
156
|
`)?"":`
|
|
157
157
|
`)+n.raw,a.text+=`
|
|
158
158
|
`+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(`
|
|
159
159
|
`)?"":`
|
|
160
160
|
`)+n.raw,a.text+=`
|
|
161
|
-
`+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
|
|
162
|
-
`;return s?'<pre><code class="language-'+
|
|
163
|
-
`:"<pre><code>"+(t?i:
|
|
161
|
+
`+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 i=!1,n="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(n=""),i=!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),d;this.options.extensions.startInline.forEach(f=>{d=f.call({lexer:this},p),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),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)),i=!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)}},re=class{options;parser;constructor(r){this.options=r||M}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(k.notSpaceStart)?.[0],i=r.replace(k.endingNewline,"")+`
|
|
162
|
+
`;return s?'<pre><code class="language-'+C(s)+'">'+(t?i:C(i,!0))+`</code></pre>
|
|
163
|
+
`:"<pre><code>"+(t?i:C(i,!0))+`</code></pre>
|
|
164
164
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
165
165
|
${this.parser.parse(r)}</blockquote>
|
|
166
166
|
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
@@ -176,16 +176,16 @@ ${this.parser.parse(r)}</blockquote>
|
|
|
176
176
|
`}tablerow({text:r}){return`<tr>
|
|
177
177
|
${r}</tr>
|
|
178
178
|
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
179
|
-
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${
|
|
180
|
-
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+
|
|
179
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${C(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=et(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+C(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=et(r);if(i===null)return C(t);r=i;let n=`<img src="${r}" alt="${C(t)}"`;return e&&(n+=` title="${C(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:C(r.text)}},De=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},w=class ve{options;renderer;textRenderer;constructor(e){this.options=e||M,this.options.renderer=this.options.renderer||new re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new De}static parse(e,t){return new ve(t).parse(e)}static parseInline(e,t){return new ve(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;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 i=0;i<e.length;i++){let n=e[i];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}},Z=class{options;block;constructor(r){this.options=r||M}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?$.lex:$.lexInline}provideParser(r=this.block){return r?w.parse:w.parseInline}},hi=class{defaults=Te();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=w;Renderer=re;TextRenderer=De;Lexer=$;Tokenizer=ie;Hooks=Z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let o=i[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new re(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===!1&&(p=l.apply(i,c)),p||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new ie(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===!1&&(p=l.apply(i,c)),p}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Z;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],l=i[o];Z.passThroughHooks.has(n)?i[o]=c=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let d=await a.call(i,c);return l.call(i,d)})();let p=a.call(i,c);return l.call(i,p)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(i,c);return d===!1&&(d=await l.apply(i,c)),d})();let p=a.apply(i,c);return p===!1&&(p=l.apply(i,c)),p}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return $.lex(r,e??this.defaults)}parser(r,e){return w.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.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(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?$.lex:$.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser(r):r?w.parse:w.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?$.lex:$.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?w.parse:w.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
|
|
180
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+C(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new hi;function x(r,e){return D.parse(r,e)}x.options=x.setOptions=function(r){return D.setOptions(r),x.defaults=D.defaults,kt(x.defaults),x};x.getDefaults=Te;x.defaults=M;function di(...r){return D.use(...r),x.defaults=D.defaults,kt(x.defaults),x}x.use=di;x.walkTokens=function(r,e){return D.walkTokens(r,e)};x.parseInline=D.parseInline;x.Parser=w;x.parser=w.parse;x.Renderer=re;x.TextRenderer=De;x.Lexer=$;x.lexer=$.lex;x.Tokenizer=ie;x.Hooks=Z;x.parse=x;x.options;x.setOptions;x.walkTokens;x.parseInline;w.parse;$.lex;/**
|
|
181
181
|
* @license
|
|
182
182
|
* Copyright 2017 Google LLC
|
|
183
183
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
184
|
-
*/const
|
|
184
|
+
*/const pi={CHILD:2},ui=r=>(...e)=>({_$litDirective$:r,values:e});class fi{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)}}/**
|
|
185
185
|
* @license
|
|
186
186
|
* Copyright 2017 Google LLC
|
|
187
187
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
188
|
-
*/class
|
|
188
|
+
*/class ke extends fi{constructor(e){if(super(e),this.it=m,e.type!==pi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===m||e==null)return this._t=void 0,this.it=e;if(e===I)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:[]}}}ke.directiveName="unsafeHTML",ke.resultType=1;const gi=ui(ke);let rt=0;class bi extends _{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#n;#r;static{this.styles=O`
|
|
189
189
|
:host {
|
|
190
190
|
display: inline-block;
|
|
191
191
|
position: relative;
|
|
@@ -299,8 +299,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
299
299
|
.option input { margin: 0; pointer-events: none; }
|
|
300
300
|
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
301
301
|
.create-option { color: var(--accent); font-style: italic; }
|
|
302
|
-
`}constructor(){super(),new
|
|
303
|
-
<div class="field" style=${`anchor-name: ${this.#
|
|
302
|
+
`}constructor(){super(),new le(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++rt}`,this.#r=`tag-multiselect-listbox-${rt}`}willUpdate(){this.style.width=this.width??""}#g=e=>{e.composedPath().includes(this)||this.#c()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#g)}disconnectedCallback(){document.removeEventListener("click",this.#g),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#c(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#u(){this.#t.value?this.#c():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#d(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#o(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#f(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#b(e){const t=this.#l;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#d(s)):this.#o&&(e.preventDefault(),this.#d(this.#e.value.trim()))}else if(e.key==="Backspace"&&!this.#e.value&&this.active.length>0){const s=this.active[this.active.length-1];s!==void 0&&this.onToggle(s)}else e.key==="Escape"&&this.#c()}render(){const e=this.active,t=this.#l,s=this.#t.value,i=this.#s.value;return h`
|
|
303
|
+
<div class="field" style=${`anchor-name: ${this.#n}`}>
|
|
304
304
|
<div class="chips-and-input">
|
|
305
305
|
${e.map(n=>h`
|
|
306
306
|
<span class="selected-chip">
|
|
@@ -313,13 +313,13 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
313
313
|
role="combobox"
|
|
314
314
|
aria-autocomplete="list"
|
|
315
315
|
aria-expanded=${s}
|
|
316
|
-
aria-controls=${this.#
|
|
317
|
-
aria-activedescendant=${i>=0?`${this.#
|
|
316
|
+
aria-controls=${this.#r}
|
|
317
|
+
aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
|
|
318
318
|
placeholder=${e.length===0?"Filter by tag…":""}
|
|
319
319
|
.value=${this.#e.value}
|
|
320
|
-
@input=${n=>this.#
|
|
321
|
-
@focus=${()=>this.#
|
|
322
|
-
@click=${()=>this.#
|
|
320
|
+
@input=${n=>this.#h(n)}
|
|
321
|
+
@focus=${()=>this.#i()}
|
|
322
|
+
@click=${()=>this.#i()}
|
|
323
323
|
@keydown=${n=>this.#b(n)}
|
|
324
324
|
/>
|
|
325
325
|
</div>
|
|
@@ -328,43 +328,43 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
328
328
|
class="chevron-btn ${s?"open":""}"
|
|
329
329
|
tabindex="-1"
|
|
330
330
|
@mousedown=${n=>n.preventDefault()}
|
|
331
|
-
@click=${()=>this.#
|
|
331
|
+
@click=${()=>this.#u()}
|
|
332
332
|
>
|
|
333
333
|
▾
|
|
334
334
|
</button>
|
|
335
335
|
</div>
|
|
336
336
|
|
|
337
337
|
<ul
|
|
338
|
-
id=${this.#
|
|
338
|
+
id=${this.#r}
|
|
339
339
|
class="menu ${s?"visible":""}"
|
|
340
340
|
role="listbox"
|
|
341
341
|
aria-multiselectable="true"
|
|
342
342
|
popover="manual"
|
|
343
|
-
style=${`position-anchor: ${this.#
|
|
343
|
+
style=${`position-anchor: ${this.#n}`}
|
|
344
344
|
>
|
|
345
345
|
${t.length?t.map((n,o)=>h`
|
|
346
346
|
<li
|
|
347
|
-
id=${`${this.#
|
|
347
|
+
id=${`${this.#r}-opt-${o}`}
|
|
348
348
|
role="option"
|
|
349
349
|
aria-selected=${e.includes(n)}
|
|
350
350
|
class=${o===i?"option highlighted":"option"}
|
|
351
351
|
@mousedown=${a=>a.preventDefault()}
|
|
352
|
-
@click=${()=>this.#
|
|
352
|
+
@click=${()=>this.#d(n)}
|
|
353
353
|
>
|
|
354
354
|
<input type="checkbox" .checked=${e.includes(n)} tabindex="-1" />
|
|
355
355
|
${n}
|
|
356
356
|
</li>
|
|
357
|
-
`):this.#
|
|
357
|
+
`):this.#o?h`
|
|
358
358
|
<li
|
|
359
359
|
class="option create-option"
|
|
360
360
|
@mousedown=${n=>n.preventDefault()}
|
|
361
|
-
@click=${()=>this.#
|
|
361
|
+
@click=${()=>this.#d(this.#e.value.trim())}
|
|
362
362
|
>
|
|
363
363
|
No match. Create '${this.#e.value.trim()}'
|
|
364
364
|
</li>
|
|
365
365
|
`:h`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
|
|
366
366
|
</ul>
|
|
367
|
-
`}}customElements.define("tag-multiselect",
|
|
367
|
+
`}}customElements.define("tag-multiselect",bi);let nt=0;class mi extends _{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new u("");#t=new u(!1);#s=new u(-1);#n;#r;static{this.styles=O`
|
|
368
368
|
:host {
|
|
369
369
|
display: inline-block;
|
|
370
370
|
position: relative;
|
|
@@ -451,65 +451,65 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
451
451
|
.option.selected { font-weight: 600; }
|
|
452
452
|
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
453
453
|
.create-option { color: var(--accent); font-style: italic; }
|
|
454
|
-
`}constructor(){super(),new
|
|
455
|
-
<div class="field" style=${`anchor-name: ${this.#
|
|
454
|
+
`}constructor(){super(),new le(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++nt}`,this.#r=`status-select-listbox-${nt}`}#g=e=>{e.composedPath().includes(this)||this.#c()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#g)}disconnectedCallback(){document.removeEventListener("click",this.#g),super.disconnectedCallback()}get#l(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#c(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#u(){this.#t.value?this.#c():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#h(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#d(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#o(e){const t=this.#d(e);if(!t)return this.#c();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#c()}get#f(){const e=this.#d(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#b(){return this.#l.length+(this.#f?1:0)}#y(e){const t=this.#b;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#l,i=s[this.#s.value];i!==void 0?this.#o(i):this.#s.value===s.length&&this.#f?this.#o(this.#e.value):this.#e.value.trim()&&this.#o(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#c())}render(){const e=this.value,t=this.#l,s=this.#t.value,i=this.#s.value;return h`
|
|
455
|
+
<div class="field" style=${`anchor-name: ${this.#n}`}>
|
|
456
456
|
<input
|
|
457
457
|
class="input"
|
|
458
458
|
role="combobox"
|
|
459
459
|
aria-autocomplete="list"
|
|
460
460
|
aria-expanded=${s}
|
|
461
|
-
aria-controls=${this.#
|
|
462
|
-
aria-activedescendant=${i>=0?`${this.#
|
|
461
|
+
aria-controls=${this.#r}
|
|
462
|
+
aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
|
|
463
463
|
.value=${s?this.#e.value:e}
|
|
464
|
-
@input=${n=>this.#
|
|
465
|
-
@focus=${()=>this.#
|
|
466
|
-
@click=${()=>this.#
|
|
467
|
-
@keydown=${n=>this.#
|
|
468
|
-
@blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#
|
|
464
|
+
@input=${n=>this.#h(n)}
|
|
465
|
+
@focus=${()=>this.#i()}
|
|
466
|
+
@click=${()=>this.#i()}
|
|
467
|
+
@keydown=${n=>this.#y(n)}
|
|
468
|
+
@blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#d(this.#e.value)!==e?this.#o(this.#e.value):this.#c()}}
|
|
469
469
|
/>
|
|
470
470
|
<button
|
|
471
471
|
class="chevron-btn ${s?"open":""}"
|
|
472
472
|
tabindex="-1"
|
|
473
473
|
@mousedown=${n=>n.preventDefault()}
|
|
474
|
-
@click=${()=>this.#
|
|
474
|
+
@click=${()=>this.#u()}
|
|
475
475
|
>
|
|
476
476
|
▾
|
|
477
477
|
</button>
|
|
478
478
|
</div>
|
|
479
479
|
|
|
480
480
|
<ul
|
|
481
|
-
id=${this.#
|
|
481
|
+
id=${this.#r}
|
|
482
482
|
class="menu ${s?"visible":""}"
|
|
483
483
|
role="listbox"
|
|
484
484
|
popover="manual"
|
|
485
|
-
style=${`position-anchor: ${this.#
|
|
485
|
+
style=${`position-anchor: ${this.#n}`}
|
|
486
486
|
>
|
|
487
487
|
${t.map((n,o)=>h`
|
|
488
488
|
<li
|
|
489
|
-
id=${`${this.#
|
|
489
|
+
id=${`${this.#r}-opt-${o}`}
|
|
490
490
|
role="option"
|
|
491
491
|
aria-selected=${n===e}
|
|
492
492
|
class=${`option ${n===e?"selected":""} ${o===i?"highlighted":""}`}
|
|
493
493
|
@mousedown=${a=>a.preventDefault()}
|
|
494
|
-
@click=${()=>this.#
|
|
494
|
+
@click=${()=>this.#o(n)}
|
|
495
495
|
>
|
|
496
496
|
${n}
|
|
497
497
|
</li>
|
|
498
498
|
`)}
|
|
499
499
|
${this.#f?h`
|
|
500
500
|
<li
|
|
501
|
-
id=${`${this.#
|
|
501
|
+
id=${`${this.#r}-opt-${t.length}`}
|
|
502
502
|
role="option"
|
|
503
503
|
class=${`option create-option ${t.length===i?"highlighted":""}`}
|
|
504
504
|
@mousedown=${n=>n.preventDefault()}
|
|
505
|
-
@click=${()=>this.#
|
|
505
|
+
@click=${()=>this.#o(this.#e.value)}
|
|
506
506
|
>
|
|
507
|
-
${t.length?"Create":"No match. Create"} '${this.#
|
|
507
|
+
${t.length?"Create":"No match. Create"} '${this.#d(this.#e.value)}'
|
|
508
508
|
</li>
|
|
509
509
|
`:""}
|
|
510
510
|
${!t.length&&!this.#f?h`<li class="empty">No options</li>`:""}
|
|
511
511
|
</ul>
|
|
512
|
-
`}}customElements.define("status-select",
|
|
512
|
+
`}}customElements.define("status-select",mi);let xi=0;const vi={top:"top: auto; bottom: anchor(top); left: anchor(center); right: auto; translate: -50% 0; margin-top: 0; margin-bottom: 6px;",bottom:"top: anchor(bottom); bottom: auto; left: anchor(center); right: auto; translate: -50% 0; margin-top: 6px; margin-bottom: 0;",left:"top: anchor(center); bottom: auto; left: auto; right: anchor(left); translate: 0 -50%; margin-right: 6px;",right:"top: anchor(center); bottom: auto; left: anchor(right); right: auto; translate: 0 -50%; margin-left: 6px;"},ki=["top","bottom","left","right"];class yi extends _{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=O`
|
|
513
513
|
:host {
|
|
514
514
|
display: inline-flex;
|
|
515
515
|
position: relative;
|
|
@@ -593,29 +593,29 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
593
593
|
translate: 0 -50%;
|
|
594
594
|
margin: 0 0 0 6px;
|
|
595
595
|
}
|
|
596
|
-
`}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++
|
|
596
|
+
`}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++xi}`}get#s(){const e=ki.filter(t=>t!==this.placement);return[this.placement,...e].map(t=>`--bubble-${t}`).join(", ")}disconnectedCallback(){this.#t&&clearTimeout(this.#t),super.disconnectedCallback()}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null);const e=this.renderRoot.querySelector(".bubble");e&&!e.matches(":popover-open")&&e.showPopover()}#r(){this.#t=setTimeout(()=>{this.renderRoot.querySelector(".bubble")?.hidePopover()},100)}render(){return h`
|
|
597
597
|
<button
|
|
598
598
|
type="button"
|
|
599
599
|
class="icon"
|
|
600
600
|
style=${`anchor-name: ${this.#e}`}
|
|
601
601
|
aria-describedby="bubble"
|
|
602
|
-
@mouseenter=${()=>this.#
|
|
603
|
-
@mouseleave=${()=>this.#
|
|
604
|
-
@focus=${()=>this.#
|
|
605
|
-
@blur=${()=>this.#
|
|
602
|
+
@mouseenter=${()=>this.#n()}
|
|
603
|
+
@mouseleave=${()=>this.#r()}
|
|
604
|
+
@focus=${()=>this.#n()}
|
|
605
|
+
@blur=${()=>this.#r()}
|
|
606
606
|
>?</button>
|
|
607
607
|
<div
|
|
608
608
|
id="bubble"
|
|
609
609
|
role="tooltip"
|
|
610
610
|
class="bubble"
|
|
611
611
|
popover="manual"
|
|
612
|
-
style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${
|
|
613
|
-
@mouseenter=${()=>this.#
|
|
614
|
-
@mouseleave=${()=>this.#
|
|
612
|
+
style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${vi[this.placement]}`}
|
|
613
|
+
@mouseenter=${()=>this.#n()}
|
|
614
|
+
@mouseleave=${()=>this.#r()}
|
|
615
615
|
>
|
|
616
616
|
${this.text}
|
|
617
617
|
</div>
|
|
618
|
-
`}}customElements.define("help-tooltip",
|
|
618
|
+
`}}customElements.define("help-tooltip",yi);const ot="mem-bucket-detail-view-mode";function $i(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const wi=["stable","beta","unreviewed"],_i=["active","shipped","abandoned"],at=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Si=["ticket","freeform"],y={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function lt(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ci extends _{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ot)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue=""}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0}}}static{this.styles=O`
|
|
619
619
|
:host { display: block; padding: 16px; }
|
|
620
620
|
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
621
621
|
.title-row {
|
|
@@ -902,129 +902,129 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
902
902
|
color: inherit;
|
|
903
903
|
}
|
|
904
904
|
.hint { font-size: 11px; opacity: 0.6; }
|
|
905
|
-
`}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return;const n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(
|
|
905
|
+
`}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok)return;const n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ot,e)}async#n(){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#g(){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?.()}#l(){this._doc&&(this._draft=lt(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#i(){this._doc&&(this._draft=lt(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#c(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#u(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#h(e){this._draft&&(this._draft={...this._draft,...e})}#d(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#h({tags:t})}#o(e){if(!this._draft)return;const t=this._draft.trigger_phrases.includes(e)?this._draft.trigger_phrases.filter(s=>s!==e):[...this._draft.trigger_phrases,e];this.#h({trigger_phrases:t})}async#f(){if(!this._draft||!this.selected)return;const{table:e,id:t}=this.selected,s=e==="skills",i={description:this._draft.description,tags:this._draft.tags,status:this._draft.status};s?(i.owner=this._draft.owner||null,i.extends=this._draft.extends||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const n=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!n.ok){const o=await n.json().catch(()=>({}));window.alert(`Save failed: ${o.error??n.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#b(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
|
|
906
906
|
|
|
907
|
-
This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#
|
|
907
|
+
This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#y(){this._doc&&(this._renameValue=this._doc.name??"",this._renaming=!0)}async#x(){if(!this._doc||!this._renameValue.trim())return;const e=this._renameValue.trim();if(e===this._doc.name){this._renaming=!1;return}const t=await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:e})});if(!t.ok){const s=await t.json().catch(()=>({}));window.alert(`Rename failed: ${s.error??t.statusText}`);return}this._renaming=!1,this.selected={table:"skills",id:e},await this.#e(),this.onChanged?.()}#k(){return h`
|
|
908
908
|
<div class="edit-form">
|
|
909
909
|
<div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
|
|
910
910
|
<div class="field">
|
|
911
|
-
<label>doc_type <help-tooltip .text=${
|
|
911
|
+
<label>doc_type <help-tooltip .text=${y.doc_type}></help-tooltip></label>
|
|
912
912
|
<select
|
|
913
913
|
@change=${e=>this.#c(e.target.value)}
|
|
914
914
|
>
|
|
915
915
|
<option value="" selected disabled>Choose…</option>
|
|
916
|
-
${
|
|
916
|
+
${at.map(e=>h`<option value=${e}>${e}</option>`)}
|
|
917
917
|
</select>
|
|
918
918
|
</div>
|
|
919
919
|
<div class="form-actions">
|
|
920
|
-
<button class="cancel" @click=${()=>this.#
|
|
920
|
+
<button class="cancel" @click=${()=>this.#u()}>Cancel</button>
|
|
921
921
|
</div>
|
|
922
922
|
</div>
|
|
923
923
|
`}#v(e){const t=this._draft,s=this.facets;return h`
|
|
924
924
|
<div class="edit-form">
|
|
925
925
|
${e?h`
|
|
926
926
|
<div class="field">
|
|
927
|
-
<label>name <help-tooltip .text=${
|
|
927
|
+
<label>name <help-tooltip .text=${y.name}></help-tooltip></label>
|
|
928
928
|
<div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
|
|
929
929
|
</div>
|
|
930
930
|
`:h`
|
|
931
931
|
<div class="field-row">
|
|
932
932
|
<div class="field">
|
|
933
|
-
<label>key <help-tooltip .text=${
|
|
933
|
+
<label>key <help-tooltip .text=${y.key}></help-tooltip></label>
|
|
934
934
|
<input
|
|
935
935
|
type="text"
|
|
936
936
|
.value=${t.key}
|
|
937
|
-
@input=${i=>this.#
|
|
937
|
+
@input=${i=>this.#h({key:i.target.value})}
|
|
938
938
|
/>
|
|
939
939
|
</div>
|
|
940
940
|
<div class="field">
|
|
941
|
-
<label>key_type <help-tooltip .text=${
|
|
941
|
+
<label>key_type <help-tooltip .text=${y.key_type}></help-tooltip></label>
|
|
942
942
|
<select
|
|
943
943
|
.value=${t.key_type}
|
|
944
|
-
@change=${i=>this.#
|
|
944
|
+
@change=${i=>this.#h({key_type:i.target.value})}
|
|
945
945
|
>
|
|
946
|
-
${
|
|
946
|
+
${Si.map(i=>h`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
|
|
947
947
|
</select>
|
|
948
948
|
</div>
|
|
949
949
|
</div>
|
|
950
950
|
<div class="field">
|
|
951
|
-
<label>doc_type <help-tooltip .text=${
|
|
951
|
+
<label>doc_type <help-tooltip .text=${y.doc_type}></help-tooltip></label>
|
|
952
952
|
<select
|
|
953
953
|
.value=${t.doc_type}
|
|
954
|
-
@change=${i=>this.#
|
|
954
|
+
@change=${i=>this.#h({doc_type:i.target.value})}
|
|
955
955
|
>
|
|
956
|
-
${
|
|
956
|
+
${at.map(i=>h`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
|
|
957
957
|
</select>
|
|
958
958
|
</div>
|
|
959
959
|
`}
|
|
960
960
|
<div class="field">
|
|
961
|
-
<label>description <help-tooltip .text=${
|
|
961
|
+
<label>description <help-tooltip .text=${y.description}></help-tooltip></label>
|
|
962
962
|
<textarea
|
|
963
963
|
.value=${t.description}
|
|
964
|
-
@input=${i=>this.#
|
|
964
|
+
@input=${i=>this.#h({description:i.target.value})}
|
|
965
965
|
></textarea>
|
|
966
966
|
</div>
|
|
967
967
|
<div class="field">
|
|
968
|
-
<label>tags <help-tooltip .text=${
|
|
968
|
+
<label>tags <help-tooltip .text=${y.tags}></help-tooltip></label>
|
|
969
969
|
<tag-multiselect
|
|
970
970
|
.tags=${s?.tags??[]}
|
|
971
971
|
.active=${t.tags}
|
|
972
972
|
.allowCreate=${!0}
|
|
973
|
-
.onToggle=${i=>this.#
|
|
973
|
+
.onToggle=${i=>this.#d(i)}
|
|
974
974
|
></tag-multiselect>
|
|
975
975
|
</div>
|
|
976
976
|
<div class="field">
|
|
977
|
-
<label>status <help-tooltip .text=${
|
|
977
|
+
<label>status <help-tooltip .text=${y.status}></help-tooltip></label>
|
|
978
978
|
<status-select
|
|
979
|
-
.options=${[...new Set([...e?
|
|
979
|
+
.options=${[...new Set([...e?wi:_i,...s?.statuses??[]])]}
|
|
980
980
|
.value=${t.status}
|
|
981
|
-
.onChange=${i=>this.#
|
|
981
|
+
.onChange=${i=>this.#h({status:i})}
|
|
982
982
|
></status-select>
|
|
983
983
|
</div>
|
|
984
984
|
${e?h`
|
|
985
985
|
<div class="field-row">
|
|
986
986
|
<div class="field">
|
|
987
|
-
<label>owner <help-tooltip .text=${
|
|
987
|
+
<label>owner <help-tooltip .text=${y.owner}></help-tooltip></label>
|
|
988
988
|
<input
|
|
989
989
|
type="text"
|
|
990
990
|
.value=${t.owner}
|
|
991
|
-
@input=${i=>this.#
|
|
991
|
+
@input=${i=>this.#h({owner:i.target.value})}
|
|
992
992
|
/>
|
|
993
993
|
</div>
|
|
994
994
|
<div class="field">
|
|
995
|
-
<label>extends <help-tooltip .text=${
|
|
995
|
+
<label>extends <help-tooltip .text=${y.extends}></help-tooltip></label>
|
|
996
996
|
<input
|
|
997
997
|
type="text"
|
|
998
998
|
.value=${t.extends}
|
|
999
|
-
@input=${i=>this.#
|
|
999
|
+
@input=${i=>this.#h({extends:i.target.value})}
|
|
1000
1000
|
/>
|
|
1001
1001
|
</div>
|
|
1002
1002
|
</div>
|
|
1003
1003
|
<div class="field">
|
|
1004
|
-
<label>trigger_phrases <help-tooltip .text=${
|
|
1004
|
+
<label>trigger_phrases <help-tooltip .text=${y.trigger_phrases}></help-tooltip></label>
|
|
1005
1005
|
<tag-multiselect
|
|
1006
1006
|
.tags=${[]}
|
|
1007
1007
|
.active=${t.trigger_phrases}
|
|
1008
1008
|
.allowCreate=${!0}
|
|
1009
|
-
.onToggle=${i=>this.#
|
|
1009
|
+
.onToggle=${i=>this.#o(i)}
|
|
1010
1010
|
></tag-multiselect>
|
|
1011
1011
|
</div>
|
|
1012
1012
|
`:h`
|
|
1013
1013
|
<div class="field">
|
|
1014
|
-
<label>related_to <help-tooltip .text=${
|
|
1014
|
+
<label>related_to <help-tooltip .text=${y.related_to}></help-tooltip></label>
|
|
1015
1015
|
<input
|
|
1016
1016
|
type="text"
|
|
1017
1017
|
.value=${t.related_to}
|
|
1018
|
-
@input=${i=>this.#
|
|
1018
|
+
@input=${i=>this.#h({related_to:i.target.value})}
|
|
1019
1019
|
/>
|
|
1020
1020
|
</div>
|
|
1021
1021
|
`}
|
|
1022
1022
|
<div class="form-actions">
|
|
1023
1023
|
<button class="save" @click=${()=>this.#f()}>Save</button>
|
|
1024
|
-
<button class="cancel" @click=${()=>this.#
|
|
1024
|
+
<button class="cancel" @click=${()=>this.#u()}>Cancel</button>
|
|
1025
1025
|
</div>
|
|
1026
1026
|
</div>
|
|
1027
|
-
`}#
|
|
1027
|
+
`}#m(e,t){const s=t?void 0:e.key;return h`
|
|
1028
1028
|
<div class="title-row">
|
|
1029
1029
|
<h2>
|
|
1030
1030
|
${s?h`<button class="title-link" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
|
|
@@ -1035,7 +1035,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1035
1035
|
📁 ${e.folder}
|
|
1036
1036
|
</button>
|
|
1037
1037
|
</div>
|
|
1038
|
-
`}#
|
|
1038
|
+
`}#p(e,t){const s=e.created_at?$i(e.created_at):null;return h`
|
|
1039
1039
|
<dl class="info-grid">
|
|
1040
1040
|
<dt>Description</dt>
|
|
1041
1041
|
<dd class="description">${e.description||"—"}</dd>
|
|
@@ -1051,16 +1051,16 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1051
1051
|
${e.deprecated||e.paused?h`
|
|
1052
1052
|
<dt>Flags</dt>
|
|
1053
1053
|
<dd>
|
|
1054
|
-
${e.deprecated?h`<span class="pill warn-pill">deprecated</span>`:
|
|
1055
|
-
${e.paused?h`<span class="pill muted-pill">paused</span>`:
|
|
1054
|
+
${e.deprecated?h`<span class="pill warn-pill">deprecated</span>`:m}
|
|
1055
|
+
${e.paused?h`<span class="pill muted-pill">paused</span>`:m}
|
|
1056
1056
|
</dd>
|
|
1057
|
-
`:
|
|
1057
|
+
`:m}
|
|
1058
1058
|
|
|
1059
1059
|
${t?h`
|
|
1060
1060
|
${e.owner?h`<dt>Owner</dt>
|
|
1061
|
-
<dd>${e.owner}</dd>`:
|
|
1061
|
+
<dd>${e.owner}</dd>`:m}
|
|
1062
1062
|
${e.extends?h`<dt>Extends</dt>
|
|
1063
|
-
<dd>${e.extends}</dd>`:
|
|
1063
|
+
<dd>${e.extends}</dd>`:m}
|
|
1064
1064
|
`:h`
|
|
1065
1065
|
<dt>Key</dt>
|
|
1066
1066
|
<dd>
|
|
@@ -1076,7 +1076,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1076
1076
|
<dd>${e.doc_type}</dd>
|
|
1077
1077
|
|
|
1078
1078
|
${e.related_to?h`<dt>Related to</dt>
|
|
1079
|
-
<dd>${e.related_to}</dd>`:
|
|
1079
|
+
<dd>${e.related_to}</dd>`:m}
|
|
1080
1080
|
`}
|
|
1081
1081
|
|
|
1082
1082
|
<dt>Created</dt>
|
|
@@ -1086,7 +1086,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1086
1086
|
>`:h`<span class="hint">unknown</span>`}
|
|
1087
1087
|
</dd>
|
|
1088
1088
|
</dl>
|
|
1089
|
-
`}
|
|
1089
|
+
`}#$(e,t){const s=new x.Renderer,i=s.link.bind(s);return s.link=n=>{if(typeof n.href=="string"&&n.href.startsWith("attachment://")){const o=n.href.slice(13);return i({...n,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(n)},s}#w(e,t){return e.attachments?.length?h`
|
|
1090
1090
|
<div class="attachments-section">
|
|
1091
1091
|
<h4>Attachments</h4>
|
|
1092
1092
|
<ul>
|
|
@@ -1106,19 +1106,19 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1106
1106
|
`)}
|
|
1107
1107
|
</ul>
|
|
1108
1108
|
</div>
|
|
1109
|
-
`:
|
|
1110
|
-
${this.#
|
|
1111
|
-
${i?h`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#
|
|
1112
|
-
${s?
|
|
1109
|
+
`:m}render(){if(!this.selected)return h`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return m;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?h`${this.#m(e,t)}${this.#k()}`:this._editing&&this._draft?h`${this.#m(e,t)}${this.#v(t)}`:h`
|
|
1110
|
+
${this.#m(e,t)}
|
|
1111
|
+
${i?h`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#p(e,t)}
|
|
1112
|
+
${s?m:h`
|
|
1113
1113
|
<div class="actions">
|
|
1114
|
-
${i?h`<button class="primary" @click=${()=>this.#
|
|
1115
|
-
<button @click=${()=>this.#
|
|
1116
|
-
${t?h`<button @click=${()=>this.#
|
|
1117
|
-
<button @click=${()=>this.#
|
|
1118
|
-
<button @click=${()=>this.#
|
|
1119
|
-
${t?
|
|
1114
|
+
${i?h`<button class="primary" @click=${()=>this.#i()}>Add frontmatter</button>`:h`
|
|
1115
|
+
<button @click=${()=>this.#l()}>Edit</button>
|
|
1116
|
+
${t?h`<button @click=${()=>this.#y()}>Rename</button>`:m}
|
|
1117
|
+
<button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
|
|
1118
|
+
<button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
|
|
1119
|
+
${t?m:h`<button class="danger" @click=${()=>this.#b()}>Delete frontmatter</button>`}
|
|
1120
1120
|
`}
|
|
1121
|
-
<button class="danger" @click=${()=>this.#
|
|
1121
|
+
<button class="danger" @click=${()=>this.#g()}>Delete</button>
|
|
1122
1122
|
</div>
|
|
1123
1123
|
${this._renaming?h`
|
|
1124
1124
|
<div class="rename-row">
|
|
@@ -1126,14 +1126,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1126
1126
|
type="text"
|
|
1127
1127
|
.value=${this._renameValue}
|
|
1128
1128
|
@input=${n=>this._renameValue=n.target.value}
|
|
1129
|
-
@keydown=${n=>n.key==="Enter"&&this.#
|
|
1129
|
+
@keydown=${n=>n.key==="Enter"&&this.#x()}
|
|
1130
1130
|
/>
|
|
1131
|
-
<button @click=${()=>this.#
|
|
1131
|
+
<button @click=${()=>this.#x()}>Save</button>
|
|
1132
1132
|
<button @click=${()=>this._renaming=!1}>Cancel</button>
|
|
1133
1133
|
</div>
|
|
1134
|
-
`:
|
|
1134
|
+
`:m}
|
|
1135
1135
|
`}
|
|
1136
|
-
${this.#
|
|
1136
|
+
${this.#w(e,this.selected.table)}
|
|
1137
1137
|
<div class="view-toggle">
|
|
1138
1138
|
<button
|
|
1139
1139
|
class=${this._viewMode==="markdown"?"active":""}
|
|
@@ -1148,9 +1148,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1148
1148
|
Raw
|
|
1149
1149
|
</button>
|
|
1150
1150
|
</div>
|
|
1151
|
-
${this._viewMode==="markdown"?h`<div class="markdown-body">${
|
|
1151
|
+
${this._viewMode==="markdown"?h`<div class="markdown-body">${gi(x.parse(e.body??"",{async:!1,renderer:this.#$(this.selected.table,e.id)}))}</div>`:h`<pre>${e.raw_file??e.body}</pre>`}
|
|
1152
1152
|
<div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
|
|
1153
|
-
`}}customElements.define("detail-panel",
|
|
1153
|
+
`}}customElements.define("detail-panel",Ci);const ne="membkt";let ue;function ye(){return ue||(ue=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ue}class Ai extends _{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new u("skill");#t=new u("local");#s=new u("");#n=new u([]);#r=new u(null);#g=new u("");#l=new u("");#i=new u("");#c=new u(!1);#u=new u(!1);#h=new u(!1);#d=new u("");#o=new u("");#f=new u(!1);#b=new u("");#y=new u(!1);#x=new u("");#k=new u(!1);#v=new u(!1);#m=new u([]);#p=new u("");#$=new u(!1);#w;static{this.styles=O`
|
|
1154
1154
|
:host { display: block; }
|
|
1155
1155
|
.backdrop {
|
|
1156
1156
|
position: fixed; inset: 0; background: var(--overlay);
|
|
@@ -1233,8 +1233,160 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1233
1233
|
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
1234
1234
|
}
|
|
1235
1235
|
.error { color: var(--danger); font-size: 12px; }
|
|
1236
|
-
|
|
1237
|
-
|
|
1236
|
+
.source-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
|
|
1237
|
+
.source-toggle button {
|
|
1238
|
+
flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
|
|
1239
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
1240
|
+
}
|
|
1241
|
+
.source-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
|
|
1242
|
+
.ff-body { padding: 4px 20px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
|
|
1243
|
+
.ff-hint { font-size: 12px; opacity: 0.7; }
|
|
1244
|
+
.ff-connected-row {
|
|
1245
|
+
font-size: 12px; display: flex; align-items: center; gap: 6px; padding: 6px 0;
|
|
1246
|
+
}
|
|
1247
|
+
.ff-connected-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
|
|
1248
|
+
.ff-folder-list { border: 1px solid var(--border); border-radius: 6px; max-height: 220px; overflow-y: auto; }
|
|
1249
|
+
.ff-folder-entry {
|
|
1250
|
+
padding: 8px 12px; cursor: pointer; font-size: 13px; font-family: monospace;
|
|
1251
|
+
}
|
|
1252
|
+
.ff-folder-entry:hover { background: var(--hover); }
|
|
1253
|
+
.ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
|
|
1254
|
+
.ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
|
|
1255
|
+
.ff-widget-slot { display: flex; }
|
|
1256
|
+
`}constructor(){super(),new le(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#_()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#w)}async#_(e){const t=new URLSearchParams;e&&t.set("path",e),this.#u.value&&t.set("hidden","1");const s=await fetch(`/api/fs/list?${t.toString()}`);if(!s.ok){this.#i.set((await s.json()).error??"failed to list directory");return}const i=await s.json();this.#s.set(i.path),this.#r.set(i.parent),this.#n.set(i.entries),this.#i.set(""),this.renderRoot.querySelector(".browser")?.scrollTo(0,0)}#R(){this.#u.set(!this.#u.value),this.#_(this.#s.value)}#I(){this.#d.set(""),this.#h.set(!0)}#P(){this.#h.set(!1),this.#d.set("")}async#z(){const e=this.#d.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#h.set(!1),this.#d.set(""),await this.#_(this.#s.value)}catch(t){this.#i.set(t.message)}}}#D(){this.#g.set(this.#s.value),this.#l.value||this.#l.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#O(){const e=this.#g.value||this.#s.value;if(e){this.#c.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#c.set(!1)}}}async#M(){if(this.#k.value)return;const{folderfooMode:e,folderfooHost:t}=await ye();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#x.set(ne),this.#y.set(!0),this.#A(s))}async#L(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await dt(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#f.set(!0),this.#b.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#w=setInterval(()=>this.#S(),800),this.#S()}catch(e){this.#b.set(e.message)}}#S(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#k.value||(clearInterval(this.#w),this.#A(e))}async#A(e){this.#v.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#k.set(!0),this.#x.set(ne),await this.#F()}finally{this.#v.set(!1)}}async#F(){this.#$.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#x.value}),t=await fetch(`/api/folderfoo/folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folderfoo folders");return}this.#m.set(s)}finally{this.#$.set(!1)}}#N(e){this.#p.set(e),this.#l.value||this.#l.set(e.split("/").filter(Boolean).pop()??this.#x.value)}async#T(){if(this.#p.value){this.#c.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,server:this.#o.value,tenantId:this.#x.value,folderPath:this.#p.value})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded()}finally{this.#c.set(!1)}}}#q(){const e=this.#n.value;return h`
|
|
1257
|
+
<div class="breadcrumb-row">
|
|
1258
|
+
<div class="breadcrumb">${this.#s.value}</div>
|
|
1259
|
+
<button class="new-folder-btn" @click=${()=>this.#I()}>+ New folder</button>
|
|
1260
|
+
<label class="hidden-toggle">
|
|
1261
|
+
<input type="checkbox" .checked=${this.#u.value} @change=${()=>this.#R()} />
|
|
1262
|
+
Show hidden
|
|
1263
|
+
</label>
|
|
1264
|
+
</div>
|
|
1265
|
+
${this.#h.value?h`
|
|
1266
|
+
<div class="new-folder-row">
|
|
1267
|
+
<input
|
|
1268
|
+
type="text"
|
|
1269
|
+
placeholder="Folder name"
|
|
1270
|
+
.value=${this.#d.value}
|
|
1271
|
+
@input=${t=>this.#d.set(t.target.value)}
|
|
1272
|
+
@keydown=${t=>{t.key==="Enter"&&this.#z(),t.key==="Escape"&&this.#P()}}
|
|
1273
|
+
/>
|
|
1274
|
+
<button @click=${()=>this.#z()}>Create</button>
|
|
1275
|
+
<button @click=${()=>this.#P()}>Cancel</button>
|
|
1276
|
+
</div>
|
|
1277
|
+
`:""}
|
|
1278
|
+
<div class="browser">
|
|
1279
|
+
${this.#r.value?h`<div class="entry up" @click=${()=>this.#_(this.#r.value)}>
|
|
1280
|
+
<span class="icon">📁</span> ..
|
|
1281
|
+
</div>`:""}
|
|
1282
|
+
${e.length===0&&!this.#r.value?h`<div class="empty">No subdirectories here.</div>`:e.map(t=>h`<div class="entry" @click=${()=>this.#_(t.path)}>
|
|
1283
|
+
<span class="icon">📁</span> ${t.name}
|
|
1284
|
+
</div>`)}
|
|
1285
|
+
</div>
|
|
1286
|
+
<div class="footer">
|
|
1287
|
+
<button class="secondary" @click=${()=>this.#D()}>
|
|
1288
|
+
Select this folder
|
|
1289
|
+
</button>
|
|
1290
|
+
${this.#g.value?h`<div class="selected-row">Selected: <span class="path">${this.#g.value}</span></div>`:""}
|
|
1291
|
+
<div>
|
|
1292
|
+
<label>Folder name</label>
|
|
1293
|
+
<input
|
|
1294
|
+
type="text"
|
|
1295
|
+
.value=${this.#l.value}
|
|
1296
|
+
placeholder="e.g. personal, company"
|
|
1297
|
+
@input=${t=>this.#l.set(t.target.value)}
|
|
1298
|
+
/>
|
|
1299
|
+
</div>
|
|
1300
|
+
${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
|
|
1301
|
+
<div class="actions">
|
|
1302
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1303
|
+
<button
|
|
1304
|
+
class="primary"
|
|
1305
|
+
?disabled=${!this.#g.value||this.#c.value}
|
|
1306
|
+
@click=${()=>this.#O()}
|
|
1307
|
+
>
|
|
1308
|
+
${this.#c.value?"Adding…":"Add folder"}
|
|
1309
|
+
</button>
|
|
1310
|
+
</div>
|
|
1311
|
+
</div>
|
|
1312
|
+
`}#a(){const e=this.#m.value;return this.#y.value&&!this.#k.value?h`
|
|
1313
|
+
<div class="ff-body">
|
|
1314
|
+
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
|
|
1315
|
+
${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
|
|
1316
|
+
<div class="actions">
|
|
1317
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1318
|
+
</div>
|
|
1319
|
+
</div>
|
|
1320
|
+
`:this.#k.value?h`
|
|
1321
|
+
<div class="ff-body">
|
|
1322
|
+
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#o.value}</div>
|
|
1323
|
+
${e.length>0?h`
|
|
1324
|
+
<div class="ff-folder-list">
|
|
1325
|
+
${e.map(t=>h`<div
|
|
1326
|
+
class="ff-folder-entry ${this.#p.value===t.path?"selected":""}"
|
|
1327
|
+
@click=${()=>this.#N(t.path)}
|
|
1328
|
+
>
|
|
1329
|
+
${t.path}
|
|
1330
|
+
</div>`)}
|
|
1331
|
+
</div>
|
|
1332
|
+
`:this.#$.value?h`<div class="ff-hint">Loading folders…</div>`:h`<div class="ff-empty">No folders found.</div>`}
|
|
1333
|
+
${this.#p.value?h`<div class="selected-row">Selected: <span class="path">${this.#p.value}</span></div>`:""}
|
|
1334
|
+
<div>
|
|
1335
|
+
<label>Folder name</label>
|
|
1336
|
+
<input
|
|
1337
|
+
type="text"
|
|
1338
|
+
.value=${this.#l.value}
|
|
1339
|
+
placeholder="e.g. team-qa"
|
|
1340
|
+
@input=${t=>this.#l.set(t.target.value)}
|
|
1341
|
+
/>
|
|
1342
|
+
</div>
|
|
1343
|
+
${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
|
|
1344
|
+
<div class="actions">
|
|
1345
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1346
|
+
<button
|
|
1347
|
+
class="primary"
|
|
1348
|
+
?disabled=${!this.#p.value||this.#c.value}
|
|
1349
|
+
@click=${()=>this.#T()}
|
|
1350
|
+
>
|
|
1351
|
+
${this.#c.value?"Connecting…":"Connect folder"}
|
|
1352
|
+
</button>
|
|
1353
|
+
</div>
|
|
1354
|
+
</div>
|
|
1355
|
+
`:h`
|
|
1356
|
+
<div class="ff-body">
|
|
1357
|
+
<div class="ff-hint">
|
|
1358
|
+
Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
|
|
1359
|
+
${this.#e.value==="skill"?"skill":"memory"} source. Content stays live-synced from folderfoo —
|
|
1360
|
+
reads and writes go straight through, with a local cache for fast search.
|
|
1361
|
+
</div>
|
|
1362
|
+
<div>
|
|
1363
|
+
<label>Server URL</label>
|
|
1364
|
+
<input
|
|
1365
|
+
type="text"
|
|
1366
|
+
.value=${this.#o.value}
|
|
1367
|
+
placeholder="https://folderfoo.example.com"
|
|
1368
|
+
?disabled=${this.#f.value}
|
|
1369
|
+
@input=${t=>this.#o.set(t.target.value)}
|
|
1370
|
+
@keydown=${t=>t.key==="Enter"&&this.#L()}
|
|
1371
|
+
/>
|
|
1372
|
+
</div>
|
|
1373
|
+
${this.#f.value?h`
|
|
1374
|
+
<div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
|
|
1375
|
+
<div class="ff-widget-slot"></div>
|
|
1376
|
+
${this.#v.value?h`<div class="ff-hint">Finishing connection…</div>`:""}
|
|
1377
|
+
`:h`
|
|
1378
|
+
<div class="actions" style="justify-content: flex-start; margin-top: 0;">
|
|
1379
|
+
<button class="secondary" @click=${()=>this.#L()}>Continue</button>
|
|
1380
|
+
</div>
|
|
1381
|
+
`}
|
|
1382
|
+
${this.#b.value?h`<div class="error">${this.#b.value}</div>`:""}
|
|
1383
|
+
${this.#i.value?h`<div class="error">${this.#i.value}</div>`:""}
|
|
1384
|
+
<div class="actions">
|
|
1385
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1386
|
+
</div>
|
|
1387
|
+
</div>
|
|
1388
|
+
`}render(){return h`
|
|
1389
|
+
<div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
|
|
1238
1390
|
<div class="modal">
|
|
1239
1391
|
<div class="header"><h2>Add a folder</h2></div>
|
|
1240
1392
|
${this.lockKind?h``:h`
|
|
@@ -1253,64 +1405,21 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1253
1405
|
</button>
|
|
1254
1406
|
</div>
|
|
1255
1407
|
`}
|
|
1256
|
-
<div class="
|
|
1257
|
-
<
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
<div class="new-folder-row">
|
|
1266
|
-
<input
|
|
1267
|
-
type="text"
|
|
1268
|
-
placeholder="Folder name"
|
|
1269
|
-
.value=${this.#n.value}
|
|
1270
|
-
@input=${t=>this.#n.set(t.target.value)}
|
|
1271
|
-
@keydown=${t=>{t.key==="Enter"&&this.#m(),t.key==="Escape"&&this.#b()}}
|
|
1272
|
-
/>
|
|
1273
|
-
<button @click=${()=>this.#m()}>Create</button>
|
|
1274
|
-
<button @click=${()=>this.#b()}>Cancel</button>
|
|
1275
|
-
</div>
|
|
1276
|
-
`:""}
|
|
1277
|
-
<div class="browser">
|
|
1278
|
-
${this.#r.value?h`<div class="entry up" @click=${()=>this.#p(this.#r.value)}>
|
|
1279
|
-
<span class="icon">📁</span> ..
|
|
1280
|
-
</div>`:""}
|
|
1281
|
-
${e.length===0&&!this.#r.value?h`<div class="empty">No subdirectories here.</div>`:e.map(t=>h`<div class="entry" @click=${()=>this.#p(t.path)}>
|
|
1282
|
-
<span class="icon">📁</span> ${t.name}
|
|
1283
|
-
</div>`)}
|
|
1284
|
-
</div>
|
|
1285
|
-
<div class="footer">
|
|
1286
|
-
<button class="secondary" @click=${()=>this.#k()}>
|
|
1287
|
-
Select this folder
|
|
1408
|
+
<div class="source-toggle">
|
|
1409
|
+
<button class=${this.#t.value==="local"?"active":""} @click=${()=>this.#t.set("local")}>
|
|
1410
|
+
Local folder
|
|
1411
|
+
</button>
|
|
1412
|
+
<button
|
|
1413
|
+
class=${this.#t.value==="folderfoo"?"active":""}
|
|
1414
|
+
@click=${()=>{this.#t.set("folderfoo"),this.#M()}}
|
|
1415
|
+
>
|
|
1416
|
+
Connect folderfoo
|
|
1288
1417
|
</button>
|
|
1289
|
-
${this.#i.value?h`<div class="selected-row">Selected: <span class="path">${this.#i.value}</span></div>`:""}
|
|
1290
|
-
<div>
|
|
1291
|
-
<label>Folder name</label>
|
|
1292
|
-
<input
|
|
1293
|
-
type="text"
|
|
1294
|
-
.value=${this.#d.value}
|
|
1295
|
-
placeholder="e.g. personal, company"
|
|
1296
|
-
@input=${t=>this.#d.set(t.target.value)}
|
|
1297
|
-
/>
|
|
1298
|
-
</div>
|
|
1299
|
-
${this.#o.value?h`<div class="error">${this.#o.value}</div>`:""}
|
|
1300
|
-
<div class="actions">
|
|
1301
|
-
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1302
|
-
<button
|
|
1303
|
-
class="primary"
|
|
1304
|
-
?disabled=${!this.#i.value||this.#a.value}
|
|
1305
|
-
@click=${()=>this.#x()}
|
|
1306
|
-
>
|
|
1307
|
-
${this.#a.value?"Adding…":"Add folder"}
|
|
1308
|
-
</button>
|
|
1309
|
-
</div>
|
|
1310
1418
|
</div>
|
|
1419
|
+
${this.#t.value==="local"?this.#q():this.#a()}
|
|
1311
1420
|
</div>
|
|
1312
1421
|
</div>
|
|
1313
|
-
`}}customElements.define("add-folder-modal",
|
|
1422
|
+
`}}customElements.define("add-folder-modal",Ai);function Ti(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const Ei=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],ct=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],Ri={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},Pi={skill:[],memory:[]},Rt="mem-bucket-split-pct",Pt=20,zt=80;function zi(){const r=Number(localStorage.getItem(Rt));return Number.isFinite(r)&&r>=Pt&&r<=zt?r:40}const Lt="mem-bucket-theme",fe=["system","light","dark"],Li={system:"◐",light:"☀",dark:"☾"},Ii={system:"Auto",light:"Light",dark:"Dark"};function Di(){const r=localStorage.getItem(Lt);return r==="light"||r==="dark"?r:"system"}function ht(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function Oi(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const l=e.get("deprecated");l==="0"?t.deprecatedFilter="hide":l==="1"&&(t.deprecatedFilter="only");const 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 d=e.get("date_to");return d&&(t.dateTo=d),t}class Mi extends _{static{this.styles=O`
|
|
1314
1423
|
:host { display: flex; flex-direction: column; height: 100vh; }
|
|
1315
1424
|
.theme-toggle {
|
|
1316
1425
|
position: fixed;
|
|
@@ -1471,6 +1580,17 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1471
1580
|
cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
|
|
1472
1581
|
}
|
|
1473
1582
|
.folder-chip.active { background: var(--purple-tint); border-color: var(--purple); color: var(--purple-fg); }
|
|
1583
|
+
/* Remote (folderfoo) folders get the accent color instead of the default border, so they're
|
|
1584
|
+
visually distinct from local folders at a glance — active-state purple still wins when both apply. */
|
|
1585
|
+
.folder-chip.remote { border-color: var(--accent); color: var(--accent); }
|
|
1586
|
+
.folder-chip.remote.active { background: var(--purple-tint); border-color: var(--purple); color: var(--purple-fg); }
|
|
1587
|
+
.folder-chip .remote-dot {
|
|
1588
|
+
width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
|
|
1589
|
+
}
|
|
1590
|
+
.folder-chip.active .remote-dot { background: var(--purple); }
|
|
1591
|
+
.folder-chip .kind {
|
|
1592
|
+
opacity: 0.55; font-size: 10px;
|
|
1593
|
+
}
|
|
1474
1594
|
.folder-chip .remove {
|
|
1475
1595
|
opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
|
|
1476
1596
|
}
|
|
@@ -1480,6 +1600,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1480
1600
|
cursor: pointer; background: none; color: inherit; opacity: 0.75;
|
|
1481
1601
|
}
|
|
1482
1602
|
.add-folder-btn:hover { opacity: 1; }
|
|
1603
|
+
.folderfoo-open-banner {
|
|
1604
|
+
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
|
1605
|
+
padding: 8px 16px; font-size: 12px; background: var(--accent-tint); border-bottom: 1px solid var(--border);
|
|
1606
|
+
}
|
|
1607
|
+
.folderfoo-open-banner .dismiss {
|
|
1608
|
+
background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6; padding: 2px; border-radius: 50%;
|
|
1609
|
+
}
|
|
1610
|
+
.folderfoo-open-banner .dismiss:hover { opacity: 1; background: var(--hover-strong); }
|
|
1483
1611
|
.first-run {
|
|
1484
1612
|
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
1485
1613
|
flex: 1 1 auto; gap: 16px; text-align: center; padding: 24px;
|
|
@@ -1515,63 +1643,70 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1515
1643
|
cursor: pointer;
|
|
1516
1644
|
}
|
|
1517
1645
|
.bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
|
|
1518
|
-
`}#e=
|
|
1646
|
+
`}#e=Oi();#t=new u(this.#e.query??"");#s=new u(this.#e.typeFilter??"all");#n=new u(this.#e.activeTags??[]);#r=new u(this.#e.activeFolders??[]);#g=new u([]);#l=new u(Ri);#i=new u(null);#c=new u(Pi);#u=new u(!1);#h=new u("");#d=new u(!1);#o=new u(zi());#f=new u("");#b=new u(!1);#y=new u(this.#e.sort??"mtime_desc");#x=new u(this.#e.deprecatedFilter??"all");#k=new u(this.#e.pausedFilter??"all");#v=new u(this.#e.dateFrom??"");#m=new u(this.#e.dateTo??"");#p=new u(new Set);#$=new u(Di());#w=new u(!1);#_=e=>this.#O(e);#R=()=>this.#M();constructor(){super(),new le(this),ht(this.#$.value)}#I(e){this.#$.set(e),localStorage.setItem(Lt,e),ht(e)}#P(){const e=fe[(fe.indexOf(this.#$.value)+1)%fe.length];this.#I(e)}async#z(){if(!this.#w.value){this.#w.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#E(),this.#C(),this.#a()])}finally{this.#w.set(!1)}}}#D(e){e.preventDefault(),this.#b.set(!0),document.addEventListener("pointermove",this.#_),document.addEventListener("pointerup",this.#R)}#O(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(zt,Math.max(Pt,i)))}#M(){this.#b.set(!1),document.removeEventListener("pointermove",this.#_),document.removeEventListener("pointerup",this.#R),localStorage.setItem(Rt,String(this.#o.value))}#L=new hs(()=>{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.#n.value)e.append("tag",t);for(const t of this.#r.value)e.append("folder",t);return this.#y.value!=="mtime_desc"&&e.set("sort",this.#y.value),this.#x.value==="hide"?e.set("deprecated","0"):this.#x.value==="only"&&e.set("deprecated","1"),this.#k.value==="hide"?e.set("paused","0"):this.#k.value==="only"&&e.set("paused","1"),this.#v.value&&e.set("date_from",this.#v.value),this.#m.value&&e.set("date_to",this.#m.value),e.toString()});#S=()=>this.#q();#A=e=>this.#F(e);connectedCallback(){super.connectedCallback(),this.#a(),this.#C(),this.#E(),window.addEventListener("focus",this.#S),document.addEventListener("visibilitychange",this.#S),document.addEventListener("folderfoo-file-open",this.#A),this.#N()}async#F(e){const t=e.detail?.name;if(!t)return;const s=Ti(t);if(s.owner){this.#f.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:n}=await ye();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:ne,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#f.set(a.error??`couldn't open "${s.name}"`);return}this.#f.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#f.set(o.message)}}async#N(){if(document.querySelector("folderfoo-profile-circle"))return;const{folderfooMode:e,folderfooHost:t}=await ye();e==="off"||!t||dt(()=>import(`${t}/elements/folderfoo-profile-circle.js`),[]).then(()=>{const s=document.createElement("folderfoo-profile-circle");s.setAttribute("app-name","Memory Bucket"),s.setAttribute("tenant-id",ne),document.body.appendChild(s)}).catch(s=>{console.warn("folderfoo-profile-circle unavailable:",s.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#S),document.removeEventListener("visibilitychange",this.#S),document.removeEventListener("folderfoo-file-open",this.#A)}#T=!1;async#q(){if(document.visibilityState==="visible"){if(this.#H().some(e=>e.remote)&&!this.#T){this.#T=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#T=!1}}this.#a(),this.#C(),this.#E(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#a(){const e=this.#L.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#g.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0)}async#C(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#E(){const e=await fetch("/api/folders");this.#c.set(await e.json()),this.#d.set(!0)}#Q(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#a()}async#V(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#h.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#E(),this.#C(),this.#a()])}finally{this.#h.set("")}}}#j(){this.#u.set(!1),this.#E(),this.#C(),this.#a()}#H(){return[...this.#c.value.skill,...this.#c.value.memory]}#Y(e){this.#s.set(e),this.#n.set([]),this.#C(),this.#a()}#J(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#a()}#G(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#a()}#X(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#a()}#ee(e){this.#v.set(e),this.#m.set(e),this.#a()}#te(e){this.#t.set(e.target.value),this.#a()}#B(e){this.#t.set(e),this.#a()}#se(){this.#t.set(""),this.#a()}#ie(e){this.#i.set({table:e._table,id:e.id})}#re(e){this.#y.set(e.target.value),this.#a()}#ne(e){this.#x.set(e.target.value),this.#a()}#oe(e){this.#k.set(e.target.value),this.#a()}#ae(e){this.#v.set(e.target.value),this.#a()}#le(e){this.#m.set(e.target.value),this.#a()}#ce(){this.#v.set(""),this.#m.set(""),this.#a()}#he(e){const t=new Set(this.#p.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#p.set(t)}#de(){return new Map(this.#g.value.map(e=>[e.id,e]))}#U(){const e=new Map,t=this.#de();for(const s of this.#p.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#K(e){const t=this.#U();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#p.set(new Set),await this.#a()}async#Z(e){const t=this.#U();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#p.set(new Set),await this.#a()}async#pe(){if(!window.confirm(`Delete ${this.#p.value.size} doc(s)? This can't be undone.`))return;const e=this.#U();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#p.set(new Set),await this.#a()}#W(){const e=this.#$.value;return h`
|
|
1519
1647
|
<button
|
|
1520
1648
|
class="theme-toggle"
|
|
1521
|
-
title=${`Theme: ${
|
|
1649
|
+
title=${`Theme: ${Ii[e]} (click to change)`}
|
|
1522
1650
|
aria-label="Toggle color theme"
|
|
1523
|
-
@click=${()=>this.#
|
|
1651
|
+
@click=${()=>this.#P()}
|
|
1524
1652
|
>
|
|
1525
|
-
${
|
|
1653
|
+
${Li[e]}
|
|
1526
1654
|
</button>
|
|
1527
|
-
`}#
|
|
1655
|
+
`}#ue(){const e=this.#w.value;return h`
|
|
1528
1656
|
<button
|
|
1529
1657
|
class=${`reindex-toggle${e?" spinning":""}`}
|
|
1530
1658
|
title=${e?"Reindexing…":"Rebuild cache from disk"}
|
|
1531
1659
|
aria-label="Rebuild cache from disk"
|
|
1532
1660
|
?disabled=${e}
|
|
1533
|
-
@click=${()=>this.#
|
|
1661
|
+
@click=${()=>this.#z()}
|
|
1534
1662
|
>
|
|
1535
1663
|
♻
|
|
1536
1664
|
</button>
|
|
1537
|
-
`}render(){const e=this.#
|
|
1538
|
-
${this.#
|
|
1665
|
+
`}render(){const e=this.#l.value,t=this.#H();return this.#d.value&&t.length===0&&!this.#u.value?h`
|
|
1666
|
+
${this.#W()}
|
|
1539
1667
|
<div class="first-run">
|
|
1540
1668
|
<h1>No folders configured yet</h1>
|
|
1541
1669
|
<p>
|
|
1542
1670
|
Add a folder of skills or memory docs to get started. You can add more folders later —
|
|
1543
1671
|
e.g. a personal skills repo plus a shared company repo.
|
|
1544
1672
|
</p>
|
|
1545
|
-
<button class="add-folder-btn" @click=${()=>this.#
|
|
1673
|
+
<button class="add-folder-btn" @click=${()=>this.#u.set(!0)}>+ Add your first folder</button>
|
|
1546
1674
|
</div>
|
|
1547
|
-
${this.#
|
|
1675
|
+
${this.#u.value?h`<add-folder-modal
|
|
1548
1676
|
.defaultKind=${"skill"}
|
|
1549
1677
|
.lockKind=${!1}
|
|
1550
|
-
.onAdded=${()=>this.#
|
|
1551
|
-
.onCancel=${()=>this.#
|
|
1678
|
+
.onAdded=${()=>this.#j()}
|
|
1679
|
+
.onCancel=${()=>this.#u.set(!1)}
|
|
1552
1680
|
></add-folder-modal>`:""}
|
|
1553
1681
|
`:h`
|
|
1554
|
-
${this.#
|
|
1555
|
-
${this.#
|
|
1682
|
+
${this.#ue()}
|
|
1683
|
+
${this.#W()}
|
|
1556
1684
|
<div class="folders-bar">
|
|
1557
1685
|
<span class="filter-label">Folders:</span>
|
|
1558
1686
|
${t.map(s=>h`
|
|
1559
1687
|
<button
|
|
1560
|
-
class="folder-chip ${this.#
|
|
1561
|
-
title=${s.path}
|
|
1562
|
-
@click=${()=>this.#
|
|
1688
|
+
class="folder-chip ${s.remote?"remote":""} ${this.#r.value.includes(s.name)?"active":""}"
|
|
1689
|
+
title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
|
|
1690
|
+
@click=${()=>this.#Q(s.name)}
|
|
1563
1691
|
>
|
|
1564
|
-
📁 ${s.name}
|
|
1692
|
+
${s.remote?h`<span class="remote-dot"></span>`:"📁"} ${s.name}
|
|
1693
|
+
<span class="kind">(${s.kind==="skill"?"s":"m"})</span>
|
|
1565
1694
|
<span
|
|
1566
1695
|
class="remove"
|
|
1567
1696
|
title="Remove folder"
|
|
1568
|
-
@click=${i=>this.#
|
|
1569
|
-
>${this.#
|
|
1697
|
+
@click=${i=>this.#V(s,i)}
|
|
1698
|
+
>${this.#h.value===s.name?"…":"✕"}</span
|
|
1570
1699
|
>
|
|
1571
1700
|
</button>
|
|
1572
1701
|
`)}
|
|
1573
|
-
<button class="add-folder-btn" @click=${()=>this.#
|
|
1702
|
+
<button class="add-folder-btn" @click=${()=>this.#u.set(!0)}>+ Add folder</button>
|
|
1574
1703
|
</div>
|
|
1704
|
+
${this.#f.value?h`
|
|
1705
|
+
<div class="folderfoo-open-banner">
|
|
1706
|
+
${this.#f.value}
|
|
1707
|
+
<button class="dismiss" @click=${()=>this.#f.set("")}>✕</button>
|
|
1708
|
+
</div>
|
|
1709
|
+
`:""}
|
|
1575
1710
|
<div class="filters">
|
|
1576
1711
|
<div class="row search-row">
|
|
1577
1712
|
<div class="search-field">
|
|
@@ -1579,24 +1714,24 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1579
1714
|
type="search"
|
|
1580
1715
|
placeholder="Search descriptions, bodies, tags..."
|
|
1581
1716
|
.value=${this.#t.value}
|
|
1582
|
-
@input=${s=>this.#
|
|
1717
|
+
@input=${s=>this.#te(s)}
|
|
1583
1718
|
/>
|
|
1584
1719
|
${this.#t.value?h`
|
|
1585
1720
|
<button
|
|
1586
1721
|
class="search-clear-btn"
|
|
1587
1722
|
title="Clear search"
|
|
1588
1723
|
aria-label="Clear search"
|
|
1589
|
-
@click=${()=>this.#
|
|
1724
|
+
@click=${()=>this.#se()}
|
|
1590
1725
|
>
|
|
1591
1726
|
✕
|
|
1592
1727
|
</button>
|
|
1593
1728
|
`:""}
|
|
1594
1729
|
</div>
|
|
1595
1730
|
<div class="row type-toggle">
|
|
1596
|
-
${
|
|
1731
|
+
${Ei.map(s=>h`
|
|
1597
1732
|
<button
|
|
1598
1733
|
class=${this.#s.value===s.value?"active":""}
|
|
1599
|
-
@click=${()=>this.#
|
|
1734
|
+
@click=${()=>this.#Y(s.value)}
|
|
1600
1735
|
>
|
|
1601
1736
|
${s.label}
|
|
1602
1737
|
</button>
|
|
@@ -1605,8 +1740,8 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1605
1740
|
${e.tags.length===0?h`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:h`
|
|
1606
1741
|
<tag-multiselect
|
|
1607
1742
|
.tags=${e.tags}
|
|
1608
|
-
.active=${this.#
|
|
1609
|
-
.onToggle=${s=>this.#
|
|
1743
|
+
.active=${this.#n.value}
|
|
1744
|
+
.onToggle=${s=>this.#J(s)}
|
|
1610
1745
|
.width=${"260px"}
|
|
1611
1746
|
></tag-multiselect>
|
|
1612
1747
|
`}
|
|
@@ -1615,83 +1750,83 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1615
1750
|
<input
|
|
1616
1751
|
type="date"
|
|
1617
1752
|
aria-label="From date"
|
|
1618
|
-
.value=${this.#
|
|
1619
|
-
@change=${s=>this.#
|
|
1753
|
+
.value=${this.#v.value}
|
|
1754
|
+
@change=${s=>this.#ae(s)}
|
|
1620
1755
|
/>
|
|
1621
1756
|
<span class="date-range-sep">–</span>
|
|
1622
1757
|
<input
|
|
1623
1758
|
type="date"
|
|
1624
1759
|
aria-label="To date"
|
|
1625
|
-
.value=${this.#
|
|
1626
|
-
@change=${s=>this.#
|
|
1760
|
+
.value=${this.#m.value}
|
|
1761
|
+
@change=${s=>this.#le(s)}
|
|
1627
1762
|
/>
|
|
1628
|
-
${this.#
|
|
1763
|
+
${this.#v.value||this.#m.value?h`
|
|
1629
1764
|
<button
|
|
1630
1765
|
class="date-range-clear"
|
|
1631
1766
|
title="Clear date range"
|
|
1632
1767
|
aria-label="Clear date range"
|
|
1633
|
-
@click=${()=>this.#
|
|
1768
|
+
@click=${()=>this.#ce()}
|
|
1634
1769
|
>
|
|
1635
1770
|
✕
|
|
1636
1771
|
</button>
|
|
1637
1772
|
`:""}
|
|
1638
1773
|
</div>
|
|
1639
1774
|
<span class="filter-label">Sort:</span>
|
|
1640
|
-
<select .value=${this.#
|
|
1775
|
+
<select .value=${this.#y.value} @change=${s=>this.#re(s)}>
|
|
1641
1776
|
<option value="mtime_desc">Recently touched</option>
|
|
1642
1777
|
<option value="mtime_asc">Least recently touched</option>
|
|
1643
1778
|
<option value="created_at_asc">Oldest first</option>
|
|
1644
1779
|
<option value="name_asc">Name</option>
|
|
1645
1780
|
</select>
|
|
1646
1781
|
<span class="filter-label">Deprecated:</span>
|
|
1647
|
-
<select .value=${this.#
|
|
1648
|
-
${
|
|
1782
|
+
<select .value=${this.#x.value} @change=${s=>this.#ne(s)}>
|
|
1783
|
+
${ct.map(s=>h`<option value=${s.value}>${s.label}</option>`)}
|
|
1649
1784
|
</select>
|
|
1650
1785
|
<span class="filter-label">Paused:</span>
|
|
1651
|
-
<select .value=${this.#k.value} @change=${s=>this.#
|
|
1652
|
-
${
|
|
1786
|
+
<select .value=${this.#k.value} @change=${s=>this.#oe(s)}>
|
|
1787
|
+
${ct.map(s=>h`<option value=${s.value}>${s.label}</option>`)}
|
|
1653
1788
|
</select>
|
|
1654
1789
|
</div>
|
|
1655
1790
|
</div>
|
|
1656
|
-
${this.#
|
|
1791
|
+
${this.#p.value.size>0?h`
|
|
1657
1792
|
<div class="bulk-bar">
|
|
1658
|
-
<span>${this.#
|
|
1659
|
-
<button @click=${()=>this.#
|
|
1660
|
-
<button @click=${()=>this.#
|
|
1661
|
-
<button @click=${()=>this.#
|
|
1662
|
-
<button @click=${()=>this.#
|
|
1663
|
-
<button class="danger" @click=${()=>this.#
|
|
1664
|
-
<button @click=${()=>this.#
|
|
1793
|
+
<span>${this.#p.value.size} selected</span>
|
|
1794
|
+
<button @click=${()=>this.#K(!0)}>Mark deprecated</button>
|
|
1795
|
+
<button @click=${()=>this.#K(!1)}>Un-deprecate</button>
|
|
1796
|
+
<button @click=${()=>this.#Z(!0)}>Pause</button>
|
|
1797
|
+
<button @click=${()=>this.#Z(!1)}>Resume</button>
|
|
1798
|
+
<button class="danger" @click=${()=>this.#pe()}>Delete</button>
|
|
1799
|
+
<button @click=${()=>this.#p.set(new Set)}>Clear</button>
|
|
1665
1800
|
</div>
|
|
1666
1801
|
`:""}
|
|
1667
1802
|
<div class="body-region">
|
|
1668
1803
|
<result-list
|
|
1669
|
-
style=${`width: ${this.#
|
|
1670
|
-
.results=${this.#
|
|
1804
|
+
style=${`width: ${this.#o.value}%; border-right: 1px solid var(--border);`}
|
|
1805
|
+
.results=${this.#g.value}
|
|
1671
1806
|
.showFolder=${t.length>1}
|
|
1672
|
-
.onSelect=${s=>this.#
|
|
1673
|
-
.selectedIds=${this.#
|
|
1674
|
-
.onToggleSelect=${s=>this.#
|
|
1675
|
-
.onKeyClick=${s=>this.#
|
|
1807
|
+
.onSelect=${s=>this.#ie(s)}
|
|
1808
|
+
.selectedIds=${this.#p.value}
|
|
1809
|
+
.onToggleSelect=${s=>this.#he(s)}
|
|
1810
|
+
.onKeyClick=${s=>this.#B(s)}
|
|
1676
1811
|
></result-list>
|
|
1677
1812
|
<div
|
|
1678
|
-
class="splitter ${this.#
|
|
1679
|
-
@pointerdown=${s=>this.#
|
|
1813
|
+
class="splitter ${this.#b.value?"dragging":""}"
|
|
1814
|
+
@pointerdown=${s=>this.#D(s)}
|
|
1680
1815
|
></div>
|
|
1681
1816
|
<detail-panel
|
|
1682
|
-
.selected=${this.#
|
|
1817
|
+
.selected=${this.#i.value}
|
|
1683
1818
|
.facets=${e}
|
|
1684
|
-
.onChanged=${()=>{this.#
|
|
1685
|
-
.onTagClick=${s=>this.#
|
|
1686
|
-
.onFolderClick=${s=>this.#
|
|
1687
|
-
.onDateClick=${s=>this.#
|
|
1688
|
-
.onKeyClick=${s=>this.#
|
|
1819
|
+
.onChanged=${()=>{this.#a(),this.#C()}}
|
|
1820
|
+
.onTagClick=${s=>this.#G(s)}
|
|
1821
|
+
.onFolderClick=${s=>this.#X(s)}
|
|
1822
|
+
.onDateClick=${s=>this.#ee(s)}
|
|
1823
|
+
.onKeyClick=${s=>this.#B(s)}
|
|
1689
1824
|
></detail-panel>
|
|
1690
1825
|
</div>
|
|
1691
|
-
${this.#
|
|
1826
|
+
${this.#u.value?h`<add-folder-modal
|
|
1692
1827
|
.defaultKind=${"skill"}
|
|
1693
1828
|
.lockKind=${!1}
|
|
1694
|
-
.onAdded=${()=>this.#
|
|
1695
|
-
.onCancel=${()=>this.#
|
|
1829
|
+
.onAdded=${()=>this.#j()}
|
|
1830
|
+
.onCancel=${()=>this.#u.set(!1)}
|
|
1696
1831
|
></add-folder-modal>`:""}
|
|
1697
|
-
`}}customElements.define("mem-bucket-app",
|
|
1832
|
+
`}}customElements.define("mem-bucket-app",Mi);
|