@hienlh/ppm 0.8.7 → 0.8.9

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.
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-CYzKIDNi.js";import{C as n,E as r,M as i,N as a,P as o,S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,k as _,l as v,m as y,n as b,o as x,p as ee,r as S,s as C,t as w,u as T,v as E,y as D}from"./input-CE3bFwLk.js";import{n as O,t as k}from"./jsx-runtime-wQxeESYQ.js";import{n as A}from"./utils-DC-bdPS3.js";import{t as j}from"./api-client-TUmacMRS.js";var M=O(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),N=O(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),P=O(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),te=O(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),F=e(t(),1),I=k(),ne=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),L=`VisuallyHidden`,R=F.forwardRef((e,t)=>(0,I.jsx)(n.span,{...e,ref:t,style:{...ne,...e.style}}));R.displayName=L;var z=R;function B(e){let t=F.useRef({value:e,previous:e});return F.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var V=`Label`,re=F.forwardRef((e,t)=>(0,I.jsx)(n.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));re.displayName=V;var ie=re;function H(e,[t,n]){return Math.min(n,Math.max(t,e))}var ae=e(o(),1),oe=[` `,`Enter`,`ArrowUp`,`ArrowDown`],se=[` `,`Enter`],U=`Select`,[W,G,ce]=u(U),[K,le]=s(U,[ce,x]),q=x(),[ue,J]=K(U),[de,fe]=K(U),pe=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:g,required:_,form:v}=e,y=q(t),[b,x]=F.useState(null),[ee,S]=F.useState(null),[C,w]=F.useState(!1),T=h(d),[E,D]=c({prop:r,defaultProp:i??!1,onChange:a,caller:U}),[O,k]=c({prop:o,defaultProp:s,onChange:u,caller:U}),A=F.useRef(null),j=b?v||!!b.closest(`form`):!0,[M,N]=F.useState(new Set),P=Array.from(M).map(e=>e.props.value).join(`;`);return(0,I.jsx)(l,{...y,children:(0,I.jsxs)(ue,{required:_,scope:t,trigger:b,onTriggerChange:x,valueNode:ee,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:g,children:[(0,I.jsx)(W.Provider,{scope:t,children:(0,I.jsx)(de,{scope:e.__scopeSelect,onNativeOptionAdd:F.useCallback(e=>{N(t=>new Set(t).add(e))},[]),onNativeOptionRemove:F.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),j?(0,I.jsxs)(it,{"aria-hidden":!0,required:_,tabIndex:-1,name:f,autoComplete:p,value:O,onChange:e=>k(e.target.value),disabled:g,form:v,children:[O===void 0?(0,I.jsx)(`option`,{value:``}):null,Array.from(M)]},P):null]})})};pe.displayName=U;var me=`SelectTrigger`,he=F.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:i=!1,...a}=e,o=q(r),s=J(me,r),c=s.disabled||i,l=_(t,s.onTriggerChange),u=G(r),d=F.useRef(`touch`),[f,p,m]=ot(e=>{let t=u().filter(e=>!e.disabled),n=st(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),h=e=>{c||(s.onOpenChange(!0),m()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,I.jsx)(b,{asChild:!0,...o,children:(0,I.jsx)(n.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"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":at(s.value)?``:void 0,...a,ref:l,onClick:D(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:D(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:D(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&oe.includes(e.key)&&(h(),e.preventDefault())})})})});he.displayName=me;var ge=`SelectValue`,_e=F.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,children:o,placeholder:s=``,...c}=e,l=J(ge,r),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=_(t,l.onValueNodeChange);return E(()=>{u(d)},[u,d]),(0,I.jsx)(n.span,{...c,ref:f,style:{pointerEvents:`none`},children:at(l.value)?(0,I.jsx)(I.Fragment,{children:s}):o})});_e.displayName=ge;var ve=`SelectIcon`,ye=F.forwardRef((e,t)=>{let{__scopeSelect:r,children:i,...a}=e;return(0,I.jsx)(n.span,{"aria-hidden":!0,...a,ref:t,children:i||`▼`})});ye.displayName=ve;var be=`SelectPortal`,xe=e=>(0,I.jsx)(f,{asChild:!0,...e});xe.displayName=be;var Y=`SelectContent`,Se=F.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=F.useState();if(E(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?ae.createPortal((0,I.jsx)(Ce,{scope:e.__scopeSelect,children:(0,I.jsx)(W.Slot,{scope:e.__scopeSelect,children:(0,I.jsx)(`div`,{children:e.children})})}),t):null}return(0,I.jsx)(Ee,{...e,ref:t})});Se.displayName=Y;var X=10,[Ce,Z]=K(Y),we=`SelectContentImpl`,Te=r(`SelectContent.RemoveScroll`),Ee=F.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:y,avoidCollisions:b,...x}=e,S=J(Y,n),[C,w]=F.useState(null),[E,O]=F.useState(null),k=_(t,e=>w(e)),[A,j]=F.useState(null),[M,N]=F.useState(null),P=G(n),[te,ne]=F.useState(!1),L=F.useRef(!1);F.useEffect(()=>{if(C)return d(C)},[C]),T();let R=F.useCallback(e=>{let[t,...n]=P().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&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[P,E]),z=F.useCallback(()=>R([A,C]),[R,A,C]);F.useEffect(()=>{te&&z()},[te,z]);let{onOpenChange:B,triggerPointerDownPosRef:V}=S;F.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(V.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():C.contains(n.target)||B(!1),document.removeEventListener(`pointermove`,t),V.current=null};return V.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,B,V]),F.useEffect(()=>{let e=()=>B(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[B]);let[re,ie]=ot(e=>{let t=P().filter(e=>!e.disabled),n=st(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),H=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(S.value!==void 0&&S.value===t||r)&&(j(e),r&&(L.current=!0))},[S.value]),ae=F.useCallback(()=>C?.focus(),[C]),oe=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(S.value!==void 0&&S.value===t||r)&&N(e)},[S.value]),se=r===`popper`?Ae:Oe,U=se===Ae?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:y,avoidCollisions:b}:{};return(0,I.jsx)(Ce,{scope:n,content:C,viewport:E,onViewportChange:O,itemRefCallback:H,selectedItem:A,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:z,selectedItemText:M,position:r,isPositioned:te,searchRef:re,children:(0,I.jsx)(v,{as:Te,allowPinchZoom:!0,children:(0,I.jsx)(p,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:D(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,I.jsx)(se,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...x,...U,onPlaced:()=>ne(!0),ref:k,style:{display:`flex`,flexDirection:`column`,outline:`none`,...x.style},onKeyDown:D(x.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=P().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(()=>R(t)),e.preventDefault()}})})})})})})});Ee.displayName=we;var De=`SelectItemAlignedPosition`,Oe=F.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=J(Y,r),s=Z(Y,r),[c,l]=F.useState(null),[u,d]=F.useState(null),f=_(t,e=>d(e)),p=G(r),m=F.useRef(!1),h=F.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=F.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&v&&y){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=H(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=H(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-X*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+_,ee=Math.min(v.offsetHeight*5,x),S=window.getComputedStyle(g),C=parseInt(S.paddingTop,10),w=parseInt(S.paddingBottom,10),T=e.top+e.height/2-X,E=s-T,D=v.offsetHeight/2,O=v.offsetTop+D,k=f+h+O,A=x-k;if(k<=T){let e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=k+Math.max(E,D+(e?w:0)+t+_);c.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;c.style.top=`0px`;let t=Math.max(T,f+g.offsetTop+(e?C:0)+D)+A;c.style.height=t+`px`,g.scrollTop=k-T+g.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=ee+`px`,c.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,v,y,o.dir,i]);E(()=>x(),[x]);let[ee,S]=F.useState();return E(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]),(0,I.jsx)(je,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:F.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]),children:(0,I.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:ee},children:(0,I.jsx)(n.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Oe.displayName=De;var ke=`SelectPopperPosition`,Ae=F.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=q(n);return(0,I.jsx)(g,{...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)`}})});Ae.displayName=ke;var[je,Me]=K(Y,{}),Ne=`SelectViewport`,Pe=F.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:i,...a}=e,o=Z(Ne,r),s=Me(Ne,r),c=_(t,o.onViewportChange),l=F.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:i}),(0,I.jsx)(W.Slot,{scope:r,children:(0,I.jsx)(n.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:D(a.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-X*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})})})]})});Pe.displayName=Ne;var Fe=`SelectGroup`,[Ie,Le]=K(Fe),Re=F.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=m();return(0,I.jsx)(Ie,{scope:r,id:a,children:(0,I.jsx)(n.div,{role:`group`,"aria-labelledby":a,...i,ref:t})})});Re.displayName=Fe;var ze=`SelectLabel`,Be=F.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=Le(ze,r);return(0,I.jsx)(n.div,{id:a.id,...i,ref:t})});Be.displayName=ze;var Ve=`SelectItem`,[He,Ue]=K(Ve),We=F.forwardRef((e,t)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,c=J(Ve,r),l=Z(Ve,r),u=c.value===i,[d,f]=F.useState(o??``),[p,h]=F.useState(!1),g=_(t,e=>l.itemRefCallback?.(e,i,a)),v=m(),y=F.useRef(`touch`),b=()=>{a||(c.onValueChange(i),c.onOpenChange(!1))};if(i===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,I.jsx)(He,{scope:r,value:i,disabled:a,textId:v,isSelected:u,onItemTextChange:F.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(W.ItemSlot,{scope:r,value:i,disabled:a,textValue:d,children:(0,I.jsx)(n.div,{role:`option`,"aria-labelledby":v,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:g,onFocus:D(s.onFocus,()=>h(!0)),onBlur:D(s.onBlur,()=>h(!1)),onClick:D(s.onClick,()=>{y.current!==`mouse`&&b()}),onPointerUp:D(s.onPointerUp,()=>{y.current===`mouse`&&b()}),onPointerDown:D(s.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:D(s.onPointerMove,e=>{y.current=e.pointerType,a?l.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:D(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:D(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(se.includes(e.key)&&b(),e.key===` `&&e.preventDefault())})})})})});We.displayName=Ve;var Q=`SelectItemText`,Ge=F.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,...o}=e,s=J(Q,r),c=Z(Q,r),l=Ue(Q,r),u=fe(Q,r),[d,f]=F.useState(null),p=_(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=F.useMemo(()=>(0,I.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=u;return E(()=>(g(h),()=>v(h)),[g,v,h]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.span,{id:l.textId,...o,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ae.createPortal(o.children,s.valueNode):null]})});Ge.displayName=Q;var Ke=`SelectItemIndicator`,qe=F.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e;return Ue(Ke,r).isSelected?(0,I.jsx)(n.span,{"aria-hidden":!0,...i,ref:t}):null});qe.displayName=Ke;var Je=`SelectScrollUpButton`,Ye=F.forwardRef((e,t)=>{let n=Z(Je,e.__scopeSelect),r=Me(Je,e.__scopeSelect),[i,a]=F.useState(!1),o=_(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Qe,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ye.displayName=Je;var Xe=`SelectScrollDownButton`,Ze=F.forwardRef((e,t)=>{let n=Z(Xe,e.__scopeSelect),r=Me(Xe,e.__scopeSelect),[i,a]=F.useState(!1),o=_(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Qe,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ze.displayName=Xe;var Qe=F.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=Z(`SelectScrollButton`,r),s=F.useRef(null),c=G(r),l=F.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return F.useEffect(()=>()=>l(),[l]),E(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,I.jsx)(n.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:D(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:D(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:D(a.onPointerLeave,()=>{l()})})}),$e=`SelectSeparator`,et=F.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e;return(0,I.jsx)(n.div,{"aria-hidden":!0,...i,ref:t})});et.displayName=$e;var tt=`SelectArrow`,nt=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=q(n),a=J(tt,n),o=Z(tt,n);return a.open&&o.position===`popper`?(0,I.jsx)(S,{...i,...r,ref:t}):null});nt.displayName=tt;var rt=`SelectBubbleInput`,it=F.forwardRef(({__scopeSelect:e,value:t,...r},i)=>{let a=F.useRef(null),o=_(i,a),s=B(t);return F.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,I.jsx)(n.select,{...r,style:{...ne,...r.style},ref:o,defaultValue:t})});it.displayName=rt;function at(e){return e===``||e===void 0}function ot(e){let t=y(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function st(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=ct(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}function ct(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lt=pe,ut=he,dt=_e,ft=ye,pt=xe,mt=Se,ht=Pe,gt=We,_t=Ge,vt=qe,yt=Ye,bt=Ze,xt=`Switch`,[St,Ct]=s(xt),[wt,Tt]=St(xt),Et=F.forwardRef((e,t)=>{let{__scopeSwitch:r,name:i,checked:a,defaultChecked:o,required:s,disabled:l,value:u=`on`,onCheckedChange:d,form:f,...p}=e,[m,h]=F.useState(null),g=_(t,e=>h(e)),v=F.useRef(!1),y=m?f||!!m.closest(`form`):!0,[b,x]=c({prop:a,defaultProp:o??!1,onChange:d,caller:xt});return(0,I.jsxs)(wt,{scope:r,checked:b,disabled:l,children:[(0,I.jsx)(n.button,{type:`button`,role:`switch`,"aria-checked":b,"aria-required":s,"data-state":jt(b),"data-disabled":l?``:void 0,disabled:l,value:u,...p,ref:g,onClick:D(e.onClick,e=>{x(e=>!e),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),y&&(0,I.jsx)(At,{control:m,bubbles:!v.current,name:i,value:u,checked:b,required:s,disabled:l,form:f,style:{transform:`translateX(-100%)`}})]})});Et.displayName=xt;var Dt=`SwitchThumb`,Ot=F.forwardRef((e,t)=>{let{__scopeSwitch:r,...i}=e,a=Tt(Dt,r);return(0,I.jsx)(n.span,{"data-state":jt(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})});Ot.displayName=Dt;var kt=`SwitchBubbleInput`,At=F.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=F.useRef(null),s=_(o,a),c=B(n),l=C(t);return F.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,I.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});At.displayName=kt;function jt(e){return e?`checked`:`unchecked`}var Mt=Et,Nt=Ot;function $({className:e,...t}){return(0,I.jsx)(ie,{"data-slot":`label`,className:A(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Pt({...e}){return(0,I.jsx)(lt,{"data-slot":`select`,...e})}function Ft({...e}){return(0,I.jsx)(dt,{"data-slot":`select-value`,...e})}function It({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(ut,{"data-slot":`select-trigger`,"data-size":t,className:A(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(ft,{asChild:!0,children:(0,I.jsx)(i,{className:`size-4 opacity-50`})})]})}function Lt({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,I.jsx)(pt,{children:(0,I.jsxs)(mt,{"data-slot":`select-content`,className:A(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md 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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-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:r,...i,children:[(0,I.jsx)(zt,{}),(0,I.jsx)(ht,{className:A(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(Bt,{})]})})}function Rt({className:e,children:t,...n}){return(0,I.jsxs)(gt,{"data-slot":`select-item`,className:A(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent 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 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(vt,{children:(0,I.jsx)(a,{className:`size-4`})})}),(0,I.jsx)(_t,{children:t})]})}function zt({className:e,...t}){return(0,I.jsx)(yt,{"data-slot":`select-scroll-up-button`,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(N,{className:`size-4`})})}function Bt({className:e,...t}){return(0,I.jsx)(bt,{"data-slot":`select-scroll-down-button`,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(i,{className:`size-4`})})}function Vt(){return j.get(`/api/accounts`)}function Ht(){return j.get(`/api/accounts/active`)}function Ut(e){return j.post(`/api/accounts`,e)}function Wt(e){return j.del(`/api/accounts/${e}`)}function Gt(e,t){return j.patch(`/api/accounts/${e}`,t)}function Kt(){return j.get(`/api/accounts/settings`)}function qt(e){return j.put(`/api/accounts/settings`,e)}function Jt(e){return j.post(`/api/accounts/${e}/verify`)}function Yt(){return j.get(`/api/accounts/oauth/url`)}function Xt(e,t){return j.post(`/api/accounts/oauth/exchange`,{code:e,state:t})}function Zt(){return j.get(`/api/accounts/usage`)}function Qt(e){return j.post(`/api/accounts/import`,e)}function $t(){return j.get(`/api/settings/ai`)}function en(e){return j.put(`/api/settings/ai`,e)}var tn=[{value:`claude-sonnet-4-6`,label:`Claude Sonnet 4.6`},{value:`claude-opus-4-6`,label:`Claude Opus 4.6`},{value:`claude-haiku-4-5`,label:`Claude Haiku 4.5`}],nn=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}],rn=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}];function an({compact:e}={}){let[t,n]=(0,F.useState)(null),[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(null),[s,c]=(0,F.useState)(0);(0,F.useEffect)(()=>{$t().then(n).catch(e=>o(e.message))},[]);let l=t?.default_provider??`claude`,u=t?.providers[l],d=async(e,r)=>{if(t){i(!0),o(null);try{n(await en({providers:{[l]:{[e]:r}}})),c(e=>e+1)}catch(e){o(e.message)}finally{i(!1)}}},f=e?`text-[11px]`:`text-sm`,p=e?`text-xs`:`text-sm`,m=e?`space-y-2`:`space-y-4`,h=e?`space-y-1.5`:`space-y-3`,g=e?`space-y-1`:`space-y-1.5`;return t?(0,I.jsxs)(`div`,{className:m,children:[(0,I.jsx)(`h3`,{className:`${p} font-medium text-text-secondary`,children:`AI Provider`}),(0,I.jsxs)(`div`,{className:h,children:[(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-model`,className:e?f:void 0,children:`Model`}),(0,I.jsxs)(Pt,{value:u?.model??`claude-sonnet-4-6`,onValueChange:e=>d(`model`,e),children:[(0,I.jsx)(It,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(Ft,{})}),(0,I.jsx)(Lt,{children:tn.map(e=>(0,I.jsx)(Rt,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-effort`,className:e?f:void 0,children:`Effort`}),(0,I.jsxs)(Pt,{value:u?.effort??`high`,onValueChange:e=>d(`effort`,e),children:[(0,I.jsx)(It,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(Ft,{})}),(0,I.jsx)(Lt,{children:nn.map(e=>(0,I.jsx)(Rt,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-max-turns`,className:e?f:void 0,children:`Max Turns (1-500)`}),(0,I.jsx)(w,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:u?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||d(`max_turns`,t)}},`turns-${s}`)]}),(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-budget`,className:e?f:void 0,children:`Max Budget (USD)`}),(0,I.jsx)(w,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:u?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);d(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${s}`)]}),(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-thinking`,className:e?f:void 0,children:`Thinking Budget (tokens)`}),(0,I.jsx)(w,{id:`ai-thinking`,type:`number`,min:0,defaultValue:u?.thinking_budget_tokens??``,placeholder:`Disabled`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);d(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${s}`)]}),(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-permission-mode`,className:e?f:void 0,children:`Default Permission Mode`}),(0,I.jsxs)(Pt,{value:u?.permission_mode??`bypassPermissions`,onValueChange:e=>d(`permission_mode`,e),children:[(0,I.jsx)(It,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,I.jsx)(Ft,{})}),(0,I.jsx)(Lt,{children:rn.map(e=>(0,I.jsx)(Rt,{value:e.value,children:e.label},e.value))})]})]}),(0,I.jsxs)(`div`,{className:g,children:[(0,I.jsx)($,{htmlFor:`ai-system-prompt`,className:e?f:void 0,children:`Additional Instructions`}),(0,I.jsx)(`textarea`,{id:`ai-system-prompt`,rows:4,defaultValue:u?.system_prompt??``,placeholder:`Enter additional instructions for Claude...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{d(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${s}`)]})]}),r&&(0,I.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),a&&(0,I.jsx)(`p`,{className:`text-xs text-red-500`,children:a})]}):(0,I.jsxs)(`div`,{className:h,children:[(0,I.jsx)(`h3`,{className:`${p} font-medium text-text-secondary`,children:`AI Provider`}),(0,I.jsx)(`p`,{className:`${f} text-text-subtle`,children:a?`Error: ${a}`:`Loading...`})]})}var on=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(Mt,{className:A(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,I.jsx)(Nt,{className:A(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));on.displayName=Mt.displayName;export{z as C,M as D,N as E,H as S,P as T,Lt as _,Xt as a,Ft as b,Vt as c,Yt as d,Qt as f,Pt as g,Jt as h,Wt as i,Ht as l,qt as m,an as n,$t as o,Gt as p,Ut as r,Kt as s,on as t,Zt as u,Rt as v,te as w,$ as x,It as y};