@texturehq/edges 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{TimeField-rRIt80g3.d.ts → TimeField-DVuYVoDw.d.ts} +88 -1
- package/dist/{TimeField-CJUNJDQT.d.cts → TimeField-DsHO9pLs.d.cts} +88 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -3
- package/dist/index.d.ts +101 -3
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/rhf/index.cjs +2 -2
- package/dist/rhf/index.cjs.map +1 -1
- package/dist/rhf/index.d.cts +22 -3
- package/dist/rhf/index.d.ts +22 -3
- package/dist/rhf/index.js +2 -2
- package/dist/rhf/index.js.map +1 -1
- package/dist/styles.css +14 -0
- package/package.json +1 -1
package/dist/rhf/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';export{Controller,useFieldArray,useFormContext,useWatch}from'react-hook-form';import*as lt from'react';import lt__default,{memo,createContext,forwardRef,useState,useRef,useEffect,useCallback,useId,useContext,Component}from'react';import {useFilter}from'react-aria';import {ComboBox,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,Group,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,useSlottedContext,PopoverContext,OverlayArrow,Modal,ListBoxItem,Calendar,CalendarGrid,CalendarGridBody,CalendarCell,Text,TooltipTrigger,Tooltip,ModalOverlay,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell}from'react-aria-components';import {useAsyncList}from'react-stately';import {twMerge}from'tailwind-merge';import*as Vo from'@phosphor-icons/react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {Minus,Check,Image,X,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import as from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import ds from'@tiptap/starter-kit';var Lr=Object.defineProperty;var Dr=(e,o,t)=>o in e?Lr(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Lt=(e,o,t)=>Dr(e,typeof o!="symbol"?o+"":o,t);function _e(e,o=false){let[t,r]=useState(o);return useEffect(()=>{if(typeof window>"u")return;let n=window.matchMedia(e);r(n.matches);let a=i=>{r(i.matches);};return n.addEventListener("change",a),()=>{n.removeEventListener("change",a);}},[e]),t}var Ze={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function ft(e="base"){let o=_e(`(min-width: ${Ze.sm})`,e!=="base"),t=_e(`(min-width: ${Ze.md})`,["md","lg","xl","2xl"].includes(e)),r=_e(`(min-width: ${Ze.lg})`,["lg","xl","2xl"].includes(e)),n=_e(`(min-width: ${Ze.xl})`,["xl","2xl"].includes(e)),a=_e(`(min-width: ${Ze["2xl"]})`,e==="2xl"),i=!t,s=t,d="base";return a?d="2xl":n?d="xl":r?d="lg":t?d="md":o&&(d="sm"),{current:d,isSm:o,isMd:t,isLg:r,isXl:n,is2Xl:a,isMobile:i,isDesktop:s}}function So(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let n=setTimeout(()=>r(e),o);return ()=>clearTimeout(n)},[e,o]),t}function gt(e,o=300){let[t,r]=useState(false);return useEffect(()=>{if(e){let n=setTimeout(()=>{r(true);},o);return ()=>clearTimeout(n)}r(false);},[e,o]),t}function xt(...e){return e.filter(Boolean).join(" ")}var Pe={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function wo(e,...o){return xt(Pe[e],...o)}function Ee(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function G(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var q={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};function K(e,o){let t=forwardRef(({size:r=24,color:n="currentColor",className:a,mirrored:i,alt:s,...d},u)=>{let c=!!s||"aria-label"in d;return jsx("svg",{ref:u,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 256 256",fill:n,className:a,transform:i?"scale(-1, 1)":void 0,"aria-hidden":c?void 0:true,role:c?"img":void 0,"aria-label":s,...d,children:o})});return t.displayName=e,t}var bt=()=>jsxs(Fragment,{children:[jsx("path",{d:"M12 128h44M200 128h44",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"76",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("circle",{cx:"180",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"})]}),Io=()=>jsx("path",{d:"M166 120 88 70",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Eo=()=>jsx("path",{d:"M162 122 92 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Bo=()=>jsxs(Fragment,{children:[jsx("path",{d:"M112 85.7 A32 32 0 1 1 144 85.7",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"58",r:"8",fill:"currentColor",stroke:"none"})]}),Ur=K("TextureRecloser",jsxs(Fragment,{children:[jsx("rect",{x:"36",y:"36",width:"184",height:"184",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"140",fontWeight:"700",fill:"currentColor",stroke:"none",children:"R"})]})),Kr=K("TextureFuse",jsx("path",{d:"M20 128h72q18 -84 36 0q18 84 36 0h72",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})),Yr=K("TextureBreaker",jsxs(Fragment,{children:[jsx("rect",{x:"36",y:"36",width:"184",height:"184",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"140",fontWeight:"700",fill:"currentColor",stroke:"none",children:"B"})]})),jr=K("TextureSource",jsxs(Fragment,{children:[jsx("path",{d:"M4 128h40M212 128h40",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"128",r:"84",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("path",{d:"M92 128q18 -84 36 0q18 84 36 0",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})]})),Qr=K("TextureCapacitor",jsx(Fragment,{children:jsx("path",{d:"M4 128h106M146 128h106M110 72v112M146 72v112",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"})})),Xr=K("TextureRegulator",jsxs(Fragment,{children:[jsx("circle",{cx:"128",cy:"128",r:"92",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"128",fontWeight:"700",fill:"currentColor",stroke:"none",children:"V"})]})),Jr=K("TextureSwitch",jsxs(Fragment,{children:[jsx(bt,{}),jsx(Io,{})]})),Zr=K("TextureSwitchClosed",jsxs(Fragment,{children:[jsx(bt,{}),jsx(Eo,{})]})),en=K("TextureOpenPoint",jsxs(Fragment,{children:[jsx("path",{d:"M112 52 C 74 92, 74 164, 112 204",fill:"none",stroke:"currentColor",strokeWidth:"18",strokeLinecap:"round"}),jsx("path",{d:"M144 52 C 182 92, 182 164, 144 204",fill:"none",stroke:"currentColor",strokeWidth:"18",strokeLinecap:"round"})]})),tn=K("TextureSectionalizerOpen",jsxs(Fragment,{children:[jsx(bt,{}),jsx(Io,{}),jsx(Bo,{})]})),on=K("TextureSectionalizerClosed",jsxs(Fragment,{children:[jsx(bt,{}),jsx(Eo,{}),jsx(Bo,{})]})),rn=K("TextureTransformer",jsxs(Fragment,{children:[jsx("path",{d:"M40 64H88A22 22 0 0 1 88 108A22 22 0 0 1 88 152A22 22 0 0 1 88 196H40",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M216 64H168A22 22 0 0 0 168 108A22 22 0 0 0 168 152A22 22 0 0 0 168 196H216",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})]})),He={1:[128],2:[110,146],3:[92,128,164]},Dt=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"},e),At=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",pathLength:100,strokeDasharray:"20 20"},e),nn=K("TextureSinglePhaseOverheadLine",jsx(Fragment,{children:He[1].map(Dt)})),an=K("TextureTwoPhaseOverheadLine",jsx(Fragment,{children:He[2].map(Dt)})),sn=K("TextureThreePhaseOverheadLine",jsx(Fragment,{children:He[3].map(Dt)})),ln=K("TextureSinglePhaseUndergroundLine",jsx(Fragment,{children:He[1].map(At)})),dn=K("TextureTwoPhaseUndergroundLine",jsx(Fragment,{children:He[2].map(At)})),cn=K("TextureThreePhaseUndergroundLine",jsx(Fragment,{children:He[3].map(At)})),un=K("TextureSupportStructure",jsx("circle",{cx:"128",cy:"128",r:"40",fill:"currentColor",stroke:"none"})),ht={TextureRecloser:Ur,TextureFuse:Kr,TextureBreaker:Yr,TextureSource:jr,TextureCapacitor:Qr,TextureRegulator:Xr,TextureSwitch:Jr,TextureSwitchClosed:Zr,TextureOpenPoint:en,TextureSectionalizerOpen:tn,TextureSectionalizerClosed:on,TextureTransformer:rn,TextureSinglePhaseOverheadLine:nn,TextureTwoPhaseOverheadLine:an,TextureThreePhaseOverheadLine:sn,TextureSinglePhaseUndergroundLine:ln,TextureTwoPhaseUndergroundLine:dn,TextureThreePhaseUndergroundLine:cn,TextureSupportStructure:un};if(process.env.NODE_ENV==="development")for(let e of Object.keys(ht))e in Vo&&console.error(`Custom icon "${e}" collides with a Phosphor icon of the same name. Rename it (use the "Texture" prefix) to keep the icon namespace unambiguous.`);var ze={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},y=memo(({name:e,size:o="md",color:t,weight:r="regular",className:n,ariaLabel:a,...i})=>{let s=ht[e]??Vo[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react or the custom icon registry`),null;let d=typeof o=="string"&&o in ze?ze[o]:o,u=twMerge("inline-block flex-shrink-0",!t&&"text-current",n);return jsx(s,{...i,size:d,color:t,weight:r,className:u,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});y.displayName="Icon";var mn=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:n="md",className:a,name:i,color:s,weight:d,ariaLabel:u,ref:c,...l})=>{let g=typeof n=="string"&&n in ze?ze[n]:n,v=t?typeof t=="string"&&t in ze?ze[t]:t:g*1.75,m=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:m,style:{width:v,height:v},children:jsx(y,{...l,name:i,size:n,color:s,weight:d,className:a,ariaLabel:u})})});mn.displayName="IconWithContainer";var bn=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",o?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",t].filter(Boolean).join(" ");function Mo({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,n)=>bn({...n,className:r})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function ke(){let[e,o]=lt__default.useState(false),t=lt__default.useCallback((n,a)=>{o(true),a?.(n);},[]),r=lt__default.useCallback((n,a)=>{o(false),a?.(n);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var oe=lt__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));oe.displayName="InputWrapper";function et({onClick:e,size:o="md",className:t}){return jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(y,{name:"X",size:o==="sm"?16:20})})}function tt(e){let{isInvalid:o,isDisabled:t,isFocused:r}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${n} border-border-muted`:o&&r?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:o?`${n} border-feedback-error-border`:r?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function hn(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function yn(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function ae(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",tt({isInvalid:o,isDisabled:t,isFocused:r}),hn({transparent:n,isDisabled:t}),q[a].text,q[a].height,q[a].padding,yn(a),i)}function W({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:n="below",isRequired:a,className:i,htmlFor:s}){let d=t||r&&n==="tooltip",u=t||r,c=r&&n==="inline",l=jsxs("label",{htmlFor:s,className:twMerge(q[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsx("span",{children:"*"}),d&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(y,{name:"Info",size:o==="sm"?16:20})}),c&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&u?jsx(Mo,{content:u,children:l}):l}function I({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",q[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(q[o].text,"text-feedback-error-text",t),children:e})}function vt({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:n,className:a,...i}){return jsx("input",{className:ae({isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:e,className:a}),...i})}var Rn="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Fn="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",Tn={primary:Fn,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Ho={full:"w-full",default:"w-fit"},Nn="opacity-50 cursor-not-allowed pointer-events-none",kn="opacity-100 cursor-pointer",Sn={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},wn={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function In(e){return !e||e==="default"||e==="brand"?"primary":e}function En(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:n=false,isLoading:a=false}=e,i=In(o),s=i==="unstyled"?"":`${Rn} ${Tn[i]}`;i!=="unstyled"&&(s+=` ${q[t].text} ${q[t].height} ${q[t].padding} ${q[t].gap}`),r||a?s+=` ${Nn}`:s+=` ${kn}`,n?s+=` ${Ho.full}`:s+=` ${Ho.default}`;let d=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,Ee(),d].filter(Boolean).join(" ")}function T(e){let{icon:o,children:t,isLoading:r=false,loadingText:n,loadingIndicator:a,size:i="md",iconPosition:s="left",iconWeight:d,href:u,className:c,badgeNumber:l,badgeVariant:g="primary",badgePosition:v="top-right",style:m,target:p,rel:C,...R}=e,P=o?jsx(y,{name:o,size:i,weight:d}):null,V=jsxs(Fragment,{children:[s==="left"&&P,typeof t=="function"?null:t,s==="right"&&P]}),M=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(y,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:V}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),E=(l??0)>0,F=twMerge(En(e),c),k=u?{href:u,target:p,rel:C,...R}:{};if(u){let{onPress:S,onPressStart:ne,onPressEnd:H,onPressChange:ce,onPressUp:X,onAuxClick:U,onContextMenu:de,onDoubleClick:z,...h}=R;Object.assign(k,h);}let Q=u?jsx(Link,{...k,...r&&{"aria-busy":true},style:E?void 0:m,className:F,children:r?M:typeof t=="function"?(function(S){return jsxs(Fragment,{children:[s==="left"&&P,t(S),s==="right"&&P]})}):V}):jsx(Button,{...R,...r&&{"aria-busy":true},style:E?void 0:m,className:F,children:r?M:typeof t=="function"?(function(S){return jsxs(Fragment,{children:[s==="left"&&P,t(S),s==="right"&&P]})}):V});return E?jsxs("div",{className:twMerge("relative flex",c),style:m,children:[Q,jsx("span",{className:`absolute ${Sn[v]} flex h-5 w-5 items-center justify-center rounded-full ${wn[g]} text-xs font-medium`,"aria-label":`${l} items`,children:l})]}):Q}function Be({transparent:e=false,className:o,children:t,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(o,(n,a)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/15"].join(" "),a.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),a.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:t})}function Gn({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let n=[!r&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),a=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [n,a,i,t].filter(Boolean).join(" ")}function Ge({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:n=true,disableGroup:a=false,...i}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",u=o?12:8;u=d?u-6:u;let c=jsxs(Popover,{offset:u,...i,className:composeRenderProps(r,(l,g)=>Gn({...g,className:l,disableGroup:a})),children:[o&&jsx(OverlayArrow,{children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"block fill-background-surface stroke-border-default stroke-1 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsx(Be,{isDismissable:n,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:n,children:c})}):c}function zo(e=true){let[o,t]=useState(null);return useEffect(()=>{if(!e){t(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let n=()=>{let a=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));t({height:r.height,keyboardOffset:a});};return n(),r.addEventListener("resize",n),r.addEventListener("scroll",n),()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n);}},[e]),o}function zt({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(T,{type:r?"submit":"button",form:r?e.formId:void 0,size:e.size||t,variant:e.variant||o,onPress:r?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Gt({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let n=e||o||t;return !n&&!r?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsx("div",{className:"flex h-10 justify-center",children:r}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:t&&jsx(zt,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(zt,{action:o,defaultVariant:"secondary"}),e&&jsx(zt,{action:e,defaultVariant:"primary"})]})]})]})}var Un={heading:{sm:Pe.headingSm,md:Pe.headingMd,lg:Pe.headingLg,xl:Pe.headingXl},display:{sm:Pe.displaySm,md:Pe.displayMd,lg:Pe.displayLg,xl:Pe.displayXl}},Kn={page:"h-16 leading-[62px]"};function nt({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:n="",children:a}){let i=t==="xs"?"sm":t,s=Un[o][i],d=r?Kn[r]:"";return jsx(e,{className:xt(s,"text-text-primary",d,n),children:a})}var $e=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:n=false,onBack:a,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[n&&jsx(T,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(y,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(nt,{size:"xs",children:e}),o&&!t&&jsx(T,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(y,{name:"X","data-testid":"close-button"})})]})]});var Jn=createContext(false);function Go({children:e}){return jsx(Jn.Provider,{value:true,children:e})}var xe=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:n=false,flex:a=false,stack:i,responsive:s,delay:d=0,adjustAnimationSpeedBasedOnWidth:u=false,ariaLabel:c,className:l,"data-testid":g})=>{let[v,m]=useState(d===0);if(useEffect(()=>{if(d>0){let E=setTimeout(()=>m(true),d);return ()=>clearTimeout(E)}},[d]),!v)return null;let p=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",C=u&&e?(()=>{let E=typeof e=="number"?e:parseFloat(String(e));return isNaN(E)?"":`animation-duration-[${Math.max(.8,E/100)}s]`})():"",R=r==="pulse"?`animate-pulse ${C}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${C}`:"",P="rounded-sm";t==="circle"&&(P="rounded-full"),t==="text"&&(P="h-4 w-full rounded-sm");let V=a?"flex-1 min-w-0":"",M=s?Object.entries(s).map(([E,F])=>`${E}:w-[${F}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":g,children:i.map((E,F)=>jsx("div",{className:twMerge(p,R,P,V,M,l),style:{width:E,height:o}},F))}):jsx("div",{className:twMerge(p,R,P,V,M,l),style:{width:e,height:o},role:"presentation","aria-hidden":!c,"aria-label":c??void 0,"data-testid":g})};var oa={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},ra="rounded-lg",$t={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},na={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function aa(e){return lt__default.Children.toArray(e).some(o=>lt__default.isValidElement(o)&&o.type===it&&!!o.props.title)}function be({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:n="default"}){let a=aa(t)?jsx(Go,{children:t}):t;return jsx("div",{className:twMerge("w-full overflow-hidden",oa[e],ra,n==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(xe,{width:"100%",height:"100%",className:"rounded-none"}):a})}function it({title:e,subtitle:o,actions:t,leading:r,className:n,isLoading:a=false}){return a?jsxs("div",{className:twMerge("p-6 pb-4",n),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(xe,{width:120,height:20}),jsx(xe,{width:24,height:24})]}),o&&jsx(xe,{width:200,height:16})]}):!e&&!o&&!t&&!r?null:jsx("div",{className:twMerge("p-6 pb-4",n),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[r&&jsx("div",{className:"flex-shrink-0",children:r}),jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(nt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:wo("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function qo({src:e,alt:o,aspectRatio:t="auto",className:r,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",$t[t],r),children:jsx(xe,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",$t[t],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",$t[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Pt({className:e,children:o,isLoading:t=false,fill:r=false,style:n}){let i=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsx("div",{className:twMerge(i,r&&"flex-1 flex flex-col min-h-0",e),style:n,children:jsxs("div",{className:"space-y-2",children:[jsx(xe,{width:"100%",height:16}),jsx(xe,{width:"80%",height:16}),jsx(xe,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge(i,"text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),style:n,children:o}):null}function Uo({className:e,children:o,align:t="end",isLoading:r=false}){return r?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(xe,{width:80,height:32}),jsx(xe,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",na[t],e),children:o}):null}be.Header=it;be.Media=qo;be.Content=Pt;be.Footer=Uo;var st=class extends Component{constructor(){super(...arguments);Lt(this,"state",{hasError:false});Lt(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,r){console.error("Error Boundary caught an error:",t,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(be,{children:[this.props.title&&jsx(be.Header,{title:this.props.title}),jsx(be.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var da=.3,ca=.5;function Ue({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:i,isOpen:s,onClose:d,isDismissable:u=true,transparentOverlay:c=false,primaryAction:l,secondaryAction:g,footerContent:v,maxHeight:m="80vh",height:p,maxWidth:C="640px",contentPadding:R=true,showHandle:P=true,animationVariant:V="scale",className:M}){let[E,F]=useState(false),[k,Q]=useState(0),[S,ne]=useState(false),H=zo(s),ce=H?.height??null,X=H?.keyboardOffset??0,U=useRef(null),de=useRef(null),z=useRef(null),h=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let b=setTimeout(()=>{F(true),setTimeout(()=>F(false),600);},400);return ()=>clearTimeout(b)}},[s]),useEffect(()=>{s||(Q(0),ne(false),h.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let b=de.current;if(!b||!s)return;let Y=null,O=Z=>{let ye=Z.target;ye&&["INPUT","TEXTAREA","SELECT"].includes(ye.tagName)&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{ye.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return b.addEventListener("focusin",O),()=>{b.removeEventListener("focusin",O),Y&&clearTimeout(Y);}},[s]);let Ie=useCallback(b=>{u&&(b.pointerType!=="touch"&&b.pointerType!=="pen"||(z.current&&(clearTimeout(z.current),z.current=null),h.current={isDragging:true,startY:b.clientY,startTime:Date.now(),pointerId:b.pointerId},ne(false),b.currentTarget.setPointerCapture(b.pointerId)));},[u]),Te=useCallback(b=>{let{isDragging:Y,startY:O,pointerId:Z}=h.current;if(!Y||b.pointerId!==Z)return;let ye=b.clientY-O;Q(Math.max(0,ye));},[]),ue=useCallback(b=>{let{isDragging:Y,startY:O,startTime:Z,pointerId:ye}=h.current;if(!Y||b.pointerId!==ye)return;let ee=b.clientY-O,Me=Date.now()-Z,Je=ee/Me;h.current={isDragging:false,startY:0,startTime:0,pointerId:null};let pt=(U.current?.getBoundingClientRect().height??0)*da;(ee>pt||Je>ca&&ee>50)&&u?(d?.(),Q(0)):(ne(true),Q(0),z.current=setTimeout(()=>{ne(false),z.current=null;},200));},[u,d]);if(!s)return null;let Fe=o||t,Ne=l||g||v;return jsx(st,{children:jsx(Be,{isOpen:s,onOpenChange:b=>{b||d?.();},isDismissable:u,transparent:c,style:{paddingBottom:X>0?`${X}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:u,children:jsx("div",{ref:U,className:twMerge("w-full",S&&"transition-transform duration-200"),style:{transform:k>0?`translateY(${k}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",V==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",V==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",M),style:{maxWidth:C,...p?{height:p}:{maxHeight:/\d/.test(m)?ce!==null?`min(${m}, ${Math.max(ce-8,0)}px, 100dvh)`:`min(${m}, 100dvh)`:m}},children:[P&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:Ie,onPointerMove:Te,onPointerUp:ue,onPointerCancel:ue,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",E&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),Fe&&(a?jsx($e,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsx($e,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!d,onClose:d||(()=>{})})),jsx("div",{ref:de,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",R?"p-4":"p-0"),children:e}),Ne&&jsx(Gt,{primaryAction:l,secondaryAction:g,footerContent:v})]})})})})})}Ue.displayName="Tray";var Jt=createContext("md");function Jo(){return useContext(Jt)}function jt(e="md"){let o=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${q[e].text} ${o}`}function xa(){let e=lt__default.useCallback((t,r)=>{r?.(t);},[]),o=lt__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function Zt({label:e,description:o,errorMessage:t,children:r,items:n,renderItem:a,renderSelectedValue:i,size:s="md",selectedKey:d,defaultSelectedKey:u,onSelectionChange:c,placeholder:l,showErrors:g=false,tooltip:v,isRequired:m,transparent:p,reserveErrorSpace:C=false,placement:R="bottom start",shouldFlip:P=true,menuWidth:V="match",descriptionPlacement:M="below",useMobileTray:E=true,...F}){let[k,Q]=useState(null),[S,ne]=useState(null),[H,ce]=useState(false),X=d??k??u,{handleFocus:U,handleBlur:de}=xa(),{isMobile:z}=ft(),h=E&&z,Ie=lt__default.useMemo(()=>!i||!X||!n?null:Array.from(n).find(Y=>Y.id===X)??null,[i,X,n]),Te=b=>{c&&b!==null&&c(b),c||Q(b);},ue=useRef(null),Fe=useRef(null),Ne=()=>{h&&ce(!H);};return jsxs(Fragment,{children:[jsx(Select,{...F,selectedKey:X,defaultSelectedKey:u,onSelectionChange:Te,placeholder:l,className:G(F.className,"group flex w-full flex-col"),ref:ue,onOpenChange:b=>{h||(b&&Fe.current?ne(Fe.current.offsetWidth):b||ue.current?.blur());},children:({isDisabled:b,isInvalid:Y,isOpen:O})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(W,{size:s,tooltip:v,description:M==="tooltip"||M==="inline"?o:void 0,descriptionPlacement:M,isRequired:m,children:e}),jsx(oe,{children:jsx("div",{ref:Fe,children:jsxs(T,{variant:"unstyled",className:twMerge(ae({isInvalid:Y||g&&!!t,isDisabled:b,isFocused:h?H:O,transparent:p,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:Z=>U(Z,F.onFocus),onBlur:Z=>de(Z,F.onBlur),onPress:h?Ne:void 0,"data-open":h?H:O,children:[i&&Ie?jsx("div",{className:jt(s),children:i(Ie)}):h&&X?jsx("div",{className:jt(s),children:n?Array.from(n).find(ee=>ee.id===X)?.label:String(X)}):jsx(SelectValue,{className:jt(s)}),jsx(y,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(h?H:O)&&"rotate-180")})]})})}),C?jsx("div",{className:"mt-1 min-h-[20px]",children:g?jsx(f,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&F.validationResult?t(F.validationResult):typeof t=="string"?t:null}):o&&M==="below"?jsx(I,{size:s,children:o}):null}):jsx(Fragment,{children:g?jsx(f,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&F.validationResult?t(F.validationResult):typeof t=="string"?t:null}):o&&M==="below"?jsx(I,{size:s,className:"mt-1",children:o}):null}),h?null:jsx(Ge,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:V==="match"&&S?`${S}px`:void 0,minWidth:V==="auto"&&S?`${S}px`:void 0,maxWidth:V==="auto"?"min(600px, 90vw)":void 0},placement:R,shouldFlip:P,children:jsx(Jt.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?Z=>jsx(we,{id:Z.id,textValue:Z.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(Z)})},Z.id):r})})})]})}),h&&jsx(Ue,{isOpen:H,onClose:()=>ce(false),title:e??"Select an option",contentPadding:false,children:jsx(Jt.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:X!=null?[X]:[],onSelectionChange:b=>{let Y=Array.from(b)[0];Y!=null&&(Te(Y),ce(false));},children:a&&n?b=>jsx(we,{id:b.id,textValue:b.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(b)})},b.id):r})})})]})}function we({size:e,className:o,...t}){let r=Jo(),n=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",q[n].paddingY,q[n].text,o)})}var Ke=({className:e,size:o=24,color:t="text-action-brand"})=>jsx("div",{className:twMerge("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent",t,e),style:{width:o,height:o},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});var wa=[],Ia={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},Ea={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},tr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},to=(e,o,t)=>{if(e==null||e==="")return "";let n=(t?t.flatMap(a=>a.items):o||[]).find(a=>a.id===e);return n?n.name:""};async function Ba(e,o,t){try{let r=e.url.replace("{q}",o),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([d,u])=>{n.append(d,u.toString());});let a=`${r}${n.toString()?"?"+n.toString():""}`,i=await fetch(a,{method:"GET",headers:e.headers,signal:t});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in REST request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}async function Va(e,o,t){try{let r=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${o}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:r}),signal:t});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.json();if(a.errors)throw new Error(a.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(a=e.responsePath.split(".").reduce((i,s)=>i?.[s],a)),{items:e.transformResponse(a)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}function oo({label:e,staticItems:o=wa,sections:t,selectedKey:r,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:u,description:c,size:l="md",tooltip:g,isRequired:v,isDisabled:m,isInvalid:p,validationResult:C,showErrors:R=true,renderItem:P,renderLeftIcon:V,renderSection:M,autoFocus:E=false,reserveErrorSpace:F=false,hideChevron:k=false,useMobileTray:Q=true,className:S}){let ne=lt__default.useRef(null),H=lt__default.useRef(null),[ce,X]=lt__default.useState(),[U,de]=useState(()=>to(r||n,o,t)),[z,h]=useState(false),[Ie,Te]=useState(false),ue=So(U),{contains:Fe}=useFilter({sensitivity:"base"}),[Ne,b]=useState(),{isMobile:Y}=ft(),O=Q&&Y,Z=q[l].text,ye=useAsyncList({async load({signal:w,filterText:L=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(L))return {items:[]};try{let re;return i.requestType==="GraphQL"?re=await Va(i,L,w):re=await Ba(i,L,w),b(re.error),{items:re.items}}catch(re){return re instanceof Error&&re.name==="AbortError"?{items:[]}:(console.error("Error loading items:",re),b(re instanceof Error?re.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),ee=i&&ue!==""?ye:null,Me=false,Je=useRef("");useEffect(()=>{E&&h(true);},[E]),useEffect(()=>{let w=to(r,o,t);w!==U&&de(w);},[r,o,t]),useEffect(()=>{let w=()=>{ne.current&&X(ne.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),useEffect(()=>{ue===""?Je.current="":ee&&ue!==Je.current&&(Je.current=ue,ee.setFilterText(ue));},[ue,ee]),Me=gt(!!ee?.isLoading,300);let No=lt__default.useMemo(()=>{if(!O||!U)return ee?ee.items:o;let w=ee?ee.items:o,L=s??(i?()=>true:Fe);return w.filter(re=>L(re.name,U))},[O,U,ee,o,s,Fe]),pt=w=>{let L=to(w,o,t);de(L),a&&a(w);},Vt=w=>{de(w);},ko=()=>{O&&Te(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:pt,selectedKey:r||void 0,defaultSelectedKey:n||void 0,items:ee?ee.items:t?t.flatMap(w=>w.items):o,className:G(S,"group flex flex-col w-full"),menuTrigger:O?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:m,isInvalid:p||!!u,inputValue:U,onInputChange:Vt,autoFocus:E&&!O,defaultFilter:s??(i?()=>true:Fe),"aria-label":e||d||"Autocomplete",children:w=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(W,{size:l,tooltip:g,isRequired:v,children:e}),jsxs(oe,{ref:ne,children:[V?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:V(Me)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Me?jsx(Ke,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:`${Ia[l]} text-text-secondary`})}),jsx(Input,{className:ae({isInvalid:p||!!u,isDisabled:m,isFocused:z||(O?Ie:w.isOpen),size:l,className:twMerge(Ea[l],U&&!m||!k&&!U?"pr-10":"pr-3",O&&"cursor-pointer",S)}),placeholder:d,disabled:m,onFocus:L=>{h(true),O&&(L.currentTarget.blur(),ko());},onBlur:()=>{h(false);},onClick:O?ko:void 0,readOnly:O,"aria-label":e||d||"Autocomplete"}),U&&!m&&jsx(et,{onClick:()=>{de(""),a?.(null);},size:l}),!k&&!U&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:m,children:({isPressed:L})=>jsx(y,{name:L?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),F?jsx("div",{className:"mt-1 min-h-[20px]",children:R&&Ne?jsx(f,{size:l,className:"text-feedback-error-text",children:Ne}):R&&typeof u=="string"?jsx(f,{size:l,className:"text-feedback-error-text",children:u}):R&&typeof u=="function"&&C?jsx(f,{size:l,className:"text-feedback-error-text",children:u(C)}):c?jsx(I,{size:l,children:c}):null}):jsxs(Fragment,{children:[c&&jsx(I,{size:l,className:"mt-1",children:c}),R&&Ne&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Ne}),R&&typeof u=="string"&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:u}),R&&typeof u=="function"&&C&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:u(C)})]}),!O&&jsx(Ge,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:ce?`${ce}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||d||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${Z}`,children:t?t.map(L=>{let re=L.items.map(ve=>jsx(we,{id:ve.id,textValue:ve.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${tr[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:P?P(ve):ve.name},ve.id));if(M){let ve=M(L,re);return lt__default.isValidElement(ve)&&ve.type===ListBoxSection?ve:jsx(ListBoxSection,{children:ve},L.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:L.name}),re]},L.name)}):L=>jsx(we,{id:L.id,textValue:L.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${tr[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:P?P(L):L.name},L.id)})})]})}),O&&jsx(Ue,{isOpen:Ie,onClose:()=>Te(false),title:e??d??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(oe,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Me?jsx(Ke,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:H,type:"text",value:U,onChange:w=>Vt(w.target.value),placeholder:d,autoFocus:true,className:ae({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),U&&jsx(et,{onClick:()=>{de(""),a?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||d||"Suggestions",items:No,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:w=>{let L=Array.from(w)[0];L&&(pt(L),Te(false));},className:"bg-background-input outline-none",children:w=>jsx(we,{id:w.id,textValue:w.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:P?P(w):w.name},w.id)})})]})})]})}function D(e,o){let t=o.split("."),r=e;for(let a of t)if(r&&typeof r=="object"&&a in r)r=r[a];else {r=void 0;break}let n=r?.message;return typeof n=="string"?n:void 0}function Bu({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(oo,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!a,errorMessage:a})})}var Oa="focus:ring-action-primary",Ga="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function ar(e){return jsxs(CheckboxGroup,{...e,className:G(e.className,"flex flex-col gap-2"),children:[jsx(W,{children:e.label}),e.children,e.description&&jsx(I,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Wa({isDisabled:e}){return `relative flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function $a({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",a=Oa,i="";return t?i="border-border-muted bg-background-muted":o?i="border-feedback-error-border bg-feedback-error-background":e||r?i=Ga:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var nr="w-4 h-4 text-current group-disabled:text-text-disabled";function ir(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(n,a)=>`${Wa(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,d=jsx("div",{className:$a({isSelected:a,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:nr}):a?jsx(Check,{"aria-hidden":true,className:nr}):null});return jsxs(Fragment,{children:[d,typeof o=="function"?o(n):o]})}})}function ju({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:n,formState:a}=useFormContext(),i=D(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(ir,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(f,{children:i})]})})}function tm({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ar,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:a,children:t.children})})}function Ye(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function ao(e){if(!e)return "";let o=e.startsWith("#")?e.slice(1):e;return o.length===3&&(o=o.split("").map(t=>t+t).join("")),`#${o.toUpperCase()}`}function cr({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:d,value:u,defaultValue:c,onChange:l,placeholder:g="#000000",showColorSwatch:v=true,reserveErrorSpace:m=true,...p}){let[C,R]=useState(c||""),[P,V]=useState(u||c||""),[M,E]=useState(false),[F,k]=useState(null),{isFocused:Q,handleFocus:S,handleBlur:ne}=ke(),H=u!==void 0?u:C;useEffect(()=>{u!==void 0&&V(u);},[u]);let ce=H?!Ye(H):false,X=useCallback(z=>{if(V(z),Ye(z)){let h=ao(z);l?l(h):R(h);}else z===""&&(l?l(""):R(""));},[l]),U=useCallback(z=>{let h=ao(z);V(h),l?l(h):R(h);},[l]),de=useCallback(z=>{if(Ye(P)){let h=ao(P);V(h),l&&h!==H?l(h):!l&&h!==C&&R(h);}ne(z,p.onBlur);},[P,H,C,l,ne,p.onBlur]);return jsx(TextField,{...p,isRequired:a,className:G(s,"group flex flex-col"),children:({isDisabled:z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(W,{size:r,tooltip:n,isRequired:a,children:e}),jsx(oe,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(vt,{size:r,disabled:z,type:"text",value:P,placeholder:g,onFocus:h=>S(h,p.onFocus),onBlur:de,onChange:h=>X(h.target.value),className:twMerge(ae({isInvalid:ce,isDisabled:z,isFocused:Q,size:r,transparent:i}),v?"pr-12":"pr-3","pl-3")}),v&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:q[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",Ye(H)?"border-border-default":"border-border-default bg-background-muted"),style:Ye(H)?{backgroundColor:H}:void 0,"aria-hidden":"true",children:!Ye(H)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:k,children:jsx(T,{variant:"secondary",size:r,icon:"Palette",onPress:()=>E(!M),isDisabled:z,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsx(f,{size:r,children:t(d)}):o?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsx(I,{size:r,className:"mt-1",children:o}):null}),M&&F&&jsx(Ge,{triggerRef:{current:F},isOpen:M,onOpenChange:E,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:H||"#000000",onChange:U,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:H||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:H||"#000000"})]})]})})]})})}function ym({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(cr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a})})}function mi({isSelected:e,isDisabled:o}){let t=[Ee,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return o?t.push("text-text-disabled forced-colors:text-[GrayText]"):e?t.push("bg-action-default text-text-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function so({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(mr,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(pr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:n})=>`${mi({isSelected:r,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function mr(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(T,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(y,{name:"CaretRight","aria-hidden":true,size:o}):jsx(y,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(T,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(y,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(y,{name:"CaretRight","aria-hidden":true,size:o})})]})}function pr(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function co({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,showCalendar:d=true,reserveErrorSpace:u=true,validationResult:c,className:l,...g}){let[v,m]=useState(false),p=C=>{g.onChange&&C&&g.onChange(C),m(false);};return jsxs(DateField,{...g,isDisabled:i,isRequired:a,isInvalid:s,className:G(l,"flex flex-col gap-1"),children:[e&&jsx(W,{size:r,tooltip:n,isRequired:a,children:e}),jsx(oe,{children:jsxs("div",{className:"relative w-full",children:[jsx(gr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:m,children:[jsx(T,{variant:"unstyled",className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-8 w-8 items-center justify-center rounded hover:bg-background-hover text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(y,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(so,{value:g.value,onChange:p,minValue:g.minValue,maxValue:g.maxValue,isDisabled:i,isReadOnly:g.isReadOnly,isDateUnavailable:g.isDateUnavailable})})})]})]})}),u?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsx(f,{size:r,children:t(c)}):o?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(f,{size:r,className:"mt-1",children:t(c)}):o?jsx(I,{size:r,className:"mt-1",children:o}):null})]})}function vi({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function gr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:n,...a}){return jsx(DateInput,{className:twMerge(tt({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",n),...a,children:i=>jsx(DateSegment,{segment:i,className:vi({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function Jm({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(co,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a})})}function uo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:n,isDisabled:a=false,onUpload:i,className:s,showPreview:d=true,placeholder:u="Drop files here or click to browse"}){let[c,l]=useState(false),[g,v]=useState(false),[m,p]=useState(null),[C,R]=useState(e),P=useRef(null),V=async F=>{if(p(null),n&&F.size>n){p(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(d&&F.type.startsWith("image/")){let k=new FileReader;k.onloadend=()=>{R(k.result);},k.readAsDataURL(F);}if(i){v(true);try{let k=await i(F);R(k),t?.(k);}catch(k){p("Failed to upload file"),console.error("Upload error:",k);}finally{v(false);}}o?.(F,C);},M=async F=>{try{let k=F.items;if(k.length>0){let Q=k[0];if(Q.kind==="file"){let S=await Q.getFile();S&&V(S);}}}catch(k){p("Failed to upload file"),console.error("Upload error:",k);}finally{l(false);}},E=()=>{R(void 0),p(null),o?.(null),t?.(""),P.current&&(P.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",c?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",a&&"pointer-events-none opacity-50",m&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:M,onDropEnter:()=>l(true),onDropExit:()=>l(false),children:[C?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(C.startsWith("data:image")||C.startsWith("http"))?jsx("img",{src:C,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsx(T,{variant:"icon",size:"sm",onPress:E,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:u}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsx(FileTrigger,{acceptedFileTypes:r.split(","),onSelect:F=>{let k=Array.from(F||[]);k.length>0&&V(k[0]);},children:jsx(T,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),g&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),m&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function fp({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:n,formState:a}=useFormContext(),i=D(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(uo,{...r,value:s.value??"",onChange:(d,u)=>s.onChange(u||"")}),t&&i&&jsx(f,{children:i})]})})}var _i=e=>{let o=ae({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function fo({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,validationResult:s,reserveErrorSpace:d=true,descriptionPlacement:u="below",...c}){let l=useId(),{isFocused:g,handleFocus:v,handleBlur:m}=ke();return jsx(NumberField,{...c,id:l,isRequired:a,className:G(c.className,"group flex flex-col gap-1"),step:c.step??1,onChange:p=>{typeof p=="number"&&(c.maxValue!=null&&p>c.maxValue?c.onChange?.(c.maxValue):c.minValue!=null&&p<c.minValue?c.onChange?.(c.minValue):c.onChange?.(p));},isInvalid:!!t||typeof c.value=="number"&&(c.maxValue!=null&&c.value>c.maxValue||c.minValue!=null&&c.value<c.minValue),children:({isDisabled:p,isInvalid:C})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(W,{size:r,tooltip:n,description:u==="tooltip"||u==="inline"?o:void 0,descriptionPlacement:u,isRequired:a,htmlFor:l,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:P=>v(P,c.onFocus),onBlur:P=>m(P,c.onBlur),className:_i({isInvalid:C||!!t,isDisabled:p,isFocused:g,transparent:i,size:r,className:typeof c.className=="string"?c.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:p,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(y,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:p,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(y,{name:"CaretDown",size:14})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&u==="below"?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&u==="below"?jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}function Vp({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(fo,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a,isRequired:t.isRequired})})}function xo({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:a,className:i,children:s,size:d="2",variant:u="primary",columns:c="repeat(auto-fit, minmax(160px, 1fr))",gap:l="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:a,className:G(i,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(c))?`repeat(${c}, minmax(0, 1fr))`:c,gap:l==="1"?"0.25rem":l==="2"?"0.5rem":l==="3"?"0.75rem":l==="4"?"1rem":typeof l=="number"?`${l}px`:l},children:lt__default.Children.map(s,g=>lt__default.isValidElement(g)?lt__default.cloneElement(g,{size:d,variant:u}):g)})}function Xp({name:e,defaultValue:o,label:t,description:r,children:n,...a}){let{control:i,formState:s}=useFormContext(),d=D(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:u})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx(W,{children:t}),r&&jsx(I,{children:r}),jsx(xo,{...a,value:u.value,onChange:c=>u.onChange(c),children:n}),d&&jsx(f,{children:d})]})})}function ji(e){return "primary"}var Qi=createContext({variant:"primary"});function bo(e){let{variant:o="primary",...t}=e,r=ji();return jsx(Qi.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:G(e.className,"group flex flex-col gap-2"),children:[jsx(W,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(I,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function yf({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(bo,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:a,children:t.children})})}var rs=e=>{let o=ae({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function mt({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,showSearchIcon:s,isClearable:d,onClear:u,type:c,validationResult:l,reserveErrorSpace:g=true,isLoading:v=false,descriptionPlacement:m="below",...p}){let[C,R]=lt__default.useState(false),{isFocused:P,handleFocus:V,handleBlur:M}=ke(),E=c==="password",F=gt(v,300);return jsx(TextField,{...p,isRequired:a,className:G(p.className,"group flex flex-col"),children:({isDisabled:k,isInvalid:Q})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(W,{size:r,tooltip:n,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:a,children:e}),jsxs(oe,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let S={sm:14,md:16,lg:18,xl:20}[r];return F?jsx(Ke,{size:S,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",size:S,className:`transition-colors ${P?"text-action-brand":"text-text-secondary"}`})})()}),jsx(vt,{size:r,disabled:k,type:E?C?"text":"password":c,name:p.name,autoComplete:p.autoComplete,value:p.value,defaultValue:p.defaultValue,placeholder:p.placeholder,onFocus:S=>V(S,p.onFocus),onBlur:S=>M(S,p.onBlur),onChange:S=>p.onChange?.(S.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[r]}:void 0,className:rs({isInvalid:Q,isDisabled:k,isFocused:P,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!p.value,isPassword:E,className:typeof p.className=="string"?p.className:void 0})}),d&&p.value&&!k&&jsx(et,{onClick:()=>{u?u():p.onChange&&p.onChange("");},size:r}),E&&!k&&jsx("button",{type:"button",onClick:()=>R(!C),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":C?"Hide password":"Show password",onMouseDown:S=>{S.preventDefault(),S.stopPropagation();},children:jsx(y,{name:C?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o&&m==="below"?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}var ps={sm:{toolbar:"p-1.5",contentWrapper:"min-h-[100px]",contentPadding:"p-3",placeholderPos:"left-3 top-3",prose:"prose-xs",h1:"[&_.ProseMirror_h1]:mb-2 [&_.ProseMirror_h1]:text-base [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-1.5 [&_.ProseMirror_h2]:text-sm [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-1",list:"[&_.ProseMirror_ul]:mb-1 [&_.ProseMirror_ul]:ml-4 [&_.ProseMirror_ol]:mb-1 [&_.ProseMirror_ol]:ml-4",li:"[&_.ProseMirror_li]:mb-0.5",placeholderText:"text-xs"},md:{toolbar:"p-2",contentWrapper:"min-h-[200px]",contentPadding:"p-4",placeholderPos:"left-4 top-4",prose:"prose-sm",h1:"[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-2",list:"[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6",li:"[&_.ProseMirror_li]:mb-1",placeholderText:"text-sm"},lg:{toolbar:"p-2.5",contentWrapper:"min-h-[250px]",contentPadding:"p-5",placeholderPos:"left-5 top-5",prose:"prose-base",h1:"[&_.ProseMirror_h1]:mb-5 [&_.ProseMirror_h1]:text-3xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-4 [&_.ProseMirror_h2]:text-2xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-3",list:"[&_.ProseMirror_ul]:mb-3 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ol]:mb-3 [&_.ProseMirror_ol]:ml-6",li:"[&_.ProseMirror_li]:mb-1.5",placeholderText:"text-base"},xl:{toolbar:"p-3",contentWrapper:"min-h-[300px]",contentPadding:"p-6",placeholderPos:"left-6 top-6",prose:"prose-lg",h1:"[&_.ProseMirror_h1]:mb-6 [&_.ProseMirror_h1]:text-4xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-5 [&_.ProseMirror_h2]:text-3xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-3",list:"[&_.ProseMirror_ul]:mb-3 [&_.ProseMirror_ul]:ml-8 [&_.ProseMirror_ol]:mb-3 [&_.ProseMirror_ol]:ml-8",li:"[&_.ProseMirror_li]:mb-2",placeholderText:"text-lg"}},Qe=({isActive:e=false,onPress:o,children:t})=>jsx(T,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function fs({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[n,a]=useState(e);return lt__default.useEffect(()=>{a(e);},[e]),jsx(Be,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsx(Modal,{className:"flex items-center justify-center p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsx(Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxs("form",{onSubmit:s=>{s.preventDefault(),r(n),t();},children:[jsx($e,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(mt,{label:"URL",type:"url",value:n,onChange:a,autoFocus:true,className:"w-full"})}),jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsx(T,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(T,{type:"submit",children:"Save"})]})]})})})})}function ho({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:n="Start typing...",id:a,size:i="md",headingLevels:s=[1,2]}){let d=ps[i],[u,c]=useState(false),l=useEditor({immediatelyRender:false,extensions:[ds.configure({heading:s.length>0?{levels:s}:false}),as.configure({openOnClick:false,HTMLAttributes:{class:"text-text-link-default hover:text-text-link-hover underline decoration-text-link-default/30 hover:decoration-text-link-hover cursor-pointer"}})],content:e,editable:!r,onUpdate:({editor:m})=>{o?.(m.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${d.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),g=()=>{c(true);},v=m=>{m===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:m}).run();};return l?jsxs("div",{id:a,"data-richtexteditor":true,className:twMerge("flex flex-col rounded-md border border-border-input bg-background-input","outline-none focus-within:outline-none focus-within:border-border-input focus-within:ring-0 focus-within:shadow-none",r&&"opacity-50",t),style:{outline:"none"},children:[!r&&l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,shouldShow:({editor:m})=>m.isActive("link")&&!u,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(T,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let m=l.getAttributes("link").href;m&&window.open(m,"_blank","noopener,noreferrer");},children:[jsx(y,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(T,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:g,children:[jsx(y,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(T,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(y,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(fs,{isOpen:u,onClose:()=>c(false),onSubmit:v,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(m=>jsx(Qe,{isActive:l.isActive("heading",{level:m}),onPress:()=>l.chain().focus().toggleHeading({level:m}).run(),children:jsxs("span",{className:"text-xs font-bold",children:["H",m]})},m)),jsx(Qe,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Qe,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsx("span",{className:"text-xs italic",children:"I"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Qe,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(y,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Qe,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(y,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Qe,{isActive:l.isActive("link"),onPress:g,children:jsx(y,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:twMerge("relative w-full outline-none focus:outline-none",d.contentWrapper),children:[jsx(EditorContent,{editor:l,className:twMerge("w-full outline-none focus:outline-none",d.contentPadding,"[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none",d.h1,d.h2,d.p,"[&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:list-decimal",d.list,d.li,"[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:border-border-muted [&_.ProseMirror_blockquote]:pl-4 [&_.ProseMirror_blockquote]:italic","[&_.ProseMirror_code]:rounded [&_.ProseMirror_code]:bg-background-muted [&_.ProseMirror_code]:px-1 [&_.ProseMirror_code]:py-0.5 [&_.ProseMirror_code]:font-mono [&_.ProseMirror_code]:text-sm","[&_.ProseMirror_pre]:rounded-md [&_.ProseMirror_pre]:bg-background-muted [&_.ProseMirror_pre]:p-3 [&_.ProseMirror_pre]:font-mono [&_.ProseMirror_pre]:text-sm","[&_.ProseMirror_hr]:border-border-muted",r&&"pointer-events-none")}),l.isEmpty&&!r&&jsx("div",{className:twMerge("pointer-events-none absolute text-text-secondary",d.placeholderPos,d.placeholderText),children:n})]})]}):null}function og({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:n=true,...a}){let{control:i,formState:s}=useFormContext(),d=D(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:u})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-primary",children:t}),r&&jsx("p",{className:"text-sm text-text-secondary",children:r}),jsx(ho,{...a,id:e,initialContent:u.value??"",onChange:c=>u.onChange(c)}),d&&jsx("p",{className:"text-sm text-feedback-error-text",children:d}),n&&!d&&jsx("div",{className:"h-5"})]})})}function cg({name:e,defaultValue:o,onValueChange:t,...r}){let{control:n,formState:a}=useFormContext(),i=D(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsx(Zt,{...r,selectedKey:s.value??null,onSelectionChange:d=>{s.onChange(d),t?.(d);},showErrors:!!i,errorMessage:i})})}var vo={sm:{track:"h-4 w-7",handle:"h-3.5 w-3.5",text:"text-xs"},md:{track:"h-5 w-9",handle:"h-4 w-4",text:"text-sm"},lg:{track:"h-6 w-11",handle:"h-5 w-5",text:"text-base"},xl:{track:"h-7 w-14",handle:"h-6 w-6",text:"text-lg"}};function Cs({isSelected:e,isDisabled:o,size:t="md"}){let r="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=vo[t].track,a=Ee,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[r,n,a,i,s,o?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Rs({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",n=vo[t].handle;return [r,n,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Po({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:G(r.className,`relative group flex items-center gap-2 ${vo[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:Cs({...n,size:t}),children:jsx("span",{className:Rs({...n,size:t})})}),e]})})}function Cg({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:n})=>jsx(Po,{...t,isSelected:!!n.value,onChange:a=>n.onChange(a),children:t.children})})}var ws=e=>{let o=ae({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=`min-h-[100px] py-2 ${e.isDisabled?"resize-none":e.isResizable?"resize-y":"resize-none"}`;return twMerge(o,t,e.className)};function Co({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,required:a,transparent:i,isInvalid:s,isDisabled:d,isResizable:u=false,className:c,validationResult:l,reserveErrorSpace:g=true,...v}){let{isFocused:m,handleFocus:p,handleBlur:C}=ke();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(W,{size:r,tooltip:n,isRequired:a,children:e}),jsx(oe,{children:jsx("textarea",{...v,required:a,onFocus:R=>{v.onFocus&&v.onFocus(R),p(R);},onBlur:R=>{v.onBlur&&v.onBlur(R),C(R);},className:ws({isInvalid:s,isDisabled:d,isResizable:u,isFocused:m,size:r,transparent:i,className:c}),disabled:d})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}function Dg({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Co,{...t,value:i.value??"",onChange:s=>i.onChange(s.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!a,errorMessage:a,required:t.required})})}function Og({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(mt,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!a,errorMessage:a,isRequired:t.isRequired})})}function Hs({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function Ro({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,reserveErrorSpace:d=true,validationResult:u,className:c,descriptionPlacement:l="below",...g}){return jsxs(TimeField,{...g,isDisabled:i,isRequired:a,isInvalid:s,className:G(c,"flex flex-col gap-1"),children:[e&&jsx(W,{size:r,tooltip:n,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:a,children:e}),jsx(oe,{children:jsx(DateInput,{className:twMerge(tt({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:Hs({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||i,size:r})})})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsx(f,{size:r,children:t(u)}):o&&l==="below"?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(f,{size:r,className:"mt-1",children:t(u)}):o&&l==="below"?jsx(I,{size:r,className:"mt-1",children:o}):null})]})}function sx({name:e,...o}){let{control:t,formState:{errors:r}}=useFormContext(),n=r[e],a=n?.message;return jsx(Controller,{name:e,control:t,render:({field:i})=>jsx(Ro,{...o,value:i.value,onChange:i.onChange,isInvalid:!!n,errorMessage:a})})}function mx({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),n=lt.useRef(null),a=r.errors,i=Object.entries(a||{}),s=i.length>0;if(lt.useEffect(()=>{t&&s&&n.current?.focus();},[t,s]),!s)return null;let d=u=>{let c=`[name="${CSS.escape(u)}"]`,l=document.querySelector(c);l&&(l.focus(),l.scrollIntoView({block:"center",behavior:"smooth"}));};return jsxs("div",{ref:n,role:"alert",tabIndex:-1,className:twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsx("div",{className:"font-medium",children:o}),jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([u,c])=>{let l=c?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>d(u),children:l})},u)})})]})}function bx({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:n,...a}){let{formState:i}=useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsx(T,{type:"submit",form:e,isDisabled:s,...a,children:n})}function Rx({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:n}=useFormContext(),{fields:a,append:i,remove:s,swap:d}=useFieldArray({control:n,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[a.map((u,c)=>jsxs(be,{children:[jsx(it,{title:o?o(c):`Item ${c+1}`,actions:jsxs("div",{className:"flex gap-2",children:[c>0&&jsx(T,{size:"sm",variant:"secondary",onPress:()=>d(c,c-1),children:"Up"}),c<a.length-1&&jsx(T,{size:"sm",variant:"secondary",onPress:()=>d(c,c+1),children:"Down"}),jsx(T,{size:"sm",variant:"secondary",onPress:()=>s(c),children:"Remove"})]})}),jsx(Pt,{children:t(c)})]},u.id)),jsx("div",{children:jsx(T,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function To(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function wr(e){let o=e.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||e.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']")||e.querySelector("input, select, textarea");o&&(o.focus({preventScroll:false}),o instanceof HTMLElement&&o.scrollIntoView({block:"center",behavior:"smooth"}));}function Mx({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:n=true,className:a,...i}){let s=useForm(i),d=(u,c)=>{if(n&&e){let l=document.getElementById(e);l&&wr(l);}t?.(u,c);};return jsx(FormProvider,{...s,children:jsx(To,{id:e,className:a,onSubmit:s.handleSubmit(o,d),children:r})})}function Br({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:i}){return o?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(T,{variant:"secondary",onPress:r,children:a}),jsx(T,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":n})]})]})}):null}function Ux({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n}){let{formState:a}=useFormContext();return jsx(Br,{formId:e,show:a.isDirty,isSubmitting:a.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n})}function Qx(e=true){let{formState:o}=useFormContext();lt.useEffect(()=>{if(!e||!o.isSubmitted||!o.errors||Object.keys(o.errors).length===0)return;let t=document.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||document.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']");t&&t.scrollIntoView({block:"center",behavior:"smooth"});},[e,o.isSubmitted,o.errors]);}function Zx({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:n}=useFormContext(),a=lt.useRef(void 0);lt.useEffect(()=>{let i=t(()=>{r.isDirty&&(a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(async()=>{let s=n();await o(s);},e));});return ()=>{i.unsubscribe(),a.current&&window.clearTimeout(a.current);}},[t,r.isDirty,n,e,o]);}
|
|
2
|
-
export{
|
|
1
|
+
import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';export{Controller,useFieldArray,useFormContext,useWatch}from'react-hook-form';import*as Pt from'react';import Pt__default,{memo,createContext,forwardRef,useState,useRef,useEffect,useCallback,useId,useMemo,useContext,Component}from'react';import {useFilter}from'react-aria';import {ComboBox,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,Group,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,useSlottedContext,PopoverContext,OverlayArrow,Modal,ListBoxItem,Calendar,CalendarGrid,CalendarGridBody,CalendarCell,Text,TooltipTrigger,Tooltip,ModalOverlay,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell}from'react-aria-components';import {useAsyncList}from'react-stately';import {twMerge}from'tailwind-merge';import*as Xo from'@phosphor-icons/react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {Image,X,Upload,Minus,Check}from'lucide-react';import {HexColorPicker}from'react-colorful';import Zs from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import rl from'@tiptap/starter-kit';var pn=Object.defineProperty;var mn=(e,o,t)=>o in e?pn(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Xt=(e,o,t)=>mn(e,typeof o!="symbol"?o+"":o,t);function Xe(e,o=false){let[t,r]=useState(o);return useEffect(()=>{if(typeof window>"u")return;let n=window.matchMedia(e);r(n.matches);let i=a=>{r(a.matches);};return n.addEventListener("change",i),()=>{n.removeEventListener("change",i);}},[e]),t}var pt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function Nt(e="base"){let o=Xe(`(min-width: ${pt.sm})`,e!=="base"),t=Xe(`(min-width: ${pt.md})`,["md","lg","xl","2xl"].includes(e)),r=Xe(`(min-width: ${pt.lg})`,["lg","xl","2xl"].includes(e)),n=Xe(`(min-width: ${pt.xl})`,["xl","2xl"].includes(e)),i=Xe(`(min-width: ${pt["2xl"]})`,e==="2xl"),a=!t,s=t,l="base";return i?l="2xl":n?l="xl":r?l="lg":t?l="md":o&&(l="sm"),{current:l,isSm:o,isMd:t,isLg:r,isXl:n,is2Xl:i,isMobile:a,isDesktop:s}}function Uo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let n=setTimeout(()=>r(e),o);return ()=>clearTimeout(n)},[e,o]),t}function wt(e,o=300){let[t,r]=useState(false);return useEffect(()=>{if(e){let n=setTimeout(()=>{r(true);},o);return ()=>clearTimeout(n)}r(false);},[e,o]),t}function It(...e){return e.filter(Boolean).join(" ")}var Ne={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function Ko(e,...o){return It(Ne[e],...o)}function $e(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function Q(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var $={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};function oe(e,o){let t=forwardRef(({size:r=24,color:n="currentColor",className:i,mirrored:a,alt:s,...l},c)=>{let u=!!s||"aria-label"in l;return jsx("svg",{ref:c,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 256 256",fill:n,className:i,transform:a?"scale(-1, 1)":void 0,"aria-hidden":u?void 0:true,role:u?"img":void 0,"aria-label":s,...l,children:o})});return t.displayName=e,t}var Et=()=>jsxs(Fragment,{children:[jsx("path",{d:"M12 128h44M200 128h44",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"76",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("circle",{cx:"180",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"})]}),Yo=()=>jsx("path",{d:"M166 120 88 70",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jo=()=>jsx("path",{d:"M162 122 92 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Qo=()=>jsxs(Fragment,{children:[jsx("path",{d:"M112 85.7 A32 32 0 1 1 144 85.7",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"58",r:"8",fill:"currentColor",stroke:"none"})]}),Fn=oe("TextureRecloser",jsxs(Fragment,{children:[jsx("rect",{x:"36",y:"36",width:"184",height:"184",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"140",fontWeight:"700",fill:"currentColor",stroke:"none",children:"R"})]})),Sn=oe("TextureFuse",jsx("path",{d:"M20 128h72q18 -84 36 0q18 84 36 0h72",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})),kn=oe("TextureBreaker",jsxs(Fragment,{children:[jsx("rect",{x:"36",y:"36",width:"184",height:"184",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"140",fontWeight:"700",fill:"currentColor",stroke:"none",children:"B"})]})),Tn=oe("TextureSource",jsxs(Fragment,{children:[jsx("path",{d:"M4 128h40M212 128h40",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"128",r:"84",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("path",{d:"M92 128q18 -84 36 0q18 84 36 0",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})]})),Nn=oe("TextureCapacitor",jsx(Fragment,{children:jsx("path",{d:"M4 128h106M146 128h106M110 72v112M146 72v112",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"})})),wn=oe("TextureRegulator",jsxs(Fragment,{children:[jsx("circle",{cx:"128",cy:"128",r:"92",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("text",{x:"128",y:"126",textAnchor:"middle",dominantBaseline:"central",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"128",fontWeight:"700",fill:"currentColor",stroke:"none",children:"V"})]})),In=oe("TextureSwitch",jsxs(Fragment,{children:[jsx(Et,{}),jsx(Yo,{})]})),En=oe("TextureSwitchClosed",jsxs(Fragment,{children:[jsx(Et,{}),jsx(jo,{})]})),Vn=oe("TextureOpenPoint",jsxs(Fragment,{children:[jsx("path",{d:"M112 52 C 74 92, 74 164, 112 204",fill:"none",stroke:"currentColor",strokeWidth:"18",strokeLinecap:"round"}),jsx("path",{d:"M144 52 C 182 92, 182 164, 144 204",fill:"none",stroke:"currentColor",strokeWidth:"18",strokeLinecap:"round"})]})),Ln=oe("TextureSectionalizerOpen",jsxs(Fragment,{children:[jsx(Et,{}),jsx(Yo,{}),jsx(Qo,{})]})),Bn=oe("TextureSectionalizerClosed",jsxs(Fragment,{children:[jsx(Et,{}),jsx(jo,{}),jsx(Qo,{})]})),Mn=oe("TextureTransformer",jsxs(Fragment,{children:[jsx("path",{d:"M40 64H88A22 22 0 0 1 88 108A22 22 0 0 1 88 152A22 22 0 0 1 88 196H40",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M216 64H168A22 22 0 0 0 168 108A22 22 0 0 0 168 152A22 22 0 0 0 168 196H216",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})]})),Je={1:[128],2:[110,146],3:[92,128,164]},Jt=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"},e),Zt=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",pathLength:100,strokeDasharray:"20 20"},e),Dn=oe("TextureSinglePhaseOverheadLine",jsx(Fragment,{children:Je[1].map(Jt)})),An=oe("TextureTwoPhaseOverheadLine",jsx(Fragment,{children:Je[2].map(Jt)})),_n=oe("TextureThreePhaseOverheadLine",jsx(Fragment,{children:Je[3].map(Jt)})),zn=oe("TextureSinglePhaseUndergroundLine",jsx(Fragment,{children:Je[1].map(Zt)})),Hn=oe("TextureTwoPhaseUndergroundLine",jsx(Fragment,{children:Je[2].map(Zt)})),On=oe("TextureThreePhaseUndergroundLine",jsx(Fragment,{children:Je[3].map(Zt)})),$n=oe("TextureSupportStructure",jsx("circle",{cx:"128",cy:"128",r:"40",fill:"currentColor",stroke:"none"})),Vt={TextureRecloser:Fn,TextureFuse:Sn,TextureBreaker:kn,TextureSource:Tn,TextureCapacitor:Nn,TextureRegulator:wn,TextureSwitch:In,TextureSwitchClosed:En,TextureOpenPoint:Vn,TextureSectionalizerOpen:Ln,TextureSectionalizerClosed:Bn,TextureTransformer:Mn,TextureSinglePhaseOverheadLine:Dn,TextureTwoPhaseOverheadLine:An,TextureThreePhaseOverheadLine:_n,TextureSinglePhaseUndergroundLine:zn,TextureTwoPhaseUndergroundLine:Hn,TextureThreePhaseUndergroundLine:On,TextureSupportStructure:$n};if(process.env.NODE_ENV==="development")for(let e of Object.keys(Vt))e in Xo&&console.error(`Custom icon "${e}" collides with a Phosphor icon of the same name. Rename it (use the "Texture" prefix) to keep the icon namespace unambiguous.`);var Ze={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},y=memo(({name:e,size:o="md",color:t,weight:r="regular",className:n,ariaLabel:i,...a})=>{let s=Vt[e]??Xo[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react or the custom icon registry`),null;let l=typeof o=="string"&&o in Ze?Ze[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",n);return jsx(s,{...a,size:l,color:t,weight:r,className:c,"aria-label":i||`${e} icon`,"data-testid":`icon-${e}`})});y.displayName="Icon";var Gn=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:n="md",className:i,name:a,color:s,weight:l,ariaLabel:c,ref:u,...d})=>{let x=typeof n=="string"&&n in Ze?Ze[n]:n,v=t?typeof t=="string"&&t in Ze?Ze[t]:t:x*1.75,m=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:m,style:{width:v,height:v},children:jsx(y,{...d,name:a,size:n,color:s,weight:l,className:i,ariaLabel:c})})});Gn.displayName="IconWithContainer";var Yn=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",o?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",t].filter(Boolean).join(" ");function tr({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,n)=>Yn({...n,className:r})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function we(){let[e,o]=Pt__default.useState(false),t=Pt__default.useCallback((n,i)=>{o(true),i?.(n);},[]),r=Pt__default.useCallback((n,i)=>{o(false),i?.(n);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var ie=Pt__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));ie.displayName="InputWrapper";function mt({onClick:e,size:o="md",className:t}){return jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(y,{name:"X",size:o==="sm"?16:20})})}function ft(e){let{isInvalid:o,isDisabled:t,isFocused:r}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${n} border-border-muted`:o&&r?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:o?`${n} border-feedback-error-border`:r?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function jn(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function Qn(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function pe(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:i="md",className:a}=e;return twMerge("w-full",ft({isInvalid:o,isDisabled:t,isFocused:r}),jn({transparent:n,isDisabled:t}),$[i].text,$[i].height,$[i].padding,Qn(i),a)}function q({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:n="below",isRequired:i,className:a,htmlFor:s}){let l=t||r&&n==="tooltip",c=t||r,u=r&&n==="inline",d=jsxs("label",{htmlFor:s,className:twMerge($[o].text,"!text-text-label font-semibold flex items-center gap-1",a),children:[e,i&&jsx("span",{children:"*"}),l&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(y,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return l&&c?jsx(tr,{content:c,children:d}):d}function T({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",$[e].text,o),children:t})}function b({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge($[o].text,"text-feedback-error-text",t),children:e})}function Bt({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:n,className:i,...a}){return jsx("input",{className:pe({isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:e,className:i}),...a})}var ea="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",ta="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",oa={primary:ta,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},rr={full:"w-full",default:"w-fit"},ra="opacity-50 cursor-not-allowed pointer-events-none",na="opacity-100 cursor-pointer",aa={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},ia={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function sa(e){return !e||e==="default"||e==="brand"?"primary":e}function la(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:n=false,isLoading:i=false}=e,a=sa(o),s=a==="unstyled"?"":`${ea} ${oa[a]}`;a!=="unstyled"&&(s+=` ${$[t].text} ${$[t].height} ${$[t].padding} ${$[t].gap}`),r||i?s+=` ${ra}`:s+=` ${na}`,n?s+=` ${rr.full}`:s+=` ${rr.default}`;let l=a==="primary"?"focus-visible:outline-action-primary":void 0;return [s,$e(),l].filter(Boolean).join(" ")}function S(e){let{icon:o,children:t,isLoading:r=false,loadingText:n,loadingIndicator:i,size:a="md",iconPosition:s="left",iconWeight:l,href:c,className:u,badgeNumber:d,badgeVariant:x="primary",badgePosition:v="top-right",style:m,target:f,rel:h,...R}=e,F=o?jsx(y,{name:o,size:a,weight:l}):null,A=jsxs(Fragment,{children:[s==="left"&&F,typeof t=="function"?null:t,s==="right"&&F]}),M=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i||jsx(y,{name:"CircleNotch",size:a,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:A}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),V=(d??0)>0,k=twMerge(la(e),u),N=c?{href:c,target:f,rel:h,...R}:{};if(c){let{onPress:I,onPressStart:le,onPressEnd:H,onPressChange:ge,onPressUp:J,onAuxClick:Y,onContextMenu:me,onDoubleClick:G,...g}=R;Object.assign(N,g);}let K=c?jsx(Link,{...N,...r&&{"aria-busy":true},style:V?void 0:m,className:k,children:r?M:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&F,t(I),s==="right"&&F]})}):A}):jsx(Button,{...R,...r&&{"aria-busy":true},style:V?void 0:m,className:k,children:r?M:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&F,t(I),s==="right"&&F]})}):A});return V?jsxs("div",{className:twMerge("relative flex",u),style:m,children:[K,jsx("span",{className:`absolute ${aa[v]} flex h-5 w-5 items-center justify-center rounded-full ${ia[x]} text-xs font-medium`,"aria-label":`${d} items`,children:d})]}):K}function Ge({transparent:e=false,className:o,children:t,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(o,(n,i)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/15"].join(" "),i.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),i.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:t})}function ya({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let n=[!r&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),i=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",a=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [n,i,a,t].filter(Boolean).join(" ")}function tt({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:n=true,disableGroup:i=false,...a}){let l=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=l?c-6:c;let u=jsxs(Popover,{offset:c,...a,className:composeRenderProps(r,(d,x)=>ya({...x,className:d,disableGroup:i})),children:[o&&jsx(OverlayArrow,{children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"block fill-background-surface stroke-border-default stroke-1 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsx(Ge,{isDismissable:n,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:n,children:u})}):u}function nr(e=true){let[o,t]=useState(null);return useEffect(()=>{if(!e){t(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let n=()=>{let i=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));t({height:r.height,keyboardOffset:i});};return n(),r.addEventListener("resize",n),r.addEventListener("scroll",n),()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n);}},[e]),o}function ro({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(S,{type:r?"submit":"button",form:r?e.formId:void 0,size:e.size||t,variant:e.variant||o,onPress:r?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function ao({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let n=e||o||t;return !n&&!r?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsx("div",{className:"flex h-10 justify-center",children:r}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:t&&jsx(ro,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(ro,{action:o,defaultVariant:"secondary"}),e&&jsx(ro,{action:e,defaultVariant:"primary"})]})]})]})}var Ra={heading:{sm:Ne.headingSm,md:Ne.headingMd,lg:Ne.headingLg,xl:Ne.headingXl},display:{sm:Ne.displaySm,md:Ne.displayMd,lg:Ne.displayLg,xl:Ne.displayXl}},Fa={page:"h-16 leading-[62px]"};function xt({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:n="",children:i}){let a=t==="xs"?"sm":t,s=Ra[o][a],l=r?Fa[r]:"";return jsx(e,{className:It(s,"text-text-primary",l,n),children:i})}var rt=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:n=false,onBack:i,headerContent:a})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[n&&jsx(S,{variant:"icon",onPress:i,className:"absolute left-6","aria-label":"Go back",children:jsx(y,{name:"CaretLeft","data-testid":"back-arrow"})}),a||jsxs(Fragment,{children:[e&&jsx(xt,{size:"xs",children:e}),o&&!t&&jsx(S,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(y,{name:"X","data-testid":"close-button"})})]})]});var wa=createContext(false);function ir({children:e}){return jsx(wa.Provider,{value:true,children:e})}var Se=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:n=false,flex:i=false,stack:a,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:d,"data-testid":x})=>{let[v,m]=useState(l===0);if(useEffect(()=>{if(l>0){let V=setTimeout(()=>m(true),l);return ()=>clearTimeout(V)}},[l]),!v)return null;let f=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",h=c&&e?(()=>{let V=typeof e=="number"?e:parseFloat(String(e));return isNaN(V)?"":`animation-duration-[${Math.max(.8,V/100)}s]`})():"",R=r==="pulse"?`animate-pulse ${h}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${h}`:"",F="rounded-sm";t==="circle"&&(F="rounded-full"),t==="text"&&(F="h-4 w-full rounded-sm");let A=i?"flex-1 min-w-0":"",M=s?Object.entries(s).map(([V,k])=>`${V}:w-[${k}]`).join(" "):"";return a?jsx("div",{className:"space-y-2","data-testid":x,children:a.map((V,k)=>jsx("div",{className:twMerge(f,R,F,A,M,d),style:{width:V,height:o}},k))}):jsx("div",{className:twMerge(f,R,F,A,M,d),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":x})};var La={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},Ba="rounded-lg",so={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Ma={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function Da(e){return Pt__default.Children.toArray(e).some(o=>Pt__default.isValidElement(o)&&o.type===yt&&!!o.props.title)}function ke({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:n="default"}){let i=Da(t)?jsx(ir,{children:t}):t;return jsx("div",{className:twMerge("w-full overflow-hidden",La[e],Ba,n==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(Se,{width:"100%",height:"100%",className:"rounded-none"}):i})}function yt({title:e,subtitle:o,actions:t,leading:r,className:n,isLoading:i=false}){return i?jsxs("div",{className:twMerge("p-6 pb-4",n),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(Se,{width:120,height:20}),jsx(Se,{width:24,height:24})]}),o&&jsx(Se,{width:200,height:16})]}):!e&&!o&&!t&&!r?null:jsx("div",{className:twMerge("p-6 pb-4",n),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[r&&jsx("div",{className:"flex-shrink-0",children:r}),jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(xt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:Ko("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function dr({src:e,alt:o,aspectRatio:t="auto",className:r,children:n,isLoading:i=false}){return i?jsx("div",{className:twMerge("bg-background-muted",so[t],r),children:jsx(Se,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",so[t],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",so[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Mt({className:e,children:o,isLoading:t=false,fill:r=false,style:n}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsx("div",{className:twMerge(a,r&&"flex-1 flex flex-col min-h-0",e),style:n,children:jsxs("div",{className:"space-y-2",children:[jsx(Se,{width:"100%",height:16}),jsx(Se,{width:"80%",height:16}),jsx(Se,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge(a,"text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),style:n,children:o}):null}function cr({className:e,children:o,align:t="end",isLoading:r=false}){return r?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(Se,{width:80,height:32}),jsx(Se,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",Ma[t],e),children:o}):null}ke.Header=yt;ke.Media=dr;ke.Content=Mt;ke.Footer=cr;var vt=class extends Component{constructor(){super(...arguments);Xt(this,"state",{hasError:false});Xt(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,r){console.error("Error Boundary caught an error:",t,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(ke,{children:[this.props.title&&jsx(ke.Header,{title:this.props.title}),jsx(ke.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var Ha=.3,Oa=.5;function at({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:i=false,onBack:a,isOpen:s,onClose:l,isDismissable:c=true,transparentOverlay:u=false,primaryAction:d,secondaryAction:x,footerContent:v,maxHeight:m="80vh",height:f,maxWidth:h="640px",contentPadding:R=true,showHandle:F=true,animationVariant:A="scale",className:M}){let[V,k]=useState(false),[N,K]=useState(0),[I,le]=useState(false),H=nr(s),ge=H?.height??null,J=H?.keyboardOffset??0,Y=useRef(null),me=useRef(null),G=useRef(null),g=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let P=setTimeout(()=>{k(true),setTimeout(()=>k(false),600);},400);return ()=>clearTimeout(P)}},[s]),useEffect(()=>{s||(K(0),le(false),g.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let P=me.current;if(!P||!s)return;let Z=null,O=re=>{let L=re.target;L&&["INPUT","TEXTAREA","SELECT"].includes(L.tagName)&&(Z&&clearTimeout(Z),Z=setTimeout(()=>{L.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return P.addEventListener("focusin",O),()=>{P.removeEventListener("focusin",O),Z&&clearTimeout(Z);}},[s]);let Ve=useCallback(P=>{c&&(P.pointerType!=="touch"&&P.pointerType!=="pen"||(G.current&&(clearTimeout(G.current),G.current=null),g.current={isDragging:true,startY:P.clientY,startTime:Date.now(),pointerId:P.pointerId},le(false),P.currentTarget.setPointerCapture(P.pointerId)));},[c]),ye=useCallback(P=>{let{isDragging:Z,startY:O,pointerId:re}=g.current;if(!Z||P.pointerId!==re)return;let L=P.clientY-O;K(Math.max(0,L));},[]),ee=useCallback(P=>{let{isDragging:Z,startY:O,startTime:re,pointerId:L}=g.current;if(!Z||P.pointerId!==L)return;let j=P.clientY-O,Le=Date.now()-re,ue=j/Le;g.current={isDragging:false,startY:0,startTime:0,pointerId:null};let Be=(Y.current?.getBoundingClientRect().height??0)*Ha;(j>Be||ue>Oa&&j>50)&&c?(l?.(),K(0)):(le(true),K(0),G.current=setTimeout(()=>{le(false),G.current=null;},200));},[c,l]);if(!s)return null;let de=o||t,fe=d||x||v;return jsx(vt,{children:jsx(Ge,{isOpen:s,onOpenChange:P=>{P||l?.();},isDismissable:c,transparent:u,style:{paddingBottom:J>0?`${J}px`:void 0,transition:"padding-bottom 0.25s ease-out"},className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:c,children:jsx("div",{ref:Y,className:twMerge("w-full",I&&"transition-transform duration-200"),style:{transform:N>0?`translateY(${N}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",A==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",A==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",M),style:{maxWidth:h,...f?{height:f}:{maxHeight:/\d/.test(m)?ge!==null?`min(${m}, ${Math.max(ge-8,0)}px, 100dvh)`:`min(${m}, 100dvh)`:m}},children:[F&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:Ve,onPointerMove:ye,onPointerUp:ee,onPointerCancel:ee,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",V&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),de&&(i?jsx(rt,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!l,hasBackArrow:true,onBack:a??(()=>{}),onClose:l||(()=>{})}):jsx(rt,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!l,onClose:l||(()=>{})})),jsx("div",{ref:me,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",R?"p-4":"p-0"),children:e}),fe&&jsx(ao,{primaryAction:d,secondaryAction:x,footerContent:v})]})})})})})}at.displayName="Tray";var bo=createContext("md");function br(){return useContext(bo)}function mo(e="md"){let o=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${$[e].text} ${o}`}function Ka(){let e=Pt__default.useCallback((t,r)=>{r?.(t);},[]),o=Pt__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function xo({label:e,description:o,errorMessage:t,children:r,items:n,renderItem:i,renderSelectedValue:a,size:s="md",selectedKey:l,defaultSelectedKey:c,onSelectionChange:u,placeholder:d,showErrors:x=false,tooltip:v,isRequired:m,transparent:f,reserveErrorSpace:h=false,placement:R="bottom start",shouldFlip:F=true,menuWidth:A="match",descriptionPlacement:M="below",useMobileTray:V=true,...k}){let[N,K]=useState(null),[I,le]=useState(null),[H,ge]=useState(false),J=l??N??c,{handleFocus:Y,handleBlur:me}=Ka(),{isMobile:G}=Nt(),g=V&&G,Ve=Pt__default.useMemo(()=>!a||!J||!n?null:Array.from(n).find(Z=>Z.id===J)??null,[a,J,n]),ye=P=>{u&&P!==null&&u(P),u||K(P);},ee=useRef(null),de=useRef(null),fe=()=>{g&&ge(!H);};return jsxs(Fragment,{children:[jsx(Select,{...k,selectedKey:J,defaultSelectedKey:c,onSelectionChange:ye,placeholder:d,className:Q(k.className,"group flex w-full flex-col"),ref:ee,onOpenChange:P=>{g||(P&&de.current?le(de.current.offsetWidth):P||ee.current?.blur());},children:({isDisabled:P,isInvalid:Z,isOpen:O})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(q,{size:s,tooltip:v,description:M==="tooltip"||M==="inline"?o:void 0,descriptionPlacement:M,isRequired:m,children:e}),jsx(ie,{children:jsx("div",{ref:de,children:jsxs(S,{variant:"unstyled",className:twMerge(pe({isInvalid:Z||x&&!!t,isDisabled:P,isFocused:g?H:O,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:re=>Y(re,k.onFocus),onBlur:re=>me(re,k.onBlur),onPress:g?fe:void 0,"data-open":g?H:O,children:[a&&Ve?jsx("div",{className:mo(s),children:a(Ve)}):g&&J?jsx("div",{className:mo(s),children:n?Array.from(n).find(j=>j.id===J)?.label:String(J)}):jsx(SelectValue,{className:mo(s)}),jsx(y,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(g?H:O)&&"rotate-180")})]})})}),h?jsx("div",{className:"mt-1 min-h-[20px]",children:x?jsx(b,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&k.validationResult?t(k.validationResult):typeof t=="string"?t:null}):o&&M==="below"?jsx(T,{size:s,children:o}):null}):jsx(Fragment,{children:x?jsx(b,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&k.validationResult?t(k.validationResult):typeof t=="string"?t:null}):o&&M==="below"?jsx(T,{size:s,className:"mt-1",children:o}):null}),g?null:jsx(tt,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:A==="match"&&I?`${I}px`:void 0,minWidth:A==="auto"&&I?`${I}px`:void 0,maxWidth:A==="auto"?"min(600px, 90vw)":void 0},placement:R,shouldFlip:F,children:jsx(bo.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:i&&n?re=>jsx(He,{id:re.id,textValue:re.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:i(re)})},re.id):r})})})]})}),g&&jsx(at,{isOpen:H,onClose:()=>ge(false),title:e??"Select an option",contentPadding:false,children:jsx(bo.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:J!=null?[J]:[],onSelectionChange:P=>{let Z=Array.from(P)[0];Z!=null&&(ye(Z),ge(false));},children:i&&n?P=>jsx(He,{id:P.id,textValue:P.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:i(P)})},P.id):r})})})]})}function He({size:e,className:o,...t}){let r=br(),n=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",$[n].paddingY,$[n].text,o)})}var Ae=({className:e,size:o=24,color:t="text-action-brand"})=>jsx("div",{className:twMerge("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent",t,e),style:{width:o,height:o},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});var ii=[],si={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},li={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},yr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},yo=(e,o,t)=>{if(e==null||e==="")return "";let n=(t?t.flatMap(i=>i.items):o||[]).find(i=>i.id===e);return n?n.name:""};async function di(e,o,t){try{let r=e.url.replace("{q}",o),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,c])=>{n.append(l,c.toString());});let i=`${r}${n.toString()?"?"+n.toString():""}`,a=await fetch(i,{method:"GET",headers:e.headers,signal:t});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let s=await a.json();return {items:e.transformResponse(s)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in REST request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}async function ci(e,o,t){try{let r=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${o}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:r}),signal:t});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let i=await n.json();if(i.errors)throw new Error(i.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(i=e.responsePath.split(".").reduce((a,s)=>a?.[s],i)),{items:e.transformResponse(i)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}function vo({label:e,staticItems:o=ii,sections:t,selectedKey:r,defaultSelectedKey:n,onSelectionChange:i,requestConfig:a,defaultFilter:s,placeholder:l,errorMessage:c,description:u,size:d="md",tooltip:x,isRequired:v,isDisabled:m,isInvalid:f,validationResult:h,showErrors:R=true,renderItem:F,renderLeftIcon:A,renderSection:M,autoFocus:V=false,reserveErrorSpace:k=false,hideChevron:N=false,useMobileTray:K=true,className:I}){let le=Pt__default.useRef(null),H=Pt__default.useRef(null),[ge,J]=Pt__default.useState(),[Y,me]=useState(()=>yo(r||n,o,t)),[G,g]=useState(false),[Ve,ye]=useState(false),ee=Uo(Y),{contains:de}=useFilter({sensitivity:"base"}),[fe,P]=useState(),{isMobile:Z}=Nt(),O=K&&Z,re=$[d].text,L=useAsyncList({async load({signal:E,filterText:D=""}){if(!a)return {items:[]};if(!a.url||a.shouldLoad&&!a.shouldLoad(D))return {items:[]};try{let ae;return a.requestType==="GraphQL"?ae=await ci(a,D,E):ae=await di(a,D,E),P(ae.error),{items:ae.items}}catch(ae){return ae instanceof Error&&ae.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ae),P(ae instanceof Error?ae.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),j=a&&ee!==""?L:null,Le=false,ue=useRef("");useEffect(()=>{V&&g(true);},[V]),useEffect(()=>{let E=yo(r,o,t);E!==Y&&me(E);},[r,o,t]),useEffect(()=>{let E=()=>{le.current&&J(le.current.offsetWidth);};return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]),useEffect(()=>{ee===""?ue.current="":j&&ee!==ue.current&&(ue.current=ee,j.setFilterText(ee));},[ee,j]),Le=wt(!!j?.isLoading,300);let je=Pt__default.useMemo(()=>{if(!O||!Y)return j?j.items:o;let E=j?j.items:o,D=s??(a?()=>true:de);return E.filter(ae=>D(ae.name,Y))},[O,Y,j,o,s,de]),Be=E=>{let D=yo(E,o,t);me(D),i&&i(E);},Me=E=>{me(E);},ct=()=>{O&&ye(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:Be,selectedKey:r||void 0,defaultSelectedKey:n||void 0,items:j?j.items:t?t.flatMap(E=>E.items):o,className:Q(I,"group flex flex-col w-full"),menuTrigger:O?"manual":a?"input":"focus",allowsEmptyCollection:!!a,isDisabled:m,isInvalid:f||!!c,inputValue:Y,onInputChange:Me,autoFocus:V&&!O,defaultFilter:s??(a?()=>true:de),"aria-label":e||l||"Autocomplete",children:E=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(q,{size:d,tooltip:x,isRequired:v,children:e}),jsxs(ie,{ref:le,children:[A?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:A(Le)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ae,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:`${si[d]} text-text-secondary`})}),jsx(Input,{className:pe({isInvalid:f||!!c,isDisabled:m,isFocused:G||(O?Ve:E.isOpen),size:d,className:twMerge(li[d],Y&&!m||!N&&!Y?"pr-10":"pr-3",O&&"cursor-pointer",I)}),placeholder:l,disabled:m,onFocus:D=>{g(true),O&&(D.currentTarget.blur(),ct());},onBlur:()=>{g(false);},onClick:O?ct:void 0,readOnly:O,"aria-label":e||l||"Autocomplete"}),Y&&!m&&jsx(mt,{onClick:()=>{me(""),i?.(null);},size:d}),!N&&!Y&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:m,children:({isPressed:D})=>jsx(y,{name:D?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),k?jsx("div",{className:"mt-1 min-h-[20px]",children:R&&fe?jsx(b,{size:d,className:"text-feedback-error-text",children:fe}):R&&typeof c=="string"?jsx(b,{size:d,className:"text-feedback-error-text",children:c}):R&&typeof c=="function"&&h?jsx(b,{size:d,className:"text-feedback-error-text",children:c(h)}):u?jsx(T,{size:d,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(T,{size:d,className:"mt-1",children:u}),R&&fe&&jsx(b,{size:d,className:"text-feedback-error-text mt-1",children:fe}),R&&typeof c=="string"&&jsx(b,{size:d,className:"text-feedback-error-text mt-1",children:c}),R&&typeof c=="function"&&h&&jsx(b,{size:d,className:"text-feedback-error-text mt-1",children:c(h)})]}),!O&&jsx(tt,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:ge?`${ge}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||l||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${re}`,children:t?t.map(D=>{let ae=D.items.map(ve=>jsx(He,{id:ve.id,textValue:ve.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${yr[d]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:F?F(ve):ve.name},ve.id));if(M){let ve=M(D,ae);return Pt__default.isValidElement(ve)&&ve.type===ListBoxSection?ve:jsx(ListBoxSection,{children:ve},D.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:D.name}),ae]},D.name)}):D=>jsx(He,{id:D.id,textValue:D.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${yr[d]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:F?F(D):D.name},D.id)})})]})}),O&&jsx(at,{isOpen:Ve,onClose:()=>ye(false),title:e??l??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(ie,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ae,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:H,type:"text",value:Y,onChange:E=>Me(E.target.value),placeholder:l,autoFocus:true,className:pe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),Y&&jsx(mt,{onClick:()=>{me(""),i?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||l||"Suggestions",items:je,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:E=>{let D=Array.from(E)[0];D&&(Be(D),ye(false));},className:"bg-background-input outline-none",children:E=>jsx(He,{id:E.id,textValue:E.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:F?F(E):E.name},E.id)})})]})})]})}function _(e,o){let t=o.split("."),r=e;for(let i of t)if(r&&typeof r=="object"&&i in r)r=r[i];else {r=void 0;break}let n=r?.message;return typeof n=="string"?n:void 0}function kp({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(vo,{...t,selectedKey:a.value??null,onSelectionChange:s=>a.onChange(s),showErrors:!!i,errorMessage:i})})}var hi="focus:ring-action-primary",yi="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function Rr(e){return jsxs(CheckboxGroup,{...e,className:Q(e.className,"flex flex-col gap-2"),children:[jsx(q,{children:e.label}),e.children,e.description&&jsx(T,{children:e.description}),jsx(b,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function vi({isDisabled:e}){return `relative flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function Pi({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",i=hi,a="";return t?a="border-border-muted bg-background-muted":o?a="border-feedback-error-border bg-feedback-error-background":e||r?a=yi:a="bg-background-input border-border-input hover:border-border-focus",`${n} ${i} ${a}`}var Cr="w-4 h-4 text-current group-disabled:text-text-disabled";function Po({className:e,...o}){return jsx("div",{"aria-hidden":"true",className:`${Pi(o)} ${e||""}`,children:o.isIndeterminate?jsx(Minus,{"aria-hidden":true,className:Cr}):o.isSelected?jsx(Check,{"aria-hidden":true,className:Cr}):null})}function Fr(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(n,i)=>`${vi(i)} ${n||""}`),children:n=>{let{isSelected:i,isIndeterminate:a,isDisabled:s,isInvalid:l}=n;return jsxs(Fragment,{children:[jsx(Po,{isSelected:i,isIndeterminate:a,isDisabled:s,isInvalid:l}),typeof o=="function"?o(n):o]})}})}function Gp({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:n,formState:i}=useFormContext(),a=_(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Fr,{...r,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!a,children:r.children}),t&&a&&jsx(b,{children:a})]})})}function jp({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Rr,{...t,value:a.value||[],onChange:s=>a.onChange(s),errorMessage:i,children:t.children})})}function it(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function Fo(e){if(!e)return "";let o=e.startsWith("#")?e.slice(1):e;return o.length===3&&(o=o.split("").map(t=>t+t).join("")),`#${o.toUpperCase()}`}function Nr({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,transparent:a,className:s,validationResult:l,value:c,defaultValue:u,onChange:d,placeholder:x="#000000",showColorSwatch:v=true,reserveErrorSpace:m=true,...f}){let[h,R]=useState(u||""),[F,A]=useState(c||u||""),[M,V]=useState(false),[k,N]=useState(null),{isFocused:K,handleFocus:I,handleBlur:le}=we(),H=c!==void 0?c:h;useEffect(()=>{c!==void 0&&A(c);},[c]);let ge=H?!it(H):false,J=useCallback(G=>{if(A(G),it(G)){let g=Fo(G);d?d(g):R(g);}else G===""&&(d?d(""):R(""));},[d]),Y=useCallback(G=>{let g=Fo(G);A(g),d?d(g):R(g);},[d]),me=useCallback(G=>{if(it(F)){let g=Fo(F);A(g),d&&g!==H?d(g):!d&&g!==h&&R(g);}le(G,f.onBlur);},[F,H,h,d,le,f.onBlur]);return jsx(TextField,{...f,isRequired:i,className:Q(s,"group flex flex-col"),children:({isDisabled:G})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(q,{size:r,tooltip:n,isRequired:i,children:e}),jsx(ie,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(Bt,{size:r,disabled:G,type:"text",value:F,placeholder:x,onFocus:g=>I(g,f.onFocus),onBlur:me,onChange:g=>J(g.target.value),className:twMerge(pe({isInvalid:ge,isDisabled:G,isFocused:K,size:r,transparent:a}),v?"pr-12":"pr-3","pl-3")}),v&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:$[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",it(H)?"border-border-default":"border-border-default bg-background-muted"),style:it(H)?{backgroundColor:H}:void 0,"aria-hidden":"true",children:!it(H)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:N,children:jsx(S,{variant:"secondary",size:r,icon:"Palette",onPress:()=>V(!M),isDisabled:G,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:r,children:t}):typeof t=="function"&&l?jsx(b,{size:r,children:t(l)}):o?jsx(T,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(b,{size:r,className:"mt-1",children:t(l)}):o?jsx(T,{size:r,className:"mt-1",children:o}):null}),M&&k&&jsx(tt,{triggerRef:{current:k},isOpen:M,onOpenChange:V,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:H||"#000000",onChange:Y,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:H||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:H||"#000000"})]})]})})]})})}function mm({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Nr,{...t,value:a.value??"",onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i})})}function Gi({isSelected:e,isDisabled:o}){let t=[$e,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return o?t.push("text-text-disabled forced-colors:text-[GrayText]"):e?t.push("bg-action-default text-text-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function ko({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(Ir,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Er,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:n})=>`${Gi({isSelected:r,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Ir(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(S,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(y,{name:"CaretRight","aria-hidden":true,size:o}):jsx(y,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(S,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(y,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(y,{name:"CaretRight","aria-hidden":true,size:o})})]})}function Er(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function No({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,isDisabled:a,isInvalid:s,showCalendar:l=true,reserveErrorSpace:c=true,validationResult:u,className:d,...x}){let[v,m]=useState(false),f=h=>{x.onChange&&h&&x.onChange(h),m(false);};return jsxs(DateField,{...x,isDisabled:a,isRequired:i,isInvalid:s,className:Q(d,"flex flex-col gap-1"),children:[e&&jsx(q,{size:r,tooltip:n,isRequired:i,children:e}),jsx(ie,{children:jsxs("div",{className:"relative w-full",children:[jsx(Lr,{size:r,isDisabled:a,isInvalid:s,hasCalendar:l}),l&&!a&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:m,children:[jsx(S,{variant:"unstyled",className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-8 w-8 items-center justify-center rounded hover:bg-background-hover text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(y,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(ko,{value:x.value,onChange:f,minValue:x.minValue,maxValue:x.maxValue,isDisabled:a,isReadOnly:x.isReadOnly,isDateUnavailable:x.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:r,children:t}):typeof t=="function"&&u?jsx(b,{size:r,children:t(u)}):o?jsx(T,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(b,{size:r,className:"mt-1",children:t(u)}):o?jsx(T,{size:r,className:"mt-1",children:o}):null})]})}function Xi({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function Lr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:n,...i}){return jsx(DateInput,{className:twMerge(ft({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",n),...i,children:a=>jsx(DateSegment,{segment:a,className:Xi({isPlaceholder:a.isPlaceholder,isDisabled:!a.isEditable||o,size:e})})})}function Um({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(No,{...t,value:a.value??null,onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i})})}function wo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:n,isDisabled:i=false,onUpload:a,className:s,showPreview:l=true,placeholder:c="Drop files here or click to browse"}){let[u,d]=useState(false),[x,v]=useState(false),[m,f]=useState(null),[h,R]=useState(e),F=useRef(null),A=async k=>{if(f(null),n&&k.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(l&&k.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{R(N.result);},N.readAsDataURL(k);}if(a){v(true);try{let N=await a(k);R(N),t?.(N);}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{v(false);}}o?.(k,h);},M=async k=>{try{let N=k.items;if(N.length>0){let K=N[0];if(K.kind==="file"){let I=await K.getFile();I&&A(I);}}}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{d(false);}},V=()=>{R(void 0),f(null),o?.(null),t?.(""),F.current&&(F.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",u?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",i&&"pointer-events-none opacity-50",m&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:M,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[h?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&(h.startsWith("data:image")||h.startsWith("http"))?jsx("img",{src:h,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!i&&jsx(S,{variant:"icon",size:"sm",onPress:V,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:c}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsx(FileTrigger,{acceptedFileTypes:r.split(","),onSelect:k=>{let N=Array.from(k||[]);N.length>0&&A(N[0]);},children:jsx(S,{variant:"secondary",size:"sm",isDisabled:i,children:"Choose File"})})]}),x&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),m&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function df({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:n,formState:i}=useFormContext(),a=_(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(wo,{...r,value:s.value??"",onChange:(l,c)=>s.onChange(c||"")}),t&&a&&jsx(b,{children:a})]})})}var us={primary:"bg-action-primary/10 text-action-primary border border-action-primary/20 hover:bg-action-primary/15",secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border border-border-muted hover:bg-action-secondary-hover",info:"bg-feedback-info-background text-feedback-info-text border border-feedback-info-border hover:bg-feedback-info-background/80"};function Dr(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var ps={xs:"px-1.5 py-[2px] gap-0.5",sm:"px-2 py-1 gap-1",md:"px-3 py-1.5 gap-1.5",lg:"px-3 py-2 gap-2",xl:"px-4 py-2.5 gap-2"},ms="opacity-75 cursor-not-allowed pointer-events-none";function Ar(e){let{variant:o,size:t,isDisabled:r,isClickable:n,className:i}=e,a=t==="xs"?"text-xs":$[t].text;return twMerge("inline-flex items-center justify-center rounded-full font-medium transition-colors","whitespace-nowrap select-none",ps[t],a,us[o],n&&!r&&"cursor-pointer",r&&ms,i)}function _r({children:e,onRemove:o,removeLabel:t="Remove",size:r="md",variant:n="secondary",isRemovable:i=true,isDisabled:a=false,className:s,onClick:l}){let c=!!l&&!a,u=i&&o&&!a,d=h=>{h.stopPropagation(),h.preventDefault(),o&&!a&&o();},x=()=>{l&&!a&&l();},v=r==="xs"?10:r==="sm"?12:r==="md"?14:16,f=jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e}),u?c?jsx("span",{onClick:d,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d(h));},role:"button",tabIndex:0,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":t,title:t,children:jsx(y,{name:"X",size:v,className:"text-current opacity-70 hover:opacity-100"})}):jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 rounded-full p-0.5 hover:bg-text-primary/10 transition-colors cursor-pointer","aria-label":t,title:t,tabIndex:-1,children:jsx(y,{name:"X",size:v,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:x,className:Ar({variant:Dr(n),size:r,isDisabled:a,isClickable:c,className:s}),disabled:a,children:f}):jsx("span",{className:Ar({variant:Dr(n),size:r,isDisabled:a,isClickable:c,className:s}),children:f})}var bs=(e,o)=>e.toLocaleLowerCase().includes(o.toLocaleLowerCase());function xs(e){return [e.value,e.label]}function zr(e,o,t=bs){let r=o.trim();return r===""?[...e]:e.filter(n=>xs(n).some(i=>t(i,r)))}function Hr(e){let o=e.query.trim();if(o==="")return false;let t=o.toLocaleLowerCase();return e.options.some(n=>n.value.toLocaleLowerCase()===t||n.label.toLocaleLowerCase()===t)?false:!e.selected.some(n=>n.toLocaleLowerCase()===t)}function Or(e,o){return e.map(t=>{let r=o.find(n=>n.value===t);return r?r.count===void 0?{value:t,label:r.label,isUnknown:false}:{value:t,label:r.label,count:r.count,isUnknown:false}:{value:t,label:t,isUnknown:true}})}var Ps=e=>e.kind==="literal"?`literal:${e.value}`:`option:${e.option.value}`,Eo=e=>e.kind==="literal"?e.value:e.option.value,$r=e=>e.kind==="literal"?e.value:e.option.label,Cs={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},Rs={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Fs={sm:"xs",md:"xs",lg:"sm",xl:"sm"};function Vo({options:e,value:o,defaultValue:t,onChange:r,label:n,placeholder:i,size:a="md",loading:s=false,disabled:l=false,maxSelected:c,allowLiteral:u=false,onSearchChange:d,truncated:x=false,totalCount:v,emptyMessage:m,showSelectAll:f=false,description:h,errorMessage:R,isRequired:F=false,onBlur:A,inputRef:M,className:V,id:k}){let N=useId(),K=k??`multiselect-${N}`,I=`${K}-input`,le=`${K}-listbox`,H=useRef(null),ge=useCallback(p=>{H.current=p,typeof M=="function"?M(p):M&&(M.current=p);},[M]),{contains:J}=useFilter({sensitivity:"base"}),{isFocused:Y,handleFocus:me,handleBlur:G}=we(),[g,Ve]=useState(""),[ye,ee]=useState(true),[de,fe]=useState(null),[P,Z]=useState(""),[O,re]=useState(()=>[...t??[]]),L=useMemo(()=>o?[...o]:O,[o,O]),j=useMemo(()=>zr(e,g,J),[e,g,J]),Le=u&&!s&&Hr({query:g,options:e,selected:L}),ue=useMemo(()=>{let p=j.map(te=>({kind:"option",option:te}));return Le?[{kind:"literal",value:g.trim()},...p]:p},[j,Le,g]),je=useMemo(()=>Or(L,e),[L,e]),Be=c!==void 0&&L.length>=c,Me=useCallback((p,te)=>{o||re(p),Z(`${te} ${p.length} selected.`),r(p);},[r,o]),ct=useCallback((p,te)=>{if(!l){if(L.includes(p)){Me(L.filter(_e=>_e!==p),`${te} removed.`);return}Be||Me([...L,p],`${te} selected.`);}},[Be,Me,l,L]),E=useCallback(p=>{p.kind==="option"&&p.option.disabled||ct(Eo(p),$r(p));},[ct]),D=p=>{if(l||p.length===0)return;let te=new Set(p),_e=p.map(De=>je.find(Qt=>Qt.value===De)?.label??De);Me(L.filter(De=>!te.has(De)),`${_e.join(", ")} removed.`);},ae=p=>{Ve(p),fe(null),ee(true),d?.(p);},ve=p=>{if(ue.length===0){fe(null);return}fe(te=>te===null?p>0?0:ue.length-1:(te+p+ue.length)%ue.length);},sn=p=>{if(l)return;let te=de===null?void 0:ue[de];switch(p.key){case "ArrowDown":p.preventDefault(),ee(true),ve(1);break;case "ArrowUp":p.preventDefault(),ee(true),ve(-1);break;case "Home":ue.length>0&&(p.preventDefault(),ee(true),fe(0));break;case "End":ue.length>0&&(p.preventDefault(),ee(true),fe(ue.length-1));break;case "Enter":te&&(p.preventDefault(),E(te));break;case " ":g===""&&te&&(p.preventDefault(),E(te));break;case "Escape":p.preventDefault(),g!==""?ae(""):(ee(false),fe(null));break;case "Backspace":g===""&&L.length>0&&(p.preventDefault(),D([L[L.length-1]]));break;}},Qe=j.filter(p=>!p.disabled&&!L.includes(p.value)).map(p=>p.value),ln=c===void 0?Qe.length:Math.max(0,c-L.length),ut=Math.min(Qe.length,ln),dn=ut===Qe.length?`Select all ${Qe.length} matching`:`Select ${ut} of ${Qe.length} matching`,cn=()=>{if(l||ut===0)return;let p=Qe.slice(0,ut);Me([...L,...p],`${p.length} matching options selected.`);},jt=s?"loading":e.length===0?"empty":j.length===0&&g.trim()!==""?"no-match":null,un=$[a].text;return jsxs("div",{className:twMerge("flex w-full flex-col gap-1",V),"data-testid":"multiselect",children:[jsx(q,{size:a,htmlFor:I,isRequired:F,children:n}),jsxs(ie,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 z-10 flex -translate-y-1/2 items-center",children:s?jsx(Ae,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:twMerge(Cs[a],"text-text-secondary")})}),jsx("input",{ref:ge,id:I,type:"text",role:"combobox",autoComplete:"off","aria-expanded":ye,"aria-controls":le,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-activedescendant":ye&&de!==null&&ue[de]?`${K}-row-${de}`:void 0,"aria-required":F||void 0,"aria-invalid":R?true:void 0,value:g,placeholder:i,disabled:l,onChange:p=>ae(p.target.value),onKeyDown:sn,onFocus:p=>{ee(true),me(p);},onBlur:p=>{G(p),A?.(p);},className:pe({isDisabled:l,isFocused:Y,isInvalid:!!R,size:a,className:twMerge(Rs[a],"pr-3")})})]}),je.length>0&&jsx("div",{"data-testid":"multiselect-selection-region",role:"group","aria-label":`Selected ${n}`,className:"flex flex-wrap gap-1.5 rounded-[var(--control-border-radius)] border border-border-default bg-background-muted p-2",children:je.map(p=>jsx(_r,{size:Fs[a],variant:"primary",isDisabled:l,removeLabel:`Remove ${p.label}`,onRemove:()=>D([p.value]),className:"shrink-0",children:p.isUnknown?jsx("span",{"data-testid":`multiselect-selection-unknown-${p.value}`,title:"Not in the current option list",children:`${p.label} (custom)`}):p.label},p.value))}),f&&jsxs("div",{className:"flex items-center gap-2",children:[jsx(S,{variant:"link",size:a,onPress:cn,isDisabled:l||ut===0,children:dn}),jsx(S,{variant:"link",size:a,onPress:()=>D(L),isDisabled:l||L.length===0,children:"Clear all"})]}),jsx("div",{id:le,role:"listbox","aria-multiselectable":"true","aria-label":`${n} options`,hidden:!ye,className:twMerge(un,"max-h-[260px] overflow-y-auto rounded-[var(--control-border-radius)] border border-border-input bg-background-input"),children:ye&&ue.map((p,te)=>{let _e=L.includes(Eo(p)),De=l||p.kind==="option"&&p.option.disabled===true||!_e&&Be;return jsxs("div",{id:`${K}-row-${te}`,role:"option","aria-selected":_e,"aria-disabled":De||void 0,"data-value":Eo(p),"data-literal":p.kind==="literal"?"true":void 0,"data-active":de===te?"true":void 0,onMouseDown:Qt=>Qt.preventDefault(),onClick:()=>{De||(E(p),H.current?.focus());},className:twMerge("flex cursor-default items-center gap-2 px-3",$[a].paddingY,"text-text-primary",de===te&&"bg-background-hover",_e&&"bg-background-selected font-medium",De&&"text-text-disabled"),children:[jsx(Po,{isSelected:_e,isDisabled:De,className:"!w-4 !h-4"}),jsx("span",{className:"flex-1 truncate",children:$r(p)}),p.kind==="literal"&&jsx("span",{"data-testid":"multiselect-literal-badge",className:"italic text-text-secondary",children:"Use as typed"}),p.kind==="option"&&p.option.count!==void 0&&jsx("span",{"data-testid":`multiselect-count-${p.option.value}`,className:"text-text-secondary",children:p.option.count.toLocaleString()})]},Ps(p))})}),jt==="loading"&&jsx("div",{"data-testid":"multiselect-status-loading","data-status":"loading",children:jsxs(T,{size:a,className:"flex items-center gap-2",children:[jsx(Ae,{size:14,color:"text-text-secondary"}),jsx("span",{children:"Loading options\u2026"})]})}),jt==="empty"&&jsx("div",{"data-testid":"multiselect-status-empty","data-status":"empty",children:jsxs(T,{size:a,className:"flex items-center gap-2",children:[jsx(y,{name:"Tray",className:"h-4 w-4"}),jsx("span",{children:m??"No options available"})]})}),jt==="no-match"&&jsx("div",{"data-testid":"multiselect-status-no-match","data-status":"no-match",children:jsxs(T,{size:a,className:"flex items-center gap-2 text-feedback-warning-text",children:[jsx(y,{name:"MagnifyingGlass",className:"h-4 w-4"}),jsx("span",{children:`No options match \u201C${g.trim()}\u201D`})]})}),x&&jsx("div",{"data-testid":"multiselect-truncation",children:jsx(T,{size:a,children:v===void 0?"Showing a partial list \u2014 refine your search to see more":`Showing ${e.length} of ${v} \u2014 refine your search to see more`})}),c!==void 0&&jsx("div",{"data-testid":"multiselect-limit",children:jsx(T,{size:a,children:Be?`${L.length} of ${c} selected \u2014 limit reached, remove one to choose another`:`${L.length} of ${c} selected`})}),h&&jsx(T,{size:a,children:h}),R&&jsx(b,{size:a,children:R}),jsx("div",{"data-testid":"multiselect-live-region",role:"status","aria-live":"polite",className:"sr-only",children:P})]})}function zf({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Vo,{...t,value:a.value??[],onChange:s=>a.onChange(s),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},inputRef:a.ref,errorMessage:i})})}var Vs=e=>{let o=pe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function Bo({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,transparent:a,validationResult:s,reserveErrorSpace:l=true,descriptionPlacement:c="below",...u}){let d=useId(),{isFocused:x,handleFocus:v,handleBlur:m}=we();return jsx(NumberField,{...u,id:d,isRequired:i,className:Q(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:f=>{typeof f=="number"&&(u.maxValue!=null&&f>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&f<u.minValue?u.onChange?.(u.minValue):u.onChange?.(f));},isInvalid:!!t||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:f,isInvalid:h})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(q,{size:r,tooltip:n,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:i,htmlFor:d,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:F=>v(F,u.onFocus),onBlur:F=>m(F,u.onBlur),className:Vs({isInvalid:h||!!t,isDisabled:f,isFocused:x,transparent:a,size:r,className:typeof u.className=="string"?u.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(y,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:f,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(y,{name:"CaretDown",size:14})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(b,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(T,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(b,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(T,{size:r,className:"mt-1",children:o}):null})]})})}function ng({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Bo,{...t,value:typeof a.value=="number"?a.value:void 0,onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i,isRequired:t.isRequired})})}function Do({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:i,className:a,children:s,size:l="2",variant:c="primary",columns:u="repeat(auto-fit, minmax(160px, 1fr))",gap:d="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:i,className:Q(a,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(u))?`repeat(${u}, minmax(0, 1fr))`:u,gap:d==="1"?"0.25rem":d==="2"?"0.5rem":d==="3"?"0.75rem":d==="4"?"1rem":typeof d=="number"?`${d}px`:d},children:Pt__default.Children.map(s,x=>Pt__default.isValidElement(x)?Pt__default.cloneElement(x,{size:l,variant:c}):x)})}function Cg({name:e,defaultValue:o,label:t,description:r,children:n,...i}){let{control:a,formState:s}=useFormContext(),l=_(s.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:o,render:({field:c})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx(q,{children:t}),r&&jsx(T,{children:r}),jsx(Do,{...i,value:c.value,onChange:u=>c.onChange(u),children:n}),l&&jsx(b,{children:l})]})})}function Gs(e){return "primary"}var Ws=createContext({variant:"primary"});function Ao(e){let{variant:o="primary",...t}=e,r=Gs();return jsx(Ws.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:Q(e.className,"group flex flex-col gap-2"),children:[jsx(q,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(T,{children:e.description}),jsx(b,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function Gg({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Ao,{...t,value:a.value,onChange:s=>a.onChange(s),errorMessage:i,children:t.children})})}var Xs=e=>{let o=pe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function Tt({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,transparent:a,showSearchIcon:s,isClearable:l,onClear:c,type:u,validationResult:d,reserveErrorSpace:x=true,isLoading:v=false,descriptionPlacement:m="below",...f}){let[h,R]=Pt__default.useState(false),{isFocused:F,handleFocus:A,handleBlur:M}=we(),V=u==="password",k=wt(v,300);return jsx(TextField,{...f,isRequired:i,className:Q(f.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:K})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(q,{size:r,tooltip:n,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:i,children:e}),jsxs(ie,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let I={sm:14,md:16,lg:18,xl:20}[r];return k?jsx(Ae,{size:I,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",size:I,className:`transition-colors ${F?"text-action-brand":"text-text-secondary"}`})})()}),jsx(Bt,{size:r,disabled:N,type:V?h?"text":"password":u,name:f.name,autoComplete:f.autoComplete,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:I=>A(I,f.onFocus),onBlur:I=>M(I,f.onBlur),onChange:I=>f.onChange?.(I.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[r]}:void 0,className:Xs({isInvalid:K,isDisabled:N,isFocused:F,size:r,transparent:a,showSearchIcon:s,isClearable:l,hasValue:!!f.value,isPassword:V,className:typeof f.className=="string"?f.className:void 0})}),l&&f.value&&!N&&jsx(mt,{onClick:()=>{c?c():f.onChange&&f.onChange("");},size:r}),V&&!N&&jsx("button",{type:"button",onClick:()=>R(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":h?"Hide password":"Show password",onMouseDown:I=>{I.preventDefault(),I.stopPropagation();},children:jsx(y,{name:h?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:r,children:t}):typeof t=="function"&&d?jsx(b,{size:r,children:t(d)}):o&&m==="below"?jsx(T,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(b,{size:r,className:"mt-1",children:t(d)}):o&&m==="below"?jsx(T,{size:r,className:"mt-1",children:o}):null})]})})}var sl={sm:{toolbar:"p-1.5",contentWrapper:"min-h-[100px]",contentPadding:"p-3",placeholderPos:"left-3 top-3",prose:"prose-xs",h1:"[&_.ProseMirror_h1]:mb-2 [&_.ProseMirror_h1]:text-base [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-1.5 [&_.ProseMirror_h2]:text-sm [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-1",list:"[&_.ProseMirror_ul]:mb-1 [&_.ProseMirror_ul]:ml-4 [&_.ProseMirror_ol]:mb-1 [&_.ProseMirror_ol]:ml-4",li:"[&_.ProseMirror_li]:mb-0.5",placeholderText:"text-xs"},md:{toolbar:"p-2",contentWrapper:"min-h-[200px]",contentPadding:"p-4",placeholderPos:"left-4 top-4",prose:"prose-sm",h1:"[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-2",list:"[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6",li:"[&_.ProseMirror_li]:mb-1",placeholderText:"text-sm"},lg:{toolbar:"p-2.5",contentWrapper:"min-h-[250px]",contentPadding:"p-5",placeholderPos:"left-5 top-5",prose:"prose-base",h1:"[&_.ProseMirror_h1]:mb-5 [&_.ProseMirror_h1]:text-3xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-4 [&_.ProseMirror_h2]:text-2xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-3",list:"[&_.ProseMirror_ul]:mb-3 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ol]:mb-3 [&_.ProseMirror_ol]:ml-6",li:"[&_.ProseMirror_li]:mb-1.5",placeholderText:"text-base"},xl:{toolbar:"p-3",contentWrapper:"min-h-[300px]",contentPadding:"p-6",placeholderPos:"left-6 top-6",prose:"prose-lg",h1:"[&_.ProseMirror_h1]:mb-6 [&_.ProseMirror_h1]:text-4xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-5 [&_.ProseMirror_h2]:text-3xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-3",list:"[&_.ProseMirror_ul]:mb-3 [&_.ProseMirror_ul]:ml-8 [&_.ProseMirror_ol]:mb-3 [&_.ProseMirror_ol]:ml-8",li:"[&_.ProseMirror_li]:mb-2",placeholderText:"text-lg"}},lt=({isActive:e=false,onPress:o,children:t})=>jsx(S,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function ll({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[n,i]=useState(e);return Pt__default.useEffect(()=>{i(e);},[e]),jsx(Ge,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsx(Modal,{className:"flex items-center justify-center p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsx(Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxs("form",{onSubmit:s=>{s.preventDefault(),r(n),t();},children:[jsx(rt,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(Tt,{label:"URL",type:"url",value:n,onChange:i,autoFocus:true,className:"w-full"})}),jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsx(S,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(S,{type:"submit",children:"Save"})]})]})})})})}function _o({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:n="Start typing...",id:i,size:a="md",headingLevels:s=[1,2]}){let l=sl[a],[c,u]=useState(false),d=useEditor({immediatelyRender:false,extensions:[rl.configure({heading:s.length>0?{levels:s}:false}),Zs.configure({openOnClick:false,HTMLAttributes:{class:"text-text-link-default hover:text-text-link-hover underline decoration-text-link-default/30 hover:decoration-text-link-hover cursor-pointer"}})],content:e,editable:!r,onUpdate:({editor:m})=>{o?.(m.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${l.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),x=()=>{u(true);},v=m=>{m===""?d?.chain().focus().unsetLink().run():d?.chain().focus().setLink({href:m}).run();};return d?jsxs("div",{id:i,"data-richtexteditor":true,className:twMerge("flex flex-col rounded-md border border-border-input bg-background-input","outline-none focus-within:outline-none focus-within:border-border-input focus-within:ring-0 focus-within:shadow-none",r&&"opacity-50",t),style:{outline:"none"},children:[!r&&d&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:d,shouldShow:({editor:m})=>m.isActive("link")&&!c,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let m=d.getAttributes("link").href;m&&window.open(m,"_blank","noopener,noreferrer");},children:[jsx(y,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:x,children:[jsx(y,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>d.chain().focus().unsetLink().run(),children:[jsx(y,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(ll,{isOpen:c,onClose:()=>u(false),onSubmit:v,initialUrl:d.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",l.toolbar),children:[s.map(m=>jsx(lt,{isActive:d.isActive("heading",{level:m}),onPress:()=>d.chain().focus().toggleHeading({level:m}).run(),children:jsxs("span",{className:"text-xs font-bold",children:["H",m]})},m)),jsx(lt,{isActive:d.isActive("bold"),onPress:()=>d.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(lt,{isActive:d.isActive("italic"),onPress:()=>d.chain().focus().toggleItalic().run(),children:jsx("span",{className:"text-xs italic",children:"I"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(lt,{isActive:d.isActive("bulletList"),onPress:()=>d.chain().focus().toggleBulletList().run(),children:jsx(y,{name:"ListBullets",className:"h-4 w-4"})}),jsx(lt,{isActive:d.isActive("orderedList"),onPress:()=>d.chain().focus().toggleOrderedList().run(),children:jsx(y,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(lt,{isActive:d.isActive("link"),onPress:x,children:jsx(y,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:twMerge("relative w-full outline-none focus:outline-none",l.contentWrapper),children:[jsx(EditorContent,{editor:d,className:twMerge("w-full outline-none focus:outline-none",l.contentPadding,"[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none",l.h1,l.h2,l.p,"[&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:list-decimal",l.list,l.li,"[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:border-border-muted [&_.ProseMirror_blockquote]:pl-4 [&_.ProseMirror_blockquote]:italic","[&_.ProseMirror_code]:rounded [&_.ProseMirror_code]:bg-background-muted [&_.ProseMirror_code]:px-1 [&_.ProseMirror_code]:py-0.5 [&_.ProseMirror_code]:font-mono [&_.ProseMirror_code]:text-sm","[&_.ProseMirror_pre]:rounded-md [&_.ProseMirror_pre]:bg-background-muted [&_.ProseMirror_pre]:p-3 [&_.ProseMirror_pre]:font-mono [&_.ProseMirror_pre]:text-sm","[&_.ProseMirror_hr]:border-border-muted",r&&"pointer-events-none")}),d.isEmpty&&!r&&jsx("div",{className:twMerge("pointer-events-none absolute text-text-secondary",l.placeholderPos,l.placeholderText),children:n})]})]}):null}function Fb({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:n=true,...i}){let{control:a,formState:s}=useFormContext(),l=_(s.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:o,render:({field:c})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-primary",children:t}),r&&jsx("p",{className:"text-sm text-text-secondary",children:r}),jsx(_o,{...i,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),l&&jsx("p",{className:"text-sm text-feedback-error-text",children:l}),n&&!l&&jsx("div",{className:"h-5"})]})})}function Vb({name:e,defaultValue:o,onValueChange:t,...r}){let{control:n,formState:i}=useFormContext(),a=_(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsx(xo,{...r,selectedKey:s.value??null,onSelectionChange:l=>{s.onChange(l),t?.(l);},showErrors:!!a,errorMessage:a})})}var Ho={sm:{track:"h-4 w-7",handle:"h-3.5 w-3.5",text:"text-xs"},md:{track:"h-5 w-9",handle:"h-4 w-4",text:"text-sm"},lg:{track:"h-6 w-11",handle:"h-5 w-5",text:"text-base"},xl:{track:"h-7 w-14",handle:"h-6 w-6",text:"text-lg"}};function bl({isSelected:e,isDisabled:o,size:t="md"}){let r="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=Ho[t].track,i=$e,a="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[r,n,i,a,s,o?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function xl({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",n=Ho[t].handle;return [r,n,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Oo({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:Q(r.className,`relative group flex items-center gap-2 ${Ho[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:bl({...n,size:t}),children:jsx("span",{className:xl({...n,size:t})})}),e]})})}function Wb({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:n})=>jsx(Oo,{...t,isSelected:!!n.value,onChange:i=>n.onChange(i),children:t.children})})}var Rl=e=>{let o=pe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=`min-h-[100px] py-2 ${e.isDisabled?"resize-none":e.isResizable?"resize-y":"resize-none"}`;return twMerge(o,t,e.className)};function $o({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,required:i,transparent:a,isInvalid:s,isDisabled:l,isResizable:c=false,className:u,validationResult:d,reserveErrorSpace:x=true,...v}){let{isFocused:m,handleFocus:f,handleBlur:h}=we();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(q,{size:r,tooltip:n,isRequired:i,children:e}),jsx(ie,{children:jsx("textarea",{...v,required:i,onFocus:R=>{v.onFocus&&v.onFocus(R),f(R);},onBlur:R=>{v.onBlur&&v.onBlur(R),h(R);},className:Rl({isInvalid:s,isDisabled:l,isResizable:c,isFocused:m,size:r,transparent:a,className:u}),disabled:l})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:r,children:t}):typeof t=="function"&&d?jsx(b,{size:r,children:t(d)}):o?jsx(T,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(b,{size:r,className:"mt-1",children:t(d)}):o?jsx(T,{size:r,className:"mt-1",children:o}):null})]})})}function rx({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx($o,{...t,value:a.value??"",onChange:s=>a.onChange(s.target.value),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},isInvalid:!!i,errorMessage:i,required:t.required})})}function dx({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Tt,{...t,value:a.value??"",onChange:s=>a.onChange(s),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},isInvalid:!!i,errorMessage:i,isRequired:t.isRequired})})}function Ll({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function Go({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,isDisabled:a,isInvalid:s,reserveErrorSpace:l=true,validationResult:c,className:u,descriptionPlacement:d="below",...x}){return jsxs(TimeField,{...x,isDisabled:a,isRequired:i,isInvalid:s,className:Q(u,"flex flex-col gap-1"),children:[e&&jsx(q,{size:r,tooltip:n,description:d==="tooltip"||d==="inline"?o:void 0,descriptionPlacement:d,isRequired:i,children:e}),jsx(ie,{children:jsx(DateInput,{className:twMerge(ft({isInvalid:s,isDisabled:a}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:Ll({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||a,size:r})})})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:r,children:t}):typeof t=="function"&&c?jsx(b,{size:r,children:t(c)}):o&&d==="below"?jsx(T,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(b,{size:r,className:"mt-1",children:t(c)}):o&&d==="below"?jsx(T,{size:r,className:"mt-1",children:o}):null})]})}function wx({name:e,...o}){let{control:t,formState:{errors:r}}=useFormContext(),n=r[e],i=n?.message;return jsx(Controller,{name:e,control:t,render:({field:a})=>jsx(Go,{...o,value:a.value,onChange:a.onChange,isInvalid:!!n,errorMessage:i})})}function Bx({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),n=Pt.useRef(null),i=r.errors,a=Object.entries(i||{}),s=a.length>0;if(Pt.useEffect(()=>{t&&s&&n.current?.focus();},[t,s]),!s)return null;let l=c=>{let u=`[name="${CSS.escape(c)}"]`,d=document.querySelector(u);d&&(d.focus(),d.scrollIntoView({block:"center",behavior:"smooth"}));};return jsxs("div",{ref:n,role:"alert",tabIndex:-1,className:twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsx("div",{className:"font-medium",children:o}),jsx("ul",{className:"mt-2 list-disc pl-5",children:a.map(([c,u])=>{let d=u?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>l(c),children:d})},c)})})]})}function zx({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:n,...i}){let{formState:a}=useFormContext(),s=r||a.isSubmitting||o&&!a.isValid||t&&!a.isDirty;return jsx(S,{type:"submit",form:e,isDisabled:s,...i,children:n})}function qx({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:n}=useFormContext(),{fields:i,append:a,remove:s,swap:l}=useFieldArray({control:n,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[i.map((c,u)=>jsxs(ke,{children:[jsx(yt,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(S,{size:"sm",variant:"secondary",onPress:()=>l(u,u-1),children:"Up"}),u<i.length-1&&jsx(S,{size:"sm",variant:"secondary",onPress:()=>l(u,u+1),children:"Down"}),jsx(S,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(Mt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(S,{variant:"secondary",onPress:()=>a(r?.()||{}),children:"Add item"})})]})}function qo(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function tn(e){let o=e.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||e.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']")||e.querySelector("input, select, textarea");o&&(o.focus({preventScroll:false}),o instanceof HTMLElement&&o.scrollIntoView({block:"center",behavior:"smooth"}));}function ah({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:n=true,className:i,...a}){let s=useForm(a),l=(c,u)=>{if(n&&e){let d=document.getElementById(e);d&&tn(d);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(qo,{id:e,className:i,onSubmit:s.handleSubmit(o,l),children:r})})}function nn({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:n="Save changes",secondaryLabel:i="Cancel",className:a}){return o?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",a),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(S,{variant:"secondary",onPress:r,children:i}),jsx(S,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":n})]})]})}):null}function fh({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n}){let{formState:i}=useFormContext();return jsx(nn,{formId:e,show:i.isDirty,isSubmitting:i.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n})}function hh(e=true){let{formState:o}=useFormContext();Pt.useEffect(()=>{if(!e||!o.isSubmitted||!o.errors||Object.keys(o.errors).length===0)return;let t=document.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||document.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']");t&&t.scrollIntoView({block:"center",behavior:"smooth"});},[e,o.isSubmitted,o.errors]);}function Ph({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:n}=useFormContext(),i=Pt.useRef(void 0);Pt.useEffect(()=>{let a=t(()=>{r.isDirty&&(i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(async()=>{let s=n();await o(s);},e));});return ()=>{a.unsubscribe(),i.current&&window.clearTimeout(i.current);}},[t,r.isDirty,n,e,o]);}
|
|
2
|
+
export{Bx as ErrorSummary,qx as FieldArrayList,kp as FormAutocomplete,Gp as FormCheckbox,jp as FormCheckboxGroup,mm as FormColorField,Um as FormDateField,df as FormFileUpload,zf as FormMultiSelect,ng as FormNumberField,ah as FormProvider,Cg as FormRadioCardGroup,Gg as FormRadioGroup,Fb as FormRichTextEditor,fh as FormSaveBar,Vb as FormSelect,Wb as FormSwitch,rx as FormTextArea,dx as FormTextField,wx as FormTimeField,zx as SubmitButton,tn as focusFirstError,Ph as useAutoSave,hh as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|