@hienlh/ppm 0.7.8 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/CONTRIBUTING.md +46 -0
- package/LICENSE +21 -0
- package/README.md +34 -1
- package/bun.lock +1 -0
- package/dist/web/assets/ai-settings-section-BxCMGg-I.js +1 -0
- package/dist/web/assets/chat-tab-R_8ZfOG8.js +7 -0
- package/dist/web/assets/{code-editor-1FNaZKfA.js → code-editor-BbhIHbts.js} +1 -1
- package/dist/web/assets/{database-viewer-Hso-EwQH.js → database-viewer-BJYmlnr2.js} +1 -1
- package/dist/web/assets/{diff-viewer-BG2UNjTZ.js → diff-viewer-CS-wesGq.js} +1 -1
- package/dist/web/assets/{git-graph-DK_yDfWe.js → git-graph-B9eaNltz.js} +1 -1
- package/dist/web/assets/index-qElHXk-7.js +28 -0
- package/dist/web/assets/index-sMxUHxFZ.css +2 -0
- package/dist/web/assets/input-CVIzrYsH.js +41 -0
- package/dist/web/assets/keybindings-store-DrBQMVKg.js +1 -0
- package/dist/web/assets/{markdown-renderer-Xe_wjdJH.js → markdown-renderer-DpIu7iOT.js} +1 -1
- package/dist/web/assets/{postgres-viewer-CguN1z3q.js → postgres-viewer-B5-tRXE2.js} +1 -1
- package/dist/web/assets/settings-tab-3-ewawy0.js +1 -0
- package/dist/web/assets/{sqlite-viewer-VrZiiegZ.js → sqlite-viewer-CfIer2x_.js} +1 -1
- package/dist/web/assets/{terminal-tab-CabMjIRO.js → terminal-tab-qJxp0iOK.js} +2 -2
- package/dist/web/index.html +4 -4
- package/dist/web/sw.js +1 -1
- package/docs/codebase-summary.md +16 -5
- package/docs/system-architecture.md +20 -2
- package/package.json +4 -1
- package/src/lib/account-crypto.ts +53 -0
- package/src/providers/claude-agent-sdk.ts +77 -3
- package/src/server/index.ts +8 -0
- package/src/server/routes/accounts.ts +165 -0
- package/src/server/routes/chat.ts +2 -0
- package/src/services/account-selector.service.ts +109 -0
- package/src/services/account.service.ts +411 -0
- package/src/services/claude-usage.service.ts +186 -124
- package/src/services/db.service.ts +117 -3
- package/src/types/chat.ts +2 -0
- package/src/web/app.tsx +0 -4
- package/src/web/components/chat/chat-history-bar.tsx +3 -0
- package/src/web/components/chat/usage-badge.tsx +86 -12
- package/src/web/components/settings/accounts-settings-section.tsx +358 -0
- package/src/web/components/settings/settings-tab.tsx +11 -0
- package/src/web/components/ui/badge.tsx +36 -0
- package/src/web/components/ui/switch.tsx +27 -0
- package/src/web/hooks/use-usage.ts +1 -1
- package/src/web/lib/api-settings.ts +65 -0
- package/dist/web/assets/ai-settings-section-ByRvOONz.js +0 -1
- package/dist/web/assets/chat-tab-DLfy6CBX.js +0 -7
- package/dist/web/assets/index-4pPCbWJp.css +0 -2
- package/dist/web/assets/index-DaQYRomz.js +0 -29
- package/dist/web/assets/input-P_K5CUiy.js +0 -41
- package/dist/web/assets/keybindings-store-xe6f5O18.js +0 -1
- package/dist/web/assets/settings-tab-CHONXRsW.js +0 -1
- package/src/web/hooks/use-health-check.ts +0 -95
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./react-CYzKIDNi.js";import{n as r,t as i}from"./jsx-runtime-wQxeESYQ.js";import{n as a}from"./utils-DC-bdPS3.js";var o=t((e=>{var t=n();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`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.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 s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.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))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(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})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(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})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(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})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(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})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.4`})),s=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=o()})),c=r(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),l=e(n(),1);function u(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function d(...e){return t=>{let n=!1,r=e.map(e=>{let r=u(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():u(e[t],null)}}}}function f(...e){return l.useCallback(d(...e),e)}var p=i();function m(e){let t=g(e),n=l.forwardRef((e,n)=>{let{children:r,...i}=e,a=l.Children.toArray(r),o=a.find(y);if(o){let e=o.props.children,r=a.map(t=>t===o?l.Children.count(e)>1?l.Children.only(null):l.isValidElement(e)?e.props.children:null:t);return(0,p.jsx)(t,{...i,ref:n,children:l.isValidElement(e)?l.cloneElement(e,void 0,r):null})}return(0,p.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var h=m(`Slot`);function g(e){let t=l.forwardRef((e,t)=>{let{children:n,...r}=e;if(l.isValidElement(n)){let e=x(n),i=b(r,n.props);return n.type!==l.Fragment&&(i.ref=t?d(t,e):e),l.cloneElement(n,i)}return l.Children.count(n)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _=Symbol(`radix.slottable`);function v(e){let t=({children:e})=>(0,p.jsx)(p.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=_,t}function y(e){return l.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===_}function b(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function x(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var S=e(s(),1),C=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=m(`Primitive.${t}`),r=l.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,p.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function w(e,t){e&&S.flushSync(()=>e.dispatchEvent(t))}function T(e,t){let n=l.createContext(t),r=e=>{let{children:t,...r}=e,i=l.useMemo(()=>r,Object.values(r));return(0,p.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=l.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function E(e,t=[]){let n=[];function r(t,r){let i=l.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=l.useMemo(()=>o,Object.values(o));return(0,p.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=l.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>l.createContext(e));return function(n){let r=n?.[e]||t;return l.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ee(i,...t)]}function ee(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function D(e){let t=e+`CollectionProvider`,[n,r]=E(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=l.useRef(null),a=l.useRef(new Map).current;return(0,p.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=m(s),u=l.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,p.jsx)(c,{ref:f(t,a(s,n).collectionRef),children:r})});u.displayName=s;let d=e+`CollectionItemSlot`,h=`data-radix-collection-item`,g=m(d),_=l.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=l.useRef(null),s=f(t,o),c=a(d,n);return l.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,p.jsx)(g,{[h]:``,ref:s,children:r})});_.displayName=d;function v(t){let n=a(e+`CollectionConsumer`,t);return l.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:u,ItemSlot:_},v,r]}typeof window<`u`&&window.document&&window.document.createElement;function O(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var k=globalThis?.document?l.useLayoutEffect:()=>{},A=l.useInsertionEffect||k;function j({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=M({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=l.useRef(e!==void 0);l.useEffect(()=>{let e=t.current;if(e!==s){let t=e?`controlled`:`uncontrolled`,n=s?`controlled`:`uncontrolled`;console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,r])}return[c,l.useCallback(t=>{if(s){let n=N(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function M({defaultProp:e,onChange:t}){let[n,r]=l.useState(e),i=l.useRef(n),a=l.useRef(t);return A(()=>{a.current=t},[t]),l.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function N(e){return typeof e==`function`}var te=l.useId||(()=>void 0),ne=0;function re(e){let[t,n]=l.useState(te());return k(()=>{e||n(e=>e??String(ne++))},[e]),e||(t?`radix-${t}`:``)}var ie=l.createContext(void 0);function P(e){let t=l.useContext(ie);return e||t||`ltr`}function F(e){let t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>(...e)=>t.current?.(...e),[])}function ae(e,t=globalThis?.document){let n=F(e);l.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var oe=`DismissableLayer`,se=`dismissableLayer.update`,ce=`dismissableLayer.pointerDownOutside`,le=`dismissableLayer.focusOutside`,ue,de=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fe=l.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,u=l.useContext(de),[d,m]=l.useState(null),h=d?.ownerDocument??globalThis?.document,[,g]=l.useState({}),_=f(t,e=>m(e)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=d?v.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,w=x>=b,T=he(e=>{let t=e.target,n=[...u.branches].some(e=>e.contains(t));!w||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},h),E=ge(e=>{let t=e.target;[...u.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},h);return ae(e=>{x===u.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},h),l.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ue=h.body.style.pointerEvents,h.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),_e(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=ue)}},[d,h,n,u]),l.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),_e())},[d,u]),l.useEffect(()=>{let e=()=>g({});return document.addEventListener(se,e),()=>document.removeEventListener(se,e)},[]),(0,p.jsx)(C.div,{...c,ref:_,style:{pointerEvents:S?w?`auto`:`none`:void 0,...e.style},onFocusCapture:O(e.onFocusCapture,E.onFocusCapture),onBlurCapture:O(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:O(e.onPointerDownCapture,T.onPointerDownCapture)})});fe.displayName=oe;var pe=`DismissableLayerBranch`,me=l.forwardRef((e,t)=>{let n=l.useContext(de),r=l.useRef(null),i=f(t,r);return l.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,p.jsx)(C.div,{...e,ref:i})});me.displayName=pe;function he(e,t=globalThis?.document){let n=F(e),r=l.useRef(!1),i=l.useRef(()=>{});return l.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ve(ce,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ge(e,t=globalThis?.document){let n=F(e),r=l.useRef(!1);return l.useEffect(()=>{let e=e=>{e.target&&!r.current&&ve(le,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function _e(){let e=new CustomEvent(se);document.dispatchEvent(e)}function ve(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?w(i,a):i.dispatchEvent(a)}var ye=`focusScope.autoFocusOnMount`,be=`focusScope.autoFocusOnUnmount`,xe={bubbles:!1,cancelable:!0},Se=`FocusScope`,Ce=l.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=l.useState(null),u=F(i),d=F(a),m=l.useRef(null),h=f(t,e=>c(e)),g=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(r){let e=function(e){if(g.paused||!s)return;let t=e.target;s.contains(t)?m.current=t:I(m.current,{select:!0})},t=function(e){if(g.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||I(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&I(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,g.paused]),l.useEffect(()=>{if(s){Ae.add(g);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ye,xe);s.addEventListener(ye,u),s.dispatchEvent(t),t.defaultPrevented||(we(Ne(Ee(s)),{select:!0}),document.activeElement===e&&I(s))}return()=>{s.removeEventListener(ye,u),setTimeout(()=>{let t=new CustomEvent(be,xe);s.addEventListener(be,d),s.dispatchEvent(t),t.defaultPrevented||I(e??document.body,{select:!0}),s.removeEventListener(be,d),Ae.remove(g)},0)}}},[s,u,d,g]);let _=l.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Te(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&I(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&I(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,p.jsx)(C.div,{tabIndex:-1,...o,ref:h,onKeyDown:_})});Ce.displayName=Se;function we(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(I(r,{select:t}),document.activeElement!==n)return}function Te(e){let t=Ee(e);return[De(t,e),De(t.reverse(),e)]}function Ee(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function De(e,t){for(let n of e)if(!Oe(n,{upTo:t}))return n}function Oe(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function ke(e){return e instanceof HTMLInputElement&&`select`in e}function I(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ke(e)&&t&&e.select()}}var Ae=je();function je(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Me(e,t),e.unshift(t)},remove(t){e=Me(e,t),e[0]?.resume()}}}function Me(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ne(e){return e.filter(e=>e.tagName!==`A`)}var Pe=`Portal`,Fe=l.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=l.useState(!1);k(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?S.createPortal((0,p.jsx)(C.div,{...r,ref:t}),o):null});Fe.displayName=Pe;var Ie=0;function Le(){l.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Re()),document.body.insertAdjacentElement(`beforeend`,e[1]??Re()),Ie++,()=>{Ie===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Ie--}},[])}function Re(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var L=function(){return L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},L.apply(this,arguments)};function ze(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Be(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ve=`right-scroll-bar-position`,He=`width-before-scroll-bar`,Ue=`with-scroll-bars-hidden`,We=`--removed-body-scroll-bar-size`;function Ge(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ke(e,t){var n=(0,l.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var qe=typeof window<`u`?l.useLayoutEffect:l.useEffect,Je=new WeakMap;function Ye(e,t){var n=Ke(t||null,function(t){return e.forEach(function(e){return Ge(e,t)})});return qe(function(){var t=Je.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ge(e,null)}),i.forEach(function(e){r.has(e)||Ge(e,a)})}Je.set(n,e)},[e]),n}function Xe(e){return e}function Ze(e,t){t===void 0&&(t=Xe);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Qe(e){e===void 0&&(e={});var t=Ze(null);return t.options=L({async:!0,ssr:!1},e),t}var $e=function(e){var t=e.sideCar,n=ze(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return l.createElement(r,L({},n))};$e.isSideCarExport=!0;function et(e,t){return e.useMedium(t),$e}var tt=Qe(),nt=function(){},rt=l.forwardRef(function(e,t){var n=l.useRef(null),r=l.useState({onScrollCapture:nt,onWheelCapture:nt,onTouchMoveCapture:nt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=ze(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=Ye([n,t]),w=L(L({},x),i);return l.createElement(l.Fragment,null,d&&l.createElement(S,{sideCar:tt,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?l.cloneElement(l.Children.only(s),L(L({},w),{ref:C})):l.createElement(y,L({},w,{className:c,ref:C}),s))});rt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},rt.classNames={fullWidth:He,zeroRight:Ve};var it,at=function(){if(it)return it;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ot(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=at();return t&&e.setAttribute(`nonce`,t),e}function st(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ct(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var lt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ot())&&(st(t,n),ct(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ut=function(){var e=lt();return function(t,n){l.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},dt=function(){var e=ut();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ft={left:0,top:0,right:0,gap:0},pt=function(e){return parseInt(e||``,10)||0},mt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[pt(n),pt(r),pt(i)]},ht=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ft;var t=mt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gt=dt(),_t=`data-scroll-locked`,vt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
-
.${Ue} {
|
|
3
|
-
overflow: hidden ${r};
|
|
4
|
-
padding-right: ${s}px ${r};
|
|
5
|
-
}
|
|
6
|
-
body[${_t}] {
|
|
7
|
-
overflow: hidden ${r};
|
|
8
|
-
overscroll-behavior: contain;
|
|
9
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
10
|
-
padding-left: ${i}px;
|
|
11
|
-
padding-top: ${a}px;
|
|
12
|
-
padding-right: ${o}px;
|
|
13
|
-
margin-left:0;
|
|
14
|
-
margin-top:0;
|
|
15
|
-
margin-right: ${s}px ${r};
|
|
16
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.${Ve} {
|
|
20
|
-
right: ${s}px ${r};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.${He} {
|
|
24
|
-
margin-right: ${s}px ${r};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.${Ve} .${Ve} {
|
|
28
|
-
right: 0 ${r};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${He} .${He} {
|
|
32
|
-
margin-right: 0 ${r};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[${_t}] {
|
|
36
|
-
${We}: ${s}px;
|
|
37
|
-
}
|
|
38
|
-
`},yt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},bt=function(){l.useEffect(function(){return document.body.setAttribute(_t,(yt()+1).toString()),function(){var e=yt()-1;e<=0?document.body.removeAttribute(_t):document.body.setAttribute(_t,e.toString())}},[])},xt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;bt();var a=l.useMemo(function(){return ht(i)},[i]);return l.createElement(gt,{styles:vt(a,!t,i,n?``:`!important`)})},St=!1;if(typeof window<`u`)try{var Ct=Object.defineProperty({},`passive`,{get:function(){return St=!0,!0}});window.addEventListener(`test`,Ct,Ct),window.removeEventListener(`test`,Ct,Ct)}catch{St=!1}var wt=St?{passive:!1}:!1,Tt=function(e){return e.tagName===`TEXTAREA`},Et=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Tt(e)&&n[t]===`visible`)},Dt=function(e){return Et(e,`overflowY`)},Ot=function(e){return Et(e,`overflowX`)},kt=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Mt(e,r)){var i=Nt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},At=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},jt=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Mt=function(e,t){return e===`v`?Dt(t):Ot(t)},Nt=function(e,t){return e===`v`?At(t):jt(t)},Pt=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ft=function(e,t,n,r,i){var a=Pt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Nt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Mt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},It=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Lt=function(e){return[e.deltaX,e.deltaY]},Rt=function(e){return e&&`current`in e?e.current:e},zt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Bt=function(e){return`
|
|
39
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
-
`},Vt=0,Ht=[];function Ut(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),i=l.useState(Vt++)[0],a=l.useState(dt)[0],o=l.useRef(e);l.useEffect(function(){o.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Be([e.lockRef.current],(e.shards||[]).map(Rt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=l.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=It(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=kt(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=kt(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Ft(h,t,e,h===`h`?s:c,!0)},[]),c=l.useCallback(function(e){var n=e;if(!(!Ht.length||Ht[Ht.length-1]!==a)){var r=`deltaY`in n?Lt(n):It(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&zt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Rt).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=l.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Wt(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=l.useCallback(function(e){n.current=It(e),r.current=void 0},[]),f=l.useCallback(function(t){u(t.type,Lt(t),t.target,s(t,e.lockRef.current))},[]),p=l.useCallback(function(t){u(t.type,It(t),t.target,s(t,e.lockRef.current))},[]);l.useEffect(function(){return Ht.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,wt),document.addEventListener(`touchmove`,c,wt),document.addEventListener(`touchstart`,d,wt),function(){Ht=Ht.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,wt),document.removeEventListener(`touchmove`,c,wt),document.removeEventListener(`touchstart`,d,wt)}},[]);var m=e.removeScrollBar,h=e.inert;return l.createElement(l.Fragment,null,h?l.createElement(a,{styles:Bt(i)}):null,m?l.createElement(xt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Wt(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Gt=et(tt,Ut),Kt=l.forwardRef(function(e,t){return l.createElement(rt,L({},e,{ref:t,sideCar:Gt}))});Kt.classNames=rt.classNames;var qt=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Jt=new WeakMap,Yt=new WeakMap,Xt={},Zt=0,Qt=function(e){return e&&(e.host||Qt(e.parentNode))},$t=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Qt(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},en=function(e,t,n,r){var i=$t(t,Array.isArray(e)?e:[e]);Xt[n]||(Xt[n]=new WeakMap);var a=Xt[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Jt.get(e)||0)+1,l=(a.get(e)||0)+1;Jt.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Yt.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Zt++,function(){o.forEach(function(e){var t=Jt.get(e)-1,i=a.get(e)-1;Jt.set(e,t),a.set(e,i),t||(Yt.has(e)||e.removeAttribute(r),Yt.delete(e)),i||e.removeAttribute(n)}),Zt--,Zt||(Jt=new WeakMap,Jt=new WeakMap,Yt=new WeakMap,Xt={})}},tn=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||qt(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),en(r,i,n,`aria-hidden`)):function(){return null}};function nn(e){let[t,n]=l.useState(void 0);return k(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var rn=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,an=Math.round,on=Math.floor,B=e=>({x:e,y:e}),sn={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function cn(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function U(e){return e.split(`-`)[1]}function ln(e){return e===`x`?`y`:`x`}function un(e){return e===`y`?`height`:`width`}function W(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function dn(e){return ln(W(e))}function fn(e,t,n){n===void 0&&(n=!1);let r=U(e),i=dn(e),a=un(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xn(o)),[o,xn(o)]}function pn(e){let t=xn(e);return[mn(e),t,mn(t)]}function mn(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hn=[`left`,`right`],gn=[`right`,`left`],_n=[`top`,`bottom`],vn=[`bottom`,`top`];function yn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gn:hn:t?hn:gn;case`left`:case`right`:return t?_n:vn;default:return[]}}function bn(e,t,n,r){let i=U(e),a=yn(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mn)))),a}function xn(e){let t=H(e);return sn[t]+e.slice(t.length)}function Sn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Cn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sn(e)}function wn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Tn(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=dn(t),s=un(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(U(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function En(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=Cn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wn(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=wn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Dn=50,On=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:En},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Tn(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Dn&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Tn(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kn=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=Cn(u),f={x:n,y:r},p=dn(i),m=un(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),ee=R(d[v],T),D=E,O=C-h[m]-ee,k=C/2-h[m]/2+w,A=cn(D,k,O),j=!c.arrow&&U(i)!=null&&k!==A&&a.reference[m]/2-(k<D?E:ee)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),An=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=W(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xn(o)]:pn(o)),x=p!==`none`;!d&&x&&b.push(...bn(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=fn(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==W(t))||T.every(e=>W(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function jn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mn(e){return rn.some(t=>e[t]>=0)}var Nn=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=jn(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mn(e)}}}case`escaped`:{let e=jn(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mn(e)}}}default:return{}}}}},Pn=new Set([`left`,`top`]);async function Fn(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=U(n),c=W(n)===`y`,l=Pn.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var In=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Fn(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ln=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=W(H(i)),p=ln(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=cn(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=cn(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Rn=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=W(i),f=ln(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Pn.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},zn=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=V(e,t),u=await o.detectOverflow(t,l),d=H(i),f=U(i),p=W(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=R(h-u[g],v),x=R(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=z(u.left,0),t=z(u.right,0),n=z(u.top,0),r=z(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:z(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:z(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Bn(){return typeof window<`u`}function G(e){return Vn(e)?(e.nodeName||``).toLowerCase():`#document`}function K(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function q(e){return((Vn(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Vn(e){return Bn()?e instanceof Node||e instanceof K(e).Node:!1}function J(e){return Bn()?e instanceof Element||e instanceof K(e).Element:!1}function Y(e){return Bn()?e instanceof HTMLElement||e instanceof K(e).HTMLElement:!1}function Hn(e){return!Bn()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof K(e).ShadowRoot}function Un(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Wn(e){return/^(table|td|th)$/.test(G(e))}function Gn(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Kn=/transform|translate|scale|rotate|perspective|filter/,qn=/paint|layout|strict|content/,X=e=>!!e&&e!==`none`,Jn;function Yn(e){let t=J(e)?Z(e):e;return X(t.transform)||X(t.translate)||X(t.scale)||X(t.rotate)||X(t.perspective)||!Zn()&&(X(t.backdropFilter)||X(t.filter))||Kn.test(t.willChange||``)||qn.test(t.contain||``)}function Xn(e){let t=Q(e);for(;Y(t)&&!Qn(t);){if(Yn(t))return t;if(Gn(t))return null;t=Q(t)}return null}function Zn(){return Jn??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Jn}function Qn(e){return/^(html|body|#document)$/.test(G(e))}function Z(e){return K(e).getComputedStyle(e)}function $n(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(G(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Hn(e)&&e.host||q(e);return Hn(t)?t.host:t}function er(e){let t=Q(e);return Qn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&Un(t)?t:er(t)}function tr(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=er(e),i=r===e.ownerDocument?.body,a=K(r);if(i){let e=nr(a);return t.concat(a,a.visualViewport||[],Un(r)?r:[],e&&n?tr(e):[])}else return t.concat(r,tr(r,[],n))}function nr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function rr(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Y(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=an(n)!==a||an(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ir(e){return J(e)?e:e.contextElement}function ar(e){let t=ir(e);if(!Y(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=rr(t),o=(a?an(n.width):n.width)/r,s=(a?an(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var or=B(0);function sr(e){let t=K(e);return!Zn()||!t.visualViewport?or:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==K(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ir(e),o=B(1);t&&(r?J(r)&&(o=ar(r)):o=ar(e));let s=cr(a,n,r)?sr(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=K(a),t=r&&J(r)?K(r):r,n=e,i=nr(n);for(;i&&r&&t!==n;){let e=ar(i),t=i.getBoundingClientRect(),r=Z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=K(i),i=nr(n)}}return wn({width:u,height:d,x:c,y:l})}function lr(e,t){let n=$n(e).scrollLeft;return t?t.left+n:$(q(e)).left+n}function ur(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lr(e,n),y:n.top+t.scrollTop}}function dr(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=q(r),s=t?Gn(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=Y(r);if((d||!d&&!a)&&((G(r)!==`body`||Un(o))&&(c=$n(r)),d)){let e=$(r);l=ar(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ur(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function fr(e){return Array.from(e.getClientRects())}function pr(e){let t=q(e),n=$n(e),r=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+lr(e),s=-n.scrollTop;return Z(r).direction===`rtl`&&(o+=z(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var mr=25;function hr(e,t){let n=K(e),r=q(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Zn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=lr(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=mr&&(a-=o)}else l<=mr&&(a+=l);return{width:a,height:o,x:s,y:c}}function gr(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Y(e)?ar(e):B(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _r(e,t,n){let r;if(t===`viewport`)r=hr(e,n);else if(t===`document`)r=pr(q(e));else if(J(t))r=gr(t,n);else{let n=sr(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wn(r)}function vr(e,t){let n=Q(e);return n===t||!J(n)||Qn(n)?!1:Z(n).position===`fixed`||vr(n,t)}function yr(e,t){let n=t.get(e);if(n)return n;let r=tr(e,[],!1).filter(e=>J(e)&&G(e)!==`body`),i=null,a=Z(e).position===`fixed`,o=a?Q(e):e;for(;J(o)&&!Qn(o);){let t=Z(o),n=Yn(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Un(o)&&!n&&vr(e,o))?r=r.filter(e=>e!==o):i=t,o=Q(o)}return t.set(e,r),r}function br(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Gn(t)?[]:yr(t,this._c):[].concat(n),r],o=_r(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=_r(t,a[e],i);s=z(n.top,s),c=R(n.right,c),l=R(n.bottom,l),u=z(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xr(e){let{width:t,height:n}=rr(e);return{width:t,height:n}}function Sr(e,t,n){let r=Y(t),i=q(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);function l(){c.x=lr(i)}if(r||!r&&!a)if((G(t)!==`body`||Un(i))&&(s=$n(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?ur(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Cr(e){return Z(e).position===`static`}function wr(e,t){if(!Y(e)||Z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return q(e)===n&&(n=n.ownerDocument.body),n}function Tr(e,t){let n=K(e);if(Gn(e))return n;if(!Y(e)){let t=Q(e);for(;t&&!Qn(t);){if(J(t)&&!Cr(t))return t;t=Q(t)}return n}let r=wr(e,t);for(;r&&Wn(r)&&Cr(r);)r=wr(r,t);return r&&Qn(r)&&Cr(r)&&!Yn(r)?n:r||Xn(e)||n}var Er=async function(e){let t=this.getOffsetParent||Tr,n=this.getDimensions,r=await n(e.floating);return{reference:Sr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Dr(e){return Z(e).direction===`rtl`}var Or={convertOffsetParentRelativeRectToViewportRelativeRect:dr,getDocumentElement:q,getClippingRect:br,getOffsetParent:Tr,getElementRects:Er,getClientRects:fr,getDimensions:xr,getScale:ar,isElement:J,isRTL:Dr};function kr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ar(e,t){let n=null,r,i=q(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=on(d),h=on(i.clientWidth-(u+f)),g=on(i.clientHeight-(d+p)),_=on(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!kr(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function jr(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ir(e),u=i||a?[...l?tr(l):[],...t?tr(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ar(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!kr(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Mr=In,Nr=Ln,Pr=An,Fr=zn,Ir=Nn,Lr=kn,Rr=Rn,zr=(e,t,n)=>{let r=new Map,i={platform:Or,...n},a={...i.platform,_c:r};return On(e,t,{...i,platform:a})},Br=typeof document<`u`?l.useLayoutEffect:function(){};function Vr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Vr(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Vr(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Hr(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ur(e,t){let n=Hr(e);return Math.round(t*n)/n}function Wr(e){let t=l.useRef(e);return Br(()=>{t.current=e}),t}function Gr(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[d,f]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=l.useState(r);Vr(p,r)||m(r);let[h,g]=l.useState(null),[_,v]=l.useState(null),y=l.useCallback(e=>{e!==w.current&&(w.current=e,g(e))},[]),b=l.useCallback(e=>{e!==T.current&&(T.current=e,v(e))},[]),x=a||h,C=o||_,w=l.useRef(null),T=l.useRef(null),E=l.useRef(d),ee=c!=null,D=Wr(c),O=Wr(i),k=Wr(u),A=l.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),zr(w.current,T.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Vr(E.current,t)&&(E.current=t,S.flushSync(()=>{f(t)}))})},[p,t,n,O,k]);Br(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let j=l.useRef(!1);Br(()=>(j.current=!0,()=>{j.current=!1}),[]),Br(()=>{if(x&&(w.current=x),C&&(T.current=C),x&&C){if(D.current)return D.current(x,C,A);A()}},[x,C,A,D,ee]);let M=l.useMemo(()=>({reference:w,floating:T,setReference:y,setFloating:b}),[y,b]),N=l.useMemo(()=>({reference:x,floating:C}),[x,C]),te=l.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Ur(N.floating,d.x),r=Ur(N.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Hr(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,d.x,d.y]);return l.useMemo(()=>({...d,update:A,refs:M,elements:N,floatingStyles:te}),[d,A,M,N,te])}var Kr=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Lr({element:r.current,padding:i}).fn(n):r?Lr({element:r,padding:i}).fn(n):{}}}},qr=(e,t)=>{let n=Mr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jr=(e,t)=>{let n=Nr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yr=(e,t)=>({fn:Rr(e).fn,options:[e,t]}),Xr=(e,t)=>{let n=Pr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zr=(e,t)=>{let n=Fr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qr=(e,t)=>{let n=Ir(e);return{name:n.name,fn:n.fn,options:[e,t]}},$r=(e,t)=>{let n=Kr(e);return{name:n.name,fn:n.fn,options:[e,t]}},ei=`Arrow`,ti=l.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,p.jsx)(C.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,p.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});ti.displayName=ei;var ni=ti,ri=`Popper`,[ii,ai]=E(ri),[oi,si]=ii(ri),ci=e=>{let{__scopePopper:t,children:n}=e,[r,i]=l.useState(null);return(0,p.jsx)(oi,{scope:t,anchor:r,onAnchorChange:i,children:n})};ci.displayName=ri;var li=`PopperAnchor`,ui=l.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=si(li,n),o=l.useRef(null),s=f(t,o),c=l.useRef(null);return l.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,p.jsx)(C.div,{...i,ref:s})});ui.displayName=li;var di=`PopperContent`,[fi,pi]=ii(di),mi=l.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:m=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:g=`optimized`,onPlaced:_,...v}=e,y=si(di,n),[b,x]=l.useState(null),S=f(t,e=>x(e)),[w,T]=l.useState(null),E=nn(w),ee=E?.width??0,D=E?.height??0,O=r+(a===`center`?``:`-`+a),A=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(u)?u:[u],M=j.length>0,N={padding:A,boundary:j.filter(vi),altBoundary:M},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:P}=Gr({strategy:`fixed`,placement:O,whileElementsMounted:(...e)=>jr(...e,{animationFrame:g===`always`}),elements:{reference:y.anchor},middleware:[qr({mainAxis:i+D,alignmentAxis:o}),c&&Jr({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?Yr():void 0,...N}),c&&Xr({...N}),Zr({...N,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&$r({element:w,padding:s}),yi({arrowWidth:ee,arrowHeight:D}),h&&Qr({strategy:`referenceHidden`,...N})]}),[ae,oe]=bi(re),se=F(_);k(()=>{ie&&se?.()},[ie,se]);let ce=P.arrow?.x,le=P.arrow?.y,ue=P.arrow?.centerOffset!==0,[de,fe]=l.useState();return k(()=>{b&&fe(window.getComputedStyle(b).zIndex)},[b]),(0,p.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,p.jsx)(fi,{scope:n,placedSide:ae,onArrowChange:T,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,p.jsx)(C.div,{"data-side":ae,"data-align":oe,...v,ref:S,style:{...v.style,animation:ie?void 0:`none`}})})})});mi.displayName=di;var hi=`PopperArrow`,gi={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_i=l.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pi(hi,n),a=gi[i.placedSide];return(0,p.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,p.jsx)(ni,{...r,ref:t,style:{...r.style,display:`block`}})})});_i.displayName=hi;function vi(e){return e!==null}var yi=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bi(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bi(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xi=ci,Si=ui,Ci=mi,wi=_i;function Ti(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ei({className:e,type:t,...n}){return(0,p.jsx)(`input`,{type:t,"data-slot":`input`,className:a(`h-9 w-full min-w-0 rounded-lg border border-border bg-surface px-3 py-2 text-base md:text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`selection:bg-primary selection:text-primary-foreground`,`file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground`,`aria-invalid:border-destructive`,e),...n})}export{c as A,C,v as D,m as E,d as O,E as S,h as T,j as _,Ci as a,D as b,tn as c,Fe as d,Ce as f,re as g,P as h,wi as i,s as j,f as k,Kt as l,F as m,Ti as n,xi as o,fe as p,Si as r,ai as s,Ei as t,Le as u,k as v,w,T as x,O as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./react-CYzKIDNi.js";import"./api-client-TUmacMRS.js";import{x as e}from"./index-DaQYRomz.js";export{e as useKeybindingsStore};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./react-CYzKIDNi.js";import"./input-P_K5CUiy.js";import"./jsx-runtime-wQxeESYQ.js";import"./ai-settings-section-ByRvOONz.js";import"./settings-store-2NQzaOVJ.js";import"./api-client-TUmacMRS.js";import{n as e}from"./index-DaQYRomz.js";export{e as SettingsTab};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
import { toast } from "sonner";
|
|
3
|
-
|
|
4
|
-
const POLL_INTERVAL = 5_000;
|
|
5
|
-
const HEALTH_URL = "/api/health";
|
|
6
|
-
const LOGS_URL = "/api/logs/recent";
|
|
7
|
-
const REPO = "hienlh/ppm";
|
|
8
|
-
|
|
9
|
-
/** Fetch recent server logs for bug report */
|
|
10
|
-
async function fetchRecentLogs(): Promise<string> {
|
|
11
|
-
try {
|
|
12
|
-
const res = await fetch(LOGS_URL, { signal: AbortSignal.timeout(3000) });
|
|
13
|
-
const json = await res.json();
|
|
14
|
-
return json.ok ? json.data.logs : "(failed to fetch logs)";
|
|
15
|
-
} catch {
|
|
16
|
-
return "(server logs unavailable)";
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** Open GitHub issue pre-filled with crash context + logs */
|
|
21
|
-
async function openBugReport() {
|
|
22
|
-
const logs = await fetchRecentLogs();
|
|
23
|
-
const title = encodeURIComponent("bug: server crashed unexpectedly");
|
|
24
|
-
const body = encodeURIComponent([
|
|
25
|
-
"## Environment",
|
|
26
|
-
`- URL: ${window.location.href}`,
|
|
27
|
-
`- UserAgent: ${navigator.userAgent}`,
|
|
28
|
-
`- Time: ${new Date().toISOString()}`,
|
|
29
|
-
"",
|
|
30
|
-
"## Description",
|
|
31
|
-
"The PPM server went down and restarted unexpectedly.",
|
|
32
|
-
"",
|
|
33
|
-
"## Steps to Reproduce",
|
|
34
|
-
"1. ",
|
|
35
|
-
"",
|
|
36
|
-
"## Recent Server Logs",
|
|
37
|
-
"```",
|
|
38
|
-
logs,
|
|
39
|
-
"```",
|
|
40
|
-
].join("\n"));
|
|
41
|
-
window.open(`https://github.com/${REPO}/issues/new?title=${title}&body=${body}`, "_blank");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Periodically pings /api/health. When server goes down and comes back,
|
|
46
|
-
* shows a toast suggesting the user report a bug.
|
|
47
|
-
*/
|
|
48
|
-
export function useHealthCheck() {
|
|
49
|
-
const wasDown = useRef(false);
|
|
50
|
-
const isFirstCheck = useRef(true);
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
let timer: ReturnType<typeof setInterval>;
|
|
54
|
-
|
|
55
|
-
async function check() {
|
|
56
|
-
try {
|
|
57
|
-
const res = await fetch(HEALTH_URL, { signal: AbortSignal.timeout(3000) });
|
|
58
|
-
if (res.ok) {
|
|
59
|
-
if (wasDown.current && !isFirstCheck.current) {
|
|
60
|
-
toast.warning("Server was restarted", {
|
|
61
|
-
description: "PPM server went down and recovered. If unexpected, please report it.",
|
|
62
|
-
duration: 15_000,
|
|
63
|
-
action: {
|
|
64
|
-
label: "Report Bug",
|
|
65
|
-
onClick: () => openBugReport(),
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
wasDown.current = false;
|
|
69
|
-
}
|
|
70
|
-
isFirstCheck.current = false;
|
|
71
|
-
} else {
|
|
72
|
-
wasDown.current = true;
|
|
73
|
-
}
|
|
74
|
-
} catch {
|
|
75
|
-
if (!wasDown.current && !isFirstCheck.current) {
|
|
76
|
-
toast.error("Server unreachable", {
|
|
77
|
-
description: "PPM server is not responding. It may have crashed.",
|
|
78
|
-
duration: 10_000,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
wasDown.current = true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const initialDelay = setTimeout(() => {
|
|
86
|
-
check();
|
|
87
|
-
timer = setInterval(check, POLL_INTERVAL);
|
|
88
|
-
}, POLL_INTERVAL);
|
|
89
|
-
|
|
90
|
-
return () => {
|
|
91
|
-
clearTimeout(initialDelay);
|
|
92
|
-
clearInterval(timer);
|
|
93
|
-
};
|
|
94
|
-
}, []);
|
|
95
|
-
}
|