@dubusoft/toodo-linux-arm64 1.11.1-dev.178 → 1.11.1-dev.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/toodo +0 -0
- package/bin/toodo-server +0 -0
- package/package.json +1 -1
- package/web/assets/Item-BwIA2qYJ.js +2 -0
- package/web/assets/LayoutChangeSnapshot-CKXseiXe.js +1 -0
- package/web/assets/MenuBottomSheet-JyWCs-nD.js +1 -0
- package/web/assets/MenuBottomSheetActionList-VK0x4-S-.js +1 -0
- package/web/assets/Selector-BPVKqXPd.js +2 -0
- package/web/assets/SwipeActionsLayer-DyTcKith.js +1 -0
- package/web/assets/Tooltip-D5RzAbgJ.js +1 -0
- package/web/assets/button-CBaPb4j9.js +1 -0
- package/web/assets/createLucideIcon-DtNDbJdC.js +1 -0
- package/web/assets/details-sheet-CRELNzf_.js +1 -0
- package/web/assets/{event-CB2iK3mK.js → event-COpa9hhp.js} +1 -1
- package/web/assets/focusOutline.stylex-ZXdUNMFw.js +1 -0
- package/web/assets/focusReturn-BAqtMp_d.js +1 -0
- package/web/assets/index-BVWdydjt.js +64 -0
- package/web/assets/index-bmzrMLgi.css +2 -0
- package/web/assets/inputHold-CZa_Ny55.js +1 -0
- package/web/assets/jsx-runtime-C3cWAN_r.js +1 -0
- package/web/assets/markdown-CC5k3Mg1.js +32 -0
- package/web/assets/mergeProps-Poh9JbFs.js +1 -0
- package/web/assets/offline-screen-2u_fz51g.js +1 -0
- package/web/assets/padding.stylex-Q-kmgnXU.js +1 -0
- package/web/assets/primaryClick-88oQu3_u.js +1 -0
- package/web/assets/queries-a7XPgRcU.js +1 -0
- package/web/assets/reducedMotion-DCkUC6gt.js +1 -0
- package/web/assets/resolveSnapPoint-CBS37OcT.js +1 -0
- package/web/assets/review-BJ4W6_x5.js +1 -0
- package/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/web/assets/server-access-CvhYUwwt.js +1 -0
- package/web/assets/task-details-B1CNC08j.js +2 -0
- package/web/assets/task-graph-DSKsuPl9.js +8 -0
- package/web/assets/useDevWarning-DtAYt56R.js +1 -0
- package/web/assets/useLayerDismissal-BWIjwIJ-.js +1 -0
- package/web/assets/useLinkComponent-CqCWDM4X.js +4 -0
- package/web/assets/useTooltip-C_x74aGj.js +1 -0
- package/web/index.html +23 -20
- package/web/sw.js +2 -2
- package/web/version.json +1 -1
- package/web/assets/Item-ZRzKTOOV.js +0 -2
- package/web/assets/ItemSwipeLayer-Cd36YhD2.js +0 -1
- package/web/assets/LayoutChangeSnapshot-B4oZH00p.js +0 -1
- package/web/assets/MenuBottomSheet-DI91g7Ev.js +0 -1
- package/web/assets/MenuBottomSheetActionList-B_oeHm6H.js +0 -1
- package/web/assets/Selector-BwHo8VGI.js +0 -2
- package/web/assets/Tooltip-D2KklOm3.js +0 -1
- package/web/assets/button-BpXTpERz.js +0 -1
- package/web/assets/createLucideIcon-BVHtiYZr.js +0 -1
- package/web/assets/details-sheet-Bmm7uG_t.js +0 -1
- package/web/assets/devWarning-WNHQ_jrU.js +0 -1
- package/web/assets/focusOutline.stylex-C8peqGyQ.js +0 -1
- package/web/assets/focusReturn-sK-DMBDt.js +0 -1
- package/web/assets/index-D-zV9pKv.css +0 -2
- package/web/assets/index-D_3GoUFa.js +0 -58
- package/web/assets/jsx-runtime-D3jfb0Ew.js +0 -1
- package/web/assets/markdown-vYLeEAh6.js +0 -29
- package/web/assets/mergeProps-ptS-gIMz.js +0 -1
- package/web/assets/offline-screen-CD6xBoPC.js +0 -1
- package/web/assets/padding.stylex-DZAzBtx2.js +0 -1
- package/web/assets/presentation-vnGoTO8Y.js +0 -1
- package/web/assets/queries-XyxPBs72.js +0 -1
- package/web/assets/review-7e4-j-Mr.js +0 -1
- package/web/assets/server-access-vaP57Ouf.js +0 -1
- package/web/assets/task-details-CNGTtiAP.js +0 -2
- package/web/assets/task-graph-BPifaqer.js +0 -8
- package/web/assets/useLayerDismissal-DhnWLnTJ.js +0 -1
- package/web/assets/useLinkComponent-Cokdl8Ls.js +0 -4
- package/web/assets/useMediaQuery-oNWJZ4E0.js +0 -1
- package/web/assets/useTooltip-BCo1T06f.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,g as i,i as a,l as o,o as s,t as c}from"./session-sBDFnC3r.js";import{n as l}from"./event-CB2iK3mK.js";var u=e(t(),1),d=n(),f=u.createContext(void 0),p=e=>{let t=u.useContext(f);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},m=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,d.jsx)(f.Provider,{value:e,children:t})),h={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},g=new class{#e=h;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function _(e){setTimeout(e,0)}var v=typeof window>`u`||`Deno`in globalThis;function y(){}function b(e,t){return typeof e==`function`?e(t):e}function ee(e){return typeof e==`number`&&e>=0&&e!==1/0}function te(e,t){return Math.max(e+(t||0)-Date.now(),0)}function x(e,t){return typeof e==`function`?e(t):e}function ne(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ie(o,t.options))return!1}else if(!C(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function re(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(S(t.options.mutationKey)!==S(a))return!1}else if(!C(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ie(e,t){return(t?.queryKeyHashFn||S)(e)}function S(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function C(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!C(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!C(e[r],t[r]))return!1;return!0}return!1}var ae=Object.prototype.hasOwnProperty;function oe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=se(e)&&se(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ae.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=oe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function se(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!ce(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ce(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ce(e){return Object.prototype.toString.call(e)===`[object Object]`}function le(e){return new Promise(t=>{g.setTimeout(t,e)})}function E(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:oe(e,t)}function ue(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function de(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var D=Symbol();function fe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===D?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O(e,t){return typeof e==`function`?e(...t):!!e}function pe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var me=()=>v,k=()=>me(),A=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},j=new class extends A{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},he=_;function ge(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=he,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var M=ge(),N=new class extends A{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)!==`online`||N.isOnline()}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(y);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new ye(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>j.isFocused()&&(e.networkMode===`always`||N.isOnline())&&e.canRun(),p=()=>ve(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(k()?0:3),a=e.retryDelay??_e,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),le(o).then(()=>f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ee(this.gcTime)&&(this.#e=g.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(g.clearTimeout(this.#e),this.#e=void 0)}};function Se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{pe(e,()=>t.signal,()=>n=!0)},u=fe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?de:ue;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Te(e,t){return t?Ce(e,t)!=null:!1}function Ee(e,t){return!t||!e.getPreviousPageParam?!1:we(e,t)!=null}var De=class extends xe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ae(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ae(this.options);e.data!==void 0&&(this.setState(ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=E(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>x(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===D||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>x(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!te(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=fe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Oe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ke(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),M.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Oe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ae(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var je=class extends A{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ne(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof x(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Fe(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||x(this.options.enabled,this.#t)!==x(t.enabled,this.#t)||x(this.options.staleTime,this.#t)!==x(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||x(this.options.enabled,this.#t)!==x(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return w(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(y)),t}#h(e){return!k()&&x(this.options.enabled,this.#t)!==!1&&ee(e)}#g(){this.#b();let e=x(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=te(this.#r.dataUpdatedAt,e)+1;this.#u=g.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return x(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=g.setInterval(()=>{(this.options.refetchIntervalInBackground||j.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(g.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(g.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ne(e,t),o=i&&Fe(e,n,t,r);(a||o)&&(l={...l,...Oe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=E(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=E(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ie(e,t),refetch:this.refetch,isEnabled:x(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),w(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();M.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Me(e,t){return x(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||x(t.retryOnMount,e)!==!1)}function Ne(e,t){return Me(e,t)||e.state.data!==void 0&&Pe(e,t,t.refetchOnMount)}function Pe(e,t,n){if(x(t.enabled,e)!==!1&&x(t.staleTime,e)!==`static`){let r=x(n,e);return r===`always`||r!==!1&&Ie(e,t)}return!1}function Fe(e,t,n,r){return(e!==t||x(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ie(e,n)}function Ie(e,t){return x(t.enabled,e)!==!1&&e.isStaleByTime(x(t.staleTime,e))}var Le=class extends je{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Te(t,n.data),hasPreviousPage:Ee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Re=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ze(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),M.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ze(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Be=class extends A{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),w(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&S(t.mutationKey)!==S(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ze();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){M.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ve=u.createContext(!1),He=()=>u.useContext(Ve);Ve.Provider;function Ue(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var We=u.createContext(Ue()),Ge=()=>u.useContext(We),Ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?O(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},qe=e=>{u.useEffect(()=>{e.clearReset()},[e])},Je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||O(n,[e.error,r])),Ye=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Xe=(e,t)=>e?.suspense&&t.isPending,Ze=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Qe(e,t,n){let r=He(),i=Ge(),a=p(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ye(o),Ke(o,i,s),qe(i);let[l]=u.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),f=!r&&c;if(u.useSyncExternalStore(u.useCallback(e=>{let t=f?l.subscribe(M.batchCalls(e)):y;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u.useEffect(()=>{l.setOptions(o)},[o,l]),Xe(o,d))throw Ze(o,l,i);if(Je({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:l.trackResult(d)}function P(e,t){return Qe(e,je,t)}function F(e,t){let n=p(t),[r]=u.useState(()=>new Be(n,e));u.useEffect(()=>{r.setOptions(e)},[r,e]);let i=u.useSyncExternalStore(u.useCallback(e=>r.subscribe(M.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=u.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(y)},[r]);if(i.error&&O(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function $e(e,t){return Qe(e,Le,t)}var I={planned:`Blocked`,ready:`Ready`,waiting:`Planned`,paused:`Paused`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`,not_adopted:`Not adopted`},et=`Planned on`,tt={neutral:`bg-muted text-foreground/70`,info:`bg-sky-100 text-sky-800 dark:bg-sky-950 dark:text-sky-200`,progress:`bg-blue-100 text-blue-800 dark:bg-blue-950 dark:text-blue-200`,review:`bg-violet-100 text-violet-800 dark:bg-violet-950 dark:text-violet-200`,success:`bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200`,attention:`bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-200`,danger:`bg-rose-100 text-rose-800 dark:bg-rose-950 dark:text-rose-200`},nt={neutral:`text-muted-foreground`,info:`text-sky-700 dark:text-sky-300`,progress:`text-blue-700 dark:text-blue-300`,review:`text-violet-700 dark:text-violet-300`,success:`text-emerald-700 dark:text-emerald-300`,attention:`text-amber-700 dark:text-amber-300`,danger:`text-rose-700 dark:text-rose-300`},rt={neutral:`border-border text-muted-foreground`,info:`border-sky-300 text-sky-700 dark:border-sky-800 dark:text-sky-300`,progress:`border-blue-300 text-blue-700 dark:border-blue-800 dark:text-blue-300`,review:`border-violet-300 text-violet-700 dark:border-violet-800 dark:text-violet-300`,success:`border-emerald-300 text-emerald-700 dark:border-emerald-800 dark:text-emerald-300`,attention:`border-amber-300 text-amber-700 dark:border-amber-800 dark:text-amber-300`,danger:`border-rose-300 text-rose-700 dark:border-rose-800 dark:text-rose-300`},it={info:`border border-sky-300 bg-sky-50 text-sky-900 dark:border-sky-800 dark:bg-sky-950 dark:text-sky-100`,attention:`border border-amber-300 bg-amber-50 text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100`,danger:`border border-rose-300 bg-rose-50 text-rose-900 dark:border-rose-800 dark:bg-rose-950 dark:text-rose-100`},at={neutral:`bg-neutral-400`,info:`bg-sky-500`,progress:`bg-blue-500`,review:`bg-violet-500`,success:`bg-emerald-500`,attention:`bg-amber-500`,danger:`bg-rose-500`},ot={neutral:`border-muted-foreground`,info:`border-sky-500`,progress:`border-blue-500`,review:`border-violet-500`,success:`border-emerald-500`,attention:`border-amber-500`,danger:`border-rose-500 dark:border-rose-400`},st={done:`border-emerald-500 bg-emerald-100 dark:bg-emerald-950`,ready:`border-amber-500 shadow-none`,blocked:`border-dashed border-muted-foreground shadow-none`,paused:`border-dashed border-muted-foreground bg-muted shadow-none`,behindDue:`border-2 border-rose-500 dark:border-rose-400`},ct=`border-foreground/70`,lt=`text-foreground`,ut=[[`plannedAt`,`Planned`],[`startedAt`,`Started`],[`reviewAt`,I.in_review],[`completedAt`,`Completed`],[`reopenedAt`,`Reopened`],[`pausedAt`,I.paused]];function dt(e){let t=new Date(e*1e3),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}var ft=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`,style:`short`}),pt=604800;function mt(e,t=Date.now()/1e3){let n=e-t,r=Math.abs(n);if(r<60)return`just now`;if(r<pt){let[e,t]=r<3600?[Math.trunc(n/60),`minute`]:r<86400?[Math.trunc(n/3600),`hour`]:[Math.trunc(n/86400),`day`];return ft.format(e,t)}let i=new Date(e*1e3),a=i.getFullYear()===new Date(t*1e3).getFullYear();return i.toLocaleDateString(`en`,{month:`short`,day:`numeric`,...a?{}:{year:`numeric`}})}function ht(e,t=Date.now()/1e3){let n=Math.max(0,Math.floor((e-t)/60));if(n<60)return`${n}m`;if(n<1440)return`${Math.floor(n/30)/2}h`;let r=Math.floor(n/1440);return r<14?`${r}d`:r<60?`${Math.floor(r/7)}w`:r<365?`${Math.floor(r/30)}mo`:`${Math.floor(r/365)}y`}function gt(e){return new Date(e*1e3).toLocaleString(`en`,{dateStyle:`medium`,timeStyle:`short`})}function _t(e){let t=[];for(let n of e){let e=t.at(-1);e!==void 0&&e.end===null&&(e.end=n.at),n.status!==`done`&&(n.status===`planned`?t.length>0&&t.push({state:`paused`,start:n.at,end:null,reason:n.reason}):t.push({state:n.status,start:n.at,end:null,reason:null}))}return t}function vt(e,t){return bt(e,t,e=>e!==`paused`)}function yt(e,t){return bt(e,t,e=>e===`paused`)}function bt(e,t,n){let r=_t(e);return r.length===0?null:r.filter(e=>n(e.state)).reduce((e,n)=>e+Math.max((n.end??t)-n.start,0),0)}function xt(e){return ut.flatMap(([t,n])=>{let r=e[t];return r===null?[]:[{label:n,at:r}]}).sort((e,t)=>e.at-t.at)}function St({at:e,prefix:t=``,className:n}){return(0,d.jsx)(`time`,{className:n,dateTime:new Date(e*1e3).toISOString(),title:gt(e),children:`${t}${mt(e)}`})}var Ct=3e4;function wt(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`&&typeof e.code==`string`&&typeof e.message==`string`}async function L(e,t={}){let n=a();if(n===null)throw Error(`No access token for the Toodo server.`);let c=new AbortController,l=setTimeout(()=>c.abort(),Ct),u,d;try{if(u=await i(`/api/rpc/${encodeURIComponent(e)}`,{method:`POST`,headers:{...n,"Content-Type":`application/json`},body:JSON.stringify(t),signal:c.signal}),u.status===401)throw await o(u)?(s(),Error(`The Toodo server did not accept the access token.`)):r();d=await u.text()}catch(t){throw c.signal.aborted?Error(`The Toodo server did not answer ${e} within ${Ct/1e3} s.`):t}finally{clearTimeout(l)}if(u.ok)return d?JSON.parse(d):null;let f=null;try{f=JSON.parse(d)}catch{}throw wt(f)?f:Error(d||`${u.status} ${u.statusText}`)}var R={appInfo:()=>L(`app_info`),checkUpdate:()=>L(`check_update`),listWorkspaces:()=>B(L(`list_workspaces`)),getWorkspace:e=>B(L(`get_workspace`,{id:e})),createWorkspace:e=>B(L(`create_workspace`,{workspace:e})),updateWorkspace:e=>B(L(`update_workspace`,{workspace:e})),deleteWorkspace:e=>B(L(`delete_workspace`,{id:e})),restoreWorkspace:e=>B(L(`restore_workspace`,{id:e})),purgeWorkspace:e=>B(L(`purge_workspace`,{id:e})),listArchive:()=>B(L(`list_archive`)),listGuidelines:e=>B(L(`list_guidelines`,{workspaceId:e})),addGuideline:e=>B(L(`add_guideline`,{guideline:e})),updateGuideline:e=>B(L(`update_guideline`,{guideline:e})),deleteGuideline:e=>B(L(`delete_guideline`,{id:e})),listTasks:e=>B(L(`list_tasks`,{filter:e})),listTaskRelations:()=>B(L(`list_task_relations`)),addTaskRelation:(e,t)=>B(L(`add_task_relation`,{taskId:e,relatedId:t})),removeTaskRelation:(e,t)=>B(L(`remove_task_relation`,{taskId:e,relatedId:t})),getTask:e=>B(L(`get_task`,{id:e})),createTask:e=>B(L(`create_task`,{task:e})),updateTask:e=>B(L(`update_task`,{task:e})),moveTask:(e,t)=>B(L(`move_task`,{id:e,workspaceId:t})),pauseTask:e=>B(L(`pause_task`,{id:e})),waitTask:(e,t,n)=>B(L(`wait_task`,{id:e,until:t,reason:n})),endWait:e=>B(L(`end_wait`,{id:e})),setCompletionNote:(e,t)=>B(L(`set_completion_note`,{id:e,note:t})),reopenTask:(e,t)=>B(L(`reopen_task`,{id:e,reason:t})),setTaskOutcome:(e,t,n)=>B(L(`set_task_outcome`,{id:e,resolution:t,note:n})),checkCriterion:(e,t,n,r)=>B(L(`check_criterion`,{taskId:e,criterionId:t,met:n,evidence:r})),deleteTask:e=>B(L(`delete_task`,{id:e})),deleteDoneTasks:e=>B(L(`delete_done_tasks`,{workspaceId:e})),restoreTask:e=>B(L(`restore_task`,{id:e})),purgeTask:e=>B(L(`purge_task`,{id:e})),addDependency:(e,t,n)=>B(L(`add_dependency`,{taskId:e,dependsOn:t,confirmPause:n})),removeDependency:(e,t)=>B(L(`remove_dependency`,{taskId:e,dependsOn:t})),startTask:(e,t,n)=>B(L(`start_task`,{id:e,reason:t,refs:n})),completeTask:(e,t,n)=>B(L(`complete_task`,{id:e,note:t,refs:n})),concludeTask:(e,t,n,r)=>B(L(`conclude_task`,{id:e,note:t,outcome:n,shippedWith:r})),linkIssue:(e,t)=>B(L(`link_issue`,{id:e,reference:t})),mcpServerInfo:()=>L(`mcp_server_info`),listConnectedApps:()=>B(L(`list_connected_apps`)),revokeConnectedApp:e=>B(L(`revoke_connected_app`,{grantId:e})),reviewPeriod:(e,t)=>B(L(`review_period`,{from:e,to:t})),reviewReport:e=>B(L(`review_report`,{request:e})),getReviewTimeZone:()=>B(L(`get_review_time_zone`)),setReviewTimeZone:e=>B(L(`set_review_time_zone`,{timeZone:e})),saveReviewSnapshot:e=>B(L(`save_review_snapshot`,{request:e})),listReviewSnapshots:()=>B(L(`list_review_snapshots`)),getReviewSnapshot:e=>B(L(`get_review_snapshot`,{id:e})),deleteReviewSnapshot:e=>B(L(`delete_review_snapshot`,{id:e})),getBackupSettings:()=>L(`get_backup_settings`),getBackupStatus:()=>L(`get_backup_status`),saveBackupSettings:e=>B(L(`save_backup_settings`,{settings:e})),listBackups:()=>B(L(`list_backups`)),restoreBackup:e=>B(L(`restore_backup`,{name:e}))},z={tasksChanged:V(`tasks-changed`),workspacesChanged:V(`workspaces-changed`),guidelinesChanged:V(`guidelines-changed`),taskStatusChanged:V(`task-status-changed`),taskReady:V(`task-ready`)};async function B(e){try{return{status:`ok`,data:await e}}catch(e){if(e instanceof Error)throw e;return{status:`error`,error:e}}}function V(e){return{listen:t=>l(e,t)}}function Tt(e){switch(e.code){case`unknownCommand`:case`invalidArguments`:return`This page is out of date with the Toodo server. Reload the page, then try again.`;case`commandPanicked`:return`Something went wrong on the Toodo server. Try again; if it keeps failing, look for "a command panicked" in the toodo-server log.`;case`guidelineNotFound`:return`This guideline no longer exists; it was deleted elsewhere. Reload the page to see the current guidelines, and add your text as a new guideline if it is still needed.`;case`storageFailed`:return`The Toodo server could not use its database (${e.message}). Try again; if it keeps failing, check the toodo-server log.`;default:return e.message}}function Et(e,t){return/filename="([^"]+)"/.exec(e.headers.get(`Content-Disposition`)??``)?.[1]??t}function H(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0)}async function Dt(){let e=await c(`/api/backups/export`),t=Et(e,`toodo-backup.sqlite3`);return H(t,await e.blob()),t}async function Ot(e){return H(e,await(await c(`/api/backups/${encodeURIComponent(e)}`)).blob()),e}async function kt(e){return await(await c(`/api/backups/restore`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:e})).json()}var At=`toodo-install-dismissed`;function jt(){let{userAgent:e,maxTouchPoints:t}=navigator;return/iPhone|iPad|iPod/.test(e)||e.includes(`Macintosh`)&&t>1}function Mt(){return matchMedia(`(display-mode: standalone)`).matches||`standalone`in navigator&&navigator.standalone===!0}var U=null,Nt=!1,W=new Set;function G(){W.forEach(e=>e())}function Pt(e){return W.add(e),()=>W.delete(e)}function Ft(){return Nt||Mt()||localStorage.getItem(At)!==null?`none`:U===null?jt()?`home-screen`:`none`:`prompt`}function It(){localStorage.setItem(At,`1`),G()}async function Lt(){let e=U;if(e===null)return;U=null,await e.prompt();let{outcome:t}=await e.userChoice;t===`dismissed`?It():G()}function Rt(){addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),U=e,G()}),addEventListener(`appinstalled`,()=>{U=null,Nt=!0,G()})}function zt(){return`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:jt()&&!Mt()?`needs-install`:`unsupported`}var K=null,Bt={completion:[`Task awaiting completion`]};function Vt(e){return K!==null&&Object.keys(Bt).some(t=>K?.[t]===!0&&Bt[t].includes(e))}function Ht(e){let t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`);return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function Ut(e,t){let n=e.options.applicationServerKey;return n===null||n.byteLength===t.length&&new Uint8Array(n).every((e,n)=>e===t[n])}function q(){return navigator.serviceWorker.getRegistration()}async function Wt(e){let t=await(await q())?.pushManager.getSubscription()??null;return t===null||Ut(t,e)?t:(await t.unsubscribe(),null)}function J(e){return typeof e==`object`&&!!e}function Gt(e){return J(e)&&typeof e.completion==`boolean`}function Kt(e){return J(e)&&typeof e.message==`string`&&typeof e.at==`number`}function qt(e){return J(e)&&typeof e.endpoint==`string`&&Gt(e.settings)&&(e.lastFailure===null||Kt(e.lastFailure))}function Jt(e){return J(e)&&typeof e.publicKey==`string`&&(e.subscription===null||qt(e.subscription))}async function Yt(e,t,n){let r=await t.text(),i;try{i=JSON.parse(r)}catch{throw Error(`The answer to ${e} is not JSON; a proxy in front of the Toodo server may have answered instead.`)}if(!n(i))throw Error(`The answer to ${e} is not the push data this app expects; the Toodo server may be older or newer than the app. Reload the app.`);return i}async function Xt(e){return Yt(`PUT /api/push/subscription`,await c(`/api/push/subscription`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e.toJSON())}),qt)}async function Zt(){let e=await Yt(`GET /api/push`,await c(`/api/push`),Jt),t=await Wt(Ht(e.publicKey)),n=t===null?null:t.endpoint===e.subscription?.endpoint?e.subscription:await Xt(t);return K=n?.settings??null,{publicKey:e.publicKey,permission:Notification.permission,subscription:n}}var Qt=1e4;async function $t(){let e,t=new Promise((t,n)=>{e=setTimeout(()=>n(Error(`The service worker did not become active within ${Qt/1e3} seconds. Reload the app and try again.`)),Qt)});try{return await Promise.race([navigator.serviceWorker.ready,t])}finally{clearTimeout(e)}}async function en(e,t){if(await e!==`granted`)throw Error(`Notifications were not allowed.`);if(await q()===void 0)throw Error(`Notifications need the service worker, which only the built app installs.`);let{pushManager:n}=await $t(),r=Ht(t),i=await Wt(r)??await n.subscribe({userVisibleOnly:!0,applicationServerKey:r});try{let e=await Xt(i);return K=e.settings,e}catch(e){throw await i.unsubscribe(),e}}async function tn(){await(await(await q())?.pushManager.getSubscription())?.unsubscribe(),K=null,await c(`/api/push/subscription`,{method:`DELETE`})}async function nn(e){let t=await Yt(`PUT /api/push/settings`,await c(`/api/push/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),qt);return K=t.settings,t}async function rn(){await c(`/api/push/test`,{method:`POST`})}var an=`toodo-open-task`;function on(e){if(!(`serviceWorker`in navigator))return()=>{};let t=navigator.serviceWorker,n=({data:t})=>{typeof t==`object`&&t&&`type`in t&&t.type===an&&`taskId`in t&&typeof t.taskId==`number`&&e(t.taskId)};return t.addEventListener(`message`,n),()=>t.removeEventListener(`message`,n)}async function sn(){return`Notification`in window&&Notification.permission===`granted`}async function cn(){return`Notification`in window?Notification.requestPermission():`denied`}function ln(e){Vt(e.title)||new Notification(e.title,{body:e.body})}var un={planned:`Planned`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`};function dn(e){return e.status===`done`&&e.resolution===`completed`?`Completed`:e.status===`done`&&e.resolution===`not_adopted`?`Not adopted`:un[e.status]}function fn(e,t){switch(t.status){case`in_progress`:return`Task started`;case`in_review`:return`Task awaiting completion`;case`done`:return t.resolution===`not_adopted`?`Task concluded without merging`:`Task done`;case`planned`:return e===`in_progress`?`Task paused`:`Task status changed`}}function pn(e,t){let n=new Map(e.map(e=>[e.id,e.status]));return t.flatMap(e=>{let t=n.get(e.id);return t===void 0||t===e.status?[]:[{title:fn(t,e),body:`#${e.id} ${e.title}: ${un[t]} -> ${dn(e)}`}]})}async function mn(e){if(e.length!==0&&(await sn()||await cn()===`granted`))for(let t of e)ln(t)}var hn=class extends Error{kind;code;constructor(e){super(Tt(e)),this.name=`CommandFailure`,this.kind=e.kind,this.code=e.code}};async function Y(e){let t=await e;if(t.status===`error`)throw new hn(t.error);return t.data}var X={workspaces:[`workspaces`],guidelines:e=>[`guidelines`,e],tasks:[`task-list`,`pages`],taskRelations:[`tasks`,`relations`],archive:[`tasks`,`archive`],backups:[`backups`],backupSettings:[`backup-settings`],backupStatus:[`backup-status`],mcpServerInfo:[`mcp-server-info`],review:(e,t)=>[`review`,e,t],reviewTimeZone:[`review`,`time-zone`],reviewSnapshots:[`review-snapshots`],reviewSnapshot:e=>[`review-snapshots`,e]};function gn(){return P({queryKey:X.mcpServerInfo,queryFn:()=>R.mcpServerInfo(),refetchInterval:5e3})}function _n(){return P({queryKey:X.backups,queryFn:()=>Y(R.listBackups())})}function vn(){return P({queryKey:X.backupSettings,queryFn:()=>R.getBackupSettings()})}function yn(){return P({queryKey:X.backupStatus,queryFn:()=>R.getBackupStatus(),refetchInterval:6e4})}function bn(){let e=p();return F({mutationFn:e=>Y(R.saveBackupSettings(e)),onSuccess:t=>(e.setQueryData(X.backupSettings,t),Promise.all([e.invalidateQueries({queryKey:X.backups}),e.invalidateQueries({queryKey:X.backupStatus})]))})}function xn(){let e=p();return F({mutationFn:e=>Y(R.restoreBackup(e)),onSuccess:()=>e.invalidateQueries()})}function Sn(){return F({mutationFn:Dt})}function Cn(){return F({mutationFn:Ot})}function wn(){let e=p();return F({mutationFn:kt,onSuccess:()=>e.invalidateQueries()})}function Tn(){return P({queryKey:X.workspaces,queryFn:()=>Y(R.listWorkspaces())})}function En(){let e=p();return F({mutationFn:e=>Y(R.createWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.workspaces})})}function Dn(){let e=p();return F({mutationFn:e=>Y(R.updateWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.workspaces,exact:!0})})}function On(){return Z(e=>Y(R.deleteWorkspace(e)))}function kn(){return P({queryKey:X.archive,queryFn:()=>Y(R.listArchive())})}function Z(e){let t=p();return F({mutationFn:e,onSuccess:()=>Promise.all([t.invalidateQueries({queryKey:X.tasks}),t.invalidateQueries({queryKey:X.workspaces,exact:!0}),t.invalidateQueries({queryKey:X.archive}),t.invalidateQueries({queryKey:[`review`]})])})}function An(){return Z(e=>Y(R.restoreWorkspace(e)))}function jn(){return Z(e=>Y(R.purgeWorkspace(e)))}function Mn(){return Z(e=>Y(R.restoreTask(e)))}function Nn(){return Z(e=>Y(R.purgeTask(e)))}function Pn(e){return P({queryKey:X.guidelines(e),queryFn:()=>Y(R.listGuidelines(e))})}function Fn(e){let t=p();return F({mutationFn:e,onSuccess:e=>t.invalidateQueries({queryKey:X.guidelines(e.workspaceId)})})}function In(){return Fn(e=>Y(R.addGuideline(e)))}function Ln(){return Fn(e=>Y(R.updateGuideline(e)))}function Rn(){return Fn(e=>Y(R.deleteGuideline(e)))}var zn=[`planned`,`in_progress`,`in_review`];function Q(e){return Y(R.listTasks(e))}async function Bn(e){let t=Q({statuses:[`done`],before:e,limit:100}),n=e=>e.length<100?null:Math.min(...e.map(e=>e.id));if(e!==null){let e=await t;return{tasks:e,olderBefore:n(e)}}let[r,i]=await Promise.all([Q({statuses:zn}),t]),a=new Set([...r,...i].map(e=>e.id)),o=[...new Set(r.flatMap(e=>e.dependsOn))].filter(e=>!a.has(e)),s=[];for(let e=0;e<o.length;e+=100)s.push(o.slice(e,e+100));let c=await Promise.all(s.map(e=>Q({ids:e})));return{tasks:[...r,...i,...c.flat()],olderBefore:n(i)}}function Vn(e){let t=new Map;for(let n of e.pages)for(let e of n.tasks)t.set(e.id,e);return[...t.values()].sort((e,t)=>e.id-t.id)}function Hn(e){let t=e.getQueryData(X.tasks);return t===void 0?void 0:Vn(t)}async function Un(e){let t=e.getQueryData(X.tasks);t===void 0||t.pages.length<=1||(await e.cancelQueries({queryKey:X.tasks,exact:!0}),e.setQueryData(X.tasks,e=>e===void 0?e:{pages:e.pages.slice(0,1),pageParams:e.pageParams.slice(0,1)}))}function Wn(e){let t=p();(0,u.useEffect)(()=>{if(!e)Un(t);else return()=>void Un(t)},[e,t])}function Gn(e=[]){let t=$e({queryKey:X.tasks,queryFn:({pageParam:e})=>Bn(e),initialPageParam:null,getNextPageParam:e=>e.olderBefore,select:Vn}),n=t.data,r=new Set(n?.map(e=>e.id)),i=[...new Set(e.filter(e=>e!=null&&!r.has(e)))].sort((e,t)=>e-t),a=P({queryKey:[...X.tasks,`by-id`,i],queryFn:()=>Q({ids:i}),enabled:n!==void 0&&i.length>0}),o=i.length===0?[]:a.data??[];return n===void 0||o.length===0?t:{...t,data:[...n,...o].sort((e,t)=>e.id-t.id)}}function Kn(e,t){return P({queryKey:X.review(e,t),queryFn:()=>Y(R.reviewPeriod(e,t))})}function qn(){return P({queryKey:X.reviewTimeZone,queryFn:()=>Y(R.getReviewTimeZone())})}function Jn(){let e=p();return F({mutationFn:e=>Y(R.setReviewTimeZone(e)),onSuccess:()=>e.invalidateQueries({queryKey:[`review`]})})}function Yn(){return P({queryKey:X.reviewSnapshots,queryFn:()=>Y(R.listReviewSnapshots())})}function Xn(e){return P({queryKey:X.reviewSnapshot(e??0),queryFn:()=>Y(R.getReviewSnapshot(e??0)),enabled:e!==null,staleTime:1/0})}function Zn(){let e=p();return F({mutationFn:e=>Y(R.saveReviewSnapshot(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.reviewSnapshots})})}function Qn(){let e=p();return F({mutationFn:e=>Y(R.deleteReviewSnapshot(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.reviewSnapshots})})}function $n(){let e=p();(0,u.useEffect)(()=>{let t=[z.tasksChanged.listen(async()=>{let t=Hn(e);await e.invalidateQueries({queryKey:X.tasks}),!(t===void 0||document.hasFocus())&&mn(pn(t,Hn(e)??[])).catch(e=>console.error(`toodo: failed to show status notifications`,e))}),z.workspacesChanged.listen(()=>e.invalidateQueries({queryKey:X.workspaces,exact:!0})),z.guidelinesChanged.listen(t=>e.invalidateQueries({queryKey:X.guidelines(t.payload.workspaceId)}))];return()=>{for(let e of t)e.then(e=>e())}},[e])}function er(){let e=p();return F({mutationFn:e=>Y(R.startTask(e,null,null)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}function tr(){let e=p();return F({mutationFn:e=>Y(R.completeTask(e,null,null)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function nr(){let e=p();return F({mutationFn:({id:e,note:t,shippedWith:n=null})=>Y(R.concludeTask(e,t,n===null?`not_adopted`:`shipped_with`,n)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function rr(){let e=p();return F({mutationFn:({id:e,note:t})=>Y(R.setCompletionNote(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function ir(){let e=p();return F({mutationFn:({id:e,reason:t})=>Y(R.reopenTask(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function ar(){let e=p();return F({mutationFn:({id:e,resolution:t,note:n})=>Y(R.setTaskOutcome(e,t,n)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function or(){let e=p();return F({mutationFn:e=>Y(R.updateTask(e)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function sr(){let e=p();return F({mutationFn:({id:e,workspaceId:t})=>Y(R.moveTask(e,t)),onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:X.tasks}),e.invalidateQueries({queryKey:[`review`]})])})}function $(e){let t=p();return F({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:X.tasks})})}function cr(){return $(e=>Y(R.pauseTask(e)))}function lr(){return $(({id:e,until:t,reason:n})=>Y(R.waitTask(e,t,n)))}function ur(){return $(e=>Y(R.endWait(e)))}function dr(){return $(({taskId:e,criterionId:t,met:n,evidence:r})=>Y(R.checkCriterion(e,t,n,r)))}function fr(){return Z(e=>Y(R.deleteTask(e)))}function pr(){return Z(e=>Y(R.deleteDoneTasks(e)))}function mr(e,t){return P({queryKey:[...X.tasks,`done-count`,e],queryFn:async()=>(await Q({workspaceId:e,statuses:[`done`]})).length,enabled:t})}function hr(){return $(({id:e,dependsOn:t,confirmPause:n})=>Y(R.addDependency(e,t,n)))}function gr(){return $(({id:e,dependsOn:t})=>Y(R.removeDependency(e,t)))}function _r(){return P({queryKey:X.taskRelations,queryFn:()=>Y(R.listTaskRelations())})}function vr(e){let t=p();return F({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:X.taskRelations})})}function yr(){return vr(({taskId:e,relatedId:t})=>Y(R.addTaskRelation(e,t)))}function br(){return vr(({taskId:e,relatedId:t})=>Y(R.removeTaskRelation(e,t)))}function xr(){let e=p();return F({mutationFn:e=>Y(R.createTask(e)),onSuccess:()=>e.invalidateQueries({queryKey:X.tasks})})}export{wn as $,m as $t,jn as A,tt as At,qn as B,N as Bt,ur as C,yt as Ct,Wn as D,ct as Dt,sr as E,lt as Et,Mn as F,nt as Ft,Jn as G,S as Gt,Zn as H,j as Ht,An as I,F as It,_r as J,ne as Jt,ar as K,ie as Kt,Kn as L,P as Lt,br as M,ot as Mt,ir as N,rt as Nt,cr as O,et as Ot,xn as P,it as Pt,Dn as Q,D as Qt,Xn as R,Re as Rt,Sn as S,xt as St,gn as T,st as Tt,$n as U,A as Ut,bn as V,M as Vt,rr as W,b as Wt,Ln as X,C as Xt,Gn as Y,y as Yt,or as Z,x as Zt,Qn as _,vt as _t,yr as a,on as at,mr as b,ht as bt,yn as c,rn as ct,tr as d,Ft as dt,p as en,lr as et,nr as f,Pt as ft,Rn as g,St as gt,pr as h,R as ht,In as i,Zt as it,gr as j,at as jt,Nn as k,I as kt,_n as l,It as lt,En as m,H as mt,Y as n,tn as nt,kn as o,zt as ot,xr as p,Rt as pt,er as q,re as qt,hr as r,en as rt,vn as s,nn as st,X as t,Tn as tt,dr as u,Lt as ut,fr as v,dt as vt,Pn as w,_t as wt,Cn as x,mt as xt,On as y,gt as yt,Yn as z,De as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./Selector-BwHo8VGI.js";import{B as i,Ct as a,Ft as o,G as s,H as c,L as l,R as u,_ as d,_t as f,gt as p,ht as ee,jt as m,mt as te,n as ne,o as re,tt as ie,vt as h,wt as g,yt as ae,z as oe}from"./queries-XyxPBs72.js";import{n as _,t as v}from"./button-BpXTpERz.js";import{A as y,C as se,D as b,Dt as x,E as S,Ft as ce,G as C,It as le,L as w,M as ue,N as T,O as E,P as de,Pt as D,S as fe,T as O,Tt as k,U as A,X as pe,Z as me,_ as he,b as j,c as ge,d as _e,et as M,f as N,g as P,h as F,j as I,k as ve,l as L,m as R,nt as ye,p as z,s as be,tt as xe,u as B,v as V,w as Se,wt as H,x as U,y as W}from"./index-D_3GoUFa.js";import{t as G}from"./opener-DWhHPoCL.js";var K=e(t(),1),q=n(),Ce={completed:o.success,opened_for_review:o.review,started:o.progress,worked_on:o.progress,planned:o.neutral},J=`live`,Y=`all`,X=`any`,we=[{kind:`week`,label:`Week`},{kind:`month`,label:`Month`},{kind:`quarter`,label:`Quarter`},{kind:`year`,label:`Year`},{kind:`custom`,label:`Custom`}];function Te({disabled:e,items:t}){return(0,q.jsx)(A,{items:t,alignment:`end`,menuWidth:192,renderTrigger:t=>(0,q.jsx)(v,{...t,size:`sm`,variant:`primary`,icon:(0,q.jsx)(D,{}),label:`Export`,isDisabled:e})})}function Z(e,t){return`${e} ${t}${e===1?``:`s`}`}function Ee(){let e=i(),t=s(),[n,r]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),[c,l]=(0,K.useState)(null),u=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];async function d(e){l(null);try{await t.mutateAsync(e),r(!1)}catch(e){l(e instanceof Error?e.message:String(e))}}if(!e.data)return null;let{timeZone:f,configured:p}=e.data;return n?(0,q.jsxs)(`form`,{"aria-label":`Review time zone`,className:`flex flex-wrap items-center gap-2 print:hidden`,onSubmit:e=>{e.preventDefault(),d(a)},children:[(0,q.jsx)(`label`,{htmlFor:`review-time-zone`,className:`text-xs`,children:`Time zone for every device`}),(0,q.jsx)(`input`,{id:`review-time-zone`,list:`review-time-zones`,required:!0,className:x(M,`w-56`),value:a,onChange:e=>o(e.target.value)}),(0,q.jsx)(`datalist`,{id:`review-time-zones`,children:u.map(e=>(0,q.jsx)(`option`,{value:e},e))}),(0,q.jsx)(v,{size:`sm`,variant:`primary`,type:`submit`,label:`Save`,isDisabled:t.isPending}),p!==null&&(0,q.jsx)(v,{size:`sm`,variant:`secondary`,label:`Use the server's`,onClick:()=>void d(null)}),(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Cancel`,onClick:()=>r(!1)}),c&&(0,q.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-destructive`,children:c})]}):(0,q.jsxs)(`span`,{children:[`Days are in `,f,p===null&&` (the server's time zone)`,`.`,` `,(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Change time zone`,className:`print:hidden`,onClick:()=>{o(p??f),r(!0)}})]})}function Q({onShowTask:e}){let[t,n]=(0,K.useState)(()=>U(`week`,h(Date.now()/1e3))),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(W),[f,m]=(0,K.useState)(null),[g,S]=(0,K.useState)(null),T=l(t.from,t.to),E=oe(),D=u(g),O=c(),A=d(),M=g!==null,N=M?D:T,P=ie(),F=re(),I=M?D.data?.workspaces??[]:[...P.data??[],...F.data?.workspaces??[]],L=new Map(I.map(e=>[e.id,e.name])),R=M?D.data&&{period:{kind:D.data.summary.period,from:D.data.summary.from,to:D.data.summary.to},entries:D.data.entries,start:D.data.summary.start,end:D.data.summary.end,timeZone:D.data.summary.timeZone,now:D.data.summary.savedAt}:T.data&&{period:t,entries:T.data.entries,start:T.data.start,end:T.data.end,timeZone:T.data.timeZone,now:Date.now()/1e3},z=R?.period??t,B=R&&_e(R.entries,o),V=ve(R?.entries??[]);o.label!==null&&!V.includes(o.label)&&V.push(o.label);let H=[o.workspaceId===null?`across all workspaces`:`in ${L.get(o.workspaceId)??`workspace ${o.workspaceId}`}`,o.label!==null&&`labelled ${o.label}`].filter(Boolean).join(`, `),G=se[z.kind];function Q(e){a(null),n(e)}function $(e){a(null),m(null),S(e)}async function Me(){try{let e=await O.mutateAsync({period:t.kind,from:t.from,to:t.kind===`custom`?t.to:null,workspaceId:o.workspaceId,label:o.label,title:null});a(`Saved "${e.title}" with ${Z(e.entryCount,`task`)}; reopen it from Saved reviews.`)}catch(e){a(`Could not save the review: ${e instanceof Error?e.message:String(e)}`)}}async function Ne(e){try{await A.mutateAsync(e),$(null),a(`Deleted the saved review.`)}catch(e){a(`Could not delete the saved review: ${e instanceof Error?e.message:String(e)}`)}}function Pe(e){e!==t.kind&&Q(e===`custom`?{...t,kind:e}:U(e,t.from))}function Fe(e){return M?D.data?Promise.resolve(e===`csv`?D.data.csv:D.data.markdown):Promise.reject(Error(`the saved review is still loading`)):ne(ee.reviewReport({period:t.kind,date:null,from:t.from,to:t.kind===`custom`?t.to:null,format:e,timeZone:null,workspaceId:o.workspaceId,label:o.label}))}async function Ie(){try{let e=Fe(`markdown`);if(typeof ClipboardItem>`u`)await navigator.clipboard.writeText((await e).contents);else{let t=e.then(({contents:e})=>new Blob([e],{type:`text/plain`}));await navigator.clipboard.write([new ClipboardItem({"text/plain":t})])}a(`Copied as Markdown.`)}catch(e){a(`Could not copy: ${e instanceof Error?e.message:String(e)}`)}}async function Le(e){try{let t=await Fe(e);te(t.fileName,new Blob([t.contents],{type:`${t.mediaType};charset=utf-8`})),a(`Downloaded ${t.fileName}`)}catch(e){a(`Could not export: ${e instanceof Error?e.message:String(e)}`)}}return(0,q.jsxs)(`section`,{"aria-labelledby":`review-heading`,className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h2`,{id:`review-heading`,className:`text-xl font-semibold tracking-tight`,children:M&&D.data?D.data.summary.title:Se[z.kind]}),(0,q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Work recorded from `,z.from,` to `,z.to,` `,H,`.`,` `,M?D.data&&(0,q.jsxs)(`span`,{children:[`Saved `,ae(D.data.summary.savedAt),`, with days in `,D.data.summary.timeZone,`; it stays as it was when saved.`]}):(0,q.jsx)(Ee,{})]})]}),(M||(E.data?.length??0)>0)&&(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,q.jsx)(r,{label:`Saved reviews`,isLabelHidden:!0,size:`sm`,options:[{value:J,label:`Live review`},...(E.data??[]).map(e=>({value:String(e.id),label:`${e.title} (saved ${h(e.savedAt)})`}))],value:g===null?J:String(g),onChange:e=>$(e===J?null:Number(e))}),g!==null&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(v,{size:`sm`,variant:`secondary`,label:`Back to the live review`,onClick:()=>$(null)}),(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Delete saved review`,isDisabled:A.isPending,onClick:()=>void Ne(g)})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 print:hidden`,children:[!M&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ye,{label:`Review period`,size:`sm`,value:t.kind,onChange:e=>typeof e==`string`&&Pe(e),children:we.map(({kind:e,label:t})=>(0,q.jsx)(xe,{value:e,label:t},e))}),t.kind===`week`&&(0,q.jsx)(w,{label:`Week starting`,size:`sm`,format:`system_date`,value:t.from,onChange:e=>e&&Q(ue(e))}),t.kind===`custom`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(w,{label:`From`,size:`sm`,format:`system_date`,max:t.to,value:t.from,onChange:e=>e&&e<=t.to&&Q({...t,from:e})}),(0,q.jsx)(w,{label:`To`,size:`sm`,format:`system_date`,min:t.from,value:t.to,onChange:e=>e&&e>=t.from&&Q({...t,to:e})})]}),t.kind!==`week`&&t.kind!==`custom`&&(0,q.jsx)(`span`,{className:`px-1 text-sm font-medium`,children:fe(t)}),(0,q.jsx)(_,{size:`sm`,variant:`secondary`,icon:(0,q.jsx)(ce,{}),label:`Previous ${G}`,tooltip:`Previous ${G}`,onClick:()=>Q(y(t,-1))}),(0,q.jsx)(_,{size:`sm`,variant:`secondary`,icon:(0,q.jsx)(le,{}),label:`Next ${G}`,tooltip:`Next ${G}`,onClick:()=>Q(y(t,1))}),t.kind!==`custom`&&(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`This ${G}`,onClick:()=>Q(U(t.kind,h(Date.now()/1e3)))})]}),(0,q.jsx)(`div`,{className:`ml-auto`,children:(0,q.jsx)(Te,{disabled:!B,items:[...M?[]:[{label:`Save as snapshot`,onClick:()=>void Me()}],{label:`Copy as Markdown`,onClick:()=>void Ie()},{label:`Save as Markdown`,onClick:()=>void Le(`markdown`)},{label:`Save as CSV`,onClick:()=>void Le(`csv`)},{label:`Print or save as PDF`,onClick:()=>window.print()}]})})]}),(0,q.jsxs)(`div`,{role:`group`,"aria-label":`Review filters`,className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,q.jsx)(r,{label:`Workspace`,isLabelHidden:!0,size:`sm`,options:[{value:Y,label:`All workspaces`},...I.map(e=>({value:String(e.id),label:e.name}))],value:o.workspaceId===null?Y:String(o.workspaceId),onChange:e=>s({...o,workspaceId:e===Y?null:Number(e)})}),(0,q.jsx)(r,{label:`Label`,isLabelHidden:!0,size:`sm`,options:[{value:X,label:V.length===0?`No labels in this period`:`Any label`},...V.map(e=>({value:`label:${e}`,label:e}))],value:o.label===null?X:`label:${o.label}`,onChange:e=>s({...o,label:e===X?null:e.slice(6)})}),(o.workspaceId!==null||o.label!==null)&&(0,q.jsx)(v,{size:`sm`,variant:`ghost`,label:`Clear filters`,onClick:()=>s(W)})]}),i&&(0,q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground print:hidden`,children:i}),(0,q.jsx)(`p`,{role:`status`,className:x(`text-sm text-muted-foreground`,!N.isPending&&`sr-only`),children:N.isPending?`Loading the review...`:B?`Showing ${B.length} ${B.length===1?`task`:`tasks`} with activity in this ${G}.`:``}),N.isError&&(0,q.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load the review: `,N.error.message]}),B?.length===0&&(0,q.jsx)(be,{title:R?.entries.length===0?`No recorded activity in this ${G}.`:`No recorded activity in this ${G} matches the filters.`,hint:M?`This saved review keeps the tasks it had when it was saved.`:R?.entries.length===0?`Toodo records each task as it is planned, started, moved to review, and completed, so reviews fill up as you work.`:`Pick another period or change the filters to look at other work.`,action:M?void 0:(0,q.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2 print:hidden`,children:(0,q.jsx)(v,{size:`sm`,variant:`secondary`,label:`Show the ${G} before`,onClick:()=>Q(y(t,-1))})})}),R&&B&&B.length>0&&(0,q.jsx)(je,{shown:R,entries:B,workspaces:I}),R&&B&&(0,q.jsx)(Ae,{shown:R,entries:B,editable:!M}),z.kind===`year`&&B&&(0,q.jsx)(ke,{entries:B}),B&&he(B).map(t=>(0,q.jsxs)(`section`,{"aria-label":j[t.outcome],className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`h3`,{className:x(`text-sm font-semibold`,Ce[t.outcome]),children:[j[t.outcome],` `,(0,q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.entries.length,`)`]})]}),(0,q.jsx)(`ul`,{className:`flex flex-col divide-y rounded-lg border`,children:t.entries.map(({task:t,at:n,commits:r,archived:i,pullRequest:a})=>(0,q.jsxs)(`li`,{className:`flex flex-col gap-1 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(C,{type:t.taskType}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,t.id]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Open #${t.id} ${t.title}`,title:t.title,onClick:()=>e?.(t.id),className:`min-w-0 flex-1 truncate text-left text-sm font-medium hover:underline max-md:min-h-11`,children:t.title}),t.resolution===`not_adopted`&&(0,q.jsx)(k,{className:`shrink-0`,label:`Not adopted`}),i&&(0,q.jsx)(k,{className:`shrink-0`,label:`Archived`}),t.resolution===`completed`&&(0,q.jsx)(k,{className:`shrink-0`,variant:`green`,label:`Completed`}),b(t)&&(0,q.jsx)(Oe,{url:b(t),stats:a}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground max-md:hidden print:inline`,children:[L.get(t.workspaceId)??`Workspace ${t.workspaceId}`,` · `,(0,q.jsx)(p,{at:n})]})]}),(0,q.jsx)(me,{task:t}),i||M?null:f?.id===t.id?(0,q.jsx)(de,{task:t,focusPlan:f.field,onDone:()=>m(null)}):(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground empty:hidden print:hidden`,children:(0,q.jsx)(pe,{task:t,onEdit:e=>m({id:t.id,field:e})})}),t.completionNote&&(0,q.jsx)(`p`,{"aria-label":`Completion note of #${t.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:t.completionNote}),R&&(0,q.jsx)(De,{task:t,shown:R}),r.length>0&&(0,q.jsx)(`ul`,{"aria-label":`Commits of #${t.id} this ${G}`,className:`flex flex-col gap-0.5`,children:r.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,q.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,q.jsx)(`span`,{className:`truncate`,children:ge(e.message)})]},e.sha))})]},t.id))})]},t.outcome))]})}function $(e){return e===0?`0h`:R(e)}function De({task:e,shown:t}){let{start:n,end:r,now:i}=t,o=f(e.timeline,i),s=a(e.timeline,i);if(o===null||s===null)return null;let c=g(e.timeline).filter(e=>e.state===`paused`&&e.start<r&&(e.end??i)>n);return(0,q.jsxs)(`div`,{"aria-label":`Time of #${e.id}`,className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:[(0,q.jsxs)(`p`,{children:[$(o),` active, `,$(s),` waiting`]}),c.length>0&&(0,q.jsx)(`ul`,{"aria-label":`Waits of #${e.id}`,className:`flex flex-col gap-0.5`,children:c.map(e=>(0,q.jsxs)(`li`,{className:`break-words-keep`,children:[`Waiting `,$(Math.max((e.end??i)-e.start,0)),` from `,h(e.start),e.end===null&&`, still waiting`,`: `,e.reason??`no reason recorded`]},e.start))})]})}function Oe({url:e,stats:t}){let n=S(e),r=t=>{t.preventDefault(),G(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,q.jsx)(`a`,{href:e,title:t?`${e} \u00b7 ${E(t)}`:e,"aria-label":n?`Pull request #${n}`:`Pull request`,onClick:r,onAuxClick:r,className:`shrink-0 text-xs text-primary underline underline-offset-2 hover:no-underline max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:n?`#${n}`:`PR`})}function ke({entries:e}){let t=T(e);return t===null?null:(0,q.jsxs)(`section`,{"aria-labelledby":`year-in-review-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsx)(`h3`,{id:`year-in-review-heading`,className:`text-sm font-semibold`,children:`Year in review`}),t.pullRequests&&(0,q.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Merged pull requests`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.pullRequests})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Lines changed`}),(0,q.jsxs)(`dd`,{className:`text-lg font-semibold`,children:[(0,q.jsxs)(`span`,{children:[`+`,t.pullRequests.additions]}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,q.jsxs)(`span`,{children:[`-`,t.pullRequests.deletions]})]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Files changed`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.changedFiles})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Reviews`}),(0,q.jsxs)(`dd`,{className:`text-lg font-semibold`,title:P(t.pullRequests),children:[t.pullRequests.reviews,(0,q.jsxs)(`span`,{className:`ml-1 text-xs font-normal text-muted-foreground`,children:[`on `,t.pullRequests.reviewed,` of `,t.pullRequests.pullRequests]})]})]})]}),t.largest.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest pull requests`}),(0,q.jsx)(`ol`,{"aria-label":`Largest pull requests`,className:`flex flex-col gap-1`,children:t.largest.map(({task:e,pullRequest:t})=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(C,{type:e.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:E(t)})]},e.id))})]}),t.research.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Research conclusions`}),(0,q.jsx)(`ul`,{"aria-label":`Research conclusions`,className:`flex flex-col divide-y rounded-md border`,children:t.research.map(({task:e,at:t,adopted:n})=>(0,q.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsx)(k,{className:`shrink-0`,variant:n?`green`:`neutral`,label:n?`Adopted`:`Not adopted`}),(0,q.jsx)(p,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,at:t})]}),(0,q.jsx)(`p`,{"aria-label":`Research conclusion of #${e.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:e.completionNote??(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`No conclusion written.`})})]},e.id))})]}),t.overruns.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest estimate overruns`}),(0,q.jsx)(`ol`,{"aria-label":`Largest estimate overruns`,className:`flex flex-col gap-1`,children:t.overruns.map(({task:e,estimated:t,actual:n})=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsx)(C,{type:e.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,q.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[`estimated `,R(t),`, `,R(n),` active`]})]},e.id))})]})]})}function Ae({shown:e,entries:t,editable:n}){let r=O(e.end,t,e.now),i=n?t.filter(({archived:e})=>!e).map(({task:e})=>H(e)):[],a=i.filter(e=>e.includes(`estimate`)).length,s=i.filter(e=>e.includes(`dueDate`)).length;if(r===null&&a+s===0)return null;let c=(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Missing plan`}),(0,q.jsxs)(`dd`,{children:[[a>0&&`${Z(a,`task`)} without an estimate`,s>0&&`${Z(s,`task`)} without a due date`].filter(Boolean).join(`, `),`; add them from the marks on the tasks below`]})]});return(0,q.jsxs)(`section`,{"aria-labelledby":`plan-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsx)(`h3`,{id:`plan-heading`,className:`text-sm font-semibold`,children:`Plan vs actual`}),r===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`text-sm`,children:`No reviewed task has an estimate or a due date, so there is nothing to compare yet.`}),(0,q.jsx)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:c})]}):(0,q.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Estimate vs active time`}),(0,q.jsx)(`dd`,{children:r.time?F(r.time):`No completed task had an estimate`})]}),(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due dates met`}),(0,q.jsx)(`dd`,{children:r.dueDates?z(r.dueDates):`No completed task had a due date`})]}),a+s>0&&c]}),r!==null&&r.late.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Late tasks`}),(0,q.jsx)(`ul`,{"aria-label":`Late tasks`,className:`flex flex-col gap-1`,children:r.late.map(e=>(0,q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[(0,q.jsx)(C,{type:e.task.taskType}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:e.task.title})]}),(0,q.jsx)(`span`,{className:x(`ml-auto shrink-0 text-xs`,o.danger),children:V(e)})]},e.task.id))})]})]})}function je({shown:e,entries:t,workspaces:n}){let r=I(e.period,t,n,e.timeZone),i=Math.max(1,...(r.completedPerMonth??[]).map(({count:e})=>e));return(0,q.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,q.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[r.outcomes.map(({outcome:e,count:t})=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:j[e]}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:t})]},e)),r.notAdopted>0&&(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Not adopted`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.notAdopted})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Commits`}),(0,q.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.commits})]})]}),(0,q.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[L.map(e=>{let t=r[e];return(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:B[e]}),(0,q.jsx)(`dd`,{children:t===null?`No data`:`${R(t.median)} (${t.tasks} ${t.tasks===1?`task`:`tasks`})`})]},e)}),r.changes&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Changes in completed pull requests`}),(0,q.jsx)(`dd`,{children:N(r.changes)})]}),r.completedByType.length>0&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by type`}),(0,q.jsx)(`dd`,{children:r.completedByType.map(({taskType:e,count:t})=>`${e} ${t}`).join(`, `)})]}),r.completedByWorkspace.length>0&&(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by workspace`}),(0,q.jsx)(`dd`,{children:r.completedByWorkspace.map(({workspace:e,count:t})=>`${e} ${t}`).join(`, `)})]})]}),r.completedPerMonth&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Completed per month`}),(0,q.jsx)(`ul`,{"aria-label":`Completed per month`,className:`flex flex-col gap-0.5`,children:r.completedPerMonth.map(({month:e,count:t})=>(0,q.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,q.jsx)(`span`,{className:`w-16 shrink-0 font-mono text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:x(`h-2 rounded-sm`,m.success),style:{width:`${t/i*60}%`,minWidth:t>0?4:0}}),(0,q.jsx)(`span`,{children:t})]},e))})]})]})}export{Q as Review};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{l as r,t as i}from"./Selector-BwHo8VGI.js";import{t as a}from"./button-BpXTpERz.js";import{d as o,r as s,s as c,u as l}from"./session-sBDFnC3r.js";import{a as u,i as d,n as f,o as p,r as m}from"./index-D_3GoUFa.js";var h=e(t(),1),g=n();function _({children:e}){let t=(0,h.useSyncExternalStore)(o,c),[n,r]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(t)return;let e=!0;return s().catch(e=>console.warn(`toodo: could not ask the server about Cloudflare Access`,e)).finally(()=>{e&&r(!0)}),()=>{e=!1,r(!1)}},[t]),t?e:n?(0,g.jsx)(b,{}):null}var v=[{value:`full`,label:`Full access`},{value:`read`,label:`Read-only`}],y=m.map(({label:e,days:t})=>({value:t===null?`never`:String(t),label:e}));function b(){let[e,t]=(0,h.useState)(``),[n,o]=(0,h.useState)(()=>u(navigator.userAgent)),[s,c]=(0,h.useState)(f.scope),[m,_]=(0,h.useState)(String(f.expiresInDays)),[b,x]=(0,h.useState)(null),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(!1),E=(0,h.useRef)(null),D=(0,h.useId)(),O=`${D}-help`,k=`${D}-rejected`;async function A(t){t.preventDefault(),T(!0),x(null),C(!1);try{let t=m===`never`?null:Number(m);l(await p(e.trim(),n.trim(),{scope:s,expiresInDays:t}))}catch(e){e instanceof d?(C(!0),E.current?.focus(),E.current?.select()):e instanceof TypeError?x(`Could not reach the server: ${String(e)}`):x(e instanceof Error?e.message:String(e))}finally{T(!1)}}return(0,g.jsx)(`main`,{className:`flex min-h-svh flex-col items-center justify-center gap-4 p-6`,children:(0,g.jsxs)(`form`,{onSubmit:A,"aria-label":`Server access`,className:`flex w-full max-w-sm flex-col gap-3 rounded-lg border p-5`,children:[(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Toodo server`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sign in with the server's access token. This browser then gets a token of its own, which you can revoke under Devices.`}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,g.jsx)(r,{ref:E,label:`Access token`,type:`password`,autoComplete:`current-password`,value:e,onChange:e=>{t(e),C(!1)},status:S?{type:`error`}:void 0,"aria-describedby":S?`${k} ${O}`:O}),S&&(0,g.jsxs)(`p`,{id:k,role:`alert`,className:`text-xs text-destructive`,children:[`The server did not accept this token. Paste the whole contents of`,` `,(0,g.jsx)(`code`,{className:`text-xs`,children:`web-token`}),` again; a device token stops working once it is revoked.`]}),(0,g.jsxs)(`p`,{id:O,className:`text-xs text-muted-foreground`,children:[`Copy it from `,(0,g.jsx)(`code`,{className:`text-xs`,children:`web-token`}),` in the server's data directory.`]})]}),(0,g.jsx)(r,{label:`Device name`,description:`Signing in again under a device's name replaces that device, so give each browser its own name.`,value:n,onChange:e=>o(e.slice(0,80))}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsx)(i,{label:`Access`,options:v,value:s,onChange:e=>c(e)}),(0,g.jsx)(i,{label:`Token expires after`,options:y,value:m,onChange:_})]}),(0,g.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Applies when you sign in with `,(0,g.jsx)(`code`,{className:`text-xs`,children:`web-token`}),`. When the token expires, sign in again.`]}),b&&(0,g.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:b}),(0,g.jsx)(a,{type:`submit`,variant:`primary`,label:w?`Checking...`:`Continue`,isDisabled:w||!e.trim()||!n.trim()})]})})}export{_ as ServerAccess};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{l as r,t as i}from"./Selector-BwHo8VGI.js";import{E as a,Ft as o,J as s,M as c,St as l,Z as u,a as d,gt as f,tt as p,u as m,xt as h,yt as g}from"./queries-XyxPBs72.js";import{t as _}from"./createLucideIcon-BVHtiYZr.js";import{n as v,t as y}from"./button-BpXTpERz.js";import{$ as b,B as x,Ct as S,Dt as C,F as w,H as T,I as E,J as D,Lt as O,Mt as k,Q as A,Tt as j,V as ee,Y as te,Z as ne,jt as M,q as N}from"./index-D_3GoUFa.js";import{t as P}from"./opener-DWhHPoCL.js";import{t as F}from"./details-sheet-Bmm7uG_t.js";var I={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};I.node;var L=_(I),R={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};R.node;var z=_(R),B={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};B.node;var V=_(B),H=e(t(),1),U=n();function W({onClose:e,children:t}){let n=(0,H.useRef)(null),[r,i]=(0,H.useState)(!1);function a(){n.current?.querySelector(`form[data-dirty]`)?i(!0):e()}return(0,H.useEffect)(()=>{function e(e){e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[aria-haspopup='menu'][aria-expanded='true']`)||(r?i(!1):e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select, [role=combobox], [role=listbox]`)||a())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)}),(0,U.jsx)(F,{ref:n,width:`min(480px, max(360px, 40vw), calc(100vw - 32px))`,onClose:a,banner:r&&(0,U.jsxs)(`div`,{role:`group`,"aria-label":`Unsaved changes`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted px-4 py-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Discard your unsaved changes?`}),(0,U.jsx)(y,{size:`sm`,variant:`secondary`,label:`Keep editing`,autoFocus:!0,onClick:()=>i(!1)}),(0,U.jsx)(y,{size:`sm`,variant:`destructive`,label:`Discard changes`,onClick:e})]}),children:t})}function G(e){switch(e.status){case`in_progress`:return`Started`;case`in_review`:return`In review`;case`done`:return`Completed`;case`planned`:return e.reopened?`Reopened`:`Paused`}}function K({task:e}){let t=e.timeline.filter(e=>e.reason!==null);return t.length===0?null:(0,U.jsx)(`ol`,{"aria-label":`Reasons of #${e.id}`,className:`mt-1 flex flex-col gap-0.5`,children:t.map((e,t)=>(0,U.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2 max-md:flex-wrap max-md:gap-y-0`,children:[(0,U.jsx)(f,{className:`shrink-0 text-muted-foreground`,at:e.at}),(0,U.jsx)(`span`,{className:`shrink-0 font-medium`,children:G(e)}),(0,U.jsx)(`span`,{className:`min-w-0 whitespace-pre-line break-words-keep max-md:basis-full`,children:e.reason})]},t))})}var q={lane:`Lane`,discord:`Discord`,pr:`PR`};function re({value:e}){if(/^https?:\/\//i.test(e)){let t=t=>{t.preventDefault(),P(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,U.jsx)(`a`,{href:e,onClick:t,onAuxClick:t,className:`min-w-0 break-all text-primary underline underline-offset-2 hover:no-underline`,children:e})}let t=e.indexOf(`:`),n=t>0?q[e.slice(0,t)]:void 0;return n===void 0?(0,U.jsx)(`code`,{className:`min-w-0 break-all`,children:e}):(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:n}),(0,U.jsx)(`code`,{className:`min-w-0 break-all`,children:e.slice(t+1)})]})}function J({task:e}){return e.refs.length===0?null:(0,U.jsx)(N,{label:`Refs`,children:(0,U.jsx)(`ul`,{"aria-label":`Refs of #${e.id}`,className:`flex flex-col gap-0.5`,children:e.refs.map(e=>(0,U.jsx)(`li`,{className:`flex min-w-0`,children:(0,U.jsx)(re,{value:e})},e))})})}function Y({task:e,detailed:t}){let n=l(e.milestones);return n.length===0?null:t?(0,U.jsxs)(N,{label:`Timeline`,children:[(0,U.jsx)(`dl`,{"aria-label":`Timeline of #${e.id}`,className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5`,children:n.map(({label:e,at:t})=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(f,{at:t})})]},e))}),(0,U.jsx)(K,{task:e})]}):(0,U.jsx)(`p`,{"aria-label":`Timeline of #${e.id}`,className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:n.map(({label:e,at:t})=>(0,U.jsx)(f,{at:t,prefix:`${e} `},e))})}function X({task:e,tasks:t,context:n,navigation:r}){let a=s(),o=d(),l=c(),u=(a.data??[]).flatMap(({taskId:t,relatedId:n})=>t===e.id?[n]:n===e.id?[t]:[]).filter(e=>n.byId.has(e)),f=t.filter(t=>t.id!==e.id&&!u.includes(t.id)),p=[...new Set([e.workspaceId,...f.map(e=>e.workspaceId)])].map(e=>({workspaceId:e,tasks:f.filter(t=>t.workspaceId===e)})).filter(e=>e.tasks.length>0),m=b(),h=o.isPending||l.isPending||m,g=o.error??l.error;if(u.length===0&&p.length===0)return null;let _=p.length>0&&(0,U.jsx)(i,{label:`Add related task to #${e.id}`,isLabelHidden:!0,size:`sm`,width:192,placeholder:`Add related task...`,value:``,isDisabled:h,options:p.map(e=>({type:`section`,title:n.workspaceName(e.workspaceId),options:e.tasks.map(e=>({value:String(e.id),label:`#${e.id} ${e.title}`}))})),onChange:t=>{t&&o.mutate({taskId:e.id,relatedId:Number(t)})}}),x=g&&(0,U.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:g.message});return u.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs`,children:[_,x]}):(0,U.jsxs)(N,{label:`Related`,children:[(0,U.jsxs)(`ul`,{"aria-label":`Related tasks of #${e.id}`,className:`flex flex-wrap items-center gap-1 max-md:gap-2`,children:[u.map(t=>{let i=n.byId.get(t),a=A(t,e.workspaceId,n);return(0,U.jsxs)(`li`,{className:`inline-flex min-w-0 items-center max-md:gap-2`,children:[(0,U.jsx)(y,{size:`sm`,variant:`secondary`,label:i===void 0?a:`${a} ${i.title}`,"aria-label":`Open related task ${a}`,tooltip:i?.title,className:`min-w-0 max-w-56 tabular-nums`,isDisabled:r===void 0||!r.canOpen(t),onClick:()=>r?.open(t)}),(0,U.jsx)(v,{size:`sm`,variant:`ghost`,label:`Remove related task #${t} from #${e.id}`,tooltip:`Remove related task`,icon:(0,U.jsx)(k,{}),isDisabled:h,onClick:()=>l.mutate({taskId:e.id,relatedId:t})})]},t)}),_]}),x]})}function ie({task:e}){let t=u();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y,{size:`sm`,variant:e.autopilot?`primary`:`secondary`,changesData:!0,"aria-pressed":e.autopilot,"aria-label":`Autopilot of #${e.id}`,label:e.autopilot?`Autopilot on`:`Autopilot off`,icon:(0,U.jsx)(O,{"aria-hidden":!0}),tooltip:e.autopilot?`Marked for autopilot: an executor may take it up on its own once it is ready. Click to clear.`:`Not marked for autopilot. Click to let an executor take it up on its own once it is ready.`,isDisabled:t.isPending,onClick:()=>t.mutate({status:null,id:e.id,taskType:e.taskType,title:e.title,description:e.description,estimate:e.estimate,dueDate:e.dueDate,autopilot:!e.autopilot,criteria:null}),className:`shrink-0`}),t.error&&(0,U.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:t.error.message})]})}function ae({task:e}){let t=p(),n=a(),r=b(),o=t.data??[];return o.length<2?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`inline-flex`,title:`Move the task to another workspace; its history, notes, criteria, refs, and links stay`,children:(0,U.jsx)(i,{label:`Workspace of #${e.id}`,isLabelHidden:!0,size:`sm`,width:160,value:String(e.workspaceId),isDisabled:n.isPending||r,options:o.map(e=>({value:String(e.id),label:e.name})),onChange:t=>n.mutate({id:e.id,workspaceId:Number(t)})})}),n.error&&(0,U.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:n.error.message})]})}function oe({task:e}){return(0,U.jsxs)(U.Fragment,{children:[(e.estimate!==null||e.dueDate!==null)&&(0,U.jsxs)(`p`,{"aria-label":`Plan of #${e.id}`,className:`flex flex-wrap gap-x-2 text-xs text-muted-foreground`,children:[e.estimate!==null&&(0,U.jsxs)(`span`,{children:[`Estimate `,S(e.estimate)]}),e.dueDate!==null&&(0,U.jsx)(D,{task:e})]}),(0,U.jsx)(ne,{task:e}),(0,U.jsx)(J,{task:e})]})}var se={progress:`Progress`,blocker:`Blocker`,decision:`Decision`},ce={progress:`neutral`,blocker:`warning`,decision:`info`};function Z({kind:e}){return(0,U.jsx)(j,{"data-note-kind":e,className:`shrink-0`,variant:ce[e],label:se[e]})}function le({task:e,detailed:t}){let n=e.notes;if(n.length===0)return null;if(!t){let t=n[n.length-1];return(0,U.jsxs)(`p`,{"aria-label":`Latest note of #${e.id}`,className:`flex min-w-0 items-center gap-1.5 text-xs`,title:g(t.at),children:[(0,U.jsx)(Z,{kind:t.kind}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:T(t.body)}),n.length>1&&(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`+${n.length-1} more`})]})}return(0,U.jsx)(N,{label:`Notes (${n.length})`,children:(0,U.jsx)(`ol`,{"aria-label":`Notes of #${e.id}`,className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(Z,{kind:e.kind}),(0,U.jsx)(f,{className:`text-muted-foreground`,at:e.at})]}),(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(`p`,{className:`whitespace-pre-line break-words-keep`,children:e.body}),children:(0,U.jsx)(te,{source:e.body})})]},t))})})}var ue={pending:`Pending`,met:`Met`,failed:`Failed`},de={pending:o.neutral,met:o.success,failed:o.danger},Q={user:`you`,agent:`an agent`,toodo:`Toodo`};function $({state:e}){let t=e===`met`?L:e===`failed`?z:V;return(0,U.jsx)(`span`,{role:`img`,"aria-label":ue[e],className:C(`flex size-4 shrink-0 items-center justify-center`,de[e]),children:(0,U.jsx)(t,{"aria-hidden":!0,className:`size-3.5`})})}function fe(e){if(e.checkedBy===null)return null;let t=e.checkedAt===null?``:` ${h(e.checkedAt)}`;return`Checked by ${Q[e.checkedBy]}${t}`}function pe({task:e,detailed:t}){let n=e.criteria;if(n.length===0)return null;let r=(0,U.jsx)(`ul`,{"aria-label":`Criteria of #${e.id}`,className:`flex flex-col gap-0.5`,children:n.map(n=>(0,U.jsx)(me,{task:e,criterion:n,detailed:t},n.id))});if(!t)return r;let i=n.filter(e=>e.state===`met`).length;return(0,U.jsx)(N,{label:`Criteria (${i} of ${n.length} met)`,children:r})}function me({task:e,criterion:t,detailed:n}){let i=m(),a=b(),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(``),d=t.kind===`manual`&&e.status!==`done`,p=fe(t),h=E(t.kind)?t.target:null;function g(){c(!1),u(``)}let _=ee(l.trim()!==``,g,i.isPending);function v(n){s?g():n?(i.reset(),c(!0)):i.mutate({taskId:e.id,criterionId:t.id,met:!1,evidence:null})}function S(n){n.preventDefault(),i.mutate({taskId:e.id,criterionId:t.id,met:!0,evidence:l.trim()||null},{onSuccess:g})}return(0,U.jsxs)(`li`,{"data-criterion-state":t.state,className:`flex min-w-0 flex-col gap-0.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,title:n?void 0:[p,t.evidence,h].filter(Boolean).join(`
|
|
2
|
-
`)||void 0,children:[d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(M,{size:`sm`,className:`shrink-0`,label:`Check criterion ${t.id} of #${e.id}`,isLabelHidden:!0,value:t.state===`met`||s,isDisabled:i.isPending||a,onChange:v}),t.state===`failed`&&(0,U.jsx)($,{state:`failed`})]}):(0,U.jsx)($,{state:t.state}),(0,U.jsx)(`span`,{className:C(`min-w-0`,n?`break-words-keep`:`truncate`,t.state===`failed`&&o.danger),children:t.text}),t.kind!==`manual`&&(0,U.jsx)(j,{className:`shrink-0`,label:w[t.kind]}),!n&&t.evidence&&(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.evidence})]}),n&&h&&(0,U.jsx)(`code`,{className:`ml-5.5 break-all text-muted-foreground`,children:h}),n&&(t.evidence||p)&&(0,U.jsxs)(`p`,{className:`ml-5.5 whitespace-pre-line break-words-keep text-muted-foreground`,children:[t.evidence,t.evidence&&p&&` · `,t.checkedBy!==null&&(0,U.jsxs)(U.Fragment,{children:[`Checked by `,Q[t.checkedBy],t.checkedAt!==null&&(0,U.jsxs)(U.Fragment,{children:[` `,(0,U.jsx)(f,{at:t.checkedAt})]})]})]}),s&&(0,U.jsxs)(`form`,{onSubmit:S,className:`ml-5.5 flex flex-wrap items-center gap-1`,onKeyDown:_.onKeyDown,children:[(0,U.jsx)(r,{size:`sm`,containerClassName:`flex-1 basis-48`,label:`Evidence for criterion ${t.id}`,isLabelHidden:!0,placeholder:`Evidence (optional), e.g. a link or what you checked`,value:l,onChange:u,hasAutoFocus:!0}),_.asking?(0,U.jsx)(x,{label:`Discard evidence for criterion ${t.id}`,question:`Discard the evidence?`,onKeep:_.keep,onDiscard:_.discard}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y,{type:`submit`,size:`sm`,variant:`primary`,label:i.isPending?`Saving...`:`Save`,isDisabled:i.isPending}),(0,U.jsx)(y,{type:`button`,size:`sm`,variant:`ghost`,label:`Cancel`,onClick:_.request})]})]}),i.isError&&(0,U.jsx)(`p`,{role:`alert`,className:`ml-5.5 text-destructive`,children:i.error.message})]})}export{ie as AutopilotToggle,X as RelatedTasks,pe as TaskCriteria,W as TaskDetailsSheet,le as TaskNotes,oe as TaskPlan,Y as TaskTimeline,ae as TaskWorkspace};
|