mcp-memory-bucket 0.11.0 → 0.11.1
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/dist/client/assets/index-DdIscKr7.js +2946 -0
- package/dist/client/icons/apple-touch-icon.png +0 -0
- package/dist/client/icons/favicon-32.png +0 -0
- package/dist/client/icons/icon-192.png +0 -0
- package/dist/client/icons/icon-512.png +0 -0
- package/dist/client/index.html +17 -1
- package/dist/client/manifest.webmanifest +16 -0
- package/dist/client/sw.js +6 -0
- package/dist/src/attachments/storage.js +28 -0
- package/dist/src/memory/repository.js +20 -0
- package/dist/src/store/sync.js +13 -0
- package/dist/src/web/routes.js +131 -1
- package/package.json +1 -1
- package/dist/client/assets/index-DNC2lMlx.js +0 -2539
|
@@ -0,0 +1,2946 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();const as="modulepreload",ls=function(n){return"/"+n},He={},ae=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){let o=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=o(t.map(d=>{if(d=ls(d),d in He)return;He[d]=!0;const u=d.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const g=document.createElement("link");if(g.rel=u?"stylesheet":as,u||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),u)return new Promise((x,m)=>{g.addEventListener("load",x),g.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const ne=globalThis,Te=ne.ShadowRoot&&(ne.ShadyCSS===void 0||ne.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ae=Symbol(),Ke=new WeakMap;let It=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==Ae)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(Te&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=Ke.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Ke.set(t,e))}return e}toString(){return this.cssText}};const cs=n=>new It(typeof n=="string"?n:n+"",void 0,Ae),w=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new It(t,n,Ae)},ds=(n,e)=>{if(Te)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=ne.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},Ve=Te?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return cs(t)})(n):n;/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const{is:hs,defineProperty:ps,getOwnPropertyDescriptor:us,getOwnPropertyNames:fs,getOwnPropertySymbols:gs,getPrototypeOf:bs}=Object,pe=globalThis,Ge=pe.trustedTypes,ms=Ge?Ge.emptyScript:"",vs=pe.reactiveElementPolyfillSupport,Q=(n,e)=>n,ye={toAttribute(n,e){switch(e){case Boolean:n=n?ms:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Lt=(n,e)=>!hs(n,e),We={attribute:!0,type:String,converter:ye,reflect:!1,useDefault:!1,hasChanged:Lt};Symbol.metadata??=Symbol("metadata"),pe.litPropertyMetadata??=new WeakMap;let B=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=We){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&&ps(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=us(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);r?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??We}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const e=bs(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const t=this.properties,s=[...fs(t),...gs(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(Ve(i))}else e!==void 0&&t.push(Ve(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 ds(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:ye).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:ye;this._$Em=i;const a=o.fromAttribute(t,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,r){if(e!==void 0){const o=this.constructor;if(i===!1&&(r=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??Lt)(r,t)||s.useDefault&&s.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:o}=r,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};B.elementStyles=[],B.shadowRootOptions={mode:"open"},B[Q("elementProperties")]=new Map,B[Q("finalized")]=new Map,vs?.({ReactiveElement:B}),(pe.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/const Ee=globalThis,Ze=n=>n,le=Ee.trustedTypes,Je=le?le.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ft="$lit$",z=`lit$${Math.random().toFixed(9).slice(2)}$`,Ot="?"+z,xs=`<${Ot}>`,O=document,X=()=>O.createComment(""),ee=n=>n===null||typeof n!="object"&&typeof n!="function",Re=Array.isArray,ys=n=>Re(n)||typeof n?.[Symbol.iterator]=="function",be=`[
|
|
14
|
+
\f\r]`,Z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ye=/-->/g,Qe=/>/g,P=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Xe=/'/g,et=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ks=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),l=ks(1),D=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),tt=new WeakMap,L=O.createTreeWalker(O,129);function Mt(n,e){if(!Re(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Je!==void 0?Je.createHTML(e):e}const $s=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=Z;for(let a=0;a<t;a++){const c=n[a];let d,u,p=-1,g=0;for(;g<c.length&&(o.lastIndex=g,u=o.exec(c),u!==null);)g=o.lastIndex,o===Z?u[1]==="!--"?o=Ye:u[1]!==void 0?o=Qe:u[2]!==void 0?(Dt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??Z,p=-1):u[1]===void 0?p=-2:(p=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?et:Xe):o===et||o===Xe?o=P:o===Ye||o===Qe?o=Z:(o=P,i=void 0);const x=o===P&&n[a+1].startsWith("/>")?" ":"";r+=o===Z?c+xs:p>=0?(s.push(d),c.slice(0,p)+Ft+c.slice(p)+z+x):c+z+(p===-2?a:x)}return[Mt(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ke=class Nt{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[d,u]=$s(e,t);if(this.el=Nt.createElement(d,s),L.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=L.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Ft)){const g=u[o++],x=i.getAttribute(p).split(z),m=/([.?@])?(.*)/.exec(g);c.push({type:1,index:r,name:m[2],strings:x,ctor:m[1]==="."?_s:m[1]==="?"?Ss:m[1]==="@"?Cs:ue}),i.removeAttribute(p)}else p.startsWith(z)&&(c.push({type:6,index:r}),i.removeAttribute(p));if(Dt.test(i.tagName)){const p=i.textContent.split(z),g=p.length-1;if(g>0){i.textContent=le?le.emptyScript:"";for(let x=0;x<g;x++)i.append(p[x],X()),L.nextNode(),c.push({type:2,index:++r});i.append(p[g],X())}}}else if(i.nodeType===8)if(i.data===Ot)c.push({type:2,index:r});else{let p=-1;for(;(p=i.data.indexOf(z,p+1))!==-1;)c.push({type:7,index:r}),p+=z.length-1}r++}}static createElement(e,t){const s=O.createElement("template");return s.innerHTML=e,s}};function K(n,e,t=n,s){if(e===D)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=ee(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=K(n,i._$AS(n,e.values),i,s)),e}let ws=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??O).importNode(t,!0);L.currentNode=i;let r=L.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new ze(r,r.nextSibling,this,e):c.type===1?d=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(d=new Ts(r,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(r=L.nextNode(),o++)}return L.currentNode=O,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++}},ze=class Ut{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=f,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=K(this,e,t),ee(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==D&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ys(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!==f&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.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=ke.createElement(Mt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new ws(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=tt.get(e.strings);return t===void 0&&tt.set(e.strings,t=new ke(e)),t}k(e){Re(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new Ut(this.O(X()),this.O(X()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ze(e).nextSibling;Ze(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ue=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=f}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=K(this,e,t,0),o=!ee(e)||e!==this._$AH&&e!==D,o&&(this._$AH=e);else{const a=e;let c,d;for(e=r[0],c=0;c<r.length-1;c++)d=K(this,a[s+c],t,c),d===D&&(d=this._$AH[c]),o||=!ee(d)||d!==this._$AH[c],d===f?e=f:e!==f&&(e+=(d??"")+r[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},_s=class extends ue{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},Ss=class extends ue{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},Cs=class extends ue{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=K(this,e,t,0)??f)===D)return;const s=this._$AH,i=e===f&&s!==f||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==f&&(s===f||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ts=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){K(this,e)}};const As=Ee.litHtmlPolyfillSupport;As?.(ke,ze),(Ee.litHtmlVersions??=[]).push("3.3.3");const Es=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new ze(e.insertBefore(X(),r),r,void 0,t??{})}return i._$AI(n),i};/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2017 Google LLC
|
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
+
*/const Pe=globalThis;let k=class extends B{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=Es(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return D}};k._$litElement$=!0,k.finalized=!0,Pe.litElementHydrateSupport?.({LitElement:k});const Rs=Pe.litElementPolyfillSupport;Rs?.({LitElement:k});(Pe.litElementVersions??=[]).push("4.2.2");var jt;let me=0;const st=new Set;function zs(n){me++;try{n()}finally{me--,me===0&&Ps()}}function Ps(){const n=new Set(st);st.clear();for(const e of n)e()}function Is(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Ls(n){return n&&typeof n.deref=="function"}class Ie{static#e=0;#t;#s;#n=new Set;#r=jt.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return h.activeConsumer&&h.activeConsumer.track(this),this.#t}_set(e){return Is(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(Ls(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}`}}jt=Ie;class h extends Ie{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){zs(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class it extends Ie{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#u=()=>{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.#u,this.#r);this.#n.set(e,t)}dispose(){this.#a()}#a(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(h.activeConsumer&&h.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
|
|
20
|
+
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#a(),h.push(this);try{const e=this.#e();this._set(e)}finally{h.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 h.activeConsumer||this.get(),s}}class N{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(r){h.push(i);try{s.call(this,r)}finally{h.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 Fs=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Os(n){if(!n)return"unknown age";const e=new Date(n);return Number.isNaN(e.getTime())?"unknown age":Fs.format(e)}function Ds(n){const e=[],t=new Map,s=[];for(const r of n){const o=r._table==="memory_docs"?r.key:r.group;if(!o){s.push(r);continue}t.has(o)||(t.set(o,[]),e.push(o)),t.get(o).push(r)}const i=e.map(r=>({label:r,icon:t.get(r)[0]._table==="memory_docs"?"🔑":"📂",items:t.get(r)}));return s.length>0&&i.push({label:null,icon:s[0]._table==="memory_docs"?"🔑":"📂",items:s}),i}class Ms extends k{static{this.properties={results:{attribute:!1},showFolder:{attribute:!1},onSelect:{attribute:!1},selectedIds:{attribute:!1},onToggleSelect:{attribute:!1},onKeyClick:{attribute:!1},onGroupClick:{attribute:!1}}}static{this.styles=w`
|
|
21
|
+
:host { display: block; }
|
|
22
|
+
.count-header {
|
|
23
|
+
padding: 8px 14px;
|
|
24
|
+
font-size: 11px;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
text-transform: uppercase;
|
|
27
|
+
opacity: 0.6;
|
|
28
|
+
background: var(--bg);
|
|
29
|
+
border-bottom: 1px solid var(--border);
|
|
30
|
+
}
|
|
31
|
+
.key-group-header {
|
|
32
|
+
padding: 6px 14px;
|
|
33
|
+
font-size: 11px;
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
opacity: 0.7;
|
|
36
|
+
background: var(--bg-subtle);
|
|
37
|
+
border-bottom: 1px solid var(--border);
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 6px;
|
|
41
|
+
}
|
|
42
|
+
.key-group-count { opacity: 0.6; font-weight: 400; }
|
|
43
|
+
.key-group-link {
|
|
44
|
+
background: none; border: none; padding: 0; margin: 0; font: inherit; font-weight: 700;
|
|
45
|
+
color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
|
|
46
|
+
}
|
|
47
|
+
.key-group-link:hover { opacity: 0.8; }
|
|
48
|
+
.row { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 8px; }
|
|
49
|
+
.row:hover { background: var(--hover); }
|
|
50
|
+
.row.deprecated { opacity: 0.55; }
|
|
51
|
+
.row.paused { opacity: 0.6; }
|
|
52
|
+
.row-checkbox { flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
|
|
53
|
+
.row-body { flex: 1 1 auto; min-width: 0; }
|
|
54
|
+
.top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
|
|
55
|
+
.name { font-weight: 600; }
|
|
56
|
+
.deprecated .name { text-decoration: line-through; }
|
|
57
|
+
.meta { opacity: 0.65; font-size: 11px; white-space: nowrap; }
|
|
58
|
+
.folder-path { font-size: 10.5px; opacity: 0.55; margin-top: 1px; }
|
|
59
|
+
.key-line { font-size: 10.5px; opacity: 0.6; margin-top: 1px; }
|
|
60
|
+
.desc { font-size: 12px; opacity: 0.8; margin-top: 3px; }
|
|
61
|
+
.tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
|
|
62
|
+
.tag { font-size: 10px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 6px; }
|
|
63
|
+
.type-badge {
|
|
64
|
+
font-size: 10px; text-transform: uppercase; font-weight: 700; flex: 0 0 auto;
|
|
65
|
+
border-radius: 4px; padding: 1px 5px; display: inline-flex; align-items: center; gap: 3px;
|
|
66
|
+
}
|
|
67
|
+
.type-badge.skill {
|
|
68
|
+
border: 1px solid var(--purple); color: var(--purple-fg); background: var(--purple-tint);
|
|
69
|
+
}
|
|
70
|
+
.type-badge.memory {
|
|
71
|
+
border: 1px solid var(--accent); color: var(--accent); background: var(--accent-tint);
|
|
72
|
+
}
|
|
73
|
+
.deprecated-badge {
|
|
74
|
+
font-size: 10px; text-transform: uppercase; border: 1px solid var(--danger);
|
|
75
|
+
color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-radius: 4px; padding: 0 4px;
|
|
76
|
+
}
|
|
77
|
+
.paused-badge {
|
|
78
|
+
font-size: 10px; text-transform: uppercase; border: 1px solid var(--accent);
|
|
79
|
+
color: var(--accent); background: var(--accent-tint); border-radius: 4px; padding: 0 4px;
|
|
80
|
+
}
|
|
81
|
+
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
82
|
+
`}render(){return!this.results||this.results.length===0?l`<div class="empty">No results.</div>`:l`
|
|
83
|
+
<div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
|
|
84
|
+
${Ds(this.results).map(e=>l`
|
|
85
|
+
${e.label?l`<div class="key-group-header">
|
|
86
|
+
${e.icon}
|
|
87
|
+
<button
|
|
88
|
+
class="key-group-link"
|
|
89
|
+
title=${e.icon==="🔑"?"Search for this key":"Search for this group"}
|
|
90
|
+
@click=${()=>e.icon==="🔑"?this.onKeyClick?.(e.label):this.onGroupClick?.(e.label)}
|
|
91
|
+
>
|
|
92
|
+
${e.label}
|
|
93
|
+
</button>
|
|
94
|
+
<span class="key-group-count">(${e.items.length})</span>
|
|
95
|
+
</div>`:e.items.length>0&&e.icon==="📂"?l`<div class="key-group-header">
|
|
96
|
+
📂 <span>Ungrouped</span> <span class="key-group-count">(${e.items.length})</span>
|
|
97
|
+
</div>`:""}
|
|
98
|
+
${e.items.map(t=>this.#e(t))}
|
|
99
|
+
`)}
|
|
100
|
+
`}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return l`
|
|
101
|
+
<div class="row ${e.deprecated?"deprecated":""} ${e.paused?"paused":""}" @click=${()=>this.onSelect(e)}>
|
|
102
|
+
<input
|
|
103
|
+
type="checkbox"
|
|
104
|
+
class="row-checkbox"
|
|
105
|
+
.checked=${this.selectedIds?.has(e.id)??!1}
|
|
106
|
+
.disabled=${t}
|
|
107
|
+
title=${t?"Builtin skills can't be bulk-deprecated, paused, or deleted":""}
|
|
108
|
+
@click=${s=>{s.stopPropagation(),t||this.onToggleSelect(e)}}
|
|
109
|
+
/>
|
|
110
|
+
<div class="row-body">
|
|
111
|
+
<div class="top">
|
|
112
|
+
<span class="name">
|
|
113
|
+
<span class="type-badge ${e._table==="skills"?"skill":"memory"}"
|
|
114
|
+
>${e._table==="skills"?"⚡ skill":"📝 memory"}</span
|
|
115
|
+
>
|
|
116
|
+
${e.name}
|
|
117
|
+
</span>
|
|
118
|
+
<span class="meta">${Os(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
|
|
119
|
+
</div>
|
|
120
|
+
${e._table==="memory_docs"&&e.key?l`<div class="key-line">🔑 ${e.key}</div>`:""}
|
|
121
|
+
${e._table==="skills"&&e.group?l`<div class="key-line">
|
|
122
|
+
📂
|
|
123
|
+
<button
|
|
124
|
+
class="key-group-link"
|
|
125
|
+
title="Search for this group"
|
|
126
|
+
@click=${s=>{s.stopPropagation(),this.onGroupClick?.(e.group)}}
|
|
127
|
+
>
|
|
128
|
+
${e.group}
|
|
129
|
+
</button>
|
|
130
|
+
</div>`:""}
|
|
131
|
+
${this.showFolder&&e.folder?l`<div class="folder-path">📁 ${e.folder}</div>`:""}
|
|
132
|
+
<div class="desc">${e.description}</div>
|
|
133
|
+
<div class="tags">
|
|
134
|
+
${e.deprecated?l`<span class="deprecated-badge">deprecated</span>`:""}
|
|
135
|
+
${e.paused?l`<span class="paused-badge">paused</span>`:""}
|
|
136
|
+
${e.tags.map(s=>l`<span class="tag">${s}</span>`)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
`}}customElements.define("result-list",Ms);function Le(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var U=Le();function qt(n){U=n}var I={exec:()=>null};function j(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=n(s),e[s]=i),i}}function b(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace($.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var Ns=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),$={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:j(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:j(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:j(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:j(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:j(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:j(n=>new RegExp(`^ {0,${n}}>`))},Us=/^(?:[ \t]*(?:\n|$))+/,js=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,te=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Bt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ht=b(Bt).replace(/bull/g,Fe).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(),Hs=b(Bt).replace(/bull/g,Fe).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(),Oe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ks=/^[^\n]+/,De=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Vs=b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",De).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gs=b(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Fe).getRegex(),fe="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",Me=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ws=b("^ {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",Me).replace("tag",fe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Kt=n=>b(Oe).replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fe).getRegex(),Zs=Kt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Js=Kt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ys=b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Js).getRegex(),Ne={blockquote:Ys,code:js,def:Vs,fences:qs,heading:Bs,hr:te,html:Ws,lheading:Ht,list:Gs,newline:Us,paragraph:Zs,table:I,text:Ks},rt=b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",te).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",fe).getRegex(),Qs={...Ne,lheading:Hs,table:rt,paragraph:b(Oe).replace("hr",te).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rt).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",fe).getRegex()},Xs={...Ne,html:b(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me).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:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:b(Oe).replace("hr",te).replace("heading",` *#{1,6} *[^
|
|
141
|
+
]`).replace("lheading",Ht).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ei=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ti=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Vt=/^( {2,}|\\)\n(?!\s*$)/,si=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E=/[\p{P}\p{S}]/u,V=/[\s\p{P}\p{S}]/u,se=/[^\s\p{P}\p{S}]/u,ii=b(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,V).getRegex(),ri=/[\p{Pi}\p{Ps}"']/u,Gt=/(?!~)[\p{P}\p{S}]/u,ni=/(?!~)[\s\p{P}\p{S}]/u,oi=/(?:[^\s\p{P}\p{S}]|~)/u,ai=b(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ns?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Wt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,li=b(Wt,"u").replace(/punct/g,E).getRegex(),ci=b(Wt,"u").replace(/punct/g,Gt).getRegex(),di=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,hi=b(di,"u").replace(/openQuote/g,ri).replace(/punct/g,E).getRegex(),Zt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",pi=b(Zt,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),ui=b(Zt,"gu").replace(/notPunctSpace/g,oi).replace(/punctSpace/g,ni).replace(/punct/g,Gt).getRegex(),fi="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",gi=b(fi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),bi=b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),mi="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",vi=b(mi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),xi=b(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,E).getRegex(),yi="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ki=b(yi,"gu").replace(/notPunctSpace/g,se).replace(/punctSpace/g,V).replace(/punct/g,E).getRegex(),$i=b(/\\(punct)/,"gu").replace(/punct/g,E).getRegex(),wi=b(/^<(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(),_i=b(Me).replace("(?:-->|$)","-->").getRegex(),Si=b("^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",_i).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ce=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ci=b(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ce).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jt=b(/^!?\[(label)\]\[(ref)\]/).replace("label",ce).replace("ref",De).getRegex(),Yt=b(/^!?\[(ref)\](?:\[\])?/).replace("ref",De).getRegex(),Ti=b("reflink|nolink(?!\\()","g").replace("reflink",Jt).replace("nolink",Yt).getRegex(),nt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ue={_backpedal:I,anyPunctuation:$i,autolink:wi,blockSkip:ai,br:Vt,code:ti,del:I,delLDelim:I,delRDelim:I,emStrongLDelim:li,emStrongRDelimAst:pi,emStrongRDelimUnd:bi,escape:ei,link:Ci,nolink:Yt,punctuation:ii,reflink:Jt,reflinkSearch:Ti,tag:Si,text:si,url:I},Ai={...Ue,emStrongLDelim:hi,emStrongRDelimAst:gi,emStrongRDelimUnd:vi,link:b(/^!?\[(label)\]\((.*?)\)/).replace("label",ce).getRegex(),reflink:b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce).getRegex()},$e={...Ue,emStrongRDelimAst:ui,emStrongLDelim:ci,delLDelim:xi,delRDelim:ki,url:b(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",nt).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:b(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",nt).getRegex()},Ei={...$e,br:b(Vt).replace("{2,}","*").getRegex(),text:b($e.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ie={normal:Ne,gfm:Qs,pedantic:Xs},J={normal:Ue,gfm:$e,breaks:Ei,pedantic:Ai},Ri={"&":"&","<":"<",">":">",'"':""","'":"'"},ot=n=>Ri[n];function A(n,e){if(e){if($.escapeTest.test(n))return n.replace($.escapeReplace,ot)}else if($.escapeTestNoEncode.test(n))return n.replace($.escapeReplaceNoEncode,ot);return n}function at(n){try{n=encodeURI(n).replace($.percentDecode,"%")}catch{return null}return n}function lt(n,e){let t=n.replace($.findPipe,(r,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split($.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($.slashPipe,"|");return s}function R(n,e,t){let s=n.length;if(s===0)return"";let i=0;for(;i<s&&n.charAt(s-i-1)===e;)i++;return n.slice(0,s-i)}function ct(n){let e=n.split(`
|
|
142
|
+
`),t=e.length-1;for(;t>=0&&$.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
143
|
+
`)}function zi(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Pi(n,e=0){let t=e,s="";for(let i of n)if(i===" "){let r=4-t%4;s+=" ".repeat(r),t+=r}else s+=i,t++;return s}function dt(n,e,t,s,i){let r=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let p=s.inlineTokens(a),g=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(g){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:r,title:o,text:a,tokens:p}}function Ii(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
144
|
+
`).map(r=>{let o=r.match(t.other.beginningSpace);if(o===null)return r;let[a]=o;return a.length>=i.length?r.slice(i.length):r}).join(`
|
|
145
|
+
`)}var de=class{options;rules;lexer;constructor(n){this.options=n||U}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:ct(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=Ii(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=R(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:R(e[0],`
|
|
146
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:R(e[0],`
|
|
147
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=R(e[0],`
|
|
148
|
+
`).split(`
|
|
149
|
+
`),s="",i="",r=[];for(;t.length>0;){let o=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),o=!0;else if(!o)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
|
|
150
|
+
`),u=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
151
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
152
|
+
${d}`:d,i=i?`${i}
|
|
153
|
+
${u}`:u;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=p,t.length===0)break;let g=r.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let x=g,m=t.join(`
|
|
154
|
+
`),T=x.raw+`
|
|
155
|
+
`+m.replace(this.rules.other.blockquoteSetextReplace2,""),G=this.blockquote(T);r[r.length-1]=G,s=`${s}
|
|
156
|
+
${m}`,i=i.substring(0,i.length-x.text.length)+G.text;break}else if(g?.type==="list"){let x=g,m=x.raw+`
|
|
157
|
+
`+t.join(`
|
|
158
|
+
`),T=this.list(m);r[r.length-1]=T,s=s.substring(0,s.length-g.raw.length)+T.raw,i=i.substring(0,i.length-x.raw.length)+T.raw,t=m.substring(r.at(-1).raw.length).split(`
|
|
159
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,i={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let r=this.rules.other.listItemRegex(t),o=!1;for(;n;){let c=!1,d="",u="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let p=Pi(e[2].split(`
|
|
160
|
+
`,1)[0],e[1].length),g=n.split(`
|
|
161
|
+
`,1)[0],x=!p.trim(),m=0;if(this.options.pedantic?(m=2,u=p.trimStart()):x?m=e[1].length+1:(m=p.search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=p.slice(m),m+=e[1].length),x&&this.rules.other.blankLine.test(g)&&(d+=g+`
|
|
162
|
+
`,n=n.substring(g.length+1),c=!0),!c){let T=this.rules.other.nextBulletRegex(m),G=this.rules.other.hrRegex(m),qe=this.rules.other.fencesBeginRegex(m),Be=this.rules.other.headingBeginRegex(m),ns=this.rules.other.htmlBeginRegex(m),os=this.rules.other.blockquoteBeginRegex(m);for(;n;){let ge=n.split(`
|
|
163
|
+
`,1)[0],W;if(g=ge,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),W=g):W=g.replace(this.rules.other.tabCharGlobal," "),qe.test(g)||Be.test(g)||ns.test(g)||os.test(g)||T.test(g)||G.test(g))break;if(W.search(this.rules.other.nonSpaceChar)>=m||!g.trim())u+=`
|
|
164
|
+
`+W.slice(m);else{if(x||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||qe.test(p)||Be.test(p)||G.test(p))break;u+=`
|
|
165
|
+
`+g}x=!g.trim(),d+=ge+`
|
|
166
|
+
`,n=n.substring(ge.length+1),p=W.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),i.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=d}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!i.loose){let d=c.tokens.filter(p=>p.type==="space"),u=d.length>0&&d.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=u}for(let c of i.items){let d=c.tokens[0];if(c.task&&(d?.type==="text"||d?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let p={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=p.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=p.raw+c.tokens[0].raw,c.tokens[0].text=p.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(p)):c.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):c.tokens.unshift(p)}}else c.task&&(c.task=!1)}if(i.loose)for(let c of i.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return i}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=ct(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:R(e[0],`
|
|
167
|
+
`),href:s,title:i}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=lt(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
168
|
+
`):[],r={type:"table",raw:R(e[0],`
|
|
169
|
+
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<t.length;o++)r.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:r.align[o]});for(let o of i)r.rows.push(lt(o,r.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[c]})));return r}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:R(e[0],`
|
|
170
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
171
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=R(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=zi(e[2],"()");if(r===-2)return;if(r>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],i=r[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),dt(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return dt(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,c=0,d=s[0][0],u=t===d,p=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*n.length+i);(s=p.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(a-=o,a>0)continue;o=Math.min(o,o+a+c);let g=[...s[0]][0].length,x=n.slice(0,i+s.index+g+o);if(Math.min(i,o)%2){let T=x.slice(1,-1);return{type:"em",raw:x,text:T,tokens:this.lexer.inlineTokens(T)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,r,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+i);(s=c.exec(e))!==null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r||(o=[...r].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,u=n.slice(0,i+s.index+d+o),p=u.slice(i,-i);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},S=class we{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||U,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:$,block:ie.normal,inline:J.normal};this.options.pedantic?(t.block=ie.pedantic,t.inline=J.pedantic):this.options.gfm&&(t.block=ie.gfm,this.options.breaks?t.inline=J.breaks:t.inline=J.gfm),this.tokenizer.rules=t}static get rules(){return{block:ie,inline:J}}static lex(e,t){return new we(t).lex(e)}static lexInline(e,t){return new we(t).inlineTokens(e)}lex(e){e=e.replace($.carriageReturn,`
|
|
172
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace($.tabCharGlobal," ").replace($.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
|
|
173
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
174
|
+
`)?"":`
|
|
175
|
+
`)+r.raw,a.text+=`
|
|
176
|
+
`+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
177
|
+
`)?"":`
|
|
178
|
+
`)+r.raw,a.text+=`
|
|
179
|
+
`+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
180
|
+
`)?"":`
|
|
181
|
+
`)+r.raw,a.text+=`
|
|
182
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),s=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
183
|
+
`)?"":`
|
|
184
|
+
`)+r.raw,a.text+=`
|
|
185
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=s[0],r=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,i.slice(r+1,-1)))&&!(r>1&&this.linkInText(i.slice(1,r-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=d=>{let u=d.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,d.slice(u+1,-1)))return d;if(u>1&&d.charAt(0)!=="!"){let p=d.slice(1,u-1);if(this.linkInText(p))return"["+p.replace(a,c)+"]["+"a".repeat(d.length-u-2)+"]"}return"["+"a".repeat(d.length-2)+"]"};s=s.replace(a,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(a,c,d)=>{let u=d?d.length:0;return a.slice(0,u)+"["+"a".repeat(a.length-u-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,r="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}i||(r=""),i=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},u),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),i=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},he=class{options;parser;constructor(n){this.options=n||U}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match($.notSpaceStart)?.[0],i=n.replace($.endingNewline,"")+`
|
|
186
|
+
`;return s?'<pre><code class="language-'+A(s)+'">'+(t?i:A(i,!0))+`</code></pre>
|
|
187
|
+
`:"<pre><code>"+(t?i:A(i,!0))+`</code></pre>
|
|
188
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
189
|
+
${this.parser.parse(n)}</blockquote>
|
|
190
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
191
|
+
`}hr(n){return`<hr>
|
|
192
|
+
`}list(n){let e=n.ordered,t=n.start,s="";for(let o=0;o<n.items.length;o++){let a=n.items[o];s+=this.listitem(a)}let i=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+i+r+`>
|
|
193
|
+
`+s+"</"+i+`>
|
|
194
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
195
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
196
|
+
`}table(n){let e="",t="";for(let i=0;i<n.header.length;i++)t+=this.tablecell(n.header[i]);e+=this.tablerow({text:t});let s="";for(let i=0;i<n.rows.length;i++){let r=n.rows[i];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
197
|
+
<thead>
|
|
198
|
+
`+e+`</thead>
|
|
199
|
+
`+s+`</table>
|
|
200
|
+
`}tablerow({text:n}){return`<tr>
|
|
201
|
+
${n}</tr>
|
|
202
|
+
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
203
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${A(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),i=at(n);if(i===null)return s;n=i;let r='<a href="'+n+'"';return e&&(r+=' title="'+A(e)+'"'),r+=">"+s+"</a>",r}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=at(n);if(i===null)return A(t);n=i;let r=`<img src="${n}" alt="${A(t)}"`;return e&&(r+=` title="${A(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:A(n.text)}},je=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},C=class _e{options;renderer;textRenderer;constructor(e){this.options=e||U,this.options.renderer=this.options.renderer||new he,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new je}static parse(e,t){return new _e(t).parse(e)}static parseInline(e,t){return new _e(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let r=i;switch(r.type){case"space":{t+=this.renderer.space(r);break}case"hr":{t+=this.renderer.hr(r);break}case"heading":{t+=this.renderer.heading(r);break}case"code":{t+=this.renderer.code(r);break}case"table":{t+=this.renderer.table(r);break}case"blockquote":{t+=this.renderer.blockquote(r);break}case"list":{t+=this.renderer.list(r);break}case"checkbox":{t+=this.renderer.checkbox(r);break}case"html":{t+=this.renderer.html(r);break}case"def":{t+=this.renderer.def(r);break}case"paragraph":{t+=this.renderer.paragraph(r);break}case"text":{t+=this.renderer.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let r=e[i];if(this.options.extensions?.renderers?.[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){s+=a||"";continue}}let o=r;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},Y=class{options;block;constructor(n){this.options=n||U}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?S.lex:S.lexInline}provideParser(n=this.block){return n?C.parse:C.parseInline}},Li=class{defaults=Le();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=C;Renderer=he;TextRenderer=je;Lexer=S;Tokenizer=de;Hooks=Y;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let r of i.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of i.rows)for(let o of r)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{let o=i[r].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let r=e.renderers[i.name];r?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[i.level];r?r.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new he(this.defaults);for(let r in t.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=t.renderer[o],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u||""}}s.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new de(this.defaults);for(let r in t.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=t.tokenizer[o],c=i[o];i[o]=(...d)=>{let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Y;for(let r in t.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=t.hooks[o],c=i[o];Y.passThroughHooks.has(r)?i[o]=d=>{if(this.defaults.async&&Y.passThroughHooksRespectAsync.has(r))return(async()=>{let p=await a.call(i,d);return c.call(i,p)})();let u=a.call(i,d);return c.call(i,u)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,d);return p===!1&&(p=await c.apply(i,d)),p})();let u=a.apply(i,d);return u===!1&&(u=c.apply(i,d)),u}}s.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,r=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return S.lex(n,e??this.defaults)}parser(n,e){return C.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},i={...this.defaults,...s},r=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(n):n?S.lex:S.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(n):n?C.parse:C.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(r);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(n):n?S.lex:S.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(n):n?C.parse:C.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(n,e){return t=>{if(t.message+=`
|
|
204
|
+
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+A(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},M=new Li;function v(n,e){return M.parse(n,e)}v.options=v.setOptions=function(n){return M.setOptions(n),v.defaults=M.defaults,qt(v.defaults),v};v.getDefaults=Le;v.defaults=U;function Fi(...n){return M.use(...n),v.defaults=M.defaults,qt(v.defaults),v}v.use=Fi;v.walkTokens=function(n,e){return M.walkTokens(n,e)};v.parseInline=M.parseInline;v.Parser=C;v.parser=C.parse;v.Renderer=he;v.TextRenderer=je;v.Lexer=S;v.lexer=S.lex;v.Tokenizer=de;v.Hooks=Y;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;C.parse;S.lex;/**
|
|
205
|
+
* @license
|
|
206
|
+
* Copyright 2017 Google LLC
|
|
207
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
208
|
+
*/const Oi={CHILD:2},Di=n=>(...e)=>({_$litDirective$:n,values:e});class Mi{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)}}/**
|
|
209
|
+
* @license
|
|
210
|
+
* Copyright 2017 Google LLC
|
|
211
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
212
|
+
*/class Se extends Mi{constructor(e){if(super(e),this.it=f,e.type!==Oi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===D)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:[]}}}Se.directiveName="unsafeHTML",Se.resultType=1;const Ni=Di(Se);let ht=0;class Ui extends k{static{this.properties={tags:{attribute:!1},active:{attribute:!1},onToggle:{attribute:!1},allowCreate:{attribute:!1},width:{attribute:!1}}}#e=new h("");#t=new h(!1);#s=new h(-1);#n;#r;static{this.styles=w`
|
|
213
|
+
:host {
|
|
214
|
+
display: inline-block;
|
|
215
|
+
position: relative;
|
|
216
|
+
width: fit-content;
|
|
217
|
+
min-width: 200px;
|
|
218
|
+
max-width: 100%;
|
|
219
|
+
font: inherit;
|
|
220
|
+
font-size: 13px;
|
|
221
|
+
}
|
|
222
|
+
.field {
|
|
223
|
+
display: flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
gap: 4px;
|
|
226
|
+
border: 1px solid var(--border-strong);
|
|
227
|
+
border-radius: 6px;
|
|
228
|
+
background: none;
|
|
229
|
+
padding: 3px 4px 3px 8px;
|
|
230
|
+
min-height: 30px;
|
|
231
|
+
box-sizing: border-box;
|
|
232
|
+
}
|
|
233
|
+
.chips-and-input {
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
flex-wrap: wrap;
|
|
237
|
+
gap: 4px;
|
|
238
|
+
flex: 1 1 auto;
|
|
239
|
+
min-width: 0;
|
|
240
|
+
}
|
|
241
|
+
.field:focus-within {
|
|
242
|
+
border-color: var(--accent);
|
|
243
|
+
box-shadow: 0 0 0 2px var(--accent-tint);
|
|
244
|
+
}
|
|
245
|
+
.selected-chip {
|
|
246
|
+
display: inline-flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
gap: 4px;
|
|
249
|
+
background: var(--accent);
|
|
250
|
+
color: var(--accent-fg);
|
|
251
|
+
border-radius: 999px;
|
|
252
|
+
padding: 2px 6px 2px 10px;
|
|
253
|
+
font-size: 12px;
|
|
254
|
+
white-space: nowrap;
|
|
255
|
+
}
|
|
256
|
+
.selected-chip .remove {
|
|
257
|
+
cursor: pointer;
|
|
258
|
+
opacity: 0.85;
|
|
259
|
+
line-height: 1;
|
|
260
|
+
padding: 2px;
|
|
261
|
+
border-radius: 50%;
|
|
262
|
+
}
|
|
263
|
+
.selected-chip .remove:hover { opacity: 1; background: #ffffff33; }
|
|
264
|
+
.input {
|
|
265
|
+
flex: 1 1 60px;
|
|
266
|
+
min-width: 60px;
|
|
267
|
+
border: none;
|
|
268
|
+
outline: none;
|
|
269
|
+
padding: 5px 2px;
|
|
270
|
+
font: inherit;
|
|
271
|
+
font-size: 13px;
|
|
272
|
+
background: transparent;
|
|
273
|
+
color: inherit;
|
|
274
|
+
}
|
|
275
|
+
.clear-btn, .chevron-btn {
|
|
276
|
+
border: none;
|
|
277
|
+
background: transparent;
|
|
278
|
+
cursor: pointer;
|
|
279
|
+
color: inherit;
|
|
280
|
+
opacity: 0.6;
|
|
281
|
+
font-size: 12px;
|
|
282
|
+
padding: 2px 5px;
|
|
283
|
+
line-height: 1;
|
|
284
|
+
}
|
|
285
|
+
.clear-btn:hover, .chevron-btn:hover { opacity: 1; }
|
|
286
|
+
.chevron-btn { transition: transform 0.15s ease; }
|
|
287
|
+
.chevron-btn.open { transform: rotate(180deg); }
|
|
288
|
+
|
|
289
|
+
.menu {
|
|
290
|
+
position: fixed;
|
|
291
|
+
margin: 0;
|
|
292
|
+
inset: auto;
|
|
293
|
+
top: anchor(bottom);
|
|
294
|
+
left: anchor(left);
|
|
295
|
+
width: anchor-size(width);
|
|
296
|
+
position-try-fallbacks: flip-block;
|
|
297
|
+
list-style: none;
|
|
298
|
+
padding: 4px;
|
|
299
|
+
margin: 0;
|
|
300
|
+
border: 1px solid var(--border);
|
|
301
|
+
border-radius: 8px;
|
|
302
|
+
background: var(--bg);
|
|
303
|
+
color: inherit;
|
|
304
|
+
box-shadow: 0 8px 24px var(--shadow);
|
|
305
|
+
max-height: 260px;
|
|
306
|
+
overflow-y: auto;
|
|
307
|
+
box-sizing: border-box;
|
|
308
|
+
}
|
|
309
|
+
.menu:popover-open { margin-top: 4px; }
|
|
310
|
+
.menu[popover] { display: none; }
|
|
311
|
+
.menu.visible[popover] { display: block; }
|
|
312
|
+
|
|
313
|
+
.option {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: 8px;
|
|
317
|
+
padding: 6px 8px;
|
|
318
|
+
border-radius: 5px;
|
|
319
|
+
cursor: pointer;
|
|
320
|
+
font-size: 13px;
|
|
321
|
+
}
|
|
322
|
+
.option:hover, .option.highlighted { background: var(--hover); }
|
|
323
|
+
.option input { margin: 0; pointer-events: none; }
|
|
324
|
+
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
325
|
+
.create-option { color: var(--accent); font-style: italic; }
|
|
326
|
+
`}constructor(){super(),new N(this),this.tags=[],this.active=[],this.onToggle=()=>{},this.allowCreate=!1,this.#n=`--tag-multiselect-${++ht}`,this.#r=`tag-multiselect-listbox-${ht}`}willUpdate(){this.style.width=this.width??""}#u=e=>{e.composedPath().includes(this)||this.#o()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#u)}disconnectedCallback(){document.removeEventListener("click",this.#u),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return e?this.tags.filter(t=>t.toLowerCase().includes(e)):this.tags}#i(){this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#o(){this.#t.set(!1),this.#s.set(-1),this.renderRoot.querySelector(".menu")?.hidePopover()}#d(){this.#t.value?this.#o():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#e.set(e.target.value),this.#s.set(-1),this.#i()}#h(e){this.onToggle(e),this.#e.set(""),this.#s.set(-1)}get#c(){if(!this.allowCreate)return!1;const e=this.#e.value.trim();return e.length>0&&!this.tags.includes(e)&&!this.active.includes(e)}#b(e){e.stopPropagation(),this.active.forEach(t=>this.onToggle(t)),this.#e.set(""),this.renderRoot.querySelector(".input")?.focus(),this.#i()}#$(e){const t=this.#a;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value+1)%t.length);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t.length&&this.#s.set((this.#s.value-1+t.length)%t.length);else if(e.key==="Enter"||this.allowCreate&&e.key===","){const s=t[this.#s.value];s!==void 0?(e.preventDefault(),this.#h(s)):this.#c&&(e.preventDefault(),this.#h(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.#o()}render(){const e=this.active,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
|
|
327
|
+
<div class="field" style=${`anchor-name: ${this.#n}`}>
|
|
328
|
+
<div class="chips-and-input">
|
|
329
|
+
${e.map(r=>l`
|
|
330
|
+
<span class="selected-chip">
|
|
331
|
+
${r}
|
|
332
|
+
<span class="remove" @click=${()=>this.onToggle(r)}>✕</span>
|
|
333
|
+
</span>
|
|
334
|
+
`)}
|
|
335
|
+
<input
|
|
336
|
+
class="input"
|
|
337
|
+
role="combobox"
|
|
338
|
+
aria-autocomplete="list"
|
|
339
|
+
aria-expanded=${s}
|
|
340
|
+
aria-controls=${this.#r}
|
|
341
|
+
aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
|
|
342
|
+
placeholder=${e.length===0?"Filter by tag…":""}
|
|
343
|
+
.value=${this.#e.value}
|
|
344
|
+
@input=${r=>this.#g(r)}
|
|
345
|
+
@focus=${()=>this.#i()}
|
|
346
|
+
@click=${()=>this.#i()}
|
|
347
|
+
@keydown=${r=>this.#$(r)}
|
|
348
|
+
/>
|
|
349
|
+
</div>
|
|
350
|
+
${e.length>0?l`<button class="clear-btn" tabindex="-1" @mousedown=${r=>r.preventDefault()} @click=${r=>this.#b(r)}>✕</button>`:""}
|
|
351
|
+
<button
|
|
352
|
+
class="chevron-btn ${s?"open":""}"
|
|
353
|
+
tabindex="-1"
|
|
354
|
+
@mousedown=${r=>r.preventDefault()}
|
|
355
|
+
@click=${()=>this.#d()}
|
|
356
|
+
>
|
|
357
|
+
▾
|
|
358
|
+
</button>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<ul
|
|
362
|
+
id=${this.#r}
|
|
363
|
+
class="menu ${s?"visible":""}"
|
|
364
|
+
role="listbox"
|
|
365
|
+
aria-multiselectable="true"
|
|
366
|
+
popover="manual"
|
|
367
|
+
style=${`position-anchor: ${this.#n}`}
|
|
368
|
+
>
|
|
369
|
+
${t.length?t.map((r,o)=>l`
|
|
370
|
+
<li
|
|
371
|
+
id=${`${this.#r}-opt-${o}`}
|
|
372
|
+
role="option"
|
|
373
|
+
aria-selected=${e.includes(r)}
|
|
374
|
+
class=${o===i?"option highlighted":"option"}
|
|
375
|
+
@mousedown=${a=>a.preventDefault()}
|
|
376
|
+
@click=${()=>this.#h(r)}
|
|
377
|
+
>
|
|
378
|
+
<input type="checkbox" .checked=${e.includes(r)} tabindex="-1" />
|
|
379
|
+
${r}
|
|
380
|
+
</li>
|
|
381
|
+
`):this.#c?l`
|
|
382
|
+
<li
|
|
383
|
+
class="option create-option"
|
|
384
|
+
@mousedown=${r=>r.preventDefault()}
|
|
385
|
+
@click=${()=>this.#h(this.#e.value.trim())}
|
|
386
|
+
>
|
|
387
|
+
No match. Create '${this.#e.value.trim()}'
|
|
388
|
+
</li>
|
|
389
|
+
`:l`<li class="empty">${this.allowCreate?"Type to create a tag":"No matches"}</li>`}
|
|
390
|
+
</ul>
|
|
391
|
+
`}}customElements.define("tag-multiselect",Ui);let pt=0;class ji extends k{static{this.properties={options:{attribute:!1},value:{attribute:!1},onChange:{attribute:!1}}}#e=new h("");#t=new h(!1);#s=new h(-1);#n;#r;static{this.styles=w`
|
|
392
|
+
:host {
|
|
393
|
+
display: inline-block;
|
|
394
|
+
position: relative;
|
|
395
|
+
width: 100%;
|
|
396
|
+
max-width: 320px;
|
|
397
|
+
font: inherit;
|
|
398
|
+
font-size: 13px;
|
|
399
|
+
}
|
|
400
|
+
.field {
|
|
401
|
+
display: flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
gap: 4px;
|
|
404
|
+
border: 1px solid var(--border-strong);
|
|
405
|
+
border-radius: 6px;
|
|
406
|
+
background: var(--bg);
|
|
407
|
+
padding: 3px 4px 3px 8px;
|
|
408
|
+
min-height: 30px;
|
|
409
|
+
box-sizing: border-box;
|
|
410
|
+
}
|
|
411
|
+
.field:focus-within {
|
|
412
|
+
border-color: var(--accent);
|
|
413
|
+
box-shadow: 0 0 0 2px var(--accent-tint);
|
|
414
|
+
}
|
|
415
|
+
.input {
|
|
416
|
+
flex: 1 1 auto;
|
|
417
|
+
min-width: 0;
|
|
418
|
+
border: none;
|
|
419
|
+
outline: none;
|
|
420
|
+
padding: 5px 2px;
|
|
421
|
+
font: inherit;
|
|
422
|
+
font-size: 13px;
|
|
423
|
+
background: transparent;
|
|
424
|
+
color: inherit;
|
|
425
|
+
}
|
|
426
|
+
.chevron-btn {
|
|
427
|
+
border: none;
|
|
428
|
+
background: transparent;
|
|
429
|
+
cursor: pointer;
|
|
430
|
+
color: inherit;
|
|
431
|
+
opacity: 0.6;
|
|
432
|
+
font-size: 12px;
|
|
433
|
+
padding: 2px 5px;
|
|
434
|
+
line-height: 1;
|
|
435
|
+
flex: 0 0 auto;
|
|
436
|
+
}
|
|
437
|
+
.chevron-btn:hover { opacity: 1; }
|
|
438
|
+
.chevron-btn { transition: transform 0.15s ease; }
|
|
439
|
+
.chevron-btn.open { transform: rotate(180deg); }
|
|
440
|
+
|
|
441
|
+
.menu {
|
|
442
|
+
position: fixed;
|
|
443
|
+
margin: 0;
|
|
444
|
+
inset: auto;
|
|
445
|
+
top: anchor(bottom);
|
|
446
|
+
left: anchor(left);
|
|
447
|
+
width: anchor-size(width);
|
|
448
|
+
position-try-fallbacks: flip-block;
|
|
449
|
+
list-style: none;
|
|
450
|
+
padding: 4px;
|
|
451
|
+
margin: 0;
|
|
452
|
+
border: 1px solid var(--border);
|
|
453
|
+
border-radius: 8px;
|
|
454
|
+
background: var(--bg);
|
|
455
|
+
color: inherit;
|
|
456
|
+
box-shadow: 0 8px 24px var(--shadow);
|
|
457
|
+
max-height: 260px;
|
|
458
|
+
overflow-y: auto;
|
|
459
|
+
box-sizing: border-box;
|
|
460
|
+
}
|
|
461
|
+
.menu:popover-open { margin-top: 4px; }
|
|
462
|
+
.menu[popover] { display: none; }
|
|
463
|
+
.menu.visible[popover] { display: block; }
|
|
464
|
+
|
|
465
|
+
.option {
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
gap: 8px;
|
|
469
|
+
padding: 6px 8px;
|
|
470
|
+
border-radius: 5px;
|
|
471
|
+
cursor: pointer;
|
|
472
|
+
font-size: 13px;
|
|
473
|
+
}
|
|
474
|
+
.option:hover, .option.highlighted { background: var(--hover); }
|
|
475
|
+
.option.selected { font-weight: 600; }
|
|
476
|
+
.empty { padding: 6px 8px; opacity: 0.6; font-style: italic; font-size: 12px; }
|
|
477
|
+
.create-option { color: var(--accent); font-style: italic; }
|
|
478
|
+
`}constructor(){super(),new N(this),this.options=[],this.value="",this.onChange=()=>{},this.#n=`--status-select-${++pt}`,this.#r=`status-select-listbox-${pt}`}#u=e=>{e.composedPath().includes(this)||this.#o()};connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#u)}disconnectedCallback(){document.removeEventListener("click",this.#u),super.disconnectedCallback()}get#a(){const e=this.#e.value.trim().toLowerCase();return!e||e===this.value.trim().toLowerCase()?this.options:this.options.filter(t=>t.toLowerCase().includes(e))}#i(){this.#e.set(this.value),this.#t.set(!0),this.updateComplete.then(()=>{this.renderRoot.querySelector(".menu")?.showPopover()})}#o(){this.#t.set(!1),this.#s.set(-1),this.#e.set(this.value),this.renderRoot.querySelector(".menu")?.hidePopover()}#d(){this.#t.value?this.#o():(this.#i(),this.renderRoot.querySelector(".input")?.focus())}#g(e){this.#e.set(e.target.value),this.#s.set(-1),this.#t.value||this.#i()}#h(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}#c(e){const t=this.#h(e);if(!t)return this.#o();this.onChange(t),this.#e.set(t),this.#s.set(-1),this.#o()}get#b(){const e=this.#h(this.#e.value);return e.length>0&&!this.options.some(t=>t.toLowerCase()===e)}get#$(){return this.#a.length+(this.#b?1:0)}#x(e){const t=this.#$;if(e.key==="ArrowDown")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value+1)%t);else if(e.key==="ArrowUp")e.preventDefault(),this.#i(),t&&this.#s.set((this.#s.value-1+t)%t);else if(e.key==="Enter"){e.preventDefault();const s=this.#a,i=s[this.#s.value];i!==void 0?this.#c(i):this.#s.value===s.length&&this.#b?this.#c(this.#e.value):this.#e.value.trim()&&this.#c(this.#e.value)}else e.key==="Escape"&&(e.preventDefault(),this.#o())}render(){const e=this.value,t=this.#a,s=this.#t.value,i=this.#s.value;return l`
|
|
479
|
+
<div class="field" style=${`anchor-name: ${this.#n}`}>
|
|
480
|
+
<input
|
|
481
|
+
class="input"
|
|
482
|
+
role="combobox"
|
|
483
|
+
aria-autocomplete="list"
|
|
484
|
+
aria-expanded=${s}
|
|
485
|
+
aria-controls=${this.#r}
|
|
486
|
+
aria-activedescendant=${i>=0?`${this.#r}-opt-${i}`:""}
|
|
487
|
+
.value=${s?this.#e.value:e}
|
|
488
|
+
@input=${r=>this.#g(r)}
|
|
489
|
+
@focus=${()=>this.#i()}
|
|
490
|
+
@click=${()=>this.#i()}
|
|
491
|
+
@keydown=${r=>this.#x(r)}
|
|
492
|
+
@blur=${()=>{this.#t.value&&this.#e.value.trim()&&this.#h(this.#e.value)!==e?this.#c(this.#e.value):this.#o()}}
|
|
493
|
+
/>
|
|
494
|
+
<button
|
|
495
|
+
class="chevron-btn ${s?"open":""}"
|
|
496
|
+
tabindex="-1"
|
|
497
|
+
@mousedown=${r=>r.preventDefault()}
|
|
498
|
+
@click=${()=>this.#d()}
|
|
499
|
+
>
|
|
500
|
+
▾
|
|
501
|
+
</button>
|
|
502
|
+
</div>
|
|
503
|
+
|
|
504
|
+
<ul
|
|
505
|
+
id=${this.#r}
|
|
506
|
+
class="menu ${s?"visible":""}"
|
|
507
|
+
role="listbox"
|
|
508
|
+
popover="manual"
|
|
509
|
+
style=${`position-anchor: ${this.#n}`}
|
|
510
|
+
>
|
|
511
|
+
${t.map((r,o)=>l`
|
|
512
|
+
<li
|
|
513
|
+
id=${`${this.#r}-opt-${o}`}
|
|
514
|
+
role="option"
|
|
515
|
+
aria-selected=${r===e}
|
|
516
|
+
class=${`option ${r===e?"selected":""} ${o===i?"highlighted":""}`}
|
|
517
|
+
@mousedown=${a=>a.preventDefault()}
|
|
518
|
+
@click=${()=>this.#c(r)}
|
|
519
|
+
>
|
|
520
|
+
${r}
|
|
521
|
+
</li>
|
|
522
|
+
`)}
|
|
523
|
+
${this.#b?l`
|
|
524
|
+
<li
|
|
525
|
+
id=${`${this.#r}-opt-${t.length}`}
|
|
526
|
+
role="option"
|
|
527
|
+
class=${`option create-option ${t.length===i?"highlighted":""}`}
|
|
528
|
+
@mousedown=${r=>r.preventDefault()}
|
|
529
|
+
@click=${()=>this.#c(this.#e.value)}
|
|
530
|
+
>
|
|
531
|
+
${t.length?"Create":"No match. Create"} '${this.#h(this.#e.value)}'
|
|
532
|
+
</li>
|
|
533
|
+
`:""}
|
|
534
|
+
${!t.length&&!this.#b?l`<li class="empty">No options</li>`:""}
|
|
535
|
+
</ul>
|
|
536
|
+
`}}customElements.define("status-select",ji);let qi=0;const Bi={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;"},Hi=["top","bottom","left","right"];class Ki extends k{static{this.properties={text:{attribute:!1},placement:{attribute:!1}}}#e;#t=null;static{this.styles=w`
|
|
537
|
+
:host {
|
|
538
|
+
display: inline-flex;
|
|
539
|
+
position: relative;
|
|
540
|
+
vertical-align: middle;
|
|
541
|
+
}
|
|
542
|
+
.icon {
|
|
543
|
+
display: inline-flex;
|
|
544
|
+
align-items: center;
|
|
545
|
+
justify-content: center;
|
|
546
|
+
width: 14px;
|
|
547
|
+
height: 14px;
|
|
548
|
+
border-radius: 50%;
|
|
549
|
+
border: 1px solid var(--border-strong);
|
|
550
|
+
background: transparent;
|
|
551
|
+
color: inherit;
|
|
552
|
+
opacity: 0.55;
|
|
553
|
+
font-size: 10px;
|
|
554
|
+
line-height: 1;
|
|
555
|
+
cursor: help;
|
|
556
|
+
padding: 0;
|
|
557
|
+
}
|
|
558
|
+
.icon:hover, .icon:focus-visible {
|
|
559
|
+
opacity: 1;
|
|
560
|
+
border-color: var(--accent);
|
|
561
|
+
color: var(--accent);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.bubble {
|
|
565
|
+
/* Primary position (top/bottom/left/right + translate + margin) and
|
|
566
|
+
position-try-fallbacks are both set inline per-instance from the placement property —
|
|
567
|
+
see PRIMARY_POSITION/#fallbackNames and the inline style in render() below. */
|
|
568
|
+
position: fixed;
|
|
569
|
+
inset: auto;
|
|
570
|
+
border: 1px solid var(--border);
|
|
571
|
+
border-radius: 6px;
|
|
572
|
+
background: var(--bg);
|
|
573
|
+
color: inherit;
|
|
574
|
+
box-shadow: 0 6px 20px var(--shadow);
|
|
575
|
+
padding: 6px 9px;
|
|
576
|
+
max-width: 240px;
|
|
577
|
+
width: max-content;
|
|
578
|
+
font-size: 12px;
|
|
579
|
+
line-height: 1.4;
|
|
580
|
+
font-weight: 400;
|
|
581
|
+
text-align: left;
|
|
582
|
+
}
|
|
583
|
+
.bubble[popover] { display: none; }
|
|
584
|
+
.bubble:popover-open { display: block; }
|
|
585
|
+
|
|
586
|
+
/* One @position-try block per side. Named per-side (not per-placement-order) so any
|
|
587
|
+
placement's fallback list can reference the same four blocks in a different order. */
|
|
588
|
+
@position-try --bubble-top {
|
|
589
|
+
top: auto;
|
|
590
|
+
bottom: anchor(top);
|
|
591
|
+
left: anchor(center);
|
|
592
|
+
right: auto;
|
|
593
|
+
translate: -50% 0;
|
|
594
|
+
margin: 0 0 6px;
|
|
595
|
+
}
|
|
596
|
+
@position-try --bubble-bottom {
|
|
597
|
+
top: anchor(bottom);
|
|
598
|
+
bottom: auto;
|
|
599
|
+
left: anchor(center);
|
|
600
|
+
right: auto;
|
|
601
|
+
translate: -50% 0;
|
|
602
|
+
margin: 6px 0 0;
|
|
603
|
+
}
|
|
604
|
+
@position-try --bubble-left {
|
|
605
|
+
top: anchor(center);
|
|
606
|
+
bottom: auto;
|
|
607
|
+
left: auto;
|
|
608
|
+
right: anchor(left);
|
|
609
|
+
translate: 0 -50%;
|
|
610
|
+
margin: 0 6px 0 0;
|
|
611
|
+
}
|
|
612
|
+
@position-try --bubble-right {
|
|
613
|
+
top: anchor(center);
|
|
614
|
+
bottom: auto;
|
|
615
|
+
left: anchor(right);
|
|
616
|
+
right: auto;
|
|
617
|
+
translate: 0 -50%;
|
|
618
|
+
margin: 0 0 0 6px;
|
|
619
|
+
}
|
|
620
|
+
`}constructor(){super(),this.text="",this.placement="top",this.#e=`--help-tooltip-${++qi}`}get#s(){const e=Hi.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 l`
|
|
621
|
+
<button
|
|
622
|
+
type="button"
|
|
623
|
+
class="icon"
|
|
624
|
+
style=${`anchor-name: ${this.#e}`}
|
|
625
|
+
aria-describedby="bubble"
|
|
626
|
+
@mouseenter=${()=>this.#n()}
|
|
627
|
+
@mouseleave=${()=>this.#r()}
|
|
628
|
+
@focus=${()=>this.#n()}
|
|
629
|
+
@blur=${()=>this.#r()}
|
|
630
|
+
>?</button>
|
|
631
|
+
<div
|
|
632
|
+
id="bubble"
|
|
633
|
+
role="tooltip"
|
|
634
|
+
class="bubble"
|
|
635
|
+
popover="manual"
|
|
636
|
+
style=${`position-anchor: ${this.#e}; position-try-fallbacks: ${this.#s}; ${Bi[this.placement]}`}
|
|
637
|
+
@mouseenter=${()=>this.#n()}
|
|
638
|
+
@mouseleave=${()=>this.#r()}
|
|
639
|
+
>
|
|
640
|
+
${this.text}
|
|
641
|
+
</div>
|
|
642
|
+
`}}customElements.define("help-tooltip",Ki);const Ce="mem-bucket-toast",ut=3,Qt=2200;function q(n,e="default",t=Qt){window.dispatchEvent(new CustomEvent(Ce,{detail:{message:n,type:e,timeoutMs:t},bubbles:!0,composed:!0}))}const y={send:q,default:(n,e)=>q(n,"default",e),success:(n,e)=>q(n,"success",e),danger:(n,e)=>q(n,"danger",e),warning:(n,e)=>q(n,"warning",e),info:(n,e)=>q(n,"info",e)},Vi={default:"--fg",success:"--success",danger:"--danger",warning:"--warning",info:"--accent"};class Gi extends k{#e=new h([]);#t=e=>this.#s(e);constructor(){super(),new N(this)}connectedCallback(){super.connectedCallback(),window.addEventListener(Ce,this.#t)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(Ce,this.#t)}#s(e){const{message:t,type:s="default",timeoutMs:i=Qt}=e.detail,r=Math.random().toString(36).slice(2,11),o=[...this.#e.value,{id:r,type:s,message:t,timeout:i}];this.#e.set(o.length>ut?o.slice(o.length-ut):o),setTimeout(()=>{this.#e.set(this.#e.value.filter(a=>a.id!==r))},i)}static{this.styles=w`
|
|
643
|
+
:host {
|
|
644
|
+
position: fixed;
|
|
645
|
+
top: 14px;
|
|
646
|
+
left: 0;
|
|
647
|
+
right: 0;
|
|
648
|
+
z-index: 9999;
|
|
649
|
+
display: flex;
|
|
650
|
+
flex-direction: column;
|
|
651
|
+
align-items: center;
|
|
652
|
+
gap: 8px;
|
|
653
|
+
pointer-events: none;
|
|
654
|
+
}
|
|
655
|
+
.toast {
|
|
656
|
+
display: flex;
|
|
657
|
+
align-items: center;
|
|
658
|
+
gap: 8px;
|
|
659
|
+
padding: 9px 16px;
|
|
660
|
+
border-radius: 8px;
|
|
661
|
+
background: var(--bg);
|
|
662
|
+
color: inherit;
|
|
663
|
+
border: 1px solid var(--border-strong);
|
|
664
|
+
box-shadow: 0 4px 20px var(--shadow);
|
|
665
|
+
font-size: 13px;
|
|
666
|
+
max-width: min(420px, 90vw);
|
|
667
|
+
animation: toast-in 180ms ease-out;
|
|
668
|
+
}
|
|
669
|
+
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
|
|
670
|
+
@keyframes toast-in {
|
|
671
|
+
from { opacity: 0; transform: translateY(-8px); }
|
|
672
|
+
to { opacity: 1; transform: translateY(0); }
|
|
673
|
+
}
|
|
674
|
+
`}render(){return l`
|
|
675
|
+
${this.#e.value.map(e=>l`
|
|
676
|
+
<div class="toast">
|
|
677
|
+
<span class="dot" style=${`background: var(${Vi[e.type]})`}></span>
|
|
678
|
+
<span>${e.message}</span>
|
|
679
|
+
</div>
|
|
680
|
+
`)}
|
|
681
|
+
`}}customElements.define("toast-stack",Gi);const ft="mem-bucket-detail-view-mode",Wi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Zi(n){const e=n.lastIndexOf(".");return e===-1?!1:Wi.has(n.slice(e).toLowerCase())}function Ji(n){const e={name:"",children:new Map};for(const t of n){const s=t.filename.split("/").filter(Boolean);let i=e;s.forEach((r,o)=>{const a=o===s.length-1;let c=i.children.get(r);c||(c={name:r,children:new Map},i.children.set(r,c)),a&&(c.entry=t),i=c})}return e}function Yi(n){const e={name:"",children:new Map,isFile:!1};for(const t of n){const s=t.split("/").filter(Boolean);let i=e;s.forEach((r,o)=>{let a=i.children.get(r);a||(a={name:r,children:new Map,isFile:!1},i.children.set(r,a)),o===s.length-1&&(a.isFile=!0),i=a})}return e}function Qi(n){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(n))}const Xi=["stable","beta","unreviewed"],er=["active","shipped","abandoned"],gt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],tr=["ticket","freeform"],_={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",group:"This skill's primary category — distinct from folder (physical location) and tags (cross-cutting labels). Leave blank if it doesn't belong to a group.",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 bt(n){return{description:n.description??"",tags:n.tags??[],status:n.status??"",name:n.name??"",owner:n.owner??"",extends:n.extends??"",group:n.group??"",trigger_phrases:n.trigger_phrases??[],key:n.key??"",key_type:n.key_type??"",doc_type:n.doc_type??"",related_to:n.related_to??""}}class sr extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ft)??"markdown",this._editing=!1,this._draft=null,this._addingFrontmatter=!1,this._renaming=!1,this._renameValue="",this._viewingAttachment=null,this._sharing=!1,this._shareUsername="",this._shareRole="member",this._shareBusy=!1,this._shareStatus=null}static{this.properties={selected:{attribute:!1},onChanged:{attribute:!1},facets:{attribute:!1},onTagClick:{attribute:!1},onFolderClick:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1},onGroupClick:{attribute:!1},onGone:{attribute:!1},_doc:{state:!0},_viewMode:{state:!0},_editing:{state:!0},_draft:{state:!0},_addingFrontmatter:{state:!0},_renaming:{state:!0},_renameValue:{state:!0},_viewingAttachment:{state:!0},_sharing:{state:!0},_shareUsername:{state:!0},_shareRole:{state:!0},_shareBusy:{state:!0},_shareStatus:{state:!0}}}static{this.styles=w`
|
|
682
|
+
:host { display: block; padding: 16px; }
|
|
683
|
+
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
684
|
+
.title-row {
|
|
685
|
+
display: flex;
|
|
686
|
+
align-items: center;
|
|
687
|
+
gap: 8px;
|
|
688
|
+
flex-wrap: wrap;
|
|
689
|
+
margin-bottom: 10px;
|
|
690
|
+
}
|
|
691
|
+
.title-row h2 { margin: 0; }
|
|
692
|
+
.title-link {
|
|
693
|
+
background: none; border: none; padding: 0; margin: 0; font: inherit; font-weight: inherit;
|
|
694
|
+
color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
|
|
695
|
+
text-align: left;
|
|
696
|
+
}
|
|
697
|
+
.title-link:hover { opacity: 0.8; }
|
|
698
|
+
.key-subtitle { display: block; font-size: 12px; opacity: 0.65; margin-top: 2px; font-weight: 400; }
|
|
699
|
+
.key-link {
|
|
700
|
+
background: none; border: none; padding: 0; margin: 0; font: inherit;
|
|
701
|
+
color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
|
|
702
|
+
}
|
|
703
|
+
.key-link:hover { opacity: 0.8; }
|
|
704
|
+
.pill {
|
|
705
|
+
border: 1px solid var(--border-strong);
|
|
706
|
+
border-radius: 999px;
|
|
707
|
+
padding: 2px 9px;
|
|
708
|
+
font-size: 11px;
|
|
709
|
+
display: inline-flex;
|
|
710
|
+
align-items: center;
|
|
711
|
+
background: none;
|
|
712
|
+
color: inherit;
|
|
713
|
+
font-family: inherit;
|
|
714
|
+
}
|
|
715
|
+
.pill.folder-pill {
|
|
716
|
+
cursor: pointer;
|
|
717
|
+
color: var(--purple-fg);
|
|
718
|
+
border-color: var(--purple);
|
|
719
|
+
background: var(--purple-tint);
|
|
720
|
+
}
|
|
721
|
+
.pill.folder-pill:hover { background: var(--hover-strong); }
|
|
722
|
+
.pill.tag-pill {
|
|
723
|
+
cursor: pointer;
|
|
724
|
+
background: var(--bg-subtle);
|
|
725
|
+
}
|
|
726
|
+
.pill.tag-pill:hover { background: var(--hover); border-color: var(--border-strong); }
|
|
727
|
+
.pill.warn-pill {
|
|
728
|
+
border-color: var(--danger);
|
|
729
|
+
color: var(--danger);
|
|
730
|
+
background: none;
|
|
731
|
+
}
|
|
732
|
+
.pill.muted-pill {
|
|
733
|
+
opacity: 0.65;
|
|
734
|
+
}
|
|
735
|
+
.info-grid {
|
|
736
|
+
display: grid;
|
|
737
|
+
grid-template-columns: max-content 1fr;
|
|
738
|
+
column-gap: 10px;
|
|
739
|
+
row-gap: 7px;
|
|
740
|
+
font-size: 12px;
|
|
741
|
+
margin-bottom: 12px;
|
|
742
|
+
align-items: start;
|
|
743
|
+
}
|
|
744
|
+
.info-grid dt {
|
|
745
|
+
opacity: 0.55;
|
|
746
|
+
font-size: 10.5px;
|
|
747
|
+
text-transform: uppercase;
|
|
748
|
+
letter-spacing: 0.04em;
|
|
749
|
+
padding-top: 2px;
|
|
750
|
+
white-space: nowrap;
|
|
751
|
+
}
|
|
752
|
+
.info-grid dd {
|
|
753
|
+
margin: 0;
|
|
754
|
+
display: flex;
|
|
755
|
+
flex-wrap: wrap;
|
|
756
|
+
gap: 5px;
|
|
757
|
+
align-items: center;
|
|
758
|
+
}
|
|
759
|
+
.info-grid dd.description { opacity: 0.85; }
|
|
760
|
+
.info-grid .date-value {
|
|
761
|
+
cursor: pointer;
|
|
762
|
+
text-decoration: underline dotted;
|
|
763
|
+
text-underline-offset: 2px;
|
|
764
|
+
}
|
|
765
|
+
.info-grid .date-value:hover { opacity: 0.75; }
|
|
766
|
+
.info-grid .hint { opacity: 0.5; font-style: italic; }
|
|
767
|
+
.bare-notice { font-size: 12px; opacity: 0.6; font-style: italic; margin-bottom: 12px; }
|
|
768
|
+
.attachments-section {
|
|
769
|
+
font-size: 12px;
|
|
770
|
+
margin-bottom: 12px;
|
|
771
|
+
}
|
|
772
|
+
.attachments-section h4 {
|
|
773
|
+
margin: 0 0 6px;
|
|
774
|
+
font-size: 10.5px;
|
|
775
|
+
text-transform: uppercase;
|
|
776
|
+
letter-spacing: 0.04em;
|
|
777
|
+
opacity: 0.55;
|
|
778
|
+
font-weight: 600;
|
|
779
|
+
}
|
|
780
|
+
.attachment-add {
|
|
781
|
+
position: relative;
|
|
782
|
+
display: inline-block;
|
|
783
|
+
margin-top: 6px;
|
|
784
|
+
font-weight: 500;
|
|
785
|
+
opacity: 0.85;
|
|
786
|
+
cursor: pointer;
|
|
787
|
+
}
|
|
788
|
+
.attachment-add:hover { opacity: 1; }
|
|
789
|
+
.attachment-add input[type='file'] {
|
|
790
|
+
position: absolute;
|
|
791
|
+
inset: 0;
|
|
792
|
+
opacity: 0;
|
|
793
|
+
cursor: pointer;
|
|
794
|
+
}
|
|
795
|
+
.attachment-remove {
|
|
796
|
+
opacity: 0.55;
|
|
797
|
+
background: none;
|
|
798
|
+
border: none;
|
|
799
|
+
cursor: pointer;
|
|
800
|
+
font-size: 13px;
|
|
801
|
+
line-height: 1;
|
|
802
|
+
padding: 0 0 0 4px;
|
|
803
|
+
color: inherit;
|
|
804
|
+
}
|
|
805
|
+
.attachment-remove:hover { opacity: 1; color: var(--danger); }
|
|
806
|
+
.attachments-section ul {
|
|
807
|
+
list-style: none;
|
|
808
|
+
margin: 0;
|
|
809
|
+
padding: 0;
|
|
810
|
+
display: flex;
|
|
811
|
+
flex-direction: column;
|
|
812
|
+
gap: 4px;
|
|
813
|
+
}
|
|
814
|
+
.attachments-section ul.attachment-tree {
|
|
815
|
+
font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
816
|
+
gap: 2px;
|
|
817
|
+
}
|
|
818
|
+
.attachments-section .tree-dir {
|
|
819
|
+
opacity: 0.7;
|
|
820
|
+
}
|
|
821
|
+
.attachments-section .tree-prefix {
|
|
822
|
+
opacity: 0.45;
|
|
823
|
+
white-space: pre;
|
|
824
|
+
}
|
|
825
|
+
.attachment-download {
|
|
826
|
+
opacity: 0.55;
|
|
827
|
+
text-decoration: none;
|
|
828
|
+
margin-left: 2px;
|
|
829
|
+
}
|
|
830
|
+
.attachment-download:hover { opacity: 1; }
|
|
831
|
+
.attachment-view-header {
|
|
832
|
+
display: flex;
|
|
833
|
+
align-items: center;
|
|
834
|
+
gap: 10px;
|
|
835
|
+
margin-bottom: 8px;
|
|
836
|
+
}
|
|
837
|
+
.back-button {
|
|
838
|
+
font-size: 11px;
|
|
839
|
+
padding: 3px 8px;
|
|
840
|
+
border: 1px solid var(--border);
|
|
841
|
+
background: transparent;
|
|
842
|
+
color: inherit;
|
|
843
|
+
border-radius: 4px;
|
|
844
|
+
cursor: pointer;
|
|
845
|
+
}
|
|
846
|
+
.back-button:hover { background: var(--hover); }
|
|
847
|
+
.attachment-view-title {
|
|
848
|
+
font-size: 12px;
|
|
849
|
+
font-weight: 600;
|
|
850
|
+
flex: 1;
|
|
851
|
+
overflow: hidden;
|
|
852
|
+
text-overflow: ellipsis;
|
|
853
|
+
white-space: nowrap;
|
|
854
|
+
}
|
|
855
|
+
.attachment-view-download {
|
|
856
|
+
font-size: 11px;
|
|
857
|
+
text-decoration: none;
|
|
858
|
+
color: inherit;
|
|
859
|
+
opacity: 0.75;
|
|
860
|
+
}
|
|
861
|
+
.attachment-view-download:hover { opacity: 1; }
|
|
862
|
+
.attachment-frame {
|
|
863
|
+
width: 100%;
|
|
864
|
+
height: 65vh;
|
|
865
|
+
border: 1px solid var(--border);
|
|
866
|
+
border-radius: 6px;
|
|
867
|
+
background: var(--bg-subtle);
|
|
868
|
+
}
|
|
869
|
+
.attachment-image {
|
|
870
|
+
display: block;
|
|
871
|
+
max-width: 100%;
|
|
872
|
+
max-height: 65vh;
|
|
873
|
+
border-radius: 6px;
|
|
874
|
+
}
|
|
875
|
+
.source-path {
|
|
876
|
+
font-family: monospace;
|
|
877
|
+
font-size: 11px;
|
|
878
|
+
opacity: 0.6;
|
|
879
|
+
cursor: pointer;
|
|
880
|
+
word-break: break-all;
|
|
881
|
+
}
|
|
882
|
+
pre {
|
|
883
|
+
white-space: pre-wrap;
|
|
884
|
+
font-size: 12px;
|
|
885
|
+
background: var(--bg-subtle);
|
|
886
|
+
padding: 12px;
|
|
887
|
+
border-radius: 6px;
|
|
888
|
+
max-height: 60vh;
|
|
889
|
+
overflow-y: auto;
|
|
890
|
+
}
|
|
891
|
+
textarea {
|
|
892
|
+
width: 100%;
|
|
893
|
+
box-sizing: border-box;
|
|
894
|
+
font-family: monospace;
|
|
895
|
+
font-size: 12px;
|
|
896
|
+
background: var(--bg-subtle);
|
|
897
|
+
color: inherit;
|
|
898
|
+
border: 1px solid var(--border);
|
|
899
|
+
border-radius: 6px;
|
|
900
|
+
padding: 12px;
|
|
901
|
+
min-height: 30vh;
|
|
902
|
+
resize: vertical;
|
|
903
|
+
}
|
|
904
|
+
.empty { opacity: 0.5; font-size: 13px; }
|
|
905
|
+
.view-toggle {
|
|
906
|
+
display: flex;
|
|
907
|
+
gap: 4px;
|
|
908
|
+
margin-bottom: 8px;
|
|
909
|
+
}
|
|
910
|
+
.view-toggle button {
|
|
911
|
+
font-size: 11px;
|
|
912
|
+
padding: 3px 8px;
|
|
913
|
+
border: 1px solid var(--border);
|
|
914
|
+
background: transparent;
|
|
915
|
+
border-radius: 4px;
|
|
916
|
+
cursor: pointer;
|
|
917
|
+
opacity: 0.6;
|
|
918
|
+
}
|
|
919
|
+
.view-toggle button.active {
|
|
920
|
+
opacity: 1;
|
|
921
|
+
background: var(--hover);
|
|
922
|
+
font-weight: 600;
|
|
923
|
+
}
|
|
924
|
+
.markdown-body {
|
|
925
|
+
font-size: 13px;
|
|
926
|
+
line-height: 1.5;
|
|
927
|
+
max-height: 60vh;
|
|
928
|
+
overflow-y: auto;
|
|
929
|
+
padding: 12px;
|
|
930
|
+
background: var(--bg-subtle);
|
|
931
|
+
border-radius: 6px;
|
|
932
|
+
}
|
|
933
|
+
.markdown-body :first-child { margin-top: 0; }
|
|
934
|
+
.markdown-body :last-child { margin-bottom: 0; }
|
|
935
|
+
.markdown-body pre {
|
|
936
|
+
background: var(--hover);
|
|
937
|
+
max-height: none;
|
|
938
|
+
}
|
|
939
|
+
.markdown-body code {
|
|
940
|
+
font-family: monospace;
|
|
941
|
+
font-size: 12px;
|
|
942
|
+
}
|
|
943
|
+
.actions {
|
|
944
|
+
display: flex;
|
|
945
|
+
flex-wrap: wrap;
|
|
946
|
+
gap: 8px;
|
|
947
|
+
margin-bottom: 12px;
|
|
948
|
+
}
|
|
949
|
+
.actions button {
|
|
950
|
+
font-size: 11px;
|
|
951
|
+
padding: 4px 10px;
|
|
952
|
+
border: 1px solid var(--border);
|
|
953
|
+
background: transparent;
|
|
954
|
+
color: inherit;
|
|
955
|
+
border-radius: 4px;
|
|
956
|
+
cursor: pointer;
|
|
957
|
+
}
|
|
958
|
+
.actions button.danger {
|
|
959
|
+
border-color: var(--danger);
|
|
960
|
+
color: var(--danger);
|
|
961
|
+
}
|
|
962
|
+
.actions button.primary {
|
|
963
|
+
border-color: var(--accent);
|
|
964
|
+
color: var(--accent);
|
|
965
|
+
font-weight: 600;
|
|
966
|
+
}
|
|
967
|
+
.edit-form {
|
|
968
|
+
display: flex;
|
|
969
|
+
flex-direction: column;
|
|
970
|
+
gap: 10px;
|
|
971
|
+
margin-bottom: 12px;
|
|
972
|
+
padding: 12px;
|
|
973
|
+
background: var(--bg-subtle);
|
|
974
|
+
border-radius: 6px;
|
|
975
|
+
}
|
|
976
|
+
.field {
|
|
977
|
+
display: flex;
|
|
978
|
+
flex-direction: column;
|
|
979
|
+
gap: 4px;
|
|
980
|
+
}
|
|
981
|
+
.field label {
|
|
982
|
+
font-size: 11px;
|
|
983
|
+
font-weight: 600;
|
|
984
|
+
opacity: 0.7;
|
|
985
|
+
display: inline-flex;
|
|
986
|
+
align-items: center;
|
|
987
|
+
gap: 4px;
|
|
988
|
+
}
|
|
989
|
+
.field input[type='text'],
|
|
990
|
+
.field select,
|
|
991
|
+
.field textarea {
|
|
992
|
+
font-size: 13px;
|
|
993
|
+
padding: 6px 8px;
|
|
994
|
+
border: 1px solid var(--border-strong);
|
|
995
|
+
border-radius: 6px;
|
|
996
|
+
background: var(--bg);
|
|
997
|
+
color: inherit;
|
|
998
|
+
font-family: inherit;
|
|
999
|
+
}
|
|
1000
|
+
.field input[type='text'],
|
|
1001
|
+
.field select {
|
|
1002
|
+
max-width: 320px;
|
|
1003
|
+
}
|
|
1004
|
+
.field textarea {
|
|
1005
|
+
min-height: 60px;
|
|
1006
|
+
resize: vertical;
|
|
1007
|
+
}
|
|
1008
|
+
.field-row {
|
|
1009
|
+
display: flex;
|
|
1010
|
+
gap: 10px;
|
|
1011
|
+
}
|
|
1012
|
+
.field-row .field { flex: 1; }
|
|
1013
|
+
.form-actions {
|
|
1014
|
+
display: flex;
|
|
1015
|
+
gap: 8px;
|
|
1016
|
+
margin-top: 4px;
|
|
1017
|
+
}
|
|
1018
|
+
.form-actions button {
|
|
1019
|
+
font-size: 12px;
|
|
1020
|
+
padding: 5px 12px;
|
|
1021
|
+
border-radius: 4px;
|
|
1022
|
+
cursor: pointer;
|
|
1023
|
+
}
|
|
1024
|
+
.form-actions button.save {
|
|
1025
|
+
border: 1px solid var(--accent);
|
|
1026
|
+
background: var(--accent);
|
|
1027
|
+
color: var(--accent-fg);
|
|
1028
|
+
}
|
|
1029
|
+
.form-actions button.cancel {
|
|
1030
|
+
border: 1px solid var(--border);
|
|
1031
|
+
background: transparent;
|
|
1032
|
+
color: inherit;
|
|
1033
|
+
}
|
|
1034
|
+
.rename-row {
|
|
1035
|
+
display: flex;
|
|
1036
|
+
gap: 6px;
|
|
1037
|
+
align-items: center;
|
|
1038
|
+
}
|
|
1039
|
+
.rename-row input {
|
|
1040
|
+
flex: 1;
|
|
1041
|
+
font-size: 12px;
|
|
1042
|
+
padding: 4px 6px;
|
|
1043
|
+
border: 1px solid var(--border-strong);
|
|
1044
|
+
border-radius: 4px;
|
|
1045
|
+
background: var(--bg);
|
|
1046
|
+
color: inherit;
|
|
1047
|
+
}
|
|
1048
|
+
.hint { font-size: 11px; opacity: 0.6; }
|
|
1049
|
+
.share-form {
|
|
1050
|
+
display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-top: 4px;
|
|
1051
|
+
border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-subtle);
|
|
1052
|
+
}
|
|
1053
|
+
.share-row { display: flex; gap: 6px; align-items: center; }
|
|
1054
|
+
.share-row input[type='text'] {
|
|
1055
|
+
flex: 1; font-size: 12px; padding: 4px 6px; border: 1px solid var(--border-strong);
|
|
1056
|
+
border-radius: 4px; background: var(--bg); color: inherit;
|
|
1057
|
+
}
|
|
1058
|
+
.share-row select {
|
|
1059
|
+
font-size: 12px; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px;
|
|
1060
|
+
background: var(--bg); color: inherit;
|
|
1061
|
+
}
|
|
1062
|
+
.share-links-row { display: flex; gap: 6px; }
|
|
1063
|
+
.share-status { font-size: 11px; opacity: 0.75; }
|
|
1064
|
+
`}updated(e){e.has("selected")&&this.selected&&(this._editing=!1,this._addingFrontmatter=!1,this._renaming=!1,this._viewingAttachment=null,this.#e(),this.scrollTop=0)}async#e(){const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);this._doc=s.ok?await s.json():null,await this.updateComplete,this.shadowRoot?.querySelector(".markdown-body")?.scrollTo(0,0),this.shadowRoot?.querySelector("pre")?.scrollTo(0,0)}async refresh(){if(!this.selected||this._editing||this._addingFrontmatter||this._renaming)return;const{table:e,id:t}=this.selected,s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`);if(!s.ok){this._doc=null,this.onGone?.();return}const r=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=r)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ft,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})})).ok){y.danger("Failed to update status");return}await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})})).ok){y.danger("Failed to update status");return}await this.#e(),this.onChanged?.()}async#u(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),r=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!r.ok){const{error:o}=await r.json().catch(()=>({error:`upload failed (${r.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#a(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#u(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;if(!(await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"})).ok){y.danger("Failed to remove attachment");return}this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#o(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#d(){this._sharing=!1,this._shareStatus=null}async#g(){if(!this.selected||!this._shareUsername.trim())return;const{table:e,id:t}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const s=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this._shareUsername.trim(),role:this._shareRole})}),i=await s.json().catch(()=>({}));this._shareStatus=s.ok?`Shared with ${this._shareUsername.trim()}.`:`Share failed: ${i.error??s.statusText}`,s.ok&&(this._shareUsername="")}finally{this._shareBusy=!1}}async#h(e){if(!this.selected)return;const{table:t,id:s}=this.selected;this._shareBusy=!0,this._shareStatus=null;try{const i=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/${e}`,{method:"POST"}),r=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${r.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(r.token)}`;const c=a.toString();try{await navigator.clipboard?.writeText(c),this._shareStatus=`${e==="share-link"?"Share":"Public"} link copied to clipboard.`}catch{this._shareStatus=`Link: ${c}`}}finally{this._shareBusy=!1}}async#c(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;if(!(await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"})).ok){y.danger("Delete failed");return}this._doc=null,y.success("Deleted"),this.onChanged?.()}#b(){this._doc&&(this._draft=bt(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#$(){this._doc&&(this._draft=bt(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#x(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#v(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#p(e){this._draft&&(this._draft={...this._draft,...e})}#y(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#p({tags:t})}#w(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.#p({trigger_phrases:t})}async#l(){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.group=this._draft.group||null,i.trigger_phrases=this._draft.trigger_phrases):(i.key=this._draft.key,i.key_type=this._draft.key_type,i.doc_type=this._draft.doc_type,i.related_to=this._draft.related_to||null);const r=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!r.ok){const o=await r.json().catch(()=>({}));window.alert(`Save failed: ${o.error??r.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#k(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
|
|
1065
|
+
|
|
1066
|
+
This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Delete failed: ${r.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#_(){if(!this._doc||!this.selected)return;const e=this.selected.table==="skills";this._renameValue=e?this._doc.name??"":this._doc.source_path.split("/").pop()??"",this._renaming=!0}async#m(){if(!this._doc||!this.selected||!this._renameValue.trim())return;const e=this.selected.table==="skills",t=this._renameValue.trim(),s=e?this._doc.name:this._doc.source_path.split("/").pop();if(t===s){this._renaming=!1;return}const i=e?await fetch(`/api/entries/skills/${encodeURIComponent(this._doc.name)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_name:t})}):await fetch(`/api/entries/memory_docs/${encodeURIComponent(this.selected.id)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({new_filename:t})});if(!i.ok){const r=await i.json().catch(()=>({}));window.alert(`Rename failed: ${r.error??i.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const r=await i.json();this.selected={table:"memory_docs",id:r.source_path}}await this.#e(),this.onChanged?.()}#T(){return l`
|
|
1067
|
+
<div class="edit-form">
|
|
1068
|
+
<div class="hint">What kind of doc is this? This shapes which fields apply next.</div>
|
|
1069
|
+
<div class="field">
|
|
1070
|
+
<label>doc_type <help-tooltip .text=${_.doc_type}></help-tooltip></label>
|
|
1071
|
+
<select
|
|
1072
|
+
@change=${e=>this.#x(e.target.value)}
|
|
1073
|
+
>
|
|
1074
|
+
<option value="" selected disabled>Choose…</option>
|
|
1075
|
+
${gt.map(e=>l`<option value=${e}>${e}</option>`)}
|
|
1076
|
+
</select>
|
|
1077
|
+
</div>
|
|
1078
|
+
<div class="form-actions">
|
|
1079
|
+
<button class="cancel" @click=${()=>this.#v()}>Cancel</button>
|
|
1080
|
+
</div>
|
|
1081
|
+
</div>
|
|
1082
|
+
`}#A(e){const t=this._draft,s=this.facets;return l`
|
|
1083
|
+
<div class="edit-form">
|
|
1084
|
+
${e?l`
|
|
1085
|
+
<div class="field">
|
|
1086
|
+
<label>name <help-tooltip .text=${_.name}></help-tooltip></label>
|
|
1087
|
+
<div class="hint">Renaming moves the skill's folder on disk — kept as a separate action.</div>
|
|
1088
|
+
</div>
|
|
1089
|
+
`:l`
|
|
1090
|
+
<div class="field-row">
|
|
1091
|
+
<div class="field">
|
|
1092
|
+
<label>key <help-tooltip .text=${_.key}></help-tooltip></label>
|
|
1093
|
+
<input
|
|
1094
|
+
type="text"
|
|
1095
|
+
.value=${t.key}
|
|
1096
|
+
@input=${i=>this.#p({key:i.target.value})}
|
|
1097
|
+
/>
|
|
1098
|
+
</div>
|
|
1099
|
+
<div class="field">
|
|
1100
|
+
<label>key_type <help-tooltip .text=${_.key_type}></help-tooltip></label>
|
|
1101
|
+
<select
|
|
1102
|
+
.value=${t.key_type}
|
|
1103
|
+
@change=${i=>this.#p({key_type:i.target.value})}
|
|
1104
|
+
>
|
|
1105
|
+
${tr.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
|
|
1106
|
+
</select>
|
|
1107
|
+
</div>
|
|
1108
|
+
</div>
|
|
1109
|
+
<div class="field">
|
|
1110
|
+
<label>doc_type <help-tooltip .text=${_.doc_type}></help-tooltip></label>
|
|
1111
|
+
<select
|
|
1112
|
+
.value=${t.doc_type}
|
|
1113
|
+
@change=${i=>this.#p({doc_type:i.target.value})}
|
|
1114
|
+
>
|
|
1115
|
+
${gt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
|
|
1116
|
+
</select>
|
|
1117
|
+
</div>
|
|
1118
|
+
`}
|
|
1119
|
+
<div class="field">
|
|
1120
|
+
<label>description <help-tooltip .text=${_.description}></help-tooltip></label>
|
|
1121
|
+
<textarea
|
|
1122
|
+
.value=${t.description}
|
|
1123
|
+
@input=${i=>this.#p({description:i.target.value})}
|
|
1124
|
+
></textarea>
|
|
1125
|
+
</div>
|
|
1126
|
+
<div class="field">
|
|
1127
|
+
<label>tags <help-tooltip .text=${_.tags}></help-tooltip></label>
|
|
1128
|
+
<tag-multiselect
|
|
1129
|
+
.tags=${s?.tags??[]}
|
|
1130
|
+
.active=${t.tags}
|
|
1131
|
+
.allowCreate=${!0}
|
|
1132
|
+
.onToggle=${i=>this.#y(i)}
|
|
1133
|
+
></tag-multiselect>
|
|
1134
|
+
</div>
|
|
1135
|
+
<div class="field">
|
|
1136
|
+
<label>status <help-tooltip .text=${_.status}></help-tooltip></label>
|
|
1137
|
+
<status-select
|
|
1138
|
+
.options=${[...new Set([...e?Xi:er,...s?.statuses??[]])]}
|
|
1139
|
+
.value=${t.status}
|
|
1140
|
+
.onChange=${i=>this.#p({status:i})}
|
|
1141
|
+
></status-select>
|
|
1142
|
+
</div>
|
|
1143
|
+
${e?l`
|
|
1144
|
+
<div class="field-row">
|
|
1145
|
+
<div class="field">
|
|
1146
|
+
<label>owner <help-tooltip .text=${_.owner}></help-tooltip></label>
|
|
1147
|
+
<input
|
|
1148
|
+
type="text"
|
|
1149
|
+
.value=${t.owner}
|
|
1150
|
+
@input=${i=>this.#p({owner:i.target.value})}
|
|
1151
|
+
/>
|
|
1152
|
+
</div>
|
|
1153
|
+
<div class="field">
|
|
1154
|
+
<label>extends <help-tooltip .text=${_.extends}></help-tooltip></label>
|
|
1155
|
+
<input
|
|
1156
|
+
type="text"
|
|
1157
|
+
.value=${t.extends}
|
|
1158
|
+
@input=${i=>this.#p({extends:i.target.value})}
|
|
1159
|
+
/>
|
|
1160
|
+
</div>
|
|
1161
|
+
</div>
|
|
1162
|
+
<div class="field">
|
|
1163
|
+
<label>group <help-tooltip .text=${_.group}></help-tooltip></label>
|
|
1164
|
+
<status-select
|
|
1165
|
+
.options=${s?.groups??[]}
|
|
1166
|
+
.value=${t.group}
|
|
1167
|
+
.onChange=${i=>this.#p({group:i})}
|
|
1168
|
+
></status-select>
|
|
1169
|
+
</div>
|
|
1170
|
+
<div class="field">
|
|
1171
|
+
<label>trigger_phrases <help-tooltip .text=${_.trigger_phrases}></help-tooltip></label>
|
|
1172
|
+
<tag-multiselect
|
|
1173
|
+
.tags=${[]}
|
|
1174
|
+
.active=${t.trigger_phrases}
|
|
1175
|
+
.allowCreate=${!0}
|
|
1176
|
+
.onToggle=${i=>this.#w(i)}
|
|
1177
|
+
></tag-multiselect>
|
|
1178
|
+
</div>
|
|
1179
|
+
`:l`
|
|
1180
|
+
<div class="field">
|
|
1181
|
+
<label>related_to <help-tooltip .text=${_.related_to}></help-tooltip></label>
|
|
1182
|
+
<input
|
|
1183
|
+
type="text"
|
|
1184
|
+
.value=${t.related_to}
|
|
1185
|
+
@input=${i=>this.#p({related_to:i.target.value})}
|
|
1186
|
+
/>
|
|
1187
|
+
</div>
|
|
1188
|
+
`}
|
|
1189
|
+
<div class="form-actions">
|
|
1190
|
+
<button class="save" @click=${()=>this.#l()}>Save</button>
|
|
1191
|
+
<button class="cancel" @click=${()=>this.#v()}>Cancel</button>
|
|
1192
|
+
</div>
|
|
1193
|
+
</div>
|
|
1194
|
+
`}#S(e,t){const s=t?void 0:e.key,i=t?e.name??e.id:e.source_path?e.source_path.split("/").pop():e.id;return l`
|
|
1195
|
+
<div class="title-row">
|
|
1196
|
+
<div>
|
|
1197
|
+
<h2>${i}</h2>
|
|
1198
|
+
${s?l`<button class="title-link key-subtitle" title="Search for key '${s}'" @click=${()=>this.onKeyClick?.(s)}>
|
|
1199
|
+
🔑 ${s}
|
|
1200
|
+
</button>`:""}
|
|
1201
|
+
</div>
|
|
1202
|
+
<button class="pill folder-pill" title="Filter by folder '${e.folder}'" @click=${()=>this.onFolderClick?.(e.folder)}>
|
|
1203
|
+
📁 ${e.folder}
|
|
1204
|
+
</button>
|
|
1205
|
+
</div>
|
|
1206
|
+
`}#R(e,t){const s=e.created_at?Qi(e.created_at):null;return l`
|
|
1207
|
+
<dl class="info-grid">
|
|
1208
|
+
<dt>Description</dt>
|
|
1209
|
+
<dd class="description">${e.description||"—"}</dd>
|
|
1210
|
+
|
|
1211
|
+
<dt>Tags</dt>
|
|
1212
|
+
<dd>
|
|
1213
|
+
${e.tags?.length?e.tags.map(i=>l`<button class="pill tag-pill" @click=${()=>this.onTagClick?.(i)}>${i}</button>`):l`<span class="hint">no tags</span>`}
|
|
1214
|
+
</dd>
|
|
1215
|
+
|
|
1216
|
+
<dt>Status</dt>
|
|
1217
|
+
<dd>${e.status}</dd>
|
|
1218
|
+
|
|
1219
|
+
${e.deprecated||e.paused?l`
|
|
1220
|
+
<dt>Flags</dt>
|
|
1221
|
+
<dd>
|
|
1222
|
+
${e.deprecated?l`<span class="pill warn-pill">deprecated</span>`:f}
|
|
1223
|
+
${e.paused?l`<span class="pill muted-pill">paused</span>`:f}
|
|
1224
|
+
</dd>
|
|
1225
|
+
`:f}
|
|
1226
|
+
|
|
1227
|
+
${t?l`
|
|
1228
|
+
${e.owner?l`<dt>Owner</dt>
|
|
1229
|
+
<dd>${e.owner}</dd>`:f}
|
|
1230
|
+
${e.extends?l`<dt>Extends</dt>
|
|
1231
|
+
<dd>${e.extends}</dd>`:f}
|
|
1232
|
+
${e.group?l`<dt>Group</dt>
|
|
1233
|
+
<dd>
|
|
1234
|
+
<button class="key-link" title="Search for this group" @click=${()=>e.group&&this.onGroupClick?.(e.group)}>
|
|
1235
|
+
${e.group}
|
|
1236
|
+
</button>
|
|
1237
|
+
</dd>`:f}
|
|
1238
|
+
`:l`
|
|
1239
|
+
<dt>Key</dt>
|
|
1240
|
+
<dd>
|
|
1241
|
+
<button class="key-link" title="Search for this key" @click=${()=>e.key&&this.onKeyClick?.(e.key)}>
|
|
1242
|
+
${e.key}
|
|
1243
|
+
</button>
|
|
1244
|
+
</dd>
|
|
1245
|
+
|
|
1246
|
+
<dt>Key type</dt>
|
|
1247
|
+
<dd>${e.key_type}</dd>
|
|
1248
|
+
|
|
1249
|
+
<dt>Doc type</dt>
|
|
1250
|
+
<dd>${e.doc_type}</dd>
|
|
1251
|
+
|
|
1252
|
+
${e.related_to?l`<dt>Related to</dt>
|
|
1253
|
+
<dd>${e.related_to}</dd>`:f}
|
|
1254
|
+
`}
|
|
1255
|
+
|
|
1256
|
+
<dt>Created</dt>
|
|
1257
|
+
<dd>
|
|
1258
|
+
${s?l`<span class="date-value" title="Filter to this day" @click=${()=>this.onDateClick?.(s)}
|
|
1259
|
+
>${s}</span
|
|
1260
|
+
>`:l`<span class="hint">unknown</span>`}
|
|
1261
|
+
</dd>
|
|
1262
|
+
</dl>
|
|
1263
|
+
`}#E(e,t){const s=new v.Renderer,i=s.link.bind(s);return s.link=r=>{if(typeof r.href=="string"&&r.href.startsWith("attachment://")){const o=r.href.slice(13);return i({...r,href:`/api/entries/${e}/${encodeURIComponent(t)}/attachments/${encodeURIComponent(o)}`})}return i(r)},s}#I(){return l`
|
|
1264
|
+
<div class="share-form">
|
|
1265
|
+
<div class="share-row">
|
|
1266
|
+
<input
|
|
1267
|
+
type="text"
|
|
1268
|
+
placeholder="username"
|
|
1269
|
+
.value=${this._shareUsername}
|
|
1270
|
+
@input=${e=>this._shareUsername=e.target.value}
|
|
1271
|
+
@keydown=${e=>e.key==="Enter"&&this.#g()}
|
|
1272
|
+
/>
|
|
1273
|
+
<select .value=${this._shareRole} @change=${e=>this._shareRole=e.target.value}>
|
|
1274
|
+
<option value="member">Read-only</option>
|
|
1275
|
+
<option value="editor">Can edit</option>
|
|
1276
|
+
</select>
|
|
1277
|
+
<button ?disabled=${this._shareBusy||!this._shareUsername.trim()} @click=${()=>this.#g()}>Share</button>
|
|
1278
|
+
</div>
|
|
1279
|
+
<div class="share-links-row">
|
|
1280
|
+
<button ?disabled=${this._shareBusy} @click=${()=>this.#h("share-link")}>Copy share link</button>
|
|
1281
|
+
<button ?disabled=${this._shareBusy} @click=${()=>this.#h("public-link")}>Copy public link</button>
|
|
1282
|
+
<button @click=${()=>this.#d()}>Close</button>
|
|
1283
|
+
</div>
|
|
1284
|
+
${this._shareStatus?l`<div class="share-status">${this._shareStatus}</div>`:f}
|
|
1285
|
+
</div>
|
|
1286
|
+
`}#z(e,t,s,i){return l`
|
|
1287
|
+
<a
|
|
1288
|
+
href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view"
|
|
1289
|
+
target="_blank"
|
|
1290
|
+
rel="noopener"
|
|
1291
|
+
@click=${r=>{r.button!==0||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||(r.preventDefault(),this._viewingAttachment=s)}}
|
|
1292
|
+
>${i}</a
|
|
1293
|
+
>
|
|
1294
|
+
<a
|
|
1295
|
+
class="attachment-download"
|
|
1296
|
+
href="/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}"
|
|
1297
|
+
title="Download"
|
|
1298
|
+
>⇩</a
|
|
1299
|
+
>
|
|
1300
|
+
<button class="attachment-remove" title="Remove" @click=${()=>this.#i(s.filename)}>×</button>
|
|
1301
|
+
`}#P(e,t,s,i){const r=[...s.children.values()].sort((o,a)=>o.name.localeCompare(a.name));return r.map((o,a)=>{const c=a===r.length-1,d=i.map(p=>p?"│ ":" ").join("")+(c?"└── ":"├── "),u=o.entry===void 0;return l`
|
|
1302
|
+
<li>
|
|
1303
|
+
<span class="tree-prefix">${d}</span>${u?l`<span class="tree-dir">📁 ${o.name}</span>`:this.#z(e,t,o.entry,o.name)}
|
|
1304
|
+
</li>
|
|
1305
|
+
${u?this.#P(e,t,o,[...i,!c]):f}
|
|
1306
|
+
`})}#C(e,t){const s=[...e.children.values()].sort((i,r)=>i.name.localeCompare(r.name));return s.map((i,r)=>{const o=r===s.length-1,a=t.map(c=>c?"│ ":" ").join("")+(o?"└── ":"├── ");return l`
|
|
1307
|
+
<li>
|
|
1308
|
+
<span class="tree-prefix">${a}</span>${i.isFile?l`<span>${i.name}</span>`:l`<span class="tree-dir">📁 ${i.name}</span>`}
|
|
1309
|
+
</li>
|
|
1310
|
+
${i.isFile?f:this.#C(i,[...t,!o])}
|
|
1311
|
+
`})}#O(e){if(!e.sourceFiles?.length)return f;const t=Yi(e.sourceFiles);return l`
|
|
1312
|
+
<div class="attachments-section">
|
|
1313
|
+
<h4>Skill files</h4>
|
|
1314
|
+
<ul class="attachment-tree">${this.#C(t,[])}</ul>
|
|
1315
|
+
</div>
|
|
1316
|
+
`}#F(e,t){const s=e.attachments?.length?Ji(e.attachments):void 0,i=e.attachments?.some(r=>r.filename.includes("/"))??!1;return l`
|
|
1317
|
+
<div class="attachments-section">
|
|
1318
|
+
<h4>Attachments</h4>
|
|
1319
|
+
${s?i?l`<ul class="attachment-tree">${this.#P(e,t,s,[])}</ul>`:l`
|
|
1320
|
+
<ul>
|
|
1321
|
+
${e.attachments.map(r=>l`<li>${this.#z(e,t,r,r.filename)}</li>`)}
|
|
1322
|
+
</ul>
|
|
1323
|
+
`:f}
|
|
1324
|
+
<label class="attachment-add">
|
|
1325
|
+
+ Add
|
|
1326
|
+
<input type="file" @change=${r=>this.#a(r)} />
|
|
1327
|
+
</label>
|
|
1328
|
+
</div>
|
|
1329
|
+
`}#M(e,t,s){const i=document.documentElement.getAttribute("data-theme"),r=i==="light"||i==="dark"?`?theme=${i}`:"",o=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}/view${r}`,a=`/api/entries/${t}/${encodeURIComponent(e.id)}/attachments/${encodeURIComponent(s.filename)}`;return l`
|
|
1330
|
+
<div class="attachment-view-header">
|
|
1331
|
+
<button class="back-button" title="Back to ${e.name??e.key??e.id}" @click=${()=>this._viewingAttachment=null}>
|
|
1332
|
+
← Back
|
|
1333
|
+
</button>
|
|
1334
|
+
<span class="attachment-view-title" title=${s.filename}>${s.filename}</span>
|
|
1335
|
+
<a class="attachment-view-download" href=${a} title="Download ${s.filename}">⇩ Download</a>
|
|
1336
|
+
</div>
|
|
1337
|
+
${Zi(s.filename)?l`<img class="attachment-image" src=${o} alt=${s.filename} />`:l`<iframe class="attachment-frame" src=${o} title=${s.filename}></iframe>`}
|
|
1338
|
+
`}render(){if(!this.selected)return l`<div class="empty">Select an entry to view its details.</div>`;if(!this._doc)return f;const e=this._doc,t=this.selected.table==="skills",s=t&&e.folder==="builtin",i=!t&&e.has_frontmatter===!1;return this._addingFrontmatter?l`${this.#S(e,t)}${this.#T()}`:this._editing&&this._draft?l`${this.#S(e,t)}${this.#A(t)}`:this._viewingAttachment?l`${this.#S(e,t)}${this.#M(e,this.selected.table,this._viewingAttachment)}`:l`
|
|
1339
|
+
${this.#S(e,t)}
|
|
1340
|
+
${i?l`<div class="bare-notice">No frontmatter — this is a plain, unmanaged file.</div>`:this.#R(e,t)}
|
|
1341
|
+
${s?f:l`
|
|
1342
|
+
<div class="actions">
|
|
1343
|
+
${i?l`<button class="primary" @click=${()=>this.#$()}>Add frontmatter</button>`:l`
|
|
1344
|
+
<button @click=${()=>this.#b()}>Edit</button>
|
|
1345
|
+
<button @click=${()=>this.#_()}>Rename</button>
|
|
1346
|
+
<button @click=${()=>this.#n()}>${e.deprecated?"Un-deprecate":"Mark deprecated"}</button>
|
|
1347
|
+
<button @click=${()=>this.#r()}>${e.paused?"Resume":"Pause"}</button>
|
|
1348
|
+
${t?f:l`<button class="danger" @click=${()=>this.#k()}>Delete frontmatter</button>`}
|
|
1349
|
+
${e.remoteInfo?l`<button @click=${()=>this.#o()}>Share…</button>`:f}
|
|
1350
|
+
`}
|
|
1351
|
+
<button class="danger" @click=${()=>this.#c()}>Delete</button>
|
|
1352
|
+
</div>
|
|
1353
|
+
${this._renaming?l`
|
|
1354
|
+
<div class="rename-row">
|
|
1355
|
+
<input
|
|
1356
|
+
type="text"
|
|
1357
|
+
.value=${this._renameValue}
|
|
1358
|
+
@input=${r=>this._renameValue=r.target.value}
|
|
1359
|
+
@keydown=${r=>r.key==="Enter"&&this.#m()}
|
|
1360
|
+
/>
|
|
1361
|
+
<button @click=${()=>this.#m()}>Save</button>
|
|
1362
|
+
<button @click=${()=>this._renaming=!1}>Cancel</button>
|
|
1363
|
+
</div>
|
|
1364
|
+
`:f}
|
|
1365
|
+
${this._sharing?this.#I():f}
|
|
1366
|
+
`}
|
|
1367
|
+
${this.#O(e)}
|
|
1368
|
+
${this.#F(e,this.selected.table)}
|
|
1369
|
+
<div class="view-toggle">
|
|
1370
|
+
<button
|
|
1371
|
+
class=${this._viewMode==="markdown"?"active":""}
|
|
1372
|
+
@click=${()=>this.#s("markdown")}
|
|
1373
|
+
>
|
|
1374
|
+
Preview
|
|
1375
|
+
</button>
|
|
1376
|
+
<button
|
|
1377
|
+
class=${this._viewMode==="raw"?"active":""}
|
|
1378
|
+
@click=${()=>this.#s("raw")}
|
|
1379
|
+
>
|
|
1380
|
+
Raw
|
|
1381
|
+
</button>
|
|
1382
|
+
</div>
|
|
1383
|
+
${this._viewMode==="markdown"?l`<div class="markdown-body">${Ni(v.parse(e.body??"",{async:!1,renderer:this.#E(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
|
|
1384
|
+
<div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
|
|
1385
|
+
`}}customElements.define("detail-panel",sr);const F="membkt";let ve;function H(){return ve||(ve=fetch("/api/config").then(n=>n.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ve}class ir extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new h("skill");#t=new h("local");#s=new h("");#n=new h([]);#r=new h(null);#u=new h("");#a=new h("");#i=new h("");#o=new h(!1);#d=new h(!1);#g=new h(!1);#h=new h("");#c=new h("");#b=new h(!1);#$=new h("");#x=new h(!1);#v=new h("");#p=new h(!1);#y=new h(!1);#w=new h([]);#l=new h("");#k=new h("");#_=new h(!1);#m;#T=new h("mine");#A=new h([]);#S=new h(!1);#R=new h(null);static{this.styles=w`
|
|
1386
|
+
:host { display: block; }
|
|
1387
|
+
.backdrop {
|
|
1388
|
+
position: fixed; inset: 0; background: var(--overlay);
|
|
1389
|
+
display: flex; align-items: center; justify-content: center; z-index: 100;
|
|
1390
|
+
}
|
|
1391
|
+
.modal {
|
|
1392
|
+
background: var(--bg);
|
|
1393
|
+
color: inherit;
|
|
1394
|
+
border-radius: 10px;
|
|
1395
|
+
width: min(560px, 92vw);
|
|
1396
|
+
max-height: 82vh;
|
|
1397
|
+
display: flex;
|
|
1398
|
+
flex-direction: column;
|
|
1399
|
+
box-shadow: 0 8px 40px var(--shadow);
|
|
1400
|
+
border: 1px solid var(--border);
|
|
1401
|
+
}
|
|
1402
|
+
.header { padding: 16px 20px 8px; }
|
|
1403
|
+
h2 { margin: 0; font-size: 16px; }
|
|
1404
|
+
.kind-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
|
|
1405
|
+
.kind-toggle button {
|
|
1406
|
+
flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
|
|
1407
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
1408
|
+
}
|
|
1409
|
+
.kind-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
|
|
1410
|
+
.breadcrumb-row {
|
|
1411
|
+
padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
1412
|
+
}
|
|
1413
|
+
.breadcrumb {
|
|
1414
|
+
font-size: 12px; opacity: 0.7; font-family: monospace;
|
|
1415
|
+
word-break: break-all;
|
|
1416
|
+
}
|
|
1417
|
+
.hidden-toggle {
|
|
1418
|
+
font-size: 11px; opacity: 0.7; display: flex; align-items: center; gap: 4px;
|
|
1419
|
+
cursor: pointer; white-space: nowrap; user-select: none;
|
|
1420
|
+
}
|
|
1421
|
+
.new-folder-btn {
|
|
1422
|
+
font-size: 11px; opacity: 0.7; background: none; border: none; color: inherit;
|
|
1423
|
+
cursor: pointer; white-space: nowrap; padding: 0;
|
|
1424
|
+
}
|
|
1425
|
+
.new-folder-btn:hover { opacity: 1; }
|
|
1426
|
+
.new-folder-row {
|
|
1427
|
+
padding: 8px 20px; display: flex; align-items: center; gap: 8px;
|
|
1428
|
+
border-top: 1px solid var(--border);
|
|
1429
|
+
}
|
|
1430
|
+
.new-folder-row input[type='text'] {
|
|
1431
|
+
flex: 1; padding: 5px 8px; font-size: 12px;
|
|
1432
|
+
border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
|
|
1433
|
+
}
|
|
1434
|
+
.new-folder-row button {
|
|
1435
|
+
font-size: 11px; padding: 5px 10px; border: 1px solid var(--border-strong); background: none;
|
|
1436
|
+
color: inherit; border-radius: 6px; cursor: pointer;
|
|
1437
|
+
}
|
|
1438
|
+
.browser {
|
|
1439
|
+
flex: 1; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
|
|
1440
|
+
min-height: 200px;
|
|
1441
|
+
}
|
|
1442
|
+
.entry {
|
|
1443
|
+
padding: 8px 20px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
|
|
1444
|
+
}
|
|
1445
|
+
.entry:hover { background: var(--hover); }
|
|
1446
|
+
.entry .icon { opacity: 0.6; }
|
|
1447
|
+
.up { opacity: 0.7; }
|
|
1448
|
+
.empty { padding: 16px 20px; opacity: 0.6; font-size: 13px; }
|
|
1449
|
+
.footer { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
|
|
1450
|
+
.selected-row { font-size: 12px; }
|
|
1451
|
+
.selected-row .path { font-family: monospace; opacity: 0.85; word-break: break-all; }
|
|
1452
|
+
label { font-size: 12px; opacity: 0.7; display: block; margin-bottom: 4px; }
|
|
1453
|
+
input[type='text'] {
|
|
1454
|
+
width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px;
|
|
1455
|
+
border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
|
|
1456
|
+
}
|
|
1457
|
+
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
|
|
1458
|
+
button.primary {
|
|
1459
|
+
background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); padding: 7px 16px;
|
|
1460
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
1461
|
+
}
|
|
1462
|
+
button.primary:disabled { opacity: 0.5; cursor: default; }
|
|
1463
|
+
button.secondary {
|
|
1464
|
+
background: none; border: 1px solid var(--border-strong); color: inherit; padding: 7px 16px;
|
|
1465
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
1466
|
+
}
|
|
1467
|
+
.error { color: var(--danger); font-size: 12px; }
|
|
1468
|
+
.source-toggle { display: flex; gap: 8px; padding: 0 20px 12px; }
|
|
1469
|
+
.source-toggle button {
|
|
1470
|
+
flex: 1; padding: 8px; border: 1px solid var(--border-strong); background: none; color: inherit;
|
|
1471
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
1472
|
+
}
|
|
1473
|
+
.source-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
|
|
1474
|
+
.ff-body { padding: 4px 20px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
|
|
1475
|
+
.ff-hint { font-size: 12px; opacity: 0.7; }
|
|
1476
|
+
.ff-connected-row {
|
|
1477
|
+
font-size: 12px; display: flex; align-items: center; gap: 6px; padding: 6px 0;
|
|
1478
|
+
}
|
|
1479
|
+
.ff-connected-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
|
|
1480
|
+
.ff-folder-list { border: 1px solid var(--border); border-radius: 6px; max-height: 220px; overflow-y: auto; }
|
|
1481
|
+
.ff-folder-entry {
|
|
1482
|
+
padding: 8px 12px; cursor: pointer; font-size: 13px; font-family: monospace;
|
|
1483
|
+
}
|
|
1484
|
+
.ff-folder-entry:hover { background: var(--hover); }
|
|
1485
|
+
.ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
|
|
1486
|
+
.ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
|
|
1487
|
+
.ff-widget-slot { display: flex; }
|
|
1488
|
+
`}constructor(){super(),new N(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#E()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#m)}async#E(e){const t=new URLSearchParams;e&&t.set("path",e),this.#d.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)}#I(){this.#d.set(!this.#d.value),this.#E(this.#s.value)}#z(){this.#h.set(""),this.#g.set(!0)}#P(){this.#g.set(!1),this.#h.set("")}async#C(){const e=this.#h.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.#g.set(!1),this.#h.set(""),await this.#E(this.#s.value)}catch(t){this.#i.set(t.message)}}}#O(){this.#u.set(this.#s.value),this.#a.value||this.#a.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#F(){const e=this.#u.value||this.#s.value;if(e){this.#o.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#o.set(!1)}}}async#M(){if(this.#p.value)return;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#c.set(t),this.#v.set(F),this.#x.set(!0),this.#G(s))}async#j(){if(!this.#c.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await ae(()=>import(`${this.#c.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#$.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.#m=setInterval(()=>this.#q(),800),this.#q()}catch(e){this.#$.set(e.message)}}#q(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#p.value||(clearInterval(this.#m),this.#G(e))}async#G(e){this.#y.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#c.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#p.set(!0),this.#v.set(F),await this.#B()}finally{this.#y.set(!1)}}async#B(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),r=await i.json();if(!i.ok){this.#i.set(r.error??"failed to list folderfoo folders");return}this.#w.set(r)}finally{this.#_.set(!1)}}async#Z(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#c.value,tenantId:this.#v.value}),t=await fetch(`/api/folderfoo/shared-folders?${e.toString()}`),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to list folders shared with you");return}this.#A.set(s)}finally{this.#S.set(!1)}}#H(e){this.#T.set(e),this.#R.set(null),this.#l.set(""),this.#k.set(""),e==="shared"&&this.#A.value.length===0?this.#Z():e==="mine"&&this.#B()}#J(e){this.#R.set(e),this.#B(e.owner,e.path)}#K(e,t){this.#l.set(e),this.#k.set(t??""),this.#a.value||this.#a.set(e.split("/").filter(Boolean).pop()??this.#v.value)}#Y(e){this.#K(e.path,e.owner)}async#Q(){if(this.#l.value){this.#o.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#a.value||void 0,server:this.#c.value,tenantId:this.#v.value,folderPath:this.#l.value,owner:this.#k.value||void 0})}),t=await e.json();if(!e.ok){this.#i.set(t.error??"failed to connect folder");return}this.onAdded(t.kindMismatchWarning)}finally{this.#o.set(!1)}}}#X(){const e=this.#n.value;return l`
|
|
1489
|
+
<div class="breadcrumb-row">
|
|
1490
|
+
<div class="breadcrumb">${this.#s.value}</div>
|
|
1491
|
+
<button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
|
|
1492
|
+
<label class="hidden-toggle">
|
|
1493
|
+
<input type="checkbox" .checked=${this.#d.value} @change=${()=>this.#I()} />
|
|
1494
|
+
Show hidden
|
|
1495
|
+
</label>
|
|
1496
|
+
</div>
|
|
1497
|
+
${this.#g.value?l`
|
|
1498
|
+
<div class="new-folder-row">
|
|
1499
|
+
<input
|
|
1500
|
+
type="text"
|
|
1501
|
+
placeholder="Folder name"
|
|
1502
|
+
.value=${this.#h.value}
|
|
1503
|
+
@input=${t=>this.#h.set(t.target.value)}
|
|
1504
|
+
@keydown=${t=>{t.key==="Enter"&&this.#C(),t.key==="Escape"&&this.#P()}}
|
|
1505
|
+
/>
|
|
1506
|
+
<button @click=${()=>this.#C()}>Create</button>
|
|
1507
|
+
<button @click=${()=>this.#P()}>Cancel</button>
|
|
1508
|
+
</div>
|
|
1509
|
+
`:""}
|
|
1510
|
+
<div class="browser">
|
|
1511
|
+
${this.#r.value?l`<div class="entry up" @click=${()=>this.#E(this.#r.value)}>
|
|
1512
|
+
<span class="icon">📁</span> ..
|
|
1513
|
+
</div>`:""}
|
|
1514
|
+
${e.length===0&&!this.#r.value?l`<div class="empty">No subdirectories here.</div>`:e.map(t=>l`<div class="entry" @click=${()=>this.#E(t.path)}>
|
|
1515
|
+
<span class="icon">📁</span> ${t.name}
|
|
1516
|
+
</div>`)}
|
|
1517
|
+
</div>
|
|
1518
|
+
<div class="footer">
|
|
1519
|
+
<button class="secondary" @click=${()=>this.#O()}>
|
|
1520
|
+
Select this folder
|
|
1521
|
+
</button>
|
|
1522
|
+
${this.#u.value?l`<div class="selected-row">Selected: <span class="path">${this.#u.value}</span></div>`:""}
|
|
1523
|
+
<div>
|
|
1524
|
+
<label>Folder name</label>
|
|
1525
|
+
<input
|
|
1526
|
+
type="text"
|
|
1527
|
+
.value=${this.#a.value}
|
|
1528
|
+
placeholder="e.g. personal, company"
|
|
1529
|
+
@input=${t=>this.#a.set(t.target.value)}
|
|
1530
|
+
/>
|
|
1531
|
+
</div>
|
|
1532
|
+
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1533
|
+
<div class="actions">
|
|
1534
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1535
|
+
<button
|
|
1536
|
+
class="primary"
|
|
1537
|
+
?disabled=${!this.#u.value||this.#o.value}
|
|
1538
|
+
@click=${()=>this.#F()}
|
|
1539
|
+
>
|
|
1540
|
+
${this.#o.value?"Adding…":"Add folder"}
|
|
1541
|
+
</button>
|
|
1542
|
+
</div>
|
|
1543
|
+
</div>
|
|
1544
|
+
`}#N(){const e=this.#w.value;if(this.#x.value&&!this.#p.value)return l`
|
|
1545
|
+
<div class="ff-body">
|
|
1546
|
+
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#c.value} — connecting…</div>
|
|
1547
|
+
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1548
|
+
<div class="actions">
|
|
1549
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1550
|
+
</div>
|
|
1551
|
+
</div>
|
|
1552
|
+
`;if(!this.#p.value)return l`
|
|
1553
|
+
<div class="ff-body">
|
|
1554
|
+
<div class="ff-hint">
|
|
1555
|
+
Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
|
|
1556
|
+
${this.#e.value==="skill"?"skill":"memory"} source. Content stays live-synced from folderfoo —
|
|
1557
|
+
reads and writes go straight through, with a local cache for fast search.
|
|
1558
|
+
</div>
|
|
1559
|
+
<div>
|
|
1560
|
+
<label>Server URL</label>
|
|
1561
|
+
<input
|
|
1562
|
+
type="text"
|
|
1563
|
+
.value=${this.#c.value}
|
|
1564
|
+
placeholder="https://folderfoo.example.com"
|
|
1565
|
+
?disabled=${this.#b.value}
|
|
1566
|
+
@input=${i=>this.#c.set(i.target.value)}
|
|
1567
|
+
@keydown=${i=>i.key==="Enter"&&this.#j()}
|
|
1568
|
+
/>
|
|
1569
|
+
</div>
|
|
1570
|
+
${this.#b.value?l`
|
|
1571
|
+
<div class="ff-hint">Sign in below (this is folderfoo's own login widget, same one every folderfoo app uses):</div>
|
|
1572
|
+
<div class="ff-widget-slot"></div>
|
|
1573
|
+
${this.#y.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
|
|
1574
|
+
`:l`
|
|
1575
|
+
<div class="actions" style="justify-content: flex-start; margin-top: 0;">
|
|
1576
|
+
<button class="secondary" @click=${()=>this.#j()}>Continue</button>
|
|
1577
|
+
</div>
|
|
1578
|
+
`}
|
|
1579
|
+
${this.#$.value?l`<div class="error">${this.#$.value}</div>`:""}
|
|
1580
|
+
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1581
|
+
<div class="actions">
|
|
1582
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1583
|
+
</div>
|
|
1584
|
+
</div>
|
|
1585
|
+
`;const t=this.#A.value,s=this.#R.value;return l`
|
|
1586
|
+
<div class="ff-body">
|
|
1587
|
+
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Connected to ${this.#c.value}</div>
|
|
1588
|
+
<div class="kind-toggle">
|
|
1589
|
+
<button
|
|
1590
|
+
class=${this.#T.value==="mine"?"active":""}
|
|
1591
|
+
@click=${()=>this.#H("mine")}
|
|
1592
|
+
>
|
|
1593
|
+
My folders
|
|
1594
|
+
</button>
|
|
1595
|
+
<button
|
|
1596
|
+
class=${this.#T.value==="shared"?"active":""}
|
|
1597
|
+
@click=${()=>this.#H("shared")}
|
|
1598
|
+
>
|
|
1599
|
+
Shared with me
|
|
1600
|
+
</button>
|
|
1601
|
+
</div>
|
|
1602
|
+
${this.#T.value==="mine"?l`
|
|
1603
|
+
${e.length>0?l`
|
|
1604
|
+
<div class="ff-folder-list">
|
|
1605
|
+
${e.map(i=>l`<div
|
|
1606
|
+
class="ff-folder-entry ${this.#l.value===i.path&&!this.#k.value?"selected":""}"
|
|
1607
|
+
@click=${()=>this.#K(i.path)}
|
|
1608
|
+
>
|
|
1609
|
+
${i.path}
|
|
1610
|
+
</div>`)}
|
|
1611
|
+
</div>
|
|
1612
|
+
`:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No folders found.</div>`}
|
|
1613
|
+
`:s?l`
|
|
1614
|
+
<div class="breadcrumb-row">
|
|
1615
|
+
<div class="breadcrumb">${s.owner}:${s.path}</div>
|
|
1616
|
+
<button class="new-folder-btn" @click=${()=>this.#H("shared")}>← Back</button>
|
|
1617
|
+
</div>
|
|
1618
|
+
<div
|
|
1619
|
+
class="ff-folder-entry ${this.#l.value===s.path&&this.#k.value===s.owner?"selected":""}"
|
|
1620
|
+
@click=${()=>this.#Y(s)}
|
|
1621
|
+
>
|
|
1622
|
+
(connect this folder itself)
|
|
1623
|
+
</div>
|
|
1624
|
+
${e.length>0?l`
|
|
1625
|
+
<div class="ff-folder-list">
|
|
1626
|
+
${e.map(i=>l`<div
|
|
1627
|
+
class="ff-folder-entry ${this.#l.value===i.path&&this.#k.value===s.owner?"selected":""}"
|
|
1628
|
+
@click=${()=>this.#K(i.path,s.owner)}
|
|
1629
|
+
>
|
|
1630
|
+
${i.path}
|
|
1631
|
+
</div>`)}
|
|
1632
|
+
</div>
|
|
1633
|
+
`:this.#_.value?l`<div class="ff-hint">Loading folders…</div>`:l`<div class="ff-empty">No subfolders.</div>`}
|
|
1634
|
+
`:l`
|
|
1635
|
+
${t.length>0?l`
|
|
1636
|
+
<div class="ff-folder-list">
|
|
1637
|
+
${t.map(i=>l`<div class="ff-folder-entry" @click=${()=>this.#J(i)}>
|
|
1638
|
+
${i.path} <span style="opacity:0.6">— shared by ${i.owner}${i.role==="member"?" (read-only)":""}</span>
|
|
1639
|
+
</div>`)}
|
|
1640
|
+
</div>
|
|
1641
|
+
`:this.#S.value?l`<div class="ff-hint">Loading shared folders…</div>`:l`<div class="ff-empty">No one has shared a folder with you yet.</div>`}
|
|
1642
|
+
`}
|
|
1643
|
+
${this.#l.value?l`<div class="selected-row">
|
|
1644
|
+
Selected: <span class="path">${this.#k.value?`${this.#k.value}:`:""}${this.#l.value}</span>
|
|
1645
|
+
</div>`:""}
|
|
1646
|
+
<div>
|
|
1647
|
+
<label>Folder name</label>
|
|
1648
|
+
<input
|
|
1649
|
+
type="text"
|
|
1650
|
+
.value=${this.#a.value}
|
|
1651
|
+
placeholder="e.g. team-qa"
|
|
1652
|
+
@input=${i=>this.#a.set(i.target.value)}
|
|
1653
|
+
/>
|
|
1654
|
+
</div>
|
|
1655
|
+
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
1656
|
+
<div class="actions">
|
|
1657
|
+
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1658
|
+
<button
|
|
1659
|
+
class="primary"
|
|
1660
|
+
?disabled=${!this.#l.value||this.#o.value}
|
|
1661
|
+
@click=${()=>this.#Q()}
|
|
1662
|
+
>
|
|
1663
|
+
${this.#o.value?"Connecting…":"Connect folder"}
|
|
1664
|
+
</button>
|
|
1665
|
+
</div>
|
|
1666
|
+
</div>
|
|
1667
|
+
`}render(){return l`
|
|
1668
|
+
<div class="backdrop" @click=${e=>e.target===e.currentTarget&&this.onCancel()}>
|
|
1669
|
+
<div class="modal">
|
|
1670
|
+
<div class="header"><h2>Add a folder</h2></div>
|
|
1671
|
+
${this.lockKind?l``:l`
|
|
1672
|
+
<div class="kind-toggle">
|
|
1673
|
+
<button
|
|
1674
|
+
class=${this.#e.value==="skill"?"active":""}
|
|
1675
|
+
@click=${()=>this.#e.set("skill")}
|
|
1676
|
+
>
|
|
1677
|
+
Skill folder
|
|
1678
|
+
</button>
|
|
1679
|
+
<button
|
|
1680
|
+
class=${this.#e.value==="memory"?"active":""}
|
|
1681
|
+
@click=${()=>this.#e.set("memory")}
|
|
1682
|
+
>
|
|
1683
|
+
Memory folder
|
|
1684
|
+
</button>
|
|
1685
|
+
</div>
|
|
1686
|
+
`}
|
|
1687
|
+
<div class="source-toggle">
|
|
1688
|
+
<button class=${this.#t.value==="local"?"active":""} @click=${()=>this.#t.set("local")}>
|
|
1689
|
+
Local folder
|
|
1690
|
+
</button>
|
|
1691
|
+
<button
|
|
1692
|
+
class=${this.#t.value==="folderfoo"?"active":""}
|
|
1693
|
+
@click=${()=>{this.#t.set("folderfoo"),this.#M()}}
|
|
1694
|
+
>
|
|
1695
|
+
Connect folderfoo
|
|
1696
|
+
</button>
|
|
1697
|
+
</div>
|
|
1698
|
+
${this.#t.value==="local"?this.#X():this.#N()}
|
|
1699
|
+
</div>
|
|
1700
|
+
</div>
|
|
1701
|
+
`}}customElements.define("add-folder-modal",ir);function mt(n){const e=Date.now()-n,t=Math.floor(e/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const s=Math.floor(t/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}class rr extends k{static{this.properties={channels:{attribute:!1},selected:{attribute:!1},detail:{attribute:!1},loading:{attribute:!1},onSelect:{attribute:!1},onRefresh:{attribute:!1}}}static{this.styles=w`
|
|
1702
|
+
:host { display: flex; flex: 1 1 auto; min-height: 0; }
|
|
1703
|
+
.nav {
|
|
1704
|
+
flex: 0 0 260px;
|
|
1705
|
+
overflow-y: auto;
|
|
1706
|
+
border-right: 1px solid var(--border);
|
|
1707
|
+
display: flex;
|
|
1708
|
+
flex-direction: column;
|
|
1709
|
+
}
|
|
1710
|
+
.nav-header {
|
|
1711
|
+
padding: 10px 14px;
|
|
1712
|
+
padding-top: 46px;
|
|
1713
|
+
font-size: 11px;
|
|
1714
|
+
font-weight: 600;
|
|
1715
|
+
text-transform: uppercase;
|
|
1716
|
+
opacity: 0.6;
|
|
1717
|
+
background: var(--bg);
|
|
1718
|
+
border-bottom: 1px solid var(--border);
|
|
1719
|
+
display: flex;
|
|
1720
|
+
align-items: center;
|
|
1721
|
+
justify-content: space-between;
|
|
1722
|
+
}
|
|
1723
|
+
.refresh-btn {
|
|
1724
|
+
border: none; background: none; color: inherit; cursor: pointer; opacity: 0.6;
|
|
1725
|
+
font-size: 12px; padding: 2px 4px; border-radius: 4px;
|
|
1726
|
+
}
|
|
1727
|
+
.refresh-btn:hover { opacity: 1; background: var(--hover); }
|
|
1728
|
+
.channel-row {
|
|
1729
|
+
padding: 10px 14px;
|
|
1730
|
+
border-bottom: 1px solid var(--border);
|
|
1731
|
+
cursor: pointer;
|
|
1732
|
+
display: flex;
|
|
1733
|
+
flex-direction: column;
|
|
1734
|
+
gap: 2px;
|
|
1735
|
+
}
|
|
1736
|
+
.channel-row:hover { background: var(--hover); }
|
|
1737
|
+
.channel-row.active { background: var(--accent-tint); border-left: 3px solid var(--accent); padding-left: 11px; }
|
|
1738
|
+
.channel-name { font-size: 13px; font-weight: 600; font-family: ui-monospace, monospace; }
|
|
1739
|
+
.channel-meta { font-size: 11px; opacity: 0.6; }
|
|
1740
|
+
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
1741
|
+
.content-pane { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 16px 20px; padding-top: 46px; }
|
|
1742
|
+
.content-header {
|
|
1743
|
+
display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
|
|
1744
|
+
margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
|
|
1745
|
+
}
|
|
1746
|
+
.content-title { font-size: 15px; font-weight: 700; font-family: ui-monospace, monospace; }
|
|
1747
|
+
.content-meta { font-size: 12px; opacity: 0.6; }
|
|
1748
|
+
.content-body {
|
|
1749
|
+
white-space: pre-wrap;
|
|
1750
|
+
word-break: break-word;
|
|
1751
|
+
font-family: ui-monospace, monospace;
|
|
1752
|
+
font-size: 13px;
|
|
1753
|
+
line-height: 1.5;
|
|
1754
|
+
}
|
|
1755
|
+
.no-selection {
|
|
1756
|
+
flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
|
|
1757
|
+
opacity: 0.5; font-size: 13px; padding-top: 46px;
|
|
1758
|
+
}
|
|
1759
|
+
.placeholder-empty { opacity: 0.5; font-style: italic; }
|
|
1760
|
+
`}#e(){return!this.channels||this.channels.length===0?l`<div class="empty">No live channels right now. Channels appear here once an agent posts to one with memory_channel_post — they're ephemeral and disappear after a long idle period or server restart.</div>`:[...this.channels].sort((t,s)=>s.lastActivityAt-t.lastActivityAt).map(t=>l`
|
|
1761
|
+
<div
|
|
1762
|
+
class="channel-row ${this.selected===t.name?"active":""}"
|
|
1763
|
+
@click=${()=>this.onSelect(t.name)}
|
|
1764
|
+
>
|
|
1765
|
+
<span class="channel-name">${t.name}</span>
|
|
1766
|
+
<span class="channel-meta">${mt(t.lastActivityAt)}</span>
|
|
1767
|
+
</div>
|
|
1768
|
+
`)}#t(){return this.selected?this.loading?l`<div class="content-pane"><div class="content-meta">Loading…</div></div>`:this.detail?l`
|
|
1769
|
+
<div class="content-pane">
|
|
1770
|
+
<div class="content-header">
|
|
1771
|
+
<span class="content-title">${this.detail.name}</span>
|
|
1772
|
+
<span class="content-meta">last activity ${mt(this.detail.lastActivityAt)}</span>
|
|
1773
|
+
</div>
|
|
1774
|
+
${this.detail.content?l`<div class="content-body">${this.detail.content}</div>`:l`<div class="placeholder-empty">Channel exists but nothing has been posted yet.</div>`}
|
|
1775
|
+
</div>
|
|
1776
|
+
`:l`<div class="content-pane"><div class="content-meta">Channel not found — it may have gone idle and been swept.</div></div>`:l`<div class="no-selection">Select a channel to view its content.</div>`}render(){return l`
|
|
1777
|
+
<div class="nav">
|
|
1778
|
+
<div class="nav-header">
|
|
1779
|
+
<span>Live channels</span>
|
|
1780
|
+
<button class="refresh-btn" title="Refresh" @click=${()=>this.onRefresh()}>⟳</button>
|
|
1781
|
+
</div>
|
|
1782
|
+
${this.#e()}
|
|
1783
|
+
</div>
|
|
1784
|
+
${this.#t()}
|
|
1785
|
+
`}}customElements.define("channel-view",rr);function nr(n){const e=new Map;for(const t of n){const s=t.tags.length>0?t.tags:[null];for(const i of s){const r=e.get(i);r?r.push(t):e.set(i,[t])}}return[...e.entries()].map(([t,s])=>({tag:t,items:s})).sort((t,s)=>t.tag===null?1:s.tag===null?-1:t.tag.localeCompare(s.tag))}function or(n,e){const t=new Map;for(const r of n){const o=t.get(r.folder);o?o.push(r):t.set(r.folder,[r])}const s=[],i=[];for(const r of e){const o=t.get(r.name);if(!o)continue;const a={folder:r,tagGroups:[{tag:null,items:o}]};(r.remote?i:s).push(a)}return{local:s,remote:i}}const Xt="mem-bucket-folder-view-mode",es="mem-bucket-folder-view-expanded",vt="mem-bucket-folder-view-tree-split-pct",xt="mem-bucket-folder-view-list-split-pct",yt=12,kt=40,$t=20,wt=80;function _t(n,e,t,s){const i=Number(localStorage.getItem(n));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const ar=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],lr=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function cr(){const n=localStorage.getItem(Xt);return n==="a"||n==="b"||n==="c"?n:"a"}function dr(){try{const n=localStorage.getItem(es);if(!n)return new Set;const e=JSON.parse(n);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function St(n){localStorage.setItem(es,JSON.stringify([...n]))}class hr extends k{static{this.properties={entries:{attribute:!1},allFolders:{attribute:!1},facets:{attribute:!1},typeFilter:{attribute:!1},onTypeChange:{attribute:!1},onChanged:{attribute:!1},onDateClick:{attribute:!1},onKeyClick:{attribute:!1}}}#e=new h(cr());#t=new h(dr());#s=new h([]);#n=new h(null);#r=new h(null);#u=new h(_t(vt,20,yt,kt));#a=new h(_t(xt,40,$t,wt));#i=new h(null);#o=e=>this.#b(e);#d=()=>this.#$();static{this.styles=w`
|
|
1786
|
+
:host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
|
|
1787
|
+
/* padding-right reserves room for mem-bucket-app's absolutely-positioned .header-toolbar
|
|
1788
|
+
overlay (rendered outside this element entirely - see its own comment), which lines up with
|
|
1789
|
+
this row's top-right corner via matching padding. */
|
|
1790
|
+
.mode-row {
|
|
1791
|
+
display: flex; align-items: center; gap: 8px; padding: 10px 320px 10px 16px;
|
|
1792
|
+
border-bottom: 1px solid var(--border); background: var(--bg-subtle);
|
|
1793
|
+
}
|
|
1794
|
+
.mode-row .filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
|
|
1795
|
+
.mode-row select {
|
|
1796
|
+
font-size: 13px; padding: 6px 8px; height: 30px; box-sizing: border-box;
|
|
1797
|
+
border: 1px solid var(--border-strong); border-radius: 6px; background: none; color: inherit;
|
|
1798
|
+
}
|
|
1799
|
+
.type-toggle { display: flex; gap: 0; }
|
|
1800
|
+
.type-toggle button {
|
|
1801
|
+
border: 1px solid var(--border-strong);
|
|
1802
|
+
background: none;
|
|
1803
|
+
color: inherit;
|
|
1804
|
+
padding: 6px 12px;
|
|
1805
|
+
font-size: 13px;
|
|
1806
|
+
cursor: pointer;
|
|
1807
|
+
height: 30px;
|
|
1808
|
+
box-sizing: border-box;
|
|
1809
|
+
}
|
|
1810
|
+
.type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
|
|
1811
|
+
.type-toggle button:first-child { border-radius: 6px 0 0 6px; }
|
|
1812
|
+
.type-toggle button:last-child { border-radius: 0 6px 6px 0; }
|
|
1813
|
+
.type-toggle button:not(:first-child) { border-left: none; }
|
|
1814
|
+
.body-region { display: flex; flex: 1 1 auto; min-height: 0; }
|
|
1815
|
+
.tree-rail { flex: 0 0 auto; overflow-y: auto; padding: 8px 0; box-sizing: border-box; }
|
|
1816
|
+
result-list { flex: 0 0 auto; overflow-y: auto; box-sizing: border-box; }
|
|
1817
|
+
detail-panel { flex: 1 1 auto; min-width: 0; overflow-y: auto; }
|
|
1818
|
+
.no-selection {
|
|
1819
|
+
flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
|
|
1820
|
+
opacity: 0.5; font-size: 13px;
|
|
1821
|
+
}
|
|
1822
|
+
.splitter {
|
|
1823
|
+
flex: 0 0 auto;
|
|
1824
|
+
width: 6px;
|
|
1825
|
+
cursor: col-resize;
|
|
1826
|
+
background: var(--hover);
|
|
1827
|
+
position: relative;
|
|
1828
|
+
}
|
|
1829
|
+
.splitter:hover, .splitter.dragging { background: var(--accent-tint); }
|
|
1830
|
+
.splitter::after {
|
|
1831
|
+
content: '';
|
|
1832
|
+
position: absolute;
|
|
1833
|
+
top: 0; bottom: 0;
|
|
1834
|
+
left: -3px; right: -3px;
|
|
1835
|
+
}
|
|
1836
|
+
.section-header {
|
|
1837
|
+
padding: 8px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: 0.55;
|
|
1838
|
+
}
|
|
1839
|
+
.node {
|
|
1840
|
+
display: flex; align-items: center; gap: 6px; padding: 6px 14px; cursor: pointer; font-size: 13px;
|
|
1841
|
+
border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
|
|
1842
|
+
}
|
|
1843
|
+
.node:hover { background: var(--hover); }
|
|
1844
|
+
.node.active { background: var(--accent-tint); }
|
|
1845
|
+
.node .caret { width: 12px; flex: 0 0 auto; opacity: 0.6; font-size: 10px; }
|
|
1846
|
+
.node .icon { flex: 0 0 auto; }
|
|
1847
|
+
.node .label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1848
|
+
.node .count { flex: 0 0 auto; opacity: 0.5; font-size: 11px; }
|
|
1849
|
+
.node.remote .icon { color: var(--accent); }
|
|
1850
|
+
.indent-1 { padding-left: 30px; }
|
|
1851
|
+
.indent-2 { padding-left: 46px; }
|
|
1852
|
+
.empty { padding: 24px; opacity: 0.6; font-size: 13px; }
|
|
1853
|
+
.breadcrumb-bar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13px; }
|
|
1854
|
+
.breadcrumb-bar button {
|
|
1855
|
+
background: none; border: none; color: inherit; cursor: pointer; padding: 2px 4px;
|
|
1856
|
+
text-decoration: underline; text-underline-offset: 2px; font: inherit;
|
|
1857
|
+
}
|
|
1858
|
+
.breadcrumb-sep { opacity: 0.5; }
|
|
1859
|
+
.folder-card {
|
|
1860
|
+
display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px;
|
|
1861
|
+
border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
|
|
1862
|
+
}
|
|
1863
|
+
.folder-card:hover { background: var(--hover); }
|
|
1864
|
+
`}constructor(){super(),new N(this)}#g(e){this.#e.set(e),localStorage.setItem(Xt,e),this.#t.set(new Set),St(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#h(e){this.#g(e.target.value)}#c(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#o),document.addEventListener("pointerup",this.#d)}#b(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),r=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#u.set(Math.min(kt,Math.max(yt,r)));else{const o=100-this.#u.value,a=o>0?(r-this.#u.value)/o*100:0;this.#a.set(Math.min(wt,Math.max($t,a)))}}#$(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#o),document.removeEventListener("pointerup",this.#d),e==="tree"?localStorage.setItem(vt,String(this.#u.value)):e==="list"&&localStorage.setItem(xt,String(this.#a.value))}#x(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),St(t)}#v(e,t){this.#n.set({folder:e,tag:t})}#p(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#y(e){this.#r.set({table:e._table,id:e.id})}#w(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),r=this.#n.value?.folder===e.folder.name&&this.#n.value?.tag===null;return l`
|
|
1865
|
+
<button class="node ${e.folder.remote?"remote":""} ${r?"active":""}" @click=${()=>this.#x(t)}>
|
|
1866
|
+
<span class="caret">${s?"▾":"▸"}</span>
|
|
1867
|
+
<span class="icon">${e.folder.remote?"☁":"📁"}</span>
|
|
1868
|
+
<span
|
|
1869
|
+
class="label"
|
|
1870
|
+
@click=${o=>{o.stopPropagation(),this.#v(e.folder.name,null)}}
|
|
1871
|
+
>${e.folder.name}</span
|
|
1872
|
+
>
|
|
1873
|
+
<span class="count">${i}</span>
|
|
1874
|
+
</button>
|
|
1875
|
+
`}#l(e){const t=(s,i)=>s.length===0?"":l`
|
|
1876
|
+
<div class="section-header">${i}</div>
|
|
1877
|
+
${s.map(r=>{const o=`folder:${r.folder.name}`,a=this.#t.value.has(o),c=r.tagGroups[0]?.items??[];return l`
|
|
1878
|
+
${this.#w(r,o)}
|
|
1879
|
+
${a?c.map(d=>l`
|
|
1880
|
+
<button class="node indent-1" @click=${()=>this.#p(d)}>
|
|
1881
|
+
<span class="caret"></span>
|
|
1882
|
+
<span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
|
|
1883
|
+
<span class="label">${d.name}</span>
|
|
1884
|
+
</button>
|
|
1885
|
+
`):""}
|
|
1886
|
+
`})}
|
|
1887
|
+
`;return e.local.length===0&&e.remote.length===0?l`<div class="empty">No entries.</div>`:l`${t(e.local,"Folders")}${t(e.remote,"Remote")}`}#k(e){const t=this.#s.value;if(t.length===0){const o=[...e.local,...e.remote];return o.length===0?l`<div class="empty">No entries.</div>`:o.map(a=>{const c=a.tagGroups.reduce((d,u)=>d+u.items.length,0);return l`
|
|
1888
|
+
<button
|
|
1889
|
+
class="folder-card ${a.folder.remote?"remote":""}"
|
|
1890
|
+
@click=${()=>this.#s.set([a.folder.name])}
|
|
1891
|
+
>
|
|
1892
|
+
<span class="icon">${a.folder.remote?"☁":"📁"}</span>
|
|
1893
|
+
<span class="label">${a.folder.name}</span>
|
|
1894
|
+
<span class="count">${c}</span>
|
|
1895
|
+
</button>
|
|
1896
|
+
`})}const s=t[0],r=[...e.local,...e.remote].find(o=>o.folder.name===s)?.tagGroups[0]?.items??[];return l`
|
|
1897
|
+
<div class="breadcrumb-bar">
|
|
1898
|
+
<button @click=${()=>this.#s.set([])}>🏠 Folders</button>
|
|
1899
|
+
<span class="breadcrumb-sep">›</span>
|
|
1900
|
+
<span>${s}</span>
|
|
1901
|
+
</div>
|
|
1902
|
+
${r.length===0?l`<div class="empty">No entries in this folder.</div>`:r.map(o=>l`
|
|
1903
|
+
<button class="node" @click=${()=>this.#p(o)}>
|
|
1904
|
+
<span class="caret"></span>
|
|
1905
|
+
<span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
|
|
1906
|
+
<span class="label">${o.name}</span>
|
|
1907
|
+
</button>
|
|
1908
|
+
`)}
|
|
1909
|
+
`}#_(e){return e.length===0?l`<div class="empty">No entries.</div>`:e.map(t=>{const s=`tag:${t.tag??""}`,i=this.#t.value.has(s),r=this.#n.value?.folder===null&&this.#n.value?.tag===t.tag;return l`
|
|
1910
|
+
<button class="node ${r?"active":""}" @click=${()=>this.#x(s)}>
|
|
1911
|
+
<span class="caret">${i?"▾":"▸"}</span>
|
|
1912
|
+
<span class="icon">${t.tag===null?"":"🏷"}</span>
|
|
1913
|
+
<span
|
|
1914
|
+
class="label"
|
|
1915
|
+
@click=${o=>{o.stopPropagation(),this.#v(null,t.tag)}}
|
|
1916
|
+
>${t.tag??"(untagged)"}</span
|
|
1917
|
+
>
|
|
1918
|
+
<span class="count">${t.items.length}</span>
|
|
1919
|
+
</button>
|
|
1920
|
+
${i?t.items.map(o=>l`
|
|
1921
|
+
<button class="node indent-1" @click=${()=>this.#p(o)}>
|
|
1922
|
+
<span class="caret"></span>
|
|
1923
|
+
<span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
|
|
1924
|
+
<span class="label">${o.name}</span>
|
|
1925
|
+
<span class="count">${o.folder}</span>
|
|
1926
|
+
</button>
|
|
1927
|
+
`):""}
|
|
1928
|
+
`})}#m(){const e=this.#n.value;return e?(this.entries??[]).filter(s=>(e.folder===null||s.folder===e.folder)&&(e.tag===null||s.tags.includes(e.tag))):[]}render(){const e=this.#e.value,t=this.entries??[],s=this.allFolders??[],i=e==="c"?null:or(t,s),r=e==="c"?nr(t):null,o=this.#n.value,a=this.#r.value;return l`
|
|
1929
|
+
<div class="mode-row">
|
|
1930
|
+
<span class="filter-label">View:</span>
|
|
1931
|
+
<select .value=${e} @change=${c=>this.#h(c)}>
|
|
1932
|
+
${lr.map(c=>l`<option value=${c.value}>${c.label}</option>`)}
|
|
1933
|
+
</select>
|
|
1934
|
+
<div class="type-toggle">
|
|
1935
|
+
${ar.map(c=>l`
|
|
1936
|
+
<button
|
|
1937
|
+
class=${this.typeFilter===c.value?"active":""}
|
|
1938
|
+
@click=${()=>this.onTypeChange(c.value)}
|
|
1939
|
+
>
|
|
1940
|
+
${c.label}
|
|
1941
|
+
</button>
|
|
1942
|
+
`)}
|
|
1943
|
+
</div>
|
|
1944
|
+
</div>
|
|
1945
|
+
<div class="body-region">
|
|
1946
|
+
<div
|
|
1947
|
+
class="tree-rail"
|
|
1948
|
+
style=${`width: ${this.#u.value}%; border-right: 1px solid var(--border);`}
|
|
1949
|
+
>
|
|
1950
|
+
${e==="a"?this.#l(i):e==="b"?this.#k(i):this.#_(r)}
|
|
1951
|
+
</div>
|
|
1952
|
+
${o?l`
|
|
1953
|
+
<div
|
|
1954
|
+
class="splitter ${this.#i.value==="tree"?"dragging":""}"
|
|
1955
|
+
@pointerdown=${c=>this.#c("tree",c)}
|
|
1956
|
+
></div>
|
|
1957
|
+
<result-list
|
|
1958
|
+
style=${`width: ${this.#a.value}%; border-right: 1px solid var(--border);`}
|
|
1959
|
+
.results=${this.#m()}
|
|
1960
|
+
.showFolder=${!0}
|
|
1961
|
+
.onSelect=${c=>this.#y(c)}
|
|
1962
|
+
.selectedIds=${new Set}
|
|
1963
|
+
.onToggleSelect=${()=>{}}
|
|
1964
|
+
.onKeyClick=${this.onKeyClick}
|
|
1965
|
+
></result-list>
|
|
1966
|
+
<div
|
|
1967
|
+
class="splitter ${this.#i.value==="list"?"dragging":""}"
|
|
1968
|
+
@pointerdown=${c=>this.#c("list",c)}
|
|
1969
|
+
></div>
|
|
1970
|
+
`:l`
|
|
1971
|
+
<div
|
|
1972
|
+
class="splitter ${this.#i.value==="tree"?"dragging":""}"
|
|
1973
|
+
@pointerdown=${c=>this.#c("tree",c)}
|
|
1974
|
+
></div>
|
|
1975
|
+
`}
|
|
1976
|
+
${a?l`
|
|
1977
|
+
<detail-panel
|
|
1978
|
+
.selected=${a}
|
|
1979
|
+
.facets=${this.facets}
|
|
1980
|
+
.onChanged=${this.onChanged}
|
|
1981
|
+
.onTagClick=${()=>{}}
|
|
1982
|
+
.onFolderClick=${()=>{}}
|
|
1983
|
+
.onDateClick=${this.onDateClick}
|
|
1984
|
+
.onKeyClick=${this.onKeyClick}
|
|
1985
|
+
></detail-panel>
|
|
1986
|
+
`:l`<div class="no-selection">Select an item to view it.</div>`}
|
|
1987
|
+
</div>
|
|
1988
|
+
`}}customElements.define("folder-view",hr);const pr={system:"◐",light:"☀",dark:"☾"},ur={system:"Auto",light:"Light",dark:"Dark"};class fr extends k{static{this.properties={showReindex:{attribute:!1},reindexing:{attribute:!1},channelsActive:{attribute:!1},folderViewActive:{attribute:!1},showShared:{attribute:!1},sharedActive:{attribute:!1},theme:{attribute:!1},onReindex:{attribute:!1},onToggleChannels:{attribute:!1},onToggleFolderView:{attribute:!1},onToggleShared:{attribute:!1},onCycleTheme:{attribute:!1}}}static{this.styles=w`
|
|
1989
|
+
:host {
|
|
1990
|
+
display: flex;
|
|
1991
|
+
align-items: center;
|
|
1992
|
+
gap: 6px;
|
|
1993
|
+
flex-shrink: 0;
|
|
1994
|
+
font-family: system-ui, sans-serif;
|
|
1995
|
+
font-size: 13px;
|
|
1996
|
+
line-height: normal;
|
|
1997
|
+
color: inherit;
|
|
1998
|
+
}
|
|
1999
|
+
.theme-toggle, .reindex-toggle {
|
|
2000
|
+
width: 28px;
|
|
2001
|
+
height: 28px;
|
|
2002
|
+
border: 1px solid var(--border-strong);
|
|
2003
|
+
border-radius: 50%;
|
|
2004
|
+
background: var(--bg);
|
|
2005
|
+
color: inherit;
|
|
2006
|
+
cursor: pointer;
|
|
2007
|
+
font-size: 14px;
|
|
2008
|
+
line-height: 1;
|
|
2009
|
+
display: flex;
|
|
2010
|
+
align-items: center;
|
|
2011
|
+
justify-content: center;
|
|
2012
|
+
opacity: 0.75;
|
|
2013
|
+
font-family: inherit;
|
|
2014
|
+
}
|
|
2015
|
+
.theme-toggle:hover, .reindex-toggle:hover { opacity: 1; background: var(--hover); }
|
|
2016
|
+
.folderfoo-slot { display: contents; }
|
|
2017
|
+
.reindex-toggle:disabled { cursor: default; opacity: 0.4; }
|
|
2018
|
+
.reindex-toggle.spinning { animation: reindex-spin 0.8s linear infinite; }
|
|
2019
|
+
@keyframes reindex-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
|
2020
|
+
.channels-toggle, .folder-view-toggle, .shared-toggle {
|
|
2021
|
+
height: 28px;
|
|
2022
|
+
padding: 0 12px;
|
|
2023
|
+
border: 1px solid var(--border-strong);
|
|
2024
|
+
border-radius: 14px;
|
|
2025
|
+
background: var(--bg);
|
|
2026
|
+
color: inherit;
|
|
2027
|
+
cursor: pointer;
|
|
2028
|
+
font-size: 12px;
|
|
2029
|
+
line-height: 1;
|
|
2030
|
+
display: flex;
|
|
2031
|
+
align-items: center;
|
|
2032
|
+
gap: 5px;
|
|
2033
|
+
opacity: 0.75;
|
|
2034
|
+
font-family: inherit;
|
|
2035
|
+
}
|
|
2036
|
+
.channels-toggle:hover, .folder-view-toggle:hover, .shared-toggle:hover { opacity: 1; background: var(--hover); }
|
|
2037
|
+
.channels-toggle.active, .folder-view-toggle.active, .shared-toggle.active {
|
|
2038
|
+
background: var(--accent); border-color: var(--accent); color: var(--accent-fg); opacity: 1;
|
|
2039
|
+
}
|
|
2040
|
+
`}#e(){return l`
|
|
2041
|
+
<button
|
|
2042
|
+
class=${`reindex-toggle${this.reindexing?" spinning":""}`}
|
|
2043
|
+
title=${this.reindexing?"Reindexing…":"Rebuild cache from disk"}
|
|
2044
|
+
aria-label="Rebuild cache from disk"
|
|
2045
|
+
?disabled=${this.reindexing}
|
|
2046
|
+
@click=${()=>this.onReindex()}
|
|
2047
|
+
>
|
|
2048
|
+
♻
|
|
2049
|
+
</button>
|
|
2050
|
+
`}render(){return l`
|
|
2051
|
+
${this.showReindex?this.#e():""}
|
|
2052
|
+
<button
|
|
2053
|
+
class="channels-toggle ${this.channelsActive?"active":""}"
|
|
2054
|
+
title="Live memory channels"
|
|
2055
|
+
@click=${()=>this.onToggleChannels()}
|
|
2056
|
+
>
|
|
2057
|
+
⛓ Channels
|
|
2058
|
+
</button>
|
|
2059
|
+
<button
|
|
2060
|
+
class="folder-view-toggle ${this.folderViewActive?"active":""}"
|
|
2061
|
+
title="Browse by folder"
|
|
2062
|
+
@click=${()=>this.onToggleFolderView()}
|
|
2063
|
+
>
|
|
2064
|
+
🗂 Folder View
|
|
2065
|
+
</button>
|
|
2066
|
+
${this.showShared?l`
|
|
2067
|
+
<button
|
|
2068
|
+
class="shared-toggle ${this.sharedActive?"active":""}"
|
|
2069
|
+
title="Items shared with you"
|
|
2070
|
+
@click=${()=>this.onToggleShared()}
|
|
2071
|
+
>
|
|
2072
|
+
🤝 Shared
|
|
2073
|
+
</button>
|
|
2074
|
+
`:""}
|
|
2075
|
+
<button
|
|
2076
|
+
class="theme-toggle"
|
|
2077
|
+
title=${`Theme: ${ur[this.theme]} (click to change)`}
|
|
2078
|
+
aria-label="Toggle color theme"
|
|
2079
|
+
@click=${()=>this.onCycleTheme()}
|
|
2080
|
+
>
|
|
2081
|
+
${pr[this.theme]}
|
|
2082
|
+
</button>
|
|
2083
|
+
<div class="folderfoo-slot"></div>
|
|
2084
|
+
`}}customElements.define("app-toolbar",fr);const Ct="mem-bucket-last-fork-folder";class gr extends k{constructor(){super(...arguments),this._forkOpenFor=null,this._forkFolder=localStorage.getItem(Ct)??"",this._forkBusy=!1,this._forkStatus=null}static{this.properties={items:{attribute:!1},refreshing:{attribute:!1},lastRefreshSummary:{attribute:!1},memoryFolderNames:{attribute:!1},skillFolderNames:{attribute:!1},onRefresh:{attribute:!1},onDismiss:{attribute:!1},onOpen:{attribute:!1},onFork:{attribute:!1},_forkOpenFor:{state:!0},_forkFolder:{state:!0},_forkBusy:{state:!0},_forkStatus:{state:!0}}}static{this.styles=w`
|
|
2085
|
+
:host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
|
|
2086
|
+
.header {
|
|
2087
|
+
display: flex; align-items: center; gap: 10px; padding: 10px 16px;
|
|
2088
|
+
border-bottom: 1px solid var(--border); background: var(--bg-subtle);
|
|
2089
|
+
}
|
|
2090
|
+
.header h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; opacity: 0.6; margin: 0; flex: 1 1 auto; }
|
|
2091
|
+
.refresh-btn {
|
|
2092
|
+
width: 28px; height: 28px; border: 1px solid var(--border-strong); border-radius: 50%;
|
|
2093
|
+
background: var(--bg); color: inherit; cursor: pointer; font-size: 14px; line-height: 1;
|
|
2094
|
+
display: flex; align-items: center; justify-content: center; opacity: 0.75;
|
|
2095
|
+
}
|
|
2096
|
+
.refresh-btn:hover { opacity: 1; background: var(--hover); }
|
|
2097
|
+
.refresh-btn:disabled { cursor: default; opacity: 0.4; }
|
|
2098
|
+
.refresh-btn.spinning { animation: shared-refresh-spin 0.8s linear infinite; }
|
|
2099
|
+
@keyframes shared-refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
|
2100
|
+
.summary { font-size: 12px; opacity: 0.6; }
|
|
2101
|
+
.body { flex: 1 1 auto; overflow-y: auto; }
|
|
2102
|
+
.owner-group { border-bottom: 1px solid var(--border); }
|
|
2103
|
+
.owner-header { padding: 8px 16px 4px; font-size: 12px; font-weight: 600; opacity: 0.7; }
|
|
2104
|
+
.row {
|
|
2105
|
+
display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer;
|
|
2106
|
+
}
|
|
2107
|
+
.row:hover { background: var(--hover); }
|
|
2108
|
+
.row.revoked { opacity: 0.55; cursor: default; }
|
|
2109
|
+
.row .icon { flex: 0 0 auto; }
|
|
2110
|
+
.row .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2111
|
+
.role-badge {
|
|
2112
|
+
flex: 0 0 auto; font-size: 10px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--border-strong);
|
|
2113
|
+
opacity: 0.7; text-transform: uppercase;
|
|
2114
|
+
}
|
|
2115
|
+
.revoked-badge {
|
|
2116
|
+
flex: 0 0 auto; font-size: 11px; opacity: 0.8; font-style: italic;
|
|
2117
|
+
}
|
|
2118
|
+
.dismiss-btn {
|
|
2119
|
+
flex: 0 0 auto; border: none; background: none; color: inherit; cursor: pointer; opacity: 0.5; font-size: 13px;
|
|
2120
|
+
}
|
|
2121
|
+
.dismiss-btn:hover { opacity: 1; }
|
|
2122
|
+
.fork-btn {
|
|
2123
|
+
flex: 0 0 auto; font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border-strong);
|
|
2124
|
+
background: var(--bg); color: inherit; cursor: pointer; opacity: 0.75;
|
|
2125
|
+
}
|
|
2126
|
+
.fork-btn:hover { opacity: 1; background: var(--hover); }
|
|
2127
|
+
.fork-row {
|
|
2128
|
+
display: flex; align-items: center; gap: 6px; padding: 6px 16px 10px 40px; font-size: 12px;
|
|
2129
|
+
}
|
|
2130
|
+
.fork-row select {
|
|
2131
|
+
font-size: 12px; padding: 3px 6px; border: 1px solid var(--border-strong); border-radius: 4px;
|
|
2132
|
+
background: var(--bg); color: inherit;
|
|
2133
|
+
}
|
|
2134
|
+
.fork-status { font-size: 11px; opacity: 0.75; padding: 0 16px 8px 40px; }
|
|
2135
|
+
.empty { padding: 24px; opacity: 0.6; font-size: 13px; text-align: center; }
|
|
2136
|
+
`}#e(e){const t=new Map;for(const s of e){const i=t.get(s.owner)??[];i.push(s),t.set(s.owner,i)}return t}#t(e){return e==="skill"?this.skillFolderNames??[]:this.memoryFolderNames??[]}#s(e){this._forkOpenFor=this._forkOpenFor===e.origin_id?null:e.origin_id,this._forkStatus=null;const t=this.#t(e.kind);!t.includes(this._forkFolder)&&t.length&&(this._forkFolder=t[0])}async#n(e){if(this._forkFolder){this._forkBusy=!0,this._forkStatus=null;try{const t=await this.onFork(e,this._forkFolder);this._forkStatus=t.message,t.ok&&(localStorage.setItem(Ct,this._forkFolder),this._forkOpenFor=null)}finally{this._forkBusy=!1}}}#r(e){const t=e.status==="revoked",s=!t&&e.entryId!==null,i=this._forkOpenFor===e.origin_id;return l`
|
|
2137
|
+
<div class="row ${t?"revoked":""}" @click=${()=>s&&this.onOpen(e)}>
|
|
2138
|
+
<span class="icon">${e.kind==="skill"?"⚡":"📝"}</span>
|
|
2139
|
+
<span class="name">${e.remote_path}</span>
|
|
2140
|
+
${t?l`<span class="revoked-badge">no longer shared with you</span>`:l`<span class="role-badge">${e.role}</span>`}
|
|
2141
|
+
${t?"":l`<button class="fork-btn" @click=${r=>{r.stopPropagation(),this.#s(e)}}>Fork to mine</button>`}
|
|
2142
|
+
${t?l`<button class="dismiss-btn" title="Dismiss" @click=${r=>{r.stopPropagation(),this.onDismiss(e.origin_id)}}>✕</button>`:""}
|
|
2143
|
+
</div>
|
|
2144
|
+
${i?l`
|
|
2145
|
+
<div class="fork-row" @click=${r=>r.stopPropagation()}>
|
|
2146
|
+
<select .value=${this._forkFolder} @change=${r=>this._forkFolder=r.target.value}>
|
|
2147
|
+
${this.#t(e.kind).map(r=>l`<option value=${r}>${r}</option>`)}
|
|
2148
|
+
</select>
|
|
2149
|
+
<button ?disabled=${this._forkBusy||!this._forkFolder} @click=${()=>this.#n(e)}>Copy here</button>
|
|
2150
|
+
<button @click=${()=>this._forkOpenFor=null}>Cancel</button>
|
|
2151
|
+
</div>
|
|
2152
|
+
`:""}
|
|
2153
|
+
${i&&this._forkStatus?l`<div class="fork-status">${this._forkStatus}</div>`:""}
|
|
2154
|
+
`}render(){const e=this.items??[],t=this.#e(e),s=this.lastRefreshSummary;return l`
|
|
2155
|
+
<div class="header">
|
|
2156
|
+
<h2>Shared with me</h2>
|
|
2157
|
+
${s?l`<span class="summary">${s.added} added · ${s.updated} updated · ${s.revoked} revoked · ${s.unchanged} unchanged</span>`:""}
|
|
2158
|
+
<button
|
|
2159
|
+
class="refresh-btn ${this.refreshing?"spinning":""}"
|
|
2160
|
+
title="Refresh — check for updates or revoked shares"
|
|
2161
|
+
aria-label="Refresh shared items"
|
|
2162
|
+
?disabled=${this.refreshing}
|
|
2163
|
+
@click=${()=>this.onRefresh()}
|
|
2164
|
+
>
|
|
2165
|
+
♻
|
|
2166
|
+
</button>
|
|
2167
|
+
</div>
|
|
2168
|
+
<div class="body">
|
|
2169
|
+
${e.length===0?l`<div class="empty">Nothing shared with you yet. Items shared directly with you, or via a share link, appear here.</div>`:[...t.entries()].map(([i,r])=>l`
|
|
2170
|
+
<div class="owner-group">
|
|
2171
|
+
<div class="owner-header">From ${i}</div>
|
|
2172
|
+
${r.map(o=>this.#r(o))}
|
|
2173
|
+
</div>
|
|
2174
|
+
`)}
|
|
2175
|
+
</div>
|
|
2176
|
+
`}}customElements.define("shared-with-me-panel",gr);class br extends k{static{this.properties={entityTitle:{attribute:!1},description:{attribute:!1},tags:{attribute:!1},iconOrEmoji:{attribute:!1},iconImageUrl:{attribute:!1},owner:{attribute:!1},verified:{attribute:!1},stats:{attribute:!1},pinned:{attribute:!1},onPin:{attribute:!1},onCopy:{attribute:!1},copyIcon:{attribute:!1},onEdit:{attribute:!1},onDelete:{attribute:!1},selected:{attribute:!1},onClick:{attribute:!1},onActivate:{attribute:!1},actionLabel:{attribute:!1},onAction:{attribute:!1}}}static{this.styles=w`
|
|
2177
|
+
:host { display: block; height: 100%; box-sizing: border-box; }
|
|
2178
|
+
.card {
|
|
2179
|
+
display: flex;
|
|
2180
|
+
flex-direction: column;
|
|
2181
|
+
height: 100%;
|
|
2182
|
+
box-sizing: border-box;
|
|
2183
|
+
border-radius: 10px;
|
|
2184
|
+
border: 1px solid var(--border);
|
|
2185
|
+
background: var(--bg);
|
|
2186
|
+
padding: 14px;
|
|
2187
|
+
color: inherit;
|
|
2188
|
+
transition: border-color 0.15s, background 0.15s;
|
|
2189
|
+
cursor: default;
|
|
2190
|
+
}
|
|
2191
|
+
.card.clickable { cursor: pointer; }
|
|
2192
|
+
.card:hover { background: var(--hover); }
|
|
2193
|
+
.card.selected { border-color: var(--accent); background: var(--accent-tint); }
|
|
2194
|
+
.top-row {
|
|
2195
|
+
display: flex;
|
|
2196
|
+
align-items: flex-start;
|
|
2197
|
+
justify-content: space-between;
|
|
2198
|
+
gap: 10px;
|
|
2199
|
+
margin-bottom: 10px;
|
|
2200
|
+
}
|
|
2201
|
+
.logo-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
2202
|
+
.logo {
|
|
2203
|
+
width: 32px;
|
|
2204
|
+
height: 32px;
|
|
2205
|
+
border-radius: 6px;
|
|
2206
|
+
object-fit: cover;
|
|
2207
|
+
flex-shrink: 0;
|
|
2208
|
+
}
|
|
2209
|
+
.logo-emoji {
|
|
2210
|
+
width: 32px;
|
|
2211
|
+
height: 32px;
|
|
2212
|
+
border-radius: 6px;
|
|
2213
|
+
flex-shrink: 0;
|
|
2214
|
+
display: flex;
|
|
2215
|
+
align-items: center;
|
|
2216
|
+
justify-content: center;
|
|
2217
|
+
font-size: 17px;
|
|
2218
|
+
background: var(--bg-subtle);
|
|
2219
|
+
}
|
|
2220
|
+
.name-group { min-width: 0; }
|
|
2221
|
+
.name {
|
|
2222
|
+
font-size: 14px;
|
|
2223
|
+
font-weight: 600;
|
|
2224
|
+
line-height: 1.3;
|
|
2225
|
+
margin: 0;
|
|
2226
|
+
display: -webkit-box;
|
|
2227
|
+
-webkit-line-clamp: 2;
|
|
2228
|
+
-webkit-box-orient: vertical;
|
|
2229
|
+
overflow: hidden;
|
|
2230
|
+
}
|
|
2231
|
+
.owner-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
|
|
2232
|
+
.owner {
|
|
2233
|
+
font-size: 12px;
|
|
2234
|
+
opacity: 0.65;
|
|
2235
|
+
white-space: nowrap;
|
|
2236
|
+
overflow: hidden;
|
|
2237
|
+
text-overflow: ellipsis;
|
|
2238
|
+
}
|
|
2239
|
+
.check { width: 12px; height: 12px; color: var(--accent); flex-shrink: 0; }
|
|
2240
|
+
.description {
|
|
2241
|
+
font-size: 12.5px;
|
|
2242
|
+
line-height: 1.45;
|
|
2243
|
+
opacity: 0.8;
|
|
2244
|
+
margin: 0 0 10px 0;
|
|
2245
|
+
display: -webkit-box;
|
|
2246
|
+
-webkit-line-clamp: 2;
|
|
2247
|
+
-webkit-box-orient: vertical;
|
|
2248
|
+
overflow: hidden;
|
|
2249
|
+
white-space: pre-wrap;
|
|
2250
|
+
}
|
|
2251
|
+
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
|
|
2252
|
+
.badge {
|
|
2253
|
+
display: inline-flex;
|
|
2254
|
+
align-items: center;
|
|
2255
|
+
height: 18px;
|
|
2256
|
+
padding: 0 7px;
|
|
2257
|
+
border-radius: 9999px;
|
|
2258
|
+
font-size: 10px;
|
|
2259
|
+
font-weight: 500;
|
|
2260
|
+
white-space: nowrap;
|
|
2261
|
+
border: 1px solid var(--border-strong);
|
|
2262
|
+
background: var(--bg-subtle);
|
|
2263
|
+
}
|
|
2264
|
+
.spacer { flex: 1; }
|
|
2265
|
+
.footer {
|
|
2266
|
+
display: flex;
|
|
2267
|
+
align-items: center;
|
|
2268
|
+
justify-content: space-between;
|
|
2269
|
+
gap: 8px;
|
|
2270
|
+
padding-top: 10px;
|
|
2271
|
+
margin-top: auto;
|
|
2272
|
+
border-top: 1px solid var(--border);
|
|
2273
|
+
font-size: 12px;
|
|
2274
|
+
opacity: 0.75;
|
|
2275
|
+
}
|
|
2276
|
+
.footer.no-stats { justify-content: flex-end; }
|
|
2277
|
+
.stats-left { display: flex; align-items: center; gap: 10px; }
|
|
2278
|
+
.stats-left span { display: flex; align-items: center; gap: 3px; }
|
|
2279
|
+
.actions-right { display: flex; align-items: center; gap: 4px; }
|
|
2280
|
+
.icon-btn {
|
|
2281
|
+
background: none;
|
|
2282
|
+
border: none;
|
|
2283
|
+
color: inherit;
|
|
2284
|
+
opacity: 0.6;
|
|
2285
|
+
cursor: pointer;
|
|
2286
|
+
padding: 3px;
|
|
2287
|
+
display: flex;
|
|
2288
|
+
align-items: center;
|
|
2289
|
+
border-radius: 4px;
|
|
2290
|
+
font-size: 13px;
|
|
2291
|
+
line-height: 1;
|
|
2292
|
+
}
|
|
2293
|
+
.icon-btn:hover { opacity: 1; background: var(--bg-subtle); }
|
|
2294
|
+
.icon-btn.heart.pinned { opacity: 1; color: var(--danger); }
|
|
2295
|
+
.icon-btn.delete:hover { color: var(--danger); }
|
|
2296
|
+
.action-btn {
|
|
2297
|
+
display: flex;
|
|
2298
|
+
align-items: center;
|
|
2299
|
+
gap: 5px;
|
|
2300
|
+
padding: 4px 10px;
|
|
2301
|
+
border-radius: 6px;
|
|
2302
|
+
border: 1px solid var(--border-strong);
|
|
2303
|
+
background: none;
|
|
2304
|
+
font-size: 11.5px;
|
|
2305
|
+
font-weight: 500;
|
|
2306
|
+
color: inherit;
|
|
2307
|
+
cursor: pointer;
|
|
2308
|
+
}
|
|
2309
|
+
.action-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
|
|
2310
|
+
`}#e(e){e.stopPropagation()}render(){const e=this.entityTitle!==void 0||this.iconOrEmoji||this.iconImageUrl||this.owner,t=this.stats&&this.stats.length>0||this.onPin||this.onCopy||this.onEdit||this.onDelete||this.actionLabel&&this.onAction;return l`
|
|
2311
|
+
<div
|
|
2312
|
+
class="card ${this.onClick||this.onActivate?"clickable":""} ${this.selected?"selected":""}"
|
|
2313
|
+
@click=${()=>this.onClick?.()}
|
|
2314
|
+
@dblclick=${()=>this.onActivate?.()}
|
|
2315
|
+
>
|
|
2316
|
+
${e?l`
|
|
2317
|
+
<div class="top-row">
|
|
2318
|
+
<div class="logo-name">
|
|
2319
|
+
${this.iconImageUrl?l`<img class="logo" src=${this.iconImageUrl} alt="" loading="lazy" />`:this.iconOrEmoji?l`<div class="logo-emoji">${this.iconOrEmoji}</div>`:f}
|
|
2320
|
+
<div class="name-group">
|
|
2321
|
+
${this.entityTitle!==void 0?l`<h3 class="name">${this.entityTitle||l`<em style="opacity:0.5">(untitled)</em>`}</h3>`:f}
|
|
2322
|
+
${this.owner?l`
|
|
2323
|
+
<div class="owner-row">
|
|
2324
|
+
<span class="owner">${this.owner}</span>
|
|
2325
|
+
${this.verified?l`<svg class="check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2326
|
+
<circle cx="12" cy="12" r="10" />
|
|
2327
|
+
<path d="m9 12 2 2 4-4" />
|
|
2328
|
+
</svg>`:f}
|
|
2329
|
+
</div>
|
|
2330
|
+
`:f}
|
|
2331
|
+
</div>
|
|
2332
|
+
</div>
|
|
2333
|
+
</div>
|
|
2334
|
+
`:f}
|
|
2335
|
+
${this.description?l`<p class="description">${this.description}</p>`:f}
|
|
2336
|
+
${this.tags&&this.tags.length>0?l`<div class="tags">${this.tags.map(s=>l`<span class="badge">${s}</span>`)}</div>`:f}
|
|
2337
|
+
${t?l`
|
|
2338
|
+
<div class="footer ${this.stats&&this.stats.length>0?"":"no-stats"}">
|
|
2339
|
+
${this.stats&&this.stats.length>0?l`
|
|
2340
|
+
<div class="stats-left">
|
|
2341
|
+
${this.stats.map(s=>l`<span>${s.icon} ${s.label}</span>`)}
|
|
2342
|
+
</div>
|
|
2343
|
+
`:f}
|
|
2344
|
+
<div class="actions-right">
|
|
2345
|
+
${this.onCopy?l`<button class="icon-btn copy" title="Copy" @click=${s=>{this.#e(s),this.onCopy?.()}}>${this.copyIcon||"📋"}</button>`:f}
|
|
2346
|
+
${this.onPin?l`<button
|
|
2347
|
+
class="icon-btn heart ${this.pinned?"pinned":""}"
|
|
2348
|
+
title=${this.pinned?"Unpin":"Pin"}
|
|
2349
|
+
@click=${s=>{this.#e(s),this.onPin?.()}}
|
|
2350
|
+
>${this.pinned?"♥":"♡"}</button>`:f}
|
|
2351
|
+
${this.onEdit?l`<button class="icon-btn edit" title="Edit" @click=${s=>{this.#e(s),this.onEdit?.()}}>✏️</button>`:f}
|
|
2352
|
+
${this.onDelete?l`<button class="icon-btn delete" title="Delete" @click=${s=>{this.#e(s),this.onDelete?.()}}>🗑</button>`:f}
|
|
2353
|
+
${this.actionLabel&&this.onAction?l`<button class="action-btn" @click=${s=>{this.#e(s),this.onAction?.()}}>${this.actionLabel}</button>`:f}
|
|
2354
|
+
</div>
|
|
2355
|
+
</div>
|
|
2356
|
+
`:f}
|
|
2357
|
+
</div>
|
|
2358
|
+
`}}customElements.define("entity-card",br);let re=null;const mr=200,Tt="mem-bucket-quick-prompts-folder";class vr extends k{static{this.properties={onClose:{attribute:!1},memoryFolders:{attribute:!1},openToAdd:{attribute:!1}}}#e=new h([]);#t=new h(!0);#s=new h("");#n=new h(-1);#r=new h(!1);#u=!1;#a=new h(null);#i=new h("");#o=new h("");#d=new h(localStorage.getItem(Tt)??"");#g=new h("");#h=new h("");#c=e=>this.#y(e);#b=e=>this.#w(e);static{this.styles=w`
|
|
2359
|
+
:host { display: block; }
|
|
2360
|
+
.backdrop {
|
|
2361
|
+
position: fixed; inset: 0; background: var(--overlay);
|
|
2362
|
+
display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; z-index: 200;
|
|
2363
|
+
}
|
|
2364
|
+
.modal {
|
|
2365
|
+
background: var(--bg);
|
|
2366
|
+
color: inherit;
|
|
2367
|
+
border-radius: 12px;
|
|
2368
|
+
width: min(760px, 92vw);
|
|
2369
|
+
max-height: 76vh;
|
|
2370
|
+
display: flex;
|
|
2371
|
+
flex-direction: column;
|
|
2372
|
+
box-shadow: 0 12px 48px var(--shadow);
|
|
2373
|
+
border: 1px solid var(--border);
|
|
2374
|
+
overflow: hidden;
|
|
2375
|
+
}
|
|
2376
|
+
.search-row {
|
|
2377
|
+
display: flex; align-items: center; gap: 8px; padding: 12px 16px;
|
|
2378
|
+
border-bottom: 1px solid var(--border);
|
|
2379
|
+
}
|
|
2380
|
+
.search-row input {
|
|
2381
|
+
flex: 1; border: none; background: none; color: inherit; font-size: 15px; outline: none;
|
|
2382
|
+
}
|
|
2383
|
+
.hint { font-size: 11px; opacity: 0.5; white-space: nowrap; }
|
|
2384
|
+
.body { flex: 1; overflow-y: auto; padding: 14px 16px; }
|
|
2385
|
+
.grid {
|
|
2386
|
+
display: grid;
|
|
2387
|
+
grid-template-columns: repeat(auto-fill, minmax(${mr}px, 1fr));
|
|
2388
|
+
gap: 10px;
|
|
2389
|
+
}
|
|
2390
|
+
.add-tile {
|
|
2391
|
+
display: flex; align-items: center; justify-content: center;
|
|
2392
|
+
border: 1px dashed var(--border-strong);
|
|
2393
|
+
border-radius: 10px;
|
|
2394
|
+
min-height: 96px;
|
|
2395
|
+
cursor: pointer;
|
|
2396
|
+
font-size: 28px;
|
|
2397
|
+
opacity: 0.5;
|
|
2398
|
+
background: none;
|
|
2399
|
+
color: inherit;
|
|
2400
|
+
}
|
|
2401
|
+
.add-tile:hover { opacity: 1; background: var(--hover); }
|
|
2402
|
+
.empty { padding: 24px; text-align: center; opacity: 0.6; font-size: 13px; }
|
|
2403
|
+
.add-form { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 2px; }
|
|
2404
|
+
.add-form input[type='text'] {
|
|
2405
|
+
padding: 6px 9px; font-size: 12.5px; border: 1px solid var(--border-strong); border-radius: 6px;
|
|
2406
|
+
background: none; color: inherit;
|
|
2407
|
+
}
|
|
2408
|
+
.add-form textarea {
|
|
2409
|
+
padding: 8px 9px; font-size: 13px; border: 1px solid var(--border-strong); border-radius: 6px;
|
|
2410
|
+
background: none; color: inherit; resize: vertical; min-height: 140px; font-family: inherit;
|
|
2411
|
+
}
|
|
2412
|
+
.add-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
2413
|
+
.folder-pill {
|
|
2414
|
+
flex: 0 0 auto;
|
|
2415
|
+
padding: 4px 10px; font-size: 11.5px; border: 1px solid var(--border-strong); border-radius: 999px;
|
|
2416
|
+
background: var(--bg-subtle); color: inherit; cursor: pointer;
|
|
2417
|
+
}
|
|
2418
|
+
.folder-pill:hover { background: var(--hover); }
|
|
2419
|
+
button.primary {
|
|
2420
|
+
background: var(--accent); border: 1px solid var(--accent); color: var(--accent-fg); padding: 6px 14px;
|
|
2421
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
2422
|
+
}
|
|
2423
|
+
button.secondary {
|
|
2424
|
+
background: none; border: 1px solid var(--border-strong); color: inherit; padding: 6px 14px;
|
|
2425
|
+
border-radius: 6px; cursor: pointer; font-size: 13px;
|
|
2426
|
+
}
|
|
2427
|
+
.error { color: var(--danger); font-size: 12px; padding: 0 16px 10px; }
|
|
2428
|
+
.footer-bar {
|
|
2429
|
+
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
2430
|
+
padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11px; opacity: 0.6;
|
|
2431
|
+
}
|
|
2432
|
+
`}constructor(){super(),new N(this)}willUpdate(e){e.has("memoryFolders")&&this.#T()}connectedCallback(){super.connectedCallback(),this.#$(),this.#T(),this.openToAdd&&(this.#u=!0,this.#A()),window.addEventListener("keydown",this.#b)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#b)}firstUpdated(){this.renderRoot.querySelector(".search-row input")?.focus()}async#$(){this.#t.set(!0);try{const t=await(await fetch("/api/quick-prompts")).json();this.#e.set(t)}catch(e){this.#g.set(e.message)}finally{this.#t.set(!1)}}#x(){const e=this.#d.value?this.#e.value.filter(i=>i.folder===this.#d.value):this.#e.value,t=this.#s.value.trim().toLowerCase();return[...t?e.filter(i=>i.title.toLowerCase().includes(t)||i.body.toLowerCase().includes(t)||i.tags.some(r=>r.toLowerCase().includes(t))):e].sort((i,r)=>Number(r.pinned)-Number(i.pinned))}#v(e){const t=this.#x()[this.#n.value];this.#s.set(e.target.value);const s=this.#x(),i=t?s.findIndex(r=>r.id===t.id):-1;this.#n.set(i!==-1?i:s.length>0?0:-1)}#p(){const e=this.renderRoot.querySelector(".grid");if(!e)return 1;const t=getComputedStyle(e).gridTemplateColumns;return Math.max(1,t.split(" ").filter(Boolean).length)}#y(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#r.value){e.preventDefault(),this.#A();return}const t=this.#x(),s=this.#p(),i=e.target,r=i instanceof HTMLInputElement,o=i instanceof HTMLTextAreaElement,a=(r||o)&&i.value.length>0;if(!((e.key==="ArrowLeft"||e.key==="ArrowRight")&&a)&&!((e.key==="ArrowUp"||e.key==="ArrowDown")&&o)){if(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"){e.preventDefault();let c=this.#n.value;c===-1?c=0:e.key==="ArrowDown"?c=Math.min(t.length-1,c+s):e.key==="ArrowUp"?c=Math.max(0,c-s):e.key==="ArrowRight"?c=Math.min(t.length-1,c+1):e.key==="ArrowLeft"&&(c=Math.max(0,c-1)),this.#n.set(c);return}if(e.key==="Enter"){const c=t[this.#n.value];c&&(e.preventDefault(),this.#l(c));return}e.key==="Escape"&&!this.#r.value&&this.onClose()}}#w(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"&&re&&(e.preventDefault(),this.#m())}async#l(e){try{await navigator.clipboard.writeText(e.body),y.success("Copied to clipboard")}catch{y.danger("Copy failed")}this.onClose()}async#k(e){const t=!e.pinned;this.#e.set(this.#e.value.map(s=>s.id===e.id?{...s,pinned:t}:s)),await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:t})})}async#_(e){re={title:e.title,body:e.body,tags:e.tags,pinned:e.pinned,folder:e.folder},this.#e.set(this.#e.value.filter(t=>t.id!==e.id)),this.#h.set("Deleted — press Cmd+Z / Ctrl+Z to undo");try{await fetch(`/api/quick-prompts/${encodeURIComponent(e.id)}`,{method:"DELETE"})}catch(t){this.#g.set(t.message)}}async#m(){const e=re;if(e){re=null,this.#h.set("");try{const s=await(await fetch("/api/quick-prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,body:e.body,tags:e.tags,folder:e.folder})})).json();e.pinned&&(await fetch(`/api/quick-prompts/${encodeURIComponent(s.id)}/pinned`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pinned:!0})}),s.pinned=!0),this.#e.set([s,...this.#e.value]),this.#h.set("Prompt restored"),setTimeout(()=>this.#h.set(""),2e3)}catch(t){this.#g.set(t.message)}}}#T(){const e=this.memoryFolders??[];e.length!==0&&(e.some(t=>t.name===this.#d.value)||this.#d.set(e[0].name))}#A(){this.#a.set(null),this.#i.set(""),this.#o.set(""),this.#T(),this.#r.set(!0),this.#R()}#S(e){this.#a.set(e.id),this.#i.set(e.title),this.#o.set(e.body),this.#d.set(e.folder),this.#r.set(!0),this.#R()}#R(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".add-form textarea")?.focus()})}#E(){this.updateComplete.then(()=>{this.renderRoot.querySelector(".search-row input")?.focus()})}#I(e){this.#d.set(e),localStorage.setItem(Tt,e),this.#n.set(-1)}#z(){if(this.#u){this.onClose();return}this.#r.set(!1),this.#a.set(null),this.#E()}async#P(){const e=this.#o.value.trim();if(!e)return;this.#g.set("");const t=this.#a.value;try{const s=await fetch(t?`/api/quick-prompts/${encodeURIComponent(t)}`:"/api/quick-prompts",{method:t?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:this.#i.value.trim(),body:e,folder:this.#d.value||void 0})}),i=await s.json();if(!s.ok){this.#g.set(i.error??(t?"failed to update prompt":"failed to create prompt"));return}t?this.#e.set(this.#e.value.map(r=>r.id===t?i:r)):this.#e.set([i,...this.#e.value]),this.#r.set(!1),this.#a.set(null)}catch(s){this.#g.set(s.message)}}#C(e){e.key==="Escape"?(e.stopPropagation(),this.#z()):(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&this.#P()}render(){const e=this.#x();return l`
|
|
2433
|
+
<div class="backdrop" @click=${t=>t.target===t.currentTarget&&this.onClose()}>
|
|
2434
|
+
<div class="modal" @keydown=${this.#c}>
|
|
2435
|
+
<div class="search-row">
|
|
2436
|
+
<input
|
|
2437
|
+
type="search"
|
|
2438
|
+
placeholder="Search quick prompts…"
|
|
2439
|
+
.value=${this.#s.value}
|
|
2440
|
+
@input=${t=>this.#v(t)}
|
|
2441
|
+
/>
|
|
2442
|
+
${(this.memoryFolders?.length??0)>1?l`
|
|
2443
|
+
<select
|
|
2444
|
+
class="folder-pill"
|
|
2445
|
+
title="Shows and saves quick prompts for this folder"
|
|
2446
|
+
.value=${this.#d.value}
|
|
2447
|
+
@change=${t=>this.#I(t.target.value)}
|
|
2448
|
+
>
|
|
2449
|
+
${this.memoryFolders.map(t=>l`<option value=${t.name}>${t.remote?"☁":"📁"} ${t.name}</option>`)}
|
|
2450
|
+
</select>
|
|
2451
|
+
`:""}
|
|
2452
|
+
<span class="hint">${this.#h.value||"↑↓←→ navigate · Enter copy · Esc close"}</span>
|
|
2453
|
+
</div>
|
|
2454
|
+
${this.#g.value?l`<div class="error">${this.#g.value}</div>`:""}
|
|
2455
|
+
<div class="body">
|
|
2456
|
+
${this.#r.value?l`
|
|
2457
|
+
<div class="add-form" @keydown=${this.#C}>
|
|
2458
|
+
<input
|
|
2459
|
+
type="text"
|
|
2460
|
+
placeholder="Title (optional)"
|
|
2461
|
+
.value=${this.#i.value}
|
|
2462
|
+
@input=${t=>this.#i.set(t.target.value)}
|
|
2463
|
+
/>
|
|
2464
|
+
<textarea
|
|
2465
|
+
placeholder="Prompt text…"
|
|
2466
|
+
.value=${this.#o.value}
|
|
2467
|
+
@input=${t=>this.#o.set(t.target.value)}
|
|
2468
|
+
></textarea>
|
|
2469
|
+
<div class="add-form-actions">
|
|
2470
|
+
<button class="secondary" @click=${()=>this.#z()}>Cancel</button>
|
|
2471
|
+
<button class="primary" ?disabled=${!this.#o.value.trim()} @click=${()=>this.#P()}>
|
|
2472
|
+
${this.#a.value?"Save changes":"Add prompt"}
|
|
2473
|
+
</button>
|
|
2474
|
+
</div>
|
|
2475
|
+
</div>
|
|
2476
|
+
`:this.#t.value?l`<div class="empty">Loading…</div>`:e.length===0&&!this.#s.value?l`
|
|
2477
|
+
<div class="grid">
|
|
2478
|
+
<button class="add-tile" title="Add a quick prompt" @click=${()=>this.#A()}>+</button>
|
|
2479
|
+
</div>
|
|
2480
|
+
<div class="empty">No quick prompts yet — add one to get started.</div>
|
|
2481
|
+
`:l`
|
|
2482
|
+
<div class="grid">
|
|
2483
|
+
<button class="add-tile" title="Add a quick prompt" @click=${()=>this.#A()}>+</button>
|
|
2484
|
+
${e.map((t,s)=>l`
|
|
2485
|
+
<entity-card
|
|
2486
|
+
.entityTitle=${t.title}
|
|
2487
|
+
.description=${t.body}
|
|
2488
|
+
.tags=${t.tags}
|
|
2489
|
+
.iconOrEmoji=${t.remote?"☁":"📝"}
|
|
2490
|
+
.pinned=${t.pinned}
|
|
2491
|
+
.selected=${s===this.#n.value}
|
|
2492
|
+
.onPin=${()=>this.#k(t)}
|
|
2493
|
+
.onCopy=${()=>this.#l(t)}
|
|
2494
|
+
copyIcon="📋"
|
|
2495
|
+
.onEdit=${()=>this.#S(t)}
|
|
2496
|
+
.onDelete=${()=>this.#_(t)}
|
|
2497
|
+
.onClick=${()=>this.#l(t)}
|
|
2498
|
+
.onActivate=${()=>this.#l(t)}
|
|
2499
|
+
></entity-card>
|
|
2500
|
+
`)}
|
|
2501
|
+
</div>
|
|
2502
|
+
`}
|
|
2503
|
+
</div>
|
|
2504
|
+
<div class="footer-bar">
|
|
2505
|
+
<span>${e.length} quick prompt${e.length===1?"":"s"}</span>
|
|
2506
|
+
<span>⌘/Ctrl+Enter to add · Double-Shift to toggle this palette</span>
|
|
2507
|
+
</div>
|
|
2508
|
+
</div>
|
|
2509
|
+
</div>
|
|
2510
|
+
`}}customElements.define("quick-prompts-modal",vr);function xr(n){const e=n.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[r,o]=e;return r.includes("/")?{folderPath:r,name:o}:{owner:r,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const oe=new h({mode:"off",username:null});let At=!1;function yr(){if(At)return;At=!0;const n=new EventSource("/api/folderfoo/identity-stream");n.onmessage=e=>{try{oe.set(JSON.parse(e.data))}catch{}}}let Et=!1;async function kr(n){if(Et)return;Et=!0;const{folderfooMode:e,folderfooHost:t}=await H();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),r=s.searchParams.has("publicToken");if(!(!i&&!r)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||n({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:F})}),document.addEventListener("folderfoo-share-redeem-failed",o=>{const a=o.detail?.message;alert(a||"This link is invalid or has expired.")});try{const[o,a]=await Promise.all([ae(()=>import(`${t}/elements/auth-guard.js`),[]),ae(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(F),i&&o.redeemShareTokenFromUrl(),r){const c=s.searchParams.get("publicToken");s.searchParams.delete("publicToken"),window.history.replaceState(null,"",s.toString());const d=await o.getPublicLink(c).catch(u=>(alert(u.message||"This link is invalid or has expired."),null));d?.type==="file"&&d.originId&&d.kind&&n({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:F})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let Rt=!1;const $r=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],zt=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],wr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},_r={skill:[],memory:[]},ts="mem-bucket-split-pct",ss=20,is=80;function Sr(){const n=Number(localStorage.getItem(ts));return Number.isFinite(n)&&n>=ss&&n<=is?n:40}const rs="mem-bucket-theme",xe=["system","light","dark"];function Cr(){const n=localStorage.getItem(rs);return n==="light"||n==="dark"?n:"system"}function Pt(n){n==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",n)}function Tr(){const n=location.hash.slice(1);if(!n)return{};const e=new URLSearchParams(n),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const r=e.getAll("tag");r.length&&(t.activeTags=r);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const c=e.get("deprecated");c==="0"?t.deprecatedFilter="hide":c==="1"&&(t.deprecatedFilter="only");const d=e.get("paused");d==="0"?t.pausedFilter="hide":d==="1"&&(t.pausedFilter="only");const u=e.get("date_from");u&&(t.dateFrom=u);const p=e.get("date_to");return p&&(t.dateTo=p),t}class Ar extends k{static{this.styles=w`
|
|
2511
|
+
:host { display: flex; flex-direction: column; height: 100vh; position: relative; }
|
|
2512
|
+
/* Overlays whichever header row #renderBody() renders for the current mode (.folders-bar,
|
|
2513
|
+
.toolbar-bar, or folder-view's own .mode-row) - all three share the same 10px/16px padding,
|
|
2514
|
+
so this lines up with them pixel-for-pixel without needing to sit inside any of them. */
|
|
2515
|
+
.header-toolbar { position: absolute; top: 10px; right: 16px; z-index: 1; }
|
|
2516
|
+
.filters {
|
|
2517
|
+
padding: 12px 16px;
|
|
2518
|
+
border-bottom: 1px solid var(--border);
|
|
2519
|
+
display: flex;
|
|
2520
|
+
flex-direction: column;
|
|
2521
|
+
gap: 8px;
|
|
2522
|
+
}
|
|
2523
|
+
.search-field {
|
|
2524
|
+
position: relative;
|
|
2525
|
+
flex: 1 1 240px;
|
|
2526
|
+
max-width: 480px;
|
|
2527
|
+
}
|
|
2528
|
+
.filters input[type='search'] {
|
|
2529
|
+
font-size: 13px;
|
|
2530
|
+
padding: 6px 28px 6px 10px;
|
|
2531
|
+
width: 100%;
|
|
2532
|
+
box-sizing: border-box;
|
|
2533
|
+
border: 1px solid var(--border-strong);
|
|
2534
|
+
border-radius: 6px;
|
|
2535
|
+
background: none;
|
|
2536
|
+
color: inherit;
|
|
2537
|
+
height: 30px;
|
|
2538
|
+
}
|
|
2539
|
+
.filters input[type='search']::-webkit-search-cancel-button { display: none; }
|
|
2540
|
+
.search-clear-btn {
|
|
2541
|
+
position: absolute;
|
|
2542
|
+
right: 4px;
|
|
2543
|
+
top: 50%;
|
|
2544
|
+
transform: translateY(-50%);
|
|
2545
|
+
border: none;
|
|
2546
|
+
background: transparent;
|
|
2547
|
+
cursor: pointer;
|
|
2548
|
+
color: inherit;
|
|
2549
|
+
opacity: 0.6;
|
|
2550
|
+
font-size: 12px;
|
|
2551
|
+
line-height: 1;
|
|
2552
|
+
padding: 4px 6px;
|
|
2553
|
+
border-radius: 50%;
|
|
2554
|
+
}
|
|
2555
|
+
.search-clear-btn:hover { opacity: 1; background: var(--hover); }
|
|
2556
|
+
.date-range { display: flex; align-items: center; gap: 4px; }
|
|
2557
|
+
.date-range input[type='date'] {
|
|
2558
|
+
font-size: 13px;
|
|
2559
|
+
padding: 5px 8px;
|
|
2560
|
+
border: 1px solid var(--border-strong);
|
|
2561
|
+
border-radius: 6px;
|
|
2562
|
+
background: none;
|
|
2563
|
+
color: inherit;
|
|
2564
|
+
height: 30px;
|
|
2565
|
+
box-sizing: border-box;
|
|
2566
|
+
}
|
|
2567
|
+
.date-range-sep { opacity: 0.5; font-size: 12px; }
|
|
2568
|
+
.date-range-clear {
|
|
2569
|
+
position: static;
|
|
2570
|
+
transform: none;
|
|
2571
|
+
opacity: 0.6;
|
|
2572
|
+
font-size: 12px;
|
|
2573
|
+
line-height: 1;
|
|
2574
|
+
padding: 4px 6px;
|
|
2575
|
+
border: none;
|
|
2576
|
+
background: transparent;
|
|
2577
|
+
cursor: pointer;
|
|
2578
|
+
color: inherit;
|
|
2579
|
+
border-radius: 50%;
|
|
2580
|
+
}
|
|
2581
|
+
.date-range-clear:hover { opacity: 1; background: var(--hover); }
|
|
2582
|
+
.search-row { align-items: center; }
|
|
2583
|
+
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
|
|
2584
|
+
.filter-label { font-size: 12px; opacity: 0.6; font-weight: 600; }
|
|
2585
|
+
.type-toggle { gap: 0; }
|
|
2586
|
+
.type-toggle button {
|
|
2587
|
+
border: 1px solid var(--border-strong);
|
|
2588
|
+
background: none;
|
|
2589
|
+
color: inherit;
|
|
2590
|
+
padding: 6px 12px;
|
|
2591
|
+
font-size: 13px;
|
|
2592
|
+
cursor: pointer;
|
|
2593
|
+
height: 30px;
|
|
2594
|
+
box-sizing: border-box;
|
|
2595
|
+
}
|
|
2596
|
+
.type-toggle button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
|
|
2597
|
+
.type-toggle button:first-child { border-radius: 6px 0 0 6px; }
|
|
2598
|
+
.type-toggle button:last-child { border-radius: 0 6px 6px 0; }
|
|
2599
|
+
.type-toggle button:not(:first-child) { border-left: none; }
|
|
2600
|
+
.body-region { display: flex; flex: 1 1 auto; min-height: 0; }
|
|
2601
|
+
result-list { overflow-y: auto; flex: 0 0 auto; }
|
|
2602
|
+
detail-panel { overflow-y: auto; flex: 1 1 auto; min-width: 0; }
|
|
2603
|
+
.splitter {
|
|
2604
|
+
flex: 0 0 auto;
|
|
2605
|
+
width: 6px;
|
|
2606
|
+
cursor: col-resize;
|
|
2607
|
+
background: var(--hover);
|
|
2608
|
+
position: relative;
|
|
2609
|
+
}
|
|
2610
|
+
.splitter:hover, .splitter.dragging { background: var(--accent-tint); }
|
|
2611
|
+
.splitter::after {
|
|
2612
|
+
content: '';
|
|
2613
|
+
position: absolute;
|
|
2614
|
+
top: 0; bottom: 0;
|
|
2615
|
+
left: -3px; right: -3px;
|
|
2616
|
+
}
|
|
2617
|
+
label.small { font-size: 12px; opacity: 0.7; }
|
|
2618
|
+
/* padding-right reserves room for .header-toolbar (an absolutely-positioned overlay, so it
|
|
2619
|
+
takes no space in this row's own flex layout) so wrapped folder chips don't run under it. */
|
|
2620
|
+
.folders-bar {
|
|
2621
|
+
display: flex;
|
|
2622
|
+
gap: 6px;
|
|
2623
|
+
align-items: center;
|
|
2624
|
+
flex-wrap: wrap;
|
|
2625
|
+
padding: 10px 320px 10px 16px;
|
|
2626
|
+
border-bottom: 1px solid var(--border);
|
|
2627
|
+
background: var(--bg-subtle);
|
|
2628
|
+
}
|
|
2629
|
+
.folders-bar .folder-chips {
|
|
2630
|
+
display: flex;
|
|
2631
|
+
gap: 6px;
|
|
2632
|
+
align-items: center;
|
|
2633
|
+
flex-wrap: wrap;
|
|
2634
|
+
flex: 1 1 auto;
|
|
2635
|
+
min-width: 0;
|
|
2636
|
+
}
|
|
2637
|
+
.toolbar-bar {
|
|
2638
|
+
display: flex;
|
|
2639
|
+
align-items: center;
|
|
2640
|
+
padding: 10px 16px;
|
|
2641
|
+
border-bottom: 1px solid var(--border);
|
|
2642
|
+
background: var(--bg-subtle);
|
|
2643
|
+
}
|
|
2644
|
+
.folder-chip {
|
|
2645
|
+
border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12px;
|
|
2646
|
+
cursor: pointer; background: none; color: inherit; display: inline-flex; align-items: center; gap: 6px;
|
|
2647
|
+
}
|
|
2648
|
+
/* Active chips invert to a solid white fill with dark text in both themes, so they read
|
|
2649
|
+
clearly against remote chips' accent outline instead of blending into a similar tint. */
|
|
2650
|
+
.folder-chip.active { background: #ffffff; border-color: var(--purple); color: #111111; }
|
|
2651
|
+
/* Remote (folderfoo) folders get the accent color instead of the default border, so they're
|
|
2652
|
+
visually distinct from local folders at a glance — active-state purple still wins when both apply. */
|
|
2653
|
+
.folder-chip.remote { border-color: var(--accent); color: var(--accent); }
|
|
2654
|
+
.folder-chip.remote.active { background: #ffffff; border-color: var(--purple); color: #111111; }
|
|
2655
|
+
.folder-chip .remote-dot {
|
|
2656
|
+
width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
|
|
2657
|
+
}
|
|
2658
|
+
.folder-chip.active .remote-dot { background: var(--purple); }
|
|
2659
|
+
.folder-chip .kind {
|
|
2660
|
+
opacity: 0.55; font-size: 10px;
|
|
2661
|
+
}
|
|
2662
|
+
.folder-chip .remove {
|
|
2663
|
+
opacity: 0.6; font-size: 12px; line-height: 1; padding: 2px; border-radius: 50%;
|
|
2664
|
+
}
|
|
2665
|
+
.folder-chip .remove:hover { opacity: 1; background: var(--hover-strong); }
|
|
2666
|
+
.add-folder-btn {
|
|
2667
|
+
border: 1px dashed var(--border-strong); border-radius: 999px; padding: 3px 10px; font-size: 12px;
|
|
2668
|
+
cursor: pointer; background: none; color: inherit; opacity: 0.75;
|
|
2669
|
+
}
|
|
2670
|
+
.add-folder-btn:hover { opacity: 1; }
|
|
2671
|
+
.folderfoo-open-banner {
|
|
2672
|
+
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
|
2673
|
+
padding: 8px 16px; font-size: 12px; background: var(--accent-tint); border-bottom: 1px solid var(--border);
|
|
2674
|
+
}
|
|
2675
|
+
.folderfoo-open-banner .dismiss {
|
|
2676
|
+
background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6; padding: 2px; border-radius: 50%;
|
|
2677
|
+
}
|
|
2678
|
+
.folderfoo-open-banner .dismiss:hover { opacity: 1; background: var(--hover-strong); }
|
|
2679
|
+
.first-run {
|
|
2680
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
2681
|
+
flex: 1 1 auto; gap: 16px; text-align: center; padding: 24px;
|
|
2682
|
+
}
|
|
2683
|
+
.first-run h1 { font-size: 18px; margin: 0; }
|
|
2684
|
+
.first-run p { opacity: 0.7; font-size: 13px; max-width: 420px; margin: 0; }
|
|
2685
|
+
select {
|
|
2686
|
+
font-size: 13px;
|
|
2687
|
+
padding: 6px 8px;
|
|
2688
|
+
height: 30px;
|
|
2689
|
+
box-sizing: border-box;
|
|
2690
|
+
border: 1px solid var(--border-strong);
|
|
2691
|
+
border-radius: 6px;
|
|
2692
|
+
background: none;
|
|
2693
|
+
color: inherit;
|
|
2694
|
+
}
|
|
2695
|
+
.bulk-bar {
|
|
2696
|
+
display: flex;
|
|
2697
|
+
gap: 8px;
|
|
2698
|
+
align-items: center;
|
|
2699
|
+
padding: 6px 16px;
|
|
2700
|
+
border-bottom: 1px solid var(--border);
|
|
2701
|
+
background: var(--accent-tint);
|
|
2702
|
+
font-size: 12px;
|
|
2703
|
+
}
|
|
2704
|
+
.bulk-bar button {
|
|
2705
|
+
font-size: 11px;
|
|
2706
|
+
padding: 4px 10px;
|
|
2707
|
+
border: 1px solid var(--border);
|
|
2708
|
+
background: transparent;
|
|
2709
|
+
color: inherit;
|
|
2710
|
+
border-radius: 4px;
|
|
2711
|
+
cursor: pointer;
|
|
2712
|
+
}
|
|
2713
|
+
.bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
|
|
2714
|
+
`}#e=Tr();#t=new h(this.#e.query??"");#s=new h(this.#e.typeFilter??"all");#n=new h(this.#e.activeTags??[]);#r=new h(this.#e.activeFolders??[]);#u=new h([]);#a=new h(wr);#i=new h(null);#o=new h(_r);#d=new h(!1);#g=new h("");#h=new h(!1);#c=new h(Sr());#b=new h("");#$=new h(!1);#x=new h(this.#e.sort??"");#v=new h(this.#e.deprecatedFilter??"all");#p=new h(this.#e.pausedFilter??"all");#y=new h(this.#e.dateFrom??"");#w=new h(this.#e.dateTo??"");#l=new h(new Set);#k=new h(Cr());#_=new h(!1);#m=new h("entries");#T=new h([]);#A=new h([]);#S=new h(null);#R=new h(null);#E=new h(!1);#I=new h([]);#z=new h(!1);#P=new h(null);#C=new h(!1);#O=new h(!1);#F=0;#M=e=>this.#K(e);#j=()=>this.#Y();#q=e=>this.#H(e);constructor(){super(),new N(this),Pt(this.#k.value)}#G(e){this.#k.set(e),localStorage.setItem(rs,e),Pt(e)}#B(){const e=xe[(xe.indexOf(this.#k.value)+1)%xe.length];this.#G(e)}async#Z(){if(!this.#_.value){this.#_.set(!0);try{if(!(await fetch("/api/rebuild-cache",{method:"POST"})).ok)throw new Error("rebuild-cache request failed");await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Reindex complete")}catch{y.danger("Reindex failed")}finally{this.#_.set(!1)}}}#H(e){if((e.metaKey||e.ctrlKey)&&e.key==="Enter"&&!this.#C.value){e.preventDefault(),this.#O.set(!0),this.#C.set(!0);return}if(e.key!=="Shift"){this.#F=0;return}const t=Date.now();t-this.#F<450?(this.#F=0,this.#C.set(!this.#C.value)):this.#F=t}#J(e){e.preventDefault(),this.#$.set(!0),document.addEventListener("pointermove",this.#M),document.addEventListener("pointerup",this.#j)}#K(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#c.set(Math.min(is,Math.max(ss,i)))}#Y(){this.#$.set(!1),document.removeEventListener("pointermove",this.#M),document.removeEventListener("pointerup",this.#j),localStorage.setItem(ts,String(this.#c.value))}#Q=new it(()=>{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.#x.value&&e.set("sort",this.#x.value),this.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#w.value&&e.set("date_to",this.#w.value),e.toString()});#X=new it(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#v.value==="hide"?e.set("deprecated","0"):this.#v.value==="only"&&e.set("deprecated","1"),this.#p.value==="hide"?e.set("paused","0"):this.#p.value==="only"&&e.set("paused","1"),this.#y.value&&e.set("date_from",this.#y.value),this.#w.value&&e.set("date_to",this.#w.value),e.toString()});#N=()=>this.#de();#ie=e=>this.#ke(e);#re=e=>this.#$e(e);#ne=()=>this.#ce();#oe;connectedCallback(){super.connectedCallback(),this.#f(),this.#L(),this.#D().then(()=>this.#de()),window.addEventListener("focus",this.#N),document.addEventListener("visibilitychange",this.#N),window.addEventListener("keydown",this.#q),document.addEventListener("folderfoo-file-open",this.#ie),document.addEventListener("folderfoo-folder-changed",this.#re),window.addEventListener("folderfoo-auth-change",this.#ne),this.#ce(),yr(),kr(e=>this.#Ce(e)),this.#W(),this.#oe=oe.subscribe(()=>{this.#D(),this.#f(),this.#L(),this.#m.value==="shared"&&oe.value.username===null&&this.#U("entries")})}async#ke(e){const t=e.detail?.name;if(!t)return;const s=xr(t);if(s.owner){this.#b.set(`"${s.name}" is from a shared folder — opening shared files here isn't supported yet.`);return}const{folderfooMode:i,folderfooHost:r}=await H();if(!(i==="off"||!r))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,tenantId:F,folderPath:s.folderPath,name:s.name})}),a=await o.json();if(!o.ok){this.#b.set(a.error??`couldn't open "${s.name}"`);return}this.#b.set(""),this.#i.set({table:a.table,id:a.id})}catch(o){this.#b.set(o.message)}}async#$e(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:r}=await H();if(!r)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:r,oldPath:t,newPath:i})})}catch{}}this.#D()}}#ae(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#le(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",F),t.style.zoom="0.875",e.appendChild(t)}async#we(){const e=this.#ae();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(Rt){this.#le(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await H();t==="off"||!s||ae(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{Rt=!0,await this.updateComplete;const i=this.#ae();i&&!i.querySelector("folderfoo-profile-circle")&&this.#le(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#N),document.removeEventListener("visibilitychange",this.#N),window.removeEventListener("keydown",this.#q),document.removeEventListener("folderfoo-file-open",this.#ie),document.removeEventListener("folderfoo-folder-changed",this.#re),window.removeEventListener("folderfoo-auth-change",this.#ne),this.#oe?.()}async#ce(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{return}if(!e){fetch("/api/folderfoo/logout",{method:"POST"}).catch(()=>{});return}const{folderfooMode:t,folderfooHost:s}=await H();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#ee=!1;async#de(){if(document.visibilityState==="visible"){if(this.#te().some(e=>e.remote)&&!this.#ee){this.#ee=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#ee=!1}}this.#f(),this.#L(),this.#D(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#f(){const e=this.#Q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#u.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#m.value==="folder-view"&&this.#he()}async#he(){const e=await fetch(`/api/entries?${this.#X.value}`);this.#T.set(await e.json())}async#L(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#a.set(await t.json())}async#D(){const t=await(await fetch("/api/folders")).json();this.#o.set(t),this.#h.set(!0);const s=new Set([...t.skill,...t.memory].map(o=>o.name)),i=this.#r.value.filter(o=>s.has(o));i.length!==this.#r.value.length&&(this.#r.set(i),this.#f());const r=this.#i.value;if(r){const o=this.#ve().get(r.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#U(e){this.#m.set(e),e==="channels"?this.#ue():e==="folder-view"?this.#he():e==="shared"&&(this.#W(),this.#pe())}async#W(){const e=await fetch("/api/shared-items");this.#I.set(e.ok?await e.json():[])}async#pe(){this.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#P.set(await e.json()),await this.#W()}finally{this.#z.set(!1)}}async#_e(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#W()}#Se(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#U("entries"))}async#Ce(e){const t=await fetch("/api/shared-items/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const s=await t.json().catch(()=>({}));alert(s.error||"Failed to accept the shared item.");return}this.#U("shared")}async#Te(e,t){const s=await fetch(`/api/shared-items/${encodeURIComponent(e.origin_id)}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder:t})}),i=await s.json().catch(()=>({}));return s.ok?(await this.#f(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#ue(){const e=await fetch("/api/channels");this.#A.set(await e.json()),this.#S.value&&this.#fe(this.#S.value)}async#fe(e){this.#S.set(e),this.#E.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#E.set(!1)}}#Ae(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}async#Ee(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#g.set(e.name);try{if(!(await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok)throw new Error("remove folder request failed");this.#r.set(this.#r.value.filter(r=>r!==e.name)),await Promise.all([this.#D(),this.#L(),this.#f()]),y.success("Folder removed")}catch{y.danger("Failed to remove folder")}finally{this.#g.set("")}}}#ge(e){this.#d.set(!1),this.#D(),this.#L(),this.#f(),y.success("Folder connected"),e&&alert(e)}#te(){return[...this.#o.value.skill,...this.#o.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#be(e){this.#s.set(e),this.#n.set([]),this.#L(),this.#f()}#Re(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#f()}#ze(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#f()}#Pe(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#f()}#me(e){this.#y.set(e),this.#w.set(e),this.#f()}#Ie(e){this.#t.set(e.target.value),this.#f()}#V(e){this.#t.set(e),this.#f()}#Le(){this.#t.set(""),this.#f()}#Fe(e){this.#i.set({table:e._table,id:e.id})}#Oe(e){this.#x.set(e.target.value),this.#f()}#De(e){this.#v.set(e.target.value),this.#f()}#Me(e){this.#p.set(e.target.value),this.#f()}#Ne(e){this.#y.set(e.target.value),this.#f()}#Ue(e){this.#w.set(e.target.value),this.#f()}#je(){this.#y.set(""),this.#w.set(""),this.#f()}#qe(e){const t=new Set(this.#l.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#l.set(t)}#ve(){return new Map(this.#u.value.map(e=>[e.id,e]))}#se(){const e=new Map,t=this.#ve();for(const s of this.#l.value){const i=t.get(s);if(!i)continue;const r=e.get(i._table)??[];r.push(s),e.set(i._table,r)}return e}async#xe(e){const t=this.#se(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,deprecated:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#ye(e){const t=this.#se(),s=this.#l.value.size,i=await Promise.all([...t.entries()].map(([r,o])=>fetch(`/api/entries/${r}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:o,paused:e})})));this.#l.set(new Set),await this.#f(),i.every(r=>r.ok)?y.success(`${s} item${s===1?"":"s"} updated`):y.danger("Bulk update failed")}async#Be(){if(!window.confirm(`Delete ${this.#l.value.size} doc(s)? This can't be undone.`))return;const e=this.#se(),t=this.#l.value.size,s=await Promise.all([...e.entries()].map(([i,r])=>fetch(`/api/entries/${i}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:r})})));this.#l.set(new Set),await this.#f(),s.every(i=>i.ok)?y.success(`${t} item${t===1?"":"s"} deleted`):y.danger("Bulk delete failed")}#He(){const e=this.#m.value!=="channels"&&this.#m.value!=="shared"&&this.#h.value&&this.#te().length>0,t=oe.value.username!==null||this.#I.value.length>0;return l`
|
|
2715
|
+
<app-toolbar
|
|
2716
|
+
.showReindex=${e}
|
|
2717
|
+
.reindexing=${this.#_.value}
|
|
2718
|
+
.channelsActive=${this.#m.value==="channels"}
|
|
2719
|
+
.folderViewActive=${this.#m.value==="folder-view"}
|
|
2720
|
+
.showShared=${t}
|
|
2721
|
+
.sharedActive=${this.#m.value==="shared"}
|
|
2722
|
+
.theme=${this.#k.value}
|
|
2723
|
+
.onReindex=${()=>this.#Z()}
|
|
2724
|
+
.onToggleChannels=${()=>this.#U(this.#m.value==="channels"?"entries":"channels")}
|
|
2725
|
+
.onToggleFolderView=${()=>this.#U(this.#m.value==="folder-view"?"entries":"folder-view")}
|
|
2726
|
+
.onToggleShared=${()=>this.#U(this.#m.value==="shared"?"entries":"shared")}
|
|
2727
|
+
.onCycleTheme=${()=>this.#B()}
|
|
2728
|
+
></app-toolbar>
|
|
2729
|
+
`}updated(){this.#we()}render(){return l`
|
|
2730
|
+
<div class="header-toolbar">${this.#He()}</div>
|
|
2731
|
+
${this.#Ke()}
|
|
2732
|
+
${this.#C.value?l`<quick-prompts-modal
|
|
2733
|
+
.onClose=${()=>{this.#C.set(!1),this.#O.set(!1)}}
|
|
2734
|
+
.memoryFolders=${this.#o.value.memory}
|
|
2735
|
+
.openToAdd=${this.#O.value}
|
|
2736
|
+
></quick-prompts-modal>`:""}
|
|
2737
|
+
<toast-stack></toast-stack>
|
|
2738
|
+
`}#Ke(){const e=this.#a.value,t=this.#te();return this.#m.value==="shared"?l`
|
|
2739
|
+
<div class="toolbar-bar"></div>
|
|
2740
|
+
<shared-with-me-panel
|
|
2741
|
+
.items=${this.#I.value}
|
|
2742
|
+
.refreshing=${this.#z.value}
|
|
2743
|
+
.lastRefreshSummary=${this.#P.value}
|
|
2744
|
+
.memoryFolderNames=${this.#o.value.memory.map(s=>s.name)}
|
|
2745
|
+
.skillFolderNames=${this.#o.value.skill.map(s=>s.name)}
|
|
2746
|
+
.onRefresh=${()=>this.#pe()}
|
|
2747
|
+
.onDismiss=${s=>this.#_e(s)}
|
|
2748
|
+
.onOpen=${s=>this.#Se(s)}
|
|
2749
|
+
.onFork=${(s,i)=>this.#Te(s,i)}
|
|
2750
|
+
></shared-with-me-panel>
|
|
2751
|
+
`:this.#m.value==="channels"?l`
|
|
2752
|
+
<div class="toolbar-bar"></div>
|
|
2753
|
+
<channel-view
|
|
2754
|
+
.channels=${this.#A.value}
|
|
2755
|
+
.selected=${this.#S.value}
|
|
2756
|
+
.detail=${this.#R.value}
|
|
2757
|
+
.loading=${this.#E.value}
|
|
2758
|
+
.onSelect=${s=>this.#fe(s)}
|
|
2759
|
+
.onRefresh=${()=>this.#ue()}
|
|
2760
|
+
></channel-view>
|
|
2761
|
+
`:this.#m.value==="folder-view"?l`
|
|
2762
|
+
<folder-view
|
|
2763
|
+
.entries=${this.#T.value}
|
|
2764
|
+
.allFolders=${t}
|
|
2765
|
+
.facets=${e}
|
|
2766
|
+
.typeFilter=${this.#s.value}
|
|
2767
|
+
.onTypeChange=${s=>this.#be(s)}
|
|
2768
|
+
.onChanged=${()=>{this.#f(),this.#L()}}
|
|
2769
|
+
.onDateClick=${s=>this.#me(s)}
|
|
2770
|
+
.onKeyClick=${s=>this.#V(s)}
|
|
2771
|
+
></folder-view>
|
|
2772
|
+
`:this.#h.value&&t.length===0&&!this.#d.value?l`
|
|
2773
|
+
<div class="toolbar-bar"></div>
|
|
2774
|
+
<div class="first-run">
|
|
2775
|
+
<h1>No folders configured yet</h1>
|
|
2776
|
+
<p>
|
|
2777
|
+
Add a folder of skills or memory docs to get started. You can add more folders later —
|
|
2778
|
+
e.g. a personal skills repo plus a shared company repo.
|
|
2779
|
+
</p>
|
|
2780
|
+
<button class="add-folder-btn" @click=${()=>this.#d.set(!0)}>+ Add your first folder</button>
|
|
2781
|
+
</div>
|
|
2782
|
+
${this.#d.value?l`<add-folder-modal
|
|
2783
|
+
.defaultKind=${"skill"}
|
|
2784
|
+
.lockKind=${!1}
|
|
2785
|
+
.onAdded=${s=>this.#ge(s)}
|
|
2786
|
+
.onCancel=${()=>this.#d.set(!1)}
|
|
2787
|
+
></add-folder-modal>`:""}
|
|
2788
|
+
`:l`
|
|
2789
|
+
<div class="folders-bar">
|
|
2790
|
+
<span class="filter-label">Folders:</span>
|
|
2791
|
+
<div class="folder-chips">
|
|
2792
|
+
${t.map(s=>l`
|
|
2793
|
+
<button
|
|
2794
|
+
class="folder-chip ${s.remote?"remote":""} ${this.#r.value.includes(s.name)?"active":""}"
|
|
2795
|
+
title=${s.remote?`${s.path} (remote — folderfoo)`:s.path}
|
|
2796
|
+
@click=${()=>this.#Ae(s.name)}
|
|
2797
|
+
>
|
|
2798
|
+
${s.remote?l`<span class="remote-dot"></span>`:"📁"} ${s.name}
|
|
2799
|
+
<span class="kind">(${s.kind==="skill"?"s":"m"})</span>
|
|
2800
|
+
<span
|
|
2801
|
+
class="remove"
|
|
2802
|
+
title="Remove folder"
|
|
2803
|
+
@click=${i=>this.#Ee(s,i)}
|
|
2804
|
+
>${this.#g.value===s.name?"…":"✕"}</span
|
|
2805
|
+
>
|
|
2806
|
+
</button>
|
|
2807
|
+
`)}
|
|
2808
|
+
<button class="add-folder-btn" @click=${()=>this.#d.set(!0)}>+ Add folder</button>
|
|
2809
|
+
</div>
|
|
2810
|
+
</div>
|
|
2811
|
+
${this.#b.value?l`
|
|
2812
|
+
<div class="folderfoo-open-banner">
|
|
2813
|
+
${this.#b.value}
|
|
2814
|
+
<button class="dismiss" @click=${()=>this.#b.set("")}>✕</button>
|
|
2815
|
+
</div>
|
|
2816
|
+
`:""}
|
|
2817
|
+
<div class="filters">
|
|
2818
|
+
<div class="row search-row">
|
|
2819
|
+
<div class="search-field">
|
|
2820
|
+
<input
|
|
2821
|
+
type="search"
|
|
2822
|
+
placeholder="Search descriptions, bodies, tags..."
|
|
2823
|
+
.value=${this.#t.value}
|
|
2824
|
+
@input=${s=>this.#Ie(s)}
|
|
2825
|
+
/>
|
|
2826
|
+
${this.#t.value?l`
|
|
2827
|
+
<button
|
|
2828
|
+
class="search-clear-btn"
|
|
2829
|
+
title="Clear search"
|
|
2830
|
+
aria-label="Clear search"
|
|
2831
|
+
@click=${()=>this.#Le()}
|
|
2832
|
+
>
|
|
2833
|
+
✕
|
|
2834
|
+
</button>
|
|
2835
|
+
`:""}
|
|
2836
|
+
</div>
|
|
2837
|
+
<div class="row type-toggle">
|
|
2838
|
+
${$r.map(s=>l`
|
|
2839
|
+
<button
|
|
2840
|
+
class=${this.#s.value===s.value?"active":""}
|
|
2841
|
+
@click=${()=>this.#be(s.value)}
|
|
2842
|
+
>
|
|
2843
|
+
${s.label}
|
|
2844
|
+
</button>
|
|
2845
|
+
`)}
|
|
2846
|
+
</div>
|
|
2847
|
+
${e.tags.length===0?l`<span class="filter-label">Tags:</span> <label class="small">no tags yet</label>`:l`
|
|
2848
|
+
<tag-multiselect
|
|
2849
|
+
.tags=${e.tags}
|
|
2850
|
+
.active=${this.#n.value}
|
|
2851
|
+
.onToggle=${s=>this.#Re(s)}
|
|
2852
|
+
.width=${"260px"}
|
|
2853
|
+
></tag-multiselect>
|
|
2854
|
+
`}
|
|
2855
|
+
<span class="filter-label">Dates:</span>
|
|
2856
|
+
<div class="date-range">
|
|
2857
|
+
<input
|
|
2858
|
+
type="date"
|
|
2859
|
+
aria-label="From date"
|
|
2860
|
+
.value=${this.#y.value}
|
|
2861
|
+
@change=${s=>this.#Ne(s)}
|
|
2862
|
+
/>
|
|
2863
|
+
<span class="date-range-sep">–</span>
|
|
2864
|
+
<input
|
|
2865
|
+
type="date"
|
|
2866
|
+
aria-label="To date"
|
|
2867
|
+
.value=${this.#w.value}
|
|
2868
|
+
@change=${s=>this.#Ue(s)}
|
|
2869
|
+
/>
|
|
2870
|
+
${this.#y.value||this.#w.value?l`
|
|
2871
|
+
<button
|
|
2872
|
+
class="date-range-clear"
|
|
2873
|
+
title="Clear date range"
|
|
2874
|
+
aria-label="Clear date range"
|
|
2875
|
+
@click=${()=>this.#je()}
|
|
2876
|
+
>
|
|
2877
|
+
✕
|
|
2878
|
+
</button>
|
|
2879
|
+
`:""}
|
|
2880
|
+
</div>
|
|
2881
|
+
<span class="filter-label">Sort:</span>
|
|
2882
|
+
<select
|
|
2883
|
+
.value=${this.#x.value||(this.#t.value.trim()?"relevance":"mtime_desc")}
|
|
2884
|
+
@change=${s=>this.#Oe(s)}
|
|
2885
|
+
>
|
|
2886
|
+
${this.#t.value.trim()?l`<option value="relevance">Relevance</option>`:""}
|
|
2887
|
+
<option value="mtime_desc">Recently touched</option>
|
|
2888
|
+
<option value="mtime_asc">Least recently touched</option>
|
|
2889
|
+
<option value="created_at_asc">Oldest first</option>
|
|
2890
|
+
<option value="name_asc">Name</option>
|
|
2891
|
+
</select>
|
|
2892
|
+
<span class="filter-label">Deprecated:</span>
|
|
2893
|
+
<select .value=${this.#v.value} @change=${s=>this.#De(s)}>
|
|
2894
|
+
${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
|
|
2895
|
+
</select>
|
|
2896
|
+
<span class="filter-label">Paused:</span>
|
|
2897
|
+
<select .value=${this.#p.value} @change=${s=>this.#Me(s)}>
|
|
2898
|
+
${zt.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
|
|
2899
|
+
</select>
|
|
2900
|
+
</div>
|
|
2901
|
+
</div>
|
|
2902
|
+
${this.#l.value.size>0?l`
|
|
2903
|
+
<div class="bulk-bar">
|
|
2904
|
+
<span>${this.#l.value.size} selected</span>
|
|
2905
|
+
<button @click=${()=>this.#xe(!0)}>Mark deprecated</button>
|
|
2906
|
+
<button @click=${()=>this.#xe(!1)}>Un-deprecate</button>
|
|
2907
|
+
<button @click=${()=>this.#ye(!0)}>Pause</button>
|
|
2908
|
+
<button @click=${()=>this.#ye(!1)}>Resume</button>
|
|
2909
|
+
<button class="danger" @click=${()=>this.#Be()}>Delete</button>
|
|
2910
|
+
<button @click=${()=>this.#l.set(new Set)}>Clear</button>
|
|
2911
|
+
</div>
|
|
2912
|
+
`:""}
|
|
2913
|
+
<div class="body-region">
|
|
2914
|
+
<result-list
|
|
2915
|
+
style=${`width: ${this.#c.value}%; border-right: 1px solid var(--border);`}
|
|
2916
|
+
.results=${this.#u.value}
|
|
2917
|
+
.showFolder=${t.length>1}
|
|
2918
|
+
.onSelect=${s=>this.#Fe(s)}
|
|
2919
|
+
.selectedIds=${this.#l.value}
|
|
2920
|
+
.onToggleSelect=${s=>this.#qe(s)}
|
|
2921
|
+
.onKeyClick=${s=>this.#V(s)}
|
|
2922
|
+
.onGroupClick=${s=>this.#V(s)}
|
|
2923
|
+
></result-list>
|
|
2924
|
+
<div
|
|
2925
|
+
class="splitter ${this.#$.value?"dragging":""}"
|
|
2926
|
+
@pointerdown=${s=>this.#J(s)}
|
|
2927
|
+
></div>
|
|
2928
|
+
<detail-panel
|
|
2929
|
+
.selected=${this.#i.value}
|
|
2930
|
+
.facets=${e}
|
|
2931
|
+
.onChanged=${()=>{this.#f(),this.#L()}}
|
|
2932
|
+
.onTagClick=${s=>this.#ze(s)}
|
|
2933
|
+
.onFolderClick=${s=>this.#Pe(s)}
|
|
2934
|
+
.onDateClick=${s=>this.#me(s)}
|
|
2935
|
+
.onKeyClick=${s=>this.#V(s)}
|
|
2936
|
+
.onGroupClick=${s=>this.#V(s)}
|
|
2937
|
+
.onGone=${()=>this.#i.set(null)}
|
|
2938
|
+
></detail-panel>
|
|
2939
|
+
</div>
|
|
2940
|
+
${this.#d.value?l`<add-folder-modal
|
|
2941
|
+
.defaultKind=${"skill"}
|
|
2942
|
+
.lockKind=${!1}
|
|
2943
|
+
.onAdded=${s=>this.#ge(s)}
|
|
2944
|
+
.onCancel=${()=>this.#d.set(!1)}
|
|
2945
|
+
></add-folder-modal>`:""}
|
|
2946
|
+
`}}customElements.define("mem-bucket-app",Ar);
|