@dubusoft/toodo-linux-arm64 1.11.1-dev.192 → 1.11.1-dev.194

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.
Files changed (42) hide show
  1. package/bin/toodo +0 -0
  2. package/bin/toodo-server +0 -0
  3. package/package.json +1 -1
  4. package/web/assets/Item-lIxHjWj_.js +2 -0
  5. package/web/assets/{LayoutChangeSnapshot-Bqg4192Z.js → LayoutChangeSnapshot-D3xatAtC.js} +1 -1
  6. package/web/assets/{MenuBottomSheet-CeALVyiC.js → MenuBottomSheet-c34lL1NX.js} +1 -1
  7. package/web/assets/MenuBottomSheetActionList-vpV_l1kc.js +1 -0
  8. package/web/assets/{Selector-DoBdC70u.js → Selector-C5qvx4hg.js} +2 -2
  9. package/web/assets/{SwipeActionsLayer-B7GU5Iq8.js → SwipeActionsLayer-DoZybr_Y.js} +1 -1
  10. package/web/assets/{button-HISRpujD.js → button-BGH43TyY.js} +1 -1
  11. package/web/assets/{details-sheet-DZm5HiKY.js → details-sheet-CocFq_H_.js} +1 -1
  12. package/web/assets/focusOutline.stylex-tP8rBkq-.js +1 -0
  13. package/web/assets/{focusReturn-DgQoALUE.js → focusReturn-CZYsdEBO.js} +1 -1
  14. package/web/assets/index-Cbw2q6IR.js +69 -0
  15. package/web/assets/{index-B09gU1NJ.css → index-DCOB-S8R.css} +1 -1
  16. package/web/assets/{inputHold-CZa_Ny55.js → inputHold-Vm2aa67t.js} +1 -1
  17. package/web/assets/{markdown-DMV9aINp.js → markdown-Bm09hfWj.js} +1 -1
  18. package/web/assets/{offline-screen-D2oNUAkw.js → offline-screen-hN5S_H90.js} +1 -1
  19. package/web/assets/{padding.stylex-DG4aFJ6m.js → padding.stylex-B1SBwjoO.js} +1 -1
  20. package/web/assets/{primaryClick-88oQu3_u.js → primaryClick-BsGCoCcT.js} +1 -1
  21. package/web/assets/queries-D7Y7ESQJ.js +1 -0
  22. package/web/assets/{reducedMotion-DCkUC6gt.js → reducedMotion-DHbcKoD2.js} +1 -1
  23. package/web/assets/{resolveSnapPoint-CBS37OcT.js → resolveSnapPoint-Bn5gTeO7.js} +1 -1
  24. package/web/assets/review-Bjc8qkoS.js +1 -0
  25. package/web/assets/{server-access-yl-6avZn.js → server-access-iPbJHIgj.js} +1 -1
  26. package/web/assets/task-details-BK0aw1hF.js +2 -0
  27. package/web/assets/{task-graph-yrbG5llV.js → task-graph-CXE_z0tI.js} +3 -3
  28. package/web/assets/{useLayerDismissal-D77qBJbE.js → useLayerDismissal-BVKANkUt.js} +1 -1
  29. package/web/assets/{useLinkComponent-DLC334Kf.js → useLinkComponent-BjJ-sXiE.js} +3 -3
  30. package/web/assets/useTooltip-wT5GvIfc.js +1 -0
  31. package/web/index.html +17 -17
  32. package/web/sw.js +2 -2
  33. package/web/version.json +1 -1
  34. package/web/assets/Item-CVXI6XsR.js +0 -2
  35. package/web/assets/MenuBottomSheetActionList-DFd0KkKB.js +0 -1
  36. package/web/assets/Tooltip-D2N09Hzl.js +0 -1
  37. package/web/assets/focusOutline.stylex-ZXdUNMFw.js +0 -1
  38. package/web/assets/index-BhedIiZp.js +0 -69
  39. package/web/assets/queries-Bcvk9W54.js +0 -1
  40. package/web/assets/review-BlpOrNhk.js +0 -1
  41. package/web/assets/task-details-DvCtIgd-.js +0 -2
  42. package/web/assets/useTooltip-Dd70k22y.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-C3cWAN_r.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-CSYkpd32.js";var u=e(t(),1),d=u.createContext(!1),f=()=>u.useContext(d);d.Provider;var p=n(),m=u.createContext(void 0),h=e=>{let t=u.useContext(m);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},g=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,p.jsx)(m.Provider,{value:e,children:t}));function _(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var v=u.createContext(_()),ee=()=>u.useContext(v),y=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(){}},te=new class extends y{#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`}},ne={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},b=new class{#e=ne;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 re(e){setTimeout(e,0)}var ie=typeof window>`u`||`Deno`in globalThis;function x(){}function ae(e,t){return typeof e==`function`?e(t):e}function oe(e){return typeof e==`number`&&e>=0&&e!==1/0}function se(e,t){return Math.max(e+(t||0)-Date.now(),0)}function S(e,t){return typeof e==`function`?e(t):e}function ce(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ue(o,t.options))return!1}else if(!w(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 le(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(C(t.options.mutationKey)!==C(a))return!1}else if(!w(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ue(e,t){return(t?.queryKeyHashFn||C)(e)}function C(e){return JSON.stringify(e,(e,t)=>me(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function w(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))return!1;if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!w(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!w(e[r],t[r]))return!1;return!0}return!1}var de=Object.prototype.hasOwnProperty;function fe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=pe(e)&&pe(t);if(!r&&!(me(e)&&me(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:de.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=fe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function T(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!de.call(t,n)||e[n]!==t[n])return!1;return!0}function pe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function me(e){if(!he(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!(!he(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function he(e){return Object.prototype.toString.call(e)===`[object Object]`}function ge(e){return new Promise(t=>{b.setTimeout(t,e)})}function _e(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:fe(e,t)}function ve(e,t,n,r){let i=r?[t,...e]:[...e,t];return n&&i.length>n?r?i.slice(0,n):i.slice(-n):i}var E=Symbol();function ye(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===E?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function D(e,t){return typeof e==`function`?e(...t):!!e}var O=Symbol();function be(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[O]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i||(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0})),a)}}),e}var xe=()=>ie,k=()=>xe();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=t,u=e=>{be(e,()=>t.signal,()=>n=!0,l[O])},d=ye(t.options,t.fetchOptions),f=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 u(e),e})(),o=await d(a),{maxPages:s}=t.options;return{pages:ve(e.pages,o,s,i),pageParams:ve(e.pageParams,r,s,i)}};if(i&&a.length){let e=i===`backward`,t=e?Ce:A,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:A(r,s);if(c>0&&e==null)break;s=await f(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 A(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 Ce(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function we(e,t){return t?A(e,t)!=null:!1}function Te(e,t){return!t||!e.getPreviousPageParam?!1:Ce(e,t)!=null}var Ee=re;function De(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ee,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 j=De(),Oe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),oe(this.gcTime)&&(this.#e=b.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(b.clearTimeout(this.#e),this.#e=void 0)}},M=new class extends y{#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 ke(e){return Math.min(1e3*2**e,3e4)}function Ae(e){return(e??`online`)!==`online`||M.isOnline()}var N=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function je(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(x);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new N(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>te.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),p=()=>Ae(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??ke,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),ge(o).then(()=>c()||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 Me=class extends Oe{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=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=Fe(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.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Fe(this.options);e.data!==void 0&&(this.setState(Pe(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.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(x).catch(x):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=>S(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===E||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>S(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:!se(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.#c||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.#l({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&&this.#o)return this.#a.continueRetry(),this.#o}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.defineProperties(e,{[O]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=ye(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!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.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=je({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof N&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;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 N){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({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.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(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,...Ne(t.data,this.options),fetchMeta:e.meta??null};case`success`:{let n={...t,...Pe(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 n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:`idle`,status:`error`,isInvalidated:!0}}case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),j.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ne(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ae(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Pe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fe(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 Ie=class extends y{#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.#a=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Re(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return P(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return P(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 S(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&&!T(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ze(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||S(this.options.enabled,this.#t)!==S(t.enabled,this.#t)||S(this.options.staleTime,this.#t)!==S(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||S(this.options.enabled,this.#t)!==S(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 T(this.getCurrentResult(),n)||(this.#r=n,this.#i=e),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(t).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(x)),t}#h(e){return!k()&&S(this.options.enabled,this.#t)!==!1&&oe(e)}#g(){this.#b();let e=S(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=se(this.#r.dataUpdatedAt,e)+1;this.#u=b.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return S(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=b.setInterval(()=>{(this.options.refetchIntervalInBackground||te.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(b.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(b.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=e===n?this.#n:e.state,{state:s}=e,c={...s},l=!1,u;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Re(e,t),o=i&&ze(e,n,t,r);(a||o)&&(c={...c,...Ne(s.data,e.options)}),t._optimisticResults===`isRestoring`&&(c.fetchStatus=`idle`)}let{error:d,errorUpdatedAt:f,status:p}=c;u=c.data;let m=!1;if(t.placeholderData!==void 0&&u===void 0&&p===`pending`){let e,n=i?.isPlaceholderData&&t.placeholderData===a?.placeholderData;n?(e=i.data,m=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,(n||e!==void 0)&&(p=`success`,u=_e(t.select&&!m?this.#s:i?.data,e,t),l=!0)}if(t.select&&u!==void 0&&!m){if(u===this.#s&&t.select===this.#o)u=this.#c;else try{this.#o=t.select,this.#s=u,u=t.select(u),u=_e(i?.data,u,t),this.#c=u,this.#a=null}catch(e){this.#a=e}}else u===void 0&&(this.#s=void 0,this.#a=null);this.#a&&(d=this.#a,u=this.#c,f=i?.error===d?i.errorUpdatedAt:Date.now(),p=`error`,l=!1);let h=c.fetchStatus===`fetching`,g=p===`pending`,_=p===`error`,v=g&&h,ee=u!==void 0;return{status:p,fetchStatus:c.fetchStatus,isPending:g,isSuccess:p===`success`,isError:_,isInitialLoading:v,isLoading:v,data:u,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:c.dataUpdateCount>o.dataUpdateCount||c.errorUpdateCount>o.errorUpdateCount,isFetching:h,isRefetching:h&&!g,isLoadingError:_&&!ee,isPaused:c.fetchStatus===`paused`,isPlaceholderData:l,isRefetchError:_&&ee,isStale:F(e,t),refetch:this.refetch,isEnabled:S(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.options,this.#t.state.data!==void 0&&(this.#l=this.#t),T(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||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();j.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 Le(e,t){return S(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||S(t.retryOnMount,e)!==!1)}function Re(e,t){return Le(e,t)||e.state.data!==void 0&&P(e,t,t.refetchOnMount)}function P(e,t,n){if(S(t.enabled,e)!==!1&&S(t.staleTime,e)!==`static`){let r=S(n,e);return r===`always`||r!==!1&&F(e,t)}return!1}function ze(e,t,n,r){return(e!==t||S(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&F(e,n)}function F(e,t){return S(t.enabled,e)!==!1&&e.isStaleByTime(S(t.staleTime,e))}var Be=class extends Ie{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:we(t,n.data),hasPreviousPage:Te(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Ve=class extends Oe{#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||He(),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=je({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})}this.state.isPaused&&r.canStart()&&t();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),j.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function He(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ue=class extends y{#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),T(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&C(t.mutationKey)!==C(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??He();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){j.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)})})}},We=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?D(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ge=e=>{u.useEffect(()=>{e.clearReset()},[e])},Ke=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||D(n,[e.error,r])),qe=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))}},Je=(e,t)=>e?.suspense&&t.isPending,Ye=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Xe(e,t,n){let r=f(),i=ee(),a=h(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,qe(o),We(o,i,s),Ge(i);let[l]=u.useState(()=>new t(a,o)),d=l.getOptimisticResult(o);u.useEffect(()=>{l.setOptions(o)},[o,l]);let p=!r&&c;if(u.useSyncExternalStore(u.useCallback(e=>{let t=p?l.subscribe(j.batchCalls(e)):x;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Je(o,d))throw Ye(o,l,i);if(Ke({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return o.notifyOnChangeProps?d:l.trackResult(d)}function I(e,t){return Xe(e,Ie,t)}function L(e,t){let n=h(t),[r]=u.useState(()=>new Ue(n,e));u.useEffect(()=>{r.setOptions(e)},[r,e]);let i=u.useSyncExternalStore(u.useCallback(e=>r.subscribe(j.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=u.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(x)},[r]);if(i.error&&D(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Ze(e,t){return Xe(e,Be,t)}var Qe={planned:`Blocked`,ready:`Ready`,waiting:`Planned`,paused:`Paused`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`,not_adopted:`Not adopted`},$e=`Planned on`,et={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`},tt={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`},nt={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`},rt={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`},it={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`},at={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`},ot={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`},st=`border-foreground/70`,ct=`text-foreground`,lt=[[`plannedAt`,`Planned`],[`startedAt`,`Started`],[`reviewAt`,Qe.in_review],[`completedAt`,`Completed`],[`reopenedAt`,`Reopened`],[`pausedAt`,Qe.paused]];function ut(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 dt=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`,style:`short`}),ft=604800;function pt(e,t=Date.now()/1e3){let n=e-t,r=Math.abs(n);if(r<60)return`just now`;if(r<ft){let[e,t]=r<3600?[Math.trunc(n/60),`minute`]:r<86400?[Math.trunc(n/3600),`hour`]:[Math.trunc(n/86400),`day`];return dt.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 mt(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 ht(e){return new Date(e*1e3).toLocaleString(`en`,{dateStyle:`medium`,timeStyle:`short`})}function gt(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 _t(e,t){return yt(e,t,e=>e!==`paused`)}function vt(e,t){return yt(e,t,e=>e===`paused`)}function yt(e,t,n){let r=gt(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 bt(e){return lt.flatMap(([t,n])=>{let r=e[t];return r===null?[]:[{label:n,at:r}]}).sort((e,t)=>e.at-t.at)}function xt({at:e,prefix:t=``,className:n}){return(0,p.jsx)(`time`,{className:n,dateTime:new Date(e*1e3).toISOString(),title:ht(e),children:`${t}${pt(e)}`})}var St=3e4;function Ct(e){return typeof e==`object`&&!!e&&typeof e.kind==`string`&&typeof e.code==`string`&&typeof e.message==`string`}async function R(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(),St),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 ${St/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 Ct(f)?f:Error(d||`${u.status} ${u.statusText}`)}var z={appInfo:()=>R(`app_info`),checkUpdate:()=>R(`check_update`),listWorkspaces:()=>V(R(`list_workspaces`)),getWorkspace:e=>V(R(`get_workspace`,{id:e})),createWorkspace:e=>V(R(`create_workspace`,{workspace:e})),updateWorkspace:e=>V(R(`update_workspace`,{workspace:e})),deleteWorkspace:e=>V(R(`delete_workspace`,{id:e})),restoreWorkspace:e=>V(R(`restore_workspace`,{id:e})),purgeWorkspace:e=>V(R(`purge_workspace`,{id:e})),listArchive:()=>V(R(`list_archive`)),listGuidelines:e=>V(R(`list_guidelines`,{workspaceId:e})),addGuideline:e=>V(R(`add_guideline`,{guideline:e})),updateGuideline:e=>V(R(`update_guideline`,{guideline:e})),deleteGuideline:e=>V(R(`delete_guideline`,{id:e})),listTasks:e=>V(R(`list_tasks`,{filter:e})),listTaskRelations:()=>V(R(`list_task_relations`)),addTaskRelation:(e,t)=>V(R(`add_task_relation`,{taskId:e,relatedId:t})),removeTaskRelation:(e,t)=>V(R(`remove_task_relation`,{taskId:e,relatedId:t})),getTask:e=>V(R(`get_task`,{id:e})),createTask:e=>V(R(`create_task`,{task:e})),updateTask:e=>V(R(`update_task`,{task:e})),moveTask:(e,t)=>V(R(`move_task`,{id:e,workspaceId:t})),pauseTask:e=>V(R(`pause_task`,{id:e})),waitTask:(e,t,n)=>V(R(`wait_task`,{id:e,until:t,reason:n})),endWait:e=>V(R(`end_wait`,{id:e})),setCompletionNote:(e,t)=>V(R(`set_completion_note`,{id:e,note:t})),reopenTask:(e,t)=>V(R(`reopen_task`,{id:e,reason:t})),setTaskOutcome:(e,t,n)=>V(R(`set_task_outcome`,{id:e,resolution:t,note:n})),checkCriterion:(e,t,n,r)=>V(R(`check_criterion`,{taskId:e,criterionId:t,met:n,evidence:r})),deleteTask:e=>V(R(`delete_task`,{id:e})),deleteDoneTasks:e=>V(R(`delete_done_tasks`,{workspaceId:e})),restoreTask:e=>V(R(`restore_task`,{id:e})),purgeTask:e=>V(R(`purge_task`,{id:e})),addDependency:(e,t,n)=>V(R(`add_dependency`,{taskId:e,dependsOn:t,confirmPause:n})),removeDependency:(e,t)=>V(R(`remove_dependency`,{taskId:e,dependsOn:t})),startTask:(e,t,n)=>V(R(`start_task`,{id:e,reason:t,refs:n})),completeTask:(e,t,n)=>V(R(`complete_task`,{id:e,note:t,refs:n})),concludeTask:(e,t,n,r)=>V(R(`conclude_task`,{id:e,note:t,outcome:n,shippedWith:r})),linkIssue:(e,t)=>V(R(`link_issue`,{id:e,reference:t})),mcpServerInfo:()=>R(`mcp_server_info`),listConnectedApps:()=>V(R(`list_connected_apps`)),revokeConnectedApp:e=>V(R(`revoke_connected_app`,{grantId:e})),reviewPeriod:(e,t)=>V(R(`review_period`,{from:e,to:t})),reviewReport:e=>V(R(`review_report`,{request:e})),getReviewTimeZone:()=>V(R(`get_review_time_zone`)),setReviewTimeZone:e=>V(R(`set_review_time_zone`,{timeZone:e})),saveReviewSnapshot:e=>V(R(`save_review_snapshot`,{request:e})),listReviewSnapshots:()=>V(R(`list_review_snapshots`)),getReviewSnapshot:e=>V(R(`get_review_snapshot`,{id:e})),deleteReviewSnapshot:e=>V(R(`delete_review_snapshot`,{id:e})),getBackupSettings:()=>R(`get_backup_settings`),getBackupStatus:()=>R(`get_backup_status`),saveBackupSettings:e=>V(R(`save_backup_settings`,{settings:e})),listBackups:()=>V(R(`list_backups`)),restoreBackup:e=>V(R(`restore_backup`,{name:e})),listChat:e=>V(R(`list_chat`,{before:e})),sendChatMessage:(e,t)=>V(R(`send_chat_message`,{body:e,clientId:t}))},B={tasksChanged:H(`tasks-changed`),workspacesChanged:H(`workspaces-changed`),guidelinesChanged:H(`guidelines-changed`),taskStatusChanged:H(`task-status-changed`),taskReady:H(`task-ready`),chatChanged:H(`chat-changed`),chatTyping:H(`chat-typing`)};async function V(e){try{return{status:`ok`,data:await e}}catch(e){if(e instanceof Error)throw e;return{status:`error`,error:e}}}function H(e){return{listen:t=>l(e,t)}}function wt(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 Tt(e,t){return/filename="([^"]+)"/.exec(e.headers.get(`Content-Disposition`)??``)?.[1]??t}function Et(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=Tt(e,`toodo-backup.sqlite3`);return Et(t,await e.blob()),t}async function Ot(e){return Et(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`],messages:[]};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 Wt(){return navigator.serviceWorker.getRegistration()}async function Gt(e){let t=await(await Wt())?.pushManager.getSubscription()??null;return t===null||Ut(t,e)?t:(await t.unsubscribe(),null)}function q(e){return typeof e==`object`&&!!e}function Kt(e){return q(e)&&typeof e.completion==`boolean`&&typeof e.messages==`boolean`}function qt(e){return q(e)&&typeof e.message==`string`&&typeof e.at==`number`}function Jt(e){return q(e)&&typeof e.endpoint==`string`&&Kt(e.settings)&&(e.lastFailure===null||qt(e.lastFailure))}function Yt(e){return q(e)&&typeof e.publicKey==`string`&&(e.subscription===null||Jt(e.subscription))}async function Xt(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 Zt(e){return Xt(`PUT /api/push/subscription`,await c(`/api/push/subscription`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e.toJSON())}),Jt)}async function Qt(){let e=await Xt(`GET /api/push`,await c(`/api/push`),Yt),t=await Gt(Ht(e.publicKey)),n=t===null?null:t.endpoint===e.subscription?.endpoint?e.subscription:await Zt(t);return K=n?.settings??null,{publicKey:e.publicKey,permission:Notification.permission,subscription:n}}var $t=1e4;async function en(){let e,t=new Promise((t,n)=>{e=setTimeout(()=>n(Error(`The service worker did not become active within ${$t/1e3} seconds. Reload the app and try again.`)),$t)});try{return await Promise.race([navigator.serviceWorker.ready,t])}finally{clearTimeout(e)}}async function tn(e,t){if(await e!==`granted`)throw Error(`Notifications were not allowed.`);if(await Wt()===void 0)throw Error(`Notifications need the service worker, which only the built app installs.`);let{pushManager:n}=await en(),r=Ht(t),i=await Gt(r)??await n.subscribe({userVisibleOnly:!0,applicationServerKey:r});try{let e=await Zt(i);return K=e.settings,e}catch(e){throw await i.unsubscribe(),e}}async function nn(){await(await(await Wt())?.pushManager.getSubscription())?.unsubscribe(),K=null,await c(`/api/push/subscription`,{method:`DELETE`})}async function rn(e){let t=await Xt(`PUT /api/push/settings`,await c(`/api/push/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),Jt);return K=t.settings,t}async function an(){await c(`/api/push/test`,{method:`POST`})}var on=`toodo-open-task`,sn=`toodo-open-chat`;function cn(e){if(!(`serviceWorker`in navigator))return()=>{};let t=navigator.serviceWorker,n=({data:t})=>{typeof t==`object`&&t&&`type`in t&&t.type===sn&&e()};return t.addEventListener(`message`,n),()=>t.removeEventListener(`message`,n)}function ln(e){if(!(`serviceWorker`in navigator))return()=>{};let t=navigator.serviceWorker,n=({data:t})=>{typeof t==`object`&&t&&`type`in t&&t.type===on&&`taskId`in t&&typeof t.taskId==`number`&&e(t.taskId)};return t.addEventListener(`message`,n),()=>t.removeEventListener(`message`,n)}async function un(){return`Notification`in window&&Notification.permission===`granted`}async function dn(){return`Notification`in window?Notification.requestPermission():`denied`}function fn(e){Vt(e.title)||new Notification(e.title,{body:e.body})}var pn={planned:`Planned`,in_progress:`In progress`,in_review:`Awaiting completion`,done:`Done`};function mn(e){return e.status===`done`&&e.resolution===`completed`?`Completed`:e.status===`done`&&e.resolution===`not_adopted`?`Not adopted`:pn[e.status]}function hn(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 gn(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:hn(t,e),body:`#${e.id} ${e.title}: ${pn[t]} -> ${mn(e)}`}]})}async function _n(e){if(e.length!==0&&(await un()||await dn()===`granted`))for(let t of e)fn(t)}var vn=class extends Error{kind;code;constructor(e){super(wt(e)),this.name=`CommandFailure`,this.kind=e.kind,this.code=e.code}};async function J(e){let t=await e;if(t.status===`error`)throw new vn(t.error);return t.data}var Y={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],chat:[`chat`]};function yn(){return Ze({queryKey:Y.chat,queryFn:({pageParam:e})=>J(z.listChat(e)),initialPageParam:null,getNextPageParam:e=>e.hasEarlier?e.messages[0]?.id??null:null})}function bn(e){return[...e.pages].reverse().flatMap(e=>e.messages)}function xn(){let e=h();return L({mutationFn:({body:e,clientId:t})=>J(z.sendChatMessage(e,t)),onSuccess:()=>e.invalidateQueries({queryKey:Y.chat})})}function Sn(){return I({queryKey:Y.mcpServerInfo,queryFn:()=>z.mcpServerInfo(),refetchInterval:5e3})}function Cn(){return I({queryKey:Y.backups,queryFn:()=>J(z.listBackups())})}function wn(){return I({queryKey:Y.backupSettings,queryFn:()=>z.getBackupSettings()})}function Tn(){return I({queryKey:Y.backupStatus,queryFn:()=>z.getBackupStatus(),refetchInterval:6e4})}function En(){let e=h();return L({mutationFn:e=>J(z.saveBackupSettings(e)),onSuccess:t=>(e.setQueryData(Y.backupSettings,t),Promise.all([e.invalidateQueries({queryKey:Y.backups}),e.invalidateQueries({queryKey:Y.backupStatus})]))})}function Dn(){let e=h();return L({mutationFn:e=>J(z.restoreBackup(e)),onSuccess:()=>e.invalidateQueries()})}function On(){return L({mutationFn:Dt})}function kn(){return L({mutationFn:Ot})}function An(){let e=h();return L({mutationFn:kt,onSuccess:()=>e.invalidateQueries()})}function jn(){return I({queryKey:Y.workspaces,queryFn:()=>J(z.listWorkspaces())})}function Mn(){let e=h();return L({mutationFn:e=>J(z.createWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:Y.workspaces})})}function Nn(){let e=h();return L({mutationFn:e=>J(z.updateWorkspace(e)),onSuccess:()=>e.invalidateQueries({queryKey:Y.workspaces,exact:!0})})}function Pn(){return Z(e=>J(z.deleteWorkspace(e)))}function Fn(){return I({queryKey:Y.archive,queryFn:()=>J(z.listArchive())})}function X(e){return Promise.all([e.invalidateQueries({queryKey:Y.tasks}),e.invalidateQueries({queryKey:[`tasks`]}),e.invalidateQueries({queryKey:[`review`]})])}function Z(e){let t=h();return L({mutationFn:e,onSuccess:()=>Promise.all([X(t),t.invalidateQueries({queryKey:Y.workspaces,exact:!0})])})}function In(){return Z(e=>J(z.restoreWorkspace(e)))}function Ln(){return Z(e=>J(z.purgeWorkspace(e)))}function Rn(){return Z(e=>J(z.restoreTask(e)))}function zn(){return Z(e=>J(z.purgeTask(e)))}function Bn(e){return I({queryKey:Y.guidelines(e),queryFn:()=>J(z.listGuidelines(e))})}function Vn(e){let t=h();return L({mutationFn:e,onSuccess:e=>t.invalidateQueries({queryKey:Y.guidelines(e.workspaceId)})})}function Hn(){return Vn(e=>J(z.addGuideline(e)))}function Un(){return Vn(e=>J(z.updateGuideline(e)))}function Wn(){return Vn(e=>J(z.deleteGuideline(e)))}var Gn=[`planned`,`in_progress`,`in_review`];function Q(e){return J(z.listTasks(e))}async function Kn(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:Gn}),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 qn(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 Jn(e){let t=e.getQueryData(Y.tasks);return t===void 0?void 0:qn(t)}async function Yn(e){let t=e.getQueryData(Y.tasks);t===void 0||t.pages.length<=1||(await e.cancelQueries({queryKey:Y.tasks,exact:!0}),e.setQueryData(Y.tasks,e=>e===void 0?e:{pages:e.pages.slice(0,1),pageParams:e.pageParams.slice(0,1)}))}function Xn(e){let t=h();(0,u.useEffect)(()=>{if(!e)Yn(t);else return()=>void Yn(t)},[e,t])}function Zn(e=[]){let t=Ze({queryKey:Y.tasks,queryFn:({pageParam:e})=>Kn(e),initialPageParam:null,getNextPageParam:e=>e.olderBefore,select:qn}),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=I({queryKey:[...Y.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 Qn(e,t){return I({queryKey:Y.review(e,t),queryFn:()=>J(z.reviewPeriod(e,t))})}function $n(){return I({queryKey:Y.reviewTimeZone,queryFn:()=>J(z.getReviewTimeZone())})}function er(){let e=h();return L({mutationFn:e=>J(z.setReviewTimeZone(e)),onSuccess:()=>e.invalidateQueries({queryKey:[`review`]})})}function tr(){return I({queryKey:Y.reviewSnapshots,queryFn:()=>J(z.listReviewSnapshots())})}function nr(e){return I({queryKey:Y.reviewSnapshot(e??0),queryFn:()=>J(z.getReviewSnapshot(e??0)),enabled:e!==null,staleTime:1/0})}function rr(){let e=h();return L({mutationFn:e=>J(z.saveReviewSnapshot(e)),onSuccess:()=>e.invalidateQueries({queryKey:Y.reviewSnapshots})})}function ir(){let e=h();return L({mutationFn:e=>J(z.deleteReviewSnapshot(e)),onSuccess:()=>e.invalidateQueries({queryKey:Y.reviewSnapshots})})}function ar(){let e=h();(0,u.useEffect)(()=>{let t=[B.tasksChanged.listen(async()=>{let t=Jn(e);await X(e),t===void 0||document.hasFocus()||_n(gn(t,Jn(e)??[])).catch(e=>console.error(`toodo: failed to show status notifications`,e))}),B.workspacesChanged.listen(()=>e.invalidateQueries({queryKey:Y.workspaces,exact:!0})),B.guidelinesChanged.listen(t=>e.invalidateQueries({queryKey:Y.guidelines(t.payload.workspaceId)})),B.chatChanged.listen(()=>e.invalidateQueries({queryKey:Y.chat}))];return()=>{for(let e of t)e.then(e=>e())}},[e])}function or(){let e=h();return L({mutationFn:e=>J(z.startTask(e,null,null)),onSuccess:()=>X(e)})}function sr(){let e=h();return L({mutationFn:e=>J(z.completeTask(e,null,null)),onSuccess:()=>X(e)})}function cr(){let e=h();return L({mutationFn:({id:e,note:t,shippedWith:n=null})=>J(z.concludeTask(e,t,n===null?`not_adopted`:`shipped_with`,n)),onSuccess:()=>X(e)})}function lr(){let e=h();return L({mutationFn:({id:e,note:t})=>J(z.setCompletionNote(e,t)),onSuccess:()=>X(e)})}function ur(){let e=h();return L({mutationFn:({id:e,reason:t})=>J(z.reopenTask(e,t)),onSuccess:()=>X(e)})}function dr(){let e=h();return L({mutationFn:({id:e,resolution:t,note:n})=>J(z.setTaskOutcome(e,t,n)),onSuccess:()=>X(e)})}function fr(){let e=h();return L({mutationFn:e=>J(z.updateTask(e)),onSuccess:()=>X(e)})}function pr(){let e=h();return L({mutationFn:({id:e,workspaceId:t})=>J(z.moveTask(e,t)),onSuccess:()=>X(e)})}function $(e){let t=h();return L({mutationFn:e,onSuccess:()=>X(t)})}function mr(){return $(e=>J(z.pauseTask(e)))}function hr(){return $(({id:e,until:t,reason:n})=>J(z.waitTask(e,t,n)))}function gr(){return $(e=>J(z.endWait(e)))}function _r(){return $(({taskId:e,criterionId:t,met:n,evidence:r})=>J(z.checkCriterion(e,t,n,r)))}function vr(){return Z(e=>J(z.deleteTask(e)))}function yr(){return Z(e=>J(z.deleteDoneTasks(e)))}function br(e,t){return I({queryKey:[...Y.tasks,`done-count`,e],queryFn:async()=>(await Q({workspaceId:e,statuses:[`done`]})).length,enabled:t})}function xr(){return $(({id:e,dependsOn:t,confirmPause:n})=>J(z.addDependency(e,t,n)))}function Sr(){return $(({id:e,dependsOn:t})=>J(z.removeDependency(e,t)))}function Cr(){return I({queryKey:Y.taskRelations,queryFn:()=>J(z.listTaskRelations())})}function wr(e){let t=h();return L({mutationFn:e,onSuccess:()=>t.invalidateQueries({queryKey:Y.taskRelations})})}function Tr(){return wr(({taskId:e,relatedId:t})=>J(z.addTaskRelation(e,t)))}function Er(){return wr(({taskId:e,relatedId:t})=>J(z.removeTaskRelation(e,t)))}function Dr(){let e=h();return L({mutationFn:e=>J(z.createTask(e)),onSuccess:()=>X(e)})}export{Un as $,w as $t,mr as A,ot as At,nr as B,tt as Bt,kn as C,ut as Ct,Sn as D,bt as Dt,Bn as E,pt as Et,ur as F,et as Ft,xn as G,M as Gt,$n as H,I as Ht,Dn as I,it as It,er as J,C as Jt,ar as K,j as Kt,Rn as L,at as Lt,Ln as M,st as Mt,Sr as N,$e as Nt,pr as O,vt as Ot,Er as P,Qe as Pt,Zn as Q,x as Qt,In as R,nt as Rt,br as S,_t as St,gr as T,mt as Tt,En as U,Ve as Ut,tr as V,L as Vt,rr as W,Me as Wt,or as X,le as Xt,dr as Y,ue as Yt,Cr as Z,ce as Zt,yr as _,Rt as _t,Hn as a,h as an,nn as at,vr as b,B as bt,wn as c,cn as ct,yn as d,rn as dt,S as en,fr as et,_r as f,an as ft,Mn as g,Pt as gt,Dr as h,Ft as ht,xr as i,g as in,jn as it,zn as j,ct as jt,Xn as k,gt as kt,Tn as l,ln as lt,cr as m,Lt as mt,Y as n,te as nn,An as nt,Tr as o,tn as ot,sr as p,It as pt,lr as q,ae as qt,J as r,y as rn,hr as rt,Fn as s,Qt as st,bn as t,E as tn,Nn as tt,Cn as u,zt as ut,Wn as v,Et as vt,On as w,ht as wt,Pn as x,xt,ir as y,z as yt,Qn as z,rt as zt};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-C3cWAN_r.js";import{A as r,Bt as i,C as a,D as o,E as s,G as c,J as l,L as u,M as d,N as f,Nt as p,O as m,P as ee,Pt as h,Q as te,Rt as g,S as ne,T as _,X as v,Z as re,_ as ie,b as y,c as ae,ct as oe,d as se,dt as b,f as x,g as S,h as C,j as w,k as ce,l as T,m as E,p as D,s as le,st as ue,u as O,v as k,w as de,x as A,y as j,zt as fe}from"./index-BhedIiZp.js";import{t as M}from"./Selector-DoBdC70u.js";import{n as N,t as P}from"./button-HISRpujD.js";import{B as pe,Bt as F,Ct as I,H as L,It as R,J as z,Ot as B,St as V,V as me,W as he,it as ge,kt as H,r as _e,s as ve,vt as ye,wt as be,xt as U,y as xe,yt as Se,z as Ce}from"./queries-Bcvk9W54.js";import{t as W}from"./opener-DWhHPoCL.js";var G=e(t(),1),K=n(),we={completed:F.success,opened_for_review:F.review,started:F.progress,worked_on:F.progress,planned:F.neutral},q=`live`,J=`all`,Y=`any`,Te=[{kind:`week`,label:`Week`},{kind:`month`,label:`Month`},{kind:`quarter`,label:`Quarter`},{kind:`year`,label:`Year`},{kind:`custom`,label:`Custom`}];function Ee({disabled:e,items:t}){return(0,K.jsx)(c,{items:t,alignment:`end`,menuWidth:192,renderTrigger:t=>(0,K.jsx)(P,{...t,size:`sm`,variant:`primary`,icon:(0,K.jsx)(g,{}),label:`Export`,isDisabled:e})})}function X(e,t){return`${e} ${t}${e===1?``:`s`}`}function De(){let e=L(),t=z(),[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(null),c=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];async function l(e){s(null);try{await t.mutateAsync(e),r(!1)}catch(e){s(e instanceof Error?e.message:String(e))}}if(!e.data)return null;let{timeZone:u,configured:d}=e.data;return n?(0,K.jsxs)(`form`,{"aria-label":`Review time zone`,className:`flex flex-wrap items-center gap-2 print:hidden`,onSubmit:e=>{e.preventDefault(),l(i)},children:[(0,K.jsx)(`label`,{htmlFor:`review-time-zone`,className:`text-xs`,children:`Time zone for every device`}),(0,K.jsx)(`input`,{id:`review-time-zone`,list:`review-time-zones`,required:!0,className:b(v,`w-56`),value:i,onChange:e=>a(e.target.value)}),(0,K.jsx)(`datalist`,{id:`review-time-zones`,children:c.map(e=>(0,K.jsx)(`option`,{value:e},e))}),(0,K.jsx)(P,{size:`sm`,variant:`primary`,type:`submit`,label:`Save`,isDisabled:t.isPending}),d!==null&&(0,K.jsx)(P,{size:`sm`,variant:`secondary`,label:`Use the server's`,onClick:()=>void l(null)}),(0,K.jsx)(P,{size:`sm`,variant:`ghost`,label:`Cancel`,onClick:()=>r(!1)}),o&&(0,K.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-destructive`,children:o})]}):(0,K.jsxs)(`span`,{children:[`Days are in `,u,d===null&&` (the server's time zone)`,`.`,` `,(0,K.jsx)(P,{size:`sm`,variant:`ghost`,label:`Change time zone`,className:`print:hidden`,onClick:()=>{a(d??u),r(!0)}})]})}function Z({onShowTask:e}){let[t,n]=(0,G.useState)(()=>A(`week`,I(Date.now()/1e3))),[s,c]=(0,G.useState)(null),[f,p]=(0,G.useState)(j),[m,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(null),x=Ce(t.from,t.to),S=me(),C=pe(_),w=he(),T=xe(),E=_!==null,D=E?C:x,O=ge(),k=ve(),F=E?C.data?.workspaces??[]:[...O.data??[],...k.data?.workspaces??[]],L=new Map(F.map(e=>[e.id,e.name])),R=E?C.data&&{period:{kind:C.data.summary.period,from:C.data.summary.from,to:C.data.summary.to},entries:C.data.entries,start:C.data.summary.start,end:C.data.summary.end,timeZone:C.data.summary.timeZone,now:C.data.summary.savedAt}:x.data&&{period:t,entries:x.data.entries,start:x.data.start,end:x.data.end,timeZone:x.data.timeZone,now:Date.now()/1e3},z=R?.period??t,B=R&&se(R.entries,f),V=ce(R?.entries??[]);f.label!==null&&!V.includes(f.label)&&V.push(f.label);let H=[f.workspaceId===null?`across all workspaces`:`in ${L.get(f.workspaceId)??`workspace ${f.workspaceId}`}`,f.label!==null&&`labelled ${f.label}`].filter(Boolean).join(`, `),W=a[z.kind];function Z(e){c(null),n(e)}function Q(e){c(null),g(null),v(e)}async function Ne(){try{let e=await w.mutateAsync({period:t.kind,from:t.from,to:t.kind===`custom`?t.to:null,workspaceId:f.workspaceId,label:f.label,title:null});c(`Saved "${e.title}" with ${X(e.entryCount,`task`)}; reopen it from Saved reviews.`)}catch(e){c(`Could not save the review: ${e instanceof Error?e.message:String(e)}`)}}async function Pe(e){try{await T.mutateAsync(e),Q(null),c(`Deleted the saved review.`)}catch(e){c(`Could not delete the saved review: ${e instanceof Error?e.message:String(e)}`)}}function Fe(e){e!==t.kind&&Z(e===`custom`?{...t,kind:e}:A(e,t.from))}function $(e){return E?C.data?Promise.resolve(e===`csv`?C.data.csv:C.data.markdown):Promise.reject(Error(`the saved review is still loading`)):_e(Se.reviewReport({period:t.kind,date:null,from:t.from,to:t.kind===`custom`?t.to:null,format:e,timeZone:null,workspaceId:f.workspaceId,label:f.label}))}async function Ie(){try{let e=$(`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})])}c(`Copied as Markdown.`)}catch(e){c(`Could not copy: ${e instanceof Error?e.message:String(e)}`)}}async function Le(e){try{let t=await $(e);ye(t.fileName,new Blob([t.contents],{type:`${t.mediaType};charset=utf-8`})),c(`Downloaded ${t.fileName}`)}catch(e){c(`Could not export: ${e instanceof Error?e.message:String(e)}`)}}return(0,K.jsxs)(`section`,{"aria-labelledby":`review-heading`,className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h2`,{id:`review-heading`,className:`text-xl font-semibold tracking-tight`,children:E&&C.data?C.data.summary.title:de[z.kind]}),(0,K.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Work recorded from `,z.from,` to `,z.to,` `,H,`.`,` `,E?C.data&&(0,K.jsxs)(`span`,{children:[`Saved `,be(C.data.summary.savedAt),`, with days in `,C.data.summary.timeZone,`; it stays as it was when saved.`]}):(0,K.jsx)(De,{})]})]}),(E||(S.data?.length??0)>0)&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,K.jsx)(M,{label:`Saved reviews`,isLabelHidden:!0,size:`sm`,options:[{value:q,label:`Live review`},...(S.data??[]).map(e=>({value:String(e.id),label:`${e.title} (saved ${I(e.savedAt)})`}))],value:_===null?q:String(_),onChange:e=>Q(e===q?null:Number(e))}),_!==null&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(P,{size:`sm`,variant:`secondary`,label:`Back to the live review`,onClick:()=>Q(null)}),(0,K.jsx)(P,{size:`sm`,variant:`ghost`,label:`Delete saved review`,isDisabled:T.isPending,onClick:()=>void Pe(_)})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 print:hidden`,children:[!E&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(te,{label:`Review period`,size:`sm`,value:t.kind,onChange:e=>typeof e==`string`&&Fe(e),children:Te.map(({kind:e,label:t})=>(0,K.jsx)(re,{value:e,label:t},e))}),t.kind===`week`&&(0,K.jsx)(u,{label:`Week starting`,size:`sm`,format:`system_date`,value:t.from,onChange:e=>e&&Z(d(e))}),t.kind===`custom`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(u,{label:`From`,size:`sm`,format:`system_date`,max:t.to,value:t.from,onChange:e=>e&&e<=t.to&&Z({...t,from:e})}),(0,K.jsx)(u,{label:`To`,size:`sm`,format:`system_date`,min:t.from,value:t.to,onChange:e=>e&&e>=t.from&&Z({...t,to:e})})]}),t.kind!==`week`&&t.kind!==`custom`&&(0,K.jsx)(`span`,{className:`px-1 text-sm font-medium`,children:ne(t)}),(0,K.jsx)(N,{size:`sm`,variant:`secondary`,icon:(0,K.jsx)(i,{}),label:`Previous ${W}`,tooltip:`Previous ${W}`,onClick:()=>Z(r(t,-1))}),(0,K.jsx)(N,{size:`sm`,variant:`secondary`,icon:(0,K.jsx)(fe,{}),label:`Next ${W}`,tooltip:`Next ${W}`,onClick:()=>Z(r(t,1))}),t.kind!==`custom`&&(0,K.jsx)(P,{size:`sm`,variant:`ghost`,label:`This ${W}`,onClick:()=>Z(A(t.kind,I(Date.now()/1e3)))})]}),(0,K.jsx)(`div`,{className:`ml-auto`,children:(0,K.jsx)(Ee,{disabled:!B,items:[...E?[]:[{label:`Save as snapshot`,onClick:()=>void Ne()}],{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,K.jsxs)(`div`,{role:`group`,"aria-label":`Review filters`,className:`flex flex-wrap items-center gap-2 print:hidden`,children:[(0,K.jsx)(M,{label:`Workspace`,isLabelHidden:!0,size:`sm`,options:[{value:J,label:`All workspaces`},...F.map(e=>({value:String(e.id),label:e.name}))],value:f.workspaceId===null?J:String(f.workspaceId),onChange:e=>p({...f,workspaceId:e===J?null:Number(e)})}),(0,K.jsx)(M,{label:`Label`,isLabelHidden:!0,size:`sm`,options:[{value:Y,label:V.length===0?`No labels in this period`:`Any label`},...V.map(e=>({value:`label:${e}`,label:e}))],value:f.label===null?Y:`label:${f.label}`,onChange:e=>p({...f,label:e===Y?null:e.slice(6)})}),(f.workspaceId!==null||f.label!==null)&&(0,K.jsx)(P,{size:`sm`,variant:`ghost`,label:`Clear filters`,onClick:()=>p(j)})]}),s&&(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground print:hidden`,children:s}),(0,K.jsx)(`p`,{role:`status`,className:b(`text-sm text-muted-foreground`,!D.isPending&&`sr-only`),children:D.isPending?`Loading the review...`:B?`Showing ${B.length} ${B.length===1?`task`:`tasks`} with activity in this ${W}.`:``}),D.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load the review: `,D.error.message]}),B?.length===0&&(0,K.jsx)(le,{title:R?.entries.length===0?`No recorded activity in this ${W}.`:`No recorded activity in this ${W} matches the filters.`,hint:E?`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:E?void 0:(0,K.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2 print:hidden`,children:(0,K.jsx)(P,{size:`sm`,variant:`secondary`,label:`Show the ${W} before`,onClick:()=>Z(r(t,-1))})})}),R&&B&&B.length>0&&(0,K.jsx)(Me,{shown:R,entries:B,workspaces:F}),R&&B&&(0,K.jsx)(je,{shown:R,entries:B,editable:!E}),z.kind===`year`&&B&&(0,K.jsx)(Ae,{entries:B}),B&&ie(B).map(t=>(0,K.jsxs)(`section`,{"aria-label":y[t.outcome],className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`h3`,{className:b(`text-sm font-semibold`,we[t.outcome]),children:[y[t.outcome],` `,(0,K.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.entries.length,`)`]})]}),(0,K.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,K.jsxs)(`li`,{className:`flex flex-col gap-1 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(l,{type:t.taskType}),(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,t.id]}),(0,K.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,K.jsx)(h,{className:`shrink-0`,label:`Not adopted`}),i&&(0,K.jsx)(h,{className:`shrink-0`,label:`Archived`}),t.resolution===`completed`&&(0,K.jsx)(h,{className:`shrink-0`,variant:`green`,label:`Completed`}),o(t)&&(0,K.jsx)(ke,{url:o(t),stats:a}),(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground max-md:hidden print:inline`,children:[L.get(t.workspaceId)??`Workspace ${t.workspaceId}`,` · `,(0,K.jsx)(U,{at:n})]})]}),(0,K.jsx)(oe,{task:t}),i||E?null:m?.id===t.id?(0,K.jsx)(ee,{task:t,focusPlan:m.field,onDone:()=>g(null)}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground empty:hidden print:hidden`,children:(0,K.jsx)(ue,{task:t,onEdit:e=>g({id:t.id,field:e})})}),t.completionNote&&(0,K.jsx)(`p`,{"aria-label":`Completion note of #${t.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:t.completionNote}),R&&(0,K.jsx)(Oe,{task:t,shown:R}),r.length>0&&(0,K.jsx)(`ul`,{"aria-label":`Commits of #${t.id} this ${W}`,className:`flex flex-col gap-0.5`,children:r.map(e=>(0,K.jsxs)(`li`,{className:`flex gap-2 text-xs`,title:e.author,children:[(0,K.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}),(0,K.jsx)(`span`,{className:`truncate`,children:ae(e.message)})]},e.sha))})]},t.id))})]},t.outcome))]})}function Q(e){return e===0?`0h`:E(e)}function Oe({task:e,shown:t}){let{start:n,end:r,now:i}=t,a=V(e.timeline,i),o=B(e.timeline,i);if(a===null||o===null)return null;let s=H(e.timeline).filter(e=>e.state===`paused`&&e.start<r&&(e.end??i)>n);return(0,K.jsxs)(`div`,{"aria-label":`Time of #${e.id}`,className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`p`,{children:[Q(a),` active, `,Q(o),` waiting`]}),s.length>0&&(0,K.jsx)(`ul`,{"aria-label":`Waits of #${e.id}`,className:`flex flex-col gap-0.5`,children:s.map(e=>(0,K.jsxs)(`li`,{className:`break-words-keep`,children:[`Waiting `,Q(Math.max((e.end??i)-e.start,0)),` from `,I(e.start),e.end===null&&`, still waiting`,`: `,e.reason??`no reason recorded`]},e.start))})]})}function ke({url:e,stats:t}){let n=s(e),r=t=>{t.preventDefault(),W(e).catch(t=>console.error(`Failed to open ${e}`,t))};return(0,K.jsx)(`a`,{href:e,title:t?`${e} \u00b7 ${m(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 Ae({entries:e}){let t=f(e);return t===null?null:(0,K.jsxs)(`section`,{"aria-labelledby":`year-in-review-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,K.jsx)(`h3`,{id:`year-in-review-heading`,className:`text-sm font-semibold`,children:`Year in review`}),t.pullRequests&&(0,K.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Merged pull requests`}),(0,K.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.pullRequests})]}),(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Lines changed`}),(0,K.jsxs)(`dd`,{className:`text-lg font-semibold`,children:[(0,K.jsxs)(`span`,{children:[`+`,t.pullRequests.additions]}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),(0,K.jsxs)(`span`,{children:[`-`,t.pullRequests.deletions]})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Files changed`}),(0,K.jsx)(`dd`,{className:`text-lg font-semibold`,children:t.pullRequests.changedFiles})]}),(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Reviews`}),(0,K.jsxs)(`dd`,{className:`text-lg font-semibold`,title:S(t.pullRequests),children:[t.pullRequests.reviews,(0,K.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,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest pull requests`}),(0,K.jsx)(`ol`,{"aria-label":`Largest pull requests`,className:`flex flex-col gap-1`,children:t.largest.map(({task:e,pullRequest:t})=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,K.jsx)(l,{type:e.taskType}),(0,K.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:m(t)})]},e.id))})]}),t.research.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Research conclusions`}),(0,K.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,K.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,K.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,K.jsx)(h,{className:`shrink-0`,variant:n?`green`:`neutral`,label:n?`Adopted`:`Not adopted`}),(0,K.jsx)(U,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,at:t})]}),(0,K.jsx)(`p`,{"aria-label":`Research conclusion of #${e.id}`,className:`whitespace-pre-line break-words-keep text-xs`,children:e.completionNote??(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`No conclusion written.`})})]},e.id))})]}),t.overruns.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Largest estimate overruns`}),(0,K.jsx)(`ol`,{"aria-label":`Largest estimate overruns`,className:`flex flex-col gap-1`,children:t.overruns.map(({task:e,estimated:t,actual:n})=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,K.jsx)(l,{type:e.taskType}),(0,K.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,K.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[`estimated `,E(t),`, `,E(n),` active`]})]},e.id))})]})]})}function je({shown:e,entries:t,editable:n}){let r=_(e.end,t,e.now),i=n?t.filter(({archived:e})=>!e).map(({task:e})=>p(e)):[],a=i.filter(e=>e.includes(`estimate`)).length,o=i.filter(e=>e.includes(`dueDate`)).length;if(r===null&&a+o===0)return null;let s=(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Missing plan`}),(0,K.jsxs)(`dd`,{children:[[a>0&&`${X(a,`task`)} without an estimate`,o>0&&`${X(o,`task`)} without a due date`].filter(Boolean).join(`, `),`; add them from the marks on the tasks below`]})]});return(0,K.jsxs)(`section`,{"aria-labelledby":`plan-heading`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,K.jsx)(`h3`,{id:`plan-heading`,className:`text-sm font-semibold`,children:`Plan vs actual`}),r===null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm`,children:`No reviewed task has an estimate or a due date, so there is nothing to compare yet.`}),(0,K.jsx)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:s})]}):(0,K.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Estimate vs active time`}),(0,K.jsx)(`dd`,{children:r.time?C(r.time):`No completed task had an estimate`})]}),(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due dates met`}),(0,K.jsx)(`dd`,{children:r.dueDates?D(r.dueDates):`No completed task had a due date`})]}),a+o>0&&s]}),r!==null&&r.late.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:`Late tasks`}),(0,K.jsx)(`ul`,{"aria-label":`Late tasks`,className:`flex flex-col gap-1`,children:r.late.map(e=>(0,K.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[(0,K.jsx)(l,{type:e.task.taskType}),(0,K.jsx)(`span`,{className:`truncate font-medium`,children:e.task.title})]}),(0,K.jsx)(`span`,{className:b(`ml-auto shrink-0 text-xs`,F.danger),children:k(e)})]},e.task.id))})]})]})}function Me({shown:e,entries:t,workspaces:n}){let r=w(e.period,t,n,e.timeZone),i=Math.max(1,...(r.completedPerMonth??[]).map(({count:e})=>e));return(0,K.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,K.jsxs)(`dl`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[r.outcomes.map(({outcome:e,count:t})=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y[e]}),(0,K.jsx)(`dd`,{className:`text-lg font-semibold`,children:t})]},e)),r.notAdopted>0&&(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Not adopted`}),(0,K.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.notAdopted})]}),(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Commits`}),(0,K.jsx)(`dd`,{className:`text-lg font-semibold`,children:r.commits})]})]}),(0,K.jsxs)(`dl`,{className:`grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[auto_1fr]`,children:[T.map(e=>{let t=r[e];return(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:O[e]}),(0,K.jsx)(`dd`,{children:t===null?`No data`:`${E(t.median)} (${t.tasks} ${t.tasks===1?`task`:`tasks`})`})]},e)}),r.changes&&(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Changes in completed pull requests`}),(0,K.jsx)(`dd`,{children:x(r.changes)})]}),r.completedByType.length>0&&(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by type`}),(0,K.jsx)(`dd`,{children:r.completedByType.map(({taskType:e,count:t})=>`${e} ${t}`).join(`, `)})]}),r.completedByWorkspace.length>0&&(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed by workspace`}),(0,K.jsx)(`dd`,{children:r.completedByWorkspace.map(({workspace:e,count:t})=>`${e} ${t}`).join(`, `)})]})]}),r.completedPerMonth&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h3`,{className:`text-xs text-muted-foreground`,children:`Completed per month`}),(0,K.jsx)(`ul`,{"aria-label":`Completed per month`,className:`flex flex-col gap-0.5`,children:r.completedPerMonth.map(({month:e,count:t})=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`w-16 shrink-0 font-mono text-muted-foreground`,children:e}),(0,K.jsx)(`span`,{"aria-hidden":!0,className:b(`h-2 rounded-sm`,R.success),style:{width:`${t/i*60}%`,minWidth:t>0?4:0}}),(0,K.jsx)(`span`,{children:t})]},e))})]})]})}export{Z as Review};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-C3cWAN_r.js";import{n as r,t as i}from"./button-HISRpujD.js";import{t as a}from"./details-sheet-DZm5HiKY.js";import{F as o,Ft as s,H as c,I as l,It as u,Mt as d,Pt as f,U as p,Vt as m,W as h,at as g,ct as _,dt as v,it as y,lt as b,ot as x,ut as S}from"./index-BhedIiZp.js";import{t as C,u as w}from"./Selector-DoBdC70u.js";import{Bt as T,Dt as E,Et as D,O,P as k,Z as ee,et as A,f as j,it as M,o as N,wt as te,xt as P}from"./queries-Bcvk9W54.js";import{t as ne}from"./opener-DWhHPoCL.js";import{t as F}from"./createLucideIcon-DtNDbJdC.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=F(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=F(R),B={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};B.node;var V=F(B),H=e(t(),1),U=n();function W({onClose:e,children:t}){let n=(0,H.useRef)(null),[r,o]=(0,H.useState)(!1);function s(){n.current?.querySelector(`form[data-dirty]`)?o(!0):e()}return(0,H.useEffect)(()=>{function e(e){e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[aria-haspopup='menu'][aria-expanded='true']`)||(r?o(!1):e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select, [role=combobox], [role=listbox]`)||s())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)}),(0,U.jsx)(a,{ref:n,width:`min(480px, max(360px, 40vw), calc(100vw - 32px))`,onClose:s,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)(i,{size:`sm`,variant:`secondary`,label:`Keep editing`,autoFocus:!0,onClick:()=>o(!1)}),(0,U.jsx)(i,{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)(P,{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 J({value:e}){if(/^https?:\/\//i.test(e)){let t=t=>{t.preventDefault(),ne(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 Y({task:e}){return e.refs.length===0?null:(0,U.jsx)(y,{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)(J,{value:e})},e))})})}function X({task:e,detailed:t}){let n=E(e.milestones);return n.length===0?null:t?(0,U.jsxs)(y,{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)(P,{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)(P,{at:t,prefix:`${e} `},e))})}function re({task:e,tasks:t,context:n,navigation:a}){let o=ee(),s=N(),c=k(),l=(o.data??[]).flatMap(({taskId:t,relatedId:n})=>t===e.id?[n]:n===e.id?[t]:[]).filter(e=>n.byId.has(e)),d=t.filter(t=>t.id!==e.id&&!l.includes(t.id)),f=[...new Set([e.workspaceId,...d.map(e=>e.workspaceId)])].map(e=>({workspaceId:e,tasks:d.filter(t=>t.workspaceId===e)})).filter(e=>e.tasks.length>0),p=S(),m=s.isPending||c.isPending||p,h=s.error??c.error;if(l.length===0&&f.length===0)return null;let g=f.length>0&&(0,U.jsx)(C,{label:`Add related task to #${e.id}`,isLabelHidden:!0,size:`sm`,width:192,placeholder:`Add related task...`,value:``,isDisabled:m,options:f.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&&s.mutate({taskId:e.id,relatedId:Number(t)})}}),_=h&&(0,U.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:h.message});return l.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs`,children:[g,_]}):(0,U.jsxs)(y,{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:[l.map(t=>{let o=n.byId.get(t),s=b(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)(i,{size:`sm`,variant:`secondary`,label:o===void 0?s:`${s} ${o.title}`,"aria-label":`Open related task ${s}`,tooltip:o?.title,className:`min-w-0 max-w-56 tabular-nums`,isDisabled:a===void 0||!a.canOpen(t),onClick:()=>a?.open(t)}),(0,U.jsx)(r,{size:`sm`,variant:`ghost`,label:`Remove related task #${t} from #${e.id}`,tooltip:`Remove related task`,icon:(0,U.jsx)(u,{}),isDisabled:m,onClick:()=>c.mutate({taskId:e.id,relatedId:t})})]},t)}),g]}),_]})}function ie({task:e}){let t=A();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(i,{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)(m,{"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=M(),n=O(),r=S(),i=t.data??[];return i.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)(C,{label:`Workspace of #${e.id}`,isLabelHidden:!0,size:`sm`,width:160,value:String(e.workspaceId),isDisabled:n.isPending||r,options:i.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 `,d(e.estimate)]}),e.dueDate!==null&&(0,U.jsx)(g,{task:e})]}),(0,U.jsx)(_,{task:e}),(0,U.jsx)(Y,{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)(f,{"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:te(t.at),children:[(0,U.jsx)(Z,{kind:t.kind}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:h(t.body)}),n.length>1&&(0,U.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`+${n.length-1} more`})]})}return(0,U.jsx)(y,{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)(P,{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)(x,{source:e.body})})]},t))})})}var ue={pending:`Pending`,met:`Met`,failed:`Failed`},de={pending:T.neutral,met:T.success,failed:T.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:v(`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?``:` ${D(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)(y,{label:`Criteria (${i} of ${n.length} met)`,children:r})}function me({task:e,criterion:t,detailed:n}){let r=j(),a=S(),[u,d]=(0,H.useState)(!1),[m,h]=(0,H.useState)(``),g=t.kind===`manual`&&e.status!==`done`,_=fe(t),y=l(t.kind)?t.target:null;function b(){d(!1),h(``)}let x=p(m.trim()!==``,b,r.isPending);function C(n){u?b():n?(r.reset(),d(!0)):r.mutate({taskId:e.id,criterionId:t.id,met:!1,evidence:null})}function E(n){n.preventDefault(),r.mutate({taskId:e.id,criterionId:t.id,met:!0,evidence:m.trim()||null},{onSuccess:b})}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:[_,t.evidence,y].filter(Boolean).join(`
2
- `)||void 0,children:[g?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(s,{size:`sm`,className:`shrink-0`,label:`Check criterion ${t.id} of #${e.id}`,isLabelHidden:!0,value:t.state===`met`||u,isDisabled:r.isPending||a,onChange:C}),t.state===`failed`&&(0,U.jsx)($,{state:`failed`})]}):(0,U.jsx)($,{state:t.state}),(0,U.jsx)(`span`,{className:v(`min-w-0`,n?`break-words-keep`:`truncate`,t.state===`failed`&&T.danger),children:t.text}),t.kind!==`manual`&&(0,U.jsx)(f,{className:`shrink-0`,label:o[t.kind]}),!n&&t.evidence&&(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.evidence})]}),n&&y&&(0,U.jsx)(`code`,{className:`ml-5.5 break-all text-muted-foreground`,children:y}),n&&(t.evidence||_)&&(0,U.jsxs)(`p`,{className:`ml-5.5 whitespace-pre-line break-words-keep text-muted-foreground`,children:[t.evidence,t.evidence&&_&&` · `,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)(P,{at:t.checkedAt})]})]})]}),u&&(0,U.jsxs)(`form`,{onSubmit:E,className:`ml-5.5 flex flex-wrap items-center gap-1`,onKeyDown:x.onKeyDown,children:[(0,U.jsx)(w,{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:m,onChange:h,hasAutoFocus:!0}),x.asking?(0,U.jsx)(c,{label:`Discard evidence for criterion ${t.id}`,question:`Discard the evidence?`,onKeep:x.keep,onDiscard:x.discard}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(i,{type:`submit`,size:`sm`,variant:`primary`,label:r.isPending?`Saving...`:`Save`,isDisabled:r.isPending}),(0,U.jsx)(i,{type:`button`,size:`sm`,variant:`ghost`,label:`Cancel`,onClick:x.request})]})]}),r.isError&&(0,U.jsx)(`p`,{role:`alert`,className:`ml-5.5 text-destructive`,children:r.error.message})]})}export{ie as AutopilotToggle,re as RelatedTasks,pe as TaskCriteria,W as TaskDetailsSheet,le as TaskNotes,oe as TaskPlan,X as TaskTimeline,ae as TaskWorkspace};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-C3cWAN_r.js";import{$ as r,$t as i,B as a,Ft as o,G as s,H as c,Ht as l,It as u,J as d,N as f,O as p,Pt as m,Q as h,T as g,U as _,W as v,Wt as y,Y as b,Z as x,_t as S,dt as C,et as w,ht as T,in as E,it as D,k as O,l as k,lt as A,nt as j,o as M,p as ee,pt as N,rn as P,rt as F,ut as te,wt as ne,x as re}from"./focusOutline.stylex-ZXdUNMFw.js";import{A as I,D as ie,F as ae,G as oe,J as se,K as ce,L,M as le,N as R,O as ue,Q as de,S as fe,Y as pe,Z as me,a as z,k as he,n as ge,nt as _e,ot as ve,q as B,rt as ye,tt as be,w as xe,y as V}from"./useLayerDismissal-D77qBJbE.js";import{i as H,o as Se,t as Ce}from"./primaryClick-88oQu3_u.js";var U=e(t(),1),we=be(),Te=_e(`TooltipPresentInterestContext`,1,null);Te.displayName=`TooltipPresentInterestContext`;function W(e){return e.hasAttribute(`tabindex`)?e.tabIndex>=0:[`A`,`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`].includes(e.tagName)?!e.disabled:e.isContentEditable}function Ee(e,t){return G(e.target,e.currentTarget,t)}function G(e,t,n){return n===`always`||n!==`never`&&t!=null&&(e===t||W(t))}function De(){let e=!1;return{focusIn(t,n){return e=Ee(t,n),e},focusOut(t,n){return!e&&!Ee(t,n)?!1:(e=!1,!0)}}}function Oe(e){return(e.style.anchorName??``).split(`,`).map(e=>e.trim()).filter(Boolean)}function K(e,t){e.style.anchorName=t.join(`, `)}function ke(e,t){let n=Oe(e);n.includes(t)||(n.push(t),K(e,n))}function Ae(e,t){let n=Oe(e);n.includes(t)&&K(e,n.filter(e=>e!==t))}var q=m(`layer/gesture-counter/state`,1,()=>({gesture:0,clickedGesture:null,contextMenuGesture:null,pressPointerId:null,releasingGesture:null,isDispatchingRelease:!1,releasingPointerType:``,claimedPress:null,isListening:!1,listenedDocuments:new WeakSet,unsubscribePress:null}));function je(){q.releasingGesture===void 0&&(q.releasingGesture=null),q.isDispatchingRelease===void 0&&(q.isDispatchingRelease=!1),q.releasingPointerType===void 0&&(q.releasingPointerType=``),q.listenedDocuments===void 0&&(q.listenedDocuments=new WeakSet)}function Me(){q.gesture+=1}function Ne(e){je(),q.isDispatchingRelease=!1,F(),Me(),q.pressPointerId=e.pointerId;let t=e.view??document.defaultView;if(q.unsubscribePress!=null||t==null)return;let n=[A(t,`pointerup`,Pe,{first:!0}),A(t,`pointercancel`,Pe,{first:!0}),A(t,`contextmenu`,J,{first:!0})];q.unsubscribePress=()=>{for(let e of n)e()}}function Pe(e){if(je(),e.type===`pointerup`){let t=q.gesture;q.releasingGesture=t,q.releasingPointerType=e.pointerType,q.isDispatchingRelease=!0,setTimeout(()=>{q.releasingGesture===t&&(q.releasingGesture=null)},0)}q.pressPointerId=null,q.unsubscribePress?.(),q.unsubscribePress=null}function J(){q.contextMenuGesture=q.gesture}function Fe(e){je(),q.clickedGesture=q.gesture,q.releasingGesture===q.gesture&&!(q.isDispatchingRelease&&e.detail===0)&&(q.releasingGesture=null)}function Ie(){q.isDispatchingRelease=!1}function Y(){je(),q.isListening||typeof document>`u`||(q.isListening=!0,Le(document))}function Le(e){let t=e.defaultView;t!=null&&(A(t,`pointerdown`,Ne,{first:!0}),t.addEventListener(`pointerup`,Ie)),e.addEventListener(`keydown`,Me,!0),e.addEventListener(`click`,Fe,!0)}function Re(e){Y(),e==null||e===document||q.listenedDocuments.has(e)||(q.listenedDocuments.add(e),Le(e))}function ze(){return Y(),q.gesture}function Be(){return Y(),q.clickedGesture===q.gesture}function Ve(){return Y(),q.releasingGesture===null||q.releasingGesture!==q.gesture?!1:!(q.releasingPointerType===`touch`&&D())}function He(e,t){let n=!1,r=()=>{n||(n=!0,s(),t())},i=e.defaultView,a=i==null?()=>{}:A(i,`click`,e=>{q.isDispatchingRelease&&e.detail===0||(q.releasingGesture===q.gesture&&(q.releasingGesture=null),r())},{first:!0}),o=setTimeout(r,0);function s(){n=!0,a(),clearTimeout(o)}return s}function Ue(){return Y(),q.pressPointerId!==null}function We(e,{releaseTarget:t=null,onRelease:n}={}){Y();let r=q.pressPointerId,i=e.ownerDocument.defaultView;if(r===null||i==null||q.claimedPress!==null&&q.claimedPress.layer===e&&q.claimedPress.pointerId===r&&q.claimedPress.gesture===q.gesture)return;let a={layer:e,pointerId:r,gesture:q.gesture};q.claimedPress=a;let o=n=>{try{if(n!==null){n.setPointerCapture(r);return}for(let n of[e,t])n?.hasPointerCapture(r)===!0&&n.releasePointerCapture(r)}catch{}};o(t??e);let s=null,c=()=>{let t=[];try{t=[...e.querySelectorAll(`:popover-open`)]}catch{}return[e,...t].map(e=>e.getBoundingClientRect())},l=(e,t)=>(s??=c(),s.some(n=>e>=n.left&&e<n.right&&t>=n.top&&t<n.bottom)),u=null,d=(e,n)=>(u??=t?.getBoundingClientRect()??null,u!==null&&e>=u.left&&e<u.right&&n>=u.top&&n<u.bottom),f=()=>{s=null,u=null},p=n=>{if(n.pointerId===r){let{clientX:r,clientY:i}=n;l(r,i)?o(null):t!==null&&d(r,i)?o(t):o(e)}},m=[],h=()=>{for(let e of m)e();m.length=0,q.claimedPress===a&&(q.claimedPress=null)},g=n=>{n.pointerId===r&&n.target!==e&&n.target!==t&&h()},_=e=>{e.pointerId===r&&(h(),e.type===`pointerup`&&n?.())},v=t=>{t.target===e&&t.newState===`closed`?(o(null),h()):f()};e.addEventListener(`toggle`,v,!0),m.push(A(i,`pointermove`,p),A(i,`gotpointercapture`,g),A(i,`pointerup`,_),A(i,`pointercancel`,_),A(i,`scroll`,f),A(i,`resize`,f),()=>e.removeEventListener(`toggle`,v,!0))}function Ge(e){Y(),q.contextMenuGesture===q.gesture&&We(e)}var Ke=new Set([`touch`,`pen`]);function qe(){let[e]=(0,U.useState)(Je);return(0,U.useEffect)(()=>()=>e.forget(),[e]),e}function Je(){let e=null,t=null,n=()=>{e?.(),e=null};return{press(r,i,a){if(n(),!Ke.has(r.pointerType))return!1;if(i==null)return!0;let o=ze();t=o;let s=()=>{i.removeEventListener(`click`,c),i.removeEventListener(`pointercancel`,s),e===s&&(e=null)},c=e=>{s(),ze()===o&&a(e)};return i.addEventListener(`click`,c),i.addEventListener(`pointercancel`,s),e=s,!0},forget:n,isTouchPressCurrent:()=>e!=null&&t===ze()}}var Ye=`data-astryx-layer-portal-boundary`,Xe=`external`;function Ze(e){return e.getAttribute(Ye)===Xe}var Qe=new Set(`p.h1.h2.h3.h4.h5.h6.dt.pre.legend.data.dfn.meter.output.progress.option.optgroup.table.thead.tbody.tfoot.tr.colgroup.ul.ol.menu.dl.select.datalist.picture.hgroup.ruby.rt.rp.a.button.label.summary.span.em.strong.b.i.u.s.small.mark.code.kbd.samp.var.sub.sup.abbr.cite.q.time.bdi.bdo.ins.del`.split(`.`));function $e(e){if(!e)return null;let t=null,n=!1,r=e;for(;r;){let e=r.tagName.toLowerCase();if(e===`dialog`)break;N(r)&&(n=!0),Qe.has(e)?(t=r,n=!1):t!==null&&Ze(r)&&!n&&(t=r),r=r.parentElement}return t?.parentElement??null}var et={gutterBlockStart:`calc(max(var(--spacing-4), env(safe-area-inset-top, 0px)) + var(--astryx-layer-inset-block-start, 0px))`,gutterBlockEnd:`calc(max(var(--spacing-4), env(safe-area-inset-bottom, 0px)) + var(--astryx-layer-inset-block-end, 0px))`,gutterInline:`calc(max(var(--spacing-4), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)) + max(var(--astryx-layer-inset-inline-start, 0px), var(--astryx-layer-inset-inline-end, 0px)))`,gutterBlock:`calc(max(var(--spacing-4), env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px)) + max(var(--astryx-layer-inset-block-start, 0px), var(--astryx-layer-inset-block-end, 0px)))`,gutterBlockFallback:`calc(var(--spacing-4) + max(var(--astryx-layer-inset-block-start, 0px), var(--astryx-layer-inset-block-end, 0px)))`,gutterBlockStartFallback:`calc(var(--spacing-4) + var(--astryx-layer-inset-block-start, 0px))`,gutterBlockEndFallback:`calc(var(--spacing-4) + var(--astryx-layer-inset-block-end, 0px))`,gutterInlineFallback:`calc(var(--spacing-4) + max(var(--astryx-layer-inset-inline-start, 0px), var(--astryx-layer-inset-inline-end, 0px)))`,maxInlineSize:`calc(100vi - calc(max(var(--spacing-4), env(safe-area-inset-left, 0px)) + var(--astryx-layer-inset-inline-start, 0px)) - calc(max(var(--spacing-4), env(safe-area-inset-right, 0px)) + var(--astryx-layer-inset-inline-end, 0px)))`,maxInlineSizeFallback:`calc(100vw - var(--spacing-4) - var(--spacing-4) - var(--astryx-layer-inset-inline-start, 0px) - var(--astryx-layer-inset-inline-end, 0px))`,maxBlockSize:`min(calc(100dvb - calc(max(var(--spacing-4), env(safe-area-inset-top, 0px)) + var(--astryx-layer-inset-block-start, 0px)) - calc(max(var(--spacing-4), env(safe-area-inset-bottom, 0px)) + var(--astryx-layer-inset-block-end, 0px))), var(--_layer-keyboard-max-block-size, 100dvb))`,maxBlockSizeFallback:`min(calc(100vh - var(--spacing-4) - var(--spacing-4) - var(--astryx-layer-inset-block-start, 0px) - var(--astryx-layer-inset-block-end, 0px)), var(--_layer-keyboard-max-block-size, 100vh))`},tt=`data-layer-anchored`;function nt(e,t,n){if(n<=0)return null;let r=t-n-10;return e.bottom<=r?null:Math.max(0,r-e.top)}var rt=`--_astryx-layer-clearance`,it=`--_astryx-layer-lift`;function at(e,t){return`--astryx-layer-slide-${e}-${t}`}var ot=`var(${rt}, 0px)`,st=`var(${it}, 0px)`;function ct(e,t,n){return`${e}:${t};${e}:${n};`}function lt(e){return ct(e,et.gutterBlockFallback,et.gutterBlock)}function ut(e){return ct(e,et.gutterInlineFallback,et.gutterInline)}var dt={above:`below`,below:`above`,start:`end`,end:`start`};function ft(e){switch(e){case`above`:return`inset-block-end:calc(anchor(outside) + ${st});inset-block-start:calc(0px - ${st});align-self:self-end;margin-block-end:${ot};${lt(`margin-block-start`)}`;case`below`:return`inset-block-start:calc(anchor(outside) - ${st});inset-block-end:${st};align-self:self-start;margin-block-start:${ot};${lt(`margin-block-end`)}`;case`start`:return`inset-inline-end:anchor(outside);inset-inline-start:0;justify-self:self-end;margin-inline-end:${ot};${ut(`margin-inline-start`)}`;case`end`:return`inset-inline-start:anchor(outside);inset-inline-end:0;justify-self:self-start;margin-inline-start:${ot};${ut(`margin-inline-end`)}`}}function pt(e){return e===`above`||e===`below`?`inset-inline-start:0;inset-inline-end:0;justify-self:anchor-center;${ut(`margin-inline-start`)}${ut(`margin-inline-end`)}`:`inset-block-start:calc(0px - ${st});inset-block-end:${st};align-self:anchor-center;${lt(`margin-block-start`)}${lt(`margin-block-end`)}`}function mt(e,t){let n=t===`same`?e:dt[e];return`@position-try ${at(e,t)}{${ft(n)}${pt(n)}}`}var ht=[`above`,`below`,`start`,`end`];function gt(e){return e===`above`||e===`start`?`unsafe self-end`:`unsafe self-start`}function _t(e){return`--astryx-layer-beside-${e}`}function vt(e){return`--astryx-layer-fit-${e}`}function yt(e){return`@position-try ${_t(e)}{${ft(e)}${pt(e)}inline-size:max-content;justify-self:${gt(e)};}`}function bt(e,t){return`calc((${e} - anchor-size(block)) / 2 - ${ot} - ${t} - 1px)`}function xt(e){let t=ct(`min-block-size`,bt(`100vh`,et.gutterBlockFallback),bt(`100dvb`,et.gutterBlock));return`@position-try ${vt(e)}{${ft(e)}${pt(e)}block-size:-webkit-fill-available;block-size:stretch;${t}align-self:${gt(e)};}`}function St(e){if(e!==`above`&&e!==`below`)return``;let t=e===`above`?`below`:`above`;return`flip-block, ${_t(`end`)}, ${_t(`start`)}, ${vt(e)}, ${vt(t)}`}function Ct(){return[...ht.flatMap(e=>[mt(e,`same`),mt(e,`opposite`)]),yt(`end`),yt(`start`),xt(`above`),xt(`below`)].join(``)}var wt=`astryx-layer-slide-rules`;function Tt(e){if(e.getElementById(`astryx-layer-slide-rules`))return;let t=e.createElement(`style`);t.id=wt,t.textContent=Ct(),e.head.appendChild(t)}var Et=[`transform`,`translate`,`scale`,`rotate`],Dt=[1,0,0,1,0,0],Ot=64,kt=1/2048,At=1/32;function jt(e){return Et.some(t=>{let n=e.getPropertyValue(t);return n!==``&&n!==`none`})}function Mt(e){return e!==``&&e!==`none`}function Nt(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Pt(e){let t=e.getPropertyValue(`translate`),n=e.getPropertyValue(`rotate`),r=e.getPropertyValue(`scale`),i=e.getPropertyValue(`transform`),a=Dt;if(Mt(t)){let[e=`0`,n=`0`,r]=t.split(` `);if(r!=null||!t.split(` `).every(e=>e.endsWith(`px`)))return null;a=Nt(a,[1,0,0,1,parseFloat(e),parseFloat(n)])}if(Mt(n)){if(!/^-?[\d.]+deg$/.test(n))return null;let e=parseFloat(n)*Math.PI/180,t=Math.cos(e),r=Math.sin(e);a=Nt(a,[t,r,-r,t,0,0])}if(Mt(r)){let[e=`1`,t=e,n]=r.split(` `);if(n!=null)return null;a=Nt(a,[parseFloat(e),0,0,parseFloat(t),0,0])}if(Mt(i)){let e=/^matrix\(([^)]*)\)$/.exec(i)?.[1].split(`,`).map(e=>parseFloat(e));if(e?.length!==6||e.some(e=>Number.isNaN(e)))return null;a=Nt(a,e)}return a}function Ft([e,t,n,r]){return t===0&&n===0&&e!==0&&r!==0}function It(e){return(e.currentCSSZoom??1)===1&&!(e.getAnimations?.()??[]).some(e=>e.pending)}function Lt(e){let t=t=>parseFloat(e.getPropertyValue(t))||0,n=e.getPropertyValue(`box-sizing`)!==`border-box`,r=e=>n?e.reduce((e,n)=>e+t(`padding-${n}`)+t(`border-${n}-width`),0):0;return{width:t(`width`)+r([`left`,`right`]),height:t(`height`)+r([`top`,`bottom`])}}function Rt(e,t,[n,,,r]){let{width:i,height:a}=Lt(t);if(!(i>0)||!(a>0))return!1;let o=Math.abs(e.width-i*Math.abs(n))+Math.abs(e.height-a*Math.abs(r)),s=Math.abs(e.width-i)+Math.abs(e.height-a);return o+At<s}function zt(e){let t=Math.round(e*Ot)/Ot;return Math.abs(t-e)<kt?t:e}function Bt(e,t,n,r){let[i,a,o,s,c,l]=r,u=Ft(r),d=u?e.width/Math.abs(i):t.offsetWidth,f=u?e.height/Math.abs(s):t.offsetHeight;if(!u&&d<=0)return e;let[p=0,m=0]=n.getPropertyValue(`transform-origin`).split(` `).map(e=>parseFloat(e)),h=d/2-p,g=f/2-m,_=i*h+o*g+c,v=a*h+s*g+l,y=e.left+e.width/2-_-p,b=e.top+e.height/2-v-m;if(!u)return new DOMRect(y,b,d,f);let x=zt(y),S=zt(b);return new DOMRect(x,S,zt(y+d)-x,zt(b+f)-S)}function Vt(e){let t=e.ownerDocument.defaultView,n=t?.getComputedStyle(e);if(n==null||!jt(n))return e.getBoundingClientRect();let r=Pt(n);if(r!=null&&Ft(r)&&It(e)){let t=e.getBoundingClientRect();if(Rt(t,n,r))return Bt(t,e,n,r)}let i=n.getPropertyValue(`transition-property`).split(`,`).map(e=>e.trim()),a=n.getPropertyValue(`transition-duration`).split(`,`).map(parseFloat);if(i.some((e,t)=>(e===`all`||Et.includes(e))&&(a[t%a.length]??0)>0)){let t=e.getBoundingClientRect();return r==null?t:Bt(t,e,n,r)}let o=Et.map(t=>[t,e.style.getPropertyValue(t),e.style.getPropertyPriority(t)]);for(let t of Et)e.style.setProperty(t,`none`,`important`);let s=e.getBoundingClientRect(),c=t?.getComputedStyle(e),l=c!=null&&jt(c)?Pt(c):null,u=c!=null&&l!=null?Bt(s,e,c,l):s;for(let[t,n,r]of o)n===``?e.style.removeProperty(t):e.style.setProperty(t,n,r);return u}function Ht(e,{onClicked:t,onNoClick:n}){let r=e.ownerDocument.defaultView;if(r==null){let e=!1;return queueMicrotask(()=>{e||n()}),()=>{e=!0}}let i=!1,a=null,o=null,s=null,c=()=>{i=!0,s?.(),s=null,o!=null&&(r.clearTimeout(o),o=null)};return s=A(r,`click`,n=>{!i&&n.isTrusted&&e.contains(n.target)&&(c(),a=r.setTimeout(()=>{a=null,t(n.defaultPrevented)},0))}),o=r.setTimeout(()=>{i||(c(),n())},300),()=>{c(),a!=null&&(r.clearTimeout(a),a=null)}}function Ut(e){let t=e.ownerDocument.defaultView,n=null,r=t=>{n==null&&t.target===e&&(n=t)};t?.addEventListener(`click`,r,!0);try{e.click()}finally{t?.removeEventListener(`click`,r,!0)}return n?.defaultPrevented===!0}function Wt(e){return w(e.ownerDocument),j(()=>Ut(e))}var Gt=`--_layer-keyboard-inset-block-end`;function Kt(e,t){let n=e.ownerDocument.defaultView;for(let r=t.parentElement;r!=null;r=r===e?null:r.parentElement){let e=n?.getComputedStyle(r).overflowY;if(r.scrollHeight>r.clientHeight+1&&(e===`auto`||e===`scroll`)){let e=r.getBoundingClientRect(),n=t.getBoundingClientRect();n.bottom>e.bottom?r.scrollTop+=n.bottom-e.bottom:n.top<e.top&&(r.scrollTop-=e.top-n.top);return}}}function qt(e){return e==null?null:{[it]:`${e}px`}}function Jt(e,t){let[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null);E(()=>{let n=t.current,i=n?.ownerDocument.defaultView;if(!e||n==null||i==null)return;let o=i,f=!1,p=xe(i),m=n,h=0,_=()=>{h+=1},v=()=>{let e=t.current;return e==null||e===m?!1:(m.removeEventListener(`pointerdown`,M,!0),m.removeEventListener(`touchstart`,_,{capture:!0}),m.removeEventListener(`wheel`,_,{capture:!0}),m=e,m.addEventListener(`pointerdown`,M,!0),m.addEventListener(`touchstart`,_,{capture:!0,passive:!0}),m.addEventListener(`wheel`,_,{capture:!0,passive:!0}),!0)},y=(e,t=u.current,n=null)=>{f||c.current===e&&u.current===t&&l.current===n||(c.current=e,u.current=t,l.current=n,(0,we.flushSync)(()=>{r(e),s(t),a(n)}),v())},b=e=>{let t=e>0?e+10:0,n=Math.max(t,u.current??0);if(y(null,n>0?n:null),e<=0)return!1;let r=se(i),a=Vt(m),o=nt(a,r,e);if(o==null)return!1;y(o);let s=Vt(m);if(s.top>a.top+1&&Math.abs(s.bottom-a.bottom)>1){y(o,u.current,s.top-a.top);let t=Vt(m);if(Math.abs(t.top-a.top)>1){y(o);let t=nt(s,r,e);t!=null&&y(t)}}let c=r-e-10;return Vt(m).bottom>c+1?(y(null),!1):!0},x=e=>{if(v(),!m.hasAttribute(`data-layer-anchored`)){y(null,null);return}if(!b(e))return;let t=m.ownerDocument.activeElement;if(t!=null&&t!==m&&m.contains(t)){let e=h;i.requestAnimationFrame(()=>i.requestAnimationFrame(()=>{!f&&h===e&&Kt(m,t)}))}},S=null,C=()=>{S!=null&&(i.clearTimeout(S),S=null)},w=new Set,T=null,E=null,D=null,O=()=>{let e=[A(o,`pointerup`,ee),A(o,`pointercancel`,ee)];D=()=>{for(let t of e)t()}},k=()=>{D?.(),D=null},j=()=>{E?.(),E=null,w.clear(),k();let e=T;T=null,e?.()};function M(e){_(),w.size===0&&O(),w.add(e.pointerId)}function ee(e){w.has(e.pointerId)&&(e.type===`pointercancel`?j():E??=Ht(m,{onClicked:j,onNoClick:j}))}m.addEventListener(`pointerdown`,M,!0),m.addEventListener(`touchstart`,_,{capture:!0,passive:!0}),m.addEventListener(`wheel`,_,{capture:!0,passive:!0});let N=p.subscribe(e=>{if(C(),e.animated&&e.to>e.from){let t=e.start+(p.profile===`chromium`&&e.curve!=null?e.curve.durationMs:g.keyboardNotificationMs);S=i.setTimeout(()=>{S=null,x(e.to)},Math.max(0,t-i.performance.now()))}else w.size>0?T=()=>x(e.to):x(e.to)});L(i)>0&&i.queueMicrotask(()=>{f||x(L(i))});let P=null;return d.current=()=>{!v()||P!=null||L(i)<=0||(P=i.requestAnimationFrame(()=>{P=null,f||S!=null||(w.size>0?T=()=>x(L(i)):x(L(i)))}))},()=>{f=!0,d.current=null,P!=null&&i.cancelAnimationFrame(P),N(),C(),E?.(),m.removeEventListener(`pointerdown`,M,!0),m.removeEventListener(`touchstart`,_,{capture:!0}),m.removeEventListener(`wheel`,_,{capture:!0}),k(),c.current!=null&&(c.current=null,r(null)),l.current!=null&&(l.current=null,a(null)),u.current!=null&&(u.current=null,s(null))}},[e,t]);let f=(0,U.useCallback)(()=>{d.current?.()},[]);return{cap:e?n:null,lift:e?i:null,inset:e?o:null,followLayerElement:f}}var Yt=`--_astryx-layer-enter-x`,Xt=`--_astryx-layer-enter-y`,Zt=`--_astryx-layer-enter-origin`,Qt=`--_astryx-layer-enter-gap`,$t=(e,t)=>Math.min(t,Math.max(0,e));function en(e,t){if(e.width<=0||e.height<=0)return null;let n=t.left+t.width/2,r=t.top+t.height/2,i=$t(n-e.left,e.width),a=$t(r-e.top,e.height),o=t.width<=1&&t.height<=1;if(i>0&&i<e.width&&a>0&&a<e.height)return{x:0,y:0,originX:i,originY:a,gap:0};let s=(e.left+e.width/2-n)/((e.width+t.width)/2),c=(e.top+e.height/2-r)/((e.height+t.height)/2);if(Math.abs(c)>=Math.abs(s)){let n=c>0;return{x:0,y:n?-1:1,originX:i,originY:n?0:e.height,gap:o?null:Math.max(0,n?e.top-(t.top+t.height):t.top-(e.top+e.height))}}let l=s>0;return{x:l?-1:1,y:0,originX:l?0:e.width,originY:a,gap:o?null:Math.max(0,l?e.left-(t.left+t.width):t.left-(e.left+e.width))}}function tn(e,t){let n=t.getBoundingClientRect();return en(Vt(e),n)}var nn=e=>`${Math.round(e*1e3)/1e3}px`;function rn(e,t){e.style.setProperty(Yt,t==null?`initial`:String(t.x)),e.style.setProperty(Xt,t==null?`initial`:String(t.y)),e.style.setProperty(Zt,t==null?`initial`:`${nn(t.originX)} ${nn(t.originY)}`);let n=t?.gap==null?null:Math.floor(t.gap*1e3)/1e3;e.style.setProperty(Qt,n==null?`initial`:`${n}px`)}var an=[[`blockStart`,`--astryx-layer-inset-block-start`],[`blockEnd`,`--astryx-layer-inset-block-end`],[`inlineStart`,`--astryx-layer-inset-inline-start`],[`inlineEnd`,`--astryx-layer-inset-inline-end`]];function on(e){return typeof e==`number`?`${e}px`:e}function sn(e){let t={};if(e)for(let[n,r]of an){let i=e[n];i!=null&&i!==``&&(t[r]=on(i))}return t}var cn=o(`layer/popover-operations/own-operations-by-document`,1),ln=o(`layer/popover-operations/browser-hides-by-document`,1),un=o(`layer/popover-operations/settled-callbacks-by-document`,1);function dn(e,t,n){e.set(t,Math.max(0,(e.get(t)??0)+n))}function fn(e){return(cn.get(e)??0)>0||(ln.get(e)??0)>0}function pn(e){!fn(e)&&un.has(e)&&queueMicrotask(()=>mn(e))}function mn(e){if(fn(e))return;let t=un.get(e);if(t!=null){un.delete(e);for(let e of t)queueMicrotask(e)}}function hn(e,t){dn(cn,e,1);try{t()}finally{dn(cn,e,-1),pn(e)}}function gn(e){return(cn.get(e)??0)>0}function _n(e){return(ln.get(e)??0)>0}var vn=u(`layer/popover-operations/browser-hides-in-flight`,1);function yn(e){if(vn.has(e))return;vn.add(e);let t=e.ownerDocument;dn(ln,t,1);let n=t.defaultView??globalThis,r=null,i=!1,a=()=>{i||(i=!0,e.removeEventListener(`toggle`,a),r!=null&&(n.clearTimeout(r),r=null),vn.delete(e),dn(ln,t,-1),pn(t))};e.addEventListener(`toggle`,a),r=n.setTimeout(a,0)}function bn(e,t){if(!fn(e)){t();return}let n=un.get(e);n==null?un.set(e,[t]):n.push(t)}var xn=new Set([`effect`,`timeline`,`rangeStart`,`rangeEnd`,`playbackRate`,`startTime`,`currentTime`]);function Sn(e){let t=new Set;for(let n=Object.getPrototypeOf(e);n!=null&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let[e,r]of Object.entries(Object.getOwnPropertyDescriptors(n)))r.set!=null&&t.add(e);return[...t]}function Cn(e){return typeof CSSNumericValue<`u`&&e instanceof CSSNumericValue?e.toString():typeof e==`object`&&e&&Object.getPrototypeOf(e)===Object.prototype?Object.entries(e).map(([e,t])=>`${e}:${Cn(t)??String(t)}`).join(`;`):null}function wn(e,t){if(e===t)return!1;let n=Cn(e);return n==null||n!==Cn(t)}function Tn(e){let t=e.effect,n={};for(let t of Sn(e))n[t]=e[t];let r={};if(t!=null)for(let e of Sn(t))r[e]=t[e];return{animation:e,name:e.animationName??``,target:t?.target??null,pseudoElement:t?.pseudoElement??null,values:n,effectValues:r,timing:t?.getTiming()??null,keyframes:t?.getKeyframes()??null,playState:e.playState,replaceState:e.replaceState}}function En(e,t,n){e[t]=n}function Dn(e,t){for(let n of Sn(e))n in t.effectValues&&wn(t.effectValues[n],e[n])&&En(e,n,t.effectValues[n]);if(t.timing!=null){let n=e.getTiming(),r={};for(let[e,i]of Object.entries(t.timing))wn(i,n[e])&&(r[e]=i);Object.keys(r).length>0&&e.updateTiming(r)}t.keyframes!=null&&JSON.stringify(t.keyframes)!==JSON.stringify(e.getKeyframes())&&e.setKeyframes(t.keyframes)}function On(e,t){let n=()=>{t.startTime!=null&&e.playState!==`idle`&&(e.startTime=t.startTime)};t.startTime==null?t.ready.then(n,()=>void 0):n()}function kn(e,t){let n=e.effect;n!=null&&Dn(n,t);let r=e;for(let n of[`timeline`,`rangeStart`,`rangeEnd`])n in t.values&&wn(t.values[n],r[n])&&En(e,n,t.values[n]);for(let n of Sn(e))!xn.has(n)&&n in t.values&&wn(t.values[n],r[n])&&En(e,n,t.values[n]);t.replaceState===`persisted`&&e.replaceState!==`persisted`&&e.persist();let i=t.values.playbackRate;typeof i==`number`&&i!==e.playbackRate&&(e.playbackRate=i),t.playState===`paused`&&e.playState!==`paused`?e.pause():t.playState!==`paused`&&e.playState===`paused`&&e.play();let a=t.values.startTime,o=t.values.currentTime;t.playState===`finished`?e.finish():a==null?o!=null&&(e.currentTime=o,t.playState===`running`&&On(e,t.animation)):e.startTime=a}function An(e){e.target!=null&&e.keyframes!=null&&kn(e.target.animate(e.keyframes,{pseudoElement:e.pseudoElement??void 0}),e)}function jn(e){return typeof CSSTransition<`u`&&e instanceof CSSTransition}function Mn(e){return typeof CSSAnimation<`u`&&e instanceof CSSAnimation}function Nn(e){let t=e.effect?.getComputedTiming().endTime;t!=null&&Number.isFinite(Number(t))&&e.playbackRate!==0&&e.finish()}function Pn(e,t,n){let r=e.getAnimations({subtree:!0}),i=new Set(r),a=[];for(let e of t)i.has(e.animation)||(jn(e.animation)?An(e):a.push(e));let o=r.filter(e=>(Mn(e)||jn(e))&&!n.has(e)),s=[];for(let e of o){let t=e.effect,n=e.animationName??``,r=a.findIndex(e=>e.name===n&&e.target===(t?.target??null)&&e.pseudoElement===(t?.pseudoElement??null));r===-1?s.push(e):kn(e,a.splice(r,1)[0])}for(let e of s){let t=e.animationName??``,n=a.findIndex(e=>e.name===t);n===-1?Nn(e):kn(e,a.splice(n,1)[0])}}function Fn(e,t){if(typeof e.getAnimations!=`function`){t();return}let n=e.getAnimations({subtree:!0}),r=n.map(Tn);t(),Pn(e,r,new Set(n))}var In=_e(`LayerContext`,1,null);In.displayName=`LayerContext`;function Ln(){return(0,U.use)(In)}var X=n(),Rn={keoZOQ:`x1vhfslr`,k1K539:`x119uzjn`,$$css:!0},zn={keoZOQ:`x1lhixnp`,k1K539:`xlm3tn6`,$$css:!0},Bn={k71WvV:`xa3ewmy`,$$css:!0},Vn={keTefX:`x1cytvie`,$$css:!0},Z={keyboardCap:(e,t,n)=>[{"--_layer-keyboard-max-block-size":e==null?e:`x1ex41ac`,"--_layer-keyboard-overflow":t==null?t:`xypflj0`,"--_layer-keyboard-inset-block-end":n==null?n:`xihxjaz`,$$css:!0},{"--x---_layer-keyboard-max-block-size":e??void 0,"--x---_layer-keyboard-overflow":t??void 0,"--x---_layer-keyboard-inset-block-end":n??void 0}],scrollsOnOverflow:{kORKVm:`x1odjw0f`,$$css:!0},base:{keoZOQ:`xdj266r`,k1K539:`xat24cr`,keTefX:`x1lziwak`,k71WvV:`x14z9mp`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kVQacm:`x1rea2x4`,kWkggS:`xjbqb8w`,$$css:!0},fixed:{kVAEAm:`xixxii4`,$$css:!0},placementBelow:e=>[Rn,{"--x-marginBlockStart":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],placementAbove:e=>[zn,{"--x-marginBlockEnd":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],placementEnd:e=>[Bn,{keTefX:e==null?e:`x4lel18`,$$css:!0},{"--x-marginInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],placementStart:e=>[Vn,{k71WvV:e==null?e:`x1c9tiao`,$$css:!0},{"--x-marginInlineEnd":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],farBelow:{k1K539:`x119uzjn`,$$css:!0},farAbove:{keoZOQ:`x1lhixnp`,$$css:!0},farEnd:{k71WvV:`xa3ewmy`,$$css:!0},farStart:{keTefX:`x1cytvie`,$$css:!0},viewportFit:{kB7OPa:`x9f619`,ks0D6T:`xc0b1yq`,kskxy:`x3v4n1`,$$css:!0},sideBelow:{k87sOh:`x11qqqwi`,krVfgx:`x1ihzn68`,$$css:!0},sideAbove:{k87sOh:`xs7zcsv`,krVfgx:`x1dkbz8d`,$$css:!0},sideEnd:{kLqNvP:`xgn968y`,kt4wiu:`xtijo5x`,$$css:!0},sideStart:{kLqNvP:`x1o0tod`,kt4wiu:`x1rmahmk`,$$css:!0},alignInlineStart:{kLqNvP:`xjlsgp1`,kt4wiu:`xtijo5x`,k71WvV:`x144kxal`,$$css:!0},alignInlineEnd:{kLqNvP:`x1o0tod`,kt4wiu:`x1sii5lc`,keTefX:`xpdk1p0`,$$css:!0},alignBlockStart:{k87sOh:`x1pex6sq`,krVfgx:`x1ihzn68`,k1K539:`x3z50q0`,$$css:!0},alignBlockEnd:{k87sOh:`xs7zcsv`,krVfgx:`x1lalo65`,keoZOQ:`x1j6tnbc`,$$css:!0},heldInlineStart:{kLqNvP:`x1hirqua`,$$css:!0},heldInlineEnd:{kt4wiu:`xt5bzs0`,$$css:!0},heldBlockStart:{k87sOh:`x2tnmsz`,$$css:!0},heldBlockEnd:{krVfgx:`xbmjlmh`,$$css:!0},centerInline:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,keTefX:`xpdk1p0`,k71WvV:`x144kxal`,$$css:!0},centerBlock:{k87sOh:`xs7zcsv`,krVfgx:`x1ihzn68`,keoZOQ:`x1j6tnbc`,k1K539:`x3z50q0`,$$css:!0}};function Hn(e){return typeof e==`number`?`${e}px`:e}function Un(e){Fn(e,()=>{let t=e.style.display;e.style.display=`none`,e.getBoundingClientRect(),e.style.display=t})}function Wn(e){return e.playState===`running`&&e.effect?.getComputedTiming().endTime!==1/0}function Gn(e){return e==null||typeof e.getAnimations!=`function`?[]:e.getAnimations({subtree:!0}).filter(Wn)}function Kn(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e);if(t==null)return!1;let n=e=>t.getPropertyValue(e).split(`,`).map(e=>e.trim()),r=n(`transition-behavior`),i=n(`transition-duration`).map(parseFloat),a=n(`transition-delay`).map(parseFloat);return n(`transition-property`).some((e,t)=>{let n=r[t%r.length],o=i[t%i.length]||0,s=a[t%a.length]||0;return(e===`all`||e===`display`)&&n===`allow-discrete`&&o+Math.max(0,s)>0})}function qn(e){return(e.ownerDocument.defaultView?.getComputedStyle(e))?.getPropertyValue(`animation-name`).trim()||`none`}function Jn({layer:e,anchor:t},n){if(e.width<=0||e.height<=0)return!1;let r=e.left<t.right&&t.left<e.right&&e.top<t.bottom&&t.top<e.bottom,i=t.bottom>0&&t.top<n;return r||i&&(e.top<0||e.bottom>n)}function Yn(e,t){if(t==null)return null;let n=t.getBoundingClientRect(),r=e.ownerDocument.documentElement.clientHeight,i={anchor:n,layer:Vt(e)};return Jn(i,r)?(Un(e),null):i}function Xn(e,t,n){t==null||!e.hasAttribute(`data-layer-anchored`)?rn(e,null):rn(e,n==null?tn(e,t):en(n.layer,n.anchor))}var Zn=150;function Qn(e){let t=[];for(let n=e;n;n=c(n)){let e=n.getRootNode();h(e)&&!t.includes(e)&&t.push(e)}return t}function $n(e,t,n){let r=null,i=null,o=()=>{r!==null&&(e.cancelAnimationFrame(r),r=null),i!==null&&(e.clearTimeout(i),i=null)},s=()=>{o(),r=e.requestAnimationFrame(()=>{r=null,i=e.setTimeout(()=>{i=null,r=e.requestAnimationFrame(()=>{r=null,n()})})})},c=e.onscrollend!==void 0,l=e=>a(e.target,t),u=t=>{l(t)&&(o(),c||(i=e.setTimeout(()=>{i=null,s()},Zn)))},d=e=>{l(e)&&s()},f=[A(e,`scroll`,u)];c&&f.push(A(e,`scrollend`,d));let p={capture:!0,passive:!0},m=Qn(t);for(let e of m)e.addEventListener(`scroll`,u,p),c&&e.addEventListener(`scrollend`,d,p);return()=>{for(let e of f)e();for(let e of m)e.removeEventListener(`scroll`,u,p),e.removeEventListener(`scrollend`,d,p);o()}}function er(e,t,n,r,i){let a=e.ownerDocument.defaultView;if(!a)return()=>{};let o=()=>{n()&&Yn(e,t)},s=null;if(typeof ResizeObserver<`u`){s=new ResizeObserver(o),s.observe(e);for(let t of Array.from(e.children))s.observe(t);s.observe(t)}a.addEventListener(`resize`,o);let c=$n(a,t,()=>{n()&&(r()&&e.hasAttribute(`data-layer-anchored`)?(Un(e),i()):Yn(e,t))});return()=>{s?.disconnect(),c(),a.removeEventListener(`resize`,o)}}function tr(e){if(e.getClientRects().length===0)return!1;let t=e.closest(`dialog`);return t==null||s(t)}function nr(e){if(e.getClientRects().length===0)return!1;let t=e.closest(`dialog`);return t!=null&&!s(t)}function rr(e,t){let n=e.ownerDocument,r=n.defaultView;if(typeof n.getAnimations!=`function`||r==null)return t(),()=>{};let i=!1,a=r.requestAnimationFrame(()=>{if(i)return;let r=n.getAnimations().filter(t=>{let r=t.effect,i=r!=null&&`target`in r?r.target:null;return!x(i)||!(i===e||i.contains(e))||t.timeline!==n.timeline?!1:Wn(t)});r.length===0?t():Promise.all(r.map(async e=>e.finished.catch(()=>{}))).then(()=>{i||t()})});return()=>{i=!0,r.cancelAnimationFrame(a)}}function ir(){let e=null,t=new Set;return{get:()=>e,set:n=>{if(n!==e){e=n;for(let e of t)e()}},subscribe:e=>(t.add(e),()=>{t.delete(e)})}}var ar=()=>null;function or({mountStore:e,renderLayer:t,sentinelRef:n}){let r=(0,U.useSyncExternalStore)(e.subscribe,e.get,ar),i=(0,X.jsx)(`template`,{ref:n});if(r===null)return(0,X.jsx)(X.Fragment,{children:i});let a=t(r);return(0,X.jsxs)(X.Fragment,{children:[i,r.portalTarget?(0,we.createPortal)(a,r.portalTarget):a]})}function sr(e,t){let n=e.ownerDocument.defaultView;if(!n)return{};let r=n.getComputedStyle(e),i=n.getComputedStyle(t);return{...r.direction!==i.direction&&{direction:r.direction},...r.writingMode!==i.writingMode&&{writingMode:r.writingMode}}}function cr(e=`above`){return`flip-block, flip-inline, flip-block flip-inline, ${at(e,`same`)}, ${at(e,`opposite`)}`}function lr(e,t,n){let r=e===`above`||e===`below`,i=e===`above`||e===`start`?`self-end`:`self-start`,a=t===`center`?`anchor-center`:`${n?``:`unsafe `}self-${t}`;return r?{alignSelf:i,justifySelf:a}:{justifySelf:i,alignSelf:a}}function ur(e,t,n){let r=e===`above`||e===`below`,i=e===`above`?Z.sideAbove:e===`below`?Z.sideBelow:e===`start`?Z.sideStart:Z.sideEnd;if(t===`center`)return[i,r?Z.centerInline:Z.centerBlock];let a=t===`start`,o=r?a?Z.alignInlineStart:Z.alignInlineEnd:a?Z.alignBlockStart:Z.alignBlockEnd,s=n?null:r?a?Z.heldInlineStart:Z.heldInlineEnd:a?Z.heldBlockStart:Z.heldBlockEnd;return s==null?[i,o]:[i,o,s]}function dr(e,t){return(0,U.useMemo)(()=>({onPointerDown:n=>{let i=n.currentTarget,a=i.ownerDocument,o=i.getRootNode(),s=(h(o)?o:a).getElementById(e);if(!t&&(s==null||!r(s)))return;i.setAttribute(`popovertarget`,e);let c=()=>{a.removeEventListener(`pointerup`,c),a.removeEventListener(`pointercancel`,c),a.defaultView?.setTimeout(()=>{i.removeAttribute(`popovertarget`)},0)};a.addEventListener(`pointerup`,c),a.addEventListener(`pointercancel`,c)},onClickCapture:e=>{let t=e.currentTarget;t.hasAttribute(`popovertarget`)&&(e.preventDefault(),t.removeAttribute(`popovertarget`))}}),[e,t])}function fr(e){let{mode:t,onShow:n,onHide:r,lightDismiss:i=!1}=e,a=t===`context`?e.lazyMount??!1:!1,o=a&&t===`context`?e.keepsMountAfterShow??!1:!1,s=t===`context`?e.keepsAnchorClear??!1:!1,c=t===`context`?e.watchesOutsidePans:void 0,l=t===`context`?e.writesEntranceSide??!1:!1,u=te(t===`context`?e.onPlacedAfresh:void 0),d=t===`context`?e.onCloseStart:void 0,f=t===`context`?e.onOpenPendingChange:void 0,p=te(t===`context`&&e.waitsForAnchor===!0),m=te(d),h=(0,U.useId)(),g=`--astryx-layer-${h.replace(/:/g,``)}`,[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(!0),x=(0,U.useRef)(!0),S=(0,U.useCallback)(e=>{x.current!==e&&(x.current=e,b(e))},[]),w=Ln()?.inset,T=(0,U.useRef)(null),D=(0,U.useRef)(null),O=(0,U.useRef)(null),k=(0,U.useRef)(null),A=(0,U.useRef)(null),j=(0,U.useRef)(null),[M]=(0,U.useState)(ir),[ee,N]=(0,U.useState)(0),F=(0,U.useRef)(!1),ne=(0,U.useRef)(null),I=(0,U.useRef)(!1),ae=(0,U.useRef)(null),oe=(0,U.useRef)(!1),se=(0,U.useCallback)(e=>{let t={};ae.current=t;let n=()=>{if(ae.current!==t)return;ae.current=null;let e=O.current;!I.current&&e!=null&&Ae(e,g)},r=oe.current?Gn(e):[];r.length===0?n():Promise.all(r.map(async e=>e.finished.catch(()=>void 0))).then(n)},[g]),ce=(0,U.useRef)(null),L=(0,U.useRef)(null),le=(0,U.useRef)(null),R=(0,U.useRef)(null),me=(0,U.useRef)(null),z=(0,U.useCallback)(()=>{me.current?.(),me.current=null},[]),he=(0,U.useCallback)(()=>{let e=ze();return ce.current===e},[]),ge=(0,U.useCallback)(e=>{if(typeof e.showPopover==`function`){let t=e.ownerDocument,n=_n(t);try{hn(t,()=>{let t=O.current,n=t?.ownerDocument.defaultView;e.showPopover({source:n!=null&&t instanceof n.HTMLElement?t:void 0})})}catch(e){if(n&&e?.name===`InvalidStateError`)return!1;throw e}}else e.style.display=`block`;return D.current=e,!0},[]),_e=(0,U.useCallback)(e=>{if(t!==`context`)return!0;let n=j.current;if(n===null)return!1;let r=n.portalTarget??A.current?.parentElement??null;return e.parentElement===r},[t]),ve=(0,U.useCallback)(()=>{if(t!==`context`)return;let e=A.current,n=e?.parentElement??null;if(!e||!n)return;Tt(e.ownerDocument);let r=$e(n),i=F.current||I.current,a={portalTarget:r,portalStyle:r==null?{}:i?sr(e,r):null},o=j.current!==null;j.current=a,M.set(a),o&&N(e=>e+1)},[t,M]),B=(0,U.useCallback)(e=>{let t=j.current,n=A.current;if(t===null||t.portalTarget===null||t.portalStyle!==null||n===null)return;let r=sr(n,t.portalTarget);r.direction!=null&&e.style.direction===``&&(e.style.direction=r.direction),r.writingMode!=null&&e.style.writingMode===``&&(e.style.writingMode=r.writingMode);let i={...t,portalStyle:r};j.current=i,M.set(i)},[M]),be=(0,U.useCallback)(()=>{t===`context`&&a&&!o&&(j.current=null,M.set(null))},[t,a,o,M]),xe=(0,U.useCallback)(()=>{if(he()&&L.current===O.current)return;if(i&&!I.current&&Ve()){let e=T.current?.ownerDocument??document;F.current=!0,ne.current?.(),ne.current=He(e,()=>{ne.current=null,F.current&&(F.current=!1,K.current())});return}let e=le.current;e!=null&&I.current&&e.popover===T.current&&e.trigger!==O.current&&(e.moved=!0,D.current=null,I.current=!1,z());let t=T.current,r=t&&_e(t)?t:null;if(!r)F.current=!0,ve();else if(!I.current){let e=()=>{F.current=!0,bn(r.ownerDocument,()=>{F.current&&(F.current=!1,K.current())})};if(gn(r.ownerDocument)){e();return}let t=Kn(r),a=qn(r);B(r);let o=O.current;if(o!=null&&ke(o,g),!ge(r)){o!=null&&ae.current==null&&Ae(o,g),e();return}let u=a!==`none`&&a!==qn(r);oe.current=t||u,i&&(Ge(r),c!=null&&(z(),me.current=c(r)));let d=s?Yn(r,O.current):null;l||Xn(r,O.current,d),I.current=!0,v(!0),n?.()}},[g,n,s,l,i,c,z,ve,B,ge,_e,he]),V=(0,U.useRef)(null),H=(0,U.useRef)(null),Se=(0,U.useRef)(null),Ce=(0,U.useRef)(null),[we,Te]=(0,U.useState)(0);E(()=>{let e=Ce.current;Ce.current=null,e?.()},[we]);let W=(0,U.useCallback)(()=>{let e=V.current!=null;V.current?.(),V.current=null,H.current=null,Se.current&&=(Se.current.cancelled=!0,null),e&&f?.(!1)},[f]),Ee=(0,U.useCallback)(()=>{let e=V.current!=null;V.current=null,H.current=null,e&&f?.(!1)},[f]),G=(0,U.useCallback)(()=>{let e=t===`context`?O.current:null;if(e!=null&&V.current!=null&&H.current===e)return;if(W(),!e){if(p.current){V.current=()=>{},I.current||f?.(!0);return}xe();return}if(tr(e)||typeof ResizeObserver>`u`||typeof document.getAnimations!=`function`){xe();return}let n=e,r=e.getClientRects().length>0,i=e.closest(`dialog`),a=()=>{},o=!1,s=()=>{},c=()=>{},l=()=>{s(),h?.disconnect(),c(),i?.removeEventListener(`toggle`,m)},u=()=>{o=!0,l(),a=rr(e,()=>{Ee(),xe()})},d=()=>{Ce.current=()=>{!o&&nr(n)&&(r?(o=!0,l(),Ee(),xe()):u())},Te(e=>e+1)};function m(){o||(tr(n)?u():nr(n)&&d())}let h=typeof IntersectionObserver>`u`?null:new IntersectionObserver(m);s=ye(e,m),o?l():(h?.observe(e),i&&(c=re(i,{attributes:!0,attributeFilter:[`open`]},m),i.addEventListener(`toggle`,m))),V.current=()=>{o=!0,l(),a()},H.current=e,I.current||f?.(!0)},[t,xe,W,Ee,f,p]),De=(0,U.useCallback)(()=>{if(ne.current?.(),ne.current=null,W(),F.current=!1,I.current){let e=T.current;m.current?.(),D.current=null,I.current=!1,z(),e&&(typeof e.hidePopover==`function`?hn(e.ownerDocument,()=>{e.hidePopover()}):e.style.display=`none`),v(!1),r?.()}se(T.current),be()},[r,be,se,W,z,m]),K=(0,U.useRef)(G);C(K,G);let q=(0,U.useRef)(null),je=(0,U.useCallback)(e=>{if(!e){let e=O.current;if(!e)return;let t={element:e,cancelled:!1};k.current=t;let n=()=>{t.cancelled||O.current!==e||(Ae(e,g),O.current=null,H.current===e&&W(),s&&I.current&&(q.current?.(),q.current=null))};p.current?n():queueMicrotask(n);return}k.current?.element===e&&(k.current.cancelled=!0,k.current=null),O.current&&O.current!==e&&Ae(O.current,g),e&&(I.current||ae.current!=null)&&ke(e,g);let t=O.current;if(O.current=e,Re(e.ownerDocument),s&&I.current&&e!==t){q.current?.(),q.current=null;let t=T.current;t&&(q.current=er(t,e,()=>T.current===t&&O.current===e,()=>x.current,()=>u.current?.()),Yn(t,e))}let n=H.current;if(V.current!=null&&n!==e){W();let t={cancelled:!1};Se.current=t,queueMicrotask(()=>{t.cancelled||(Se.current=null,O.current===e&&!I.current&&K.current())})}},[g,W,s,u,p]),Me=(0,U.useCallback)(e=>{if(R.current?.(),Be())return;ce.current=ze(),L.current=O.current;let t=e.defaultView,n=null,r=()=>{ce.current=null,L.current=null,e.removeEventListener(`click`,i,!0),n!==null&&(t?.clearTimeout(n),n=null),R.current===r&&(R.current=null)},i=()=>{e.removeEventListener(`click`,i,!0),t?n=t.setTimeout(()=>{n=null,R.current===r&&r()},0):r()};e.addEventListener(`click`,i,!0),R.current=r},[]);(0,U.useEffect)(()=>(ze(),()=>{R.current?.(),V.current?.(),ne.current?.(),ne.current=null,z()}),[z]);let Ne=(0,U.useCallback)(e=>{let t=e,n=e.currentTarget;if(t.newState!==`closed`||n==null)return;if(I.current){yn(n),m.current?.(),le.current={popover:n,trigger:O.current,moved:!1};return}let r=O.current;r!=null&&Oe(r).includes(g)&&!oe.current&&(ae.current=null,Ae(r,g))},[g,m]),Pe=(0,U.useCallback)(e=>{let t=e,n=le.current;n!=null&&n.popover===e.currentTarget&&(le.current=null,n.moved)||t.newState===`closed`&&I.current&&(D.current=null,I.current=!1,z(),Me(e.currentTarget?.ownerDocument??document),se(e.currentTarget),v(!1),r?.(),be())},[r,be,Me,se,z]),J=(0,U.useRef)(null),Fe=(0,U.useRef)(null),Ie=(0,U.useCallback)((e,t)=>{J.current&&Fe.current&&(J.current!==e||Fe.current!==t)&&(J.current.removeEventListener(`toggle`,Fe.current),J.current.removeEventListener(`beforetoggle`,Ne),J.current=null,Fe.current=null),e&&J.current!==e&&(e.addEventListener(`toggle`,t),e.addEventListener(`beforetoggle`,Ne),J.current=e,Fe.current=t)},[Ne]),{cap:Y,lift:Le,inset:Ue,followLayerElement:We}=Jt(_&&t===`context`,T),Ke=(0,U.useCallback)(e=>{if(T.current=e,Ie(e,Pe),e&&F.current)F.current=!1,G();else if(e&&I.current&&D.current!==e&&_e(e)){if(We(),ge(e)){let t=s?Yn(e,O.current):null;Xn(e,O.current,t)}else bn(e.ownerDocument,()=>{let t=T.current;if(I.current&&t===e&&D.current!==e&&ge(e)){let t=s?Yn(e,O.current):null;Xn(e,O.current,t)}})}},[Pe,Ie,G,ge,_e,s,We]),qe=(0,U.useCallback)(e=>{A.current=e,e&&(!a||F.current||I.current||o&&j.current!=null)&&ve()},[a,o,ve]);(0,U.useEffect)(()=>(T.current&&Ie(T.current,Pe),()=>{J.current&&Fe.current&&(J.current.removeEventListener(`toggle`,Fe.current),J.current.removeEventListener(`beforetoggle`,Ne),J.current=null,Fe.current=null)}),[Pe,Ie,Ne]),E(()=>{if(!_||t!==`context`)return;let e=O.current;if(!e)return;let n=e.ownerDocument.defaultView;if(n){let t=e.getBoundingClientRect(),r=t.bottom>=0&&t.right>=0&&t.top<=n.innerHeight&&t.left<=n.innerWidth;S(r)}if(typeof IntersectionObserver>`u`)return;let r=new IntersectionObserver(e=>{let t=e[e.length-1];t&&S(t.isIntersecting)});return r.observe(e),()=>r.disconnect()},[_,t,S]),E(()=>{if(!s||!_||t!==`context`)return;let e=T.current,n=O.current;if(e&&n)return q.current?.(),q.current=er(e,n,()=>T.current===e&&O.current===n,()=>x.current,()=>u.current?.()),()=>{q.current?.(),q.current=null}},[s,_,t,ee]),E(()=>{if(!_||t!==`context`||s)return;let e=T.current,n=O.current,r=n?.ownerDocument.defaultView;if(e&&n&&r)return $n(r,n,()=>{x.current&&T.current===e&&e.hasAttribute(`data-layer-anchored`)&&(Un(e),u.current?.())})},[_,t,s,ee,u]);let Je=(0,U.useCallback)((e,t)=>{let{placement:n=`above`,alignment:r=`center`,positioning:a=`anchor`,offset:o,role:c,"aria-label":l,xstyle:u,className:d,style:f,as:p=`div`,onMouseEnter:m,onMouseLeave:_}=t||{},v=cr(n),b=s&&a===`anchor`?St(n):``,x=a===`custom`?{positionAnchor:g}:{positionAnchor:g,positionTryFallbacks:b||v,...lr(n,r,y),...b?{alignSelf:gt(n)}:{}},S=o?Hn(o):null,C=a===`anchor`&&S!=null?{[rt]:S}:{},T=a===`anchor`?S==null?n===`above`?Z.farAbove:n===`below`?Z.farBelow:n===`start`?Z.farStart:Z.farEnd:n===`above`?Z.placementAbove(S):n===`below`?Z.placementBelow(S):n===`start`?Z.placementStart(S):Z.placementEnd(S):null,E=a===`anchor`?[Z.viewportFit,...ur(n,r,y)]:null,D=P(ue.reset,ie.reset,Z.base,fe.reset,Z.keyboardCap(Y==null?`100vh`:`${Y}px`,Y==null?`visible`:`auto`,Ue==null?`initial`:`${Ue}px`),s&&Z.scrollsOnOverflow,E,T,u),O=d?`${d} ${D.className??``}`:D.className;return(0,X.jsx)(or,{mountStore:M,renderLayer:t=>(0,X.jsx)(p,{ref:Ke,id:h,...a===`anchor`?{[tt]:``}:{},role:c,"aria-label":l,popover:i?`auto`:`manual`,className:O,style:{...D.style,...x,...a===`anchor`?qt(Le)??{"--_astryx-layer-lift":`0px`}:null,...C,...sn(w),...t.portalStyle,...f},onMouseEnter:m,onMouseLeave:_,...pe(),children:(0,X.jsx)(de,{children:e})}),sentinelRef:qe})},[g,w,h,y,s,Y,Ue,Le,i,M,Ke,qe]),Ye=(0,U.useCallback)((e,t)=>{let{x:n,y:r,xstyle:a,className:o,style:s}=t,c={top:r,left:n},l=P(ue.reset,ie.reset,Z.base,fe.reset,Z.keyboardCap(`100vh`,`visible`,`initial`),Z.fixed,a),u=o?`${o} ${l.className??``}`:l.className;return(0,X.jsx)(`div`,{ref:Ke,id:h,popover:i?`auto`:`manual`,className:u,style:{...l.style,...c,...s},...pe(),children:(0,X.jsx)(de,{children:e})})},[Ke,h,i]),Xe=(0,U.useMemo)(()=>({ref:je,anchorId:g,show:G,hide:De,isOpen:_,id:h,render:Je}),[je,g,G,De,_,h,Je]),Ze=(0,U.useMemo)(()=>({ref:void 0,show:G,hide:De,isOpen:_,id:h,render:Ye}),[G,De,_,h,Ye]);return t===`context`?Xe:Ze}function pr(e){return fr(e)}function mr(e){return fr(e)}var hr=o(`layer/outside-press/outside-dismissals`,1);function gr(e){hr.set(e,(hr.get(e)??0)+1)}function _r(e){return hr.get(e)??0}function vr(e,t,n,{pointerTypes:r,closesOnPan:i=!1,onPan:a,onPress:o,root:s=null}={}){let c=e.ownerDocument,l=i?void 0:a,u=i||l!=null,f=s==null?[]:v(s),p=!1,m=null,h=e=>r==null||r.includes(e.pointerType),g=()=>{p=!1,m=null,gr(c),n()},_=e=>{h(e)&&(!i||m==null||m.id===e.pointerId||e.isPrimary)&&(p=!t(e.composedPath()),o?.(!p),u&&(m=p?{id:e.pointerId,x:e.clientX,y:e.clientY}:null))},y=e=>{if(m?.id===e.pointerId&&Math.max(Math.abs(e.clientX-m.x),Math.abs(e.clientY-m.y))>=ee.hysteresis.value){if(l!=null){let t=Math.abs(e.clientX-m.x)>=Math.abs(e.clientY-m.y)?`x`:`y`,n=e.composedPath()[0];p=!1,m=null,d(n)&&k(n,t)&&l();return}g()}},b=e=>{if(l!=null||o!=null||!h(e)||i&&m?.id!==e.pointerId)return;let r=p;p=!1,m=null,r&&!t(e.composedPath())&&(gr(c),n())},x=null,S=e=>t=>{t===x||e!=null&&t.composedPath().includes(e)||(x=t,b(t))},C=S(f.at(-1)?.host??null),w=f.map(({root:e,host:t},n)=>({shadow:e,host:t,handleRootUp:S(n===0?null:f[n-1].host),handleHostUp:S(null)})),T=e=>{h(e)&&(i&&m?.id===e.pointerId?g():i||(p=!1,m=null))},E=[c,...f.map(({root:e})=>e)];for(let e of E)e.addEventListener(`pointerdown`,_,!0);let D=c.defaultView,O=u&&D!=null?A(D,`pointermove`,y):null;c.addEventListener(`pointerup`,C,!0);for(let{shadow:e,host:t,handleRootUp:n,handleHostUp:r}of w)e.addEventListener(`pointerup`,n,!0),t.addEventListener(`pointerup`,r);return c.addEventListener(`pointercancel`,T,!0),()=>{for(let e of E)e.removeEventListener(`pointerdown`,_,!0);O?.(),c.removeEventListener(`pointerup`,C,!0);for(let{shadow:e,host:t,handleRootUp:n,handleHostUp:r}of w)e.removeEventListener(`pointerup`,n,!0),t.removeEventListener(`pointerup`,r);c.removeEventListener(`pointercancel`,T,!0)}}function yr(){let e=(0,U.useRef)(null),t=(0,U.useCallback)(()=>{e.current?.(),e.current=null},[]),n=(0,U.useCallback)((t,n,r,i)=>{e.current?.(),e.current=vr(t,n,r,i)},[]);return(0,U.useEffect)(()=>t,[t]),(0,U.useMemo)(()=>({start:n,stop:t}),[n,t])}function br(e,t){for(let n=e;n!=null;n=n.parentNode??_(n))if(d(n)&&n.id===t)return!0;return!1}function xr(e,t,n){return e.some(e=>e===t||n!==``&&x(e)&&d(e)&&e.id===n)}function Sr(e,t,n){return x(e)&&(t?.contains(e)===!0||br(e,n))}var Cr=u(`layer/layer-surface-press/surfaces`,1);function wr(e){if(e==null)return;Cr.add(e);let t=e.parentElement;t?.hasAttribute(`popover`)&&Cr.add(t)}function Tr(e){return Cr.has(e)}function Er(e){return e.replace(/[\x00-\x1f\x7f]/g,``).trim()}function Dr(e){return e.toLowerCase().replace(/^([a-z][a-z\d+.-]*:) +/,`$1`)}function Or(e){let t=Er(e),n=Dr(t);return n.startsWith(`javascript:`)||n.startsWith(`vbscript:`)||n.startsWith(`data:text/html`)?null:t}function kr(e){return Or(e)!==null}function Ar(e){if(e==null)return!0;if(typeof e==`string`)return kr(e);if(typeof e!=`object`)return!1;let{pathname:t,href:n,protocol:r,host:i,hostname:a}=e;for(let e of[t,n,r,i,a])if(e!=null&&typeof e!=`string`)return!1;if(typeof t==`string`&&!kr(t)||typeof n==`string`&&!kr(n))return!1;if(typeof r==`string`&&r!==``){let e=Er(r),n=e.endsWith(`:`)?e:`${e}:`;if(!kr(n)||!kr(`${n}${i||a||``}${typeof t==`string`?t:``}`))return!1}return!0}var jr=`data-astryx-menu-press`,Mr={duration:`200ms`,easing:`cubic-bezier(0.42, 0, 0.58, 1)`},Nr={"--duration-fast-min":`130ms`,"--duration-fast":`175ms`,"--duration-fast-max":`230ms`,"--duration-medium-min":`310ms`,"--duration-medium":`410ms`,"--duration-medium-max":`550ms`,"--duration-slow-min":`730ms`,"--duration-slow":`975ms`,"--duration-slow-max":`1300ms`,"--duration-exit":`var(--duration-fast)`,"--ease-standard":`cubic-bezier(0.24, 1, 0.4, 1)`,"--ease-entrance":`cubic-bezier(0.24, 1, 0.4, 1)`,"--ease-move":`cubic-bezier(0.24, 1, 0.4, 1)`,"--ease-exit":`cubic-bezier(0.3, 0, 0.6, 0.6)`};function Pr(e,t,{jumps:n=!1}={}){let r=n=>e<=0||n>=e?1:t(Math.max(0,n)/e),i=Math.min(.001,e/100);return{duration:e,at:r,velocity:t=>{if(e<=0||t>=e)return 0;let a=Math.max(0,t-i),o=Math.min(e,t+i);if(!n)return(r(o)-r(a))/(o-a);let s=r(t),c=[];return t>a&&c.push((s-r(a))/(t-a)),o>t&&c.push((r(o)-s)/(o-t)),c.reduce((e,t)=>Math.abs(t)<Math.abs(e)?t:e)}}}function Fr(e){return O(`duration`,e.transitionDuration.split(`,`)[0]??``)}function Ir(e){return e.transitionTimingFunction.split(/,(?![^(]*\))/)[0]??``}function Lr(e){return p(Ir(e))}function Rr(e,t){let n=e.defaultView;if(typeof n?.Animation!=`function`||typeof n.KeyframeEffect!=`function`)return null;let r;try{r=new n.Animation(new n.KeyframeEffect(null,null,{duration:1e3,easing:t,fill:`both`}),null)}catch{return null}return e=>(r.currentTime=Math.min(1,Math.max(0,e))*1e3,r.effect?.getComputedTiming().progress??1)}function zr(e,{ms:t,points:n},r){if(t==null||t<=0)return null;if(n!=null)return Pr(t/1e3,f(n));let i=Rr(e,r);return i==null?null:Pr(t/1e3,i,{jumps:!0})}function Br(e,{duration:t,easing:n}){let r=t==null?null:O(`duration`,t),i=n==null?null:p(n),a=e.ownerDocument,o=a.defaultView,s=t!=null&&r==null,c=n!=null&&i==null;if(o==null||!s&&!c)return{ms:r,points:i};let l=a.createElement(`span`);l.style.setProperty(`display`,`none`,`important`);let u=(e,t)=>(l.style.setProperty(e,t,`important`),l.style.getPropertyValue(e)!==``),d=s&&u(`transition-duration`,t),f=c&&u(`transition-timing-function`,n);(a.body??a.documentElement).append(l);try{let e=o.getComputedStyle(l);return{ms:d?Fr(e):r,points:f?Lr(e):i}}finally{l.remove()}}function Vr(e,t){let n=e.getPropertyValue(t).trim();if(n!==``)return n;let r={};for(let[t,n]of Object.entries(Nr))r[t]=e.getPropertyValue(t).trim()||n;return ve(r)[t]??``}function Hr(e,{duration:t,easing:n}){let r=e.ownerDocument.defaultView?.getComputedStyle(e);return r==null?{ms:null,points:null}:Br(e,{duration:t==null?void 0:Vr(r,t),easing:n==null?void 0:Vr(r,n)})}function Ur(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle(e);return n==null?null:Vr(n,t)}function Wr(e,t){let n=e.ownerDocument,r=n.defaultView?.getComputedStyle(e);if(r==null)return null;if(t!=null){let i=Vr(r,t.easing);return zr(n,Br(e,{duration:Vr(r,t.duration),easing:i}),i)}let i=Ir(r);return zr(n,{ms:Fr(r),points:p(i)},i)}var Gr=`data-astryx-press-box`,Kr=`[data-astryx-pressable]`,qr={[Gr]:``};function Jr(e,t){if(!(e instanceof Element))return null;let n=e.closest(`[${Gr}]`);return n instanceof HTMLElement&&t.contains(n)?n:null}function Yr(e){return Array.from(e.querySelectorAll(`[${Gr}]`)).filter(t=>t.closest(Kr)===e)}var Xr=`data-astryx-press-holds-drag`;function Zr(e){return e.hasAttribute(Xr)}var Qr=`data-astryx-press-group-item`;function $r(e){return{[Qr]:e.join(` `)}}function ei(e){return e.hasAttribute(Qr)}function ti(e,t=null){let n=e.closest(`[${Qr}]`);return n==null?!1:t==null||(n.getAttribute(Qr)??``).split(` `).includes(t)}var ni=`data-astryx-pressable`,ri=`data-astryx-press`,ii={[ni]:``},ai=`:disabled, [aria-disabled="true"]`,oi=new Set([`button`,`image`,`reset`,`submit`]),si=`[${jr}]`,Q={live:null},ci=null;function li(e){let t=ci;ci=null,t?.end(e)}var ui=null;function di(e){ui=e}var $={live:null},fi=0,pi=0,mi=null,hi=0,gi=null,_i={fade:oe,flash:100,onset:150};function vi(e){let t=Hr(e,{duration:`--duration-exit`}).ms??oe,n=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=O(`duration`,Mr.duration);return n&&r!=null?Math.min(t,r):t}function yi(e){return typeof e.getAnimations==`function`?e.getAnimations({subtree:!0}).filter(t=>{let n=t.effect,r=n?.target??null;return n==null||r==null||!(`animationName`in t)||r!==e&&r.closest(`[data-astryx-pressable]`)!==e||!Number.isFinite(Number(n.getComputedTiming().endTime))?!1:t.playState!==`finished`}):[]}function bi(e,t,n){let r=!0,i=setTimeout(()=>{let t=yi(e);t.length===0?n():Promise.allSettled(t.map(async e=>e.finished)).then(()=>{r&&n()})},t);return()=>{r=!1,clearTimeout(i)}}var xi={fade:`fadeEnd`,flash:`flashEnd`,onset:`onset`};function Si(e,t){t===`none`?e.removeAttribute(ri):e.getAttribute(`data-astryx-press`)!==t&&e.setAttribute(ri,t)}function Ci(e){e.live?.timer!=null&&(e.live.timer(),e.live.timer=null)}function wi(e,t,n=0){let r=e.live;if(r==null)return;let i=t.gesture.phase!==r.gesture.phase;if((t.timer!=null||i)&&Ci(e),r.gesture=t.gesture,Si(r.element,t.paint),t.gesture.phase===`idle`)e.live=null;else if(t.timer!=null){let i=t.timer,a=()=>{e.live!=null&&(e.live.timer=null),wi(e,B(e.live?.gesture??ce(),{kind:xi[i]}))};if(i===`fade`)r.timer=bi(r.element,vi(r.element),a);else{let e=i===`onset`?Math.max(0,_i.onset-n):_i[i],t=setTimeout(a,e);r.timer=()=>clearTimeout(t)}}}function Ti(e){if(!(e instanceof Element))return null;let t=e.closest(`[${ni}]`);return!(t instanceof HTMLElement)||t.matches(ai)||Se(t)?null:t}function Ei(e){return Date.now()-pi>=150?!1:mi instanceof Node&&mi.contains(e)}function Di(e){e.live?.gesture.phase===`dead`&&(Ci(e),e.live=null)}function Oi(e){let t=e.live;t!=null&&(Ci(e),t.element.removeAttribute(ri),e.live=null,e===$&&sa(!1))}function ki(e){Q.live?.element===e&&Oi(Q),$.live?.element===e&&Oi($)}function Ai(e,t){e.live?.element===t&&Oi(e)}function ji(){return typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches}function Mi(e){let t=Ti(e);return t!=null&&Ni(t)}function Ni(e){return Yr(e).length>0}function Pi(e,t){let n=Ti(e);return n==null||n.closest(si)!=null||t!=null&&ti(n,`mouse`)||t==null&&n!==e?null:n}function Fi(e,t){Oi($);let n=Pi(e,t);n!=null&&(Ai(Q,n),$.live={element:n,gesture:ce(),pointerId:t,timer:null},sa(t==null),wi($,B($.live.gesture,{kind:`buttonDown`})))}function Ii(e){return Ni(e)&&!ji()&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Li(){sa(!1),$.live!=null&&(Ii($.live.element)?Ri():wi($,B($.live.gesture,{kind:`up`})))}function Ri(){sa(!1),$.live!=null&&(wi($,B($.live.gesture,{kind:`cancel`})),Di($))}function zi(e){if(e.pointerType===`mouse`){(ji()?e.button===0:Ce(e)&&Mi(e.target))&&Fi(e.target,e.pointerId);return}if(e.pointerType===`pen`&&!Ce(e)&&Mi(e.target))return;if(ta(),li(!1),Q.live!=null){if(Q.live.gesture.phase!==`fading`&&Q.live.gesture.phase!==`flash`){Oi(Q);return}Oi(Q)}let t=Ti(e.target),n=e.pointerType===`pen`&&t!=null&&Ni(t),r=t!=null&&!n&&Ei(t);if(hi=Date.now(),gi=e.target instanceof Node?e.target:null,t==null||ti(t,e.pointerType))return;let i=ui?.start(t,e.target)??null,a=r?null:{element:t,gesture:ce(),pointerId:e.pointerId,timer:null};i!=null&&(ci={pointerId:e.pointerId,live:a,end:i}),a!=null&&(Ai($,t),Q.live=a,wi(Q,B(a.gesture,{kind:`down`,x:e.clientX,y:e.clientY,delayed:!n&&M(t)}),H(e.timeStamp,e)))}function Bi(e){let t=Q.live;t==null||t.pointerId!=null&&e.pointerId!==t.pointerId||Zr(t.element)||wi(Q,B(t.gesture,{kind:`move`,x:e.clientX,y:e.clientY}))}function Vi(e){if(e.pointerType===`mouse`){$.live!=null&&$.live.pointerId===e.pointerId&&Li();return}if(hi=Date.now(),e.target instanceof Node&&(gi=e.target),ci!=null&&ci.pointerId===e.pointerId){let e=ci.live;li(e!=null&&Q.live===e&&e.gesture.phase!==`dead`)}let t=Q.live;if(t==null||t.pointerId!=null&&e.pointerId!==t.pointerId)return;let n=e.pointerType===`pen`&&Ii(t.element)?`cancel`:`up`;wi(Q,B(t.gesture,{kind:n})),Di(Q)}function Hi(e){let t=e;if(t?.pointerType===`mouse`){$.live!=null&&$.live.pointerId===t.pointerId&&Ri();return}t?.pointerId!=null&&ci?.pointerId===t.pointerId&&li(!1);let n=Q.live;n!=null&&(wi(Q,B(n.gesture,{kind:`cancel`})),Di(Q))}function Ui(){Hi(),Ri()}function Wi(e){let t=e.target instanceof Node?e.target:document;Date.now()-hi<3e3&&gi!=null&&t.contains(gi)&&(pi=Date.now(),mi=t);let n=Q.live;n!=null&&(t===document||t.contains(n.element))&&Hi()}function Gi(e){return e instanceof HTMLButtonElement||e instanceof HTMLInputElement&&oi.has(e.type)}function Ki(e){return e instanceof Element&&ti(e)}function qi(e){e.key!==` `||e.repeat||e.isComposing||e.defaultPrevented||!Gi(e.target)||!(ji()||Ki(e.target))||Fi(e.target,null)}function Ji(e){e.key===` `&&$.live!=null&&$.live.pointerId==null&&Li()}function Yi(){$.live!=null&&$.live.pointerId==null&&Li()}function Xi(){document.visibilityState===`hidden`&&(li(!1),Oi(Q),Oi($))}var Zi=[],Qi=null,$i=null;function ea(e){e!==(Qi!=null)&&(e?Qi=A(window,`touchcancel`,Hi):(Qi?.(),Qi=null))}function ta(){$i??($i=S(window,ea),ea(T(window)))}function na(){Zi=[A(window,`pointerdown`,zi),A(window,`pointermove`,Bi),A(window,`pointerup`,Vi),A(window,`pointercancel`,Hi),A(window,`dragstart`,Ui),A(window,`scroll`,Wi),A(window,`visibilitychange`,Xi)],window.addEventListener(`keydown`,qi,aa)}function ra(){li(!1),ui?.endWaits();for(let e of Zi.splice(0))e();$i?.(),$i=null,ea(!1),window.removeEventListener(`keydown`,qi),sa(!1)}var ia={capture:!0,passive:!0},aa={passive:!0},oa=!1;function sa(e){e!==oa&&(oa=e,e?(window.addEventListener(`keyup`,Ji,aa),window.addEventListener(`blur`,Yi,ia)):(window.removeEventListener(`keyup`,Ji),window.removeEventListener(`blur`,Yi,ia)))}function ca(){if(typeof window>`u`)return()=>void 0;fi===0&&na(),fi+=1;let e=!1;return()=>{e||(e=!0,--fi,fi>0||(ra(),Oi(Q),Oi($),pi=0,mi=null,hi=0,gi=null))}}var la=`data-pressable-container`,ua=[`button`,`a`,`input`,`select`,`textarea`,`[role="button"]`,`[role="link"]`,`[role="checkbox"]`,`[role="radio"]`,`[role="switch"]`,`[role="tab"]`,`[role="menuitem"]`,`[role="option"]`,`[role="combobox"]`,`[role="listbox"]`,`[role="slider"]`,`[role="spinbutton"]`,`[${la}]`].join(`,`),da=`[aria-readonly="true"]`;function fa(e){return e.matches(ua)&&!e.matches(da)}function pa(e,t,n=fa){let r=e;for(;r!=null&&r!==t&&r!==document.body;){if(n(r))return r;r=r.parentElement}return null}function ma(e,t){return pa(e,t,ha)!=null}function ha(e){return fa(e)||Tr(e)}function ga(e,t,n){let r=e.target;t!=null&&(e.pointerType===`touch`||Yr(t).length!==0)&&r instanceof Element&&r!==e.currentTarget&&ma(r,t)&&n?.contains(r)!==!0&&ki(t)}function _a(e){if(typeof document>`u`||!(`getSelection`in document))return!1;let t=document.getSelection();return t==null||t.isCollapsed?!1:e.contains(t.anchorNode)}function va(e){let{containerRef:t}=e;return(0,U.useEffect)(()=>{let e=t.current;e&&e.setAttribute(la,`true`)},[t]),ya(e)}function ya({containerRef:e,interactiveRef:t,onClick:n,href:r,target:i,disabled:a=!1}){return{onClick:(0,U.useCallback)(o=>{if(a)return;let s=e.current;if(!s||_a(s))return;let c=o.target;if(c instanceof Element&&!(c!==o.currentTarget&&ma(c,s))&&(n?.(o),!o.defaultPrevented&&(r!=null&&kr(r)&&(i===`_blank`||o.ctrlKey||o.metaKey?window.open(r,`_blank`,`noopener`):t?.current?t.current.click():window.location.href=r),r==null&&n==null&&t?.current))){let e=new MouseEvent(`click`,{bubbles:o.bubbles,cancelable:o.cancelable,ctrlKey:o.ctrlKey,metaKey:o.metaKey,shiftKey:o.shiftKey,altKey:o.altKey,button:o.button});t.current.dispatchEvent(e),o.stopPropagation()}},[e,t,n,r,i,a]),onMouseUp:(0,U.useCallback)(t=>{if(a)return;let n=e.current;if(!n)return;let i=t.target;i instanceof Element&&t.button===1&&r!=null&&kr(r)&&(i===t.currentTarget||!ma(i,n))&&window.open(r,`_blank`,`noopener`)},[e,r,a]),onPointerDown:(0,U.useCallback)(n=>{a||ga(n,e.current,t?.current??null)},[e,t,a])}}function ba(e){if(e.getAttribute(`aria-disabled`)===`true`)return!0;try{return e.matches(`:disabled`)}catch{return!1}}function xa(e){let t=(0,U.useRef)(!1),n=e=>{t.current=Ke.has(e.pointerType)},r=e=>{t.current&&e.preventDefault(),t.current=!1};return e===`click`?{onPointerDown:n,onClick:r}:{onPointerDown:n,onMouseDown:r}}var Sa=new Set([`button`,`checkbox`,`combobox`,`link`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`searchbox`,`slider`,`spinbutton`,`switch`,`tab`,`textbox`]);function Ca(e){if(ba(e))return!1;let t=e.getAttribute(`role`);if(t!=null&&t!==``)return Sa.has(t);switch(e.tagName){case`LABEL`:{let t=e.control;return t==null||!ba(t)}case`BUTTON`:case`INPUT`:case`SELECT`:case`SUMMARY`:case`TEXTAREA`:return!0;case`A`:case`AREA`:return e.hasAttribute(`href`);default:return Ea(e)}}function wa(e){if(ba(e))return!0;if(e.tagName===`LABEL`){let t=e.control;return t!=null&&ba(t)}return!1}function Ta(e){let t=pa(e,null,e=>fa(e)||e.tagName===`LABEL`||ba(e));return t!=null&&wa(t)}function Ea(e){if(e.isContentEditable===!0)return!0;let t=e.getAttribute(`contenteditable`);return t!=null&&t!==`false`}function Da(e){let t=Oa(e);return{isTouchPointerRef:t.isTouchPointerRef,isTouchInteraction:t.isTouchInteraction,handlePointerEnter:t.handlePointerEnter,handlePointerDown:t.handlePointerDown,clearTapOpen:t.clearTapOpen}}function Oa(e,t,n=!1){let{touchTrigger:r,isEnabled:i,isControlled:a,isOpen:o,layerId:s,triggerRef:c,show:l,hide:u}=e,f=(0,U.useRef)(!1),p=te(u),m=te(s),h=te(t),g=(0,U.useRef)(!1),_=(0,U.useRef)(null),v=(0,U.useRef)([]),y=qe();le(c);let x=(0,U.useCallback)(()=>{g.current=!1;let e=_.current;if(e!=null){_.current=null;for(let t of v.current)t.removeEventListener(`pointerup`,e,!0),t.removeEventListener(`pointercancel`,e,!0);v.current=[]}},[]),S=(0,U.useCallback)(()=>{if(g.current=!0,_.current!=null)return;let e=c.current?.ownerDocument??document,t=e===document?[document]:[document,e],n=e=>{let n=e.target;if(n!=null){if(e.type===`pointerup`&&c.current?.contains(n)===!0)return;if(t.some(e=>e.getElementById(m.current)?.contains(n)===!0)){e.type===`pointerup`&&h.current?.();return}}x(),n!=null&&gr(n.ownerDocument??document),p.current()};_.current=n,v.current=t;for(let e of t)e.addEventListener(`pointerup`,n,!0),e.addEventListener(`pointercancel`,n,!0)},[c,x,p,m,h]);(0,U.useEffect)(()=>x,[x]);let C=(0,U.useCallback)(()=>f.current&&I(c.current),[c]),w=(0,U.useCallback)(e=>{f.current=e.pointerType===`touch`},[]),T=te(e=>{let t=c.current,a=d(e?.target)?e.target:null;if(n&&a!=null&&b(t)){let e=ae(a,t);if(e!=null&&e!==t&&!Ta(a))return}(r===`auto`?a!=null&&Ta(a)?`tap`:t!=null&&Ca(t)?`none`:`tap`:r)===`none`||!i||o||g.current?(x(),u()):(S(),l())}),E=(0,U.useCallback)(e=>{let t=Ke.has(e.pointerType);if(f.current=t,!t||a)return y.forget(),!1;let n=e.currentTarget instanceof Element?e.currentTarget:c.current;return y.press(e,n,e=>T.current(e)),!0},[a,c,y,T]),D=(0,U.useRef)(o);return(0,U.useEffect)(()=>{D.current&&!o&&x(),D.current=o},[o,x]),{isTouchPointerRef:f,isTouchInteraction:C,handlePointerEnter:w,handlePointerDown:E,clearTapOpen:x,armOutsideDismiss:S,answerTap:(0,U.useCallback)(e=>T.current(e),[T])}}var ka=`[role="log"], [role="status"], [role="alert"], [aria-live="polite"], [aria-live="assertive"]`,Aa=`[aria-hidden="true"], [hidden]`,ja=`p, div, li, br, h1, h2, h3, h4, h5, h6`;function Ma(e,t){return Array.from(e.childNodes).map(e=>{if(e.nodeType===Node.TEXT_NODE)return(e.textContent??``).replace(/\s+/g,` `).trim();if(e.nodeType===Node.ELEMENT_NODE){let n=e;return n.matches(Aa)||t!=null&&n.matches(t)?``:Na(n,t)}return``}).filter(e=>e!==``).join(` `)}function Na(e,t){let n=e.ownerDocument.defaultView,r=e=>n?.getComputedStyle(e).display??``,i=[],a=(e,n)=>{if(e.nodeType===Node.TEXT_NODE){i.push(e.textContent??``);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let o=e;if(o.matches(Aa)||t!=null&&o.matches(t))return;let s=r(o),c=o.matches(ja)||s!==``&&s!==`contents`&&!s.startsWith(`inline`)||/\b(flex|grid)\b/.test(n);c&&i.push(` `),o.childNodes.forEach(e=>a(e,s)),c&&i.push(` `)},o=r(e);return e.childNodes.forEach(e=>a(e,o)),i.join(``).replace(/\s+/g,` `).trim()}function Pa(e,t,n,{skipFirstRender:r=!1,politeness:i=`polite`,fallbackText:a,announce:o,exclude:s}={}){let c=V(),l=o??c,u=(0,U.useRef)(null),d=z(),[f]=(0,U.useState)(()=>d||document.readyState!==`complete`),p=(0,U.useRef)(!0);(0,U.useEffect)(()=>{let o=p.current;p.current=!1;let c=e.current;if(!t||c?.closest(Aa)||c?.checkVisibility?.()===!1){u.current=null;return}if(!c||r&&c.parentElement?.closest(ka))return;let d=r?Ma(c,s):Na(c,s);if(d===``&&a!==void 0&&(d=(c.getAttribute(`aria-labelledby`)??``).split(/\s+/).map(e=>{let t=c.ownerDocument.getElementById(e);return t==null?``:Na(t)}).join(` `).replace(/\s+/g,` `).trim()||a),d===``)return;let m=`${n}\u0000${d}`;if(u.current===m)return;u.current=m;let h=o&&f||document.readyState!==`complete`;r&&h||l(d,i)})}`${i[`--spacing-2`]}${i[`--spacing-2`]}`,l[`--duration-fast-max`],Mr.duration,y[`--ease-standard`];var Fa={below:{kKVMdj:`x1d5jn3a x2g3n7u xaqowwx`,k44tkh:`x9uej1z x10got5w`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,k3nNDw:`x9r0mi6`,$$css:!0},above:{kKVMdj:`xksu0ym x2g3n7u xaqowwx`,k44tkh:`x9uej1z x10got5w`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,k3nNDw:`x9r0mi6`,$$css:!0},end:{kKVMdj:`xyzx0um xixcm9l x2g3n7u xaqowwx`,k44tkh:`x9uej1z x10got5w`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,k3nNDw:`x9r0mi6`,$$css:!0},start:{kKVMdj:`x1qqotkc x1g7o29q x2g3n7u xaqowwx`,k44tkh:`x9uej1z x10got5w`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,k3nNDw:`x9r0mi6`,$$css:!0}};function Ia(e){return e.localName===`input`?!R.has((e.getAttribute(`type`)??`text`).toLowerCase()):e.matches(`textarea, [contenteditable]:not([contenteditable="false"])`)}var La=100,Ra={container:{kWkggS:`xenstv7`,kMwMTN:`xrkvqaz`,kaIpWk:`x1hviunn`,kMv6JI:`x9ynric`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0}};function za(e={}){let{placement:t=`above`,alignment:n=`center`,delay:r=200,hideDelay:a=0,focusTrigger:o=`auto`,touchTrigger:s=`auto`,isEnabled:c=!0,isOpen:l,isDefaultOpen:u=!1,onShow:d,onHide:f}=e,{ref:p,anchorId:m,show:h,hide:g,isOpen:_,id:v,render:y}=mr({mode:`context`,onShow:d,onHide:f,keepsAnchorClear:!0}),b=Ra.container,x=(0,U.useRef)(null),S=(0,U.useRef)(null),C=(0,U.useRef)(null),w=(0,U.use)(Te),T=(0,U.useRef)(0);c||(T.current+=1);let D=(0,U.useCallback)(()=>{x.current&&=(clearTimeout(x.current),null),S.current&&=(clearTimeout(S.current),null)},[]),O=(0,U.useCallback)(()=>{D(),h()},[D,h]),k=(0,U.useCallback)(()=>{D(),g()},[D,g]),A=te({isOpen:l,isLayerOpen:_,onShow:d,onHide:f}),j=(0,U.useRef)(!1),[M,ee]=(0,U.useState)(!1),N=(0,U.useCallback)(e=>{j.current=e,ee(e)},[]),P=(0,U.useRef)(!1),F=(0,U.useRef)(!1),re=(0,U.useCallback)(()=>{P.current&&j.current&&(P.current=!1,N(!1))},[N]),I=(0,U.useCallback)(()=>{if(j.current){N(!1);let e=A.current;if(e.isOpen!==void 0){e.onHide?.();return}}k()},[N,k,A]),{isTouchPointerRef:ie,isTouchInteraction:ae,handlePointerEnter:oe,handlePointerDown:se,clearTapOpen:ce,armOutsideDismiss:L,answerTap:le}=Oa({touchTrigger:s,isEnabled:c,isControlled:l!==void 0,isOpen:_,layerId:v,triggerRef:C,show:O,hide:I},re,!0),R=(0,U.useCallback)(()=>{let e=A.current;return j.current&&e.isLayerOpen&&e.isOpen!==!1},[A]),ue=(0,U.useCallback)(()=>{ce(),N(!1);let e=A.current;e.isOpen===void 0?k():e.onHide?.()},[ce,N,k,A]),de=(0,U.useCallback)(()=>{j.current&&N(!1)},[N]),fe=(0,U.useCallback)(e=>{if(!R())return;let t=e.relatedTarget,n=C.current,r=n?.ownerDocument.defaultView;if(r==null||!(t instanceof r.Node))return;let i=n?.ownerDocument.getElementById(v)??null;n?.contains(t)!==!0&&i?.contains(t)!==!0&&(gr(r.document),ue())},[R,v,ue]),pe=M&&_&&l!==!1,z=(0,U.useRef)(null);Pa(z,pe,`pinned`);let _e=me(z,wr),ve=(0,U.useCallback)(()=>{if(!c||l===!1)return;D();let e=T.current;x.current=setTimeout(()=>{T.current===e&&h()},r)},[c,l,D,h,r]),B=(0,U.useCallback)(()=>{l===!0||R()||(D(),S.current=setTimeout(()=>{g()},a>0?a:La))},[l,R,D,g,a]),ye=(0,U.useCallback)(()=>{S.current&&=(clearTimeout(S.current),null)},[]),be=(0,U.useCallback)(()=>{ie.current||ve()},[ie,ve]),xe=(0,U.useCallback)(e=>{if(ie.current)return;let t=e.relatedTarget,n=t==null?null:t.ownerDocument?.getElementById(v);n!=null&&n.contains(t)||B()},[ie,v,B]),[V]=(0,U.useState)(De),H=(0,U.useCallback)((e,t)=>t!=null&&!G(e,t,o)||!Ia(e)&&he(e)===`pointer`?!1:!ae()&&e.matches(`:focus-visible`),[o,ae]),Se=(0,U.useCallback)(e=>{if(!V.focusIn(e,o)||!c||!H(e.target,null))return;D();let t=A.current;t.isOpen===!1?t.onShow?.():h()},[V,o,c,H,D,h,A]),Ce=(0,U.useCallback)(e=>{V.focusOut(e,o)&&B()},[V,o,B]),we=(0,U.useRef)(!1),W=(0,U.useRef)(null),Ee=(0,U.useCallback)(()=>{W.current?.();let e=C.current?.ownerDocument.defaultView;if(e==null)return;we.current=!0;let t=C.current,n=r=>{r?.type===`pointerup`&&r.target instanceof e.Node&&t?.contains(r.target)===!0&&(P.current=!1),e.removeEventListener(`pointerup`,n,!0),e.removeEventListener(`pointercancel`,n,!0),we.current=!1,W.current=null};e.addEventListener(`pointerup`,n,!0),e.addEventListener(`pointercancel`,n,!0),W.current=n},[]),Oe=(0,U.useCallback)(e=>{Ee(),j.current?F.current&&(P.current=!0):se(e)?x.current&&=(clearTimeout(x.current),null):l===void 0&&(D(),g())},[se,Ee,l,D,g]),K=te({handleMouseEnter:be,handleMouseLeave:xe,handleFocusIn:Se,handleFocusOut:Ce,handleHeldFocusOut:fe,handlePointerEnter:oe,handlePointerDown:Oe,focusTrigger:o,isEnabled:c,isOpen:l,dropHold:de,hideNow:k,showNow:O,opensOnFocus:H,presentInterest:w,answerTap:le}),ke=(0,U.useRef)(null),Ae=(0,U.useRef)(!1),q=(0,U.useRef)(!1),je=(0,U.useCallback)(()=>{if(!q.current)return;q.current=!1;let e=K.current;!e.isEnabled&&e.isOpen===void 0&&(Ae.current=!0,e.dropHold(),e.hideNow())},[K]);E(()=>{je()});let Me=(0,U.useCallback)(e=>{if(e==null){ke.current?.();return}if(e===C.current)return;ke.current?.();let t=()=>K.current,n=e=>t().handlePointerEnter(e),r=()=>t().handleMouseEnter(),i=e=>t().handleMouseLeave(e),a=e=>t().handlePointerDown(e),o=e=>{t().focusTrigger!==`never`&&t().handleFocusIn(e)},s=e=>{t().focusTrigger!==`never`&&t().handleFocusOut(e)},c=e=>t().handleHeldFocusOut(e);e.addEventListener(`pointerenter`,n),e.addEventListener(`mouseenter`,r),e.addEventListener(`mouseleave`,i),e.addEventListener(`pointerdown`,a),e.addEventListener(`focusin`,o),e.addEventListener(`focusout`,s),e.addEventListener(`focusout`,c),C.current=e;let l=e.ownerDocument.activeElement,u=Ae.current;t().isEnabled&&(Ae.current=!1),u&&t().isEnabled&&t().isOpen===void 0&&t().focusTrigger!==`never`&&l instanceof HTMLElement&&e.contains(l)&&t().opensOnFocus(l,e)&&t().showNow();let d=t().presentInterest?.current,f=d==null||d.isRead?null:d.interest,p=d?.tapEvent??null;d!=null&&(d.isRead=!0),t().isEnabled&&t().isOpen===void 0&&(f===`hover`?t().handleMouseEnter():f===`tap`?t().answerTap(p):f===`focus`&&t().focusTrigger!==`never`&&l instanceof HTMLElement&&e.contains(l)&&t().opensOnFocus(l,e)&&t().showNow());let m=()=>{ke.current===m&&(ke.current=null),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`mouseenter`,r),e.removeEventListener(`mouseleave`,i),e.removeEventListener(`pointerdown`,a),e.removeEventListener(`focusin`,o),e.removeEventListener(`focusout`,s),e.removeEventListener(`focusout`,c),W.current?.(),C.current===e&&(C.current=null),q.current=!0,queueMicrotask(je)};return ke.current=m,m},[K,je]),Ne=(0,U.useCallback)(e=>{p(e);let t=Me(e);if(e!=null)return()=>{t?.(),p(null)}},[p,Me]);return(0,U.useEffect)(()=>()=>{D()},[D]),(0,U.useEffect)(()=>{u&&h()},[]),(0,U.useEffect)(()=>{l!==void 0&&(l?(D(),h()):(D(),de(),g()))},[l,D,h,g,de]),ge({isActive:!0,isPresent:()=>{let e=typeof document>`u`?null:document.getElementById(v);if(e==null)return!1;try{return e.matches(`:popover-open`)}catch{return _}},onDismiss:()=>{D(),ce(),de(),l===void 0?g():f?.()}}),{ref:Ne,positionRef:p,interactionRef:Me,anchorId:m,describedBy:v,renderTooltip:(0,U.useCallback)((e,r)=>{let a=r?.placement??t,o={placement:a,alignment:r?.alignment??n,offset:i[`--spacing-1`],role:`tooltip`,xstyle:[b,Fa[a]],className:ne(`tooltip`).className,onMouseEnter:ye,onMouseLeave:B};return y((0,X.jsx)(`div`,{ref:_e,className:`xfsso4q xy143xn x12gdq22 x1djylfy xw5ewwj x13faqbe`,children:e}),o)},[y,t,n,b,ye,B,_e]),show:(0,U.useCallback)(()=>{if(D(),!c)return;N(!0),L(),P.current=we.current,F.current=!0,C.current?.ownerDocument.defaultView?.setTimeout(()=>{F.current=!1},0);let e=A.current;e.isOpen===void 0?h():e.onShow?.()},[D,c,N,L,h,A]),hide:(0,U.useCallback)(()=>{D(),ue()},[D,ue])}}export{_r as A,Ut as B,Mr as C,Sr as D,wr as E,mr as F,Ue as G,et as H,tn as I,Te as J,qe as K,rn as L,vr as M,dr as N,xr as O,pr as P,Gt as R,Ur as S,Ar as T,We as U,Wt as V,ze as W,$r as _,Da as a,Pr as b,va as c,ki as d,di as f,ei as g,ii as h,xa as i,yr as j,gr as k,ya as l,vi as m,Fa as n,la as o,ca as p,De as q,Pa as r,ga as s,za as t,ri as u,Jr as v,jr as w,Wr as x,qr as y,Ht as z};