ownledger 2.1.0 → 2.1.1

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 (71) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/assets/index.html +10 -10
  3. package/assets/static/{Account-sw3qGLbB.js → Account-CYrXDU9Z.js} +1 -1
  4. package/assets/static/{Accounts-DWyzX3qB.js → Accounts-BXleOwUO.js} +1 -1
  5. package/assets/static/{Attention-DxV-4qdY.js → Attention-Ci3luOdE.js} +1 -1
  6. package/assets/static/{ByCategory-B4P3ikmE.js → ByCategory-cLVOyjwd.js} +1 -1
  7. package/assets/static/{CardDetail-CayBXBm-.js → CardDetail-BxXfAcMp.js} +1 -1
  8. package/assets/static/{Cards-CVuOP8Bt.js → Cards-DNtITMnA.js} +1 -1
  9. package/assets/static/{Cards-XUBdWxyo.js → Cards-DnIsAWPD.js} +1 -1
  10. package/assets/static/{CardsValue-EoW2jG_0.js → CardsValue-V1-fYMLf.js} +1 -1
  11. package/assets/static/{Cashback-BibVYHf_.js → Cashback-B8lqwRnb.js} +1 -1
  12. package/assets/static/{CategoryIcon-HfjYhH1l.js → CategoryIcon-D4Cdb_ZP.js} +1 -1
  13. package/assets/static/{CategoryPicker-BkmvzX2I.js → CategoryPicker-54vkuxVh.js} +1 -1
  14. package/assets/static/{ChartWidget-u09-whUU.js → ChartWidget-S5F4Ze91.js} +1 -1
  15. package/assets/static/{Combobox-xXeyjGgK.js → Combobox-BvX68J3o.js} +1 -1
  16. package/assets/static/{Deposits-CLAda4dj.js → Deposits-Ct5HhCEc.js} +1 -1
  17. package/assets/static/{DrillLink-Bvfam9FA.js → DrillLink-CZyI-y0-.js} +1 -1
  18. package/assets/static/{Field-tKFmKDEF.js → Field-DYmqEAlI.js} +1 -1
  19. package/assets/static/{HomeEditor-4vxj5LMD.js → HomeEditor-Dv-h_ql-.js} +1 -1
  20. package/assets/static/{Import-DwaaFpRJ.js → Import-B2uhVnEm.js} +1 -1
  21. package/assets/static/{IncomeSpending-RVDSxAK4.js → IncomeSpending-DNT2CWH9.js} +1 -1
  22. package/assets/static/{KV-DMA1AlP-.js → KV-CKWaJkRK.js} +1 -1
  23. package/assets/static/{Left-C_4gTGSX.js → Left-BefXZztB.js} +1 -1
  24. package/assets/static/{Money-PfFNNDOw.js → Money-BwLucm7P.js} +1 -1
  25. package/assets/static/{NetWorth-BSoseczC.js → NetWorth-DeLSapZ2.js} +1 -1
  26. package/assets/static/{Pace-B8p-9174.js → Pace-D6gilOBZ.js} +1 -1
  27. package/assets/static/{Panel-BnfWrw9R.js → Panel-CSe25x0N.js} +1 -1
  28. package/assets/static/{PinDialog-BqAU9Vh4.js → PinDialog-CHiLIKEs.js} +1 -1
  29. package/assets/static/{Plans-2KuQH2_I.js → Plans-D7rJ1yHU.js} +1 -1
  30. package/assets/static/{Recent-Ccmb34bq.js → Recent-Dcqb2yko.js} +1 -1
  31. package/assets/static/{Reports-Dd-dhclr.js → Reports--PDAEnQM.js} +1 -1
  32. package/assets/static/{Settings-BR8WBlen.js → Settings-Bd0oglWl.js} +1 -1
  33. package/assets/static/{Transactions-BAuQ-6Eb.js → Transactions-CQ1yQ1UU.js} +1 -1
  34. package/assets/static/{TxRow-EKIIMQKa.js → TxRow-BGfpKo2m.js} +1 -1
  35. package/assets/static/{Unusual-CwFp8aA5.js → Unusual-DGB4ZOA2.js} +1 -1
  36. package/assets/static/{Upcoming-B28roT9r.js → Upcoming-B0HwBqmG.js} +1 -1
  37. package/assets/static/{WhichCard-B3kLc842.js → WhichCard-BefFKS2q.js} +1 -1
  38. package/assets/static/{arrow-up-D3gxUKLo.js → arrow-up-CRgLRKET.js} +1 -1
  39. package/assets/static/{bits-Dr2E0ObC.js → bits-D34d9IBm.js} +1 -1
  40. package/assets/static/{button-rfwMVz0i.js → button-BKhMn8jX.js} +1 -1
  41. package/assets/static/{cards-Bb5zjzRG.js → cards-Ct0jh73r.js} +1 -1
  42. package/assets/static/{charts-BqP7HKwP.js → charts-D-1glV8L.js} +1 -1
  43. package/assets/static/chevron-down-BWoQwA6m.js +1 -0
  44. package/assets/static/chevron-right-D7Sgw1v1.js +1 -0
  45. package/assets/static/{createLucideIcon-flJrJK2p.js → createLucideIcon-XZ28znwT.js} +1 -1
  46. package/assets/static/{dialog-BuRqO4sc.js → dialog-Bx-cd-2e.js} +1 -1
  47. package/assets/static/{dist-B4_eGtNj.js → dist--HKr0kfV.js} +1 -1
  48. package/assets/static/{dist-B7PR2b0C.js → dist-BFPyD74_.js} +1 -1
  49. package/assets/static/{dist-BDn7ydjn.js → dist-CmbuesVk.js} +1 -1
  50. package/assets/static/{dist-Dl-m8cc2.js → dist-vgyaCpaL.js} +1 -1
  51. package/assets/static/{es2015-DJh4h8NX.js → es2015-DqY4UvQc.js} +1 -1
  52. package/assets/static/{index-eR1GkdC_.js → index-DBHFdsYB.js} +4 -4
  53. package/assets/static/{queries-DZIMMe4i.js → queries-BcMmmb36.js} +1 -1
  54. package/assets/static/{react-dom-wK_7mEjs.js → react-dom-5dgiSOdd.js} +1 -1
  55. package/assets/static/{select-eaSi9K-d.js → select-B5P2TaPX.js} +1 -1
  56. package/assets/static/{shared-Box7on3B.js → shared-BgU6fc7z.js} +1 -1
  57. package/assets/static/{triangle-exclamation-point-CuL0XSJl.js → triangle-exclamation-point-CMy18kC0.js} +1 -1
  58. package/assets/static/{useMutation-_Lw8xXWa.js → useMutation-aC3Z1p9y.js} +1 -1
  59. package/dist/modules/cards/files.d.ts +1 -1
  60. package/dist/modules/cards/files.js +1 -1
  61. package/dist/worker/api.js +12 -5
  62. package/dist/worker/github.d.ts +18 -1
  63. package/dist/worker/github.js +53 -6
  64. package/dist/worker/store.js +1 -1
  65. package/dist/worker/version.d.ts +1 -1
  66. package/dist/worker/version.js +1 -1
  67. package/package.json +1 -1
  68. package/assets/static/chevron-down-Co1w7ApZ.js +0 -1
  69. package/assets/static/chevron-right-Dqh3vs9Y.js +0 -1
  70. package/dist/worker/tar.d.ts +0 -3
  71. package/dist/worker/tar.js +0 -65
