@openparachute/app 0.22.9 → 0.22.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.parachute/info +1 -1
- package/dist/assets/{Account-BS79MR2p.js → Account-Cl5c8tEo.js} +1 -1
- package/dist/assets/{Activity-BCI-VU_G.js → Activity-BcJHDfuw.js} +1 -1
- package/dist/assets/{AddVault-BGmLnyvr.js → AddVault-DoCaI37K.js} +1 -1
- package/dist/assets/{AddVaultChooser-BOYsRq-6.js → AddVaultChooser-Xvu3Uphy.js} +1 -1
- package/dist/assets/{AddVaultCreate-VvY9DfX7.js → AddVaultCreate-Di9wcscn.js} +1 -1
- package/dist/assets/{Calendar-CStTh0s6.js → Calendar-DBe5DpLx.js} +1 -1
- package/dist/assets/{CheckEmail-D1qSfrIa.js → CheckEmail-ntqd1kZe.js} +1 -1
- package/dist/assets/{ConnectAI-_yRQ6PVE.js → ConnectAI-CUJNLwHZ.js} +1 -1
- package/dist/assets/{DayView-CP-3vwhX.js → DayView-jTXjnokv.js} +1 -1
- package/dist/assets/{Export-BN79ECKv.js → Export-BFGWcvOW.js} +1 -1
- package/dist/assets/{Import-CGC0ejYh.js → Import-2WIsPfSi.js} +1 -1
- package/dist/assets/{NoteEditor-7Ul1HK8m.js → NoteEditor-DT4kYH2h.js} +1 -1
- package/dist/assets/NoteNew-B7fbwu7C.js +8 -0
- package/dist/assets/{NoteRenderer-CyTOvjQK.js → NoteRenderer-DG6I-BOG.js} +1 -1
- package/dist/assets/NoteView-Dy3cUyrT.js +3 -0
- package/dist/assets/{OAuthCallback-DXQknDTs.js → OAuthCallback-W5STO-7I.js} +1 -1
- package/dist/assets/{PinArchiveButtons-CJcBoOpQ.js → PinArchiveButtons-8xFKv2oH.js} +1 -1
- package/dist/assets/Settings-ClPAPWCJ.js +1 -0
- package/dist/assets/{TagPage-CHDSvaJ4.js → TagPage-pYbWcmlY.js} +1 -1
- package/dist/assets/{TagSchemaEditor-Qk8dM9DF.js → TagSchemaEditor-ve19B-tr.js} +1 -1
- package/dist/assets/{Tags-BKTmTns9.js → Tags-DGl9Zubj.js} +1 -1
- package/dist/assets/{VaultGraph-CX2MzD9D.js → VaultGraph-BrDsta1c.js} +2 -2
- package/dist/assets/{Vaults-B9uh43KI.js → Vaults-DWoDm-Th.js} +1 -1
- package/dist/assets/{ViewNew-C6gk4Ujs.js → ViewNew-D3N3bUyp.js} +1 -1
- package/dist/assets/{ViewSurface-B-DhVasF.js → ViewSurface-CB97Dtg8.js} +1 -1
- package/dist/assets/{Welcome-pHYMoace.js → Welcome-C6zOVULl.js} +1 -1
- package/dist/assets/{WizardShell-Dbn_qWnU.js → WizardShell-eATuMAXz.js} +1 -1
- package/dist/assets/{attachment-upload-BfsE-IDX.js → attachment-upload-D6wfJsr6.js} +1 -1
- package/dist/assets/{history-BU5ztowk.js → history-BHtc79G3.js} +1 -1
- package/dist/assets/index-BKfqr8sS.js +66 -0
- package/dist/assets/{index-rEtUY3V3.css → index-DBJfPBlG.css} +1 -1
- package/dist/assets/{provenance-BoiAp4jO.js → provenance-BFQb2w9-.js} +1 -1
- package/dist/assets/{react-force-graph-2d-CAZ4sIdb.js → react-force-graph-2d-BZd7whjL.js} +1 -1
- package/dist/assets/{transcribe-default-3hayXb7m.js → transcribe-default-Cjxt7F_e.js} +1 -1
- package/dist/assets/{useAttachmentUploader-BPyx3tZN.js → useAttachmentUploader-Be6yFw7I.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/NoteNew-B-Lomu-W.js +0 -8
- package/dist/assets/NoteView-CCQoXBAK.js +0 -3
- package/dist/assets/Settings-BvqkQbc1.js +0 -1
- package/dist/assets/index-BhV_u6Bm.js +0 -66
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as at,
|
|
1
|
+
import{r as at,c8 as _o,ac as vo}from"./index-BKfqr8sS.js";function mo(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(c){f=!0,o=c}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function xo(e,n,r){return n=To(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Kn(e,n){return ko(e)||mo(e,n)||oi(e,n)||So()}function bo(e){return wo(e)||Ao(e)||oi(e)||Co()}function wo(e){if(Array.isArray(e))return gn(e)}function ko(e){if(Array.isArray(e))return e}function Ao(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function oi(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 Co(){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 So(){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 Mo(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 To(e){var n=Mo(e,"string");return typeof n=="symbol"?n:String(n)}var Po=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(bo(Object.entries(n).filter(function(o){var a=Kn(o,1),s=a[0];return!i.has(s)}).map(function(o){var a=Kn(o,2),s=a[0],u=a[1];return xo({},s,u)}))))};function Oo(e,{wrapperElementType:n="div",nodeMapper:r=a=>a,methodNames:i=[],initPropNames:o=[]}={}){return at.forwardRef((a,s)=>{const u=at.useRef(),l=at.useMemo(()=>{const h=Object.fromEntries(o.filter(d=>a.hasOwnProperty(d)).map(d=>[d,a[d]]));return e(h)},[]);Qn(()=>{l(r(u.current))},at.useLayoutEffect),Qn(()=>l._destructor instanceof Function?l._destructor:void 0);const f=at.useCallback((h,...d)=>l[h]instanceof Function?l[h](...d):void 0,[l]),c=at.useRef({});return Object.keys(Po(a,[...i,...o])).filter(h=>c.current[h]!==a[h]).forEach(h=>f(h,a[h])),c.current=a,at.useImperativeHandle(s,()=>Object.fromEntries(i.map(h=>[h,(...d)=>f(h,...d)])),[f]),_o.createElement(n,{ref:u})})}function Qn(e,n=at.useEffect){const r=at.useRef(),i=at.useRef(!1),o=at.useRef(!1),[a,s]=at.useState(0);i.current&&(o.current=!0),n(()=>(i.current||(r.current=e(),i.current=!0),s(u=>u+1),()=>{o.current&&(r.current&&r.current(),r.current=void 0,i.current=!1,o.current=!1)}),[])}var yn="http://www.w3.org/1999/xhtml";const Jn={svg:"http://www.w3.org/2000/svg",xhtml:yn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Be(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Jn.hasOwnProperty(n)?{space:Jn[n],local:e}:e}function Eo(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===yn&&n.documentElement.namespaceURI===yn?n.createElement(e):n.createElementNS(r,e)}}function zo(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ai(e){var n=Be(e);return(n.local?zo:Eo)(n)}function Ro(){}function Nn(e){return e==null?Ro:function(){return this.querySelector(e)}}function No(e){typeof e!="function"&&(e=Nn(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var a=n[o],s=a.length,u=i[o]=new Array(s),l,f,c=0;c<s;++c)(l=a[c])&&(f=e.call(l,l.__data__,c,a))&&("__data__"in l&&(f.__data__=l.__data__),u[c]=f);return new rt(i,this._parents)}function Io(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Do(){return[]}function si(e){return e==null?Do:function(){return this.querySelectorAll(e)}}function $o(e){return function(){return Io(e.apply(this,arguments))}}function jo(e){typeof e=="function"?e=$o(e):e=si(e);for(var n=this._groups,r=n.length,i=[],o=[],a=0;a<r;++a)for(var s=n[a],u=s.length,l,f=0;f<u;++f)(l=s[f])&&(i.push(e.call(l,l.__data__,f,s)),o.push(l));return new rt(i,o)}function ui(e){return function(){return this.matches(e)}}function li(e){return function(n){return n.matches(e)}}var Fo=Array.prototype.find;function Uo(e){return function(){return Fo.call(this.children,e)}}function Lo(){return this.firstElementChild}function qo(e){return this.select(e==null?Lo:Uo(typeof e=="function"?e:li(e)))}var Ho=Array.prototype.filter;function Go(){return Array.from(this.children)}function Vo(e){return function(){return Ho.call(this.children,e)}}function Wo(e){return this.selectAll(e==null?Go:Vo(typeof e=="function"?e:li(e)))}function Bo(e){typeof e!="function"&&(e=ui(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var a=n[o],s=a.length,u=i[o]=[],l,f=0;f<s;++f)(l=a[f])&&e.call(l,l.__data__,f,a)&&u.push(l);return new rt(i,this._parents)}function fi(e){return new Array(e.length)}function Xo(){return new rt(this._enter||this._groups.map(fi),this._parents)}function Re(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Re.prototype={constructor:Re,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Yo(e){return function(){return e}}function Zo(e,n,r,i,o,a){for(var s=0,u,l=n.length,f=a.length;s<f;++s)(u=n[s])?(u.__data__=a[s],i[s]=u):r[s]=new Re(e,a[s]);for(;s<l;++s)(u=n[s])&&(o[s]=u)}function Ko(e,n,r,i,o,a,s){var u,l,f=new Map,c=n.length,h=a.length,d=new Array(c),p;for(u=0;u<c;++u)(l=n[u])&&(d[u]=p=s.call(l,l.__data__,u,n)+"",f.has(p)?o[u]=l:f.set(p,l));for(u=0;u<h;++u)p=s.call(e,a[u],u,a)+"",(l=f.get(p))?(i[u]=l,l.__data__=a[u],f.delete(p)):r[u]=new Re(e,a[u]);for(u=0;u<c;++u)(l=n[u])&&f.get(d[u])===l&&(o[u]=l)}function Qo(e){return e.__data__}function Jo(e,n){if(!arguments.length)return Array.from(this,Qo);var r=n?Ko:Zo,i=this._parents,o=this._groups;typeof e!="function"&&(e=Yo(e));for(var a=o.length,s=new Array(a),u=new Array(a),l=new Array(a),f=0;f<a;++f){var c=i[f],h=o[f],d=h.length,p=ta(e.call(c,c&&c.__data__,f,i)),y=p.length,x=u[f]=new Array(y),_=s[f]=new Array(y),g=l[f]=new Array(d);r(c,h,x,_,g,p,n);for(var w=0,S=0,b,m;w<y;++w)if(b=x[w]){for(w>=S&&(S=w+1);!(m=_[S])&&++S<y;);b._next=m||null}}return s=new rt(s,i),s._enter=u,s._exit=l,s}function ta(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ea(){return new rt(this._exit||this._groups.map(fi),this._parents)}function na(e,n,r){var i=this.enter(),o=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?a.remove():r(a),i&&o?i.merge(o).order():o}function ra(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,a=i.length,s=Math.min(o,a),u=new Array(o),l=0;l<s;++l)for(var f=r[l],c=i[l],h=f.length,d=u[l]=new Array(h),p,y=0;y<h;++y)(p=f[y]||c[y])&&(d[y]=p);for(;l<o;++l)u[l]=r[l];return new rt(u,this._parents)}function ia(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,a=i[o],s;--o>=0;)(s=i[o])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function oa(e){e||(e=aa);function n(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a){for(var s=r[a],u=s.length,l=o[a]=new Array(u),f,c=0;c<u;++c)(f=s[c])&&(l[c]=f);l.sort(n)}return new rt(o,this._parents).order()}function aa(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function sa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ua(){return Array.from(this)}function la(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,a=i.length;o<a;++o){var s=i[o];if(s)return s}return null}function fa(){let e=0;for(const n of this)++e;return e}function ca(){return!this.node()}function ha(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],a=0,s=o.length,u;a<s;++a)(u=o[a])&&e.call(u,u.__data__,a,o);return this}function da(e){return function(){this.removeAttribute(e)}}function pa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ga(e,n){return function(){this.setAttribute(e,n)}}function ya(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function _a(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function va(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function ma(e,n){var r=Be(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?pa:da:typeof n=="function"?r.local?va:_a:r.local?ya:ga)(r,n))}function ci(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xa(e){return function(){this.style.removeProperty(e)}}function ba(e,n,r){return function(){this.style.setProperty(e,n,r)}}function wa(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function ka(e,n,r){return arguments.length>1?this.each((n==null?xa:typeof n=="function"?wa:ba)(e,n,r??"")):Vt(this.node(),e)}function Vt(e,n){return e.style.getPropertyValue(n)||ci(e).getComputedStyle(e,null).getPropertyValue(n)}function Aa(e){return function(){delete this[e]}}function Ca(e,n){return function(){this[e]=n}}function Sa(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Ma(e,n){return arguments.length>1?this.each((n==null?Aa:typeof n=="function"?Sa:Ca)(e,n)):this.node()[e]}function hi(e){return e.trim().split(/^|\s+/)}function In(e){return e.classList||new di(e)}function di(e){this._node=e,this._names=hi(e.getAttribute("class")||"")}di.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function pi(e,n){for(var r=In(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function gi(e,n){for(var r=In(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function Ta(e){return function(){pi(this,e)}}function Pa(e){return function(){gi(this,e)}}function Oa(e,n){return function(){(n.apply(this,arguments)?pi:gi)(this,e)}}function Ea(e,n){var r=hi(e+"");if(arguments.length<2){for(var i=In(this.node()),o=-1,a=r.length;++o<a;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?Oa:n?Ta:Pa)(r,n))}function za(){this.textContent=""}function Ra(e){return function(){this.textContent=e}}function Na(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Ia(e){return arguments.length?this.each(e==null?za:(typeof e=="function"?Na:Ra)(e)):this.node().textContent}function Da(){this.innerHTML=""}function $a(e){return function(){this.innerHTML=e}}function ja(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Fa(e){return arguments.length?this.each(e==null?Da:(typeof e=="function"?ja:$a)(e)):this.node().innerHTML}function Ua(){this.nextSibling&&this.parentNode.appendChild(this)}function La(){return this.each(Ua)}function qa(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ha(){return this.each(qa)}function Ga(e){var n=typeof e=="function"?e:ai(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Va(){return null}function Wa(e,n){var r=typeof e=="function"?e:ai(e),i=n==null?Va:typeof n=="function"?n:Nn(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function Ba(){var e=this.parentNode;e&&e.removeChild(this)}function Xa(){return this.each(Ba)}function Ya(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Za(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Ka(e){return this.select(e?Za:Ya)}function Qa(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ja(e){return function(n){e.call(this,n,this.__data__)}}function ts(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function es(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,a;r<o;++r)a=n[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):n[++i]=a;++i?n.length=i:delete this.__on}}}function ns(e,n,r){return function(){var i=this.__on,o,a=Ja(n);if(i){for(var s=0,u=i.length;s<u;++s)if((o=i[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=a,o.options=r),o.value=n;return}}this.addEventListener(e.type,a,r),o={type:e.type,name:e.name,value:n,listener:a,options:r},i?i.push(o):this.__on=[o]}}function rs(e,n,r){var i=ts(e+""),o,a=i.length,s;if(arguments.length<2){var u=this.node().__on;if(u){for(var l=0,f=u.length,c;l<f;++l)for(o=0,c=u[l];o<a;++o)if((s=i[o]).type===c.type&&s.name===c.name)return c.value}return}for(u=n?ns:es,o=0;o<a;++o)this.each(u(i[o],n,r));return this}function yi(e,n,r){var i=ci(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function is(e,n){return function(){return yi(this,e,n)}}function os(e,n){return function(){return yi(this,e,n.apply(this,arguments))}}function as(e,n){return this.each((typeof n=="function"?os:is)(e,n))}function*ss(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&(yield s)}var _i=[null];function rt(e,n){this._groups=e,this._parents=n}function ye(){return new rt([[document.documentElement]],_i)}function us(){return this}rt.prototype=ye.prototype={constructor:rt,select:No,selectAll:jo,selectChild:qo,selectChildren:Wo,filter:Bo,data:Jo,enter:Xo,exit:ea,join:na,merge:ra,selection:us,order:ia,sort:oa,call:sa,nodes:ua,node:la,size:fa,empty:ca,each:ha,attr:ma,style:ka,property:Ma,classed:Ea,text:Ia,html:Fa,raise:La,lower:Ha,append:Ga,insert:Wa,remove:Xa,clone:Ka,datum:Qa,on:rs,dispatch:as,[Symbol.iterator]:ss};function st(e){return typeof e=="string"?new rt([[document.querySelector(e)]],[document.documentElement]):new rt([[e]],_i)}function ls(e){let n;for(;n=e.sourceEvent;)e=n;return e}function yt(e,n){if(e=ls(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}var fs={value:()=>{}};function _e(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Me(r)}function Me(e){this._=e}function cs(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Me.prototype=_e.prototype={constructor:Me,on:function(e,n){var r=this._,i=cs(e+"",r),o,a=-1,s=i.length;if(arguments.length<2){for(;++a<s;)if((o=(e=i[a]).type)&&(o=hs(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<s;)if(o=(e=i[a]).type)r[o]=tr(r[o],e.name,n);else if(n==null)for(o in r)r[o]=tr(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new Me(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,a;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,o=a.length;i<o;++i)a[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,a=i.length;o<a;++o)i[o].value.apply(n,r)}};function hs(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function tr(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=fs,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}const ds={passive:!1},fe={capture:!0,passive:!1};function en(e){e.stopImmediatePropagation()}function Ht(e){e.preventDefault(),e.stopImmediatePropagation()}function vi(e){var n=e.document.documentElement,r=st(e).on("dragstart.drag",Ht,fe);"onselectstart"in n?r.on("selectstart.drag",Ht,fe):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function mi(e,n){var r=e.document.documentElement,i=st(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ht,fe),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const xe=e=>()=>e;function _n(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:a,x:s,y:u,dx:l,dy:f,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:c}})}_n.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ps(e){return!e.ctrlKey&&!e.button}function gs(){return this.parentNode}function ys(e,n){return n??{x:e.x,y:e.y}}function _s(){return navigator.maxTouchPoints||"ontouchstart"in this}function vs(){var e=ps,n=gs,r=ys,i=_s,o={},a=_e("start","drag","end"),s=0,u,l,f,c,h=0;function d(b){b.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",g,ds).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(b,m){if(!(c||!e.call(this,b,m))){var A=S(this,n.call(this,b,m),b,m,"mouse");A&&(st(b.view).on("mousemove.drag",y,fe).on("mouseup.drag",x,fe),vi(b.view),en(b),f=!1,u=b.clientX,l=b.clientY,A("start",b))}}function y(b){if(Ht(b),!f){var m=b.clientX-u,A=b.clientY-l;f=m*m+A*A>h}o.mouse("drag",b)}function x(b){st(b.view).on("mousemove.drag mouseup.drag",null),mi(b.view,f),Ht(b),o.mouse("end",b)}function _(b,m){if(e.call(this,b,m)){var A=b.changedTouches,C=n.call(this,b,m),M=A.length,z,P;for(z=0;z<M;++z)(P=S(this,C,b,m,A[z].identifier,A[z]))&&(en(b),P("start",b,A[z]))}}function g(b){var m=b.changedTouches,A=m.length,C,M;for(C=0;C<A;++C)(M=o[m[C].identifier])&&(Ht(b),M("drag",b,m[C]))}function w(b){var m=b.changedTouches,A=m.length,C,M;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),C=0;C<A;++C)(M=o[m[C].identifier])&&(en(b),M("end",b,m[C]))}function S(b,m,A,C,M,z){var P=a.copy(),R=yt(z||A,m),N,j,k;if((k=r.call(b,new _n("beforestart",{sourceEvent:A,target:d,identifier:M,active:s,x:R[0],y:R[1],dx:0,dy:0,dispatch:P}),C))!=null)return N=k.x-R[0]||0,j=k.y-R[1]||0,function E(T,I,$){var F=R,U;switch(T){case"start":o[M]=E,U=s++;break;case"end":delete o[M],--s;case"drag":R=yt($||I,m),U=s;break}P.call(T,b,new _n(T,{sourceEvent:I,subject:k,target:d,identifier:M,active:U,x:R[0]+N,y:R[1]+j,dx:R[0]-F[0],dy:R[1]-F[1],dispatch:P}),C)}}return d.filter=function(b){return arguments.length?(e=typeof b=="function"?b:xe(!!b),d):e},d.container=function(b){return arguments.length?(n=typeof b=="function"?b:xe(b),d):n},d.subject=function(b){return arguments.length?(r=typeof b=="function"?b:xe(b),d):r},d.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:xe(!!b),d):i},d.on=function(){var b=a.on.apply(a,arguments);return b===a?d:b},d.clickDistance=function(b){return arguments.length?(h=(b=+b)*b,d):Math.sqrt(h)},d}function Dn(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function xi(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function ve(){}var ce=.7,Ne=1/ce,Gt="\\s*([+-]?\\d+)\\s*",he="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ms=/^#([0-9a-f]{3,8})$/,xs=new RegExp(`^rgb\\(${Gt},${Gt},${Gt}\\)$`),bs=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),ws=new RegExp(`^rgba\\(${Gt},${Gt},${Gt},${he}\\)$`),ks=new RegExp(`^rgba\\(${vt},${vt},${vt},${he}\\)$`),As=new RegExp(`^hsl\\(${he},${vt},${vt}\\)$`),Cs=new RegExp(`^hsla\\(${he},${vt},${vt},${he}\\)$`),er={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Dn(ve,de,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:nr,formatHex:nr,formatHex8:Ss,formatHsl:Ms,formatRgb:rr,toString:rr});function nr(){return this.rgb().formatHex()}function Ss(){return this.rgb().formatHex8()}function Ms(){return bi(this).formatHsl()}function rr(){return this.rgb().formatRgb()}function de(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=ms.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?ir(n):r===3?new tt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?be(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?be(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=xs.exec(e))?new tt(n[1],n[2],n[3],1):(n=bs.exec(e))?new tt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=ws.exec(e))?be(n[1],n[2],n[3],n[4]):(n=ks.exec(e))?be(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=As.exec(e))?sr(n[1],n[2]/100,n[3]/100,1):(n=Cs.exec(e))?sr(n[1],n[2]/100,n[3]/100,n[4]):er.hasOwnProperty(e)?ir(er[e]):e==="transparent"?new tt(NaN,NaN,NaN,0):null}function ir(e){return new tt(e>>16&255,e>>8&255,e&255,1)}function be(e,n,r,i){return i<=0&&(e=n=r=NaN),new tt(e,n,r,i)}function Ts(e){return e instanceof ve||(e=de(e)),e?(e=e.rgb(),new tt(e.r,e.g,e.b,e.opacity)):new tt}function vn(e,n,r,i){return arguments.length===1?Ts(e):new tt(e,n,r,i??1)}function tt(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Dn(tt,vn,xi(ve,{brighter(e){return e=e==null?Ne:Math.pow(Ne,e),new tt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ce:Math.pow(ce,e),new tt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tt(jt(this.r),jt(this.g),jt(this.b),Ie(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:or,formatHex:or,formatHex8:Ps,formatRgb:ar,toString:ar}));function or(){return`#${$t(this.r)}${$t(this.g)}${$t(this.b)}`}function Ps(){return`#${$t(this.r)}${$t(this.g)}${$t(this.b)}${$t((isNaN(this.opacity)?1:this.opacity)*255)}`}function ar(){const e=Ie(this.opacity);return`${e===1?"rgb(":"rgba("}${jt(this.r)}, ${jt(this.g)}, ${jt(this.b)}${e===1?")":`, ${e})`}`}function Ie(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $t(e){return e=jt(e),(e<16?"0":"")+e.toString(16)}function sr(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new ht(e,n,r,i)}function bi(e){if(e instanceof ht)return new ht(e.h,e.s,e.l,e.opacity);if(e instanceof ve||(e=de(e)),!e)return new ht;if(e instanceof ht)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),a=Math.max(n,r,i),s=NaN,u=a-o,l=(a+o)/2;return u?(n===a?s=(r-i)/u+(r<i)*6:r===a?s=(i-n)/u+2:s=(n-r)/u+4,u/=l<.5?a+o:2-a-o,s*=60):u=l>0&&l<1?0:s,new ht(s,u,l,e.opacity)}function Os(e,n,r,i){return arguments.length===1?bi(e):new ht(e,n,r,i??1)}function ht(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Dn(ht,Os,xi(ve,{brighter(e){return e=e==null?Ne:Math.pow(Ne,e),new ht(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ce:Math.pow(ce,e),new ht(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new tt(nn(e>=240?e-240:e+120,o,i),nn(e,o,i),nn(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new ht(ur(this.h),we(this.s),we(this.l),Ie(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ie(this.opacity);return`${e===1?"hsl(":"hsla("}${ur(this.h)}, ${we(this.s)*100}%, ${we(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ur(e){return e=(e||0)%360,e<0?e+360:e}function we(e){return Math.max(0,Math.min(1,e||0))}function nn(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const wi=e=>()=>e;function Es(e,n){return function(r){return e+r*n}}function zs(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function Rs(e){return(e=+e)==1?ki:function(n,r){return r-n?zs(n,r,e):wi(isNaN(n)?r:n)}}function ki(e,n){var r=n-e;return r?Es(e,r):wi(isNaN(e)?n:e)}const lr=(function e(n){var r=Rs(n);function i(o,a){var s=r((o=vn(o)).r,(a=vn(a)).r),u=r(o.g,a.g),l=r(o.b,a.b),f=ki(o.opacity,a.opacity);return function(c){return o.r=s(c),o.g=u(c),o.b=l(c),o.opacity=f(c),o+""}}return i.gamma=e,i})(1);function Nt(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var mn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rn=new RegExp(mn.source,"g");function Ns(e){return function(){return e}}function Is(e){return function(n){return e(n)+""}}function Ds(e,n){var r=mn.lastIndex=rn.lastIndex=0,i,o,a,s=-1,u=[],l=[];for(e=e+"",n=n+"";(i=mn.exec(e))&&(o=rn.exec(n));)(a=o.index)>r&&(a=n.slice(r,a),u[s]?u[s]+=a:u[++s]=a),(i=i[0])===(o=o[0])?u[s]?u[s]+=o:u[++s]=o:(u[++s]=null,l.push({i:s,x:Nt(i,o)})),r=rn.lastIndex;return r<n.length&&(a=n.slice(r),u[s]?u[s]+=a:u[++s]=a),u.length<2?l[0]?Is(l[0].x):Ns(n):(n=l.length,function(f){for(var c=0,h;c<n;++c)u[(h=l[c]).i]=h.x(f);return u.join("")})}var fr=180/Math.PI,xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ai(e,n,r,i,o,a){var s,u,l;return(s=Math.sqrt(e*e+n*n))&&(e/=s,n/=s),(l=e*r+n*i)&&(r-=e*l,i-=n*l),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,l/=u),e*i<n*r&&(e=-e,n=-n,l=-l,s=-s),{translateX:o,translateY:a,rotate:Math.atan2(n,e)*fr,skewX:Math.atan(l)*fr,scaleX:s,scaleY:u}}var ke;function $s(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?xn:Ai(n.a,n.b,n.c,n.d,n.e,n.f)}function js(e){return e==null||(ke||(ke=document.createElementNS("http://www.w3.org/2000/svg","g")),ke.setAttribute("transform",e),!(e=ke.transform.baseVal.consolidate()))?xn:(e=e.matrix,Ai(e.a,e.b,e.c,e.d,e.e,e.f))}function Ci(e,n,r,i){function o(f){return f.length?f.pop()+" ":""}function a(f,c,h,d,p,y){if(f!==h||c!==d){var x=p.push("translate(",null,n,null,r);y.push({i:x-4,x:Nt(f,h)},{i:x-2,x:Nt(c,d)})}else(h||d)&&p.push("translate("+h+n+d+r)}function s(f,c,h,d){f!==c?(f-c>180?c+=360:c-f>180&&(f+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Nt(f,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(f,c,h,d){f!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Nt(f,c)}):c&&h.push(o(h)+"skewX("+c+i)}function l(f,c,h,d,p,y){if(f!==h||c!==d){var x=p.push(o(p)+"scale(",null,",",null,")");y.push({i:x-4,x:Nt(f,h)},{i:x-2,x:Nt(c,d)})}else(h!==1||d!==1)&&p.push(o(p)+"scale("+h+","+d+")")}return function(f,c){var h=[],d=[];return f=e(f),c=e(c),a(f.translateX,f.translateY,c.translateX,c.translateY,h,d),s(f.rotate,c.rotate,h,d),u(f.skewX,c.skewX,h,d),l(f.scaleX,f.scaleY,c.scaleX,c.scaleY,h,d),f=c=null,function(p){for(var y=-1,x=d.length,_;++y<x;)h[(_=d[y]).i]=_.x(p);return h.join("")}}}var Fs=Ci($s,"px, ","px)","deg)"),Us=Ci(js,", ",")",")"),Ls=1e-12;function cr(e){return((e=Math.exp(e))+1/e)/2}function qs(e){return((e=Math.exp(e))-1/e)/2}function Hs(e){return((e=Math.exp(2*e))-1)/(e+1)}const Gs=(function e(n,r,i){function o(a,s){var u=a[0],l=a[1],f=a[2],c=s[0],h=s[1],d=s[2],p=c-u,y=h-l,x=p*p+y*y,_,g;if(x<Ls)g=Math.log(d/f)/n,_=function(C){return[u+C*p,l+C*y,f*Math.exp(n*C*g)]};else{var w=Math.sqrt(x),S=(d*d-f*f+i*x)/(2*f*r*w),b=(d*d-f*f-i*x)/(2*d*r*w),m=Math.log(Math.sqrt(S*S+1)-S),A=Math.log(Math.sqrt(b*b+1)-b);g=(A-m)/n,_=function(C){var M=C*g,z=cr(m),P=f/(r*w)*(z*Hs(n*M+m)-qs(m));return[u+P*p,l+P*y,f*z/cr(n*M+m)]}}return _.duration=g*1e3*n/Math.SQRT2,_}return o.rho=function(a){var s=Math.max(.001,+a),u=s*s,l=u*u;return e(s,u,l)},o})(Math.SQRT2,2,4);var Wt=0,ne=0,Xt=0,Si=1e3,De,re,$e=0,Ut=0,Xe=0,pe=typeof performance=="object"&&performance.now?performance:Date,Mi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $n(){return Ut||(Mi(Vs),Ut=pe.now()+Xe)}function Vs(){Ut=0}function je(){this._call=this._time=this._next=null}je.prototype=jn.prototype={constructor:je,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?$n():+r)+(n==null?0:+n),!this._next&&re!==this&&(re?re._next=this:De=this,re=this),this._call=e,this._time=r,bn()},stop:function(){this._call&&(this._call=null,this._time=1/0,bn())}};function jn(e,n,r){var i=new je;return i.restart(e,n,r),i}function Ws(){$n(),++Wt;for(var e=De,n;e;)(n=Ut-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Wt}function hr(){Ut=($e=pe.now())+Xe,Wt=ne=0;try{Ws()}finally{Wt=0,Xs(),Ut=0}}function Bs(){var e=pe.now(),n=e-$e;n>Si&&(Xe-=n,$e=e)}function Xs(){for(var e,n=De,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:De=r);re=e,bn(i)}function bn(e){if(!Wt){ne&&(ne=clearTimeout(ne));var n=e-Ut;n>24?(e<1/0&&(ne=setTimeout(hr,e-pe.now()-Xe)),Xt&&(Xt=clearInterval(Xt))):(Xt||($e=pe.now(),Xt=setInterval(Bs,Si)),Wt=1,Mi(hr))}}function dr(e,n,r){var i=new je;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var Ys=_e("start","end","cancel","interrupt"),Zs=[],Ti=0,pr=1,wn=2,Te=3,gr=4,kn=5,Pe=6;function Ye(e,n,r,i,o,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;Ks(e,r,{name:n,index:i,group:o,on:Ys,tween:Zs,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Ti})}function Fn(e,n){var r=pt(e,n);if(r.state>Ti)throw new Error("too late; already scheduled");return r}function xt(e,n){var r=pt(e,n);if(r.state>Te)throw new Error("too late; already running");return r}function pt(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function Ks(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=jn(a,0,r.time);function a(f){r.state=pr,r.timer.restart(s,r.delay,r.time),r.delay<=f&&s(f-r.delay)}function s(f){var c,h,d,p;if(r.state!==pr)return l();for(c in i)if(p=i[c],p.name===r.name){if(p.state===Te)return dr(s);p.state===gr?(p.state=Pe,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[c]):+c<n&&(p.state=Pe,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[c])}if(dr(function(){r.state===Te&&(r.state=gr,r.timer.restart(u,r.delay,r.time),u(f))}),r.state=wn,r.on.call("start",e,e.__data__,r.index,r.group),r.state===wn){for(r.state=Te,o=new Array(d=r.tween.length),c=0,h=-1;c<d;++c)(p=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(o[++h]=p);o.length=h+1}}function u(f){for(var c=f<r.duration?r.ease.call(null,f/r.duration):(r.timer.restart(l),r.state=kn,1),h=-1,d=o.length;++h<d;)o[h].call(e,c);r.state===kn&&(r.on.call("end",e,e.__data__,r.index,r.group),l())}function l(){r.state=Pe,r.timer.stop(),delete i[n];for(var f in i)return;delete e.__transition}}function Oe(e,n){var r=e.__transition,i,o,a=!0,s;if(r){n=n==null?null:n+"";for(s in r){if((i=r[s]).name!==n){a=!1;continue}o=i.state>wn&&i.state<kn,i.state=Pe,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[s]}a&&delete e.__transition}}function Qs(e){return this.each(function(){Oe(this,e)})}function Js(e,n){var r,i;return function(){var o=xt(this,e),a=o.tween;if(a!==r){i=r=a;for(var s=0,u=i.length;s<u;++s)if(i[s].name===n){i=i.slice(),i.splice(s,1);break}}o.tween=i}}function tu(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var a=xt(this,e),s=a.tween;if(s!==i){o=(i=s).slice();for(var u={name:n,value:r},l=0,f=o.length;l<f;++l)if(o[l].name===n){o[l]=u;break}l===f&&o.push(u)}a.tween=o}}function eu(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=pt(this.node(),r).tween,o=0,a=i.length,s;o<a;++o)if((s=i[o]).name===e)return s.value;return null}return this.each((n==null?Js:tu)(r,e,n))}function Un(e,n,r){var i=e._id;return e.each(function(){var o=xt(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return pt(o,i).value[n]}}function Pi(e,n){var r;return(typeof n=="number"?Nt:n instanceof de?lr:(r=de(n))?(n=r,lr):Ds)(e,n)}function nu(e){return function(){this.removeAttribute(e)}}function ru(e){return function(){this.removeAttributeNS(e.space,e.local)}}function iu(e,n,r){var i,o=r+"",a;return function(){var s=this.getAttribute(e);return s===o?null:s===i?a:a=n(i=s,r)}}function ou(e,n,r){var i,o=r+"",a;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===i?a:a=n(i=s,r)}}function au(e,n,r){var i,o,a;return function(){var s,u=r(this),l;return u==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=u+"",s===l?null:s===i&&l===o?a:(o=l,a=n(i=s,u)))}}function su(e,n,r){var i,o,a;return function(){var s,u=r(this),l;return u==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=u+"",s===l?null:s===i&&l===o?a:(o=l,a=n(i=s,u)))}}function uu(e,n){var r=Be(e),i=r==="transform"?Us:Pi;return this.attrTween(e,typeof n=="function"?(r.local?su:au)(r,i,Un(this,"attr."+e,n)):n==null?(r.local?ru:nu)(r):(r.local?ou:iu)(r,i,n))}function lu(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function fu(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function cu(e,n){var r,i;function o(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&fu(e,a)),r}return o._value=n,o}function hu(e,n){var r,i;function o(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&lu(e,a)),r}return o._value=n,o}function du(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=Be(e);return this.tween(r,(i.local?cu:hu)(i,n))}function pu(e,n){return function(){Fn(this,e).delay=+n.apply(this,arguments)}}function gu(e,n){return n=+n,function(){Fn(this,e).delay=n}}function yu(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?pu:gu)(n,e)):pt(this.node(),n).delay}function _u(e,n){return function(){xt(this,e).duration=+n.apply(this,arguments)}}function vu(e,n){return n=+n,function(){xt(this,e).duration=n}}function mu(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?_u:vu)(n,e)):pt(this.node(),n).duration}function xu(e,n){if(typeof n!="function")throw new Error;return function(){xt(this,e).ease=n}}function bu(e){var n=this._id;return arguments.length?this.each(xu(n,e)):pt(this.node(),n).ease}function wu(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;xt(this,e).ease=r}}function ku(e){if(typeof e!="function")throw new Error;return this.each(wu(this._id,e))}function Au(e){typeof e!="function"&&(e=ui(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var a=n[o],s=a.length,u=i[o]=[],l,f=0;f<s;++f)(l=a[f])&&e.call(l,l.__data__,f,a)&&u.push(l);return new Et(i,this._parents,this._name,this._id)}function Cu(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u<a;++u)for(var l=n[u],f=r[u],c=l.length,h=s[u]=new Array(c),d,p=0;p<c;++p)(d=l[p]||f[p])&&(h[p]=d);for(;u<i;++u)s[u]=n[u];return new Et(s,this._parents,this._name,this._id)}function Su(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function Mu(e,n,r){var i,o,a=Su(n)?Fn:xt;return function(){var s=a(this,e),u=s.on;u!==i&&(o=(i=u).copy()).on(n,r),s.on=o}}function Tu(e,n){var r=this._id;return arguments.length<2?pt(this.node(),r).on.on(e):this.each(Mu(r,e,n))}function Pu(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Ou(){return this.on("end.remove",Pu(this._id))}function Eu(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Nn(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s<o;++s)for(var u=i[s],l=u.length,f=a[s]=new Array(l),c,h,d=0;d<l;++d)(c=u[d])&&(h=e.call(c,c.__data__,d,u))&&("__data__"in c&&(h.__data__=c.__data__),f[d]=h,Ye(f[d],n,r,d,f,pt(c,r)));return new Et(a,this._parents,n,r)}function zu(e){var n=this._name,r=this._id;typeof e!="function"&&(e=si(e));for(var i=this._groups,o=i.length,a=[],s=[],u=0;u<o;++u)for(var l=i[u],f=l.length,c,h=0;h<f;++h)if(c=l[h]){for(var d=e.call(c,c.__data__,h,l),p,y=pt(c,r),x=0,_=d.length;x<_;++x)(p=d[x])&&Ye(p,n,r,x,d,y);a.push(d),s.push(c)}return new Et(a,s,n,r)}var Ru=ye.prototype.constructor;function Nu(){return new Ru(this._groups,this._parents)}function Iu(e,n){var r,i,o;return function(){var a=Vt(this,e),s=(this.style.removeProperty(e),Vt(this,e));return a===s?null:a===r&&s===i?o:o=n(r=a,i=s)}}function Oi(e){return function(){this.style.removeProperty(e)}}function Du(e,n,r){var i,o=r+"",a;return function(){var s=Vt(this,e);return s===o?null:s===i?a:a=n(i=s,r)}}function $u(e,n,r){var i,o,a;return function(){var s=Vt(this,e),u=r(this),l=u+"";return u==null&&(l=u=(this.style.removeProperty(e),Vt(this,e))),s===l?null:s===i&&l===o?a:(o=l,a=n(i=s,u))}}function ju(e,n){var r,i,o,a="style."+n,s="end."+a,u;return function(){var l=xt(this,e),f=l.on,c=l.value[a]==null?u||(u=Oi(n)):void 0;(f!==r||o!==c)&&(i=(r=f).copy()).on(s,o=c),l.on=i}}function Fu(e,n,r){var i=(e+="")=="transform"?Fs:Pi;return n==null?this.styleTween(e,Iu(e,i)).on("end.style."+e,Oi(e)):typeof n=="function"?this.styleTween(e,$u(e,i,Un(this,"style."+e,n))).each(ju(this._id,e)):this.styleTween(e,Du(e,i,n),r).on("end.style."+e,null)}function Uu(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function Lu(e,n,r){var i,o;function a(){var s=n.apply(this,arguments);return s!==o&&(i=(o=s)&&Uu(e,s,r)),i}return a._value=n,a}function qu(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,Lu(e,n,r??""))}function Hu(e){return function(){this.textContent=e}}function Gu(e){return function(){var n=e(this);this.textContent=n??""}}function Vu(e){return this.tween("text",typeof e=="function"?Gu(Un(this,"text",e)):Hu(e==null?"":e+""))}function Wu(e){return function(n){this.textContent=e.call(this,n)}}function Bu(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Wu(o)),n}return i._value=e,i}function Xu(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,Bu(e))}function Yu(){for(var e=this._name,n=this._id,r=Ei(),i=this._groups,o=i.length,a=0;a<o;++a)for(var s=i[a],u=s.length,l,f=0;f<u;++f)if(l=s[f]){var c=pt(l,n);Ye(l,e,r,f,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Et(i,this._parents,e,r)}function Zu(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(a,s){var u={value:s},l={value:function(){--o===0&&a()}};r.each(function(){var f=xt(this,i),c=f.on;c!==e&&(n=(e=c).copy(),n._.cancel.push(u),n._.interrupt.push(u),n._.end.push(l)),f.on=n}),o===0&&a()})}var Ku=0;function Et(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function Ei(){return++Ku}var kt=ye.prototype;Et.prototype={constructor:Et,select:Eu,selectAll:zu,selectChild:kt.selectChild,selectChildren:kt.selectChildren,filter:Au,merge:Cu,selection:Nu,transition:Yu,call:kt.call,nodes:kt.nodes,node:kt.node,size:kt.size,empty:kt.empty,each:kt.each,on:Tu,attr:uu,attrTween:du,style:Fu,styleTween:qu,text:Vu,textTween:Xu,remove:Ou,tween:eu,delay:yu,duration:mu,ease:bu,easeVarying:ku,end:Zu,[Symbol.iterator]:kt[Symbol.iterator]};function Qu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ju={time:null,delay:0,duration:250,ease:Qu};function tl(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function el(e){var n,r;e instanceof Et?(n=e._id,e=e._name):(n=Ei(),(r=Ju).time=$n(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,a=0;a<o;++a)for(var s=i[a],u=s.length,l,f=0;f<u;++f)(l=s[f])&&Ye(l,e,n,f,s,r||tl(l,n));return new Et(i,this._parents,e,n)}ye.prototype.interrupt=Qs;ye.prototype.transition=el;const Ae=e=>()=>e;function nl(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Tt(e,n,r){this.k=e,this.x=n,this.y=r}Tt.prototype={constructor:Tt,scale:function(e){return e===1?this:new Tt(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Tt(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ln=new Tt(1,0,0);gt.prototype=Tt.prototype;function gt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ln;return e.__zoom}function on(e){e.stopImmediatePropagation()}function Yt(e){e.preventDefault(),e.stopImmediatePropagation()}function rl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function il(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function yr(){return this.__zoom||Ln}function ol(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function al(){return navigator.maxTouchPoints||"ontouchstart"in this}function sl(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],a=e.invertY(n[0][1])-r[0][1],s=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}function ul(){var e=rl,n=il,r=sl,i=ol,o=al,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],u=250,l=Gs,f=_e("start","zoom","end"),c,h,d,p=500,y=150,x=0,_=10;function g(k){k.property("__zoom",yr).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",R).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(k,E,T,I){var $=k.selection?k.selection():k;$.property("__zoom",yr),k!==$?m(k,E,T,I):$.interrupt().each(function(){A(this,arguments).event(I).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},g.scaleBy=function(k,E,T,I){g.scaleTo(k,function(){var $=this.__zoom.k,F=typeof E=="function"?E.apply(this,arguments):E;return $*F},T,I)},g.scaleTo=function(k,E,T,I){g.transform(k,function(){var $=n.apply(this,arguments),F=this.__zoom,U=T==null?b($):typeof T=="function"?T.apply(this,arguments):T,L=F.invert(U),q=typeof E=="function"?E.apply(this,arguments):E;return r(S(w(F,q),U,L),$,s)},T,I)},g.translateBy=function(k,E,T,I){g.transform(k,function(){return r(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof T=="function"?T.apply(this,arguments):T),n.apply(this,arguments),s)},null,I)},g.translateTo=function(k,E,T,I,$){g.transform(k,function(){var F=n.apply(this,arguments),U=this.__zoom,L=I==null?b(F):typeof I=="function"?I.apply(this,arguments):I;return r(Ln.translate(L[0],L[1]).scale(U.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof T=="function"?-T.apply(this,arguments):-T),F,s)},I,$)};function w(k,E){return E=Math.max(a[0],Math.min(a[1],E)),E===k.k?k:new Tt(E,k.x,k.y)}function S(k,E,T){var I=E[0]-T[0]*k.k,$=E[1]-T[1]*k.k;return I===k.x&&$===k.y?k:new Tt(k.k,I,$)}function b(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function m(k,E,T,I){k.on("start.zoom",function(){A(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(I).end()}).tween("zoom",function(){var $=this,F=arguments,U=A($,F).event(I),L=n.apply($,F),q=T==null?b(L):typeof T=="function"?T.apply($,F):T,Y=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),X=$.__zoom,lt=typeof E=="function"?E.apply($,F):E,bt=l(X.invert(q).concat(Y/X.k),lt.invert(q).concat(Y/lt.k));return function(ft){if(ft===1)ft=lt;else{var wt=bt(ft),tn=Y/wt[2];ft=new Tt(tn,q[0]-wt[0]*tn,q[1]-wt[1]*tn)}U.zoom(null,ft)}})}function A(k,E,T){return!T&&k.__zooming||new C(k,E)}function C(k,E){this.that=k,this.args=E,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,E),this.taps=0}C.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,E){return this.mouse&&k!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var E=st(this.that).datum();f.call(k,this.that,new nl(k,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:f}),E)}};function M(k,...E){if(!e.apply(this,arguments))return;var T=A(this,E).event(k),I=this.__zoom,$=Math.max(a[0],Math.min(a[1],I.k*Math.pow(2,i.apply(this,arguments)))),F=yt(k);if(T.wheel)(T.mouse[0][0]!==F[0]||T.mouse[0][1]!==F[1])&&(T.mouse[1]=I.invert(T.mouse[0]=F)),clearTimeout(T.wheel);else{if(I.k===$)return;T.mouse=[F,I.invert(F)],Oe(this),T.start()}Yt(k),T.wheel=setTimeout(U,y),T.zoom("mouse",r(S(w(I,$),T.mouse[0],T.mouse[1]),T.extent,s));function U(){T.wheel=null,T.end()}}function z(k,...E){if(d||!e.apply(this,arguments))return;var T=k.currentTarget,I=A(this,E,!0).event(k),$=st(k.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",Y,!0),F=yt(k,T),U=k.clientX,L=k.clientY;vi(k.view),on(k),I.mouse=[F,this.__zoom.invert(F)],Oe(this),I.start();function q(X){if(Yt(X),!I.moved){var lt=X.clientX-U,bt=X.clientY-L;I.moved=lt*lt+bt*bt>x}I.event(X).zoom("mouse",r(S(I.that.__zoom,I.mouse[0]=yt(X,T),I.mouse[1]),I.extent,s))}function Y(X){$.on("mousemove.zoom mouseup.zoom",null),mi(X.view,I.moved),Yt(X),I.event(X).end()}}function P(k,...E){if(e.apply(this,arguments)){var T=this.__zoom,I=yt(k.changedTouches?k.changedTouches[0]:k,this),$=T.invert(I),F=T.k*(k.shiftKey?.5:2),U=r(S(w(T,F),I,$),n.apply(this,E),s);Yt(k),u>0?st(this).transition().duration(u).call(m,U,I,k):st(this).call(g.transform,U,I,k)}}function R(k,...E){if(e.apply(this,arguments)){var T=k.touches,I=T.length,$=A(this,E,k.changedTouches.length===I).event(k),F,U,L,q;for(on(k),U=0;U<I;++U)L=T[U],q=yt(L,this),q=[q,this.__zoom.invert(q),L.identifier],$.touch0?!$.touch1&&$.touch0[2]!==q[2]&&($.touch1=q,$.taps=0):($.touch0=q,F=!0,$.taps=1+!!c);c&&(c=clearTimeout(c)),F&&($.taps<2&&(h=q[0],c=setTimeout(function(){c=null},p)),Oe(this),$.start())}}function N(k,...E){if(this.__zooming){var T=A(this,E).event(k),I=k.changedTouches,$=I.length,F,U,L,q;for(Yt(k),F=0;F<$;++F)U=I[F],L=yt(U,this),T.touch0&&T.touch0[2]===U.identifier?T.touch0[0]=L:T.touch1&&T.touch1[2]===U.identifier&&(T.touch1[0]=L);if(U=T.that.__zoom,T.touch1){var Y=T.touch0[0],X=T.touch0[1],lt=T.touch1[0],bt=T.touch1[1],ft=(ft=lt[0]-Y[0])*ft+(ft=lt[1]-Y[1])*ft,wt=(wt=bt[0]-X[0])*wt+(wt=bt[1]-X[1])*wt;U=w(U,Math.sqrt(ft/wt)),L=[(Y[0]+lt[0])/2,(Y[1]+lt[1])/2],q=[(X[0]+bt[0])/2,(X[1]+bt[1])/2]}else if(T.touch0)L=T.touch0[0],q=T.touch0[1];else return;T.zoom("touch",r(S(U,L,q),T.extent,s))}}function j(k,...E){if(this.__zooming){var T=A(this,E).event(k),I=k.changedTouches,$=I.length,F,U;for(on(k),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),F=0;F<$;++F)U=I[F],T.touch0&&T.touch0[2]===U.identifier?delete T.touch0:T.touch1&&T.touch1[2]===U.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(U=yt(U,this),Math.hypot(h[0]-U[0],h[1]-U[1])<_)){var L=st(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return g.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ae(+k),g):i},g.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ae(!!k),g):e},g.touchable=function(k){return arguments.length?(o=typeof k=="function"?k:Ae(!!k),g):o},g.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ae([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),g):n},g.scaleExtent=function(k){return arguments.length?(a[0]=+k[0],a[1]=+k[1],g):[a[0],a[1]]},g.translateExtent=function(k){return arguments.length?(s[0][0]=+k[0][0],s[1][0]=+k[1][0],s[0][1]=+k[0][1],s[1][1]=+k[1][1],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(k){return arguments.length?(r=k,g):r},g.duration=function(k){return arguments.length?(u=+k,g):u},g.interpolate=function(k){return arguments.length?(l=k,g):l},g.on=function(){var k=f.on.apply(f,arguments);return k===f?g:k},g.clickDistance=function(k){return arguments.length?(x=(k=+k)*k,g):Math.sqrt(x)},g.tapDistance=function(k){return arguments.length?(_=+k,g):_},g}class _r extends Map{constructor(n,r=cl){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[i,o]of n)this.set(i,o)}get(n){return super.get(vr(this,n))}has(n){return super.has(vr(this,n))}set(n,r){return super.set(ll(this,n),r)}delete(n){return super.delete(fl(this,n))}}function vr({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):r}function ll({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function fl({_intern:e,_key:n},r){const i=n(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function cl(e){return e!==null&&typeof e=="object"?e.valueOf():e}function mr(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r<i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let o of e)(o=n(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}return r}function xr(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let o of e)(o=n(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}return r}function hl(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var dl=typeof global=="object"&&global&&global.Object===Object&&global,pl=typeof self=="object"&&self&&self.Object===Object&&self,zi=dl||pl||Function("return this")(),Fe=zi.Symbol,Ri=Object.prototype,gl=Ri.hasOwnProperty,yl=Ri.toString,Zt=Fe?Fe.toStringTag:void 0;function _l(e){var n=gl.call(e,Zt),r=e[Zt];try{e[Zt]=void 0;var i=!0}catch{}var o=yl.call(e);return i&&(n?e[Zt]=r:delete e[Zt]),o}var vl=Object.prototype,ml=vl.toString;function xl(e){return ml.call(e)}var bl="[object Null]",wl="[object Undefined]",br=Fe?Fe.toStringTag:void 0;function kl(e){return e==null?e===void 0?wl:bl:br&&br in Object(e)?_l(e):xl(e)}function Al(e){return e!=null&&typeof e=="object"}var Cl="[object Symbol]";function Sl(e){return typeof e=="symbol"||Al(e)&&kl(e)==Cl}var Ml=/\s/;function Tl(e){for(var n=e.length;n--&&Ml.test(e.charAt(n)););return n}var Pl=/^\s+/;function Ol(e){return e&&e.slice(0,Tl(e)+1).replace(Pl,"")}function Ue(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var wr=NaN,El=/^[-+]0x[0-9a-f]+$/i,zl=/^0b[01]+$/i,Rl=/^0o[0-7]+$/i,Nl=parseInt;function kr(e){if(typeof e=="number")return e;if(Sl(e))return wr;if(Ue(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=Ue(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Ol(e);var r=zl.test(e);return r||Rl.test(e)?Nl(e.slice(2),r?2:8):El.test(e)?wr:+e}var an=function(){return zi.Date.now()},Il="Expected a function",Dl=Math.max,$l=Math.min;function Ni(e,n,r){var i,o,a,s,u,l,f=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(Il);n=kr(n)||0,Ue(r)&&(c=!!r.leading,h="maxWait"in r,a=h?Dl(kr(r.maxWait)||0,n):a,d="trailing"in r?!!r.trailing:d);function p(A){var C=i,M=o;return i=o=void 0,f=A,s=e.apply(M,C),s}function y(A){return f=A,u=setTimeout(g,n),c?p(A):s}function x(A){var C=A-l,M=A-f,z=n-C;return h?$l(z,a-M):z}function _(A){var C=A-l,M=A-f;return l===void 0||C>=n||C<0||h&&M>=a}function g(){var A=an();if(_(A))return w(A);u=setTimeout(g,x(A))}function w(A){return u=void 0,d&&i?p(A):(i=o=void 0,s)}function S(){u!==void 0&&clearTimeout(u),f=0,i=l=o=u=void 0}function b(){return u===void 0?s:w(an())}function m(){var A=an(),C=_(A);if(i=arguments,o=this,l=A,C){if(u===void 0)return y(l);if(h)return clearTimeout(u),u=setTimeout(g,n),p(l)}return u===void 0&&(u=setTimeout(g,n)),s}return m.cancel=S,m.flush=b,m}var jl="Expected a function";function Fl(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(jl);return Ue(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Ni(e,n,{leading:i,maxWait:n,trailing:o})}var Ft=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ft.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Ft.Bounce.In(e*2)*.5:Ft.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),ie=function(){return performance.now()},Ii=(function(){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var o=0,a=r;o<a.length;o++){var s=a[o];(n=s._group)===null||n===void 0||n.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=0,o=n;i<o.length;i++){var a=o[i];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,r){n===void 0&&(n=ie()),r===void 0&&(r=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<i.length;o++){var a=this._tweens[i[o]],s=!r;a&&a.update(n,s)===!1&&!r&&this.remove(a)}i=Object.keys(this._tweensAddedDuringUpdate)}},e})(),An={Linear:function(e,n){var r=e.length-1,i=r*n,o=Math.floor(i),a=An.Utils.Linear;return n<0?a(e[0],e[1],i):n>1?a(e[r],e[r-1],r-i):a(e[o],e[o+1>r?r:o+1],i-o)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},Di=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),Cn=new Ii,Ar=(function(){function e(n,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ft.Linear.None,this._interpolationFunction=An.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Di.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Cn,Cn.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=ie()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var a in this._valuesEnd)o[a]=this._valuesEnd[a];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,o,a){for(var s in i){var u=n[s],l=Array.isArray(u),f=l?"array":typeof u,c=!l&&Array.isArray(i[s]);if(!(f==="undefined"||f==="function")){if(c){var h=i[s];if(h.length===0)continue;for(var d=[u],p=0,y=h.length;p<y;p+=1){var x=this._handleRelativeValue(u,h[p]);if(isNaN(x)){c=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(x)}c&&(i[s]=d)}if((f==="object"||l)&&u&&!c){r[s]=l?[]:{};var _=u;for(var g in _)r[s][g]=_[g];o[s]=l?[]:{};var h=i[s];if(!this._isDynamic){var w={};for(var g in h)w[g]=h[g];i[s]=h=w}this._setupProperties(_,r[s],h,o[s],a)}else(typeof r[s]>"u"||a)&&(r[s]=u),l||(r[s]*=1),c?o[s]=i[s].slice().reverse():o[s]=r[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=ie()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=ie()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Ft.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=An.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var i=this,o;if(n===void 0&&(n=ie()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=n-this._startTime,u=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*u,f=function(){if(i._duration===0||s>l)return 1;var x=Math.trunc(s/u),_=s-x*u,g=Math.min(_/i._duration,1);return g===0&&s===i._duration?1:g},c=f(),h=this._easingFunction(c);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,h),this._onUpdateCallback&&this._onUpdateCallback(this._object,c),this._duration===0||s>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((s-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,y=this._chainedTweens.length;p<y;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,i,o){for(var a in i)if(r[a]!==void 0){var s=r[a]||0,u=i[a],l=Array.isArray(n[a]),f=Array.isArray(u),c=!l&&f;c?n[a]=this._interpolationFunction(u,o):typeof u=="object"&&u?this._updateProperties(n[a],s,u,o):(u=this._handleRelativeValue(s,u),typeof u=="number"&&(n[a]=s+(u-s)*o))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e.autoStartOnUpdate=!1,e})();Di.nextId;var mt=Cn;mt.getAll.bind(mt);mt.removeAll.bind(mt);mt.add.bind(mt);mt.remove.bind(mt);mt.update.bind(mt);function Cr(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 Ul(e){if(Array.isArray(e))return e}function Ll(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function ql(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function Hl(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(c){f=!0,o=c}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return u}}function Gl(){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 Vl(e,n){return Ul(e)||Hl(e,n)||Wl(e,n)||Gl()}function Wl(e,n){if(e){if(typeof e=="string")return Cr(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Cr(e,n):void 0}}var Bl=ql(function e(n,r){var i=r.default,o=i===void 0?null:i,a=r.triggerUpdate,s=a===void 0?!0:a,u=r.onChange,l=u===void 0?function(f,c){}:u;Ll(this,e),this.name=n,this.defaultVal=o,this.triggerUpdate=s,this.onChange=l});function qn(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,i=e.props,o=i===void 0?{}:i,a=e.methods,s=a===void 0?{}:a,u=e.aliases,l=u===void 0?{}:u,f=e.init,c=f===void 0?function(){}:f,h=e.update,d=h===void 0?function(){}:h,p=Object.keys(o).map(function(y){return new Bl(y,o[y])});return function y(){for(var x=arguments.length,_=new Array(x),g=0;g<x;g++)_[g]=arguments[g];var w=!!(this instanceof y&&this.constructor),S=w?_.shift():void 0,b=_[0],m=b===void 0?{}:b,A=Object.assign({},r instanceof Function?r(m):r,{initialised:!1}),C={};function M(R){return z(R,m),P(),M}var z=function(N,j){c.call(M,N,A,j),A.initialised=!0},P=Ni(function(){A.initialised&&(d.call(M,A,C),C={})},1);return p.forEach(function(R){M[R.name]=N(R);function N(j){var k=j.name,E=j.triggerUpdate,T=E===void 0?!1:E,I=j.onChange,$=I===void 0?function(L,q){}:I,F=j.defaultVal,U=F===void 0?null:F;return function(L){var q=A[k];if(!arguments.length)return q;var Y=L===void 0?U:L;return A[k]=Y,$.call(M,Y,A,q),!C.hasOwnProperty(k)&&(C[k]=q),T&&P(),M}}}),Object.keys(s).forEach(function(R){M[R]=function(){for(var N,j=arguments.length,k=new Array(j),E=0;E<j;E++)k[E]=arguments[E];return(N=s[R]).call.apply(N,[M,A].concat(k))}}),Object.entries(l).forEach(function(R){var N=Vl(R,2),j=N[0],k=N[1];return M[j]=M[k]}),M.resetProps=function(){return p.forEach(function(R){M[R.name](R.defaultVal)}),M},M.resetProps(),A._rerender=P,w&&S&&M(S),M}}var H=(function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}});function Le(e){"@babel/helpers - typeof";return Le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Le(e)}var Xl=/^\s+/,Yl=/\s+$/;function D(e,n){if(e=e||"",n=n||{},e instanceof D)return e;if(!(this instanceof D))return new D(e,n);var r=Zl(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,i,o,a,s,u;return r=n.r/255,i=n.g/255,o=n.b/255,r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),o<=.03928?u=o/12.92:u=Math.pow((o+.055)/1.055,2.4),.2126*a+.7152*s+.0722*u},setAlpha:function(n){return this._a=$i(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=Mr(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=Mr(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),o=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+o+"%)":"hsva("+r+", "+i+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var n=Sr(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=Sr(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),o=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+o+"%)":"hsla("+r+", "+i+"%, "+o+"%, "+this._roundA+")"},toHex:function(n){return Tr(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return tf(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(W(this._r,255)*100)+"%",g:Math.round(W(this._g,255)*100)+"%",b:Math.round(W(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(W(this._r,255)*100)+"%, "+Math.round(W(this._g,255)*100)+"%, "+Math.round(W(this._b,255)*100)+"%)":"rgba("+Math.round(W(this._r,255)*100)+"%, "+Math.round(W(this._g,255)*100)+"%, "+Math.round(W(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:df[Tr(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+Pr(this._r,this._g,this._b,this._a),i=r,o=this._gradientType?"GradientType = 1, ":"";if(n){var a=D(n);i="#"+Pr(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+r+",endColorstr="+i+")"},toString:function(n){var r=!!n;n=n||this._format;var i=!1,o=this._a<1&&this._a>=0,a=!r&&o&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(of,arguments)},brighten:function(){return this._applyModification(af,arguments)},darken:function(){return this._applyModification(sf,arguments)},desaturate:function(){return this._applyModification(ef,arguments)},saturate:function(){return this._applyModification(nf,arguments)},greyscale:function(){return this._applyModification(rf,arguments)},spin:function(){return this._applyModification(uf,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(cf,arguments)},complement:function(){return this._applyCombination(lf,arguments)},monochromatic:function(){return this._applyCombination(hf,arguments)},splitcomplement:function(){return this._applyCombination(ff,arguments)},triad:function(){return this._applyCombination(Or,[3])},tetrad:function(){return this._applyCombination(Or,[4])}};D.fromRatio=function(e,n){if(Le(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=oe(e[i]));e=r}return D(e,n)};function Zl(e){var n={r:0,g:0,b:0},r=1,i=null,o=null,a=null,s=!1,u=!1;return typeof e=="string"&&(e=_f(e)),Le(e)=="object"&&(At(e.r)&&At(e.g)&&At(e.b)?(n=Kl(e.r,e.g,e.b),s=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):At(e.h)&&At(e.s)&&At(e.v)?(i=oe(e.s),o=oe(e.v),n=Jl(e.h,i,o),s=!0,u="hsv"):At(e.h)&&At(e.s)&&At(e.l)&&(i=oe(e.s),a=oe(e.l),n=Ql(e.h,i,a),s=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=$i(r),{ok:s,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function Kl(e,n,r){return{r:W(e,255)*255,g:W(n,255)*255,b:W(r,255)*255}}function Sr(e,n,r){e=W(e,255),n=W(n,255),r=W(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=(i+o)/2;if(i==o)a=s=0;else{var l=i-o;switch(s=u>.5?l/(2-i-o):l/(i+o),i){case e:a=(n-r)/l+(n<r?6:0);break;case n:a=(r-e)/l+2;break;case r:a=(e-n)/l+4;break}a/=6}return{h:a,s,l:u}}function Ql(e,n,r){var i,o,a;e=W(e,360),n=W(n,100),r=W(r,100);function s(f,c,h){return h<0&&(h+=1),h>1&&(h-=1),h<1/6?f+(c-f)*6*h:h<1/2?c:h<2/3?f+(c-f)*(2/3-h)*6:f}if(n===0)i=o=a=r;else{var u=r<.5?r*(1+n):r+n-r*n,l=2*r-u;i=s(l,u,e+1/3),o=s(l,u,e),a=s(l,u,e-1/3)}return{r:i*255,g:o*255,b:a*255}}function Mr(e,n,r){e=W(e,255),n=W(n,255),r=W(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=i,l=i-o;if(s=i===0?0:l/i,i==o)a=0;else{switch(i){case e:a=(n-r)/l+(n<r?6:0);break;case n:a=(r-e)/l+2;break;case r:a=(e-n)/l+4;break}a/=6}return{h:a,s,v:u}}function Jl(e,n,r){e=W(e,360)*6,n=W(n,100),r=W(r,100);var i=Math.floor(e),o=e-i,a=r*(1-n),s=r*(1-o*n),u=r*(1-(1-o)*n),l=i%6,f=[r,s,a,a,u,r][l],c=[u,r,r,s,a,a][l],h=[a,a,u,r,r,s][l];return{r:f*255,g:c*255,b:h*255}}function Tr(e,n,r,i){var o=[dt(Math.round(e).toString(16)),dt(Math.round(n).toString(16)),dt(Math.round(r).toString(16))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function tf(e,n,r,i,o){var a=[dt(Math.round(e).toString(16)),dt(Math.round(n).toString(16)),dt(Math.round(r).toString(16)),dt(ji(i))];return o&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function Pr(e,n,r,i){var o=[dt(ji(i)),dt(Math.round(e).toString(16)),dt(Math.round(n).toString(16)),dt(Math.round(r).toString(16))];return o.join("")}D.equals=function(e,n){return!e||!n?!1:D(e).toRgbString()==D(n).toRgbString()};D.random=function(){return D.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function ef(e,n){n=n===0?0:n||10;var r=D(e).toHsl();return r.s-=n/100,r.s=Ze(r.s),D(r)}function nf(e,n){n=n===0?0:n||10;var r=D(e).toHsl();return r.s+=n/100,r.s=Ze(r.s),D(r)}function rf(e){return D(e).desaturate(100)}function of(e,n){n=n===0?0:n||10;var r=D(e).toHsl();return r.l+=n/100,r.l=Ze(r.l),D(r)}function af(e,n){n=n===0?0:n||10;var r=D(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),D(r)}function sf(e,n){n=n===0?0:n||10;var r=D(e).toHsl();return r.l-=n/100,r.l=Ze(r.l),D(r)}function uf(e,n){var r=D(e).toHsl(),i=(r.h+n)%360;return r.h=i<0?360+i:i,D(r)}function lf(e){var n=D(e).toHsl();return n.h=(n.h+180)%360,D(n)}function Or(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=D(e).toHsl(),i=[D(e)],o=360/n,a=1;a<n;a++)i.push(D({h:(r.h+a*o)%360,s:r.s,l:r.l}));return i}function ff(e){var n=D(e).toHsl(),r=n.h;return[D(e),D({h:(r+72)%360,s:n.s,l:n.l}),D({h:(r+216)%360,s:n.s,l:n.l})]}function cf(e,n,r){n=n||6,r=r||30;var i=D(e).toHsl(),o=360/r,a=[D(e)];for(i.h=(i.h-(o*n>>1)+720)%360;--n;)i.h=(i.h+o)%360,a.push(D(i));return a}function hf(e,n){n=n||6;for(var r=D(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push(D({h:i,s:o,v:a})),a=(a+u)%1;return s}D.mix=function(e,n,r){r=r===0?0:r||50;var i=D(e).toRgb(),o=D(n).toRgb(),a=r/100,s={r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a};return D(s)};D.readability=function(e,n){var r=D(e),i=D(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};D.isReadable=function(e,n,r){var i=D.readability(e,n),o,a;switch(a=!1,o=vf(r),o.level+o.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};D.mostReadable=function(e,n,r){var i=null,o=0,a,s,u,l;r=r||{},s=r.includeFallbackColors,u=r.level,l=r.size;for(var f=0;f<n.length;f++)a=D.readability(e,n[f]),a>o&&(o=a,i=D(n[f]));return D.isReadable(e,i,{level:u,size:l})||!s?i:(r.includeFallbackColors=!1,D.mostReadable(e,["#fff","#000"],r))};var Sn=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},df=D.hexNames=pf(Sn);function pf(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function $i(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function W(e,n){gf(e)&&(e="100%");var r=yf(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function Ze(e){return Math.min(1,Math.max(0,e))}function nt(e){return parseInt(e,16)}function gf(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function yf(e){return typeof e=="string"&&e.indexOf("%")!=-1}function dt(e){return e.length==1?"0"+e:""+e}function oe(e){return e<=1&&(e=e*100+"%"),e}function ji(e){return Math.round(parseFloat(e)*255).toString(16)}function Er(e){return nt(e)/255}var ct=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function At(e){return!!ct.CSS_UNIT.exec(e)}function _f(e){e=e.replace(Xl,"").replace(Yl,"").toLowerCase();var n=!1;if(Sn[e])e=Sn[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=ct.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=ct.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ct.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=ct.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ct.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=ct.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ct.hex8.exec(e))?{r:nt(r[1]),g:nt(r[2]),b:nt(r[3]),a:Er(r[4]),format:n?"name":"hex8"}:(r=ct.hex6.exec(e))?{r:nt(r[1]),g:nt(r[2]),b:nt(r[3]),format:n?"name":"hex"}:(r=ct.hex4.exec(e))?{r:nt(r[1]+""+r[1]),g:nt(r[2]+""+r[2]),b:nt(r[3]+""+r[3]),a:Er(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=ct.hex3.exec(e))?{r:nt(r[1]+""+r[1]),g:nt(r[2]+""+r[2]),b:nt(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function vf(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function Mn(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 mf(e){if(Array.isArray(e))return Mn(e)}function Fi(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function xf(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function bf(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function it(e,n){return e.get(Fi(e,n))}function zr(e,n,r){xf(e,n),n.set(e,r)}function Rr(e,n,r){return e.set(Fi(e,n),r),r}function wf(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Tf(i.key),i)}}function kf(e,n,r){return n&&wf(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Af(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bm as g,a5 as S,a as E,av as b,bn as h,r as a}from"./index-BKfqr8sS.js";import{i as m}from"./types-BaJkUfo6.js";const p="keep",y="lens:audio-retention-choice:";function f(e){return y+e}function c(e){try{return localStorage.getItem(f(e))!==null}catch{return!1}}function R(e){try{localStorage.setItem(f(e),JSON.stringify({chosenAt:new Date().toISOString()}))}catch{}}function C(e){const[t,n]=a.useState(()=>e?c(e):!1);a.useEffect(()=>{n(e?c(e):!1)},[e]);const r=a.useCallback(()=>{e&&(R(e),n(!0))},[e]);return{made:t,markMade:r}}function _(){var n,r,o;const e=g(),t=(r=(n=e.data)==null?void 0:n.config)==null?void 0:r.audio_retention;return{value:m(t)?t:p,supported:e.isSuccess&&((o=e.data)==null?void 0:o.config)!==void 0,isLoading:e.isPending,isError:e.isError}}function w(){const e=S(),t=E(r=>r.activeVaultId),n=b();return h({mutationFn:async r=>{var i;if(!e)throw new Error("No active vault");const o=await e.patchVault({config:{audio_retention:r}});if(((i=o.config)==null?void 0:i.audio_retention)!==r)throw new Error("This vault doesn't support changing voice retention yet.");return o},onSuccess:r=>{n.setQueryData(["vaultInfo",t],o=>o&&{...o,config:r.config})}})}const s=!0,T="lens:transcribe-default:";function l(e){return T+e}function u(e){try{const t=localStorage.getItem(l(e));if(!t)return s;const n=JSON.parse(t);return typeof n.transcribe=="boolean"?n.transcribe:s}catch{return s}}function A(e,t){try{localStorage.setItem(l(e),JSON.stringify({transcribe:t}))}catch{}}function F(e){const[t,n]=a.useState(()=>e?u(e):s);a.useEffect(()=>{n(e?u(e):s)},[e]);const r=a.useCallback(o=>{e&&(A(e,o),n(o))},[e]);return{transcribeDefault:t,setTranscribeDefault:r}}export{w as a,C as b,F as c,u as l,_ as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var rO=Object.defineProperty;var sO=(n,e,t)=>e in n?rO(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var gi=(n,e,t)=>sO(n,typeof e!="symbol"?e+"":e,t);import{r as ee,j as ae,aJ as oO,au as lO}from"./index-
|
|
1
|
+
var rO=Object.defineProperty;var sO=(n,e,t)=>e in n?rO(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var gi=(n,e,t)=>sO(n,typeof e!="symbol"?e+"":e,t);import{r as ee,j as ae,aJ as oO,au as lO}from"./index-BKfqr8sS.js";import{W as aO}from"./NoteRenderer-DG6I-BOG.js";import{v as hO,m as cO}from"./attachment-upload-D6wfJsr6.js";const fO="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",VQ=ee.forwardRef(function({onPickFiles:e,label:t="Attach files…",className:i},r){const s=ee.useRef(null);return ee.useImperativeHandle(r,()=>({open:()=>{var o;return(o=s.current)==null?void 0:o.click()}}),[]),ae.jsxs(ae.Fragment,{children:[ae.jsx("button",{type:"button",onClick:()=>{var o;return(o=s.current)==null?void 0:o.click()},className:i??"min-h-11 rounded-lg border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",title:"Upload an attachment",children:t}),ae.jsx("input",{ref:s,type:"file",multiple:!0,accept:fO,className:"hidden",onChange:o=>{const l=Array.from(o.target.files??[]);l.length>0&&e(l),o.target.value=""}})]})});function BQ({uploads:n,onCancel:e,onDismiss:t}){return n.length===0?null:ae.jsx("ul",{className:"space-y-2",children:n.map(i=>ae.jsxs("li",{className:"rounded-md border border-border bg-card/60 px-3 py-2 text-xs text-fg-muted",children:[ae.jsxs("div",{className:"flex items-center justify-between gap-2",children:[ae.jsx("span",{className:"truncate font-mono",title:i.filename,children:i.filename}),ae.jsx("span",{className:"shrink-0",children:uO(i)})]}),i.status==="uploading"?ae.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded bg-border/40",children:ae.jsx("div",{className:"h-full bg-accent transition-[width]",style:{width:`${Ph(i)}%`}})}):null,i.status==="error"&&i.error?ae.jsx("p",{className:"mt-1 text-red-400",children:i.error}):null,ae.jsx("div",{className:"mt-1 flex justify-end gap-2 text-xs",children:i.status==="uploading"||i.status==="linking"?ae.jsx("button",{type:"button",onClick:()=>e(i.id),className:"text-fg-dim hover:text-fg",children:"Cancel"}):ae.jsx("button",{type:"button",onClick:()=>t(i.id),className:"text-fg-dim hover:text-fg",children:"Dismiss"})})]},i.id))})}function Ph(n){return n.size===0?0:Math.min(100,Math.round(n.loaded/n.size*100))}function uO(n){switch(n.status){case"uploading":return`${Ph(n)}%`;case"linking":return"Linking…";case"done":return"Done";case"cancelled":return"Cancelled";case"error":return"Error"}}let gs=[],Th=[];(()=>{let n="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<n.length;e++)(e%2?Th:gs).push(t=t+n[e])})();function OO(n){if(n<768)return!1;for(let e=0,t=gs.length;;){let i=e+t>>1;if(n<gs[i])t=i;else if(n>=Th[i])e=i+1;else return!0;if(e==t)return!1}}function Ol(n){return n>=127462&&n<=127487}const dl=8205;function dO(n,e,t=!0,i=!0){return(t?Ch:pO)(n,e,i)}function Ch(n,e,t){if(e==n.length)return e;e&&Zh(n.charCodeAt(e))&&Xh(n.charCodeAt(e-1))&&e--;let i=Ar(n,e);for(e+=pl(i);e<n.length;){let r=Ar(n,e);if(i==dl||r==dl||t&&OO(r))e+=pl(r),i=r;else if(Ol(r)){let s=0,o=e-2;for(;o>=0&&Ol(Ar(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function pO(n,e,t){for(;e>1;){let i=Ch(n,e-2,t);if(i<e)return i;e--}return 0}function Ar(n,e){let t=n.charCodeAt(e);if(!Xh(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Zh(i)?(t-55296<<10)+(i-56320)+65536:t}function Zh(n){return n>=56320&&n<57344}function Xh(n){return n>=55296&&n<56320}function pl(n){return n<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]=ii(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Ue.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ii(this,e,t);let i=[];return this.decompose(e,t,i,0),Ue.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),r=new Ci(this),s=new Ci(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new Ah(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Mh(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):Ue.from(J.split(e,[]))}}class J extends z{constructor(e,t=mO(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new gO(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){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(r&1){let o=i.pop(),l=Ln(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new J(l,o.length+s.length));else{let a=l.length>>1;i.push(new J(l.slice(0,a)),new J(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);[e,t]=ii(this,e,t);let r=Ln(this.text,Ln(i.text,ml(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new J(r,s):Ue.from(J.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=ii(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new J(i,r)),i=[],r=-1);return r>-1&&t.push(new J(i,r)),t}}class Ue 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,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=ii(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new Ue(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=ii(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ue))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.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 r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(O){let d;if(O.lines>s&&O instanceof Ue)for(let p of O.children)f(p);else O.lines>o&&(a>o||!a)?(u(),l.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>r&&u(),a+=O.lines,h+=O.length+1,c.push(O))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ue.from(c,h)),h=-1,a=c.length=0)}for(let O of e)f(O);return u(),l.length==1?l[0]:new Ue(l,t)}}z.empty=new J([""],0);function mO(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Ln(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function ml(n,e,t){return Ln(n,[""],e,t)}class Ci{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,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof J?r.text.length:r.children.length;if(o==(t>0?l: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(r instanceof J){let a=r.text[o+(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=r.children[o+(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 Ah{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ci(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:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.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 Mh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=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=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},Ci.prototype[Symbol.iterator]=Ah.prototype[Symbol.iterator]=Mh.prototype[Symbol.iterator]=function(){return this});let gO=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function ii(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ce(n,e,t=!0,i=!0){return dO(n,e,t,i)}function SO(n){return n>=56320&&n<57344}function bO(n){return n>=55296&&n<56320}function Zt(n,e){let t=n.charCodeAt(e);if(!bO(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return SO(i)?(t-55296<<10)+(i-56320)+65536:t}function QO(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Bt(n){return n<65536?1:2}const Ss=/\r\n?|\n/;var de=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(de||(de={}));class et{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,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){bs(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new et(e)}composeDesc(e){return this.empty?e:e.empty?this:Rh(this,e)}mapDesc(e,t=!1){return e.empty?this:Qs(this,e,t)}mapPos(e,t=-1,i=de.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&r<e&&h>e||i==de.TrackBefore&&r<e||i==de.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}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 et(e)}static create(e){return new et(e)}}class ie extends et{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 bs(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Qs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(z.empty);i.push(o?e.slice(s,s+o):z.empty)}s+=o}return new ie(t,i)}compose(e){return this.empty?e:e.empty?this:Rh(this,e,!0)}map(e,t=!1){return e.empty?this:Qs(this,e,t,!0)}iterChanges(e,t=!1){bs(this,e,t)}get desc(){return et.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new ji(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);he(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;he(t,c,f),f>0&&bt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);he(t,c,-1),he(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new ie(t,i),filtered:et.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<t&&he(r,t-o,-1);let f=new ie(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ie){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):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||Ss)):O:z.empty,p=d.length;if(f==u&&p==0)return;f<o&&a(),f>o&&he(r,f-o,-1),he(r,u-f,p),bt(s,r,d),o=u}}return h(e),a(!l),l}static empty(e){return new ie(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(z.empty);i[r]=z.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new ie(t,i)}static createSet(e,t){return new ie(e,t)}}function he(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function bt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(z.empty);n.push(t)}}function bs(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=z.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function Qs(n,e,t,i=!1){let r=[],s=i?[]:null,o=new ji(n),l=new ji(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);he(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(he(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(he(r,0,o.ins),s&&bt(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;he(r,h,a<o.i?o.ins:0),s&&a<o.i&&bt(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?ie.createSet(r,s):et.create(r);throw new Error("Mismatched change set lengths")}}}function Rh(n,e,t=!1){let i=[],r=t?[]:null,s=new ji(n),o=new ji(e);for(let l=!1;;){if(s.done&&o.done)return r?ie.createSet(i,r):et.create(i);if(s.ins==0)he(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)he(i,0,o.ins,l),r&&bt(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;he(i,a,c,l),r&&c&&bt(r,i,o.text)}else o.ins==-1?(he(i,s.off?0:s.len,a,l),r&&bt(r,i,s.textBit(a))):(he(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&bt(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class ji{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 gt{constructor(e,t,i,r){this.from=e,this.to=t,this.flags=i,this.goalColumn=r}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 undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new gt(i,r,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return k.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return k.range(this.anchor,r,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,r){return new gt(e,t,i,r)}}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=>gt.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,r=0;r<e.length;r++){let s=e[r];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,r){return gt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,t,i,r,s){let o=r==null?7:Math.min(6,r);return!s&&e!=t&&(s=t<e?1:-1),s&&(o|=s<0?8:16),t<e?gt.create(t,e,o|32,i):gt.create(e,t,o,i)}static undirectionalRange(e,t){return gt.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?k.range(a,l):k.range(l,a))}}return new k(e,t)}}function Lh(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Oo=0;class X{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Oo++,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:po),!!e.static,e.enables)}of(e){return new En([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new En(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new En(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function po(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class En{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Oo++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=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[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||ys(f,c)){let O=i(f);if(l?!gl(O,f.values[o],r):!r(O,f.values[o]))return f.values[o]=O,1}return 0},reconfigure:(f,u)=>{let O,d=u.config.address[s];if(d!=null){let p=In(u,d);if(this.dependencies.every(g=>g instanceof X?u.facet(g)===f.facet(g):g instanceof We?u.field(g,!1)==f.field(g,!1):!0)||(l?gl(O=i(f),p,r):r(O=i(f),p)))return f.values[o]=p,0}else O=i(f);return f.values[o]=O,1}}}get extension(){return this}}function gl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function ys(n,e){let t=!1;for(let i of e)Zi(n,i)&1&&(t=!0);return t}function yO(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=In(a,i[c]);if(r[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)Zi(a,h);return a.values[o]=l(a),1},update(a,h){if(!ys(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=ys(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&po(t,f))return a.values[o]=u,0;let O=l(a);return e.compare(O,u)?(a.values[o]=u,0):(a.values[o]=O,1)}}}const pn=X.define({static:!0});class We{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new We(Oo++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(pn).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,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(pn),o=r.facet(pn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,pn.of({field:this,create:e})]}get extension(){return this}}const At={lowest:4,low:3,default:2,high:1,highest:0};function Si(n){return e=>new Eh(e,n)}const Wt={highest:Si(At.highest),high:Si(At.high),default:Si(At.default),low:Si(At.low),lowest:Si(At.lowest)};class Eh{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class gr{of(e){return new ks(this,e)}reconfigure(e){return gr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ks{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class qn{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,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 r=[],s=Object.create(null),o=new Map;for(let u of kO(e,t,o))u instanceof We?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[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(g=>g.type==0))if(l[d.id]=a.length<<1|1,po(p,O))a.push(i.facet(d));else{let g=d.combine(O.map(S=>S.value));a.push(i&&d.compare(g,i.facet(d))?i.facet(d):g)}else{for(let g of O)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(S=>g.dynamicSlot(S)));l[d.id]=h.length<<1,h.push(g=>yO(g,d,O))}}let f=h.map(u=>u(l));return new qn(e,o,f,l,a,s)}}function kO(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof ks&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof ks){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof Eh)s(o.inner,o.prec);else if(o instanceof We)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof En)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,At.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,At.default),i.reduce((o,l)=>o.concat(l))}function Zi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function In(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const jh=X.define(),xs=X.define({combine:n=>n.some(e=>e),static:!0}),Yh=X.define({combine:n=>n.length?n[0]:void 0,static:!0}),zh=X.define(),_h=X.define(),Wh=X.define(),Vh=X.define({combine:n=>n.length?n[0]:!1});class ut{constructor(e,t){this.type=e,this.value=t}static define(){return new xO}}class xO{of(e){return new ut(this,e)}}class wO{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 wO(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}I.reconfigure=I.define();I.appendConfig=I.define();class te{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Lh(i,t.newLength),s.some(l=>l.type==te.time)||(this.annotations=s.concat(te.time.of(Date.now())))}static create(e,t,i,r,s,o){return new te(e,t,i,r,s,o)}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(te.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}te.time=ut.define();te.userEvent=ut.define();te.addToHistory=ut.define();te.remote=ut.define();function $O(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Bh(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=ie.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:I.mapEffects(n.effects,r).concat(I.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function ws(n,e,t){let i=e.selection,r=Ut(e.annotations);return e.userEvent&&(r=r.concat(te.userEvent.of(e.userEvent))),{changes:e.changes instanceof ie?e.changes:ie.of(e.changes||[],t,n.facet(Yh)),selection:i&&(i instanceof k?i:k.single(i.anchor,i.head)),effects:Ut(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Dh(n,e,t){let i=ws(n,e.length?e[0]:{},n.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 o=!!e[s].sequential;i=Bh(i,ws(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=te.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return PO(t?vO(r):r)}function vO(n){let e=n.startState,t=!0;for(let r of e.facet(zh)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:$O(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=ie.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=te.create(e,r,n.selection&&n.selection.map(s),I.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(_h);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof te?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof te?n=s[0]:n=Dh(e,Ut(s),!1)}return n}function PO(n){let e=n.startState,t=e.facet(Wh),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=Bh(i,ws(e,s,n.changes.newLength),!0))}return i==n?n:te.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const TO=[];function Ut(n){return n==null?TO:Array.isArray(n)?n:[n]}var lt=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(lt||(lt={}));const CO=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let $s;try{$s=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ZO(n){if($s)return $s.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||CO.test(t)))return!0}return!1}function XO(n){return e=>{if(!/\S/.test(e))return lt.Space;if(ZO(e))return lt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return lt.Word;return lt.Other}}class V{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Zi(this,l<<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 Zi(this,i),In(this,i)}update(...e){return Dh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(gr.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(I.reconfigure)?(t=null,i=l.value):l.is(I.appendConfig)&&(t=null,i=Ut(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=qn.resolve(i,r,this),s=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(xs)?e.newSelection:e.newSelection.asSingle();new V(t,e.newDoc,o,s,(l,a)=>a.update(l,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]),r=this.changes(i.changes),s=[i.range],o=Ut(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let u=0;u<l;u++)s[u]=s[u].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=I.mapEffects(o,c).concat(I.mapEffects(Ut(a.effects),f))}return{changes:r,selection:k.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ie?e:ie.of(e,this.doc.length,this.facet(V.lineSeparator))}toText(e){return z.of(e.split(this.facet(V.lineSeparator)||Ss))}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:(Zi(this,t),In(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof We&&this.config.address[r.id]!=null&&(t[i]=r.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 r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:k.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=qn.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Ss)),r=e.selection?e.selection instanceof k?e.selection:k.single(e.selection.anchor,e.selection.head):k.single(0);return Lh(r,i.length),t.staticFacet(xs)||(r=r.asSingle()),new V(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
|
package/dist/index.html
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
} catch (e) {}
|
|
23
23
|
})();
|
|
24
24
|
</script>
|
|
25
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
25
|
+
<script type="module" crossorigin src="/assets/index-BKfqr8sS.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DBJfPBlG.css">
|
|
27
27
|
<link rel="manifest" href="/manifest.webmanifest"></head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
package/dist/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const u=s=>l(s,r),o={module:{uri:r},exports:a,require:u};e[r]=Promise.all(i.map(s=>o[s]||u(s))).then(s=>(n(...s),a))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"pwa-64x64.png",revision:"6f10cd3ce8dd36cf6af65fd22310235f"},{url:"pwa-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-192x192.png",revision:"536b2ea22e7195eefa8806a1d7d993da"},{url:"maskable-icon-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"manifest.webmanifest",revision:"5171a09ae3e50605a6503e2bebd6866b"},{url:"index.html",revision:"
|
|
1
|
+
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const u=s=>l(s,r),o={module:{uri:r},exports:a,require:u};e[r]=Promise.all(i.map(s=>o[s]||u(s))).then(s=>(n(...s),a))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"pwa-64x64.png",revision:"6f10cd3ce8dd36cf6af65fd22310235f"},{url:"pwa-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-192x192.png",revision:"536b2ea22e7195eefa8806a1d7d993da"},{url:"maskable-icon-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"manifest.webmanifest",revision:"5171a09ae3e50605a6503e2bebd6866b"},{url:"index.html",revision:"7de1aebdde0a91b69a47e5702ba17732"},{url:"icon.svg",revision:"53c7d88dbec013463a85d68375229bcb"},{url:"favicon.ico",revision:"8b16a7348bc587d1c91324487d988e81"},{url:"apple-touch-icon-180x180.png",revision:"010679b40baa6da053a041cfc7fc7657"},{url:"assets/workbox-window.prod.es5-BBnX5xw4.js",revision:null},{url:"assets/useAttachmentUploader-Be6yFw7I.js",revision:null},{url:"assets/url-QSQwrjSV.js",revision:null},{url:"assets/types-BaJkUfo6.js",revision:null},{url:"assets/transcribe-default-Cjxt7F_e.js",revision:null},{url:"assets/react-force-graph-2d-BZd7whjL.js",revision:null},{url:"assets/provenance-BFQb2w9-.js",revision:null},{url:"assets/index-DBJfPBlG.css",revision:null},{url:"assets/index-BKfqr8sS.js",revision:null},{url:"assets/history-BHtc79G3.js",revision:null},{url:"assets/fraunces-vietnamese-opsz-normal-Czevyj-6.woff2",revision:null},{url:"assets/fraunces-vietnamese-opsz-italic-DxWqP7Ku.woff2",revision:null},{url:"assets/fraunces-latin-opsz-normal-DihXLNYH.woff2",revision:null},{url:"assets/fraunces-latin-opsz-italic-lSdLDfvT.woff2",revision:null},{url:"assets/fraunces-latin-ext-opsz-normal-CJcjJNj7.woff2",revision:null},{url:"assets/fraunces-latin-ext-opsz-italic-CGbN9UgK.woff2",revision:null},{url:"assets/figtree-latin-wght-normal-D_ZTVpCC.woff2",revision:null},{url:"assets/figtree-latin-ext-wght-normal-DCwSJGxG.woff2",revision:null},{url:"assets/editor-mode-D9fveTEx.js",revision:null},{url:"assets/attachment-upload-D6wfJsr6.js",revision:null},{url:"assets/WizardShell-eATuMAXz.js",revision:null},{url:"assets/Welcome-C6zOVULl.js",revision:null},{url:"assets/ViewSurface-CB97Dtg8.js",revision:null},{url:"assets/ViewNew-D3N3bUyp.js",revision:null},{url:"assets/Vaults-DWoDm-Th.js",revision:null},{url:"assets/VaultGraph-BrDsta1c.js",revision:null},{url:"assets/Tags-DGl9Zubj.js",revision:null},{url:"assets/TagSchemaEditor-ve19B-tr.js",revision:null},{url:"assets/TagPage-pYbWcmlY.js",revision:null},{url:"assets/Settings-ClPAPWCJ.js",revision:null},{url:"assets/PinArchiveButtons-8xFKv2oH.js",revision:null},{url:"assets/OAuthCallback-W5STO-7I.js",revision:null},{url:"assets/NoteView-Dy3cUyrT.js",revision:null},{url:"assets/NoteRenderer-DG6I-BOG.js",revision:null},{url:"assets/NoteNew-B7fbwu7C.js",revision:null},{url:"assets/NoteEditor-DT4kYH2h.js",revision:null},{url:"assets/Import-2WIsPfSi.js",revision:null},{url:"assets/Export-BFGWcvOW.js",revision:null},{url:"assets/DayView-jTXjnokv.js",revision:null},{url:"assets/ConnectAI-CUJNLwHZ.js",revision:null},{url:"assets/CheckEmail-ntqd1kZe.js",revision:null},{url:"assets/Calendar-DBe5DpLx.js",revision:null},{url:"assets/AddVaultCreate-Di9wcscn.js",revision:null},{url:"assets/AddVaultChooser-Xvu3Uphy.js",revision:null},{url:"assets/AddVault-DoCaI37K.js",revision:null},{url:"assets/Activity-BcJHDfuw.js",revision:null},{url:"assets/Account-Cl5c8tEo.js",revision:null},{url:"apple-touch-icon-180x180.png",revision:"010679b40baa6da053a041cfc7fc7657"},{url:"favicon.ico",revision:"8b16a7348bc587d1c91324487d988e81"},{url:"icon.svg",revision:"53c7d88dbec013463a85d68375229bcb"},{url:"maskable-icon-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-192x192.png",revision:"536b2ea22e7195eefa8806a1d7d993da"},{url:"pwa-512x512.png",revision:"f748457107f68f1ca3c1c546ef9921e7"},{url:"pwa-64x64.png",revision:"6f10cd3ce8dd36cf6af65fd22310235f"},{url:"manifest.webmanifest",revision:"5171a09ae3e50605a6503e2bebd6866b"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"),{denylist:[/^\/api\//,/^\/oauth\/(?!callback)/,/^\/\.well-known\//,/^\/signup/,/^\/login/,/^\/logout/,/^\/auth\//,/^\/console/,/^\/admin/,/^\/account\//,/^\/billing/,/^\/unsubscribe/,/^\/health/,/^\/vault\//,/^\/u\//]}))});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openparachute/app",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Parachute — the super-surface. A single-page app for interfacing with your Parachute: name a vault, capture and browse notes, connect your AI, and manage the cloud + hub via their APIs. Seeded from notes-ui; the calm centered arrival + warm home lead the experience.",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{ap as _e,r as o,aq as Me,ar as $e,as as ge,a as Le,b as Ue,a6 as qe,at as Fe,au as Ve,av as Oe,aw as Ge,a1 as Be,a5 as He,ax as We,ah as Ye,ay as ze,y as Ke,ak as Qe,j as e,N as Ze,az as Je,aA as xe,V as Xe,al as G,aB as et,aC as tt,aD as J,aE as st,aF as nt,aG as at,aH as I,L as rt,an as ot,x as it,aI as ct,ao as lt}from"./index-BhV_u6Bm.js";import{v as dt,A as ut}from"./attachment-upload-BfsE-IDX.js";import{u as mt,C as pt,A as ft,a as ht}from"./useAttachmentUploader-BPyx3tZN.js";import{b as gt,N as xt}from"./NoteRenderer-CyTOvjQK.js";import{l as be,u as bt,a as vt,b as yt}from"./transcribe-default-3hayXb7m.js";import{r as jt}from"./editor-mode-D9fveTEx.js";import"./types-BaJkUfo6.js";const kt=30*6e4,wt=20*1024*1024,Rt=1e4;function Nt(t){const c=t.segmentMs??kt,l=t.setTimer??((x,T)=>setTimeout(x,T)),b=t.clearTimer??(x=>clearTimeout(x)),w=t.makeRecorder??(x=>_e({...x,releaseStreamOnStop:!1})),g=[];let n=null,d=null,f="idle",u=0,h=0,y=!1;const m=()=>{for(const x of t.stream.getTracks())x.stop()},r=()=>{d!==null&&(b(d),d=null)},p=()=>{d=l(()=>{d=null,R()},c)},i=()=>{h+=1;const x=h;n=w({stream:t.stream,mimeType:t.mimeType,releaseStreamOnStop:!1,now:t.now,MediaRecorderCtor:t.MediaRecorderCtor,dataIntervalMs:Rt,onData:T=>{x===h&&T>=wt&&R()}}),n.start(),u+=1,p()},R=()=>{var x;f!=="recording"||!n||y||(y=!0,r(),g.push(n.stop()),i(),(x=t.onRoll)==null||x.call(t,u),y=!1)};return{get state(){return f},get activePart(){return u},start(){if(f!=="idle")throw new Error(`Cannot start from ${f}`);f="recording",i()},async stop(){if(f!=="recording"||!n)throw new Error(`Cannot stop from ${f}`);f="stopped",r(),g.push(n.stop()),n=null;const x=await Promise.all(g);return m(),x},cancel(){r(),n&&n.cancel(),n=null,f="stopped",m()}}}function Tt(){const[t,c]=o.useState({kind:"idle"}),[l,b]=o.useState(0),[w,g]=o.useState(0),n=o.useRef(null),d=o.useRef(null);o.useEffect(()=>{if(t.kind!=="recording")return;const m=setInterval(()=>b(Date.now()-t.startedAt),250);return()=>clearInterval(m)},[t]),o.useEffect(()=>()=>{d.current&&URL.revokeObjectURL(d.current),n.current&&n.current.state==="recording"&&n.current.cancel()},[]);const f=o.useCallback(async()=>{if(!(t.kind==="recording"||t.kind==="requesting")){c({kind:"requesting"});try{const m=Me();if(!m){c({kind:"denied",message:"This browser can't record audio in a format we can save."});return}const r=await $e(),p=Nt({stream:r,mimeType:m,onRoll:i=>g(i)});n.current=p,p.start(),b(0),g(p.activePart),c({kind:"recording",startedAt:Date.now()})}catch(m){const r=m,p=r.kind==="permission-denied"?"Microphone access was denied. Update your browser's site settings to record.":r.kind==="no-device"?"No microphone was found on this device.":r instanceof Error?r.message:"Microphone is not available in this browser.";c({kind:"denied",message:p})}}},[t]),u=o.useCallback(async()=>{var r;const m=n.current;if(!(!m||t.kind!=="recording"))try{const p=await m.stop();n.current=null,g(0);const i=((r=p[0])==null?void 0:r.mimeType)??"",R=p.reduce((B,L)=>B+L.durationMs,0),x=p[0],T=x?URL.createObjectURL(new Blob([x.data],{type:x.mimeType})):"";d.current&&URL.revokeObjectURL(d.current),d.current=T||null,c({kind:"have-audio",segments:p,mimeType:i,url:T,durationMs:R})}catch(p){console.warn(p instanceof Error?`Recording failed: ${p.message}`:"Recording failed."),g(0),c({kind:"idle"})}},[t]),h=o.useCallback(()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null),c({kind:"idle"}),b(0),g(0)},[]),y=o.useCallback(()=>{h()},[h]);return{phase:t,elapsedMs:l,parts:w,startRecording:f,stopRecording:u,discardAudio:h,reset:y}}function St(t){const{segments:c,mimeType:l,recordedAt:b,willTranscribe:w}=t,g=c.length>1,n=t.typedText.trim(),d=c.map((y,m)=>({filename:g?ge(l,b,m+1):ge(l,b),transcribe:w,...w&&g?{segment_index:m}:{}})),f=w?g?c.map((y,m)=>`_Transcript pending (part ${m+1})._`).join(`
|
|
2
|
-
|
|
3
|
-
`):"_Transcript pending._":"",u=d.map(y=>`![[${y.filename}]]`).join(`
|
|
4
|
-
|
|
5
|
-
`),h=[];return n&&h.push(n),f&&h.push(f),h.push(u),{body:`${h.join(`
|
|
6
|
-
|
|
7
|
-
`)}
|
|
8
|
-
`,segments:d}}const ve={content:"",path:"",tags:[]};function Ut(){const t=Le(s=>s.getActiveVault()),c=Ue(),l=qe(s=>s.push),b=Fe(),w=Ve(),g=Oe(),{db:n,blobStore:d,engine:f}=Ge(),{roles:u}=Be((t==null?void 0:t.id)??null),h=He(),y=o.useRef(We()),m=o.useRef(jt()).current,r=o.useRef((t==null?void 0:t.id)??null).current,p=o.useRef(null),[i,R]=o.useState(()=>{if(r){const s=Ye(r,I);if(s)return p.current=s.savedAt,s.body}return{...ve,path:y.current}}),[x,T]=o.useState(()=>p.current),[B,L]=o.useState(""),[ee,C]=o.useState(null),[U,je]=o.useState([]),[ke,te]=o.useState(!1),H=o.useRef(null),se=o.useRef(null),v=Tt(),D=ze(),N=D.capability,ne=v.phase.kind==="requesting"||v.phase.kind==="recording"||v.phase.kind==="have-audio",we=(N==null?void 0:N.enabled)===!1&&!ne,W=typeof(N==null?void 0:N.minutes_remaining)=="number"?N.minutes_remaining:void 0,Y=W!==void 0&&W<=0,[z,ae]=o.useState(()=>r?be(r):!0),Re=(N==null?void 0:N.enabled)!==!1,re=o.useRef(v.phase.kind);o.useEffect(()=>{const s=re.current,a=v.phase.kind;re.current=a,a==="idle"&&s!=="idle"&&r&&ae(be(r))},[v.phase.kind,r]);const[Ne]=Ke(),oe=Ne.has("voice"),ie=o.useRef(!1);o.useEffect(()=>{var s;!oe||ie.current||D.settled&&((s=D.capability)==null?void 0:s.enabled)!==!1&&(ie.current=!0,v.startRecording())},[oe,D.settled,D.capability,v.startRecording]);const A=mt({noteId:null,onInsert:s=>{H.current?H.current.insertAtCursor(s):R(a=>({...a,content:`${a.content}${s}`}))},onStaged:s=>je(a=>[...a,s]),onError:s=>l(s,"error")}),_=o.useRef(p.current!==null),q=o.useRef(null);o.useEffect(()=>{_.current||(R(s=>{const a=q.current?s.tags.filter(P=>P!==q.current):s.tags,j=a.includes(u.captureText)?a:[...a,u.captureText];return j===s.tags?s:{...s,tags:j}}),q.current=u.captureText)},[u.captureText]);const ce=!_.current&&(i.tags.length===0||i.tags.length===1&&i.tags[0]===u.captureText),Te=i.content.trim().length>0||!ce||i.path.trim().length>0&&i.path!==y.current;if(Qe(r,I,i,Te),!t)return e.jsx(Ze,{to:"/",replace:!0});const F=v.phase.kind==="have-audio",K=i.content.trim().length>0,V=i.content.length>0||i.path!==y.current||!ce||F,M=i.path.trim().length>0&&(K||F),E=b.isPending||ke,le=o.useCallback(()=>{if(!M||E)return;const s=Je({content:i.content,path:i.path,tags:i.tags});h&&xe(t.id,h),C(null),b.mutate(s,{onSuccess:async a=>{for(const j of U)try{await w.mutateAsync({noteId:a.id,path:j.path,mimeType:j.mimeType})}catch(P){const Q=P instanceof Error?P.message:"Link failed";l(`Failed to attach ${j.filename}: ${Q}`,"error")}r&&G(r,I),l(`Created ${a.path??a.id}`,"success"),c(`/n/${encodeURIComponent(a.id)}`,{replace:!0})},onError:a=>{a instanceof Xe?C("Session expired. Reconnect to save."):C(a instanceof Error?`${a.message} — if the path is taken, try a different one.`:"Create failed")}})},[t,r,h,i,M,w,b,c,E,l,U]),de=o.useCallback(async()=>{if(!M||E||v.phase.kind!=="have-audio")return;if(!n||!d){l("Sync queue not ready — try again in a moment.","error");return}C(null);const s=v.phase,a=s.segments,j=s.mimeType,P=i.path.trim(),Q=i.tags,Pe=et(i.content),pe=Array.from(new Set([u.captureVoice,...Q,...Pe].filter(k=>k.length>0)));K&&pe.push(u.captureText);const fe=Array.from(new Set(pe)),Ie=new Date,$=tt(),De=!Y&&z,O=St({segments:a,mimeType:j,typedText:i.content,recordedAt:Ie,willTranscribe:De});for(let k=0;k<a.length;k++){const S=dt(new File([a[k].data],O.segments[k].filename,{type:j}));if(S){l(S,"error"),C(S);return}}te(!0),h&&xe(t.id,h);const he={content:O.body,path:P,metadata:{source:"voice"},...fe.length?{tags:fe}:{}};try{await J(n,{kind:"create-note",localId:$,payload:he},{vaultId:t.id});for(let k=0;k<O.segments.length;k++){const S=O.segments[k],Z=st();await d.put(Z,a[k].data,j,t.id),await J(n,{kind:"upload-attachment",blobId:Z,filename:S.filename,mimeType:j},{vaultId:t.id}),await J(n,{kind:"link-attachment",noteId:$,pathRef:nt(Z),mimeType:j,transcribe:S.transcribe,...S.segment_index!==void 0?{segment_index:S.segment_index}:{}},{vaultId:t.id})}f==null||f.runOnce(),g.setQueryData(["note",t.id,$],at(he,$)),r&&G(r,I),l("Captured — syncing audio.","success"),v.discardAudio(),c(`/n/${encodeURIComponent($)}`,{replace:!0})}catch(k){l(k instanceof Error?`Capture failed: ${k.message}`:"Capture failed.","error"),C(k instanceof Error?k.message:"Capture failed")}finally{te(!1)}},[t,r,d,h,n,i,f,K,M,c,Y,E,l,g,u.captureText,u.captureVoice,z,v]),ue=o.useCallback(()=>{F?de():le()},[F,le,de]),me=o.useCallback(()=>{V&&!confirm("Discard this draft?")||(r&&G(r,I),v.discardAudio(),c("/"))},[r,V,c,v]),Se=o.useCallback(()=>{r&&G(r,I),_.current=!1,q.current=u.captureText,R({...ve,path:y.current,tags:[u.captureText]}),v.discardAudio(),T(null)},[r,v,u.captureText]);o.useEffect(()=>{if(!V)return;const s=a=>{a.preventDefault(),a.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[V]);const Ce=s=>{const a=lt(s);!a||i.tags.includes(a)||(_.current=!0,R(j=>({...j,tags:[...j.tags,a]})),L(""))},Ae=s=>{_.current=!0,R(a=>({...a,tags:a.tags.filter(j=>j!==s)}))},Ee=gt({id:"__new__",createdAt:new Date().toISOString()});return e.jsxs("div",{className:"page",children:[e.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:e.jsx(rt,{to:"/notes",className:"hover:text-accent",children:"← All notes"})}),e.jsxs("article",{children:[e.jsxs("header",{className:"composer mb-6 p-5 md:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("span",{className:"eyebrow",children:"New note"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:me,className:"btn btn-secondary btn-touch",children:"Cancel"}),e.jsx("button",{type:"button",onClick:ue,disabled:!M||E,className:"btn btn-primary btn-touch",title:"Create (⌘S)",children:E?"Creating…":"Create"})]})]}),e.jsx("input",{type:"text",value:i.path,onChange:s=>R(a=>({...a,path:s.target.value})),className:i.path===y.current?"mt-4 w-full border-0 bg-transparent font-sans text-sm text-fg-dim outline-none placeholder:text-fg-dim":"mt-4 w-full border-0 bg-transparent font-serif text-2xl text-fg outline-none placeholder:text-fg-dim md:text-3xl","aria-label":"Note path",placeholder:"Name your note — or just start writing"}),e.jsx("div",{className:"mt-4",children:e.jsx(ot,{tags:i.tags,input:B,onInputChange:L,onAdd:Ce,onRemove:Ae})})]}),x?e.jsxs("div",{role:"status","data-testid":"draft-restored",className:"mb-4 flex flex-wrap items-center justify-between gap-2 rounded-xl border border-accent/30 bg-accent/5 px-3 py-2 text-sm",children:[e.jsxs("span",{className:"text-fg-muted",children:["Unsaved draft restored from ",it(x),"."]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:Se,className:"text-fg-dim hover:text-danger",children:"Discard draft"}),e.jsx("button",{type:"button",onClick:()=>T(null),"aria-label":"Dismiss draft-restored notice",className:"text-fg-dim hover:text-accent",children:"✕"})]})]}):null,ee?e.jsx("div",{role:"alert",className:"mb-4 rounded-xl border border-danger-border bg-danger-soft p-3 text-sm text-danger",children:ee}):null,we?e.jsx(ct,{capability:N}):e.jsxs(e.Fragment,{children:[e.jsx(Et,{voice:v,minutesRemaining:W,outOfMinutes:Y,transcribe:z,onTranscribeChange:ae,showTranscribeToggle:Re}),e.jsx(Ct,{vaultId:t.id,captureEngaged:ne})]}),e.jsxs("div",{className:`grid min-h-[60dvh] gap-4 ${m?"":"lg:grid-cols-2"}`,children:[e.jsx(ut,{onDropFiles:A.start,className:"card min-h-0 h-[60dvh] min-w-0",hint:"Images, audio, webm video",children:e.jsx(pt,{ref:H,value:i.content,onChange:s=>R(a=>({...a,content:s})),onSave:ue,onCancel:me,placeholder:"Start writing…",onPasteFile:s=>(A.start(s),!0),onRequestAttachment:()=>{var s;return(s=se.current)==null?void 0:s.open()},livePreview:m})}),m?null:e.jsx("div",{className:"card min-w-0 overflow-auto p-4 lg:h-[60dvh] lg:min-h-0",children:i.content.trim()?e.jsx(xt,{note:{path:i.path,content:i.content},resolve:Ee}):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-xl",children:"Attachments"}),e.jsx(ft,{ref:se,onPickFiles:A.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:"text-accent hover:underline",children:"PDF + mp4 coming"}),"."]}),e.jsx(ht,{uploads:A.uploads,onCancel:A.cancel,onDismiss:A.dismiss}),U.length>0?e.jsx("ul",{className:"mt-3 space-y-1 text-sm",children:U.map(s=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded-lg 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:s.filename}),e.jsx("span",{className:"shrink-0 text-fg-dim",children:"staged"})]},s.path))}):null]})]})]})}function Ct({vaultId:t,captureEngaged:c}){const l=bt(),b=vt(),{made:w,markMade:g}=yt(t),[n,d]=o.useState(null);if(!(c&&!w&&l.supported&&l.value==="keep"))return null;const u=h=>{d(null),b.mutate(h,{onSuccess:()=>g(),onError:()=>d("Couldn't save that choice — this recording is kept (the vault default). We'll ask again next time; you can also set it in Settings.")})};return e.jsxs("div",{"data-testid":"retention-choice",className:"mb-4 flex flex-col gap-2 rounded-xl border border-border bg-card/60 p-3",children:[e.jsx("p",{className:"text-xs text-fg-muted",children:"First voice note here — should this vault keep your audio files after transcribing?"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>u("keep"),disabled:b.isPending,className:"btn btn-secondary btn-touch",children:"Keep my recordings"}),e.jsx("button",{type:"button",onClick:()=>u("until_transcribed"),disabled:b.isPending,className:"btn btn-secondary btn-touch",children:"Just keep the words"}),e.jsx("span",{className:"text-xs text-fg-dim",children:"(audio deleted after transcribing)"})]}),e.jsx("p",{className:"text-xs text-fg-dim",children:"Either way your capture saves now. Change this anytime in Settings."}),n?e.jsx("p",{className:"text-xs text-danger","data-testid":"retention-choice-error",children:n}):null]})}const At=30;function ye({checked:t,disabled:c,onChange:l}){return e.jsxs("div",{className:"flex basis-full items-center justify-between gap-3",children:[e.jsx("span",{className:"text-xs text-fg-dim",children:"Transcribe this recording"}),e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":"Transcribe this recording","data-testid":"transcribe-toggle",disabled:c,onClick:()=>l(!t),className:`relative h-7 w-12 shrink-0 rounded-full transition-colors disabled:opacity-40 ${t?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 h-6 w-6 rounded-full bg-card shadow-sm transition-transform ${t?"translate-x-5":"translate-x-0.5"}`})})]})}function Et({voice:t,minutesRemaining:c,outOfMinutes:l,transcribe:b,onTranscribeChange:w,showTranscribeToggle:g}){const{phase:n,elapsedMs:d,parts:f,startRecording:u,stopRecording:h,discardAudio:y}=t,m=n.kind==="recording",r=n.kind==="requesting",p=!l&&b,i=typeof c=="number"&&c<=At;return n.kind==="have-audio"?e.jsxs("div",{className:"mb-4 flex flex-col gap-2 rounded-xl border border-accent/30 bg-accent/5 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"text-sm text-fg-muted",children:["🎙 Recorded ",X(n.durationMs),n.segments.length>1?` · ${n.segments.length} parts`:""]}),e.jsx("button",{type:"button",onClick:y,className:"text-xs text-fg-dim hover:text-danger",children:"Discard"})]}),e.jsx("audio",{controls:!0,src:n.url,className:"w-full",children:e.jsx("track",{kind:"captions"})}),g?e.jsx(ye,{checked:p,disabled:l,onChange:w}):null,e.jsx("p",{className:"text-xs text-fg-dim",children:l?"Saved as audio-only — you're out of transcription minutes this month.":p?"Transcript will be appended once your vault processes it. Save to commit.":"Saved as audio-only — transcription is off for this recording."})]}):e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border bg-card/60 p-3",children:[e.jsx("div",{className:"text-xs text-fg-dim",children:m?f>1?`Recording — tap Stop to finish. (part ${f})`:"Recording — tap Stop to finish.":r?"Requesting microphone…":l?"You're out of transcription minutes this month — this saves as audio-only.":p?"Add a voice memo to this note. Audio gets transcribed and appended.":"Add a voice memo to this note. Saved as audio-only — transcription is off for this recording."}),m?e.jsxs("button",{type:"button",onClick:()=>void h(),"aria-label":`Recording — ${X(d)} — stop`,"aria-pressed":"true",className:"flex min-h-11 items-center gap-2 rounded-full border border-danger-border bg-danger-soft px-4 py-2 text-sm font-medium text-danger",children:[e.jsx("span",{"aria-hidden":"true",className:"animate-pulse",children:"🎙"}),e.jsxs("span",{children:["Stop ",X(d)]})]}):e.jsxs("button",{type:"button",onClick:()=>void u(),"aria-label":"Record voice memo",disabled:r,className:"flex min-h-11 items-center gap-2 rounded-full border border-accent/30 bg-accent/10 px-4 py-2 text-sm font-medium text-accent hover:bg-accent/15 disabled:opacity-40",children:[e.jsx("span",{"aria-hidden":"true",children:"🎙"}),e.jsx("span",{children:r?"Requesting…":"Record"})]}),g?e.jsx(ye,{checked:p,disabled:l,onChange:w}):null,i&&!l?e.jsxs("p",{className:"basis-full text-xs text-fg-dim","data-testid":"voice-minutes-left",children:["About ",Math.round(c)," min of transcription left this month."]}):null,n.kind==="denied"?e.jsx("p",{className:"basis-full rounded-xl border border-danger-border bg-danger-soft px-3 py-2 text-xs text-danger",children:n.message}):null]})}function X(t){const c=Math.floor(t/1e3),l=Math.floor(c/60),b=c%60;return`${String(l).padStart(2,"0")}:${String(b).padStart(2,"0")}`}export{Ut as NoteNew};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-force-graph-2d-CAZ4sIdb.js","assets/index-BhV_u6Bm.js","assets/index-rEtUY3V3.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a5 as w,a as k,av as M,r as d,aM as U,j as t,af as A,aN as $,L as p,aO as D,aP as V,aQ as O,aR as _,aS as H,ae as z,aT as G,N as W,a0 as K,v as j,a1 as Q,aU as Y,aw as q,ag as L,aV as X,aW as Z,aX as J,am as ee,aY as te,E as se,w as ne,aZ as F,x as T,Y as re,a_ as ae,V as ie,a7 as oe}from"./index-BhV_u6Bm.js";import{P as le,D as ce}from"./PinArchiveButtons-CJcBoOpQ.js";import{b as de,N as ue}from"./NoteRenderer-CyTOvjQK.js";function me(e,n){const s=w(),r=k(u=>u.activeVaultId),i=M(),[l,a]=d.useState(!1),o=n&&!xe(n)?n.path:void 0;return d.useEffect(()=>{if(a(!1),!s||!r||!e||!o)return;let u=!0;const m=()=>{u&&i.invalidateQueries({queryKey:["note",r,e]})},c=he(s,o,{onUpsert:m,onRemove:m,onStatus:h=>{u&&a(h==="open")}});return()=>{u=!1,a(!1),c()}},[s,r,e,o,i]),{isLive:l}}function xe(e){return U(e.id)}function he(e,n,s){return e.subscribe({path:n},{onSnapshot:()=>{},onUpsert:()=>s.onUpsert(),onRemove:()=>s.onRemove(),onStatus:s.onStatus})}const fe=1,pe=3,ge=1;function be(e,n){const s=new Map,r=new Map;for(const l of n.values())for(const a of l.links??[]){if(a.sourceId===a.targetId||!n.has(a.sourceId)||!n.has(a.targetId))continue;const o=`${a.sourceId}|${a.targetId}|${a.relationship}`;s.has(o)||(s.set(o,{source:a.sourceId,target:a.targetId,relationship:a.relationship}),r.set(a.sourceId,(r.get(a.sourceId)??0)+1),r.set(a.targetId,(r.get(a.targetId)??0)+1))}return{nodes:[...n.values()].map(l=>{var a;return{id:l.id,path:l.path,tags:l.tags,summary:typeof((a=l.metadata)==null?void 0:a.summary)=="string"?l.metadata.summary:void 0,isAnchor:l.id===e,linkCount:r.get(l.id)??0}}),edges:[...s.values()]}}async function je(e,n,s,r){const i=new Map;i.set(e.id,e);let l=[e];for(let a=1;a<=n;a++){const o=new Set;for(const c of l)for(const h of c.links??[]){const f=h.sourceId===c.id?h.targetId:h.sourceId;f!==c.id&&(i.has(f)||o.add(f))}if(o.size===0)break;const u=await Promise.all([...o].map(c=>s(c).catch(()=>null)));if(r!=null&&r.cancelled)return i;const m=[];for(const c of u)c&&!i.has(c.id)&&(i.set(c.id,c),m.push(c));l=m}return i}function Ne(e,n,s){const[r,i]=d.useState(null),[l,a]=d.useState(!1);return d.useEffect(()=>{if(!e||!n){i(null),a(!1);return}const o={cancelled:!1};return a(!0),je(n,s,u=>e.getNote(u,{includeLinks:!0}),o).then(u=>{o.cancelled||(i(be(n.id,u)),a(!1))}).catch(()=>{o.cancelled||a(!1)}),()=>{o.cancelled=!0}},[e,n,s]),{data:r,isLoading:l}}const ve=d.lazy(()=>V(()=>import("./react-force-graph-2d-CAZ4sIdb.js"),__vite__mapDeps([0,1,2])));function ye({anchor:e}){const[n,s]=d.useState(!0),[r,i]=d.useState(ge),l=w(),{data:a,isLoading:o}=Ne(l,n?e:void 0,r);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:()=>s(u=>!u),"aria-expanded":n,className:"font-serif text-xl text-fg hover:text-accent",children:[n?"▾":"▸"," Neighborhood"]}),n&&a?t.jsxs("span",{className:"text-xs text-fg-dim",children:[a.nodes.length," ",a.nodes.length===1?"note":"notes"]}):null]}),n?t.jsx(we,{depth:r,onChange:i}):null]}),n?t.jsx(ke,{data:a,isLoading:o}):null]})}function we({depth:e,onChange:n}){const s=[];for(let r=fe;r<=pe;r++)s.push(r);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"}),s.map(r=>t.jsx("button",{type:"button","aria-pressed":r===e,onClick:()=>n(r),className:r===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:r},r))]})}function ke({data:e,isLoading:n}){const[s,r]=d.useState(null),i=d.useRef(null);if(d.useEffect(()=>{s&&e&&!e.nodes.some(m=>m.id===s)&&r(null)},[e,s]),!e&&n)return t.jsx(B,{});if(!e)return null;if(e.nodes.length<=1)return 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."});const l=e.nodes.filter(m=>!m.isAnchor),a=s?e.nodes.find(m=>m.id===s)??null:null,o=m=>{i.current=document.activeElement??null,r(m)},u=m=>{var c,h;r(null),m!=null&&m.restoreFocus&&((h=(c=i.current)==null?void 0:c.focus)==null||h.call(c))};return t.jsxs(t.Fragment,{children:[t.jsx(Re,{data:e,onSelect:o}),a?t.jsx(Ie,{node:a,onClose:u},a.id):null,t.jsx(Ce,{neighbors:l,selectedId:s,onSelect:o})]})}function Ce({neighbors:e,selectedId:n,onSelect:s}){return e.length===0?null:t.jsxs("div",{className:"mt-4",children:[t.jsx("h3",{className:"eyebrow mb-2",children:"Neighbors"}),t.jsx("ul",{className:"flex flex-wrap gap-2",children:e.map(r=>{const i=D(r.path??r.id);return t.jsx("li",{children:t.jsx("button",{type:"button",onClick:()=>s(r.id),"aria-haspopup":"dialog","aria-pressed":n===r.id,"aria-label":`Preview ${i}`,className:`btn btn-sm btn-touch max-w-full ${n===r.id?"btn-primary":"btn-secondary"}`,children:t.jsx("span",{className:"truncate",children:i})})},r.id)})})]})}function Ie({node:e,onClose:n}){var a;const s=A(e.id),r=d.useRef(null);d.useEffect(()=>{var o;(o=r.current)==null||o.focus()},[]);const i=$({id:e.id,path:e.path,content:(a=s.data)==null?void 0:a.content}),l=Se(s.data);return t.jsxs("div",{role:"dialog",ref:r,"aria-label":"Note preview",tabIndex:-1,"data-testid":"neighbor-preview",onKeyDown:o=>{o.key==="Escape"&&n({restoreFocus:!0})},onBlur:o=>{o.currentTarget.contains(o.relatedTarget)||n()},className:"focus-ring card mt-3 p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx("h3",{className:"min-w-0 truncate font-serif text-lg text-fg",children:i}),t.jsx("button",{type:"button",onClick:()=>n({restoreFocus:!0}),"aria-label":"Close preview",className:"shrink-0 text-fg-dim hover:text-accent",children:"✕"})]}),e.tags&&e.tags.length>0?t.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.tags.map(o=>t.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",o]},o))}):null,t.jsx(Ee,{isPaused:s.fetchStatus==="paused",isPending:s.isPending,isError:s.isError,snippet:l}),t.jsx("div",{className:"mt-3",children:t.jsx(p,{to:`/n/${encodeURIComponent(e.id)}`,className:"btn btn-primary btn-touch",children:"Open note"})})]})}function Ee({isPaused:e,isPending:n,isError:s,snippet:r}){return e&&n?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Preview unavailable offline."}):n?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Loading preview…"}):s?t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"Couldn't load preview."}):r?t.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:r}):t.jsx("p",{className:"mt-2 text-sm text-fg-dim",children:"No preview text."})}function Se(e){if(!e)return null;const n=(e.preview??O(e.content??"")).trim();return n?n.length>200?`${n.slice(0,200).trimEnd()}…`:n:null}function B(){return t.jsx("div",{"aria-busy":"true",className:"h-[24rem] w-full animate-pulse rounded-md border border-border bg-card"})}function Re({data:e,onSelect:n}){const s=d.useRef(null),[r,i]=d.useState({w:600,h:384});d.useEffect(()=>{const a=s.current;if(!a)return;const o=()=>{const m=a.getBoundingClientRect();i({w:Math.max(320,Math.floor(m.width)),h:384})};o();const u=new ResizeObserver(o);return u.observe(a),()=>u.disconnect()},[]);const l=d.useMemo(()=>({nodes:e.nodes.map(a=>({...a})),links:e.edges.map(a=>({source:a.source,target:a.target,rel:a.relationship}))}),[e]);return t.jsx("div",{ref:s,"data-testid":"neighborhood-graph-canvas",className:"overflow-hidden rounded-md border border-border bg-card",children:t.jsx(d.Suspense,{fallback:t.jsx(B,{}),children:t.jsx(ve,{graphData:l,width:r.w,height:r.h,nodeLabel:a=>Le(a),nodeVal:a=>{const o=a;return o.isAnchor?8:3+Math.min(o.linkCount,8)},nodeColor:a=>a.isAnchor?"#c9b170":"#8a9a7a",linkColor:()=>"rgba(160, 160, 160, 0.4)",linkDirectionalArrowLength:3,linkDirectionalArrowRelPos:1,cooldownTicks:80,onNodeClick:a=>{n(a.id)}})})})}function Le(e){const n=[e.path??e.id];return e.tags&&e.tags.length>0&&n.push(`tags: ${e.tags.join(", ")}`),e.summary&&n.push(e.summary),n.join(`
|
|
3
|
-
`)}function Te({content:e,attachments:n,onRetry:s,retrying:r=!1}){const i={content:e,attachments:n},l=_(i);if(l==="pending"){const a=H(i);return 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.jsxs("span",{className:"text-sky-300/80",children:["part ",Math.min(a.done+1,a.total)," of ",a.total]}):null]})}return l==="failed"?t.jsxs("output",{className:"mb-4 inline-flex flex-wrap 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:[t.jsx("span",{children:"Transcription unavailable — open the audio below and add a note by hand."}),s?t.jsx("button",{type:"button",onClick:s,disabled:r,className:"rounded border border-amber-500/40 px-2 py-0.5 font-medium text-amber-100 hover:bg-amber-500/15 disabled:opacity-50",children:r?"Retrying…":"Retry"}):null]}):l==="voice-limit"?t.jsx("output",{className:"mb-4 inline-flex items-center gap-2 rounded-md border border-border bg-bg/40 px-3 py-1.5 text-xs text-fg-muted",children:"Monthly voice limit reached — transcription resumes next month. The audio is saved below."}):null}function Xe(){const{id:e}=z(),n=k(r=>r.getActiveVault()),s=A(e);return me(e,s.data),d.useEffect(()=>{n&&e&&G(n.id,e)},[n,e]),n?t.jsxs("div",{className:"page",children:[t.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:t.jsx(p,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})}),s.isPending?t.jsx(_e,{}):s.data?t.jsxs(t.Fragment,{children:[s.isError?t.jsx(K,{}):null,t.jsx(Pe,{note:s.data,cacheId:e})]}):s.isError?t.jsx(Ke,{error:s.error,retry:()=>s.refetch()}):t.jsx(We,{id:e??""})]}):t.jsx(W,{to:"/",replace:!0})}function Pe({note:e,cacheId:n}){var S,R;const s=k(x=>x.getActiveVault()),{roles:r}=Q((s==null?void 0:s.id)??null),i=Y(),{mirror:l}=q(),a=l.state==="offline",o=e.contentEvicted===!0,u=d.useMemo(()=>de(e),[e]),m=L(x=>x.on),c=L(x=>x.setOn);d.useEffect(()=>{if(!m)return;const x=y=>{y.key==="Escape"&&c(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[m,c]);const h=e.path??e.id,f=X(e.content),g=f!==null?{kind:"title",text:f}:e.path?Z(e.path):{kind:"title",text:e.id},b=d.useMemo(()=>f!==null?{...e,content:J(e.content??"")}:e,[e,f]),C=typeof((S=e.metadata)==null?void 0:S.summary)=="string"?e.metadata.summary:null,I=d.useMemo(()=>(e.links??[]).filter(x=>x.targetId===e.id&&x.sourceId!==e.id&&x.sourceNote),[e]),E=d.useMemo(()=>{const x=new Set,y=[];for(const N of e.links??[])N.sourceId!==e.id||N.targetId===e.id||N.targetNote&&(x.has(N.targetId)||(x.add(N.targetId),y.push(N)));return y},[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-8 border-b border-border pb-5",children:[t.jsx("h1",{className:g.kind==="timestamp"?"page-title title-timestamp":"page-title",children:g.text}),a?t.jsx(ze,{}):null,e.tags&&e.tags.length>0?t.jsx(Be,{tags:e.tags}):null,C?t.jsx("p",{className:"mt-3 text-fg-muted",children:C}):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:"btn btn-secondary btn-touch",children:"Edit"}),t.jsx(le,{note:e,keyboard:!0}),t.jsx(ce,{note:e}),t.jsxs("button",{type:"button",onClick:()=>c(!0),className:"btn btn-ghost btn-touch",title:"Focus (⌘.)",children:[t.jsx(ee,{width:16,height:16}),"Focus"]}),te(e,r.view)?t.jsx(p,{to:`/views/${encodeURIComponent(e.id)}`,className:"btn btn-secondary btn-touch",children:"Open as view"}):null]}),t.jsx(Ue,{value:h,isPath:!!e.path})]}),t.jsx(Te,{content:e.content??"",attachments:e.attachments,onRetry:()=>i.mutate({cacheId:n??e.id,serverId:e.id}),retrying:i.isPending}),o?t.jsx(Ge,{preview:e.preview}):(R=b.content)!=null&&R.trim()?t.jsx(ue,{note:b,resolve:u}):f===null?t.jsx(He,{noteId:e.id}):null,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(x=>t.jsx($e,{attachment:x},x.id))})]}):null,t.jsx(ye,{anchor:e})]}),t.jsxs("aside",{className:"space-y-6 text-sm lg:sticky lg:top-24 lg:self-start",children:[t.jsx(Ae,{note:e}),E.length>0?t.jsx(P,{title:"Outbound",links:E,peer:"target"}):null,I.length>0?t.jsx(P,{title:"Inbound",links:I,peer:"source"}):null]})]})}function Ae({note:e}){const n=e.createdAt,s=e.updatedAt,r=Object.entries(e.metadata??{}).filter(([i])=>i!=="summary");return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsx("h2",{className:"eyebrow mb-2",children:"Metadata"}),t.jsxs("dl",{className:"space-y-1.5 text-sm",children:[e.path?t.jsx(v,{label:"Title",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.path})}):null,t.jsx(v,{label:"ID",value:t.jsx("span",{className:"font-mono text-xs break-all",children:e.id})}),t.jsx(v,{label:"Created",value:t.jsx("time",{title:n,children:T(n)})}),s?t.jsx(v,{label:"Updated",value:t.jsx("time",{title:s,children:T(s)})}):null,e.path?t.jsx(v,{label:"Path",value:t.jsx(re,{value:e.path,label:"note path",className:"mt-1"})}):null,r.map(([i,l])=>t.jsx(v,{label:i,value:t.jsx("span",{className:"break-all text-fg-muted",children:String(l)})},i))]}),e.path?t.jsx(Fe,{path:e.path}):null,t.jsx(ae,{note:e,variant:"detail",className:"mt-3"})]})}function Fe({path:e}){const{copied:n,copy:s}=F();return t.jsx("button",{type:"button",onClick:()=>s(e),className:"btn btn-secondary btn-touch mt-3 w-full","aria-label":"Copy reference to this note",children:n?"Copied ✓":"Copy reference"})}function v({label:e,value:n}){return t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("dt",{className:"eyebrow",children:e}),t.jsx("dd",{children:n})]})}function Be({tags:e}){return t.jsx("div",{className:"mt-2 flex flex-wrap gap-1","aria-label":"Tags",children:e.map(n=>t.jsxs(p,{to:`/tags/${encodeURIComponent(n)}`,className:"chip chip-tag focus-ring max-w-full break-all",children:["#",n]},n))})}function Me(e){return t.jsxs("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[t.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),t.jsx("path",{d:"M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5"})]})}function Ue({value:e,isPath:n}){const{copied:s,copy:r}=F();return t.jsxs("button",{type:"button",onClick:()=>r(e),"aria-label":n?"Copy path":"Copy note id",className:"focus-ring group mt-4 flex max-w-full items-center gap-1.5 rounded text-fg-dim transition-colors hover:text-fg-muted",children:[t.jsx(Me,{className:"shrink-0 opacity-70 transition-opacity group-hover:opacity-100"}),t.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:e}),s?t.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:"Copied"}):null]})}function P({title:e,links:n,peer:s}){return t.jsxs("section",{className:"card shadow-soft p-4",children:[t.jsxs("h2",{className:"eyebrow mb-2 tabular-nums",children:[e," (",n.length,")"]}),t.jsx("ul",{className:"space-y-1.5",children:n.map(r=>{var o;const i=s==="source"?r.sourceNote:r.targetNote;if(!i)return null;const l=i.path??i.id,a=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:l}),a?t.jsx("div",{className:"mt-0.5 line-clamp-2 text-xs text-fg-dim",children:a}):null]})},`${r.sourceId}->${r.targetId}:${r.relationship}`)})})]})}function $e({attachment:e}){const n=(e.mimeType??"").toLowerCase(),s=e.filename??e.id;return t.jsxs("figure",{className:"card shadow-soft 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:s}),typeof e.size=="number"?t.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:Oe(e.size)}):null]}),t.jsx(De,{attachment:e,mime:n,filename:s})]})}function De({attachment:e,mime:n,filename:s}){const r=w(),[i,l]=d.useState(null),[a,o]=d.useState(null),u=Ve(n,s),m=u!=="other",c=e.url;if(d.useEffect(()=>{if(!m||!c||!r)return;let f=!1,g=null;return o(null),r.fetchAttachmentBlob(c).then(b=>{f||(g=URL.createObjectURL(b),l(g))}).catch(b=>{f||o(b instanceof Error?b.message:"Failed to load attachment")}),()=>{f=!0,g&&URL.revokeObjectURL(g)}},[m,c,r]),!c)return t.jsx("p",{className:"text-sm text-fg-dim",children:"(no URL)"});if(a)return t.jsx("p",{className:"text-sm text-danger",children:a});if(m&&!i)return t.jsx(j,{className:"h-32 w-full"});const h=i??c;return u==="image"?t.jsx("img",{src:h,alt:s,className:"max-h-[32rem] rounded"}):u==="audio"?t.jsx("audio",{controls:!0,src:h,className:"w-full"}):u==="video"?t.jsx("video",{controls:!0,src:h,className:"w-full rounded"}):u==="pdf"?t.jsxs(t.Fragment,{children:[t.jsx("iframe",{src:h,title:s,className:"h-[40rem] w-full rounded border border-border"}),t.jsxs("a",{href:h,download:s,className:"mt-2 inline-block text-sm text-accent hover:underline",children:["Download ",s]})]}):t.jsxs("a",{href:h,download:s,className:"text-sm text-accent hover:underline",children:["Download ",s]})}function Ve(e,n){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 s=n.toLowerCase().split(".").pop()??"";return["png","jpg","jpeg","gif","webp","svg"].includes(s)?"image":["mp3","wav","ogg","m4a","flac"].includes(s)?"audio":["mp4","webm","mov"].includes(s)?"video":s==="pdf"?"pdf":"other"}function Oe(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 _e(){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(j,{className:"h-3 w-32"}),t.jsx(j,{className:"h-8 w-2/3"}),t.jsx(j,{className:"h-4 w-full"}),t.jsx("div",{className:"mt-6 space-y-2",children:[0,1,2,3,4,5].map(e=>t.jsx(j,{className:"h-3",width:`${70+e*13%25}%`},e))})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(j,{className:"h-32"}),t.jsx(j,{className:"h-24"})]})]})}function He({noteId:e}){return t.jsxs("p",{className:"my-8 font-serif text-lg italic text-fg-muted",children:["Nothing here yet."," ",t.jsx(p,{to:`/n/${encodeURIComponent(e)}/edit`,className:"not-italic text-accent hover:underline",children:"Start writing →"})]})}function ze(){return t.jsx("p",{className:"mt-2",children:t.jsx("span",{className:"chip bg-bg-soft text-fg-muted",title:"Served from your offline copy",children:"Saved copy"})})}function Ge({preview:e}){return t.jsxs("div",{className:"my-8",children:[e?t.jsx("p",{className:"mb-4 text-fg-muted",children:e}):null,t.jsx("p",{className:"font-serif text-lg italic text-fg-muted",children:"Connect to load this note."})]})}function We({id:e}){return t.jsx(ne,{title:t.jsx("span",{className:"font-serif text-xl text-fg",children:"Note not found"}),description:t.jsxs(t.Fragment,{children:["No note with id ",t.jsx("span",{className:"font-mono",children:e})," in this vault."]}),action:t.jsx(p,{to:"/notes",className:"text-sm text-accent hover:underline",children:"Back to all notes"})})}function Ke({error:e,retry:n}){const s=e instanceof ie,r=e instanceof oe,i=s?"Session expired":r?"Note not found":"Could not load note",l=s?e.message:r?"Couldn't find this note. It may have been deleted, or the link may be wrong.":"Something went wrong loading this note. You can try again, or head back to your notes.";return t.jsx(se,{title:i,message:t.jsxs(t.Fragment,{children:[l,s?null:t.jsxs("details",{className:"mt-3",children:[t.jsx("summary",{className:"cursor-pointer text-xs text-fg-dim hover:text-fg-muted",children:"Technical detail"}),t.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-xs text-fg-dim",children:e.message})]})]}),retry:s?void 0:n,action:s?t.jsx(p,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):t.jsx(p,{to:"/notes",className:"btn btn-secondary btn-touch",children:"Back to notes"})})}export{Xe as NoteView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as T,j as e,N as C,L as j,b6 as k,a6 as y,r as d,b7 as E,b8 as A,b9 as O,ba as R,bb as L,a1 as M,bc as P,bd as N,be as g,aw as $,bf as _,bg as I,x as D,bh as z,b as V,u as B,g as F,bi as G,bj as H,h as U,i as Y,bk as K}from"./index-BhV_u6Bm.js";import{u as q,a as Q,b as W,c as X}from"./transcribe-default-3hayXb7m.js";import{r as Z,w as J}from"./editor-mode-D9fveTEx.js";import"./types-BaJkUfo6.js";function pe(){const t=T(a=>a.getActiveVault());return t?e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:e.jsx(j,{to:"/",className:"focus-ring hover:text-accent",children:"← Home"})}),e.jsx("p",{className:"eyebrow mb-1",children:t.name}),e.jsx("h1",{className:"page-title",children:"Settings"}),e.jsx("p",{className:"mt-2 text-fg-muted",children:"Everything about this vault, in one calm place."})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsx(ee,{}),e.jsx(se,{}),e.jsx(ne,{vaultId:t.id}),e.jsx(ie,{}),e.jsx(re,{}),e.jsx(de,{vaultId:t.id}),e.jsx(ue,{vaultId:t.id}),e.jsx(le,{vaultId:t.id}),e.jsx(oe,{})]})]}):e.jsx(C,{to:"/",replace:!0})}function ee(){return e.jsxs("section",{"aria-label":"Manage",children:[e.jsx("h2",{className:"eyebrow mb-3",children:"Manage"}),e.jsxs("div",{className:"card divide-y divide-border rounded-xl shadow-soft",children:[e.jsx(b,{to:"/account",title:"Account",description:"Your plan, billing, hosted vaults, and sign-in — managed in the app."}),e.jsx(te,{}),e.jsx(b,{to:"/connect",title:"Connections",description:"Connect Claude, ChatGPT, or any MCP client to this vault."}),e.jsx(b,{to:"/vaults",title:"Vaults",description:"Add a vault, switch between them, or export."})]})]})}function te(){const t=V(),a=B(r=>r.identityEpoch),[n,s]=d.useState(null),[i,u]=d.useState(!1);if(d.useEffect(()=>{let r=!0;return F().then(o=>{r&&s(o.signed_in?{identity:o.email??o.username??null,csrf:o.csrf}:null)}).catch(()=>{r&&s(null)}),()=>{r=!1}},[a]),!n)return null;const{identity:c,csrf:h}=n;async function x(){u(!0);try{await U(h)}finally{Y(),t("/",{replace:!0})}}return e.jsxs("div",{className:"flex items-center justify-between gap-4 px-5 py-4",children:[e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"block font-medium text-fg",children:["Signed in",c?` as ${c}`:""]}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:"Signing out ends your account session on this device. Vaults already connected here stay until you remove them."})]}),e.jsx("button",{type:"button",onClick:x,disabled:i,className:"btn btn-secondary btn-touch shrink-0",children:i?"Signing out…":"Sign out"})]})}function b({to:t,href:a,title:n,description:s}){const i=e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block font-medium text-fg",children:n}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:s})]}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-fg-dim",children:a?"↗":"→"})]}),u="focus-ring flex items-center justify-between gap-4 px-5 py-4 transition-colors hover:bg-bg-soft first:rounded-t-xl last:rounded-b-xl";return a?e.jsx("a",{href:a,className:u,children:i}):e.jsx(j,{to:t??"/",className:u,children:i})}function se(){return e.jsxs("section",{className:"card space-y-3 rounded-xl p-6 shadow-soft",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Import notes"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Bring in an Obsidian vault zip or a folder of markdown files. Parsed in your browser; previewed before any note lands in the vault."})]}),e.jsx(j,{to:"/import",className:"btn btn-primary btn-touch",children:"Open importer"})]})}const ae=[{value:"keep",title:"Keep",help:"Recordings are stored with your notes; included wherever attachments are included."},{value:"until_transcribed",title:"Delete after transcribing",help:"Your words stay; the audio file is removed once the transcript lands."},{value:"never",title:"Never store",help:"Audio is removed even if transcription fails — the transcript is your only copy; failed transcriptions lose the audio."}];function ne({vaultId:t}){const a=k(),n=q(),s=Q(),{markMade:i}=W(t),{transcribeDefault:u,setTranscribeDefault:c}=X(t),h=y(r=>r.push);if((a==null?void 0:a.enabled)===!1)return null;const x=r=>{r===n.value||s.isPending||s.mutate(r,{onSuccess:()=>{i(),h("Voice recording setting saved.","success")},onError:o=>{h(o instanceof Error&&o.message?`Couldn't save: ${o.message}`:"Couldn't save the voice recording setting.","error")}})};return e.jsxs("section",{className:"card space-y-6 rounded-xl p-6 shadow-soft",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Voice"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"How voice capture behaves in this vault."})]}),e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-fg",children:"Transcribe recordings by default"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"New voice notes start with transcription on — your words are added to the note. Turn it off for a single recording right where you capture. Applies on this device."})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":u,"aria-label":"Transcribe recordings by default","data-testid":"transcribe-default-toggle",onClick:()=>c(!u),className:`relative h-7 w-12 shrink-0 rounded-full transition-colors ${u?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 h-6 w-6 rounded-full bg-card shadow-sm transition-transform ${u?"translate-x-5":"translate-x-0.5"}`})})]}),e.jsxs("div",{className:"space-y-4 border-t border-border pt-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-fg",children:"Keep recordings"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"What happens to the audio file after a voice note is transcribed. Applies to this vault, from every device connected to it."})]}),n.isLoading?e.jsx("p",{className:"text-sm text-fg-dim",children:"Loading…"}):n.isError?e.jsx("p",{className:"text-sm text-fg-dim","data-testid":"retention-load-error",children:"Couldn't load this setting — check the vault connection."}):e.jsxs(e.Fragment,{children:[e.jsxs("fieldset",{className:"space-y-2",disabled:!n.supported||s.isPending,children:[e.jsx("legend",{className:"sr-only",children:"Voice recording retention"}),ae.map(r=>{const o=n.value===r.value;return e.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 transition-colors ${o?"border-accent bg-accent/5":"border-border hover:border-accent/40"}`,children:[e.jsx("input",{type:"radio",name:"audio-retention",value:r.value,checked:o,onChange:()=>x(r.value),className:"mt-1 accent-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium text-fg",children:r.title}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:r.help})]})]},r.value)})]}),n.supported?null:e.jsx("p",{className:"text-xs text-fg-dim","data-testid":"retention-unsupported",children:"This vault doesn't support changing this yet — recordings are kept. Update the vault to choose."})]})]})]})}function ie(){const[t,a]=d.useState(()=>Z()),n=s=>{a(s),J(s)};return e.jsx("section",{className:"card space-y-4 rounded-xl p-6 shadow-soft",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Live preview"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Formats your writing as you type — Markdown stays underneath. Turn off for the raw editor with a side-by-side preview."})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":"Live preview",onClick:()=>n(!t),className:`relative h-7 w-12 shrink-0 rounded-full transition-colors ${t?"bg-accent":"bg-border"}`,children:e.jsx("span",{className:`absolute top-0.5 h-6 w-6 rounded-full bg-card shadow-sm transition-transform ${t?"translate-x-5":"translate-x-0.5"}`})})]})})}function re(){const[t,a]=d.useState(()=>E()),n=s=>{a(s),G(s),H(s)};return e.jsxs("section",{className:"card space-y-4 rounded-xl p-6 shadow-soft",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Text size"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Affects the editor and rendered notes on this device. Your markdown isn't changed."})]}),e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"sr-only",children:"View text size"}),A.map(s=>{const i=t===s;return e.jsxs("label",{className:`flex items-center gap-3 rounded-xl border p-3 transition-colors ${i?"border-accent bg-accent/5":"border-border hover:border-accent/40"}`,children:[e.jsx("input",{type:"radio",name:"text-size",value:s,checked:i,onChange:()=>n(s),className:"accent-accent"}),e.jsx("span",{className:"font-medium text-fg",children:O(s)})]},s)})]})]})}function le({vaultId:t}){const{db:a,mirror:n}=$(),s=y(m=>m.push),[i,u]=d.useState(null),[c,h]=d.useState(null),x=d.useCallback(async()=>{if(!a)return;const[m,l]=await Promise.all([_(a,t),I(a,t)]);u({bytes:m,count:l})},[a,t]);if(d.useEffect(()=>{x()},[x]),!n.enabled)return null;const r=async()=>{if(!c){h("sync");try{await n.syncNow(),await x(),s("Synced offline copy.","success")}catch{s("Couldn't sync the offline copy right now.","error")}finally{h(null)}}},o=async()=>{if(!c&&confirm("Clear this vault's offline copy from this device? Un-synced changes are kept.")){h("clear");try{await n.clearOffline(),await x(),s("Offline copy cleared.","success")}catch{s("Couldn't clear the offline copy.","error")}finally{h(null)}}};return e.jsxs("section",{className:"card space-y-5 rounded-xl p-6 shadow-soft","aria-label":"Offline",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Offline"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"A copy of this vault is kept on this device so your notes open without a connection."})]}),e.jsxs("dl",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsx("dt",{className:"text-fg-muted",children:"Status"}),e.jsx("dd",{className:"text-fg",children:ce(n.state)})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsx("dt",{className:"text-fg-muted",children:"Last synced"}),e.jsx("dd",{className:"text-fg-muted",children:n.lastSyncedAt?D(new Date(n.lastSyncedAt).toISOString()):"never"})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsx("dt",{className:"text-fg-muted",children:"Saved on this device"}),e.jsx("dd",{className:"text-fg-muted tabular-nums","data-testid":"offline-usage",children:i?`${i.count} note${i.count===1?"":"s"} · ${w(i.bytes)} of ${w(K)}`:"—"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[e.jsx("button",{type:"button",onClick:r,disabled:c!==null,className:"btn btn-secondary btn-touch",children:c==="sync"?"Syncing…":"Sync now"}),e.jsx("button",{type:"button",onClick:o,disabled:c!==null,className:"text-sm text-danger hover:underline disabled:opacity-60",children:c==="clear"?"Clearing…":"Clear offline copy"})]})]})}function ce(t){switch(t){case"hydrating":return"Saving your vault…";case"offline":return"Offline — showing your saved vault";case"error":return"Sync error";default:return"Saved for offline"}}function w(t){return t<1024*1024?`${(t/1024).toFixed(0)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function oe(){const[t,a]=d.useState(!1);return d.useEffect(()=>{a(z())},[]),t?e.jsx("section",{className:"card rounded-xl p-6 text-sm shadow-soft",children:e.jsxs("p",{className:"text-fg-muted",children:[e.jsx("span",{className:"mr-2 inline-block rounded-full bg-positive-soft px-2 py-0.5 text-xs font-medium text-positive",children:"Installed"}),"Parachute is running as an installed app on this device."]})}):null}const S={auto:{title:"Auto",help:"Show the tree only when the vault has enough folders to make it worth the space."},always:{title:"Always",help:"Always show the tree, even on a tag-flat vault."},never:{title:"Never",help:"Hide the tree. The path-prefix text input still works."}};function de({vaultId:t}){const{mode:a,setMode:n}=R(t);return e.jsxs("section",{className:"card space-y-4 rounded-xl p-6 shadow-soft",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Folder tree (Notes sidebar)"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Controls the collapsible folder tree on the notes list page. Auto-detect renders the tree when the vault has at least five top-level folders or twenty notes in folders."})]}),e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"sr-only",children:"Path tree visibility"}),L.map(s=>{const i=a===s;return e.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 transition-colors ${i?"border-accent bg-accent/5":"border-border hover:border-accent/40"}`,children:[e.jsx("input",{type:"radio",name:"path-tree-mode",value:s,checked:i,onChange:()=>n(s),className:"mt-1 accent-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium text-fg",children:S[s].title}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:S[s].help})]})]},s)})]})]})}const v={pinned:{title:"Pinned",help:"Tag for notes you want at the top of views."},archived:{title:"Archived",help:"Tag for notes you've moved out of the way."},captureVoice:{title:"Voice capture",help:"Default tag for new voice memos."},captureText:{title:"Text capture",help:"Default tag for quick typed notes."},view:{title:"Saved view",help:"Tag the saved-view notes carry. Used to list them in the notes sidebar."}};function ue({vaultId:t}){const{roles:a,setRoles:n}=M(t),s=P(),i=y(l=>l.push),u=d.useId(),[c,h]=d.useState(a);d.useEffect(()=>h(a),[a]);const x=d.useMemo(()=>{const l=(s.data??[]).map(f=>f.name);return[...new Set(l)].sort((f,p)=>f.localeCompare(p))},[s.data]),r=N.some(l=>c[l].trim()!==a[l]),o=()=>{n(c),i("Tag roles saved.","success")},m=()=>{n(null),h(g),i("Tag roles reset to defaults.","success")};return e.jsxs("section",{className:"card space-y-5 rounded-xl p-6 shadow-soft",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Tag roles"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Point each role at whatever tag your vault already uses. Changes apply to future notes only — existing notes keep their current tags."})]}),e.jsx("datalist",{id:u,children:x.map(l=>e.jsx("option",{value:l},l))}),e.jsx("div",{className:"space-y-4",children:N.map(l=>e.jsxs("label",{className:"block text-sm",children:[e.jsxs("span",{className:"mb-1.5 flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-fg",children:v[l].title}),e.jsxs("span",{className:"text-xs text-fg-dim",children:["default: #",g[l]]})]}),e.jsx("input",{type:"text",value:c[l],onChange:f=>h(p=>({...p,[l]:f.target.value})),list:u,placeholder:g[l],"aria-label":`${v[l].title} tag role`,spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",className:"input input-on-bg"}),e.jsx("span",{className:"mt-1.5 block text-xs text-fg-dim",children:v[l].help})]},l))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 pt-1",children:[e.jsx("button",{type:"button",onClick:o,disabled:!r,className:"btn btn-primary btn-lg",children:"Save"}),e.jsx("button",{type:"button",onClick:m,className:"btn btn-ghost",children:"Reset to defaults"})]})]})}export{pe as Settings};
|