@openparachute/notes-ui 0.1.5-rc.1 → 0.1.6-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/.parachute/info +1 -1
- package/dist/assets/{Activity-D95uEfl-.js → Activity-DJhKtRnz.js} +1 -1
- package/dist/assets/{AddVault-DyLm40Wr.js → AddVault-DX-7VPHH.js} +1 -1
- package/dist/assets/{AttachmentDropZone-BpW24D0t.js → AttachmentDropZone-DrZXEO9k.js} +1 -1
- package/dist/assets/{Calendar-BxC8PSFW.js → Calendar-CfbphZhF.js} +1 -1
- package/dist/assets/{Import-B7PEdPjZ.js → Import-BOoIUF34.js} +1 -1
- package/dist/assets/{NoteEditor-DoAZre6A.js → NoteEditor-ZdIpS6QN.js} +1 -1
- package/dist/assets/NoteNew-Crzh0iYo.js +9 -0
- package/dist/assets/{NoteRenderer-DZG-A0PR.js → NoteRenderer-BGWbYFIT.js} +1 -1
- package/dist/assets/{NoteView-DC4F7Yg0.js → NoteView-LNlromHS.js} +2 -2
- package/dist/assets/{OAuthCallback-DCVwov9d.js → OAuthCallback-D1kmhUQA.js} +1 -1
- package/dist/assets/{PinArchiveButtons-B-J_q8fy.js → PinArchiveButtons-HkysJJPl.js} +1 -1
- package/dist/assets/{Settings-CV-HhWB9.js → Settings-DpHNB3Wj.js} +1 -1
- package/dist/assets/Tags-5UgiMjud.js +1 -0
- package/dist/assets/Today-MgBcz9I5.js +1 -0
- package/dist/assets/{VaultGraph-DRR18im5.js → VaultGraph-CHtHQpMd.js} +2 -2
- package/dist/assets/{Vaults-CE_H2o0k.js → Vaults-RFwi9oID.js} +1 -1
- package/dist/assets/index-By5JSkFz.css +1 -0
- package/dist/assets/index-D27iivhA.js +62 -0
- package/dist/assets/{react-force-graph-2d-ByCzo_0U.js → react-force-graph-2d-DBfJJN1_.js} +1 -1
- package/dist/assets/{useAttachmentUploader-B1jCiVcW.js → useAttachmentUploader-CoOJv16s.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +2 -8
- package/dist/assets/Capture-DCy4NMNH.js +0 -9
- package/dist/assets/NoteNew-modij3mZ.js +0 -1
- package/dist/assets/Tags-C8cO3-Em.js +0 -1
- package/dist/assets/Today-DZXV6hrm.js +0 -1
- package/dist/assets/index-CeSJJ5Fs.js +0 -62
- package/dist/assets/index-RxgFsdXJ.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{z as at,R as xo,r as bo}from"./index-
|
|
1
|
+
import{z as at,R as xo,r as bo}from"./index-D27iivhA.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 zo=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 Ro(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{z as ne,t as oe,
|
|
1
|
+
import{z as ne,t as oe,ae as Hf,Q as Kf,c as Jf,S as eu}from"./index-D27iivhA.js";const tu="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 dS({onPickFiles:r,label:e="Attach files…",className:t}){const i=ne.useRef(null);return oe.jsxs(oe.Fragment,{children:[oe.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}),oe.jsx("input",{ref:i,type:"file",multiple:!0,accept:tu,className:"hidden",onChange:n=>{const s=Array.from(n.target.files??[]);s.length>0&&r(s),n.target.value=""}})]})}function pS({uploads:r,onCancel:e,onDismiss:t}){return r.length===0?null:oe.jsx("ul",{className:"space-y-2",children:r.map(i=>oe.jsxs("li",{className:"rounded-md border border-border bg-card/60 px-3 py-2 text-xs text-fg-muted",children:[oe.jsxs("div",{className:"flex items-center justify-between gap-2",children:[oe.jsx("span",{className:"truncate font-mono",title:i.filename,children:i.filename}),oe.jsx("span",{className:"shrink-0",children:iu(i)})]}),i.status==="uploading"?oe.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded bg-border/40",children:oe.jsx("div",{className:"h-full bg-accent transition-[width]",style:{width:`${Ma(i)}%`}})}):null,i.status==="error"&&i.error?oe.jsx("p",{className:"mt-1 text-red-400",children:i.error}):null,oe.jsx("div",{className:"mt-1 flex justify-end gap-2 text-xs",children:i.status==="uploading"||i.status==="linking"?oe.jsx("button",{type:"button",onClick:()=>e(i.id),className:"text-fg-dim hover:text-fg",children:"Cancel"}):oe.jsx("button",{type:"button",onClick:()=>t(i.id),className:"text-fg-dim hover:text-fg",children:"Dismiss"})})]},i.id))})}function Ma(r){return r.size===0?0:Math.min(100,Math.round(r.loaded/r.size*100))}function iu(r){switch(r.status){case"uploading":return`${Ma(r)}%`;case"linking":return"Linking…";case"done":return"Done";case"cancelled":return"Cancelled";case"error":return"Error"}}let Nn=[],ja=[];(()=>{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?ja:Nn).push(t=t+r[e])})();function ru(r){if(r<768)return!1;for(let e=0,t=Nn.length;;){let i=e+t>>1;if(r<Nn[i])t=i;else if(r>=ja[i])e=i+1;else return!0;if(e==t)return!1}}function Xl(r){return r>=127462&&r<=127487}const Cl=8205;function nu(r,e,t=!0,i=!0){return(t?za:su)(r,e,i)}function za(r,e,t){if(e==r.length)return e;e&&La(r.charCodeAt(e))&&_a(r.charCodeAt(e-1))&&e--;let i=On(r,e);for(e+=Al(i);e<r.length;){let n=On(r,e);if(i==Cl||n==Cl||t&&ru(n))e+=Al(n),i=n;else if(Xl(n)){let s=0,l=e-2;for(;l>=0&&Xl(On(r,l));)s++,l-=2;if(s%2==0)break;e+=2}else break}return e}function su(r,e,t){for(;e>0;){let i=za(r,e-2,t);if(i<e)return i;e--}return 0}function On(r,e){let t=r.charCodeAt(e);if(!_a(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return La(i)?(t-55296<<10)+(i-56320)+65536:t}function La(r){return r>=56320&&r<57344}function _a(r){return r>=55296&&r<56320}function Al(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 Ya(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 Ea(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 K(e):Be.from(K.split(e,[]))}}class K extends z{constructor(e,t=lu(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 ou(n,o,i,l);n=o+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new K(Rl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let l=i.pop(),o=mr(s.text,l.text.slice(),0,s.length);if(o.length<=32)i.push(new K(o,l.length+s.length));else{let a=o.length>>1;i.push(new K(o.slice(0,a)),new K(o.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof K))return super.replace(e,t,i);[e,t]=Dt(this,e,t);let n=mr(this.text,mr(i.text,Rl(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new K(n,s):Be.from(K.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 K(i,n)),i=[],n=-1);return n>-1&&t.push(new K(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 K(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 K&&a&&(d=c[c.length-1])instanceof K&&O.lines+d.lines<=32?(a+=O.lines,h+=O.length+1,c[c.length-1]=new K(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 K([""],0);function lu(r){let e=-1;for(let t of r)e+=t.length+1;return e}function mr(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 Rl(r,e,t){return mr(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 K?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 K?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 K){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 K?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 Ya{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 Ea{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]=Ya.prototype[Symbol.iterator]=Ea.prototype[Symbol.iterator]=function(){return this});let ou=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 nu(r,e,t,i)}function au(r){return r>=56320&&r<57344}function hu(r){return r>=55296&&r<56320}function cu(r,e){let t=r.charCodeAt(e);if(!hu(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return au(i)?(t-55296<<10)+(i-56320)+65536:t}function fu(r){return r<65536?1:2}const Un=/\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){Fn(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:Va(this,e)}mapDesc(e,t=!1){return e.empty?this:Hn(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 te 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 Fn(this,(t,i,n,s,l)=>e=e.replace(n,n+(i-t),l),!1),e}mapDesc(e,t=!1){return Hn(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 te(t,i)}compose(e){return this.empty?e:e.empty?this:Va(this,e,!0)}map(e,t=!1){return e.empty?this:Hn(this,e,t,!0)}iterChanges(e,t=!1){Fn(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 te(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 te(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 te){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||Un)):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 te(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 te(t,i)}static createSet(e,t){return new te(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 Fn(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 Hn(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?te.createSet(n,s):Ue.create(n);throw new Error("Mismatched change set lengths")}}}function Va(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?te.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 k.range(e,t,void 0,void 0,i);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return k.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 k.range(e.anchor,e.head)}static create(e,t,i){return new vt(e,t,i)}}class k{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:k.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 k([this.main],0)}addRange(e,t=!0){return k.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,k.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 k(e.ranges.map(t=>vt.fromJSON(t)),e.main)}static single(e,t=e){return new k([k.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 k.normalized(e.slice(),t);i=s.to}return new k(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?k.range(a,o):k.range(o,a))}}return new k(e,t)}}function Wa(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let qs=0;class X{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=qs++,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:Ds),!!e.static,e.enables)}of(e){return new Sr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Sr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Sr(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ds(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}class Sr{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=qs++}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)||Kn(f,c)){let O=i(f);if(o?!Ml(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=Tr(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?Ml(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 Ml(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 Kn(r,e){let t=!1;for(let i of e)Si(r,i)&1&&(t=!0);return t}function uu(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=Tr(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(!Kn(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=Kn(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Ds(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 Ji=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(qs++,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(Ji).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(Ji),l=n.facet(Ji),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,Ji.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 Ba(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 Ba{constructor(e,t){this.inner=e,this.prec=t}}class Kr{of(e){return new Jn(this,e)}reconfigure(e){return Kr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Jn{constructor(e,t){this.compartment=e,this.inner=t}}class vr{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 Ou(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,Ds(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=>uu(m,d,O))}}let f=h.map(u=>u(o));return new vr(e,l,f,o,a,s)}}function Ou(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 Jn&&t.delete(l.compartment)}if(n.set(l,o),Array.isArray(l))for(let h of l)s(h,o);else if(l instanceof Jn){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 Ba)s(l.inner,l.prec);else if(l instanceof lt)i[o].push(l),l.provides&&s(l.provides,o);else if(l instanceof Sr)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 Tr(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const qa=X.define(),es=X.define({combine:r=>r.some(e=>e),static:!0}),Da=X.define({combine:r=>r.length?r[0]:void 0,static:!0}),Ia=X.define(),Ga=X.define(),Na=X.define(),Ua=X.define({combine:r=>r.length?r[0]:!1});class ot{constructor(e,t){this.type=e,this.value=t}static define(){return new du}}class du{of(e){return new ot(this,e)}}class pu{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 pu(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 ee{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&&Wa(i,t.newLength),s.some(o=>o.type==ee.time)||(this.annotations=s.concat(ee.time.of(Date.now())))}static create(e,t,i,n,s,l){return new ee(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(ee.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ee.time=ot.define();ee.userEvent=ot.define();ee.addToHistory=ot.define();ee.remote=ot.define();function gu(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 Fa(r,e,t){var i;let n,s,l;return t?(n=e.changes,s=te.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 ts(r,e,t){let i=e.selection,n=Yt(e.annotations);return e.userEvent&&(n=n.concat(ee.userEvent.of(e.userEvent))),{changes:e.changes instanceof te?e.changes:te.of(e.changes||[],t,r.facet(Da)),selection:i&&(i instanceof k?i:k.single(i.anchor,i.head)),effects:Yt(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function Ha(r,e,t){let i=ts(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=Fa(i,ts(r,e[s],l?i.changes.newLength:r.doc.length),l)}let n=ee.create(r,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Su(t?mu(n):n)}function mu(r){let e=r.startState,t=!0;for(let n of e.facet(Ia)){let s=n(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:gu(t,s))}if(t!==!0){let n,s;if(t===!1)s=r.changes.invertedDesc,n=te.empty(e.doc.length);else{let l=r.changes.filter(t);n=l.changes,s=l.filtered.mapDesc(l.changes).invertedDesc}r=ee.create(e,n,r.selection&&r.selection.map(s),I.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let i=e.facet(Ga);for(let n=i.length-1;n>=0;n--){let s=i[n](r);s instanceof ee?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ee?r=s[0]:r=Ha(e,Yt(s),!1)}return r}function Su(r){let e=r.startState,t=e.facet(Na),i=r;for(let n=t.length-1;n>=0;n--){let s=t[n](r);s&&Object.keys(s).length&&(i=Fa(i,ts(e,s,r.changes.newLength),!0))}return i==r?r:ee.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}const Qu=[];function Yt(r){return r==null?Qu: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 is;try{is=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function bu(r){if(is)return is.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 yu(r){return e=>{if(!/\S/.test(e))return tt.Space;if(bu(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),Tr(this,i)}update(...e){return Ha(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:n}=t;for(let o of e.effects)o.is(Kr.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=vr.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(es)?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:k.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:k.create(s,t.mainIndex),effects:l}}changes(e=[]){return e instanceof te?e:te.of(e,this.doc.length,this.facet(_.lineSeparator))}toText(e){return z.of(e.split(this.facet(_.lineSeparator)||Un))}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),Tr(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:k.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=vr.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(_.lineSeparator)||Un)),n=e.selection?e.selection instanceof k?e.selection:k.single(e.selection.anchor,e.selection.head):k.single(0);return Wa(n,i.length),t.staticFacet(es)||(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,8 +19,8 @@
|
|
|
19
19
|
} catch (e) {}
|
|
20
20
|
})();
|
|
21
21
|
</script>
|
|
22
|
-
<script type="module" crossorigin src="./assets/index-
|
|
23
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
22
|
+
<script type="module" crossorigin src="./assets/index-D27iivhA.js"></script>
|
|
23
|
+
<link rel="stylesheet" crossorigin href="./assets/index-By5JSkFz.css">
|
|
24
24
|
<link rel="manifest" href="./manifest.webmanifest"></head>
|
|
25
25
|
<body>
|
|
26
26
|
<div id="root"></div>
|
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
|
|
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 o={};const a=e=>i(e,r),t={module:{uri:r},exports:o,require:a};s[r]=Promise.all(n.map(e=>t[e]||a(e))).then(e=>(l(...e),o))}}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:"fb5a8829b8f0a5ccad931a4b4ab4fb68"},{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-CoOJv16s.js",revision:null},{url:"assets/react-force-graph-2d-DBfJJN1_.js",revision:null},{url:"assets/index-D27iivhA.js",revision:null},{url:"assets/index-By5JSkFz.css",revision:null},{url:"assets/dates-BGZoWpL2.js",revision:null},{url:"assets/Vaults-RFwi9oID.js",revision:null},{url:"assets/VaultGraph-CHtHQpMd.js",revision:null},{url:"assets/Today-MgBcz9I5.js",revision:null},{url:"assets/Tags-5UgiMjud.js",revision:null},{url:"assets/Settings-DpHNB3Wj.js",revision:null},{url:"assets/PinArchiveButtons-HkysJJPl.js",revision:null},{url:"assets/OAuthCallback-D1kmhUQA.js",revision:null},{url:"assets/NoteView-LNlromHS.js",revision:null},{url:"assets/NoteRenderer-BGWbYFIT.js",revision:null},{url:"assets/NoteNew-Crzh0iYo.js",revision:null},{url:"assets/NoteEditor-ZdIpS6QN.js",revision:null},{url:"assets/Import-BOoIUF34.js",revision:null},{url:"assets/Calendar-CfbphZhF.js",revision:null},{url:"assets/AttachmentDropZone-DrZXEO9k.js",revision:null},{url:"assets/AddVault-DX-7VPHH.js",revision:null},{url:"assets/Activity-DJhKtRnz.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openparachute/notes-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6-rc.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
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/.",
|
|
@@ -10,13 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/ParachuteComputer/parachute-surface.git",
|
|
11
11
|
"directory": "packages/notes-ui"
|
|
12
12
|
},
|
|
13
|
-
"files": [
|
|
14
|
-
"dist",
|
|
15
|
-
"meta.json",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE",
|
|
18
|
-
"CHANGELOG.md"
|
|
19
|
-
],
|
|
13
|
+
"files": ["dist", "meta.json", "README.md", "LICENSE", "CHANGELOG.md"],
|
|
20
14
|
"scripts": {
|
|
21
15
|
"dev": "vite",
|
|
22
16
|
"build": "tsc -b && vite build",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{ac as xe,a9 as be,a6 as ye,a7 as ve,G as we,z as i,v as G,p as ke,u as Te,o as S,l as Re,t as a,N as Se,B as je,e as Ne,w as oe,L as Ee}from"./index-CeSJJ5Fs.js";const Ie=["audio/webm;codecs=opus","audio/mp4","audio/ogg;codecs=opus"];function Ce(r=Ie){if(typeof MediaRecorder>"u")return null;for(const t of r)if(MediaRecorder.isTypeSupported(t))return t;return null}function Me(r){return r.startsWith("audio/webm")?"webm":r.startsWith("audio/mp4")?"m4a":r.startsWith("audio/ogg")?"ogg":r.startsWith("audio/wav")?"wav":"bin"}function Ae(r){const t=r.now??(()=>Date.now()),d=r.MediaRecorderCtor??MediaRecorder,n=new d(r.stream,{mimeType:r.mimeType}),l=[];let s="idle",m=0,A=0;n.ondataavailable=k=>{k.data&&k.data.size>0&&l.push(k.data)};const p=()=>{for(const k of r.stream.getTracks())k.stop()};return{get state(){return s},get mimeType(){return r.mimeType},start(){if(s!=="idle")throw new Error(`Cannot start from ${s}`);n.start(),m=t(),s="recording"},pause(){s==="recording"&&(n.pause(),A+=t()-m,s="paused")},resume(){s==="paused"&&(n.resume(),m=t(),s="recording")},async stop(){if(s==="idle"||s==="stopped")throw new Error(`Cannot stop from ${s}`);s==="recording"&&(A+=t()-m);const k=new Promise(x=>{n.onstop=async()=>{const L=await $e(l);x({data:L,mimeType:r.mimeType,durationMs:A})}});return n.stop(),s="stopped",p(),k},cancel(){if(s==="recording"||s==="paused")try{n.stop()}catch{}s="stopped",l.length=0,p()}}}async function De(r){const t=r;return typeof t.arrayBuffer=="function"?t.arrayBuffer():new Promise((d,n)=>{const l=new FileReader;l.onload=()=>d(l.result),l.onerror=()=>n(l.error??new Error("FileReader error")),l.readAsArrayBuffer(r)})}async function $e(r){if(r.length===0)return new ArrayBuffer(0);const t=await Promise.all(r.map(s=>De(s))),d=t.reduce((s,m)=>s+m.byteLength,0),n=new Uint8Array(d);let l=0;for(const s of t)n.set(new Uint8Array(s),l),l+=s.byteLength;return n.buffer}async function Oe(){var r;if(typeof navigator>"u"||!((r=navigator.mediaDevices)!=null&&r.getUserMedia)){const t=new Error("Microphone is not available in this browser.");throw t.kind="unavailable",t}try{return await navigator.mediaDevices.getUserMedia({audio:!0})}catch(t){const d=new Error(t instanceof Error?t.message:"Microphone permission denied."),n=t instanceof DOMException?t.name:"";throw d.kind=n==="NotFoundError"||n==="OverconstrainedError"?"no-device":"permission-denied",d}}function Le(r,t=new Date){return`memo-${t.toISOString().replace(/[:.]/g,"-").replace(/Z$/,"")}.${Me(r)}`}function se(r=new Date){const t=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0"),l=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0"),m=String(r.getSeconds()).padStart(2,"0");return`Notes/${t}/${d}-${n}/${l}-${s}-${m}`}const Ue=/(?:^|\s)#([a-zA-Z][\w-]*)/g;function Y(r){const t=new Set;for(const d of r.matchAll(Ue)){const n=oe(d[1]??"");n&&t.add(n)}return[...t]}function Z(r){const t=Math.floor(r/1e3),d=Math.floor(t/60),n=t%60;return`${String(d).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function Fe({moreFieldsOpenDefault:r=!1}={}){const t=xe(e=>e.getActiveVault()),d=be(e=>e.push),{db:n,blobStore:l,engine:s}=ye(),{roles:m}=ve((t==null?void 0:t.id)??null),A=we(),[p,k]=i.useState(""),[x,L]=i.useState([]),[ie,F]=i.useState(""),[ce,de]=i.useState(r),D=i.useRef(se()),J=i.useRef(!1),[j,Q]=i.useState(()=>D.current),le=i.useCallback(e=>{J.current=e.trim()!==""&&e!==D.current,Q(e)},[]),[N,ue]=i.useState(""),[c,b]=i.useState({kind:"idle"}),[me,B]=i.useState(0),$=i.useRef(null),[q,X]=i.useState(null),[pe,fe]=i.useState(0),V=i.useRef(null),E=i.useRef(null),W=i.useRef(null),U=i.useRef(!1);i.useEffect(()=>{if(c.kind!=="recording")return;const e=setInterval(()=>B(Date.now()-c.startedAt),250);return()=>clearInterval(e)},[c]),i.useEffect(()=>()=>{E.current&&URL.revokeObjectURL(E.current)},[]),i.useEffect(()=>{var e;(e=W.current)==null||e.focus()},[]);const ge=i.useCallback(async()=>{if(!(c.kind==="recording"||c.kind==="requesting")){b({kind:"requesting"});try{const e=Ce();if(!e){b({kind:"denied",message:"This browser can't record audio in a format we can save."});return}const o=await Oe(),u=Ae({stream:o,mimeType:e});V.current=u,u.start(),B(0),b({kind:"recording",startedAt:Date.now()})}catch(e){const o=e,u=o.kind==="permission-denied"?"Microphone access was denied. Update your browser's site settings to record.":o.kind==="no-device"?"No microphone was found on this device.":o instanceof Error?o.message:"Microphone is not available in this browser.";b({kind:"denied",message:u})}}},[c]),ee=i.useCallback(async()=>{const e=V.current;if(!(!e||c.kind!=="recording"))try{const o=await e.stop();V.current=null;const u=new Blob([o.data],{type:o.mimeType}),y=URL.createObjectURL(u);E.current&&URL.revokeObjectURL(E.current),E.current=y,b({kind:"have-audio",data:o.data,mimeType:o.mimeType,url:y,durationMs:o.durationMs})}catch(o){d(o instanceof Error?`Recording failed: ${o.message}`:"Recording failed.","error"),b({kind:"idle"})}},[c,d]);i.useEffect(()=>{if(c.kind!=="recording")return;const e=()=>{ee()};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[c,ee]);const _=i.useCallback(()=>{E.current&&(URL.revokeObjectURL(E.current),E.current=null),b({kind:"idle"}),B(0)},[]),te=i.useCallback(()=>{var e;if($.current=null,X(null),k(""),L([]),F(""),!J.current){const o=se();D.current=o,Q(o)}_(),(e=W.current)==null||e.focus()},[_]),P=c.kind==="have-audio",T=p.trim().length>0,H=(T||P)&&c.kind!=="saving",z=i.useCallback(async()=>{if(!H||!n||!t)return;if(P&&!l){d("Sync queue not ready — try again in a moment.","error");return}const e=c.kind==="have-audio"?c:null;U.current=!0,b({kind:"saving"});const o=x.filter(g=>g.length>0),u=Y(p),y=[];T&&y.push(m.captureText),e&&y.push(m.captureVoice);const v=Array.from(new Set([...y,...o,...u].filter(g=>g.length>0))),f=$.current,w=(f==null?void 0:f.localId)??G(),I=j.trim()||D.current,C=N.trim(),h=C?{summary:C}:void 0;A&&ke(t.id,A);try{if(e){const g=new Date,O=Le(e.mimeType,g),M=Te(),R=T?`${p.trim()}
|
|
2
|
-
|
|
3
|
-
_Transcript pending._
|
|
4
|
-
|
|
5
|
-
![[${O}]]
|
|
6
|
-
`:`_Transcript pending._
|
|
7
|
-
|
|
8
|
-
![[${O}]]
|
|
9
|
-
`,ae=I;if(!l)throw new Error("blob store missing");await l.put(M,e.data,e.mimeType,t.id),await S(n,{kind:"create-note",localId:w,payload:{content:R,path:ae,...v.length?{tags:v}:{},...h?{metadata:h}:{}}},{vaultId:t.id}),await S(n,{kind:"upload-attachment",blobId:M,filename:O,mimeType:e.mimeType},{vaultId:t.id}),await S(n,{kind:"link-attachment",noteId:w,pathRef:Re(M),mimeType:e.mimeType,transcribe:!0},{vaultId:t.id})}else f!=null&&f.createCommitted?await S(n,{kind:"update-note",targetId:w,payload:{content:p,path:I,...v.length?{tags:{add:v}}:{},...h?{metadata:h}:{}}},{vaultId:t.id}):await S(n,{kind:"create-note",localId:w,payload:{content:p,path:I,...v.length?{tags:v}:{},...h?{metadata:h}:{}}},{vaultId:t.id});s==null||s.runOnce(),d(e?"Captured — syncing audio.":"Captured.","success"),te(),b({kind:"idle"}),U.current=!1}catch(g){d(g instanceof Error?`Capture failed: ${g.message}`:"Capture failed.","error"),U.current=!1,b(e?{kind:"have-audio",data:e.data,mimeType:e.mimeType,url:e.url,durationMs:e.durationMs}:{kind:"idle"})}},[H,n,t,l,A,c,P,T,x,p,j,N,m.captureText,m.captureVoice,s,d,te]),re=i.useCallback(async()=>{if(!n||!t||c.kind!=="idle"||!T)return;const e=x.filter(h=>h.length>0),o=Y(p),u=Array.from(new Set([m.captureText,...e,...o].filter(h=>h.length>0))),y=j.trim()||D.current,v=N.trim(),f=v?{summary:v}:void 0,w=$.current,I=!w,C=(w==null?void 0:w.localId)??G();I&&($.current={localId:C,createCommitted:!0});try{I?await S(n,{kind:"create-note",localId:C,payload:{content:p,path:y,...u.length?{tags:u}:{},...f?{metadata:f}:{}}},{vaultId:t.id}):await S(n,{kind:"update-note",targetId:C,payload:{content:p,path:y,...u.length?{tags:{add:u}}:{},...f?{metadata:f}:{}}},{vaultId:t.id}),s==null||s.runOnce(),X(Date.now())}catch{I&&($.current=null)}},[n,t,c.kind,T,p,x,j,N,m.captureText,s]),he=i.useCallback(e=>{(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&(e.preventDefault(),z())},[z]),ne=i.useRef({db:n,activeVaultId:(t==null?void 0:t.id)??null,content:p,tags:x,pathOverride:j,summary:N,roles:m});return ne.current={db:n,activeVaultId:(t==null?void 0:t.id)??null,content:p,tags:x,pathOverride:j,summary:N,roles:m},i.useEffect(()=>()=>{if(U.current)return;const{db:e,activeVaultId:o,content:u,tags:y,pathOverride:v,summary:f,roles:w}=ne.current;if(!u.trim()||!e||!o)return;const C=y.filter(K=>K.length>0),h=Y(u),g=Array.from(new Set([w.captureText,...C,...h].filter(K=>K.length>0))),O=v.trim()||D.current,M=f.trim(),R=$.current;(R!=null&&R.createCommitted?S(e,{kind:"update-note",targetId:R.localId,payload:{content:u,path:O,...g.length?{tags:{add:g}}:{},...M?{metadata:{summary:M}}:{}}},{vaultId:o}):S(e,{kind:"create-note",localId:(R==null?void 0:R.localId)??G(),payload:{content:u,path:O,...g.length?{tags:g}:{},...M?{metadata:{summary:M}}:{}}},{vaultId:o})).catch(()=>{})},[]),i.useEffect(()=>{if(q===null)return;const e=setInterval(()=>{fe(o=>o+1)},15e3);return()=>clearInterval(e)},[q]),i.useEffect(()=>{if(c.kind==="recording"||c.kind==="requesting"||c.kind==="saving"||c.kind==="have-audio"||!T)return;const e=setTimeout(()=>{U.current||re()},5e3);return()=>clearTimeout(e)},[c.kind,T,p,x,j,N,re]),t?a.jsxs("div",{className:"mx-auto max-w-2xl px-4 py-5 md:px-6 md:py-8",children:[a.jsxs("header",{className:"mb-5",children:[a.jsx("h1",{className:"font-serif text-2xl text-fg md:text-3xl",children:"Capture"}),a.jsxs("p",{className:"mt-1 text-xs text-fg-dim",children:["Type a thought, hold the mic to record, or both."," ",a.jsx("kbd",{className:"rounded bg-bg/60 px-1",children:"⌘"}),a.jsx("kbd",{className:"rounded bg-bg/60 px-1",children:"↵"})," to send."]})]}),a.jsxs("section",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-5 md:p-6",children:[a.jsx("textarea",{ref:W,value:p,onChange:e=>k(e.target.value),onKeyDown:he,placeholder:"What are you thinking?","aria-label":"Capture content",rows:8,disabled:c.kind==="saving",className:"min-h-[30vh] w-full resize-y rounded-md border border-border bg-bg px-3 py-2 text-sm text-fg placeholder:text-fg-dim focus:border-accent focus:outline-none disabled:opacity-60"}),q!==null?a.jsxs("p",{className:"-mt-2 text-right text-[11px] text-fg-dim","aria-live":"polite","data-indicator-tick":pe,children:["Draft saved · ",je(new Date(q).toISOString())]}):null,c.kind==="have-audio"?a.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-accent/30 bg-accent/5 p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("span",{className:"text-sm text-fg-muted",children:["🎙 Recorded ",Z(c.durationMs)]}),a.jsx("button",{type:"button",onClick:_,className:"text-xs text-fg-dim hover:text-red-400",children:"Discard"})]}),a.jsx("audio",{controls:!0,src:c.url,className:"w-full",children:a.jsx("track",{kind:"captions"})}),a.jsx("p",{className:"text-xs text-fg-dim",children:"Transcript will be appended once your vault processes it."})]}):null,c.kind==="denied"?a.jsx("p",{className:"rounded-md border border-red-500/30 bg-red-500/5 px-3 py-2 text-xs text-red-400",children:c.message}):null,a.jsx(Ne,{tags:x,input:ie,onInputChange:F,onAdd:e=>{const o=oe(e);!o||x.includes(o)||(L(u=>[...u,o]),F(""))},onRemove:e=>L(o=>o.filter(u=>u!==e))}),a.jsxs("details",{className:"group rounded-md border border-border bg-bg/50",open:ce,onToggle:e=>de(e.currentTarget.open),children:[a.jsx("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs text-fg-muted hover:text-accent",children:"More fields"}),a.jsxs("div",{className:"space-y-3 px-3 pb-3 pt-1",children:[a.jsxs("label",{className:"flex flex-col gap-1 text-xs",children:[a.jsx("span",{className:"text-fg-dim",children:"Title"}),a.jsx("input",{type:"text",value:j,onChange:e=>le(e.target.value),placeholder:"(blank → auto-generated)","aria-label":"Title override",className:"rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-xs text-fg focus:border-accent focus:outline-none"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-xs",children:[a.jsx("span",{className:"text-fg-dim",children:"Summary"}),a.jsx("input",{type:"text",value:N,onChange:e=>ue(e.target.value),placeholder:"(optional one-line description)","aria-label":"Summary",className:"rounded-md border border-border bg-card px-2.5 py-1.5 text-xs text-fg focus:border-accent focus:outline-none"})]}),a.jsxs("p",{className:"text-xs text-fg-dim",children:["Need to attach a file?"," ",a.jsx(Ee,{to:"/new",className:"text-accent hover:underline",children:"Open the full editor"}),"."]})]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2",children:[a.jsx(Pe,{phase:c,elapsedMs:me,onPointerDown:()=>void ge()}),a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsx("button",{type:"button",onClick:()=>void z(),disabled:!H,className:"min-h-11 rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover disabled:opacity-40",children:c.kind==="saving"?"Saving…":"Capture"}),a.jsx("span",{className:"text-[11px] text-fg-dim",children:P&&T?"Will save as a note with audio attached.":P?"Will save as a voice memo.":T?"Will save as a text note.":"Type or record to capture."})]})]})]})]}):a.jsx(Se,{to:"/",replace:!0})}function Pe({phase:r,elapsedMs:t,onPointerDown:d}){const n=r.kind==="recording",l=r.kind==="requesting",s=n?`Recording — release to stop (${Z(t)})`:l?"Requesting microphone…":"Hold to record";return a.jsxs("button",{type:"button",onPointerDown:m=>{m.preventDefault(),d()},"aria-label":s,"aria-pressed":n,disabled:r.kind==="saving",className:`flex min-h-11 items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium transition select-none ${n?"border-red-500/40 bg-red-500/10 text-red-400":"border-accent/30 bg-accent/10 text-accent hover:bg-accent/15"} disabled:opacity-40`,children:[a.jsx("span",{"aria-hidden":"true",className:n?"animate-pulse":"",children:"🎙"}),a.jsx("span",{children:n?`Rec ${Z(t)}`:l?"Requesting…":"Hold to record"})]})}export{Fe as Capture,Y as extractHashtags};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ac as T,W as P,a9 as I,K as R,Q as L,z as n,t as e,N as V,V as $,L as F,e as _,w as M}from"./index-CeSJJ5Fs.js";import{A as U}from"./AttachmentDropZone-BpW24D0t.js";import{u as z,C as B,A as W,a as K}from"./useAttachmentUploader-B1jCiVcW.js";import{b as O,N as Q}from"./NoteRenderer-DZG-A0PR.js";const Y={content:"",path:"",tags:[],summary:""};function J(){const w=T(t=>t.getActiveVault()),l=P(),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=z({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=M(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=O({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:"Title"}),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(_,{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(U,{onDropFiles:i.start,className:"min-w-0 rounded-md border border-border bg-card",hint:"Images, audio, webm video",children:e.jsx(B,{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(Q,{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(W,{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(K,{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 +0,0 @@
|
|
|
1
|
-
import{a9 as P,z as l,h as O,V as R,t as e,ac as L,a8 as z,a6 as F,a1 as I,a2 as V,U as D,N as U,L as E}from"./index-CeSJJ5Fs.js";const $=a=>Object.values(a).reduce((n,x)=>n+x,0);function A({mode:a,sources:n,tagOptions:x,onClose:c,onRun:d,onRunMerge:o,pending:i,offline:m}){const p=P(t=>t.push),g=l.useId(),[S,j]=l.useState(a==="rename"?n[0]??"":""),[T,h]=l.useState(null),[u,y]=l.useState(null),[b,N]=l.useState(!1),v=l.useRef(null);l.useEffect(()=>{var t,r;(t=v.current)==null||t.focus(),(r=v.current)==null||r.select()},[]),l.useEffect(()=>{const t=r=>{r.key==="Escape"&&c()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[c]);const w=S.trim().replace(/^#/,""),f=!i&&!m&&!b&&w.length>0&&!(a==="rename"&&w===n[0]),C=l.useCallback(async()=>{if(f){h(null),y(null);try{const t=await d(w);if("renamed"in t)p(`Renamed on ${t.renamed} note${t.renamed===1?"":"s"}.`,"success");else{const r=$(t.merged);p(`Merged into #${t.target} on ${r} note${r===1?"":"s"}.`,"success")}c()}catch(t){if(t instanceof O&&a==="rename"&&o){y(t.target);return}t instanceof R?h("Session expired. Reconnect to retry."):h(t instanceof Error?t.message:"Operation failed.")}}},[f,w,a,c,d,o,p]),k=l.useCallback(async()=>{if(!(!u||!o)){h(null),N(!0);try{const t=await o(u),r=$(t.merged);p(`Merged into #${t.target} on ${r} note${r===1?"":"s"}.`,"success"),c()}catch(t){t instanceof R?h("Session expired. Reconnect to retry."):h(t instanceof Error?t.message:"Merge failed."),N(!1)}}},[u,c,o,p]),s=a==="rename"?"Rename tag":`Merge ${n.length} tags`;return e.jsx("dialog",{open:!0,"aria-labelledby":"tag-op-title",className:"fixed inset-0 z-40 m-0 flex h-full max-h-full w-full max-w-full items-center justify-center bg-black/60 p-4",onMouseDown:t=>{t.target===t.currentTarget&&c()},children:e.jsxs("div",{className:"w-full max-w-md rounded-md border border-border bg-card p-6 shadow-xl",children:[e.jsx("h2",{id:"tag-op-title",className:"mb-2 font-serif text-xl text-fg",children:s}),e.jsxs("p",{className:"mb-3 text-sm text-fg-muted",children:[a==="rename"?e.jsxs(e.Fragment,{children:["Rename ",e.jsx(M,{children:n[0]})," on every note that carries it. Notes that already have the new tag will end up with one copy."]}):e.jsxs(e.Fragment,{children:["Combine"," ",n.map((t,r)=>e.jsxs("span",{children:[e.jsx(M,{children:t}),r<n.length-1?", ":""]},t))," ","into one tag. The originals are removed."]})," ","Changes apply atomically on the vault."]}),e.jsxs("label",{className:"mb-3 block text-sm",children:[e.jsx("span",{className:"mb-1 block text-fg-muted",children:a==="rename"?"New tag name":"Target tag"}),e.jsx("input",{ref:v,type:"text",value:S,onChange:t=>{j(t.target.value),u&&y(null)},onKeyDown:t=>{t.key==="Enter"&&f&&C()},list:g,"aria-label":a==="rename"?"New tag name":"Merge target tag",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",className:"w-full rounded-md border border-border bg-bg/40 px-2.5 py-1.5 font-mono text-sm text-fg focus:border-accent focus:outline-none",autoComplete:"off"}),e.jsx("datalist",{id:g,children:x.map(t=>e.jsx("option",{value:t},t))})]}),m?e.jsx("p",{className:"mb-3 text-sm text-amber-300",children:"Offline — tag operations need a live vault connection."}):null,u?e.jsxs("div",{role:"alert",className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-sm",children:[e.jsxs("p",{className:"mb-2 text-amber-300",children:["A tag named ",e.jsx(M,{children:u})," already exists."]}),e.jsxs("p",{className:"mb-3 text-fg-muted",children:["Merge ",e.jsx(M,{children:n[0]})," into ",e.jsx(M,{children:u})," instead? Notes that carry both end up with one copy."]}),e.jsx("button",{type:"button",onClick:()=>void k(),disabled:b,className:"rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white hover:bg-accent-hover disabled:opacity-40",children:b?"Merging…":`Merge into #${u}`})]}):null,T?e.jsx("p",{role:"alert",className:"mb-3 text-sm text-red-400",children:T}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:c,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-fg",children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>void C(),disabled:!f,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",children:i?a==="rename"?"Renaming…":"Merging…":a==="rename"?"Rename":"Merge"})]})]})})}function M({children:a}){return e.jsxs("span",{className:"rounded bg-bg/60 px-1 py-0.5 font-mono text-xs text-fg",children:["#",a]})}function J(){const a=L(s=>s.getActiveVault()),n=z(),{isOnline:x}=F(),{isPinned:c,togglePin:d}=I((a==null?void 0:a.id)??null),[o,i]=l.useState(""),[m,p]=l.useState("count"),[g,S]=l.useState(new Set),[j,T]=l.useState(null),[h,u]=l.useState(!1),y=V(),b=D(),N=l.useMemo(()=>K(n.data??[],o,m),[n.data,o,m]),v=l.useMemo(()=>(n.data??[]).map(s=>s.name),[n.data]),w=s=>{S(t=>{const r=new Set(t);return r.has(s)?r.delete(s):r.add(s),r})},f=()=>S(new Set);if(!a)return e.jsx(U,{to:"/",replace:!0});const C=g.size,k=!x;return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-5 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-3 md:mb-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:a.name}),e.jsx("h1",{className:"font-serif text-2xl tracking-tight md:text-3xl",children:"Tags"})]}),e.jsxs("button",{type:"button",onClick:()=>p(s=>s==="count"?"alpha":"count"),className:"text-sm text-fg-muted hover:text-accent","aria-label":"Toggle tag sort",children:["Sort: ",m==="count"?"most used":"A–Z"]})]}),e.jsx("input",{type:"search",placeholder:"Filter tags…",value:o,onChange:s=>i(s.target.value),"aria-label":"Filter tags",className:"mb-4 w-full rounded-md border border-border bg-card px-3 py-2 text-sm text-fg focus:border-accent focus:outline-none"}),C>0?e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3 rounded-md border border-accent/30 bg-accent/5 px-3 py-2 text-sm","aria-label":"Tag selection actions",children:[e.jsxs("span",{className:"text-fg-muted",children:[C," selected: ",Array.from(g).join(", ")]}),e.jsx("button",{type:"button",onClick:()=>u(!0),disabled:C<2||k,className:"rounded-md bg-accent px-3 py-1 text-xs font-medium text-white hover:bg-accent-hover disabled:opacity-40",children:"Merge into…"}),e.jsx("button",{type:"button",onClick:f,className:"text-xs text-fg-muted hover:text-accent",children:"Clear"})]}):null,n.isPending?e.jsx(Z,{}):n.isError?e.jsx(q,{error:n.error}):N.length===0?e.jsx(G,{filtering:o.trim().length>0,hasAny:(n.data??[]).length>0}):e.jsx("ul",{className:"divide-y divide-border rounded-md border border-border bg-card","aria-label":"Tag list",children:N.map(s=>e.jsx(B,{tag:s,selected:g.has(s.name),onToggle:()=>w(s.name),onRename:()=>T(s.name),pinned:c(s.name),onTogglePin:()=>d(s.name),offline:k},s.name))}),n.data&&n.data.length>0?e.jsxs("p",{className:"mt-6 text-xs text-fg-dim",children:[N.length," / ",n.data.length," tag",n.data.length===1?"":"s"]}):null,j!==null?e.jsx(A,{mode:"rename",sources:[j],tagOptions:v,onClose:()=>T(null),pending:y.isPending||b.isPending,offline:k,onRun:s=>y.mutateAsync({oldName:j,newName:s}),onRunMerge:s=>b.mutateAsync({sources:[j],target:s})}):null,h?e.jsx(A,{mode:"merge",sources:Array.from(g),tagOptions:v,onClose:()=>u(!1),pending:b.isPending,offline:k,onRun:async s=>{const t=await b.mutateAsync({sources:Array.from(g),target:s});return f(),t}}):null]})}function B({tag:a,selected:n,onToggle:x,onRename:c,pinned:d,onTogglePin:o,offline:i}){return e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:x,"aria-label":`Select tag ${a.name}`,className:"accent-accent"}),e.jsxs(E,{to:`/?tag=${encodeURIComponent(a.name)}`,className:"flex flex-1 items-baseline gap-2 text-fg hover:text-accent focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsxs("span",{className:"font-mono",children:["#",a.name]}),e.jsx("span",{className:"text-xs text-fg-dim",children:a.count})]}),e.jsx("button",{type:"button",onClick:o,className:d?"text-xs font-medium text-accent hover:text-accent-hover":"text-xs text-fg-muted hover:text-accent","aria-label":d?`Unpin tag ${a.name}`:`Pin tag ${a.name}`,"aria-pressed":d,title:d?"Pinned to home strip — click to unpin":"Pin to home strip",children:d?"★ Pinned":"☆ Pin"}),e.jsx("button",{type:"button",onClick:c,disabled:i,className:"text-xs text-fg-muted hover:text-accent disabled:opacity-40","aria-label":`Rename tag ${a.name}`,children:"Rename"})]})}function K(a,n,x){const c=n.trim().toLowerCase(),o=[...c?a.filter(i=>i.name.toLowerCase().includes(c)):a];return x==="alpha"?o.sort((i,m)=>i.name.localeCompare(m.name)):o.sort((i,m)=>m.count-i.count||i.name.localeCompare(m.name)),o}function Z(){return e.jsx("div",{className:"divide-y divide-border rounded-md border border-border bg-card","aria-busy":"true",children:[0,1,2,3,4].map(a=>e.jsx("div",{className:"h-10 animate-pulse bg-card/60"},a))})}function q({error:a}){const n=a instanceof R;return e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[e.jsx("p",{className:"mb-2 font-medium text-red-400",children:n?"Session expired":"Could not load tags"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:a.message}),n?e.jsx(E,{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]})}function G({filtering:a,hasAny:n}){return a&&n?e.jsx("div",{className:"rounded-md border border-border bg-card p-10 text-center",children:e.jsx("p",{className:"text-fg-muted",children:"No tags match your filter."})}):e.jsxs("div",{className:"rounded-md border border-border bg-card p-10 text-center",children:[e.jsx("p",{className:"mb-3 text-fg-muted",children:"No tags in this vault yet."}),e.jsx(E,{to:"/new",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Create a note"})]})}export{J as Tags};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ac as w,a5 as $,Y as A,z as D,t as e,N as E,L as d,B as C,V as S}from"./index-CeSJJ5Fs.js";import{e as V,b as N,t as g,f as K,p as f}from"./dates-BGZoWpL2.js";function F(){const a=w(i=>i.getActiveVault()),[s]=$(),t=s.get("date"),u=V(),r=t??u,x=N(r),n=A(),c=D.useMemo(()=>{const i=[],m=[];if(!n.data||!x)return{created:i,edited:m};for(const l of n.data){const b=g(l.createdAt),k=g(l.updatedAt??l.createdAt);b===r&&i.push(l),k===r&&b!==r&&m.push(l)}return{created:i,edited:m}},[n.data,x,r]);if(!a)return e.jsx(E,{to:"/",replace:!0});if(!x)return e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("p",{className:"text-sm text-red-400",children:["Invalid date in URL: ",r]}),e.jsx(d,{to:"/today",className:"text-sm text-accent hover:underline",children:"Back to today"})]});const o=r===u,p=j(r,-1),h=j(r,1),v=r.slice(0,7);return e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:o?"Today":"On"}),e.jsx("h1",{className:"font-serif text-2xl tracking-tight md:text-3xl",children:K(r)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(d,{to:`/today?date=${p}`,className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Previous day",children:["← ",p]}),o?null:e.jsx(d,{to:"/today",className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"Today"}),e.jsxs(d,{to:`/today?date=${h}`,className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Next day",children:[h," →"]}),e.jsx(d,{to:`/calendar?month=${v}`,className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"Calendar"}),e.jsx(d,{to:"/capture",className:"rounded-md bg-accent px-3 py-1.5 font-medium text-white hover:bg-accent-hover",children:"+ Capture"})]})]}),n.isPending?e.jsx(B,{}):n.isError?e.jsx(L,{error:n.error}):c.created.length===0&&c.edited.length===0?e.jsx(P,{isToday:o,targetKey:r}):e.jsxs("div",{className:"space-y-8",children:[c.created.length>0?e.jsx(y,{title:o?"Created today":`Created on ${r}`,notes:c.created}):null,c.edited.length>0?e.jsx(y,{title:o?"Edited today":`Edited on ${r}`,notes:c.edited}):null]})]})}function j(a,s){const t=N(a);return t?(t.setDate(t.getDate()+s),`${t.getFullYear()}-${f(t.getMonth()+1)}-${f(t.getDate())}`):a}function y({title:a,notes:s}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-2 text-xs uppercase tracking-wider text-fg-dim",children:[a," (",s.length,")"]}),e.jsx("ol",{className:"divide-y divide-border rounded-md border border-border bg-card",children:s.map(t=>e.jsx("li",{children:e.jsxs(d,{to:`/n/${encodeURIComponent(t.id)}`,className:"block px-4 py-3 hover:bg-bg/60 focus:bg-bg/60 focus:outline-none",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsx("span",{className:"truncate font-mono text-sm text-fg",children:t.path??t.id}),e.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:C(t.updatedAt??t.createdAt)})]}),t.preview?e.jsx("p",{className:"mt-1 truncate text-sm text-fg-muted",children:t.preview}):null]})},t.id))})]})}function P({isToday:a,targetKey:s}){return e.jsxs("div",{className:"rounded-md border border-border bg-card p-10 text-center",children:[e.jsx("p",{className:"mb-4 text-fg-muted",children:a?"Nothing yet today — start capturing.":`Nothing on ${s}.`}),a?e.jsx(d,{to:"/capture",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Open capture"}):null]})}function B(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3].map(a=>e.jsx("div",{className:"h-14 animate-pulse rounded-md bg-border/30"},a))})}function L({error:a}){const s=a instanceof S;return e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[e.jsx("p",{className:"mb-2 font-medium text-red-400",children:s?"Session expired":"Could not load notes"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:a.message}),s?e.jsx(d,{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{F as Today};
|