@openparachute/notes-ui 0.1.1 → 0.1.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/dist/.parachute/info +1 -1
- package/dist/CNAME +1 -0
- package/dist/assets/{Activity-DCz02G45.js → Activity-D45lyieR.js} +1 -1
- package/dist/assets/{AddVault-KGZOIx2j.js → AddVault-CU4XgZVQ.js} +1 -1
- package/dist/assets/{Calendar-CgYUCaSZ.js → Calendar-CWAc8XWz.js} +1 -1
- package/dist/assets/{Capture-YgzRoZZX.js → Capture-D_hhqLiB.js} +2 -2
- package/dist/assets/{NoteEditor-DNYo0bPT.js → NoteEditor-CyY4zLMN.js} +1 -1
- package/dist/assets/NoteNew-0NxE4hzz.js +1 -0
- package/dist/assets/{NoteRenderer-CWW2zAJs.js → NoteRenderer-CbVbDcm6.js} +1 -1
- package/dist/assets/NoteView-COXz1-0X.js +3 -0
- package/dist/assets/{OAuthCallback-5pCjuCLO.js → OAuthCallback-CRL1swoB.js} +1 -1
- package/dist/assets/{PinArchiveButtons-BO3QwhOp.js → PinArchiveButtons-Co9x5XtS.js} +1 -1
- package/dist/assets/{Settings-D8q_-oSw.js → Settings-C04J50qQ.js} +1 -1
- package/dist/assets/{Tags-BQjXsHYG.js → Tags-Ci-07E0X.js} +1 -1
- package/dist/assets/{Today-BZ5ksWIi.js → Today-BhqaiSa2.js} +1 -1
- package/dist/assets/{VaultGraph-mQzbyY3l.js → VaultGraph-DqTqupmq.js} +2 -2
- package/dist/assets/{Vaults-EaMq5ivX.js → Vaults-BzOgFkRm.js} +1 -1
- package/dist/assets/index-RQd3jtWY.js +62 -0
- package/dist/assets/{react-force-graph-2d-CtvMkQ0a.js → react-force-graph-2d-DXfKuqMP.js} +1 -1
- package/dist/assets/{useAttachmentUploader-Du2IiCzJ.js → useAttachmentUploader-NEobOH0b.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/meta.json +2 -2
- package/package.json +12 -6
- package/dist/assets/NoteNew-BWuLHfJV.js +0 -1
- package/dist/assets/NoteView-DR9WYC4s.js +0 -3
- package/dist/assets/index-BF1NxtUe.js +0 -62
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as at,R as xo,p as bo}from"./index-
|
|
1
|
+
import{x as at,R as xo,p as bo}from"./index-RQd3jtWY.js";function wo(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function ko(e,n,r){return n=Eo(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Jn(e,n){return So(e)||wo(e,n)||ui(e,n)||Po()}function Ao(e){return Co(e)||Mo(e)||ui(e)||To()}function Co(e){if(Array.isArray(e))return gn(e)}function So(e){if(Array.isArray(e))return e}function Mo(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ui(e,n){if(e){if(typeof e=="string")return gn(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gn(e,n)}}function gn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function To(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Po(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oo(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Eo(e){var n=Oo(e,"string");return typeof n=="symbol"?n:String(n)}var Ro=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(Ao(Object.entries(n).filter(function(o){var a=Jn(o,1),s=a[0];return!i.has(s)}).map(function(o){var a=Jn(o,2),s=a[0],u=a[1];return ko({},s,u)}))))};function yn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function zo(e){if(Array.isArray(e))return e}function No(e){if(Array.isArray(e))return yn(e)}function Io(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $o(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,a,s,u=[],l=!0,f=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(l=(i=a.call(r)).done)&&(u.push(i.value),u.length!==n);l=!0);}catch(h){f=!0,o=h}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function Do(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as N,r as te,a9 as Kf,M as Jf,c as eu,S as tu}from"./index-
|
|
1
|
+
import{x as N,r as te,a9 as Kf,M as Jf,c as eu,S as tu}from"./index-RQd3jtWY.js";function pS({onDropFiles:r,children:e,className:t,hint:i}){const[n,s]=N.useState(!1),l=N.useRef(0),o=N.useCallback(f=>{Ji(f.dataTransfer)&&(f.preventDefault(),l.current+=1,s(!0))},[]),a=N.useCallback(f=>{Ji(f.dataTransfer)&&(f.preventDefault(),l.current=Math.max(0,l.current-1),l.current===0&&s(!1))},[]),h=N.useCallback(f=>{Ji(f.dataTransfer)&&(f.preventDefault(),f.dataTransfer.dropEffect="copy")},[]),c=N.useCallback(f=>{if(!Ji(f.dataTransfer))return;f.preventDefault(),s(!1),l.current=0;const u=Array.from(f.dataTransfer.files);u.length>0&&r(u)},[r]);return te.jsxs("div",{className:`relative ${t??""}`,onDragEnter:o,onDragLeave:a,onDragOver:h,onDrop:c,children:[e,n?te.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center rounded-md border-2 border-dashed border-accent bg-accent/10 text-sm text-accent",children:te.jsxs("div",{className:"rounded-md bg-bg/80 px-4 py-2 font-medium shadow",children:["Drop to attach",i?te.jsxs("span",{className:"ml-2 text-fg-dim",children:["— ",i]}):null]})}):null]})}function Ji(r){if(!r)return!1;const e=r.types;for(let t=0;t<e.length;t++)if(e[t]==="Files")return!0;return!1}const iu="image/png,image/jpeg,image/gif,image/webp,audio/wav,audio/mpeg,audio/mp4,audio/ogg,audio/webm,video/webm,.wav,.mp3,.m4a,.ogg,.webm,.png,.jpg,.jpeg,.gif,.webp";function gS({onPickFiles:r,label:e="Attach files…",className:t}){const i=N.useRef(null);return te.jsxs(te.Fragment,{children:[te.jsx("button",{type:"button",onClick:()=>{var n;return(n=i.current)==null?void 0:n.click()},className:t??"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",title:"Upload an attachment",children:e}),te.jsx("input",{ref:i,type:"file",multiple:!0,accept:iu,className:"hidden",onChange:n=>{const s=Array.from(n.target.files??[]);s.length>0&&r(s),n.target.value=""}})]})}function mS({uploads:r,onCancel:e,onDismiss:t}){return r.length===0?null:te.jsx("ul",{className:"space-y-2",children:r.map(i=>te.jsxs("li",{className:"rounded-md border border-border bg-card/60 px-3 py-2 text-xs text-fg-muted",children:[te.jsxs("div",{className:"flex items-center justify-between gap-2",children:[te.jsx("span",{className:"truncate font-mono",title:i.filename,children:i.filename}),te.jsx("span",{className:"shrink-0",children:ru(i)})]}),i.status==="uploading"?te.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded bg-border/40",children:te.jsx("div",{className:"h-full bg-accent transition-[width]",style:{width:`${ja(i)}%`}})}):null,i.status==="error"&&i.error?te.jsx("p",{className:"mt-1 text-red-400",children:i.error}):null,te.jsx("div",{className:"mt-1 flex justify-end gap-2 text-xs",children:i.status==="uploading"||i.status==="linking"?te.jsx("button",{type:"button",onClick:()=>e(i.id),className:"text-fg-dim hover:text-fg",children:"Cancel"}):te.jsx("button",{type:"button",onClick:()=>t(i.id),className:"text-fg-dim hover:text-fg",children:"Dismiss"})})]},i.id))})}function ja(r){return r.size===0?0:Math.min(100,Math.round(r.loaded/r.size*100))}function ru(r){switch(r.status){case"uploading":return`${ja(r)}%`;case"linking":return"Linking…";case"done":return"Done";case"cancelled":return"Cancelled";case"error":return"Error"}}let Un=[],za=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<r.length;e++)(e%2?za:Un).push(t=t+r[e])})();function nu(r){if(r<768)return!1;for(let e=0,t=Un.length;;){let i=e+t>>1;if(r<Un[i])t=i;else if(r>=za[i])e=i+1;else return!0;if(e==t)return!1}}function Cl(r){return r>=127462&&r<=127487}const Al=8205;function su(r,e,t=!0,i=!0){return(t?La:lu)(r,e,i)}function La(r,e,t){if(e==r.length)return e;e&&_a(r.charCodeAt(e))&&Ya(r.charCodeAt(e-1))&&e--;let i=dn(r,e);for(e+=Rl(i);e<r.length;){let n=dn(r,e);if(i==Al||n==Al||t&&nu(n))e+=Rl(n),i=n;else if(Cl(n)){let s=0,l=e-2;for(;l>=0&&Cl(dn(r,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function lu(r,e,t){for(;e>0;){let i=La(r,e-2,t);if(i<e)return i;e--}return 0}function dn(r,e){let t=r.charCodeAt(e);if(!Ya(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return _a(i)?(t-55296<<10)+(i-56320)+65536:t}function _a(r){return r>=56320&&r<57344}function Ya(r){return r>=55296&&r<56320}function Rl(r){return r<65536?1:2}class z{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Dt(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Be.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Dt(this,e,t);let i=[];return this.decompose(e,t,i,0),Be.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new mi(this),s=new mi(e);for(let l=t,o=t;;){if(n.next(l),s.next(l),l=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new mi(this,e)}iterRange(e,t=this.length){return new Ea(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Va(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?z.empty:e.length<=32?new J(e):Be.from(J.split(e,[]))}}class J extends z{constructor(e,t=ou(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let l=this.text[s],o=n+l.length;if((t?i:o)>=e)return new au(n,o,i,l);n=o+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new J(Ml(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let l=i.pop(),o=Sr(s.text,l.text.slice(),0,s.length);if(o.length<=32)i.push(new J(o,l.length+s.length));else{let a=o.length>>1;i.push(new J(o.slice(0,a)),new J(o.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);[e,t]=Dt(this,e,t);let n=Sr(this.text,Sr(i.text,Ml(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new J(n,s):Be.from(J.split(n,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=Dt(this,e,t);let n="";for(let s=0,l=0;s<=t&&l<this.text.length;l++){let o=this.text[l],a=s+o.length;s>e&&l&&(n+=i),e<a&&t>s&&(n+=o.slice(Math.max(0,e-s),t-s)),s=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let s of e)i.push(s),n+=s.length+1,i.length==32&&(t.push(new J(i,n)),i=[],n=-1);return n>-1&&t.push(new J(i,n)),t}}class Be extends z{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let s=0;;s++){let l=this.children[s],o=n+l.length,a=i+l.lines-1;if((t?a:o)>=e)return l.lineInner(e,t,i,n);n=o+1,i=a+1}}decompose(e,t,i,n){for(let s=0,l=0;l<=t&&s<this.children.length;s++){let o=this.children[s],a=l+o.length;if(e<=a&&t>=l){let h=n&((l<=e?1:0)|(a>=t?2:0));l>=e&&a<=t&&!h?i.push(o):o.decompose(e-l,t-l,i,h)}l=a+1}}replace(e,t,i){if([e,t]=Dt(this,e,t),i.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let l=this.children[n],o=s+l.length;if(e>=s&&t<=o){let a=l.replace(e-s,t-s,i),h=this.lines-l.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[n]=a,new Be(c,this.length-(t-e)+i.length)}return super.replace(s,o,a)}s=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=Dt(this,e,t);let n="";for(let s=0,l=0;s<this.children.length&&l<=t;s++){let o=this.children[s],a=l+o.length;l>e&&s&&(n+=i),e<a&&t>l&&(n+=o.sliceString(e-l,t-l,i)),l=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Be))return 0;let i=0,[n,s,l,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==l||s==o)return i;let a=this.children[n],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let O of e)i+=O.lines;if(i<32){let O=[];for(let d of e)d.flatten(O);return new J(O,t)}let n=Math.max(32,i>>5),s=n<<1,l=n>>1,o=[],a=0,h=-1,c=[];function f(O){let d;if(O.lines>s&&O instanceof Be)for(let p of O.children)f(p);else O.lines>l&&(a>l||!a)?(u(),o.push(O)):O instanceof J&&a&&(d=c[c.length-1])instanceof J&&O.lines+d.lines<=32?(a+=O.lines,h+=O.length+1,c[c.length-1]=new J(d.text.concat(O.text),d.length+1+O.length)):(a+O.lines>n&&u(),a+=O.lines,h+=O.length+1,c.push(O))}function u(){a!=0&&(o.push(c.length==1?c[0]:Be.from(c,h)),h=-1,a=c.length=0)}for(let O of e)f(O);return u(),o.length==1?o[0]:new Be(o,t)}}z.empty=new J([""],0);function ou(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Sr(r,e,t=0,i=1e9){for(let n=0,s=0,l=!0;s<r.length&&n<=i;s++){let o=r[s],a=n+o.length;a>=t&&(a>i&&(o=o.slice(0,i-n)),n<t&&(o=o.slice(t-n)),l?(e[e.length-1]+=o,l=!1):e.push(o)),n=a+1}return e}function Ml(r,e,t){return Sr(r,[""],e,t)}class mi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof J?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],l=s>>1,o=n instanceof J?n.text.length:n.children.length;if(l==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(n instanceof J){let a=n.text[l+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[l+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof J?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Ea{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new mi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Va{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},mi.prototype[Symbol.iterator]=Ea.prototype[Symbol.iterator]=Va.prototype[Symbol.iterator]=function(){return this});let au=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function Dt(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function he(r,e,t=!0,i=!0){return su(r,e,t,i)}function hu(r){return r>=56320&&r<57344}function cu(r){return r>=55296&&r<56320}function fu(r,e){let t=r.charCodeAt(e);if(!cu(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return hu(i)?(t-55296<<10)+(i-56320)+65536:t}function uu(r){return r<65536?1:2}const Fn=/\r\n?|\n/;var Oe=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Oe||(Oe={}));class Ue{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let s=this.sections[t++],l=this.sections[t++];l<0?(e(i,n,s),n+=s):n+=l,i+=s}}iterChangedRanges(e,t=!1){Hn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];n<0?e.push(i,n):e.push(n,i)}return new Ue(e)}composeDesc(e){return this.empty?e:e.empty?this:Wa(this,e)}mapDesc(e,t=!1){return e.empty?this:Kn(this,e,t)}mapPos(e,t=-1,i=Oe.Simple){let n=0,s=0;for(let l=0;l<this.sections.length;){let o=this.sections[l++],a=this.sections[l++],h=n+o;if(a<0){if(h>e)return s+(e-n);s+=o}else{if(i!=Oe.Simple&&h>=e&&(i==Oe.TrackDel&&n<e&&h>e||i==Oe.TrackBefore&&n<e||i==Oe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!o)return e==n||t<0?s:s+a;s+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let s=this.sections[i++],l=this.sections[i++],o=n+s;if(l>=0&&n<=t&&o>=e)return n<e&&o>t?"cover":!0;n=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ue(e)}static create(e){return new Ue(e)}}class re extends Ue{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Hn(this,(t,i,n,s,l)=>e=e.replace(n,n+(i-t),l),!1),e}mapDesc(e,t=!1){return Kn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n<t.length;n+=2){let l=t[n],o=t[n+1];if(o>=0){t[n]=o,t[n+1]=l;let a=n>>1;for(;i.length<a;)i.push(z.empty);i.push(l?e.slice(s,s+l):z.empty)}s+=l}return new re(t,i)}compose(e){return this.empty?e:e.empty?this:Wa(this,e,!0)}map(e,t=!1){return e.empty?this:Kn(this,e,t,!0)}iterChanges(e,t=!1){Hn(this,e,t)}get desc(){return Ue.create(this.sections)}filter(e){let t=[],i=[],n=[],s=new wi(this);e:for(let l=0,o=0;;){let a=l==e.length?1e9:e[l++];for(;o<a||o==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-o);ae(n,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ae(t,c,f),f>0&&Ot(i,t,s.text),s.forward(c),o+=c}let h=e[l++];for(;o<h;){if(s.done)break e;let c=Math.min(s.len,h-o);ae(t,c,-1),ae(n,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),o+=c}}return{changes:new re(t,i),filtered:Ue.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],n=this.sections[t+1];n<0?e.push(i):n==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let n=[],s=[],l=0,o=null;function a(c=!1){if(!c&&!n.length)return;l<t&&ae(n,t-l,-1);let f=new re(n,s);o=o?o.compose(f.map(o)):f,n=[],s=[],l=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof re){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),o=o?o.compose(c.map(o)):c}else{let{from:f,to:u=f,insert:O}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let d=O?typeof O=="string"?z.of(O.split(i||Fn)):O:z.empty,p=d.length;if(f==u&&p==0)return;f<l&&a(),f>l&&ae(n,f-l,-1),ae(n,u-f,p),Ot(s,n,d),l=u}}return h(e),a(!o),o}static empty(e){return new re(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;n<e.length;n++){let s=e[n];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((l,o)=>o&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<n;)i.push(z.empty);i[n]=z.of(s.slice(1)),t.push(s[0],i[n].length)}}}return new re(t,i)}static createSet(e,t){return new re(e,t)}}function ae(r,e,t,i=!1){if(e==0&&t<=0)return;let n=r.length-2;n>=0&&t<=0&&t==r[n+1]?r[n]+=e:n>=0&&e==0&&r[n]==0?r[n+1]+=t:i?(r[n]+=e,r[n+1]+=t):r.push(e,t)}function Ot(r,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<i;)r.push(z.empty);r.push(t)}}function Hn(r,e,t){let i=r.inserted;for(let n=0,s=0,l=0;l<r.sections.length;){let o=r.sections[l++],a=r.sections[l++];if(a<0)n+=o,s+=o;else{let h=n,c=s,f=z.empty;for(;h+=o,c+=a,a&&i&&(f=f.append(i[l-2>>1])),!(t||l==r.sections.length||r.sections[l+1]<0);)o=r.sections[l++],a=r.sections[l++];e(n,h,s,c,f),n=h,s=c}}}function Kn(r,e,t,i=!1){let n=[],s=i?[]:null,l=new wi(r),o=new wi(e);for(let a=-1;;){if(l.done&&o.len||o.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&o.ins==-1){let h=Math.min(l.len,o.len);ae(n,h,-1),l.forward(h),o.forward(h)}else if(o.ins>=0&&(l.ins<0||a==l.i||l.off==0&&(o.len<l.len||o.len==l.len&&!t))){let h=o.len;for(ae(n,o.ins,-1);h;){let c=Math.min(l.len,h);l.ins>=0&&a<l.i&&l.len<=c&&(ae(n,0,l.ins),s&&Ot(s,n,l.text),a=l.i),l.forward(c),h-=c}o.next()}else if(l.ins>=0){let h=0,c=l.len;for(;c;)if(o.ins==-1){let f=Math.min(c,o.len);h+=f,c-=f,o.forward(f)}else if(o.ins==0&&o.len<c)c-=o.len,o.next();else break;ae(n,h,a<l.i?l.ins:0),s&&a<l.i&&Ot(s,n,l.text),a=l.i,l.forward(l.len-c)}else{if(l.done&&o.done)return s?re.createSet(n,s):Ue.create(n);throw new Error("Mismatched change set lengths")}}}function Wa(r,e,t=!1){let i=[],n=t?[]:null,s=new wi(r),l=new wi(e);for(let o=!1;;){if(s.done&&l.done)return n?re.createSet(i,n):Ue.create(i);if(s.ins==0)ae(i,s.len,0,o),s.next();else if(l.len==0&&!l.done)ae(i,0,l.ins,o),n&&Ot(n,i,l.text),l.next();else{if(s.done||l.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,l.len),h=i.length;if(s.ins==-1){let c=l.ins==-1?-1:l.off?0:l.ins;ae(i,a,c,o),n&&c&&Ot(n,i,l.text)}else l.ins==-1?(ae(i,s.off?0:s.len,a,o),n&&Ot(n,i,s.textBit(a))):(ae(i,s.off?0:s.len,l.off?0:l.ins,o),n&&!l.off&&Ot(n,i,l.text));o=(s.ins>a||l.ins>=0&&l.len>a)&&(o||i.length>h),s.forward2(a),l.forward(a)}}}}class wi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?z.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?z.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class vt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new vt(i,n,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,i);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,n,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new vt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new b([this.main],0)}addRange(e,t=!0){return b.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,b.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>vt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=i:s.from<i)return b.normalized(e.slice(),t);i=s.to}return new b(e,t)}static cursor(e,t=0,i,n){return vt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(e,t,i,n,s){let l=(i??16777215)<<6|(n==null?7:Math.min(6,n));return!s&&e!=t&&(s=t<e?1:-1),t<e?vt.create(t,e,48|l):vt.create(e,t,(s?s<0?8:16:0)|l)}static normalized(e,t=0){let i=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(i);for(let n=1;n<e.length;n++){let s=e[n],l=e[n-1];if(s.empty?s.from<=l.to:s.from<l.to){let o=l.from,a=Math.max(s.to,l.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?b.range(a,o):b.range(o,a))}}return new b(e,t)}}function Ba(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ds=0;class X{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=Ds++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new X(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Is),!!e.static,e.enables)}of(e){return new Qr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qr(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Is(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}class Qr{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=Ds++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,s=this.id,l=e[s]>>1,o=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[l]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Jn(f,c)){let O=i(f);if(o?!jl(O,f.values[l],n):!n(O,f.values[l]))return f.values[l]=O,1}return 0},reconfigure:(f,u)=>{let O,d=u.config.address[s];if(d!=null){let p=Zr(u,d);if(this.dependencies.every(m=>m instanceof X?u.facet(m)===f.facet(m):m instanceof lt?u.field(m,!1)==f.field(m,!1):!0)||(o?jl(O=i(f),p,n):n(O=i(f),p)))return f.values[l]=p,0}else O=i(f);return f.values[l]=O,1}}}}function jl(r,e,t){if(r.length!=e.length)return!1;for(let i=0;i<r.length;i++)if(!t(r[i],e[i]))return!1;return!0}function Jn(r,e){let t=!1;for(let i of e)Si(r,i)&1&&(t=!0);return t}function Ou(r,e,t){let i=t.map(a=>r[a.id]),n=t.map(a=>a.type),s=i.filter(a=>!(a&1)),l=r[e.id]>>1;function o(a){let h=[];for(let c=0;c<i.length;c++){let f=Zr(a,i[c]);if(n[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)Si(a,h);return a.values[l]=o(a),1},update(a,h){if(!Jn(a,s))return 0;let c=o(a);return e.compare(c,a.values[l])?0:(a.values[l]=c,1)},reconfigure(a,h){let c=Jn(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Is(t,f))return a.values[l]=u,0;let O=o(a);return e.compare(O,u)?(a.values[l]=u,0):(a.values[l]=O,1)}}}const er=X.define({static:!0});class lt{constructor(e,t,i,n,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new lt(Ds++,e.create,e.update,e.compare||((i,n)=>i===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(er).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,n)=>{let s=i.values[t],l=this.updateF(s,n);return this.compareF(s,l)?0:(i.values[t]=l,1)},reconfigure:(i,n)=>{let s=i.facet(er),l=n.facet(er),o;return(o=s.find(a=>a.field==this))&&o!=l.find(a=>a.field==this)?(i.values[t]=o.create(i),1):n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,er.of({field:this,create:e})]}get extension(){return this}}const $t={lowest:4,low:3,default:2,high:1,highest:0};function li(r){return e=>new qa(e,r)}const Ei={highest:li($t.highest),high:li($t.high),default:li($t.default),low:li($t.low),lowest:li($t.lowest)};class qa{constructor(e,t){this.inner=e,this.prec=t}}class Jr{of(e){return new es(this,e)}reconfigure(e){return Jr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class es{constructor(e,t){this.compartment=e,this.inner=t}}class Tr{constructor(e,t,i,n,s,l){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=l,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let n=[],s=Object.create(null),l=new Map;for(let u of du(e,t,l))u instanceof lt?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let o=Object.create(null),a=[],h=[];for(let u of n)o[u.id]=h.length<<1,h.push(O=>u.slot(O));let c=i==null?void 0:i.config.facets;for(let u in s){let O=s[u],d=O[0].facet,p=c&&c[u]||[];if(O.every(m=>m.type==0))if(o[d.id]=a.length<<1|1,Is(p,O))a.push(i.facet(d));else{let m=d.combine(O.map(S=>S.value));a.push(i&&d.compare(m,i.facet(d))?i.facet(d):m)}else{for(let m of O)m.type==0?(o[m.id]=a.length<<1|1,a.push(m.value)):(o[m.id]=h.length<<1,h.push(S=>m.dynamicSlot(S)));o[d.id]=h.length<<1,h.push(m=>Ou(m,d,O))}}let f=h.map(u=>u(o));return new Tr(e,l,f,o,a,s)}}function du(r,e,t){let i=[[],[],[],[],[]],n=new Map;function s(l,o){let a=n.get(l);if(a!=null){if(a<=o)return;let h=i[a].indexOf(l);h>-1&&i[a].splice(h,1),l instanceof es&&t.delete(l.compartment)}if(n.set(l,o),Array.isArray(l))for(let h of l)s(h,o);else if(l instanceof es){if(t.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;t.set(l.compartment,h),s(h,o)}else if(l instanceof qa)s(l.inner,l.prec);else if(l instanceof lt)i[o].push(l),l.provides&&s(l.provides,o);else if(l instanceof Qr)i[o].push(l),l.facet.extensions&&s(l.facet.extensions,$t.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,o)}}return s(r,$t.default),i.reduce((l,o)=>l.concat(o))}function Si(r,e){if(e&1)return 2;let t=e>>1,i=r.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;r.status[t]=4;let n=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|n}function Zr(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const Da=X.define(),ts=X.define({combine:r=>r.some(e=>e),static:!0}),Ia=X.define({combine:r=>r.length?r[0]:void 0,static:!0}),Ga=X.define(),Na=X.define(),Ua=X.define(),Fa=X.define({combine:r=>r.length?r[0]:!1});class ot{constructor(e,t){this.type=e,this.value=t}static define(){return new pu}}class pu{of(e){return new ot(this,e)}}class gu{constructor(e){this.map=e}of(e){return new I(this,e)}}class I{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new I(this.type,t)}is(e){return this.type==e}static define(e={}){return new gu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let s=n.map(t);s&&i.push(s)}return i}}I.reconfigure=I.define();I.appendConfig=I.define();class ie{constructor(e,t,i,n,s,l){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=l,this._doc=null,this._state=null,i&&Ba(i,t.newLength),s.some(o=>o.type==ie.time)||(this.annotations=s.concat(ie.time.of(Date.now())))}static create(e,t,i,n,s,l){return new ie(e,t,i,n,s,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=ot.define();ie.userEvent=ot.define();ie.addToHistory=ot.define();ie.remote=ot.define();function mu(r,e){let t=[];for(let i=0,n=0;;){let s,l;if(i<r.length&&(n==e.length||e[n]>=r[i]))s=r[i++],l=r[i++];else if(n<e.length)s=e[n++],l=e[n++];else return t;!t.length||t[t.length-1]<s?t.push(s,l):t[t.length-1]<l&&(t[t.length-1]=l)}}function Ha(r,e,t){var i;let n,s,l;return t?(n=e.changes,s=re.empty(e.changes.length),l=r.changes.compose(e.changes)):(n=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),l=r.changes.compose(n)),{changes:l,selection:e.selection?e.selection.map(s):(i=r.selection)===null||i===void 0?void 0:i.map(n),effects:I.mapEffects(r.effects,n).concat(I.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function is(r,e,t){let i=e.selection,n=Yt(e.annotations);return e.userEvent&&(n=n.concat(ie.userEvent.of(e.userEvent))),{changes:e.changes instanceof re?e.changes:re.of(e.changes||[],t,r.facet(Ia)),selection:i&&(i instanceof b?i:b.single(i.anchor,i.head)),effects:Yt(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function Ka(r,e,t){let i=is(r,e.length?e[0]:{},r.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let l=!!e[s].sequential;i=Ha(i,is(r,e[s],l?i.changes.newLength:r.doc.length),l)}let n=ie.create(r,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Qu(t?Su(n):n)}function Su(r){let e=r.startState,t=!0;for(let n of e.facet(Ga)){let s=n(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:mu(t,s))}if(t!==!0){let n,s;if(t===!1)s=r.changes.invertedDesc,n=re.empty(e.doc.length);else{let l=r.changes.filter(t);n=l.changes,s=l.filtered.mapDesc(l.changes).invertedDesc}r=ie.create(e,n,r.selection&&r.selection.map(s),I.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let i=e.facet(Na);for(let n=i.length-1;n>=0;n--){let s=i[n](r);s instanceof ie?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ie?r=s[0]:r=Ka(e,Yt(s),!1)}return r}function Qu(r){let e=r.startState,t=e.facet(Ua),i=r;for(let n=t.length-1;n>=0;n--){let s=t[n](r);s&&Object.keys(s).length&&(i=Ha(i,is(e,s,r.changes.newLength),!0))}return i==r?r:ie.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}const bu=[];function Yt(r){return r==null?bu:Array.isArray(r)?r:[r]}var tt=(function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r})(tt||(tt={}));const ku=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let rs;try{rs=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function yu(r){if(rs)return rs.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||ku.test(t)))return!0}return!1}function xu(r){return e=>{if(!/\S/.test(e))return tt.Space;if(yu(e))return tt.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return tt.Word;return tt.Other}}class _{constructor(e,t,i,n,s,l){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,l&&(l._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Si(this,o<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Si(this,i),Zr(this,i)}update(...e){return Ka(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:n}=t;for(let o of e.effects)o.is(Jr.reconfigure)?(t&&(n=new Map,t.compartments.forEach((a,h)=>n.set(h,a)),t=null),n.set(o.value.compartment,o.value.extension)):o.is(I.reconfigure)?(t=null,i=o.value):o.is(I.appendConfig)&&(t=null,i=Yt(i).concat(o.value));let s;t?s=e.startState.values.slice():(t=Tr.resolve(i,n,this),s=new _(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let l=e.startState.facet(ts)?e.newSelection:e.newSelection.asSingle();new _(t,e.newDoc,l,s,(o,a)=>a.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),s=[i.range],l=Yt(i.effects);for(let o=1;o<t.ranges.length;o++){let a=e(t.ranges[o]),h=this.changes(a.changes),c=h.map(n);for(let u=0;u<o;u++)s[u]=s[u].map(c);let f=n.mapDesc(h,!0);s.push(a.range.map(f)),n=n.compose(c),l=I.mapEffects(l,c).concat(I.mapEffects(Yt(a.effects),f))}return{changes:n,selection:b.create(s,t.mainIndex),effects:l}}changes(e=[]){return e instanceof re?e:re.of(e,this.doc.length,this.facet(_.lineSeparator))}toText(e){return z.of(e.split(this.facet(_.lineSeparator)||Fn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Si(this,t),Zr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof lt&&this.config.address[n.id]!=null&&(t[i]=n.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let l=i[s],o=e[s];n.push(l.init(a=>l.spec.fromJSON(o,a)))}}return _.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=Tr.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(_.lineSeparator)||Fn)),n=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Ba(n,i.length),t.staticFacet(ts)||(n=n.asSingle()),new _(t,i,n,t.dynamicSlots.map(()=>null),(s,l)=>l.create(s),null)}get tabSize(){return this.facet(_.tabSize)}get lineBreak(){return this.facet(_.lineSeparator)||`
|
package/dist/index.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
} catch (e) {}
|
|
20
20
|
})();
|
|
21
21
|
</script>
|
|
22
|
-
<script type="module" crossorigin src="./assets/index-
|
|
22
|
+
<script type="module" crossorigin src="./assets/index-RQd3jtWY.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="./assets/index-D_L2igjK.css">
|
|
24
24
|
<link rel="manifest" href="./manifest.webmanifest"></head>
|
|
25
25
|
<body>
|
package/dist/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const o=e=>i(e,r),t={module:{uri:r},exports:a,require:o};s[r]=Promise.all(n.map(e=>t[e]||o(e))).then(e=>(l(...e),a))}}define(["./workbox-b9acee4e"],function(e){"use strict";self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),e.precacheAndRoute([{url:"pwa-64x64.png",revision:"52bb73fe0f7c4274aa55047dc0d5479d"},{url:"pwa-512x512.png",revision:"ebdabf19d41be24e3f47062e89399c09"},{url:"pwa-192x192.png",revision:"ec3f52a07bade7b8a295997c236dac75"},{url:"maskable-icon-512x512.png",revision:"e0d671a48eed68b28f8e7ded8a86ef88"},{url:"manifest.webmanifest",revision:"4e69789fa00f6df17850c3426d2041a9"},{url:"index.html",revision:"
|
|
1
|
+
if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const o=e=>i(e,r),t={module:{uri:r},exports:a,require:o};s[r]=Promise.all(n.map(e=>t[e]||o(e))).then(e=>(l(...e),a))}}define(["./workbox-b9acee4e"],function(e){"use strict";self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),e.precacheAndRoute([{url:"pwa-64x64.png",revision:"52bb73fe0f7c4274aa55047dc0d5479d"},{url:"pwa-512x512.png",revision:"ebdabf19d41be24e3f47062e89399c09"},{url:"pwa-192x192.png",revision:"ec3f52a07bade7b8a295997c236dac75"},{url:"maskable-icon-512x512.png",revision:"e0d671a48eed68b28f8e7ded8a86ef88"},{url:"manifest.webmanifest",revision:"4e69789fa00f6df17850c3426d2041a9"},{url:"index.html",revision:"10d2f09ae304ed6b51c81e7803a27987"},{url:"icon.svg",revision:"899549fbb9d379c3b78ab012abe72061"},{url:"favicon.ico",revision:"01d978be2c7b93a7348d91107b5bf8ad"},{url:"apple-touch-icon-180x180.png",revision:"dd71bb172b849f6328130ba825ae606d"},{url:"assets/workbox-window.prod.es5-BBnX5xw4.js",revision:null},{url:"assets/useAttachmentUploader-NEobOH0b.js",revision:null},{url:"assets/react-force-graph-2d-DXfKuqMP.js",revision:null},{url:"assets/index-RQd3jtWY.js",revision:null},{url:"assets/index-D_L2igjK.css",revision:null},{url:"assets/dates-BGZoWpL2.js",revision:null},{url:"assets/Vaults-BzOgFkRm.js",revision:null},{url:"assets/VaultGraph-DqTqupmq.js",revision:null},{url:"assets/Today-BhqaiSa2.js",revision:null},{url:"assets/Tags-Ci-07E0X.js",revision:null},{url:"assets/Settings-C04J50qQ.js",revision:null},{url:"assets/PinArchiveButtons-Co9x5XtS.js",revision:null},{url:"assets/OAuthCallback-CRL1swoB.js",revision:null},{url:"assets/NoteView-COXz1-0X.js",revision:null},{url:"assets/NoteRenderer-CbVbDcm6.js",revision:null},{url:"assets/NoteNew-0NxE4hzz.js",revision:null},{url:"assets/NoteEditor-CyY4zLMN.js",revision:null},{url:"assets/Capture-D_hhqLiB.js",revision:null},{url:"assets/Calendar-CWAc8XWz.js",revision:null},{url:"assets/AddVault-CU4XgZVQ.js",revision:null},{url:"assets/Activity-D45lyieR.js",revision:null},{url:"apple-touch-icon-180x180.png",revision:"dd71bb172b849f6328130ba825ae606d"},{url:"favicon.ico",revision:"01d978be2c7b93a7348d91107b5bf8ad"},{url:"icon.svg",revision:"899549fbb9d379c3b78ab012abe72061"},{url:"maskable-icon-512x512.png",revision:"e0d671a48eed68b28f8e7ded8a86ef88"},{url:"pwa-192x192.png",revision:"ec3f52a07bade7b8a295997c236dac75"},{url:"pwa-512x512.png",revision:"ebdabf19d41be24e3f47062e89399c09"},{url:"pwa-64x64.png",revision:"52bb73fe0f7c4274aa55047dc0d5479d"},{url:"manifest.webmanifest",revision:"4e69789fa00f6df17850c3426d2041a9"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/notes/index.html"),{denylist:[/^\/api\//,/^\/oauth\//,/^\/\.well-known\//]})),e.registerRoute(/^https:\/\/fonts\.(googleapis|gstatic)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts",plugins:[new e.ExpirationPlugin({maxEntries:30,maxAgeSeconds:2592e3}),new e.CacheableResponsePlugin({statuses:[0,200]})]}),"GET")});
|
package/meta.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"name": "notes",
|
|
4
4
|
"displayName": "Notes",
|
|
5
5
|
"tagline": "Notes PWA backed by your vault.",
|
|
6
|
-
"version": "0.1.
|
|
7
|
-
"path": "/
|
|
6
|
+
"version": "0.1.3",
|
|
7
|
+
"path": "/surface/notes",
|
|
8
8
|
"iconUrl": "icon.svg",
|
|
9
9
|
"scopes_required": ["vault:*:read", "vault:*:write"],
|
|
10
10
|
"pwa": true,
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openparachute/notes-ui",
|
|
3
|
-
"version": "0.1.1",
|
|
3
|
+
"version": "0.1.4-rc.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Parachute Notes UI bundle
|
|
6
|
+
"description": "Parachute Notes UI bundle \u2014 the SPA installed under parachute-surface as the canonical first app. No daemon, no module surface; just the built dist/.",
|
|
7
7
|
"license": "AGPL-3.0-only",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/ParachuteComputer/parachute-
|
|
10
|
+
"url": "https://github.com/ParachuteComputer/parachute-surface.git",
|
|
11
11
|
"directory": "packages/notes-ui"
|
|
12
12
|
},
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"meta.json",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
14
20
|
"scripts": {
|
|
15
21
|
"dev": "vite",
|
|
16
22
|
"build": "tsc -b && vite build",
|
|
@@ -26,7 +32,6 @@
|
|
|
26
32
|
},
|
|
27
33
|
"dependencies": {
|
|
28
34
|
"@codemirror/commands": "^6.10.3",
|
|
29
|
-
"@openparachute/app-client": "^0.1.0-rc.3",
|
|
30
35
|
"@codemirror/lang-markdown": "^6.5.0",
|
|
31
36
|
"@codemirror/language": "^6.12.3",
|
|
32
37
|
"@codemirror/state": "^6.6.0",
|
|
@@ -42,7 +47,8 @@
|
|
|
42
47
|
"react-router": "^7",
|
|
43
48
|
"rehype-highlight": "^7.0.2",
|
|
44
49
|
"remark-gfm": "^4.0.1",
|
|
45
|
-
"zustand": "^5"
|
|
50
|
+
"zustand": "^5",
|
|
51
|
+
"@openparachute/surface-client": "^0.1.0-rc.4"
|
|
46
52
|
},
|
|
47
53
|
"devDependencies": {
|
|
48
54
|
"@biomejs/biome": "^1.9.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aa as P,Q as T,a7 as I,H as R,M as L,x as n,r as e,N as V,V as $,L as F,e as M,u as _}from"./index-BF1NxtUe.js";import{u as U,A as B,C as z,a as H,b as O}from"./useAttachmentUploader-Du2IiCzJ.js";import{b as Q,N as W}from"./NoteRenderer-CWW2zAJs.js";const Y={content:"",path:"",tags:[],summary:""};function J(){const w=P(t=>t.getActiveVault()),l=T(),d=I(t=>t.push),c=R(),f=L(),[a,o]=n.useState(Y),[C,b]=n.useState(""),[v,x]=n.useState(null),[m,k]=n.useState([]),p=n.useRef(null),i=U({noteId:null,onInsert:t=>{p.current?p.current.insertAtCursor(t):o(s=>({...s,content:`${s.content}${t}`}))},onStaged:t=>k(s=>[...s,t]),onError:t=>d(t,"error")});if(!w)return e.jsx(V,{to:"/",replace:!0});const u=a.content.length>0||a.path.length>0||a.tags.length>0||a.summary.length>0,h=a.content.trim().length>0&&a.path.trim().length>0,j=n.useCallback(()=>{if(!h||c.isPending)return;const t={content:a.content,path:a.path.trim()};a.tags.length&&(t.tags=a.tags);const s=a.summary.trim();s&&(t.metadata={summary:s}),x(null),c.mutate(t,{onSuccess:async r=>{for(const g of m)try{await f.mutateAsync({noteId:r.id,path:g.path,mimeType:g.mimeType})}catch(y){const D=y instanceof Error?y.message:"Link failed";d(`Failed to attach ${g.filename}: ${D}`,"error")}d(`Created ${r.path??r.id}`,"success"),l(`/n/${encodeURIComponent(r.id)}`)},onError:r=>{r instanceof $?x("Session expired. Reconnect to save."):x(r instanceof Error?`${r.message} — if the path is taken, try a different one.`:"Create failed")}})},[a,h,f,c,l,d,m]),N=n.useCallback(()=>{u&&!confirm("Discard this draft?")||l("/")},[u,l]);n.useEffect(()=>{if(!u)return;const t=s=>{s.preventDefault(),s.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[u]);const A=t=>{const s=_(t);!s||a.tags.includes(s)||(o(r=>({...r,tags:[...r.tags,s]})),b(""))},E=t=>{o(s=>({...s,tags:s.tags.filter(r=>r!==t)}))},S=Q({id:"__new__",createdAt:new Date().toISOString()});return e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-5 md:px-6 md:py-8",children:[e.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:e.jsx(F,{to:"/",className:"hover:text-accent",children:"← All notes"})}),e.jsxs("article",{children:[e.jsxs("header",{className:"mb-4 border-b border-border pb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:e.jsx("span",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"New note"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:N,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:j,disabled:!h||c.isPending,className:"min-h-11 rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-hover disabled:opacity-40",title:"Create (⌘S)",children:c.isPending?"Creating…":"Create"})]})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("label",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"shrink-0 text-xs uppercase tracking-wider text-fg-dim",children:"Path"}),e.jsx("input",{type:"text",value:a.path,onChange:t=>o(s=>({...s,path:t.target.value})),className:"flex-1 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-sm text-fg focus:border-accent focus:outline-none","aria-label":"Note path",placeholder:"e.g. Projects/README"})]}),e.jsxs("label",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"shrink-0 text-xs uppercase tracking-wider text-fg-dim",children:"Summary"}),e.jsx("input",{type:"text",value:a.summary,onChange:t=>o(s=>({...s,summary:t.target.value})),className:"flex-1 rounded-md border border-border bg-card px-2.5 py-1 text-sm text-fg focus:border-accent focus:outline-none","aria-label":"Note summary",placeholder:"(optional one-line description)"})]}),e.jsx(M,{tags:a.tags,input:C,onInputChange:b,onAdd:A,onRemove:E})]})]}),v?e.jsx("div",{role:"alert",className:"mb-4 rounded-md border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-400",children:v}):null,e.jsxs("div",{className:"grid min-h-[60vh] gap-4 lg:grid-cols-2",children:[e.jsx(B,{onDropFiles:i.start,className:"min-w-0 rounded-md border border-border bg-card",hint:"Images, audio, webm video",children:e.jsx(z,{ref:p,value:a.content,onChange:t=>o(s=>({...s,content:t})),onSave:j,onCancel:N,onPasteFile:t=>(i.start(t),!0)})}),e.jsx("div",{className:"min-w-0 overflow-auto rounded-md border border-border bg-card p-4",children:a.content.trim()?e.jsx(W,{note:{path:a.path,content:a.content},resolve:S}):e.jsx("p",{className:"text-sm text-fg-dim",children:"Preview appears here as you type."})})]}),e.jsxs("section",{className:"mt-6 border-t border-border pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"font-serif text-lg",children:"Attachments"}),e.jsx(H,{onPickFiles:i.start})]}),e.jsxs("p",{className:"mb-3 text-xs text-fg-dim",children:["Drop or paste files into the editor. Attachments link to the note when you save. Max 100 MB each. Images, audio, webm video."," ",e.jsx("a",{href:"https://github.com/ParachuteComputer/parachute-vault/issues/127",target:"_blank",rel:"noreferrer",className:"underline",children:"PDF + mp4 coming"}),"."]}),e.jsx(O,{uploads:i.uploads,onCancel:i.cancel,onDismiss:i.dismiss}),m.length>0?e.jsx("ul",{className:"mt-3 space-y-1 text-sm",children:m.map(t=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded border border-border bg-card/50 px-3 py-1.5 font-mono text-xs text-fg-muted",children:[e.jsx("span",{className:"truncate",children:t.filename}),e.jsx("span",{className:"shrink-0 text-fg-dim",children:"staged"})]},t.path))}):null]})]})]})}export{J as NoteNew};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./react-force-graph-2d-CtvMkQ0a.js","./index-BF1NxtUe.js","./index-D_L2igjK.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{x as c,E as v,r as t,Q as k,_ as y,Y as I,aa as R,U as A,w as E,N as C,L as p,V as L,z as j}from"./index-BF1NxtUe.js";import{P as _,D}from"./PinArchiveButtons-BO3QwhOp.js";import{b as T,N as U}from"./NoteRenderer-CWW2zAJs.js";const M=1,S=3,$=1;function B(e,s){const a=new Map,n=new Map;for(const d of s.values())for(const r of d.links??[]){if(r.sourceId===r.targetId||!s.has(r.sourceId)||!s.has(r.targetId))continue;const o=`${r.sourceId}|${r.targetId}|${r.relationship}`;a.has(o)||(a.set(o,{source:r.sourceId,target:r.targetId,relationship:r.relationship}),n.set(r.sourceId,(n.get(r.sourceId)??0)+1),n.set(r.targetId,(n.get(r.targetId)??0)+1))}return{nodes:[...s.values()].map(d=>{var r;return{id:d.id,path:d.path,tags:d.tags,summary:typeof((r=d.metadata)==null?void 0:r.summary)=="string"?d.metadata.summary:void 0,isAnchor:d.id===e,linkCount:n.get(d.id)??0}}),edges:[...a.values()]}}async function P(e,s,a,n){const i=new Map;i.set(e.id,e);let d=[e];for(let r=1;r<=s;r++){const o=new Set;for(const u of d)for(const x of u.links??[]){const h=x.sourceId===u.id?x.targetId:x.sourceId;h!==u.id&&(i.has(h)||o.add(h))}if(o.size===0)break;const l=await Promise.all([...o].map(u=>a(u).catch(()=>null)));if(n!=null&&n.cancelled)return i;const m=[];for(const u of l)u&&!i.has(u.id)&&(i.set(u.id,u),m.push(u));d=m}return i}function V(e,s,a){const[n,i]=c.useState(null),[d,r]=c.useState(!1);return c.useEffect(()=>{if(!e||!s){i(null),r(!1);return}const o={cancelled:!1};return r(!0),P(s,a,l=>e.getNote(l,{includeLinks:!0}),o).then(l=>{o.cancelled||(i(B(s.id,l)),r(!1))}).catch(()=>{o.cancelled||r(!1)}),()=>{o.cancelled=!0}},[e,s,a]),{data:n,isLoading:d}}const F=c.lazy(()=>y(()=>import("./react-force-graph-2d-CtvMkQ0a.js"),__vite__mapDeps([0,1,2]),import.meta.url));function z({anchor:e}){const[s,a]=c.useState(!0),[n,i]=c.useState($),d=v(),{data:r,isLoading:o}=V(d,s?e:void 0,n);return t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsxs("header",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("button",{type:"button",onClick:()=>a(l=>!l),"aria-expanded":s,className:"font-serif text-xl text-fg hover:text-accent",children:[s?"▾":"▸"," Neighborhood"]}),s&&r?t.jsxs("span",{className:"text-xs text-fg-dim",children:[r.nodes.length," ",r.nodes.length===1?"note":"notes"]}):null]}),s?t.jsx(G,{depth:n,onChange:i}):null]}),s?t.jsx(O,{data:r,isLoading:o}):null]})}function G({depth:e,onChange:s}){const a=[];for(let n=M;n<=S;n++)a.push(n);return t.jsxs("fieldset",{className:"flex items-center gap-1 text-xs text-fg-dim",children:[t.jsx("legend",{className:"mr-1 inline-block",children:"Hops"}),a.map(n=>t.jsx("button",{type:"button","aria-pressed":n===e,onClick:()=>s(n),className:n===e?"rounded border border-accent bg-accent/10 px-2 py-0.5 text-accent":"rounded border border-border bg-card px-2 py-0.5 hover:text-accent",children:n},n))]})}function O({data:e,isLoading:s}){return!e&&s?t.jsx(w,{}):e?e.nodes.length<=1?t.jsx("div",{className:"rounded-md border border-border bg-card p-6 text-center text-sm text-fg-dim",children:"This note has no neighbors yet."}):t.jsx(H,{data:e}):null}function w(){return t.jsx("div",{"aria-busy":"true",className:"h-[24rem] w-full animate-pulse rounded-md border border-border bg-card"})}function H({data:e}){const s=k(),a=c.useRef(null),[n,i]=c.useState({w:600,h:384});c.useEffect(()=>{const r=a.current;if(!r)return;const o=()=>{const m=r.getBoundingClientRect();i({w:Math.max(320,Math.floor(m.width)),h:384})};o();const l=new ResizeObserver(o);return l.observe(r),()=>l.disconnect()},[]);const d=c.useMemo(()=>({nodes:e.nodes.map(r=>({...r})),links:e.edges.map(r=>({source:r.source,target:r.target,rel:r.relationship}))}),[e]);return t.jsx("div",{ref:a,"data-testid":"neighborhood-graph-canvas",className:"overflow-hidden rounded-md border border-border bg-card",children:t.jsx(c.Suspense,{fallback:t.jsx(w,{}),children:t.jsx(F,{graphData:d,width:n.w,height:n.h,nodeLabel:r=>K(r),nodeVal:r=>{const o=r;return o.isAnchor?8:3+Math.min(o.linkCount,8)},nodeColor:r=>r.isAnchor?"#c9b170":"#8a9a7a",linkColor:()=>"rgba(160, 160, 160, 0.4)",linkDirectionalArrowLength:3,linkDirectionalArrowRelPos:1,cooldownTicks:80,onNodeClick:r=>{s(`/n/${encodeURIComponent(r.id)}`)}})})})}function K(e){const s=[e.path??e.id];return e.tags&&e.tags.length>0&&s.push(`tags: ${e.tags.join(", ")}`),e.summary&&s.push(e.summary),s.join(`
|
|
3
|
-
`)}const W="_Transcript pending._",Q="_Transcription unavailable._";function X({content:e}){const s=e.includes(W),a=!s&&e.includes(Q);return s?t.jsxs("output",{"aria-live":"polite",className:"mb-4 inline-flex items-center gap-2 rounded-md border border-sky-500/30 bg-sky-500/5 px-3 py-1.5 text-xs text-sky-300",children:[t.jsx("span",{"aria-hidden":!0,className:"inline-block h-2 w-2 animate-pulse rounded-full bg-sky-400"}),"Transcribing…"]}):a?t.jsx("output",{className:"mb-4 inline-flex items-center gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-1.5 text-xs text-amber-200",children:"Transcription unavailable — open the audio below and add a note by hand."}):null}function ce(){const{id:e}=I(),s=e?decodeURIComponent(e):void 0,a=R(i=>i.getActiveVault()),n=A(s);return c.useEffect(()=>{a&&s&&E(a.id,s)},[a,s]),a?t.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-6 md:px-6 md:py-10",children:[t.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:t.jsx(p,{to:"/",className:"hover:text-accent",children:"← All notes"})}),n.isPending?t.jsx(ne,{}):n.isError?t.jsx(oe,{error:n.error}):n.data?t.jsx(Y,{note:n.data}):t.jsx(ae,{id:s??""})]}):t.jsx(C,{to:"/",replace:!0})}function Y({note:e}){var r;const s=c.useMemo(()=>T(e),[e]),a=e.path??e.id,n=typeof((r=e.metadata)==null?void 0:r.summary)=="string"?e.metadata.summary:null,i=c.useMemo(()=>(e.links??[]).filter(o=>o.targetId===e.id&&o.sourceId!==e.id&&o.sourceNote),[e]),d=c.useMemo(()=>{const o=new Set,l=[];for(const m of e.links??[])m.sourceId!==e.id||m.targetId===e.id||m.targetNote&&(o.has(m.targetId)||(o.add(m.targetId),l.push(m)));return l},[e]);return t.jsxs("article",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("header",{className:"mb-6 border-b border-border pb-4",children:[t.jsx("h1",{className:"font-serif text-3xl tracking-tight",children:e.path?q(e.path):e.id}),e.tags&&e.tags.length>0?t.jsx(Z,{tags:e.tags}):null,t.jsx("p",{className:"mt-2 font-mono text-xs text-fg-dim break-all",children:a}),n?t.jsx("p",{className:"mt-3 text-fg-muted",children:n}):null,t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[t.jsx(p,{to:`/n/${encodeURIComponent(e.id)}/edit`,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Edit"}),t.jsx(_,{note:e,keyboard:!0}),t.jsx(D,{note:e})]})]}),t.jsx(X,{content:e.content??""}),t.jsx(U,{note:e,resolve:s}),e.attachments&&e.attachments.length>0?t.jsxs("section",{className:"mt-10 border-t border-border pt-6",children:[t.jsx("h2",{className:"mb-3 font-serif text-xl",children:"Attachments"}),t.jsx("div",{className:"space-y-6",children:e.attachments.map(o=>t.jsx(ee,{attachment:o},o.id))})]}):null,t.jsx(z,{anchor:e})]}),t.jsxs("aside",{className:"space-y-6 text-sm lg:sticky lg:top-24 lg:self-start",children:[t.jsx(J,{note:e}),d.length>0?t.jsx(N,{title:"Outbound",links:d,peer:"target"}):null,i.length>0?t.jsx(N,{title:"Inbound",links:i,peer:"source"}):null]})]})}function q(e){return(e.split("/").pop()??e).replace(/\.md$/i,"")}function J({note:e}){const s=e.createdAt,a=e.updatedAt,n=Object.entries(e.metadata??{}).filter(([i])=>i!=="summary");return t.jsxs("section",{className:"rounded-md border border-border bg-card p-4",children:[t.jsx("h2",{className:"mb-2 text-xs uppercase tracking-wider text-fg-dim",children:"Metadata"}),t.jsxs("dl",{className:"space-y-1.5 text-sm",children:[e.path?t.jsx(f,{label:"Path",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.path})}):null,t.jsx(f,{label:"ID",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.id})}),t.jsx(f,{label:"Created",value:t.jsx("time",{title:s,children:j(s)})}),a?t.jsx(f,{label:"Updated",value:t.jsx("time",{title:a,children:j(a)})}):null,n.map(([i,d])=>t.jsx(f,{label:i,value:t.jsx("span",{className:"break-all text-fg-muted",children:String(d)})},i))]})]})}function f({label:e,value:s}){return t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("dt",{className:"text-xs uppercase tracking-wider text-fg-dim",children:e}),t.jsx("dd",{children:s})]})}function Z({tags:e}){return t.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5","aria-label":"Tags",children:e.map(s=>t.jsxs(p,{to:`/?tag=${encodeURIComponent(s)}`,className:"max-w-full break-all rounded-full border border-accent/40 bg-accent/10 px-2.5 py-0.5 text-xs font-medium text-accent hover:border-accent hover:bg-accent/20",children:["#",s]},s))})}function N({title:e,links:s,peer:a}){return t.jsxs("section",{className:"rounded-md border border-border bg-card p-4",children:[t.jsxs("h2",{className:"mb-2 text-xs uppercase tracking-wider text-fg-dim",children:[e," (",s.length,")"]}),t.jsx("ul",{className:"space-y-1.5",children:s.map(n=>{var o;const i=a==="source"?n.sourceNote:n.targetNote;if(!i)return null;const d=i.path??i.id,r=typeof((o=i.metadata)==null?void 0:o.summary)=="string"?i.metadata.summary:null;return t.jsx("li",{children:t.jsxs(p,{to:`/n/${encodeURIComponent(i.id)}`,className:"block rounded px-1 py-0.5 hover:bg-bg/50",children:[t.jsx("div",{className:"truncate font-mono text-xs text-fg-muted hover:text-accent",children:d}),r?t.jsx("div",{className:"mt-0.5 line-clamp-2 text-xs text-fg-dim",children:r}):null]})},`${n.sourceId}->${n.targetId}:${n.relationship}`)})})]})}function ee({attachment:e}){const s=(e.mimeType??"").toLowerCase(),a=e.filename??e.id;return t.jsxs("figure",{className:"rounded-md border border-border bg-card p-3",children:[t.jsxs("figcaption",{className:"mb-2 flex items-baseline justify-between gap-3",children:[t.jsx("span",{className:"truncate font-mono text-xs text-fg-muted",children:a}),typeof e.size=="number"?t.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:re(e.size)}):null]}),t.jsx(te,{attachment:e,mime:s,filename:a})]})}function te({attachment:e,mime:s,filename:a}){const n=v(),[i,d]=c.useState(null),[r,o]=c.useState(null),l=se(s,a),m=l!=="other",u=e.url;if(c.useEffect(()=>{if(!m||!u||!n)return;let h=!1,b=null;return o(null),n.fetchAttachmentBlob(u).then(g=>{h||(b=URL.createObjectURL(g),d(b))}).catch(g=>{h||o(g instanceof Error?g.message:"Failed to load attachment")}),()=>{h=!0,b&&URL.revokeObjectURL(b)}},[m,u,n]),!u)return t.jsx("p",{className:"text-sm text-fg-dim",children:"(no URL)"});if(r)return t.jsx("p",{className:"text-sm text-red-400",children:r});if(m&&!i)return t.jsx("div",{className:"h-32 animate-pulse rounded bg-border/40","aria-busy":"true"});const x=i??u;return l==="image"?t.jsx("img",{src:x,alt:a,className:"max-h-[32rem] rounded"}):l==="audio"?t.jsx("audio",{controls:!0,src:x,className:"w-full"}):l==="video"?t.jsx("video",{controls:!0,src:x,className:"w-full rounded"}):l==="pdf"?t.jsxs(t.Fragment,{children:[t.jsx("iframe",{src:x,title:a,className:"h-[40rem] w-full rounded border border-border"}),t.jsxs("a",{href:x,download:a,className:"mt-2 inline-block text-sm text-accent hover:underline",children:["Download ",a]})]}):t.jsxs("a",{href:x,download:a,className:"text-sm text-accent hover:underline",children:["Download ",a]})}function se(e,s){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e==="application/pdf")return"pdf";const a=s.toLowerCase().split(".").pop()??"";return["png","jpg","jpeg","gif","webp","svg"].includes(a)?"image":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":["mp4","webm","mov"].includes(a)?"video":a==="pdf"?"pdf":"other"}function re(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function ne(){return t.jsxs("div",{className:"grid gap-10 lg:grid-cols-[minmax(0,1fr)_18rem]","aria-busy":"true",children:[t.jsxs("div",{className:"min-w-0 space-y-3",children:[t.jsx("div",{className:"h-3 w-32 animate-pulse rounded bg-border/40"}),t.jsx("div",{className:"h-8 w-2/3 animate-pulse rounded bg-border/60"}),t.jsx("div",{className:"h-4 w-full animate-pulse rounded bg-border/30"}),t.jsx("div",{className:"mt-6 space-y-2",children:[0,1,2,3,4,5].map(e=>t.jsx("div",{className:"h-3 animate-pulse rounded bg-border/30",style:{width:`${70+e*13%25}%`}},e))})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"h-32 animate-pulse rounded bg-border/30"}),t.jsx("div",{className:"h-24 animate-pulse rounded bg-border/30"})]})]})}function ae({id:e}){return t.jsxs("div",{className:"rounded-md border border-border bg-card p-10 text-center",children:[t.jsx("p",{className:"mb-2 font-serif text-xl",children:"Note not found"}),t.jsxs("p",{className:"mb-4 text-sm text-fg-muted",children:["No note with id ",t.jsx("span",{className:"font-mono",children:e})," in this vault."]}),t.jsx(p,{to:"/",className:"text-sm text-accent hover:underline",children:"Back to all notes"})]})}function oe({error:e}){const s=e instanceof L;return t.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[t.jsx("p",{className:"mb-2 font-medium text-red-400",children:s?"Session expired":"Could not load note"}),t.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:e.message}),s?t.jsx(p,{to:"/add",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Reconnect vault"}):null]})}export{ce as NoteView};
|