mcp-memory-bucket 0.10.15 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-BuS9zM5d.js → index-DNC2lMlx.js} +83 -55
- package/dist/client/index.html +1 -1
- package/dist/src/skills/builtin/memory-bucket-authoring/SKILL.md +91 -43
- package/dist/src/skills/repository.js +31 -3
- package/dist/src/skills/tools.js +26 -8
- package/dist/src/store/db.js +5 -3
- package/dist/src/store/sync.js +16 -4
- package/dist/src/web/routes.js +20 -5
- package/package.json +1 -1
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:rs,defineProperty:ns,getOwnPropertyDescriptor:os,getOwnPropertyNames:as,getOwnPropertySymbols:ls,getPrototypeOf:cs}=Object,ce=globalThis,Be=ce.trustedTypes,ds=Be?Be.emptyScript:"",hs=ce.reactiveElementPolyfillSupport,
|
|
9
|
+
*/const{is:rs,defineProperty:ns,getOwnPropertyDescriptor:os,getOwnPropertyNames:as,getOwnPropertySymbols:ls,getPrototypeOf:cs}=Object,ce=globalThis,Be=ce.trustedTypes,ds=Be?Be.emptyScript:"",hs=ce.reactiveElementPolyfillSupport,Z=(r,e)=>r,me={toAttribute(r,e){switch(e){case Boolean:r=r?ds:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},At=(r,e)=>!rs(r,e),He={attribute:!0,type:String,converter:me,reflect:!1,useDefault:!1,hasChanged:At};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;let U=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=He){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&&ns(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=os(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);n?.call(this,o),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??He}static _$Ei(){if(this.hasOwnProperty(Z("elementProperties")))return;const e=cs(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Z("properties"))){const t=this.properties,s=[...as(t),...ls(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(qe(i))}else e!==void 0&&t.push(qe(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return is(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const n=(s.converter?.toAttribute!==void 0?s.converter:me).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const n=s.getPropertyOptions(i),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:me;this._$Em=i;const a=o.fromAttribute(t,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){const o=this.constructor;if(i===!1&&(n=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??At)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,n]of s){const{wrapped:o}=n,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};U.elementStyles=[],U.shadowRootOptions={mode:"open"},U[Z("elementProperties")]=new Map,U[Z("finalized")]=new Map,hs?.({ReactiveElement:U}),(ce.reactiveElementVersions??=[]).push("2.1.2");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
13
|
*/const Se=globalThis,Ke=r=>r,ne=Se.trustedTypes,Ve=ne?ne.createPolicy("lit-html",{createHTML:r=>r}):void 0,Et="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,Rt="?"+R,ps=`<${Rt}>`,F=document,J=()=>F.createComment(""),Q=r=>r===null||typeof r!="object"&&typeof r!="function",Ce=Array.isArray,us=r=>Ce(r)||typeof r?.[Symbol.iterator]=="function",ue=`[
|
|
14
|
-
\f\r]`,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
14
|
+
\f\r]`,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ge=/-->/g,We=/>/g,P=RegExp(`>|${ue}(?:([^\\s"'>=/]+)(${ue}*=${ue}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ze=/'/g,Je=/"/g,Pt=/^(?:script|style|textarea|title)$/i,fs=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),l=fs(1),O=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),Qe=new WeakMap,I=F.createTreeWalker(F,129);function zt(r,e){if(!Ce(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ve!==void 0?Ve.createHTML(e):e}const gs=(r,e)=>{const t=r.length-1,s=[];let i,n=e===2?"<svg>":e===3?"<math>":"",o=V;for(let a=0;a<t;a++){const c=r[a];let d,u,h=-1,f=0;for(;f<c.length&&(o.lastIndex=f,u=o.exec(c),u!==null);)f=o.lastIndex,o===V?u[1]==="!--"?o=Ge:u[1]!==void 0?o=We:u[2]!==void 0?(Pt.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=P):u[3]!==void 0&&(o=P):o===P?u[0]===">"?(o=i??V,h=-1):u[1]===void 0?h=-2:(h=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?P:u[3]==='"'?Je:Ze):o===Je||o===Ze?o=P:o===Ge||o===We?o=V:(o=P,i=void 0);const x=o===P&&r[a+1].startsWith("/>")?" ":"";n+=o===V?c+ps:h>=0?(s.push(d),c.slice(0,h)+Et+c.slice(h)+R+x):c+R+(h===-2?a:x)}return[zt(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};let ve=class It{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const a=e.length-1,c=this.parts,[d,u]=gs(e,t);if(this.el=It.createElement(d,s),I.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=I.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(Et)){const f=u[o++],x=i.getAttribute(h).split(R),m=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:m[2],strings:x,ctor:m[1]==="."?ms:m[1]==="?"?vs:m[1]==="@"?xs:de}),i.removeAttribute(h)}else h.startsWith(R)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Pt.test(i.tagName)){const h=i.textContent.split(R),f=h.length-1;if(f>0){i.textContent=ne?ne.emptyScript:"";for(let x=0;x<f;x++)i.append(h[x],J()),I.nextNode(),c.push({type:2,index:++n});i.append(h[f],J())}}}else if(i.nodeType===8)if(i.data===Rt)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(R,h+1))!==-1;)c.push({type:7,index:n}),h+=R.length-1}n++}}static createElement(e,t){const s=F.createElement("template");return s.innerHTML=e,s}};function q(r,e,t=r,s){if(e===O)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const n=Q(e)?void 0:e._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,t,s)),s!==void 0?(t._$Co??=[])[s]=i:t._$Cl=i),i!==void 0&&(e=q(r,i._$AS(r,e.values),i,s)),e}let bs=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??F).importNode(t,!0);I.currentNode=i;let n=I.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let d;c.type===2?d=new Te(n,n.nextSibling,this,e):c.type===1?d=new c.ctor(n,c.name,c.strings,this,e):c.type===6&&(d=new ys(n,this,e)),this._$AV.push(d),c=s[++a]}o!==c?.index&&(n=I.nextNode(),o++)}return I.currentNode=F,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++}},Te=class Lt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),Q(e)?e===b||e==null||e===""?(this._$AH!==b&&this._$AR(),this._$AH=b):e!==this._$AH&&e!==O&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):us(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!==b&&Q(this._$AH)?this._$AA.nextSibling.data=e:this.T(F.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=ve.createElement(zt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const n=new bs(i,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=Qe.get(e.strings);return t===void 0&&Qe.set(e.strings,t=new ve(e)),t}k(e){Ce(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new Lt(this.O(J()),this.O(J()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=Ke(e).nextSibling;Ke(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},de=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=b,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(n===void 0)e=q(this,e,t,0),o=!Q(e)||e!==this._$AH&&e!==O,o&&(this._$AH=e);else{const a=e;let c,d;for(e=n[0],c=0;c<n.length-1;c++)d=q(this,a[s+c],t,c),d===O&&(d=this._$AH[c]),o||=!Q(d)||d!==this._$AH[c],d===b?e=b:e!==b&&(e+=(d??"")+n[c+1]),this._$AH[c]=d}o&&!i&&this.j(e)}j(e){e===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ms=class extends de{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===b?void 0:e}},vs=class extends de{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==b)}},xs=class extends de{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??b)===O)return;const s=this._$AH,i=e===b&&s!==b||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==b&&(s===b||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ys=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}};const ks=Se.litHtmlPolyfillSupport;ks?.(ve,Te),(Se.litHtmlVersions??=[]).push("3.3.3");const $s=(r,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const n=t?.renderBefore??null;s._$litPart$=i=new Te(e.insertBefore(J(),n),n,void 0,t??{})}return i._$AI(r),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
19
|
*/const Ae=globalThis;let k=class extends U{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=$s(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};k._$litElement$=!0,k.finalized=!0,Ae.litElementHydrateSupport?.({LitElement:k});const ws=Ae.litElementPolyfillSupport;ws?.({LitElement:k});(Ae.litElementVersions??=[]).push("4.2.2");var Ft;let fe=0;const Ye=new Set;function _s(r){fe++;try{r()}finally{fe--,fe===0&&Ss()}}function Ss(){const r=new Set(Ye);Ye.clear();for(const e of r)e()}function Cs(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function Ts(r){return r&&typeof r.deref=="function"}class Ee{static#e=0;#t;#s;#n=new Set;#r=Ft.#e++;name;constructor(e,t){this.#t=e,this.#s=e,this.name=t}_get(){return p.activeConsumer&&p.activeConsumer.track(this),this.#t}_set(e){return Cs(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(Ts(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}`}}Ft=Ee;class p extends Ee{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){_s(()=>{this._set(e)})}get value(){return this.get()}set value(e){this.set(e)}update(e){this.set(e(this.get()))}}class Xe extends Ee{#e;#t=!0;#s=!1;#n=new Map;_debugParent;#r;#p=()=>{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.#p,this.#r);this.#n.set(e,t)}dispose(){this.#l()}#l(){for(const e of this.#n.values())e();this.#n.clear()}get(){if(p.activeConsumer&&p.activeConsumer.track(this),!this.#t)return this._get();if(this.#s)throw new Error(`Cycle detected in ${this}
|
|
20
|
-
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#l(),p.push(this);try{const e=this.#e();this._set(e)}finally{p.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 p.activeConsumer||this.get(),s}}class Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){p.push(i);try{s.call(this,n)}finally{p.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 As=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Es(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":As.format(e)}function Rs(r){const e=[],t=new Map,s=[];for(const n of r){
|
|
20
|
+
↳ while computing ${this._debugParent??"root"}`);this.#s=!0,this.#l(),p.push(this);try{const e=this.#e();this._set(e)}finally{p.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 p.activeConsumer||this.get(),s}}class Y{#e;#t=new Map;_debugParent;constructor(e){this.#e=e,e.addController(this);const t=e,s=t.update,i=this;t.update=function(n){p.push(i);try{s.call(this,n)}finally{p.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 As=new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"});function Es(r){if(!r)return"unknown age";const e=new Date(r);return Number.isNaN(e.getTime())?"unknown age":As.format(e)}function Rs(r){const e=[],t=new Map,s=[];for(const n of r){const o=n._table==="memory_docs"?n.key:n.group;if(!o){s.push(n);continue}t.has(o)||(t.set(o,[]),e.push(o)),t.get(o).push(n)}const i=e.map(n=>({label:n,icon:t.get(n)[0]._table==="memory_docs"?"🔑":"📂",items:t.get(n)}));return s.length>0&&i.push({label:null,icon:s[0]._table==="memory_docs"?"🔑":"📂",items:s}),i}class Ps 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=S`
|
|
21
21
|
:host { display: block; }
|
|
22
22
|
.count-header {
|
|
23
23
|
padding: 8px 14px;
|
|
@@ -82,17 +82,19 @@
|
|
|
82
82
|
`}render(){return!this.results||this.results.length===0?l`<div class="empty">No results.</div>`:l`
|
|
83
83
|
<div class="count-header">${this.results.length} result${this.results.length===1?"":"s"}</div>
|
|
84
84
|
${Rs(this.results).map(e=>l`
|
|
85
|
-
${e.
|
|
86
|
-
|
|
85
|
+
${e.label?l`<div class="key-group-header">
|
|
86
|
+
${e.icon}
|
|
87
87
|
<button
|
|
88
88
|
class="key-group-link"
|
|
89
|
-
title
|
|
90
|
-
@click=${()=>this.onKeyClick?.(e.
|
|
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
91
|
>
|
|
92
|
-
${e.
|
|
92
|
+
${e.label}
|
|
93
93
|
</button>
|
|
94
94
|
<span class="key-group-count">(${e.items.length})</span>
|
|
95
|
-
</div>`:""
|
|
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>`:""}
|
|
96
98
|
${e.items.map(t=>this.#e(t))}
|
|
97
99
|
`)}
|
|
98
100
|
`}#e(e){const t=e._table==="skills"&&e.folder==="builtin";return l`
|
|
@@ -116,6 +118,16 @@
|
|
|
116
118
|
<span class="meta">${Es(e.created_at)} · ${e.owner??"—"} · ${e.status}</span>
|
|
117
119
|
</div>
|
|
118
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>`:""}
|
|
119
131
|
${this.showFolder&&e.folder?l`<div class="folder-path">📁 ${e.folder}</div>`:""}
|
|
120
132
|
<div class="desc">${e.description}</div>
|
|
121
133
|
<div class="tags">
|
|
@@ -126,7 +138,7 @@
|
|
|
126
138
|
</div>
|
|
127
139
|
</div>
|
|
128
140
|
`}}customElements.define("result-list",Ps);function Re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var N=Re();function Ot(r){N=r}var z={exec:()=>null};function M(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),i=e[s];return i||(i=r(s),e[s]=i),i}}function g(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(i,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(y.caret,"$1"),t=t.replace(i,o),s},getRegex:()=>new RegExp(t,e)};return s}var zs=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:M(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:M(r=>new RegExp(`^ {0,${r}}>`))},Is=/^(?:[ \t]*(?:\n|$))+/,Ls=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fs=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Os=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Pe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Dt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Nt=g(Dt).replace(/bull/g,Pe).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(),Ds=g(Dt).replace(/bull/g,Pe).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(),ze=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ns=/^[^\n]+/,Ie=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ms=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ie).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Us=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Pe).getRegex(),he="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",Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,js=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Le).replace("tag",he).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mt=r=>g(ze).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",he).getRegex(),qs=Mt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Bs=Mt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Hs=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bs).getRegex(),Fe={blockquote:Hs,code:Ls,def:Ms,fences:Fs,heading:Os,hr:X,html:js,lheading:Nt,list:Us,newline:Is,paragraph:qs,table:z,text:Ns},et=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",X).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",he).getRegex(),Ks={...Fe,lheading:Ds,table:et,paragraph:g(ze).replace("hr",X).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",et).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",he).getRegex()},Vs={...Fe,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Le).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(ze).replace("hr",X).replace("heading",` *#{1,6} *[^
|
|
129
|
-
]`).replace("lheading",Nt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},
|
|
141
|
+
]`).replace("lheading",Nt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Gs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ws=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ut=/^( {2,}|\\)\n(?!\s*$)/,Zs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,ee=/[^\s\p{P}\p{S}]/u,Js=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,B).getRegex(),Qs=/[\p{Pi}\p{Ps}"']/u,jt=/(?!~)[\p{P}\p{S}]/u,Ys=/(?!~)[\s\p{P}\p{S}]/u,Xs=/(?:[^\s\p{P}\p{S}]|~)/u,ei=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",zs?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),qt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ti=g(qt,"u").replace(/punct/g,A).getRegex(),si=g(qt,"u").replace(/punct/g,jt).getRegex(),ii=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,ri=g(ii,"u").replace(/openQuote/g,Qs).replace(/punct/g,A).getRegex(),Bt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ni=g(Bt,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),oi=g(Bt,"gu").replace(/notPunctSpace/g,Xs).replace(/punctSpace/g,Ys).replace(/punct/g,jt).getRegex(),ai="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",li=g(ai,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),ci=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),di="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",hi=g(di,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),pi=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),ui="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",fi=g(ui,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,B).replace(/punct/g,A).getRegex(),gi=g(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),bi=g(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),mi=g(Le).replace("(?:-->|$)","-->").getRegex(),vi=g("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",mi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),oe=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,xi=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",oe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ht=g(/^!?\[(label)\]\[(ref)\]/).replace("label",oe).replace("ref",Ie).getRegex(),Kt=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ie).getRegex(),yi=g("reflink|nolink(?!\\()","g").replace("reflink",Ht).replace("nolink",Kt).getRegex(),tt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Oe={_backpedal:z,anyPunctuation:gi,autolink:bi,blockSkip:ei,br:Ut,code:Ws,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:ti,emStrongRDelimAst:ni,emStrongRDelimUnd:ci,escape:Gs,link:xi,nolink:Kt,punctuation:Js,reflink:Ht,reflinkSearch:yi,tag:vi,text:Zs,url:z},ki={...Oe,emStrongLDelim:ri,emStrongRDelimAst:li,emStrongRDelimUnd:hi,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",oe).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe).getRegex()},xe={...Oe,emStrongRDelimAst:oi,emStrongLDelim:si,delLDelim:pi,delRDelim:fi,url:g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",tt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",tt).getRegex()},$i={...xe,br:g(Ut).replace("{2,}","*").getRegex(),text:g(xe.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},te={normal:Fe,gfm:Ks,pedantic:Vs},G={normal:Oe,gfm:xe,breaks:$i,pedantic:ki},wi={"&":"&","<":"<",">":">",'"':""","'":"'"},st=r=>wi[r];function T(r,e){if(e){if(y.escapeTest.test(r))return r.replace(y.escapeReplace,st)}else if(y.escapeTestNoEncode.test(r))return r.replace(y.escapeReplaceNoEncode,st);return r}function it(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function rt(r,e){let t=r.replace(y.findPipe,(n,o,a)=>{let c=!1,d=o;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),s=t.split(y.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(y.slashPipe,"|");return s}function E(r,e,t){let s=r.length;if(s===0)return"";let i=0;for(;i<s&&r.charAt(s-i-1)===e;)i++;return r.slice(0,s-i)}function nt(r){let e=r.split(`
|
|
130
142
|
`),t=e.length-1;for(;t>=0&&y.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
|
|
131
143
|
`)}function _i(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Si(r,e=0){let t=e,s="";for(let i of r)if(i===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=i,t++;return s}function ot(r,e,t,s,i){let n=e.href,o=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1"),c=r[0].charAt(0)==="!";s.state.inLink=!0;let d=s.state.linkEmitted,u=s.state.inRawBlock;s.state.linkEmitted=!1;let h=s.inlineTokens(a),f=s.state.linkEmitted;if(s.state.linkEmitted=d,s.state.inLink=!1,!c){if(f){s.state.inRawBlock=u;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:n,title:o,text:a,tokens:h}}function Ci(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let i=s[1];return e.split(`
|
|
132
144
|
`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=i.length?n.slice(i.length):n}).join(`
|
|
@@ -156,7 +168,7 @@ ${m}`,i=i.substring(0,i.length-x.text.length)+H.text;break}else if(f?.type==="li
|
|
|
156
168
|
`):[],n={type:"table",raw:E(e[0],`
|
|
157
169
|
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(let o of i)n.rows.push(rt(o,n.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:n.align[c]})));return n}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:E(e[0],`
|
|
158
170
|
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
159
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=E(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=_i(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),ot(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return ot(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=0,d=s[0][0],u=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*r.length+i);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(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 f=[...s[0]][0].length,x=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let C=x.slice(1,-1);return{type:"em",raw:x,text:C,tokens:this.lexer.inlineTokens(C)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(s=c.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,u=r.slice(0,i+s.index+d+o),h=u.slice(i,-i);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ye{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||N,this.options.tokenizer=this.options.tokenizer||new ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:te.normal,inline:
|
|
171
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let n=E(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{let n=_i(e[2],"()");if(n===-2)return;if(n>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(s);n&&(s=n[1],i=n[3])}else i=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),ot(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[s.toLowerCase()];if(!i){let n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return ot(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=0,d=s[0][0],u=t===d,h=d==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*r.length+i);(s=h.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(o=[...n].length,s[3]||s[4]){a+=o;continue}else if(s[5]||s[6]){if(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 f=[...s[0]][0].length,x=r.slice(0,i+s.index+f+o);if(Math.min(i,o)%2){let C=x.slice(1,-1);return{type:"em",raw:x,text:C,tokens:this.lexer.inlineTokens(C)}}let m=x.slice(2,-2);return{type:"strong",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...s[0]].length-1,n,o,a=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*r.length+i);(s=c.exec(e))!==null;){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n||(o=[...n].length,o!==i))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let d=[...s[0]][0].length,u=r.slice(0,i+s.index+d+o),h=u.slice(i,-i);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},w=class ye{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||N,this.options.tokenizer=this.options.tokenizer||new ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:y,block:te.normal,inline:G.normal};this.options.pedantic?(t.block=te.pedantic,t.inline=G.pedantic):this.options.gfm&&(t.block=te.gfm,this.options.breaks?t.inline=G.breaks:t.inline=G.gfm),this.tokenizer.rules=t}static get rules(){return{block:te,inline:G}}static lex(e,t){return new ye(t).lex(e)}static lexInline(e,t){return new ye(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
|
|
160
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(y.tabCharGlobal," ").replace(y.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let n;if(this.options.extensions?.block?.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let a=t.at(-1);n.raw.length===1&&a!==void 0?a.raw+=`
|
|
161
173
|
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
162
174
|
`)?"":`
|
|
@@ -188,8 +200,8 @@ ${this.parser.parse(r)}</blockquote>
|
|
|
188
200
|
`}tablerow({text:r}){return`<tr>
|
|
189
201
|
${r}</tr>
|
|
190
202
|
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
191
|
-
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${T(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=it(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+T(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=it(r);if(i===null)return T(t);r=i;let n=`<img src="${r}" alt="${T(t)}"`;return e&&(n+=` title="${T(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:T(r.text)}},De=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ke{options;renderer;textRenderer;constructor(e){this.options=e||N,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new De}static parse(e,t){return new ke(t).parse(e)}static parseInline(e,t){return new ke(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},
|
|
192
|
-
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+T(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new Ti;function v(r,e){return D.parse(r,e)}v.options=v.setOptions=function(r){return D.setOptions(r),v.defaults=D.defaults,Ot(v.defaults),v};v.getDefaults=Re;v.defaults=N;function Ai(...r){return D.use(...r),v.defaults=D.defaults,Ot(v.defaults),v}v.use=Ai;v.walkTokens=function(r,e){return D.walkTokens(r,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=le;v.TextRenderer=De;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ae;v.Hooks=
|
|
203
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${T(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),i=it(r);if(i===null)return s;r=i;let n='<a href="'+r+'"';return e&&(n+=' title="'+T(e)+'"'),n+=">"+s+"</a>",n}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let i=it(r);if(i===null)return T(t);r=i;let n=`<img src="${r}" alt="${T(t)}"`;return e&&(n+=` title="${T(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:T(r.text)}},De=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class ke{options;renderer;textRenderer;constructor(e){this.options=e||N,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new De}static parse(e,t){return new ke(t).parse(e)}static parseInline(e,t){return new ke(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){t+=a||"";continue}}let n=i;switch(n.type){case"space":{t+=this.renderer.space(n);break}case"hr":{t+=this.renderer.hr(n);break}case"heading":{t+=this.renderer.heading(n);break}case"code":{t+=this.renderer.code(n);break}case"table":{t+=this.renderer.table(n);break}case"blockquote":{t+=this.renderer.blockquote(n);break}case"list":{t+=this.renderer.list(n);break}case"checkbox":{t+=this.renderer.checkbox(n);break}case"html":{t+=this.renderer.html(n);break}case"def":{t+=this.renderer.def(n);break}case"paragraph":{t+=this.renderer.paragraph(n);break}case"text":{t+=this.renderer.text(n);break}default:{let o='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}let o=n;switch(o.type){case"escape":{s+=t.text(o);break}case"html":{s+=t.html(o);break}case"link":{s+=t.link(o);break}case"image":{s+=t.image(o);break}case"checkbox":{s+=t.checkbox(o);break}case"strong":{s+=t.strong(o);break}case"em":{s+=t.em(o);break}case"codespan":{s+=t.codespan(o);break}case"br":{s+=t.br(o);break}case"del":{s+=t.del(o);break}case"text":{s+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},W=class{options;block;constructor(r){this.options=r||N}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?w.lex:w.lexInline}provideParser(r=this.block){return r?_.parse:_.parseInline}},Ti=class{defaults=Re();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_;Renderer=le;TextRenderer=De;Lexer=w;Tokenizer=ae;Hooks=W;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let i=s;for(let n of i.header)t=t.concat(this.walkTokens(n.tokens,e));for(let n of i.rows)for(let o of n)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=s;t=t.concat(this.walkTokens(i.items,e));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(n=>{let o=i[n].flat(1/0);t=t.concat(this.walkTokens(o,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=e.renderers[i.name];n?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=n.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=e[i.level];n?n.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),s.extensions=e),t.renderer){let i=this.defaults.renderer||new le(this.defaults);for(let n in t.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let o=n,a=t.renderer[o],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 ae(this.defaults);for(let n in t.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let o=n,a=t.tokenizer[o],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 W;for(let n in t.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let o=n,a=t.hooks[o],c=i[o];W.passThroughHooks.has(n)?i[o]=d=>{if(this.defaults.async&&W.passThroughHooksRespectAsync.has(n))return(async()=>{let h=await a.call(i,d);return c.call(i,h)})();let u=a.call(i,d);return c.call(i,u)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let h=await a.apply(i,d);return h===!1&&(h=await c.apply(i,d)),h})();let 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,n=t.walkTokens;s.walkTokens=function(o){let a=[];return a.push(n.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return w.lex(r,e??this.defaults)}parser(r,e){return _.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},i={...this.defaults,...s},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(r):r?w.lex:w.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(r):r?_.parse:_.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(n);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(r):r?w.lex:w.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(r):r?_.parse:_.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return n(o)}}}onError(r,e){return t=>{if(t.message+=`
|
|
204
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+T(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},D=new Ti;function v(r,e){return D.parse(r,e)}v.options=v.setOptions=function(r){return D.setOptions(r),v.defaults=D.defaults,Ot(v.defaults),v};v.getDefaults=Re;v.defaults=N;function Ai(...r){return D.use(...r),v.defaults=D.defaults,Ot(v.defaults),v}v.use=Ai;v.walkTokens=function(r,e){return D.walkTokens(r,e)};v.parseInline=D.parseInline;v.Parser=_;v.parser=_.parse;v.Renderer=le;v.TextRenderer=De;v.Lexer=w;v.lexer=w.lex;v.Tokenizer=ae;v.Hooks=W;v.parse=v;v.options;v.setOptions;v.walkTokens;v.parseInline;_.parse;w.lex;/**
|
|
193
205
|
* @license
|
|
194
206
|
* Copyright 2017 Google LLC
|
|
195
207
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -627,7 +639,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
627
639
|
>
|
|
628
640
|
${this.text}
|
|
629
641
|
</div>
|
|
630
|
-
`}}customElements.define("help-tooltip",Ni);const ct="mem-bucket-detail-view-mode",Mi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ui(r){const e=r.lastIndexOf(".");return e===-1?!1:Mi.has(r.slice(e).toLowerCase())}function ji(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const qi=["stable","beta","unreviewed"],Bi=["active","shipped","abandoned"],dt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Hi=["ticket","freeform"],$={description:"What this doc is / does, shown in search results and list views. For skills, this is also the only thing an agent sees before deciding whether to load the full body — so state both what it does and when to use it.",tags:"Free-form keywords used to filter and search. Not the only thing matched during full-text search, but the fastest way to narrow a list view.",status:`Lifecycle state — stable/beta/unreviewed for skills, active/shipped/abandoned for memory docs. Skills default to "unreviewed" if left unset, so low-trust content doesn't read as equivalent to a reviewed pattern.`,name:"The skill's identifier — becomes its containing folder name on disk. Lowercase letters, numbers, and hyphens only.",owner:"Who authored or maintains this skill — a person or team name, free text.",extends:"Name of another skill this one builds on or specializes, if any. Leave blank if it doesn't extend anything.",trigger_phrases:"Extra keyword phrases beyond the description that should surface this skill in search — phrasings a user might type that don't literally appear in the description text.",key:"The lookup handle for this memory doc — usually a ticket ID, sometimes a free-form name. One key can have several docs attached (a plan, a spec, session notes) all retrievable together.",key_type:'"ticket" if the key is a real ticket ID, "freeform" for a name like "Spot Chart Design".',doc_type:"What kind of content this is — shapes how it should be read (a plan reads differently than raw SQL or a session summary).",related_to:"Another key this doc relates to, if any — free text, not validated against existing keys."};function ht(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ki extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ct)??"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},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=S`
|
|
642
|
+
`}}customElements.define("help-tooltip",Ni);const ct="mem-bucket-detail-view-mode",Mi=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]);function Ui(r){const e=r.lastIndexOf(".");return e===-1?!1:Mi.has(r.slice(e).toLowerCase())}function ji(r){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(r))}const qi=["stable","beta","unreviewed"],Bi=["active","shipped","abandoned"],dt=["plan","spec","sql","testing-todo","discovery","session-summary","other"],Hi=["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 ht(r){return{description:r.description??"",tags:r.tags??[],status:r.status??"",name:r.name??"",owner:r.owner??"",extends:r.extends??"",group:r.group??"",trigger_phrases:r.trigger_phrases??[],key:r.key??"",key_type:r.key_type??"",doc_type:r.doc_type??"",related_to:r.related_to??""}}class Ki extends k{constructor(){super(...arguments),this._viewMode=localStorage.getItem(ct)??"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=S`
|
|
631
643
|
:host { display: block; padding: 16px; }
|
|
632
644
|
h2 { margin: 0 0 4px; font-size: 16px; }
|
|
633
645
|
.title-row {
|
|
@@ -999,7 +1011,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
|
|
|
999
1011
|
}
|
|
1000
1012
|
.share-links-row { display: flex; gap: 6px; }
|
|
1001
1013
|
.share-status { font-size: 11px; opacity: 0.75; }
|
|
1002
|
-
`}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 n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ct,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#p(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),n=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!n.ok){const{error:o}=await n.json().catch(()=>({error:`upload failed (${n.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#l(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#p(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"}),this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#a(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#g(){this._sharing=!1,this._shareStatus=null}async#v(){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#u(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"}),n=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${n.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(n.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#o(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#b(){this._doc&&(this._draft=ht(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#k(){this._doc&&(this._draft=ht(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#w(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#m(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#
|
|
1014
|
+
`}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 n=(this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre"))?.scrollTop??0;this._doc=await s.json(),await this.updateComplete;const o=this.shadowRoot?.querySelector(".markdown-body")??this.shadowRoot?.querySelector("pre");o&&(o.scrollTop=n)}#t(){this._doc?.source_path&&navigator.clipboard?.writeText(this._doc.source_path)}#s(e){this._viewMode=e,localStorage.setItem(ct,e)}async#n(){const{table:e,id:t}=this.selected,s=!this._doc?.deprecated;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/deprecated`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({deprecated:s})}),await this.#e(),this.onChanged?.()}async#r(){const{table:e,id:t}=this.selected,s=!this._doc?.paused;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/paused`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({paused:s})}),await this.#e(),this.onChanged?.()}async#p(e){const{table:t,id:s}=this.selected,i=await e.arrayBuffer(),n=await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:i});if(!n.ok){const{error:o}=await n.json().catch(()=>({error:`upload failed (${n.status})`}));window.alert(o);return}await this.#e(),this.onChanged?.()}#l(e){const t=e.currentTarget,s=t.files?.[0];t.value="",s&&this.#p(s)}async#i(e){if(!window.confirm(`Remove attachment "${e}"? This can't be undone.`))return;const{table:t,id:s}=this.selected;await fetch(`/api/entries/${t}/${encodeURIComponent(s)}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"}),this._viewingAttachment?.filename===e&&(this._viewingAttachment=null),await this.#e(),this.onChanged?.()}#a(){this._sharing=!0,this._shareUsername="",this._shareRole="member",this._shareStatus=null}#g(){this._sharing=!1,this._shareStatus=null}async#v(){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#u(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"}),n=await i.json().catch(()=>({}));if(!i.ok){this._shareStatus=`Failed to create link: ${n.error??i.statusText}`;return}const o=e==="share-link"?"shareToken":"publicToken",a=new URL(window.location.href);a.search=`?${o}=${encodeURIComponent(n.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#o(){if(!window.confirm("Delete this doc? This can't be undone."))return;const{table:e,id:t}=this.selected;await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"DELETE"}),this._doc=null,this.onChanged?.()}#b(){this._doc&&(this._draft=ht(this._doc),this._editing=!0,this._addingFrontmatter=!1)}#k(){this._doc&&(this._draft=ht(this._doc),this._addingFrontmatter=!0,this._editing=!1)}#w(e){this._draft&&(this._draft={...this._draft,doc_type:e},this._addingFrontmatter=!1,this._editing=!0)}#m(){this._editing=!1,this._addingFrontmatter=!1,this._draft=null}#c(e){this._draft&&(this._draft={...this._draft,...e})}#x(e){if(!this._draft)return;const t=this._draft.tags.includes(e)?this._draft.tags.filter(s=>s!==e):[...this._draft.tags,e];this.#c({tags:t})}#$(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.#c({trigger_phrases:t})}async#h(){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 n=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({frontmatter:i})});if(!n.ok){const o=await n.json().catch(()=>({}));window.alert(`Save failed: ${o.error??n.statusText}`);return}this._editing=!1,this._draft=null,await this.#e(),this.onChanged?.()}async#y(){if(!this.selected||!this._doc||this.selected.table!=="memory_docs")return;const{table:e,id:t}=this.selected;if(!window.confirm(`Delete frontmatter for "${this._doc.key}"?
|
|
1003
1015
|
|
|
1004
1016
|
This removes the doc's key, tags, and status — it drops out of key-based lookup and full-text search, and becomes a plain unmanaged file, until frontmatter is added again.`))return;const i=await fetch(`/api/entries/${e}/${encodeURIComponent(t)}/frontmatter`,{method:"DELETE"});if(!i.ok){const n=await i.json().catch(()=>({}));window.alert(`Delete failed: ${n.error??i.statusText}`);return}this._doc=null,this.selected=null,this.onChanged?.()}#_(){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#f(){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 n=await i.json().catch(()=>({}));window.alert(`Rename failed: ${n.error??i.statusText}`);return}if(this._renaming=!1,e)this.selected={table:"skills",id:t};else{const n=await i.json();this.selected={table:"memory_docs",id:n.source_path}}await this.#e(),this.onChanged?.()}#T(){return l`
|
|
1005
1017
|
<div class="edit-form">
|
|
@@ -1031,14 +1043,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1031
1043
|
<input
|
|
1032
1044
|
type="text"
|
|
1033
1045
|
.value=${t.key}
|
|
1034
|
-
@input=${i=>this.#
|
|
1046
|
+
@input=${i=>this.#c({key:i.target.value})}
|
|
1035
1047
|
/>
|
|
1036
1048
|
</div>
|
|
1037
1049
|
<div class="field">
|
|
1038
1050
|
<label>key_type <help-tooltip .text=${$.key_type}></help-tooltip></label>
|
|
1039
1051
|
<select
|
|
1040
1052
|
.value=${t.key_type}
|
|
1041
|
-
@change=${i=>this.#
|
|
1053
|
+
@change=${i=>this.#c({key_type:i.target.value})}
|
|
1042
1054
|
>
|
|
1043
1055
|
${Hi.map(i=>l`<option value=${i} ?selected=${i===t.key_type}>${i}</option>`)}
|
|
1044
1056
|
</select>
|
|
@@ -1048,7 +1060,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1048
1060
|
<label>doc_type <help-tooltip .text=${$.doc_type}></help-tooltip></label>
|
|
1049
1061
|
<select
|
|
1050
1062
|
.value=${t.doc_type}
|
|
1051
|
-
@change=${i=>this.#
|
|
1063
|
+
@change=${i=>this.#c({doc_type:i.target.value})}
|
|
1052
1064
|
>
|
|
1053
1065
|
${dt.map(i=>l`<option value=${i} ?selected=${i===t.doc_type}>${i}</option>`)}
|
|
1054
1066
|
</select>
|
|
@@ -1058,7 +1070,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1058
1070
|
<label>description <help-tooltip .text=${$.description}></help-tooltip></label>
|
|
1059
1071
|
<textarea
|
|
1060
1072
|
.value=${t.description}
|
|
1061
|
-
@input=${i=>this.#
|
|
1073
|
+
@input=${i=>this.#c({description:i.target.value})}
|
|
1062
1074
|
></textarea>
|
|
1063
1075
|
</div>
|
|
1064
1076
|
<div class="field">
|
|
@@ -1075,7 +1087,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1075
1087
|
<status-select
|
|
1076
1088
|
.options=${[...new Set([...e?qi:Bi,...s?.statuses??[]])]}
|
|
1077
1089
|
.value=${t.status}
|
|
1078
|
-
.onChange=${i=>this.#
|
|
1090
|
+
.onChange=${i=>this.#c({status:i})}
|
|
1079
1091
|
></status-select>
|
|
1080
1092
|
</div>
|
|
1081
1093
|
${e?l`
|
|
@@ -1085,7 +1097,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1085
1097
|
<input
|
|
1086
1098
|
type="text"
|
|
1087
1099
|
.value=${t.owner}
|
|
1088
|
-
@input=${i=>this.#
|
|
1100
|
+
@input=${i=>this.#c({owner:i.target.value})}
|
|
1089
1101
|
/>
|
|
1090
1102
|
</div>
|
|
1091
1103
|
<div class="field">
|
|
@@ -1093,10 +1105,18 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1093
1105
|
<input
|
|
1094
1106
|
type="text"
|
|
1095
1107
|
.value=${t.extends}
|
|
1096
|
-
@input=${i=>this.#
|
|
1108
|
+
@input=${i=>this.#c({extends:i.target.value})}
|
|
1097
1109
|
/>
|
|
1098
1110
|
</div>
|
|
1099
1111
|
</div>
|
|
1112
|
+
<div class="field">
|
|
1113
|
+
<label>group <help-tooltip .text=${$.group}></help-tooltip></label>
|
|
1114
|
+
<status-select
|
|
1115
|
+
.options=${s?.groups??[]}
|
|
1116
|
+
.value=${t.group}
|
|
1117
|
+
.onChange=${i=>this.#c({group:i})}
|
|
1118
|
+
></status-select>
|
|
1119
|
+
</div>
|
|
1100
1120
|
<div class="field">
|
|
1101
1121
|
<label>trigger_phrases <help-tooltip .text=${$.trigger_phrases}></help-tooltip></label>
|
|
1102
1122
|
<tag-multiselect
|
|
@@ -1112,7 +1132,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1112
1132
|
<input
|
|
1113
1133
|
type="text"
|
|
1114
1134
|
.value=${t.related_to}
|
|
1115
|
-
@input=${i=>this.#
|
|
1135
|
+
@input=${i=>this.#c({related_to:i.target.value})}
|
|
1116
1136
|
/>
|
|
1117
1137
|
</div>
|
|
1118
1138
|
`}
|
|
@@ -1159,6 +1179,12 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1159
1179
|
<dd>${e.owner}</dd>`:b}
|
|
1160
1180
|
${e.extends?l`<dt>Extends</dt>
|
|
1161
1181
|
<dd>${e.extends}</dd>`:b}
|
|
1182
|
+
${e.group?l`<dt>Group</dt>
|
|
1183
|
+
<dd>
|
|
1184
|
+
<button class="key-link" title="Search for this group" @click=${()=>e.group&&this.onGroupClick?.(e.group)}>
|
|
1185
|
+
${e.group}
|
|
1186
|
+
</button>
|
|
1187
|
+
</dd>`:b}
|
|
1162
1188
|
`:l`
|
|
1163
1189
|
<dt>Key</dt>
|
|
1164
1190
|
<dd>
|
|
@@ -1292,7 +1318,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1292
1318
|
</div>
|
|
1293
1319
|
${this._viewMode==="markdown"?l`<div class="markdown-body">${zi(v.parse(e.body??"",{async:!1,renderer:this.#C(this.selected.table,e.id)}))}</div>`:l`<pre>${e.raw_file??e.body}</pre>`}
|
|
1294
1320
|
<div class="source-path" title="click to copy" @click=${()=>this.#t()}>${e.source_path}</div>
|
|
1295
|
-
`}}customElements.define("detail-panel",Ki);const L="membkt";let ge;function j(){return ge||(ge=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ge}class Vi extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new p("skill");#t=new p("local");#s=new p("");#n=new p([]);#r=new p(null);#p=new p("");#l=new p("");#i=new p("");#a=new p(!1);#g=new p(!1);#v=new p(!1);#u=new p("");#o=new p("");#b=new p(!1);#k=new p("");#w=new p(!1);#m=new p("");#
|
|
1321
|
+
`}}customElements.define("detail-panel",Ki);const L="membkt";let ge;function j(){return ge||(ge=fetch("/api/config").then(r=>r.json()).catch(()=>({folderfooMode:"off",folderfooHost:null}))),ge}class Vi extends k{static{this.properties={defaultKind:{attribute:!1},lockKind:{attribute:!1},onAdded:{attribute:!1},onCancel:{attribute:!1}}}#e=new p("skill");#t=new p("local");#s=new p("");#n=new p([]);#r=new p(null);#p=new p("");#l=new p("");#i=new p("");#a=new p(!1);#g=new p(!1);#v=new p(!1);#u=new p("");#o=new p("");#b=new p(!1);#k=new p("");#w=new p(!1);#m=new p("");#c=new p(!1);#x=new p(!1);#$=new p([]);#h=new p("");#y=new p("");#_=new p(!1);#f;#T=new p("mine");#E=new p([]);#S=new p(!1);#R=new p(null);static{this.styles=S`
|
|
1296
1322
|
:host { display: block; }
|
|
1297
1323
|
.backdrop {
|
|
1298
1324
|
position: fixed; inset: 0; background: var(--overlay);
|
|
@@ -1395,7 +1421,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1395
1421
|
.ff-folder-entry.selected { background: var(--accent); color: var(--accent-fg); }
|
|
1396
1422
|
.ff-empty { padding: 12px; opacity: 0.6; font-size: 13px; }
|
|
1397
1423
|
.ff-widget-slot { display: flex; }
|
|
1398
|
-
`}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#C()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#f)}async#C(e){const t=new URLSearchParams;e&&t.set("path",e),this.#g.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)}#P(){this.#g.set(!this.#g.value),this.#C(this.#s.value)}#z(){this.#u.set(""),this.#v.set(!0)}#I(){this.#v.set(!1),this.#u.set("")}async#N(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#v.set(!1),this.#u.set(""),await this.#C(this.#s.value)}catch(t){this.#i.set(t.message)}}}#
|
|
1424
|
+
`}constructor(){super(),new Y(this),this.defaultKind="skill",this.lockKind=!1}connectedCallback(){super.connectedCallback(),this.#e.set(this.defaultKind),this.#C()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this.#f)}async#C(e){const t=new URLSearchParams;e&&t.set("path",e),this.#g.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)}#P(){this.#g.set(!this.#g.value),this.#C(this.#s.value)}#z(){this.#u.set(""),this.#v.set(!0)}#I(){this.#v.set(!1),this.#u.set("")}async#N(){const e=this.#u.value.trim();if(e){this.#i.set("");try{const t=await fetch("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:this.#s.value,name:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to create folder");return}this.#v.set(!1),this.#u.set(""),await this.#C(this.#s.value)}catch(t){this.#i.set(t.message)}}}#q(){this.#p.set(this.#s.value),this.#l.value||this.#l.set(this.#s.value.split("/").filter(Boolean).pop()??"")}async#J(){const e=this.#p.value||this.#s.value;if(e){this.#a.set(!0),this.#i.set("");try{const t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,path:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to add folder");return}this.onAdded()}finally{this.#a.set(!1)}}}async#Q(){if(this.#c.value)return;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;let s=null;try{s=localStorage.getItem("folderfoo_token")}catch{}s&&(this.#o.set(t),this.#m.set(L),this.#w.set(!0),this.#K(s))}async#B(){if(!this.#o.value){this.#i.set("enter a server URL first");return}this.#i.set("");try{await re(()=>import(`${this.#o.value}/elements/folderfoo-profile-circle.js`),[]),this.#b.set(!0),this.#k.set(""),await this.updateComplete;const e=this.renderRoot.querySelector(".ff-widget-slot");if(e&&!e.querySelector("folderfoo-profile-circle")){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),e.appendChild(t)}this.#f=setInterval(()=>this.#H(),800),this.#H()}catch(e){this.#k.set(e.message)}}#H(){let e=null;try{e=localStorage.getItem("folderfoo_token")}catch{}!e||this.#c.value||(clearInterval(this.#f),this.#K(e))}async#K(e){this.#x.set(!0),this.#i.set("");try{const t=await fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:this.#o.value,token:e})}),s=await t.json();if(!t.ok){this.#i.set(s.error??"failed to persist folderfoo session");return}this.#c.set(!0),this.#m.set(L),await this.#M()}finally{this.#x.set(!1)}}async#M(e,t){this.#_.set(!0),this.#i.set("");try{const s=new URLSearchParams({server:this.#o.value,tenantId:this.#m.value});e&&s.set("owner",e),t&&s.set("rootFolder",t);const i=await fetch(`/api/folderfoo/folders?${s.toString()}`),n=await i.json();if(!i.ok){this.#i.set(n.error??"failed to list folderfoo folders");return}this.#$.set(n)}finally{this.#_.set(!1)}}async#Y(){this.#S.set(!0),this.#i.set("");try{const e=new URLSearchParams({server:this.#o.value,tenantId:this.#m.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.#E.set(s)}finally{this.#S.set(!1)}}#U(e){this.#T.set(e),this.#R.set(null),this.#h.set(""),this.#y.set(""),e==="shared"&&this.#E.value.length===0?this.#Y():e==="mine"&&this.#M()}#F(e){this.#R.set(e),this.#M(e.owner,e.path)}#O(e,t){this.#h.set(e),this.#y.set(t??""),this.#l.value||this.#l.set(e.split("/").filter(Boolean).pop()??this.#m.value)}#V(e){this.#O(e.path,e.owner)}async#G(){if(this.#h.value){this.#a.set(!0),this.#i.set("");try{const e=await fetch("/api/remote-folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:this.#e.value,name:this.#l.value||void 0,server:this.#o.value,tenantId:this.#m.value,folderPath:this.#h.value,owner:this.#y.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.#a.set(!1)}}}#W(){const e=this.#n.value;return l`
|
|
1399
1425
|
<div class="breadcrumb-row">
|
|
1400
1426
|
<div class="breadcrumb">${this.#s.value}</div>
|
|
1401
1427
|
<button class="new-folder-btn" @click=${()=>this.#z()}>+ New folder</button>
|
|
@@ -1426,7 +1452,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1426
1452
|
</div>`)}
|
|
1427
1453
|
</div>
|
|
1428
1454
|
<div class="footer">
|
|
1429
|
-
<button class="secondary" @click=${()=>this.#
|
|
1455
|
+
<button class="secondary" @click=${()=>this.#q()}>
|
|
1430
1456
|
Select this folder
|
|
1431
1457
|
</button>
|
|
1432
1458
|
${this.#p.value?l`<div class="selected-row">Selected: <span class="path">${this.#p.value}</span></div>`:""}
|
|
@@ -1445,13 +1471,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1445
1471
|
<button
|
|
1446
1472
|
class="primary"
|
|
1447
1473
|
?disabled=${!this.#p.value||this.#a.value}
|
|
1448
|
-
@click=${()=>this.#
|
|
1474
|
+
@click=${()=>this.#J()}
|
|
1449
1475
|
>
|
|
1450
1476
|
${this.#a.value?"Adding…":"Add folder"}
|
|
1451
1477
|
</button>
|
|
1452
1478
|
</div>
|
|
1453
1479
|
</div>
|
|
1454
|
-
`}#
|
|
1480
|
+
`}#X(){const e=this.#$.value;if(this.#w.value&&!this.#c.value)return l`
|
|
1455
1481
|
<div class="ff-body">
|
|
1456
1482
|
<div class="ff-connected-row"><span class="ff-connected-dot"></span> Already signed in to ${this.#o.value} — connecting…</div>
|
|
1457
1483
|
${this.#i.value?l`<div class="error">${this.#i.value}</div>`:""}
|
|
@@ -1459,7 +1485,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1459
1485
|
<button class="secondary" @click=${()=>this.onCancel()}>Cancel</button>
|
|
1460
1486
|
</div>
|
|
1461
1487
|
</div>
|
|
1462
|
-
`;if(!this.#
|
|
1488
|
+
`;if(!this.#c.value)return l`
|
|
1463
1489
|
<div class="ff-body">
|
|
1464
1490
|
<div class="ff-hint">
|
|
1465
1491
|
Sign in to a folderfoo server to mount one of your folders (or a folder shared with you) as a
|
|
@@ -1474,7 +1500,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1474
1500
|
placeholder="https://folderfoo.example.com"
|
|
1475
1501
|
?disabled=${this.#b.value}
|
|
1476
1502
|
@input=${i=>this.#o.set(i.target.value)}
|
|
1477
|
-
@keydown=${i=>i.key==="Enter"&&this.#
|
|
1503
|
+
@keydown=${i=>i.key==="Enter"&&this.#B()}
|
|
1478
1504
|
/>
|
|
1479
1505
|
</div>
|
|
1480
1506
|
${this.#b.value?l`
|
|
@@ -1483,7 +1509,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1483
1509
|
${this.#x.value?l`<div class="ff-hint">Finishing connection…</div>`:""}
|
|
1484
1510
|
`:l`
|
|
1485
1511
|
<div class="actions" style="justify-content: flex-start; margin-top: 0;">
|
|
1486
|
-
<button class="secondary" @click=${()=>this.#
|
|
1512
|
+
<button class="secondary" @click=${()=>this.#B()}>Continue</button>
|
|
1487
1513
|
</div>
|
|
1488
1514
|
`}
|
|
1489
1515
|
${this.#k.value?l`<div class="error">${this.#k.value}</div>`:""}
|
|
@@ -1527,7 +1553,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1527
1553
|
</div>
|
|
1528
1554
|
<div
|
|
1529
1555
|
class="ff-folder-entry ${this.#h.value===s.path&&this.#y.value===s.owner?"selected":""}"
|
|
1530
|
-
@click=${()=>this.#
|
|
1556
|
+
@click=${()=>this.#V(s)}
|
|
1531
1557
|
>
|
|
1532
1558
|
(connect this folder itself)
|
|
1533
1559
|
</div>
|
|
@@ -1568,7 +1594,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1568
1594
|
<button
|
|
1569
1595
|
class="primary"
|
|
1570
1596
|
?disabled=${!this.#h.value||this.#a.value}
|
|
1571
|
-
@click=${()=>this.#
|
|
1597
|
+
@click=${()=>this.#G()}
|
|
1572
1598
|
>
|
|
1573
1599
|
${this.#a.value?"Connecting…":"Connect folder"}
|
|
1574
1600
|
</button>
|
|
@@ -1600,15 +1626,15 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1600
1626
|
</button>
|
|
1601
1627
|
<button
|
|
1602
1628
|
class=${this.#t.value==="folderfoo"?"active":""}
|
|
1603
|
-
@click=${()=>{this.#t.set("folderfoo"),this.#
|
|
1629
|
+
@click=${()=>{this.#t.set("folderfoo"),this.#Q()}}
|
|
1604
1630
|
>
|
|
1605
1631
|
Connect folderfoo
|
|
1606
1632
|
</button>
|
|
1607
1633
|
</div>
|
|
1608
|
-
${this.#t.value==="local"?this.#W():this.#
|
|
1634
|
+
${this.#t.value==="local"?this.#W():this.#X()}
|
|
1609
1635
|
</div>
|
|
1610
1636
|
</div>
|
|
1611
|
-
`}}customElements.define("add-folder-modal",Vi);function pt(r){const e=Date.now()-r,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
|
|
1637
|
+
`}}customElements.define("add-folder-modal",Vi);function pt(r){const e=Date.now()-r,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 Gi 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=S`
|
|
1612
1638
|
:host { display: flex; flex: 1 1 auto; min-height: 0; }
|
|
1613
1639
|
.nav {
|
|
1614
1640
|
flex: 0 0 260px;
|
|
@@ -1692,7 +1718,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1692
1718
|
${this.#e()}
|
|
1693
1719
|
</div>
|
|
1694
1720
|
${this.#t()}
|
|
1695
|
-
`}}customElements.define("channel-view",
|
|
1721
|
+
`}}customElements.define("channel-view",Gi);function Wi(r){const e=new Map;for(const t of r){const s=t.tags.length>0?t.tags:[null];for(const i of s){const n=e.get(i);n?n.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 Zi(r,e){const t=new Map;for(const n of r){const o=t.get(n.folder);o?o.push(n):t.set(n.folder,[n])}const s=[],i=[];for(const n of e){const o=t.get(n.name);if(!o)continue;const a={folder:n,tagGroups:[{tag:null,items:o}]};(n.remote?i:s).push(a)}return{local:s,remote:i}}const Vt="mem-bucket-folder-view-mode",Gt="mem-bucket-folder-view-expanded",ut="mem-bucket-folder-view-tree-split-pct",ft="mem-bucket-folder-view-list-split-pct",gt=12,bt=40,mt=20,vt=80;function xt(r,e,t,s){const i=Number(localStorage.getItem(r));return Number.isFinite(i)&&i>=t&&i<=s?i:e}const Ji=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],Qi=[{value:"a",label:"Folder tree"},{value:"b",label:"Breadcrumb drill-down"},{value:"c",label:"Tag → Name"}];function Yi(){const r=localStorage.getItem(Vt);return r==="a"||r==="b"||r==="c"?r:"a"}function Xi(){try{const r=localStorage.getItem(Gt);if(!r)return new Set;const e=JSON.parse(r);return Array.isArray(e)?new Set(e.map(String)):new Set}catch{return new Set}}function yt(r){localStorage.setItem(Gt,JSON.stringify([...r]))}class er 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 p(Yi());#t=new p(Xi());#s=new p([]);#n=new p(null);#r=new p(null);#p=new p(xt(ut,20,gt,bt));#l=new p(xt(ft,40,mt,vt));#i=new p(null);#a=e=>this.#b(e);#g=()=>this.#k();static{this.styles=S`
|
|
1696
1722
|
:host { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
|
|
1697
1723
|
/* padding-right reserves room for mem-bucket-app's absolutely-positioned .header-toolbar
|
|
1698
1724
|
overlay (rendered outside this element entirely - see its own comment), which lines up with
|
|
@@ -1771,7 +1797,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1771
1797
|
border: none; background: none; color: inherit; width: 100%; text-align: left; box-sizing: border-box;
|
|
1772
1798
|
}
|
|
1773
1799
|
.folder-card:hover { background: var(--hover); }
|
|
1774
|
-
`}constructor(){super(),new Y(this)}#v(e){this.#e.set(e),localStorage.setItem(Vt,e),this.#t.set(new Set),yt(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#u(e){this.#v(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#a),document.addEventListener("pointerup",this.#g)}#b(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),n=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#p.set(Math.min(bt,Math.max(gt,n)));else{const o=100-this.#p.value,a=o>0?(n-this.#p.value)/o*100:0;this.#l.set(Math.min(vt,Math.max(mt,a)))}}#k(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#a),document.removeEventListener("pointerup",this.#g),e==="tree"?localStorage.setItem(ut,String(this.#p.value)):e==="list"&&localStorage.setItem(ft,String(this.#l.value))}#w(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),yt(t)}#m(e,t){this.#n.set({folder:e,tag:t})}#
|
|
1800
|
+
`}constructor(){super(),new Y(this)}#v(e){this.#e.set(e),localStorage.setItem(Vt,e),this.#t.set(new Set),yt(new Set),this.#s.set([]),this.#n.set(null),this.#r.set(null)}#u(e){this.#v(e.target.value)}#o(e,t){t.preventDefault(),this.#i.set(e),document.addEventListener("pointermove",this.#a),document.addEventListener("pointerup",this.#g)}#b(e){const t=this.#i.value;if(!t)return;const s=this.renderRoot.querySelector(".body-region");if(!s)return;const i=s.getBoundingClientRect(),n=(e.clientX-i.left)/i.width*100;if(t==="tree")this.#p.set(Math.min(bt,Math.max(gt,n)));else{const o=100-this.#p.value,a=o>0?(n-this.#p.value)/o*100:0;this.#l.set(Math.min(vt,Math.max(mt,a)))}}#k(){const e=this.#i.value;this.#i.set(null),document.removeEventListener("pointermove",this.#a),document.removeEventListener("pointerup",this.#g),e==="tree"?localStorage.setItem(ut,String(this.#p.value)):e==="list"&&localStorage.setItem(ft,String(this.#l.value))}#w(e){const t=new Set(this.#t.value);t.has(e)?t.delete(e):t.add(e),this.#t.set(t),yt(t)}#m(e,t){this.#n.set({folder:e,tag:t})}#c(e){this.#n.set(null),this.#r.set({table:e._table,id:e.id})}#x(e){this.#r.set({table:e._table,id:e.id})}#$(e,t){const s=this.#t.value.has(t),i=e.tagGroups.reduce((o,a)=>o+a.items.length,0),n=this.#n.value?.folder===e.folder.name&&this.#n.value?.tag===null;return l`
|
|
1775
1801
|
<button class="node ${e.folder.remote?"remote":""} ${n?"active":""}" @click=${()=>this.#w(t)}>
|
|
1776
1802
|
<span class="caret">${s?"▾":"▸"}</span>
|
|
1777
1803
|
<span class="icon">${e.folder.remote?"☁":"📁"}</span>
|
|
@@ -1787,7 +1813,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1787
1813
|
${s.map(n=>{const o=`folder:${n.folder.name}`,a=this.#t.value.has(o),c=n.tagGroups[0]?.items??[];return l`
|
|
1788
1814
|
${this.#$(n,o)}
|
|
1789
1815
|
${a?c.map(d=>l`
|
|
1790
|
-
<button class="node indent-1" @click=${()=>this.#
|
|
1816
|
+
<button class="node indent-1" @click=${()=>this.#c(d)}>
|
|
1791
1817
|
<span class="caret"></span>
|
|
1792
1818
|
<span class="icon">${d._table==="skills"?"⚡":"📝"}</span>
|
|
1793
1819
|
<span class="label">${d.name}</span>
|
|
@@ -1810,7 +1836,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1810
1836
|
<span>${s}</span>
|
|
1811
1837
|
</div>
|
|
1812
1838
|
${n.length===0?l`<div class="empty">No entries in this folder.</div>`:n.map(o=>l`
|
|
1813
|
-
<button class="node" @click=${()=>this.#
|
|
1839
|
+
<button class="node" @click=${()=>this.#c(o)}>
|
|
1814
1840
|
<span class="caret"></span>
|
|
1815
1841
|
<span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
|
|
1816
1842
|
<span class="label">${o.name}</span>
|
|
@@ -1828,14 +1854,14 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
1828
1854
|
<span class="count">${t.items.length}</span>
|
|
1829
1855
|
</button>
|
|
1830
1856
|
${i?t.items.map(o=>l`
|
|
1831
|
-
<button class="node indent-1" @click=${()=>this.#
|
|
1857
|
+
<button class="node indent-1" @click=${()=>this.#c(o)}>
|
|
1832
1858
|
<span class="caret"></span>
|
|
1833
1859
|
<span class="icon">${o._table==="skills"?"⚡":"📝"}</span>
|
|
1834
1860
|
<span class="label">${o.name}</span>
|
|
1835
1861
|
<span class="count">${o.folder}</span>
|
|
1836
1862
|
</button>
|
|
1837
1863
|
`):""}
|
|
1838
|
-
`})}#f(){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:
|
|
1864
|
+
`})}#f(){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:Zi(t,s),n=e==="c"?Wi(t):null,o=this.#n.value,a=this.#r.value;return l`
|
|
1839
1865
|
<div class="mode-row">
|
|
1840
1866
|
<span class="filter-label">View:</span>
|
|
1841
1867
|
<select .value=${e} @change=${c=>this.#u(c)}>
|
|
@@ -2083,7 +2109,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2083
2109
|
</div>
|
|
2084
2110
|
`)}
|
|
2085
2111
|
</div>
|
|
2086
|
-
`}}customElements.define("shared-with-me-panel",rr);function nr(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const ie=new p({mode:"off",username:null});let $t=!1;function or(){if($t)return;$t=!0;const r=new EventSource("/api/folderfoo/identity-stream");r.onmessage=e=>{try{ie.set(JSON.parse(e.data))}catch{}}}let wt=!1;async function ar(r){if(wt)return;wt=!0;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),n=s.searchParams.has("publicToken");if(!(!i&&!n)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||r({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:L})}),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([re(()=>import(`${t}/elements/auth-guard.js`),[]),re(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(L),i&&o.redeemShareTokenFromUrl(),n){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&&r({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:L})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let _t=!1;const lr=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],St=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],cr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},dr={skill:[],memory:[]},
|
|
2112
|
+
`}}customElements.define("shared-with-me-panel",rr);function nr(r){const e=r.split(":");if(e.length===1)return{folderPath:"",name:e[0]};if(e.length===2){const[n,o]=e;return n.includes("/")?{folderPath:n,name:o}:{owner:n,folderPath:"",name:o}}const[t,s,...i]=e;return{owner:t===""?void 0:t,folderPath:s,name:i.join(":")}}const ie=new p({mode:"off",username:null});let $t=!1;function or(){if($t)return;$t=!0;const r=new EventSource("/api/folderfoo/identity-stream");r.onmessage=e=>{try{ie.set(JSON.parse(e.data))}catch{}}}let wt=!1;async function ar(r){if(wt)return;wt=!0;const{folderfooMode:e,folderfooHost:t}=await j();if(e==="off"||!t)return;const s=new URL(window.location.href),i=s.searchParams.has("shareToken"),n=s.searchParams.has("publicToken");if(!(!i&&!n)){document.addEventListener("folderfoo-share-redeemed",o=>{const a=o.detail;!a?.owner||!a?.path||a.type!=="file"||!a.originId||!a.kind||r({owner:a.owner,path:a.path,originId:a.originId,kind:a.kind,role:a.role??"member",server:t,tenantId:L})}),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([re(()=>import(`${t}/elements/auth-guard.js`),[]),re(()=>import(`${t}/elements/api-client.js`),[])]);if(a.setTenantId(L),i&&o.redeemShareTokenFromUrl(),n){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&&r({owner:d.owner,path:d.path,originId:d.originId,kind:d.kind,role:"member",server:t,tenantId:L})}}catch(o){console.error("[memory-bucket] failed to load folderfoo share-accept widgets:",o)}}}let _t=!1;const lr=[{value:"all",label:"All"},{value:"skill",label:"Skills"},{value:"memory",label:"Memories"}],St=[{value:"all",label:"Show all"},{value:"hide",label:"Hide"},{value:"only",label:"Only"}],cr={tags:[],statuses:[],owners:[],doc_types:[],key_types:[],folders:[]},dr={skill:[],memory:[]},Wt="mem-bucket-split-pct",Zt=20,Jt=80;function hr(){const r=Number(localStorage.getItem(Wt));return Number.isFinite(r)&&r>=Zt&&r<=Jt?r:40}const Qt="mem-bucket-theme",be=["system","light","dark"];function pr(){const r=localStorage.getItem(Qt);return r==="light"||r==="dark"?r:"system"}function Ct(r){r==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",r)}function ur(){const r=location.hash.slice(1);if(!r)return{};const e=new URLSearchParams(r),t={},s=e.get("q");s&&(t.query=s);const i=e.get("type");(i==="skill"||i==="memory"||i==="all")&&(t.typeFilter=i);const n=e.getAll("tag");n.length&&(t.activeTags=n);const o=e.getAll("folder");o.length&&(t.activeFolders=o);const a=e.get("sort");a&&(t.sort=a);const 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 h=e.get("date_to");return h&&(t.dateTo=h),t}class fr extends k{static{this.styles=S`
|
|
2087
2113
|
:host { display: flex; flex-direction: column; height: 100vh; position: relative; }
|
|
2088
2114
|
/* Overlays whichever header row #renderBody() renders for the current mode (.folders-bar,
|
|
2089
2115
|
.toolbar-bar, or folder-view's own .mode-row) - all three share the same 10px/16px padding,
|
|
@@ -2287,7 +2313,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2287
2313
|
cursor: pointer;
|
|
2288
2314
|
}
|
|
2289
2315
|
.bulk-bar button.danger { border-color: var(--danger); color: var(--danger); }
|
|
2290
|
-
`}#e=ur();#t=new p(this.#e.query??"");#s=new p(this.#e.typeFilter??"all");#n=new p(this.#e.activeTags??[]);#r=new p(this.#e.activeFolders??[]);#p=new p([]);#l=new p(cr);#i=new p(null);#a=new p(dr);#g=new p(!1);#v=new p("");#u=new p(!1);#o=new p(hr());#b=new p("");#k=new p(!1);#w=new p(this.#e.sort??"");#m=new p(this.#e.deprecatedFilter??"all");#d=new p(this.#e.pausedFilter??"all");#x=new p(this.#e.dateFrom??"");#$=new p(this.#e.dateTo??"");#h=new p(new Set);#y=new p(pr());#_=new p(!1);#f=new p("entries");#T=new p([]);#E=new p([]);#S=new p(null);#R=new p(null);#C=new p(!1);#P=new p([]);#z=new p(!1);#I=new p(null);#N=e=>this.#H(e);#j=()=>this.#M();constructor(){super(),new Y(this),Ct(this.#y.value)}#G(e){this.#y.set(e),localStorage.setItem(Qt,e),Ct(e)}#J(){const e=be[(be.indexOf(this.#y.value)+1)%be.length];this.#G(e)}async#q(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#L(),this.#A(),this.#c()])}finally{this.#_.set(!1)}}}#B(e){e.preventDefault(),this.#k.set(!0),document.addEventListener("pointermove",this.#N),document.addEventListener("pointerup",this.#j)}#H(e){const t=this.renderRoot.querySelector(".body-region");if(!t)return;const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width*100;this.#o.set(Math.min(Jt,Math.max(Gt,i)))}#M(){this.#k.set(!1),document.removeEventListener("pointermove",this.#N),document.removeEventListener("pointerup",this.#j),localStorage.setItem(Zt,String(this.#o.value))}#Q=new Xe(()=>{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.#w.value&&e.set("sort",this.#w.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#d.value==="hide"?e.set("paused","0"):this.#d.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#U=new Xe(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#d.value==="hide"?e.set("paused","0"):this.#d.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#F=()=>this.#oe();#O=e=>this.#Y(e);#K=e=>this.#me(e);#V=()=>this.#ne();#W;connectedCallback(){super.connectedCallback(),this.#c(),this.#A(),this.#L().then(()=>this.#oe()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#O),document.addEventListener("folderfoo-folder-changed",this.#K),window.addEventListener("folderfoo-auth-change",this.#V),this.#ne(),or(),ar(e=>this.#ke(e)),this.#Z(),this.#W=ie.subscribe(()=>{this.#L(),this.#c(),this.#A(),this.#f.value==="shared"&&ie.value.username===null&&this.#D("entries")})}async#Y(e){const t=e.detail?.name;if(!t)return;const s=nr(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:n}=await j();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:L,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#me(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await j();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#L()}}#ie(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#re(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",L),t.style.zoom="0.875",e.appendChild(t)}async#ve(){const e=this.#ie();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(_t){this.#re(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||re(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{_t=!0,await this.updateComplete;const i=this.#ie();i&&!i.querySelector("folderfoo-profile-circle")&&this.#re(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#O),document.removeEventListener("folderfoo-folder-changed",this.#K),window.removeEventListener("folderfoo-auth-change",this.#V),this.#W?.()}async#ne(){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 j();t==="off"||!s||fetch("/api/folderfoo/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:s,token:e})}).catch(()=>{})}#X=!1;async#oe(){if(document.visibilityState==="visible"){if(this.#ee().some(e=>e.remote)&&!this.#X){this.#X=!0;try{await fetch("/api/remote-folders/resync-all",{method:"POST"})}catch{}finally{this.#X=!1}}this.#c(),this.#A(),this.#L(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#c(){const e=this.#Q.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#p.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#f.value==="folder-view"&&this.#ae()}async#ae(){const e=await fetch(`/api/entries?${this.#U.value}`);this.#T.set(await e.json())}async#A(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#L(){const t=await(await fetch("/api/folders")).json();this.#a.set(t),this.#u.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.#c());const n=this.#i.value;if(n){const o=this.#fe().get(n.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#D(e){this.#f.set(e),e==="channels"?this.#ce():e==="folder-view"?this.#ae():e==="shared"&&(this.#Z(),this.#le())}async#Z(){const e=await fetch("/api/shared-items");this.#P.set(e.ok?await e.json():[])}async#le(){this.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#I.set(await e.json()),await this.#Z()}finally{this.#z.set(!1)}}async#xe(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#Z()}#ye(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#D("entries"))}async#ke(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.#D("shared")}async#$e(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.#c(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#ce(){const e=await fetch("/api/channels");this.#E.set(await e.json()),this.#S.value&&this.#de(this.#S.value)}async#de(e){this.#S.set(e),this.#C.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#C.set(!1)}}#we(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}async#_e(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#v.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#L(),this.#A(),this.#c()])}finally{this.#v.set("")}}}#he(e){this.#g.set(!1),this.#L(),this.#A(),this.#c(),e&&alert(e)}#ee(){return[...this.#a.value.skill,...this.#a.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#pe(e){this.#s.set(e),this.#n.set([]),this.#A(),this.#c()}#Se(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#c()}#Ce(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#c()}#Te(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#c()}#ue(e){this.#x.set(e),this.#$.set(e),this.#c()}#Ae(e){this.#t.set(e.target.value),this.#c()}#te(e){this.#t.set(e),this.#c()}#Ee(){this.#t.set(""),this.#c()}#Re(e){this.#i.set({table:e._table,id:e.id})}#Pe(e){this.#w.set(e.target.value),this.#c()}#ze(e){this.#m.set(e.target.value),this.#c()}#Ie(e){this.#d.set(e.target.value),this.#c()}#Le(e){this.#x.set(e.target.value),this.#c()}#Fe(e){this.#$.set(e.target.value),this.#c()}#Oe(){this.#x.set(""),this.#$.set(""),this.#c()}#De(e){const t=new Set(this.#h.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#h.set(t)}#fe(){return new Map(this.#p.value.map(e=>[e.id,e]))}#se(){const e=new Map,t=this.#fe();for(const s of this.#h.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#ge(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#h.set(new Set),await this.#c()}async#be(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#h.set(new Set),await this.#c()}async#Ne(){if(!window.confirm(`Delete ${this.#h.value.size} doc(s)? This can't be undone.`))return;const e=this.#se();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#h.set(new Set),await this.#c()}#Me(){const e=this.#f.value!=="channels"&&this.#f.value!=="shared"&&this.#u.value&&this.#ee().length>0,t=ie.value.username!==null||this.#P.value.length>0;return l`
|
|
2316
|
+
`}#e=ur();#t=new p(this.#e.query??"");#s=new p(this.#e.typeFilter??"all");#n=new p(this.#e.activeTags??[]);#r=new p(this.#e.activeFolders??[]);#p=new p([]);#l=new p(cr);#i=new p(null);#a=new p(dr);#g=new p(!1);#v=new p("");#u=new p(!1);#o=new p(hr());#b=new p("");#k=new p(!1);#w=new p(this.#e.sort??"");#m=new p(this.#e.deprecatedFilter??"all");#c=new p(this.#e.pausedFilter??"all");#x=new p(this.#e.dateFrom??"");#$=new p(this.#e.dateTo??"");#h=new p(new Set);#y=new p(pr());#_=new p(!1);#f=new p("entries");#T=new p([]);#E=new p([]);#S=new p(null);#R=new p(null);#C=new p(!1);#P=new p([]);#z=new p(!1);#I=new p(null);#N=e=>this.#K(e);#q=()=>this.#M();constructor(){super(),new Y(this),Ct(this.#y.value)}#J(e){this.#y.set(e),localStorage.setItem(Qt,e),Ct(e)}#Q(){const e=be[(be.indexOf(this.#y.value)+1)%be.length];this.#J(e)}async#B(){if(!this.#_.value){this.#_.set(!0);try{await fetch("/api/rebuild-cache",{method:"POST"}),await Promise.all([this.#L(),this.#A(),this.#d()])}finally{this.#_.set(!1)}}}#H(e){e.preventDefault(),this.#k.set(!0),document.addEventListener("pointermove",this.#N),document.addEventListener("pointerup",this.#q)}#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.#o.set(Math.min(Jt,Math.max(Zt,i)))}#M(){this.#k.set(!1),document.removeEventListener("pointermove",this.#N),document.removeEventListener("pointerup",this.#q),localStorage.setItem(Wt,String(this.#o.value))}#Y=new Xe(()=>{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.#w.value&&e.set("sort",this.#w.value),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#c.value==="hide"?e.set("paused","0"):this.#c.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#U=new Xe(()=>{const e=new URLSearchParams;return this.#s.value!=="all"&&e.set("type",this.#s.value),this.#t.value.trim()&&e.set("q",this.#t.value.trim()),this.#m.value==="hide"?e.set("deprecated","0"):this.#m.value==="only"&&e.set("deprecated","1"),this.#c.value==="hide"?e.set("paused","0"):this.#c.value==="only"&&e.set("paused","1"),this.#x.value&&e.set("date_from",this.#x.value),this.#$.value&&e.set("date_to",this.#$.value),e.toString()});#F=()=>this.#oe();#O=e=>this.#X(e);#V=e=>this.#me(e);#G=()=>this.#ne();#W;connectedCallback(){super.connectedCallback(),this.#d(),this.#A(),this.#L().then(()=>this.#oe()),window.addEventListener("focus",this.#F),document.addEventListener("visibilitychange",this.#F),document.addEventListener("folderfoo-file-open",this.#O),document.addEventListener("folderfoo-folder-changed",this.#V),window.addEventListener("folderfoo-auth-change",this.#G),this.#ne(),or(),ar(e=>this.#ke(e)),this.#Z(),this.#W=ie.subscribe(()=>{this.#L(),this.#d(),this.#A(),this.#f.value==="shared"&&ie.value.username===null&&this.#D("entries")})}async#X(e){const t=e.detail?.name;if(!t)return;const s=nr(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:n}=await j();if(!(i==="off"||!n))try{const o=await fetch("/api/folderfoo/resolve-open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,tenantId:L,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#me(e){const{path:t,action:s,newPath:i}=e.detail??{};if(!(t===void 0||!s)){if((s==="rename"||s==="move")&&i){const{folderfooHost:n}=await j();if(!n)return;try{await fetch("/api/folders/renamed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:n,oldPath:t,newPath:i})})}catch{}}this.#L()}}#ie(){return this.shadowRoot?.querySelector("app-toolbar")?.shadowRoot?.querySelector(".folderfoo-slot")??null}#re(e){const t=document.createElement("folderfoo-profile-circle");t.setAttribute("app-name","Memory Bucket"),t.setAttribute("tenant-id",L),t.style.zoom="0.875",e.appendChild(t)}async#ve(){const e=this.#ie();if(!e||e.querySelector("folderfoo-profile-circle"))return;if(_t){this.#re(e);return}if(e.hasAttribute("data-ff-attempted"))return;e.setAttribute("data-ff-attempted","");const{folderfooMode:t,folderfooHost:s}=await j();t==="off"||!s||re(()=>import(`${s}/elements/folderfoo-profile-circle.js`),[]).then(async()=>{_t=!0,await this.updateComplete;const i=this.#ie();i&&!i.querySelector("folderfoo-profile-circle")&&this.#re(i)}).catch(i=>{console.warn("folderfoo-profile-circle unavailable:",i.message)})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("focus",this.#F),document.removeEventListener("visibilitychange",this.#F),document.removeEventListener("folderfoo-file-open",this.#O),document.removeEventListener("folderfoo-folder-changed",this.#V),window.removeEventListener("folderfoo-auth-change",this.#G),this.#W?.()}async#ne(){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 j();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#oe(){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.#d(),this.#A(),this.#L(),this.renderRoot.querySelector("detail-panel")?.refresh?.()}}async#d(){const e=this.#Y.value;history.replaceState(null,"",e?`#${e}`:location.pathname+location.search);const t=await fetch(`/api/entries?${e}`);this.#p.set(await t.json()),this.renderRoot.querySelector("result-list")?.scrollTo(0,0),this.#f.value==="folder-view"&&this.#ae()}async#ae(){const e=await fetch(`/api/entries?${this.#U.value}`);this.#T.set(await e.json())}async#A(){const e=this.#s.value==="all"?"":`?type=${this.#s.value}`,t=await fetch(`/api/facets${e}`);this.#l.set(await t.json())}async#L(){const t=await(await fetch("/api/folders")).json();this.#a.set(t),this.#u.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.#d());const n=this.#i.value;if(n){const o=this.#fe().get(n.id);o&&!s.has(o.folder)&&this.#i.set(null)}}#D(e){this.#f.set(e),e==="channels"?this.#ce():e==="folder-view"?this.#ae():e==="shared"&&(this.#Z(),this.#le())}async#Z(){const e=await fetch("/api/shared-items");this.#P.set(e.ok?await e.json():[])}async#le(){this.#z.set(!0);try{const e=await fetch("/api/shared-items/refresh",{method:"POST"});e.ok&&this.#I.set(await e.json()),await this.#Z()}finally{this.#z.set(!1)}}async#xe(e){await fetch(`/api/shared-items/${encodeURIComponent(e)}`,{method:"DELETE"}),await this.#Z()}#ye(e){e.entryId&&(this.#i.set({table:e.kind==="skill"?"skills":"memory_docs",id:e.entryId}),this.#D("entries"))}async#ke(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.#D("shared")}async#$e(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.#d(),{ok:!0,message:`Copied into "${t}".`}):{ok:!1,message:i.error||`Fork failed (${s.status}).`}}async#ce(){const e=await fetch("/api/channels");this.#E.set(await e.json()),this.#S.value&&this.#de(this.#S.value)}async#de(e){this.#S.set(e),this.#C.set(!0);try{const t=await fetch(`/api/channels/${encodeURIComponent(e)}`);this.#R.set(t.ok?await t.json():null)}finally{this.#C.set(!1)}}#we(e){const t=this.#r.value;this.#r.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#d()}async#_e(e,t){if(t.stopPropagation(),window.prompt(`Type "${e.name}" to remove this ${e.kind} folder (files on disk are untouched):`)===e.name){this.#v.set(e.name);try{await fetch(`/api/folders/${e.kind}/${encodeURIComponent(e.name)}`,{method:"DELETE"}),this.#r.set(this.#r.value.filter(i=>i!==e.name)),await Promise.all([this.#L(),this.#A(),this.#d()])}finally{this.#v.set("")}}}#he(e){this.#g.set(!1),this.#L(),this.#A(),this.#d(),e&&alert(e)}#te(){return[...this.#a.value.skill,...this.#a.value.memory].sort((e,t)=>Number(e.remote)-Number(t.remote))}#pe(e){this.#s.set(e),this.#n.set([]),this.#A(),this.#d()}#Se(e){const t=this.#n.value;this.#n.set(t.includes(e)?t.filter(s=>s!==e):[...t,e]),this.#d()}#Ce(e){this.#n.value.includes(e)||this.#n.set([...this.#n.value,e]),this.#d()}#Te(e){this.#r.value.includes(e)||this.#r.set([...this.#r.value,e]),this.#d()}#ue(e){this.#x.set(e),this.#$.set(e),this.#d()}#Ae(e){this.#t.set(e.target.value),this.#d()}#j(e){this.#t.set(e),this.#d()}#Ee(){this.#t.set(""),this.#d()}#Re(e){this.#i.set({table:e._table,id:e.id})}#Pe(e){this.#w.set(e.target.value),this.#d()}#ze(e){this.#m.set(e.target.value),this.#d()}#Ie(e){this.#c.set(e.target.value),this.#d()}#Le(e){this.#x.set(e.target.value),this.#d()}#Fe(e){this.#$.set(e.target.value),this.#d()}#Oe(){this.#x.set(""),this.#$.set(""),this.#d()}#De(e){const t=new Set(this.#h.value);t.has(e.id)?t.delete(e.id):t.add(e.id),this.#h.set(t)}#fe(){return new Map(this.#p.value.map(e=>[e.id,e]))}#se(){const e=new Map,t=this.#fe();for(const s of this.#h.value){const i=t.get(s);if(!i)continue;const n=e.get(i._table)??[];n.push(s),e.set(i._table,n)}return e}async#ge(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/deprecated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,deprecated:e})}))),this.#h.set(new Set),await this.#d()}async#be(e){const t=this.#se();await Promise.all([...t.entries()].map(([s,i])=>fetch(`/api/entries/${s}/bulk/paused`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:i,paused:e})}))),this.#h.set(new Set),await this.#d()}async#Ne(){if(!window.confirm(`Delete ${this.#h.value.size} doc(s)? This can't be undone.`))return;const e=this.#se();await Promise.all([...e.entries()].map(([t,s])=>fetch(`/api/entries/${t}/bulk/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:s})}))),this.#h.set(new Set),await this.#d()}#Me(){const e=this.#f.value!=="channels"&&this.#f.value!=="shared"&&this.#u.value&&this.#te().length>0,t=ie.value.username!==null||this.#P.value.length>0;return l`
|
|
2291
2317
|
<app-toolbar
|
|
2292
2318
|
.showReindex=${e}
|
|
2293
2319
|
.reindexing=${this.#_.value}
|
|
@@ -2296,13 +2322,13 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2296
2322
|
.showShared=${t}
|
|
2297
2323
|
.sharedActive=${this.#f.value==="shared"}
|
|
2298
2324
|
.theme=${this.#y.value}
|
|
2299
|
-
.onReindex=${()=>this.#
|
|
2325
|
+
.onReindex=${()=>this.#B()}
|
|
2300
2326
|
.onToggleChannels=${()=>this.#D(this.#f.value==="channels"?"entries":"channels")}
|
|
2301
2327
|
.onToggleFolderView=${()=>this.#D(this.#f.value==="folder-view"?"entries":"folder-view")}
|
|
2302
2328
|
.onToggleShared=${()=>this.#D(this.#f.value==="shared"?"entries":"shared")}
|
|
2303
|
-
.onCycleTheme=${()=>this.#
|
|
2329
|
+
.onCycleTheme=${()=>this.#Q()}
|
|
2304
2330
|
></app-toolbar>
|
|
2305
|
-
`}updated(){this.#ve()}render(){return l` <div class="header-toolbar">${this.#Me()}</div>${this.#Ue()} `}#Ue(){const e=this.#l.value,t=this.#
|
|
2331
|
+
`}updated(){this.#ve()}render(){return l` <div class="header-toolbar">${this.#Me()}</div>${this.#Ue()} `}#Ue(){const e=this.#l.value,t=this.#te();return this.#f.value==="shared"?l`
|
|
2306
2332
|
<div class="toolbar-bar"></div>
|
|
2307
2333
|
<shared-with-me-panel
|
|
2308
2334
|
.items=${this.#P.value}
|
|
@@ -2332,9 +2358,9 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2332
2358
|
.facets=${e}
|
|
2333
2359
|
.typeFilter=${this.#s.value}
|
|
2334
2360
|
.onTypeChange=${s=>this.#pe(s)}
|
|
2335
|
-
.onChanged=${()=>{this.#
|
|
2361
|
+
.onChanged=${()=>{this.#d(),this.#A()}}
|
|
2336
2362
|
.onDateClick=${s=>this.#ue(s)}
|
|
2337
|
-
.onKeyClick=${s=>this.#
|
|
2363
|
+
.onKeyClick=${s=>this.#j(s)}
|
|
2338
2364
|
></folder-view>
|
|
2339
2365
|
`:this.#u.value&&t.length===0&&!this.#g.value?l`
|
|
2340
2366
|
<div class="toolbar-bar"></div>
|
|
@@ -2461,7 +2487,7 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2461
2487
|
${St.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
|
|
2462
2488
|
</select>
|
|
2463
2489
|
<span class="filter-label">Paused:</span>
|
|
2464
|
-
<select .value=${this.#
|
|
2490
|
+
<select .value=${this.#c.value} @change=${s=>this.#Ie(s)}>
|
|
2465
2491
|
${St.map(s=>l`<option value=${s.value}>${s.label}</option>`)}
|
|
2466
2492
|
</select>
|
|
2467
2493
|
</div>
|
|
@@ -2485,20 +2511,22 @@ This removes the doc's key, tags, and status — it drops out of key-based looku
|
|
|
2485
2511
|
.onSelect=${s=>this.#Re(s)}
|
|
2486
2512
|
.selectedIds=${this.#h.value}
|
|
2487
2513
|
.onToggleSelect=${s=>this.#De(s)}
|
|
2488
|
-
.onKeyClick=${s=>this.#
|
|
2514
|
+
.onKeyClick=${s=>this.#j(s)}
|
|
2515
|
+
.onGroupClick=${s=>this.#j(s)}
|
|
2489
2516
|
></result-list>
|
|
2490
2517
|
<div
|
|
2491
2518
|
class="splitter ${this.#k.value?"dragging":""}"
|
|
2492
|
-
@pointerdown=${s=>this.#
|
|
2519
|
+
@pointerdown=${s=>this.#H(s)}
|
|
2493
2520
|
></div>
|
|
2494
2521
|
<detail-panel
|
|
2495
2522
|
.selected=${this.#i.value}
|
|
2496
2523
|
.facets=${e}
|
|
2497
|
-
.onChanged=${()=>{this.#
|
|
2524
|
+
.onChanged=${()=>{this.#d(),this.#A()}}
|
|
2498
2525
|
.onTagClick=${s=>this.#Ce(s)}
|
|
2499
2526
|
.onFolderClick=${s=>this.#Te(s)}
|
|
2500
2527
|
.onDateClick=${s=>this.#ue(s)}
|
|
2501
|
-
.onKeyClick=${s=>this.#
|
|
2528
|
+
.onKeyClick=${s=>this.#j(s)}
|
|
2529
|
+
.onGroupClick=${s=>this.#j(s)}
|
|
2502
2530
|
.onGone=${()=>this.#i.set(null)}
|
|
2503
2531
|
></detail-panel>
|
|
2504
2532
|
</div>
|