var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function te(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ne(e,t){return te(e.type,t,e.props)}function T(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function re(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ie=/\/+/g;function ae(e,t){return typeof e==`object`&&e&&e.key!=null?re(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function se(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,se(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ae(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ie,`$&/`)+`/`),se(o,r,i,``,function(e){return e})):o!=null&&(T(o)&&(o=ne(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ie,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,T());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function te(){return g?!0:!(e.unstable_now()-eet&&te());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?T():S=!1}}}var T;if(typeof y==`function`)T=function(){y(ne)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=ne,T=function(){ie.postMessage(null)}}else T=function(){_(ne,0)};function ae(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,T()))),r},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1de||(e.current=ue[de],ue[de]=null,de--)}function A(e,t){de++,ue[de]=e.current,e.current=t}var pe=fe(null),me=fe(null),he=fe(null),ge=fe(null);function _e(e,t){switch(A(he,t),A(me,e),A(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}k(pe),A(pe,e)}function ve(){k(pe),k(me),k(he)}function ye(e){e.memoizedState!==null&&A(ge,e);var t=pe.current,n=Hd(t,e.type);t!==n&&(A(me,e),A(pe,n))}function be(e){me.current===e&&(k(pe),k(me)),ge.current===e&&(k(ge),Qf._currentValue=O)}var xe,Se;function Ce(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1)`:-1i||c[r]!==l[i]){var u=` `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{we=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ce(n):``}function Ee(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce(`Lazy`);case 13:return e.child!==t&&t!==null?Ce(`Suspense Fallback`):Ce(`Suspense`);case 19:return Ce(`SuspenseList`);case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return Ce(`Activity`);default:return``}}function De(e){try{var t=``,n=null;do t+=Ee(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,je=t.unstable_shouldYield,Me=t.unstable_requestPaint,Ne=t.unstable_now,Pe=t.unstable_getCurrentPriorityLevel,Fe=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,Re=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Be=t.log,Ve=t.unstable_setDisableYieldValue,He=null,Ue=null;function We(e){if(typeof Be==`function`&&Ve(e),Ue&&typeof Ue.setStrictMode==`function`)try{Ue.setStrictMode(He,e)}catch{}}var Ge=Math.clz32?Math.clz32:Je,Ke=Math.log,qe=Math.LN2;function Je(e){return e>>>=0,e===0?32:31-(Ke(e)/qe|0)|0}var Ye=256,Xe=262144,Ze=4194304;function Qe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function $e(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Qe(n))):i=Qe(o):i=Qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Qe(n))):i=Qe(o)):i=Qe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function et(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nt(){var e=Ze;return Ze<<=1,!(Ze&62914560)&&(Ze=4194304),e}function rt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function it(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function at(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),_n=!1;if(gn)try{var vn={};Object.defineProperty(vn,"passive",{get:function(){_n=!0}}),window.addEventListener(`test`,vn,vn),window.removeEventListener(`test`,vn,vn)}catch{_n=!1}var yn=null,bn=null,xn=null;function Sn(){if(xn)return xn;var e,t=bn,n=t.length,r,i=`value`in yn?yn.value:yn.textContent,a=i.length;for(e=0;e=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Sn(),xn=bn=yn=null,sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=jr(n)}}function Nr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ut(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ut(e.document)}return t}function Fr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Ir=gn&&`documentMode`in document&&11>=document.documentMode,Lr=null,Rr=null,zr=null,Br=!1;function Vr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Br||Lr==null||Lr!==Ut(r)||(r=Lr,`selectionStart`in r&&Fr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),zr&&Ar(zr,r)||(zr=r,r=Ed(Rr,`onSelect`),0>=o,i-=o,Ni=1<<32-Ge(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),N&&Fi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),N&&Fi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return N&&Fi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),N&&Fi(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&Na(l)===r.type){n(e,r.sibling),c=i(r,a.props),Ba(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===y?(c=bi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=yi(a.type,a.key,a.props,null,e.mode,c),Ba(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=Ci(a,e.mode,c),c.return=e,e=c}return o(e);case T:return a=Na(a),b(e,r,a,c)}if(le(a))return h(e,r,a,c);if(oe(a)){if(l=oe(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,za(a),c);if(a.$$typeof===C)return b(e,r,ca(e,a),c);Va(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=xi(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Ra=0;var i=b(e,t,n,r);return La=null,i}catch(t){if(t===Da||t===ka)throw t;var a=hi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ua=Ha(!0),Wa=Ha(!1),Ga=!1;function Ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=fi(e),di(e,null,n),t}return ci(e,r,t,n),fi(e)}function Xa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,st(e,n)}}function Za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Qa=!1;function $a(){if(Qa){var e=va;if(e!==null)throw e}}function eo(e,t,n,r){Qa=!1;var i=e.updateQueue;Ga=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(J&f)===f:(r&f)===f){f!==0&&f===_a&&(Qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ga=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function to(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function no(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=E.T,s={};E.T=s,Is(e,!1,t,n);try{var c=i(),l=E.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,xa(c,r),pu(e)):Fs(e,t,r,pu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{D.p=a,o!==null&&s.types!==null&&(o.types=s.types),E.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ds(e).queue;ws(e,i,t,O,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:O},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},pu())}function ks(){return sa(Qf)}function As(){return B().memoizedState}function js(){return B().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ja(n);var r=Ya(t,e,n);r!==null&&(hu(r,t,n),Xa(r,t,n)),t={cache:pa()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=li(e,t,n,r),n!==null&&(hu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,pu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,kr(s,o))return ci(e,t,i,0),K===null&&si(),!1}catch{}if(n=li(e,t,i,r),n!==null)return hu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(s(479))}else t=li(e,n,r,2),t!==null&&hu(t,e,2)}function Ls(e){var t=e.alternate;return e===I||t!==null&&t===I}function Rs(e,t){yo=vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,st(e,n)}}var Bs={readContext:sa,use:Io,useCallback:z,useContext:z,useEffect:z,useImperativeHandle:z,useLayoutEffect:z,useInsertionEffect:z,useMemo:z,useReducer:z,useRef:z,useState:z,useDebugValue:z,useDeferredValue:z,useTransition:z,useSyncExternalStore:z,useId:z,useHostTransitionStatus:z,useFormState:z,useActionState:z,useOptimistic:z,useMemoCache:z,useCacheRefresh:z};Bs.useEffectEvent=z;var Vs={readContext:sa,use:Io,useCallback:function(e,t){return No().memoizedState=[e,t===void 0?null:t],e},useContext:sa,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,_s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=No();t=t===void 0?null:t;var r=e();if(bo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=No();if(n!==void 0){var i=n(t);if(bo){We(!0);try{n(t)}finally{We(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ns.bind(null,I,e),[r.memoizedState,e]},useRef:function(e){var t=No();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=Ps.bind(null,I,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ys,useDeferredValue:function(e,t){return Ss(No(),e,t)},useTransition:function(){var e=qo(!1);return e=ws.bind(null,I,e.queue,!0,!1),No().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=I,i=No();if(N){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),K===null)throw Error(s(349));J&127||Ho(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ds(Wo.bind(null,r,a,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,a,n,t),null),n},useId:function(){var e=No(),t=K.identifierPrefix;if(N){var n=Pi,r=Ni;n=(r&~(1<<32-Ge(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[mt]=t,a[ht]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return U(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=he.current,qi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Bi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[mt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Wi(t,!0)}else e=Bd(e).createTextNode(r),e[mt]=t,t.stateNode=e}return U(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=qi(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[mt]=t}else Ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),e=!1}else n=Yi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ho(t),t):(ho(t),null);if(t.flags&128)throw Error(s(558))}return U(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=qi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[mt]=t}else Ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),i=!1}else i=Yi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ho(t),t):(ho(t),null)}return ho(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),U(t),null);case 4:return ve(),e===null&&Sd(t.stateNode.containerInfo),U(t),null;case 10:return ta(t.type),U(t),null;case 19:if(k(F),r=t.memoizedState,r===null)return U(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)Rc(r,!1);else{if(X!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=go(e),a!==null){for(t.flags|=128,Rc(r,!1),e=a.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)vi(n,e),n=n.sibling;return A(F,F.current&1|2),N&&Fi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ne()>tu&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}else{if(!i)if(e=go(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!N)return U(t),null}else 2*Ne()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(U(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ne(),e.sibling=null,n=F.current,A(F,i?n&1|2:n&1),N&&Fi(t,r.treeForkCount),e);case 22:case 23:return ho(t),so(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&k(Ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ta(P),U(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Bc(e,t){switch(Ri(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ta(P),ve(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return be(t),null;case 31:if(t.memoizedState!==null){if(ho(t),t.alternate===null)throw Error(s(340));Ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ho(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return k(F),null;case 4:return ve(),null;case 10:return ta(t.type),null;case 22:case 23:return ho(t),so(),e!==null&&k(Ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ta(P),null;case 25:return null;default:return null}}function Vc(e,t){switch(Ri(t),t.tag){case 3:ta(P),ve();break;case 26:case 27:case 5:be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&ho(t);break;case 13:ho(t);break;case 19:k(F);break;case 10:ta(t.type);break;case 22:case 23:ho(t),so(),e!==null&&k(Ca);break;case 24:ta(P)}}function Hc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Uc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{no(t,n)}catch(t){Z(e,e.return,t)}}}function Gc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Kc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}function Jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ht]=t}catch(t){Z(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[mt]=e,t[ht]=n}catch(t){Z(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Rd=sp,e=Pr(e),Fr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(a,r,n),a[mt]=e,j(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;cg&&(o=g,g=h,h=o);var _=Mr(s,h),v=Mr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,E.T=null,n=lu,lu=null;var a=au,o=su;if(iu=0,ou=au=null,su=0,G&6)throw Error(s(331));var c=G;if(G|=4,Fl(a.current),Dl(a,a.current,o,n),G=c,id(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot==`function`)try{Ue.onPostCommitFiberRoot(He,a)}catch{}return!0}finally{D.p=i,E.T=r,Vu(e,t)}}function Wu(e,t,n){t=Ti(n,t),t=ec(e.stateNode,t,2),e=Ya(e,t,2),e!==null&&(it(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=Ti(n,e),n=tc(2),r=Ya(t,n,2),r!==null&&(nc(n,r,t,e),it(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,K===e&&(J&n)===n&&(X===4||X===3&&(J&62914560)===J&&300>Ne()-$l?!(G&2)&&Su(e,0):ql|=n,Yl===J&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=nt()),e=ui(e,t),e!==null&&(it(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return ke(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ge(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=J,a=$e(r,r===K?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||et(r,a)||(n=!0,ld(r,a));r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=Ne(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Gt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),j(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),j(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Gt(r)+`"][href="`+Gt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),j(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=Et(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);j(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=Et(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),j(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=Et(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),j(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=he.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=Et(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=Et(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=Et(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Gt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),j(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Gt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,j(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),j(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,j(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),j(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,j(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),j(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,j(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),j(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c();async function d(e,t,n=!1){return fetch(e,{method:`POST`,headers:n?{"Content-Type":`application/json`}:void 0,body:t})}async function f(e=20){return(await fetch(`/captures?limit=${e}`)).json()}async function p(e,t=50){return(await fetch(`/captures?intent=${encodeURIComponent(e)}&limit=${t}`)).json()}async function m(e){return(await fetch(`/captures/${e}/related`)).json()}async function h(e,t=``){let n=new FormData;return n.append(`content`,e),t.trim()&&n.append(`your_take`,t.trim()),(await d(`/capture/text`,n)).json()}async function g(e,t=``){let n=new FormData;return n.append(`url`,e),t.trim()&&n.append(`your_take`,t.trim()),(await d(`/capture/link`,n)).json()}async function _(e,t=``,n=``){let r=new FormData;return r.append(`file`,e),t.trim()&&r.append(`description`,t.trim()),n.trim()&&r.append(`your_take`,n.trim()),(await d(`/capture/image`,r)).json()}async function v(e,t=3,n){let r=new URLSearchParams({n:String(t)});return e&&e!==`all`&&r.set(`mode`,e),n&&r.set(`mood`,n),(await fetch(`/surface?${r}`)).json()}async function y(e){await fetch(`/surface/${e}/done`,{method:`POST`})}async function b(e){await fetch(`/surface/${e}/skip`,{method:`POST`})}async function x(e){return(await fetch(`/captures/${e}`,{method:`DELETE`})).ok}async function S(e){await d(`/events`,JSON.stringify(e),!0).catch(()=>{})}async function C(e,t){await fetch(`/captures/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}async function w(e=10){return(await fetch(`/review?limit=${e}`)).json()}async function ee(e,t){await fetch(`/captures/${e}/review`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({rating:t})})}async function te(){return(await fetch(`/review/history`)).json()}async function ne(e,t=20){return(await fetch(`/search?q=${encodeURIComponent(e)}&limit=${t}`)).json()}async function T(e){let t=e?`/brief?date=${encodeURIComponent(e)}`:`/brief`;return(await fetch(t)).json()}async function re(){return(await fetch(`/brief/dates`)).json()}async function ie(e,t){let n=await fetch(`/ask/synthesize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e,capture_ids:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.text();if(!r.trim())throw Error(`Empty response from server`);return JSON.parse(r)}async function ae(e,t){let n=await fetch(`/ask/feynman`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e,capture_ids:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}async function oe(e,t){let n=await fetch(`/ask/feynman/grade`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({qa_pairs:e,capture_ids:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}async function se(e,t){let n=await fetch(`/ask/arc`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e,capture_ids:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}async function ce(e){let t=await fetch(`/brief/week/synthesize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({daily_entries:e})});if(!t.ok)throw Error(`HTTP ${t.status}`);return t.json()}async function le(e,t){let n=await fetch(`/brief/synthesize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({capture_ids:e,date_label:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}async function E(e,t){let n=await fetch(`/ask/extend`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e,synthesis:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.text();if(!r.trim())throw Error(`Empty response`);return JSON.parse(r)}var D=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),O=e(((e,t)=>{t.exports=D()}))(),ue=[{id:`note`,label:`NOTE`},{id:`link`,label:`LINK`},{id:`image`,label:`IMAGE`}];function de({onCapture:e}){let[t,n]=(0,l.useState)(`note`),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(``),[m,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(!1),C=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!s){v(null);return}let e=URL.createObjectURL(s);return v(e),()=>URL.revokeObjectURL(e)},[s]);let w=(0,l.useCallback)(async()=>{if(!x){S(!0);try{let n=null;if(t===`note`&&r.trim())n=await h(r.trim(),f),i(``),p(``);else if(t===`link`&&a.trim())n=await g(a.trim(),f),o(``),p(``);else if(t===`image`&&s)n=await _(s,u,f),c(null),d(``),p(``),C.current&&(C.current.value=``);else return;n&&e(n.id)}finally{S(!1)}}},[t,r,a,s,u,x,e]);function ee(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),w())}function te(e){e.type.startsWith(`image/`)&&c(e)}function ne(e){e.preventDefault(),b(!1),e.dataTransfer.files[0]&&te(e.dataTransfer.files[0])}return(0,O.jsxs)(`section`,{className:`border-2 border-[var(--line)] overflow-hidden`,style:{background:`var(--card)`,boxShadow:`var(--shadow)`},children:[(0,O.jsx)(`div`,{className:`flex border-b-2 border-[var(--line)]`,children:ue.map(e=>(0,O.jsx)(`button`,{onClick:()=>n(e.id),className:`font-mono flex-1 py-3 border-r-2 border-[var(--line)] last:border-r-0 text-[12px] font-bold tracking-[0.12em] transition-colors`,style:{background:t===e.id?`var(--ink)`:`var(--card)`,color:t===e.id?`var(--paper)`:`var(--ink)`},children:e.label},e.id))}),t===`note`&&(0,O.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),onKeyDown:ee,placeholder:`What's on your mind?`,rows:5,className:`w-full resize-none border-none outline-none px-5 py-4 text-[17px] leading-relaxed block`,style:{background:`var(--card)`,color:`var(--ink)`}}),t===`link`&&(0,O.jsx)(`input`,{type:`url`,value:a,onChange:e=>o(e.target.value),onKeyDown:ee,placeholder:`Paste a URL to capture…`,className:`w-full border-none outline-none px-5 py-4 text-[17px] font-mono block`,style:{background:`var(--card)`,color:`var(--ink)`,minHeight:120}}),t===`image`&&(0,O.jsxs)(`div`,{children:[s?(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`14px 16px`,borderBottom:`2px solid var(--line)`,background:`var(--paper)`,alignItems:`flex-start`},children:[(0,O.jsxs)(`div`,{style:{width:80,height:64,flexShrink:0,border:`2px solid var(--line)`,overflow:`hidden`,cursor:`pointer`,position:`relative`},onClick:()=>C.current?.click(),title:`Click to change image`,children:[m&&(0,O.jsx)(`img`,{src:m,alt:`preview`,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}),(0,O.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`rgba(24,20,16,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:0,transition:`opacity .15s`},onMouseEnter:e=>e.currentTarget.style.opacity=`1`,onMouseLeave:e=>e.currentTarget.style.opacity=`0`,children:(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9,fontWeight:700,color:`white`,letterSpacing:`0.1em`},children:`CHANGE`})})]}),(0,O.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,O.jsxs)(`p`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,color:`var(--ink)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginBottom:4},children:[`✓ `,s.name]}),(0,O.jsx)(`button`,{onClick:()=>{c(null),d(``),C.current&&(C.current.value=``)},className:`font-mono`,style:{fontSize:10,fontWeight:700,color:`var(--ink-soft)`,textDecoration:`underline`,background:`none`,border:`none`,cursor:`pointer`,padding:0},children:`remove`})]})]}),(0,O.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),onKeyDown:ee,placeholder:`Why are you saving this?`,rows:3,className:`w-full resize-none border-none outline-none px-5 py-4 text-[16px] leading-relaxed block`,style:{background:`var(--card)`,color:`var(--ink)`}})]}):(0,O.jsx)(`div`,{onDragOver:e=>{e.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:ne,onClick:()=>C.current?.click(),className:`flex flex-col items-center justify-center cursor-pointer transition-all`,style:{minHeight:120,margin:16,border:`2px dashed ${y?`var(--ink)`:`#bbb`}`,background:y?`var(--paper)`:`transparent`,color:y?`var(--ink)`:`#aaa`},children:(0,O.jsx)(`p`,{className:`font-mono text-[11px] font-bold uppercase tracking-widest`,children:`↓ drop image or click to choose`})}),(0,O.jsx)(`input`,{ref:C,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>e.target.files?.[0]&&te(e.target.files[0])})]}),t!==`image`&&(0,O.jsx)(`div`,{style:{borderTop:`2px solid var(--line)`,background:`var(--paper)`,padding:`10px 16px`},children:(0,O.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),onKeyDown:ee,placeholder:`Why are you saving this?`,rows:2,className:`w-full resize-none border-none outline-none text-[13px] leading-relaxed font-mono`,style:{background:`transparent`,color:`var(--ink)`,opacity:f?1:.6}})}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-t-2 border-[var(--line)]`,style:{background:`var(--paper)`},children:[(0,O.jsx)(`span`,{className:`font-mono text-[11px]`,style:{color:`var(--ink-soft)`,letterSpacing:`0.04em`},children:`CMD + ↵ to capture`}),(0,O.jsx)(`button`,{onClick:w,disabled:x,className:`font-bold text-[14px] uppercase tracking-[0.04em] px-5 py-2.5 border-2 border-[var(--line)] transition-all duration-100 disabled:opacity-30`,style:{background:`var(--learn)`,color:`var(--ink)`,boxShadow:`var(--shadow-sm)`},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`var(--shadow)`,e.currentTarget.style.transform=`translate(-1px,-1px)`},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`var(--shadow-sm)`,e.currentTarget.style.transform=``},onMouseDown:e=>{e.currentTarget.style.boxShadow=`none`,e.currentTarget.style.transform=`translate(3px,3px)`},onMouseUp:e=>{e.currentTarget.style.boxShadow=`var(--shadow)`,e.currentTarget.style.transform=`translate(-1px,-1px)`},children:x?`…`:`Capture ↵`})]})]})}var fe={learn:`var(--learn)`,act:`var(--act)`,reference:`var(--ref)`,ephemeral:`var(--eph)`};function k({item:e,onPick:t}){let n=(e.related??[]).slice(0,3);if(n.length===0)return null;let r=(e.related_ids?.length??e.related?.length??0)-n.length,i=n.length,a=e=>{if(i===1)return 0;let t=Math.min(70,35*(i-1));return(-t/2+t/(i-1)*e)*(Math.PI/180)},o=n.map((e,t)=>{let n=a(t),r=e.summary??e.tags?.[0]??e.intent??`?`,i=r.length>18?r.slice(0,17)+`…`:r;return{r:e,x:56+100*Math.cos(n),y:88+100*Math.sin(n),label:i}}),s=(e.intent?fe[e.intent]:null)??`#eee`;return(0,O.jsxs)(`svg`,{viewBox:`0 0 380 190`,width:`100%`,style:{display:`block`,overflow:`hidden`},children:[o.map((e,t)=>(0,O.jsx)(`line`,{x1:56,y1:88,x2:e.x,y2:e.y,stroke:`var(--ink)`,strokeWidth:`2`,strokeDasharray:`4 3`,opacity:.4},`l`+t)),o.map((e,n)=>{let r=(e.r.intent?fe[e.r.intent]:null)??`#eee`;return(0,O.jsxs)(`g`,{style:{cursor:t?`pointer`:`default`},onClick:()=>t?.(e.r),children:[(0,O.jsx)(`title`,{children:e.r.summary??e.r.tags?.join(`, `)??``}),(0,O.jsx)(`circle`,{cx:e.x,cy:e.y,r:15,fill:r,stroke:`var(--ink)`,strokeWidth:`2.5`}),(0,O.jsx)(`text`,{x:e.x,y:e.y+27,textAnchor:`middle`,fontFamily:`JetBrains Mono, monospace`,fontSize:`9`,fontWeight:`700`,fill:`var(--ink-soft)`,children:e.label})]},`n`+n)}),(0,O.jsx)(`circle`,{cx:56,cy:88,r:22,fill:s,stroke:`var(--ink)`,strokeWidth:`3`}),(0,O.jsx)(`circle`,{cx:56,cy:88,r:7,fill:`var(--ink)`}),r>0&&(0,O.jsxs)(`text`,{x:56,y:125,textAnchor:`middle`,fontFamily:`JetBrains Mono, monospace`,fontSize:`9`,fontWeight:`700`,fill:`var(--ink-soft)`,children:[`· `,r,` more`]})]})}var A=o();function pe({src:e,alt:t,thumbHeight:n=160}){let[r,i]=(0,l.useState)(!1);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{onClick:()=>i(!0),style:{cursor:`zoom-in`,position:`relative`,border:`var(--bw) solid var(--line)`,background:`var(--paper)`,overflow:`hidden`,marginBottom:10},children:[(0,O.jsx)(`img`,{src:e,alt:t,style:{display:`block`,width:`100%`,height:n,objectFit:`contain`}}),(0,O.jsx)(`span`,{style:{position:`absolute`,bottom:5,right:6,fontSize:10,fontWeight:700,fontFamily:`monospace`,letterSpacing:`0.06em`,background:`var(--ink)`,color:`var(--paper)`,padding:`2px 6px`,opacity:.75},children:`⊕ expand`})]}),r&&(0,A.createPortal)((0,O.jsxs)(`div`,{onClick:()=>i(!1),style:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,0.88)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`zoom-out`},children:[(0,O.jsx)(`img`,{src:e,alt:t,style:{maxWidth:`92vw`,maxHeight:`92vh`,objectFit:`contain`},onClick:e=>e.stopPropagation()}),(0,O.jsx)(`button`,{onClick:()=>i(!1),style:{position:`fixed`,top:18,right:22,background:`transparent`,border:`none`,color:`#fff`,fontSize:28,cursor:`pointer`,lineHeight:1,opacity:.8},children:`✕`})]}),document.body)]})}var me={learn:`var(--learn)`,act:`var(--act)`,reference:`var(--ref)`,ephemeral:`var(--eph)`},he={learn:`LEARN`,act:`ACT`,reference:`REFERENCE`,ephemeral:`EPHEMERAL`},ge={text:`TEXT`,link:`LINK`,image:`IMAGE`};function _e({label:e,bg:t}){return(0,O.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase leading-none whitespace-nowrap inline-flex items-center border-2 border-[var(--line)]`,style:{background:t,letterSpacing:`0.08em`,padding:`3px 8px`,boxShadow:`2px 2px 0 var(--line)`},children:e})}function ve({capture:e,variant:t,onAction:n,onPick:r,onDelete:i}){let a=(0,l.useRef)(Date.now()),[o,s]=(0,l.useState)(!1),c=!e.summary;(0,l.useEffect)(()=>{a.current=Date.now()},[e.id]);let u=()=>Math.round((Date.now()-a.current)/1e3);async function d(){await S({capture_id:e.id,event:`dwell`,value:String(u())}),s(!0),setTimeout(async()=>{await y(e.id),n?.()},600)}async function f(){await S({capture_id:e.id,event:`dwell`,value:String(u())}),await b(e.id),n?.()}async function p(t){t.stopPropagation(),await x(e.id)&&i?.(e.id)}let m=(e.intent?me[e.intent]:null)??`#eee`;return(0,O.jsxs)(`div`,{className:`relative overflow-hidden`,style:{display:`flex`,border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow-sm)`,transition:`transform .08s, box-shadow .08s`,cursor:t===`feed`&&r&&!c?`pointer`:`default`},onClick:t===`feed`&&r&&!c?()=>r(e):void 0,onMouseEnter:e=>{e.currentTarget.style.boxShadow=`var(--shadow)`,e.currentTarget.style.transform=`translate(-2px,-2px)`},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`var(--shadow-sm)`,e.currentTarget.style.transform=``},children:[(0,O.jsx)(`div`,{style:{width:12,background:m,borderRight:`var(--bw) solid var(--line)`,flexShrink:0}}),(0,O.jsxs)(`div`,{style:{padding:t===`feed`?`13px 15px`:`18px 18px 14px`,flex:1,minWidth:0},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:9},children:[(0,O.jsx)(_e,{label:ge[e.type]??e.type,bg:`var(--paper)`}),e.intent&&(0,O.jsx)(_e,{label:he[e.intent]??e.intent,bg:m}),t===`feed`&&(0,O.jsx)(`span`,{className:`font-mono`,style:{marginLeft:`auto`,fontSize:11,color:`var(--ink-soft)`},children:e.created_at?.slice(0,16).replace(`T`,` `)})]}),e.title&&(0,O.jsx)(`p`,{className:`font-bold`,style:{margin:`0 0 8px`,fontSize:t===`surface`?18:15,lineHeight:1.25,letterSpacing:`-0.01em`,color:`var(--ink)`},children:e.title}),e.type===`image`&&e.file_path&&(0,O.jsx)(pe,{src:`/uploads/${e.file_path.split(`/`).pop()}`,alt:e.summary??`image capture`,thumbHeight:t===`surface`?200:140}),e.your_take&&(0,O.jsxs)(`div`,{style:{margin:`0 0 10px`,padding:`8px 12px`,borderLeft:`3px solid var(--learn)`,background:`var(--paper)`},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:9,fontWeight:700,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--learn)`,marginBottom:4},children:`Your take`}),(0,O.jsxs)(`p`,{style:{margin:0,fontSize:14,lineHeight:1.45,fontWeight:500,fontStyle:`italic`,color:`var(--ink)`},children:[`"`,e.your_take,`"`]})]}),e.summary?.startsWith(`⚠`)&&t===`feed`&&i&&(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,marginBottom:8},children:[(0,O.jsx)(`p`,{className:`font-mono`,style:{margin:0,fontSize:12,fontWeight:700,color:`var(--act)`},children:e.summary}),(0,O.jsx)(`button`,{onClick:p,className:`font-mono`,style:{flexShrink:0,fontSize:11,fontWeight:700,padding:`4px 10px`,border:`2px solid var(--act)`,background:`var(--paper)`,color:`var(--act)`,cursor:`pointer`,letterSpacing:`0.06em`},children:`Delete`})]}),e.summary&&!e.summary.startsWith(`⚠`)?Array.isArray(e.claims)&&e.claims.length>1?(0,O.jsx)(`ul`,{style:{margin:0,padding:0,listStyle:`none`,display:`flex`,flexDirection:`column`,gap:6},children:e.claims.map((e,n)=>(0,O.jsxs)(`li`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,O.jsx)(`span`,{style:{flexShrink:0,marginTop:5,width:5,height:5,borderRadius:`50%`,background:`var(--ink)`,opacity:.4}}),(0,O.jsx)(`span`,{style:{fontSize:t===`surface`?16:14,lineHeight:1.45,fontWeight:500},children:e})]},n))}):(0,O.jsx)(`p`,{style:{margin:0,fontSize:t===`surface`?19:16,lineHeight:1.4,fontWeight:500},children:e.summary}):(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:8},children:[(0,O.jsxs)(`div`,{style:{minWidth:0},children:[(0,O.jsx)(`p`,{className:`font-mono`,style:{margin:`0 0 4px`,fontSize:11,fontWeight:700,letterSpacing:`0.1em`,color:`var(--ink-soft)`,textTransform:`uppercase`,animation:`pulse-opacity 1.6s ease-in-out infinite`},children:`◌ Processing…`}),(e.raw||e.source_url)&&(0,O.jsx)(`p`,{style:{margin:0,fontSize:13,color:`var(--ink-soft)`,lineHeight:1.4,overflow:`hidden`,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},children:(e.raw||e.source_url).slice(0,120)})]}),t===`feed`&&i&&(0,O.jsx)(`button`,{onClick:p,title:`Dismiss`,className:`font-mono`,style:{flexShrink:0,fontSize:14,lineHeight:1,padding:`2px 6px`,border:`2px solid var(--line)`,background:`var(--paper)`,color:`var(--ink-soft)`,cursor:`pointer`},children:`×`})]}),e.source_url&&(()=>{let t=``;try{t=new URL(e.source_url).hostname}catch{}return(0,O.jsxs)(`a`,{href:e.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono`,style:{display:`flex`,alignItems:`center`,gap:5,marginTop:8,fontSize:11.5,fontWeight:700,color:`var(--ref)`,overflow:`hidden`,textDecoration:`none`},children:[t&&(0,O.jsx)(`img`,{src:`https://www.google.com/s2/favicons?domain=${t}&sz=16`,width:13,height:13,style:{flexShrink:0,border:`1px solid var(--line)`},alt:``}),(0,O.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`↗ `,e.source_url]})]})})(),e.tags?.length>0&&(0,O.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:5,marginTop:11},children:e.tags.map(e=>(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:11.5,padding:`2px 7px`,border:`2px solid var(--line)`,background:`var(--paper)`,borderRadius:999,color:`var(--ink)`,whiteSpace:`nowrap`},children:e},e))}),e.source_content_path&&(0,O.jsx)(`a`,{href:`/uploads/content/${e.id}.txt`,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono`,style:{display:`inline-block`,marginTop:8,fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,color:`var(--ink-soft)`,textDecoration:`none`,opacity:.6},children:`↗ view source`}),t===`surface`&&e.related&&e.related.length>0&&(0,O.jsxs)(`div`,{style:{borderTop:`var(--bw) solid var(--line)`,marginTop:14,background:`var(--paper)`,margin:`14px -15px -14px`},children:[(0,O.jsxs)(`p`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,padding:`10px 16px 0`},children:[`◇ Connected · `,e.related_ids?.length??e.related.length]}),(0,O.jsx)(k,{item:e,onPick:r})]}),t===`surface`&&(0,O.jsxs)(`div`,{style:{display:`flex`,gap:10,marginTop:14},children:[(0,O.jsx)(`button`,{onClick:d,className:`font-bold`,style:{flex:1,fontSize:14,letterSpacing:`0.04em`,textTransform:`uppercase`,padding:`11px 0`,border:`var(--bw) solid var(--line)`,background:`var(--done)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`,transition:`transform .06s, box-shadow .06s`},onMouseEnter:e=>{e.currentTarget.style.transform=`translate(-1px,-1px)`,e.currentTarget.style.boxShadow=`var(--shadow)`},onMouseLeave:e=>{e.currentTarget.style.transform=``,e.currentTarget.style.boxShadow=`var(--shadow-sm)`},onMouseDown:e=>{e.currentTarget.style.transform=`translate(3px,3px)`,e.currentTarget.style.boxShadow=`none`},onMouseUp:e=>{e.currentTarget.style.transform=`translate(-1px,-1px)`,e.currentTarget.style.boxShadow=`var(--shadow)`},children:`✓ Done`}),(0,O.jsx)(`button`,{onClick:f,className:`font-bold`,style:{flex:1,fontSize:14,letterSpacing:`0.04em`,textTransform:`uppercase`,padding:`11px 0`,border:`var(--bw) solid var(--line)`,background:`var(--card)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`,transition:`transform .06s, box-shadow .06s`},onMouseEnter:e=>{e.currentTarget.style.transform=`translate(-1px,-1px)`,e.currentTarget.style.boxShadow=`var(--shadow)`},onMouseLeave:e=>{e.currentTarget.style.transform=``,e.currentTarget.style.boxShadow=`var(--shadow-sm)`},onMouseDown:e=>{e.currentTarget.style.transform=`translate(3px,3px)`,e.currentTarget.style.boxShadow=`none`},onMouseUp:e=>{e.currentTarget.style.transform=`translate(-1px,-1px)`,e.currentTarget.style.boxShadow=`var(--shadow)`},children:`Skip →`})]})]}),o&&(0,O.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`grid`,placeItems:`center`,pointerEvents:`none`,background:`rgba(255,253,246,.7)`},children:(0,O.jsx)(`div`,{className:`font-bold`,style:{fontSize:64,color:`var(--done)`,border:`6px solid var(--done)`,padding:`6px 22px`,letterSpacing:`0.04em`,background:`rgba(255,253,246,.7)`,animation:`stamp .5s cubic-bezier(.2,1.4,.4,1) both`},children:`DONE`})})]})}function ye({onPick:e,mood:t}){let[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(`all`),c=(0,l.useRef)(!1);async function u(e){a(!0),s(e);try{r(await v(e===`all`?void 0:e,3,t||void 0))}finally{a(!1)}}(0,l.useEffect)(()=>{u(`all`)},[]),(0,l.useEffect)(()=>{if(!c.current){c.current=!0;return}u(o)},[t]);function d(){r(e=>e.slice(1))}let f=n[0]??null,p=n.length;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:14},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.18em`,textTransform:`uppercase`,color:`var(--ink-soft)`},children:`Today's Focus`}),(0,O.jsx)(`div`,{style:{display:`flex`,gap:6},children:[`learn`,`act`,`all`].map(e=>(0,O.jsx)(`button`,{onClick:()=>u(e),disabled:i,className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`4px 10px`,border:`2px solid var(--line)`,background:o===e?`var(--ink)`:`var(--card)`,color:o===e?`var(--paper)`:`var(--ink)`,cursor:i?`not-allowed`:`pointer`,opacity:i?.5:1,boxShadow:o===e?`none`:`2px 2px 0 var(--line)`},children:i&&o===e?`…`:e.toUpperCase()},e))})]}),i&&!f&&(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,padding:`20px 18px`,opacity:.4},children:[(0,O.jsx)(`div`,{style:{height:12,background:`var(--line)`,borderRadius:2,width:`60%`,marginBottom:10}}),(0,O.jsx)(`div`,{style:{height:10,background:`var(--line)`,borderRadius:2,width:`85%`,marginBottom:8}}),(0,O.jsx)(`div`,{style:{height:10,background:`var(--line)`,borderRadius:2,width:`40%`}})]}),f&&(0,O.jsxs)(`div`,{style:{animation:`pop-in .15s ease both`},children:[p>1&&(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.1em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:8},children:[p,` queued · `,(0,O.jsx)(`span`,{style:{cursor:`pointer`,textDecoration:`underline`},onClick:()=>u(o),children:`shuffle`})]}),(0,O.jsx)(ve,{capture:f,variant:`surface`,onAction:d,onPick:e},f.id)]}),!i&&n.length===0&&(0,O.jsxs)(`div`,{style:{border:`2px dashed var(--line)`,padding:`28px 0`,textAlign:`center`},children:[(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--ink-soft)`,margin:0},children:`All clear ✦`}),(0,O.jsx)(`button`,{onClick:()=>u(o),className:`font-mono`,style:{marginTop:10,fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`5px 12px`,border:`2px solid var(--line)`,background:`var(--card)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`2px 2px 0 var(--line)`},children:`↺ Resurface`})]})]})}function be({refreshTrigger:e,onCountChange:t,onPick:n,limit:r=20,compact:i=!1,onBrowseAll:a}){let[o,s]=(0,l.useState)([]),[c,u]=(0,l.useState)(!1),d=(0,l.useRef)(null),p=(0,l.useCallback)(async()=>{u(!0);try{let e=await f(i?50:r);return t?.(e.length),s(i?e.slice(0,r):e),e}finally{u(!1)}},[t,r,i]),m=(0,l.useCallback)(()=>{d.current||=setInterval(async()=>{let e=await f(i?50:r);t?.(e.length),s(i?e.slice(0,r):e),e.some(e=>!e.summary)||(clearInterval(d.current),d.current=null)},3e3)},[t,r,i]);return(0,l.useEffect)(()=>(p().then(e=>{e?.some(e=>!e.summary)&&m()}),()=>{d.current&&=(clearInterval(d.current),null)}),[e]),(0,l.useEffect)(()=>{o.some(e=>!e.summary)&&m()},[o]),i?(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:14},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.18em`,textTransform:`uppercase`,color:`var(--ink-soft)`},children:`Just Added`}),(0,O.jsx)(`div`,{style:{display:`flex`,gap:10,alignItems:`center`},children:(0,O.jsx)(`button`,{onClick:p,disabled:c,className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`4px 10px`,border:`2px solid var(--line)`,background:`var(--card)`,color:`var(--ink)`,cursor:c?`not-allowed`:`pointer`,boxShadow:`2px 2px 0 var(--line)`,opacity:c?.5:1},children:c?`…`:`↻`})})]}),o.length===0&&!c&&(0,O.jsx)(`div`,{style:{border:`2px dashed var(--line)`,padding:`28px 0`,textAlign:`center`,opacity:.4},children:(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--ink)`,margin:0},children:`Nothing captured yet`})}),(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:o.map(e=>(0,O.jsx)(ve,{capture:e,variant:`feed`,onPick:n,onDelete:e=>s(t=>t.filter(t=>t.id!==e))},e.id))}),a&&(0,O.jsx)(`button`,{onClick:a,className:`font-mono`,style:{marginTop:14,width:`100%`,fontSize:11,fontWeight:700,letterSpacing:`0.1em`,textTransform:`uppercase`,padding:`10px 0`,border:`2px solid var(--line)`,background:`transparent`,color:`var(--ink-soft)`,cursor:`pointer`},children:`Browse all captures →`})]}):(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-baseline justify-between mb-6`,children:[(0,O.jsxs)(`h2`,{className:`font-bold`,style:{fontSize:22,letterSpacing:`-0.01em`,color:`var(--ink)`},children:[`Recent`,` `,(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:13,fontWeight:700,color:`var(--ink-soft)`},children:[`· `,o.length]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,O.jsx)(`span`,{className:`font-mono text-[11px] font-bold uppercase tracking-[0.12em]`,style:{color:`var(--ink-soft)`},children:`live · local-first`}),(0,O.jsx)(`button`,{onClick:p,disabled:c,className:`font-mono text-[13px] font-bold uppercase tracking-[0.1em] px-4 py-2 border-2 border-[var(--line)] transition-all duration-100 disabled:opacity-40`,style:{background:`var(--card)`,color:`var(--ink)`,boxShadow:`var(--shadow-sm)`},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`var(--shadow)`,e.currentTarget.style.transform=`translate(-1px,-1px)`},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`var(--shadow-sm)`,e.currentTarget.style.transform=``},children:c?`…`:`↻ refresh`})]})]}),o.length===0&&!c&&(0,O.jsx)(`div`,{className:`border-2 border-dashed border-[var(--line)] py-16 text-center opacity-40`,children:(0,O.jsx)(`p`,{className:`font-mono text-[11px] font-bold uppercase tracking-widest`,style:{color:`var(--ink)`},children:`Nothing captured yet`})}),(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:o.map(e=>(0,O.jsx)(ve,{capture:e,variant:`feed`,onPick:n,onDelete:e=>s(t=>t.filter(t=>t.id!==e))},e.id))})]})}var xe=[{label:`All`,value:`all`,bg:`var(--card)`},{label:`Learn`,value:`learn`,bg:`var(--learn)`},{label:`Act`,value:`act`,bg:`var(--act)`},{label:`Reference`,value:`reference`,bg:`var(--ref)`},{label:`Ephemeral`,value:`ephemeral`,bg:`var(--eph)`}],Se=[{label:`All types`,value:`all`},{label:`Text`,value:`text`},{label:`Link`,value:`link`},{label:`Image`,value:`image`}],Ce=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],we=[`S`,`M`,`T`,`W`,`T`,`F`,`S`];function Te({captures:e,selectedDate:t,onSelectDate:n}){let r=new Date,i=(0,l.useMemo)(()=>{let t=new Map;for(let n of e){let e=n.created_at?.slice(0,10);e&&t.set(e,(t.get(e)??0)+1)}return t},[e]),a=(0,l.useMemo)(()=>Math.max(1,...i.values()),[i]),o=(0,l.useMemo)(()=>{let e=[];for(let t=2;t>=0;t--){let n=new Date(r.getFullYear(),r.getMonth()-t,1);e.push({year:n.getFullYear(),month:n.getMonth()})}return e},[]);return(0,O.jsxs)(`div`,{style:{marginBottom:20},children:[(0,O.jsx)(`div`,{style:{display:`flex`,gap:24,flexWrap:`wrap`},children:o.map(({year:e,month:o})=>{let s=new Date(e,o+1,0).getDate(),c=new Date(e,o,1).getDay(),l=Array(c).fill(null);for(let t=1;t<=s;t++){let n=String(o+1).padStart(2,`0`),r=String(t).padStart(2,`0`);l.push(`${e}-${n}-${r}`)}for(;l.length%7!=0;)l.push(null);return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:9,fontWeight:700,letterSpacing:`0.1em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:6},children:[Ce[o],` `,e]}),(0,O.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(7, 14px)`,gap:3},children:[we.map((e,t)=>(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:8,fontWeight:700,textAlign:`center`,color:`var(--ink-soft)`,opacity:.5,marginBottom:1},children:e},t)),l.map((e,o)=>{if(!e)return(0,O.jsx)(`div`,{style:{width:14,height:14}},o);let s=i.get(e)??0,c=s===0?0:Math.min(1,.25+s/a*.75),l=e===t,u=e===r.toISOString().slice(0,10);return(0,O.jsx)(`div`,{title:`${e} · ${s} capture${s===1?``:`s`}`,onClick:()=>n(l?null:e),style:{width:14,height:14,background:s===0?`var(--card)`:`var(--learn)`,opacity:s===0?.25:c,border:l?`2px solid var(--ink)`:u?`2px solid var(--ink-soft)`:`1px solid var(--line)`,cursor:s>0?`pointer`:`default`,transition:`transform 0.08s`,transform:l?`scale(1.2)`:`none`}},o)})]})]},`${e}-${o}`)})}),t&&(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10},children:[(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,color:`var(--ink)`,padding:`3px 8px`,background:`var(--learn)`,border:`2px solid var(--line)`,boxShadow:`2px 2px 0 var(--line)`},children:[t,` · `,i.get(t)??0,` capture`,(i.get(t)??0)===1?``:`s`]}),(0,O.jsx)(`button`,{onClick:()=>n(null),className:`font-mono`,style:{fontSize:10,fontWeight:700,background:`none`,border:`none`,color:`var(--ink-soft)`,cursor:`pointer`,textDecoration:`underline`},children:`clear ✕`})]})]})}var Ee=10;function De({onCountChange:e,onPick:t}){let[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(`all`),[d,p]=(0,l.useState)(`all`),[m,h]=(0,l.useState)(`newest`),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(1);(0,l.useEffect)(()=>{a(!0),f(500).then(t=>{r(t),e(t.length)}).finally(()=>a(!1))},[]);let S=(0,l.useMemo)(()=>{let e=o.trim().toLowerCase();return n.filter(t=>!(c!==`all`&&t.intent!==c||d!==`all`&&t.type!==d||g&&(t.review_count??0)>0||v&&t.created_at?.slice(0,10)!==v||e&&![t.summary,t.raw,...t.tags??[]].join(` `).toLowerCase().includes(e)))},[n,c,d,g,v,o]),C=(0,l.useMemo)(()=>{let e=[...S];return m===`oldest`?e.sort((e,t)=>(e.created_at??``).localeCompare(t.created_at??``)):m===`review_due`&&e.sort((e,t)=>{let n=e.review_due_at??`9999-99-99`,r=t.review_due_at??`9999-99-99`;return n.localeCompare(r)}),e},[S,m]);(0,l.useEffect)(()=>{x(1)},[c,d,g,v,o,m]);let w=Math.max(1,Math.ceil(C.length/Ee)),ee=C.slice((b-1)*Ee,b*Ee);function te({label:e,active:t,bg:n,onClick:r}){return(0,O.jsx)(`button`,{onClick:r,className:`font-mono text-[11px] font-bold uppercase tracking-[0.08em] px-3 py-1.5 border-2 border-[var(--line)] transition-all duration-100`,style:{background:t?`var(--ink)`:n??`var(--card)`,color:t?`var(--paper)`:`var(--ink)`,boxShadow:t?`var(--shadow-sm)`:`none`,transform:t?`translate(-1px,-1px)`:``},children:e})}return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,marginBottom:16},children:(0,O.jsxs)(`h2`,{className:`font-bold`,style:{fontSize:22,letterSpacing:`-0.01em`,color:`var(--ink)`},children:[`Browse`,` `,(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:13,fontWeight:700,color:`var(--ink-soft)`},children:[`· `,S.length,n.length===S.length?``:` of ${n.length}`]})]})}),!i&&n.length>0&&(0,O.jsx)(Te,{captures:n,selectedDate:v,onSelectDate:y}),(0,O.jsxs)(`div`,{style:{marginBottom:12,border:`2px solid var(--line)`,background:`var(--card)`,display:`flex`,alignItems:`center`,boxShadow:`var(--shadow-sm)`},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{padding:`0 12px`,fontSize:14,color:`var(--ink-soft)`,flexShrink:0},children:`⌕`}),(0,O.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`Search summaries and tags…`,style:{flex:1,border:`none`,outline:`none`,padding:`10px 12px 10px 0`,fontSize:15,background:`transparent`,color:`var(--ink)`}}),o&&(0,O.jsx)(`button`,{onClick:()=>s(``),className:`font-mono`,style:{padding:`0 12px`,fontSize:12,color:`var(--ink-soft)`,background:`none`,border:`none`,cursor:`pointer`},children:`✕`})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,marginBottom:8},children:[xe.map(e=>(0,O.jsx)(te,{label:e.label,active:c===e.value,bg:e.bg,onClick:()=>u(e.value)},e.value)),(0,O.jsx)(`div`,{style:{marginLeft:`auto`},children:(0,O.jsx)(te,{label:`Never reviewed`,active:g,onClick:()=>_(e=>!e)})})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,marginBottom:20,alignItems:`center`},children:[Se.map(e=>(0,O.jsx)(te,{label:e.label,active:d===e.value,onClick:()=>p(e.value)},e.value)),(0,O.jsxs)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:6,alignItems:`center`},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9,fontWeight:700,letterSpacing:`0.1em`,textTransform:`uppercase`,color:`var(--ink-soft)`},children:`Sort`}),[`newest`,`oldest`,`review_due`].map(e=>(0,O.jsx)(`button`,{onClick:()=>h(e),className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`4px 10px`,border:`2px solid var(--line)`,background:m===e?`var(--ink)`:`var(--card)`,color:m===e?`var(--paper)`:`var(--ink)`,cursor:`pointer`,boxShadow:m===e?`var(--shadow-sm)`:`none`,transform:m===e?`translate(-1px,-1px)`:``,transition:`all 0.08s`},children:e===`newest`?`↓ Newest`:e===`oldest`?`↑ Oldest`:`⏰ Due`},e))]})]}),i&&(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:12,color:`var(--ink-soft)`,textAlign:`center`,padding:`40px 0`},children:`Loading…`}),!i&&C.length===0&&(0,O.jsx)(`div`,{style:{border:`2px dashed var(--line)`,padding:`48px 0`,textAlign:`center`,opacity:.4},children:(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.1em`,color:`var(--ink)`},children:`No captures match`})}),(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:ee.map(e=>(0,O.jsx)(ve,{capture:e,variant:`feed`,onPick:t},e.id))}),w>1&&(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginTop:20,gap:12},children:[(0,O.jsx)(`button`,{onClick:()=>x(e=>Math.max(1,e-1)),disabled:b===1,className:`font-mono text-[11px] font-bold uppercase tracking-[0.08em] px-4 py-2 border-2 border-[var(--line)] transition-all duration-100 disabled:opacity-30`,style:{background:`var(--card)`,color:`var(--ink)`,boxShadow:`var(--shadow-sm)`,cursor:b===1?`default`:`pointer`},onMouseEnter:e=>{b>1&&(e.currentTarget.style.boxShadow=`var(--shadow)`,e.currentTarget.style.transform=`translate(-1px,-1px)`)},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`var(--shadow-sm)`,e.currentTarget.style.transform=``},children:`← prev`}),(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,color:`var(--ink-soft)`,letterSpacing:`0.1em`},children:[b,` / `,w]}),(0,O.jsx)(`button`,{onClick:()=>x(e=>Math.min(w,e+1)),disabled:b===w,className:`font-mono text-[11px] font-bold uppercase tracking-[0.08em] px-4 py-2 border-2 border-[var(--line)] transition-all duration-100 disabled:opacity-30`,style:{background:`var(--card)`,color:`var(--ink)`,boxShadow:`var(--shadow-sm)`,cursor:b===w?`default`:`pointer`},onMouseEnter:e=>{b{e.currentTarget.style.boxShadow=`var(--shadow-sm)`,e.currentTarget.style.transform=``},children:`next →`})]})]})}function Oe(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function je(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;nu&&(u=i),ad&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;ne||e>=i||r>t||t>=a;)switch(l=(tu||(s=m.y0)>d||(c=m.x1)=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function Re(e){for(var t=0,n=e.length;tl.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_u+m||ad+m||oe.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r[t(e,n,o),e])),d;for(n=0,s=Array(i);n{}};function ot(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}st.prototype=ot.prototype={constructor:st,on:function(e,t){var n=this._,r=ct(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&e._call.call(void 0,t),e=e._next;--dt}function j(){vt=(_t=bt.now())+yt,dt=ft=0;try{Et()}finally{dt=0,Ot(),vt=0}}function Dt(){var e=bt.now(),t=e-_t;t>mt&&(yt-=t,_t=e)}function Ot(){for(var e,t=ht,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ht=n);gt=e,kt(r)}function kt(e){dt||(ft&&=clearTimeout(ft),e-vt>24?(e<1/0&&(ft=setTimeout(j,e-bt.now()-yt)),pt&&=clearInterval(pt)):(pt||=(_t=bt.now(),setInterval(Dt,mt)),dt=1,xt(j)))}function At(e,t,n){var r=new wt;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var jt=1664525,Mt=1013904223,Nt=4294967296;function Pt(){let e=1;return()=>(e=(jt*e+Mt)%Nt)/Nt}function Ft(e){return e.x}function It(e){return e.y}var Lt=10,Rt=Math.PI*(3-Math.sqrt(5));function zt(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=Tt(d),l=ot(`tick`,`end`),u=Pt();e??=[];function d(){f(),l.call(`tick`,t),n1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i1?(l.on(e,n),t):l.on(e)}}}function Bt(){var e,t,n,r,i=Ze(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=qe(e,Ft,It).visitAfter(d);for(r=n,i=0;i=s)){(e.data!==t||e.next)&&(d===0&&(d=Qe(n),m+=d*d),f===0&&(f=Qe(n),m+=f*f),m=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Vt.hasOwnProperty(t)?{space:Vt[t],local:e}:e}function Ut(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Wt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Gt(e){var t=Ht(e);return(t.local?Wt:Ut)(t)}function Kt(){}function qt(e){return e==null?Kt:function(){return this.querySelector(e)}}function Jt(e){typeof e!=`function`&&(e=qt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Tn(e){e||=En;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function Dn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function On(){return Array.from(this)}function kn(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Vn:typeof t==`function`?Un:Hn)(e,t,n??``)):Gn(this.node(),e)}function Gn(e,t){return e.style.getPropertyValue(t)||Bn(e).getComputedStyle(e,null).getPropertyValue(t)}function Kn(e){return function(){delete this[e]}}function qn(e,t){return function(){this[e]=t}}function Jn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Yn(e,t){return arguments.length>1?this.each((t==null?Kn:typeof t==`function`?Jn:qn)(e,t)):this.node()[e]}function Xn(e){return e.trim().split(/^|\s+/)}function Zn(e){return e.classList||new Qn(e)}function Qn(e){this._node=e,this._names=Xn(e.getAttribute(`class`)||``)}Qn.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function $n(e,t){for(var n=Zn(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Or(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function Xr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Xr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Zr(e){return!e.ctrlKey&&!e.button}function Qr(){return this.parentNode}function $r(e,t){return t??{x:e.x,y:e.y}}function ei(){return navigator.maxTouchPoints||`ontouchstart`in this}function ti(){var e=Zr,t=Qr,n=$r,r=ei,i={},a=ot(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Ur).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Br(n.view).on(`mousemove.drag`,m,Wr).on(`mouseup.drag`,h,Wr),qr(n.view),Gr(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Kr(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Br(e.view).on(`mousemove.drag mouseup.drag`,null),Jr(e.view,l),Kr(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?wi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=di.exec(e))?new Di(t[1],t[2],t[3],1):(t=fi.exec(e))?new Di(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pi.exec(e))?wi(t[1],t[2],t[3],t[4]):(t=mi.exec(e))?wi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hi.exec(e))?Pi(t[1],t[2]/100,t[3]/100,1):(t=gi.exec(e))?Pi(t[1],t[2]/100,t[3]/100,t[4]):_i.hasOwnProperty(e)?Ci(_i[e]):e===`transparent`?new Di(NaN,NaN,NaN,0):null}function Ci(e){return new Di(e>>16&255,e>>8&255,e&255,1)}function wi(e,t,n,r){return r<=0&&(e=t=n=NaN),new Di(e,t,n,r)}function Ti(e){return e instanceof ii||(e=Si(e)),e?(e=e.rgb(),new Di(e.r,e.g,e.b,e.opacity)):new Di}function Ei(e,t,n,r){return arguments.length===1?Ti(e):new Di(e,t,n,r??1)}function Di(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ni(Di,Ei,ri(ii,{brighter(e){return e=e==null?oi:oi**+e,new Di(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ai:ai**+e,new Di(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Di(Mi(this.r),Mi(this.g),Mi(this.b),ji(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:Oi,formatHex:Oi,formatHex8:ki,formatRgb:Ai,toString:Ai}));function Oi(){return`#${Ni(this.r)}${Ni(this.g)}${Ni(this.b)}`}function ki(){return`#${Ni(this.r)}${Ni(this.g)}${Ni(this.b)}${Ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ai(){let e=ji(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Mi(this.r)}, ${Mi(this.g)}, ${Mi(this.b)}${e===1?`)`:`, ${e})`}`}function ji(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ni(e){return e=Mi(e),(e<16?`0`:``)+e.toString(16)}function Pi(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Li(e,t,n,r)}function Fi(e){if(e instanceof Li)return new Li(e.h,e.s,e.l,e.opacity);if(e instanceof ii||(e=Si(e)),!e)return new Li;if(e instanceof Li)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Li(o,s,c,e.opacity)}function Ii(e,t,n,r){return arguments.length===1?Fi(e):new Li(e,t,n,r??1)}function Li(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ni(Li,Ii,ri(ii,{brighter(e){return e=e==null?oi:oi**+e,new Li(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ai:ai**+e,new Li(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Di(Bi(e>=240?e-240:e+120,i,r),Bi(e,i,r),Bi(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Li(Ri(this.h),zi(this.s),zi(this.l),ji(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(){let e=ji(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ri(this.h)}, ${zi(this.s)*100}%, ${zi(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ri(e){return e=(e||0)%360,e<0?e+360:e}function zi(e){return Math.max(0,Math.min(1,e||0))}function Bi(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var M=e=>()=>e;function N(e,t){return function(n){return e+n*t}}function Vi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Hi(e){return(e=+e)==1?Ui:function(t,n){return n-t?Vi(t,n,e):M(isNaN(t)?n:t)}}function Ui(e,t){var n=t-e;return n?N(e,n):M(isNaN(e)?t:e)}var Wi=(function e(t){var n=Hi(t);function r(e,t){var r=n((e=Ei(e)).r,(t=Ei(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Ui(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Gi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ki=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qi=new RegExp(Ki.source,`g`);function Ji(e){return function(){return e}}function Yi(e){return function(t){return e(t)+``}}function Xi(e,t){var n=Ki.lastIndex=qi.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Ki.exec(e))&&(i=qi.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Gi(r,i)})),n=qi.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Gi(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Gi(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Gi(e,n)},{i:s-2,x:Gi(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t0)throw Error(`too late; already scheduled`);return n}function ma(e,t){var n=ha(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function ha(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function ga(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Tt(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return At(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function va(e){return this.each(function(){_a(this,e)})}function ya(e,t){var n,r;return function(){var i=ma(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Ya(e,t,n){var r,i,a=Ja(t)?pa:ma;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Xa(e,t){var n=this._id;return arguments.length<2?ha(this.node(),n).on.on(e):this.each(Ya(n,e,t))}function Za(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Qa(){return this.on(`end.remove`,Za(this._id))}function $a(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=qt(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function Eo(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Do(e,t,n){this.k=e,this.x=t,this.y=n}Do.prototype={constructor:Do,scale:function(e){return e===1?this:new Do(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Do(this.k,this.x+this.k*e,this.y+this.k*t)},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 Oo=new Do(1,0,0);ko.prototype=Do.prototype;function ko(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Oo;return e.__zoom}function Ao(e){e.stopImmediatePropagation()}function jo(e){e.preventDefault(),e.stopImmediatePropagation()}function Mo(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function No(){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 B(){return this.__zoom||Oo}function Po(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Fo(){return navigator.maxTouchPoints||`ontouchstart`in this}function Io(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Lo(){var e=Mo,t=No,n=Io,r=Po,i=Fo,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ua,l=ot(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,B).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,ee).on(`dblclick.zoom`,te).filter(i).on(`touchstart.zoom`,ne).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,re).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,B),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Oo.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Do(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Do(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Do(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Br(this.that).datum();l.call(e,this.that,new Eo(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Hr(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],_a(this),s.start();jo(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function ee(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Br(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Hr(t,i),l=t.clientX,u=t.clientY;qr(t.view),Ao(t),a.mouse=[c,this.__zoom.invert(c)],_a(this),a.start();function d(e){if(jo(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Hr(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Jr(e.view,a.moved),jo(e),a.event(e).end()}}function te(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Hr(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);jo(r),s>0?Br(this).transition().duration(s).call(x,d,c,r):Br(this).call(_.transform,d,c,r)}}function ne(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Ao(t),s=0;s{f(500).then(e=>{r(e),a(!1)})},[]),(0,l.useEffect)(()=>{if(!n.length||!t.current)return;let e=t.current,r=e.clientWidth||800,i=e.clientHeight||600,a=Br(e);a.selectAll(`*`).remove();let o=a.append(`g`),c=new Map,l=n.map(e=>{let t={id:e.id,capture:e,r:e.intent===`learn`?10:e.intent===`act`?11:8,degree:0,x:r/2+(Math.random()-.5)*300,y:i/2+(Math.random()-.5)*300};return c.set(e.id,t),t}),d=new Set,f=[],p=new Map;for(let e of n)for(let t of e.related_ids??[]){let n=Number(t),r=[Math.min(e.id,n),Math.max(e.id,n)].join(`-`);!d.has(r)&&c.has(n)&&(d.add(r),f.push({source:e.id,target:n}),p.set(e.id,(p.get(e.id)??0)+1),p.set(n,(p.get(n)??0)+1))}for(let e of l)e.degree=p.get(e.id)??0;let m=o.append(`g`).selectAll(`line`).data(f).join(`line`).attr(`stroke`,`#181410`).attr(`stroke-opacity`,.18).attr(`stroke-width`,1.5),h=o.append(`g`).selectAll(`g`).data(l,e=>e.id).join(`g`).attr(`cursor`,`grab`);h.append(`circle`).attr(`r`,e=>e.r).attr(`fill`,e=>Ro[e.capture.intent??``]??`#ccc`).attr(`stroke`,`#181410`).attr(`stroke-width`,2);let g=!1;h.on(`mouseenter`,function(e,t){Br(this).select(`circle`).attr(`stroke-width`,3.5).attr(`r`,t.r+3),s({capture:t.capture,degree:t.degree})}).on(`mouseleave`,function(e,t){Br(this).select(`circle`).attr(`stroke-width`,2).attr(`r`,t.r),s(null)}).on(`pointerup.pick`,(e,t)=>{g||u({capture:t.capture,degree:t.degree})}).on(`dblclick`,(e,t)=>{t.fx=null,t.fy=null});let _=ti().on(`start`,function(e,t){g=!1,t.fx=t.x,t.fy=t.y,Br(this).attr(`cursor`,`grabbing`)}).on(`drag`,function(e,t){g=!0,t.fx=t.x=e.x,t.fy=t.y=e.y,Br(this).attr(`transform`,`translate(${t.x},${t.y})`),m.attr(`x1`,e=>e.source.x??0).attr(`y1`,e=>e.source.y??0).attr(`x2`,e=>e.target.x??0).attr(`y2`,e=>e.target.y??0)}).on(`end`,function(e,t){g||(t.fx=null,t.fy=null),Br(this).attr(`cursor`,`grab`)});h.call(_);let v=Lo().scaleExtent([.15,4]).on(`zoom`,e=>{o.attr(`transform`,e.transform)});a.call(v),a.on(`dblclick.zoom`,null);let y=zt(l).force(`link`,it(f).id(e=>e.id).distance(90).strength(.5)).force(`charge`,Bt().strength(-150)).force(`center`,Oe(r/2,i/2)).force(`collision`,tt(e=>e.r+8)).on(`tick`,()=>{m.attr(`x1`,e=>e.source.x??0).attr(`y1`,e=>e.source.y??0).attr(`x2`,e=>e.target.x??0).attr(`y2`,e=>e.target.y??0),h.attr(`transform`,e=>`translate(${e.x??0},${e.y??0})`)});return()=>{y.stop()}},[n,e]),(0,O.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,marginBottom:14,flexShrink:0},children:[(0,O.jsxs)(`h2`,{className:`font-bold`,style:{fontSize:22,letterSpacing:`-0.01em`,color:`var(--ink)`},children:[`Graph`,` `,(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:13,fontWeight:700,color:`var(--ink-soft)`},children:[`· `,n.length,` nodes`]})]}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,color:`var(--ink-soft)`},children:`scroll · zoom \xA0|\xA0 drag · pan \xA0|\xA0 drag node · pin \xA0|\xA0 dblclick · unpin \xA0|\xA0 click · surface`})]}),(0,O.jsx)(`div`,{style:{display:`flex`,gap:16,marginBottom:12,flexShrink:0},children:Object.entries(Ro).map(([e,t])=>(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,O.jsx)(`div`,{style:{width:11,height:11,borderRadius:`50%`,background:t,border:`2px solid var(--ink)`}}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,textTransform:`uppercase`,color:`var(--ink-soft)`},children:e})]},e))}),(0,O.jsxs)(`div`,{style:{flex:1,position:`relative`,border:`2px solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow-sm)`,overflow:`hidden`},children:[i&&(0,O.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`grid`,placeItems:`center`},children:(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:12,fontWeight:700,color:`var(--ink-soft)`},children:`Building graph…`})}),(0,O.jsx)(`svg`,{ref:t,width:`100%`,height:`100%`}),o&&!c&&(0,O.jsxs)(`div`,{style:{position:`absolute`,bottom:16,left:16,background:`var(--card)`,border:`2px solid var(--line)`,boxShadow:`var(--shadow)`,padding:`8px 12px`,pointerEvents:`none`,maxWidth:320},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,gap:6,marginBottom:5,alignItems:`center`},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,padding:`2px 6px`,border:`2px solid var(--line)`,background:Ro[o.capture.intent??``]??`#eee`,boxShadow:`2px 2px 0 var(--line)`},children:(o.capture.intent??`—`).toUpperCase()}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,padding:`2px 6px`,border:`2px solid var(--line)`,background:`var(--paper)`,boxShadow:`2px 2px 0 var(--line)`},children:o.capture.type.toUpperCase()}),o.degree>0&&(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`},children:[`◇ `,o.degree]})]}),(0,O.jsx)(`p`,{style:{fontSize:13,fontWeight:500,color:`var(--ink)`,margin:0,lineHeight:1.35},children:o.capture.summary??o.capture.raw??`(processing…)`})]}),c&&(0,O.jsxs)(`div`,{style:{position:`absolute`,top:0,right:0,bottom:0,width:320,background:`var(--card)`,borderLeft:`var(--bw) solid var(--line)`,boxShadow:`-4px 0 0 var(--line)`,display:`flex`,flexDirection:`column`,animation:`pop-in .15s ease both`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,gap:8,padding:`14px 16px`,borderBottom:`var(--bw) solid var(--line)`,alignItems:`center`,flexShrink:0},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,padding:`3px 8px`,border:`2px solid var(--line)`,background:Ro[c.capture.intent??``]??`#eee`,boxShadow:`2px 2px 0 var(--line)`},children:(c.capture.intent??`—`).toUpperCase()}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,padding:`3px 8px`,border:`2px solid var(--line)`,background:`var(--paper)`,boxShadow:`2px 2px 0 var(--line)`},children:c.capture.type.toUpperCase()}),c.degree>0&&(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,marginLeft:2},children:[`◇ `,c.degree,` edges`]}),(0,O.jsx)(`button`,{onClick:()=>u(null),style:{marginLeft:`auto`,background:`transparent`,border:`none`,cursor:`pointer`,fontSize:18,color:`var(--ink-soft)`,lineHeight:1,padding:`2px 4px`},children:`✕`})]}),(0,O.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 16px 20px`},children:[c.capture.type===`image`&&c.capture.file_path&&(0,O.jsx)(pe,{src:`/uploads/${c.capture.file_path.split(`/`).pop()}`,alt:c.capture.summary??`image`,thumbHeight:160}),(0,O.jsx)(`p`,{style:{margin:`0 0 14px`,fontSize:16,lineHeight:1.45,fontWeight:500,color:`var(--ink)`},children:c.capture.summary??c.capture.raw??`(processing…)`}),c.capture.source_url&&(0,O.jsx)(`a`,{href:c.capture.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono`,style:{display:`flex`,alignItems:`center`,gap:5,fontSize:11,fontWeight:700,color:`var(--ref)`,textDecoration:`none`,marginBottom:14,overflow:`hidden`},children:(0,O.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`↗ `,c.capture.source_url]})}),c.capture.tags?.length>0&&(0,O.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:5,marginBottom:14},children:c.capture.tags.map(e=>(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,padding:`2px 7px`,border:`2px solid var(--line)`,background:`var(--paper)`,borderRadius:999},children:e},e))}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,fontWeight:700},children:c.capture.created_at?.slice(0,16).replace(`T`,` `)})]}),(0,O.jsx)(`div`,{style:{padding:`12px 16px`,borderTop:`var(--bw) solid var(--line)`,flexShrink:0},children:(0,O.jsx)(`button`,{onClick:()=>{e?.(c.capture),u(null)},style:{width:`100%`,fontSize:13,fontWeight:700,letterSpacing:`0.04em`,textTransform:`uppercase`,padding:`10px 0`,border:`var(--bw) solid var(--line)`,background:`var(--learn)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`Open in recall →`})})]})]})]})}var Bo=[{id:`home`,label:`HOME`,accent:`var(--learn)`},{id:`ask`,label:`ASK`,accent:`var(--act)`},{id:`browse`,label:`BROWSE`,accent:`var(--paper)`},{id:`brief`,label:`BRIEF`,accent:`var(--ref)`},{id:`review`,label:`REVIEW`,accent:`var(--done)`},{id:`graph`,label:`GRAPH`,accent:`var(--eph)`}],V={fill:`none`,stroke:`var(--ink)`,strokeWidth:2.4,strokeLinecap:`round`,strokeLinejoin:`round`};function Vo({id:e}){return e===`home`?(0,O.jsxs)(`svg`,{width:`26`,height:`26`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`rect`,{x:`4`,y:`5`,width:`18`,height:`16`,...V}),(0,O.jsx)(`line`,{x1:`13`,y1:`10`,x2:`13`,y2:`16`,...V}),(0,O.jsx)(`line`,{x1:`10`,y1:`13`,x2:`16`,y2:`13`,...V})]}):e===`browse`?(0,O.jsxs)(`svg`,{width:`26`,height:`26`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`line`,{x1:`5`,y1:`8`,x2:`21`,y2:`8`,...V}),(0,O.jsx)(`line`,{x1:`5`,y1:`13`,x2:`21`,y2:`13`,...V}),(0,O.jsx)(`line`,{x1:`5`,y1:`18`,x2:`21`,y2:`18`,...V})]}):e===`ask`?(0,O.jsxs)(`svg`,{width:`26`,height:`26`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`,...V}),(0,O.jsx)(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`,...V})]}):e===`brief`?(0,O.jsxs)(`svg`,{width:`26`,height:`26`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`circle`,{cx:`13`,cy:`13`,r:`5`,...V}),[0,45,90,135,180,225,270,315].map((e,t)=>{let n=e*Math.PI/180;return(0,O.jsx)(`line`,{x1:13+7*Math.cos(n),y1:13+7*Math.sin(n),x2:13+9.5*Math.cos(n),y2:13+9.5*Math.sin(n),...V},t)})]}):e===`review`?(0,O.jsxs)(`svg`,{width:`26`,height:`26`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`path`,{d:`M20 9a8 8 0 1 0 1.6 6`,...V}),(0,O.jsx)(`polyline`,{points:`20,4 20,9 15,9`,...V})]}):(0,O.jsxs)(`svg`,{width:`26`,height:`26`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`line`,{x1:`9`,y1:`9`,x2:`18`,y2:`7`,...V}),(0,O.jsx)(`line`,{x1:`9`,y1:`9`,x2:`8`,y2:`19`,...V}),(0,O.jsx)(`line`,{x1:`9`,y1:`9`,x2:`19`,y2:`17`,...V}),(0,O.jsx)(`circle`,{cx:`9`,cy:`9`,r:`3`,fill:`var(--ink)`,stroke:`none`}),(0,O.jsx)(`circle`,{cx:`18`,cy:`7`,r:`2.6`,...V,fill:`var(--paper)`}),(0,O.jsx)(`circle`,{cx:`8`,cy:`19`,r:`2.6`,...V,fill:`var(--paper)`}),(0,O.jsx)(`circle`,{cx:`19`,cy:`17`,r:`2.6`,...V,fill:`var(--paper)`})]})}function Ho({view:e,setView:t,badges:n={}}){return(0,O.jsx)(`nav`,{style:{width:96,flexShrink:0,borderRight:`var(--bw) solid var(--line)`,background:`var(--paper)`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:12,padding:`18px 0`},children:Bo.map(r=>{let i=e===r.id,a=n[r.id]??0;return(0,O.jsxs)(`button`,{onClick:()=>t(r.id),title:r.label,style:{position:`relative`,width:68,height:64,cursor:`pointer`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:5,border:`var(--bw) solid var(--line)`,background:i?r.accent:`var(--card)`,boxShadow:i?`4px 4px 0 var(--line)`:`2px 2px 0 var(--line)`,transform:i?`translate(-1px,-1px)`:`none`,transition:`transform .06s, box-shadow .06s`},children:[(0,O.jsx)(Vo,{id:r.id}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9,fontWeight:700,letterSpacing:`0.06em`},children:r.label}),a>0&&(0,O.jsx)(`span`,{className:`font-mono`,style:{position:`absolute`,top:-8,right:-8,minWidth:20,height:20,borderRadius:999,background:`var(--act)`,color:`var(--ink)`,border:`2.5px solid var(--line)`,fontSize:10,fontWeight:700,display:`grid`,placeItems:`center`,padding:`0 4px`},children:a})]},r.id)})})}var Uo=[{id:`learn`,label:`LEARN`,color:`var(--learn)`},{id:`act`,label:`ACT`,color:`var(--act)`},{id:`reference`,label:`REFERENCE`,color:`var(--ref)`},{id:`ephemeral`,label:`EPHEMERAL`,color:`var(--eph)`}];function Wo({capture:e,onConfirm:t,onUpdate:n}){let[r,i]=(0,l.useState)(e.intent),[a,o]=(0,l.useState)(e.tags??[]),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(!1);async function f(t){i(t),d(!0),await C(e.id,{intent:t}),n({intent:t})}function p(t){let r=a.filter(e=>e!==t);o(r),d(!0),C(e.id,{tags:r}),n({tags:r})}function m(t){let r=t.trim().toLowerCase();if(!r||a.includes(r))return;let i=[...a,r];o(i),d(!0),C(e.id,{tags:i}),n({tags:i})}return(0,O.jsxs)(`section`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow)`,overflow:`hidden`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`11px 14px`,background:`var(--ink)`,color:`var(--paper)`},children:[(0,O.jsx)(`span`,{style:{width:24,height:24,display:`grid`,placeItems:`center`,background:`var(--learn)`,border:`2.5px solid var(--paper)`,fontWeight:700,fontSize:13,color:`var(--ink)`},children:`✦`}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.1em`},children:u?`GOT IT — I'LL REMEMBER`:`I FILED THIS — RIGHT?`}),(0,O.jsx)(`button`,{onClick:t,style:{marginLeft:`auto`,background:`transparent`,border:`none`,color:`var(--paper)`,cursor:`pointer`,fontSize:18,lineHeight:1,padding:`2px 4px`},children:`✕`})]}),(0,O.jsxs)(`div`,{style:{padding:`14px 16px`},children:[(0,O.jsxs)(`p`,{style:{margin:`0 0 14px`,fontSize:14,lineHeight:1.45,fontWeight:500,color:`var(--ink)`,overflow:`hidden`,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},children:[`"`,e.summary||e.raw||``,`"`]}),(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:8},children:`Intent — tap to re-file`}),(0,O.jsx)(`div`,{style:{display:`flex`,gap:7,marginBottom:16,flexWrap:`wrap`},children:Uo.map(({id:e,label:t,color:n})=>{let i=r===e;return(0,O.jsx)(`button`,{onClick:()=>f(e),className:`font-mono`,style:{fontWeight:700,fontSize:11,letterSpacing:`0.06em`,padding:`6px 11px`,border:`2.5px solid var(--line)`,cursor:`pointer`,textTransform:`uppercase`,background:i?n:`var(--card)`,color:`var(--ink)`,boxShadow:i?`2px 2px 0 var(--line)`:`none`,transform:i?`translate(-1px,-1px)`:`none`,transition:`transform .06s, box-shadow .06s`},children:t},e)})}),(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:8},children:`Tags — ✕ to drop`}),(0,O.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,alignItems:`center`},children:[a.map(e=>(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:11.5,padding:`2px 7px`,border:`2px solid var(--line)`,background:`var(--paper)`,borderRadius:999,color:`var(--ink)`,display:`inline-flex`,alignItems:`center`,gap:5,paddingRight:4},children:[e,(0,O.jsx)(`button`,{onClick:()=>p(e),style:{border:`none`,background:`var(--ink)`,color:`var(--paper)`,cursor:`pointer`,width:15,height:15,borderRadius:`50%`,fontSize:10,lineHeight:1,display:`grid`,placeItems:`center`},children:`✕`})]},e)),(0,O.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(m(s),c(``))},placeholder:`+ add`,className:`font-mono`,style:{border:`2px dashed var(--ink-soft)`,background:`transparent`,borderRadius:999,fontSize:11.5,padding:`2px 9px`,width:64,outline:`none`,color:`var(--ink)`}})]}),(0,O.jsx)(`button`,{onClick:t,style:{width:`100%`,marginTop:16,fontSize:14,fontWeight:700,letterSpacing:`0.04em`,textTransform:`uppercase`,padding:`11px 0`,border:`var(--bw) solid var(--line)`,background:`var(--done)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`✓ Looks right`})]})]})}var Go=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Ko({reviewedDates:e,streak:t,big:n=!1}){let r=n?34:26,i=new Date,a=i.toISOString().slice(0,10),o=i.getDay(),s=o===0?6:o-1,c=Go.map((e,t)=>{let n=new Date(i);return n.setDate(i.getDate()-s+t),n.toISOString().slice(0,10)}),l=new Set(e);return(0,O.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:10},children:[(0,O.jsx)(`div`,{style:{display:`flex`,gap:n?8:6},children:c.map((e,t)=>{let i=e===a,o=l.has(e);return(0,O.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:5},children:[(0,O.jsx)(`div`,{style:{width:r,height:r,border:`2.5px solid var(--line)`,display:`grid`,placeItems:`center`,fontWeight:700,fontSize:n?14:11,background:o?`var(--done)`:i?`var(--learn)`:`var(--card)`,opacity:e>a?.35:1},children:o?`✓`:i?`•`:``}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9.5,fontWeight:700,color:`var(--ink-soft)`},children:Go[t]})]},t)})}),t>0&&(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.1em`,color:`var(--ink-soft)`},children:[t,` DAY STREAK 🔥`]})]})}var qo={learn:`What's the key insight here?`,act:`What were you going to do?`,reference:`When would you reach for this?`,ephemeral:`Why did this catch your attention?`};function Jo(e){return e.recall_question?e.recall_question:qo[e.intent??``]??`What do you remember about this?`}var Yo={learn:`var(--learn)`,act:`var(--act)`,reference:`var(--ref)`,ephemeral:`var(--eph)`},Xo={text:`TEXT`,link:`LINK`,image:`IMAGE`},Zo={learn:`LEARN`,act:`ACT`,reference:`REFERENCE`,ephemeral:`EPHEMERAL`};function Qo({onExit:e}){let[t,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)(0),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)({got:0,again:0}),[m,h]=(0,l.useState)([]),[g,_]=(0,l.useState)(0);(0,l.useEffect)(()=>{Promise.all([w(20).catch(()=>[]),te().catch(()=>({reviewed_dates:[],streak:0}))]).then(([e,t])=>{n(e),h(t.reviewed_dates),_(t.streak),i(!1)})},[]);async function v(){let e=await te().catch(()=>({reviewed_dates:[],streak:0}));h(e.reviewed_dates),_(e.streak)}async function y(e){let n=t[a];await ee(n.id,e),p(t=>({...t,[e===`got_it`?`got`:`again`]:t[e===`got_it`?`got`:`again`]+1})),a+1{o(0),c(!1),d(!1),p({got:0,again:0})},style:{fontSize:14,fontWeight:700,textTransform:`uppercase`,padding:`11px 20px`,border:`var(--bw) solid var(--line)`,background:`var(--card)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`Review again`}),(0,O.jsx)(`button`,{onClick:e,style:{fontSize:14,fontWeight:700,textTransform:`uppercase`,padding:`11px 20px`,border:`var(--bw) solid var(--line)`,background:`var(--learn)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`Done`})]})]})});let b=t[a],x=b.intent?Yo[b.intent]:`#eee`;return(0,O.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,padding:`26px 24px`,overflowY:`auto`},children:[(0,O.jsxs)(`div`,{style:{width:`100%`,maxWidth:560,marginBottom:22},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`},children:`Recall session`}),(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontWeight:700,fontSize:13},children:[a+1,` / `,t.length]})]}),(0,O.jsx)(`div`,{style:{display:`flex`,gap:5},children:t.map((e,t)=>(0,O.jsx)(`div`,{style:{flex:1,height:10,border:`2.5px solid var(--line)`,background:t1?(0,O.jsx)(`ul`,{style:{margin:`0 0 12px`,padding:0,listStyle:`none`,display:`flex`,flexDirection:`column`,gap:7},children:b.claims.map((e,t)=>(0,O.jsxs)(`li`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,O.jsx)(`span`,{style:{flexShrink:0,marginTop:7,width:5,height:5,borderRadius:`50%`,background:`var(--ink)`,opacity:.4}}),(0,O.jsx)(`span`,{style:{fontSize:15,lineHeight:1.5,fontWeight:500},children:e})]},t))}):(0,O.jsx)(`p`,{style:{margin:`0 0 12px`,fontSize:16,lineHeight:1.45,fontWeight:500},children:b.summary}),b.source_url&&(()=>{let e=``;try{e=new URL(b.source_url).hostname}catch{}return(0,O.jsxs)(`a`,{href:b.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono`,style:{display:`flex`,alignItems:`center`,gap:5,marginBottom:12,fontSize:11,fontWeight:700,color:`var(--ref)`,textDecoration:`none`},children:[e&&(0,O.jsx)(`img`,{src:`https://www.google.com/s2/favicons?domain=${e}&sz=16`,width:12,height:12,alt:``,style:{border:`1px solid var(--line)`}}),(0,O.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`↗ `,b.source_url]})]})})(),(0,O.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:5},children:b.tags.map(e=>(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,padding:`2px 7px`,border:`2px solid var(--line)`,background:`var(--paper)`,borderRadius:999,color:`var(--ink)`},children:e},e))})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{style:{margin:`0 0 16px`,fontSize:19,lineHeight:1.4,fontWeight:700,color:`var(--ink)`},children:Jo(b)}),(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:8},children:`Cues`}),(0,O.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:[b.tags.map(e=>(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:11.5,padding:`2px 7px`,border:`2px solid var(--line)`,background:`var(--paper)`,borderRadius:999,color:`var(--ink)`},children:e},e)),b.tags.length===0&&(0,O.jsx)(`span`,{style:{fontSize:13,color:`var(--ink-soft)`},children:`no tags`})]})]})}),(0,O.jsx)(`div`,{style:{padding:14,borderTop:`var(--bw) solid var(--line)`},children:s?(0,O.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[(0,O.jsx)(`button`,{onClick:()=>y(`again`),style:{flex:1,fontSize:14,fontWeight:700,textTransform:`uppercase`,padding:`11px 0`,border:`var(--bw) solid var(--line)`,background:`var(--act)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`↺ Again`}),(0,O.jsx)(`button`,{onClick:()=>y(`got_it`),style:{flex:1,fontSize:14,fontWeight:700,textTransform:`uppercase`,padding:`11px 0`,border:`var(--bw) solid var(--line)`,background:`var(--done)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`✓ Got it`})]}):(0,O.jsx)(`button`,{onClick:()=>c(!0),style:{width:`100%`,fontSize:14,fontWeight:700,letterSpacing:`0.04em`,textTransform:`uppercase`,padding:`11px 0`,border:`var(--bw) solid var(--line)`,background:`var(--ref)`,color:`var(--paper)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:`Reveal ↓`})})]}),(0,O.jsx)(`button`,{onClick:e,className:`font-mono`,style:{marginTop:18,background:`transparent`,border:`none`,fontSize:12,fontWeight:700,letterSpacing:`0.1em`,textTransform:`uppercase`,color:`var(--ink-soft)`,cursor:`pointer`,textDecoration:`underline`},children:`Exit session`})]})}var $o=[`what do I know about LLM inference?`,`what should I act on?`,`how does spaced repetition work?`,`what have I saved about embeddings?`,`things to learn this week`,`how to build and ship faster`];function es(e){let t=e.toLowerCase();return/\b(act on|to[- ]?do|todo|tasks?|should i do|action items?|follow.?up)\b/.test(t)?{mode:`intent`,intent:`act`}:/\b(what (to|should i) (learn|study|read|watch|review)|things to learn|learn this week)\b/.test(t)?{mode:`intent`,intent:`learn`}:/\breference(s)?|look up|look back\b/.test(t)?{mode:`intent`,intent:`reference`}:{mode:`search`}}var ts={learn:`var(--learn)`,act:`var(--act)`,reference:`var(--ref)`,ephemeral:`var(--eph)`};function ns(e){return e>=.7?`var(--done)`:e>=.5?`var(--learn)`:`var(--paper)`}function rs({capture:e,onExpand:t,expanded:n,onPick:r}){let i=e.summary||e.raw||`—`,a=i.length>110?i.slice(0,110)+`…`:i;return(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow-sm)`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,cursor:`pointer`},onClick:t,children:[e.score!==void 0&&(0,O.jsxs)(`span`,{className:`font-mono`,style:{flexShrink:0,fontSize:10,fontWeight:700,letterSpacing:`0.06em`,background:ns(e.score),color:`var(--ink)`,border:`2px solid var(--line)`,padding:`2px 6px`,minWidth:46,textAlign:`center`},children:[Math.round(e.score*100),`%`]}),e.intent&&(0,O.jsx)(`span`,{style:{flexShrink:0,width:8,height:8,borderRadius:`50%`,background:ts[e.intent]||`var(--line)`},title:e.intent}),(0,O.jsx)(`span`,{style:{flex:1,fontSize:13,lineHeight:1.4,fontWeight:500,color:`var(--ink)`},children:n?i:a}),(0,O.jsx)(`span`,{style:{flexShrink:0,fontSize:14,color:`var(--ink-soft)`,transform:n?`rotate(180deg)`:`none`,transition:`transform 0.15s`},children:`▾`})]}),n&&(0,O.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`},children:[(0,O.jsx)(ve,{capture:e,variant:`feed`}),r&&(0,O.jsx)(`div`,{style:{padding:`0 12px 10px`,display:`flex`,justifyContent:`flex-end`},children:(0,O.jsx)(`button`,{onClick:()=>r(e),className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`5px 12px`,border:`2px solid var(--line)`,background:`var(--paper)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`2px 2px 0 var(--line)`},children:`Open in home →`})})]})]})}function is({onPick:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(`search`),[s,c]=(0,l.useState)(void 0),[u,d]=(0,l.useState)([]),[f,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)({text:``,tension:null,loading:!1,done:!1}),[y,b]=(0,l.useState)({gap:``,questions:[],loading:!1,done:!1}),[x,S]=(0,l.useState)({questions:[],answers:[],grades:[],loadingQuestions:!1,gradingLoading:!1,graded:!1,open:!1}),[C,w]=(0,l.useState)({periods:[],loading:!1,done:!1}),ee=(0,l.useRef)(null),te=(0,l.useRef)(null);(0,l.useEffect)(()=>{ee.current?.focus()},[]);let T=(0,l.useCallback)(()=>{i(``),o(`search`),c(void 0),d([]),g(null),v({text:``,tension:null,loading:!1,done:!1}),b({gap:``,questions:[],loading:!1,done:!1}),S({questions:[],answers:[],grades:[],loadingQuestions:!1,gradingLoading:!1,graded:!1,open:!1}),w({periods:[],loading:!1,done:!1})},[]),re=(0,l.useCallback)(async e=>{let t=e.trim();if(!t)return;let n=es(t);i(t),o(n.mode),c(n.intent),g(null),v({text:``,tension:null,loading:!1,done:!1}),b({gap:``,questions:[],loading:!1,done:!1}),m(!0),d(n.mode===`intent`&&n.intent?await p(n.intent).catch(()=>[]):await ne(t).catch(()=>[])),m(!1)},[]),ce=.5,le=u.filter(e=>e.score===void 0||e.score>=ce).slice(0,8),D=(0,l.useCallback)(async()=>{if(!r||!u.length)return;v(e=>({...e,loading:!0,done:!1,error:void 0}));let e=(le.length>0?le:u.slice(0,5)).map(e=>e.id);try{let t=await ie(r,e);v({text:t.synthesis,tension:t.tension,loading:!1,done:!0}),setTimeout(()=>te.current?.scrollIntoView({behavior:`smooth`,block:`start`}),80)}catch(e){v({text:``,tension:null,loading:!1,done:!0,error:String(e)})}},[r,le]),ue=(0,l.useCallback)(async()=>{if(!r||!_.text)return;b(e=>({...e,loading:!0}));let e=await E(r,_.text).catch(()=>({gap:``,questions:[]}));b({gap:e.gap,questions:e.questions,loading:!1,done:!0})},[r,_.text]),de=(0,l.useMemo)(()=>{if(u.length<3)return 0;let e=u.map(e=>e.created_at?.slice(0,10)).filter(Boolean).sort();return e.length<2?0:Math.floor((new Date(e[e.length-1]).getTime()-new Date(e[0]).getTime())/864e5)},[u]),fe=(0,l.useCallback)(async()=>{if(!r||!le.length)return;S(e=>({...e,open:!0,loadingQuestions:!0,questions:[],answers:[],grades:[],graded:!1}));let e=le.map(e=>e.id);try{let t=await ae(r,e);S(e=>({...e,loadingQuestions:!1,questions:t.questions,answers:t.questions.map(()=>``),grades:t.questions.map(()=>null)}))}catch{S(e=>({...e,loadingQuestions:!1}))}},[r,le]),k=(0,l.useCallback)(async()=>{let e=le.map(e=>e.id),t=x.questions.map((e,t)=>({question:e,answer:x.answers[t]??``}));S(e=>({...e,gradingLoading:!0}));try{let n=await oe(t,e);S(e=>({...e,gradingLoading:!1,graded:!0,grades:n.grades}))}catch{S(e=>({...e,gradingLoading:!1,graded:!0}))}},[x.questions,x.answers,le]),A=(0,l.useCallback)(async()=>{if(!r||!u.length)return;w({periods:[],loading:!0,done:!1});let e=u.map(e=>e.id);try{w({periods:(await se(r,e)).periods,loading:!1,done:!0})}catch{w({periods:[],loading:!1,done:!0})}},[r,u]);function pe(e){e.key===`Enter`&&re(t)}let me=r.length>0;return(0,O.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`30px 30px 60px`},children:(0,O.jsxs)(`div`,{style:{maxWidth:740,margin:`0 auto`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`stretch`,border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow)`,marginBottom:20},children:[(0,O.jsx)(`div`,{style:{display:`grid`,placeItems:`center`,padding:`0 16px`,borderRight:`var(--bw) solid var(--line)`},children:(0,O.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 26 26`,children:[(0,O.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`,fill:`none`,stroke:`var(--ink)`,strokeWidth:`2.6`}),(0,O.jsx)(`line`,{x1:`16`,y1:`16`,x2:`21`,y2:`21`,stroke:`var(--ink)`,strokeWidth:`2.6`,strokeLinecap:`round`})]})}),(0,O.jsx)(`input`,{ref:ee,value:t,onChange:e=>n(e.target.value),onKeyDown:pe,placeholder:`Ask your mycelium… (press Enter)`,style:{flex:1,border:`none`,outline:`none`,background:`var(--card)`,fontSize:20,fontWeight:500,padding:`18px 16px`,color:`var(--ink)`}}),t&&(0,O.jsx)(`button`,{onClick:()=>{n(``),T(),ee.current?.focus()},style:{alignSelf:`center`,marginRight:8,background:`transparent`,border:`none`,color:`var(--ink-soft)`,cursor:`pointer`,fontSize:18,padding:`4px 8px`},children:`✕`})]}),!me&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:12},children:`Try asking…`}),(0,O.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:10},children:$o.map(e=>(0,O.jsx)(`button`,{onClick:()=>{n(e),re(e)},style:{fontSize:14,fontWeight:600,padding:`10px 16px`,border:`var(--bw) solid var(--line)`,background:`var(--card)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`var(--shadow-sm)`},children:e},e))}),(0,O.jsx)(`div`,{style:{textAlign:`center`,marginTop:60,opacity:.6},children:(0,O.jsxs)(`p`,{style:{fontWeight:500,fontSize:15},children:[`Find · Synthesize · Extend`,(0,O.jsx)(`br`,{}),(0,O.jsx)(`span`,{style:{fontSize:13,opacity:.7},children:`Your knowledge base, as a thinking partner.`})]})})]}),me&&(0,O.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:24},children:[(0,O.jsxs)(`section`,{children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,display:`flex`,alignItems:`center`,gap:10},children:[(0,O.jsx)(`span`,{style:{width:14,height:14,background:a===`intent`?ts[s??``]??`var(--act)`:`var(--ref)`,border:`2px solid var(--line)`,display:`inline-block`,flexShrink:0}}),f?a===`intent`?`Filtering ${s??``}…`:`Searching…`:a===`intent`?`${u.length} ${s??`intent`} capture${u.length===1?``:`s`}`:`${u.length} note${u.length===1?``:`s`} found`]}),!f&&u.length>0&&(0,O.jsx)(`div`,{style:{display:`flex`,gap:10,alignItems:`center`},children:[`learn`,`act`,`reference`].map(e=>(0,O.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,O.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:ts[e]}}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9,color:`var(--ink-soft)`,fontWeight:700,letterSpacing:`0.06em`},children:e})]},e))})]}),!f&&u.length===0&&(0,O.jsxs)(`div`,{style:{padding:`28px 20px`,border:`2px solid var(--line)`,background:`var(--card)`},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.12em`,color:`var(--ink-soft)`,marginBottom:10},children:`◎ NOTHING CAPTURED ON THIS YET`}),(0,O.jsxs)(`p`,{style:{margin:`0 0 6px`,fontSize:15,fontWeight:500,color:`var(--ink)`},children:[`No notes found for "`,r,`".`]}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:13,color:`var(--ink-soft)`,lineHeight:1.5},children:`Capture a link, note, or image about this topic — then ask again. The more you capture, the richer the synthesis.`})]}),u.length>0&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:u.map(t=>(0,O.jsx)(`div`,{style:{opacity:t.score!==void 0&&t.scoreg(h===t.id?null:t.id),onPick:e})},t.id))}),u.some(e=>e.score!==void 0)&&(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,marginTop:6,letterSpacing:`0.06em`},children:[le.length,` of `,u.length,` notes above `,50,`% relevance — dimmed ones excluded from synthesis`]}),!_.done&&!_.loading&&(()=>{let e=le.length>0,t=u.slice(0,5);return(0,O.jsxs)(`div`,{style:{marginTop:10},children:[!e&&u.length>0&&(0,O.jsxs)(`div`,{style:{fontSize:13,fontWeight:500,color:`var(--ink-soft)`,marginBottom:8,display:`flex`,alignItems:`center`,gap:6},children:[(0,O.jsx)(`span`,{children:`⚠`}),` All matches below `,50,`% relevance — synthesis may be loosely grounded`]}),(0,O.jsxs)(`button`,{onClick:D,style:{width:`100%`,fontSize:13,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`12px 0`,border:e?`var(--bw) solid var(--line)`:`2px dashed var(--line)`,background:e?`var(--ink)`:`var(--card)`,color:e?`var(--paper)`:`var(--ink-soft)`,cursor:`pointer`,boxShadow:e?`var(--shadow-sm)`:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8},children:[(0,O.jsx)(`span`,{children:`✦`}),e?`Synthesize from ${le.length} relevant note${le.length===1?``:`s`}`:`Synthesize anyway from best ${t.length} matches`]})]})})()]})]}),(_.loading||_.done)&&(0,O.jsxs)(`section`,{ref:te,style:{animation:`pop-in .2s ease both`},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:12,display:`flex`,alignItems:`center`,gap:10},children:[(0,O.jsx)(`span`,{style:{width:14,height:14,background:`var(--learn)`,border:`2px solid var(--line)`,display:`inline-block`,flexShrink:0}}),_.loading?`Synthesizing…`:`Synthesis`]}),_.loading&&(0,O.jsx)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,padding:`20px 18px`,boxShadow:`var(--shadow-sm)`},children:(0,O.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,opacity:.5},children:[(0,O.jsx)(`span`,{style:{fontSize:18},children:`✦`}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,fontWeight:700,letterSpacing:`0.1em`},children:`Reading your notes…`})]})}),_.done&&_.text&&(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--ink)`,color:`var(--paper)`,padding:`20px`,boxShadow:`var(--shadow)`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`flex-start`,marginBottom:14},children:[(0,O.jsx)(`span`,{style:{flexShrink:0,width:26,height:26,display:`grid`,placeItems:`center`,background:`var(--learn)`,border:`2.5px solid var(--paper)`,fontWeight:700,fontSize:14,color:`var(--ink)`},children:`✦`}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:16,lineHeight:1.6,fontWeight:500},children:_.text})]}),_.tension&&(0,O.jsxs)(`div`,{style:{marginTop:14,padding:`10px 14px`,background:`rgba(255,93,57,0.15)`,border:`2px solid var(--act)`,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,O.jsx)(`span`,{style:{fontSize:14,flexShrink:0},children:`⚡`}),(0,O.jsxs)(`p`,{className:`font-mono`,style:{margin:0,fontSize:12,lineHeight:1.5,color:`var(--act)`,fontWeight:700},children:[`TENSION: `,_.tension]})]}),(!y.done||!x.open)&&(0,O.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:8},children:[!y.done&&!y.loading&&(0,O.jsx)(`button`,{onClick:ue,style:{flex:1,fontSize:12,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`10px 0`,border:`2px solid var(--paper)`,background:`transparent`,color:`var(--paper)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:`→ What am I missing?`}),!x.open&&le.length>0&&(0,O.jsx)(`button`,{onClick:fe,style:{flex:1,fontSize:12,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`10px 0`,border:`2px solid var(--learn)`,background:`transparent`,color:`var(--learn)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:`🧠 Test yourself`})]})]}),_.done&&!_.text&&(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,padding:`16px 18px`,boxShadow:`var(--shadow-sm)`,borderLeft:`6px solid var(--ref)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:16},children:[(0,O.jsx)(`p`,{className:`font-mono`,style:{margin:0,fontSize:12,fontWeight:700,color:`var(--ink-soft)`},children:_.error?.includes(`HTTP`)?`Server error — restart the backend and try again.`:_.error?.includes(`Empty`)?`LM returned empty response — model may still be loading. Try again.`:_.error?_.error:`No notes have summaries yet — captures may still be processing.`}),(0,O.jsx)(`button`,{onClick:D,className:`font-mono`,style:{flexShrink:0,fontSize:11,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`6px 12px`,border:`2px solid var(--line)`,background:`var(--paper)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`2px 2px 0 var(--line)`},children:`↺ Retry`})]})]}),(y.loading||y.done)&&(0,O.jsxs)(`section`,{style:{animation:`pop-in .2s ease both`},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:12,display:`flex`,alignItems:`center`,gap:10},children:[(0,O.jsx)(`span`,{style:{width:14,height:14,background:`var(--act)`,border:`2px solid var(--line)`,display:`inline-block`,flexShrink:0}}),y.loading?`Finding gaps…`:`Extend your knowledge`]}),y.loading&&(0,O.jsx)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,padding:`20px 18px`,boxShadow:`var(--shadow-sm)`,opacity:.6},children:(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,fontWeight:700,letterSpacing:`0.1em`},children:`Identifying gaps…`})}),y.done&&(y.gap||y.questions.length>0)&&(0,O.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[y.gap&&(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow)`,padding:`16px 18px`,borderLeft:`6px solid var(--act)`},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--act)`,marginBottom:8},children:`Gap in your knowledge`}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:15,lineHeight:1.5,fontWeight:500,color:`var(--ink)`},children:y.gap})]}),y.questions.length>0&&(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow)`,padding:`16px 18px`},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:12},children:`Questions to capture answers to`}),(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:y.questions.map((e,t)=>(0,O.jsxs)(`div`,{style:{display:`flex`,gap:12,alignItems:`flex-start`,padding:`10px 12px`,border:`2px solid var(--line)`,background:`var(--paper)`},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{flexShrink:0,width:22,height:22,display:`grid`,placeItems:`center`,background:`var(--ink)`,color:`var(--paper)`,fontSize:11,fontWeight:700},children:t+1}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:14,lineHeight:1.45,fontWeight:500,color:`var(--ink)`},children:e})]},t))})]})]}),y.done&&!y.gap&&y.questions.length===0&&(0,O.jsx)(`div`,{style:{padding:`14px 0`,opacity:.5},children:(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:12,fontWeight:700},children:`Could not generate extensions — try again.`})})]}),x.open&&(0,O.jsxs)(`section`,{style:{animation:`pop-in .2s ease both`},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:12,display:`flex`,alignItems:`center`,gap:10},children:[(0,O.jsx)(`span`,{style:{width:14,height:14,background:`var(--learn)`,border:`2px solid var(--line)`,display:`inline-block`,flexShrink:0}}),`Test yourself — Feynman mode`]}),x.loadingQuestions&&(0,O.jsx)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,padding:`18px`,opacity:.6},children:(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,fontWeight:700,letterSpacing:`0.1em`},children:`Generating questions…`})}),!x.loadingQuestions&&x.questions.length>0&&(0,O.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[x.graded&&(0,O.jsx)(`div`,{style:{padding:`12px 16px`,border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow)`},children:(()=>{let e=x.grades.filter(e=>e?.verdict===`right`).length,t=x.questions.length;return(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:13,fontWeight:700},children:[e,`/`,t,` correct ·`,` `,(0,O.jsx)(`span`,{style:{color:e===t?`var(--done)`:e>=t/2?`var(--learn)`:`var(--act)`},children:e===t?`You nailed it`:e>=t/2?`Solid understanding`:`Review these notes again`})]})})()}),x.questions.map((e,t)=>{let n=x.graded?x.grades[t]:null,r=n?.verdict===`right`?`var(--done)`:n?.verdict===`partial`?`var(--learn)`:n?.verdict===`wrong`?`var(--act)`:`var(--paper)`;return(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow-sm)`,overflow:`hidden`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,gap:10,padding:`12px 14px`,borderBottom:n?`var(--bw) solid var(--line)`:`none`,alignItems:`flex-start`},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{flexShrink:0,width:22,height:22,display:`grid`,placeItems:`center`,background:n?r:`var(--ink)`,color:`var(--paper)`,fontSize:11,fontWeight:700,border:`2px solid var(--line)`},children:t+1}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:15,lineHeight:1.45,fontWeight:600,flex:1},children:e}),n&&(0,O.jsx)(`span`,{className:`font-mono`,style:{flexShrink:0,fontSize:10,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`3px 8px`,border:`2px solid var(--line)`,background:r,boxShadow:`2px 2px 0 var(--line)`,color:`var(--ink)`},children:n.verdict})]}),(0,O.jsx)(`div`,{style:{padding:`10px 14px`},children:x.graded?(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`p`,{style:{margin:`0 0 6px`,fontSize:14,color:`var(--ink-soft)`,fontStyle:`italic`},children:[`"`,x.answers[t]||`(no answer)`,`"`]}),n?.feedback&&(0,O.jsxs)(`p`,{className:`font-mono`,style:{margin:0,fontSize:11,fontWeight:700,color:`var(--ink-soft)`},children:[`↳ `,n.feedback]})]}):(0,O.jsx)(`textarea`,{value:x.answers[t]??``,onChange:e=>{let n=[...x.answers];n[t]=e.target.value,S(e=>({...e,answers:n}))},placeholder:`Type your answer…`,rows:3,style:{width:`100%`,border:`2px solid var(--line)`,background:`var(--paper)`,color:`var(--ink)`,fontSize:14,padding:`8px 10px`,resize:`vertical`,outline:`none`,fontFamily:`inherit`,boxSizing:`border-box`}})})]},t)}),!x.graded&&(()=>{let e=x.answers.filter(e=>e.trim().length>0).length,t=e===x.questions.length;return(0,O.jsxs)(`div`,{children:[!t&&!x.gradingLoading&&(0,O.jsxs)(`p`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,color:`var(--ink-soft)`,letterSpacing:`0.08em`,marginBottom:8},children:[e,`/`,x.questions.length,` answered — fill in all answers before submitting`]}),(0,O.jsx)(`button`,{onClick:k,disabled:x.gradingLoading||!t,style:{width:`100%`,fontSize:13,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`12px 0`,border:`var(--bw) solid var(--line)`,background:t?`var(--ink)`:`var(--card)`,color:t?`var(--paper)`:`var(--ink-soft)`,cursor:x.gradingLoading||!t?`default`:`pointer`,boxShadow:t?`var(--shadow-sm)`:`none`,opacity:x.gradingLoading?.6:1},children:x.gradingLoading?`Grading…`:`Submit for grading`})]})})(),x.graded&&(0,O.jsx)(`button`,{onClick:()=>S(e=>({...e,graded:!1,grades:e.questions.map(()=>null),answers:e.questions.map(()=>``)})),className:`font-mono`,style:{alignSelf:`flex-start`,fontSize:11,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`6px 12px`,border:`2px solid var(--line)`,background:`var(--paper)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`2px 2px 0 var(--line)`},children:`↺ Try again`})]})]}),!C.done&&!C.loading&&de>=14&&_.done&&(0,O.jsx)(`section`,{children:(0,O.jsxs)(`button`,{onClick:A,style:{width:`100%`,fontSize:12,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`11px 0`,border:`2px dashed var(--line)`,background:`var(--card)`,color:`var(--ink-soft)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8},children:[`📅 How my thinking on this evolved (`,de,`d span)`]})}),(C.loading||C.done)&&(0,O.jsxs)(`section`,{style:{animation:`pop-in .2s ease both`},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.15em`,textTransform:`uppercase`,color:`var(--ink-soft)`,marginBottom:12,display:`flex`,alignItems:`center`,gap:10},children:[(0,O.jsx)(`span`,{style:{width:14,height:14,background:`var(--ref)`,border:`2px solid var(--line)`,display:`inline-block`,flexShrink:0}}),C.loading?`Tracing your arc…`:`Learning arc`]}),C.loading&&(0,O.jsx)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,padding:`18px`,opacity:.6},children:(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,fontWeight:700,letterSpacing:`0.1em`},children:`Mapping how your understanding evolved…`})}),C.done&&C.periods.length>0&&(0,O.jsxs)(`div`,{style:{position:`relative`,paddingLeft:28},children:[(0,O.jsx)(`div`,{style:{position:`absolute`,left:10,top:12,bottom:12,width:3,background:`var(--line)`}}),C.periods.map((e,t)=>{let n=.5+t/Math.max(1,C.periods.length-1)*.5;return(0,O.jsxs)(`div`,{style:{position:`relative`,marginBottom:16},children:[(0,O.jsx)(`div`,{style:{position:`absolute`,left:-22,top:14,width:13,height:13,borderRadius:`50%`,background:`var(--ref)`,border:`2.5px solid var(--ink)`,opacity:n}}),(0,O.jsxs)(`div`,{style:{border:`var(--bw) solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow-sm)`,padding:`14px 16px`,opacity:n},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:8},children:[(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`3px 8px`,border:`2px solid var(--line)`,background:`var(--paper)`,boxShadow:`2px 2px 0 var(--line)`},children:e.label}),(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,fontWeight:700},children:[e.start_date?.slice(0,10),e.end_date&&e.end_date!==e.start_date?` → ${e.end_date?.slice(0,10)}`:``,` · `,e.capture_count,` note`,e.capture_count===1?``:`s`]})]}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:15,lineHeight:1.5,fontWeight:500},children:e.insight})]})]},t)})]}),C.done&&C.periods.length===0&&(0,O.jsx)(`div`,{style:{padding:`14px 0`,opacity:.5},children:(0,O.jsx)(`p`,{className:`font-mono`,style:{fontSize:12,fontWeight:700},children:`Could not identify distinct phases — captures may span too short a period.`})})]})]})]})})}var as=[`learn`,`act`,`reference`,`ephemeral`,`other`],os={learn:`var(--learn)`,act:`var(--act)`,reference:`var(--ref)`,ephemeral:`var(--eph)`,other:`var(--paper)`},ss={learn:`Learning`,act:`To do`,reference:`Reference`,ephemeral:`Fleeting`,other:`Other`};function cs(e){return new Date(e+`T12:00:00`).toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`})}function ls(e){return e===new Date().toISOString().slice(0,10)}function us({dates:e}){let t=e.slice(0,7),n=Math.max(...t.map(e=>e.count),1);return(0,O.jsxs)(`div`,{style:{padding:`20px 24px`},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.12em`,color:`var(--ink-soft)`,marginBottom:14},children:[`LAST 7 DAYS — `,t.reduce((e,t)=>e+t.count,0),` CAPTURES`]}),(0,O.jsx)(`div`,{style:{display:`flex`,alignItems:`flex-end`,gap:6,height:60},children:t.map(e=>(0,O.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:4},children:[(0,O.jsx)(`div`,{style:{width:`100%`,height:Math.max(4,e.count/n*48),background:ls(e.date)?`var(--learn)`:`var(--ink)`,border:`1.5px solid var(--line)`,transition:`height .3s ease`}}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9,color:`var(--ink-soft)`,fontWeight:700},children:new Date(e.date+`T12:00:00`).toLocaleDateString(`en-US`,{weekday:`narrow`})}),e.count>0&&(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:9,color:`var(--ink)`,fontWeight:700},children:e.count})]},e.date))})]})}var ds={},fs=new Set,ps={},ms=new Set;function hs({onPick:e}){let t=new Date().toISOString().slice(0,10),[n,r]=(0,l.useState)(`day`),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(t),[c,u]=(0,l.useState)({}),[d,f]=(0,l.useState)(!0),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(!1),[ee,te]=(0,l.useState)(0);(0,l.useEffect)(()=>{if(n!==`week`||i.length===0)return;let e=i.slice(0,7),t=e.filter(e=>ds[e.date]).map(e=>({date:e.date,synthesis:ds[e.date],count:e.count})),r=e.map(e=>e.date).join(`-`)+`|${t.length}`;S(ps[r]??null),!ms.has(r)&&(t.length<2||(ms.add(r),w(!0),ce(t).then(e=>{ps[r]=e.synthesis,S(e.synthesis)}).catch(()=>{}).finally(()=>w(!1))))},[n,i,ee]),(0,l.useEffect)(()=>{re().then(a).catch(()=>{})},[]),(0,l.useEffect)(()=>{f(!0),v(!1),b(!1),m(ds[o]??null),g(!1),T(o).then(e=>{u(e),f(!1);let t=as.flatMap(t=>e[t]??[]);if(t.length>0&&!fs.has(o)){fs.add(o),g(!0);let e=ls(o)?`today`:cs(o);le(t.map(e=>e.id),e).then(e=>{ds[o]=e.synthesis,m(e.synthesis),te(e=>e+1)}).catch(()=>{}).finally(()=>g(!1))}}).catch(()=>{u({}),f(!1)})},[o]);let ne=(0,l.useMemo)(()=>as.flatMap(e=>c[e]??[]),[c]),ie=(0,l.useMemo)(()=>{let e=[];for(let t of[`learn`,`act`,`reference`]){let n=c[t]??[];if(n.length>0&&e.push(n[0]),e.length>=3)break}if(e.length<2)for(let t of[`ephemeral`,`other`]){let n=c[t]??[];if(n.length>0&&!e.find(e=>e.id===n[0].id)&&(e.push(n[0]),e.length>=2))break}return e},[c]),ae=(0,l.useMemo)(()=>new Set(ie.map(e=>e.id)),[ie]),oe=(0,l.useMemo)(()=>ne.filter(e=>!ae.has(e.id)),[ne,ae]),se=as.filter(e=>c[e]?.length>0).map(e=>({key:e,items:c[e]})),E=ls(o)?new Date().toLocaleDateString(`en-US`,{weekday:`long`,month:`long`,day:`numeric`}):cs(o);return(0,O.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`28px 30px`,position:`relative`},children:[(0,O.jsxs)(`div`,{style:{maxWidth:760,margin:`0 auto`},children:[(0,O.jsx)(`div`,{style:{display:`flex`,gap:0,marginBottom:20,border:`2px solid var(--line)`,width:`fit-content`},children:[`day`,`week`].map(e=>(0,O.jsx)(`button`,{onClick:()=>r(e),className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.1em`,textTransform:`uppercase`,padding:`7px 20px`,border:`none`,borderRight:e===`day`?`2px solid var(--line)`:`none`,background:n===e?`var(--ink)`:`var(--card)`,color:n===e?`var(--paper)`:`var(--ink)`,cursor:`pointer`},children:e===`day`?`Daily`:`Weekly`},e))}),n===`week`?(0,O.jsxs)(`div`,{style:{border:`2px solid var(--line)`,background:`var(--card)`,boxShadow:`var(--shadow-sm)`},children:[(0,O.jsxs)(`div`,{style:{background:`var(--ink)`,color:`var(--paper)`,padding:`22px 24px`,borderBottom:`2px solid var(--line)`},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,marginBottom:x||C?16:0},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,letterSpacing:`0.15em`,color:`var(--learn)`,fontWeight:700,marginBottom:4},children:`WEEKLY OVERVIEW`}),(0,O.jsxs)(`div`,{style:{fontSize:26,fontWeight:700,letterSpacing:`-0.01em`},children:[i.slice(0,7).reduce((e,t)=>e+t.count,0),` captures this week`]})]}),(0,O.jsxs)(`div`,{style:{textAlign:`right`,flexShrink:0,marginLeft:16},children:[(0,O.jsxs)(`div`,{style:{fontSize:32,fontWeight:700,lineHeight:1,color:`var(--learn)`},children:[i.slice(0,7).filter(e=>ds[e.date]).length,(0,O.jsxs)(`span`,{style:{fontSize:16,opacity:.6},children:[`/`,Math.min(i.length,7)]})]}),(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,letterSpacing:`0.08em`,opacity:.7},children:`DAYS REVIEWED`})]})]}),C&&(0,O.jsxs)(`div`,{style:{borderTop:`1px solid rgba(255,255,255,0.15)`,paddingTop:14},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,color:`var(--learn)`,letterSpacing:`0.08em`,fontWeight:700,marginBottom:6},children:`◌ Finding threads across your week…`}),(0,O.jsx)(`div`,{style:{height:12,background:`rgba(255,255,255,0.1)`,borderRadius:2,width:`70%`,marginBottom:6}}),(0,O.jsx)(`div`,{style:{height:12,background:`rgba(255,255,255,0.07)`,borderRadius:2,width:`55%`,marginBottom:6}}),(0,O.jsx)(`div`,{style:{height:12,background:`rgba(255,255,255,0.04)`,borderRadius:2,width:`40%`}})]}),x&&!C&&(0,O.jsxs)(`div`,{style:{borderTop:`1px solid rgba(255,255,255,0.15)`,paddingTop:14},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,color:`var(--learn)`,letterSpacing:`0.12em`,fontWeight:700,marginBottom:8},children:`◆ THIS WEEK'S THREAD`}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:15,lineHeight:1.6,color:`rgba(255,255,255,0.9)`},children:x})]}),!x&&!C&&i.slice(0,7).filter(e=>ds[e.date]).length<2&&(0,O.jsx)(`div`,{style:{borderTop:`1px solid rgba(255,255,255,0.15)`,paddingTop:14},children:(0,O.jsx)(`p`,{className:`font-mono`,style:{margin:0,fontSize:11,color:`rgba(255,255,255,0.4)`,letterSpacing:`0.04em`},children:`Visit at least 2 daily briefs to unlock the weekly thread synthesis.`})})]}),(0,O.jsx)(us,{dates:i})]}):(0,O.jsxs)(O.Fragment,{children:[i.length>1&&(0,O.jsxs)(`div`,{style:{display:`flex`,gap:6,overflowX:`auto`,marginBottom:20,paddingBottom:4},children:[(0,O.jsx)(`button`,{onClick:()=>s(t),className:`font-mono`,style:{flexShrink:0,fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`5px 12px`,border:`2.5px solid var(--line)`,background:o===t?`var(--ink)`:`var(--card)`,color:o===t?`var(--paper)`:`var(--ink)`,cursor:`pointer`,boxShadow:o===t?`none`:`2px 2px 0 var(--line)`},children:`Today`}),i.filter(e=>e.date!==t).map(e=>(0,O.jsxs)(`button`,{onClick:()=>s(e.date),className:`font-mono`,style:{flexShrink:0,fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`5px 12px`,border:`2.5px solid var(--line)`,background:o===e.date?`var(--ink)`:`var(--card)`,color:o===e.date?`var(--paper)`:`var(--ink)`,cursor:`pointer`,boxShadow:o===e.date?`none`:`2px 2px 0 var(--line)`},children:[cs(e.date),(0,O.jsx)(`span`,{style:{marginLeft:5,opacity:.5},children:e.count})]},e.date))]}),(0,O.jsxs)(`div`,{style:{background:`var(--ink)`,color:`var(--paper)`,border:`var(--bw) solid var(--line)`,boxShadow:`var(--shadow)`,padding:`22px 24px`,marginBottom:24},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,marginBottom:p||h?16:0},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,letterSpacing:`0.18em`,color:`var(--learn)`,fontWeight:700,marginBottom:4},children:E.toUpperCase()}),(0,O.jsx)(`div`,{style:{fontSize:28,fontWeight:700,letterSpacing:`-0.02em`},children:ls(o)?`Daily Brief`:`Past Brief`})]}),(0,O.jsxs)(`div`,{style:{textAlign:`right`,flexShrink:0,marginLeft:16},children:[(0,O.jsx)(`div`,{style:{fontSize:38,fontWeight:700,lineHeight:1,color:`var(--learn)`},children:d?`—`:ne.length}),(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,letterSpacing:`0.1em`,opacity:.7},children:`CAPTURES`})]})]}),h&&(0,O.jsxs)(`div`,{style:{borderTop:`1px solid rgba(255,255,255,0.15)`,paddingTop:14},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,color:`var(--learn)`,letterSpacing:`0.08em`,fontWeight:700,marginBottom:6},children:`◌ Synthesizing…`}),(0,O.jsx)(`div`,{style:{height:12,background:`rgba(255,255,255,0.1)`,borderRadius:2,width:`60%`,marginBottom:6}}),(0,O.jsx)(`div`,{style:{height:12,background:`rgba(255,255,255,0.07)`,borderRadius:2,width:`80%`,marginBottom:6}}),(0,O.jsx)(`div`,{style:{height:12,background:`rgba(255,255,255,0.05)`,borderRadius:2,width:`45%`}})]}),p&&!h&&(0,O.jsxs)(`div`,{style:{borderTop:`1px solid rgba(255,255,255,0.15)`,paddingTop:14},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:10,color:`var(--learn)`,letterSpacing:`0.12em`,fontWeight:700,marginBottom:8},children:`◆ TODAY'S SYNTHESIS`}),(0,O.jsx)(`p`,{style:{margin:0,fontSize:15,lineHeight:1.6,color:`rgba(255,255,255,0.9)`,fontWeight:400},children:p})]})]}),d&&(0,O.jsx)(`div`,{style:{textAlign:`center`,padding:`40px 0`,opacity:.5},children:(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,fontWeight:700,letterSpacing:`0.1em`},children:`Loading…`})}),!d&&ne.length===0&&(0,O.jsxs)(`div`,{style:{textAlign:`center`,padding:`60px 0`,opacity:.6},children:[(0,O.jsx)(`div`,{style:{fontSize:40},children:`◎`}),(0,O.jsx)(`p`,{style:{fontWeight:500,marginTop:8},children:ls(o)?`Nothing captured today yet.`:`No captures found for this date.`})]}),!d&&ie.length>0&&(0,O.jsxs)(`section`,{style:{marginBottom:28},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,O.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.12em`,color:`var(--ink-soft)`},children:`◆ HIGHLIGHTS`}),(0,O.jsx)(`div`,{style:{flex:1,height:1,background:`var(--line)`}}),(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,fontWeight:700},children:[ie.length,` of `,ne.length]})]}),(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:11},children:ie.map(t=>(0,O.jsx)(ve,{capture:t,variant:`feed`,onPick:e},t.id))})]}),!d&&oe.length>0&&(0,O.jsxs)(`section`,{style:{marginBottom:24},children:[(0,O.jsxs)(`button`,{onClick:()=>v(e=>!e),style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,background:`none`,border:`none`,cursor:`pointer`,padding:`6px 0`,marginBottom:12},children:[(0,O.jsxs)(`div`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.12em`,color:`var(--ink-soft)`},children:[_?`▾`:`▸`,` ALL CAPTURES`]}),(0,O.jsx)(`div`,{style:{flex:1,height:1,background:`var(--line)`}}),(0,O.jsxs)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,fontWeight:700},children:[oe.length,` more`]})]}),_&&(0,O.jsx)(`div`,{children:se.map(t=>{let n=t.items.filter(e=>!ae.has(e.id));return n.length===0?null:(0,O.jsxs)(`div`,{style:{marginBottom:22},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,O.jsx)(`span`,{style:{width:10,height:10,background:os[t.key],border:`2px solid var(--line)`,flexShrink:0}}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,letterSpacing:`0.08em`,color:`var(--ink-soft)`},children:ss[t.key]??t.key}),(0,O.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--ink-soft)`,marginLeft:`auto`},children:n.length})]}),(0,O.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:n.map(t=>(0,O.jsx)(ve,{capture:t,variant:`feed`,onPick:e},t.id))})]},t.key)})})]}),!d&&ne.length>0&&ls(o)&&(0,O.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,marginTop:30,marginBottom:10},children:(0,O.jsx)(`button`,{onClick:()=>b(!0),disabled:y,style:{fontSize:14,fontWeight:700,letterSpacing:`0.04em`,textTransform:`uppercase`,padding:`12px 26px`,border:`var(--bw) solid var(--line)`,background:y?`var(--card)`:`var(--done)`,color:`var(--ink)`,cursor:y?`default`:`pointer`,boxShadow:y?`none`:`var(--shadow-sm)`},children:y?`✓ Brief read for today`:`Mark brief as read`})})]})]}),y&&(0,O.jsx)(`div`,{style:{position:`absolute`,top:90,left:`50%`,transform:`translateX(-50%) rotate(-12deg)`,pointerEvents:`none`,fontWeight:700,fontSize:56,color:`var(--done)`,border:`6px solid var(--done)`,padding:`4px 20px`,background:`rgba(255,253,246,.65)`,letterSpacing:`0.04em`,animation:`stamp .5s cubic-bezier(.2,1.4,.4,1) both`},children:`READ`})]})}var gs=[`focused`,`curious`,`restless`,`tired`,`inspired`],_s={focused:{emoji:`🎯`,hint:`Tasks & action items`},curious:{emoji:`🔭`,hint:`Deep learning mode`},restless:{emoji:`⚡`,hint:`Browse & variety`},tired:{emoji:`🌙`,hint:`Light content only`},inspired:{emoji:`✨`,hint:`Learn & create`}};function vs({mood:e,onChange:t}){let[n,r]=(0,l.useState)(!1),i=(0,l.useRef)(null);(0,l.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&r(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);function a(e){t(e),r(!1)}return(0,O.jsxs)(`div`,{ref:i,style:{position:`relative`},children:[(0,O.jsx)(`button`,{onClick:()=>r(e=>!e),className:`font-mono`,style:{display:`inline-flex`,alignItems:`center`,gap:6,fontSize:11,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`3px 8px`,border:`2.5px solid var(--line)`,background:e?`var(--ink)`:`var(--card)`,color:e?`var(--paper)`:`var(--ink-soft)`,boxShadow:e?`none`:`2px 2px 0 var(--line)`,cursor:`pointer`},children:e?(0,O.jsxs)(O.Fragment,{children:[_s[e].emoji,` `,e]}):`— mood ▾`}),n&&(0,O.jsxs)(`div`,{style:{position:`absolute`,top:`calc(100% + 6px)`,right:0,zIndex:100,background:`var(--card)`,border:`2.5px solid var(--line)`,boxShadow:`var(--shadow)`,minWidth:200},children:[gs.map(t=>(0,O.jsxs)(`button`,{onClick:()=>a(t),className:`font-mono`,style:{width:`100%`,display:`flex`,alignItems:`center`,gap:10,padding:`9px 14px`,border:`none`,borderBottom:`1px solid var(--line)`,background:e===t?`var(--ink)`:`var(--card)`,color:e===t?`var(--paper)`:`var(--ink)`,cursor:`pointer`,textAlign:`left`},onMouseEnter:n=>{e!==t&&(n.currentTarget.style.background=`var(--paper)`)},onMouseLeave:n=>{e!==t&&(n.currentTarget.style.background=`var(--card)`)},children:[(0,O.jsx)(`span`,{style:{fontSize:14},children:_s[t].emoji}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{style:{fontSize:11,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,display:`block`},children:t}),(0,O.jsx)(`span`,{style:{fontSize:10,fontWeight:500,letterSpacing:`0.04em`,opacity:.6,textTransform:`none`},children:_s[t].hint})]})]},t)),e&&(0,O.jsx)(`button`,{onClick:()=>a(``),className:`font-mono`,style:{width:`100%`,padding:`8px 14px`,border:`none`,background:`var(--paper)`,color:`var(--ink-soft)`,fontSize:10,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,cursor:`pointer`,textAlign:`left`},children:`✕ Clear mood`})]})]})}function ys({size:e=40}){return(0,O.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 40 40`,style:{display:`block`,flexShrink:0},children:[(0,O.jsx)(`line`,{x1:`20`,y1:`20`,x2:`7`,y2:`9`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`line`,{x1:`20`,y1:`20`,x2:`33`,y2:`11`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`line`,{x1:`20`,y1:`20`,x2:`9`,y2:`32`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`line`,{x1:`20`,y1:`20`,x2:`32`,y2:`31`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`circle`,{cx:`7`,cy:`9`,r:`4`,fill:`var(--learn)`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`circle`,{cx:`33`,cy:`11`,r:`3.4`,fill:`var(--act)`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`circle`,{cx:`9`,cy:`32`,r:`3.4`,fill:`var(--ref)`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`circle`,{cx:`32`,cy:`31`,r:`4`,fill:`var(--eph)`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,O.jsx)(`circle`,{cx:`20`,cy:`20`,r:`6`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`2.4`})]})}function bs(){let[e,t]=(0,l.useState)(0),[n,r]=(0,l.useState)(`home`),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(``),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(0),y=(0,l.useRef)(null),b=(0,l.useRef)(null),x=(0,l.useRef)(new Set);function S(e){y.current=e,b.current&&clearInterval(b.current),b.current=setInterval(async()=>{let e=(await f(50).catch(()=>[])).find(e=>e.id===y.current);e?.summary&&e?.intent&&(x.current.has(e.id)||(x.current.add(e.id),g(e)),y.current=null,b.current&&=(clearInterval(b.current),null))},3e3)}(0,l.useEffect)(()=>{f(50).then(e=>{let t=new Date(Date.now()-120*1e3).toISOString().replace(`T`,` `).slice(0,19),n=e.find(e=>e.summary&&e.intent&&!e.summary.startsWith(`⚠`)&&e.created_at&&e.created_at>=t&&!x.current.has(e.id));n&&(x.current.add(n.id),g(n))}).catch(()=>{})},[]),(0,l.useEffect)(()=>()=>{b.current&&clearInterval(b.current)},[]),(0,l.useEffect)(()=>{function e(){w(20).then(e=>v(e.length)).catch(()=>{})}e();let t=setInterval(e,6e4);return()=>clearInterval(t)},[]);let C=(0,l.useCallback)(async e=>{let t=e.related??await m(e.id).catch(()=>[]);u({...e,related:t}),a(n),r(`home`)},[n]);function ee(e){t(e=>e+1),r(`home`),S(e)}function te(){g(null)}function ne(e){g(t=>t?{...t,...e}:null)}return(0,O.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,O.jsxs)(`header`,{style:{display:`flex`,alignItems:`flex-end`,justifyContent:`space-between`,padding:`20px 26px`,borderBottom:`var(--bw) solid var(--line)`,background:`var(--paper)`,color:`var(--ink)`,flexShrink:0},children:[(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[(0,O.jsx)(ys,{size:42}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{style:{fontWeight:700,fontSize:30,letterSpacing:`-0.02em`,lineHeight:1},children:`MYCELIUM`}),(0,O.jsx)(`div`,{className:`font-mono`,style:{marginTop:5,fontSize:11,fontWeight:700,letterSpacing:`0.18em`,textTransform:`uppercase`,opacity:.6},children:`Personal Knowledge Agent`})]})]}),(0,O.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[o!==null&&(0,O.jsxs)(`span`,{className:`font-mono`,style:{display:`inline-flex`,alignItems:`center`,gap:6,fontSize:11,fontWeight:700,letterSpacing:`0.08em`,padding:`3px 8px`,border:`2.5px solid var(--line)`,background:`var(--card)`,boxShadow:`2px 2px 0 var(--line)`},children:[o,` CAPTURES`]}),(0,O.jsx)(vs,{mood:d,onChange:p}),(0,O.jsxs)(`span`,{className:`font-mono`,style:{display:`inline-flex`,alignItems:`center`,gap:6,fontSize:11,fontWeight:700,letterSpacing:`0.08em`,padding:`3px 8px`,border:`2.5px solid var(--line)`,background:`var(--done)`,boxShadow:`2px 2px 0 var(--line)`},children:[(0,O.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--ink)`,display:`inline-block`,animation:`wob 2.4s ease-in-out infinite`}}),`LOCAL`]})]})]}),(0,O.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`,height:`calc(100vh - 93px)`},children:[(0,O.jsx)(Ho,{view:n,setView:r,badges:{review:_}}),n===`home`&&(0,O.jsxs)(`div`,{style:{flex:1,display:`grid`,gridTemplateColumns:`minmax(360px,440px) 1fr`,minHeight:0,overflow:`hidden`},children:[(0,O.jsxs)(`aside`,{style:{borderRight:`var(--bw) solid var(--line)`,display:`flex`,flexDirection:`column`,gap:20,padding:22,overflowY:`auto`},children:[(0,O.jsx)(`div`,{style:{flexShrink:0},children:(0,O.jsx)(de,{onCapture:ee})}),h&&(0,O.jsx)(`div`,{style:{flexShrink:0},children:(0,O.jsx)(Wo,{capture:h,onConfirm:te,onUpdate:ne})}),(0,O.jsx)(`div`,{style:{flexShrink:0},children:(0,O.jsx)(ye,{onPick:C,mood:d})})]}),(0,O.jsx)(`main`,{style:{overflowY:`auto`,padding:22,position:`relative`},children:c?(0,O.jsxs)(`div`,{style:{animation:`pop-in .15s ease both`},children:[(0,O.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:16},children:(0,O.jsxs)(`button`,{onClick:()=>{u(null),i&&i!==`home`&&(r(i),a(null))},className:`font-mono`,style:{fontSize:12,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,padding:`6px 12px`,border:`2px solid var(--line)`,background:`var(--card)`,color:`var(--ink)`,cursor:`pointer`,boxShadow:`2px 2px 0 var(--line)`},children:[`← `,i&&i!==`home`?`Back to ${i}`:`Back`]})}),(0,O.jsx)(ve,{capture:c,variant:`surface`,onAction:()=>u(null),onPick:C})]}):(0,O.jsx)(be,{refreshTrigger:e,onCountChange:s,onPick:C,limit:3,compact:!0,onBrowseAll:()=>r(`browse`)})})]}),n===`ask`&&(0,O.jsx)(is,{onPick:C}),n===`browse`&&(0,O.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:22},children:(0,O.jsx)(De,{onCountChange:s,onPick:C})}),n===`brief`&&(0,O.jsx)(hs,{onPick:C}),n===`review`&&(0,O.jsx)(Qo,{onExit:()=>{r(`home`),w(20).then(e=>v(e.length))}}),n===`graph`&&(0,O.jsx)(`main`,{style:{flex:1,overflow:`hidden`,padding:22},children:(0,O.jsx)(zo,{onPick:C})})]}),(0,O.jsx)(`div`,{className:`font-mono border-t-2 border-[var(--line)] text-center flex-shrink-0`,style:{padding:`8px 0`,fontSize:10,fontWeight:700,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--ink-soft)`,background:`var(--paper)`},children:`Made with ♥ by Ajit & Claude Code`})]})}(0,u.createRoot)(document.getElementById(`root`)).render((0,O.jsx)(l.StrictMode,{children:(0,O.jsx)(bs,{})}));