@skybridge/devtools 0.0.0-dev.cf86f93 → 0.0.0-dev.cfc7f32

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.
@@ -149,7 +149,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
149
149
  ${e.right}px ${e.bottom}px,
150
150
  ${e.right}px ${e.top}px,
151
151
  ${e.left}px ${e.top}px
152
- )`}return(0,G.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),cie=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Y3(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,G.jsx)(q5.Provider,{value:n,children:(0,G.jsxs)(V6,{ref:t,...r,children:[a&&o===!0&&(0,G.jsx)(J5,{ref:i.context.internalBackdropRef,inert:k4(!s)}),e.children]})}):null});function Y5(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}var X5={},Z5={},Q5=``;function lie(e){if(typeof document>`u`)return!1;let t=q1(e);return OT(t).innerWidth-t.documentElement.clientWidth>0}function uie(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=q1(e),n=t.documentElement,r=t.body,i=PT(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function die(e){let t=q1(e),n=t.documentElement,r=t.body,i=PT(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function fie(e){let t=q1(e),n=t.documentElement,r=t.body,i=OT(n),a=0,o=0,s=!1,c=I4.create();if(x0&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,X5={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Q5=n.style.scrollBehavior,Z5={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=PT(n)?n:r;if(s=uie(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,X5),Object.assign(r.style,Z5),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Q5)}function d(){u(),c.request(l)}return l(),i.addEventListener(`resize`,d),()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&i.removeEventListener(`resize`,d)}}var pie=new class{lockCount=0;restore=null;timeoutLock=u6.create();timeoutUnlock=u6.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=q1(e).documentElement,n=OT(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=TE;return}this.restore=S0||!lie(e)?die(e):fie(e)}};function $5(e=!0,t=null){$(()=>{if(e)return pie.acquire(t)},[e,t])}function mie(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function e7(e,t){let n=b.useRef(e),r=XT(t);$(()=>{n.current!==e&&r(n.current)},[e,r]),$(()=>{n.current=e},[e])}function t7(e){let[t,n]=b.useState(null),r=XT((t,r)=>{e||n(r||(S0?`touch`:``))});e7(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=mie(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function hie(e){let{store:t,parentContext:n,actionsRef:r}=e,i=t.useState(`open`),a=t.useState(`disablePointerDismissal`),o=t.useState(`modal`),s=t.useState(`popupElement`),{openMethod:c,triggerProps:l}=t7(i);T5(t);let{forceUnmount:u}=E5(i,t),d=XT(e=>{let n=g0(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),f=b.useCallback(()=>{t.setOpen(!1,d(m0))},[t,d]);b.useImperativeHandle(r,()=>({unmount:u,close:f}),[u,f]);let p=M5({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[m,h]=b.useState(0),g=m===0,_=V5(p),v=d8(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=R0(e);if(g&&!a){let e=n;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||I0(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:g});$5(i&&o===!0,s);let{getReferenceProps:y,getFloatingProps:x,getTriggerProps:S}=F5([_,v]);t.useContextCallback(`onNestedDialogOpen`,e=>{h(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(m),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,m]);let C=b.useMemo(()=>y(l),[y,l]),w=b.useMemo(()=>S(l),[S,l]),T=b.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:p,nestedOpenDialogCount:m})}var gie={...A5,modal:v5(e=>e.modal),nested:v5(e=>e.nested),nestedOpenDialogCount:v5(e=>e.nestedOpenDialogCount),disablePointerDismissal:v5(e=>e.disablePointerDismissal),openMethod:v5(e=>e.openMethod),descriptionElementId:v5(e=>e.descriptionElementId),titleElementId:v5(e=>e.titleElementId),viewportElement:v5(e=>e.viewportElement),role:v5(e=>e.role)},_ie=class extends C5{constructor(e){super(vie(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new D5,onOpenChange:void 0,onOpenChangeComplete:void 0},gie)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function vie(e={}){return{...O5(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function yie(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=Y3(!0),p=!!f,m=JT(()=>l?.store??new _ie({open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:p})).current;Y5(()=>{n===void 0&&m.state.open===!1&&r===!0&&m.update({open:!0,activeTriggerId:d})}),m.useControlledProp(`openProp`,n),m.useControlledProp(`triggerIdProp`,u),m.useSyncedValues({disablePointerDismissal:o,nested:p,modal:s}),m.useContextCallback(`onOpenChange`,i),m.useContextCallback(`onOpenChangeComplete`,a);let h=m.useState(`payload`);hie({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=b.useMemo(()=>({store:m}),[m]);return(0,G.jsx)(J3.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}var bie=b.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=Y3(),s=Q1(i);return o.useSyncedValueWithCleanup(`titleElementId`,s),NE(`h2`,e,{ref:t,props:[{id:s},a]})});function xie({...e}){return(0,G.jsx)(yie,{"data-slot":`dialog`,...e})}function Sie({...e}){return(0,G.jsx)(cie,{"data-slot":`dialog-portal`,...e})}function Cie({className:e,...t}){return(0,G.jsx)(s6,{"data-slot":`dialog-overlay`,className:uO(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,e),...t})}function wie({className:e,children:t,showCloseButton:n=!0,...r}){return(0,G.jsxs)(Sie,{children:[(0,G.jsx)(Cie,{}),(0,G.jsxs)(sie,{"data-slot":`dialog-content`,className:uO(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-none p-4 text-xs/relaxed ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,e),...r,children:[t,n&&(0,G.jsxs)(c6,{"data-slot":`dialog-close`,render:(0,G.jsx)(fO,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,G.jsx)(gn,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Tie({className:e,...t}){return(0,G.jsx)(bie,{"data-slot":`dialog-title`,className:uO(`text-sm font-medium`,e),...t})}var Eie=()=>{let e=wT(),[t,n]=(0,b.useState)(!1);return e._meta&&Object.keys(e._meta).length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(fO,{variant:`ghost`,size:`default`,onClick:()=>n(!0),"aria-label":`View metadata`,title:`View metadata`,children:[(0,G.jsx)(sn,{className:`h-4 w-4`}),`Metadata`]}),(0,G.jsx)(xie,{open:t,onOpenChange:n,children:(0,G.jsxs)(wie,{className:`sm:max-w-2xl`,children:[(0,G.jsx)(Tie,{children:`Tool Metadata`}),(0,G.jsx)(`div`,{className:`text-xs`,children:(0,G.jsx)(q3,{src:e._meta,name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,style:{fontSize:`0.75rem`},collapsed:2,collapseStringsAfterLength:80})})]})})]}):null},Die={"ui:submitButtonOptions":{norender:!0}},Oie=({schema:e,formData:t,setFormData:n,ref:r})=>!e?.properties||Object.keys(e.properties).length===0?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This tool requires no input`})}):(0,G.jsx)(S3,{children:(0,G.jsx)(C3,{children:(0,G.jsx)(M1,{ref:r,schema:e??{},validator:PK,uiSchema:Die,formData:t,onChange:e=>n(e.formData),showErrorList:!1,templates:{FieldTemplate:e=>{let{id:t,classNames:n,style:r,label:i,required:a,errors:o,children:s}=e;return(0,G.jsxs)(`div`,{className:uO(`flex flex-col gap-2`,n),style:r,children:[(0,G.jsxs)(`label`,{htmlFor:t,className:`text-sm text-foreground`,children:[i,a&&(0,G.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s,o]})]})},FieldErrorTemplate:e=>e.errors&&e.errors.length>0?(0,G.jsx)(`div`,{className:`text-sm text-destructive mt-1 flex items-center gap-1`,children:(0,G.jsx)(`span`,{children:e.errors.join(`, `)})}):null}})})}),kie=({formData:e,setFormData:t})=>{let[n,r]=(0,b.useState)(JSON.stringify(e,null,2));(0,b.useEffect)(()=>{r(JSON.stringify(e,null,2))},[e]);let i=e=>{r(e);try{t(JSON.parse(e))}catch{}};return(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,G.jsx)(`textarea`,{className:`w-full h-full p-2 rounded-md border border-border`,rows:12,value:n,onChange:e=>i(e.target.value)})})},Aie=()=>{let e=(0,b.useRef)(null),t=wT(),{setToolData:n}=sC(),r=cC(t.name)?.input??{},i=e=>{n(t.name,{input:e??{}})};return(0,G.jsxs)(`div`,{className:uO(`flex flex-col h-full overflow-hidden border-r border-border`),children:[(0,G.jsxs)(`div`,{className:`shrink-0 border-b border-border px-6 py-4 flex items-center justify-between h-[72px]`,children:[(0,G.jsx)(`h2`,{className:`font-semibold text-foreground`,children:t.name}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Eie,{}),(0,G.jsx)(G3,{validateForm:async()=>e.current===null?!0:await e.current.validateForm(),formData:r})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-6 bg-muted/50`,children:(0,G.jsxs)(_3,{defaultValue:`form`,children:[(0,G.jsxs)(y3,{children:[(0,G.jsx)(b3,{value:`form`,children:`Form`}),(0,G.jsx)(b3,{value:`json`,children:`JSON`})]}),(0,G.jsx)(x3,{value:`form`,children:(0,G.jsx)(Oie,{schema:t.inputSchema,formData:r,setFormData:i,ref:e},t.name)}),(0,G.jsx)(x3,{value:`json`,children:(0,G.jsx)(kie,{formData:r,setFormData:i},t.name)})]})})]})},jie=UE(`rounded-none has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-none flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0 [&>[data-slot]]:rounded-r-none`,vertical:`flex-col [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0 [&>[data-slot]]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function Mie({className:e,orientation:t,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:uO(jie({orientation:t}),e),...n})}function Nie({className:e,...t}){return(0,G.jsx)(`label`,{"data-slot":`label`,className:uO(`gap-2 text-xs leading-none group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed`,e),...t})}function Pie({className:e,...t}){return(0,G.jsx)(`fieldset`,{"data-slot":`field-set`,className:uO(`gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col`,e),...t})}var Fie=UE(`data-[invalid=true]:text-destructive gap-2 group/field flex w-full`,{variants:{orientation:{vertical:`flex-col [&>*]:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function n7({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:uO(Fie({orientation:t}),e),...n})}function r7({className:e,...t}){return(0,G.jsx)(Nie,{"data-slot":`field-label`,className:uO(`has-data-checked:bg-primary/5 has-data-checked:border-primary dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-none has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var i7=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Iie={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},a7={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Lie={disabled:!1,...a7},o7={valid(e){return e===null?null:e?{[i7.valid]:``}:{[i7.invalid]:``}}},Rie=b.createContext({invalid:void 0,name:void 0,validityData:{state:Iie,errors:[],error:``,value:``,initialValue:null},setValidityData:TE,disabled:void 0,touched:a7.touched,setTouched:TE,dirty:a7.dirty,setDirty:TE,filled:a7.filled,setFilled:TE,focused:a7.focused,setFocused:TE,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Lie,markedDirtyRef:{current:!1},validation:{getValidationProps:(e=DE)=>e,getInputValidationProps:(e=DE)=>e,inputRef:{current:null},commit:async()=>{}}});function s7(e=!0){let t=b.useContext(Rie);if(t.setValidityData===TE&&!e)throw Error(cE(28));return t}var zie=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:TE,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function c7(){return b.useContext(zie)}var Bie=b.createContext({controlId:void 0,registerControlId:TE,labelId:void 0,setLabelId:TE,messageIds:[],setMessageIds:TE,getDescriptionProps:e=>e});function l7(){return b.useContext(Bie)}function Vie(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function u7(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=l7(),o=Q1(t),s=n?i:void 0,c=JT(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=XT(()=>{!l.current||a===TE||(l.current=!1,a(c.current,void 0))});return $(()=>{if(a===TE)return;let e;if(n){let n=r?.current;e=jT(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function d7(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=c7(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=s7(),f=XT(e.getValue);$(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),$(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:Vie(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?Vq.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),$(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var Hie=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,...d}=e,{state:f,name:p,disabled:m,setTouched:h,setDirty:g,validityData:_,setFocused:v,setFilled:y,validationMode:x,validation:S}=s7(),C=m||s,w=p??a,T={...f,disabled:C},{labelId:E}=l7(),D=u7({id:i});$(()=>{let e=o!=null;S.inputRef.current?.value||e&&o!==``?y(!0):e&&o===``&&y(!1)},[S.inputRef,y,o]);let O=b.useRef(null);$(()=>{u&&O.current===F0(q1(O.current))&&v(!0)},[u,v]);let[k]=N1({controlled:o,default:l,name:`FieldControl`,state:`value`}),A=o!==void 0,j=A?k:void 0;return d7({id:D,name:w,commit:S.commit,value:j,getValue:()=>S.inputRef.current?.value,controlRef:S.inputRef}),NE(`input`,e,{ref:[t,O],state:T,props:[{id:D,disabled:C,name:w,ref:S.inputRef,"aria-labelledby":E,autoFocus:u,...A?{value:j}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,g0(a0,e.nativeEvent)),g(t!==_.initialValue),y(t!==``)},onFocus(){v(!0)},onBlur(e){h(!0),v(!1),x===`onBlur`&&S.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(h(!0),S.commit(e.currentTarget.value))}},S.getInputValidationProps(),d],stateAttributesMapping:o7})}),Uie=b.forwardRef(function(e,t){return(0,G.jsx)(Hie,{ref:t,...e})});function f7({className:e,type:t,...n}){return(0,G.jsx)(Uie,{type:t,"data-slot":`input`,className:uO(`dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-none border bg-transparent px-2.5 py-1 text-xs transition-colors file:h-6 file:text-xs file:font-medium focus-visible:ring-1 aria-invalid:ring-1 md:text-xs file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,e),...n})}var p7=b.createContext(null),m7=b.createContext(null);function h7(){let e=b.useContext(p7);if(e===null)throw Error(cE(60));return e}function g7(){let e=b.useContext(m7);if(e===null)throw Error(cE(61));return e}var Wie=(e,t)=>Object.is(e,t);function _7(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Gie(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:_7(t,e,n))}function v7(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:_7(e,t,n))}function Kie(e,t,n){return e.filter(e=>!_7(t,e,n))}function y7(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function b7(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function qie(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(b7(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Jie(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return y7(e)}function x7(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?y7(e.value):y7(e)}function S7(e,t,n){function r(){return Jie(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=b7(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Yie(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,G.jsx)(b.Fragment,{children:S7(r,t,n)},i)),e),[])}var C7={id:v5(e=>e.id),labelId:v5(e=>e.labelId),modal:v5(e=>e.modal),multiple:v5(e=>e.multiple),items:v5(e=>e.items),itemToStringLabel:v5(e=>e.itemToStringLabel),itemToStringValue:v5(e=>e.itemToStringValue),isItemEqualToValue:v5(e=>e.isItemEqualToValue),value:v5(e=>e.value),hasSelectedValue:v5(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:x7(t,r)!==``}),hasNullItemLabel:v5((e,t)=>t?qie(e.items):!1),open:v5(e=>e.open),mounted:v5(e=>e.mounted),forceMount:v5(e=>e.forceMount),transitionStatus:v5(e=>e.transitionStatus),openMethod:v5(e=>e.openMethod),activeIndex:v5(e=>e.activeIndex),selectedIndex:v5(e=>e.selectedIndex),isActive:v5((e,t)=>e.activeIndex===t),isSelected:v5((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>_7(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:_7(n,i,r)}),isSelectedByFocus:v5((e,t)=>e.selectedIndex===t),popupProps:v5(e=>e.popupProps),triggerProps:v5(e=>e.triggerProps),triggerElement:v5(e=>e.triggerElement),positionerElement:v5(e=>e.positionerElement),listElement:v5(e=>e.listElement),scrollUpArrowVisible:v5(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:v5(e=>e.scrollDownArrowVisible),hasScrollArrows:v5(e=>e.hasScrollArrows)};function Xie(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,autoComplete:l,disabled:u=!1,readOnly:d=!1,required:f=!1,modal:p=!0,actionsRef:m,inputRef:h,onOpenChangeComplete:g,items:_,multiple:v=!1,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:S=Wie,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=c7(),{setDirty:E,setTouched:D,setFocused:O,shouldValidateOnChange:k,validityData:A,setFilled:j,name:M,disabled:N,validation:P,validationMode:F}=s7(),I=u7({id:t}),L=N||u,R=M??c,[z,B]=N1({controlled:n,default:v?r??EE:r,name:`Select`,state:`value`}),[V,H]=N1({controlled:a,default:o,name:`Select`,state:`open`}),U=b.useRef([]),ee=b.useRef([]),W=b.useRef(null),te=b.useRef(null),ne=b.useRef(0),re=b.useRef(null),ie=b.useRef([]),ae=b.useRef(!1),oe=b.useRef(!1),se=b.useRef(null),ce=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),le=b.useRef(!1),{mounted:ue,setMounted:de,transitionStatus:fe}=V4(V),{openMethod:pe,triggerProps:me}=t7(V),he=JT(()=>new S5({id:I,labelId:void 0,modal:p,multiple:v,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:S,value:z,open:V,mounted:ue,transitionStatus:fe,items:_,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ge=x5(he,C7.activeIndex),_e=x5(he,C7.selectedIndex),ve=x5(he,C7.triggerElement),ye=x5(he,C7.positionerElement),be=b.useMemo(()=>v&&Array.isArray(z)&&z.length===0?``:x7(z,x),[v,z,x]),xe=b.useMemo(()=>v&&Array.isArray(z)?z.map(e=>x7(e,x)):x7(z,x),[v,z,x]),Se=g6(he.state.triggerElement);d7({id:I,commit:P.commit,value:z,controlRef:Se,name:R,getValue:()=>xe});let Ce=b.useRef(z);$(()=>{z!==Ce.current&&he.set(`forceMount`,!0)},[he,z]),$(()=>{j(v?Array.isArray(z)&&z.length>0:z!=null)},[v,z,j]),$(function(){if(V)return;let e=ie.current;if(v){let t=Array.isArray(z)?z:[];if(t.length===0){he.set(`selectedIndex`,null);return}let n=t[t.length-1],r=v7(e,n,S);he.set(`selectedIndex`,r===-1?null:r);return}let t=v7(e,z,S);he.set(`selectedIndex`,t===-1?null:t)},[v,V,z,ie,S,he]),e7(z,()=>{T(R),E(z!==A.initialValue),k()?P.commit(z):P.commit(z,!0)});let we=XT((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),F===`onBlur`&&P.commit(z)),!e&&he.state.activeIndex!==null)){let e=U.current[he.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Te=XT(()=>{de(!1),he.set(`activeIndex`,null),g?.(!1)});B4({enabled:!m,open:V,ref:W,onComplete(){V||Te()}}),b.useImperativeHandle(m,()=>({unmount:Te}),[Te]);let Ee=XT((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),De=XT(()=>{let e=he.state.listElement||W.current;if(!e)return;let t=e.scrollTop,n=e.scrollTop+e.clientHeight,r=t>1,i=n<e.scrollHeight-1;he.state.scrollUpArrowVisible!==r&&he.set(`scrollUpArrowVisible`,r),he.state.scrollDownArrowVisible!==i&&he.set(`scrollDownArrowVisible`,i)}),Oe=j5({open:V,onOpenChange:we,elements:{reference:ve,floating:ye}}),{getReferenceProps:ke,getFloatingProps:Ae,getItemProps:je}=F5([s8(Oe,{enabled:!d&&!L,event:`mousedown`}),d8(Oe,{bubbles:!1}),Zre(Oe,{enabled:!d&&!L,listRef:U,activeIndex:ge,selectedIndex:_e,disabledIndices:EE,onNavigate(e){e===null&&!V||he.set(`activeIndex`,e)},focusItemOnHover:!1}),$re(Oe,{enabled:!d&&!L&&(V||!v),listRef:ee,activeIndex:ge,selectedIndex:_e,onMatch(e){V?he.set(`activeIndex`,e):Ee(ie.current[e],g0(`none`))},onTypingChange(e){ae.current=e}})]),Me=b.useMemo(()=>$T(ke(),me,I?{id:I}:DE),[ke,me,I]);Y5(()=>{he.update({popupProps:Ae(),triggerProps:Me})}),$(()=>{he.update({id:I,modal:p,multiple:v,value:z,open:V,mounted:ue,transitionStatus:fe,popupProps:Ae(),triggerProps:Me,items:_,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:S,openMethod:pe})},[he,I,p,v,z,V,ue,fe,Ae,Me,_,y,x,S,pe]);let Ne=b.useMemo(()=>({store:he,name:R,required:f,disabled:L,readOnly:d,multiple:v,itemToStringLabel:y,itemToStringValue:x,highlightItemOnHover:C,setValue:Ee,setOpen:we,listRef:U,popupRef:W,scrollHandlerRef:te,handleScrollArrowVisibility:De,scrollArrowsMountedCountRef:ne,getItemProps:je,events:Oe.context.events,valueRef:re,valuesRef:ie,labelsRef:ee,typingRef:ae,selectionRef:ce,selectedItemTextRef:se,validation:P,onOpenChangeComplete:g,keyboardActiveRef:oe,alignItemWithTriggerActiveRef:le,initialValueRef:Ce}),[he,R,f,L,d,v,y,x,C,Ee,we,je,Oe.context.events,P,g,De]),Pe=hE(h,P.inputRef),Fe=v&&Array.isArray(z)&&z.length>0,Ie=v?void 0:R,Le=b.useMemo(()=>!v||!Array.isArray(z)||!R?null:z.map(e=>{let t=x7(e,x);return(0,G.jsx)(`input`,{type:`hidden`,name:R,value:t},t)}),[v,z,R,x]);return(0,G.jsx)(p7.Provider,{value:Ne,children:(0,G.jsxs)(m7.Provider,{value:Oe,children:[w,(0,G.jsx)(`input`,{...P.getInputValidationProps({onFocus(){he.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.value,n=g0(a0,e.nativeEvent);function r(){if(v)return;let e=ie.current.find(e=>x7(e,x).toLowerCase()===t.toLowerCase());e!=null&&(E(e!==A.initialValue),Ee(e,n),k()&&P.commit(e))}he.set(`forceMount`,!0),queueMicrotask(r)}}),id:I&&Ie==null?`${I}-hidden-input`:void 0,name:Ie,autoComplete:l,value:be,disabled:L,required:f&&!Fe,readOnly:d,ref:Pe,style:R?b6:y6,tabIndex:-1,"aria-hidden":!0}),Le]})})}function Zie(e,t){return e??t}function Qie(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,`::before`),r=window.getComputedStyle(e,`::after`);if(!(n.content!==`none`||r.content!==`none`))return t;let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,s=parseFloat(r.height)||0,c=Math.max(t.width,i,o),l=Math.max(t.height,a,s),u=c-t.width,d=l-t.height;return{left:t.left-u/2,right:t.right+u/2,top:t.top-d/2,bottom:t.bottom+d/2}}var w7=2,$ie=400,T7=200,eae={...i6,...o7,value:()=>null},tae=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{setTouched:c,setFocused:l,validationMode:u,state:d,disabled:f}=s7(),{labelId:p}=l7(),{store:m,setOpen:h,selectionRef:g,validation:_,readOnly:v,required:y,alignItemWithTriggerActiveRef:x,disabled:S,keyboardActiveRef:C}=h7(),w=f||S||a,T=x5(m,C7.open),E=x5(m,C7.value),D=x5(m,C7.triggerProps),O=x5(m,C7.positionerElement),k=x5(m,C7.listElement),A=x5(m,C7.id),j=x5(m,C7.labelId),M=x5(m,C7.hasSelectedValue),N=!M&&T,P=x5(m,C7.hasNullItemLabel,N),F=i??A,I=Zie(p,j);u7({id:F});let L=g6(O),R=b.useRef(null),{getButtonProps:z,buttonRef:B}=fE({disabled:w,native:o}),V=hE(t,R,B,XT(e=>{m.set(`triggerElement`,e)})),H=d6(),U=d6(),ee=d6(),W=d6();b.useEffect(()=>{if(T)return M||P?W.start(T7,()=>{g.current.allowUnselectedMouseUp=!0,ee.start(T7,()=>{g.current.allowSelectedMouseUp=!0})}):ee.start($ie,()=>{g.current.allowUnselectedMouseUp=!0,g.current.allowSelectedMouseUp=!0}),()=>{ee.clear(),W.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},U.clear()},[T,M,P,g,U,ee,W]);let te=b.useMemo(()=>k?.id??U0(O)?.id,[k,O]),ne=$T(D,{id:F,role:`combobox`,"aria-expanded":T?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":T?te:void 0,"aria-labelledby":I,"aria-readonly":v||void 0,"aria-required":y||void 0,tabIndex:w?-1:0,ref:V,onFocus(e){l(!0),T&&x.current&&h(!1,g0(a0,e.nativeEvent)),H.start(0,()=>{m.set(`forceMount`,!0)})},onBlur(e){I0(O,e.relatedTarget)||(c(!0),l(!1),u===`onBlur`&&_.commit(E))},onPointerMove(){C.current=!1},onKeyDown(){C.current=!0},onMouseDown(e){if(T)return;let t=q1(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(I0(R.current,t)||I0(L.current,t)||t===R.current)return;let n=Qie(R.current);e.clientX>=n.left-w7&&e.clientX<=n.right+w7&&e.clientY>=n.top-w7&&e.clientY<=n.bottom+w7||h(!1,g0($ne,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},_.getValidationProps,s,z);ne.role=`combobox`;let re={...d,open:T,disabled:w,value:E,readOnly:v,placeholder:!M};return NE(`button`,e,{ref:[t,R],state:re,stateAttributesMapping:eae,props:ne})}),nae={value:()=>null},rae=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,...o}=e,{store:s,valueRef:c}=h7(),l=x5(s,C7.value),u=x5(s,C7.items),d=x5(s,C7.itemToStringLabel),f=x5(s,C7.hasSelectedValue),p=!f&&a!=null&&i==null,m=x5(s,C7.hasNullItemLabel,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(!f&&a!=null&&!m?a:Array.isArray(l)?Yie(l,u,d):S7(l,u,d)),NE(`span`,e,{state:h,ref:[t,c],props:[{children:g},o],stateAttributesMapping:nae})}),iae=b.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a}=h7();return NE(`span`,e,{state:{open:x5(a,C7.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},i],stateAttributesMapping:r6})}),aae=b.createContext(void 0),oae=b.forwardRef(function(e,t){let{store:n}=h7(),r=x5(n,C7.mounted),i=x5(n,C7.forceMount);return r||i?(0,G.jsx)(aae.Provider,{value:!0,children:(0,G.jsx)(V6,{ref:t,...e})}):null}),sae=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,offsetParent:d=`real`}=o2(e,t)||{};if(l==null)return{};let f=w2(u),p={x:n,y:r},m=f2(i),h=u2(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=a2(k,j,A),N=!c.arrow&&c2(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),cae=(e,t)=>({...sae(e),options:[e,t]}),lae={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await cre().fn(e)).data?.referenceHidden||a}}}},E7={sideX:`left`,sideY:`top`},uae={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=OT(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:E7};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=q1(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=s2(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:E7.sideX,g=f===`top`?`bottom`:E7.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function D7(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function O7(e,t,n){let{rects:r,placement:i}=e;return{side:D7(t,s2(i),n),align:c2(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function k7(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=XT(D),k=D?O:t,A=g6(t),j=V1()===`rtl`,M=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":j?`left`:`right`,"inline-start":j?`right`:`left`}[r],N=a===`center`?M:`${M}-${a}`,P=c,F=r===`bottom`?1:0,I=r===`top`?1:0,L=r===`right`?1:0,R=r===`left`?1:0;typeof P==`number`?P={top:P+F,right:P+R,bottom:P+I,left:P+L}:P&&={top:(P.top||0)+F,right:(P.right||0)+R,bottom:(P.bottom||0)+I,left:(P.left||0)+L};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:P},B=b.useRef(null),V=g6(i),H=g6(o),U=[rre(e=>{let t=O7(e,r,j),n=typeof V.current==`function`?V.current(t):V.current,i=typeof H.current==`function`?H.current(t):H.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,j,r])],ee=T===`none`&&w!==`shift`,W=!ee&&(l||g||w===`shift`),te=w===`none`?null:ore({...z,padding:{top:P.top+1,right:P.right+1,bottom:P.bottom+1,left:P.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ne=ee?null:ire(e=>{let t=q1(e.elements.floating).documentElement;return{...z,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:W,limiter:l||g?void 0:are(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=d2(s2(e.placement)),i=r===`y`?t:n,a=r===`y`?P.left+P.right:P.top+P.bottom;return{offset:i/2+a/2}})}},[z,l,g,P,T]);w===`shift`||T===`shift`||a===`center`?U.push(ne,te):U.push(te,ne),U.push(sre({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=window.devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),cae(()=>({element:B.current||document.createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=s2(a),l=d2(c),u=B.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(O7(e,r,j)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,W&&l===`y`&&b?S:x),{}}},lae,v),$(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);let re=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ie,elements:ae,x:oe,y:se,middlewareData:ce,update:le,placement:ue,context:de,isPositioned:fe,floatingStyles:pe}=Bre({rootContext:p,placement:N,middleware:U,strategy:n,whileElementsMounted:f?void 0:(...e)=>t5(...e,re),nodeId:_,externalTree:x}),{sideX:me,sideY:he}=ce.adaptiveOrigin||E7,ge=fe?n:`fixed`,_e=b.useMemo(()=>{let e=v?{position:ge,[me]:oe,[he]:se}:{position:ge,...pe};return fe||(e.opacity=0),e},[v,ge,me,oe,he,se,pe,fe]),ve=b.useRef(null);$(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(A7(t)?t.current:t)||null;n!==ve.current&&(ie.setPositionReference(n),ve.current=n)},[m,ie,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&A7(e)&&e.current!==ve.current&&(ie.setPositionReference(e.current),ve.current=e.current)},[m,ie,k,A]),b.useEffect(()=>{if(f&&m&&ae.domReference&&ae.floating)return t5(ae.domReference,ae.floating,le,re)},[f,m,ae,le,re]);let ye=s2(ue),be=D7(r,ye,j),xe=c2(ue)||`center`,Se=!!ce.hide?.referenceHidden;$(()=>{y&&m&&fe&&C(ye)},[y,m,fe,ye]);let Ce=b.useMemo(()=>({position:`absolute`,top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),we=ce.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:_e,arrowStyles:Ce,arrowRef:B,arrowUncentered:we,side:be,align:xe,physicalSide:ye,anchorHidden:Se,refs:ie,context:de,isPositioned:fe,update:le}),[_e,Ce,B,we,be,xe,ye,Se,ie,de,fe,le])}function A7(e){return e!=null&&`current`in e}var j7=b.createContext(void 0);function M7(){let e=b.useContext(j7);if(!e)throw Error(cE(59));return e}function N7(e){return e===`starting`?OE:DE}function P7(e,t){e&&Object.assign(e.style,t)}var F7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},dae={position:`fixed`},fae=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=AE,..._}=e,{store:v,listRef:y,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D}=h7(),O=g7(),k=x5(v,C7.open),A=x5(v,C7.mounted),j=x5(v,C7.modal),M=x5(v,C7.value),N=x5(v,C7.openMethod),P=x5(v,C7.positionerElement),F=x5(v,C7.triggerElement),I=x5(v,C7.isItemEqualToValue),L=x5(v,C7.transitionStatus),R=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),H=A&&B&&N!==`touch`;!A&&B!==h&&V(h),$(()=>{A||(C7.scrollUpArrowVisible(v.state)&&v.set(`scrollUpArrowVisible`,!1),C7.scrollDownArrowVisible(v.state)&&v.set(`scrollDownArrowVisible`,!1))},[v,A]),b.useImperativeHandle(S,()=>H),$5((H||j)&&k&&N!==`touch`,F);let U=k7({anchor:n,floatingRootContext:O,positionMethod:r,mounted:A,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),ee=H?`none`:U.side,W=H?dae:U.positionerStyles,te=b.useMemo(()=>{let e={};return k||(e.pointerEvents=`none`),{role:`presentation`,hidden:!A,style:{...W,...e}}},[k,A,W]),ne={open:k,side:ee,align:U.align,anchorHidden:U.anchorHidden},re=NE(`div`,e,{ref:[t,XT(e=>{v.set(`positionerElement`,e)})],state:ne,stateAttributesMapping:a6,props:[te,N7(L),_]}),ie=b.useRef(0),ae=XT(e=>{if(e.size===0&&ie.current===0||w.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=g0(a0);if(t!==0&&!v.state.multiple&&M!==null&&v7(w.current,M,I)===-1){let e=T.current,t=e!=null&&v7(w.current,e,I)!==-1?e:null;D(t,n),t===null&&(v.set(`selectedIndex`,null),C.current=null)}if(t!==0&&v.state.multiple&&Array.isArray(M)){let e=e=>v7(w.current,e,I)!==-1,t=M.filter(t=>e(t));(t.length!==M.length||t.some(e=>!Gie(M,e,I)))&&(D(t,n),t.length===0&&(v.set(`selectedIndex`,null),C.current=null))}if(k&&H){v.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};P7(P,e),P7(E.current,e)}}),oe=b.useMemo(()=>({...U,side:ee,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:R,scrollDownArrowRef:z}),[U,ee,H,V]);return(0,G.jsx)(I1,{elementsRef:y,labelsRef:x,onMapChange:ae,children:(0,G.jsxs)(j7.Provider,{value:oe,children:[A&&j&&(0,G.jsx)(J5,{inert:k4(!k),cutout:F}),re]})})});function I7(e){let t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}var L7=`base-ui-disable-scrollbar`,R7={className:L7,getElement(e){return(0,G.jsx)(`style`,{nonce:e,href:L7,precedence:`base-ui:low`,children:`.${L7}{scrollbar-width:none}.${L7}::-webkit-scrollbar{display:none}`})}},pae=b.createContext(void 0);function z7(e){let t=b.useContext(pae);if(t===void 0&&!e)throw Error(cE(69));return t}function B7(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var V7=1,mae={...a6,...N4},hae=b.forwardRef(function(e,t){let{render:n,className:r,finalFocus:i,...a}=e,{store:o,popupRef:s,onOpenChangeComplete:c,setOpen:l,valueRef:u,selectedItemTextRef:d,keyboardActiveRef:f,multiple:p,handleScrollArrowVisibility:m,scrollHandlerRef:h,highlightItemOnHover:g}=h7(),{side:_,align:v,alignItemWithTriggerActive:y,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:S,scrollUpArrowRef:C}=M7(),w=z7(!0)!=null,T=g7(),{nonce:E,disableStyleElements:D}=O4(),O=d6(),k=x5(o,C7.id),A=x5(o,C7.open),j=x5(o,C7.mounted),M=x5(o,C7.popupProps),N=x5(o,C7.transitionStatus),P=x5(o,C7.triggerElement),F=x5(o,C7.positionerElement),I=x5(o,C7.listElement),L=b.useRef(0),R=b.useRef(!1),z=b.useRef(0),B=b.useRef(!1),V=b.useRef({}),H=L4(),U=XT(e=>{if(!F||!s.current||!B.current)return;if(R.current||!y){m();return}let t=F.style.top===`0px`,n=F.style.bottom===`0px`,r=F.getBoundingClientRect().height,i=q1(F),a=getComputedStyle(F),o=parseFloat(a.marginTop),c=parseFloat(a.marginBottom),l=H7(getComputedStyle(s.current)),u=Math.min(i.documentElement.clientHeight-o-c,l),d=e.scrollTop,f=U7(e),p=0,h=null,g=!1,_=!1,v=e=>{F.style.height=`${e}px`},b=(t,n)=>{let i=B7(t,0,u-r);i>0&&v(r+i),e.scrollTop=n,u-(r+i)<=V7&&(R.current=!0),m()};if(t){let e=f-d,t=r+e,n=Math.min(t,u);if(p=n,e<=V7){b(e,f);return}u-n>V7?_=!0:g=!0}else if(n){let e=d,t=r+e,n=Math.min(t,u),i=t-u;if(p=n,e<=V7){b(e,0);return}u-n>V7?h=0:(g=!0,d<f&&(h=d-(e-i)))}if(p=Math.ceil(p),p!==0&&v(p),_||h!=null){let t=U7(e),n=_?t:B7(h,0,t);Math.abs(e.scrollTop-n)>V7&&(e.scrollTop=n)}(g||p>=u-V7)&&(R.current=!0),m()});b.useImperativeHandle(h,()=>U,[U]),B4({open:A,ref:s,onComplete(){A&&c?.(!0)}});let ee={open:A,transitionStatus:N,side:_,align:v};$(()=>{!F||!s.current||Object.keys(V.current).length||(V.current={top:F.style.top||`0`,left:F.style.left||`0`,right:F.style.right,height:F.style.height,bottom:F.style.bottom,minHeight:F.style.minHeight,maxHeight:F.style.maxHeight,marginTop:F.style.marginTop,marginBottom:F.style.marginBottom})},[s,F]),$(()=>{A||y||(B.current=!1,R.current=!1,L.current=0,z.current=0,P7(F,V.current))},[A,y,F,s]),$(()=>{let e=s.current;if(!(!A||!P||!F||!e||o.state.transitionStatus===`ending`)){if(!y){B.current=!0,H.request(m),e.style.removeProperty(`--transform-origin`);return}queueMicrotask(()=>{let t=_ae(e);e.style.removeProperty(`--transform-origin`);try{let t=getComputedStyle(F),n=getComputedStyle(e),r=q1(P),i=OT(F),a=gae(P),o=W7(P.getBoundingClientRect(),a),s=W7(F.getBoundingClientRect(),a),c=o.left,l=o.height,f=I||e,p=f.scrollHeight,h=parseFloat(n.borderBottomWidth),g=parseFloat(t.marginTop)||10,_=parseFloat(t.marginBottom)||10,v=parseFloat(t.minHeight)||100,y=H7(n),b=r.documentElement.clientHeight-g-_,S=r.documentElement.clientWidth,C=b-o.bottom+l,w=d.current,T=u.current,E,D=0,O=0;if(w&&T){let e=W7(T.getBoundingClientRect(),a);E=W7(w.getBoundingClientRect(),a);let t=e.left-c,n=E.left-s.left,r=e.top-o.top+e.height/2,i=E.top-s.top+E.height/2;D=t-n,O=i-r}let k=C+O+_+h,A=Math.min(b,k),j=b-g-_,M=k-A,N=Math.max(5,c+D),z=S-5,H=Math.max(0,N+s.width-z);F.style.left=`${N-H}px`,F.style.height=`${A}px`,F.style.maxHeight=`auto`,F.style.marginTop=`${g}px`,F.style.marginBottom=`${_}px`,e.style.height=`100%`;let U=U7(f),ee=M>=U-V7;ee&&(A=Math.min(b,s.height)-(M-U));let W=o.top<20||o.bottom>b-20||Math.ceil(A)+V7<Math.min(p,v),te=(i.visualViewport?.scale??1)!==1&&x0;if(W||te){B.current=!0,P7(F,V.current),Vq.flushSync(()=>x(!1));return}if(ee){let e=Math.max(0,b-k);F.style.top=s.height>=j?`0`:`${e}px`,F.style.height=`${A}px`,f.scrollTop=U7(f),L.current=Math.max(v,A)}else F.style.bottom=`0`,L.current=Math.max(v,A),f.scrollTop=M;if(E){let t=s.top,n=s.height,r=E.top+E.height/2,i=B7(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(L.current===b||A>=y)&&(R.current=!0),m(),setTimeout(()=>{B.current=!0})}finally{t()}})}},[o,A,F,P,u,d,s,m,y,x,H,S,C,I]),b.useEffect(()=>{if(!y||!F||!A)return;let e=OT(F);function t(e){l(!1,g0(h0,e))}return e.addEventListener(`resize`,t),()=>{e.removeEventListener(`resize`,t)}},[l,y,F,A]);let W={...I?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":p||void 0,id:`${k}-list`},onKeyDown(e){f.current=!0,w&&r3.has(e.key)&&e.stopPropagation()},onMouseMove(){f.current=!1},onPointerLeave(e){if(!g||I7(e)||e.pointerType===`touch`)return;let t=e.currentTarget;O.start(0,()=>{o.set(`activeIndex`,null),t.focus({preventScroll:!0})})},onScroll(e){I||U(e.currentTarget)},...y&&{style:I?{height:`100%`}:F7}},te=NE(`div`,e,{ref:[t,s],state:ee,stateAttributesMapping:mae,props:[M,W,N7(N),{className:!I&&y?R7.className:void 0},a]});return(0,G.jsxs)(b.Fragment,{children:[!D&&R7.getElement(E),(0,G.jsx)(o8,{context:T,modal:!1,disabled:!j,returnFocus:i,restoreFocus:!0,children:te})]})});function H7(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function U7(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function gae(e){return Q8.getScale(e)}function W7(e,t){return T2({x:e.x/t.x,y:e.y/t.y,width:e.width/t.x,height:e.height/t.y})}var G7=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function _ae(e){let{style:t}=e,n={};for(let[e,r]of G7)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of G7){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var vae=b.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a,scrollHandlerRef:o}=h7(),{alignItemWithTriggerActive:s}=M7(),c=x5(a,C7.hasScrollArrows),l=x5(a,C7.openMethod),u=x5(a,C7.multiple),d={id:`${x5(a,C7.id)}-list`,role:`listbox`,"aria-multiselectable":u||void 0,onScroll(e){o.current?.(e.currentTarget)},...s&&{style:F7},className:c&&l!==`touch`?R7.className:void 0};return NE(`div`,e,{ref:[t,XT(e=>{a.set(`listElement`,e)})],props:[d,i]})}),K7=b.createContext(void 0);function q7(){let e=b.useContext(K7);if(!e)throw Error(cE(57));return e}var yae=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,...c}=e,l=b.useRef(null),u=t0({label:a,textRef:l,indexGuessBehavior:e0.GuessFromOrder}),{store:d,getItemProps:f,setOpen:p,setValue:m,selectionRef:h,typingRef:g,valuesRef:_,keyboardActiveRef:v,multiple:y,highlightItemOnHover:x}=h7(),S=d6(),C=x5(d,C7.isActive,u.index),w=x5(d,C7.isSelected,u.index,i),T=x5(d,C7.isSelectedByFocus,u.index),E=x5(d,C7.isItemEqualToValue),D=u.index,O=D!==-1,k=b.useRef(null),A=g6(D);$(()=>{if(!O)return;let e=_.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,_]),$(()=>{if(!O)return;let e=d.state.value,t=e;y&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&_7(i,t,E)&&d.set(`selectedIndex`,D)},[O,D,y,E,d,i]);let j={disabled:o,selected:w,highlighted:C},M=f({active:C,selected:w});M.onFocus=void 0,M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=fE({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function R(e){let t=d.state.value;if(y){let n=Array.isArray(t)?t:[];m(w?Kie(n,i,E):[...n,i],g0(l0,e))}else m(i,g0(l0,e)),p(!1,g0(l0,e))}let z={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onFocus(){d.set(`activeIndex`,D)},onMouseEnter(){!v.current&&d.state.selectedIndex===null&&x&&d.set(`activeIndex`,D)},onMouseMove(){x&&d.set(`activeIndex`,D)},onMouseLeave(e){!x||v.current||I7(e)||S.start(0,()=>{d.state.activeIndex===D&&d.set(`activeIndex`,null)})},onTouchStart(){h.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,d.set(`activeIndex`,D),e.key===` `&&g.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&g.current||P.current!==`touch`&&!C||(N.current=null,R(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!h.current.allowSelectedMouseUp&&w,t=!h.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},B=NE(`div`,e,{ref:[L,t,u.ref,k],state:j,props:[M,z,c,I]}),V=b.useMemo(()=>({selected:w,indexRef:A,textRef:l,selectedByFocus:T,hasRegistered:O}),[w,A,l,T,O]);return(0,G.jsx)(K7.Provider,{value:V,children:B})})),bae=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=q7();return n||r?(0,G.jsx)(xae,{...e,ref:t}):null}),xae=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,keepMounted:i,...a}=e,{selected:o}=q7(),s=b.useRef(null),{transitionStatus:c,setMounted:l}=V4(o),u=NE(`span`,e,{ref:[t,s],state:{selected:o,transitionStatus:c},props:[{"aria-hidden":!0,children:`✔️`},a],stateAttributesMapping:N4});return B4({open:o,ref:s,onComplete(){o||l(!1)}}),u})),Sae=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=q7(),{selectedItemTextRef:o}=h7(),{className:s,render:c,...l}=e;return NE(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:l})})),J7=b.forwardRef(function(e,t){let{render:n,className:r,direction:i,keepMounted:a=!1,...o}=e,{store:s,popupRef:c,listRef:l,handleScrollArrowVisibility:u,scrollArrowsMountedCountRef:d}=h7(),{side:f,scrollDownArrowRef:p,scrollUpArrowRef:m}=M7(),h=x5(s,i===`up`?C7.scrollUpArrowVisible:C7.scrollDownArrowVisible),g=x5(s,C7.openMethod),_=h&&g!==`touch`,v=d6(),y=i===`up`?m:p,{transitionStatus:b,setMounted:x}=V4(_);$(()=>(d.current+=1,s.state.hasScrollArrows||s.set(`hasScrollArrows`,!0),()=>{d.current=Math.max(0,d.current-1),d.current===0&&s.state.hasScrollArrows&&s.set(`hasScrollArrows`,!1)}),[s,d]),B4({open:_,ref:y,onComplete(){_||x(!1)}});let S=NE(`div`,e,{ref:[t,y],state:{direction:i,visible:_,side:f,transitionStatus:b},props:[{"aria-hidden":!0,children:i===`up`?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||v.isStarted())return;s.set(`activeIndex`,null);function t(){let e=s.state.listElement??c.current;if(!e)return;s.set(`activeIndex`,null),u();let n=e.scrollTop===0,r=Math.round(e.scrollTop+e.clientHeight)>=e.scrollHeight;if(l.current.length===0&&(i===`up`?s.set(`scrollUpArrowVisible`,!n):s.set(`scrollDownArrowVisible`,!r)),i===`up`&&n||i===`down`&&r){v.clear();return}if((s.state.listElement||c.current)&&l.current&&l.current.length>0){let t=l.current,n=y.current?.offsetHeight||0;if(i===`up`){let r=0,i=e.scrollTop+n;for(let e=0;e<t.length;e+=1){let n=t[e];if(n&&n.offsetTop>=i){r=e;break}}let a=Math.max(0,r-1);if(a<r){let r=t[a];r&&(e.scrollTop=Math.max(0,r.offsetTop-n))}else e.scrollTop=0}else{let r=t.length-1,i=e.scrollTop+e.clientHeight-n;for(let e=0;e<t.length;e+=1){let n=t[e];if(n&&n.offsetTop+n.offsetHeight>i){r=Math.max(0,e-1);break}}let a=Math.min(t.length-1,r+1);if(a>r){let r=t[a];r&&(e.scrollTop=r.offsetTop+r.offsetHeight-e.clientHeight+n)}else e.scrollTop=e.scrollHeight-e.clientHeight}}v.start(40,t)}v.start(40,t)},onMouseLeave(){v.clear()}},o]});return _||a?S:null}),Cae=b.forwardRef(function(e,t){return(0,G.jsx)(J7,{...e,ref:t,direction:`down`})}),wae=b.forwardRef(function(e,t){return(0,G.jsx)(J7,{...e,ref:t,direction:`up`})}),Tae=b.createContext(void 0),Eae=b.forwardRef(function(e,t){let{className:n,render:r,...i}=e,[a,o]=b.useState(),s=b.useMemo(()=>({labelId:a,setLabelId:o}),[a,o]),c=NE(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":a},i]});return(0,G.jsx)(Tae.Provider,{value:s,children:c})}),Y7=Xie;function X7({className:e,...t}){return(0,G.jsx)(Eae,{"data-slot":`select-group`,className:uO(`scroll-my-1`,e),...t})}function Z7({className:e,...t}){return(0,G.jsx)(rae,{"data-slot":`select-value`,className:uO(`flex flex-1 text-left`,e),...t})}function Q7({className:e,size:t=`default`,children:n,...r}){return(0,G.jsxs)(tae,{"data-slot":`select-trigger`,"data-size":t,className:uO(`border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-none border bg-transparent py-2 pr-2 pl-2.5 text-xs transition-colors select-none focus-visible:ring-1 aria-invalid:ring-1 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-none *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...r,children:[n,(0,G.jsx)(iae,{render:(0,G.jsx)(nn,{className:`text-muted-foreground size-4 pointer-events-none`})})]})}function $7({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,G.jsx)(oae,{children:(0,G.jsx)(fae,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,G.jsxs)(hae,{"data-slot":`select-content`,className:uO(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 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 ring-foreground/10 min-w-36 rounded-none shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto`,e),...s,children:[(0,G.jsx)(Dae,{}),(0,G.jsx)(vae,{children:t}),(0,G.jsx)(Oae,{})]})})})}function e9({className:e,children:t,...n}){return(0,G.jsxs)(yae,{"data-slot":`select-item`,className:uO(`focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2 rounded-none py-2 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...n,children:[(0,G.jsx)(Sae,{className:`flex flex-1 gap-2 shrink-0 whitespace-nowrap`,children:t}),(0,G.jsx)(bae,{render:(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,G.jsx)(tn,{className:`pointer-events-none`})})]})}function Dae({className:e,...t}){return(0,G.jsx)(wae,{"data-slot":`select-scroll-up-button`,className:uO(`bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full`,e),...t,children:(0,G.jsx)(rn,{})})}function Oae({className:e,...t}){return(0,G.jsx)(Cae,{"data-slot":`select-scroll-down-button`,className:uO(`bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full`,e),...t,children:(0,G.jsx)(nn,{})})}var t9=b.createContext(void 0);function kae(){let e=b.useContext(t9);if(e===void 0)throw Error(cE(63));return e}var n9=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),r9={...o7,checked(e){return e?{[n9.checked]:``}:{[n9.unchecked]:``}}};function Aae(e,t,n,r=!0,i){let[a,o]=b.useState(),s=Q1(i?`${i}-label`:void 0),c=e??t??a;return $(()=>{let i=e||t||!r?void 0:jae(n.current,s);a!==i&&o(i)}),c}function jae(e,t){let n=Mae(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Mae(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var Nae=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,id:o,inputRef:s,name:c,nativeButton:l=!1,onCheckedChange:u,readOnly:d=!1,required:f=!1,disabled:p=!1,render:m,uncheckedValue:h,value:g,..._}=e,{clearErrors:v}=c7(),{state:y,setTouched:x,setDirty:S,validityData:C,setFilled:w,setFocused:T,shouldValidateOnChange:E,validationMode:D,disabled:O,name:k,validation:A}=s7(),{labelId:j}=l7(),M=O||p,N=k??c,P=XT(u),F=b.useRef(null),I=hE(F,s,A.inputRef),L=b.useRef(null),R=Q1(),z=u7({id:o,implicit:!1,controlRef:L}),B=l?void 0:z,[V,H]=N1({controlled:n,default:!!i,name:`Switch`,state:`checked`});d7({id:R,commit:A.commit,value:V,controlRef:L,name:N,getValue:()=>V}),$(()=>{F.current&&w(F.current.checked)},[F,w]),e7(V,()=>{v(N),S(V!==C.initialValue),w(V),E()?A.commit(V):A.commit(V,!0)});let{getButtonProps:U,buttonRef:ee}=fE({disabled:M,native:l}),W=Aae(a,j,F,!l,B),te={id:l?z:R,role:`switch`,"aria-checked":V,"aria-readonly":d||void 0,"aria-required":f||void 0,"aria-labelledby":W,onFocus(){M||T(!0)},onBlur(){let e=F.current;!e||M||(x(!0),T(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){d||M||(e.preventDefault(),F.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ne=b.useMemo(()=>$T({checked:V,disabled:M,id:B,name:N,required:f,style:N?b6:y6,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:I,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=g0(a0,e.nativeEvent);P?.(t,n),!n.isCanceled&&H(t)},onFocus(){L.current?.focus()}},A.getInputValidationProps,g===void 0?DE:{value:g}),[V,M,I,B,N,P,f,H,A,g]),re=b.useMemo(()=>({...y,checked:V,disabled:M,readOnly:d,required:f}),[y,V,M,d,f]),ie=NE(`span`,e,{state:re,ref:[t,L,ee],props:[te,A.getValidationProps,_,U],stateAttributesMapping:r9});return(0,G.jsxs)(t9.Provider,{value:re,children:[ie,!V&&N&&h!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,name:N,value:h}),(0,G.jsx)(`input`,{...ne})]})}),Pae=b.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=s7(),o=kae();return NE(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:r9,props:i})});function i9({className:e,size:t=`default`,...n}){return(0,G.jsx)(Nae,{"data-slot":`switch`,"data-size":t,className:uO(`cursor-pointer data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-1 aria-invalid:ring-1 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,G.jsx)(Pae,{"data-slot":`switch-thumb`,className:`bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform`})})}function Fae({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:uO(`border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 h-8 rounded-none border transition-colors has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot][aria-invalid=true]]:ring-1 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,e),...t})}var Iae=UE(`text-muted-foreground h-auto gap-2 py-1.5 text-xs font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-none [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none`,{variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last`,"block-start":`px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}});function Lae({className:e,align:t=`inline-start`,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:uO(Iae({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}function Rae({className:e,...t}){return(0,G.jsx)(a1,{"data-slot":`command`,className:uO(`bg-popover text-popover-foreground rounded-none flex size-full flex-col overflow-hidden`,e),...t})}function zae({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`border-b pb-0`,children:(0,G.jsxs)(Fae,{className:`bg-input/30 border-input/30 h-8 border-none shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,G.jsx)(a1.Input,{"data-slot":`command-input`,className:uO(`w-full text-xs outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,G.jsx)(Lae,{children:(0,G.jsx)(pn,{className:`size-4 shrink-0 opacity-50`})})]})})}function Bae({className:e,...t}){return(0,G.jsx)(a1.List,{"data-slot":`command-list`,className:uO(`no-scrollbar max-h-72 scroll-py-0 outline-none overflow-x-hidden overflow-y-auto`,e),...t})}function Vae({className:e,...t}){return(0,G.jsx)(a1.Empty,{"data-slot":`command-empty`,className:uO(`py-6 text-center text-xs`,e),...t})}function Hae({className:e,...t}){return(0,G.jsx)(a1.Group,{"data-slot":`command-group`,className:uO(`text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs`,e),...t})}function Uae({className:e,children:t,...n}){return(0,G.jsxs)(a1.Item,{"data-slot":`command-item`,className:uO(`data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none [&_svg:not([class*='size-'])]:size-4 in-data-[slot=dialog-content]:rounded-none! group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...n,children:[t,(0,G.jsx)(tn,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var a9=b.createContext(void 0);function o9(e){let t=b.useContext(a9);if(t===void 0&&!e)throw Error(cE(47));return t}function Wae(){return{...O5(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Gae={...A5,disabled:v5(e=>e.disabled),instantType:v5(e=>e.instantType),openMethod:v5(e=>e.openMethod),openChangeReason:v5(e=>e.openChangeReason),modal:v5(e=>e.modal),stickIfOpen:v5(e=>e.stickIfOpen),titleElementId:v5(e=>e.titleElementId),descriptionElementId:v5(e=>e.descriptionElementId),openOnHover:v5(e=>e.openOnHover),closeDelay:v5(e=>e.closeDelay),hasViewport:v5(e=>e.hasViewport)},Kae=class e extends C5{constructor(e){let t={...Wae(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new u6,triggerElements:new D5},Gae)}setOpen=(e,t)=>{let n=t.reason===s0,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let a={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit(`openchange`,a);let o=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Vq.flushSync(o)):o(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=JT(()=>new e(n)).current,i=t??r;return T4(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function s9({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Kae.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});Y5(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`positionerElement`),p=u.useState(`payload`),m=u.useState(`openChangeReason`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:h,triggerProps:g}=t7(d);T5(u);let{forceUnmount:_}=E5(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});$5(d&&o===!0&&m!==`trigger-hover`&&h!==`touch`,f),b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let v=b.useCallback(e=>{let t=g0(e);return t.preventUnmountOnClose=()=>{u.set(`preventUnmountingOnClose`,!0)},t},[u]),y=b.useCallback(()=>{u.setOpen(!1,v(m0))},[u,v]);b.useImperativeHandle(e.actionsRef,()=>({unmount:_,close:y}),[_,y]);let x=M5({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=F5([d8(x,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),V5(x)]),T=b.useMemo(()=>S(g),[S,g]),E=b.useMemo(()=>w(g),[w,g]),D=b.useMemo(()=>C(),[C]);u.useSyncedValues({modal:o,openMethod:h,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:x,nested:K6()!=null});let O=b.useMemo(()=>({store:u}),[u]);return(0,G.jsx)(a9.Provider,{value:O,children:typeof t==`function`?t({payload:p}):t})}function qae(e){return o9(!0)?(0,G.jsx)(s9,{props:e}):(0,G.jsx)(X6,{children:(0,G.jsx)(s9,{props:e})})}var Jae=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,...f}=e,p=o9(!0),m=o?.store??p?.store;if(!m)throw Error(cE(74));let h=Q1(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),v=m.useState(`isOpenedByTrigger`,h),y=b.useRef(null),{registerTrigger:x,isMountedByThisTrigger:S}=Rre(h,y,m,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),C=m.useState(`openChangeReason`),w=m.useState(`stickIfOpen`),T=m.useState(`openMethod`),E=qre(_,{enabled:_!=null&&c&&(T!==`touch`||C!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:nie(),restMs:l,delay:{close:u},triggerElementRef:y,isActiveTrigger:g}),D=F5([s8(_,{enabled:_!=null,stickIfOpen:w})]),O=m.useState(`triggerProps`,S),k={disabled:i,open:v},{getButtonProps:A,buttonRef:j}=fE({disabled:i,native:a}),M=b.useMemo(()=>({open(e){return e&&C===`trigger-press`?i6.open(e):r6.open(e)}}),[C]),N=NE(`button`,e,{state:k,ref:[j,t,x,y],props:[D.getReferenceProps(),E,O,{[kE]:``,id:h},f,A],stateAttributesMapping:M}),P=b.useRef(null),F=XT(e=>{Vq.flushSync(()=>{m.setOpen(!1,g0(d0,e.nativeEvent,e.currentTarget))}),y4(P.current)?.focus()}),I=XT(e=>{let t=m.select(`positionerElement`);if(t&&b4(e,t))m.context.beforeContentFocusGuardRef.current?.focus();else{Vq.flushSync(()=>{m.setOpen(!1,g0(d0,e.nativeEvent,e.currentTarget))});let n=v4(m.context.triggerFocusTargetRef.current||y.current);for(;n!==null&&I0(t,n);){let e=n;if(n=h4(n),n===e)break}n?.focus()}});return g?(0,G.jsxs)(b.Fragment,{children:[(0,G.jsx)(x6,{ref:P,onFocus:F}),(0,G.jsx)(b.Fragment,{children:N},h),(0,G.jsx)(x6,{ref:m.context.triggerFocusTargetRef,onFocus:I})]}):(0,G.jsx)(b.Fragment,{children:N},h)}),c9=b.createContext(void 0);function Yae(){let e=b.useContext(c9);if(e===void 0)throw Error(cE(45));return e}var Xae=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=o9();return i.useState(`mounted`)||n?(0,G.jsx)(c9.Provider,{value:n,children:(0,G.jsx)(V6,{ref:t,...r})}):null}),l9=b.createContext(void 0);function Zae(){let e=b.useContext(l9);if(!e)throw Error(cE(46));return e}var Qae=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=jE,...g}=e,{store:_}=o9(),v=Yae(),y=J6(),x=_.useState(`floatingRootContext`),S=_.useState(`mounted`),C=_.useState(`open`),w=_.useState(`openChangeReason`),T=_.useState(`activeTriggerElement`),E=_.useState(`modal`),D=_.useState(`positionerElement`),O=_.useState(`instantType`),k=_.useState(`transitionStatus`),A=_.useState(`hasViewport`),j=b.useRef(null),M=z4(D,!1,!1),N=k7({anchor:i,floatingRootContext:x,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:v,nodeId:y,collisionAvoidance:h,adaptiveOrigin:A?uae:void 0}),P=b.useMemo(()=>{let e={};return C||(e.pointerEvents=`none`),{role:`presentation`,hidden:!S,style:{...N.positionerStyles,...e}}},[C,S,N.positionerStyles]),F=b.useMemo(()=>({props:P,...N}),[P,N]),I=x.useState(`domReferenceElement`);$(()=>{let e=I,t=j.current;if(e&&(j.current=e),t&&e&&e!==t){_.set(`instantType`,void 0);let e=new AbortController;return M(()=>{_.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,M,_]);let L={open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:O},R=b.useCallback(e=>{_.set(`positionerElement`,e)},[_]),z=NE(`div`,e,{state:L,props:[F.props,N7(k),g],ref:[t,R],stateAttributesMapping:a6});return(0,G.jsxs)(l9.Provider,{value:F,children:[S&&E===!0&&w!==`trigger-hover`&&(0,G.jsx)(J5,{ref:_.context.internalBackdropRef,inert:k4(!C),cutout:T}),(0,G.jsx)(Y6,{id:y,children:z})]})}),$ae=b.createContext(void 0);function eoe(){let[e,t]=b.useState(0),n=XT(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function toe(e){let{value:t,children:n}=e;return(0,G.jsx)($ae.Provider,{value:t,children:n})}var noe={...a6,...N4},roe=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,...o}=e,{store:s}=o9(),c=Zae(),l=z7(!0)!=null,{context:u,hasClosePart:d}=eoe(),f=s.useState(`open`),p=s.useState(`openMethod`),m=s.useState(`instantType`),h=s.useState(`transitionStatus`),g=s.useState(`popupProps`),_=s.useState(`titleElementId`),v=s.useState(`descriptionElementId`),y=s.useState(`modal`),x=s.useState(`mounted`),S=s.useState(`openChangeReason`),C=s.useState(`activeTriggerElement`),w=s.useState(`floatingRootContext`);B4({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}});let T=s.useState(`disabled`),E=s.useState(`openOnHover`),D=s.useState(`closeDelay`);Gre(w,{enabled:E&&!T,closeDelay:D});function O(e){return e===`touch`?s.context.popupRef.current:!0}let k=i===void 0?O:i,A={open:f,side:c.side,align:c.align,instant:m,transitionStatus:h},j=y!==!1&&d,M=b.useCallback(e=>{s.set(`popupElement`,e)},[s]),N=NE(`div`,e,{state:A,ref:[t,s.context.popupRef,M],props:[g,{"aria-labelledby":_,"aria-describedby":v,onKeyDown(e){l&&r3.has(e.key)&&e.stopPropagation()}},N7(h),o],stateAttributesMapping:noe});return(0,G.jsx)(o8,{context:w,openInteractionType:p,modal:j,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:MT(C)?C:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:(0,G.jsx)(toe,{value:u,children:N})})});function ioe({...e}){return(0,G.jsx)(qae,{"data-slot":`popover`,...e})}function aoe({...e}){return(0,G.jsx)(Jae,{"data-slot":`popover-trigger`,...e})}function ooe({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,G.jsx)(Xae,{children:(0,G.jsx)(Qae,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,G.jsx)(roe,{"data-slot":`popover-content`,className:uO(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 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 ring-foreground/10 flex flex-col gap-2.5 rounded-none p-2.5 text-xs shadow-md ring-1 duration-100 z-50 w-72 origin-(--transform-origin) outline-hidden`,e),...a})})})}var u9=[{value:`en-US`,label:`English (US)`},{value:`es-ES`,label:`español (España)`},{value:`fr-FR`,label:`français (France)`},{value:`de-DE`,label:`Deutsch`},{value:`it-IT`,label:`italiano`},{value:`am-ET`,label:`አማርኛ`},{value:`ar`,label:`العربية`},{value:`bg-BG`,label:`български`},{value:`bn-BD`,label:`বাংলা`},{value:`bs-BA`,label:`bosanski`},{value:`ca-ES`,label:`català`},{value:`cs-CZ`,label:`čeština`},{value:`da-DK`,label:`dansk`},{value:`el-GR`,label:`Ελληνικά`},{value:`es-419`,label:`español (Latinoamérica)`},{value:`et-EE`,label:`eesti`},{value:`fi-FI`,label:`suomi`},{value:`fr-CA`,label:`français (Canada)`},{value:`gu-IN`,label:`ગુજરાતી`},{value:`hi-IN`,label:`हिन्दी`},{value:`hr-HR`,label:`hrvatski`},{value:`hu-HU`,label:`magyar`},{value:`hy-AM`,label:`հայերեն`},{value:`id-ID`,label:`Indonesia`},{value:`is-IS`,label:`íslenska`},{value:`ja-JP`,label:`日本語`},{value:`ka-GE`,label:`ქართული`},{value:`kk-KZ`,label:`қазақ тілі`},{value:`kn-IN`,label:`ಕನ್ನಡ`},{value:`ko-KR`,label:`한국어`},{value:`lt-LT`,label:`lietuvių`},{value:`lv-LV`,label:`latviešu`},{value:`mk-MK`,label:`македонски`},{value:`ml-IN`,label:`മലയാളം`},{value:`mn-MN`,label:`монгол`},{value:`mr-IN`,label:`मराठी`},{value:`ms-MY`,label:`Bahasa Melayu`},{value:`my-MM`,label:`မြန်မာ`},{value:`nb-NO`,label:`norsk bokmål`},{value:`nl-NL`,label:`Nederlands`},{value:`pa-IN`,label:`ਪੰਜਾਬੀ`},{value:`pl-PL`,label:`polski`},{value:`pt-BR`,label:`português (Brasil)`},{value:`pt-PT`,label:`português (Portugal)`},{value:`ro-RO`,label:`română`},{value:`ru-RU`,label:`русский`},{value:`sk-SK`,label:`slovenčina`},{value:`sl-SI`,label:`slovenščina`},{value:`so-SO`,label:`Soomaali`},{value:`sq-AL`,label:`shqip`},{value:`sr-RS`,label:`српски`},{value:`sv-SE`,label:`svenska`},{value:`sw-KE`,label:`Kiswahili`},{value:`ta-IN`,label:`தமிழ்`},{value:`te-IN`,label:`తెలుగు`},{value:`th-TH`,label:`ไทย`},{value:`tl-PH`,label:`Tagalog`},{value:`tr-TR`,label:`Türkçe`},{value:`uk-UA`,label:`українська`},{value:`ur-PK`,label:`اردو`},{value:`vi-VN`,label:`Tiếng Việt`},{value:`zh-Hans`,label:`简体中文`},{value:`zh-Hant-HK`,label:`繁體中文(香港)`},{value:`zh-Hant-TW`,label:`繁體中文(台灣)`}],soe=({value:e,onValueChange:t})=>{let[n,r]=(0,b.useState)(!1),i=u9.find(t=>t.value===e);return(0,G.jsxs)(ioe,{open:n,onOpenChange:r,children:[(0,G.jsx)(aoe,{children:(0,G.jsxs)(fO,{variant:`outline`,role:`combobox`,"aria-expanded":n,className:`w-full justify-between`,children:[i?(0,G.jsxs)(`span`,{children:[i.value,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`- `,i.label]})]}):`Select locale...`,(0,G.jsx)(an,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,G.jsx)(ooe,{className:`w-full p-0`,children:(0,G.jsxs)(Rae,{children:[(0,G.jsx)(zae,{placeholder:`Search locale...`}),(0,G.jsxs)(Bae,{children:[(0,G.jsx)(Vae,{children:`No locale found.`}),(0,G.jsx)(Hae,{children:u9.map(n=>(0,G.jsxs)(Uae,{value:n.value,onSelect:n=>{t(n===e?``:n),r(!1)},children:[(0,G.jsxs)(`span`,{children:[n.label,` `,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,n.value,`)`]})]}),(0,G.jsx)(tn,{className:uO(`ml-auto h-4 w-4`,e===n.value?`opacity-100`:`opacity-0`)})]},n.value))})]})]})})]})};function coe({resourceUri:e}){let{data:t}=TT(e);return t?(0,G.jsx)(`div`,{className:`text-xs`,children:(0,G.jsx)(q3,{src:t.contents[0],name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,style:{fontSize:`0.75rem`},collapsed:4,collapseStringsAfterLength:80})}):null}var loe=()=>{let e=wT(),{openaiRef:t,openaiObject:n,openInAppUrl:r}=cC(e.name),{setToolData:i}=sC(),a=bh(e=>e.setPreference),o=e._meta?.[`openai/outputTemplate`],s=(r,o)=>{let s=t?.current?.contentWindow?.openai;s&&n&&(s[r]=o,i(e.name,{openaiObject:{...n,[r]:o}}),r in yh&&a(r,o))};return n?(0,G.jsx)(`div`,{className:`overflow-auto max-h-full min-h-0`,children:(0,G.jsxs)(_3,{defaultValue:`widget-state`,className:`gap-0`,children:[(0,G.jsxs)(y3,{className:`border-b border-border w-full`,children:[(0,G.jsx)(b3,{value:`properties`,children:`Properties`}),(0,G.jsx)(b3,{value:`widget-state`,children:`Widget State`}),o&&(0,G.jsx)(b3,{value:`resource`,children:`Resource`})]}),(0,G.jsx)(x3,{value:`properties`,className:`p-4`,children:(0,G.jsxs)(Pie,{children:[(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Display Mode`}),(0,G.jsxs)(Y7,{value:n.displayMode,onValueChange:e=>s(`displayMode`,e),"aria-label":`Select framework`,items:[{label:`Inline`,value:`inline`},{label:`Fullscreen`,value:`fullscreen`},{label:`Pip`,value:`pip`},{label:`Modal`,value:`modal`}],name:`displayMode`,required:!0,children:[(0,G.jsx)(Q7,{children:(0,G.jsx)(Z7,{})}),(0,G.jsx)($7,{children:(0,G.jsxs)(X7,{children:[(0,G.jsx)(e9,{value:`inline`,children:`Inline`}),(0,G.jsx)(e9,{value:`fullscreen`,children:`Fullscreen`}),(0,G.jsx)(e9,{value:`pip`,children:`Pip`}),(0,G.jsx)(e9,{value:`modal`,children:`Modal`})]})})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Theme`}),(0,G.jsxs)(Mie,{children:[(0,G.jsx)(fO,{variant:n.theme===`light`?`default`:`outline`,onClick:()=>s(`theme`,`light`),children:(0,G.jsx)(mn,{})}),(0,G.jsx)(fO,{variant:n.theme===`dark`?`default`:`outline`,onClick:()=>s(`theme`,`dark`),children:(0,G.jsx)(un,{})})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Locale`}),(0,G.jsx)(soe,{value:n.locale,onValueChange:e=>s(`locale`,e)})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Max Height`}),(0,G.jsx)(f7,{type:`number`,value:n.maxHeight===void 0?``:String(n.maxHeight),onChange:e=>{let t=e.target.value.trim();s(`maxHeight`,t===``?void 0:Number(t))}})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Safe Area Insets`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:[`top`,`bottom`,`left`,`right`].map(e=>{let t=e.charAt(0).toUpperCase()+e.slice(1);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`safeArea-${e}`,className:`text-xs text-muted-foreground block mb-1`,children:t}),(0,G.jsx)(f7,{id:`safeArea-${e}`,type:`number`,value:n.safeArea?.insets?.[e]===void 0?`0`:String(n.safeArea.insets[e]),onChange:t=>{let r=t.target.value.trim();s(`safeArea`,{...n.safeArea,insets:{...n.safeArea?.insets,[e]:r===``?0:Number(r)}})}})]},e)})})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Device Type`}),(0,G.jsxs)(Y7,{value:n.userAgent?.device?.type??`desktop`,onValueChange:e=>s(`userAgent`,{...n.userAgent,device:{...n.userAgent?.device,type:e}}),"aria-label":`Select device type`,items:[{label:`Mobile`,value:`mobile`},{label:`Desktop`,value:`desktop`}],name:`deviceType`,required:!0,children:[(0,G.jsx)(Q7,{children:(0,G.jsx)(Z7,{})}),(0,G.jsx)($7,{children:(0,G.jsxs)(X7,{children:[(0,G.jsx)(e9,{value:`mobile`,children:`Mobile`}),(0,G.jsx)(e9,{value:`desktop`,children:`Desktop`})]})})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Capabilities`}),(0,G.jsxs)(`div`,{className:`flex gap-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:`hover`,className:`text-xs text-muted-foreground cursor-pointer`,children:`Hover`}),(0,G.jsx)(i9,{id:`hover`,checked:n.userAgent?.capabilities?.hover??!1,onCheckedChange:e=>s(`userAgent`,{...n.userAgent,capabilities:{...n.userAgent?.capabilities,hover:e}})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:`touch`,className:`text-xs text-muted-foreground cursor-pointer`,children:`Touch`}),(0,G.jsx)(i9,{id:`touch`,checked:n.userAgent?.capabilities?.touch??!1,onCheckedChange:e=>s(`userAgent`,{...n.userAgent,capabilities:{...n.userAgent?.capabilities,touch:e}})})]})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Open in App URL`}),(0,G.jsx)(f7,{type:`text`,value:r??``,readOnly:!0,placeholder:`Not set`,className:`font-mono text-xs`})]})]})}),(0,G.jsx)(x3,{value:`widget-state`,className:`p-4`,children:(0,G.jsx)(q3,{src:n.widgetState??{},name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,collapsed:3,collapseStringsAfterLength:80})}),o&&(0,G.jsx)(x3,{value:`resource`,className:`p-4`,children:(0,G.jsx)(b.Suspense,{fallback:(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading resource...`}),children:(0,G.jsx)(coe,{resourceUri:o})})})]})}):null};function d9(e){return new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3})}function uoe(e,t=60){let n=JSON.stringify(e);return n.length>t?`${n.slice(0,t)}…`:n}function doe({log:e}){let[t,n]=(0,b.useState)(!1),r=Object.keys(e.args).length>0,i=r?uoe(e.args):null;return(0,G.jsxs)(G.Fragment,{children:[r?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex items-center gap-2 py-1.5 px-2 text-xs font-mono border-b border-gray-200 dark:border-gray-800/50 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800/30 w-full text-left`,children:[(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-500 shrink-0 min-w-[80px]`,children:d9(e.timestamp)}),(0,G.jsx)(`span`,{className:uO(`font-semibold shrink-0 min-w-[120px]`,e.type===`response`?`text-green-600 dark:text-green-400`:`text-blue-600 dark:text-blue-400`),children:e.command}),(0,G.jsx)(`span`,{className:`text-gray-500 dark:text-gray-600 mr-1`,children:t?`▼`:`▶`}),(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400 truncate flex-1 min-w-0`,children:i})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5 px-2 text-xs font-mono border-b border-gray-200 dark:border-gray-800/50`,children:[(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-500 shrink-0 min-w-[80px]`,children:d9(e.timestamp)}),(0,G.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400 font-semibold shrink-0 min-w-[120px]`,children:e.command})]}),t&&r&&(0,G.jsx)(`div`,{className:`px-2 py-2 bg-gray-50 dark:bg-gray-900/30 border-b border-gray-200 dark:border-gray-800/50`,children:(0,G.jsx)(`pre`,{className:`text-xs font-mono text-gray-800 dark:text-gray-200 whitespace-pre-wrap overflow-x-auto`,children:JSON.stringify(e.args,null,2)})})]})}function foe(){let e=wT(),{setToolData:t}=sC(),{openaiLogs:n}=cC(e.name),r=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight)},[]),(0,G.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden min-h-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3 h-8 flex-none`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-200`,children:`MCP client logs`}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:n.length>0&&(0,G.jsxs)(fO,{variant:`ghost`,size:`sm`,onClick:()=>{t(e.name,{openaiLogs:[]})},children:[(0,G.jsx)(hn,{className:`w-3 h-3`}),`Clear`]})})]}),(0,G.jsx)(`div`,{ref:r,className:`overflow-auto flex-1 bg-gray-50 rounded-lg border border-gray-200 min-h-0`,children:n.map(e=>(0,G.jsx)(doe,{log:e},e.id))})]})}var poe=UE(`relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-xl border px-3.5 py-3 text-card-foreground text-sm has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-[1lh] [&>svg]:w-4`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&>svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 [&>svg]:text-destructive`,info:`border-info/32 bg-info/4 [&>svg]:text-info`,success:`border-success/32 bg-success/4 [&>svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&>svg]:text-warning`}}});function moe({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:uO(poe({variant:t}),e),"data-slot":`alert`,role:`alert`,...n})}function hoe({className:e,...t}){return(0,G.jsx)(`div`,{className:uO(`font-medium [svg~&]:col-start-2`,e),"data-slot":`alert-title`,...t})}function goe({className:e,...t}){return(0,G.jsx)(`div`,{className:uO(`flex flex-col gap-2.5 text-muted-foreground [svg~&]:col-start-2`,e),"data-slot":`alert-description`,...t})}var _oe=()=>{let e=cC(wT().name);return e?(0,G.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden bg-card`,children:(0,G.jsx)(`div`,{className:`p-4 overflow-auto`,children:e.response?e.response.isError?(0,G.jsxs)(moe,{variant:`error`,children:[(0,G.jsx)(on,{}),(0,G.jsx)(hoe,{children:`Error`}),(0,G.jsx)(goe,{children:(()=>{let t=[];return e.response.content.forEach(e=>{e.type===`text`&&t.push(e.text)}),t.join(`
152
+ )`}return(0,G.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),cie=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Y3(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,G.jsx)(q5.Provider,{value:n,children:(0,G.jsxs)(V6,{ref:t,...r,children:[a&&o===!0&&(0,G.jsx)(J5,{ref:i.context.internalBackdropRef,inert:k4(!s)}),e.children]})}):null});function Y5(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}var X5={},Z5={},Q5=``;function lie(e){if(typeof document>`u`)return!1;let t=q1(e);return OT(t).innerWidth-t.documentElement.clientWidth>0}function uie(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=q1(e),n=t.documentElement,r=t.body,i=PT(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function die(e){let t=q1(e),n=t.documentElement,r=t.body,i=PT(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function fie(e){let t=q1(e),n=t.documentElement,r=t.body,i=OT(n),a=0,o=0,s=!1,c=I4.create();if(x0&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,X5={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Q5=n.style.scrollBehavior,Z5={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=PT(n)?n:r;if(s=uie(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,X5),Object.assign(r.style,Z5),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Q5)}function d(){u(),c.request(l)}return l(),i.addEventListener(`resize`,d),()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&i.removeEventListener(`resize`,d)}}var pie=new class{lockCount=0;restore=null;timeoutLock=u6.create();timeoutUnlock=u6.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=q1(e).documentElement,n=OT(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=TE;return}this.restore=S0||!lie(e)?die(e):fie(e)}};function $5(e=!0,t=null){$(()=>{if(e)return pie.acquire(t)},[e,t])}function mie(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function e7(e,t){let n=b.useRef(e),r=XT(t);$(()=>{n.current!==e&&r(n.current)},[e,r]),$(()=>{n.current=e},[e])}function t7(e){let[t,n]=b.useState(null),r=XT((t,r)=>{e||n(r||(S0?`touch`:``))});e7(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=mie(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function hie(e){let{store:t,parentContext:n,actionsRef:r}=e,i=t.useState(`open`),a=t.useState(`disablePointerDismissal`),o=t.useState(`modal`),s=t.useState(`popupElement`),{openMethod:c,triggerProps:l}=t7(i);T5(t);let{forceUnmount:u}=E5(i,t),d=XT(e=>{let n=g0(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),f=b.useCallback(()=>{t.setOpen(!1,d(m0))},[t,d]);b.useImperativeHandle(r,()=>({unmount:u,close:f}),[u,f]);let p=M5({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[m,h]=b.useState(0),g=m===0,_=V5(p),v=d8(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=R0(e);if(g&&!a){let e=n;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||I0(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:g});$5(i&&o===!0,s);let{getReferenceProps:y,getFloatingProps:x,getTriggerProps:S}=F5([_,v]);t.useContextCallback(`onNestedDialogOpen`,e=>{h(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(m),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,m]);let C=b.useMemo(()=>y(l),[y,l]),w=b.useMemo(()=>S(l),[S,l]),T=b.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:p,nestedOpenDialogCount:m})}var gie={...A5,modal:v5(e=>e.modal),nested:v5(e=>e.nested),nestedOpenDialogCount:v5(e=>e.nestedOpenDialogCount),disablePointerDismissal:v5(e=>e.disablePointerDismissal),openMethod:v5(e=>e.openMethod),descriptionElementId:v5(e=>e.descriptionElementId),titleElementId:v5(e=>e.titleElementId),viewportElement:v5(e=>e.viewportElement),role:v5(e=>e.role)},_ie=class extends C5{constructor(e){super(vie(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new D5,onOpenChange:void 0,onOpenChangeComplete:void 0},gie)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function vie(e={}){return{...O5(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function yie(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=Y3(!0),p=!!f,m=JT(()=>l?.store??new _ie({open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:p})).current;Y5(()=>{n===void 0&&m.state.open===!1&&r===!0&&m.update({open:!0,activeTriggerId:d})}),m.useControlledProp(`openProp`,n),m.useControlledProp(`triggerIdProp`,u),m.useSyncedValues({disablePointerDismissal:o,nested:p,modal:s}),m.useContextCallback(`onOpenChange`,i),m.useContextCallback(`onOpenChangeComplete`,a);let h=m.useState(`payload`);hie({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=b.useMemo(()=>({store:m}),[m]);return(0,G.jsx)(J3.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}var bie=b.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=Y3(),s=Q1(i);return o.useSyncedValueWithCleanup(`titleElementId`,s),NE(`h2`,e,{ref:t,props:[{id:s},a]})});function xie({...e}){return(0,G.jsx)(yie,{"data-slot":`dialog`,...e})}function Sie({...e}){return(0,G.jsx)(cie,{"data-slot":`dialog-portal`,...e})}function Cie({className:e,...t}){return(0,G.jsx)(s6,{"data-slot":`dialog-overlay`,className:uO(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,e),...t})}function wie({className:e,children:t,showCloseButton:n=!0,...r}){return(0,G.jsxs)(Sie,{children:[(0,G.jsx)(Cie,{}),(0,G.jsxs)(sie,{"data-slot":`dialog-content`,className:uO(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-none p-4 text-xs/relaxed ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,e),...r,children:[t,n&&(0,G.jsxs)(c6,{"data-slot":`dialog-close`,render:(0,G.jsx)(fO,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,G.jsx)(gn,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Tie({className:e,...t}){return(0,G.jsx)(bie,{"data-slot":`dialog-title`,className:uO(`text-sm font-medium`,e),...t})}var Eie=()=>{let e=wT(),[t,n]=(0,b.useState)(!1);return e._meta&&Object.keys(e._meta).length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(fO,{variant:`ghost`,size:`default`,onClick:()=>n(!0),"aria-label":`View metadata`,title:`View metadata`,children:[(0,G.jsx)(sn,{className:`h-4 w-4`}),`Metadata`]}),(0,G.jsx)(xie,{open:t,onOpenChange:n,children:(0,G.jsxs)(wie,{className:`sm:max-w-2xl`,children:[(0,G.jsx)(Tie,{children:`Tool Metadata`}),(0,G.jsx)(`div`,{className:`text-xs`,children:(0,G.jsx)(q3,{src:e._meta,name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,style:{fontSize:`0.75rem`},collapsed:2,collapseStringsAfterLength:80})})]})})]}):null},Die={"ui:submitButtonOptions":{norender:!0}},Oie=({schema:e,formData:t,setFormData:n,ref:r})=>!e?.properties||Object.keys(e.properties).length===0?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This tool requires no input`})}):(0,G.jsx)(S3,{children:(0,G.jsx)(C3,{children:(0,G.jsx)(M1,{ref:r,schema:e??{},validator:PK,uiSchema:Die,formData:t,onChange:e=>n(e.formData),showErrorList:!1,templates:{FieldTemplate:e=>{let{id:t,classNames:n,style:r,label:i,required:a,errors:o,children:s}=e;return(0,G.jsxs)(`div`,{className:uO(`flex flex-col gap-2`,n),style:r,children:[(0,G.jsxs)(`label`,{htmlFor:t,className:`text-sm text-foreground`,children:[i,a&&(0,G.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s,o]})]})},FieldErrorTemplate:e=>e.errors&&e.errors.length>0?(0,G.jsx)(`div`,{className:`text-sm text-destructive mt-1 flex items-center gap-1`,children:(0,G.jsx)(`span`,{children:e.errors.join(`, `)})}):null}})})}),kie=({formData:e,setFormData:t})=>{let[n,r]=(0,b.useState)(JSON.stringify(e,null,2));(0,b.useEffect)(()=>{r(JSON.stringify(e,null,2))},[e]);let i=e=>{r(e);try{t(JSON.parse(e))}catch{}};return(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,G.jsx)(`textarea`,{className:`w-full h-full p-2 rounded-md border border-border`,rows:12,value:n,onChange:e=>i(e.target.value)})})},Aie=()=>{let e=(0,b.useRef)(null),t=wT(),{setToolData:n}=sC(),r=cC(t.name)?.input??{},i=e=>{n(t.name,{input:e??{}})};return(0,G.jsxs)(`div`,{className:uO(`flex flex-col h-full overflow-hidden border-r border-border`),children:[(0,G.jsxs)(`div`,{className:`shrink-0 border-b border-border px-6 py-4 flex items-center justify-between h-[72px]`,children:[(0,G.jsx)(`h2`,{className:`font-semibold text-foreground`,children:t.name}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Eie,{}),(0,G.jsx)(G3,{validateForm:async()=>e.current===null?!0:await e.current.validateForm(),formData:r})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-6 bg-muted/50`,children:(0,G.jsxs)(_3,{defaultValue:`form`,children:[(0,G.jsxs)(y3,{children:[(0,G.jsx)(b3,{value:`form`,children:`Form`}),(0,G.jsx)(b3,{value:`json`,children:`JSON`})]}),(0,G.jsx)(x3,{value:`form`,children:(0,G.jsx)(Oie,{schema:t.inputSchema,formData:r,setFormData:i,ref:e},t.name)}),(0,G.jsx)(x3,{value:`json`,children:(0,G.jsx)(kie,{formData:r,setFormData:i},t.name)})]})})]})},jie=UE(`rounded-none has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-none flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0 [&>[data-slot]]:rounded-r-none`,vertical:`flex-col [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0 [&>[data-slot]]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function Mie({className:e,orientation:t,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:uO(jie({orientation:t}),e),...n})}function Nie({className:e,...t}){return(0,G.jsx)(`label`,{"data-slot":`label`,className:uO(`gap-2 text-xs leading-none group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed`,e),...t})}function Pie({className:e,...t}){return(0,G.jsx)(`fieldset`,{"data-slot":`field-set`,className:uO(`gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col`,e),...t})}var Fie=UE(`data-[invalid=true]:text-destructive gap-2 group/field flex w-full`,{variants:{orientation:{vertical:`flex-col [&>*]:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function n7({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:uO(Fie({orientation:t}),e),...n})}function r7({className:e,...t}){return(0,G.jsx)(Nie,{"data-slot":`field-label`,className:uO(`has-data-checked:bg-primary/5 has-data-checked:border-primary dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-none has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var i7=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Iie={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},a7={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Lie={disabled:!1,...a7},o7={valid(e){return e===null?null:e?{[i7.valid]:``}:{[i7.invalid]:``}}},Rie=b.createContext({invalid:void 0,name:void 0,validityData:{state:Iie,errors:[],error:``,value:``,initialValue:null},setValidityData:TE,disabled:void 0,touched:a7.touched,setTouched:TE,dirty:a7.dirty,setDirty:TE,filled:a7.filled,setFilled:TE,focused:a7.focused,setFocused:TE,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Lie,markedDirtyRef:{current:!1},validation:{getValidationProps:(e=DE)=>e,getInputValidationProps:(e=DE)=>e,inputRef:{current:null},commit:async()=>{}}});function s7(e=!0){let t=b.useContext(Rie);if(t.setValidityData===TE&&!e)throw Error(cE(28));return t}var zie=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:TE,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function c7(){return b.useContext(zie)}var Bie=b.createContext({controlId:void 0,registerControlId:TE,labelId:void 0,setLabelId:TE,messageIds:[],setMessageIds:TE,getDescriptionProps:e=>e});function l7(){return b.useContext(Bie)}function Vie(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function u7(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=l7(),o=Q1(t),s=n?i:void 0,c=JT(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=XT(()=>{!l.current||a===TE||(l.current=!1,a(c.current,void 0))});return $(()=>{if(a===TE)return;let e;if(n){let n=r?.current;e=jT(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function d7(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=c7(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=s7(),f=XT(e.getValue);$(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),$(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:Vie(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?Vq.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),$(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var Hie=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,...d}=e,{state:f,name:p,disabled:m,setTouched:h,setDirty:g,validityData:_,setFocused:v,setFilled:y,validationMode:x,validation:S}=s7(),C=m||s,w=p??a,T={...f,disabled:C},{labelId:E}=l7(),D=u7({id:i});$(()=>{let e=o!=null;S.inputRef.current?.value||e&&o!==``?y(!0):e&&o===``&&y(!1)},[S.inputRef,y,o]);let O=b.useRef(null);$(()=>{u&&O.current===F0(q1(O.current))&&v(!0)},[u,v]);let[k]=N1({controlled:o,default:l,name:`FieldControl`,state:`value`}),A=o!==void 0,j=A?k:void 0;return d7({id:D,name:w,commit:S.commit,value:j,getValue:()=>S.inputRef.current?.value,controlRef:S.inputRef}),NE(`input`,e,{ref:[t,O],state:T,props:[{id:D,disabled:C,name:w,ref:S.inputRef,"aria-labelledby":E,autoFocus:u,...A?{value:j}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,g0(a0,e.nativeEvent)),g(t!==_.initialValue),y(t!==``)},onFocus(){v(!0)},onBlur(e){h(!0),v(!1),x===`onBlur`&&S.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(h(!0),S.commit(e.currentTarget.value))}},S.getInputValidationProps(),d],stateAttributesMapping:o7})}),Uie=b.forwardRef(function(e,t){return(0,G.jsx)(Hie,{ref:t,...e})});function f7({className:e,type:t,...n}){return(0,G.jsx)(Uie,{type:t,"data-slot":`input`,className:uO(`dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-none border bg-transparent px-2.5 py-1 text-xs transition-colors file:h-6 file:text-xs file:font-medium focus-visible:ring-1 aria-invalid:ring-1 md:text-xs file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,e),...n})}var p7=b.createContext(null),m7=b.createContext(null);function h7(){let e=b.useContext(p7);if(e===null)throw Error(cE(60));return e}function g7(){let e=b.useContext(m7);if(e===null)throw Error(cE(61));return e}var Wie=(e,t)=>Object.is(e,t);function _7(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Gie(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:_7(t,e,n))}function v7(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:_7(e,t,n))}function Kie(e,t,n){return e.filter(e=>!_7(t,e,n))}function y7(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function b7(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function qie(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(b7(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Jie(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return y7(e)}function x7(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?y7(e.value):y7(e)}function S7(e,t,n){function r(){return Jie(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=b7(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Yie(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,G.jsx)(b.Fragment,{children:S7(r,t,n)},i)),e),[])}var C7={id:v5(e=>e.id),labelId:v5(e=>e.labelId),modal:v5(e=>e.modal),multiple:v5(e=>e.multiple),items:v5(e=>e.items),itemToStringLabel:v5(e=>e.itemToStringLabel),itemToStringValue:v5(e=>e.itemToStringValue),isItemEqualToValue:v5(e=>e.isItemEqualToValue),value:v5(e=>e.value),hasSelectedValue:v5(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:x7(t,r)!==``}),hasNullItemLabel:v5((e,t)=>t?qie(e.items):!1),open:v5(e=>e.open),mounted:v5(e=>e.mounted),forceMount:v5(e=>e.forceMount),transitionStatus:v5(e=>e.transitionStatus),openMethod:v5(e=>e.openMethod),activeIndex:v5(e=>e.activeIndex),selectedIndex:v5(e=>e.selectedIndex),isActive:v5((e,t)=>e.activeIndex===t),isSelected:v5((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>_7(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:_7(n,i,r)}),isSelectedByFocus:v5((e,t)=>e.selectedIndex===t),popupProps:v5(e=>e.popupProps),triggerProps:v5(e=>e.triggerProps),triggerElement:v5(e=>e.triggerElement),positionerElement:v5(e=>e.positionerElement),listElement:v5(e=>e.listElement),scrollUpArrowVisible:v5(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:v5(e=>e.scrollDownArrowVisible),hasScrollArrows:v5(e=>e.hasScrollArrows)};function Xie(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,autoComplete:l,disabled:u=!1,readOnly:d=!1,required:f=!1,modal:p=!0,actionsRef:m,inputRef:h,onOpenChangeComplete:g,items:_,multiple:v=!1,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:S=Wie,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=c7(),{setDirty:E,setTouched:D,setFocused:O,shouldValidateOnChange:k,validityData:A,setFilled:j,name:M,disabled:N,validation:P,validationMode:F}=s7(),I=u7({id:t}),L=N||u,R=M??c,[z,B]=N1({controlled:n,default:v?r??EE:r,name:`Select`,state:`value`}),[V,H]=N1({controlled:a,default:o,name:`Select`,state:`open`}),U=b.useRef([]),ee=b.useRef([]),W=b.useRef(null),te=b.useRef(null),ne=b.useRef(0),re=b.useRef(null),ie=b.useRef([]),ae=b.useRef(!1),oe=b.useRef(!1),se=b.useRef(null),ce=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),le=b.useRef(!1),{mounted:ue,setMounted:de,transitionStatus:fe}=V4(V),{openMethod:pe,triggerProps:me}=t7(V),he=JT(()=>new S5({id:I,labelId:void 0,modal:p,multiple:v,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:S,value:z,open:V,mounted:ue,transitionStatus:fe,items:_,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ge=x5(he,C7.activeIndex),_e=x5(he,C7.selectedIndex),ve=x5(he,C7.triggerElement),ye=x5(he,C7.positionerElement),be=b.useMemo(()=>v&&Array.isArray(z)&&z.length===0?``:x7(z,x),[v,z,x]),xe=b.useMemo(()=>v&&Array.isArray(z)?z.map(e=>x7(e,x)):x7(z,x),[v,z,x]),Se=g6(he.state.triggerElement);d7({id:I,commit:P.commit,value:z,controlRef:Se,name:R,getValue:()=>xe});let Ce=b.useRef(z);$(()=>{z!==Ce.current&&he.set(`forceMount`,!0)},[he,z]),$(()=>{j(v?Array.isArray(z)&&z.length>0:z!=null)},[v,z,j]),$(function(){if(V)return;let e=ie.current;if(v){let t=Array.isArray(z)?z:[];if(t.length===0){he.set(`selectedIndex`,null);return}let n=t[t.length-1],r=v7(e,n,S);he.set(`selectedIndex`,r===-1?null:r);return}let t=v7(e,z,S);he.set(`selectedIndex`,t===-1?null:t)},[v,V,z,ie,S,he]),e7(z,()=>{T(R),E(z!==A.initialValue),k()?P.commit(z):P.commit(z,!0)});let we=XT((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),F===`onBlur`&&P.commit(z)),!e&&he.state.activeIndex!==null)){let e=U.current[he.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Te=XT(()=>{de(!1),he.set(`activeIndex`,null),g?.(!1)});B4({enabled:!m,open:V,ref:W,onComplete(){V||Te()}}),b.useImperativeHandle(m,()=>({unmount:Te}),[Te]);let Ee=XT((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),De=XT(()=>{let e=he.state.listElement||W.current;if(!e)return;let t=e.scrollTop,n=e.scrollTop+e.clientHeight,r=t>1,i=n<e.scrollHeight-1;he.state.scrollUpArrowVisible!==r&&he.set(`scrollUpArrowVisible`,r),he.state.scrollDownArrowVisible!==i&&he.set(`scrollDownArrowVisible`,i)}),Oe=j5({open:V,onOpenChange:we,elements:{reference:ve,floating:ye}}),{getReferenceProps:ke,getFloatingProps:Ae,getItemProps:je}=F5([s8(Oe,{enabled:!d&&!L,event:`mousedown`}),d8(Oe,{bubbles:!1}),Zre(Oe,{enabled:!d&&!L,listRef:U,activeIndex:ge,selectedIndex:_e,disabledIndices:EE,onNavigate(e){e===null&&!V||he.set(`activeIndex`,e)},focusItemOnHover:!1}),$re(Oe,{enabled:!d&&!L&&(V||!v),listRef:ee,activeIndex:ge,selectedIndex:_e,onMatch(e){V?he.set(`activeIndex`,e):Ee(ie.current[e],g0(`none`))},onTypingChange(e){ae.current=e}})]),Me=b.useMemo(()=>$T(ke(),me,I?{id:I}:DE),[ke,me,I]);Y5(()=>{he.update({popupProps:Ae(),triggerProps:Me})}),$(()=>{he.update({id:I,modal:p,multiple:v,value:z,open:V,mounted:ue,transitionStatus:fe,popupProps:Ae(),triggerProps:Me,items:_,itemToStringLabel:y,itemToStringValue:x,isItemEqualToValue:S,openMethod:pe})},[he,I,p,v,z,V,ue,fe,Ae,Me,_,y,x,S,pe]);let Ne=b.useMemo(()=>({store:he,name:R,required:f,disabled:L,readOnly:d,multiple:v,itemToStringLabel:y,itemToStringValue:x,highlightItemOnHover:C,setValue:Ee,setOpen:we,listRef:U,popupRef:W,scrollHandlerRef:te,handleScrollArrowVisibility:De,scrollArrowsMountedCountRef:ne,getItemProps:je,events:Oe.context.events,valueRef:re,valuesRef:ie,labelsRef:ee,typingRef:ae,selectionRef:ce,selectedItemTextRef:se,validation:P,onOpenChangeComplete:g,keyboardActiveRef:oe,alignItemWithTriggerActiveRef:le,initialValueRef:Ce}),[he,R,f,L,d,v,y,x,C,Ee,we,je,Oe.context.events,P,g,De]),Pe=hE(h,P.inputRef),Fe=v&&Array.isArray(z)&&z.length>0,Ie=v?void 0:R,Le=b.useMemo(()=>!v||!Array.isArray(z)||!R?null:z.map(e=>{let t=x7(e,x);return(0,G.jsx)(`input`,{type:`hidden`,name:R,value:t},t)}),[v,z,R,x]);return(0,G.jsx)(p7.Provider,{value:Ne,children:(0,G.jsxs)(m7.Provider,{value:Oe,children:[w,(0,G.jsx)(`input`,{...P.getInputValidationProps({onFocus(){he.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.value,n=g0(a0,e.nativeEvent);function r(){if(v)return;let e=ie.current.find(e=>x7(e,x).toLowerCase()===t.toLowerCase());e!=null&&(E(e!==A.initialValue),Ee(e,n),k()&&P.commit(e))}he.set(`forceMount`,!0),queueMicrotask(r)}}),id:I&&Ie==null?`${I}-hidden-input`:void 0,name:Ie,autoComplete:l,value:be,disabled:L,required:f&&!Fe,readOnly:d,ref:Pe,style:R?b6:y6,tabIndex:-1,"aria-hidden":!0}),Le]})})}function Zie(e,t){return e??t}function Qie(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,`::before`),r=window.getComputedStyle(e,`::after`);if(!(n.content!==`none`||r.content!==`none`))return t;let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,s=parseFloat(r.height)||0,c=Math.max(t.width,i,o),l=Math.max(t.height,a,s),u=c-t.width,d=l-t.height;return{left:t.left-u/2,right:t.right+u/2,top:t.top-d/2,bottom:t.bottom+d/2}}var w7=2,$ie=400,T7=200,eae={...i6,...o7,value:()=>null},tae=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{setTouched:c,setFocused:l,validationMode:u,state:d,disabled:f}=s7(),{labelId:p}=l7(),{store:m,setOpen:h,selectionRef:g,validation:_,readOnly:v,required:y,alignItemWithTriggerActiveRef:x,disabled:S,keyboardActiveRef:C}=h7(),w=f||S||a,T=x5(m,C7.open),E=x5(m,C7.value),D=x5(m,C7.triggerProps),O=x5(m,C7.positionerElement),k=x5(m,C7.listElement),A=x5(m,C7.id),j=x5(m,C7.labelId),M=x5(m,C7.hasSelectedValue),N=!M&&T,P=x5(m,C7.hasNullItemLabel,N),F=i??A,I=Zie(p,j);u7({id:F});let L=g6(O),R=b.useRef(null),{getButtonProps:z,buttonRef:B}=fE({disabled:w,native:o}),V=hE(t,R,B,XT(e=>{m.set(`triggerElement`,e)})),H=d6(),U=d6(),ee=d6(),W=d6();b.useEffect(()=>{if(T)return M||P?W.start(T7,()=>{g.current.allowUnselectedMouseUp=!0,ee.start(T7,()=>{g.current.allowSelectedMouseUp=!0})}):ee.start($ie,()=>{g.current.allowUnselectedMouseUp=!0,g.current.allowSelectedMouseUp=!0}),()=>{ee.clear(),W.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},U.clear()},[T,M,P,g,U,ee,W]);let te=b.useMemo(()=>k?.id??U0(O)?.id,[k,O]),ne=$T(D,{id:F,role:`combobox`,"aria-expanded":T?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":T?te:void 0,"aria-labelledby":I,"aria-readonly":v||void 0,"aria-required":y||void 0,tabIndex:w?-1:0,ref:V,onFocus(e){l(!0),T&&x.current&&h(!1,g0(a0,e.nativeEvent)),H.start(0,()=>{m.set(`forceMount`,!0)})},onBlur(e){I0(O,e.relatedTarget)||(c(!0),l(!1),u===`onBlur`&&_.commit(E))},onPointerMove(){C.current=!1},onKeyDown(){C.current=!0},onMouseDown(e){if(T)return;let t=q1(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(I0(R.current,t)||I0(L.current,t)||t===R.current)return;let n=Qie(R.current);e.clientX>=n.left-w7&&e.clientX<=n.right+w7&&e.clientY>=n.top-w7&&e.clientY<=n.bottom+w7||h(!1,g0($ne,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},_.getValidationProps,s,z);ne.role=`combobox`;let re={...d,open:T,disabled:w,value:E,readOnly:v,placeholder:!M};return NE(`button`,e,{ref:[t,R],state:re,stateAttributesMapping:eae,props:ne})}),nae={value:()=>null},rae=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,...o}=e,{store:s,valueRef:c}=h7(),l=x5(s,C7.value),u=x5(s,C7.items),d=x5(s,C7.itemToStringLabel),f=x5(s,C7.hasSelectedValue),p=!f&&a!=null&&i==null,m=x5(s,C7.hasNullItemLabel,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(!f&&a!=null&&!m?a:Array.isArray(l)?Yie(l,u,d):S7(l,u,d)),NE(`span`,e,{state:h,ref:[t,c],props:[{children:g},o],stateAttributesMapping:nae})}),iae=b.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a}=h7();return NE(`span`,e,{state:{open:x5(a,C7.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},i],stateAttributesMapping:r6})}),aae=b.createContext(void 0),oae=b.forwardRef(function(e,t){let{store:n}=h7(),r=x5(n,C7.mounted),i=x5(n,C7.forceMount);return r||i?(0,G.jsx)(aae.Provider,{value:!0,children:(0,G.jsx)(V6,{ref:t,...e})}):null}),sae=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,offsetParent:d=`real`}=o2(e,t)||{};if(l==null)return{};let f=w2(u),p={x:n,y:r},m=f2(i),h=u2(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=a2(k,j,A),N=!c.arrow&&c2(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),cae=(e,t)=>({...sae(e),options:[e,t]}),lae={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await cre().fn(e)).data?.referenceHidden||a}}}},E7={sideX:`left`,sideY:`top`},uae={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=OT(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:E7};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=q1(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=s2(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:E7.sideX,g=f===`top`?`bottom`:E7.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function D7(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function O7(e,t,n){let{rects:r,placement:i}=e;return{side:D7(t,s2(i),n),align:c2(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function k7(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=XT(D),k=D?O:t,A=g6(t),j=V1()===`rtl`,M=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":j?`left`:`right`,"inline-start":j?`right`:`left`}[r],N=a===`center`?M:`${M}-${a}`,P=c,F=r===`bottom`?1:0,I=r===`top`?1:0,L=r===`right`?1:0,R=r===`left`?1:0;typeof P==`number`?P={top:P+F,right:P+R,bottom:P+I,left:P+L}:P&&={top:(P.top||0)+F,right:(P.right||0)+R,bottom:(P.bottom||0)+I,left:(P.left||0)+L};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:P},B=b.useRef(null),V=g6(i),H=g6(o),U=[rre(e=>{let t=O7(e,r,j),n=typeof V.current==`function`?V.current(t):V.current,i=typeof H.current==`function`?H.current(t):H.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,j,r])],ee=T===`none`&&w!==`shift`,W=!ee&&(l||g||w===`shift`),te=w===`none`?null:ore({...z,padding:{top:P.top+1,right:P.right+1,bottom:P.bottom+1,left:P.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ne=ee?null:ire(e=>{let t=q1(e.elements.floating).documentElement;return{...z,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:W,limiter:l||g?void 0:are(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=d2(s2(e.placement)),i=r===`y`?t:n,a=r===`y`?P.left+P.right:P.top+P.bottom;return{offset:i/2+a/2}})}},[z,l,g,P,T]);w===`shift`||T===`shift`||a===`center`?U.push(ne,te):U.push(te,ne),U.push(sre({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=window.devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),cae(()=>({element:B.current||document.createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=s2(a),l=d2(c),u=B.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(O7(e,r,j)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,W&&l===`y`&&b?S:x),{}}},lae,v),$(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);let re=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ie,elements:ae,x:oe,y:se,middlewareData:ce,update:le,placement:ue,context:de,isPositioned:fe,floatingStyles:pe}=Bre({rootContext:p,placement:N,middleware:U,strategy:n,whileElementsMounted:f?void 0:(...e)=>t5(...e,re),nodeId:_,externalTree:x}),{sideX:me,sideY:he}=ce.adaptiveOrigin||E7,ge=fe?n:`fixed`,_e=b.useMemo(()=>{let e=v?{position:ge,[me]:oe,[he]:se}:{position:ge,...pe};return fe||(e.opacity=0),e},[v,ge,me,oe,he,se,pe,fe]),ve=b.useRef(null);$(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(A7(t)?t.current:t)||null;n!==ve.current&&(ie.setPositionReference(n),ve.current=n)},[m,ie,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&A7(e)&&e.current!==ve.current&&(ie.setPositionReference(e.current),ve.current=e.current)},[m,ie,k,A]),b.useEffect(()=>{if(f&&m&&ae.domReference&&ae.floating)return t5(ae.domReference,ae.floating,le,re)},[f,m,ae,le,re]);let ye=s2(ue),be=D7(r,ye,j),xe=c2(ue)||`center`,Se=!!ce.hide?.referenceHidden;$(()=>{y&&m&&fe&&C(ye)},[y,m,fe,ye]);let Ce=b.useMemo(()=>({position:`absolute`,top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),we=ce.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:_e,arrowStyles:Ce,arrowRef:B,arrowUncentered:we,side:be,align:xe,physicalSide:ye,anchorHidden:Se,refs:ie,context:de,isPositioned:fe,update:le}),[_e,Ce,B,we,be,xe,ye,Se,ie,de,fe,le])}function A7(e){return e!=null&&`current`in e}var j7=b.createContext(void 0);function M7(){let e=b.useContext(j7);if(!e)throw Error(cE(59));return e}function N7(e){return e===`starting`?OE:DE}function P7(e,t){e&&Object.assign(e.style,t)}var F7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},dae={position:`fixed`},fae=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=AE,..._}=e,{store:v,listRef:y,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D}=h7(),O=g7(),k=x5(v,C7.open),A=x5(v,C7.mounted),j=x5(v,C7.modal),M=x5(v,C7.value),N=x5(v,C7.openMethod),P=x5(v,C7.positionerElement),F=x5(v,C7.triggerElement),I=x5(v,C7.isItemEqualToValue),L=x5(v,C7.transitionStatus),R=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),H=A&&B&&N!==`touch`;!A&&B!==h&&V(h),$(()=>{A||(C7.scrollUpArrowVisible(v.state)&&v.set(`scrollUpArrowVisible`,!1),C7.scrollDownArrowVisible(v.state)&&v.set(`scrollDownArrowVisible`,!1))},[v,A]),b.useImperativeHandle(S,()=>H),$5((H||j)&&k&&N!==`touch`,F);let U=k7({anchor:n,floatingRootContext:O,positionMethod:r,mounted:A,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),ee=H?`none`:U.side,W=H?dae:U.positionerStyles,te=b.useMemo(()=>{let e={};return k||(e.pointerEvents=`none`),{role:`presentation`,hidden:!A,style:{...W,...e}}},[k,A,W]),ne={open:k,side:ee,align:U.align,anchorHidden:U.anchorHidden},re=NE(`div`,e,{ref:[t,XT(e=>{v.set(`positionerElement`,e)})],state:ne,stateAttributesMapping:a6,props:[te,N7(L),_]}),ie=b.useRef(0),ae=XT(e=>{if(e.size===0&&ie.current===0||w.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=g0(a0);if(t!==0&&!v.state.multiple&&M!==null&&v7(w.current,M,I)===-1){let e=T.current,t=e!=null&&v7(w.current,e,I)!==-1?e:null;D(t,n),t===null&&(v.set(`selectedIndex`,null),C.current=null)}if(t!==0&&v.state.multiple&&Array.isArray(M)){let e=e=>v7(w.current,e,I)!==-1,t=M.filter(t=>e(t));(t.length!==M.length||t.some(e=>!Gie(M,e,I)))&&(D(t,n),t.length===0&&(v.set(`selectedIndex`,null),C.current=null))}if(k&&H){v.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};P7(P,e),P7(E.current,e)}}),oe=b.useMemo(()=>({...U,side:ee,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:R,scrollDownArrowRef:z}),[U,ee,H,V]);return(0,G.jsx)(I1,{elementsRef:y,labelsRef:x,onMapChange:ae,children:(0,G.jsxs)(j7.Provider,{value:oe,children:[A&&j&&(0,G.jsx)(J5,{inert:k4(!k),cutout:F}),re]})})});function I7(e){let t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}var L7=`base-ui-disable-scrollbar`,R7={className:L7,getElement(e){return(0,G.jsx)(`style`,{nonce:e,href:L7,precedence:`base-ui:low`,children:`.${L7}{scrollbar-width:none}.${L7}::-webkit-scrollbar{display:none}`})}},pae=b.createContext(void 0);function z7(e){let t=b.useContext(pae);if(t===void 0&&!e)throw Error(cE(69));return t}function B7(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var V7=1,mae={...a6,...N4},hae=b.forwardRef(function(e,t){let{render:n,className:r,finalFocus:i,...a}=e,{store:o,popupRef:s,onOpenChangeComplete:c,setOpen:l,valueRef:u,selectedItemTextRef:d,keyboardActiveRef:f,multiple:p,handleScrollArrowVisibility:m,scrollHandlerRef:h,highlightItemOnHover:g}=h7(),{side:_,align:v,alignItemWithTriggerActive:y,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:S,scrollUpArrowRef:C}=M7(),w=z7(!0)!=null,T=g7(),{nonce:E,disableStyleElements:D}=O4(),O=d6(),k=x5(o,C7.id),A=x5(o,C7.open),j=x5(o,C7.mounted),M=x5(o,C7.popupProps),N=x5(o,C7.transitionStatus),P=x5(o,C7.triggerElement),F=x5(o,C7.positionerElement),I=x5(o,C7.listElement),L=b.useRef(0),R=b.useRef(!1),z=b.useRef(0),B=b.useRef(!1),V=b.useRef({}),H=L4(),U=XT(e=>{if(!F||!s.current||!B.current)return;if(R.current||!y){m();return}let t=F.style.top===`0px`,n=F.style.bottom===`0px`,r=F.getBoundingClientRect().height,i=q1(F),a=getComputedStyle(F),o=parseFloat(a.marginTop),c=parseFloat(a.marginBottom),l=H7(getComputedStyle(s.current)),u=Math.min(i.documentElement.clientHeight-o-c,l),d=e.scrollTop,f=U7(e),p=0,h=null,g=!1,_=!1,v=e=>{F.style.height=`${e}px`},b=(t,n)=>{let i=B7(t,0,u-r);i>0&&v(r+i),e.scrollTop=n,u-(r+i)<=V7&&(R.current=!0),m()};if(t){let e=f-d,t=r+e,n=Math.min(t,u);if(p=n,e<=V7){b(e,f);return}u-n>V7?_=!0:g=!0}else if(n){let e=d,t=r+e,n=Math.min(t,u),i=t-u;if(p=n,e<=V7){b(e,0);return}u-n>V7?h=0:(g=!0,d<f&&(h=d-(e-i)))}if(p=Math.ceil(p),p!==0&&v(p),_||h!=null){let t=U7(e),n=_?t:B7(h,0,t);Math.abs(e.scrollTop-n)>V7&&(e.scrollTop=n)}(g||p>=u-V7)&&(R.current=!0),m()});b.useImperativeHandle(h,()=>U,[U]),B4({open:A,ref:s,onComplete(){A&&c?.(!0)}});let ee={open:A,transitionStatus:N,side:_,align:v};$(()=>{!F||!s.current||Object.keys(V.current).length||(V.current={top:F.style.top||`0`,left:F.style.left||`0`,right:F.style.right,height:F.style.height,bottom:F.style.bottom,minHeight:F.style.minHeight,maxHeight:F.style.maxHeight,marginTop:F.style.marginTop,marginBottom:F.style.marginBottom})},[s,F]),$(()=>{A||y||(B.current=!1,R.current=!1,L.current=0,z.current=0,P7(F,V.current))},[A,y,F,s]),$(()=>{let e=s.current;if(!(!A||!P||!F||!e||o.state.transitionStatus===`ending`)){if(!y){B.current=!0,H.request(m),e.style.removeProperty(`--transform-origin`);return}queueMicrotask(()=>{let t=_ae(e);e.style.removeProperty(`--transform-origin`);try{let t=getComputedStyle(F),n=getComputedStyle(e),r=q1(P),i=OT(F),a=gae(P),o=W7(P.getBoundingClientRect(),a),s=W7(F.getBoundingClientRect(),a),c=o.left,l=o.height,f=I||e,p=f.scrollHeight,h=parseFloat(n.borderBottomWidth),g=parseFloat(t.marginTop)||10,_=parseFloat(t.marginBottom)||10,v=parseFloat(t.minHeight)||100,y=H7(n),b=r.documentElement.clientHeight-g-_,S=r.documentElement.clientWidth,C=b-o.bottom+l,w=d.current,T=u.current,E,D=0,O=0;if(w&&T){let e=W7(T.getBoundingClientRect(),a);E=W7(w.getBoundingClientRect(),a);let t=e.left-c,n=E.left-s.left,r=e.top-o.top+e.height/2,i=E.top-s.top+E.height/2;D=t-n,O=i-r}let k=C+O+_+h,A=Math.min(b,k),j=b-g-_,M=k-A,N=Math.max(5,c+D),z=S-5,H=Math.max(0,N+s.width-z);F.style.left=`${N-H}px`,F.style.height=`${A}px`,F.style.maxHeight=`auto`,F.style.marginTop=`${g}px`,F.style.marginBottom=`${_}px`,e.style.height=`100%`;let U=U7(f),ee=M>=U-V7;ee&&(A=Math.min(b,s.height)-(M-U));let W=o.top<20||o.bottom>b-20||Math.ceil(A)+V7<Math.min(p,v),te=(i.visualViewport?.scale??1)!==1&&x0;if(W||te){B.current=!0,P7(F,V.current),Vq.flushSync(()=>x(!1));return}if(ee){let e=Math.max(0,b-k);F.style.top=s.height>=j?`0`:`${e}px`,F.style.height=`${A}px`,f.scrollTop=U7(f),L.current=Math.max(v,A)}else F.style.bottom=`0`,L.current=Math.max(v,A),f.scrollTop=M;if(E){let t=s.top,n=s.height,r=E.top+E.height/2,i=B7(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(L.current===b||A>=y)&&(R.current=!0),m(),setTimeout(()=>{B.current=!0})}finally{t()}})}},[o,A,F,P,u,d,s,m,y,x,H,S,C,I]),b.useEffect(()=>{if(!y||!F||!A)return;let e=OT(F);function t(e){l(!1,g0(h0,e))}return e.addEventListener(`resize`,t),()=>{e.removeEventListener(`resize`,t)}},[l,y,F,A]);let W={...I?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":p||void 0,id:`${k}-list`},onKeyDown(e){f.current=!0,w&&r3.has(e.key)&&e.stopPropagation()},onMouseMove(){f.current=!1},onPointerLeave(e){if(!g||I7(e)||e.pointerType===`touch`)return;let t=e.currentTarget;O.start(0,()=>{o.set(`activeIndex`,null),t.focus({preventScroll:!0})})},onScroll(e){I||U(e.currentTarget)},...y&&{style:I?{height:`100%`}:F7}},te=NE(`div`,e,{ref:[t,s],state:ee,stateAttributesMapping:mae,props:[M,W,N7(N),{className:!I&&y?R7.className:void 0},a]});return(0,G.jsxs)(b.Fragment,{children:[!D&&R7.getElement(E),(0,G.jsx)(o8,{context:T,modal:!1,disabled:!j,returnFocus:i,restoreFocus:!0,children:te})]})});function H7(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function U7(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function gae(e){return Q8.getScale(e)}function W7(e,t){return T2({x:e.x/t.x,y:e.y/t.y,width:e.width/t.x,height:e.height/t.y})}var G7=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function _ae(e){let{style:t}=e,n={};for(let[e,r]of G7)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of G7){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var vae=b.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{store:a,scrollHandlerRef:o}=h7(),{alignItemWithTriggerActive:s}=M7(),c=x5(a,C7.hasScrollArrows),l=x5(a,C7.openMethod),u=x5(a,C7.multiple),d={id:`${x5(a,C7.id)}-list`,role:`listbox`,"aria-multiselectable":u||void 0,onScroll(e){o.current?.(e.currentTarget)},...s&&{style:F7},className:c&&l!==`touch`?R7.className:void 0};return NE(`div`,e,{ref:[t,XT(e=>{a.set(`listElement`,e)})],props:[d,i]})}),K7=b.createContext(void 0);function q7(){let e=b.useContext(K7);if(!e)throw Error(cE(57));return e}var yae=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,...c}=e,l=b.useRef(null),u=t0({label:a,textRef:l,indexGuessBehavior:e0.GuessFromOrder}),{store:d,getItemProps:f,setOpen:p,setValue:m,selectionRef:h,typingRef:g,valuesRef:_,keyboardActiveRef:v,multiple:y,highlightItemOnHover:x}=h7(),S=d6(),C=x5(d,C7.isActive,u.index),w=x5(d,C7.isSelected,u.index,i),T=x5(d,C7.isSelectedByFocus,u.index),E=x5(d,C7.isItemEqualToValue),D=u.index,O=D!==-1,k=b.useRef(null),A=g6(D);$(()=>{if(!O)return;let e=_.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,_]),$(()=>{if(!O)return;let e=d.state.value,t=e;y&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&_7(i,t,E)&&d.set(`selectedIndex`,D)},[O,D,y,E,d,i]);let j={disabled:o,selected:w,highlighted:C},M=f({active:C,selected:w});M.onFocus=void 0,M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=fE({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function R(e){let t=d.state.value;if(y){let n=Array.isArray(t)?t:[];m(w?Kie(n,i,E):[...n,i],g0(l0,e))}else m(i,g0(l0,e)),p(!1,g0(l0,e))}let z={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onFocus(){d.set(`activeIndex`,D)},onMouseEnter(){!v.current&&d.state.selectedIndex===null&&x&&d.set(`activeIndex`,D)},onMouseMove(){x&&d.set(`activeIndex`,D)},onMouseLeave(e){!x||v.current||I7(e)||S.start(0,()=>{d.state.activeIndex===D&&d.set(`activeIndex`,null)})},onTouchStart(){h.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,d.set(`activeIndex`,D),e.key===` `&&g.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&g.current||P.current!==`touch`&&!C||(N.current=null,R(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!h.current.allowSelectedMouseUp&&w,t=!h.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},B=NE(`div`,e,{ref:[L,t,u.ref,k],state:j,props:[M,z,c,I]}),V=b.useMemo(()=>({selected:w,indexRef:A,textRef:l,selectedByFocus:T,hasRegistered:O}),[w,A,l,T,O]);return(0,G.jsx)(K7.Provider,{value:V,children:B})})),bae=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=q7();return n||r?(0,G.jsx)(xae,{...e,ref:t}):null}),xae=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,keepMounted:i,...a}=e,{selected:o}=q7(),s=b.useRef(null),{transitionStatus:c,setMounted:l}=V4(o),u=NE(`span`,e,{ref:[t,s],state:{selected:o,transitionStatus:c},props:[{"aria-hidden":!0,children:`✔️`},a],stateAttributesMapping:N4});return B4({open:o,ref:s,onComplete(){o||l(!1)}}),u})),Sae=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=q7(),{selectedItemTextRef:o}=h7(),{className:s,render:c,...l}=e;return NE(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:l})})),J7=b.forwardRef(function(e,t){let{render:n,className:r,direction:i,keepMounted:a=!1,...o}=e,{store:s,popupRef:c,listRef:l,handleScrollArrowVisibility:u,scrollArrowsMountedCountRef:d}=h7(),{side:f,scrollDownArrowRef:p,scrollUpArrowRef:m}=M7(),h=x5(s,i===`up`?C7.scrollUpArrowVisible:C7.scrollDownArrowVisible),g=x5(s,C7.openMethod),_=h&&g!==`touch`,v=d6(),y=i===`up`?m:p,{transitionStatus:b,setMounted:x}=V4(_);$(()=>(d.current+=1,s.state.hasScrollArrows||s.set(`hasScrollArrows`,!0),()=>{d.current=Math.max(0,d.current-1),d.current===0&&s.state.hasScrollArrows&&s.set(`hasScrollArrows`,!1)}),[s,d]),B4({open:_,ref:y,onComplete(){_||x(!1)}});let S=NE(`div`,e,{ref:[t,y],state:{direction:i,visible:_,side:f,transitionStatus:b},props:[{"aria-hidden":!0,children:i===`up`?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||v.isStarted())return;s.set(`activeIndex`,null);function t(){let e=s.state.listElement??c.current;if(!e)return;s.set(`activeIndex`,null),u();let n=e.scrollTop===0,r=Math.round(e.scrollTop+e.clientHeight)>=e.scrollHeight;if(l.current.length===0&&(i===`up`?s.set(`scrollUpArrowVisible`,!n):s.set(`scrollDownArrowVisible`,!r)),i===`up`&&n||i===`down`&&r){v.clear();return}if((s.state.listElement||c.current)&&l.current&&l.current.length>0){let t=l.current,n=y.current?.offsetHeight||0;if(i===`up`){let r=0,i=e.scrollTop+n;for(let e=0;e<t.length;e+=1){let n=t[e];if(n&&n.offsetTop>=i){r=e;break}}let a=Math.max(0,r-1);if(a<r){let r=t[a];r&&(e.scrollTop=Math.max(0,r.offsetTop-n))}else e.scrollTop=0}else{let r=t.length-1,i=e.scrollTop+e.clientHeight-n;for(let e=0;e<t.length;e+=1){let n=t[e];if(n&&n.offsetTop+n.offsetHeight>i){r=Math.max(0,e-1);break}}let a=Math.min(t.length-1,r+1);if(a>r){let r=t[a];r&&(e.scrollTop=r.offsetTop+r.offsetHeight-e.clientHeight+n)}else e.scrollTop=e.scrollHeight-e.clientHeight}}v.start(40,t)}v.start(40,t)},onMouseLeave(){v.clear()}},o]});return _||a?S:null}),Cae=b.forwardRef(function(e,t){return(0,G.jsx)(J7,{...e,ref:t,direction:`down`})}),wae=b.forwardRef(function(e,t){return(0,G.jsx)(J7,{...e,ref:t,direction:`up`})}),Tae=b.createContext(void 0),Eae=b.forwardRef(function(e,t){let{className:n,render:r,...i}=e,[a,o]=b.useState(),s=b.useMemo(()=>({labelId:a,setLabelId:o}),[a,o]),c=NE(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":a},i]});return(0,G.jsx)(Tae.Provider,{value:s,children:c})}),Y7=Xie;function X7({className:e,...t}){return(0,G.jsx)(Eae,{"data-slot":`select-group`,className:uO(`scroll-my-1`,e),...t})}function Z7({className:e,...t}){return(0,G.jsx)(rae,{"data-slot":`select-value`,className:uO(`flex flex-1 text-left`,e),...t})}function Q7({className:e,size:t=`default`,children:n,...r}){return(0,G.jsxs)(tae,{"data-slot":`select-trigger`,"data-size":t,className:uO(`border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-none border bg-transparent py-2 pr-2 pl-2.5 text-xs transition-colors select-none focus-visible:ring-1 aria-invalid:ring-1 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-none *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...r,children:[n,(0,G.jsx)(iae,{render:(0,G.jsx)(nn,{className:`text-muted-foreground size-4 pointer-events-none`})})]})}function $7({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,G.jsx)(oae,{children:(0,G.jsx)(fae,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,G.jsxs)(hae,{"data-slot":`select-content`,className:uO(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 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 ring-foreground/10 min-w-36 rounded-none shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto`,e),...s,children:[(0,G.jsx)(Dae,{}),(0,G.jsx)(vae,{children:t}),(0,G.jsx)(Oae,{})]})})})}function e9({className:e,children:t,...n}){return(0,G.jsxs)(yae,{"data-slot":`select-item`,className:uO(`focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2 rounded-none py-2 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...n,children:[(0,G.jsx)(Sae,{className:`flex flex-1 gap-2 shrink-0 whitespace-nowrap`,children:t}),(0,G.jsx)(bae,{render:(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,G.jsx)(tn,{className:`pointer-events-none`})})]})}function Dae({className:e,...t}){return(0,G.jsx)(wae,{"data-slot":`select-scroll-up-button`,className:uO(`bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full`,e),...t,children:(0,G.jsx)(rn,{})})}function Oae({className:e,...t}){return(0,G.jsx)(Cae,{"data-slot":`select-scroll-down-button`,className:uO(`bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full`,e),...t,children:(0,G.jsx)(nn,{})})}var t9=b.createContext(void 0);function kae(){let e=b.useContext(t9);if(e===void 0)throw Error(cE(63));return e}var n9=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),r9={...o7,checked(e){return e?{[n9.checked]:``}:{[n9.unchecked]:``}}};function Aae(e,t,n,r=!0,i){let[a,o]=b.useState(),s=Q1(i?`${i}-label`:void 0),c=e??t??a;return $(()=>{let i=e||t||!r?void 0:jae(n.current,s);a!==i&&o(i)}),c}function jae(e,t){let n=Mae(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Mae(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var Nae=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,id:o,inputRef:s,name:c,nativeButton:l=!1,onCheckedChange:u,readOnly:d=!1,required:f=!1,disabled:p=!1,render:m,uncheckedValue:h,value:g,..._}=e,{clearErrors:v}=c7(),{state:y,setTouched:x,setDirty:S,validityData:C,setFilled:w,setFocused:T,shouldValidateOnChange:E,validationMode:D,disabled:O,name:k,validation:A}=s7(),{labelId:j}=l7(),M=O||p,N=k??c,P=XT(u),F=b.useRef(null),I=hE(F,s,A.inputRef),L=b.useRef(null),R=Q1(),z=u7({id:o,implicit:!1,controlRef:L}),B=l?void 0:z,[V,H]=N1({controlled:n,default:!!i,name:`Switch`,state:`checked`});d7({id:R,commit:A.commit,value:V,controlRef:L,name:N,getValue:()=>V}),$(()=>{F.current&&w(F.current.checked)},[F,w]),e7(V,()=>{v(N),S(V!==C.initialValue),w(V),E()?A.commit(V):A.commit(V,!0)});let{getButtonProps:U,buttonRef:ee}=fE({disabled:M,native:l}),W=Aae(a,j,F,!l,B),te={id:l?z:R,role:`switch`,"aria-checked":V,"aria-readonly":d||void 0,"aria-required":f||void 0,"aria-labelledby":W,onFocus(){M||T(!0)},onBlur(){let e=F.current;!e||M||(x(!0),T(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){d||M||(e.preventDefault(),F.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ne=b.useMemo(()=>$T({checked:V,disabled:M,id:B,name:N,required:f,style:N?b6:y6,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:I,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=g0(a0,e.nativeEvent);P?.(t,n),!n.isCanceled&&H(t)},onFocus(){L.current?.focus()}},A.getInputValidationProps,g===void 0?DE:{value:g}),[V,M,I,B,N,P,f,H,A,g]),re=b.useMemo(()=>({...y,checked:V,disabled:M,readOnly:d,required:f}),[y,V,M,d,f]),ie=NE(`span`,e,{state:re,ref:[t,L,ee],props:[te,A.getValidationProps,_,U],stateAttributesMapping:r9});return(0,G.jsxs)(t9.Provider,{value:re,children:[ie,!V&&N&&h!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,name:N,value:h}),(0,G.jsx)(`input`,{...ne})]})}),Pae=b.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=s7(),o=kae();return NE(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:r9,props:i})});function i9({className:e,size:t=`default`,...n}){return(0,G.jsx)(Nae,{"data-slot":`switch`,"data-size":t,className:uO(`cursor-pointer data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-1 aria-invalid:ring-1 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,G.jsx)(Pae,{"data-slot":`switch-thumb`,className:`bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform`})})}function Fae({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:uO(`border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 h-8 rounded-none border transition-colors has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot][aria-invalid=true]]:ring-1 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,e),...t})}var Iae=UE(`text-muted-foreground h-auto gap-2 py-1.5 text-xs font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-none [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none`,{variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last`,"block-start":`px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}});function Lae({className:e,align:t=`inline-start`,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:uO(Iae({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}function Rae({className:e,...t}){return(0,G.jsx)(a1,{"data-slot":`command`,className:uO(`bg-popover text-popover-foreground rounded-none flex size-full flex-col overflow-hidden`,e),...t})}function zae({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`border-b pb-0`,children:(0,G.jsxs)(Fae,{className:`bg-input/30 border-input/30 h-8 border-none shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,G.jsx)(a1.Input,{"data-slot":`command-input`,className:uO(`w-full text-xs outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,G.jsx)(Lae,{children:(0,G.jsx)(pn,{className:`size-4 shrink-0 opacity-50`})})]})})}function Bae({className:e,...t}){return(0,G.jsx)(a1.List,{"data-slot":`command-list`,className:uO(`no-scrollbar max-h-72 scroll-py-0 outline-none overflow-x-hidden overflow-y-auto`,e),...t})}function Vae({className:e,...t}){return(0,G.jsx)(a1.Empty,{"data-slot":`command-empty`,className:uO(`py-6 text-center text-xs`,e),...t})}function Hae({className:e,...t}){return(0,G.jsx)(a1.Group,{"data-slot":`command-group`,className:uO(`text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs`,e),...t})}function Uae({className:e,children:t,...n}){return(0,G.jsxs)(a1.Item,{"data-slot":`command-item`,className:uO(`data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none [&_svg:not([class*='size-'])]:size-4 in-data-[slot=dialog-content]:rounded-none! group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...n,children:[t,(0,G.jsx)(tn,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var a9=b.createContext(void 0);function o9(e){let t=b.useContext(a9);if(t===void 0&&!e)throw Error(cE(47));return t}function Wae(){return{...O5(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Gae={...A5,disabled:v5(e=>e.disabled),instantType:v5(e=>e.instantType),openMethod:v5(e=>e.openMethod),openChangeReason:v5(e=>e.openChangeReason),modal:v5(e=>e.modal),stickIfOpen:v5(e=>e.stickIfOpen),titleElementId:v5(e=>e.titleElementId),descriptionElementId:v5(e=>e.descriptionElementId),openOnHover:v5(e=>e.openOnHover),closeDelay:v5(e=>e.closeDelay),hasViewport:v5(e=>e.hasViewport)},Kae=class e extends C5{constructor(e){let t={...Wae(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new u6,triggerElements:new D5},Gae)}setOpen=(e,t)=>{let n=t.reason===s0,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let a={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit(`openchange`,a);let o=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Vq.flushSync(o)):o(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=JT(()=>new e(n)).current,i=t??r;return T4(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function s9({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Kae.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});Y5(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`positionerElement`),p=u.useState(`payload`),m=u.useState(`openChangeReason`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:h,triggerProps:g}=t7(d);T5(u);let{forceUnmount:_}=E5(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});$5(d&&o===!0&&m!==`trigger-hover`&&h!==`touch`,f),b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let v=b.useCallback(e=>{let t=g0(e);return t.preventUnmountOnClose=()=>{u.set(`preventUnmountingOnClose`,!0)},t},[u]),y=b.useCallback(()=>{u.setOpen(!1,v(m0))},[u,v]);b.useImperativeHandle(e.actionsRef,()=>({unmount:_,close:y}),[_,y]);let x=M5({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=F5([d8(x,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),V5(x)]),T=b.useMemo(()=>S(g),[S,g]),E=b.useMemo(()=>w(g),[w,g]),D=b.useMemo(()=>C(),[C]);u.useSyncedValues({modal:o,openMethod:h,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:x,nested:K6()!=null});let O=b.useMemo(()=>({store:u}),[u]);return(0,G.jsx)(a9.Provider,{value:O,children:typeof t==`function`?t({payload:p}):t})}function qae(e){return o9(!0)?(0,G.jsx)(s9,{props:e}):(0,G.jsx)(X6,{children:(0,G.jsx)(s9,{props:e})})}var Jae=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,...f}=e,p=o9(!0),m=o?.store??p?.store;if(!m)throw Error(cE(74));let h=Q1(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),v=m.useState(`isOpenedByTrigger`,h),y=b.useRef(null),{registerTrigger:x,isMountedByThisTrigger:S}=Rre(h,y,m,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),C=m.useState(`openChangeReason`),w=m.useState(`stickIfOpen`),T=m.useState(`openMethod`),E=qre(_,{enabled:_!=null&&c&&(T!==`touch`||C!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:nie(),restMs:l,delay:{close:u},triggerElementRef:y,isActiveTrigger:g}),D=F5([s8(_,{enabled:_!=null,stickIfOpen:w})]),O=m.useState(`triggerProps`,S),k={disabled:i,open:v},{getButtonProps:A,buttonRef:j}=fE({disabled:i,native:a}),M=b.useMemo(()=>({open(e){return e&&C===`trigger-press`?i6.open(e):r6.open(e)}}),[C]),N=NE(`button`,e,{state:k,ref:[j,t,x,y],props:[D.getReferenceProps(),E,O,{[kE]:``,id:h},f,A],stateAttributesMapping:M}),P=b.useRef(null),F=XT(e=>{Vq.flushSync(()=>{m.setOpen(!1,g0(d0,e.nativeEvent,e.currentTarget))}),y4(P.current)?.focus()}),I=XT(e=>{let t=m.select(`positionerElement`);if(t&&b4(e,t))m.context.beforeContentFocusGuardRef.current?.focus();else{Vq.flushSync(()=>{m.setOpen(!1,g0(d0,e.nativeEvent,e.currentTarget))});let n=v4(m.context.triggerFocusTargetRef.current||y.current);for(;n!==null&&I0(t,n);){let e=n;if(n=h4(n),n===e)break}n?.focus()}});return g?(0,G.jsxs)(b.Fragment,{children:[(0,G.jsx)(x6,{ref:P,onFocus:F}),(0,G.jsx)(b.Fragment,{children:N},h),(0,G.jsx)(x6,{ref:m.context.triggerFocusTargetRef,onFocus:I})]}):(0,G.jsx)(b.Fragment,{children:N},h)}),c9=b.createContext(void 0);function Yae(){let e=b.useContext(c9);if(e===void 0)throw Error(cE(45));return e}var Xae=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=o9();return i.useState(`mounted`)||n?(0,G.jsx)(c9.Provider,{value:n,children:(0,G.jsx)(V6,{ref:t,...r})}):null}),l9=b.createContext(void 0);function Zae(){let e=b.useContext(l9);if(!e)throw Error(cE(46));return e}var Qae=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=jE,...g}=e,{store:_}=o9(),v=Yae(),y=J6(),x=_.useState(`floatingRootContext`),S=_.useState(`mounted`),C=_.useState(`open`),w=_.useState(`openChangeReason`),T=_.useState(`activeTriggerElement`),E=_.useState(`modal`),D=_.useState(`positionerElement`),O=_.useState(`instantType`),k=_.useState(`transitionStatus`),A=_.useState(`hasViewport`),j=b.useRef(null),M=z4(D,!1,!1),N=k7({anchor:i,floatingRootContext:x,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:v,nodeId:y,collisionAvoidance:h,adaptiveOrigin:A?uae:void 0}),P=b.useMemo(()=>{let e={};return C||(e.pointerEvents=`none`),{role:`presentation`,hidden:!S,style:{...N.positionerStyles,...e}}},[C,S,N.positionerStyles]),F=b.useMemo(()=>({props:P,...N}),[P,N]),I=x.useState(`domReferenceElement`);$(()=>{let e=I,t=j.current;if(e&&(j.current=e),t&&e&&e!==t){_.set(`instantType`,void 0);let e=new AbortController;return M(()=>{_.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,M,_]);let L={open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:O},R=b.useCallback(e=>{_.set(`positionerElement`,e)},[_]),z=NE(`div`,e,{state:L,props:[F.props,N7(k),g],ref:[t,R],stateAttributesMapping:a6});return(0,G.jsxs)(l9.Provider,{value:F,children:[S&&E===!0&&w!==`trigger-hover`&&(0,G.jsx)(J5,{ref:_.context.internalBackdropRef,inert:k4(!C),cutout:T}),(0,G.jsx)(Y6,{id:y,children:z})]})}),$ae=b.createContext(void 0);function eoe(){let[e,t]=b.useState(0),n=XT(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function toe(e){let{value:t,children:n}=e;return(0,G.jsx)($ae.Provider,{value:t,children:n})}var noe={...a6,...N4},roe=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,...o}=e,{store:s}=o9(),c=Zae(),l=z7(!0)!=null,{context:u,hasClosePart:d}=eoe(),f=s.useState(`open`),p=s.useState(`openMethod`),m=s.useState(`instantType`),h=s.useState(`transitionStatus`),g=s.useState(`popupProps`),_=s.useState(`titleElementId`),v=s.useState(`descriptionElementId`),y=s.useState(`modal`),x=s.useState(`mounted`),S=s.useState(`openChangeReason`),C=s.useState(`activeTriggerElement`),w=s.useState(`floatingRootContext`);B4({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}});let T=s.useState(`disabled`),E=s.useState(`openOnHover`),D=s.useState(`closeDelay`);Gre(w,{enabled:E&&!T,closeDelay:D});function O(e){return e===`touch`?s.context.popupRef.current:!0}let k=i===void 0?O:i,A={open:f,side:c.side,align:c.align,instant:m,transitionStatus:h},j=y!==!1&&d,M=b.useCallback(e=>{s.set(`popupElement`,e)},[s]),N=NE(`div`,e,{state:A,ref:[t,s.context.popupRef,M],props:[g,{"aria-labelledby":_,"aria-describedby":v,onKeyDown(e){l&&r3.has(e.key)&&e.stopPropagation()}},N7(h),o],stateAttributesMapping:noe});return(0,G.jsx)(o8,{context:w,openInteractionType:p,modal:j,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:MT(C)?C:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:(0,G.jsx)(toe,{value:u,children:N})})});function ioe({...e}){return(0,G.jsx)(qae,{"data-slot":`popover`,...e})}function aoe({...e}){return(0,G.jsx)(Jae,{"data-slot":`popover-trigger`,...e})}function ooe({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,G.jsx)(Xae,{children:(0,G.jsx)(Qae,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,G.jsx)(roe,{"data-slot":`popover-content`,className:uO(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 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 ring-foreground/10 flex flex-col gap-2.5 rounded-none p-2.5 text-xs shadow-md ring-1 duration-100 z-50 w-72 origin-(--transform-origin) outline-hidden`,e),...a})})})}var u9=[{value:`en-US`,label:`English (US)`},{value:`es-ES`,label:`español (España)`},{value:`fr-FR`,label:`français (France)`},{value:`de-DE`,label:`Deutsch`},{value:`it-IT`,label:`italiano`},{value:`am-ET`,label:`አማርኛ`},{value:`ar`,label:`العربية`},{value:`bg-BG`,label:`български`},{value:`bn-BD`,label:`বাংলা`},{value:`bs-BA`,label:`bosanski`},{value:`ca-ES`,label:`català`},{value:`cs-CZ`,label:`čeština`},{value:`da-DK`,label:`dansk`},{value:`el-GR`,label:`Ελληνικά`},{value:`es-419`,label:`español (Latinoamérica)`},{value:`et-EE`,label:`eesti`},{value:`fi-FI`,label:`suomi`},{value:`fr-CA`,label:`français (Canada)`},{value:`gu-IN`,label:`ગુજરાતી`},{value:`hi-IN`,label:`हिन्दी`},{value:`hr-HR`,label:`hrvatski`},{value:`hu-HU`,label:`magyar`},{value:`hy-AM`,label:`հայերեն`},{value:`id-ID`,label:`Indonesia`},{value:`is-IS`,label:`íslenska`},{value:`ja-JP`,label:`日本語`},{value:`ka-GE`,label:`ქართული`},{value:`kk-KZ`,label:`қазақ тілі`},{value:`kn-IN`,label:`ಕನ್ನಡ`},{value:`ko-KR`,label:`한국어`},{value:`lt-LT`,label:`lietuvių`},{value:`lv-LV`,label:`latviešu`},{value:`mk-MK`,label:`македонски`},{value:`ml-IN`,label:`മലയാളം`},{value:`mn-MN`,label:`монгол`},{value:`mr-IN`,label:`मराठी`},{value:`ms-MY`,label:`Bahasa Melayu`},{value:`my-MM`,label:`မြန်မာ`},{value:`nb-NO`,label:`norsk bokmål`},{value:`nl-NL`,label:`Nederlands`},{value:`pa-IN`,label:`ਪੰਜਾਬੀ`},{value:`pl-PL`,label:`polski`},{value:`pt-BR`,label:`português (Brasil)`},{value:`pt-PT`,label:`português (Portugal)`},{value:`ro-RO`,label:`română`},{value:`ru-RU`,label:`русский`},{value:`sk-SK`,label:`slovenčina`},{value:`sl-SI`,label:`slovenščina`},{value:`so-SO`,label:`Soomaali`},{value:`sq-AL`,label:`shqip`},{value:`sr-RS`,label:`српски`},{value:`sv-SE`,label:`svenska`},{value:`sw-KE`,label:`Kiswahili`},{value:`ta-IN`,label:`தமிழ்`},{value:`te-IN`,label:`తెలుగు`},{value:`th-TH`,label:`ไทย`},{value:`tl-PH`,label:`Tagalog`},{value:`tr-TR`,label:`Türkçe`},{value:`uk-UA`,label:`українська`},{value:`ur-PK`,label:`اردو`},{value:`vi-VN`,label:`Tiếng Việt`},{value:`zh-Hans`,label:`简体中文`},{value:`zh-Hant-HK`,label:`繁體中文(香港)`},{value:`zh-Hant-TW`,label:`繁體中文(台灣)`}],soe=({value:e,onValueChange:t})=>{let[n,r]=(0,b.useState)(!1),i=u9.find(t=>t.value===e);return(0,G.jsxs)(ioe,{open:n,onOpenChange:r,children:[(0,G.jsx)(aoe,{children:(0,G.jsxs)(fO,{variant:`outline`,role:`combobox`,"aria-expanded":n,className:`w-full justify-between`,children:[i?(0,G.jsxs)(`span`,{children:[i.value,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`- `,i.label]})]}):`Select locale...`,(0,G.jsx)(an,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,G.jsx)(ooe,{className:`w-full p-0`,children:(0,G.jsxs)(Rae,{children:[(0,G.jsx)(zae,{placeholder:`Search locale...`}),(0,G.jsxs)(Bae,{children:[(0,G.jsx)(Vae,{children:`No locale found.`}),(0,G.jsx)(Hae,{children:u9.map(n=>(0,G.jsxs)(Uae,{value:n.value,onSelect:n=>{t(n===e?``:n),r(!1)},children:[(0,G.jsxs)(`span`,{children:[n.label,` `,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,n.value,`)`]})]}),(0,G.jsx)(tn,{className:uO(`ml-auto h-4 w-4`,e===n.value?`opacity-100`:`opacity-0`)})]},n.value))})]})]})})]})};function coe({resourceUri:e}){let{data:t}=TT(e);return t?(0,G.jsx)(`div`,{className:`text-xs`,children:(0,G.jsx)(q3,{src:t.contents[0],name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,style:{fontSize:`0.75rem`},collapsed:4,collapseStringsAfterLength:80})}):null}var loe=()=>{let e=wT(),{openaiRef:t,openaiObject:n,openInAppUrl:r}=cC(e.name),{setToolData:i}=sC(),a=bh(e=>e.setPreference),o=e._meta?.[`openai/outputTemplate`],s=(r,o)=>{let s=t?.current?.contentWindow?.openai;s&&n&&(s[r]=o,i(e.name,{openaiObject:{...n,[r]:o}}),r in yh&&a(r,o))};return n?(0,G.jsx)(`div`,{className:`overflow-auto max-h-full min-h-0`,children:(0,G.jsxs)(_3,{defaultValue:`view-state`,className:`gap-0`,children:[(0,G.jsxs)(y3,{className:`border-b border-border w-full`,children:[(0,G.jsx)(b3,{value:`properties`,children:`Properties`}),(0,G.jsx)(b3,{value:`view-state`,children:`View State`}),o&&(0,G.jsx)(b3,{value:`resource`,children:`Resource`})]}),(0,G.jsx)(x3,{value:`properties`,className:`p-4`,children:(0,G.jsxs)(Pie,{children:[(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Display Mode`}),(0,G.jsxs)(Y7,{value:n.displayMode,onValueChange:e=>s(`displayMode`,e),"aria-label":`Select framework`,items:[{label:`Inline`,value:`inline`},{label:`Fullscreen`,value:`fullscreen`},{label:`Pip`,value:`pip`},{label:`Modal`,value:`modal`}],name:`displayMode`,required:!0,children:[(0,G.jsx)(Q7,{children:(0,G.jsx)(Z7,{})}),(0,G.jsx)($7,{children:(0,G.jsxs)(X7,{children:[(0,G.jsx)(e9,{value:`inline`,children:`Inline`}),(0,G.jsx)(e9,{value:`fullscreen`,children:`Fullscreen`}),(0,G.jsx)(e9,{value:`pip`,children:`Pip`}),(0,G.jsx)(e9,{value:`modal`,children:`Modal`})]})})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Theme`}),(0,G.jsxs)(Mie,{children:[(0,G.jsx)(fO,{variant:n.theme===`light`?`default`:`outline`,onClick:()=>s(`theme`,`light`),children:(0,G.jsx)(mn,{})}),(0,G.jsx)(fO,{variant:n.theme===`dark`?`default`:`outline`,onClick:()=>s(`theme`,`dark`),children:(0,G.jsx)(un,{})})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Locale`}),(0,G.jsx)(soe,{value:n.locale,onValueChange:e=>s(`locale`,e)})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Max Height`}),(0,G.jsx)(f7,{type:`number`,value:n.maxHeight===void 0?``:String(n.maxHeight),onChange:e=>{let t=e.target.value.trim();s(`maxHeight`,t===``?void 0:Number(t))}})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Safe Area Insets`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:[`top`,`bottom`,`left`,`right`].map(e=>{let t=e.charAt(0).toUpperCase()+e.slice(1);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`safeArea-${e}`,className:`text-xs text-muted-foreground block mb-1`,children:t}),(0,G.jsx)(f7,{id:`safeArea-${e}`,type:`number`,value:n.safeArea?.insets?.[e]===void 0?`0`:String(n.safeArea.insets[e]),onChange:t=>{let r=t.target.value.trim();s(`safeArea`,{...n.safeArea,insets:{...n.safeArea?.insets,[e]:r===``?0:Number(r)}})}})]},e)})})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Device Type`}),(0,G.jsxs)(Y7,{value:n.userAgent?.device?.type??`desktop`,onValueChange:e=>s(`userAgent`,{...n.userAgent,device:{...n.userAgent?.device,type:e}}),"aria-label":`Select device type`,items:[{label:`Mobile`,value:`mobile`},{label:`Desktop`,value:`desktop`}],name:`deviceType`,required:!0,children:[(0,G.jsx)(Q7,{children:(0,G.jsx)(Z7,{})}),(0,G.jsx)($7,{children:(0,G.jsxs)(X7,{children:[(0,G.jsx)(e9,{value:`mobile`,children:`Mobile`}),(0,G.jsx)(e9,{value:`desktop`,children:`Desktop`})]})})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Capabilities`}),(0,G.jsxs)(`div`,{className:`flex gap-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:`hover`,className:`text-xs text-muted-foreground cursor-pointer`,children:`Hover`}),(0,G.jsx)(i9,{id:`hover`,checked:n.userAgent?.capabilities?.hover??!1,onCheckedChange:e=>s(`userAgent`,{...n.userAgent,capabilities:{...n.userAgent?.capabilities,hover:e}})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:`touch`,className:`text-xs text-muted-foreground cursor-pointer`,children:`Touch`}),(0,G.jsx)(i9,{id:`touch`,checked:n.userAgent?.capabilities?.touch??!1,onCheckedChange:e=>s(`userAgent`,{...n.userAgent,capabilities:{...n.userAgent?.capabilities,touch:e}})})]})]})]}),(0,G.jsxs)(n7,{children:[(0,G.jsx)(r7,{children:`Open in App URL`}),(0,G.jsx)(f7,{type:`text`,value:r??``,readOnly:!0,placeholder:`Not set`,className:`font-mono text-xs`})]})]})}),(0,G.jsx)(x3,{value:`view-state`,className:`p-4`,children:(0,G.jsx)(q3,{src:n.widgetState??{},name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,collapsed:3,collapseStringsAfterLength:80})}),o&&(0,G.jsx)(x3,{value:`resource`,className:`p-4`,children:(0,G.jsx)(b.Suspense,{fallback:(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading resource...`}),children:(0,G.jsx)(coe,{resourceUri:o})})})]})}):null};function d9(e){return new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3})}function uoe(e,t=60){let n=JSON.stringify(e);return n.length>t?`${n.slice(0,t)}…`:n}function doe({log:e}){let[t,n]=(0,b.useState)(!1),r=Object.keys(e.args).length>0,i=r?uoe(e.args):null;return(0,G.jsxs)(G.Fragment,{children:[r?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex items-center gap-2 py-1.5 px-2 text-xs font-mono border-b border-gray-200 dark:border-gray-800/50 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800/30 w-full text-left`,children:[(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-500 shrink-0 min-w-[80px]`,children:d9(e.timestamp)}),(0,G.jsx)(`span`,{className:uO(`font-semibold shrink-0 min-w-[120px]`,e.type===`response`?`text-green-600 dark:text-green-400`:`text-blue-600 dark:text-blue-400`),children:e.command}),(0,G.jsx)(`span`,{className:`text-gray-500 dark:text-gray-600 mr-1`,children:t?`▼`:`▶`}),(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400 truncate flex-1 min-w-0`,children:i})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5 px-2 text-xs font-mono border-b border-gray-200 dark:border-gray-800/50`,children:[(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-500 shrink-0 min-w-[80px]`,children:d9(e.timestamp)}),(0,G.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400 font-semibold shrink-0 min-w-[120px]`,children:e.command})]}),t&&r&&(0,G.jsx)(`div`,{className:`px-2 py-2 bg-gray-50 dark:bg-gray-900/30 border-b border-gray-200 dark:border-gray-800/50`,children:(0,G.jsx)(`pre`,{className:`text-xs font-mono text-gray-800 dark:text-gray-200 whitespace-pre-wrap overflow-x-auto`,children:JSON.stringify(e.args,null,2)})})]})}function foe(){let e=wT(),{setToolData:t}=sC(),{openaiLogs:n}=cC(e.name),r=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight)},[]),(0,G.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden min-h-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3 h-8 flex-none`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-200`,children:`MCP client logs`}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:n.length>0&&(0,G.jsxs)(fO,{variant:`ghost`,size:`sm`,onClick:()=>{t(e.name,{openaiLogs:[]})},children:[(0,G.jsx)(hn,{className:`w-3 h-3`}),`Clear`]})})]}),(0,G.jsx)(`div`,{ref:r,className:`overflow-auto flex-1 bg-gray-50 rounded-lg border border-gray-200 min-h-0`,children:n.map(e=>(0,G.jsx)(doe,{log:e},e.id))})]})}var poe=UE(`relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-xl border px-3.5 py-3 text-card-foreground text-sm has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-[1lh] [&>svg]:w-4`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&>svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 [&>svg]:text-destructive`,info:`border-info/32 bg-info/4 [&>svg]:text-info`,success:`border-success/32 bg-success/4 [&>svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&>svg]:text-warning`}}});function moe({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:uO(poe({variant:t}),e),"data-slot":`alert`,role:`alert`,...n})}function hoe({className:e,...t}){return(0,G.jsx)(`div`,{className:uO(`font-medium [svg~&]:col-start-2`,e),"data-slot":`alert-title`,...t})}function goe({className:e,...t}){return(0,G.jsx)(`div`,{className:uO(`flex flex-col gap-2.5 text-muted-foreground [svg~&]:col-start-2`,e),"data-slot":`alert-description`,...t})}var _oe=()=>{let e=cC(wT().name);return e?(0,G.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden bg-card`,children:(0,G.jsx)(`div`,{className:`p-4 overflow-auto`,children:e.response?e.response.isError?(0,G.jsxs)(moe,{variant:`error`,children:[(0,G.jsx)(on,{}),(0,G.jsx)(hoe,{children:`Error`}),(0,G.jsx)(goe,{children:(()=>{let t=[];return e.response.content.forEach(e=>{e.type===`text`&&t.push(e.text)}),t.join(`
153
153
  `)})()})]}):(0,G.jsx)(`div`,{className:`text-xs`,children:(0,G.jsx)(q3,{src:e.response??{},name:null,quotesOnKeys:!1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,theme:`rjv-default`,style:{fontSize:`0.75rem`},collapsed:3,collapseStringsAfterLength:80})}):null})}):null},f9=`openai:set_globals`,voe=class extends CustomEvent{type=f9},yoe=qu([Z(`light`),Z(`dark`)]).describe(`Color theme preference for the host environment.`),p9=qu([Z(`inline`),Z(`fullscreen`),Z(`pip`)]).describe(`Display mode for UI presentation.`),boe=$u(qu([Z(`--color-background-primary`),Z(`--color-background-secondary`),Z(`--color-background-tertiary`),Z(`--color-background-inverse`),Z(`--color-background-ghost`),Z(`--color-background-info`),Z(`--color-background-danger`),Z(`--color-background-success`),Z(`--color-background-warning`),Z(`--color-background-disabled`),Z(`--color-text-primary`),Z(`--color-text-secondary`),Z(`--color-text-tertiary`),Z(`--color-text-inverse`),Z(`--color-text-ghost`),Z(`--color-text-info`),Z(`--color-text-danger`),Z(`--color-text-success`),Z(`--color-text-warning`),Z(`--color-text-disabled`),Z(`--color-border-primary`),Z(`--color-border-secondary`),Z(`--color-border-tertiary`),Z(`--color-border-inverse`),Z(`--color-border-ghost`),Z(`--color-border-info`),Z(`--color-border-danger`),Z(`--color-border-success`),Z(`--color-border-warning`),Z(`--color-border-disabled`),Z(`--color-ring-primary`),Z(`--color-ring-secondary`),Z(`--color-ring-inverse`),Z(`--color-ring-info`),Z(`--color-ring-danger`),Z(`--color-ring-success`),Z(`--color-ring-warning`),Z(`--font-sans`),Z(`--font-mono`),Z(`--font-weight-normal`),Z(`--font-weight-medium`),Z(`--font-weight-semibold`),Z(`--font-weight-bold`),Z(`--font-text-xs-size`),Z(`--font-text-sm-size`),Z(`--font-text-md-size`),Z(`--font-text-lg-size`),Z(`--font-heading-xs-size`),Z(`--font-heading-sm-size`),Z(`--font-heading-md-size`),Z(`--font-heading-lg-size`),Z(`--font-heading-xl-size`),Z(`--font-heading-2xl-size`),Z(`--font-heading-3xl-size`),Z(`--font-text-xs-line-height`),Z(`--font-text-sm-line-height`),Z(`--font-text-md-line-height`),Z(`--font-text-lg-line-height`),Z(`--font-heading-xs-line-height`),Z(`--font-heading-sm-line-height`),Z(`--font-heading-md-line-height`),Z(`--font-heading-lg-line-height`),Z(`--font-heading-xl-line-height`),Z(`--font-heading-2xl-line-height`),Z(`--font-heading-3xl-line-height`),Z(`--border-radius-xs`),Z(`--border-radius-sm`),Z(`--border-radius-md`),Z(`--border-radius-lg`),Z(`--border-radius-xl`),Z(`--border-radius-full`),Z(`--border-width-regular`),Z(`--shadow-hairline`),Z(`--shadow-sm`),Z(`--shadow-md`),Z(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
154
154
 
155
155
  Individual style keys are optional - hosts may provide any subset of these values.
@@ -196,7 +196,7 @@ Boolean requesting whether a visible border and background is provided by the ho
196
196
  - omitted: host decides border`)}),X({method:Z(`ui/request-display-mode`),params:X({mode:p9.describe(`The display mode being requested.`)})}),X({mode:p9.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough();var Toe=qu([Z(`model`),Z(`app`)]).describe(`Tool visibility scope - who can access the tool.`);X({resourceUri:J().optional(),visibility:Y(Toe).optional().describe(`Who can access this tool. Default: ["model", "app"]
197
197
  - "model": Tool visible to and callable by the agent
198
198
  - "app": Tool callable by the app from this server only`)}),X({mimeTypes:Y(J()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),X({method:Z(`ui/download-file`),params:X({contents:Y(qu([yp,bp])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),X({method:Z(`ui/message`),params:X({role:Z(`user`).describe(`Message role, currently only "user" is supported.`),content:Y(xp).describe(`Message content blocks (text, image, etc.).`)})}),X({method:Z(`ui/notifications/sandbox-resource-ready`),params:X({html:J().describe(`HTML content to load into the inner iframe.`),sandbox:J().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:m9.optional().describe(`CSP configuration from resource metadata.`),permissions:h9.optional().describe(`Sandbox permissions from resource metadata.`)})}),X({method:Z(`ui/notifications/tool-result`),params:Ap.describe(`Standard MCP tool execution result.`)});var _9=X({toolInfo:X({id:qd.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Dp.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:yoe.optional().describe(`Current color theme preference.`),styles:Soe.optional().describe(`Style configuration for theming the app.`),displayMode:p9.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:Y(p9).optional().describe(`Display modes the host supports.`),containerDimensions:qu([X({height:Ou().describe(`Fixed container height in pixels.`)}),X({maxHeight:qu([Ou(),Pu()]).optional().describe(`Maximum container height in pixels.`)})]).and(qu([X({width:Ou().describe(`Fixed container width in pixels.`)}),X({maxWidth:qu([Ou(),Pu()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
199
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:J().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:J().optional().describe(`User's timezone in IANA format.`),userAgent:J().optional().describe(`Host application identifier.`),platform:qu([Z(`web`),Z(`desktop`),Z(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:X({touch:Mu().optional().describe(`Whether the device supports touch input.`),hover:Mu().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:X({top:Ou().describe(`Top safe area inset in pixels.`),right:Ou().describe(`Right safe area inset in pixels.`),bottom:Ou().describe(`Bottom safe area inset in pixels.`),left:Ou().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();X({method:Z(`ui/notifications/host-context-changed`),params:_9.describe(`Partial context update containing only changed fields.`)}),X({method:Z(`ui/update-model-context`),params:X({content:Y(xp).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:$u(J(),Bu().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),X({method:Z(`ui/initialize`),params:X({appInfo:uf.describe(`App identification (name and version).`),appCapabilities:woe.describe(`Features and capabilities this app provides.`),protocolVersion:J().describe(`Protocol version this app supports.`)})}),X({protocolVersion:J().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:uf.describe(`Host application identification and version.`),hostCapabilities:Coe.describe(`Features and capabilities provided by the host.`),hostContext:_9.describe(`Rich context about the host environment.`)}).passthrough();var Eoe=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},v9=class{constructor(e){this.generateIdentifier=e,this.kv=new Eoe}register(e,t){this.kv.getByValue(e)||(t||=this.generateIdentifier(e),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Doe=class extends v9{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t==`object`?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function Ooe(e){if(`values`in Object)return Object.values(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function koe(e,t){let n=Ooe(e);if(`find`in n)return n.find(t);let r=n;for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}function y9(e,t){Object.entries(e).forEach(([e,n])=>t(n,e))}function b9(e,t){return e.indexOf(t)!==-1}function x9(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return r}}var Aoe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return koe(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},joe=e=>Object.prototype.toString.call(e).slice(8,-1),S9=e=>e===void 0,Moe=e=>e===null,C9=e=>typeof e!=`object`||!e||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,w9=e=>C9(e)&&Object.keys(e).length===0,T9=e=>Array.isArray(e),Noe=e=>typeof e==`string`,Poe=e=>typeof e==`number`&&!isNaN(e),Foe=e=>typeof e==`boolean`,Ioe=e=>e instanceof RegExp,E9=e=>e instanceof Map,D9=e=>e instanceof Set,O9=e=>joe(e)===`Symbol`,Loe=e=>e instanceof Date&&!isNaN(e.valueOf()),k9=e=>e instanceof Error,A9=e=>typeof e==`number`&&isNaN(e),Roe=e=>Foe(e)||Moe(e)||S9(e)||Poe(e)||Noe(e)||O9(e),zoe=e=>typeof e==`bigint`,Boe=e=>e===1/0||e===-1/0,Voe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Hoe=e=>e instanceof URL,j9=e=>e.replace(/\\/g,`\\\\`).replace(/\./g,`\\.`),M9=e=>e.map(String).map(j9).join(`.`),N9=(e,t)=>{let n=[],r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(!t&&a===`\\`){let t=e.charAt(i+1);if(t===`\\`){r+=`\\`,i++;continue}else if(t!==`.`)throw Error(`invalid path`)}if(a===`\\`&&e.charAt(i+1)===`.`){r+=`.`,i++;continue}if(a===`.`){n.push(r),r=``;continue}r+=a}let i=r;return n.push(i),n};function P9(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var F9=[P9(S9,`undefined`,()=>null,()=>void 0),P9(zoe,`bigint`,e=>e.toString(),e=>typeof BigInt<`u`?BigInt(e):(console.error(`Please add a BigInt polyfill.`),e)),P9(Loe,`Date`,e=>e.toISOString(),e=>new Date(e)),P9(k9,`Error`,(e,t)=>{let n={name:e.name,message:e.message};return`cause`in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n},(e,t)=>{let n=Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n}),P9(Ioe,`regexp`,e=>``+e,e=>{let t=e.slice(1,e.lastIndexOf(`/`)),n=e.slice(e.lastIndexOf(`/`)+1);return new RegExp(t,n)}),P9(D9,`set`,e=>[...e.values()],e=>new Set(e)),P9(E9,`map`,e=>[...e.entries()],e=>new Map(e)),P9(e=>A9(e)||Boe(e),`number`,e=>A9(e)?`NaN`:e>0?`Infinity`:`-Infinity`,Number),P9(e=>e===0&&1/e==-1/0,`number`,()=>`-0`,Number),P9(Hoe,`URL`,e=>e.toString(),e=>new URL(e))];function I9(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var L9=I9((e,t)=>O9(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>[`symbol`,t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{let r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown symbol`);return r}),Uoe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),R9=I9(Voe,e=>[`typed-array`,e.constructor.name],e=>[...e],(e,t)=>{let n=Uoe[t[1]];if(!n)throw Error(`Trying to deserialize unknown typed array`);return new n(e)});function z9(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var B9=I9(z9,(e,t)=>[`class`,t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};let r={};return n.forEach(t=>{r[t]=e[t]}),r},(e,t,n)=>{let r=n.classRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),V9=I9((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>[`custom`,t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{let r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error(`Trying to deserialize unknown custom value`);return r.deserialize(e)}),Woe=[B9,L9,V9,R9],H9=(e,t)=>{let n=x9(Woe,n=>n.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};let r=x9(F9,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},U9={};F9.forEach(e=>{U9[e.annotation]=e});var Goe=(e,t,n)=>{if(T9(t))switch(t[0]){case`symbol`:return L9.untransform(e,t,n);case`class`:return B9.untransform(e,t,n);case`custom`:return V9.untransform(e,t,n);case`typed-array`:return R9.untransform(e,t,n);default:throw Error(`Unknown transformation: `+t)}else{let r=U9[t];if(!r)throw Error(`Unknown transformation: `+t);return r.untransform(e,n)}},W9=(e,t)=>{if(t>e.size)throw Error(`index out of bounds`);let n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function G9(e){if(b9(e,`__proto__`))throw Error(`__proto__ is not allowed as a property`);if(b9(e,`prototype`))throw Error(`prototype is not allowed as a property`);if(b9(e,`constructor`))throw Error(`constructor is not allowed as a property`)}var Koe=(e,t)=>{G9(t);for(let n=0;n<t.length;n++){let r=t[n];if(D9(e))e=W9(e,+r);else if(E9(e)){let i=+r,a=+t[++n]==0?`key`:`value`,o=W9(e,i);switch(a){case`key`:e=o;break;case`value`:e=e.get(o);break}}else e=e[r]}return e},K9=(e,t,n)=>{if(G9(t),t.length===0)return n(e);let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(T9(r)){let e=+n;r=r[e]}else if(C9(r))r=r[n];else if(D9(r)){let e=+n;r=W9(r,e)}else if(E9(r)){if(e===t.length-2)break;let i=+n,a=+t[++e]==0?`key`:`value`,o=W9(r,i);switch(a){case`key`:r=o;break;case`value`:r=r.get(o);break}}}let i=t[t.length-1];if(T9(r)?r[+i]=n(r[+i]):C9(r)&&(r[i]=n(r[i])),D9(r)){let e=W9(r,+i),t=n(e);e!==t&&(r.delete(e),r.add(t))}if(E9(r)){let e=+t[t.length-2],a=W9(r,e);switch(+i==0?`key`:`value`){case`key`:{let e=n(a);r.set(e,r.get(a)),e!==a&&r.delete(a);break}case`value`:r.set(a,n(r.get(a)));break}}return e},q9=e=>e<1;function J9(e,t,n,r=[]){if(!e)return;let i=q9(n);if(!T9(e)){y9(e,(e,a)=>J9(e,t,n,[...r,...N9(a,i)]));return}let[a,o]=e;o&&y9(o,(e,a)=>{J9(e,t,n,[...r,...N9(a,i)])}),t(a,r)}function qoe(e,t,n,r){return J9(t,(t,n)=>{e=K9(e,n,e=>Goe(e,t,r))},n),e}function Joe(e,t,n){let r=q9(n);function i(t,n){let i=Koe(e,N9(n,r));t.map(e=>N9(e,r)).forEach(t=>{e=K9(e,t,()=>i)})}if(T9(t)){let[n,a]=t;n.forEach(t=>{e=K9(e,N9(t,r),()=>e)}),a&&y9(a,i)}else y9(t,i);return e}var Yoe=(e,t)=>C9(e)||T9(e)||E9(e)||D9(e)||k9(e)||z9(e,t);function Xoe(e,t,n){let r=n.get(e);r?r.push(t):n.set(e,[t])}function Zoe(e,t){let n={},r;return e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[i,...a]=e;i.length===0?r=a.map(M9):n[M9(i)]=a.map(M9)}),r?w9(n)?[r]:[r,n]:w9(n)?void 0:n}var Y9=(e,t,n,r,i=[],a=[],o=new Map)=>{let s=Roe(e);if(!s){Xoe(e,i,t);let n=o.get(e);if(n)return r?{transformedValue:null}:n}if(!Yoe(e,n)){let t=H9(e,n),r=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return s||o.set(e,r),r}if(b9(a,e))return{transformedValue:null};let c=H9(e,n),l=c?.value??e,u=T9(l)?[]:{},d={};y9(l,(s,c)=>{if(c===`__proto__`||c===`constructor`||c===`prototype`)throw Error(`Detected property ${c}. This is a prototype pollution risk, please remove it from your object.`);let l=Y9(s,t,n,r,[...i,c],[...a,e],o);u[c]=l.transformedValue,T9(l.annotations)?d[j9(c)]=l.annotations:C9(l.annotations)&&y9(l.annotations,(e,t)=>{d[j9(c)+`.`+t]=e})});let f=w9(d)?{transformedValue:u,annotations:c?[c.type]:void 0}:{transformedValue:u,annotations:c?[c.type,d]:d};return s||o.set(e,f),f};function X9(e){return Object.prototype.toString.call(e).slice(8,-1)}function Z9(e){return X9(e)===`Array`}function Qoe(e){if(X9(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function $oe(e,t,n,r,i){let a={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;a===`enumerable`&&(e[t]=n),i&&a===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function Q9(e,t={}){if(Z9(e))return e.map(e=>Q9(e,t));if(!Qoe(e))return e;let n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((n,r)=>{if(r===`__proto__`||Z9(t.props)&&!t.props.includes(r))return n;let i=e[r];return $oe(n,r,Q9(i,t),e,t.nonenumerable),n},{})}var $9=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Doe,this.symbolRegistry=new v9(e=>e.description??``),this.customTransformerRegistry=new Aoe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,n=Y9(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});let i=Zoe(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r.meta&&(r.meta.v=1),r}deserialize(e,t){let{json:n,meta:r}=e,i=t?.inPlace?n:Q9(n);return r?.values&&(i=qoe(i,r.values,r.v??0,this)),r?.referentialEqualities&&(i=Joe(i,r.referentialEqualities,r.v??0)),i}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};$9.defaultInstance=new $9,$9.serialize=$9.defaultInstance.serialize.bind($9.defaultInstance),$9.deserialize=$9.defaultInstance.deserialize.bind($9.defaultInstance),$9.stringify=$9.defaultInstance.stringify.bind($9.defaultInstance),$9.parse=$9.defaultInstance.parse.bind($9.defaultInstance),$9.registerClass=$9.defaultInstance.registerClass.bind($9.defaultInstance),$9.registerSymbol=$9.defaultInstance.registerSymbol.bind($9.defaultInstance),$9.registerCustom=$9.defaultInstance.registerCustom.bind($9.defaultInstance),$9.allowErrorProps=$9.defaultInstance.allowErrorProps.bind($9.defaultInstance),$9.serialize,$9.deserialize,$9.stringify,$9.parse,$9.registerClass,$9.registerCustom,$9.registerSymbol,$9.allowErrorProps,(0,b.createContext)(null),s(((e,t)=>{t.exports={}}))();function ese(e,t,n,r,i){return{callTool:async(e,n)=>{t(`callTool`,{name:e,args:n});let i=await r(e,n??{});return t(`← callTool response`,i,`response`),i},sendFollowUpMessage:async e=>{t(`sendFollowUpMessage`,e)},openExternal:e=>{t(`openExternal`,e)},requestDisplayMode:async r=>(t(`requestDisplayMode`,r),e.displayMode=r.mode,n(`displayMode`,r.mode),{mode:r.mode}),setWidgetState:async r=>{t(`setWidgetState`,r),e.widgetState=r,n(`widgetState`,r)},requestModal:async r=>{t(`requestModal`,r),e.displayMode=`modal`,e.view={mode:`modal`},n(`displayMode`,`modal`)},uploadFile:async e=>(t(`uploadFile`,{name:e.name,size:e.size}),{fileId:`123`}),getFileDownloadUrl:async e=>(t(`getFileDownloadUrl`,e),{downloadUrl:`https://example.com/file.pdf`}),setOpenInAppUrl:async e=>{t(`setOpenInAppUrl`,e),i(e.href)}}}function tse(e,t){let n=[`theme`,`userAgent`,`locale`,`maxHeight`,`displayMode`,`safeArea`,`toolInput`,`toolOutput`,`toolResponseMetadata`,`view`,`widgetState`];return new Proxy(e||{},{set(e,r,i,a){let o=Reflect.set(e,r,i,a);if(n.includes(r)){let e=new voe(f9,{detail:{globals:{[r]:i}}});t.dispatchEvent(e)}return o}})}function nse(e,t,n,r,i,a){let o=tse(zb(t),e);Ree(o,ese(o,n,r,i,a)),e.openai=o}function rse(e){let t=new DOMParser().parseFromString(e,`text/html`),n=t.querySelector(`script[type="module"]#dev-view-entry`);if(!n)throw Error(`dev-view-entry script not found`);return n.textContent=`
199
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:J().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:J().optional().describe(`User's timezone in IANA format.`),userAgent:J().optional().describe(`Host application identifier.`),platform:qu([Z(`web`),Z(`desktop`),Z(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:X({touch:Mu().optional().describe(`Whether the device supports touch input.`),hover:Mu().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:X({top:Ou().describe(`Top safe area inset in pixels.`),right:Ou().describe(`Right safe area inset in pixels.`),bottom:Ou().describe(`Bottom safe area inset in pixels.`),left:Ou().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();X({method:Z(`ui/notifications/host-context-changed`),params:_9.describe(`Partial context update containing only changed fields.`)}),X({method:Z(`ui/update-model-context`),params:X({content:Y(xp).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:$u(J(),Bu().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),X({method:Z(`ui/initialize`),params:X({appInfo:uf.describe(`App identification (name and version).`),appCapabilities:woe.describe(`Features and capabilities this app provides.`),protocolVersion:J().describe(`Protocol version this app supports.`)})}),X({protocolVersion:J().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:uf.describe(`Host application identification and version.`),hostCapabilities:Coe.describe(`Features and capabilities provided by the host.`),hostContext:_9.describe(`Rich context about the host environment.`)}).passthrough();var Eoe=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},v9=class{constructor(e){this.generateIdentifier=e,this.kv=new Eoe}register(e,t){this.kv.getByValue(e)||(t||=this.generateIdentifier(e),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Doe=class extends v9{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t==`object`?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function Ooe(e){if(`values`in Object)return Object.values(e);let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function koe(e,t){let n=Ooe(e);if(`find`in n)return n.find(t);let r=n;for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}function y9(e,t){Object.entries(e).forEach(([e,n])=>t(n,e))}function b9(e,t){return e.indexOf(t)!==-1}function x9(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(t(r))return r}}var Aoe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return koe(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},joe=e=>Object.prototype.toString.call(e).slice(8,-1),S9=e=>e===void 0,Moe=e=>e===null,C9=e=>typeof e!=`object`||!e||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,w9=e=>C9(e)&&Object.keys(e).length===0,T9=e=>Array.isArray(e),Noe=e=>typeof e==`string`,Poe=e=>typeof e==`number`&&!isNaN(e),Foe=e=>typeof e==`boolean`,Ioe=e=>e instanceof RegExp,E9=e=>e instanceof Map,D9=e=>e instanceof Set,O9=e=>joe(e)===`Symbol`,Loe=e=>e instanceof Date&&!isNaN(e.valueOf()),k9=e=>e instanceof Error,A9=e=>typeof e==`number`&&isNaN(e),Roe=e=>Foe(e)||Moe(e)||S9(e)||Poe(e)||Noe(e)||O9(e),zoe=e=>typeof e==`bigint`,Boe=e=>e===1/0||e===-1/0,Voe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Hoe=e=>e instanceof URL,j9=e=>e.replace(/\\/g,`\\\\`).replace(/\./g,`\\.`),M9=e=>e.map(String).map(j9).join(`.`),N9=(e,t)=>{let n=[],r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(!t&&a===`\\`){let t=e.charAt(i+1);if(t===`\\`){r+=`\\`,i++;continue}else if(t!==`.`)throw Error(`invalid path`)}if(a===`\\`&&e.charAt(i+1)===`.`){r+=`.`,i++;continue}if(a===`.`){n.push(r),r=``;continue}r+=a}let i=r;return n.push(i),n};function P9(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var F9=[P9(S9,`undefined`,()=>null,()=>void 0),P9(zoe,`bigint`,e=>e.toString(),e=>typeof BigInt<`u`?BigInt(e):(console.error(`Please add a BigInt polyfill.`),e)),P9(Loe,`Date`,e=>e.toISOString(),e=>new Date(e)),P9(k9,`Error`,(e,t)=>{let n={name:e.name,message:e.message};return`cause`in e&&(n.cause=e.cause),t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n},(e,t)=>{let n=Error(e.message,{cause:e.cause});return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(t=>{n[t]=e[t]}),n}),P9(Ioe,`regexp`,e=>``+e,e=>{let t=e.slice(1,e.lastIndexOf(`/`)),n=e.slice(e.lastIndexOf(`/`)+1);return new RegExp(t,n)}),P9(D9,`set`,e=>[...e.values()],e=>new Set(e)),P9(E9,`map`,e=>[...e.entries()],e=>new Map(e)),P9(e=>A9(e)||Boe(e),`number`,e=>A9(e)?`NaN`:e>0?`Infinity`:`-Infinity`,Number),P9(e=>e===0&&1/e==-1/0,`number`,()=>`-0`,Number),P9(Hoe,`URL`,e=>e.toString(),e=>new URL(e))];function I9(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var L9=I9((e,t)=>O9(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>[`symbol`,t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{let r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown symbol`);return r}),Uoe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),R9=I9(Voe,e=>[`typed-array`,e.constructor.name],e=>[...e],(e,t)=>{let n=Uoe[t[1]];if(!n)throw Error(`Trying to deserialize unknown typed array`);return new n(e)});function z9(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var B9=I9(z9,(e,t)=>[`class`,t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};let r={};return n.forEach(t=>{r[t]=e[t]}),r},(e,t,n)=>{let r=n.classRegistry.getValue(t[1]);if(!r)throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(r.prototype),e)}),V9=I9((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>[`custom`,t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{let r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error(`Trying to deserialize unknown custom value`);return r.deserialize(e)}),Woe=[B9,L9,V9,R9],H9=(e,t)=>{let n=x9(Woe,n=>n.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};let r=x9(F9,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},U9={};F9.forEach(e=>{U9[e.annotation]=e});var Goe=(e,t,n)=>{if(T9(t))switch(t[0]){case`symbol`:return L9.untransform(e,t,n);case`class`:return B9.untransform(e,t,n);case`custom`:return V9.untransform(e,t,n);case`typed-array`:return R9.untransform(e,t,n);default:throw Error(`Unknown transformation: `+t)}else{let r=U9[t];if(!r)throw Error(`Unknown transformation: `+t);return r.untransform(e,n)}},W9=(e,t)=>{if(t>e.size)throw Error(`index out of bounds`);let n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function G9(e){if(b9(e,`__proto__`))throw Error(`__proto__ is not allowed as a property`);if(b9(e,`prototype`))throw Error(`prototype is not allowed as a property`);if(b9(e,`constructor`))throw Error(`constructor is not allowed as a property`)}var Koe=(e,t)=>{G9(t);for(let n=0;n<t.length;n++){let r=t[n];if(D9(e))e=W9(e,+r);else if(E9(e)){let i=+r,a=+t[++n]==0?`key`:`value`,o=W9(e,i);switch(a){case`key`:e=o;break;case`value`:e=e.get(o);break}}else e=e[r]}return e},K9=(e,t,n)=>{if(G9(t),t.length===0)return n(e);let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(T9(r)){let e=+n;r=r[e]}else if(C9(r))r=r[n];else if(D9(r)){let e=+n;r=W9(r,e)}else if(E9(r)){if(e===t.length-2)break;let i=+n,a=+t[++e]==0?`key`:`value`,o=W9(r,i);switch(a){case`key`:r=o;break;case`value`:r=r.get(o);break}}}let i=t[t.length-1];if(T9(r)?r[+i]=n(r[+i]):C9(r)&&(r[i]=n(r[i])),D9(r)){let e=W9(r,+i),t=n(e);e!==t&&(r.delete(e),r.add(t))}if(E9(r)){let e=+t[t.length-2],a=W9(r,e);switch(+i==0?`key`:`value`){case`key`:{let e=n(a);r.set(e,r.get(a)),e!==a&&r.delete(a);break}case`value`:r.set(a,n(r.get(a)));break}}return e},q9=e=>e<1;function J9(e,t,n,r=[]){if(!e)return;let i=q9(n);if(!T9(e)){y9(e,(e,a)=>J9(e,t,n,[...r,...N9(a,i)]));return}let[a,o]=e;o&&y9(o,(e,a)=>{J9(e,t,n,[...r,...N9(a,i)])}),t(a,r)}function qoe(e,t,n,r){return J9(t,(t,n)=>{e=K9(e,n,e=>Goe(e,t,r))},n),e}function Joe(e,t,n){let r=q9(n);function i(t,n){let i=Koe(e,N9(n,r));t.map(e=>N9(e,r)).forEach(t=>{e=K9(e,t,()=>i)})}if(T9(t)){let[n,a]=t;n.forEach(t=>{e=K9(e,N9(t,r),()=>e)}),a&&y9(a,i)}else y9(t,i);return e}var Yoe=(e,t)=>C9(e)||T9(e)||E9(e)||D9(e)||k9(e)||z9(e,t);function Xoe(e,t,n){let r=n.get(e);r?r.push(t):n.set(e,[t])}function Zoe(e,t){let n={},r;return e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[i,...a]=e;i.length===0?r=a.map(M9):n[M9(i)]=a.map(M9)}),r?w9(n)?[r]:[r,n]:w9(n)?void 0:n}var Y9=(e,t,n,r,i=[],a=[],o=new Map)=>{let s=Roe(e);if(!s){Xoe(e,i,t);let n=o.get(e);if(n)return r?{transformedValue:null}:n}if(!Yoe(e,n)){let t=H9(e,n),r=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return s||o.set(e,r),r}if(b9(a,e))return{transformedValue:null};let c=H9(e,n),l=c?.value??e,u=T9(l)?[]:{},d={};y9(l,(s,c)=>{if(c===`__proto__`||c===`constructor`||c===`prototype`)throw Error(`Detected property ${c}. This is a prototype pollution risk, please remove it from your object.`);let l=Y9(s,t,n,r,[...i,c],[...a,e],o);u[c]=l.transformedValue,T9(l.annotations)?d[j9(c)]=l.annotations:C9(l.annotations)&&y9(l.annotations,(e,t)=>{d[j9(c)+`.`+t]=e})});let f=w9(d)?{transformedValue:u,annotations:c?[c.type]:void 0}:{transformedValue:u,annotations:c?[c.type,d]:d};return s||o.set(e,f),f};function X9(e){return Object.prototype.toString.call(e).slice(8,-1)}function Z9(e){return X9(e)===`Array`}function Qoe(e){if(X9(e)!==`Object`)return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function $oe(e,t,n,r,i){let a={}.propertyIsEnumerable.call(r,t)?`enumerable`:`nonenumerable`;a===`enumerable`&&(e[t]=n),i&&a===`nonenumerable`&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function Q9(e,t={}){if(Z9(e))return e.map(e=>Q9(e,t));if(!Qoe(e))return e;let n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((n,r)=>{if(r===`__proto__`||Z9(t.props)&&!t.props.includes(r))return n;let i=e[r];return $oe(n,r,Q9(i,t),e,t.nonenumerable),n},{})}var $9=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Doe,this.symbolRegistry=new v9(e=>e.description??``),this.customTransformerRegistry=new Aoe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,n=Y9(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});let i=Zoe(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r.meta&&(r.meta.v=1),r}deserialize(e,t){let{json:n,meta:r}=e,i=t?.inPlace?n:Q9(n);return r?.values&&(i=qoe(i,r.values,r.v??0,this)),r?.referentialEqualities&&(i=Joe(i,r.referentialEqualities,r.v??0)),i}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};$9.defaultInstance=new $9,$9.serialize=$9.defaultInstance.serialize.bind($9.defaultInstance),$9.deserialize=$9.defaultInstance.deserialize.bind($9.defaultInstance),$9.stringify=$9.defaultInstance.stringify.bind($9.defaultInstance),$9.parse=$9.defaultInstance.parse.bind($9.defaultInstance),$9.registerClass=$9.defaultInstance.registerClass.bind($9.defaultInstance),$9.registerSymbol=$9.defaultInstance.registerSymbol.bind($9.defaultInstance),$9.registerCustom=$9.defaultInstance.registerCustom.bind($9.defaultInstance),$9.allowErrorProps=$9.defaultInstance.allowErrorProps.bind($9.defaultInstance),$9.serialize,$9.deserialize,$9.stringify,$9.parse,$9.registerClass,$9.registerCustom,$9.registerSymbol,$9.allowErrorProps,(0,b.createContext)(null);function ese(e,t,n,r,i){return{callTool:async(e,n)=>{t(`callTool`,{name:e,args:n});let i=await r(e,n??{});return t(`← callTool response`,i,`response`),i},sendFollowUpMessage:async e=>{t(`sendFollowUpMessage`,e)},openExternal:e=>{t(`openExternal`,e)},requestDisplayMode:async r=>(t(`requestDisplayMode`,r),e.displayMode=r.mode,n(`displayMode`,r.mode),{mode:r.mode}),setWidgetState:async r=>{t(`setWidgetState`,r),e.widgetState=r,n(`widgetState`,r)},requestModal:async r=>{t(`requestModal`,r),e.displayMode=`modal`,e.view={mode:`modal`},n(`displayMode`,`modal`)},uploadFile:async e=>(t(`uploadFile`,{name:e.name,size:e.size}),{fileId:`123`}),getFileDownloadUrl:async e=>(t(`getFileDownloadUrl`,e),{downloadUrl:`https://example.com/file.pdf`}),setOpenInAppUrl:async e=>{t(`setOpenInAppUrl`,e),i(e.href)}}}function tse(e,t){let n=[`theme`,`userAgent`,`locale`,`maxHeight`,`displayMode`,`safeArea`,`toolInput`,`toolOutput`,`toolResponseMetadata`,`view`,`widgetState`];return new Proxy(e||{},{set(e,r,i,a){let o=Reflect.set(e,r,i,a);if(n.includes(r)){let e=new voe(f9,{detail:{globals:{[r]:i}}});t.dispatchEvent(e)}return o}})}function nse(e,t,n,r,i,a){let o=tse(zb(t),e);Ree(o,ese(o,n,r,i,a)),e.openai=o}function rse(e){let t=new DOMParser().parseFromString(e,`text/html`),n=t.querySelector(`script[type="module"]#dev-view-entry`);if(!n)throw Error(`dev-view-entry script not found`);return n.textContent=`
200
200
 
201
201
  const waitForOpenAI = () => new Promise((resolve, reject) => {
202
202
  if (typeof window === "undefined") { reject(new Error("window is not available")); return; }
@@ -219,4 +219,4 @@ container holding the app. Specify either width or maxWidth, and either height o
219
219
 
220
220
  await waitForOpenAI();
221
221
  ${n.textContent}
222
- `,t.head.innerHTML+t.body.innerHTML}var ise=()=>{let e=wT(),{openaiObject:t}=cC(e.name)??{},{data:n}=TT(e._meta?.[`openai/outputTemplate`]),{setToolData:r,pushOpenAiLog:i,updateOpenaiObject:a,setOpenInAppUrl:o}=sC(),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(!1),u=n.contents[0].text,d=(0,b.useCallback)(()=>{if(l.current)return;let c=s.current;if(!c?.contentWindow||!c.contentDocument)return;l.current=!0;let d=n.contents[0]._meta?.[`openai/widgetDomain`];d&&typeof d==`string`&&o(e.name,d),nse(c.contentWindow,t,(t,n,r=`default`)=>{i(e.name,{timestamp:Date.now(),command:t,args:n,type:r})},(t,n)=>{a(e.name,t,n)},(e,t)=>vT.callTool(e,t),t=>{o(e.name,t)}),c.contentDocument.open(),c.contentDocument.write(rse(u)),c.contentDocument.close(),r(e.name,{openaiRef:s})},[t,i,r,a,o,e.name,u,n]);return(0,b.useEffect)(()=>{d()},[d]),(0,G.jsx)(`div`,{ref:c,className:`relative overflow-auto`,style:{width:`100%`,height:`100%`},children:(0,G.jsx)(`iframe`,{ref:s,src:`about:blank`,onLoad:d,style:{width:`100%`,height:`100%`,border:`none`,display:`block`},sandbox:`allow-scripts allow-same-origin allow-forms`,title:`html-preview`})})},ase=()=>{let e=wT(),t=cC(e.name),{defaultLayout:n,onLayoutChange:r}=oi({id:`skybridge-devtools-input-column`,storage:localStorage}),{defaultLayout:i,onLayoutChange:a}=oi({id:`skybridge-devtools-widget-section`,storage:localStorage}),{defaultLayout:o,onLayoutChange:s}=oi({id:`skybridge-devtools-inspector-section`,storage:localStorage}),{defaultLayout:c,onLayoutChange:l}=oi({id:`skybridge-devtools-main-section`,storage:localStorage}),u=!!(e._meta?.[`openai/outputTemplate`]&&t?.response&&!t.response.isError);return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col overflow-hidden relative z-10`,children:(0,G.jsxs)(ri,{orientation:`vertical`,className:`flex-1 overflow-hidden`,defaultLayout:c,onLayoutChange:l,children:[(0,G.jsx)(ui,{id:`top-section`,minSize:`30`,children:(0,G.jsxs)(ri,{orientation:`horizontal`,className:`flex-1 overflow-hidden`,defaultLayout:n,onLayoutChange:r,children:[(0,G.jsx)(ui,{id:`input-column`,minSize:`20`,maxSize:`60`,children:(0,G.jsx)(`div`,{className:`flex flex-col overflow-hidden h-full`,children:(0,G.jsx)(Aie,{})})}),(0,G.jsx)(pi,{className:`w-px bg-border`}),(0,G.jsx)(ui,{id:`output-column`,minSize:`30`,children:(0,G.jsx)(`div`,{className:`flex flex-col overflow-hidden h-full`,children:(0,G.jsx)(_oe,{})})})]})}),u&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pi,{className:`h-px bg-border`}),(0,G.jsx)(ui,{id:`widget-section`,minSize:`20`,children:(0,G.jsxs)(ri,{orientation:`horizontal`,className:`flex-1 overflow-hidden bg-card`,defaultLayout:o,onLayoutChange:s,children:[(0,G.jsx)(ui,{id:`widget-logs-panel`,minSize:`30`,children:(0,G.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:(0,G.jsxs)(ri,{orientation:`vertical`,className:`flex-1 overflow-hidden`,defaultLayout:i,onLayoutChange:a,children:[(0,G.jsx)(ui,{id:`widget-panel`,minSize:`20`,maxSize:`80`,children:(0,G.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,G.jsx)(b.Suspense,{children:(0,G.jsx)(ise,{})})})}),(0,G.jsx)(pi,{className:`h-px bg-border`}),(0,G.jsx)(ui,{id:`logs-panel`,minSize:`20`,children:(0,G.jsx)(`div`,{className:`p-4 flex flex-col h-full min-h-0`,children:(0,G.jsx)(foe,{})})})]})})}),(0,G.jsx)(pi,{className:`w-px bg-border`}),(0,G.jsx)(ui,{id:`inspector-panel`,minSize:`20`,maxSize:`50`,defaultSize:30,children:(0,G.jsx)(`div`,{className:`flex flex-col overflow-hidden h-full min-h-0`,children:(0,G.jsx)(`div`,{className:`overflow-auto`,children:(0,G.jsx)(loe,{})})})})]})})]})]})})};function ose(){let e=ST(),[,t]=bC(),n=CT();return(0,G.jsx)(`div`,{className:`h-full border-r border-border bg-card flex flex-col`,children:(0,G.jsxs)(`aside`,{className:`h-full flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-border h-[72px] flex flex-col justify-center`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Tools`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e?.length,` `,e?.length===1?`tool`:`tools`]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`p-2`,children:e?.length===0?(0,G.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:`No tools registered yet.`}):(0,G.jsx)(`div`,{className:`space-y-1`,children:e?.map(e=>{let r=e.name===n?.name;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e.name),className:uO(`w-full text-left px-3 py-3 rounded-md transition-colors cursor-pointer relative`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1`,r&&`bg-accent text-accent-foreground`),children:[(0,G.jsxs)(`div`,{className:`pr-6 flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{className:uO(`font-semibold text-sm leading-tight truncate`,r&&`text-accent-foreground`),children:e.name}),e.description&&(0,G.jsx)(`div`,{className:uO(`text-xs leading-snug text-muted-foreground`,`line-clamp-2`,r&&`text-accent-foreground/80`),children:e.description})]}),r&&(0,G.jsx)(`div`,{className:`absolute top-3 right-3 w-1.5 h-1.5 rounded-full bg-primary`})]},e.name)})})})})]})})}function sse(){let e=CT(),{status:t,requiresAuth:n}=bi(),{defaultLayout:r,onLayoutChange:i}=oi({id:`skybridge-devtools-tools-list`,storage:localStorage});return(0,G.jsxs)(`div`,{className:`flex h-screen w-full flex-col overflow-hidden bg-background`,children:[(0,G.jsx)(hO,{}),t===`authenticated`?(0,G.jsxs)(ri,{orientation:`horizontal`,className:`flex-1 overflow-hidden`,defaultLayout:r,onLayoutChange:i,children:[(0,G.jsx)(ui,{id:`tools-list`,minSize:`15`,maxSize:`40`,children:(0,G.jsx)(ose,{})}),(0,G.jsx)(pi,{className:`w-px bg-border`}),(0,G.jsx)(ui,{id:`main-content`,minSize:`30`,children:(0,G.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden relative h-full`,children:e?(0,G.jsx)(ase,{}):(0,G.jsx)(Bne,{})})})]}):(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,G.jsxs)(`div`,{className:`text-center space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`connecting`?`Connecting to server...`:n?`Authentication required to access this server.`:`Not connected to a server.`}),t!==`connecting`&&(0,G.jsxs)(fO,{variant:`outline`,size:`sm`,onClick:xT,children:[(0,G.jsx)(fn,{className:`h-3.5 w-3.5`}),`Connect`]})]})})]})}function cse(){return(0,G.jsx)(Ue,{client:xC,children:(0,G.jsx)(Wt,{children:(0,G.jsx)(sse,{})})})}async function lse(){let e=new URLSearchParams(window.location.search);if(e.get(`oauth_callback`)===`true`){let t=e.get(`code`),n=new URL(window.location.href);if(n.searchParams.delete(`oauth_callback`),n.searchParams.delete(`code`),n.searchParams.delete(`state`),window.history.replaceState({},``,n.toString()),t)try{await fte(t)}catch(e){console.error(`OAuth callback failed:`,e),bi.getState().setStatus(`error`),bi.getState().setError(e instanceof Error?e.message:`OAuth callback failed`)}else bi.getState().setStatus(`error`),bi.getState().setError(`OAuth callback missing authorization code`)}else xT().catch(e=>{console.error(`Connection failed:`,e)})}lse(),(0,x.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(b.StrictMode,{children:(0,G.jsx)(cse,{})}));
222
+ `,t.head.innerHTML+t.body.innerHTML}var ise=()=>{let e=wT(),{openaiObject:t}=cC(e.name)??{},{data:n}=TT(e._meta?.[`openai/outputTemplate`]),{setToolData:r,pushOpenAiLog:i,updateOpenaiObject:a,setOpenInAppUrl:o}=sC(),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(!1),u=n.contents[0].text,d=(0,b.useCallback)(()=>{if(l.current)return;let c=s.current;if(!c?.contentWindow||!c.contentDocument)return;l.current=!0;let d=n.contents[0]._meta?.[`openai/widgetDomain`];d&&typeof d==`string`&&o(e.name,d),nse(c.contentWindow,t,(t,n,r=`default`)=>{i(e.name,{timestamp:Date.now(),command:t,args:n,type:r})},(t,n)=>{a(e.name,t,n)},(e,t)=>vT.callTool(e,t),t=>{o(e.name,t)}),c.contentDocument.open(),c.contentDocument.write(rse(u)),c.contentDocument.close(),r(e.name,{openaiRef:s})},[t,i,r,a,o,e.name,u,n]);return(0,b.useEffect)(()=>{d()},[d]),(0,G.jsx)(`div`,{ref:c,className:`relative overflow-auto`,style:{width:`100%`,height:`100%`},children:(0,G.jsx)(`iframe`,{ref:s,src:`about:blank`,onLoad:d,style:{width:`100%`,height:`100%`,border:`none`,display:`block`},sandbox:`allow-scripts allow-same-origin allow-forms`,title:`html-preview`})})},ase=()=>{let e=wT(),t=cC(e.name),{defaultLayout:n,onLayoutChange:r}=oi({id:`skybridge-devtools-input-column`,storage:localStorage}),{defaultLayout:i,onLayoutChange:a}=oi({id:`skybridge-devtools-view-section`,storage:localStorage}),{defaultLayout:o,onLayoutChange:s}=oi({id:`skybridge-devtools-inspector-section`,storage:localStorage}),{defaultLayout:c,onLayoutChange:l}=oi({id:`skybridge-devtools-main-section`,storage:localStorage}),u=!!(e._meta?.[`openai/outputTemplate`]&&t?.response&&!t.response.isError);return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col overflow-hidden relative z-10`,children:(0,G.jsxs)(ri,{orientation:`vertical`,className:`flex-1 overflow-hidden`,defaultLayout:c,onLayoutChange:l,children:[(0,G.jsx)(ui,{id:`top-section`,minSize:`30`,children:(0,G.jsxs)(ri,{orientation:`horizontal`,className:`flex-1 overflow-hidden`,defaultLayout:n,onLayoutChange:r,children:[(0,G.jsx)(ui,{id:`input-column`,minSize:`20`,maxSize:`60`,children:(0,G.jsx)(`div`,{className:`flex flex-col overflow-hidden h-full`,children:(0,G.jsx)(Aie,{})})}),(0,G.jsx)(pi,{className:`w-px bg-border`}),(0,G.jsx)(ui,{id:`output-column`,minSize:`30`,children:(0,G.jsx)(`div`,{className:`flex flex-col overflow-hidden h-full`,children:(0,G.jsx)(_oe,{})})})]})}),u&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pi,{className:`h-px bg-border`}),(0,G.jsx)(ui,{id:`view-section`,minSize:`20`,children:(0,G.jsxs)(ri,{orientation:`horizontal`,className:`flex-1 overflow-hidden bg-card`,defaultLayout:o,onLayoutChange:s,children:[(0,G.jsx)(ui,{id:`view-logs-panel`,minSize:`30`,children:(0,G.jsx)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:(0,G.jsxs)(ri,{orientation:`vertical`,className:`flex-1 overflow-hidden`,defaultLayout:i,onLayoutChange:a,children:[(0,G.jsx)(ui,{id:`view-panel`,minSize:`20`,maxSize:`80`,children:(0,G.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,G.jsx)(b.Suspense,{children:(0,G.jsx)(ise,{})})})}),(0,G.jsx)(pi,{className:`h-px bg-border`}),(0,G.jsx)(ui,{id:`logs-panel`,minSize:`20`,children:(0,G.jsx)(`div`,{className:`p-4 flex flex-col h-full min-h-0`,children:(0,G.jsx)(foe,{})})})]})})}),(0,G.jsx)(pi,{className:`w-px bg-border`}),(0,G.jsx)(ui,{id:`inspector-panel`,minSize:`20`,maxSize:`50`,defaultSize:30,children:(0,G.jsx)(`div`,{className:`flex flex-col overflow-hidden h-full min-h-0`,children:(0,G.jsx)(`div`,{className:`overflow-auto`,children:(0,G.jsx)(loe,{})})})})]})})]})]})})};function ose(){let e=ST(),[,t]=bC(),n=CT();return(0,G.jsx)(`div`,{className:`h-full border-r border-border bg-card flex flex-col`,children:(0,G.jsxs)(`aside`,{className:`h-full flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-border h-[72px] flex flex-col justify-center`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Tools`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e?.length,` `,e?.length===1?`tool`:`tools`]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`p-2`,children:e?.length===0?(0,G.jsx)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:`No tools registered yet.`}):(0,G.jsx)(`div`,{className:`space-y-1`,children:e?.map(e=>{let r=e.name===n?.name;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e.name),className:uO(`w-full text-left px-3 py-3 rounded-md transition-colors cursor-pointer relative`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1`,r&&`bg-accent text-accent-foreground`),children:[(0,G.jsxs)(`div`,{className:`pr-6 flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{className:uO(`font-semibold text-sm leading-tight truncate`,r&&`text-accent-foreground`),children:e.name}),e.description&&(0,G.jsx)(`div`,{className:uO(`text-xs leading-snug text-muted-foreground`,`line-clamp-2`,r&&`text-accent-foreground/80`),children:e.description})]}),r&&(0,G.jsx)(`div`,{className:`absolute top-3 right-3 w-1.5 h-1.5 rounded-full bg-primary`})]},e.name)})})})})]})})}function sse(){let e=CT(),{status:t,requiresAuth:n}=bi(),{defaultLayout:r,onLayoutChange:i}=oi({id:`skybridge-devtools-tools-list`,storage:localStorage});return(0,G.jsxs)(`div`,{className:`flex h-screen w-full flex-col overflow-hidden bg-background`,children:[(0,G.jsx)(hO,{}),t===`authenticated`?(0,G.jsxs)(ri,{orientation:`horizontal`,className:`flex-1 overflow-hidden`,defaultLayout:r,onLayoutChange:i,children:[(0,G.jsx)(ui,{id:`tools-list`,minSize:`15`,maxSize:`40`,children:(0,G.jsx)(ose,{})}),(0,G.jsx)(pi,{className:`w-px bg-border`}),(0,G.jsx)(ui,{id:`main-content`,minSize:`30`,children:(0,G.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden relative h-full`,children:e?(0,G.jsx)(ase,{}):(0,G.jsx)(Bne,{})})})]}):(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,G.jsxs)(`div`,{className:`text-center space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`connecting`?`Connecting to server...`:n?`Authentication required to access this server.`:`Not connected to a server.`}),t!==`connecting`&&(0,G.jsxs)(fO,{variant:`outline`,size:`sm`,onClick:xT,children:[(0,G.jsx)(fn,{className:`h-3.5 w-3.5`}),`Connect`]})]})})]})}function cse(){return(0,G.jsx)(Ue,{client:xC,children:(0,G.jsx)(Wt,{children:(0,G.jsx)(sse,{})})})}async function lse(){let e=new URLSearchParams(window.location.search);if(e.get(`oauth_callback`)===`true`){let t=e.get(`code`),n=new URL(window.location.href);if(n.searchParams.delete(`oauth_callback`),n.searchParams.delete(`code`),n.searchParams.delete(`state`),window.history.replaceState({},``,n.toString()),t)try{await fte(t)}catch(e){console.error(`OAuth callback failed:`,e),bi.getState().setStatus(`error`),bi.getState().setError(e instanceof Error?e.message:`OAuth callback failed`)}else bi.getState().setStatus(`error`),bi.getState().setError(`OAuth callback missing authorization code`)}else xT().catch(e=>{console.error(`Connection failed:`,e)})}lse(),(0,x.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(b.StrictMode,{children:(0,G.jsx)(cse,{})}));
@@ -9,8 +9,8 @@ import { type Router } from "express";
9
9
  *
