@inkeep/open-knowledge 0.29.1-beta.0 → 0.30.0-beta.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/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/assets/skills/write-skill/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-WwSYoAhh.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BYvS_cgc.mjs +1 -0
- package/dist/{init-D18QuTVY.mjs → init-BoNJQ0RQ.mjs} +3 -3
- package/dist/{loader-oAPsRlLu.mjs → loader-Bu_CIw6G.mjs} +2 -2
- package/dist/loader-LvQJaM9_.mjs +1 -0
- package/dist/{preview-DafkLCTV.mjs → preview-CrxTN9jZ.mjs} +2 -2
- package/dist/preview-Gb5GqloB.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-CbZqvb_A.js → ActivityModeContent-5_bqDHKH.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-BztfvSJa.js → CodeMirrorPropInput-BseWsWBZ.js} +2 -2
- package/dist/public/assets/{DocumentContext-DZcMx7fa.js → DocumentContext-CJECYBYb.js} +2 -2
- package/dist/public/assets/{EnableSyncConfirmDialog-HrN6822q.js → EnableSyncConfirmDialog-J2fWLuKx.js} +1 -1
- package/dist/public/assets/{GraphPanel-CjZ-1di7.js → GraphPanel-D-EeiCv_.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-PioGnkt4.js → ManagedArtifactProperties-BrMSVlga.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-wX2uMFi1.js → MermaidDocEditor-LaRaKhRV.js} +1 -1
- package/dist/public/assets/{PropertyPanel-BWc1WL_7.js → PropertyPanel-DDXKhF6k.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-CKvf-ve4.js → SettingsDialogBody-Bfut9hkr.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-D2gqyxrq.js → ShareReceiveMissDialog-CysnnPRz.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-DWcvLtye.js → SkillEditorActions-B0MNz80x.js} +1 -1
- package/dist/public/assets/{SourceEditor-huOeP2VE.js → SourceEditor-B663Yw8O.js} +1 -1
- package/dist/public/assets/{TerminalPanel-D0lg824P.js → TerminalPanel-D6hQKvpb.js} +37 -37
- package/dist/public/assets/{auth-state-cache-B8olfOAk.js → auth-state-cache-DJAi3NoE.js} +1 -1
- package/dist/public/assets/{config-provider-Cpc4mCc5.js → config-provider-DptJpHL2.js} +1 -1
- package/dist/public/assets/{dist-B3cFd6-R.js → dist-CMWIIV76.js} +1 -1
- package/dist/public/assets/documents-fetch-oup83IZh.js +1 -0
- package/dist/public/assets/file-tree-adapter-BrTWXp63.js +1 -0
- package/dist/public/assets/{index-Dh9q-MJv.js → index-gPUerME8.js} +10 -10
- package/dist/public/assets/navigation-targets-B4NGITKp.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-DEPmVkDy.js → open-managed-artifact-tab-D20KCZaE.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-C8dcyMzt.js → pending-receive-nav-store-CHWJDSOf.js} +1 -1
- package/dist/public/assets/{prop-types-Cktxy2Ty.js → prop-types-Ci7AGShX.js} +1 -1
- package/dist/public/assets/{selection-context-BV4d2iWa.js → selection-context-BoRyg1Sb.js} +1 -1
- package/dist/public/assets/{skill-actions-UtDN9_sZ.js → skill-actions-CW-DAvgj.js} +1 -1
- package/dist/public/assets/{skills-api-CmDm6eQu.js → skills-api-DhQjjD9F.js} +1 -1
- package/dist/public/assets/{src-DgbhCjBm.js → src-B1E05HAZ.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-Dzc6XGok.js → target-navigation-intent-DSkE5CGB.js} +1 -1
- package/dist/public/assets/{telemetry-impl-kX0htzfi.js → telemetry-impl-CSONG7_p.js} +1 -1
- package/dist/public/assets/{telemetry-startup-CCtOwEyz.js → telemetry-startup-BK7tF5N1.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DBgbqLL7.js → typing-burst-detector-0adggLGY.js} +1 -1
- package/dist/public/index.html +20 -20
- package/dist/{repair-launch-json-CairrcUd.mjs → repair-launch-json-B5iZEpFW.mjs} +2 -2
- package/dist/{repair-mcp-configs-CgDKMDm9.mjs → repair-mcp-configs-DqSXFZsw.mjs} +2 -2
- package/dist/{src-BLuXFtmN.mjs → src-cDAswqAJ.mjs} +2 -2
- package/dist/{start-9p7W2Map.mjs → start-C8xPgt3v.mjs} +2 -2
- package/dist/start-D3VXyjQg.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-CsthzzGt.mjs +0 -2
- package/dist/init-CP0-JkHq.mjs +0 -1
- package/dist/loader-B7muFID-.mjs +0 -1
- package/dist/preview-BFWSs5Y3.mjs +0 -1
- package/dist/public/assets/documents-fetch-DqIXnUVU.js +0 -1
- package/dist/public/assets/file-tree-adapter-CZb_x9ou.js +0 -1
- package/dist/public/assets/navigation-targets-PfRiZDK9.js +0 -1
- package/dist/start-BkGeL3eP.mjs +0 -1
- /package/dist/public/assets/{documents-events-D9ifI_ZN.js → documents-events-kyp3S2Nf.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M as e,N as t,j as n}from"./CodeMirrorPropInput-
|
|
1
|
+
import{M as e,N as t,j as n}from"./CodeMirrorPropInput-BseWsWBZ.js";import{$ as r,At as i,Bt as a,Dt as o,E as s,Et as c,Ft as l,Ht as u,J as d,Mt as f,N as p,Ot as m,Pt as h,Q as ee,Rt as te,Ut as ne,X as g,_ as re,_t as _,ct as ie,dt as ae,et as oe,f as se,gt as ce,ht as le,l as ue,lt as de,mt as fe,nt as pe,ot as me,rt as v,st as he,tt as ge,ut as _e,wt as y,y as ve,yt as b,zt as ye}from"./dist-Dot7Y1W_.js";import{i as be,n as xe,o as Se,r as Ce}from"./dist-BzxczcQx.js";var we=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,x=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(we(e)):we,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ne(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ye(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(x.prototype[Symbol.iterator]=function(){return this});var Te={from:-1,to:-1,match:/.*/.exec(``)},S=`gm`+(/x/.unicode==null?``:`u`),Ee=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Te,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new De(e,t,n,r,i);this.re=new RegExp(t,S+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=T(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=T(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},C=new WeakMap,w=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},De=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Te,this.matchPos=T(e,r),this.re=new RegExp(t,S+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=w.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=T(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=w.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ee.prototype[Symbol.iterator]=De.prototype[Symbol.iterator]=function(){return this});function Oe(e){try{return new RegExp(e,S),!0}catch{return!1}}function T(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ke=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=ce(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,l,u]=i,d=l?+l.slice(1):0,f=s?+s:a.number;if(s&&u){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),m=c.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[r,g.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},Ae={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},E=m.define({combine(e){return a(e,Ae,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function je(e){let t=[Le,Ie];return e&&t.push(E.of(e)),t}var Me=d.mark({class:`cm-selectionMatch`}),Ne=d.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Pe(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=y.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=y.Word)}function Fe(e,t,n,r){return e(t.sliceDoc(n,n+1))==y.Word&&e(t.sliceDoc(r-1,r))==y.Word}var Ie=ee.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(E),{state:n}=e,r=n.selection;if(r.ranges.length>1)return d.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return d.none;let e=n.wordAt(i.head);if(!e)return d.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return d.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Pe(o,n,i.from,i.to)&&Fe(o,n,i.from,i.to)))return d.none}else if(a=n.sliceDoc(i.from,i.to),!a)return d.none}let s=[];for(let r of e.visibleRanges){let e=new x(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Pe(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(Ne.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Me.range(r,a)),s.length>t.maxMatches))return d.none}}return d.set(s)}},{decorations:e=>e.decorations}),Le=g.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Re=({state:e,dispatch:t})=>{let{selection:n}=e,r=c.create(n.ranges.map(t=>e.wordAt(t.head)||c.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function ze(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new x(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new x(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Be=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Re({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=ze(e,r);return i?(t(e.update({selection:e.selection.addRange(c.range(i.from,i.to),!1),effects:g.scrollIntoView(i.to)})),!0):!1},D=m.define({combine(e){return a(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ct(e),scrollToMatch:e=>g.scrollIntoView(e)})}});function Ve(e){return e?[D.of(e),G]:G}var He=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Oe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
2
|
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ye(this):new Ke(this)}getCursor(e,t=0,n){let r=e.doc?e:o.create({doc:e});return n??=r.doc.length,this.regexp?k(this,r,t,n):O(this,r,t,n)}},Ue=class{constructor(e){this.spec=e}};function We(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function O(e,t,n,r){let i;return e.wholeWord&&(i=Ge(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=We(e.test,t,i)),new x(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Ge(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(A(i,n-a))!=y.Word||t(j(i,n-a))!=y.Word)&&(t(j(i,r-a))!=y.Word||t(A(i,r-a))!=y.Word))}var Ke=class extends Ue{constructor(e){super(e)}nextMatch(e,t,n){let r=O(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=O(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=O(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=O(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=O(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function qe(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function k(e,t,n,r){let i;return e.wholeWord&&(i=Je(t.charCategorizer(t.selection.main.head))),e.test&&(i=qe(e.test,t,i)),new Ee(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function A(e,t){return e.slice(u(e,t,!1),t)}function j(e,t){return e.slice(t,u(e,t))}function Je(e){return(t,n,r)=>!r[0].length||(e(A(r.input,r.index))!=y.Word||e(j(r.input,r.index))!=y.Word)&&(e(j(r.input,r.index+r[0].length))!=y.Word||e(A(r.input,r.index+r[0].length))!=y.Word)}var Ye=class extends Ue{nextMatch(e,t,n){let r=k(this.spec,e,n,e.doc.length).next();return r.done&&(r=k(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=k(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=k(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=k(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},M=h.define(),N=h.define(),P=l.define({create(e){return new F(B(e).create(),null)},update(e,t){for(let n of t.effects)n.is(M)?e=new F(n.value.create(),e.panel):n.is(N)&&(e=new F(e.query,n.value?z:null));return e},provide:e=>_.from(e,e=>e.panel)}),F=class{constructor(e,t){this.query=e,this.panel=t}},Xe=d.mark({class:`cm-searchMatch`}),Ze=d.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Qe=ee.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(P))}update(e){let t=e.state.field(P);(t!=e.startState.field(P)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return d.none;let{view:n}=this,r=new f;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Ze:Xe)})}return r.finish()}},{decorations:e=>e.decorations});function I(e){return t=>{let n=t.state.field(P,!1);return n&&n.query.spec.valid?e(t,n):at(t)}}var L=I((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=c.single(r.from,r.to),a=e.state.facet(D);return e.dispatch({selection:i,effects:[W(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),it(e),!0}),R=I((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=c.single(i.from,i.to),o=e.state.facet(D);return e.dispatch({selection:a,effects:[W(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),it(e),!0}),$e=I((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:c.create(n.map(e=>c.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),et=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new x(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(c.range(t.value.from,t.value.to))}return t(e.update({selection:c.create(a,o),userEvent:`select.search.matches`})),!0},tt=I((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],l,u,d=[];o.from==r&&o.to==i&&(u=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:u}),o=t.nextMatch(n,o.from,o.to),d.push(g.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let f=e.state.changes(s);return o&&(l=c.single(o.from,o.to).map(f),d.push(W(e,o)),d.push(n.facet(D).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:`input.replace`}),!0}),nt=I((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:g.announce.of(r),userEvent:`input.replace.all`}),!0});function z(e){return e.state.facet(D).createPanel(e)}function B(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(D);return new He({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function rt(e){let t=v(e,z);return t&&t.dom.querySelector(`[main-field]`)}function it(e){let t=rt(e);t&&t==e.root.activeElement&&t.select()}var at=e=>{let t=e.state.field(P,!1);if(t&&t.panel){let n=rt(e);if(n&&n!=e.root.activeElement){let r=B(e.state,t.query.spec);r.valid&&e.dispatch({effects:M.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[N.of(!0),t?M.of(B(e.state,t.query.spec)):h.appendConfig.of(G)]});return!0},ot=e=>{let t=e.state.field(P,!1);if(!t||!t.panel)return!1;let n=v(e,z);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:N.of(!1)}),!0},st=[{key:`Mod-f`,run:at,scope:`editor search-panel`},{key:`F3`,run:L,shift:R,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:L,shift:R,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:ot,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:et},{key:`Mod-Alt-g`,run:ke},{key:`Mod-d`,run:Be,preventDefault:!0}],ct=class{constructor(e){this.view=e;let t=this.query=e.state.field(P).query.spec;this.commit=this.commit.bind(this),this.searchField=b(`input`,{value:t.search,placeholder:V(e,`Find`),"aria-label":V(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=b(`input`,{value:t.replace,placeholder:V(e,`Replace`),"aria-label":V(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=b(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=b(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=b(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return b(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=b(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>L(e),[V(e,`next`)]),n(`prev`,()=>R(e),[V(e,`previous`)]),n(`select`,()=>$e(e),[V(e,`all`)]),b(`label`,null,[this.caseField,V(e,`match case`)]),b(`label`,null,[this.reField,V(e,`regexp`)]),b(`label`,null,[this.wordField,V(e,`by word`)]),...e.state.readOnly?[]:[b(`br`),this.replaceField,n(`replace`,()=>tt(e),[V(e,`replace`)]),n(`replaceAll`,()=>nt(e),[V(e,`replace all`)])],b(`button`,{name:`close`,onclick:()=>ot(e),"aria-label":V(e,`close`),type:`button`},[`×`])])}commit(){let e=new He({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:M.of(e)}))}keydown(e){le(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?R:L)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),tt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(M)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(D).top}};function V(e,t){return e.state.phrase(t)}var H=30,U=/[\s\.,:;?!]/;function W(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-H),o=Math.min(i,n+H),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<H;e++)if(!U.test(s[e+1])&&U.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-H;e--)if(!U.test(s[e-1])&&U.test(s[e])){s=s.slice(0,e);break}}return g.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var lt=g.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),G=[P,i.low(Qe),lt],ut=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},K=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(Z).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new f,s=[],c=0,l=r.doc.iter(),u=0,p=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>p)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,p);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==p))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=Ot(s);if(i)o.add(n,n,d.widget({widget:new Ct(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,d.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==p)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let m=o.finish();return new e(m,n,q(m))}};function q(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new ut(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new ut(r.from,n,r.diagnostic)}),r}function dt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Z).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(J))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function ft(e,t){return e.field(X,!1)?t:t.concat(h.appendConfig.of(kt))}var J=h.define(),Y=h.define(),pt=h.define(),X=l.define({create(){return new K(d.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=q(n,e.selected.diagnostic,i)||q(n,null,i)}!n.size&&i&&t.state.facet(Z).autoPanel&&(i=null),e=new K(n,i,r)}for(let n of t.effects)if(n.is(J)){let r=t.state.facet(Z).autoPanel?n.value.length?Q.open:null:e.panel;e=K.init(n.value,r,t.state)}else n.is(Y)?e=new K(e.diagnostics,n.value?Q.open:null,e.selected):n.is(pt)&&(e=new K(e.diagnostics,e.panel,n.value));return e},provide:e=>[_.from(e,e=>e.panel),g.decorations.from(e,e=>e.diagnostics)]}),mt=d.mark({class:`cm-lintRange cm-lintRange-active`});function ht(e,t,n){let{diagnostics:r}=e.state.field(X),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(Z).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:gt(e,i)}}}:null}function gt(e,t){return b(`ul`,{class:`cm-tooltip-lint`},t.map(t=>St(e,t,!1)))}var _t=e=>{let t=e.state.field(X,!1);(!t||!t.panel)&&e.dispatch({effects:ft(e.state,[Y.of(!0)])});let n=v(e,Q.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},vt=e=>{let t=e.state.field(X,!1);return!t||!t.panel?!1:(e.dispatch({effects:Y.of(!1)}),!0)},yt=[{key:`Mod-Shift-m`,run:_t,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(X,!1);if(!t)return!1;let n=e.state.selection.main,r=q(t.diagnostics,null,n.to+1);return!r&&(r=q(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],Z=m.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...a(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:bt,tooltipFilter:bt,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function bt(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function xt(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function St(e,t,n){let r=n?xt(t.actions):[];return b(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},b(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=q(e.state.field(X).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),b(`u`,s.slice(c,c+1)),s.slice(c+1)];return b(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&b(`div`,{class:`cm-diagnosticSource`},t.source))}var Ct=class extends r{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return b(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},wt=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=St(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},Q=class e{constructor(e){this.view=e,this.items=[],this.list=b(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)vt(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=xt(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=q(this.view.state.field(X).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=b(`div`,{class:`cm-panel-lint`},this.list,b(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>vt(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(X).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(X),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new wt(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new wt(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=q(this.view.state.field(X).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:pt.of(t)})}static open(t){return new e(t)}};function Tt(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function $(e){return Tt(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var Et=g.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:$(`#d11`)},".cm-lintRange-warning":{backgroundImage:$(`orange`)},".cm-lintRange-info":{backgroundImage:$(`#999`)},".cm-lintRange-hint":{backgroundImage:$(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function Dt(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function Ot(e){let t=`hint`,n=1;for(let r of e){let e=Dt(r.severity);e>n&&(n=e,t=r.severity)}return t}var kt=[X,g.decorations.compute([X],e=>{let{selected:t,panel:n}=e.field(X);return!t||!n||t.from==t.to?d.none:d.set([mt.range(t.from,t.to)])}),de(ht,{hideOn:dt}),Et],At=[ae(),he(),ie(),e(),re(),ge(),pe(),o.allowMultipleSelections.of(!0),s(),p(se,{fallback:!0}),ue(),Ce(),xe(),fe(),oe(),me(),je(),_e.of([...be,...n,...st,...t,...ve,...Se,...yt])];ie(),e(),ge(),p(se,{fallback:!0}),_e.of([...n,...t]);export{Ve as n,At as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=null;function t(){if(e)return e;let t=(async()=>{let e=await fetch(`/api/documents`),t=await e.json().catch(e=>(console.warn(`[documents-fetch] /api/documents response was not valid JSON:`,e),null));return{ok:e.ok,status:e.status,body:t}})();return e=t,t.then(()=>{e===t&&(e=null)},()=>{e===t&&(e=null)}),t}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Hi as e,Ui as t}from"./dist-Chq5t0fA.js";import{t as n}from"./file-tree-rename-validation-DeKIxKnc.js";import{_ as r,g as i,h as a,i as o}from"./navigation-targets-B4NGITKp.js";import{c as s,o as c,s as l}from"./doc-hash-KNy1saqI.js";var u=`application/x-open-knowledge-sidebar-item+json`,d={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function f(e){return JSON.stringify(e)}function p(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:s(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:c(e.assetPath)}:{target:o(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:l(e.docName)}}function m(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(u);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!h(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!g(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e){return typeof e==`string`&&Object.hasOwn(d,e)}var _={background:`#171717`,foreground:`#e5e5e5`,cursor:`#e5e5e5`,cursorAccent:`#171717`,selectionBackground:`#3a3d41`,black:`#000000`,red:`#cd3131`,green:`#0dbc79`,yellow:`#e5e510`,blue:`#2472c8`,magenta:`#bc3fbc`,cyan:`#11a8cd`,white:`#e5e5e5`,brightBlack:`#666666`,brightRed:`#f14c4c`,brightGreen:`#23d18b`,brightYellow:`#f5f543`,brightBlue:`#3b8eea`,brightMagenta:`#d670d6`,brightCyan:`#29b8db`,brightWhite:`#ffffff`},v={background:`#ffffff`,foreground:`#262626`,cursor:`#262626`,cursorAccent:`#ffffff`,selectionBackground:`#add6ff`,black:`#000000`,red:`#cd3131`,green:`#00bc00`,yellow:`#949800`,blue:`#0451a5`,magenta:`#bc05bc`,cyan:`#0598bc`,white:`#555555`,brightBlack:`#666666`,brightRed:`#cd3131`,brightGreen:`#14ce14`,brightYellow:`#b5ba00`,brightBlue:`#0451a5`,brightMagenta:`#bc05bc`,brightCyan:`#0598bc`,brightWhite:`#a5a5a5`};function y(e){return e===`dark`?_:v}var b=`.md`,x=/\.(md|mdx)$/i;function S(t,n=b){return x.test(t)||e(t)?t:`${t}${n}`}function C(e){return Q(e).replace(x,``)}function w(e,t){let n=Q(e),r=t.find(e=>i(e)&&T(e)===n);if(r)return r.docName;let a=C(n);return t.find(e=>{let t=T(e);return t!==n&&x.test(t)&&C(t)===a})&&x.test(n)?n:a}function T(e){return r(e)?O(e.path):a(e)?e.path:S(e.docName,e.docExt)}function E(e){let t=Q(e).match(x);return t?`.${t[1].toLowerCase()}`:void 0}function D(e){return Q(e)}function O(e){let t=Q(e.trim());return t?`${t}/`:``}function k(e){return e.endsWith(`/`)?D(e):C(e)}function A(e){return e.map(T)}function j(e){return[...e].sort().join(`\0`)}function M(e){return j(A(e))}function N(e){let t=new Set;for(let n of e){let e=(r(n)||a(n)?n.path:n.docName).split(`/`).filter(Boolean);if(e.includes(`.ok`))continue;if(r(n)){let e=O(n.path);e&&t.add(e)}let i=r(n)?e.length:e.length-1;for(let n=1;n<=i;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function P(e){if(!e)return[];let t=Q(e.replace(x,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function F(e,t,n){let r=E(e);if(r)return r;let a=n.find(e=>i(e)&&e.docName===t);return a?a.docExt??b:Z(e).includes(`.`)?void 0:b}function I(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),o=t.filter(e=>{if(!a(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return o.length===1?o[0].path:null}function L(e,t,n){if(E(e))return null;let r=n.find(e=>a(e)&&e.path===t);return r?r.path:Z(e).includes(`.`)?t:I(t,n)}function R(e,t){let n=e.kind===`directory`,r=n?D(e.path):w(e.path,t);if(n)return{kind:`folder`,name:Q(Z(e.path)).replace(x,``),path:r,treePath:B(e.path,!0)};let i=L(e.path,r,t);if(i)return{kind:`asset`,name:Q(Z(i)),path:i,treePath:i};let a=F(e.path,r,t);return{kind:`file`,name:Q(Z(e.path)).replace(x,``),path:r,treePath:B(e.path,!1),docExt:a}}function z(e){return e.kind===`directory`?D(e.path):e.path}function B(e,t){return t?O(e):x.test(e)?e:`${e}${b}`}function V(e,t,n){let r=O(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${b}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function H(e,t){return e===`file`?B(t,!1):`${D(t)}/index${b}`}function U(e,t){return t.kind===`root`||t.directoryPath==null?Z(e):`${t.directoryPath}${Z(e)}`}function W(e,t){if(t)return D(O(e));let n=C(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function G(e,t){let n=D(O(e));return n?`${n}/${t}`:t}function K(e,t,n){e.append(`parentDocName`,G(t,n)),e.append(`placement`,`parent-dir`)}function q(e,t){return(t.path??G(e,t.src)).replace(/^\/+/,``)}function J(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function Y(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function X(e,r){let i=n(e).toLowerCase();if(i===``)return null;let a=new Date().toISOString();if(i===`.md`||i===`.mdx`)return{kind:`document`,docName:C(e),docExt:i,modified:a,size:r.size};let o=i.startsWith(`.`)?i.slice(1):i;return{kind:`asset`,path:e,assetExt:o,mediaKind:t(o),modified:a,size:r.size}}function Z(e){let t=Q(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Q(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{f as A,j as C,u as D,y as E,p as O,R as S,q as T,z as _,H as a,C as b,A as c,T as d,Y as f,W as g,B as h,U as i,m as k,M as l,J as m,N as n,V as o,O as p,P as r,S as s,K as t,X as u,I as v,k as w,w as x,D as y};
|