@texturehq/edges 5.22.0 → 5.23.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/{RichTextEditor-tUSSVqwi.d.cts → RichTextEditor-Y9D7m0MC.d.cts} +1 -0
- package/dist/{RichTextEditor-tUSSVqwi.d.ts → RichTextEditor-Y9D7m0MC.d.ts} +1 -0
- package/dist/{TimeField-CVfhh7Rc.d.ts → TimeField-B2PQqti3.d.ts} +1 -1
- package/dist/{TimeField-BXQYxgcr.d.cts → TimeField-PFFYlRsZ.d.cts} +1 -1
- package/dist/{colors-DiMb2qNm.d.cts → colors-Bwk-3pEe.d.cts} +12 -1
- package/dist/{colors-C4MlTwKS.d.ts → colors-DSr9KkYH.d.ts} +12 -1
- package/dist/form/index.cjs +2 -2
- package/dist/form/index.cjs.map +1 -1
- package/dist/form/index.js +2 -2
- package/dist/form/index.js.map +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -20
- package/dist/index.d.ts +32 -20
- package/dist/index.js +13 -13
- 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 +2 -2
- package/dist/rhf/index.d.ts +2 -2
- package/dist/rhf/index.js +2 -2
- package/dist/rhf/index.js.map +1 -1
- package/dist/server.cjs +2 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/styles.css +0 -15
- 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 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 Jo 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 dl from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import ml from'@tiptap/starter-kit';var gn=Object.defineProperty;var hn=(e,o,t)=>o in e?gn(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Xt=(e,o,t)=>hn(e,typeof o!="symbol"?o+"":o,t);function Ze(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 Ft(e="base"){let o=Ze(`(min-width: ${pt.sm})`,e!=="base"),t=Ze(`(min-width: ${pt.md})`,["md","lg","xl","2xl"].includes(e)),r=Ze(`(min-width: ${pt.lg})`,["lg","xl","2xl"].includes(e)),n=Ze(`(min-width: ${pt.xl})`,["xl","2xl"].includes(e)),i=Ze(`(min-width: ${pt["2xl"]})`,e==="2xl"),a=!t,s=t,d="base";return i?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:i,isMobile:a,isDesktop:s}}function Yo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let n=setTimeout(()=>r(e),o);return ()=>clearTimeout(n)},[e,o]),t}function Nt(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 Ie={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 jo(e,...o){return It(Ie[e],...o)}function Ge(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 j(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 A(e,o){let t=forwardRef(({size:r=24,color:n="currentColor",className:i,mirrored:a,alt:s,weight:d,...c},u)=>{let l=!!s||"aria-label"in c;return jsx("svg",{ref:u,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 256 256",fill:n,color:n,className:i,transform:a?"scale(-1, 1)":void 0,"aria-hidden":l?void 0:true,role:l?"img":void 0,"aria-label":s,...c,children:o})});return t.displayName=e,t}var Lt=()=>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"})]}),Qo=()=>jsx("path",{d:"M166 120 88 70",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Xo=()=>jsx("path",{d:"M162 122 92 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Zo=()=>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"})]}),wn=A("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"})]})),Fn=A("TextureFuse",jsx("path",{d:"M20 128h72q18 -84 36 0q18 84 36 0h72",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})),Nn=A("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"})]})),In=A("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"})]})),Ln=A("TextureCapacitor",jsx(Fragment,{children:jsx("path",{d:"M4 128h106M146 128h106M110 72v112M146 72v112",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"})})),Mn=A("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"})]})),En=A("TextureSwitch",jsxs(Fragment,{children:[jsx(Lt,{}),jsx(Qo,{})]})),Vn=A("TextureSwitchClosed",jsxs(Fragment,{children:[jsx(Lt,{}),jsx(Xo,{})]})),Bn=A("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"})]})),Dn=A("TextureSectionalizerOpen",jsxs(Fragment,{children:[jsx(Lt,{}),jsx(Qo,{}),jsx(Zo,{})]})),An=A("TextureSectionalizerClosed",jsxs(Fragment,{children:[jsx(Lt,{}),jsx(Xo,{}),jsx(Zo,{})]})),_n=A("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]},Zt=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"},e),Jt=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",pathLength:100,strokeDasharray:"20 20"},e),Hn=A("TextureSinglePhaseOverheadLine",jsx(Fragment,{children:Je[1].map(Zt)})),zn=A("TextureTwoPhaseOverheadLine",jsx(Fragment,{children:Je[2].map(Zt)})),On=A("TextureThreePhaseOverheadLine",jsx(Fragment,{children:Je[3].map(Zt)})),$n=A("TextureSinglePhaseUndergroundLine",jsx(Fragment,{children:Je[1].map(Jt)})),Wn=A("TextureTwoPhaseUndergroundLine",jsx(Fragment,{children:Je[2].map(Jt)})),Gn=A("TextureThreePhaseUndergroundLine",jsx(Fragment,{children:Je[3].map(Jt)})),qn=A("TextureSupportStructure",jsx("circle",{cx:"128",cy:"128",r:"40",fill:"currentColor",stroke:"none"})),Un=A("TextureExplore",jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2",children:[jsx("circle",{cx:"128",cy:"128",r:"96"}),jsx("path",{d:"M170.667 85.333 149.333 149.333 85.333 170.667 106.667 106.667Z M106.667 106.667 149.333 149.333"})]})),Kn=A("TextureBoards",jsx("path",{d:"M32 21.333H106.667V128H32Z M149.333 21.333H224V85.333H149.333Z M32 170.667H106.667V234.667H32Z M149.333 128H224V234.667H149.333Z",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Yn=A("TextureMonitors",jsx("path",{d:"M32 74.667H224 M42.667 202.667H106.667L170.667 117.333H224",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),jn=A("TextureSurvey",jsx("path",{d:"M 32 74.667 V 32 H 74.667 M 181.333 32 H 224 V 74.667 M 224 181.333 V 224 H 181.333 M 74.667 224 H 32 V 181.333 M 74.667 128 H 96 M 160 128 H 181.333 M 128 74.667 V 96 M 128 160 V 181.333 M 96 128 A 32 32 0 1 0 160 128 A 32 32 0 1 0 96 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Qn=A("TextureSeismic",jsx("path",{d:"M 32 55.36 H 224 M 21.333 162.027 H 53.333 L 74.667 119.36 L 96 204.693 L 117.333 98.027 L 138.667 183.36 L 160 140.693 L 181.333 162.027 H 234.667",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Xn=A("TextureWaypoint",jsx("path",{d:"M 17.067 180.267 L 49.067 148.267 L 81.067 180.267 L 49.067 212.267 Z M 81.067 180.267 H 102.4 L 166.4 116.267 M 155.733 41.6 H 134.4 C 91.733 41.6 91.733 105.6 134.4 105.6 H 155.733 M 198.4 41.6 H 209.067 C 251.733 41.6 251.733 105.6 209.067 105.6 H 198.4 M 145.067 73.6 H 198.4",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Zn=A("TextureTerrain",jsx("path",{d:"M 32 32 H 224 V 224 H 32 Z M 32 128 H 224 M 128 32 V 224 M 32 128 L 128 32 M 128 224 L 224 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Jn=A("TextureMagma",jsx("path",{d:"M 32 226.667 V 162.667 C 32 88 128 130.667 128 56 V 34.667 H 224 M 85.333 226.667 V 194.667 C 85.333 130.667 181.333 173.333 181.333 98.667 V 88 H 224 M 138.667 226.667 C 138.667 184 224 194.667 224 141.333",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),ea=A("TextureGround",jsx("path",{d:"M 32 80 L 128 32 L 224 80 V 176 L 128 224 L 32 176 Z M 32 80 L 85.333 106.667 M 170.667 106.667 L 224 80 M 128 170.667 V 224 M 85.333 106.667 L 128 85.333 L 170.667 106.667 V 149.333 L 128 170.667 L 85.333 149.333 Z M 85.333 106.667 L 128 128 L 170.667 106.667 M 128 128 V 170.667",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Mt={TextureSurvey:jn,TextureSeismic:Qn,TextureWaypoint:Xn,TextureTerrain:Zn,TextureMagma:Jn,TextureGround:ea,TextureExplore:Un,TextureBoards:Kn,TextureMonitors:Yn,TextureRecloser:wn,TextureFuse:Fn,TextureBreaker:Nn,TextureSource:In,TextureCapacitor:Ln,TextureRegulator:Mn,TextureSwitch:En,TextureSwitchClosed:Vn,TextureOpenPoint:Bn,TextureSectionalizerOpen:Dn,TextureSectionalizerClosed:An,TextureTransformer:_n,TextureSinglePhaseOverheadLine:Hn,TextureTwoPhaseOverheadLine:zn,TextureThreePhaseOverheadLine:On,TextureSinglePhaseUndergroundLine:$n,TextureTwoPhaseUndergroundLine:Wn,TextureThreePhaseUndergroundLine:Gn,TextureSupportStructure:qn};if(process.env.NODE_ENV==="development")for(let e of Object.keys(Mt))e in Jo&&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 et={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},v=memo(({name:e,size:o="md",color:t,weight:r="regular",className:n,ariaLabel:i,...a})=>{let s=Mt[e]??Jo[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 et?et[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",n);return jsx(s,{...a,size:d,color:t,weight:r,className:c,"aria-label":i||`${e} icon`,"data-testid":`icon-${e}`})});v.displayName="Icon";var ta=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:n="md",className:i,name:a,color:s,weight:d,ariaLabel:c,ref:u,...l})=>{let b=typeof n=="string"&&n in et?et[n]:n,P=t?typeof t=="string"&&t in et?et[t]:t:b*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:P,height:P},children:jsx(v,{...l,name:a,size:n,color:s,weight:d,className:i,ariaLabel:c})})});ta.displayName="IconWithContainer";var ia=({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 rr({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,n)=>ia({...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 Le(){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 ae=Pt__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));ae.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(v,{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 sa(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function la(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}),sa({transparent:n,isDisabled:t}),$[i].text,$[i].height,$[i].padding,la(i),a)}function U({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:n="below",isRequired:i,className:a,htmlFor:s}){let d=t||r&&n==="tooltip",c=t||r,u=r&&n==="inline",l=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:"*"}),d&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(v,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsx(rr,{content:c,children:l}):l}function F({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 h({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge($[o].text,"text-feedback-error-text",t),children:e})}function Vt({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:n,className:i,...a}){let s=t??a.disabled;return jsx("input",{className:pe({isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:e,className:i}),...a,disabled:s,"aria-disabled":s||void 0})}var pa="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",ma="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",fa={primary:ma,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"},ar={full:"w-full",default:"w-fit"},ga="opacity-50 cursor-not-allowed pointer-events-none",ha="opacity-100 cursor-pointer",ba={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},xa={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function ya(e){return !e||e==="default"||e==="brand"?"primary":e}function va(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:n=false,isLoading:i=false}=e,a=ya(o),s=a==="unstyled"?"":`${pa} ${fa[a]}`;a!=="unstyled"&&(s+=` ${$[t].text} ${$[t].height} ${$[t].padding} ${$[t].gap}`),r||i?s+=` ${ga}`:s+=` ${ha}`,n?s+=` ${ar.full}`:s+=` ${ar.default}`;let d=a==="primary"?"focus-visible:outline-action-primary":void 0;return [s,Ge(),d].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:d,href:c,className:u,badgeNumber:l,badgeVariant:b="primary",badgePosition:P="top-right",style:m,target:f,rel:y,...C}=e,R=o?jsx(v,{name:o,size:a,weight:d}):null,_=jsxs(Fragment,{children:[s==="left"&&R,typeof t=="function"?null:t,s==="right"&&R]}),B=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(v,{name:"CircleNotch",size:a,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:_}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),E=(l??0)>0,w=twMerge(va(e),u),N=c?{href:c,target:f,rel:y,...C}:{};if(c){let{onPress:I,onPressStart:se,onPressEnd:O,onPressChange:me,onPressUp:J,onAuxClick:Y,onContextMenu:fe,onDoubleClick:W,...k}=C;Object.assign(N,k);}let Z=c?jsx(Link,{...N,...r&&{"aria-busy":true},style:E?void 0:m,className:w,children:r?B:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&R,t(I),s==="right"&&R]})}):_}):jsx(Button,{...C,...r&&{"aria-busy":true},style:E?void 0:m,className:w,children:r?B:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&R,t(I),s==="right"&&R]})}):_});return E?jsxs("div",{className:twMerge("relative flex",u),style:m,children:[Z,jsx("span",{className:`absolute ${ba[P]} flex h-5 w-5 items-center justify-center rounded-full ${xa[b]} text-xs font-medium`,"aria-label":`${l} items`,children:l})]}):Z}function qe({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 La({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 ot({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:n=true,disableGroup:i=false,...a}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxs(Popover,{offset:c,...a,className:composeRenderProps(r,(l,b)=>La({...b,className:l,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(qe,{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 ir(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 Ba={heading:{sm:Ie.headingSm,md:Ie.headingMd,lg:Ie.headingLg,xl:Ie.headingXl},display:{sm:Ie.displaySm,md:Ie.displayMd,lg:Ie.displayLg,xl:Ie.displayXl}},Da={page:"h-16 leading-[62px]"};function bt({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:n="",children:i}){let a=t==="xs"?"sm":t,s=Ba[o][a],d=r?Da[r]:"";return jsx(e,{className:It(s,"text-text-primary",d,n),children:i})}var nt=({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(v,{name:"CaretLeft","data-testid":"back-arrow"})}),a||jsxs(Fragment,{children:[e&&jsx(bt,{size:"xs",children:e}),o&&!t&&jsx(S,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(v,{name:"X","data-testid":"close-button"})})]})]});var za=createContext(false);createContext(null);function dr({children:e}){return jsx(za.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:d=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:l,"data-testid":b})=>{let[P,m]=useState(d===0);if(useEffect(()=>{if(d>0){let E=setTimeout(()=>m(true),d);return ()=>clearTimeout(E)}},[d]),!P)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)]",y=c&&e?(()=>{let E=typeof e=="number"?e:parseFloat(String(e));return isNaN(E)?"":`animation-duration-[${Math.max(.8,E/100)}s]`})():"",C=r==="pulse"?`animate-pulse ${y}`: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 ${y}`:"",R="rounded-sm";t==="circle"&&(R="rounded-full"),t==="text"&&(R="h-4 w-full rounded-sm");let _=i?"flex-1 min-w-0":"",B=s?Object.entries(s).map(([E,w])=>`${E}:w-[${w}]`).join(" "):"";return a?jsx("div",{className:"space-y-2","data-testid":b,children:a.map((E,w)=>jsx("div",{className:twMerge(f,C,R,_,B,l),style:{width:E,height:o}},w))}):jsx("div",{className:twMerge(f,C,R,_,B,l),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":b})};var Ga={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"},qa="rounded-lg",lo={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Ua={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function ur(e){return Pt__default.Children.toArray(e).some(o=>Pt__default.isValidElement(o)?o.type===Pt__default.Fragment?ur(o.props.children):o.type===yt&&!!o.props.title:false)}function we({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:n="default"}){let i=ur(t)?jsx(dr,{children:t}):t;return jsx("div",{className:twMerge("w-full overflow-hidden",Ga[e],qa,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(bt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:jo("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function pr({src:e,alt:o,aspectRatio:t="auto",className:r,children:n,isLoading:i=false}){return i?jsx("div",{className:twMerge("bg-background-muted",lo[t],r),children:jsx(Se,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",lo[t],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",lo[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Bt({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 mr({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",Ua[t],e),children:o}):null}we.Header=yt;we.Media=pr;we.Content=Bt;we.Footer=mr;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(we,{children:[this.props.title&&jsx(we.Header,{title:this.props.title}),jsx(we.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 Qa=.3,Xa=.5;function it({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:i=false,onBack:a,isOpen:s,onClose:d,isDismissable:c=true,transparentOverlay:u=false,primaryAction:l,secondaryAction:b,footerContent:P,maxHeight:m="80vh",height:f,maxWidth:y="640px",contentPadding:C=true,showHandle:R=true,animationVariant:_="scale",className:B}){let[E,w]=useState(false),[N,Z]=useState(0),[I,se]=useState(false),O=ir(s),me=O?.height??null,J=O?.keyboardOffset??0,Y=useRef(null),fe=useRef(null),W=useRef(null),k=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let x=setTimeout(()=>{w(true),setTimeout(()=>w(false),600);},400);return ()=>clearTimeout(x)}},[s]),useEffect(()=>{s||(Z(0),se(false),k.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let x=fe.current;if(!x||!s)return;let X=null,G=ee=>{let Pe=ee.target;Pe&&["INPUT","TEXTAREA","SELECT"].includes(Pe.tagName)&&(X&&clearTimeout(X),X=setTimeout(()=>{Pe.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return x.addEventListener("focusin",G),()=>{x.removeEventListener("focusin",G),X&&clearTimeout(X);}},[s]);let oe=useCallback(x=>{c&&(x.pointerType!=="touch"&&x.pointerType!=="pen"||(W.current&&(clearTimeout(W.current),W.current=null),k.current={isDragging:true,startY:x.clientY,startTime:Date.now(),pointerId:x.pointerId},se(false),x.currentTarget.setPointerCapture(x.pointerId)));},[c]),Ne=useCallback(x=>{let{isDragging:X,startY:G,pointerId:ee}=k.current;if(!X||x.pointerId!==ee)return;let Pe=x.clientY-G;Z(Math.max(0,Pe));},[]),le=useCallback(x=>{let{isDragging:X,startY:G,startTime:ee,pointerId:Pe}=k.current;if(!X||x.pointerId!==Pe)return;let T=x.clientY-G,ke=Date.now()-ee,De=T/ke;k.current={isDragging:false,startY:0,startTime:0,pointerId:null};let Ae=(Y.current?.getBoundingClientRect().height??0)*Qa;(T>Ae||De>Xa&&T>50)&&c?(d?.(),Z(0)):(se(true),Z(0),W.current=setTimeout(()=>{se(false),W.current=null;},200));},[c,d]);if(!s)return null;let de=o||t,ue=l||b||P;return jsx(vt,{children:jsx(qe,{isOpen:s,onOpenChange:x=>{x||d?.();},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",_==="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)]",_==="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)]",B),style:{maxWidth:y,...f?{height:f}:{maxHeight:/\d/.test(m)?me!==null?`min(${m}, ${Math.max(me-8,0)}px, 100dvh)`:`min(${m}, 100dvh)`:m}},children:[R&&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:oe,onPointerMove:Ne,onPointerUp:le,onPointerCancel:le,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]")})}),de&&(i?jsx(nt,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!d,hasBackArrow:true,onBack:a??(()=>{}),onClose:d||(()=>{})}):jsx(nt,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!d,onClose:d||(()=>{})})),jsx("div",{ref:fe,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",C?"p-4":"p-0"),children:e}),ue&&jsx(ao,{primaryAction:l,secondaryAction:b,footerContent:P})]})})})})})}it.displayName="Tray";var bo=createContext("md");function yr(){return useContext(bo)}function fo(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 ri(){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:d,defaultSelectedKey:c,onSelectionChange:u,placeholder:l,showErrors:b=false,tooltip:P,isRequired:m,transparent:f,reserveErrorSpace:y=false,placement:C="bottom start",shouldFlip:R=true,menuWidth:_="match",descriptionPlacement:B="below",useMobileTray:E=true,...w}){let[N,Z]=useState(null),[I,se]=useState(null),[O,me]=useState(false),J=d??N??c,{handleFocus:Y,handleBlur:fe}=ri(),{isMobile:W}=Ft(),k=E&&W,oe=Pt__default.useMemo(()=>!a||!J||!n?null:Array.from(n).find(X=>X.id===J)??null,[a,J,n]),Ne=x=>{u&&x!==null&&u(x),u||Z(x);},le=useRef(null),de=useRef(null),ue=()=>{k&&me(!O);};return jsxs(Fragment,{children:[jsx(Select,{...w,selectedKey:J,defaultSelectedKey:c,onSelectionChange:Ne,placeholder:l,className:j(w.className,"group flex w-full flex-col"),ref:le,onOpenChange:x=>{k||(x&&de.current?se(de.current.offsetWidth):x||le.current?.blur());},children:({isDisabled:x,isInvalid:X,isOpen:G})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:s,tooltip:P,description:B==="tooltip"||B==="inline"?o:void 0,descriptionPlacement:B,isRequired:m,children:e}),jsx(ae,{children:jsx("div",{ref:de,children:jsxs(S,{variant:"unstyled",className:twMerge(pe({isInvalid:X||b&&!!t,isDisabled:x,isFocused:k?O:G,transparent:f,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:ee=>Y(ee,w.onFocus),onBlur:ee=>fe(ee,w.onBlur),onPress:k?ue:void 0,"data-open":k?O:G,children:[a&&oe?jsx("div",{className:fo(s),children:a(oe)}):k&&J?jsx("div",{className:fo(s),children:n?Array.from(n).find(T=>T.id===J)?.label:String(J)}):jsx(SelectValue,{className:fo(s)}),jsx(v,{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",(k?O:G)&&"rotate-180")})]})})}),y?jsx("div",{className:"mt-1 min-h-[20px]",children:b?jsx(h,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&w.validationResult?t(w.validationResult):typeof t=="string"?t:null}):o&&B==="below"?jsx(F,{size:s,children:o}):null}):jsx(Fragment,{children:b?jsx(h,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&w.validationResult?t(w.validationResult):typeof t=="string"?t:null}):o&&B==="below"?jsx(F,{size:s,className:"mt-1",children:o}):null}),k?null:jsx(ot,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:_==="match"&&I?`${I}px`:void 0,minWidth:_==="auto"&&I?`${I}px`:void 0,maxWidth:_==="auto"?"min(600px, 90vw)":void 0},placement:C,shouldFlip:R,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?ee=>jsx($e,{id:ee.id,textValue:ee.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:i(ee)})},ee.id):r})})})]})}),k&&jsx(it,{isOpen:O,onClose:()=>me(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:x=>{let X=Array.from(x)[0];X!=null&&(Ne(X),me(false));},children:i&&n?x=>jsx($e,{id:x.id,textValue:x.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:i(x)})},x.id):r})})})]})}function $e({size:e,className:o,...t}){let r=yr(),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 Be=({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 hi=[],bi={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},xi={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Cr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},vo=(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 yi(e,o,t){try{let r=e.url.replace("{q}",o),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([d,c])=>{n.append(d,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 vi(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 Po({label:e,staticItems:o=hi,sections:t,selectedKey:r,defaultSelectedKey:n,onSelectionChange:i,requestConfig:a,defaultFilter:s,placeholder:d,errorMessage:c,description:u,size:l="md",tooltip:b,isRequired:P,isDisabled:m,isInvalid:f,validationResult:y,showErrors:C=true,renderItem:R,renderLeftIcon:_,renderSection:B,autoFocus:E=false,reserveErrorSpace:w=false,hideChevron:N=false,useMobileTray:Z=true,className:I}){let se=Pt__default.useRef(null),O=Pt__default.useRef(null),[me,J]=Pt__default.useState(),[Y,fe]=useState(()=>vo(r||n,o,t)),[W,k]=useState(false),[oe,Ne]=useState(false),le=Yo(Y),{contains:de}=useFilter({sensitivity:"base"}),[ue,x]=useState(),{isMobile:X}=Ft(),G=Z&&X,ee=$[l].text,Pe=useAsyncList({async load({signal:M,filterText:D=""}){if(!a)return {items:[]};if(!a.url||a.shouldLoad&&!a.shouldLoad(D))return {items:[]};try{let re;return a.requestType==="GraphQL"?re=await vi(a,D,M):re=await yi(a,D,M),x(re.error),{items:re.items}}catch(re){return re instanceof Error&&re.name==="AbortError"?{items:[]}:(console.error("Error loading items:",re),x(re instanceof Error?re.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),T=a&&le!==""?Pe:null,ke=false,De=useRef("");useEffect(()=>{E&&k(true);},[E]),useEffect(()=>{let M=vo(r,o,t);M!==Y&&fe(M);},[r,o,t]),useEffect(()=>{let M=()=>{se.current&&J(se.current.offsetWidth);};return M(),window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[]),useEffect(()=>{le===""?De.current="":T&&le!==De.current&&(De.current=le,T.setFilterText(le));},[le,T]),ke=Nt(!!T?.isLoading,300);let xe=Pt__default.useMemo(()=>{if(!G||!Y)return T?T.items:o;let M=T?T.items:o,D=s??(a?()=>true:de);return M.filter(re=>D(re.name,Y))},[G,Y,T,o,s,de]),Ae=M=>{let D=vo(M,o,t);fe(D),i&&i(M);},_e=M=>{fe(M);},He=()=>{G&&Ne(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:Ae,selectedKey:r||void 0,defaultSelectedKey:n||void 0,items:T?T.items:t?t.flatMap(M=>M.items):o,className:j(I,"group flex flex-col w-full"),menuTrigger:G?"manual":a?"input":"focus",allowsEmptyCollection:!!a,isDisabled:m,isInvalid:f||!!c,inputValue:Y,onInputChange:_e,autoFocus:E&&!G,defaultFilter:s??(a?()=>true:de),"aria-label":e||d||"Autocomplete",children:M=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:l,tooltip:b,isRequired:P,children:e}),jsxs(ae,{ref:se,children:[_?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:_(ke)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:ke?jsx(Be,{size:16,color:"text-text-secondary"}):jsx(v,{name:"MagnifyingGlass",className:`${bi[l]} text-text-secondary`})}),jsx(Input,{className:pe({isInvalid:f||!!c,isDisabled:m,isFocused:W||(G?oe:M.isOpen),size:l,className:twMerge(xi[l],Y&&!m||!N&&!Y?"pr-10":"pr-3",G&&"cursor-pointer",I)}),placeholder:d,disabled:m,onFocus:D=>{k(true),G&&(D.currentTarget.blur(),He());},onBlur:()=>{k(false);},onClick:G?He:void 0,readOnly:G,"aria-label":e||d||"Autocomplete"}),Y&&!m&&jsx(mt,{onClick:()=>{fe(""),i?.(null);},size:l}),!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(v,{name:D?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),w?jsx("div",{className:"mt-1 min-h-[20px]",children:C&&ue?jsx(h,{size:l,className:"text-feedback-error-text",children:ue}):C&&typeof c=="string"?jsx(h,{size:l,className:"text-feedback-error-text",children:c}):C&&typeof c=="function"&&y?jsx(h,{size:l,className:"text-feedback-error-text",children:c(y)}):u?jsx(F,{size:l,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(F,{size:l,className:"mt-1",children:u}),C&&ue&&jsx(h,{size:l,className:"text-feedback-error-text mt-1",children:ue}),C&&typeof c=="string"&&jsx(h,{size:l,className:"text-feedback-error-text mt-1",children:c}),C&&typeof c=="function"&&y&&jsx(h,{size:l,className:"text-feedback-error-text mt-1",children:c(y)})]}),!G&&jsx(ot,{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:me?`${me}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||d||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${ee}`,children:t?t.map(D=>{let re=D.items.map(ye=>jsx($e,{id:ye.id,textValue:ye.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${Cr[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:R?R(ye):ye.name},ye.id));if(B){let ye=B(D,re);return Pt__default.isValidElement(ye)&&ye.type===ListBoxSection?ye:jsx(ListBoxSection,{children:ye},D.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:D.name}),re]},D.name)}):D=>jsx($e,{id:D.id,textValue:D.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${Cr[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:R?R(D):D.name},D.id)})})]})}),G&&jsx(it,{isOpen:oe,onClose:()=>Ne(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(ae,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:ke?jsx(Be,{size:16,color:"text-text-secondary"}):jsx(v,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:O,type:"text",value:Y,onChange:M=>_e(M.target.value),placeholder:d,autoFocus:true,className:pe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),Y&&jsx(mt,{onClick:()=>{fe(""),i?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||d||"Suggestions",items:xe,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:M=>{let D=Array.from(M)[0];D&&(Ae(D),Ne(false));},className:"bg-background-input outline-none",children:M=>jsx($e,{id:M.id,textValue:M.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:R?R(M):M.name},M.id)})})]})})]})}function H(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 Ap({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Po,{...t,selectedKey:a.value??null,onSelectionChange:s=>a.onChange(s),showErrors:!!i,errorMessage:i})})}var Fi="focus:ring-action-primary",Ni="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function Sr(e){return jsxs(CheckboxGroup,{...e,className:j(e.className,"flex flex-col gap-2"),children:[jsx(U,{children:e.label}),e.children,e.description&&jsx(F,{children:e.description}),jsx(h,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Ii({isDisabled:e}){return `relative flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function Li({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=Fi,a="";return t?a="border-border-muted bg-background-muted":o?a="border-feedback-error-border bg-feedback-error-background":e||r?a=Ni:a="bg-background-input border-border-input hover:border-border-focus",`${n} ${i} ${a}`}var Tr="w-4 h-4 text-current group-disabled:text-text-disabled";function Co({className:e,...o}){return jsx("div",{"aria-hidden":"true",className:`${Li(o)} ${e||""}`,children:o.isIndeterminate?jsx(Minus,{"aria-hidden":true,className:Tr}):o.isSelected?jsx(Check,{"aria-hidden":true,className:Tr}):null})}function wr(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(n,i)=>`${Ii(i)} ${n||""}`),children:n=>{let{isSelected:i,isIndeterminate:a,isDisabled:s,isInvalid:d}=n;return jsxs(Fragment,{children:[jsx(Co,{isSelected:i,isIndeterminate:a,isDisabled:s,isInvalid:d}),typeof o=="function"?o(n):o]})}})}function em({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:n,formState:i}=useFormContext(),a=H(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(wr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!a,children:r.children}),t&&a&&jsx(h,{children:a})]})})}function im({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Sr,{...t,value:a.value||[],onChange:s=>a.onChange(s),errorMessage:i,children:t.children})})}function st(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 To(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 Lr({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,transparent:a,className:s,validationResult:d,value:c,defaultValue:u,onChange:l,placeholder:b="#000000",showColorSwatch:P=true,reserveErrorSpace:m=true,...f}){let[y,C]=useState(u||""),[R,_]=useState(c||u||""),[B,E]=useState(false),[w,N]=useState(null),{isFocused:Z,handleFocus:I,handleBlur:se}=Le(),O=c!==void 0?c:y;useEffect(()=>{c!==void 0&&_(c);},[c]);let me=O?!st(O):false,J=useCallback(W=>{if(_(W),st(W)){let k=To(W);l?l(k):C(k);}else W===""&&(l?l(""):C(""));},[l]),Y=useCallback(W=>{let k=To(W);_(k),l?l(k):C(k);},[l]),fe=useCallback(W=>{if(st(R)){let k=To(R);_(k),l&&k!==O?l(k):!l&&k!==y&&C(k);}se(W,f.onBlur);},[R,O,y,l,se,f.onBlur]);return jsx(TextField,{...f,isRequired:i,className:j(s,"group flex flex-col"),children:({isDisabled:W})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:r,tooltip:n,isRequired:i,children:e}),jsx(ae,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(Vt,{size:r,disabled:W,type:"text",value:R,placeholder:b,onFocus:k=>I(k,f.onFocus),onBlur:fe,onChange:k=>J(k.target.value),className:twMerge(pe({isInvalid:me,isDisabled:W,isFocused:Z,size:r,transparent:a}),P?"pr-12":"pr-3","pl-3")}),P&&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",st(O)?"border-border-default":"border-border-default bg-background-muted"),style:st(O)?{backgroundColor:O}:void 0,"aria-hidden":"true",children:!st(O)&&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:()=>E(!B),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(h,{size:r,children:t}):typeof t=="function"&&d?jsx(h,{size:r,children:t(d)}):o?jsx(F,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(h,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(h,{size:r,className:"mt-1",children:t(d)}):o?jsx(F,{size:r,className:"mt-1",children:o}):null}),B&&w&&jsx(ot,{triggerRef:{current:w},isOpen:B,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:O||"#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:O||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:O||"#000000"})]})]})})]})})}function km({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Lr,{...t,value:a.value??"",onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i})})}function Ji({isSelected:e,isDisabled:o}){let t=[Ge,"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 wo({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(Er,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Vr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:n})=>`${Ji({isSelected:r,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Er(){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(v,{name:"CaretRight","aria-hidden":true,size:o}):jsx(v,{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(v,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(v,{name:"CaretRight","aria-hidden":true,size:o})})]})}function Vr(){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:d=true,reserveErrorSpace:c=true,validationResult:u,className:l,...b}){let[P,m]=useState(false),f=y=>{b.onChange&&y&&b.onChange(y),m(false);};return jsxs(DateField,{...b,isDisabled:a,isRequired:i,isInvalid:s,className:j(l,"flex flex-col gap-1"),children:[e&&jsx(U,{size:r,tooltip:n,isRequired:i,children:e}),jsx(ae,{children:jsxs("div",{className:"relative w-full",children:[jsx(Dr,{size:r,isDisabled:a,isInvalid:s,hasCalendar:d}),d&&!a&&jsxs(DialogTrigger,{isOpen:P,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(v,{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(wo,{value:b.value,onChange:f,minValue:b.minValue,maxValue:b.maxValue,isDisabled:a,isReadOnly:b.isReadOnly,isDateUnavailable:b.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(h,{size:r,children:t}):typeof t=="function"&&u?jsx(h,{size:r,children:t(u)}):o?jsx(F,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(h,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(h,{size:r,className:"mt-1",children:t(u)}):o?jsx(F,{size:r,className:"mt-1",children:o}):null})]})}function ss({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 Dr({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:ss({isPlaceholder:a.isPlaceholder,isDisabled:!a.isEditable||o,size:e})})})}function rf({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(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 Io({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:n,isDisabled:i=false,onUpload:a,className:s,showPreview:d=true,placeholder:c="Drop files here or click to browse"}){let[u,l]=useState(false),[b,P]=useState(false),[m,f]=useState(null),[y,C]=useState(e),R=useRef(null),_=async w=>{if(f(null),n&&w.size>n){f(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(d&&w.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{C(N.result);},N.readAsDataURL(w);}if(a){P(true);try{let N=await a(w);C(N),t?.(N);}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{P(false);}}o?.(w,y);},B=async w=>{try{let N=w.items;if(N.length>0){let Z=N[0];if(Z.kind==="file"){let I=await Z.getFile();I&&_(I);}}}catch(N){f("Failed to upload file"),console.error("Upload error:",N);}finally{l(false);}},E=()=>{C(void 0),f(null),o?.(null),t?.(""),R.current&&(R.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:B,onDropEnter:()=>l(true),onDropExit:()=>l(false),children:[y?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(y.startsWith("data:image")||y.startsWith("http"))?jsx("img",{src:y,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: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: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:w=>{let N=Array.from(w||[]);N.length>0&&_(N[0]);},children:jsx(S,{variant:"secondary",size:"sm",isDisabled:i,children:"Choose File"})})]}),b&&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 vf({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:n,formState:i}=useFormContext(),a=H(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(Io,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&a&&jsx(h,{children:a})]})})}var Ps={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 Hr(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var Cs={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"},Rs="opacity-75 cursor-not-allowed pointer-events-none";function zr(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",Cs[t],a,Ps[o],n&&!r&&"cursor-pointer",r&&Rs,i)}function Or({children:e,onRemove:o,removeLabel:t="Remove",size:r="md",variant:n="secondary",isRemovable:i=true,isDisabled:a=false,className:s,onClick:d}){let c=!!d&&!a,u=i&&o&&!a,l=y=>{y.stopPropagation(),y.preventDefault(),o&&!a&&o();},b=()=>{d&&!a&&d();},P=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:l,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),l(y));},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(v,{name:"X",size:P,className:"text-current opacity-70 hover:opacity-100"})}):jsx("button",{type:"button",onClick:l,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(v,{name:"X",size:P,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:b,className:zr({variant:Hr(n),size:r,isDisabled:a,isClickable:c,className:s}),disabled:a,children:f}):jsx("span",{className:zr({variant:Hr(n),size:r,isDisabled:a,isClickable:c,className:s}),children:f})}var Ss=(e,o)=>e.toLocaleLowerCase().includes(o.toLocaleLowerCase());function ws(e){return [e.value,e.label]}function $r(e,o,t=Ss){let r=o.trim();return r===""?[...e]:e.filter(n=>ws(n).some(i=>t(i,r)))}function Wr(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 Gr(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 Ls=e=>e.kind==="literal"?`literal:${e.value}`:`option:${e.option.value}`,Mo=e=>e.kind==="literal"?e.value:e.option.value,qr=e=>e.kind==="literal"?e.value:e.option.label,Ms={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},Es={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Vs={sm:"xs",md:"xs",lg:"sm",xl:"sm"};function Eo({options:e,value:o,defaultValue:t,onChange:r,label:n,placeholder:i,size:a="md",loading:s=false,disabled:d=false,maxSelected:c,allowLiteral:u=false,onSearchChange:l,truncated:b=false,totalCount:P,emptyMessage:m,showSelectAll:f=false,description:y,errorMessage:C,isRequired:R=false,onBlur:_,inputRef:B,labelHidden:E=false,className:w,id:N}){let Z=useId(),I=N??`multiselect-${Z}`,se=`${I}-input`,O=`${I}-listbox`,me=useRef(null),J=useCallback(p=>{me.current=p,typeof B=="function"?B(p):B&&(B.current=p);},[B]),{contains:Y}=useFilter({sensitivity:"base"}),{isFocused:fe,handleFocus:W,handleBlur:k}=Le(),[oe,Ne]=useState(""),[le,de]=useState(true),[ue,x]=useState(null),[X,G]=useState(""),[ee,Pe]=useState(()=>[...t??[]]),T=useMemo(()=>o?[...o]:ee,[o,ee]),ke=useMemo(()=>$r(e,oe,Y),[e,oe,Y]),De=u&&!s&&Wr({query:oe,options:e,selected:T}),xe=useMemo(()=>{let p=ke.map(te=>({kind:"option",option:te}));return De?[{kind:"literal",value:oe.trim()},...p]:p},[ke,De,oe]),Ae=useMemo(()=>Gr(T,e),[T,e]),_e=c!==void 0&&T.length>=c,He=useCallback((p,te)=>{o||Pe(p),G(`${te} ${p.length} selected.`),r(p);},[r,o]),M=useCallback((p,te)=>{if(!d){if(T.includes(p)){He(T.filter(ze=>ze!==p),`${te} removed.`);return}_e||He([...T,p],`${te} selected.`);}},[_e,He,d,T]),D=useCallback(p=>{p.kind==="option"&&p.option.disabled||M(Mo(p),qr(p));},[M]),re=p=>{if(d||p.length===0)return;let te=new Set(p),ze=p.map(Ve=>Ae.find(Qt=>Qt.value===Ve)?.label??Ve);He(T.filter(Ve=>!te.has(Ve)),`${ze.join(", ")} removed.`);},ye=p=>{Ne(p),x(null),de(true),l?.(p);},Ko=p=>{if(xe.length===0){x(null);return}x(te=>te===null?p>0?0:xe.length-1:(te+p+xe.length)%xe.length);},cn=p=>{if(d)return;let te=ue===null?void 0:xe[ue];switch(p.key){case "ArrowDown":p.preventDefault(),de(true),Ko(1);break;case "ArrowUp":p.preventDefault(),de(true),Ko(-1);break;case "Home":xe.length>0&&(p.preventDefault(),de(true),x(0));break;case "End":xe.length>0&&(p.preventDefault(),de(true),x(xe.length-1));break;case "Enter":te&&(p.preventDefault(),D(te));break;case " ":oe===""&&te&&(p.preventDefault(),D(te));break;case "Escape":p.preventDefault(),oe!==""?ye(""):(de(false),x(null));break;case "Backspace":oe===""&&T.length>0&&(p.preventDefault(),re([T[T.length-1]]));break;}},Xe=ke.filter(p=>!p.disabled&&!T.includes(p.value)).map(p=>p.value),un=c===void 0?Xe.length:Math.max(0,c-T.length),ut=Math.min(Xe.length,un),pn=ut===Xe.length?`Select all ${Xe.length} matching`:`Select ${ut} of ${Xe.length} matching`,mn=()=>{if(d||ut===0)return;let p=Xe.slice(0,ut);He([...T,...p],`${p.length} matching options selected.`);},jt=s?"loading":e.length===0?"empty":ke.length===0&&oe.trim()!==""?"no-match":null,fn=$[a].text;return jsxs("div",{className:twMerge("flex w-full flex-col gap-1",w),"data-testid":"multiselect",children:[jsx(U,{size:a,htmlFor:se,isRequired:R,...E?{className:"sr-only"}:{},children:n}),jsxs(ae,{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(Be,{size:16,color:"text-text-secondary"}):jsx(v,{name:"MagnifyingGlass",className:twMerge(Ms[a],"text-text-secondary")})}),jsx("input",{ref:J,id:se,type:"text",role:"combobox",autoComplete:"off","aria-expanded":le,"aria-controls":O,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-activedescendant":le&&ue!==null&&xe[ue]?`${I}-row-${ue}`:void 0,"aria-required":R||void 0,"aria-invalid":C?true:void 0,value:oe,placeholder:i,disabled:d,onChange:p=>ye(p.target.value),onKeyDown:cn,onFocus:p=>{de(true),W(p);},onBlur:p=>{k(p),_?.(p);},className:pe({isDisabled:d,isFocused:fe,isInvalid:!!C,size:a,className:twMerge(Es[a],"pr-3")})})]}),Ae.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:Ae.map(p=>jsx(Or,{size:Vs[a],variant:"primary",isDisabled:d,removeLabel:`Remove ${p.label}`,onRemove:()=>re([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:mn,isDisabled:d||ut===0,children:pn}),jsx(S,{variant:"link",size:a,onPress:()=>re(T),isDisabled:d||T.length===0,children:"Clear all"})]}),jsx("div",{id:O,role:"listbox","aria-multiselectable":"true","aria-label":`${n} options`,hidden:!le,className:twMerge(fn,"max-h-[260px] overflow-y-auto rounded-[var(--control-border-radius)] border border-border-input bg-background-input"),children:le&&xe.map((p,te)=>{let ze=T.includes(Mo(p)),Ve=d||p.kind==="option"&&p.option.disabled===true||!ze&&_e;return jsxs("div",{id:`${I}-row-${te}`,role:"option","aria-selected":ze,"aria-disabled":Ve||void 0,"data-value":Mo(p),"data-literal":p.kind==="literal"?"true":void 0,"data-active":ue===te?"true":void 0,onMouseDown:Qt=>Qt.preventDefault(),onClick:()=>{Ve||(D(p),me.current?.focus());},className:twMerge("flex cursor-default items-center gap-2 px-3",$[a].paddingY,"text-text-primary",ue===te&&"bg-background-hover",ze&&"bg-background-selected font-medium",Ve&&"text-text-disabled"),children:[jsx(Co,{isSelected:ze,isDisabled:Ve,className:"!w-4 !h-4"}),jsx("span",{className:"flex-1 truncate",children:qr(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()})]},Ls(p))})}),jt==="loading"&&jsx("div",{"data-testid":"multiselect-status-loading","data-status":"loading",children:jsxs(F,{size:a,className:"flex items-center gap-2",children:[jsx(Be,{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(F,{size:a,className:"flex items-center gap-2",children:[jsx(v,{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(F,{size:a,className:"flex items-center gap-2 text-feedback-warning-text",children:[jsx(v,{name:"MagnifyingGlass",className:"h-4 w-4"}),jsx("span",{children:`No options match \u201C${oe.trim()}\u201D`})]})}),b&&jsx("div",{"data-testid":"multiselect-truncation",children:jsx(F,{size:a,children:P===void 0?"Showing a partial list \u2014 refine your search to see more":`Showing ${e.length} of ${P} \u2014 refine your search to see more`})}),c!==void 0&&jsx("div",{"data-testid":"multiselect-limit",children:jsx(F,{size:a,children:_e?`${T.length} of ${c} selected \u2014 limit reached, remove one to choose another`:`${T.length} of ${c} selected`})}),y&&jsx(F,{size:a,children:y}),C&&jsx(h,{size:a,children:C}),jsx("div",{"data-testid":"multiselect-live-region",role:"status","aria-live":"polite",className:"sr-only",children:X})]})}function Qf({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Eo,{...t,value:a.value??[],onChange:s=>a.onChange(s),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},inputRef:a.ref,errorMessage:i})})}var $s=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:d=true,descriptionPlacement:c="below",...u}){let l=useId(),{isFocused:b,handleFocus:P,handleBlur:m}=Le();return jsx(NumberField,{...u,id:l,isRequired:i,className:j(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:y})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(U,{size:r,tooltip:n,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:i,htmlFor:l,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:R=>P(R,u.onFocus),onBlur:R=>m(R,u.onBlur),className:$s({isInvalid:y||!!t,isDisabled:f,isFocused:b,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(v,{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(v,{name:"CaretDown",size:14})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(h,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(F,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(h,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(F,{size:r,className:"mt-1",children:o}):null})]})})}function gg({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(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 Ao({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:i,className:a,children:s,size:d="2",variant:c="primary",columns:u="repeat(auto-fit, minmax(160px, 1fr))",gap:l="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:i,className:j(a,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(u))?`repeat(${u}, minmax(0, 1fr))`:u,gap:l==="1"?"0.25rem":l==="2"?"0.5rem":l==="3"?"0.75rem":l==="4"?"1rem":typeof l=="number"?`${l}px`:l},children:Pt__default.Children.map(s,b=>Pt__default.isValidElement(b)?Pt__default.cloneElement(b,{size:d,variant:c}):b)})}function Eg({name:e,defaultValue:o,label:t,description:r,children:n,...i}){let{control:a,formState:s}=useFormContext(),d=H(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(U,{children:t}),r&&jsx(F,{children:r}),jsx(Ao,{...i,value:c.value,onChange:u=>c.onChange(u),children:n}),d&&jsx(h,{children:d})]})})}function Js(e){return "primary"}var el=createContext({variant:"primary"});function _o(e){let{variant:o="primary",...t}=e,r=Js();return jsx(el.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:j(e.className,"group flex flex-col gap-2"),children:[jsx(U,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(F,{children:e.description}),jsx(h,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function eh({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(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),errorMessage:i,children:t.children})})}var sl=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 wt({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:i,transparent:a,showSearchIcon:s,isClearable:d,onClear:c,type:u,validationResult:l,reserveErrorSpace:b=true,isLoading:P=false,descriptionPlacement:m="below",...f}){let[y,C]=Pt__default.useState(false),{isFocused:R,handleFocus:_,handleBlur:B}=Le(),E=u==="password",w=Nt(P,300);return jsx(TextField,{...f,isRequired:i,className:j(f.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:Z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:r,tooltip:n,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:i,children:e}),jsxs(ae,{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 w?jsx(Be,{size:I,color:"text-text-secondary"}):jsx(v,{name:"MagnifyingGlass",size:I,className:`transition-colors ${R?"text-action-brand":"text-text-secondary"}`})})()}),jsx(Vt,{size:r,disabled:N,type:E?y?"text":"password":u,name:f.name,autoComplete:f.autoComplete,value:f.value,defaultValue:f.defaultValue,placeholder:f.placeholder,onFocus:I=>_(I,f.onFocus),onBlur:I=>B(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:sl({isInvalid:Z,isDisabled:N,isFocused:R,size:r,transparent:a,showSearchIcon:s,isClearable:d,hasValue:!!f.value,isPassword:E,className:typeof f.className=="string"?f.className:void 0})}),d&&f.value&&!N&&jsx(mt,{onClick:()=>{c?c():f.onChange&&f.onChange("");},size:r}),E&&!N&&jsx("button",{type:"button",onClick:()=>C(!y),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":y?"Hide password":"Show password",onMouseDown:I=>{I.preventDefault(),I.stopPropagation();},children:jsx(v,{name:y?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),b?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(h,{size:r,children:t}):typeof t=="function"&&l?jsx(h,{size:r,children:t(l)}):o&&m==="below"?jsx(F,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(h,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(h,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsx(F,{size:r,className:"mt-1",children:o}):null})]})})}var bl={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"}},dt=({isActive:e=false,onPress:o,children:t})=>jsx(S,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function xl({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[n,i]=useState(e);return Pt__default.useEffect(()=>{i(e);},[e]),jsx(qe,{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(nt,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(wt,{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 Ho({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:n="Start typing...",id:i,size:a="md",headingLevels:s=[1,2]}){let d=bl[a],[c,u]=useState(false),l=useEditor({immediatelyRender:false,extensions:[ml.configure({heading:s.length>0?{levels:s}:false}),dl.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")}}}),b=()=>{u(true);},P=m=>{m===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:m}).run();};return l?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&&l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,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=l.getAttributes("link").href;m&&window.open(m,"_blank","noopener,noreferrer");},children:[jsx(v,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:b,children:[jsx(v,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(v,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(xl,{isOpen:c,onClose:()=>u(false),onSubmit:P,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(dt,{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(dt,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(dt,{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(dt,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(v,{name:"ListBullets",className:"h-4 w-4"})}),jsx(dt,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(v,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(dt,{isActive:l.isActive("link"),onPress:b,children:jsx(v,{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 Bh({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:n=true,...i}){let{control:a,formState:s}=useFormContext(),d=H(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(Ho,{...i,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),d&&jsx("p",{className:"text-sm text-feedback-error-text",children:d}),n&&!d&&jsx("div",{className:"h-5"})]})})}function Wh({name:e,defaultValue:o,onValueChange:t,...r}){let{control:n,formState:i}=useFormContext(),a=H(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsx(xo,{...r,selectedKey:s.value??null,onSelectionChange:d=>{s.onChange(d),t?.(d);},showErrors:!!a,errorMessage:a})})}var Oo={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 Sl({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=Oo[t].track,i=Ge,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 wl({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=Oo[t].handle;return [r,n,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function $o({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:j(r.className,`relative group flex items-center gap-2 ${Oo[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:Sl({...n,size:t}),children:jsx("span",{className:wl({...n,size:t})})}),e]})})}function tb({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:n})=>jsx($o,{...t,isSelected:!!n.value,onChange:i=>n.onChange(i),children:t.children})})}var El=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 Wo({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,required:i,transparent:a,isInvalid:s,isDisabled:d,isResizable:c=false,className:u,validationResult:l,reserveErrorSpace:b=true,...P}){let{isFocused:m,handleFocus:f,handleBlur:y}=Le();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:r,tooltip:n,isRequired:i,children:e}),jsx(ae,{children:jsx("textarea",{...P,required:i,onFocus:C=>{P.onFocus&&P.onFocus(C),f(C);},onBlur:C=>{P.onBlur&&P.onBlur(C),y(C);},className:El({isInvalid:s,isDisabled:d,isResizable:c,isFocused:m,size:r,transparent:a,className:u}),disabled:d})}),b?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(h,{size:r,children:t}):typeof t=="function"&&l?jsx(h,{size:r,children:t(l)}):o?jsx(F,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(h,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(h,{size:r,className:"mt-1",children:t(l)}):o?jsx(F,{size:r,className:"mt-1",children:o}):null})]})})}function fb({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Wo,{...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 vb({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),i=H(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(wt,{...t,value:a.value??"",onChange:s=>a.onChange(s),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},isInvalid:!!i,errorMessage:i,isRequired:t.isRequired})})}function Wl({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:d=true,validationResult:c,className:u,descriptionPlacement:l="below",...b}){return jsxs(TimeField,{...b,isDisabled:a,isRequired:i,isInvalid:s,className:j(u,"flex flex-col gap-1"),children:[e&&jsx(U,{size:r,tooltip:n,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:i,children:e}),jsx(ae,{children:jsx(DateInput,{className:twMerge(ft({isInvalid:s,isDisabled:a}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:P=>jsx(DateSegment,{segment:P,className:Wl({isPlaceholder:P.isPlaceholder,isDisabled:!P.isEditable||a,size:r})})})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(h,{size:r,children:t}):typeof t=="function"&&c?jsx(h,{size:r,children:t(c)}):o&&l==="below"?jsx(F,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(h,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(h,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsx(F,{size:r,className:"mt-1",children:o}):null})]})}function zb({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 qb({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 d=c=>{let u=`[name="${CSS.escape(c)}"]`,l=document.querySelector(u);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:a.map(([c,u])=>{let l=u?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>d(c),children:l})},c)})})]})}function Qb({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 ox({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:n}=useFormContext(),{fields:i,append:a,remove:s,swap:d}=useFieldArray({control:n,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[i.map((c,u)=>jsxs(we,{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:()=>d(u,u-1),children:"Up"}),u<i.length-1&&jsx(S,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsx(S,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(Bt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(S,{variant:"secondary",onPress:()=>a(r?.()||{}),children:"Add item"})})]})}function Uo(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function nn(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 hx({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:n=true,className:i,...a}){let s=useForm(a),d=(c,u)=>{if(n&&e){let l=document.getElementById(e);l&&nn(l);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(Uo,{id:e,className:i,onSubmit:s.handleSubmit(o,d),children:r})})}function ln({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 Tx({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n}){let{formState:i}=useFormContext();return jsx(ln,{formId:e,show:i.isDirty,isSubmitting:i.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n})}function Nx(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 Mx({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{
|
|
1
|
+
import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';export{Controller,useFieldArray,useFormContext,useWatch}from'react-hook-form';import*as Ct from'react';import Ct__default,{memo,createContext,forwardRef,useState,useRef,useEffect,useCallback,useId,useMemo,useContext,Component,isValidElement}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,ModalOverlay,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell,Tooltip}from'react-aria-components';import {useAsyncList}from'react-stately';import {twMerge}from'tailwind-merge';import*as eo 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 xl from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import Cl from'@tiptap/starter-kit';var yn=Object.defineProperty;var vn=(e,r,t)=>r in e?yn(e,r,{enumerable:true,configurable:true,writable:true,value:t}):e[r]=t;var Zt=(e,r,t)=>vn(e,typeof r!="symbol"?r+"":r,t);function Ze(e,r=false){let[t,o]=useState(r);return useEffect(()=>{if(typeof window>"u")return;let n=window.matchMedia(e);o(n.matches);let i=a=>{o(a.matches);};return n.addEventListener("change",i),()=>{n.removeEventListener("change",i);}},[e]),t}var mt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function Nt(e="base"){let r=Ze(`(min-width: ${mt.sm})`,e!=="base"),t=Ze(`(min-width: ${mt.md})`,["md","lg","xl","2xl"].includes(e)),o=Ze(`(min-width: ${mt.lg})`,["lg","xl","2xl"].includes(e)),n=Ze(`(min-width: ${mt.xl})`,["xl","2xl"].includes(e)),i=Ze(`(min-width: ${mt["2xl"]})`,e==="2xl"),a=!t,s=t,l="base";return i?l="2xl":n?l="xl":o?l="lg":t?l="md":r&&(l="sm"),{current:l,isSm:r,isMd:t,isLg:o,isXl:n,is2Xl:i,isMobile:a,isDesktop:s}}function jr(e,r=300){let[t,o]=useState(e);return useEffect(()=>{let n=setTimeout(()=>o(e),r);return ()=>clearTimeout(n)},[e,r]),t}function It(e,r=300){let[t,o]=useState(false);return useEffect(()=>{if(e){let n=setTimeout(()=>{o(true);},r);return ()=>clearTimeout(n)}o(false);},[e,r]),t}function Lt(...e){return e.filter(Boolean).join(" ")}var Ie={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 Qr(e,...r){return Lt(Ie[e],...r)}function Ge(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 j(e,r){return composeRenderProps(e,t=>twMerge(r,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 A(e,r){let t=forwardRef(({size:o=24,color:n="currentColor",className:i,mirrored:a,alt:s,weight:l,...c},u)=>{let d=!!s||"aria-label"in c;return jsx("svg",{ref:u,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 256 256",fill:n,color:n,className:i,transform:a?"scale(-1, 1)":void 0,"aria-hidden":d?void 0:true,role:d?"img":void 0,"aria-label":s,...c,children:r})});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"})]}),Xr=()=>jsx("path",{d:"M166 120 88 70",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Zr=()=>jsx("path",{d:"M162 122 92 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Jr=()=>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"})]}),Ln=A("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"})]})),En=A("TextureFuse",jsx("path",{d:"M20 128h72q18 -84 36 0q18 84 36 0h72",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})),Mn=A("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"})]})),Vn=A("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"})]})),Bn=A("TextureCapacitor",jsx(Fragment,{children:jsx("path",{d:"M4 128h106M146 128h106M110 72v112M146 72v112",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"})})),Dn=A("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"})]})),An=A("TextureSwitch",jsxs(Fragment,{children:[jsx(Et,{}),jsx(Xr,{})]})),Hn=A("TextureSwitchClosed",jsxs(Fragment,{children:[jsx(Et,{}),jsx(Zr,{})]})),_n=A("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"})]})),zn=A("TextureSectionalizerOpen",jsxs(Fragment,{children:[jsx(Et,{}),jsx(Xr,{}),jsx(Jr,{})]})),On=A("TextureSectionalizerClosed",jsxs(Fragment,{children:[jsx(Et,{}),jsx(Zr,{}),jsx(Jr,{})]})),$n=A("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),er=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",pathLength:100,strokeDasharray:"20 20"},e),Wn=A("TextureSinglePhaseOverheadLine",jsx(Fragment,{children:Je[1].map(Jt)})),Gn=A("TextureTwoPhaseOverheadLine",jsx(Fragment,{children:Je[2].map(Jt)})),qn=A("TextureThreePhaseOverheadLine",jsx(Fragment,{children:Je[3].map(Jt)})),Un=A("TextureSinglePhaseUndergroundLine",jsx(Fragment,{children:Je[1].map(er)})),Kn=A("TextureTwoPhaseUndergroundLine",jsx(Fragment,{children:Je[2].map(er)})),Yn=A("TextureThreePhaseUndergroundLine",jsx(Fragment,{children:Je[3].map(er)})),jn=A("TextureSupportStructure",jsx("circle",{cx:"128",cy:"128",r:"40",fill:"currentColor",stroke:"none"})),Qn=A("TextureExplore",jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2",children:[jsx("circle",{cx:"128",cy:"128",r:"96"}),jsx("path",{d:"M170.667 85.333 149.333 149.333 85.333 170.667 106.667 106.667Z M106.667 106.667 149.333 149.333"})]})),Xn=A("TextureBoards",jsx("path",{d:"M32 21.333H106.667V128H32Z M149.333 21.333H224V85.333H149.333Z M32 170.667H106.667V234.667H32Z M149.333 128H224V234.667H149.333Z",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Zn=A("TextureMonitors",jsx("path",{d:"M32 74.667H224 M42.667 202.667H106.667L170.667 117.333H224",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),Jn=A("TextureSurvey",jsx("path",{d:"M 32 74.667 V 32 H 74.667 M 181.333 32 H 224 V 74.667 M 224 181.333 V 224 H 181.333 M 74.667 224 H 32 V 181.333 M 74.667 128 H 96 M 160 128 H 181.333 M 128 74.667 V 96 M 128 160 V 181.333 M 96 128 A 32 32 0 1 0 160 128 A 32 32 0 1 0 96 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),ea=A("TextureSeismic",jsx("path",{d:"M 32 55.36 H 224 M 21.333 162.027 H 53.333 L 74.667 119.36 L 96 204.693 L 117.333 98.027 L 138.667 183.36 L 160 140.693 L 181.333 162.027 H 234.667",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),ta=A("TextureWaypoint",jsx("path",{d:"M 17.067 180.267 L 49.067 148.267 L 81.067 180.267 L 49.067 212.267 Z M 81.067 180.267 H 102.4 L 166.4 116.267 M 155.733 41.6 H 134.4 C 91.733 41.6 91.733 105.6 134.4 105.6 H 155.733 M 198.4 41.6 H 209.067 C 251.733 41.6 251.733 105.6 209.067 105.6 H 198.4 M 145.067 73.6 H 198.4",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),ra=A("TextureTerrain",jsx("path",{d:"M 32 32 H 224 V 224 H 32 Z M 32 128 H 224 M 128 32 V 224 M 32 128 L 128 32 M 128 224 L 224 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),oa=A("TextureMagma",jsx("path",{d:"M 32 226.667 V 162.667 C 32 88 128 130.667 128 56 V 34.667 H 224 M 85.333 226.667 V 194.667 C 85.333 130.667 181.333 173.333 181.333 98.667 V 88 H 224 M 138.667 226.667 C 138.667 184 224 194.667 224 141.333",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),na=A("TextureGround",jsx("path",{d:"M 32 80 L 128 32 L 224 80 V 176 L 128 224 L 32 176 Z M 32 80 L 85.333 106.667 M 170.667 106.667 L 224 80 M 128 170.667 V 224 M 85.333 106.667 L 128 85.333 L 170.667 106.667 V 149.333 L 128 170.667 L 85.333 149.333 Z M 85.333 106.667 L 128 128 L 170.667 106.667 M 128 128 V 170.667",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"2"})),aa=A("TextureSensor",jsxs(Fragment,{children:[jsx("path",{d:"M88 40H40v48M168 40h48v48M216 168v48h-48M88 216H40v-48",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("circle",{cx:"128",cy:"128",r:"36",fill:"currentColor",stroke:"none"})]})),Mt={TextureSensor:aa,TextureSurvey:Jn,TextureSeismic:ea,TextureWaypoint:ta,TextureTerrain:ra,TextureMagma:oa,TextureGround:na,TextureExplore:Qn,TextureBoards:Xn,TextureMonitors:Zn,TextureRecloser:Ln,TextureFuse:En,TextureBreaker:Mn,TextureSource:Vn,TextureCapacitor:Bn,TextureRegulator:Dn,TextureSwitch:An,TextureSwitchClosed:Hn,TextureOpenPoint:_n,TextureSectionalizerOpen:zn,TextureSectionalizerClosed:On,TextureTransformer:$n,TextureSinglePhaseOverheadLine:Wn,TextureTwoPhaseOverheadLine:Gn,TextureThreePhaseOverheadLine:qn,TextureSinglePhaseUndergroundLine:Un,TextureTwoPhaseUndergroundLine:Kn,TextureThreePhaseUndergroundLine:Yn,TextureSupportStructure:jn};if(process.env.NODE_ENV==="development")for(let e of Object.keys(Mt))e in eo&&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 et={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},P=memo(({name:e,size:r="md",color:t,weight:o="regular",className:n,ariaLabel:i,...a})=>{let s=Mt[e]??eo[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 r=="string"&&r in et?et[r]:r,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",n);return jsx(s,{...a,size:l,color:t,weight:o,className:c,"aria-label":i||`${e} icon`,"data-testid":`icon-${e}`})});P.displayName="Icon";var ia=memo(({variant:e="subtle",shape:r="square",containerSize:t,containerClassName:o,size:n="md",className:i,name:a,color:s,weight:l,ariaLabel:c,ref:u,...d})=>{let f=typeof n=="string"&&n in et?et[n]:n,v=t?typeof t=="string"&&t in et?et[t]:t:f*1.75,g=twMerge("inline-flex items-center justify-center flex-shrink-0",r==="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",o);return jsx("div",{className:g,style:{width:v,height:v},children:jsx(P,{...d,name:a,size:n,color:s,weight:l,className:i,ariaLabel:c})})});ia.displayName="IconWithContainer";var fa=({isEntering:e,isExiting:r,className:t})=>["max-w-xs group bg-background-surface border border-border-default text-text-primary text-sm leading-relaxed rounded-lg shadow-lg will-change-transform px-3 py-2",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":"",r?"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 ao({content:e,tooltipRef:r,...t}){return jsxs(Tooltip,{...t,ref:r,offset:t.offset??8,className:composeRenderProps(t.className,(o,n)=>fa({...n,className:o})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-background-surface stroke-border-default 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"})})}),e]})}function ga({children:e,content:r,delay:t=200,closeDelay:o,...n}){let[i,a]=useState(false),s=useRef(false),l=useRef(null),c=useRef(null),u=useId();if(useEffect(()=>{if(!i)return;let f=()=>{s.current=false,a(false);},v=m=>{m.key==="Escape"&&f();},g=m=>{!(m.target instanceof Node)||document.querySelector(`[data-tooltip-trigger="${u}"]`)?.contains(m.target)||c.current?.contains(m.target)||f();};return document.addEventListener("keydown",v,true),document.addEventListener("pointerdown",g),()=>{document.removeEventListener("keydown",v,true),document.removeEventListener("pointerdown",g);}},[i,u]),useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]),!isValidElement(e))throw new Error("Tooltip with openOnPress requires a single pressable child");let d=Ct__default.cloneElement(e,{"data-tooltip-trigger":u,onHoverStart:f=>{e.props.onHoverStart?.(f),l.current=setTimeout(()=>a(true),t);},onHoverEnd:f=>{e.props.onHoverEnd?.(f),l.current&&clearTimeout(l.current),s.current||a(false);},onPress:f=>{e.props.onPress?.(f),l.current&&clearTimeout(l.current),s.current=!s.current,a(s.current);}});return jsxs(TooltipTrigger,{delay:t,closeDelay:o,shouldCloseOnPress:false,isOpen:i,onOpenChange:f=>{!f&&s.current||a(f);},children:[d,jsx(ao,{...n,content:r,tooltipRef:c})]})}function io({children:e,content:r,openOnPress:t=false,delay:o=200,closeDelay:n,...i}){return t?jsx(ga,{...i,content:r,delay:o,closeDelay:n,children:e}):jsxs(TooltipTrigger,{delay:o,closeDelay:n,children:[e,jsx(ao,{...i,content:r})]})}function Le(){let[e,r]=Ct__default.useState(false),t=Ct__default.useCallback((n,i)=>{r(true),i?.(n);},[]),o=Ct__default.useCallback((n,i)=>{r(false),i?.(n);},[]);return {isFocused:e,handleFocus:t,handleBlur:o}}var ae=Ct__default.forwardRef(({children:e,className:r},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",r),children:e}));ae.displayName="InputWrapper";function ft({onClick:e,size:r="md",className:t}){return jsx("button",{type:"button",onClick:o=>{o.preventDefault(),o.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:o=>{o.preventDefault(),o.stopPropagation();},children:jsx(P,{name:"X",size:r==="sm"?16:20})})}function gt(e){let{isInvalid:r,isDisabled:t,isFocused:o}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${n} border-border-muted`:r&&o?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:r?`${n} border-feedback-error-border`:o?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function ha(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function ba(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:r,isDisabled:t,isFocused:o,transparent:n,size:i="md",className:a}=e;return twMerge("w-full",gt({isInvalid:r,isDisabled:t,isFocused:o}),ha({transparent:n,isDisabled:t}),$[i].text,$[i].height,$[i].padding,ba(i),a)}function U({children:e,size:r="md",tooltip:t,description:o,descriptionPlacement:n="below",isRequired:i,className:a,htmlFor:s}){let l=t||o&&n==="tooltip",c=t||o,u=o&&n==="inline",d=jsxs("label",{htmlFor:s,className:twMerge($[r].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(P,{name:"Info",size:r==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:o})]});return l&&c?jsx(io,{content:c,children:d}):d}function F({size:e="md",className:r,children:t,...o}){return jsx("div",{...o,className:twMerge("leading-[2.25] text-text-secondary",$[e].text,r),children:t})}function b({children:e,size:r="md",className:t}){return jsx("div",{role:"alert",className:twMerge($[r].text,"text-feedback-error-text",t),children:e})}function Bt({size:e="md",isInvalid:r,isDisabled:t,isFocused:o,transparent:n,className:i,...a}){let s=t??a.disabled;return jsx("input",{className:pe({isInvalid:r,isDisabled:t,isFocused:o,transparent:n,size:e,className:i}),...a,disabled:s,"aria-disabled":s||void 0})}var Pa="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Ca="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",Ra={primary:Ca,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"},lo={full:"w-full",default:"w-fit"},ka="opacity-50 cursor-not-allowed pointer-events-none",Ta="opacity-100 cursor-pointer",Sa={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},wa={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function Fa(e){return !e||e==="default"||e==="brand"?"primary":e}function Na(e){let{variant:r="primary",size:t="md",isDisabled:o,fullWidth:n=false,isLoading:i=false}=e,a=Fa(r),s=a==="unstyled"?"":`${Pa} ${Ra[a]}`;a!=="unstyled"&&(s+=` ${$[t].text} ${$[t].height} ${$[t].padding} ${$[t].gap}`),o||i?s+=` ${ka}`:s+=` ${Ta}`,n?s+=` ${lo.full}`:s+=` ${lo.default}`;let l=a==="primary"?"focus-visible:outline-action-primary":void 0;return [s,Ge(),l].filter(Boolean).join(" ")}function S(e){let{icon:r,children:t,isLoading:o=false,loadingText:n,loadingIndicator:i,size:a="md",iconPosition:s="left",iconWeight:l,href:c,className:u,badgeNumber:d,badgeVariant:f="primary",badgePosition:v="top-right",style:g,target:m,rel:x,...C}=e,R=r?jsx(P,{name:r,size:a,weight:l}):null,H=jsxs(Fragment,{children:[s==="left"&&R,typeof t=="function"?null:t,s==="right"&&R]}),B=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(P,{name:"CircleNotch",size:a,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:H}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),M=(d??0)>0,w=twMerge(Na(e),u),N=c?{href:c,target:m,rel:x,...C}:{};if(c){let{onPress:I,onPressStart:se,onPressEnd:O,onPressChange:me,onPressUp:J,onAuxClick:Y,onContextMenu:fe,onDoubleClick:W,...k}=C;Object.assign(N,k);}let Z=c?jsx(Link,{...N,...o&&{"aria-busy":true},style:M?void 0:g,className:w,children:o?B:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&R,t(I),s==="right"&&R]})}):H}):jsx(Button,{...C,...o&&{"aria-busy":true},style:M?void 0:g,className:w,children:o?B:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&R,t(I),s==="right"&&R]})}):H});return M?jsxs("div",{className:twMerge("relative flex",u),style:g,children:[Z,jsx("span",{className:`absolute ${Sa[v]} flex h-5 w-5 items-center justify-center rounded-full ${wa[f]} text-xs font-medium`,"aria-label":`${d} items`,children:d})]}):Z}function qe({transparent:e=false,className:r,children:t,...o}){return jsx(ModalOverlay,{...o,className:composeRenderProps(r,(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 za({isEntering:e,isExiting:r,className:t="",disableGroup:o=false}){let n=[!o&&"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=r?["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 ot({children:e,showArrow:r=false,withBackdrop:t=false,className:o,isDismissable:n=true,disableGroup:i=false,...a}){let l=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=r?12:8;c=l?c-6:c;let u=jsxs(Popover,{offset:c,...a,className:composeRenderProps(o,(d,f)=>za({...f,className:d,disableGroup:i})),children:[r&&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(qe,{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 co(e=true){let[r,t]=useState(null);return useEffect(()=>{if(!e){t(null);return}let o=typeof window<"u"?window.visualViewport:null;if(!o)return;let n=()=>{let i=Math.max(0,window.innerHeight-o.height-(o.offsetTop??0));t({height:o.height,keyboardOffset:i});};return n(),o.addEventListener("resize",n),o.addEventListener("scroll",n),()=>{o.removeEventListener("resize",n),o.removeEventListener("scroll",n);}},[e]),r}function ar({action:e,defaultVariant:r,defaultSize:t="lg"}){let o=!!e.formId;return jsx(S,{type:o?"submit":"button",form:o?e.formId:void 0,size:e.size||t,variant:e.variant||r,onPress:o?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function sr({primaryAction:e,secondaryAction:r,tertiaryAction:t,footerContent:o}){let n=e||r||t;return !n&&!o?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${o?"h-28":""}`,children:[o&&jsx("div",{className:"flex h-10 justify-center",children:o}),n&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:t&&jsx(ar,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[r&&jsx(ar,{action:r,defaultVariant:"secondary"}),e&&jsx(ar,{action:e,defaultVariant:"primary"})]})]})]})}var Ga={heading:{sm:Ie.headingSm,md:Ie.headingMd,lg:Ie.headingLg,xl:Ie.headingXl},display:{sm:Ie.displaySm,md:Ie.displayMd,lg:Ie.displayLg,xl:Ie.displayXl}},qa={page:"h-16 leading-[62px]"};function xt({tag:e="h1",variant:r="heading",size:t="lg",height:o,className:n="",children:i}){let a=t==="xs"?"sm":t,s=Ga[r][a],l=o?qa[o]:"";return jsx(e,{className:Lt(s,"text-text-primary",l,n),children:i})}var at=({title:e,onClose:r,hideCloseIcon:t=false,titleAlign:o="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",o==="center"?"justify-center":""),children:[n&&jsx(S,{variant:"icon",onPress:i,className:"absolute left-6","aria-label":"Go back",children:jsx(P,{name:"CaretLeft","data-testid":"back-arrow"})}),a||jsxs(Fragment,{children:[e&&jsx(xt,{size:"xs",children:e}),r&&!t&&jsx(S,{variant:"icon",onPress:r,"aria-label":"Close dialog",children:jsx(P,{name:"X","data-testid":"close-button"})})]})]});var ja=createContext(false);createContext(null);function mo({children:e}){return jsx(ja.Provider,{value:true,children:e})}var Se=({width:e,height:r,variant:t="rect",animation:o="pulse",gradient:n=false,flex:i=false,stack:a,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:d,"data-testid":f})=>{let[v,g]=useState(l===0);if(useEffect(()=>{if(l>0){let M=setTimeout(()=>g(true),l);return ()=>clearTimeout(M)}},[l]),!v)return null;let m=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)]",x=c&&e?(()=>{let M=typeof e=="number"?e:parseFloat(String(e));return isNaN(M)?"":`animation-duration-[${Math.max(.8,M/100)}s]`})():"",C=o==="pulse"?`animate-pulse ${x}`:o==="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 ${x}`:"",R="rounded-sm";t==="circle"&&(R="rounded-full"),t==="text"&&(R="h-4 w-full rounded-sm");let H=i?"flex-1 min-w-0":"",B=s?Object.entries(s).map(([M,w])=>`${M}:w-[${w}]`).join(" "):"";return a?jsx("div",{className:"space-y-2","data-testid":f,children:a.map((M,w)=>jsx("div",{className:twMerge(m,C,R,H,B,d),style:{width:M,height:r}},w))}):jsx("div",{className:twMerge(m,C,R,H,B,d),style:{width:e,height:r},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":f})};var Ja={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"},ei="rounded-lg",cr={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},ti={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function go(e){return Ct__default.Children.toArray(e).some(r=>Ct__default.isValidElement(r)?r.type===Ct__default.Fragment?go(r.props.children):r.type===vt&&!!r.props.title:false)}function we({variant:e="outlined",className:r,children:t,isLoading:o=false,layout:n="default"}){let i=go(t)?jsx(mo,{children:t}):t;return jsx("div",{className:twMerge("w-full overflow-hidden",Ja[e],ei,n==="flex"&&"flex flex-col",r),"data-testid":"card",children:o?jsx(Se,{width:"100%",height:"100%",className:"rounded-none"}):i})}function vt({title:e,subtitle:r,actions:t,leading:o,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})]}),r&&jsx(Se,{width:200,height:16})]}):!e&&!r&&!t&&!o?null:jsx("div",{className:twMerge("p-6 pb-4",n),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[o&&jsx("div",{className:"flex-shrink-0",children:o}),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}),r&&jsx("div",{className:Qr("bodySm","text-text-secondary"),children:r})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function ho({src:e,alt:r,aspectRatio:t="auto",className:o,children:n,isLoading:i=false}){return i?jsx("div",{className:twMerge("bg-background-muted",cr[t],o),children:jsx(Se,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",cr[t],o),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",cr[t],o),children:jsx("img",{src:e,alt:r||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Dt({className:e,children:r,isLoading:t=false,fill:o=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,o&&"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})]})}):r?jsx("div",{className:twMerge(a,"text-text-primary",o&&"flex-1 flex flex-col min-h-0",e),style:n,children:r}):null}function bo({className:e,children:r,align:t="end",isLoading:o=false}){return o?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})]}):r?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",ti[t],e),children:r}):null}we.Header=vt;we.Media=ho;we.Content=Dt;we.Footer=bo;var Pt=class extends Component{constructor(){super(...arguments);Zt(this,"state",{hasError:false});Zt(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,o){console.error("Error Boundary caught an error:",t,o);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(we,{children:[this.props.title&&jsx(we.Header,{title:this.props.title}),jsx(we.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 ai=.3,ii=.5;function st({children:e,title:r,headerContent:t,titleAlign:o="left",hideCloseIcon:n=false,hasBackArrow:i=false,onBack:a,isOpen:s,onClose:l,isDismissable:c=true,transparentOverlay:u=false,primaryAction:d,secondaryAction:f,footerContent:v,maxHeight:g="80vh",height:m,maxWidth:x="640px",contentPadding:C=true,showHandle:R=true,animationVariant:H="scale",className:B}){let[M,w]=useState(false),[N,Z]=useState(0),[I,se]=useState(false),O=co(s),me=O?.height??null,J=O?.keyboardOffset??0,Y=useRef(null),fe=useRef(null),W=useRef(null),k=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let y=setTimeout(()=>{w(true),setTimeout(()=>w(false),600);},400);return ()=>clearTimeout(y)}},[s]),useEffect(()=>{s||(Z(0),se(false),k.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let y=fe.current;if(!y||!s)return;let X=null,G=ee=>{let Pe=ee.target;Pe&&["INPUT","TEXTAREA","SELECT"].includes(Pe.tagName)&&(X&&clearTimeout(X),X=setTimeout(()=>{Pe.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return y.addEventListener("focusin",G),()=>{y.removeEventListener("focusin",G),X&&clearTimeout(X);}},[s]);let oe=useCallback(y=>{c&&(y.pointerType!=="touch"&&y.pointerType!=="pen"||(W.current&&(clearTimeout(W.current),W.current=null),k.current={isDragging:true,startY:y.clientY,startTime:Date.now(),pointerId:y.pointerId},se(false),y.currentTarget.setPointerCapture(y.pointerId)));},[c]),Ne=useCallback(y=>{let{isDragging:X,startY:G,pointerId:ee}=k.current;if(!X||y.pointerId!==ee)return;let Pe=y.clientY-G;Z(Math.max(0,Pe));},[]),le=useCallback(y=>{let{isDragging:X,startY:G,startTime:ee,pointerId:Pe}=k.current;if(!X||y.pointerId!==Pe)return;let T=y.clientY-G,ke=Date.now()-ee,De=T/ke;k.current={isDragging:false,startY:0,startTime:0,pointerId:null};let Ae=(Y.current?.getBoundingClientRect().height??0)*ai;(T>Ae||De>ii&&T>50)&&c?(l?.(),Z(0)):(se(true),Z(0),W.current=setTimeout(()=>{se(false),W.current=null;},200));},[c,l]);if(!s)return null;let de=r||t,ue=d||f||v;return jsx(Pt,{children:jsx(qe,{isOpen:s,onOpenChange:y=>{y||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",H==="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)]",H==="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)]",B),style:{maxWidth:x,...m?{height:m}:{maxHeight:/\d/.test(g)?me!==null?`min(${g}, ${Math.max(me-8,0)}px, 100dvh)`:`min(${g}, 100dvh)`:g}},children:[R&&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:oe,onPointerMove:Ne,onPointerUp:le,onPointerCancel:le,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",M&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),de&&(i?jsx(at,{title:r,headerContent:t,titleAlign:o,hideCloseIcon:n||!l,hasBackArrow:true,onBack:a??(()=>{}),onClose:l||(()=>{})}):jsx(at,{title:r,headerContent:t,titleAlign:o,hideCloseIcon:n||!l,onClose:l||(()=>{})})),jsx("div",{ref:fe,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",C?"p-4":"p-0"),children:e}),ue&&jsx(sr,{primaryAction:d,secondaryAction:f,footerContent:v})]})})})})})}st.displayName="Tray";var xr=createContext("md");function Ro(){return useContext(xr)}function gr(e="md"){let r=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} ${r}`}function pi(){let e=Ct__default.useCallback((t,o)=>{o?.(t);},[]),r=Ct__default.useCallback((t,o)=>{o?.(t);},[]);return {handleFocus:e,handleBlur:r}}function yr({label:e,description:r,errorMessage:t,children:o,items:n,renderItem:i,renderSelectedValue:a,size:s="md",selectedKey:l,defaultSelectedKey:c,onSelectionChange:u,placeholder:d,showErrors:f=false,tooltip:v,isRequired:g,transparent:m,reserveErrorSpace:x=false,placement:C="bottom start",shouldFlip:R=true,menuWidth:H="match",descriptionPlacement:B="below",useMobileTray:M=true,...w}){let[N,Z]=useState(null),[I,se]=useState(null),[O,me]=useState(false),J=l??N??c,{handleFocus:Y,handleBlur:fe}=pi(),{isMobile:W}=Nt(),k=M&&W,oe=Ct__default.useMemo(()=>!a||!J||!n?null:Array.from(n).find(X=>X.id===J)??null,[a,J,n]),Ne=y=>{u&&y!==null&&u(y),u||Z(y);},le=useRef(null),de=useRef(null),ue=()=>{k&&me(!O);};return jsxs(Fragment,{children:[jsx(Select,{...w,selectedKey:J,defaultSelectedKey:c,onSelectionChange:Ne,placeholder:d,className:j(w.className,"group flex w-full flex-col"),ref:le,onOpenChange:y=>{k||(y&&de.current?se(de.current.offsetWidth):y||le.current?.blur());},children:({isDisabled:y,isInvalid:X,isOpen:G})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:s,tooltip:v,description:B==="tooltip"||B==="inline"?r:void 0,descriptionPlacement:B,isRequired:g,children:e}),jsx(ae,{children:jsx("div",{ref:de,children:jsxs(S,{variant:"unstyled",className:twMerge(pe({isInvalid:X||f&&!!t,isDisabled:y,isFocused:k?O:G,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:ee=>Y(ee,w.onFocus),onBlur:ee=>fe(ee,w.onBlur),onPress:k?ue:void 0,"data-open":k?O:G,children:[a&&oe?jsx("div",{className:gr(s),children:a(oe)}):k&&J?jsx("div",{className:gr(s),children:n?Array.from(n).find(T=>T.id===J)?.label:String(J)}):jsx(SelectValue,{className:gr(s)}),jsx(P,{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",(k?O:G)&&"rotate-180")})]})})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:f?jsx(b,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&w.validationResult?t(w.validationResult):typeof t=="string"?t:null}):r&&B==="below"?jsx(F,{size:s,children:r}):null}):jsx(Fragment,{children:f?jsx(b,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&w.validationResult?t(w.validationResult):typeof t=="string"?t:null}):r&&B==="below"?jsx(F,{size:s,className:"mt-1",children:r}):null}),k?null:jsx(ot,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:H==="match"&&I?`${I}px`:void 0,minWidth:H==="auto"&&I?`${I}px`:void 0,maxWidth:H==="auto"?"min(600px, 90vw)":void 0},placement:C,shouldFlip:R,children:jsx(xr.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?ee=>jsx($e,{id:ee.id,textValue:ee.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:i(ee)})},ee.id):o})})})]})}),k&&jsx(st,{isOpen:O,onClose:()=>me(false),title:e??"Select an option",contentPadding:false,children:jsx(xr.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:y=>{let X=Array.from(y)[0];X!=null&&(Ne(X),me(false));},children:i&&n?y=>jsx($e,{id:y.id,textValue:y.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:i(y)})},y.id):o})})})]})}function $e({size:e,className:r,...t}){let o=Ro(),n=e??o;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,r)})}var Be=({className:e,size:r=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:r,height:r},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});var Ti=[],Si={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},wi={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},So={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},Pr=(e,r,t)=>{if(e==null||e==="")return "";let n=(t?t.flatMap(i=>i.items):r||[]).find(i=>i.id===e);return n?n.name:""};async function Fi(e,r,t){try{let o=e.url.replace("{q}",r),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,c])=>{n.append(l,c.toString());});let i=`${o}${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(o){if(o instanceof Error&&o.name==="AbortError")return {items:[]};console.error("Error in REST request:",o);let n=o instanceof Error?o.message:"Unknown error occurred";return {items:[],error:n}}}async function Ni(e,r,t){try{let o=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${r}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:o}),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(o){if(o instanceof Error&&o.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",o);let n=o instanceof Error?o.message:"Unknown error occurred";return {items:[],error:n}}}function Cr({label:e,staticItems:r=Ti,sections:t,selectedKey:o,defaultSelectedKey:n,onSelectionChange:i,requestConfig:a,defaultFilter:s,placeholder:l,errorMessage:c,description:u,size:d="md",tooltip:f,isRequired:v,isDisabled:g,isInvalid:m,validationResult:x,showErrors:C=true,renderItem:R,renderLeftIcon:H,renderSection:B,autoFocus:M=false,reserveErrorSpace:w=false,hideChevron:N=false,useMobileTray:Z=true,className:I}){let se=Ct__default.useRef(null),O=Ct__default.useRef(null),[me,J]=Ct__default.useState(),[Y,fe]=useState(()=>Pr(o||n,r,t)),[W,k]=useState(false),[oe,Ne]=useState(false),le=jr(Y),{contains:de}=useFilter({sensitivity:"base"}),[ue,y]=useState(),{isMobile:X}=Nt(),G=Z&&X,ee=$[d].text,Pe=useAsyncList({async load({signal:E,filterText:D=""}){if(!a)return {items:[]};if(!a.url||a.shouldLoad&&!a.shouldLoad(D))return {items:[]};try{let ne;return a.requestType==="GraphQL"?ne=await Ni(a,D,E):ne=await Fi(a,D,E),y(ne.error),{items:ne.items}}catch(ne){return ne instanceof Error&&ne.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ne),y(ne instanceof Error?ne.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),T=a&&le!==""?Pe:null,ke=false,De=useRef("");useEffect(()=>{M&&k(true);},[M]),useEffect(()=>{let E=Pr(o,r,t);E!==Y&&fe(E);},[o,r,t]),useEffect(()=>{let E=()=>{se.current&&J(se.current.offsetWidth);};return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]),useEffect(()=>{le===""?De.current="":T&&le!==De.current&&(De.current=le,T.setFilterText(le));},[le,T]),ke=It(!!T?.isLoading,300);let ye=Ct__default.useMemo(()=>{if(!G||!Y)return T?T.items:r;let E=T?T.items:r,D=s??(a?()=>true:de);return E.filter(ne=>D(ne.name,Y))},[G,Y,T,r,s,de]),Ae=E=>{let D=Pr(E,r,t);fe(D),i&&i(E);},He=E=>{fe(E);},_e=()=>{G&&Ne(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:Ae,selectedKey:o||void 0,defaultSelectedKey:n||void 0,items:T?T.items:t?t.flatMap(E=>E.items):r,className:j(I,"group flex flex-col w-full"),menuTrigger:G?"manual":a?"input":"focus",allowsEmptyCollection:!!a,isDisabled:g,isInvalid:m||!!c,inputValue:Y,onInputChange:He,autoFocus:M&&!G,defaultFilter:s??(a?()=>true:de),"aria-label":e||l||"Autocomplete",children:E=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:d,tooltip:f,isRequired:v,children:e}),jsxs(ae,{ref:se,children:[H?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:H(ke)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:ke?jsx(Be,{size:16,color:"text-text-secondary"}):jsx(P,{name:"MagnifyingGlass",className:`${Si[d]} text-text-secondary`})}),jsx(Input,{className:pe({isInvalid:m||!!c,isDisabled:g,isFocused:W||(G?oe:E.isOpen),size:d,className:twMerge(wi[d],Y&&!g||!N&&!Y?"pr-10":"pr-3",G&&"cursor-pointer",I)}),placeholder:l,disabled:g,onFocus:D=>{k(true),G&&(D.currentTarget.blur(),_e());},onBlur:()=>{k(false);},onClick:G?_e:void 0,readOnly:G,"aria-label":e||l||"Autocomplete"}),Y&&!g&&jsx(ft,{onClick:()=>{fe(""),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:g,children:({isPressed:D})=>jsx(P,{name:D?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),w?jsx("div",{className:"mt-1 min-h-[20px]",children:C&&ue?jsx(b,{size:d,className:"text-feedback-error-text",children:ue}):C&&typeof c=="string"?jsx(b,{size:d,className:"text-feedback-error-text",children:c}):C&&typeof c=="function"&&x?jsx(b,{size:d,className:"text-feedback-error-text",children:c(x)}):u?jsx(F,{size:d,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(F,{size:d,className:"mt-1",children:u}),C&&ue&&jsx(b,{size:d,className:"text-feedback-error-text mt-1",children:ue}),C&&typeof c=="string"&&jsx(b,{size:d,className:"text-feedback-error-text mt-1",children:c}),C&&typeof c=="function"&&x&&jsx(b,{size:d,className:"text-feedback-error-text mt-1",children:c(x)})]}),!G&&jsx(ot,{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:me?`${me}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||l||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${ee}`,children:t?t.map(D=>{let ne=D.items.map(ve=>jsx($e,{id:ve.id,textValue:ve.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${So[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:R?R(ve):ve.name},ve.id));if(B){let ve=B(D,ne);return Ct__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}),ne]},D.name)}):D=>jsx($e,{id:D.id,textValue:D.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${So[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:R?R(D):D.name},D.id)})})]})}),G&&jsx(st,{isOpen:oe,onClose:()=>Ne(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(ae,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:ke?jsx(Be,{size:16,color:"text-text-secondary"}):jsx(P,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:O,type:"text",value:Y,onChange:E=>He(E.target.value),placeholder:l,autoFocus:true,className:pe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),Y&&jsx(ft,{onClick:()=>{fe(""),i?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||l||"Suggestions",items:ye,selectedKeys:o?[o]:[],selectionMode:"single",onSelectionChange:E=>{let D=Array.from(E)[0];D&&(Ae(D),Ne(false));},className:"bg-background-input outline-none",children:E=>jsx($e,{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:R?R(E):E.name},E.id)})})]})})]})}function _(e,r){let t=r.split("."),o=e;for(let i of t)if(o&&typeof o=="object"&&i in o)o=o[i];else {o=void 0;break}let n=o?.message;return typeof n=="string"?n:void 0}function Up({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Cr,{...t,selectedKey:a.value??null,onSelectionChange:s=>a.onChange(s),showErrors:!!i,errorMessage:i})})}var Ai="focus:ring-action-primary",Hi="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function Io(e){return jsxs(CheckboxGroup,{...e,className:j(e.className,"flex flex-col gap-2"),children:[jsx(U,{children:e.label}),e.children,e.description&&jsx(F,{children:e.description}),jsx(b,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function _i({isDisabled:e}){return `relative flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function zi({isSelected:e,isInvalid:r,isDisabled:t,isIndeterminate:o}){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=Ai,a="";return t?a="border-border-muted bg-background-muted":r?a="border-feedback-error-border bg-feedback-error-background":e||o?a=Hi:a="bg-background-input border-border-input hover:border-border-focus",`${n} ${i} ${a}`}var No="w-4 h-4 text-current group-disabled:text-text-disabled";function Rr({className:e,...r}){return jsx("div",{"aria-hidden":"true",className:`${zi(r)} ${e||""}`,children:r.isIndeterminate?jsx(Minus,{"aria-hidden":true,className:No}):r.isSelected?jsx(Check,{"aria-hidden":true,className:No}):null})}function Lo(e){let{children:r,variant:t,...o}=e;return jsx(Checkbox,{...o,className:composeRenderProps(e.className,(n,i)=>`${_i(i)} ${n||""}`),children:n=>{let{isSelected:i,isIndeterminate:a,isDisabled:s,isInvalid:l}=n;return jsxs(Fragment,{children:[jsx(Rr,{isSelected:i,isIndeterminate:a,isDisabled:s,isInvalid:l}),typeof r=="function"?r(n):r]})}})}function dm({name:e,defaultValue:r,errorBelow:t=false,...o}){let{control:n,formState:i}=useFormContext(),a=_(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:r,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Lo,{...o,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!a,children:o.children}),t&&a&&jsx(b,{children:a})]})})}function gm({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Io,{...t,value:a.value||[],onChange:s=>a.onChange(s),errorMessage:i,children:t.children})})}function lt(e){if(!e)return false;let r=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(r)}function Sr(e){if(!e)return "";let r=e.startsWith("#")?e.slice(1):e;return r.length===3&&(r=r.split("").map(t=>t+t).join("")),`#${r.toUpperCase()}`}function Bo({label:e,description:r,errorMessage:t,size:o="md",tooltip:n,isRequired:i,transparent:a,className:s,validationResult:l,value:c,defaultValue:u,onChange:d,placeholder:f="#000000",showColorSwatch:v=true,reserveErrorSpace:g=true,...m}){let[x,C]=useState(u||""),[R,H]=useState(c||u||""),[B,M]=useState(false),[w,N]=useState(null),{isFocused:Z,handleFocus:I,handleBlur:se}=Le(),O=c!==void 0?c:x;useEffect(()=>{c!==void 0&&H(c);},[c]);let me=O?!lt(O):false,J=useCallback(W=>{if(H(W),lt(W)){let k=Sr(W);d?d(k):C(k);}else W===""&&(d?d(""):C(""));},[d]),Y=useCallback(W=>{let k=Sr(W);H(k),d?d(k):C(k);},[d]),fe=useCallback(W=>{if(lt(R)){let k=Sr(R);H(k),d&&k!==O?d(k):!d&&k!==x&&C(k);}se(W,m.onBlur);},[R,O,x,d,se,m.onBlur]);return jsx(TextField,{...m,isRequired:i,className:j(s,"group flex flex-col"),children:({isDisabled:W})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:o,tooltip:n,isRequired:i,children:e}),jsx(ae,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(Bt,{size:o,disabled:W,type:"text",value:R,placeholder:f,onFocus:k=>I(k,m.onFocus),onBlur:fe,onChange:k=>J(k.target.value),className:twMerge(pe({isInvalid:me,isDisabled:W,isFocused:Z,size:o,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:$[o].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",lt(O)?"border-border-default":"border-border-default bg-background-muted"),style:lt(O)?{backgroundColor:O}:void 0,"aria-hidden":"true",children:!lt(O)&&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:o,icon:"Palette",onPress:()=>M(!B),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:o,children:t}):typeof t=="function"&&l?jsx(b,{size:o,children:t(l)}):r?jsx(F,{size:o,children:r}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:o,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(b,{size:o,className:"mt-1",children:t(l)}):r?jsx(F,{size:o,className:"mt-1",children:r}):null}),B&&w&&jsx(ot,{triggerRef:{current:w},isOpen:B,onOpenChange:M,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:O||"#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:O||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:O||"#000000"})]})]})})]})})}function Mm({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Bo,{...t,value:a.value??"",onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i})})}function ls({isSelected:e,isDisabled:r}){let t=[Ge,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return r?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 Fr({errorMessage:e,...r}){return jsxs(Calendar,{...r,children:[jsx(Ao,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Ho,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:o,isDisabled:n})=>`${ls({isSelected:o,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function Ao(){let{direction:e}=useLocale(),r=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(P,{name:"CaretRight","aria-hidden":true,size:r}):jsx(P,{name:"CaretLeft","aria-hidden":true,size:r})}),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(P,{name:"CaretLeft","aria-hidden":true,size:r}):jsx(P,{name:"CaretRight","aria-hidden":true,size:r})})]})}function Ho(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function Ir({label:e,description:r,errorMessage:t,size:o="md",tooltip:n,isRequired:i,isDisabled:a,isInvalid:s,showCalendar:l=true,reserveErrorSpace:c=true,validationResult:u,className:d,...f}){let[v,g]=useState(false),m=x=>{f.onChange&&x&&f.onChange(x),g(false);};return jsxs(DateField,{...f,isDisabled:a,isRequired:i,isInvalid:s,className:j(d,"flex flex-col gap-1"),children:[e&&jsx(U,{size:o,tooltip:n,isRequired:i,children:e}),jsx(ae,{children:jsxs("div",{className:"relative w-full",children:[jsx(zo,{size:o,isDisabled:a,isInvalid:s,hasCalendar:l}),l&&!a&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:g,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(P,{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(Fr,{value:f.value,onChange:m,minValue:f.minValue,maxValue:f.maxValue,isDisabled:a,isReadOnly:f.isReadOnly,isDateUnavailable:f.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:o,children:t}):typeof t=="function"&&u?jsx(b,{size:o,children:t(u)}):r?jsx(F,{size:o,children:r}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:o,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(b,{size:o,className:"mt-1",children:t(u)}):r?jsx(F,{size:o,className:"mt-1",children:r}):null})]})}function hs({isPlaceholder:e,isDisabled:r,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",r?"text-text-disabled cursor-not-allowed":"cursor-text",!r&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function zo({size:e="md",isDisabled:r,isInvalid:t,hasCalendar:o,className:n,...i}){return jsx(DateInput,{className:twMerge(gt({isInvalid:t,isDisabled:r}),"px-3 py-2 flex items-center gap-0.5 w-full",o&&"pr-10",n),...i,children:a=>jsx(DateSegment,{segment:a,className:hs({isPlaceholder:a.isPlaceholder,isDisabled:!a.isEditable||r,size:e})})})}function mf({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Ir,{...t,value:a.value??null,onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i})})}function Lr({value:e,onChange:r,onUrlChange:t,accept:o="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),[f,v]=useState(false),[g,m]=useState(null),[x,C]=useState(e),R=useRef(null),H=async w=>{if(m(null),n&&w.size>n){m(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(l&&w.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{C(N.result);},N.readAsDataURL(w);}if(a){v(true);try{let N=await a(w);C(N),t?.(N);}catch(N){m("Failed to upload file"),console.error("Upload error:",N);}finally{v(false);}}r?.(w,x);},B=async w=>{try{let N=w.items;if(N.length>0){let Z=N[0];if(Z.kind==="file"){let I=await Z.getFile();I&&H(I);}}}catch(N){m("Failed to upload file"),console.error("Upload error:",N);}finally{d(false);}},M=()=>{C(void 0),m(null),r?.(null),t?.(""),R.current&&(R.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",g&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:B,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[x?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&(x.startsWith("data:image")||x.startsWith("http"))?jsx("img",{src:x,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:M,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:o==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${o}`})]}),jsx(FileTrigger,{acceptedFileTypes:o.split(","),onSelect:w=>{let N=Array.from(w||[]);N.length>0&&H(N[0]);},children:jsx(S,{variant:"secondary",size:"sm",isDisabled:i,children:"Choose File"})})]}),f&&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..."})]})})]}),g&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Nf({name:e,defaultValue:r,errorBelow:t=true,...o}){let{control:n,formState:i}=useFormContext(),a=_(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:r,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Lr,{...o,value:s.value??"",onChange:(l,c)=>s.onChange(c||"")}),t&&a&&jsx(b,{children:a})]})})}var Is={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 Wo(e){return !e||e==="default"?"secondary":e==="brand"?"primary":e}var Ls={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"},Es="opacity-75 cursor-not-allowed pointer-events-none";function Go(e){let{variant:r,size:t,isDisabled:o,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",Ls[t],a,Is[r],n&&!o&&"cursor-pointer",o&&Es,i)}function qo({children:e,onRemove:r,removeLabel:t="Remove",size:o="md",variant:n="secondary",isRemovable:i=true,isDisabled:a=false,className:s,onClick:l}){let c=!!l&&!a,u=i&&r&&!a,d=x=>{x.stopPropagation(),x.preventDefault(),r&&!a&&r();},f=()=>{l&&!a&&l();},v=o==="xs"?10:o==="sm"?12:o==="md"?14:16,m=jsxs(Fragment,{children:[jsx("span",{className:"truncate",children:e}),u?c?jsx("span",{onClick:d,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(x));},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(P,{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(P,{name:"X",size:v,className:"text-current opacity-70 hover:opacity-100"})}):null]});return c?jsx("button",{type:"button",onClick:f,className:Go({variant:Wo(n),size:o,isDisabled:a,isClickable:c,className:s}),disabled:a,children:m}):jsx("span",{className:Go({variant:Wo(n),size:o,isDisabled:a,isClickable:c,className:s}),children:m})}var Bs=(e,r)=>e.toLocaleLowerCase().includes(r.toLocaleLowerCase());function Ds(e){return [e.value,e.label]}function Uo(e,r,t=Bs){let o=r.trim();return o===""?[...e]:e.filter(n=>Ds(n).some(i=>t(i,o)))}function Ko(e){let r=e.query.trim();if(r==="")return false;let t=r.toLocaleLowerCase();return e.options.some(n=>n.value.toLocaleLowerCase()===t||n.label.toLocaleLowerCase()===t)?false:!e.selected.some(n=>n.toLocaleLowerCase()===t)}function Yo(e,r){return e.map(t=>{let o=r.find(n=>n.value===t);return o?o.count===void 0?{value:t,label:o.label,isUnknown:false}:{value:t,label:o.label,count:o.count,isUnknown:false}:{value:t,label:t,isUnknown:true}})}var zs=e=>e.kind==="literal"?`literal:${e.value}`:`option:${e.option.value}`,Mr=e=>e.kind==="literal"?e.value:e.option.value,jo=e=>e.kind==="literal"?e.value:e.option.label,Os={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},$s={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},Ws={sm:"xs",md:"xs",lg:"sm",xl:"sm"};function Vr({options:e,value:r,defaultValue:t,onChange:o,label:n,placeholder:i,size:a="md",loading:s=false,disabled:l=false,maxSelected:c,allowLiteral:u=false,onSearchChange:d,truncated:f=false,totalCount:v,emptyMessage:g,showSelectAll:m=false,description:x,errorMessage:C,isRequired:R=false,onBlur:H,inputRef:B,labelHidden:M=false,className:w,id:N}){let Z=useId(),I=N??`multiselect-${Z}`,se=`${I}-input`,O=`${I}-listbox`,me=useRef(null),J=useCallback(p=>{me.current=p,typeof B=="function"?B(p):B&&(B.current=p);},[B]),{contains:Y}=useFilter({sensitivity:"base"}),{isFocused:fe,handleFocus:W,handleBlur:k}=Le(),[oe,Ne]=useState(""),[le,de]=useState(true),[ue,y]=useState(null),[X,G]=useState(""),[ee,Pe]=useState(()=>[...t??[]]),T=useMemo(()=>r?[...r]:ee,[r,ee]),ke=useMemo(()=>Uo(e,oe,Y),[e,oe,Y]),De=u&&!s&&Ko({query:oe,options:e,selected:T}),ye=useMemo(()=>{let p=ke.map(te=>({kind:"option",option:te}));return De?[{kind:"literal",value:oe.trim()},...p]:p},[ke,De,oe]),Ae=useMemo(()=>Yo(T,e),[T,e]),He=c!==void 0&&T.length>=c,_e=useCallback((p,te)=>{r||Pe(p),G(`${te} ${p.length} selected.`),o(p);},[o,r]),E=useCallback((p,te)=>{if(!l){if(T.includes(p)){_e(T.filter(ze=>ze!==p),`${te} removed.`);return}He||_e([...T,p],`${te} selected.`);}},[He,_e,l,T]),D=useCallback(p=>{p.kind==="option"&&p.option.disabled||E(Mr(p),jo(p));},[E]),ne=p=>{if(l||p.length===0)return;let te=new Set(p),ze=p.map(Ve=>Ae.find(Xt=>Xt.value===Ve)?.label??Ve);_e(T.filter(Ve=>!te.has(Ve)),`${ze.join(", ")} removed.`);},ve=p=>{Ne(p),y(null),de(true),d?.(p);},Yr=p=>{if(ye.length===0){y(null);return}y(te=>te===null?p>0?0:ye.length-1:(te+p+ye.length)%ye.length);},fn=p=>{if(l)return;let te=ue===null?void 0:ye[ue];switch(p.key){case "ArrowDown":p.preventDefault(),de(true),Yr(1);break;case "ArrowUp":p.preventDefault(),de(true),Yr(-1);break;case "Home":ye.length>0&&(p.preventDefault(),de(true),y(0));break;case "End":ye.length>0&&(p.preventDefault(),de(true),y(ye.length-1));break;case "Enter":te&&(p.preventDefault(),D(te));break;case " ":oe===""&&te&&(p.preventDefault(),D(te));break;case "Escape":p.preventDefault(),oe!==""?ve(""):(de(false),y(null));break;case "Backspace":oe===""&&T.length>0&&(p.preventDefault(),ne([T[T.length-1]]));break;}},Xe=ke.filter(p=>!p.disabled&&!T.includes(p.value)).map(p=>p.value),gn=c===void 0?Xe.length:Math.max(0,c-T.length),pt=Math.min(Xe.length,gn),hn=pt===Xe.length?`Select all ${Xe.length} matching`:`Select ${pt} of ${Xe.length} matching`,bn=()=>{if(l||pt===0)return;let p=Xe.slice(0,pt);_e([...T,...p],`${p.length} matching options selected.`);},Qt=s?"loading":e.length===0?"empty":ke.length===0&&oe.trim()!==""?"no-match":null,xn=$[a].text;return jsxs("div",{className:twMerge("flex w-full flex-col gap-1",w),"data-testid":"multiselect",children:[jsx(U,{size:a,htmlFor:se,isRequired:R,...M?{className:"sr-only"}:{},children:n}),jsxs(ae,{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(Be,{size:16,color:"text-text-secondary"}):jsx(P,{name:"MagnifyingGlass",className:twMerge(Os[a],"text-text-secondary")})}),jsx("input",{ref:J,id:se,type:"text",role:"combobox",autoComplete:"off","aria-expanded":le,"aria-controls":O,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-activedescendant":le&&ue!==null&&ye[ue]?`${I}-row-${ue}`:void 0,"aria-required":R||void 0,"aria-invalid":C?true:void 0,value:oe,placeholder:i,disabled:l,onChange:p=>ve(p.target.value),onKeyDown:fn,onFocus:p=>{de(true),W(p);},onBlur:p=>{k(p),H?.(p);},className:pe({isDisabled:l,isFocused:fe,isInvalid:!!C,size:a,className:twMerge($s[a],"pr-3")})})]}),Ae.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:Ae.map(p=>jsx(qo,{size:Ws[a],variant:"primary",isDisabled:l,removeLabel:`Remove ${p.label}`,onRemove:()=>ne([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))}),m&&jsxs("div",{className:"flex items-center gap-2",children:[jsx(S,{variant:"link",size:a,onPress:bn,isDisabled:l||pt===0,children:hn}),jsx(S,{variant:"link",size:a,onPress:()=>ne(T),isDisabled:l||T.length===0,children:"Clear all"})]}),jsx("div",{id:O,role:"listbox","aria-multiselectable":"true","aria-label":`${n} options`,hidden:!le,className:twMerge(xn,"max-h-[260px] overflow-y-auto rounded-[var(--control-border-radius)] border border-border-input bg-background-input"),children:le&&ye.map((p,te)=>{let ze=T.includes(Mr(p)),Ve=l||p.kind==="option"&&p.option.disabled===true||!ze&&He;return jsxs("div",{id:`${I}-row-${te}`,role:"option","aria-selected":ze,"aria-disabled":Ve||void 0,"data-value":Mr(p),"data-literal":p.kind==="literal"?"true":void 0,"data-active":ue===te?"true":void 0,onMouseDown:Xt=>Xt.preventDefault(),onClick:()=>{Ve||(D(p),me.current?.focus());},className:twMerge("flex cursor-default items-center gap-2 px-3",$[a].paddingY,"text-text-primary",ue===te&&"bg-background-hover",ze&&"bg-background-selected font-medium",Ve&&"text-text-disabled"),children:[jsx(Rr,{isSelected:ze,isDisabled:Ve,className:"!w-4 !h-4"}),jsx("span",{className:"flex-1 truncate",children:jo(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()})]},zs(p))})}),Qt==="loading"&&jsx("div",{"data-testid":"multiselect-status-loading","data-status":"loading",children:jsxs(F,{size:a,className:"flex items-center gap-2",children:[jsx(Be,{size:14,color:"text-text-secondary"}),jsx("span",{children:"Loading options\u2026"})]})}),Qt==="empty"&&jsx("div",{"data-testid":"multiselect-status-empty","data-status":"empty",children:jsxs(F,{size:a,className:"flex items-center gap-2",children:[jsx(P,{name:"Tray",className:"h-4 w-4"}),jsx("span",{children:g??"No options available"})]})}),Qt==="no-match"&&jsx("div",{"data-testid":"multiselect-status-no-match","data-status":"no-match",children:jsxs(F,{size:a,className:"flex items-center gap-2 text-feedback-warning-text",children:[jsx(P,{name:"MagnifyingGlass",className:"h-4 w-4"}),jsx("span",{children:`No options match \u201C${oe.trim()}\u201D`})]})}),f&&jsx("div",{"data-testid":"multiselect-truncation",children:jsx(F,{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(F,{size:a,children:He?`${T.length} of ${c} selected \u2014 limit reached, remove one to choose another`:`${T.length} of ${c} selected`})}),x&&jsx(F,{size:a,children:x}),C&&jsx(b,{size:a,children:C}),jsx("div",{"data-testid":"multiselect-live-region",role:"status","aria-live":"polite",className:"sr-only",children:X})]})}function ag({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Vr,{...t,value:a.value??[],onChange:s=>a.onChange(s),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},inputRef:a.ref,errorMessage:i})})}var Xs=e=>{let r=pe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(r,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function Dr({label:e,description:r,errorMessage:t,size:o="md",tooltip:n,isRequired:i,transparent:a,validationResult:s,reserveErrorSpace:l=true,descriptionPlacement:c="below",...u}){let d=useId(),{isFocused:f,handleFocus:v,handleBlur:g}=Le();return jsx(NumberField,{...u,id:d,isRequired:i,className:j(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:m=>{typeof m=="number"&&(u.maxValue!=null&&m>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&m<u.minValue?u.onChange?.(u.minValue):u.onChange?.(m));},isInvalid:!!t||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:m,isInvalid:x})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(U,{size:o,tooltip:n,description:c==="tooltip"||c==="inline"?r:void 0,descriptionPlacement:c,isRequired:i,htmlFor:d,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:R=>v(R,u.onFocus),onBlur:R=>g(R,u.onBlur),className:Xs({isInvalid:x||!!t,isDisabled:m,isFocused:f,transparent:a,size:o,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:m,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(P,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:m,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(P,{name:"CaretDown",size:14})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(b,{size:o,children:typeof t=="function"?t(s):t}):r&&c==="below"?jsx(F,{size:o,children:r}):null}):jsx(Fragment,{children:t?jsx(b,{size:o,className:"mt-1",children:typeof t=="function"?t(s):t}):r&&c==="below"?jsx(F,{size:o,className:"mt-1",children:r}):null})]})})}function kg({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Dr,{...t,value:typeof a.value=="number"?a.value:void 0,onChange:s=>a.onChange(s),isInvalid:!!i,errorMessage:i,isRequired:t.isRequired})})}function Hr({value:e,defaultValue:r,onChange:t,isDisabled:o,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:r,onChange:t,isDisabled:o,isReadOnly:n,isRequired:i,className:j(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:Ct__default.Children.map(s,f=>Ct__default.isValidElement(f)?Ct__default.cloneElement(f,{size:l,variant:c}):f)})}function $g({name:e,defaultValue:r,label:t,description:o,children:n,...i}){let{control:a,formState:s}=useFormContext(),l=_(s.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:r,render:({field:c})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx(U,{children:t}),o&&jsx(F,{children:o}),jsx(Hr,{...i,value:c.value,onChange:u=>c.onChange(u),children:n}),l&&jsx(b,{children:l})]})})}function ll(e){return "primary"}var dl=createContext({variant:"primary"});function _r(e){let{variant:r="primary",...t}=e,o=ll();return jsx(dl.Provider,{value:{variant:o},children:jsxs(RadioGroup,{...t,className:j(e.className,"group flex flex-col gap-2"),children:[jsx(U,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(F,{children:e.description}),jsx(b,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function dh({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(_r,{...t,value:a.value,onChange:s=>a.onChange(s),errorMessage:i,children:t.children})})}var hl=e=>{let r=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(r,t,e.className)};function Ft({label:e,description:r,errorMessage:t,size:o="md",tooltip:n,isRequired:i,transparent:a,showSearchIcon:s,isClearable:l,onClear:c,type:u,validationResult:d,reserveErrorSpace:f=true,isLoading:v=false,descriptionPlacement:g="below",...m}){let[x,C]=Ct__default.useState(false),{isFocused:R,handleFocus:H,handleBlur:B}=Le(),M=u==="password",w=It(v,300);return jsx(TextField,{...m,isRequired:i,className:j(m.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:Z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:o,tooltip:n,description:g==="tooltip"||g==="inline"?r:void 0,descriptionPlacement:g,isRequired:i,children:e}),jsxs(ae,{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}[o];return w?jsx(Be,{size:I,color:"text-text-secondary"}):jsx(P,{name:"MagnifyingGlass",size:I,className:`transition-colors ${R?"text-action-brand":"text-text-secondary"}`})})()}),jsx(Bt,{size:o,disabled:N,type:M?x?"text":"password":u,name:m.name,autoComplete:m.autoComplete,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:I=>H(I,m.onFocus),onBlur:I=>B(I,m.onBlur),onChange:I=>m.onChange?.(I.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[o]}:void 0,className:hl({isInvalid:Z,isDisabled:N,isFocused:R,size:o,transparent:a,showSearchIcon:s,isClearable:l,hasValue:!!m.value,isPassword:M,className:typeof m.className=="string"?m.className:void 0})}),l&&m.value&&!N&&jsx(ft,{onClick:()=>{c?c():m.onChange&&m.onChange("");},size:o}),M&&!N&&jsx("button",{type:"button",onClick:()=>C(!x),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":x?"Hide password":"Show password",onMouseDown:I=>{I.preventDefault(),I.stopPropagation();},children:jsx(P,{name:x?"EyeSlash":"Eye",size:o==="sm"?16:20,className:"text-text-primary"})})]}),f?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:o,children:t}):typeof t=="function"&&d?jsx(b,{size:o,children:t(d)}):r&&g==="below"?jsx(F,{size:o,children:r}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:o,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(b,{size:o,className:"mt-1",children:t(d)}):r&&g==="below"?jsx(F,{size:o,className:"mt-1",children:r}):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"}},ct=({isActive:e=false,onPress:r,children:t})=>jsx(S,{variant:e?"secondary":"ghost",size:"sm",onPress:r,className:"p-1",children:t});function wl({initialUrl:e,isOpen:r,onClose:t,onSubmit:o}){let[n,i]=useState(e);return Ct__default.useEffect(()=>{i(e);},[e]),jsx(qe,{isDismissable:true,isOpen:r,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(),o(n),t();},children:[jsx(at,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(Ft,{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 zr({initialContent:e="",onChange:r,className:t,isDisabled:o=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:[Cl.configure({heading:s.length>0?{levels:s}:false}),xl.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:!o,onUpdate:({editor:g})=>{r?.(g.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${l.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),f=()=>{u(true);},v=g=>{g===""?d?.chain().focus().unsetLink().run():d?.chain().focus().setLink({href:g}).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",o&&"opacity-50",t),style:{outline:"none"},children:[!o&&d&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:d,shouldShow:({editor:g})=>g.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 g=d.getAttributes("link").href;g&&window.open(g,"_blank","noopener,noreferrer");},children:[jsx(P,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:f,children:[jsx(P,{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(P,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(wl,{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(g=>jsx(ct,{isActive:d.isActive("heading",{level:g}),onPress:()=>d.chain().focus().toggleHeading({level:g}).run(),children:jsxs("span",{className:"text-xs font-bold",children:["H",g]})},g)),jsx(ct,{isActive:d.isActive("bold"),onPress:()=>d.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(ct,{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(ct,{isActive:d.isActive("bulletList"),onPress:()=>d.chain().focus().toggleBulletList().run(),children:jsx(P,{name:"ListBullets",className:"h-4 w-4"})}),jsx(ct,{isActive:d.isActive("orderedList"),onPress:()=>d.chain().focus().toggleOrderedList().run(),children:jsx(P,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(ct,{isActive:d.isActive("link"),onPress:f,children:jsx(P,{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",o&&"pointer-events-none")}),d.isEmpty&&!o&&jsx("div",{className:twMerge("pointer-events-none absolute text-text-secondary",l.placeholderPos,l.placeholderText),children:n})]})]}):null}function Gh({name:e,defaultValue:r,label:t,description:o,reserveErrorSpace:n=true,...i}){let{control:a,formState:s}=useFormContext(),l=_(s.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:r,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}),o&&jsx("p",{className:"text-sm text-text-secondary",children:o}),jsx(zr,{...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 Zh({name:e,defaultValue:r,onValueChange:t,...o}){let{control:n,formState:i}=useFormContext(),a=_(i.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:r,render:({field:s})=>jsx(yr,{...o,selectedKey:s.value??null,onSelectionChange:l=>{s.onChange(l),t?.(l);},showErrors:!!a,errorMessage:a})})}var $r={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:r,size:t="md"}){let o="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=$r[t].track,i=Ge,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",[o,n,i,a,s,r?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Dl({isSelected:e,isDisabled:r,size:t="md"}){let o="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",n=$r[t].handle;return [o,n,e?"translate-x-[100%]":"translate-x-0",r?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Wr({children:e,variant:r="primary",size:t="md",...o}){return jsx(Switch,{...o,className:j(o.className,`relative group flex items-center gap-2 ${$r[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:Dl({...n,size:t})})}),e]})})}function cb({name:e,defaultValue:r,...t}){let{control:o}=useFormContext();return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:n})=>jsx(Wr,{...t,isSelected:!!n.value,onChange:i=>n.onChange(i),children:t.children})})}var $l=e=>{let r=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(r,t,e.className)};function Gr({label:e,description:r,errorMessage:t,size:o="md",tooltip:n,required:i,transparent:a,isInvalid:s,isDisabled:l,isResizable:c=false,className:u,validationResult:d,reserveErrorSpace:f=true,...v}){let{isFocused:g,handleFocus:m,handleBlur:x}=Le();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(U,{size:o,tooltip:n,isRequired:i,children:e}),jsx(ae,{children:jsx("textarea",{...v,required:i,onFocus:C=>{v.onFocus&&v.onFocus(C),m(C);},onBlur:C=>{v.onBlur&&v.onBlur(C),x(C);},className:$l({isInvalid:s,isDisabled:l,isResizable:c,isFocused:g,size:o,transparent:a,className:u}),disabled:l})}),f?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:o,children:t}):typeof t=="function"&&d?jsx(b,{size:o,children:t(d)}):r?jsx(F,{size:o,children:r}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:o,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(b,{size:o,className:"mt-1",children:t(d)}):r?jsx(F,{size:o,className:"mt-1",children:r}):null})]})})}function Rb({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Gr,{...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 Nb({name:e,defaultValue:r,...t}){let{control:o,formState:n}=useFormContext(),i=_(n.errors,e);return jsx(Controller,{control:o,name:e,defaultValue:r,render:({field:a})=>jsx(Ft,{...t,value:a.value??"",onChange:s=>a.onChange(s),onBlur:s=>{a.onBlur(),t.onBlur?.(s);},isInvalid:!!i,errorMessage:i,isRequired:t.isRequired})})}function Zl({isPlaceholder:e,isDisabled:r,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",r?"text-text-disabled cursor-not-allowed":"cursor-text",!r&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function qr({label:e,description:r,errorMessage:t,size:o="md",tooltip:n,isRequired:i,isDisabled:a,isInvalid:s,reserveErrorSpace:l=true,validationResult:c,className:u,descriptionPlacement:d="below",...f}){return jsxs(TimeField,{...f,isDisabled:a,isRequired:i,isInvalid:s,className:j(u,"flex flex-col gap-1"),children:[e&&jsx(U,{size:o,tooltip:n,description:d==="tooltip"||d==="inline"?r:void 0,descriptionPlacement:d,isRequired:i,children:e}),jsx(ae,{children:jsx(DateInput,{className:twMerge(gt({isInvalid:s,isDisabled:a}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:Zl({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||a,size:o})})})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(b,{size:o,children:t}):typeof t=="function"&&c?jsx(b,{size:o,children:t(c)}):r&&d==="below"?jsx(F,{size:o,children:r}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(b,{size:o,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(b,{size:o,className:"mt-1",children:t(c)}):r&&d==="below"?jsx(F,{size:o,className:"mt-1",children:r}):null})]})}function jb({name:e,...r}){let{control:t,formState:{errors:o}}=useFormContext(),n=o[e],i=n?.message;return jsx(Controller,{name:e,control:t,render:({field:a})=>jsx(qr,{...r,value:a.value,onChange:a.onChange,isInvalid:!!n,errorMessage:i})})}function ex({className:e,title:r="Please fix the following errors:",autoFocus:t=true}){let{formState:o}=useFormContext(),n=Ct.useRef(null),i=o.errors,a=Object.entries(i||{}),s=a.length>0;if(Ct.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:r}),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 ax({formId:e,disableWhenInvalid:r,disableWhenPristine:t,isDisabled:o,children:n,...i}){let{formState:a}=useFormContext(),s=o||a.isSubmitting||r&&!a.isValid||t&&!a.isDirty;return jsx(S,{type:"submit",form:e,isDisabled:s,...i,children:n})}function ux({name:e,getItemTitle:r,renderItem:t,onAdd:o}){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(we,{children:[jsx(vt,{title:r?r(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(Dt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(S,{variant:"secondary",onPress:()=>a(o?.()||{}),children:"Add item"})})]})}function Kr(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function dn(e){let r=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");r&&(r.focus({preventScroll:false}),r instanceof HTMLElement&&r.scrollIntoView({block:"center",behavior:"smooth"}));}function Tx({id:e,onSubmit:r,onInvalid:t,children:o,shouldFocusError:n=true,className:i,...a}){let s=useForm(a),l=(c,u)=>{if(n&&e){let d=document.getElementById(e);d&&dn(d);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(Kr,{id:e,className:i,onSubmit:s.handleSubmit(r,l),children:o})})}function pn({formId:e,show:r,isSubmitting:t,onCancel:o,primaryLabel:n="Save changes",secondaryLabel:i="Cancel",className:a}){return r?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:o,children:i}),jsx(S,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":n})]})]})}):null}function Vx({formId:e,onCancel:r,primaryLabel:t,secondaryLabel:o,className:n}){let{formState:i}=useFormContext();return jsx(pn,{formId:e,show:i.isDirty,isSubmitting:i.isSubmitting,onCancel:r,primaryLabel:t,secondaryLabel:o,className:n})}function Hx(e=true){let{formState:r}=useFormContext();Ct.useEffect(()=>{if(!e||!r.isSubmitted||!r.errors||Object.keys(r.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,r.isSubmitted,r.errors]);}function Ox({delayMs:e=800,onAutoSave:r}){let{watch:t,formState:o,getValues:n}=useFormContext(),i=Ct.useRef(void 0);Ct.useEffect(()=>{let a=t(()=>{o.isDirty&&(i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(async()=>{let s=n();await r(s);},e));});return ()=>{a.unsubscribe(),i.current&&window.clearTimeout(i.current);}},[t,o.isDirty,n,e,r]);}
|
|
2
|
+
export{ex as ErrorSummary,ux as FieldArrayList,Up as FormAutocomplete,dm as FormCheckbox,gm as FormCheckboxGroup,Mm as FormColorField,mf as FormDateField,Nf as FormFileUpload,ag as FormMultiSelect,kg as FormNumberField,Tx as FormProvider,$g as FormRadioCardGroup,dh as FormRadioGroup,Gh as FormRichTextEditor,Vx as FormSaveBar,Zh as FormSelect,cb as FormSwitch,Rb as FormTextArea,Nb as FormTextField,jb as FormTimeField,ax as SubmitButton,dn as focusFirstError,Ox as useAutoSave,Hx as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|