@@ -1 +1 @@
1
- import{I as e,R as t}from"./queries-DZIMMe4i.js";var n=t((t=>{var n=e();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,t.browser=function(e){return{$$typeof:s,_reason:e}},t.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},t.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},t.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},t.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},t.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},t.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},t.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},t.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},t.requestFormReset=function(e){a.d.r(e)},t.unstable_batchedUpdates=function(e,t){return e(t)},t.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},t.useFormStatus=function(){return u.H.useHostTransitionStatus()},t.version=`19.3.1`})),r=t(((e,t)=>{function r(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}r(),t.exports=n()}));export{r as t};
1
+ import{I as e,R as t}from"./queries-BcMmmb36.js";var n=t((t=>{var n=e();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,t.browser=function(e){return{$$typeof:s,_reason:e}},t.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},t.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},t.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},t.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},t.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},t.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},t.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},t.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},t.requestFormReset=function(e){a.d.r(e)},t.unstable_batchedUpdates=function(e,t){return e(t)},t.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},t.useFormStatus=function(){return u.H.useHostTransitionStatus()},t.version=`19.3.1`})),r=t(((e,t)=>{function r(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}r(),t.exports=n()}));export{r as t};
@@ -1 +1 @@
1
- import{B as e,I as t,L as n,T as r}from"./queries-DZIMMe4i.js";import{t as i}from"./react-dom-wK_7mEjs.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-BDn7ydjn.js";import{n as f,t as p}from"./dist-Dl-m8cc2.js";import{i as m,s as h}from"./button-rfwMVz0i.js";import{a as g,i as _,l as v,n as y,r as b,t as x}from"./es2015-DJh4h8NX.js";import{_t as S,at as C,ct as w,ot as T,st as E,tt as D}from"./index-eR1GkdC_.js";import{t as O}from"./dist-B7PR2b0C.js";import{t as k}from"./chevron-down-Co1w7ApZ.js";import{t as A}from"./createLucideIcon-flJrJK2p.js";var j=e(t(),1),M=e(i(),1),N=Object.defineProperty,P=(e,t)=>N(e,`name`,{value:t,configurable:!0});function F(e,[t,n]){return Math.min(n,Math.max(t,e))}P(F,`clamp`);var I=n(),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),ee={ItemAligned:`item-aligned`,Popper:`popper`},z={LTR:`ltr`,RTL:`rtl`},te=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,W]=f(V),[G,K]=c(V,[W,w]),q=w(),[ne,J]=G(V),[re,Y]=G(V);function ie(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:d,name:f,autoComplete:m,disabled:h,required:g,form:_,internal_do_not_use_render:v}=e,y=q(t),[b,x]=j.useState(null),[S,w]=j.useState(null),[T,E]=j.useState(!1),D=p(d),[O,k]=l({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[A,M]=l({prop:o,defaultProp:c,onChange:u,caller:V}),N=j.useRef(null),P=j.useRef(!1),[F,L]=j.useState(null),ee=R(e=>{L({value:e,hasConsumerStoppedPropagation:P.current}),M(e)},`handleUserSelect`),z=j.useRef(A);j.useEffect(()=>{let e=_?b?.ownerDocument.getElementById(_):b?.form;if(e instanceof HTMLFormElement){let t=R(()=>M(z.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[_,b,M]);let te=!b||!!_||!!b.closest(`form`),[B,U]=j.useState(new Set),W=s(),G=Array.from(B).map(e=>e.props.value).join(`;`),K=j.useCallback(e=>{U(t=>new Set(t).add(e))},[]),J=j.useCallback(e=>{U(t=>{let n=new Set(t);return n.delete(e),n})},[]),Y={required:g,trigger:b,onTriggerChange:x,valueNode:S,onValueNodeChange:w,valueNodeHasChildren:T,onValueNodeHasChildrenChange:E,contentId:W,value:A,onValueChange:M,hasConsumerStoppedPropagationRef:P,userSelection:F,onUserSelect:ee,open:O,onOpenChange:k,dir:D,triggerPointerDownPosRef:N,disabled:h,name:f,autoComplete:m,form:_,nativeOptions:B,nativeSelectKey:G,isFormControl:te};return(0,I.jsx)(C,{...y,children:(0,I.jsx)(ne,{scope:t,...Y,children:(0,I.jsx)(H.Provider,{scope:t,children:(0,I.jsx)(re,{scope:t,onNativeOptionAdd:K,onNativeOptionRemove:J,children:He(v)?v(Y):n})})})})}R(ie,`SelectProvider`);var ae=R(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(ie,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(Ve,{__scopeSelect:t}):null]})})},`Select`),oe=`SelectTrigger`,se=j.forwardRef(R(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=q(n),s=J(oe,n),c=s.disabled||r,l=h(t,s.onTriggerChange),d=U(n),f=j.useRef(`touch`),[p,m,g]=Ue(e=>{let t=d().filter(e=>!e.disabled),n=We(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onUserSelect(n.value)}),_=R(e=>{c||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(T,{asChild:!0,...a,children:(0,I.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...i,ref:l,onClick:o(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:o(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:o(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),m(e.key)),t&&e.key===` `||te.includes(e.key)&&(_(),e.preventDefault())})})})},`SelectTrigger`)),ce=`SelectValue`,le=j.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,children:o,placeholder:s=``,...c}=e,l=J(ce,n),{onValueNodeHasChildrenChange:d}=l,f=o!==void 0,p=h(t,l.onValueNodeChange);a(()=>{d(f)},[d,f]);let m=$(l.value);return(0,I.jsx)(u.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,I.jsx)(j.Fragment,{children:m?s:o},m?`placeholder`:`value`)})},`SelectValue`)),ue=j.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[de,fe]=G(`SelectPortal`,{forceMount:void 0}),pe=R(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(de,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(_,{asChild:!0,...r})})},`SelectPortal`),X=`SelectContent`,me=j.forwardRef(R(function(e,t){let n=fe(X,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,o=J(X,e.__scopeSelect),[s,c]=j.useState();return a(()=>{c(new DocumentFragment)},[]),(0,I.jsx)(O,{present:r||o.open,children:({present:e})=>e?(0,I.jsx)(ve,{...i,ref:t}):(0,I.jsx)(he,{...i,fragment:s})})},`SelectContent`)),he=j.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,I.jsx)(ge,{scope:n,children:(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Z=10,[ge,Q]=G(X),_e=m(`SelectContent.RemoveScroll`),ve=j.forwardRef(R(function(e,t){let{__scopeSelect:n}=e,{position:r=ee.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:_,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=J(X,n),[E,D]=j.useState(null),[O,k]=j.useState(null),A=h(t,D),[M,N]=j.useState(null),[P,F]=j.useState(null),L=U(n),[z,te]=j.useState(!1),B=j.useRef(!1),V=j.useRef(!1),H=j.useRef(!1);j.useEffect(()=>{if(E)return x(E)},[E]),b();let W=j.useCallback(e=>{let[t,...n]=L().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[L,O]),G=j.useCallback(()=>W([M,E]),[W,M,E]);j.useEffect(()=>{z&&G()},[z,G]);let{onOpenChange:K,triggerPointerDownPosRef:q}=T;j.useEffect(()=>{if(E){let e={x:0,y:0},t=R(t=>{e={x:Math.abs(Math.round(t.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(q.current?.y??0))}},`handlePointerMove`),n=R(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||K(!1),document.removeEventListener(`pointermove`,t),q.current=null},`handlePointerUp`);return q.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,K,q]),j.useEffect(()=>{let e=R(()=>K(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[K]);let[ne,re]=Ue(e=>{let t=L().filter(e=>!e.disabled),n=We(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),Y=j.useCallback((e,t,n)=>{let r=!V.current;r&&(V.current=!0);let i=!B.current&&!n;T.value!==void 0&&T.value===t||i?(N(e),i&&(B.current=!0)):r&&N(e)},[T.value]),ie=j.useCallback(()=>E?.focus(),[E]),ae=j.useCallback((e,t,n)=>{if(!e)return;let r=!H.current;r&&(H.current=!0);let i=!B.current&&!n;(T.value!==void 0&&T.value===t||i||r)&&F(e)},[T.value]),oe=r===ee.Popper?be:ye,se=oe===be?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:_,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(ge,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:Y,selectedItem:M,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:G,selectedItemText:P,position:r,isPositioned:z,searchRef:ne,children:(0,I.jsx)(y,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(g,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:o(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(v,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(oe,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...se,onPlaced:()=>te(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:o(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>W(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ye=j.forwardRef(R(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,o=J(X,n),s=Q(X,n),[c,l]=j.useState(null),[d,f]=j.useState(null),p=h(t,f),m=U(n),g=j.useRef(!1),_=j.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=j.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==z.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Z,d=F(a,[Z,Math.max(Z,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Z,d=F(a,[Z,Math.max(Z,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=m(),s=window.innerHeight-Z*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),h=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+h,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Z,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+h);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Z}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[m,o.trigger,o.valueNode,c,d,v,y,b,o.dir,r]);a(()=>S(),[S]);let[C,w]=j.useState();a(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]);let T=j.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(xe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:(0,I.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,I.jsx)(u.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),be=j.forwardRef(R(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Z,...a}=e,o=q(n);return(0,I.jsx)(E,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[xe,Se]=G(X,{}),Ce=`SelectViewport`,we=j.forwardRef(R(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Q(Ce,n),s=Se(Ce,n),c=h(t,a.onViewportChange),l=j.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:o(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Z*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})},`SelectViewport`)),[Te,Ee]=G(`SelectGroup`),De=`SelectItem`,[Oe,ke]=G(De),Ae=j.forwardRef(R(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...c}=e,l=J(De,n),f=Q(De,n),p=l.value===r,[m,g]=j.useState(a??``),[_,v]=j.useState(!1),y=d(e=>f.itemRefCallback?.(e,r,i)),b=h(t,y),x=s(),S=j.useRef(`touch`);function C(e){l.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),l.onUserSelect(r),l.onOpenChange(!1)}return R(C,`handleSelect`),(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:x,isSelected:p,onItemTextChange:j.useCallback(e=>{g(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,I.jsx)(u.div,{role:`option`,"aria-labelledby":x,"data-highlighted":_?``:void 0,"aria-selected":p&&_,"data-state":p?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...c,ref:b,onFocus:o(c.onFocus,()=>v(!0)),onBlur:o(c.onBlur,()=>v(!1)),onClick:o(c.onClick,e=>{i||S.current!==`mouse`&&C(e)}),onPointerUp:o(c.onPointerUp,e=>{i||S.current===`mouse`&&C(e)}),onPointerDown:o(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:o(c.onPointerMove,e=>{S.current=e.pointerType,i?f.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:o(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:o(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(f.searchRef?.current===``||e.key!==` `)&&(B.includes(e.key)&&C(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),je=`SelectItemText`,Me=j.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,...o}=e,s=J(je,n),c=Q(je,n),l=ke(je,n),f=Y(je,n),[p,m]=j.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=h(t,m,l.onItemTextChange,g),v=p?.textContent,y=j.useMemo(()=>(0,I.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return a(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?M.createPortal(o.children,s.valueNode):null]})},`SelectItemText`)),Ne=`SelectItemIndicator`,Pe=j.forwardRef(R(function(e,t){let{__scopeSelect:n,...r}=e;return ke(Ne,n).isSelected?(0,I.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Fe=`SelectScrollUpButton`,Ie=j.forwardRef(R(function(e,t){let n=Q(Fe,e.__scopeSelect),r=Se(Fe,e.__scopeSelect),[i,o]=j.useState(!1),s=h(t,r.onScrollButtonChange);return a(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(ze,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Le=`SelectScrollDownButton`,Re=j.forwardRef(R(function(e,t){let n=Q(Le,e.__scopeSelect),r=Se(Le,e.__scopeSelect),[i,o]=j.useState(!1),s=h(t,r.onScrollButtonChange);return a(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(ze,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),ze=j.forwardRef(R(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Q(`SelectScrollButton`,n),c=j.useRef(null),l=U(n),d=j.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return j.useEffect(()=>()=>d(),[d]),a(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,I.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:o(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:o(i.onPointerMove,()=>{s.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:o(i.onPointerLeave,()=>{d()})})},`SelectScrollButtonImpl`)),Be=`SelectBubbleInput`,Ve=j.forwardRef(R(function({__scopeSelect:e,...t},n){let r=J(Be,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:d,userSelection:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,g=j.useRef(null),_=h(n,g),v=i??``,y=j.useRef(v),b=j.useRef(f),x=j.useRef(!1),C=Array.from(p).some(e=>(e.props.value??``)===``);return j.useEffect(()=>{let e=g.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f!==null&&f!==b.current;b.current=f;let i=y.current!==v;y.current=v;let a=r&&i;if(r&&!i&&f.value!==v&&!f.hasConsumerStoppedPropagation&&n){x.current=!0;try{n.call(e,f.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{x.current=!1,n.call(e,v)}return}let o=a&&!f.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,v),e.dispatchEvent(t)}},[v,f]),(0,I.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:d,onChange:e=>{x.current||a(e.target.value)},...t,style:{...S,...t.style},ref:_,defaultValue:v,children:[$(i)&&!C?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function He(e){return typeof e==`function`}R(He,`isFunction`);function $(e){return e===``||e===void 0}R($,`shouldShowPlaceholder`);function Ue(e){let t=d(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}R(a,`updateSearch`),a(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}R(Ue,`useTypeaheadSearch`);function We(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ge(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}R(We,`findNextItem`);function Ge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}R(Ge,`wrapArray`);var Ke={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Ke.node;var qe=A(Ke);function Je({...e}){return(0,I.jsx)(ae,{"data-slot":`select`,...e})}function Ye({...e}){return(0,I.jsx)(le,{"data-slot":`select-value`,...e})}function Xe({className:e,size:t=`default`,children:n,...i}){return(0,I.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:r(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...i,children:[n,(0,I.jsx)(ue,{asChild:!0,children:(0,I.jsx)(k,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Ze({className:e,children:t,position:n=`item-aligned`,align:i=`center`,...a}){return(0,I.jsx)(pe,{children:(0,I.jsxs)(me,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:r(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:i,...a,children:[(0,I.jsx)($e,{}),(0,I.jsx)(we,{"data-position":n,className:r(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,I.jsx)(et,{})]})})}function Qe({className:e,children:t,...n}){return(0,I.jsxs)(Ae,{"data-slot":`select-item`,className:r(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,I.jsx)(Pe,{children:(0,I.jsx)(D,{className:`pointer-events-none`})})}),(0,I.jsx)(Me,{children:t})]})}function $e({className:e,...t}){return(0,I.jsx)(Ie,{"data-slot":`select-scroll-up-button`,className:r(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,I.jsx)(qe,{})})}function et({className:e,...t}){return(0,I.jsx)(Re,{"data-slot":`select-scroll-down-button`,className:r(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,I.jsx)(k,{})})}export{Ye as a,Xe as i,Ze as n,Qe as r,Je as t};
1
+ import{B as e,I as t,L as n,T as r}from"./queries-BcMmmb36.js";import{t as i}from"./react-dom-5dgiSOdd.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-CmbuesVk.js";import{n as f,t as p}from"./dist-vgyaCpaL.js";import{i as m,s as h}from"./button-BKhMn8jX.js";import{a as g,i as _,l as v,n as y,r as b,t as x}from"./es2015-DqY4UvQc.js";import{_t as S,at as C,ct as w,ot as T,st as E,tt as D}from"./index-DBHFdsYB.js";import{t as O}from"./dist-BFPyD74_.js";import{t as k}from"./chevron-down-BWoQwA6m.js";import{t as A}from"./createLucideIcon-XZ28znwT.js";var j=e(t(),1),M=e(i(),1),N=Object.defineProperty,P=(e,t)=>N(e,`name`,{value:t,configurable:!0});function F(e,[t,n]){return Math.min(n,Math.max(t,e))}P(F,`clamp`);var I=n(),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),ee={ItemAligned:`item-aligned`,Popper:`popper`},z={LTR:`ltr`,RTL:`rtl`},te=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,W]=f(V),[G,K]=c(V,[W,w]),q=w(),[ne,J]=G(V),[re,Y]=G(V);function ie(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:d,name:f,autoComplete:m,disabled:h,required:g,form:_,internal_do_not_use_render:v}=e,y=q(t),[b,x]=j.useState(null),[S,w]=j.useState(null),[T,E]=j.useState(!1),D=p(d),[O,k]=l({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[A,M]=l({prop:o,defaultProp:c,onChange:u,caller:V}),N=j.useRef(null),P=j.useRef(!1),[F,L]=j.useState(null),ee=R(e=>{L({value:e,hasConsumerStoppedPropagation:P.current}),M(e)},`handleUserSelect`),z=j.useRef(A);j.useEffect(()=>{let e=_?b?.ownerDocument.getElementById(_):b?.form;if(e instanceof HTMLFormElement){let t=R(()=>M(z.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[_,b,M]);let te=!b||!!_||!!b.closest(`form`),[B,U]=j.useState(new Set),W=s(),G=Array.from(B).map(e=>e.props.value).join(`;`),K=j.useCallback(e=>{U(t=>new Set(t).add(e))},[]),J=j.useCallback(e=>{U(t=>{let n=new Set(t);return n.delete(e),n})},[]),Y={required:g,trigger:b,onTriggerChange:x,valueNode:S,onValueNodeChange:w,valueNodeHasChildren:T,onValueNodeHasChildrenChange:E,contentId:W,value:A,onValueChange:M,hasConsumerStoppedPropagationRef:P,userSelection:F,onUserSelect:ee,open:O,onOpenChange:k,dir:D,triggerPointerDownPosRef:N,disabled:h,name:f,autoComplete:m,form:_,nativeOptions:B,nativeSelectKey:G,isFormControl:te};return(0,I.jsx)(C,{...y,children:(0,I.jsx)(ne,{scope:t,...Y,children:(0,I.jsx)(H.Provider,{scope:t,children:(0,I.jsx)(re,{scope:t,onNativeOptionAdd:K,onNativeOptionRemove:J,children:He(v)?v(Y):n})})})})}R(ie,`SelectProvider`);var ae=R(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(ie,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(Ve,{__scopeSelect:t}):null]})})},`Select`),oe=`SelectTrigger`,se=j.forwardRef(R(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=q(n),s=J(oe,n),c=s.disabled||r,l=h(t,s.onTriggerChange),d=U(n),f=j.useRef(`touch`),[p,m,g]=Ue(e=>{let t=d().filter(e=>!e.disabled),n=We(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onUserSelect(n.value)}),_=R(e=>{c||(s.onOpenChange(!0),g()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(T,{asChild:!0,...a,children:(0,I.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...i,ref:l,onClick:o(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:o(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:o(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),m(e.key)),t&&e.key===` `||te.includes(e.key)&&(_(),e.preventDefault())})})})},`SelectTrigger`)),ce=`SelectValue`,le=j.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,children:o,placeholder:s=``,...c}=e,l=J(ce,n),{onValueNodeHasChildrenChange:d}=l,f=o!==void 0,p=h(t,l.onValueNodeChange);a(()=>{d(f)},[d,f]);let m=$(l.value);return(0,I.jsx)(u.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,I.jsx)(j.Fragment,{children:m?s:o},m?`placeholder`:`value`)})},`SelectValue`)),ue=j.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[de,fe]=G(`SelectPortal`,{forceMount:void 0}),pe=R(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(de,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(_,{asChild:!0,...r})})},`SelectPortal`),X=`SelectContent`,me=j.forwardRef(R(function(e,t){let n=fe(X,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,o=J(X,e.__scopeSelect),[s,c]=j.useState();return a(()=>{c(new DocumentFragment)},[]),(0,I.jsx)(O,{present:r||o.open,children:({present:e})=>e?(0,I.jsx)(ve,{...i,ref:t}):(0,I.jsx)(he,{...i,fragment:s})})},`SelectContent`)),he=j.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,I.jsx)(ge,{scope:n,children:(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Z=10,[ge,Q]=G(X),_e=m(`SelectContent.RemoveScroll`),ve=j.forwardRef(R(function(e,t){let{__scopeSelect:n}=e,{position:r=ee.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:_,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=J(X,n),[E,D]=j.useState(null),[O,k]=j.useState(null),A=h(t,D),[M,N]=j.useState(null),[P,F]=j.useState(null),L=U(n),[z,te]=j.useState(!1),B=j.useRef(!1),V=j.useRef(!1),H=j.useRef(!1);j.useEffect(()=>{if(E)return x(E)},[E]),b();let W=j.useCallback(e=>{let[t,...n]=L().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[L,O]),G=j.useCallback(()=>W([M,E]),[W,M,E]);j.useEffect(()=>{z&&G()},[z,G]);let{onOpenChange:K,triggerPointerDownPosRef:q}=T;j.useEffect(()=>{if(E){let e={x:0,y:0},t=R(t=>{e={x:Math.abs(Math.round(t.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(q.current?.y??0))}},`handlePointerMove`),n=R(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||K(!1),document.removeEventListener(`pointermove`,t),q.current=null},`handlePointerUp`);return q.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,K,q]),j.useEffect(()=>{let e=R(()=>K(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[K]);let[ne,re]=Ue(e=>{let t=L().filter(e=>!e.disabled),n=We(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),Y=j.useCallback((e,t,n)=>{let r=!V.current;r&&(V.current=!0);let i=!B.current&&!n;T.value!==void 0&&T.value===t||i?(N(e),i&&(B.current=!0)):r&&N(e)},[T.value]),ie=j.useCallback(()=>E?.focus(),[E]),ae=j.useCallback((e,t,n)=>{if(!e)return;let r=!H.current;r&&(H.current=!0);let i=!B.current&&!n;(T.value!==void 0&&T.value===t||i||r)&&F(e)},[T.value]),oe=r===ee.Popper?be:ye,se=oe===be?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:_,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(ge,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:Y,selectedItem:M,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:G,selectedItemText:P,position:r,isPositioned:z,searchRef:ne,children:(0,I.jsx)(y,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(g,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:o(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(v,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(oe,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...se,onPlaced:()=>te(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:o(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>W(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ye=j.forwardRef(R(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,o=J(X,n),s=Q(X,n),[c,l]=j.useState(null),[d,f]=j.useState(null),p=h(t,f),m=U(n),g=j.useRef(!1),_=j.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=j.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==z.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Z,d=F(a,[Z,Math.max(Z,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Z,d=F(a,[Z,Math.max(Z,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=m(),s=window.innerHeight-Z*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),h=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+h,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Z,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+h);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Z}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[m,o.trigger,o.valueNode,c,d,v,y,b,o.dir,r]);a(()=>S(),[S]);let[C,w]=j.useState();a(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]);let T=j.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(xe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:(0,I.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,I.jsx)(u.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),be=j.forwardRef(R(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Z,...a}=e,o=q(n);return(0,I.jsx)(E,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[xe,Se]=G(X,{}),Ce=`SelectViewport`,we=j.forwardRef(R(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Q(Ce,n),s=Se(Ce,n),c=h(t,a.onViewportChange),l=j.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:o(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Z*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})},`SelectViewport`)),[Te,Ee]=G(`SelectGroup`),De=`SelectItem`,[Oe,ke]=G(De),Ae=j.forwardRef(R(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...c}=e,l=J(De,n),f=Q(De,n),p=l.value===r,[m,g]=j.useState(a??``),[_,v]=j.useState(!1),y=d(e=>f.itemRefCallback?.(e,r,i)),b=h(t,y),x=s(),S=j.useRef(`touch`);function C(e){l.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),l.onUserSelect(r),l.onOpenChange(!1)}return R(C,`handleSelect`),(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:x,isSelected:p,onItemTextChange:j.useCallback(e=>{g(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,I.jsx)(u.div,{role:`option`,"aria-labelledby":x,"data-highlighted":_?``:void 0,"aria-selected":p&&_,"data-state":p?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...c,ref:b,onFocus:o(c.onFocus,()=>v(!0)),onBlur:o(c.onBlur,()=>v(!1)),onClick:o(c.onClick,e=>{i||S.current!==`mouse`&&C(e)}),onPointerUp:o(c.onPointerUp,e=>{i||S.current===`mouse`&&C(e)}),onPointerDown:o(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:o(c.onPointerMove,e=>{S.current=e.pointerType,i?f.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:o(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:o(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(f.searchRef?.current===``||e.key!==` `)&&(B.includes(e.key)&&C(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),je=`SelectItemText`,Me=j.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,...o}=e,s=J(je,n),c=Q(je,n),l=ke(je,n),f=Y(je,n),[p,m]=j.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=h(t,m,l.onItemTextChange,g),v=p?.textContent,y=j.useMemo(()=>(0,I.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return a(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?M.createPortal(o.children,s.valueNode):null]})},`SelectItemText`)),Ne=`SelectItemIndicator`,Pe=j.forwardRef(R(function(e,t){let{__scopeSelect:n,...r}=e;return ke(Ne,n).isSelected?(0,I.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Fe=`SelectScrollUpButton`,Ie=j.forwardRef(R(function(e,t){let n=Q(Fe,e.__scopeSelect),r=Se(Fe,e.__scopeSelect),[i,o]=j.useState(!1),s=h(t,r.onScrollButtonChange);return a(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(ze,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Le=`SelectScrollDownButton`,Re=j.forwardRef(R(function(e,t){let n=Q(Le,e.__scopeSelect),r=Se(Le,e.__scopeSelect),[i,o]=j.useState(!1),s=h(t,r.onScrollButtonChange);return a(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(ze,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),ze=j.forwardRef(R(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Q(`SelectScrollButton`,n),c=j.useRef(null),l=U(n),d=j.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return j.useEffect(()=>()=>d(),[d]),a(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,I.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:o(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:o(i.onPointerMove,()=>{s.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:o(i.onPointerLeave,()=>{d()})})},`SelectScrollButtonImpl`)),Be=`SelectBubbleInput`,Ve=j.forwardRef(R(function({__scopeSelect:e,...t},n){let r=J(Be,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:d,userSelection:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,g=j.useRef(null),_=h(n,g),v=i??``,y=j.useRef(v),b=j.useRef(f),x=j.useRef(!1),C=Array.from(p).some(e=>(e.props.value??``)===``);return j.useEffect(()=>{let e=g.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f!==null&&f!==b.current;b.current=f;let i=y.current!==v;y.current=v;let a=r&&i;if(r&&!i&&f.value!==v&&!f.hasConsumerStoppedPropagation&&n){x.current=!0;try{n.call(e,f.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{x.current=!1,n.call(e,v)}return}let o=a&&!f.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,v),e.dispatchEvent(t)}},[v,f]),(0,I.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:d,onChange:e=>{x.current||a(e.target.value)},...t,style:{...S,...t.style},ref:_,defaultValue:v,children:[$(i)&&!C?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`SelectBubbleInput`));function He(e){return typeof e==`function`}R(He,`isFunction`);function $(e){return e===``||e===void 0}R($,`shouldShowPlaceholder`);function Ue(e){let t=d(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}R(a,`updateSearch`),a(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}R(Ue,`useTypeaheadSearch`);function We(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ge(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}R(We,`findNextItem`);function Ge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}R(Ge,`wrapArray`);var Ke={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Ke.node;var qe=A(Ke);function Je({...e}){return(0,I.jsx)(ae,{"data-slot":`select`,...e})}function Ye({...e}){return(0,I.jsx)(le,{"data-slot":`select-value`,...e})}function Xe({className:e,size:t=`default`,children:n,...i}){return(0,I.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:r(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...i,children:[n,(0,I.jsx)(ue,{asChild:!0,children:(0,I.jsx)(k,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Ze({className:e,children:t,position:n=`item-aligned`,align:i=`center`,...a}){return(0,I.jsx)(pe,{children:(0,I.jsxs)(me,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:r(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:i,...a,children:[(0,I.jsx)($e,{}),(0,I.jsx)(we,{"data-position":n,className:r(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,I.jsx)(et,{})]})})}function Qe({className:e,children:t,...n}){return(0,I.jsxs)(Ae,{"data-slot":`select-item`,className:r(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,I.jsx)(Pe,{children:(0,I.jsx)(D,{className:`pointer-events-none`})})}),(0,I.jsx)(Me,{children:t})]})}function $e({className:e,...t}){return(0,I.jsx)(Ie,{"data-slot":`select-scroll-up-button`,className:r(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,I.jsx)(qe,{})})}function et({className:e,...t}){return(0,I.jsx)(Re,{"data-slot":`select-scroll-down-button`,className:r(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,I.jsx)(k,{})})}export{Ye as a,Xe as i,Ze as n,Qe as r,Je as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./arrow-up-D3gxUKLo.js";import{L as n,T as r,w as i}from"./queries-DZIMMe4i.js";var a=n();function o(e,t){let{t:n}=i();return e.title?.trim()||n(t)}function s({pct:n,goodWhenDown:o=!0,className:s}){let{t:c}=i(),l=n>0,u=l!==o,d=l?t:e;return(0,a.jsxs)(`span`,{className:r(`inline-flex items-center gap-0.5 whitespace-nowrap text-sm font-medium tabular-nums`,n===0?`text-muted-foreground`:u?`text-positive`:`text-critical`,s),children:[n!==0&&(0,a.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),(0,a.jsx)(`span`,{className:`sr-only`,children:l?c(`delta.up`):n<0?c(`delta.down`):``}),Math.abs(Math.round(n)),`%`]})}export{o as n,s as t};
1
+ import{n as e,t}from"./arrow-up-CRgLRKET.js";import{L as n,T as r,w as i}from"./queries-BcMmmb36.js";var a=n();function o(e,t){let{t:n}=i();return e.title?.trim()||n(t)}function s({pct:n,goodWhenDown:o=!0,className:s}){let{t:c}=i(),l=n>0,u=l!==o,d=l?t:e;return(0,a.jsxs)(`span`,{className:r(`inline-flex items-center gap-0.5 whitespace-nowrap text-sm font-medium tabular-nums`,n===0?`text-muted-foreground`:u?`text-positive`:`text-critical`,s),children:[n!==0&&(0,a.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),(0,a.jsx)(`span`,{className:`sr-only`,children:l?c(`delta.up`):n<0?c(`delta.down`):``}),Math.abs(Math.round(n)),`%`]})}export{o as n,s as t};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";var t={name:`triangle-exclamation-point`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`,`triangle-alert`]};t.node;var n=e(t);export{n as t};
1
+ import{t as e}from"./createLucideIcon-XZ28znwT.js";var t={name:`triangle-exclamation-point`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`,`triangle-alert`]};t.node;var n=e(t);export{n as t};
@@ -1 +1 @@
1
- import{A as e,B as t,D as n,F as r,I as i,M as a,N as o,O as s,j as c,k as l}from"./queries-DZIMMe4i.js";var u=class extends o{#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),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(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??n();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){s.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)})})}},d=t(i(),1);function f(t,n){let i=r(n),[o]=d.useState(()=>new u(i,t));d.useEffect(()=>{o.setOptions(t)},[o,t]);let c=d.useSyncExternalStore(d.useCallback(e=>o.subscribe(s.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),l=d.useCallback((...t)=>{o.mutate(t[0],t[1]).catch(e)},[o]);if(c.error&&a(o.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:l,mutateAsync:c.mutate}}export{f as t};
1
+ import{A as e,B as t,D as n,F as r,I as i,M as a,N as o,O as s,j as c,k as l}from"./queries-BcMmmb36.js";var u=class extends o{#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),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(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??n();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){s.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)})})}},d=t(i(),1);function f(t,n){let i=r(n),[o]=d.useState(()=>new u(i,t));d.useEffect(()=>{o.setOptions(t)},[o,t]);let c=d.useSyncExternalStore(d.useCallback(e=>o.subscribe(s.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),l=d.useCallback((...t)=>{o.mutate(t[0],t[1]).catch(e)},[o]);if(c.error&&a(o.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:l,mutateAsync:c.mutate}}export{f as t};
@@ -1,7 +1,7 @@
1
1
  import type { FileMap } from "../../engine/load.js";
2
2
  /**
3
3
  * Bank statement PDFs (plan 004): imports/statements/<account-id>/<YYYY-MM>.pdf, YYYY-MM = the month of the close date.
4
- * The Worker only knows their paths (from the tarball, contents not read) and streams one to the signed-in dashboard;
4
+ * The Worker only knows their paths (from the file tree, contents never downloaded) and streams one to the signed-in dashboard;
5
5
  * it never parses them. Reading them is the CLI's job, on the user's computer.
6
6
  */
7
7
  export declare const STATEMENTS_DIR = "imports/statements";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Bank statement PDFs (plan 004): imports/statements/<account-id>/<YYYY-MM>.pdf, YYYY-MM = the month of the close date.
3
- * The Worker only knows their paths (from the tarball, contents not read) and streams one to the signed-in dashboard;
3
+ * The Worker only knows their paths (from the file tree, contents never downloaded) and streams one to the signed-in dashboard;
4
4
  * it never parses them. Reading them is the CLI's job, on the user's computer.
5
5
  */
6
6
  export const STATEMENTS_DIR = "imports/statements";
@@ -109,14 +109,21 @@ export async function api(req, env, source) {
109
109
  const q = url.searchParams;
110
110
  const path = url.pathname.slice(5);
111
111
  const src = source ?? sourceFor(env);
112
- const s = await snapshot(env, src);
112
+ let s;
113
+ try {
114
+ s = await snapshot(env, src);
115
+ }
116
+ catch (e) {
117
+ // Loading the data repo failed (GitHub down, app not installed…): say why, as JSON, instead of a bare 500.
118
+ return json({ error: `could not load the data repo (${src.label}): ${e.message}` }, 502);
119
+ }
113
120
  const L = s.ledger;
114
121
  const asOf = q.get("date") ?? todayIn(env.TIMEZONE || "Asia/Ho_Chi_Minh");
115
- const dash = dashboardOf(s.files, login);
116
- const pool = poolOf(L, dash?.prefs?.pool, asOf);
117
- /** "pool" in an account filter means every account in the pool. */
118
- const accountParam = (v) => (!v ? undefined : v === "pool" ? pool.accounts : v.includes(",") ? v.split(",") : v);
119
122
  try {
123
+ const dash = dashboardOf(s.files, login);
124
+ const pool = poolOf(L, dash?.prefs?.pool, asOf);
125
+ /** "pool" in an account filter means every account in the pool. */
126
+ const accountParam = (v) => (!v ? undefined : v === "pool" ? pool.accounts : v.includes(",") ? v.split(",") : v);
120
127
  if (path.startsWith("m/")) {
121
128
  const r = await moduleApi(path.slice(2), { req, env, src, snap: s, login, asOf, q });
122
129
  if (r && "response" in r)
@@ -12,7 +12,23 @@ export interface GitHubAppConfig {
12
12
  }
13
13
  export declare function installationToken(c: GitHubAppConfig): Promise<string>;
14
14
  export declare function headSha(c: GitHubAppConfig): Promise<string>;
15
- /** Every file under data/ and imports/*.mapping.yaml at a commit, from one tarball; statement PDFs by path only (""). */
15
+ /** Files the Worker reads as text: everything under data/ and imports/*.mapping.yaml. */
16
+ export declare const isDataFile: (p: string) => boolean;
17
+ interface TreeEntry {
18
+ path: string;
19
+ type: string;
20
+ sha: string;
21
+ }
22
+ /** Which tree entries to read as text, and which to list by path only (statement PDFs, never downloaded). */
23
+ export declare function pickFiles(tree: TreeEntry[]): {
24
+ text: TreeEntry[];
25
+ pathOnly: string[];
26
+ };
27
+ /**
28
+ * Every file under data/ and imports/*.mapping.yaml at a commit; statement PDFs by path only ("").
29
+ * One tree listing plus one GraphQL call per 100 files: no tarball, so binary files in the repo
30
+ * (statement PDFs, raw exports) cost the Worker nothing (a tarball of them ran past the Free plan's CPU limit).
31
+ */
16
32
  export declare function filesAt(c: GitHubAppConfig, sha: string): Promise<Record<string, string>>;
17
33
  /** One file's bytes at a commit, streamed (null when it isn't there). */
18
34
  export declare function blobAt(c: GitHubAppConfig, sha: string, path: string): Promise<Response | null>;
@@ -29,3 +45,4 @@ export declare function githubAuthorizeUrl(clientId: string, redirectUri: string
29
45
  export declare function githubLogin(clientId: string, clientSecret: string, code: string, verifier: string, redirectUri: string): Promise<string>;
30
46
  export declare function s256(verifier: string): Promise<string>;
31
47
  export declare function randomToken(bytes?: number): string;
48
+ export {};
@@ -76,14 +76,61 @@ export async function headSha(c) {
76
76
  throw new Error(`GitHub head of ${c.branch}: ${res.status}`);
77
77
  return (await res.text()).trim();
78
78
  }
79
- /** Every file under data/ and imports/*.mapping.yaml at a commit, from one tarball; statement PDFs by path only (""). */
79
+ /** Files the Worker reads as text: everything under data/ and imports/*.mapping.yaml. */
80
+ export const isDataFile = (p) => p.startsWith("data/") || /^imports\/[^/]+\.mapping\.yaml$/.test(p);
81
+ /** Which tree entries to read as text, and which to list by path only (statement PDFs, never downloaded). */
82
+ export function pickFiles(tree) {
83
+ const text = [];
84
+ const pathOnly = [];
85
+ for (const e of tree) {
86
+ if (e.type !== "blob")
87
+ continue;
88
+ if (isDataFile(e.path))
89
+ text.push(e);
90
+ else if (STATEMENT_PDF_RE.test(e.path))
91
+ pathOnly.push(e.path);
92
+ }
93
+ return { text, pathOnly };
94
+ }
95
+ const GRAPHQL_BATCH = 100;
96
+ /**
97
+ * Every file under data/ and imports/*.mapping.yaml at a commit; statement PDFs by path only ("").
98
+ * One tree listing plus one GraphQL call per 100 files: no tarball, so binary files in the repo
99
+ * (statement PDFs, raw exports) cost the Worker nothing (a tarball of them ran past the Free plan's CPU limit).
100
+ */
80
101
  export async function filesAt(c, sha) {
81
102
  const token = await installationToken(c);
82
- const res = await gh(`/repos/${c.repo}/tarball/${sha}`, token);
83
- if (!res.ok || !res.body)
84
- throw new Error(`GitHub tarball: ${res.status}`);
85
- const { untar } = await import("./tar.js");
86
- return untar(res.body.pipeThrough(new DecompressionStream("gzip")), (p) => p.startsWith("data/") || /^imports\/[^/]+\.mapping\.yaml$/.test(p), (p) => STATEMENT_PDF_RE.test(p));
103
+ const t = await ok(await gh(`/repos/${c.repo}/git/trees/${sha}?recursive=1`, token), "list the data repo's files");
104
+ if (t.truncated)
105
+ throw new Error("GitHub file list: the data repo has too many files for one listing (over 100,000)");
106
+ const { text, pathOnly } = pickFiles(t.tree);
107
+ const out = {};
108
+ for (const p of pathOnly)
109
+ out[p] = "";
110
+ const [owner, name] = c.repo.split("/");
111
+ for (let i = 0; i < text.length; i += GRAPHQL_BATCH) {
112
+ const batch = text.slice(i, i + GRAPHQL_BATCH);
113
+ const fields = batch.map((e, j) => `f${j}: object(oid: ${JSON.stringify(e.sha)}) { ... on Blob { text isTruncated } }`).join("\n");
114
+ const res = await gh(`/graphql`, token, {
115
+ method: "POST",
116
+ body: JSON.stringify({ query: `query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { ${fields} } }`, variables: { owner, name } }),
117
+ });
118
+ const j = await ok(res, "read the data files");
119
+ if (j.errors?.length || !j.data)
120
+ throw new Error(`GitHub read the data files: ${j.errors?.map((e) => e.message).join("; ") ?? "no data"}`);
121
+ for (const [k, e] of batch.entries()) {
122
+ const b = j.data.repository[`f${k}`];
123
+ // Too big for GraphQL's text field: fetch that one file raw.
124
+ out[e.path] = b && b.text !== null && !b.isTruncated ? b.text : await blobText(c.repo, e, token);
125
+ }
126
+ }
127
+ return out;
128
+ }
129
+ async function blobText(repo, e, token) {
130
+ const res = await gh(`/repos/${repo}/git/blobs/${e.sha}`, token, { headers: { Accept: "application/vnd.github.raw+json" } });
131
+ if (!res.ok)
132
+ throw new Error(`GitHub file ${e.path}: ${res.status}`);
133
+ return res.text();
87
134
  }
88
135
  /** One file's bytes at a commit, streamed (null when it isn't there). */
89
136
  export async function blobAt(c, sha, path) {
@@ -37,7 +37,7 @@ export function sourceFor(env) {
37
37
  return env.DEV_DATA_URL ? devSource(env) : githubSource(env);
38
38
  }
39
39
  // Parsed ledgers live in the isolate's memory (keyed by commit); raw files also in KV, so a cold isolate
40
- // needs no GitHub tarball for a commit it has seen. Both are safe to drop: GitHub is the only store.
40
+ // needs no GitHub reads for a commit it has seen. Both are safe to drop: GitHub is the only store.
41
41
  const memory = new Map();
42
42
  const KV_PREFIX = "ownledger:files2:"; // 2: with statement PDF paths (plan 004)
43
43
  export async function snapshot(env, src, sha) {
@@ -1 +1 @@
1
- export declare const VERSION = "2.1.0";
1
+ export declare const VERSION = "2.1.1";
@@ -1,2 +1,2 @@
1
1
  // generated by scripts/version.mjs
2
- export const VERSION = "2.1.0";
2
+ export const VERSION = "2.1.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ownledger",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Personal finance ledger used through AI chat (MCP). Your data in your own private GitHub repo, served by your own Cloudflare Worker.",
5
5
  "license": "MIT",
6
6
  "author": "phucbm",
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";var t={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};t.node;var n=e(t);export{n as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";var t={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};t.node;var n=e(t);export{n as t};
@@ -1,3 +0,0 @@
1
- /** Minimal streaming tar reader (ustar + pax path headers), enough for GitHub's tarballs. */
2
- /** `keep`: files whose text is returned. `pathOnly`: files returned with "" (their bytes are skipped, never decoded). */
3
- export declare function untar(stream: ReadableStream<Uint8Array>, keep: (path: string) => boolean, pathOnly?: (path: string) => boolean): Promise<Record<string, string>>;
@@ -1,65 +0,0 @@
1
- /** Minimal streaming tar reader (ustar + pax path headers), enough for GitHub's tarballs. */
2
- /** `keep`: files whose text is returned. `pathOnly`: files returned with "" (their bytes are skipped, never decoded). */
3
- export async function untar(stream, keep, pathOnly) {
4
- const out = {};
5
- const reader = stream.getReader();
6
- let buf = new Uint8Array(0);
7
- let done = false;
8
- const need = async (n) => {
9
- while (buf.length < n && !done) {
10
- const r = await reader.read();
11
- if (r.done)
12
- done = true;
13
- else {
14
- const nb = new Uint8Array(buf.length + r.value.length);
15
- nb.set(buf);
16
- nb.set(r.value, buf.length);
17
- buf = nb;
18
- }
19
- }
20
- return buf.length >= n;
21
- };
22
- const take = (n) => {
23
- const v = buf.subarray(0, n);
24
- buf = buf.subarray(n);
25
- return v;
26
- };
27
- const dec = new TextDecoder();
28
- const str = (b) => {
29
- const z = b.indexOf(0);
30
- return dec.decode(z >= 0 ? b.subarray(0, z) : b);
31
- };
32
- let paxPath = null;
33
- for (;;) {
34
- if (!(await need(512)))
35
- break;
36
- const h = take(512);
37
- if (h.every((x) => x === 0))
38
- break;
39
- const name = str(h.subarray(0, 100));
40
- const size = parseInt(str(h.subarray(124, 136)).trim() || "0", 8);
41
- const type = String.fromCharCode(h[156]);
42
- const prefix = str(h.subarray(345, 500));
43
- const padded = Math.ceil(size / 512) * 512;
44
- await need(padded);
45
- const body = take(padded).slice(0, size);
46
- if (type === "x") {
47
- const m = /\d+ path=([^\n]*)\n/.exec(dec.decode(body));
48
- paxPath = m ? m[1] : null;
49
- continue;
50
- }
51
- if (type === "g")
52
- continue;
53
- const full = paxPath ?? (prefix ? `${prefix}/${name}` : name);
54
- paxPath = null;
55
- if (type !== "0" && type !== "\0")
56
- continue;
57
- const rel = full.slice(full.indexOf("/") + 1); // strip "<repo>-<sha>/"
58
- if (keep(rel))
59
- out[rel] = dec.decode(body);
60
- else if (pathOnly?.(rel))
61
- out[rel] = "";
62
- }
63
- reader.cancel().catch(() => undefined);
64
- return out;
65
- }