@texturehq/edges 2.0.1 → 2.1.1

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.
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { Key, DateValue } from 'react-aria-components';
4
4
  import { FieldValues, FieldPath, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
5
- import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-CqmVrAdn.cjs';
6
- import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-diZqy_s1.cjs';
5
+ import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-DAuKLDSw.cjs';
6
+ import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BNXNpG4s.cjs';
7
7
  import '@phosphor-icons/react';
8
8
 
9
9
  interface FormAutocompleteProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof Autocomplete>, "selectedKey" | "defaultSelectedKey" | "onSelectionChange"> {
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { Key, DateValue } from 'react-aria-components';
4
4
  import { FieldValues, FieldPath, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
5
- import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-7pTUPh11.js';
6
- import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-diZqy_s1.js';
5
+ import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-2KuhWThm.js';
6
+ import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BNXNpG4s.js';
7
7
  import '@phosphor-icons/react';
8
8
 
9
9
  interface FormAutocompleteProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof Autocomplete>, "selectedKey" | "defaultSelectedKey" | "onSelectionChange"> {
package/dist/rhf/index.js CHANGED
@@ -1,2 +1,3 @@
1
- import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';import*as Ne from'react';import Ne__default,{memo,createContext,useState,useContext,useRef,useEffect,useCallback,useId,useMemo,Component}from'react';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 pa from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Minus,Check,Image,X,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import rs from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import ss from'@tiptap/starter-kit';var Ar=Object.defineProperty;var zr=(e,o,t)=>o in e?Ar(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Et=(e,o,t)=>zr(e,typeof o!="symbol"?o+"":o,t);var ct={prefix:String(Math.round(Math.random()*1e10)),current:0},Vo=Ne__default.createContext(ct),Or=Ne__default.createContext(false);var Gr=!!(typeof window<"u"&&window.document&&window.document.createElement),Lt=new WeakMap;function Wr(e=false){let o=useContext(Vo),t=useRef(null);if(t.current===null&&!e){var r,a;let n=(a=Ne__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||a===void 0||(r=a.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(n){let i=Lt.get(n);i==null?Lt.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,Lt.delete(n));}t.current=++o.current;}return t.current}function qr(e){let o=useContext(Vo);o===ct&&!Gr&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let t=Wr(!!e),r=o===ct&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Ur(e){let o=Ne__default.useId(),[t]=useState(ut()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ct.prefix}`;return e||`${r}-${o}`}typeof Ne__default.useId=="function"?Ur:qr;function Yr(){return false}function jr(){return true}function Qr(e){return ()=>{}}function ut(){return typeof Ne__default.useSyncExternalStore=="function"?Ne__default.useSyncExternalStore(Qr,Yr,jr):useContext(Or)}var Xr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Jr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function $t(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),r=typeof t.getTextInfo=="function"?t.getTextInfo():t.textInfo;if(r)return r.direction==="rtl";if(t.script)return Xr.has(t.script)}let o=e.split("-")[0];return Jr.has(o)}var Lo=Symbol.for("react-aria.i18n.locale");function Do(){let e=typeof window<"u"&&window[Lo]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:$t(e)?"rtl":"ltr"}}var Mt=Do(),je=new Set;function Eo(){Mt=Do();for(let e of je)e(Mt);}function $o(){let e=ut(),[o,t]=useState(Mt);return useEffect(()=>(je.size===0&&window.addEventListener("languagechange",Eo),je.add(t),()=>{je.delete(t),je.size===0&&window.removeEventListener("languagechange",Eo);}),[]),e?{locale:typeof window<"u"&&window[Lo]||"en-US",direction:"ltr"}:o}var ra=Ne__default.createContext(null);function At(){let e=$o();return useContext(ra)||e}var zt=new Map;function Ht(e){let{locale:o}=At(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(zt.has(t))return zt.get(t);let r=new Intl.Collator(o,e);return zt.set(t,r),r}function mt(e){let o=Ht({usage:"search",...e}),t=useCallback((n,i)=>i.length===0?true:(n=n.normalize("NFC"),i=i.normalize("NFC"),o.compare(n.slice(0,i.length),i)===0),[o]),r=useCallback((n,i)=>i.length===0?true:(n=n.normalize("NFC"),i=i.normalize("NFC"),o.compare(n.slice(-i.length),i)===0),[o]),a=useCallback((n,i)=>{if(i.length===0)return true;n=n.normalize("NFC"),i=i.normalize("NFC");let s=0,d=i.length;for(;s+d<=n.length;s++){let c=n.slice(s,s+d);if(o.compare(i,c)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function De(e,o=false){let[t,r]=useState(o);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia(e);r(a.matches);let n=i=>{r(i.matches);};return a.addEventListener("change",n),()=>{a.removeEventListener("change",n);}},[e]),t}var Qe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function pt(e="base"){let o=De(`(min-width: ${Qe.sm})`,e!=="base"),t=De(`(min-width: ${Qe.md})`,["md","lg","xl","2xl"].includes(e)),r=De(`(min-width: ${Qe.lg})`,["lg","xl","2xl"].includes(e)),a=De(`(min-width: ${Qe.xl})`,["xl","2xl"].includes(e)),n=De(`(min-width: ${Qe["2xl"]})`,e==="2xl"),i=!t,s=t,d="base";return n?d="2xl":a?d="xl":r?d="lg":t?d="md":o&&(d="sm"),{current:d,isSm:o,isMd:t,isLg:r,isXl:a,is2Xl:n,isMobile:i,isDesktop:s}}function Mo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function ft(e,o=300){let[t,r]=useState(false);return useEffect(()=>{if(e){let a=setTimeout(()=>{r(true);},o);return ()=>clearTimeout(a)}r(false);},[e,o]),t}function gt(...e){return e.filter(Boolean).join(" ")}var xe={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 Ao(e,...o){return gt(xe[e],...o)}function we(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 _(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var W={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)]"}};var $e={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},h=memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=pa[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let d=typeof o=="string"&&o in $e?$e[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsx(s,{...i,size:d,color:t,weight:r,className:c,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});h.displayName="Icon";var _o=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:d,ariaLabel:c,ref:u,...l})=>{let g=typeof a=="string"&&a in $e?$e[a]:a,v=t?typeof t=="string"&&t in $e?$e[t]:t:g*1.75,m=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:m,style:{width:v,height:v},children:jsx(h,{...l,name:i,size:a,color:s,weight:d,className:n,ariaLabel:c})})});_o.displayName="IconWithContainer";var ha=({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 Go({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,a)=>ha({...a,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 Ce(){let[e,o]=Ne__default.useState(false),t=Ne__default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=Ne__default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var Z=Ne__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));Z.displayName="InputWrapper";function Xe({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(h,{name:"X",size:o==="sm"?16:20})})}function Je(e){let{isInvalid:o,isDisabled:t,isFocused:r}=e,a="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${a} border-border-muted`:o&&r?`${a} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:o?`${a} border-feedback-error-border`:r?`${a} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${a} border-border-input`}function va(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function ya(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 oe(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:n="md",className:i}=e;return twMerge("w-full",Je({isInvalid:o,isDisabled:t,isFocused:r}),va({transparent:a,isDisabled:t}),W[n].text,W[n].height,W[n].padding,ya(n),i)}function O({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let d=t||r&&a==="tooltip",c=t||r,u=r&&a==="inline",l=jsxs("label",{htmlFor:s,className:twMerge(W[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsx("span",{children:"*"}),d&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(h,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsx(Go,{content:c,children:l}):l}function k({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",W[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(W[o].text,"text-feedback-error-text",t),children:e})}function xt({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:a,className:n,...i}){return jsx("input",{className:oe({isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:e,className:n}),...i})}var Ra="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Sa="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",Ta={primary:Sa,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"},qo={full:"w-full",default:"w-fit"},Na="opacity-50 cursor-not-allowed pointer-events-none",wa="opacity-100 cursor-pointer",ka={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Ia={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function Ba(e){return !e||e==="default"||e==="brand"?"primary":e}function Va(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Ba(o),s=i==="unstyled"?"":`${Ra} ${Ta[i]}`;i!=="unstyled"&&(s+=` ${W[t].text} ${W[t].height} ${W[t].padding} ${W[t].gap}`),r||n?s+=` ${Na}`:s+=` ${wa}`,a?s+=` ${qo.full}`:s+=` ${qo.default}`;let d=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,we(),d].filter(Boolean).join(" ")}function R(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:d,href:c,className:u,badgeNumber:l,badgeVariant:g="primary",badgePosition:v="top-right",style:m,target:p,rel:P,...F}=e,y=o?jsx(h,{name:o,size:i,weight:d}):null,V=jsxs(Fragment,{children:[s==="left"&&y,typeof t=="function"?null:t,s==="right"&&y]}),D=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n||jsx(h,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:V}),a&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),I=(l??0)>0,C=twMerge(Va(e),u),T=c?{href:c,target:p,rel:P,...F}:{};if(c){let{onPress:N,onPressStart:te,onPressEnd:M,onPressChange:se,onPressUp:Y,onAuxClick:q,onContextMenu:ie,onDoubleClick:A,...x}=F;Object.assign(T,x);}let K=c?jsx(Link,{...T,...r&&{"aria-busy":true},style:I?void 0:m,className:C,children:r?D:typeof t=="function"?(function(N){return jsxs(Fragment,{children:[s==="left"&&y,t(N),s==="right"&&y]})}):V}):jsx(Button,{...F,...r&&{"aria-busy":true},style:I?void 0:m,className:C,children:r?D:typeof t=="function"?(function(N){return jsxs(Fragment,{children:[s==="left"&&y,t(N),s==="right"&&y]})}):V});return I?jsxs("div",{className:twMerge("relative flex",u),style:m,children:[K,jsx("span",{className:`absolute ${ka[v]} flex h-5 w-5 items-center justify-center rounded-full ${Ia[g]} text-xs font-medium`,"aria-label":`${l} items`,children:l})]}):K}function ke({transparent:e=false,className:o,children:t,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(o,(a,n)=>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(" "),n.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),n.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),a)),children:t})}function Ga({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let a=[!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(" "),n=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [a,n,i,t].filter(Boolean).join(" ")}function Ae({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxs(Popover,{offset:c,...i,className:composeRenderProps(r,(l,g)=>Ga({...g,className:l,disableGroup:n})),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(ke,{isDismissable:a,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:a,children:u})}):u}function Uo(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 a=()=>{let n=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));t({height:r.height,keyboardOffset:n});};return a(),r.addEventListener("resize",a),r.addEventListener("scroll",a),()=>{r.removeEventListener("resize",a),r.removeEventListener("scroll",a);}},[e]),o}function qt({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(R,{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 Kt({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let a=e||o||t;return !a&&!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}),a&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:t&&jsx(qt,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(qt,{action:o,defaultVariant:"secondary"}),e&&jsx(qt,{action:e,defaultVariant:"primary"})]})]})]})}var Ka={heading:{sm:xe.headingSm,md:xe.headingMd,lg:xe.headingLg,xl:xe.headingXl},display:{sm:xe.displaySm,md:xe.displayMd,lg:xe.displayLg,xl:xe.displayXl}},Ya={page:"h-16 leading-[62px]"};function tt({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:a="",children:n}){let i=t==="xs"?"sm":t,s=Ka[o][i],d=r?Ya[r]:"";return jsx(e,{className:gt(s,"text-text-primary",d,a),children:n})}var He=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:a=false,onBack:n,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[a&&jsx(R,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsx(h,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(tt,{size:"xs",children:e}),o&&!t&&jsx(R,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(h,{name:"X","data-testid":"close-button"})})]})]});var me=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:d=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:l,"data-testid":g})=>{let[v,m]=useState(d===0);if(useEffect(()=>{if(d>0){let I=setTimeout(()=>m(true),d);return ()=>clearTimeout(I)}},[d]),!v)return null;let p=a?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",P=c&&e?(()=>{let I=typeof e=="number"?e:parseFloat(String(e));return isNaN(I)?"":`animation-duration-[${Math.max(.8,I/100)}s]`})():"",F=r==="pulse"?`animate-pulse ${P}`: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 ${P}`:"",y="rounded-sm";t==="circle"&&(y="rounded-full"),t==="text"&&(y="h-4 w-full rounded-sm");let V=n?"flex-1 min-w-0":"",D=s?Object.entries(s).map(([I,C])=>`${I}:w-[${C}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":g,children:i.map((I,C)=>jsx("div",{className:twMerge(p,F,y,V,D,l),style:{width:I,height:o}},C))}):jsx("div",{className:twMerge(p,F,y,V,D,l),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":g})};var en={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"},tn="rounded-lg",jt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},on={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function pe({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:a="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",en[e],tn,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(me,{width:"100%",height:"100%",className:"rounded-none"}):t})}function ht({title:e,subtitle:o,actions:t,className:r,isLoading:a=false}){return a?jsxs("div",{className:twMerge("p-6 pb-4",r),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(me,{width:120,height:20}),jsx(me,{width:24,height:24})]}),o&&jsx(me,{width:200,height:16})]}):!e&&!o&&!t?null:jsx("div",{className:twMerge("p-6 pb-4",r),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(tt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:Ao("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function jo({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsx("div",{className:twMerge("bg-background-muted",jt[t],r),children:jsx(me,{width:"100%",height:"100%"})}):a?jsx("div",{className:twMerge("overflow-hidden",jt[t],r),children:a}):e?jsx("div",{className:twMerge("overflow-hidden",jt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function vt({className:e,children:o,isLoading:t=false,fill:r=false}){let n=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsx("div",{className:twMerge(n,r&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(me,{width:"100%",height:16}),jsx(me,{width:"80%",height:16}),jsx(me,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),children:o}):null}function Qo({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(me,{width:80,height:32}),jsx(me,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",on[t],e),children:o}):null}pe.Header=ht;pe.Media=jo;pe.Content=vt;pe.Footer=Qo;var rt=class extends Component{constructor(){super(...arguments);Et(this,"state",{hasError:false});Et(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(pe,{children:[this.props.title&&jsx(pe.Header,{title:this.props.title}),jsx(pe.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 sn=.3,ln=.5;function Oe({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:d,isDismissable:c=true,transparentOverlay:u=false,primaryAction:l,secondaryAction:g,footerContent:v,maxHeight:m="80vh",height:p,maxWidth:P="640px",contentPadding:F=true,showHandle:y=true,animationVariant:V="scale",className:D}){let[I,C]=useState(false),[T,K]=useState(0),[N,te]=useState(false),M=Uo(s),se=M?.height??null,Y=M?.keyboardOffset??0,q=useRef(null),ie=useRef(null),A=useRef(null),x=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let b=setTimeout(()=>{C(true),setTimeout(()=>C(false),600);},400);return ()=>clearTimeout(b)}},[s]),useEffect(()=>{s||(K(0),te(false),x.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let b=ie.current;if(!b||!s)return;let U=null,z=Q=>{let ge=Q.target;ge&&["INPUT","TEXTAREA","SELECT"].includes(ge.tagName)&&(U&&clearTimeout(U),U=setTimeout(()=>{ge.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return b.addEventListener("focusin",z),()=>{b.removeEventListener("focusin",z),U&&clearTimeout(U);}},[s]);let Te=useCallback(b=>{c&&(b.pointerType!=="touch"&&b.pointerType!=="pen"||(A.current&&(clearTimeout(A.current),A.current=null),x.current={isDragging:true,startY:b.clientY,startTime:Date.now(),pointerId:b.pointerId},te(false),b.currentTarget.setPointerCapture(b.pointerId)));},[c]),Pe=useCallback(b=>{let{isDragging:U,startY:z,pointerId:Q}=x.current;if(!U||b.pointerId!==Q)return;let ge=b.clientY-z;K(Math.max(0,ge));},[]),le=useCallback(b=>{let{isDragging:U,startY:z,startTime:Q,pointerId:ge}=x.current;if(!U||b.pointerId!==ge)return;let X=b.clientY-z,Le=Date.now()-Q,Ye=X/Le;x.current={isDragging:false,startY:0,startTime:0,pointerId:null};let dt=(q.current?.getBoundingClientRect().height??0)*sn;(X>dt||Ye>ln&&X>50)&&c?(d?.(),K(0)):(te(true),K(0),A.current=setTimeout(()=>{te(false),A.current=null;},200));},[c,d]);if(!s)return null;let ye=o||t,Fe=l||g||v;return jsx(rt,{children:jsx(ke,{isOpen:s,onOpenChange:b=>{b||d?.();},isDismissable:c,transparent:u,style:{paddingBottom:Y>0?`${Y}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:q,className:twMerge("w-full",N&&"transition-transform duration-200"),style:{transform:T>0?`translateY(${T}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",V==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",V==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",D),style:{maxWidth:P,...p?{height:p}:{maxHeight:/\d/.test(m)?se!==null?`min(${m}, ${Math.max(se-8,0)}px, 100dvh)`:`min(${m}, 100dvh)`:m}},children:[y&&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:Te,onPointerMove:Pe,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",I&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),ye&&(n?jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,onClose:d||(()=>{})})),jsx("div",{ref:ie,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",F?"p-4":"p-0"),children:e}),Fe&&jsx(Kt,{primaryAction:l,secondaryAction:g,footerContent:v})]})})})})})}Oe.displayName="Tray";var ro=createContext("md");function or(){return useContext(ro)}function eo(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 ${W[e].text} ${o}`}function fn(){let e=Ne__default.useCallback((t,r)=>{r?.(t);},[]),o=Ne__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function ao({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:d,defaultSelectedKey:c,onSelectionChange:u,placeholder:l,showErrors:g=false,tooltip:v,isRequired:m,transparent:p,reserveErrorSpace:P=false,placement:F="bottom start",shouldFlip:y=true,menuWidth:V="match",descriptionPlacement:D="below",useMobileTray:I=true,...C}){let[T,K]=useState(null),[N,te]=useState(null),[M,se]=useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=fn(),{isMobile:A}=pt(),x=I&&A,Te=Ne__default.useMemo(()=>!i||!Y||!a?null:Array.from(a).find(U=>U.id===Y)??null,[i,Y,a]),Pe=b=>{u&&b!==null&&u(b),u||K(b);},le=useRef(null),ye=useRef(null),Fe=()=>{x&&se(!M);};return jsxs(Fragment,{children:[jsx(Select,{...C,selectedKey:Y,defaultSelectedKey:c,onSelectionChange:Pe,placeholder:l,className:_(C.className,"group flex w-full flex-col"),ref:le,onOpenChange:b=>{x||(b&&ye.current?te(ye.current.offsetWidth):b||le.current?.blur());},children:({isDisabled:b,isInvalid:U,isOpen:z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:s,tooltip:v,description:D==="tooltip"||D==="inline"?o:void 0,descriptionPlacement:D,isRequired:m,children:e}),jsx(Z,{children:jsx("div",{ref:ye,children:jsxs(R,{variant:"unstyled",className:twMerge(oe({isInvalid:U||g&&!!t,isDisabled:b,isFocused:x?M:z,transparent:p,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:Q=>q(Q,C.onFocus),onBlur:Q=>ie(Q,C.onBlur),onPress:x?Fe:void 0,"data-open":x?M:z,children:[i&&Te?jsx("div",{className:eo(s),children:i(Te)}):x&&Y?jsx("div",{className:eo(s),children:a?Array.from(a).find(X=>X.id===Y)?.label:String(Y)}):jsx(SelectValue,{className:eo(s)}),jsx(h,{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",(x?M:z)&&"rotate-180")})]})})}),P?jsx("div",{className:"mt-1 min-h-[20px]",children:g?jsx(f,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&C.validationResult?t(C.validationResult):typeof t=="string"?t:null}):o&&D==="below"?jsx(k,{size:s,children:o}):null}):jsx(Fragment,{children:g?jsx(f,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&C.validationResult?t(C.validationResult):typeof t=="string"?t:null}):o&&D==="below"?jsx(k,{size:s,className:"mt-1",children:o}):null}),x?null:jsx(Ae,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:V==="match"&&N?`${N}px`:void 0,minWidth:V==="auto"&&N?`${N}px`:void 0,maxWidth:V==="auto"?"min(600px, 90vw)":void 0},placement:F,shouldFlip:y,children:jsx(ro.Provider,{value:"md",children:jsx(ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?Q=>jsx(Se,{id:Q.id,textValue:Q.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(Q)})},Q.id):r})})})]})}),x&&jsx(Oe,{isOpen:M,onClose:()=>se(false),title:e??"Select an option",contentPadding:false,children:jsx(ro.Provider,{value:"md",children:jsx(ListBox,{items:a,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:Y!=null?[Y]:[],onSelectionChange:b=>{let U=Array.from(b)[0];U!=null&&(Pe(U),se(false));},children:n&&a?b=>jsx(Se,{id:b.id,textValue:b.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(b)})},b.id):r})})})]})}function Se({size:e,className:o,...t}){let r=or(),a=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",W[a].paddingY,W[a].text,o)})}var Ge=({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 Tn=[],Nn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},wn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},nr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},io=(e,o,t)=>{if(e==null||e==="")return "";let a=(t?t.flatMap(n=>n.items):o||[]).find(n=>n.id===e);return a?a.name:""};async function kn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([d,c])=>{a.append(d,c.toString());});let n=`${r}${a.toString()?"?"+a.toString():""}`,i=await fetch(n,{method:"GET",headers:e.headers,signal:t});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in REST request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}async function In(e,o,t){try{let r=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${o}"`),a=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:r}),signal:t});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let n=await a.json();if(n.errors)throw new Error(n.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(n=e.responsePath.split(".").reduce((i,s)=>i?.[s],n)),{items:e.transformResponse(n)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}function so({label:e,staticItems:o=Tn,sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:c,description:u,size:l="md",tooltip:g,isRequired:v,isDisabled:m,isInvalid:p,validationResult:P,showErrors:F=true,renderItem:y,renderLeftIcon:V,renderSection:D,autoFocus:I=false,reserveErrorSpace:C=false,hideChevron:T=false,useMobileTray:K=true,className:N}){let te=Ne__default.useRef(null),M=Ne__default.useRef(null),[se,Y]=Ne__default.useState(),[q,ie]=useState(()=>io(r||a,o,t)),[A,x]=useState(false),[Te,Pe]=useState(false),le=Mo(q),{contains:ye}=mt({sensitivity:"base"}),[Fe,b]=useState(),{isMobile:U}=pt(),z=K&&U,Q=W[l].text,ge=useAsyncList({async load({signal:w,filterText:E=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(E))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await In(i,E,w):ee=await kn(i,E,w),b(ee.error),{items:ee.items}}catch(ee){return ee instanceof Error&&ee.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ee),b(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),X=i&&le!==""?ge:null,Le=false,Ye=useRef("");useEffect(()=>{I&&x(true);},[I]),useEffect(()=>{let w=io(r,o,t);w!==q&&ie(w);},[r,o,t]),useEffect(()=>{let w=()=>{te.current&&Y(te.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),useEffect(()=>{le===""?Ye.current="":X&&le!==Ye.current&&(Ye.current=le,X.setFilterText(le));},[le,X]),Le=ft(!!X?.isLoading,300);let Io=Ne__default.useMemo(()=>{if(!z||!q)return X?X.items:o;let w=X?X.items:o,E=s??(i?()=>true:ye);return w.filter(ee=>E(ee.name,q))},[z,q,X,o,s,ye]),dt=w=>{let E=io(w,o,t);ie(E),n&&n(w);},Vt=w=>{ie(w);},Bo=()=>{z&&Pe(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:dt,selectedKey:r||void 0,defaultSelectedKey:a||void 0,items:X?X.items:t?t.flatMap(w=>w.items):o,className:_(N,"group flex flex-col w-full"),menuTrigger:z?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:m,isInvalid:p||!!c,inputValue:q,onInputChange:Vt,autoFocus:I&&!z,defaultFilter:s??(i?()=>true:ye),"aria-label":e||d||"Autocomplete",children:w=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:l,tooltip:g,isRequired:v,children:e}),jsxs(Z,{ref:te,children:[V?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:V(Le)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ge,{size:16,color:"text-text-secondary"}):jsx(h,{name:"MagnifyingGlass",className:`${Nn[l]} text-text-secondary`})}),jsx(Input,{className:oe({isInvalid:p||!!c,isDisabled:m,isFocused:A||(z?Te:w.isOpen),size:l,className:twMerge(wn[l],q&&!m||!T&&!q?"pr-10":"pr-3",z&&"cursor-pointer",N)}),placeholder:d,disabled:m,onFocus:E=>{x(true),z&&(E.currentTarget.blur(),Bo());},onBlur:()=>{x(false);},onClick:z?Bo:void 0,readOnly:z,"aria-label":e||d||"Autocomplete"}),q&&!m&&jsx(Xe,{onClick:()=>{ie(""),n?.(null);},size:l}),!T&&!q&&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:E})=>jsx(h,{name:E?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),C?jsx("div",{className:"mt-1 min-h-[20px]",children:F&&Fe?jsx(f,{size:l,className:"text-feedback-error-text",children:Fe}):F&&typeof c=="string"?jsx(f,{size:l,className:"text-feedback-error-text",children:c}):F&&typeof c=="function"&&P?jsx(f,{size:l,className:"text-feedback-error-text",children:c(P)}):u?jsx(k,{size:l,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(k,{size:l,className:"mt-1",children:u}),F&&Fe&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Fe}),F&&typeof c=="string"&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c}),F&&typeof c=="function"&&P&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c(P)})]}),!z&&jsx(Ae,{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:se?`${se}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||d||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${Q}`,children:t?t.map(E=>{let ee=E.items.map(be=>jsx(Se,{id:be.id,textValue:be.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${nr[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:y?y(be):be.name},be.id));if(D){let be=D(E,ee);return Ne__default.isValidElement(be)&&be.type===ListBoxSection?be:jsx(ListBoxSection,{children:be},E.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:E.name}),ee]},E.name)}):E=>jsx(Se,{id:E.id,textValue:E.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${nr[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:y?y(E):E.name},E.id)})})]})}),z&&jsx(Oe,{isOpen:Te,onClose:()=>Pe(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(Z,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ge,{size:16,color:"text-text-secondary"}):jsx(h,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:M,type:"text",value:q,onChange:w=>Vt(w.target.value),placeholder:d,autoFocus:true,className:oe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),q&&jsx(Xe,{onClick:()=>{ie(""),n?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||d||"Suggestions",items:Io,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:w=>{let E=Array.from(w)[0];E&&(dt(E),Pe(false));},className:"bg-background-input outline-none",children:w=>jsx(Se,{id:w.id,textValue:w.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:y?y(w):w.name},w.id)})})]})})]})}function L(e,o){let t=o.split("."),r=e;for(let n of t)if(r&&typeof r=="object"&&n in r)r=r[n];else {r=void 0;break}let a=r?.message;return typeof a=="string"?a:void 0}function Hu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(so,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var An="focus:ring-action-primary",zn="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function dr(e){return jsxs(CheckboxGroup,{...e,className:_(e.className,"flex flex-col gap-2"),children:[jsx(O,{children:e.label}),e.children,e.description&&jsx(k,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Hn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function _n({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r}){let a="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",n=An,i="";return t?i="border-border-muted bg-background-muted":o?i="border-feedback-error-border bg-feedback-error-background":e||r?i=zn:i="bg-background-input border-border-input hover:border-border-focus",`${a} ${n} ${i}`}var lr="w-4 h-4 text-current group-disabled:text-text-disabled";function cr(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(a,n)=>`${Hn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsx("div",{className:_n({isSelected:n,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:lr}):n?jsx(Check,{"aria-hidden":true,className:lr}):null});return jsxs(Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function rm({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=useFormContext(),i=L(n.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(cr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(f,{children:i})]})})}function dm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(dr,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function We(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 uo(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 fr({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:d,value:c,defaultValue:u,onChange:l,placeholder:g="#000000",showColorSwatch:v=true,reserveErrorSpace:m=true,...p}){let[P,F]=useState(u||""),[y,V]=useState(c||u||""),[D,I]=useState(false),[C,T]=useState(null),{isFocused:K,handleFocus:N,handleBlur:te}=Ce(),M=c!==void 0?c:P;useEffect(()=>{c!==void 0&&V(c);},[c]);let se=M?!We(M):false,Y=useCallback(A=>{if(V(A),We(A)){let x=uo(A);l?l(x):F(x);}else A===""&&(l?l(""):F(""));},[l]),q=useCallback(A=>{let x=uo(A);V(x),l?l(x):F(x);},[l]),ie=useCallback(A=>{if(We(y)){let x=uo(y);V(x),l&&x!==M?l(x):!l&&x!==P&&F(x);}te(A,p.onBlur);},[y,M,P,l,te,p.onBlur]);return jsx(TextField,{...p,isRequired:n,className:_(s,"group flex flex-col"),children:({isDisabled:A})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(xt,{size:r,disabled:A,type:"text",value:y,placeholder:g,onFocus:x=>N(x,p.onFocus),onBlur:ie,onChange:x=>Y(x.target.value),className:twMerge(oe({isInvalid:se,isDisabled:A,isFocused:K,size:r,transparent:i}),v?"pr-12":"pr-3","pl-3")}),v&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:W[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",We(M)?"border-border-default":"border-border-default bg-background-muted"),style:We(M)?{backgroundColor:M}:void 0,"aria-hidden":"true",children:!We(M)&&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:T,children:jsx(R,{variant:"secondary",size:r,icon:"Palette",onPress:()=>I(!D),isDisabled:A,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsx(f,{size:r,children:t(d)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null}),D&&C&&jsx(Ae,{triggerRef:{current:C},isOpen:D,onOpenChange:I,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:M||"#000000",onChange:q,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:M||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:M||"#000000"})]})]})})]})})}function Nm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(fr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function di({isSelected:e,isDisabled:o}){let t=[we,"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 po({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(br,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(xr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${di({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function br(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(R,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(h,{name:"CaretRight","aria-hidden":true,size:o}):jsx(h,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(R,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(h,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(h,{name:"CaretRight","aria-hidden":true,size:o})})]})}function xr(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function go({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:d=true,reserveErrorSpace:c=true,validationResult:u,className:l,...g}){let[v,m]=useState(false),p=P=>{g.onChange&&P&&g.onChange(P),m(false);};return jsxs(DateField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(l,"flex flex-col gap-1"),children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsxs("div",{className:"relative w-full",children:[jsx(vr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:m,children:[jsx(R,{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(h,{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(po,{value:g.value,onChange:p,minValue:g.minValue,maxValue:g.maxValue,isDisabled:i,isReadOnly:g.isReadOnly,isDateUnavailable:g.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsx(f,{size:r,children:t(u)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(f,{size:r,className:"mt-1",children:t(u)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function xi({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function vr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsx(DateInput,{className:twMerge(Je({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",a),...n,children:i=>jsx(DateSegment,{segment:i,className:xi({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function ip({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(go,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function bo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:d=true,placeholder:c="Drop files here or click to browse"}){let[u,l]=useState(false),[g,v]=useState(false),[m,p]=useState(null),[P,F]=useState(e),y=useRef(null),V=async C=>{if(p(null),a&&C.size>a){p(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(d&&C.type.startsWith("image/")){let T=new FileReader;T.onloadend=()=>{F(T.result);},T.readAsDataURL(C);}if(i){v(true);try{let T=await i(C);F(T),t?.(T);}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{v(false);}}o?.(C,P);},D=async C=>{try{let T=C.items;if(T.length>0){let K=T[0];if(K.kind==="file"){let N=await K.getFile();N&&V(N);}}}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{l(false);}},I=()=>{F(void 0),p(null),o?.(null),t?.(""),y.current&&(y.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",n&&"pointer-events-none opacity-50",m&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:D,onDropEnter:()=>l(true),onDropExit:()=>l(false),children:[P?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(P.startsWith("data:image")||P.startsWith("http"))?jsx("img",{src:P,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"})]}),!n&&jsx(R,{variant:"icon",size:"sm",onPress:I,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:C=>{let T=Array.from(C||[]);T.length>0&&V(T[0]);},children:jsx(R,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),g&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),m&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function Fp({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=useFormContext(),i=L(n.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(bo,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&i&&jsx(f,{children:i})]})})}var Di=e=>{let o=oe({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 vo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:d=true,descriptionPlacement:c="below",...u}){let l=useId(),{isFocused:g,handleFocus:v,handleBlur:m}=Ce();return jsx(NumberField,{...u,id:l,isRequired:n,className:_(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:p=>{typeof p=="number"&&(u.maxValue!=null&&p>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&p<u.minValue?u.onChange?.(u.minValue):u.onChange?.(p));},isInvalid:!!t||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:p,isInvalid:P})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(O,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:l,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:y=>v(y,u.onFocus),onBlur:y=>m(y,u.onBlur),className:Di({isInvalid:P||!!t,isDisabled:p,isFocused:g,transparent:i,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:p,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(h,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:p,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(h,{name:"CaretDown",size:14})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function _p({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(vo,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Nt({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:i,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:a,isRequired:n,className:_(i,"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:Ne__default.Children.map(s,g=>Ne__default.isValidElement(g)?Ne__default.cloneElement(g,{size:d,variant:c}):g)})}function af({name:e,defaultValue:o,label:t,description:r,children:a,...n}){let{control:i,formState:s}=useFormContext(),d=L(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx(O,{children:t}),r&&jsx(k,{children:r}),jsx(Nt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),d&&jsx(f,{children:d})]})})}function Ki(e){return "primary"}var Yi=createContext({variant:"primary"});function Po(e){let{variant:o="primary",...t}=e,r=Ki();return jsx(Yi.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:_(e.className,"group flex flex-col gap-2"),children:[jsx(O,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(k,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function Tf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Po,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var ts=e=>{let o=oe({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 lt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:d,onClear:c,type:u,validationResult:l,reserveErrorSpace:g=true,isLoading:v=false,descriptionPlacement:m="below",...p}){let[P,F]=Ne__default.useState(false),{isFocused:y,handleFocus:V,handleBlur:D}=Ce(),I=u==="password",C=ft(v,300);return jsx(TextField,{...p,isRequired:n,className:_(p.className,"group flex flex-col"),children:({isDisabled:T,isInvalid:K})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:n,children:e}),jsxs(Z,{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 N={sm:14,md:16,lg:18,xl:20}[r];return C?jsx(Ge,{size:N,color:"text-text-secondary"}):jsx(h,{name:"MagnifyingGlass",size:N,className:`transition-colors ${y?"text-action-brand":"text-text-secondary"}`})})()}),jsx(xt,{size:r,disabled:T,type:I?P?"text":"password":u,value:p.value,defaultValue:p.defaultValue,placeholder:p.placeholder,onFocus:N=>V(N,p.onFocus),onBlur:N=>D(N,p.onBlur),onChange:N=>p.onChange?.(N.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[r]}:void 0,className:ts({isInvalid:K,isDisabled:T,isFocused:y,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!p.value,isPassword:I,className:typeof p.className=="string"?p.className:void 0})}),d&&p.value&&!T&&jsx(Xe,{onClick:()=>{c?c():p.onChange&&p.onChange("");},size:r}),I&&!T&&jsx("button",{type:"button",onClick:()=>F(!P),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":P?"Hide password":"Show password",onMouseDown:N=>{N.preventDefault(),N.stopPropagation();},children:jsx(h,{name:P?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o&&m==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}var us={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"}},Ue=({isActive:e=false,onPress:o,children:t})=>jsx(R,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function ms({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=useState(e);return Ne__default.useEffect(()=>{n(e);},[e]),jsx(ke,{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(a),t();},children:[jsx(He,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(lt,{label:"URL",type:"url",value:a,onChange:n,autoFocus:true,className:"w-full"})}),jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsx(R,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(R,{type:"submit",children:"Save"})]})]})})})})}function Fo({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n,size:i="md",headingLevels:s=[1,2]}){let d=us[i],[c,u]=useState(false),l=useEditor({immediatelyRender:false,extensions:[ss.configure({heading:s.length>0?{levels:s}:false}),rs.configure({openOnClick:false,HTMLAttributes:{class:"text-text-link-default hover:text-text-link-hover underline decoration-text-link-default/30 hover:decoration-text-link-hover cursor-pointer"}})],content:e,editable:!r,onUpdate:({editor:m})=>{o?.(m.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${d.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),g=()=>{u(true);},v=m=>{m===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:m}).run();};return l?jsxs("div",{id:n,"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(R,{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(h,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:g,children:[jsx(h,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(h,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(ms,{isOpen:c,onClose:()=>u(false),onSubmit:v,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(m=>jsx(Ue,{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(Ue,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Ue,{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(Ue,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(h,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Ue,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(h,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Ue,{isActive:l.isActive("link"),onPress:g,children:jsx(h,{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:a})]})]}):null}function dg({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=useFormContext(),d=L(s.errors,e);return jsx(Controller,{control:i,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(Fo,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),d&&jsx("p",{className:"text-sm text-feedback-error-text",children:d}),a&&!d&&jsx("div",{className:"h-5"})]})})}function hg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ao,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var Ro={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 ys({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",a=Ro[t].track,n=we,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[r,a,n,i,s,o?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Ps({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",a=Ro[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function So({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:_(r.className,`group flex items-center gap-2 ${Ro[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:a=>jsxs(Fragment,{children:[jsx("div",{className:ys({...a,size:t}),children:jsx("span",{className:Ps({...a,size:t})})}),e]})})}function Ig({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(So,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var Ns=e=>{let o=oe({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 To({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:d,isResizable:c=false,className:u,validationResult:l,reserveErrorSpace:g=true,...v}){let{isFocused:m,handleFocus:p,handleBlur:P}=Ce();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsx("textarea",{...v,required:n,onFocus:F=>{v.onFocus&&v.onFocus(F),p(F);},onBlur:F=>{v.onBlur&&v.onBlur(F),P(F);},className:Ns({isInvalid:s,isDisabled:d,isResizable:c,isFocused:m,size:r,transparent:i,className:u}),disabled:d})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Gg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(To,{...t,value:i.value??"",onChange:s=>i.onChange(s.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,required:t.required})})}function jg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(lt,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Ms({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 No({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:d=true,validationResult:c,className:u,descriptionPlacement:l="below",...g}){return jsxs(TimeField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(u,"flex flex-col gap-1"),children:[e&&jsx(O,{size:r,tooltip:a,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:n,children:e}),jsx(Z,{children:jsx(DateInput,{className:twMerge(Je({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:Ms({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||i,size:r})})})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsx(f,{size:r,children:t(c)}):o&&l==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(f,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function gb({name:e,...o}){let{control:t,formState:{errors:r}}=useFormContext(),a=r[e],n=a?.message;return jsx(Controller,{name:e,control:t,render:({field:i})=>jsx(No,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function yb({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),a=Ne.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(Ne.useEffect(()=>{t&&s&&a.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:a,role:"alert",tabIndex:-1,className:twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsx("div",{className:"font-medium",children:o}),jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([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 Sb({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:a,...n}){let{formState:i}=useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsx(R,{type:"submit",form:e,isDisabled:s,...n,children:a})}function Bb({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=useFormContext(),{fields:n,append:i,remove:s,swap:d}=useFieldArray({control:a,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[n.map((c,u)=>jsxs(pe,{children:[jsx(ht,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u-1),children:"Up"}),u<n.length-1&&jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsx(R,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(vt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(R,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function ko(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Er(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 qb({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=useForm(i),d=(c,u)=>{if(a&&e){let l=document.getElementById(e);l&&Er(l);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(ko,{id:e,className:n,onSubmit:s.handleSubmit(o,d),children:r})})}function $r({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:a="Save changes",secondaryLabel:n="Cancel",className:i}){return o?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(R,{variant:"secondary",onPress:r,children:n}),jsx(R,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function ex({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=useFormContext();return jsx($r,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function ax(e=true){let{formState:o}=useFormContext();Ne.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 sx({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=useFormContext(),n=Ne.useRef(void 0);Ne.useEffect(()=>{let i=t(()=>{r.isDirty&&(n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(async()=>{let s=a();await o(s);},e));});return ()=>{i.unsubscribe(),n.current&&window.clearTimeout(n.current);}},[t,r.isDirty,a,e,o]);}export{yb as ErrorSummary,Bb as FieldArrayList,Hu as FormAutocomplete,rm as FormCheckbox,dm as FormCheckboxGroup,Nm as FormColorField,ip as FormDateField,Fp as FormFileUpload,_p as FormNumberField,qb as FormProvider,af as FormRadioCardGroup,Tf as FormRadioGroup,dg as FormRichTextEditor,ex as FormSaveBar,hg as FormSelect,Ig as FormSwitch,Gg as FormTextArea,jg as FormTextField,gb as FormTimeField,Sb as SubmitButton,Er as focusFirstError,sx as useAutoSave,ax as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
1
+ import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';import*as Le from'react';import Le__default,{memo,createContext,useState,useContext,forwardRef,useRef,useEffect,useCallback,useId,useMemo,Component}from'react';import {ComboBox,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,Group,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,useSlottedContext,PopoverContext,OverlayArrow,Modal,ListBoxItem,Calendar,CalendarGrid,CalendarGridBody,CalendarCell,Text,TooltipTrigger,Tooltip,ModalOverlay,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell}from'react-aria-components';import {useAsyncList}from'react-stately';import {twMerge}from'tailwind-merge';import*as Xo from'@phosphor-icons/react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {Minus,Check,Image,X,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import Ds from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import zs from'@tiptap/starter-kit';var Xr=Object.defineProperty;var Jr=(e,o,t)=>o in e?Xr(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var _t=(e,o,t)=>Jr(e,typeof o!="symbol"?o+"":o,t);var xt={prefix:String(Math.round(Math.random()*1e10)),current:0},Ho=Le__default.createContext(xt),tn=Le__default.createContext(false);var on=!!(typeof window<"u"&&window.document&&window.document.createElement),Ht=new WeakMap;function rn(e=false){let o=useContext(Ho),t=useRef(null);if(t.current===null&&!e){var r,n;let a=(n=Le__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||n===void 0||(r=n.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(a){let i=Ht.get(a);i==null?Ht.set(a,{id:o.current,state:a.memoizedState}):a.memoizedState!==i.state&&(o.current=i.id,Ht.delete(a));}t.current=++o.current;}return t.current}function nn(e){let o=useContext(Ho);o===xt&&!on&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let t=rn(!!e),r=o===xt&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function an(e){let o=Le__default.useId(),[t]=useState(gt()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${xt.prefix}`;return e||`${r}-${o}`}typeof Le__default.useId=="function"?an:nn;function ln(){return false}function dn(){return true}function cn(e){return ()=>{}}function gt(){return typeof Le__default.useSyncExternalStore=="function"?Le__default.useSyncExternalStore(cn,ln,dn):useContext(tn)}var un=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),pn=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Gt(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),r=typeof t.getTextInfo=="function"?t.getTextInfo():t.textInfo;if(r)return r.direction==="rtl";if(t.script)return un.has(t.script)}let o=e.split("-")[0];return pn.has(o)}var Go=Symbol.for("react-aria.i18n.locale");function Wo(){let e=typeof window<"u"&&window[Go]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:Gt(e)?"rtl":"ltr"}}var Wt=Wo(),et=new Set;function Oo(){Wt=Wo();for(let e of et)e(Wt);}function qo(){let e=gt(),[o,t]=useState(Wt);return useEffect(()=>(et.size===0&&window.addEventListener("languagechange",Oo),et.add(t),()=>{et.delete(t),et.size===0&&window.removeEventListener("languagechange",Oo);}),[]),e?{locale:typeof window<"u"&&window[Go]||"en-US",direction:"ltr"}:o}var bn=Le__default.createContext(null);function qt(){let e=qo();return useContext(bn)||e}var Ut=new Map;function Kt(e){let{locale:o}=qt(),t=o+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():"");if(Ut.has(t))return Ut.get(t);let r=new Intl.Collator(o,e);return Ut.set(t,r),r}function bt(e){let o=Kt({usage:"search",...e}),t=useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),o.compare(a.slice(0,i.length),i)===0),[o]),r=useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),o.compare(a.slice(-i.length),i)===0),[o]),n=useCallback((a,i)=>{if(i.length===0)return true;a=a.normalize("NFC"),i=i.normalize("NFC");let s=0,d=i.length;for(;s+d<=a.length;s++){let c=a.slice(s,s+d);if(o.compare(i,c)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:n}),[t,r,n])}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 a=i=>{r(i.matches);};return n.addEventListener("change",a),()=>{n.removeEventListener("change",a);}},[e]),t}var tt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function ht(e="base"){let o=ze(`(min-width: ${tt.sm})`,e!=="base"),t=ze(`(min-width: ${tt.md})`,["md","lg","xl","2xl"].includes(e)),r=ze(`(min-width: ${tt.lg})`,["lg","xl","2xl"].includes(e)),n=ze(`(min-width: ${tt.xl})`,["xl","2xl"].includes(e)),a=ze(`(min-width: ${tt["2xl"]})`,e==="2xl"),i=!t,s=t,d="base";return a?d="2xl":n?d="xl":r?d="lg":t?d="md":o&&(d="sm"),{current:d,isSm:o,isMd:t,isLg:r,isXl:n,is2Xl:a,isMobile:i,isDesktop:s}}function Uo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let n=setTimeout(()=>r(e),o);return ()=>clearTimeout(n)},[e,o]),t}function yt(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 vt(...e){return e.filter(Boolean).join(" ")}var Pe={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function Ko(e,...o){return vt(Pe[e],...o)}function Be(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 O(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var q={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};function Y(e,o){let t=forwardRef(({size:r=24,color:n="currentColor",className:a,mirrored:i,alt:s,...d},c)=>{let u=!!s||"aria-label"in d;return jsx("svg",{ref:c,xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 256 256",fill:n,className:a,transform:i?"scale(-1, 1)":void 0,"aria-hidden":u?void 0:true,role:u?"img":void 0,"aria-label":s,...d,children:o})});return t.displayName=e,t}var Pt=()=>jsxs(Fragment,{children:[jsx("path",{d:"M12 128h44M200 128h44",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"76",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"}),jsx("circle",{cx:"180",cy:"128",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"16"})]}),Yo=()=>jsx("path",{d:"M166 120 88 70",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jo=()=>jsx("path",{d:"M162 122 92 128",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),Qo=()=>jsxs(Fragment,{children:[jsx("path",{d:"M112 85.7 A32 32 0 1 1 144 85.7",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"}),jsx("circle",{cx:"128",cy:"58",r:"8",fill:"currentColor",stroke:"none"})]}),wn=Y("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"})]})),In=Y("TextureFuse",jsx("path",{d:"M20 128h72q18 -84 36 0q18 84 36 0h72",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",strokeLinejoin:"round"})),Ln=Y("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"})]})),Bn=Y("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"})]})),En=Y("TextureCapacitor",jsx(Fragment,{children:jsx("path",{d:"M4 128h106M146 128h106M110 72v112M146 72v112",fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round"})})),Vn=Y("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"})]})),Dn=Y("TextureSwitch",jsxs(Fragment,{children:[jsx(Pt,{}),jsx(Yo,{})]})),$n=Y("TextureSwitchClosed",jsxs(Fragment,{children:[jsx(Pt,{}),jsx(jo,{})]})),Mn=Y("TextureSectionalizerOpen",jsxs(Fragment,{children:[jsx(Pt,{}),jsx(Yo,{}),jsx(Qo,{})]})),An=Y("TextureSectionalizerClosed",jsxs(Fragment,{children:[jsx(Pt,{}),jsx(jo,{}),jsx(Qo,{})]})),zn=Y("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"})]})),_e={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),Qt=e=>jsx("path",{d:`M24 ${e}h208`,fill:"none",stroke:"currentColor",strokeWidth:"16",strokeLinecap:"round",pathLength:100,strokeDasharray:"20 20"},e),_n=Y("TextureSinglePhaseOverheadLine",jsx(Fragment,{children:_e[1].map(jt)})),Hn=Y("TextureTwoPhaseOverheadLine",jsx(Fragment,{children:_e[2].map(jt)})),On=Y("TextureThreePhaseOverheadLine",jsx(Fragment,{children:_e[3].map(jt)})),Gn=Y("TextureSinglePhaseUndergroundLine",jsx(Fragment,{children:_e[1].map(Qt)})),Wn=Y("TextureTwoPhaseUndergroundLine",jsx(Fragment,{children:_e[2].map(Qt)})),qn=Y("TextureThreePhaseUndergroundLine",jsx(Fragment,{children:_e[3].map(Qt)})),Un=Y("TextureSupportStructure",jsx("circle",{cx:"128",cy:"128",r:"40",fill:"currentColor",stroke:"none"})),Ct={TextureRecloser:wn,TextureFuse:In,TextureBreaker:Ln,TextureSource:Bn,TextureCapacitor:En,TextureRegulator:Vn,TextureSwitch:Dn,TextureSwitchClosed:$n,TextureSectionalizerOpen:Mn,TextureSectionalizerClosed:An,TextureTransformer:zn,TextureSinglePhaseOverheadLine:_n,TextureTwoPhaseOverheadLine:Hn,TextureThreePhaseOverheadLine:On,TextureSinglePhaseUndergroundLine:Gn,TextureTwoPhaseUndergroundLine:Wn,TextureThreePhaseUndergroundLine:qn,TextureSupportStructure:Un};if(process.env.NODE_ENV==="development")for(let e of Object.keys(Ct))e in Xo&&console.error(`Custom icon "${e}" collides with a Phosphor icon of the same name. Rename it (use the "Texture" prefix) to keep the icon namespace unambiguous.`);var He={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},y=memo(({name:e,size:o="md",color:t,weight:r="regular",className:n,ariaLabel:a,...i})=>{let s=Ct[e]??Xo[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react or the custom icon registry`),null;let d=typeof o=="string"&&o in He?He[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",n);return jsx(s,{...i,size:d,color:t,weight:r,className:c,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});y.displayName="Icon";var er=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:n="md",className:a,name:i,color:s,weight:d,ariaLabel:c,ref:u,...l})=>{let x=typeof n=="string"&&n in He?He[n]:n,v=t?typeof t=="string"&&t in He?He[t]:t:x*1.75,p=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:p,style:{width:v,height:v},children:jsx(y,{...l,name:i,size:n,color:s,weight:d,className:a,ariaLabel:c})})});er.displayName="IconWithContainer";var Xn=({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 or({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,n)=>Xn({...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 Ne(){let[e,o]=Le__default.useState(false),t=Le__default.useCallback((n,a)=>{o(true),a?.(n);},[]),r=Le__default.useCallback((n,a)=>{o(false),a?.(n);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var oe=Le__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));oe.displayName="InputWrapper";function ot({onClick:e,size:o="md",className:t}){return jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(y,{name:"X",size:o==="sm"?16:20})})}function rt(e){let{isInvalid:o,isDisabled:t,isFocused:r}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${n} border-border-muted`:o&&r?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:o?`${n} border-feedback-error-border`:r?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function Jn(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function Zn(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function ae(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",rt({isInvalid:o,isDisabled:t,isFocused:r}),Jn({transparent:n,isDisabled:t}),q[a].text,q[a].height,q[a].padding,Zn(a),i)}function G({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:n="below",isRequired:a,className:i,htmlFor:s}){let d=t||r&&n==="tooltip",c=t||r,u=r&&n==="inline",l=jsxs("label",{htmlFor:s,className:twMerge(q[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,a&&jsx("span",{children:"*"}),d&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(y,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsx(or,{content:c,children:l}):l}function I({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",q[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(q[o].text,"text-feedback-error-text",t),children:e})}function Ft({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:n,className:a,...i}){return jsx("input",{className:ae({isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:e,className:a}),...i})}var ra="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",na="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",aa={primary:na,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"},nr={full:"w-full",default:"w-fit"},ia="opacity-50 cursor-not-allowed pointer-events-none",sa="opacity-100 cursor-pointer",la={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},da={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function ca(e){return !e||e==="default"||e==="brand"?"primary":e}function ua(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:n=false,isLoading:a=false}=e,i=ca(o),s=i==="unstyled"?"":`${ra} ${aa[i]}`;i!=="unstyled"&&(s+=` ${q[t].text} ${q[t].height} ${q[t].padding} ${q[t].gap}`),r||a?s+=` ${ia}`:s+=` ${sa}`,n?s+=` ${nr.full}`:s+=` ${nr.default}`;let d=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,Be(),d].filter(Boolean).join(" ")}function R(e){let{icon:o,children:t,isLoading:r=false,loadingText:n,loadingIndicator:a,size:i="md",iconPosition:s="left",iconWeight:d,href:c,className:u,badgeNumber:l,badgeVariant:x="primary",badgePosition:v="top-right",style:p,target:m,rel:C,...S}=e,P=o?jsx(y,{name:o,size:i,weight:d}):null,E=jsxs(Fragment,{children:[s==="left"&&P,typeof t=="function"?null:t,s==="right"&&P]}),$=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(y,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:E}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),L=(l??0)>0,F=twMerge(ua(e),u),N=c?{href:c,target:m,rel:C,...S}:{};if(c){let{onPress:k,onPressStart:ne,onPressEnd:A,onPressChange:ce,onPressUp:Q,onAuxClick:U,onContextMenu:de,onDoubleClick:z,...h}=S;Object.assign(N,h);}let j=c?jsx(Link,{...N,...r&&{"aria-busy":true},style:L?void 0:p,className:F,children:r?$:typeof t=="function"?(function(k){return jsxs(Fragment,{children:[s==="left"&&P,t(k),s==="right"&&P]})}):E}):jsx(Button,{...S,...r&&{"aria-busy":true},style:L?void 0:p,className:F,children:r?$:typeof t=="function"?(function(k){return jsxs(Fragment,{children:[s==="left"&&P,t(k),s==="right"&&P]})}):E});return L?jsxs("div",{className:twMerge("relative flex",u),style:p,children:[j,jsx("span",{className:`absolute ${la[v]} flex h-5 w-5 items-center justify-center rounded-full ${da[x]} text-xs font-medium`,"aria-label":`${l} items`,children:l})]}):j}function Ee({transparent:e=false,className:o,children:t,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(o,(n,a)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/15"].join(" "),a.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),a.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:t})}function Ca({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let n=[!r&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),a=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [n,a,i,t].filter(Boolean).join(" ")}function Ge({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:n=true,disableGroup:a=false,...i}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxs(Popover,{offset:c,...i,className:composeRenderProps(r,(l,x)=>Ca({...x,className:l,disableGroup:a})),children:[o&&jsx(OverlayArrow,{children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"block fill-background-surface stroke-border-default stroke-1 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsx(Ee,{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 ar(e=true){let[o,t]=useState(null);return useEffect(()=>{if(!e){t(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let n=()=>{let a=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));t({height:r.height,keyboardOffset:a});};return n(),r.addEventListener("resize",n),r.addEventListener("scroll",n),()=>{r.removeEventListener("resize",n),r.removeEventListener("scroll",n);}},[e]),o}function eo({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(R,{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 oo({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(eo,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(eo,{action:o,defaultVariant:"secondary"}),e&&jsx(eo,{action:e,defaultVariant:"primary"})]})]})]})}var Ta={heading:{sm:Pe.headingSm,md:Pe.headingMd,lg:Pe.headingLg,xl:Pe.headingXl},display:{sm:Pe.displaySm,md:Pe.displayMd,lg:Pe.displayLg,xl:Pe.displayXl}},Na={page:"h-16 leading-[62px]"};function it({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:n="",children:a}){let i=t==="xs"?"sm":t,s=Ta[o][i],d=r?Na[r]:"";return jsx(e,{className:vt(s,"text-text-primary",d,n),children:a})}var qe=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:n=false,onBack:a,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[n&&jsx(R,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(y,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(it,{size:"xs",children:e}),o&&!t&&jsx(R,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(y,{name:"X","data-testid":"close-button"})})]})]});var ge=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:n=false,flex:a=false,stack:i,responsive:s,delay:d=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:l,"data-testid":x})=>{let[v,p]=useState(d===0);if(useEffect(()=>{if(d>0){let L=setTimeout(()=>p(true),d);return ()=>clearTimeout(L)}},[d]),!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)]",C=c&&e?(()=>{let L=typeof e=="number"?e:parseFloat(String(e));return isNaN(L)?"":`animation-duration-[${Math.max(.8,L/100)}s]`})():"",S=r==="pulse"?`animate-pulse ${C}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${C}`:"",P="rounded-sm";t==="circle"&&(P="rounded-full"),t==="text"&&(P="h-4 w-full rounded-sm");let E=a?"flex-1 min-w-0":"",$=s?Object.entries(s).map(([L,F])=>`${L}:w-[${F}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":x,children:i.map((L,F)=>jsx("div",{className:twMerge(m,S,P,E,$,l),style:{width:L,height:o}},F))}):jsx("div",{className:twMerge(m,S,P,E,$,l),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":x})};var Ea={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"},Va="rounded-lg",no={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Da={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function be({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:n="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",Ea[e],Va,n==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(ge,{width:"100%",height:"100%",className:"rounded-none"}):t})}function Rt({title:e,subtitle:o,actions:t,className:r,isLoading:n=false}){return n?jsxs("div",{className:twMerge("p-6 pb-4",r),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(ge,{width:120,height:20}),jsx(ge,{width:24,height:24})]}),o&&jsx(ge,{width:200,height:16})]}):!e&&!o&&!t?null:jsx("div",{className:twMerge("p-6 pb-4",r),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(it,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:Ko("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function lr({src:e,alt:o,aspectRatio:t="auto",className:r,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",no[t],r),children:jsx(ge,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",no[t],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",no[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Tt({className:e,children:o,isLoading:t=false,fill:r=false}){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),children:jsxs("div",{className:"space-y-2",children:[jsx(ge,{width:"100%",height:16}),jsx(ge,{width:"80%",height:16}),jsx(ge,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),children:o}):null}function dr({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(ge,{width:80,height:32}),jsx(ge,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",Da[t],e),children:o}):null}be.Header=Rt;be.Media=lr;be.Content=Tt;be.Footer=dr;var lt=class extends Component{constructor(){super(...arguments);_t(this,"state",{hasError:false});_t(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,r){console.error("Error Boundary caught an error:",t,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(be,{children:[this.props.title&&jsx(be.Header,{title:this.props.title}),jsx(be.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var za=.3,_a=.5;function Ke({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:n=false,hasBackArrow:a=false,onBack:i,isOpen:s,onClose:d,isDismissable:c=true,transparentOverlay:u=false,primaryAction:l,secondaryAction:x,footerContent:v,maxHeight:p="80vh",height:m,maxWidth:C="640px",contentPadding:S=true,showHandle:P=true,animationVariant:E="scale",className:$}){let[L,F]=useState(false),[N,j]=useState(0),[k,ne]=useState(false),A=ar(s),ce=A?.height??null,Q=A?.keyboardOffset??0,U=useRef(null),de=useRef(null),z=useRef(null),h=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let g=setTimeout(()=>{F(true),setTimeout(()=>F(false),600);},400);return ()=>clearTimeout(g)}},[s]),useEffect(()=>{s||(j(0),ne(false),h.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let g=de.current;if(!g||!s)return;let K=null,_=Z=>{let ye=Z.target;ye&&["INPUT","TEXTAREA","SELECT"].includes(ye.tagName)&&(K&&clearTimeout(K),K=setTimeout(()=>{ye.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return g.addEventListener("focusin",_),()=>{g.removeEventListener("focusin",_),K&&clearTimeout(K);}},[s]);let Ie=useCallback(g=>{c&&(g.pointerType!=="touch"&&g.pointerType!=="pen"||(z.current&&(clearTimeout(z.current),z.current=null),h.current={isDragging:true,startY:g.clientY,startTime:Date.now(),pointerId:g.pointerId},ne(false),g.currentTarget.setPointerCapture(g.pointerId)));},[c]),Re=useCallback(g=>{let{isDragging:K,startY:_,pointerId:Z}=h.current;if(!K||g.pointerId!==Z)return;let ye=g.clientY-_;j(Math.max(0,ye));},[]),ue=useCallback(g=>{let{isDragging:K,startY:_,startTime:Z,pointerId:ye}=h.current;if(!K||g.pointerId!==ye)return;let ee=g.clientY-_,Ae=Date.now()-Z,Ze=ee/Ae;h.current={isDragging:false,startY:0,startTime:0,pointerId:null};let ft=(U.current?.getBoundingClientRect().height??0)*za;(ee>ft||Ze>_a&&ee>50)&&c?(d?.(),j(0)):(ne(true),j(0),z.current=setTimeout(()=>{ne(false),z.current=null;},200));},[c,d]);if(!s)return null;let Fe=o||t,Te=l||x||v;return jsx(lt,{children:jsx(Ee,{isOpen:s,onOpenChange:g=>{g||d?.();},isDismissable:c,transparent:u,style:{paddingBottom:Q>0?`${Q}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:U,className:twMerge("w-full",k&&"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",E==="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)]",E==="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)]",$),style:{maxWidth:C,...m?{height:m}:{maxHeight:/\d/.test(p)?ce!==null?`min(${p}, ${Math.max(ce-8,0)}px, 100dvh)`:`min(${p}, 100dvh)`:p}},children:[P&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:Ie,onPointerMove:Re,onPointerUp:ue,onPointerCancel:ue,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",L&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),Fe&&(a?jsx(qe,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsx(qe,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:n||!d,onClose:d||(()=>{})})),jsx("div",{ref:de,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",S?"p-4":"p-0"),children:e}),Te&&jsx(oo,{primaryAction:l,secondaryAction:x,footerContent:v})]})})})})})}Ke.displayName="Tray";var mo=createContext("md");function xr(){return useContext(mo)}function co(e="md"){let o=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-disabled overflow-hidden text-ellipsis whitespace-nowrap ${q[e].text} ${o}`}function Ua(){let e=Le__default.useCallback((t,r)=>{r?.(t);},[]),o=Le__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function fo({label:e,description:o,errorMessage:t,children:r,items:n,renderItem:a,renderSelectedValue:i,size:s="md",selectedKey:d,defaultSelectedKey:c,onSelectionChange:u,placeholder:l,showErrors:x=false,tooltip:v,isRequired:p,transparent:m,reserveErrorSpace:C=false,placement:S="bottom start",shouldFlip:P=true,menuWidth:E="match",descriptionPlacement:$="below",useMobileTray:L=true,...F}){let[N,j]=useState(null),[k,ne]=useState(null),[A,ce]=useState(false),Q=d??N??c,{handleFocus:U,handleBlur:de}=Ua(),{isMobile:z}=ht(),h=L&&z,Ie=Le__default.useMemo(()=>!i||!Q||!n?null:Array.from(n).find(K=>K.id===Q)??null,[i,Q,n]),Re=g=>{u&&g!==null&&u(g),u||j(g);},ue=useRef(null),Fe=useRef(null),Te=()=>{h&&ce(!A);};return jsxs(Fragment,{children:[jsx(Select,{...F,selectedKey:Q,defaultSelectedKey:c,onSelectionChange:Re,placeholder:l,className:O(F.className,"group flex w-full flex-col"),ref:ue,onOpenChange:g=>{h||(g&&Fe.current?ne(Fe.current.offsetWidth):g||ue.current?.blur());},children:({isDisabled:g,isInvalid:K,isOpen:_})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:s,tooltip:v,description:$==="tooltip"||$==="inline"?o:void 0,descriptionPlacement:$,isRequired:p,children:e}),jsx(oe,{children:jsx("div",{ref:Fe,children:jsxs(R,{variant:"unstyled",className:twMerge(ae({isInvalid:K||x&&!!t,isDisabled:g,isFocused:h?A:_,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:Z=>U(Z,F.onFocus),onBlur:Z=>de(Z,F.onBlur),onPress:h?Te:void 0,"data-open":h?A:_,children:[i&&Ie?jsx("div",{className:co(s),children:i(Ie)}):h&&Q?jsx("div",{className:co(s),children:n?Array.from(n).find(ee=>ee.id===Q)?.label:String(Q)}):jsx(SelectValue,{className:co(s)}),jsx(y,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(h?A:_)&&"rotate-180")})]})})}),C?jsx("div",{className:"mt-1 min-h-[20px]",children:x?jsx(f,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&F.validationResult?t(F.validationResult):typeof t=="string"?t:null}):o&&$==="below"?jsx(I,{size:s,children:o}):null}):jsx(Fragment,{children:x?jsx(f,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&F.validationResult?t(F.validationResult):typeof t=="string"?t:null}):o&&$==="below"?jsx(I,{size:s,className:"mt-1",children:o}):null}),h?null:jsx(Ge,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:E==="match"&&k?`${k}px`:void 0,minWidth:E==="auto"&&k?`${k}px`:void 0,maxWidth:E==="auto"?"min(600px, 90vw)":void 0},placement:S,shouldFlip:P,children:jsx(mo.Provider,{value:"md",children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?Z=>jsx(we,{id:Z.id,textValue:Z.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(Z)})},Z.id):r})})})]})}),h&&jsx(Ke,{isOpen:A,onClose:()=>ce(false),title:e??"Select an option",contentPadding:false,children:jsx(mo.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:Q!=null?[Q]:[],onSelectionChange:g=>{let K=Array.from(g)[0];K!=null&&(Re(K),ce(false));},children:a&&n?g=>jsx(we,{id:g.id,textValue:g.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(g)})},g.id):r})})})]})}function we({size:e,className:o,...t}){let r=xr(),n=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",q[n].paddingY,q[n].text,o)})}var Ye=({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 ni=[],ai={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},ii={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},hr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},go=(e,o,t)=>{if(e==null||e==="")return "";let n=(t?t.flatMap(a=>a.items):o||[]).find(a=>a.id===e);return n?n.name:""};async function si(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 a=`${r}${n.toString()?"?"+n.toString():""}`,i=await fetch(a,{method:"GET",headers:e.headers,signal:t});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in REST request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}async function li(e,o,t){try{let r=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${o}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:r}),signal:t});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.json();if(a.errors)throw new Error(a.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(a=e.responsePath.split(".").reduce((i,s)=>i?.[s],a)),{items:e.transformResponse(a)}}catch(r){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}function bo({label:e,staticItems:o=ni,sections:t,selectedKey:r,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:c,description:u,size:l="md",tooltip:x,isRequired:v,isDisabled:p,isInvalid:m,validationResult:C,showErrors:S=true,renderItem:P,renderLeftIcon:E,renderSection:$,autoFocus:L=false,reserveErrorSpace:F=false,hideChevron:N=false,useMobileTray:j=true,className:k}){let ne=Le__default.useRef(null),A=Le__default.useRef(null),[ce,Q]=Le__default.useState(),[U,de]=useState(()=>go(r||n,o,t)),[z,h]=useState(false),[Ie,Re]=useState(false),ue=Uo(U),{contains:Fe}=bt({sensitivity:"base"}),[Te,g]=useState(),{isMobile:K}=ht(),_=j&&K,Z=q[l].text,ye=useAsyncList({async load({signal:w,filterText:V=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(V))return {items:[]};try{let re;return i.requestType==="GraphQL"?re=await li(i,V,w):re=await si(i,V,w),g(re.error),{items:re.items}}catch(re){return re instanceof Error&&re.name==="AbortError"?{items:[]}:(console.error("Error loading items:",re),g(re instanceof Error?re.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),ee=i&&ue!==""?ye:null,Ae=false,Ze=useRef("");useEffect(()=>{L&&h(true);},[L]),useEffect(()=>{let w=go(r,o,t);w!==U&&de(w);},[r,o,t]),useEffect(()=>{let w=()=>{ne.current&&Q(ne.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),useEffect(()=>{ue===""?Ze.current="":ee&&ue!==Ze.current&&(Ze.current=ue,ee.setFilterText(ue));},[ue,ee]),Ae=yt(!!ee?.isLoading,300);let zo=Le__default.useMemo(()=>{if(!_||!U)return ee?ee.items:o;let w=ee?ee.items:o,V=s??(i?()=>true:Fe);return w.filter(re=>V(re.name,U))},[_,U,ee,o,s,Fe]),ft=w=>{let V=go(w,o,t);de(V),a&&a(w);},zt=w=>{de(w);},_o=()=>{_&&Re(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:ft,selectedKey:r||void 0,defaultSelectedKey:n||void 0,items:ee?ee.items:t?t.flatMap(w=>w.items):o,className:O(k,"group flex flex-col w-full"),menuTrigger:_?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:p,isInvalid:m||!!c,inputValue:U,onInputChange:zt,autoFocus:L&&!_,defaultFilter:s??(i?()=>true:Fe),"aria-label":e||d||"Autocomplete",children:w=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:l,tooltip:x,isRequired:v,children:e}),jsxs(oe,{ref:ne,children:[E?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:E(Ae)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Ae?jsx(Ye,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:`${ai[l]} text-text-secondary`})}),jsx(Input,{className:ae({isInvalid:m||!!c,isDisabled:p,isFocused:z||(_?Ie:w.isOpen),size:l,className:twMerge(ii[l],U&&!p||!N&&!U?"pr-10":"pr-3",_&&"cursor-pointer",k)}),placeholder:d,disabled:p,onFocus:V=>{h(true),_&&(V.currentTarget.blur(),_o());},onBlur:()=>{h(false);},onClick:_?_o:void 0,readOnly:_,"aria-label":e||d||"Autocomplete"}),U&&!p&&jsx(ot,{onClick:()=>{de(""),a?.(null);},size:l}),!N&&!U&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:p,children:({isPressed:V})=>jsx(y,{name:V?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),F?jsx("div",{className:"mt-1 min-h-[20px]",children:S&&Te?jsx(f,{size:l,className:"text-feedback-error-text",children:Te}):S&&typeof c=="string"?jsx(f,{size:l,className:"text-feedback-error-text",children:c}):S&&typeof c=="function"&&C?jsx(f,{size:l,className:"text-feedback-error-text",children:c(C)}):u?jsx(I,{size:l,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(I,{size:l,className:"mt-1",children:u}),S&&Te&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Te}),S&&typeof c=="string"&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c}),S&&typeof c=="function"&&C&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c(C)})]}),!_&&jsx(Ge,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:ce?`${ce}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||d||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${Z}`,children:t?t.map(V=>{let re=V.items.map(ve=>jsx(we,{id:ve.id,textValue:ve.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${hr[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:P?P(ve):ve.name},ve.id));if($){let ve=$(V,re);return Le__default.isValidElement(ve)&&ve.type===ListBoxSection?ve:jsx(ListBoxSection,{children:ve},V.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:V.name}),re]},V.name)}):V=>jsx(we,{id:V.id,textValue:V.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${hr[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:P?P(V):V.name},V.id)})})]})}),_&&jsx(Ke,{isOpen:Ie,onClose:()=>Re(false),title:e??d??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(oe,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Ae?jsx(Ye,{size:16,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:A,type:"text",value:U,onChange:w=>zt(w.target.value),placeholder:d,autoFocus:true,className:ae({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),U&&jsx(ot,{onClick:()=>{de(""),a?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||d||"Suggestions",items:zo,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:w=>{let V=Array.from(w)[0];V&&(ft(V),Re(false));},className:"bg-background-input outline-none",children:w=>jsx(we,{id:w.id,textValue:w.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:P?P(w):w.name},w.id)})})]})})]})}function D(e,o){let t=o.split("."),r=e;for(let a of t)if(r&&typeof r=="object"&&a in r)r=r[a];else {r=void 0;break}let n=r?.message;return typeof n=="string"?n:void 0}function Np({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(bo,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!a,errorMessage:a})})}var gi="focus:ring-action-primary",bi="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function Cr(e){return jsxs(CheckboxGroup,{...e,className:O(e.className,"flex flex-col gap-2"),children:[jsx(G,{children:e.label}),e.children,e.description&&jsx(I,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function hi({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function yi({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",a=gi,i="";return t?i="border-border-muted bg-background-muted":o?i="border-feedback-error-border bg-feedback-error-background":e||r?i=bi:i="bg-background-input border-border-input hover:border-border-focus",`${n} ${a} ${i}`}var Pr="w-4 h-4 text-current group-disabled:text-text-disabled";function Sr(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(n,a)=>`${hi(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,d=jsx("div",{className:yi({isSelected:a,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:Pr}):a?jsx(Check,{"aria-hidden":true,className:Pr}):null});return jsxs(Fragment,{children:[d,typeof o=="function"?o(n):o]})}})}function Wp({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:n,formState:a}=useFormContext(),i=D(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Sr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(f,{children:i})]})})}function Qp({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Cr,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:a,children:t.children})})}function je(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 vo(e){if(!e)return "";let o=e.startsWith("#")?e.slice(1):e;return o.length===3&&(o=o.split("").map(t=>t+t).join("")),`#${o.toUpperCase()}`}function Nr({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:d,value:c,defaultValue:u,onChange:l,placeholder:x="#000000",showColorSwatch:v=true,reserveErrorSpace:p=true,...m}){let[C,S]=useState(u||""),[P,E]=useState(c||u||""),[$,L]=useState(false),[F,N]=useState(null),{isFocused:j,handleFocus:k,handleBlur:ne}=Ne(),A=c!==void 0?c:C;useEffect(()=>{c!==void 0&&E(c);},[c]);let ce=A?!je(A):false,Q=useCallback(z=>{if(E(z),je(z)){let h=vo(z);l?l(h):S(h);}else z===""&&(l?l(""):S(""));},[l]),U=useCallback(z=>{let h=vo(z);E(h),l?l(h):S(h);},[l]),de=useCallback(z=>{if(je(P)){let h=vo(P);E(h),l&&h!==A?l(h):!l&&h!==C&&S(h);}ne(z,m.onBlur);},[P,A,C,l,ne,m.onBlur]);return jsx(TextField,{...m,isRequired:a,className:O(s,"group flex flex-col"),children:({isDisabled:z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:r,tooltip:n,isRequired:a,children:e}),jsx(oe,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(Ft,{size:r,disabled:z,type:"text",value:P,placeholder:x,onFocus:h=>k(h,m.onFocus),onBlur:de,onChange:h=>Q(h.target.value),className:twMerge(ae({isInvalid:ce,isDisabled:z,isFocused:j,size:r,transparent:i}),v?"pr-12":"pr-3","pl-3")}),v&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:q[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",je(A)?"border-border-default":"border-border-default bg-background-muted"),style:je(A)?{backgroundColor:A}:void 0,"aria-hidden":"true",children:!je(A)&&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(R,{variant:"secondary",size:r,icon:"Palette",onPress:()=>L(!$),isDisabled:z,className:"flex-shrink-0",children:"Pick"})})]})}),p?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsx(f,{size:r,children:t(d)}):o?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsx(I,{size:r,className:"mt-1",children:o}):null}),$&&F&&jsx(Ge,{triggerRef:{current:F},isOpen:$,onOpenChange:L,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:A||"#000000",onChange:U,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:A||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:A||"#000000"})]})]})})]})})}function fm({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Nr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a})})}function Hi({isSelected:e,isDisabled:o}){let t=[Be,"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 Co({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(wr,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Ir,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:n})=>`${Hi({isSelected:r,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function wr(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(R,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(y,{name:"CaretRight","aria-hidden":true,size:o}):jsx(y,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(R,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(y,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(y,{name:"CaretRight","aria-hidden":true,size:o})})]})}function Ir(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function Fo({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,showCalendar:d=true,reserveErrorSpace:c=true,validationResult:u,className:l,...x}){let[v,p]=useState(false),m=C=>{x.onChange&&C&&x.onChange(C),p(false);};return jsxs(DateField,{...x,isDisabled:i,isRequired:a,isInvalid:s,className:O(l,"flex flex-col gap-1"),children:[e&&jsx(G,{size:r,tooltip:n,isRequired:a,children:e}),jsx(oe,{children:jsxs("div",{className:"relative w-full",children:[jsx(Br,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:p,children:[jsx(R,{variant:"unstyled",className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-8 w-8 items-center justify-center rounded hover:bg-background-hover text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(y,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(Co,{value:x.value,onChange:m,minValue:x.minValue,maxValue:x.maxValue,isDisabled:i,isReadOnly:x.isReadOnly,isDateUnavailable:x.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsx(f,{size:r,children:t(u)}):o?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(f,{size:r,className:"mt-1",children:t(u)}):o?jsx(I,{size:r,className:"mt-1",children:o}):null})]})}function ji({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 Br({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:n,...a}){return jsx(DateInput,{className:twMerge(rt({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",n),...a,children:i=>jsx(DateSegment,{segment:i,className:ji({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function Km({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Fo,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a})})}function Ro({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:n,isDisabled:a=false,onUpload:i,className:s,showPreview:d=true,placeholder:c="Drop files here or click to browse"}){let[u,l]=useState(false),[x,v]=useState(false),[p,m]=useState(null),[C,S]=useState(e),P=useRef(null),E=async F=>{if(m(null),n&&F.size>n){m(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(d&&F.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{S(N.result);},N.readAsDataURL(F);}if(i){v(true);try{let N=await i(F);S(N),t?.(N);}catch(N){m("Failed to upload file"),console.error("Upload error:",N);}finally{v(false);}}o?.(F,C);},$=async F=>{try{let N=F.items;if(N.length>0){let j=N[0];if(j.kind==="file"){let k=await j.getFile();k&&E(k);}}}catch(N){m("Failed to upload file"),console.error("Upload error:",N);}finally{l(false);}},L=()=>{S(void 0),m(null),o?.(null),t?.(""),P.current&&(P.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",u?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",a&&"pointer-events-none opacity-50",p&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:$,onDropEnter:()=>l(true),onDropExit:()=>l(false),children:[C?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(C.startsWith("data:image")||C.startsWith("http"))?jsx("img",{src:C,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!a&&jsx(R,{variant:"icon",size:"sm",onPress:L,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:F=>{let N=Array.from(F||[]);N.length>0&&E(N[0]);},children:jsx(R,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),x&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),p&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:p})]})}function cf({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:n,formState:a}=useFormContext(),i=D(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Ro,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&i&&jsx(f,{children:i})]})})}var ms=e=>{let o=ae({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function ko({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,validationResult:s,reserveErrorSpace:d=true,descriptionPlacement:c="below",...u}){let l=useId(),{isFocused:x,handleFocus:v,handleBlur:p}=Ne();return jsx(NumberField,{...u,id:l,isRequired:a,className:O(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:C})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(G,{size:r,tooltip:n,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:a,htmlFor:l,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:P=>v(P,u.onFocus),onBlur:P=>p(P,u.onBlur),className:ms({isInvalid:C||!!t,isDisabled:m,isFocused:x,transparent:i,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: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(y,{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(y,{name:"CaretDown",size:14})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}function wf({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ko,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a,isRequired:t.isRequired})})}function Vt({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:n,isRequired:a,className:i,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:a,className:O(i,"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:Le__default.Children.map(s,x=>Le__default.isValidElement(x)?Le__default.cloneElement(x,{size:d,variant:c}):x)})}function Uf({name:e,defaultValue:o,label:t,description:r,children:n,...a}){let{control:i,formState:s}=useFormContext(),d=D(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx(G,{children:t}),r&&jsx(I,{children:r}),jsx(Vt,{...a,value:c.value,onChange:u=>c.onChange(u),children:n}),d&&jsx(f,{children:d})]})})}function Rs(e){return "primary"}var Ts=createContext({variant:"primary"});function Io(e){let{variant:o="primary",...t}=e,r=Rs();return jsx(Ts.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:O(e.className,"group flex flex-col gap-2"),children:[jsx(G,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(I,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function mx({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Io,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:a,children:t.children})})}var Es=e=>{let o=ae({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function mt({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,showSearchIcon:s,isClearable:d,onClear:c,type:u,validationResult:l,reserveErrorSpace:x=true,isLoading:v=false,descriptionPlacement:p="below",...m}){let[C,S]=Le__default.useState(false),{isFocused:P,handleFocus:E,handleBlur:$}=Ne(),L=u==="password",F=yt(v,300);return jsx(TextField,{...m,isRequired:a,className:O(m.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:j})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:r,tooltip:n,description:p==="tooltip"||p==="inline"?o:void 0,descriptionPlacement:p,isRequired:a,children:e}),jsxs(oe,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let k={sm:14,md:16,lg:18,xl:20}[r];return F?jsx(Ye,{size:k,color:"text-text-secondary"}):jsx(y,{name:"MagnifyingGlass",size:k,className:`transition-colors ${P?"text-action-brand":"text-text-secondary"}`})})()}),jsx(Ft,{size:r,disabled:N,type:L?C?"text":"password":u,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:k=>E(k,m.onFocus),onBlur:k=>$(k,m.onBlur),onChange:k=>m.onChange?.(k.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[r]}:void 0,className:Es({isInvalid:j,isDisabled:N,isFocused:P,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!m.value,isPassword:L,className:typeof m.className=="string"?m.className:void 0})}),d&&m.value&&!N&&jsx(ot,{onClick:()=>{c?c():m.onChange&&m.onChange("");},size:r}),L&&!N&&jsx("button",{type:"button",onClick:()=>S(!C),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":C?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsx(y,{name:C?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o&&p==="below"?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&p==="below"?jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}var Gs={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"}},Xe=({isActive:e=false,onPress:o,children:t})=>jsx(R,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function Ws({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[n,a]=useState(e);return Le__default.useEffect(()=>{a(e);},[e]),jsx(Ee,{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(qe,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(mt,{label:"URL",type:"url",value:n,onChange:a,autoFocus:true,className:"w-full"})}),jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsx(R,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(R,{type:"submit",children:"Save"})]})]})})})})}function Lo({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:n="Start typing...",id:a,size:i="md",headingLevels:s=[1,2]}){let d=Gs[i],[c,u]=useState(false),l=useEditor({immediatelyRender:false,extensions:[zs.configure({heading:s.length>0?{levels:s}:false}),Ds.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:p})=>{o?.(p.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${d.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),x=()=>{u(true);},v=p=>{p===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:p}).run();};return l?jsxs("div",{id:a,"data-richtexteditor":true,className:twMerge("flex flex-col rounded-md border border-border-input bg-background-input","outline-none focus-within:outline-none focus-within:border-border-input focus-within:ring-0 focus-within:shadow-none",r&&"opacity-50",t),style:{outline:"none"},children:[!r&&l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,shouldShow:({editor:p})=>p.isActive("link")&&!c,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let p=l.getAttributes("link").href;p&&window.open(p,"_blank","noopener,noreferrer");},children:[jsx(y,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:x,children:[jsx(y,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(y,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(Ws,{isOpen:c,onClose:()=>u(false),onSubmit:v,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(p=>jsx(Xe,{isActive:l.isActive("heading",{level:p}),onPress:()=>l.chain().focus().toggleHeading({level:p}).run(),children:jsxs("span",{className:"text-xs font-bold",children:["H",p]})},p)),jsx(Xe,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Xe,{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(Xe,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(y,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Xe,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(y,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Xe,{isActive:l.isActive("link"),onPress:x,children:jsx(y,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:twMerge("relative w-full outline-none focus:outline-none",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 Qx({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:n=true,...a}){let{control:i,formState:s}=useFormContext(),d=D(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field: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(Lo,{...a,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 ag({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(fo,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!a,errorMessage:a})})}var Eo={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 Js({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=Eo[t].track,a=Be,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[r,n,a,i,s,o?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Zs({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=Eo[t].handle;return [r,n,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Vo({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:O(r.className,`group flex items-center gap-2 ${Eo[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:Js({...n,size:t}),children:jsx("span",{className:Zs({...n,size:t})})}),e]})})}function bg({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:n})=>jsx(Vo,{...t,isSelected:!!n.value,onChange:a=>n.onChange(a),children:t.children})})}var al=e=>{let o=ae({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=`min-h-[100px] py-2 ${e.isDisabled?"resize-none":e.isResizable?"resize-y":"resize-none"}`;return twMerge(o,t,e.className)};function Do({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,required:a,transparent:i,isInvalid:s,isDisabled:d,isResizable:c=false,className:u,validationResult:l,reserveErrorSpace:x=true,...v}){let{isFocused:p,handleFocus:m,handleBlur:C}=Ne();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:r,tooltip:n,isRequired:a,children:e}),jsx(oe,{children:jsx("textarea",{...v,required:a,onFocus:S=>{v.onFocus&&v.onFocus(S),m(S);},onBlur:S=>{v.onBlur&&v.onBlur(S),C(S);},className:al({isInvalid:s,isDisabled:d,isResizable:c,isFocused:p,size:r,transparent:i,className:u}),disabled:d})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}function Ig({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Do,{...t,value:i.value??"",onChange:s=>i.onChange(s.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!a,errorMessage:a,required:t.required})})}function $g({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=D(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(mt,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!a,errorMessage:a,isRequired:t.isRequired})})}function xl({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 $o({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,reserveErrorSpace:d=true,validationResult:c,className:u,descriptionPlacement:l="below",...x}){return jsxs(TimeField,{...x,isDisabled:i,isRequired:a,isInvalid:s,className:O(u,"flex flex-col gap-1"),children:[e&&jsx(G,{size:r,tooltip:n,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:a,children:e}),jsx(oe,{children:jsx(DateInput,{className:twMerge(rt({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:xl({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||i,size:r})})})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsx(f,{size:r,children:t(c)}):o&&l==="below"?jsx(I,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(f,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsx(I,{size:r,className:"mt-1",children:o}):null})]})}function ob({name:e,...o}){let{control:t,formState:{errors:r}}=useFormContext(),n=r[e],a=n?.message;return jsx(Controller,{name:e,control:t,render:({field:i})=>jsx($o,{...o,value:i.value,onChange:i.onChange,isInvalid:!!n,errorMessage:a})})}function sb({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),n=Le.useRef(null),a=r.errors,i=Object.entries(a||{}),s=i.length>0;if(Le.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:i.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 pb({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:n,...a}){let{formState:i}=useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsx(R,{type:"submit",form:e,isDisabled:s,...a,children:n})}function hb({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:n}=useFormContext(),{fields:a,append:i,remove:s,swap:d}=useFieldArray({control:n,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[a.map((c,u)=>jsxs(be,{children:[jsx(Rt,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u-1),children:"Up"}),u<a.length-1&&jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsx(R,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(Tt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(R,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function Ao(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Ur(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 Bb({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:n=true,className:a,...i}){let s=useForm(i),d=(c,u)=>{if(n&&e){let l=document.getElementById(e);l&&Ur(l);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(Ao,{id:e,className:a,onSubmit:s.handleSubmit(o,d),children:r})})}function jr({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:i}){return o?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(R,{variant:"secondary",onPress:r,children:a}),jsx(R,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":n})]})]})}):null}function Hb({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n}){let{formState:a}=useFormContext();return jsx(jr,{formId:e,show:a.isDirty,isSubmitting:a.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n})}function qb(e=true){let{formState:o}=useFormContext();Le.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 Yb({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:n}=useFormContext(),a=Le.useRef(void 0);Le.useEffect(()=>{let i=t(()=>{r.isDirty&&(a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(async()=>{let s=n();await o(s);},e));});return ()=>{i.unsubscribe(),a.current&&window.clearTimeout(a.current);}},[t,r.isDirty,n,e,o]);}
2
+ export{sb as ErrorSummary,hb as FieldArrayList,Np as FormAutocomplete,Wp as FormCheckbox,Qp as FormCheckboxGroup,fm as FormColorField,Km as FormDateField,cf as FormFileUpload,wf as FormNumberField,Bb as FormProvider,Uf as FormRadioCardGroup,mx as FormRadioGroup,Qx as FormRichTextEditor,Hb as FormSaveBar,ag as FormSelect,bg as FormSwitch,Ig as FormTextArea,$g as FormTextField,ob as FormTimeField,pb as SubmitButton,Ur as focusFirstError,Yb as useAutoSave,qb as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
2
3
  //# sourceMappingURL=index.js.map