10
10
  * if (env.NODE_ENV !== "production") {
11
11
  * app.use(await devtoolsStaticServer(server));
12
- * app.use(await widgetsDevServer());
13
- * ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
12
+ * app.use(await viewsDevServer());
13
+ * ^^^^^^^^ Make sure to install the devtoolsStaticServer before the viewsDevServer
14
14
  * }
15
15
  */
16
16
  export declare const devtoolsStaticServer: () => Promise<Router>;
@@ -12,8 +12,8 @@ import express, {} from "express";
12
12
  *
13
13
  * if (env.NODE_ENV !== "production") {
14
14
  * app.use(await devtoolsStaticServer(server));
15
- * app.use(await widgetsDevServer());
16
- * ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
15
+ * app.use(await viewsDevServer());
16
+ * ^^^^^^^^ Make sure to install the devtoolsStaticServer before the viewsDevServer
17
17
  * }
18
18
  */
19
19
  export const devtoolsStaticServer = async () => {
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Skybridge MCP devtools</title>
8
- <script type="module" crossorigin src="/assets/index-y2W9ORpl.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-CTv6cOm9.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-9JaNXWM9.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skybridge/devtools",
3
- "version": "0.0.0-dev.cf86f93",
3
+ "version": "0.0.0-dev.cfc7f32",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,14 +60,13 @@
60
60
  "typescript": "~6.0.2",
61
61
  "vite": "^8.0.3",
62
62
  "zustand": "^5.0.12",
63
- "skybridge": "0.0.0-dev.cf86f93"
63
+ "skybridge": "0.0.0-dev.cfc7f32"
64
64
  },
65
65
  "scripts": {
66
66
  "dev": "vite",
67
67
  "build": "tsc -b && vite build && pnpm run build:server",
68
68
  "build:server": "tsc -p tsconfig.server.json",
69
- "test": "pnpm run test:type && pnpm run test:format",
70
- "test:type": "tsc --noEmit",
69
+ "test": "pnpm run test:format",
71
70
  "format": "biome check --write --error-on-warnings",
72
71
  "test:format": "biome ci",
73
72
  "preview": "vite preview"