@texturehq/edges 1.26.2 → 1.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{RichTextEditor-BhX77nTp.d.cts → RichTextEditor-CZCqHSPF.d.cts} +2 -2
- package/dist/{RichTextEditor-BhX77nTp.d.ts → RichTextEditor-CZCqHSPF.d.ts} +2 -2
- package/dist/{TimeField-BXmGlwVW.d.cts → TimeField-CDgde0qa.d.ts} +11 -2
- package/dist/{TimeField-DuBmntG7.d.ts → TimeField-DjLAyJkm.d.cts} +11 -2
- package/dist/{colors-B9nHitHg.d.ts → colors-CHRmTEal.d.ts} +6 -2
- package/dist/{colors-Cv1f3FIO.d.cts → colors-Ddk1k14x.d.cts} +6 -2
- package/dist/components.manifest.json +26 -11
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.cjs.map +1 -1
- package/dist/form/index.js +1 -1
- package/dist/form/index.js.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -10
- package/dist/index.d.ts +61 -10
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/rhf/index.cjs +1 -1
- package/dist/rhf/index.cjs.map +1 -1
- package/dist/rhf/index.d.cts +2 -2
- package/dist/rhf/index.d.ts +2 -2
- package/dist/rhf/index.js +1 -1
- package/dist/rhf/index.js.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/styles.css +140 -17
- package/dist/utilities.manifest.json +8 -1
- package/package.json +1 -1
- package/scripts/setup-cursor-rules.js +1 -1
package/dist/rhf/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var reactHookForm=require('react-hook-form'),ye=require('react'),reactAriaComponents=require('react-aria-components'),reactStately=require('react-stately'),tailwindMerge=require('tailwind-merge'),Kr=require('@phosphor-icons/react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactColorful=require('react-colorful'),Ni=require('@tiptap/extension-link'),react=require('@tiptap/react'),menus=require('@tiptap/react/menus'),Ii=require('@tiptap/starter-kit');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ye__namespace=/*#__PURE__*/_interopNamespace(ye);var Kr__namespace=/*#__PURE__*/_interopNamespace(Kr);var Ni__default=/*#__PURE__*/_interopDefault(Ni);var Ii__default=/*#__PURE__*/_interopDefault(Ii);var yr=Object.defineProperty;var Pr=(e,o,t)=>o in e?yr(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var ut=(e,o,t)=>Pr(e,typeof o!="symbol"?o+"":o,t);var je={prefix:String(Math.round(Math.random()*1e10)),current:0},uo=ye__namespace.default.createContext(je),Rr=ye__namespace.default.createContext(false);var Sr=!!(typeof window<"u"&&window.document&&window.document.createElement),mt=new WeakMap;function Nr(e=false){let o=ye.useContext(uo),t=ye.useRef(null);if(t.current===null&&!e){var r,a;let n=(a=ye__namespace.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=mt.get(n);i==null?mt.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,mt.delete(n));}t.current=++o.current;}return t.current}function Tr(e){let o=ye.useContext(uo);o===je&&!Sr&&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=Nr(!!e),r=o===je&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function wr(e){let o=ye__namespace.default.useId(),[t]=ye.useState(Qe()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${je.prefix}`;return e||`${r}-${o}`}typeof ye__namespace.default.useId=="function"?wr:Tr;function Ir(){return false}function Br(){return true}function $r(e){return ()=>{}}function Qe(){return typeof ye__namespace.default.useSyncExternalStore=="function"?ye__namespace.default.useSyncExternalStore($r,Ir,Br):ye.useContext(Rr)}var Dr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Er=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function ft(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 Dr.has(t.script)}let o=e.split("-")[0];return Er.has(o)}var Ar=Symbol.for("react-aria.i18n.locale");function po(){let e=typeof window<"u"&&window[Ar]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:ft(e)?"rtl":"ltr"}}var bt=po(),ze=new Set;function mo(){bt=po();for(let e of ze)e(bt);}function fo(){let e=Qe(),[o,t]=ye.useState(bt);return ye.useEffect(()=>(ze.size===0&&window.addEventListener("languagechange",mo),ze.add(t),()=>{ze.delete(t),ze.size===0&&window.removeEventListener("languagechange",mo);}),[]),e?{locale:"en-US",direction:"ltr"}:o}var Hr=ye__namespace.default.createContext(null);function gt(){let e=fo();return ye.useContext(Hr)||e}var xt=new Map;function ht(e){let{locale:o}=gt(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(xt.has(t))return xt.get(t);let r=new Intl.Collator(o,e);return xt.set(t,r),r}function Xe(e){let o=ht({usage:"search",...e}),t=ye.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=ye.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=ye.useCallback((n,i)=>{if(i.length===0)return true;n=n.normalize("NFC"),i=i.normalize("NFC");let s=0,l=i.length;for(;s+l<=n.length;s++){let c=n.slice(s,s+l);if(o.compare(i,c)===0)return true}return false},[o]);return ye.useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function bo(e,o=300){let[t,r]=ye.useState(e);return ye.useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function Pe(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function q(e,o){return reactAriaComponents.composeRenderProps(e,t=>tailwindMerge.twMerge(o,t))}var A={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 ke={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},f=ye.memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=Kr__namespace[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let l=typeof o=="string"&&o in ke?ke[o]:o,c=tailwindMerge.twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsxRuntime.jsx(s,{...i,size:l,color:t,weight:r,className:c,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});f.displayName="Icon";var ho=ye.memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:l,ariaLabel:c,ref:u,...d})=>{let b=typeof a=="string"&&a in ke?ke[a]:a,v=t?typeof t=="string"&&t in ke?ke[t]:t:b*1.75,g=tailwindMerge.twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-gray-100 dark:bg-gray-800",e==="solid"&&"bg-brand text-white",e==="outline"&&"border-2 border-current",r);return jsxRuntime.jsx("div",{className:g,style:{width:v,height:v},children:jsxRuntime.jsx(f,{...d,name:i,size:a,color:s,weight:l,className:n,ariaLabel:c})})});ho.displayName="IconWithContainer";var Xr=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-slate-700 dark:bg-slate-600 border border-slate-800 dark:border-white/10 shadow-[inset_0_1px_0_0_theme(colors.gray.600)] dark:shadow-none text-white 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 yo({children:e,content:o,...t}){return jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger,{delay:200,children:[e,jsxRuntime.jsxs(reactAriaComponents.Tooltip,{...t,offset:10,className:reactAriaComponents.composeRenderProps(t.className,(r,a)=>Xr({...a,className:r})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-slate-700 stroke-gray-800 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 dark:fill-slate-600 dark:stroke-white/10 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function ge(){let[e,o]=ye__namespace.default.useState(false),t=ye__namespace.default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=ye__namespace.default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}function oe({children:e,className:o}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("relative w-full",o),children:e})}function Po({onClick:e,size:o="md",className:t}){return jsxRuntime.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:tailwindMerge.twMerge("absolute right-2 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsxRuntime.jsx(f,{name:"X",size:o==="sm"?16:20})})}function Ie(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 Fo(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function Jr(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 se(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:n="md",className:i}=e;return tailwindMerge.twMerge("w-full",Ie({isInvalid:o,isDisabled:t,isFocused:r}),Fo({transparent:a,isDisabled:t}),A[n].text,A[n].height,A[n].padding,Jr(n),i)}function Co(e){let{size:o="md",isFocusWithin:t,isInvalid:r,isDisabled:a,transparent:n,className:i}=e;return tailwindMerge.twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",Fo({transparent:n,isDisabled:a}),A[o].height,Ie({isFocused:t,isInvalid:r,isDisabled:a}),i)}function W({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let l=t||r&&a==="tooltip",c=t||r,u=r&&a==="inline",d=jsxRuntime.jsxs("label",{htmlFor:s,className:tailwindMerge.twMerge(A[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsxRuntime.jsx("span",{children:"*"}),l&&jsxRuntime.jsx("span",{className:"text-text-muted",children:jsxRuntime.jsx(f,{name:"Info",size:o==="sm"?16:20})}),u&&jsxRuntime.jsx("span",{className:"text-text-caption font-normal ml-1",children:r})]});return l&&c?jsxRuntime.jsx(yo,{content:c,children:d}):d}function w({size:e="md",className:o,children:t,...r}){return jsxRuntime.jsx("div",{...r,className:tailwindMerge.twMerge("leading-[2.25] text-text-caption",A[e].text,o),children:t})}function p({children:e,size:o="md",className:t}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.twMerge(A[o].text,"text-feedback-error-text",t),children:e})}function Je({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:a,className:n,...i}){return jsxRuntime.jsx("input",{className:se({isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:e,className:n}),...i})}function Be(e,o=false){let[t,r]=ye.useState(o);return ye.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 Me={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function Ro(e="base"){let o=Be(`(min-width: ${Me.sm})`,e!=="base"),t=Be(`(min-width: ${Me.md})`,["md","lg","xl","2xl"].includes(e)),r=Be(`(min-width: ${Me.lg})`,["lg","xl","2xl"].includes(e)),a=Be(`(min-width: ${Me.xl})`,["xl","2xl"].includes(e)),n=Be(`(min-width: ${Me["2xl"]})`,e==="2xl"),i=!t,s=t,l="base";return n?l="2xl":a?l="xl":r?l="lg":t?l="md":o&&(l="sm"),{current:l,isSm:o,isMd:t,isLg:r,isXl:a,is2Xl:n,isMobile:i,isDesktop:s}}var aa="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",na={default:"bg-action-default text-[color:var(--color-action-default-text)] hover:bg-action-default-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",brand:"bg-action-brand text-[color:var(--color-action-brand-text)] hover:bg-action-brand-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",secondary:"bg-transparent text-text-body border-2 border-border-muted hover:bg-text-body/5 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-body hover:bg-text-body/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-brand hover:text-action-brand/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-body hover:bg-background-hover hover:text-text-heading forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},No={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-brand text-white",destructive:"bg-action-destructive text-white"};function ca(e){return e?e==="primary"?"brand":e:"default"}function ua(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=ca(o),s=i==="unstyled"?"":`${aa} ${na[i]}`;i!=="unstyled"&&(s+=` ${A[t].text} ${A[t].height} ${A[t].padding} ${A[t].gap}`),r||n?s+=` ${ia}`:s+=` ${sa}`,a?s+=` ${No.full}`:s+=` ${No.default}`;let l=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,Pe(),l].filter(Boolean).join(" ")}function h(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:l,href:c,className:u,badgeNumber:d,badgeVariant:b="primary",badgePosition:v="top-right",style:g,target:m,rel:F,...y}=e,P=o?jsxRuntime.jsx(f,{name:o,size:i,weight:l}):null,B=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&P,typeof t=="function"?null:t,s==="right"&&P]}),E=jsxRuntime.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n||jsxRuntime.jsx(f,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsxRuntime.jsx("div",{className:"invisible","aria-hidden":"true",children:B}),a&&jsxRuntime.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),S=(d??0)>0,x=tailwindMerge.twMerge(ua(e),u),N=c?{href:c,target:m,rel:F,...y}:{};if(c){let{onPress:K,onPressStart:te,onPressEnd:D,onPressChange:X,onPressUp:U,onAuxClick:ce,onContextMenu:ue,onDoubleClick:_,...C}=y;Object.assign(N,C);}let k=c?jsxRuntime.jsx(reactAriaComponents.Link,{...N,...r&&{"aria-busy":true},style:S?void 0:g,className:x,children:r?E:typeof t=="function"?(function(K){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&P,t(K),s==="right"&&P]})}):B}):jsxRuntime.jsx(reactAriaComponents.Button,{...y,...r&&{"aria-busy":true},style:S?void 0:g,className:x,children:r?E:typeof t=="function"?(function(K){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&P,t(K),s==="right"&&P]})}):B});return S?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative flex",u),style:g,children:[k,jsxRuntime.jsx("span",{className:`absolute ${la[v]} flex h-5 w-5 items-center justify-center rounded-full ${da[b]} text-xs font-medium`,"aria-label":`${d} items`,children:d})]}):k}function Re({transparent:e=false,className:o,children:t,...r}){return jsxRuntime.jsx(reactAriaComponents.ModalOverlay,{...r,className:reactAriaComponents.composeRenderProps(o,(a,n)=>tailwindMerge.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-black/20 via-black/15 to-black/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-black/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 Fa({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 $e({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let l=reactAriaComponents.useSlottedContext(reactAriaComponents.PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=l?c-6:c;let u=jsxRuntime.jsxs(reactAriaComponents.Popover,{offset:c,...i,className:reactAriaComponents.composeRenderProps(r,(d,b)=>Fa({...b,className:d,disableGroup:n})),children:[o&&jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsxRuntime.jsx(Re,{isDismissable:a,children:jsxRuntime.jsx(reactAriaComponents.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 St({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let a=e||o||t;return !a&&!r?null:jsxRuntime.jsxs("div",{className:"flex h-28 w-full flex-col items-center justify-center border-t p-4",children:[r&&jsxRuntime.jsx("div",{className:"flex h-10 justify-center",children:r}),a&&jsxRuntime.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-3",children:[jsxRuntime.jsx("div",{children:t&&jsxRuntime.jsx(h,{size:t.size||"lg",variant:t.variant||"destructive",onPress:t.onPress,isLoading:t.isLoading,isDisabled:t.isDisabled,children:t.label})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[o&&jsxRuntime.jsx(h,{size:o.size||"lg",variant:o.variant||"secondary",onPress:o.onPress,isLoading:o.isLoading,isDisabled:o.isDisabled,children:o.label}),e&&jsxRuntime.jsx(h,{size:e.size||"lg",variant:e.variant||"default",onPress:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})]})]})]})}var Sa={xs:"text-lg font-semibold",sm:"text-xl font-semibold",md:"text-2xl font-semibold",lg:"text-3xl font-semibold",xl:"text-4xl font-semibold"},Na={page:"h-16 leading-[62px]"};function _e({tag:e="h1",size:o="lg",height:t,className:r="",children:a}){let n=Sa[o],i=t?Na[t]:"";return jsxRuntime.jsx(e,{className:tailwindMerge.twMerge(n,i,r),children:a})}var De=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:a=false,onBack:n,headerContent:i})=>jsxRuntime.jsxs("div",{className:tailwindMerge.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&&jsxRuntime.jsx(h,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsxRuntime.jsx(f,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e&&jsxRuntime.jsx(_e,{size:"xs",children:e}),o&&!t&&jsxRuntime.jsx(h,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsxRuntime.jsx(f,{name:"X","data-testid":"close-button"})})]})]});var le=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:d,"data-testid":b})=>{let[v,g]=ye.useState(l===0);if(ye.useEffect(()=>{if(l>0){let S=setTimeout(()=>g(true),l);return ()=>clearTimeout(S)}},[l]),!v)return null;let m=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)]",F=c&&e?(()=>{let S=typeof e=="number"?e:parseFloat(String(e));return isNaN(S)?"":`animation-duration-[${Math.max(.8,S/100)}s]`})():"",y=r==="pulse"?`animate-pulse ${F}`: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 ${F}`:"",P="rounded-sm";t==="circle"&&(P="rounded-full"),t==="text"&&(P="h-4 w-full rounded-sm");let B=n?"flex-1 min-w-0":"",E=s?Object.entries(s).map(([S,x])=>`${S}:w-[${x}]`).join(" "):"";return i?jsxRuntime.jsx("div",{className:"space-y-2","data-testid":b,children:i.map((S,x)=>jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(m,y,P,B,E,d),style:{width:S,height:o}},x))}):jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(m,y,P,B,E,d),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":b})};var $a={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"},Da="rounded-lg",Tt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Ea={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function de({variant:e="outlined",className:o,children:t,isLoading:r=false}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-full overflow-hidden",$a[e],Da,o),"data-testid":"card",children:r?jsxRuntime.jsx(le,{width:"100%",height:"100%",className:"rounded-none"}):t})}function Ze({title:e,subtitle:o,actions:t,className:r,isLoading:a=false}){return a?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx(le,{width:120,height:20}),jsxRuntime.jsx(le,{width:24,height:24})]}),o&&jsxRuntime.jsx(le,{width:200,height:16})]}):!e&&!o&&!t?null:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:jsxRuntime.jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsxRuntime.jsx("div",{className:"mb-1",children:typeof e=="string"?jsxRuntime.jsx(_e,{tag:"h3",size:"sm",className:"text-text-heading",children:e}):e}),o&&jsxRuntime.jsx("div",{className:"text-sm text-text-muted",children:o})]}),t&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:t})]})})}function ko({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("bg-background-muted",Tt[t],r),children:jsxRuntime.jsx(le,{width:"100%",height:"100%"})}):a?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Tt[t],r),children:a}):e?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Tt[t],r),children:jsxRuntime.jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function et({className:e,children:o,isLoading:t=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(a,e),children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(le,{width:"100%",height:16}),jsxRuntime.jsx(le,{width:"80%",height:16}),jsxRuntime.jsx(le,{width:"60%",height:16})]})}):o?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("px-6 py-4 text-text-body",e),children:o}):null}function Io({className:e,children:o,align:t="end",isLoading:r=false}){return r?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsxRuntime.jsx(le,{width:80,height:32}),jsxRuntime.jsx(le,{width:60,height:32})]}):o?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("px-6 py-4 flex items-center gap-2",Ea[t],e),children:o}):null}de.Header=Ze;de.Media=ko;de.Content=et;de.Footer=Io;var We=class extends ye.Component{constructor(){super(...arguments);ut(this,"state",{hasError:false});ut(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:jsxRuntime.jsxs(de,{children:[this.props.title&&jsxRuntime.jsx(de.Header,{title:this.props.title}),jsxRuntime.jsx(de.Content,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsxRuntime.jsx("p",{className:"text-red-500",children:this.state.error?.message||"Something went wrong"}),jsxRuntime.jsx("button",{className:"rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var za=.3,Ma=.5;function rt({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:l,isDismissable:c=true,transparentOverlay:u=false,primaryAction:d,secondaryAction:b,footerContent:v,maxHeight:g="80vh",height:m,maxWidth:F="640px",contentPadding:y=true,showHandle:P=true,animationVariant:B="scale",className:E}){let[S,x]=ye.useState(false),[N,k]=ye.useState(0),[K,te]=ye.useState(false),D=ye.useRef(null),X=ye.useRef(null),U=ye.useRef({isDragging:false,startY:0,startTime:0,pointerId:null});ye.useEffect(()=>{if(s){let V=setTimeout(()=>{x(true),setTimeout(()=>x(false),600);},400);return ()=>clearTimeout(V)}},[s]),ye.useEffect(()=>{s||(k(0),te(false),U.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]);let ce=ye.useCallback(V=>{c&&(V.pointerType!=="touch"&&V.pointerType!=="pen"||(X.current&&(clearTimeout(X.current),X.current=null),U.current={isDragging:true,startY:V.clientY,startTime:Date.now(),pointerId:V.pointerId},te(false),V.currentTarget.setPointerCapture(V.pointerId)));},[c]),ue=ye.useCallback(V=>{let{isDragging:be,startY:Q,pointerId:ve}=U.current;if(!be||V.pointerId!==ve)return;let H=V.clientY-Q;k(Math.max(0,H));},[]),_=ye.useCallback(V=>{let{isDragging:be,startY:Q,startTime:ve,pointerId:H}=U.current;if(!be||V.pointerId!==H)return;let T=V.clientY-Q,I=Date.now()-ve,O=T/I;U.current={isDragging:false,startY:0,startTime:0,pointerId:null};let vr=(D.current?.getBoundingClientRect().height??0)*za;(T>vr||O>Ma&&T>50)&&c?(l?.(),k(0)):(te(true),k(0),X.current=setTimeout(()=>{te(false),X.current=null;},200));},[c,l]);if(!s)return null;let C=o||t,he=d||b||v;return jsxRuntime.jsx(We,{children:jsxRuntime.jsx(Re,{isOpen:s,onOpenChange:V=>{V||l?.();},isDismissable:c,transparent:u,className:"flex items-end justify-center p-0 sm:p-4",children:jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx("div",{ref:D,className:tailwindMerge.twMerge("w-full",K&&"transition-transform duration-200"),style:{transform:N>0?`translateY(${N}px)`:void 0},children:jsxRuntime.jsxs(reactAriaComponents.Dialog,{className:tailwindMerge.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",B==="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)]",B==="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)]",E),style:{maxWidth:F,...m?{height:m}:{maxHeight:g}},children:[P&&jsxRuntime.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:ce,onPointerMove:ue,onPointerUp:_,onPointerCancel:_,children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",S&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),C&&(n?jsxRuntime.jsx(De,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!l,hasBackArrow:true,onBack:i??(()=>{}),onClose:l||(()=>{})}):jsxRuntime.jsx(De,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!l,onClose:l||(()=>{})})),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",y?"p-4":"p-0"),children:e}),he&&jsxRuntime.jsx(St,{primaryAction:d,secondaryAction:b,footerContent:v})]})})})})})}rt.displayName="Tray";var Et=ye.createContext("md");function zo(){return ye.useContext(Et)}function Vo(e="md"){return `flex-1 text-start data-[placeholder]:text-text-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${A[e].text}`}function Wa(){let e=ye__namespace.default.useCallback((t,r)=>{r?.(t);},[]),o=ye__namespace.default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function Lt({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:l,defaultSelectedKey:c,onSelectionChange:u,placeholder:d,showErrors:b=false,tooltip:v,isRequired:g,transparent:m,reserveErrorSpace:F=false,placement:y="bottom start",shouldFlip:P=true,menuWidth:B="match",descriptionPlacement:E="below",useMobileTray:S=true,...x}){let[N,k]=ye.useState(null),[K,te]=ye.useState(null),[D,X]=ye.useState(false),U=l??N??c,{handleFocus:ce,handleBlur:ue}=Wa(),{isMobile:_}=Ro(),C=S&&_,he=ye__namespace.default.useMemo(()=>!i||!U||!a?null:Array.from(a).find(T=>T.id===U)??null,[i,U,a]),V=H=>{u&&H!==null&&u(H),u||k(H);},be=ye.useRef(null),Q=ye.useRef(null),ve=()=>{C&&X(!D);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.Select,{...x,selectedKey:U,defaultSelectedKey:c,onSelectionChange:V,placeholder:d,className:q(x.className,"group flex w-full flex-col"),ref:be,onOpenChange:H=>{C||(H&&Q.current?te(Q.current.offsetWidth):H||be.current?.blur());},children:({isDisabled:H,isInvalid:T,isOpen:I})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(W,{size:s,tooltip:v,description:E==="tooltip"||E==="inline"?o:void 0,descriptionPlacement:E,isRequired:g,children:e}),jsxRuntime.jsx(oe,{children:jsxRuntime.jsx("div",{ref:Q,children:jsxRuntime.jsxs(h,{variant:"unstyled",className:tailwindMerge.twMerge(se({isInvalid:T||b&&!!t,isDisabled:H,isFocused:C?D:I,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:O=>ce(O,x.onFocus),onBlur:O=>ue(O,x.onBlur),onPress:C?ve:void 0,"data-open":C?D:I,children:[i&&he?jsxRuntime.jsx("div",{className:Vo(s),children:i(he)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:Vo(s)}),jsxRuntime.jsx(f,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",(C?D:I)&&"rotate-180")})]})})}),F?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:b?jsxRuntime.jsx(p,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&x.validationResult?t(x.validationResult):typeof t=="string"?t:null}):o&&E==="below"?jsxRuntime.jsx(w,{size:s,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:b?jsxRuntime.jsx(p,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&x.validationResult?t(x.validationResult):typeof t=="string"?t:null}):o&&E==="below"?jsxRuntime.jsx(w,{size:s,className:"mt-1",children:o}):null}),C?null:jsxRuntime.jsx($e,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:B==="match"&&K?`${K}px`:void 0,minWidth:B==="auto"&&K?`${K}px`:void 0,maxWidth:B==="auto"?"min(600px, 90vw)":void 0},placement:y,shouldFlip:P,children:jsxRuntime.jsx(Et.Provider,{value:s,children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?O=>jsxRuntime.jsx(Ce,{id:O.id,textValue:O.label,size:s,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(O)})},O.id):r})})})]})}),C&&jsxRuntime.jsx(rt,{isOpen:D,onClose:()=>X(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(Et.Provider,{value:s,children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:a,className:"w-full bg-background-surface p-0 outline-0",selectionMode:"single",selectedKeys:U!=null?[U]:[],onSelectionChange:H=>{let T=Array.from(H)[0];T!=null&&(V(T),X(false));},children:n&&a?H=>jsxRuntime.jsx(Ce,{id:H.id,textValue:H.label,size:s,className:"border-b border-border-muted last:border-0 px-6",children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(H)})},H.id):r})})})]})}function Ce({size:e,className:o,...t}){let r=zo(),a=e??r;return jsxRuntime.jsx(reactAriaComponents.ListBoxItem,{...t,className:tailwindMerge.twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-body 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",A[a].paddingY,A[a].text,o)})}var on={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},rn={sm:"pl-7",md:"pl-9",lg:"pl-10",xl:"pl-12"},Mo={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"};function an(){let e=ye__namespace.default.useContext(reactAriaComponents.ComboBoxStateContext);return jsxRuntime.jsx(reactAriaComponents.Button,{slot:null,className:"clear-button","aria-label":"Clear",onPress:()=>e?.setSelectedKey(null),children:"\u2715"})}var Mt=(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 nn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,c])=>{a.append(l,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){console.error("Error in REST request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}async function sn(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){console.error("Error in GraphQL request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}function Ot({label:e,staticItems:o=[],sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:l,errorMessage:c,description:u,size:d="md",tooltip:b,isRequired:v,isDisabled:g,isInvalid:m,validationResult:F,showErrors:y=true,renderItem:P,renderLeftIcon:B,renderSection:E,autoFocus:S=false,reserveErrorSpace:x=false,hideChevron:N=false}){let k=ye__namespace.default.useRef(null),[K,te]=ye__namespace.default.useState(),[D,X]=ye.useState(()=>Mt(r||a,o,t)),[U,ce]=ye.useState(false),ue=bo(D),{contains:_}=Xe({sensitivity:"base"}),[C,he]=ye.useState(),V=A[d].text,be=A[d].height,Q=null;ye.useEffect(()=>{S&&ce(true);},[S]),ye.useEffect(()=>{let T=()=>{k.current&&te(k.current.offsetWidth);};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),ye.useEffect(()=>{Q&&Q.setFilterText(ue);},[ue,Q]),i&&(Q=reactStately.useAsyncList({async load({signal:T,filterText:I=""}){if(!i.url||i.shouldLoad&&!i.shouldLoad(I))return {items:[]};try{let O;return i.requestType==="GraphQL"?O=await sn(i,I,T):O=await nn(i,I,T),he(O.error),{items:O.items}}catch(O){return console.error("Error loading items:",O),he(O instanceof Error?O.message:"Unknown error occurred"),{items:[]}}},initialFilterText:""})),ue===""&&(Q=null);let ve=T=>{let I=Mt(T,o,t);X(I),n&&n(T);},H=T=>{X(T);let I=Mt(r,o,t);r!=null&&T!==I&&n&&n(null);};return jsxRuntime.jsx(reactAriaComponents.ComboBox,{onSelectionChange:ve,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(T=>T.items):o,items:Q?Q.items:void 0,className:q("group flex flex-col","w-full"),menuTrigger:"focus",isDisabled:g,isInvalid:m||!!c,inputValue:D,onInputChange:H,autoFocus:S,defaultFilter:s||_,"aria-label":e||l||"Autocomplete",children:T=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(W,{size:d,tooltip:b,isRequired:v,children:e}),jsxRuntime.jsxs(reactAriaComponents.Group,{ref:k,className:Co({size:d,isInvalid:m||!!c,isDisabled:g,isFocusWithin:U||T.isOpen,className:"w-full cursor-pointer"}),"aria-label":e||l||"Autocomplete",style:{position:"relative"},children:[B?jsxRuntime.jsx("div",{className:"absolute left-3",children:B(!!Q?.isLoading)}):jsxRuntime.jsx(f,{name:"MagnifyingGlass",className:`${on[d]} absolute left-3 text-inherit`}),jsxRuntime.jsx(reactAriaComponents.Input,{className:`flex-1 min-w-0 border-none pr-3 outline-0 placeholder:text-text-placeholder ${rn[d]} ${V} ${be} ${g?"bg-background-muted":"bg-background-input"}`,placeholder:l,disabled:g,onFocus:()=>ce(true),onBlur:()=>ce(false)}),D&&!g&&jsxRuntime.jsx(an,{}),!N&&jsxRuntime.jsx(reactAriaComponents.Button,{className:`px-2 text-text-body ${V} ${be} ${g?"bg-background-muted":"bg-background-input"}`,"aria-label":"Toggle menu",isDisabled:g,children:({isPressed:I})=>jsxRuntime.jsx(f,{name:I?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),x?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:y&&C?jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text",children:C}):y&&typeof c=="string"?jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text",children:c}):y&&typeof c=="function"&&F?jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text",children:c(F)}):u?jsxRuntime.jsx(w,{size:d,children:u}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u&&jsxRuntime.jsx(w,{size:d,className:"mt-1",children:u}),y&&C&&jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:C}),y&&typeof c=="string"&&jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:c}),y&&typeof c=="function"&&F&&jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:c(F)})]}),jsxRuntime.jsx($e,{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:K?`${K}px`:void 0},children:jsxRuntime.jsx(reactAriaComponents.ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${V}`,children:t?t.map(I=>{let O=I.items.map(ne=>jsxRuntime.jsx(Ce,{id:ne.id,textValue:ne.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${Mo[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium`,children:P?P(ne):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ne.name,jsxRuntime.jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ne.id));if(E){let ne=E(I,O);return ye__namespace.default.isValidElement(ne)&&ne.type===reactAriaComponents.ListBoxSection?ne:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:ne},I.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:I.name}),O]},I.name)}):I=>jsxRuntime.jsx(Ce,{id:I.id,textValue:I.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${Mo[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium`,children:P?P(I):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[I.name,jsxRuntime.jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},I.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 qc({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Ot,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}function _o(e){return jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:q(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(W,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(w,{children:e.description}),jsxRuntime.jsx(p,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function bn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function gn({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r,variant:a="default"}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",i=a==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(t)s="border-border-muted bg-background-muted";else if(o)s="border-feedback-error-border bg-feedback-error-background";else if(e||r){let l=a==="brand"?"action-brand":"action-default";s=`bg-${l} border-${l} hover:bg-${l}-hover hover:border-${l}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${n} ${i} ${s}`}var Go="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function qo(e){let{children:o,variant:t="default",...r}=e;return jsxRuntime.jsx(reactAriaComponents.Checkbox,{...r,className:reactAriaComponents.composeRenderProps(e.className,(a,n)=>`${bn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,l=jsxRuntime.jsx("div",{className:gn({isSelected:n,isIndeterminate:i,variant:t,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:Go}):n?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:Go}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,typeof o=="function"?o(a):o]})}})}function su({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(qo,{...r,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!i,children:r.children}),t&&i&&jsxRuntime.jsx(p,{children:i})]})})}function pu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(_o,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function Ve(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 qt(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 Yo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:l,value:c,defaultValue:u,onChange:d,placeholder:b="#000000",showColorSwatch:v=true,reserveErrorSpace:g=true,...m}){let[F,y]=ye.useState(u||""),[P,B]=ye.useState(c||u||""),[E,S]=ye.useState(false),[x,N]=ye.useState(null),{isFocused:k,handleFocus:K,handleBlur:te}=ge(),D=c!==void 0?c:F;ye.useEffect(()=>{c!==void 0&&B(c);},[c]);let X=D?!Ve(D):false,U=ye.useCallback(_=>{if(B(_),Ve(_)){let C=qt(_);d?d(C):y(C);}else _===""&&(d?d(""):y(""));},[d]),ce=ye.useCallback(_=>{let C=qt(_);B(C),d?d(C):y(C);},[d]),ue=ye.useCallback(_=>{if(Ve(P)){let C=qt(P);B(C),d&&C!==D?d(C):!d&&C!==F&&y(C);}te(_,m.onBlur);},[P,D,F,d,te,m.onBlur]);return jsxRuntime.jsx(reactAriaComponents.TextField,{...m,isRequired:n,className:q(s,"group flex flex-col"),children:({isDisabled:_})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(W,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(oe,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.jsx(Je,{size:r,disabled:_,type:"text",value:P,placeholder:b,onFocus:C=>K(C,m.onFocus),onBlur:ue,onChange:C=>U(C.target.value),className:tailwindMerge.twMerge(se({isInvalid:X,isDisabled:_,isFocused:k,size:r,transparent:i}),v?"pr-12":"pr-3","pl-3")}),v&&jsxRuntime.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:A[r].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-6 h-6 rounded border shadow-sm",Ve(D)?"border-border-default":"border-border-default bg-background-muted"),style:Ve(D)?{backgroundColor:D}:void 0,"aria-hidden":"true",children:!Ve(D)&&jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsxRuntime.jsx("div",{ref:N,children:jsxRuntime.jsx(h,{variant:"secondary",size:r,icon:"Palette",onPress:()=>S(!E),isDisabled:_,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&l?jsxRuntime.jsx(p,{size:r,children:t(l)}):o?jsxRuntime.jsx(w,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(l)}):o?jsxRuntime.jsx(w,{size:r,className:"mt-1",children:o}):null}),E&&x&&jsxRuntime.jsx($e,{triggerRef:{current:x},isOpen:E,onOpenChange:S,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsx(reactColorful.HexColorPicker,{color:D||"#000000",onChange:ce,style:{width:"200px",height:"200px"}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:D||"#000000"}}),jsxRuntime.jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:D||"#000000"})]})]})})]})})}function Bu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Yo,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function zn({isSelected:e,isDisabled:o}){let t=[Pe,"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-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function Kt({errorMessage:e,...o}){return jsxRuntime.jsxs(reactAriaComponents.Calendar,{...o,children:[jsxRuntime.jsx(Qo,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(Xo,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:t=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${zn({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function Qo(){let{direction:e}=reactAriaComponents.useLocale(),o=18;return jsxRuntime.jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsxRuntime.jsx(h,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(f,{name:"CaretRight","aria-hidden":true,size:o}):jsxRuntime.jsx(f,{name:"CaretLeft","aria-hidden":true,size:o})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-zinc-900 dark:text-zinc-200"}),jsxRuntime.jsx(h,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(f,{name:"CaretLeft","aria-hidden":true,size:o}):jsxRuntime.jsx(f,{name:"CaretRight","aria-hidden":true,size:o})})]})}function Xo(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function Yt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:l=true,reserveErrorSpace:c=true,validationResult:u,className:d,...b}){let[v,g]=ye.useState(false),m=F=>{b.onChange&&F&&b.onChange(F),g(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...b,isDisabled:i,isRequired:n,isInvalid:s,className:q(d,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(W,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(oe,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(Zo,{size:r,isDisabled:i,isInvalid:s,hasCalendar:l}),l&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:v,onOpenChange:g,children:[jsxRuntime.jsx(h,{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-muted hover:text-text-body transition-colors","aria-label":"Open calendar",children:jsxRuntime.jsx(f,{name:"Calendar",size:18})}),jsxRuntime.jsx(reactAriaComponents.Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"p-4 outline-none",children:jsxRuntime.jsx(Kt,{value:b.value,onChange:m,minValue:b.minValue,maxValue:b.maxValue,isDisabled:i,isReadOnly:b.isReadOnly,isDateUnavailable:b.isDateUnavailable})})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&u?jsxRuntime.jsx(p,{size:r,children:t(u)}):o?jsxRuntime.jsx(w,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(u)}):o?jsxRuntime.jsx(w,{size:r,className:"mt-1",children:o}):null})]})}function Kn({isPlaceholder:e,isDisabled:o,size:t="md"}){return tailwindMerge.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-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function Zo({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Ie({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",a),...n,children:i=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:i,className:Kn({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function cm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Yt,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function jt({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:l=true,placeholder:c="Drop files here or click to browse"}){let[u,d]=ye.useState(false),[b,v]=ye.useState(false),[g,m]=ye.useState(null),[F,y]=ye.useState(e),P=ye.useRef(null),B=async x=>{if(m(null),a&&x.size>a){m(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(l&&x.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{y(N.result);},N.readAsDataURL(x);}if(i){v(true);try{let N=await i(x);y(N),t?.(N);}catch(N){m("Failed to upload file"),console.error("Upload error:",N);}finally{v(false);}}o?.(x,F);},E=x=>{let N=x.items;if(N.length>0){let k=N[0];if(k.kind==="file"){let K=k.getAsFile();K&&B(K);}}d(false);},S=()=>{y(void 0),m(null),o?.(null),t?.(""),P.current&&(P.current.value="");};return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",s),children:[jsxRuntime.jsxs(reactAriaComponents.DropZone,{className:tailwindMerge.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",g&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:E,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[F?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&F.startsWith("data:image")?jsxRuntime.jsx("img",{src:F,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Image,{className:"h-12 w-12 text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!n&&jsxRuntime.jsx(h,{variant:"icon",size:"sm",onPress:S,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"h-12 w-12 text-text-muted"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-body",children:c}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-muted",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:r.split(","),onSelect:x=>{let N=Array.from(x||[]);N.length>0&&B(N[0]);},children:jsxRuntime.jsx(h,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),b&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"Uploading..."})]})})]}),g&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function Nm({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(jt,{...r,value:s.value??"",onChange:(l,c)=>s.onChange(c||"")}),t&&i&&jsxRuntime.jsx(p,{children:i})]})})}var ci=e=>{let o=se({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return tailwindMerge.twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function Jt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:l=true,descriptionPlacement:c="below",...u}){let d=ye.useId(),{isFocused:b,handleFocus:v,handleBlur:g}=ge();return jsxRuntime.jsx(reactAriaComponents.NumberField,{...u,id:d,isRequired:n,className:q(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:F})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(W,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:d,children:e}),jsxRuntime.jsx("div",{className:"relative",children:jsxRuntime.jsxs(reactAriaComponents.Group,{className:"relative",children:[jsxRuntime.jsx(reactAriaComponents.Input,{onFocus:P=>v(P,u.onFocus),onBlur:P=>g(P,u.onBlur),className:ci({isInvalid:F||!!t,isDisabled:m,isFocused:b,transparent:i,size:r,className:typeof u.className=="string"?u.className:void 0})}),jsxRuntime.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:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(f,{name:"CaretUp",size:14})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(f,{name:"CaretDown",size:14})})]})]})}),l?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsxRuntime.jsx(p,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(w,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:t?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(w,{size:r,className:"mt-1",children:o}):null})]})})}function Wm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Jt,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}var gi=ye.createContext({variant:"brand"});function Zt(e){let{variant:o="default",...t}=e;return jsxRuntime.jsx(gi.Provider,{value:{variant:o},children:jsxRuntime.jsxs(reactAriaComponents.RadioGroup,{...t,className:q(e.className,"group flex flex-col gap-2"),children:[jsxRuntime.jsx(W,{children:e.label}),jsxRuntime.jsx("div",{className:"flex gap-2 group-orientation-horizontal:gap-4 group-orientation-vertical:flex-col",children:e.children}),e.description&&jsxRuntime.jsx(w,{children:e.description}),jsxRuntime.jsx(p,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function mp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Zt,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var eo=({className:e,size:o=24,color:t="text-action-brand"})=>jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsx("span",{className:"sr-only",children:"Loading..."})});var Ri=e=>{let o=se({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return tailwindMerge.twMerge(o,t,e.className)};function Ye({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:l,onClear:c,type:u,validationResult:d,reserveErrorSpace:b=true,isLoading:v=false,descriptionPlacement:g="below",...m}){let[F,y]=ye__namespace.default.useState(false),{isFocused:P,handleFocus:B,handleBlur:E}=ge(),S=u==="password";return jsxRuntime.jsx(reactAriaComponents.TextField,{...m,isRequired:n,className:q(m.className,"group flex flex-col"),children:({isDisabled:x,isInvalid:N})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(W,{size:r,tooltip:a,description:g==="tooltip"||g==="inline"?o:void 0,descriptionPlacement:g,isRequired:n,children:e}),jsxRuntime.jsxs(oe,{children:[s&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 transform flex items-center z-10",children:v?jsxRuntime.jsx(eo,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(f,{name:"MagnifyingGlass",className:`h-4 w-4 translate-y-[0.5px] transition-colors ${P?"text-action-brand":"text-text-muted"}`})}),jsxRuntime.jsx(Je,{size:r,disabled:x,type:S?F?"text":"password":u,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:k=>B(k,m.onFocus),onBlur:k=>E(k,m.onBlur),onChange:k=>m.onChange?.(k.target.value),className:Ri({isInvalid:N,isDisabled:x,isFocused:P,size:r,transparent:i,showSearchIcon:s,isClearable:l,hasValue:!!m.value,isPassword:S,className:typeof m.className=="string"?m.className:void 0})}),l&&m.value&&!x&&jsxRuntime.jsx(Po,{onClick:()=>{c?c():m.onChange&&m.onChange("");},size:r}),S&&!x&&jsxRuntime.jsx("button",{type:"button",onClick:()=>y(!F),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":F?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsxRuntime.jsx(f,{name:F?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),b?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,children:t(d)}):o&&g==="below"?jsxRuntime.jsx(w,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(d)}):o&&g==="below"?jsxRuntime.jsx(w,{size:r,className:"mt-1",children:o}):null})]})})}var Te=({isActive:e=false,onPress:o,children:t})=>jsxRuntime.jsx(h,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function Ei({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=ye.useState(e);return ye__namespace.default.useEffect(()=>{n(e);},[e]),jsxRuntime.jsx(Re,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsxRuntime.jsx(reactAriaComponents.Modal,{isDismissable:true,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:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxRuntime.jsxs("form",{onSubmit:s=>{s.preventDefault(),r(a),t();},children:[jsxRuntime.jsx(De,{title:"Insert Link",onClose:t}),jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(Ye,{label:"URL",type:"url",value:a,onChange:n,autoFocus:true,className:"w-full"})}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsxRuntime.jsx(h,{variant:"secondary",onPress:t,children:"Cancel"}),jsxRuntime.jsx(h,{type:"submit",children:"Save"})]})]})})})})}function oo({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n}){let[i,s]=ye.useState(false),l=react.useEditor({immediatelyRender:false,extensions:[Ii__default.default.configure({heading:{levels:[1,2]}}),Ni__default.default.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:d})=>{o?.(d.getHTML());},editorProps:{attributes:{class:tailwindMerge.twMerge("prose prose-sm max-w-none","focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),c=()=>{s(true);},u=d=>{d===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:d}).run();};return l?jsxRuntime.jsxs("div",{id:n,"data-richtexteditor":true,className:tailwindMerge.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:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(menus.BubbleMenu,{editor:l,shouldShow:({editor:d})=>d.isActive("link")&&!i,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxRuntime.jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let d=l.getAttributes("link").href;window.open(d,"_blank");},children:[jsxRuntime.jsx(f,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxRuntime.jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:c,children:[jsxRuntime.jsx(f,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxRuntime.jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsxRuntime.jsx(f,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsxRuntime.jsx(Ei,{isOpen:i,onClose:()=>s(false),onSubmit:u,initialUrl:l.getAttributes("link").href||""})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 border-b border-border-input p-2",children:[jsxRuntime.jsx(Te,{isActive:l.isActive("heading",{level:1}),onPress:()=>l.chain().focus().toggleHeading({level:1}).run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"H1"})}),jsxRuntime.jsx(Te,{isActive:l.isActive("heading",{level:2}),onPress:()=>l.chain().focus().toggleHeading({level:2}).run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"H2"})}),jsxRuntime.jsx(Te,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"B"})}),jsxRuntime.jsx(Te,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsxRuntime.jsx("span",{className:"text-xs italic",children:"I"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Te,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsxRuntime.jsx(f,{name:"ListBullets",className:"h-4 w-4"})}),jsxRuntime.jsx(Te,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsxRuntime.jsx(f,{name:"ListNumbers",className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Te,{isActive:l.isActive("link"),onPress:c,children:jsxRuntime.jsx(f,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxRuntime.jsxs("div",{className:"relative min-h-[200px] w-full outline-none focus:outline-none",children:[jsxRuntime.jsx(react.EditorContent,{editor:l,className:tailwindMerge.twMerge("w-full p-4 outline-none focus:outline-none","[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none","[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold","[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold","[&_.ProseMirror_p]:mb-2","[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6 [&_.ProseMirror_ol]:list-decimal","[&_.ProseMirror_li]:mb-1","[&_.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&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-4 top-4 text-text-muted",children:a})]})]}):null}function Xp({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=reactHookForm.useFormContext(),l=L(s.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsxRuntime.jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-heading",children:t}),r&&jsxRuntime.jsx("p",{className:"text-sm text-text-muted",children:r}),jsxRuntime.jsx(oo,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),l&&jsxRuntime.jsx("p",{className:"text-sm text-feedback-error-text",children:l}),a&&!l&&jsxRuntime.jsx("div",{className:"h-5"})]})})}function sf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Lt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var ao={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 Gi({isSelected:e,isDisabled:o,variant:t="default",size:r="md"}){let a="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=ao[r].track,i=Pe,s=t==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",l="";return e?t==="brand"?l="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":l="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":l="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[a,n,i,s,l,o?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function _i({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",a=ao[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function no({children:e,variant:o="default",size:t="md",...r}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...r,className:q(r.className,`group flex items-center gap-2 ${ao[t].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:a=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:Gi({...a,variant:o,size:t}),children:jsxRuntime.jsx("span",{className:_i({...a,size:t})})}),e]})})}function vf({name:e,defaultValue:o,...t}){let{control:r}=reactHookForm.useFormContext();return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsxRuntime.jsx(no,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var ji=e=>{let o=se({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 tailwindMerge.twMerge(o,t,e.className)};function io({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:l,isResizable:c=false,className:u,validationResult:d,reserveErrorSpace:b=true,...v}){let{isFocused:g,handleFocus:m,handleBlur:F}=ge();return jsxRuntime.jsx("div",{className:"group flex flex-col",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(W,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(oe,{children:jsxRuntime.jsx("textarea",{...v,required:n,onFocus:y=>{v.onFocus&&v.onFocus(y),m(y);},onBlur:y=>{v.onBlur&&v.onBlur(y),F(y);},className:ji({isInvalid:s,isDisabled:l,isResizable:c,isFocused:g,size:r,transparent:i,className:u}),disabled:l})}),b?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,children:t(d)}):o?jsxRuntime.jsx(w,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(d)}):o?jsxRuntime.jsx(w,{size:r,className:"mt-1",children:o}):null})]})})}function $f({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(io,{...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 zf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Ye,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function ns({isPlaceholder:e,isDisabled:o,size:t="md"}){return tailwindMerge.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-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function so({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:l=true,validationResult:c,className:u,descriptionPlacement:d="below",...b}){return jsxRuntime.jsxs(reactAriaComponents.TimeField,{...b,isDisabled:i,isRequired:n,isInvalid:s,className:q(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(W,{size:r,tooltip:a,description:d==="tooltip"||d==="inline"?o:void 0,descriptionPlacement:d,isRequired:n,children:e}),jsxRuntime.jsx(oe,{children:jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Ie({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:v,className:ns({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||i,size:r})})})}),l?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&c?jsxRuntime.jsx(p,{size:r,children:t(c)}):o&&d==="below"?jsxRuntime.jsx(w,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(c)}):o&&d==="below"?jsxRuntime.jsx(w,{size:r,className:"mt-1",children:o}):null})]})}function ab({name:e,...o}){let{control:t,formState:{errors:r}}=reactHookForm.useFormContext(),a=r[e],n=a?.message;return jsxRuntime.jsx(reactHookForm.Controller,{name:e,control:t,render:({field:i})=>jsxRuntime.jsx(so,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function db({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=reactHookForm.useFormContext(),a=ye__namespace.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(ye__namespace.useEffect(()=>{t&&s&&a.current?.focus();},[t,s]),!s)return null;let l=c=>{let u=`[name="${CSS.escape(c)}"]`,d=document.querySelector(u);d&&(d.focus(),d.scrollIntoView({block:"center",behavior:"smooth"}));};return jsxRuntime.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:tailwindMerge.twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsxRuntime.jsx("div",{className:"font-medium",children:o}),jsxRuntime.jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([c,u])=>{let d=u?.message||"Invalid value";return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>l(c),children:d})},c)})})]})}function fb({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:a,...n}){let{formState:i}=reactHookForm.useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsxRuntime.jsx(h,{type:"submit",form:e,isDisabled:s,...n,children:a})}function yb({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=reactHookForm.useFormContext(),{fields:n,append:i,remove:s,swap:l}=reactHookForm.useFieldArray({control:a,name:e});return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[n.map((c,u)=>jsxRuntime.jsxs(de,{children:[jsxRuntime.jsx(Ze,{title:o?o(u):`Item ${u+1}`,actions:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[u>0&&jsxRuntime.jsx(h,{size:"sm",variant:"secondary",onPress:()=>l(u,u-1),children:"Up"}),u<n.length-1&&jsxRuntime.jsx(h,{size:"sm",variant:"secondary",onPress:()=>l(u,u+1),children:"Down"}),jsxRuntime.jsx(h,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsxRuntime.jsx(et,{children:t(u)})]},c.id)),jsxRuntime.jsx("div",{children:jsxRuntime.jsx(h,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function co(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function fr(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 Eb({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=reactHookForm.useForm(i),l=(c,u)=>{if(a&&e){let d=document.getElementById(e);d&&fr(d);}t?.(c,u);};return jsxRuntime.jsx(reactHookForm.FormProvider,{...s,children:jsxRuntime.jsx(co,{id:e,className:n,onSubmit:s.handleSubmit(o,l),children:r})})}function xr({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:a="Save changes",secondaryLabel:n="Cancel",className:i}){return o?jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsxRuntime.jsx("div",{className:"text-sm text-text-muted",children:"You have unsaved changes"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(h,{variant:"secondary",onPress:r,children:n}),jsxRuntime.jsx(h,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function _b({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=reactHookForm.useFormContext();return jsxRuntime.jsx(xr,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function Ub(e=true){let{formState:o}=reactHookForm.useFormContext();ye__namespace.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 Qb({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=reactHookForm.useFormContext(),n=ye__namespace.useRef(void 0);ye__namespace.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]);}exports.ErrorSummary=db;exports.FieldArrayList=yb;exports.FormAutocomplete=qc;exports.FormCheckbox=su;exports.FormCheckboxGroup=pu;exports.FormColorField=Bu;exports.FormDateField=cm;exports.FormFileUpload=Nm;exports.FormNumberField=Wm;exports.FormProvider=Eb;exports.FormRadioGroup=mp;exports.FormRichTextEditor=Xp;exports.FormSaveBar=_b;exports.FormSelect=sf;exports.FormSwitch=vf;exports.FormTextArea=$f;exports.FormTextField=zf;exports.FormTimeField=ab;exports.SubmitButton=fb;exports.focusFirstError=fr;exports.useAutoSave=Qb;exports.useScrollIntoViewOnError=Ub;//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var reactHookForm=require('react-hook-form'),Ne=require('react'),reactAriaComponents=require('react-aria-components'),reactStately=require('react-stately'),tailwindMerge=require('tailwind-merge'),aa=require('@phosphor-icons/react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactColorful=require('react-colorful'),Li=require('@tiptap/extension-link'),react=require('@tiptap/react'),menus=require('@tiptap/react/menus'),Mi=require('@tiptap/starter-kit');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Ne__namespace=/*#__PURE__*/_interopNamespace(Ne);var aa__namespace=/*#__PURE__*/_interopNamespace(aa);var Li__default=/*#__PURE__*/_interopDefault(Li);var Mi__default=/*#__PURE__*/_interopDefault(Mi);var wr=Object.defineProperty;var kr=(e,o,t)=>o in e?wr(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Nt=(e,o,t)=>kr(e,typeof o!="symbol"?o+"":o,t);var nt={prefix:String(Math.round(Math.random()*1e10)),current:0},Ro=Ne__namespace.default.createContext(nt),Dr=Ne__namespace.default.createContext(false);var $r=!!(typeof window<"u"&&window.document&&window.document.createElement),Tt=new WeakMap;function Er(e=false){let o=Ne.useContext(Ro),t=Ne.useRef(null);if(t.current===null&&!e){var r,a;let n=(a=Ne__namespace.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=Tt.get(n);i==null?Tt.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,Tt.delete(n));}t.current=++o.current;}return t.current}function Lr(e){let o=Ne.useContext(Ro);o===nt&&!$r&&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=Er(!!e),r=o===nt&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Vr(e){let o=Ne__namespace.default.useId(),[t]=Ne.useState(it()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${nt.prefix}`;return e||`${r}-${o}`}typeof Ne__namespace.default.useId=="function"?Vr:Lr;function zr(){return false}function Mr(){return true}function Hr(e){return ()=>{}}function it(){return typeof Ne__namespace.default.useSyncExternalStore=="function"?Ne__namespace.default.useSyncExternalStore(Hr,zr,Mr):Ne.useContext(Dr)}var Or=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Gr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function kt(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 Or.has(t.script)}let o=e.split("-")[0];return Gr.has(o)}var Wr=Symbol.for("react-aria.i18n.locale");function No(){let e=typeof window<"u"&&window[Wr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:kt(e)?"rtl":"ltr"}}var It=No(),qe=new Set;function So(){It=No();for(let e of qe)e(It);}function To(){let e=it(),[o,t]=Ne.useState(It);return Ne.useEffect(()=>(qe.size===0&&window.addEventListener("languagechange",So),qe.add(t),()=>{qe.delete(t),qe.size===0&&window.removeEventListener("languagechange",So);}),[]),e?{locale:"en-US",direction:"ltr"}:o}var Yr=Ne__namespace.default.createContext(null);function Bt(){let e=To();return Ne.useContext(Yr)||e}var Dt=new Map;function $t(e){let{locale:o}=Bt(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(Dt.has(t))return Dt.get(t);let r=new Intl.Collator(o,e);return Dt.set(t,r),r}function st(e){let o=$t({usage:"search",...e}),t=Ne.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=Ne.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=Ne.useCallback((n,i)=>{if(i.length===0)return true;n=n.normalize("NFC"),i=i.normalize("NFC");let s=0,l=i.length;for(;s+l<=n.length;s++){let c=n.slice(s,s+l);if(o.compare(i,c)===0)return true}return false},[o]);return Ne.useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function $e(e,o=false){let[t,r]=Ne.useState(o);return Ne.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 We={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function lt(e="base"){let o=$e(`(min-width: ${We.sm})`,e!=="base"),t=$e(`(min-width: ${We.md})`,["md","lg","xl","2xl"].includes(e)),r=$e(`(min-width: ${We.lg})`,["lg","xl","2xl"].includes(e)),a=$e(`(min-width: ${We.xl})`,["xl","2xl"].includes(e)),n=$e(`(min-width: ${We["2xl"]})`,e==="2xl"),i=!t,s=t,l="base";return n?l="2xl":a?l="xl":r?l="lg":t?l="md":o&&(l="sm"),{current:l,isSm:o,isMd:t,isLg:r,isXl:a,is2Xl:n,isMobile:i,isDesktop:s}}function wo(e,o=300){let[t,r]=Ne.useState(e);return Ne.useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function dt(e,o=300){let[t,r]=Ne.useState(false);return Ne.useEffect(()=>{if(e){let a=setTimeout(()=>{r(true);},o);return ()=>clearTimeout(a)}r(false);},[e,o]),t}function Te(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 W(e,o){return reactAriaComponents.composeRenderProps(e,t=>tailwindMerge.twMerge(o,t))}var _={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var Ee={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},f=Ne.memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=aa__namespace[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let l=typeof o=="string"&&o in Ee?Ee[o]:o,c=tailwindMerge.twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsxRuntime.jsx(s,{...i,size:l,color:t,weight:r,className:c,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});f.displayName="Icon";var Bo=Ne.memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:l,ariaLabel:c,ref:u,...d})=>{let b=typeof a=="string"&&a in Ee?Ee[a]:a,y=t?typeof t=="string"&&t in Ee?Ee[t]:t:b*1.75,g=tailwindMerge.twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-gray-100 dark:bg-gray-800",e==="solid"&&"bg-brand text-white",e==="outline"&&"border-2 border-current",r);return jsxRuntime.jsx("div",{className:g,style:{width:y,height:y},children:jsxRuntime.jsx(f,{...d,name:i,size:a,color:s,weight:l,className:n,ariaLabel:c})})});Bo.displayName="IconWithContainer";var da=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-slate-700 dark:bg-slate-600 border border-slate-800 dark:border-white/10 shadow-[inset_0_1px_0_0_theme(colors.gray.600)] dark:shadow-none text-white 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 $o({children:e,content:o,...t}){return jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger,{delay:200,children:[e,jsxRuntime.jsxs(reactAriaComponents.Tooltip,{...t,offset:10,className:reactAriaComponents.composeRenderProps(t.className,(r,a)=>da({...a,className:r})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-slate-700 stroke-gray-800 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 dark:fill-slate-600 dark:stroke-white/10 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function Ce(){let[e,o]=Ne__namespace.default.useState(false),t=Ne__namespace.default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=Ne__namespace.default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var X=Ne__namespace.default.forwardRef(({children:e,className:o},t)=>jsxRuntime.jsx("div",{ref:t,className:tailwindMerge.twMerge("relative w-full",o),children:e}));X.displayName="InputWrapper";function Ue({onClick:e,size:o="md",className:t}){return jsxRuntime.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:tailwindMerge.twMerge("absolute right-2 top-[48%] -translate-y-1/2 transform text-text-muted hover:text-text-body cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsxRuntime.jsx(f,{name:"X",size:o==="sm"?16:20})})}function Ke(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 ca(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function ua(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 tailwindMerge.twMerge("w-full",Ke({isInvalid:o,isDisabled:t,isFocused:r}),ca({transparent:a,isDisabled:t}),_[n].text,_[n].height,_[n].padding,ua(n),i)}function U({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let l=t||r&&a==="tooltip",c=t||r,u=r&&a==="inline",d=jsxRuntime.jsxs("label",{htmlFor:s,className:tailwindMerge.twMerge(_[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsxRuntime.jsx("span",{children:"*"}),l&&jsxRuntime.jsx("span",{className:"text-text-muted",children:jsxRuntime.jsx(f,{name:"Info",size:o==="sm"?16:20})}),u&&jsxRuntime.jsx("span",{className:"text-text-caption font-normal ml-1",children:r})]});return l&&c?jsxRuntime.jsx($o,{content:c,children:d}):d}function I({size:e="md",className:o,children:t,...r}){return jsxRuntime.jsx("div",{...r,className:tailwindMerge.twMerge("leading-[2.25] text-text-caption",_[e].text,o),children:t})}function p({children:e,size:o="md",className:t}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.twMerge(_[o].text,"text-feedback-error-text",t),children:e})}function ut({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:a,className:n,...i}){return jsxRuntime.jsx("input",{className:oe({isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:e,className:n}),...i})}var ba="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",ga={default:"bg-action-default text-[color:var(--color-action-default-text)] hover:bg-action-default-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",brand:"bg-action-brand text-[color:var(--color-action-brand-text)] hover:bg-action-brand-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",secondary:"bg-transparent text-text-body border-2 border-border-muted hover:bg-text-body/5 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-body hover:bg-text-body/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-brand hover:text-action-brand/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-body hover:bg-background-hover hover:text-text-heading forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Lo={full:"w-full",default:"w-fit"},xa="opacity-50 cursor-not-allowed pointer-events-none",ha="opacity-100 cursor-pointer",va={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},ya={primary:"bg-action-brand text-white",destructive:"bg-action-destructive text-white"};function Pa(e){return e?e==="primary"?"brand":e:"default"}function Fa(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Pa(o),s=i==="unstyled"?"":`${ba} ${ga[i]}`;i!=="unstyled"&&(s+=` ${_[t].text} ${_[t].height} ${_[t].padding} ${_[t].gap}`),r||n?s+=` ${xa}`:s+=` ${ha}`,a?s+=` ${Lo.full}`:s+=` ${Lo.default}`;let l=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,Te(),l].filter(Boolean).join(" ")}function h(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:l,href:c,className:u,badgeNumber:d,badgeVariant:b="primary",badgePosition:y="top-right",style:g,target:m,rel:C,...P}=e,x=o?jsxRuntime.jsx(f,{name:o,size:i,weight:l}):null,B=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&x,typeof t=="function"?null:t,s==="right"&&x]}),$=jsxRuntime.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n||jsxRuntime.jsx(f,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsxRuntime.jsx("div",{className:"invisible","aria-hidden":"true",children:B}),a&&jsxRuntime.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),w=(d??0)>0,F=tailwindMerge.twMerge(Fa(e),u),N=c?{href:c,target:m,rel:C,...P}:{};if(c){let{onPress:k,onPressStart:ee,onPressEnd:V,onPressChange:J,onPressUp:O,onAuxClick:G,onContextMenu:ie,onDoubleClick:q,...R}=P;Object.assign(N,R);}let Y=c?jsxRuntime.jsx(reactAriaComponents.Link,{...N,...r&&{"aria-busy":true},style:w?void 0:g,className:F,children:r?$:typeof t=="function"?(function(k){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&x,t(k),s==="right"&&x]})}):B}):jsxRuntime.jsx(reactAriaComponents.Button,{...P,...r&&{"aria-busy":true},style:w?void 0:g,className:F,children:r?$:typeof t=="function"?(function(k){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&x,t(k),s==="right"&&x]})}):B});return w?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative flex",u),style:g,children:[Y,jsxRuntime.jsx("span",{className:`absolute ${va[y]} flex h-5 w-5 items-center justify-center rounded-full ${ya[b]} text-xs font-medium`,"aria-label":`${d} items`,children:d})]}):Y}function we({transparent:e=false,className:o,children:t,...r}){return jsxRuntime.jsx(reactAriaComponents.ModalOverlay,{...r,className:reactAriaComponents.composeRenderProps(o,(a,n)=>tailwindMerge.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-black/20 via-black/15 to-black/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-black/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 $a({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 Ve({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let l=reactAriaComponents.useSlottedContext(reactAriaComponents.PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=l?c-6:c;let u=jsxRuntime.jsxs(reactAriaComponents.Popover,{offset:c,...i,className:reactAriaComponents.composeRenderProps(r,(d,b)=>$a({...b,className:d,disableGroup:n})),children:[o&&jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsxRuntime.jsx(we,{isDismissable:a,children:jsxRuntime.jsx(reactAriaComponents.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 Mt({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let a=e||o||t;return !a&&!r?null:jsxRuntime.jsxs("div",{className:"flex h-28 w-full flex-col items-center justify-center border-t p-4",children:[r&&jsxRuntime.jsx("div",{className:"flex h-10 justify-center",children:r}),a&&jsxRuntime.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-3",children:[jsxRuntime.jsx("div",{children:t&&jsxRuntime.jsx(h,{size:t.size||"lg",variant:t.variant||"destructive",onPress:t.onPress,isLoading:t.isLoading,isDisabled:t.isDisabled,children:t.label})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[o&&jsxRuntime.jsx(h,{size:o.size||"lg",variant:o.variant||"secondary",onPress:o.onPress,isLoading:o.isLoading,isDisabled:o.isDisabled,children:o.label}),e&&jsxRuntime.jsx(h,{size:e.size||"lg",variant:e.variant||"default",onPress:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})]})]})]})}var Va={xs:"text-lg font-semibold",sm:"text-xl font-semibold",md:"text-2xl font-semibold",lg:"text-3xl font-semibold",xl:"text-4xl font-semibold"},Aa={page:"h-16 leading-[62px]"};function Xe({tag:e="h1",size:o="lg",height:t,className:r="",children:a}){let n=Va[o],i=t?Aa[t]:"";return jsxRuntime.jsx(e,{className:tailwindMerge.twMerge(n,i,r),children:a})}var Ae=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:a=false,onBack:n,headerContent:i})=>jsxRuntime.jsxs("div",{className:tailwindMerge.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&&jsxRuntime.jsx(h,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsxRuntime.jsx(f,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e&&jsxRuntime.jsx(Xe,{size:"xs",children:e}),o&&!t&&jsxRuntime.jsx(h,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsxRuntime.jsx(f,{name:"X","data-testid":"close-button"})})]})]});var pe=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:d,"data-testid":b})=>{let[y,g]=Ne.useState(l===0);if(Ne.useEffect(()=>{if(l>0){let w=setTimeout(()=>g(true),l);return ()=>clearTimeout(w)}},[l]),!y)return null;let m=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)]",C=c&&e?(()=>{let w=typeof e=="number"?e:parseFloat(String(e));return isNaN(w)?"":`animation-duration-[${Math.max(.8,w/100)}s]`})():"",P=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}`:"",x="rounded-sm";t==="circle"&&(x="rounded-full"),t==="text"&&(x="h-4 w-full rounded-sm");let B=n?"flex-1 min-w-0":"",$=s?Object.entries(s).map(([w,F])=>`${w}:w-[${F}]`).join(" "):"";return i?jsxRuntime.jsx("div",{className:"space-y-2","data-testid":b,children:i.map((w,F)=>jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(m,P,x,B,$,d),style:{width:w,height:o}},F))}):jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(m,P,x,B,$,d),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":b})};var _a={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},qa="rounded-lg",Ot={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Wa={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function fe({variant:e="outlined",className:o,children:t,isLoading:r=false}){return jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-full overflow-hidden",_a[e],qa,o),"data-testid":"card",children:r?jsxRuntime.jsx(pe,{width:"100%",height:"100%",className:"rounded-none"}):t})}function mt({title:e,subtitle:o,actions:t,className:r,isLoading:a=false}){return a?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx(pe,{width:120,height:20}),jsxRuntime.jsx(pe,{width:24,height:24})]}),o&&jsxRuntime.jsx(pe,{width:200,height:16})]}):!e&&!o&&!t?null:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:jsxRuntime.jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsxRuntime.jsx("div",{className:"mb-1",children:typeof e=="string"?jsxRuntime.jsx(Xe,{tag:"h3",size:"sm",className:"text-text-heading",children:e}):e}),o&&jsxRuntime.jsx("div",{className:"text-sm text-text-muted",children:o})]}),t&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:t})]})})}function zo({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("bg-background-muted",Ot[t],r),children:jsxRuntime.jsx(pe,{width:"100%",height:"100%"})}):a?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Ot[t],r),children:a}):e?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Ot[t],r),children:jsxRuntime.jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function pt({className:e,children:o,isLoading:t=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(a,e),children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(pe,{width:"100%",height:16}),jsxRuntime.jsx(pe,{width:"80%",height:16}),jsxRuntime.jsx(pe,{width:"60%",height:16})]})}):o?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("px-6 py-4 text-text-body",e),children:o}):null}function Mo({className:e,children:o,align:t="end",isLoading:r=false}){return r?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsxRuntime.jsx(pe,{width:80,height:32}),jsxRuntime.jsx(pe,{width:60,height:32})]}):o?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("px-6 py-4 flex items-center gap-2",Wa[t],e),children:o}):null}fe.Header=mt;fe.Media=zo;fe.Content=pt;fe.Footer=Mo;var Ze=class extends Ne.Component{constructor(){super(...arguments);Nt(this,"state",{hasError:false});Nt(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:jsxRuntime.jsxs(fe,{children:[this.props.title&&jsxRuntime.jsx(fe.Header,{title:this.props.title}),jsxRuntime.jsx(fe.Content,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsxRuntime.jsx("p",{className:"text-red-500",children:this.state.error?.message||"Something went wrong"}),jsxRuntime.jsx("button",{className:"rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var ja=.3,Qa=.5;function Me({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:l,isDismissable:c=true,transparentOverlay:u=false,primaryAction:d,secondaryAction:b,footerContent:y,maxHeight:g="80vh",height:m,maxWidth:C="640px",contentPadding:P=true,showHandle:x=true,animationVariant:B="scale",className:$}){let[w,F]=Ne.useState(false),[N,Y]=Ne.useState(0),[k,ee]=Ne.useState(false),V=Ne.useRef(null),J=Ne.useRef(null),O=Ne.useRef({isDragging:false,startY:0,startTime:0,pointerId:null});Ne.useEffect(()=>{if(s){let A=setTimeout(()=>{F(true),setTimeout(()=>F(false),600);},400);return ()=>clearTimeout(A)}},[s]),Ne.useEffect(()=>{s||(Y(0),ee(false),O.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]);let G=Ne.useCallback(A=>{c&&(A.pointerType!=="touch"&&A.pointerType!=="pen"||(J.current&&(clearTimeout(J.current),J.current=null),O.current={isDragging:true,startY:A.clientY,startTime:Date.now(),pointerId:A.pointerId},ee(false),A.currentTarget.setPointerCapture(A.pointerId)));},[c]),ie=Ne.useCallback(A=>{let{isDragging:be,startY:ue,pointerId:ge}=O.current;if(!be||A.pointerId!==ge)return;let z=A.clientY-ue;Y(Math.max(0,z));},[]),q=Ne.useCallback(A=>{let{isDragging:be,startY:ue,startTime:ge,pointerId:z}=O.current;if(!be||A.pointerId!==z)return;let te=A.clientY-ue,K=Date.now()-ge,se=te/K;O.current={isDragging:false,startY:0,startTime:0,pointerId:null};let Z=(V.current?.getBoundingClientRect().height??0)*ja;(te>Z||se>Qa&&te>50)&&c?(l?.(),Y(0)):(ee(true),Y(0),J.current=setTimeout(()=>{ee(false),J.current=null;},200));},[c,l]);if(!s)return null;let R=o||t,Fe=d||b||y;return jsxRuntime.jsx(Ze,{children:jsxRuntime.jsx(we,{isOpen:s,onOpenChange:A=>{A||l?.();},isDismissable:c,transparent:u,className:"flex items-end justify-center p-0 sm:p-4",children:jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx("div",{ref:V,className:tailwindMerge.twMerge("w-full",k&&"transition-transform duration-200"),style:{transform:N>0?`translateY(${N}px)`:void 0},children:jsxRuntime.jsxs(reactAriaComponents.Dialog,{className:tailwindMerge.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",B==="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)]",B==="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:g}},children:[x&&jsxRuntime.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:G,onPointerMove:ie,onPointerUp:q,onPointerCancel:q,children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",w&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),R&&(n?jsxRuntime.jsx(Ae,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!l,hasBackArrow:true,onBack:i??(()=>{}),onClose:l||(()=>{})}):jsxRuntime.jsx(Ae,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!l,onClose:l||(()=>{})})),jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",P?"p-4":"p-0"),children:e}),Fe&&jsxRuntime.jsx(Mt,{primaryAction:d,secondaryAction:b,footerContent:y})]})})})})})}Me.displayName="Tray";var jt=Ne.createContext("md");function Uo(){return Ne.useContext(jt)}function Ut(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-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${_[e].text} ${o}`}function on(){let e=Ne__namespace.default.useCallback((t,r)=>{r?.(t);},[]),o=Ne__namespace.default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function Qt({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:l,defaultSelectedKey:c,onSelectionChange:u,placeholder:d,showErrors:b=false,tooltip:y,isRequired:g,transparent:m,reserveErrorSpace:C=false,placement:P="bottom start",shouldFlip:x=true,menuWidth:B="match",descriptionPlacement:$="below",useMobileTray:w=true,...F}){let[N,Y]=Ne.useState(null),[k,ee]=Ne.useState(null),[V,J]=Ne.useState(false),O=l??N??c,{handleFocus:G,handleBlur:ie}=on(),{isMobile:q}=lt(),R=w&&q,Fe=Ne__namespace.default.useMemo(()=>!i||!O||!a?null:Array.from(a).find(te=>te.id===O)??null,[i,O,a]),A=z=>{u&&z!==null&&u(z),u||Y(z);},be=Ne.useRef(null),ue=Ne.useRef(null),ge=()=>{R&&J(!V);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.Select,{...F,selectedKey:O,defaultSelectedKey:c,onSelectionChange:A,placeholder:d,className:W(F.className,"group flex w-full flex-col"),ref:be,onOpenChange:z=>{R||(z&&ue.current?ee(ue.current.offsetWidth):z||be.current?.blur());},children:({isDisabled:z,isInvalid:te,isOpen:K})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(U,{size:s,tooltip:y,description:$==="tooltip"||$==="inline"?o:void 0,descriptionPlacement:$,isRequired:g,children:e}),jsxRuntime.jsx(X,{children:jsxRuntime.jsx("div",{ref:ue,children:jsxRuntime.jsxs(h,{variant:"unstyled",className:tailwindMerge.twMerge(oe({isInvalid:te||b&&!!t,isDisabled:z,isFocused:R?V:K,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:se=>G(se,F.onFocus),onBlur:se=>ie(se,F.onBlur),onPress:R?ge:void 0,"data-open":R?V:K,children:[i&&Fe?jsxRuntime.jsx("div",{className:Ut(s),children:i(Fe)}):R&&O?jsxRuntime.jsx("div",{className:Ut(s),children:a?Array.from(a).find(Z=>Z.id===O)?.label:String(O)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:Ut(s)}),jsxRuntime.jsx(f,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",(R?V:K)&&"rotate-180")})]})})}),C?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:b?jsxRuntime.jsx(p,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&F.validationResult?t(F.validationResult):typeof t=="string"?t:null}):o&&$==="below"?jsxRuntime.jsx(I,{size:s,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:b?jsxRuntime.jsx(p,{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"?jsxRuntime.jsx(I,{size:s,className:"mt-1",children:o}):null}),R?null:jsxRuntime.jsx(Ve,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:B==="match"&&k?`${k}px`:void 0,minWidth:B==="auto"&&k?`${k}px`:void 0,maxWidth:B==="auto"?"min(600px, 90vw)":void 0},placement:P,shouldFlip:x,children:jsxRuntime.jsx(jt.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?se=>jsxRuntime.jsx(Se,{id:se.id,textValue:se.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(se)})},se.id):r})})})]})}),R&&jsxRuntime.jsx(Me,{isOpen:V,onClose:()=>J(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(jt.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.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:O!=null?[O]:[],onSelectionChange:z=>{let te=Array.from(z)[0];te!=null&&(A(te),J(false));},children:n&&a?z=>jsxRuntime.jsx(Se,{id:z.id,textValue:z.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(z)})},z.id):r})})})]})}function Se({size:e,className:o,...t}){let r=Uo(),a=e??r;return jsxRuntime.jsx(reactAriaComponents.ListBoxItem,{...t,className:tailwindMerge.twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-body 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",_[a].paddingY,_[a].text,o)})}var He=({className:e,size:o=24,color:t="text-action-brand"})=>jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsx("span",{className:"sr-only",children:"Loading..."})});var fn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},bn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},jo={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},xt=(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 gn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,c])=>{a.append(l,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){console.error("Error in REST request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}async function xn(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){console.error("Error in GraphQL request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}function Jt({label:e,staticItems:o=[],sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:l,errorMessage:c,description:u,size:d="md",tooltip:b,isRequired:y,isDisabled:g,isInvalid:m,validationResult:C,showErrors:P=true,renderItem:x,renderLeftIcon:B,renderSection:$,autoFocus:w=false,reserveErrorSpace:F=false,hideChevron:N=false,useMobileTray:Y=true,className:k}){let ee=Ne__namespace.default.useRef(null),V=Ne__namespace.default.useRef(null),[J,O]=Ne__namespace.default.useState(),[G,ie]=Ne.useState(()=>xt(r||a,o,t)),[q,R]=Ne.useState(false),[Fe,A]=Ne.useState(false),be=wo(G),{contains:ue}=st({sensitivity:"base"}),[ge,z]=Ne.useState(),{isMobile:te}=lt(),K=Y&&te,se=_[d].text,St=reactStately.useAsyncList({async load({signal:S,filterText:D=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(D))return {items:[]};try{let le;return i.requestType==="GraphQL"?le=await xn(i,D,S):le=await gn(i,D,S),z(le.error),{items:le.items}}catch(le){return console.error("Error loading items:",le),z(le instanceof Error?le.message:"Unknown error occurred"),{items:[]}}},initialFilterText:""}),Z=i&&be!==""?St:null,_e=false;Ne.useEffect(()=>{w&&R(true);},[w]),Ne.useEffect(()=>{let S=xt(r,o,t);S!==G&&ie(S);},[r,o,t]),Ne.useEffect(()=>{let S=xt(r,o,t);S!==G&&ie(S);},[r,o,t]),Ne.useEffect(()=>{let S=()=>{ee.current&&O(ee.current.offsetWidth);};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]),Ne.useEffect(()=>{Z&&Z.setFilterText(be);},[be,Z]),_e=dt(!!Z?.isLoading,300);let Tr=Ne__namespace.default.useMemo(()=>{if(!K||!G)return Z?Z.items:o;let S=Z?Z.items:o,D=s||ue;return S.filter(le=>D(le.name,G))},[K,G,Z,o,s,ue]),Po=S=>{let D=xt(S,o,t);ie(D),n&&n(S);},Fo=S=>{ie(S);},Co=()=>{K&&A(true);};return console.log("[Autocomplete] Render",{shouldUseTray:K,isTrayOpen:Fe,isDisabled:g,inputValue:G,selectedKey:r,isMobile:te,autoFocus:w}),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.ComboBox,{onSelectionChange:Po,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(S=>S.items):o,items:Z?Z.items:void 0,className:W(k,"group flex flex-col w-full"),menuTrigger:K?"manual":"focus",isDisabled:g,isInvalid:m||!!c,inputValue:G,onInputChange:Fo,autoFocus:w&&!K,defaultFilter:s||ue,"aria-label":e||l||"Autocomplete",children:S=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(U,{size:d,tooltip:b,isRequired:y,children:e}),jsxRuntime.jsxs(X,{ref:ee,children:[B?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:B(_e)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:_e?jsxRuntime.jsx(He,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(f,{name:"MagnifyingGlass",className:`${fn[d]} text-text-muted`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:oe({isInvalid:m||!!c,isDisabled:g,isFocused:q||(K?Fe:S.isOpen),size:d,className:tailwindMerge.twMerge(bn[d],G&&!g||!N&&!G?"pr-10":"pr-3",K&&"cursor-pointer",k)}),placeholder:l,disabled:g,onFocus:D=>{R(true),K&&(D.currentTarget.blur(),Co());},onBlur:()=>{R(false);},onClick:K?Co:void 0,readOnly:K,"aria-label":e||l||"Autocomplete"}),G&&!g&&jsxRuntime.jsx(Ue,{onClick:()=>{ie(""),n?.(null);},size:d}),!N&&!G&&jsxRuntime.jsx(reactAriaComponents.Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:D})=>jsxRuntime.jsx(f,{name:D?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),F?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:P&&ge?jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text",children:ge}):P&&typeof c=="string"?jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text",children:c}):P&&typeof c=="function"&&C?jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text",children:c(C)}):u?jsxRuntime.jsx(I,{size:d,children:u}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u&&jsxRuntime.jsx(I,{size:d,className:"mt-1",children:u}),P&&ge&&jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:ge}),P&&typeof c=="string"&&jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:c}),P&&typeof c=="function"&&C&&jsxRuntime.jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:c(C)})]}),!K&&jsxRuntime.jsx(Ve,{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:J?`${J}px`:void 0},children:jsxRuntime.jsx(reactAriaComponents.ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${se}`,children:t?t.map(D=>{let le=D.items.map(xe=>jsxRuntime.jsx(Se,{id:xe.id,textValue:xe.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${jo[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:x?x(xe):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[xe.name,jsxRuntime.jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},xe.id));if($){let xe=$(D,le);return Ne__namespace.default.isValidElement(xe)&&xe.type===reactAriaComponents.ListBoxSection?xe:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:xe},D.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:D.name}),le]},D.name)}):D=>jsxRuntime.jsx(Se,{id:D.id,textValue:D.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${jo[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:x?x(D):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D.name,jsxRuntime.jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},D.id)})})]})}),K&&jsxRuntime.jsx(Me,{isOpen:Fe,onClose:()=>A(false),title:e??l??"Search",contentPadding:false,height:"80vh",children:jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsx("div",{className:"p-4 border-b border-border-default",children:jsxRuntime.jsxs(X,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:_e?jsxRuntime.jsx(He,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(f,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted"})}),jsxRuntime.jsx("input",{ref:V,type:"text",value:G,onChange:S=>Fo(S.target.value),placeholder:l,autoFocus:true,className:oe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),G&&jsxRuntime.jsx(Ue,{onClick:()=>{ie(""),n?.(null);},size:"md"})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:Tr,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:S=>{let D=Array.from(S)[0];D&&(Po(D),A(false));},className:"bg-background-input outline-none",children:S=>jsxRuntime.jsx(Se,{id:S.id,textValue:S.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:x?x(S):S.name},S.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 lu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Jt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}function Jo(e){return jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:W(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(U,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(I,{children:e.description}),jsxRuntime.jsx(p,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Sn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function Nn({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r,variant:a="default"}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",i=a==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(t)s="border-border-muted bg-background-muted";else if(o)s="border-feedback-error-border bg-feedback-error-background";else if(e||r){let l=a==="brand"?"action-brand":"action-default";s=`bg-${l} border-${l} hover:bg-${l}-hover hover:border-${l}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${n} ${i} ${s}`}var Xo="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function Zo(e){let{children:o,variant:t="default",...r}=e;return jsxRuntime.jsx(reactAriaComponents.Checkbox,{...r,className:reactAriaComponents.composeRenderProps(e.className,(a,n)=>`${Sn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,l=jsxRuntime.jsx("div",{className:Nn({isSelected:n,isIndeterminate:i,variant:t,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:Xo}):n?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:Xo}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,typeof o=="function"?o(a):o]})}})}function Su({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(Zo,{...r,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!i,children:r.children}),t&&i&&jsxRuntime.jsx(p,{children:i})]})})}function Bu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Jo,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function Oe(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function to(e){if(!e)return "";let o=e.startsWith("#")?e.slice(1):e;return o.length===3&&(o=o.split("").map(t=>t+t).join("")),`#${o.toUpperCase()}`}function rr({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:l,value:c,defaultValue:u,onChange:d,placeholder:b="#000000",showColorSwatch:y=true,reserveErrorSpace:g=true,...m}){let[C,P]=Ne.useState(u||""),[x,B]=Ne.useState(c||u||""),[$,w]=Ne.useState(false),[F,N]=Ne.useState(null),{isFocused:Y,handleFocus:k,handleBlur:ee}=Ce(),V=c!==void 0?c:C;Ne.useEffect(()=>{c!==void 0&&B(c);},[c]);let J=V?!Oe(V):false,O=Ne.useCallback(q=>{if(B(q),Oe(q)){let R=to(q);d?d(R):P(R);}else q===""&&(d?d(""):P(""));},[d]),G=Ne.useCallback(q=>{let R=to(q);B(R),d?d(R):P(R);},[d]),ie=Ne.useCallback(q=>{if(Oe(x)){let R=to(x);B(R),d&&R!==V?d(R):!d&&R!==C&&P(R);}ee(q,m.onBlur);},[x,V,C,d,ee,m.onBlur]);return jsxRuntime.jsx(reactAriaComponents.TextField,{...m,isRequired:n,className:W(s,"group flex flex-col"),children:({isDisabled:q})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(U,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(X,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.jsx(ut,{size:r,disabled:q,type:"text",value:x,placeholder:b,onFocus:R=>k(R,m.onFocus),onBlur:ie,onChange:R=>O(R.target.value),className:tailwindMerge.twMerge(oe({isInvalid:J,isDisabled:q,isFocused:Y,size:r,transparent:i}),y?"pr-12":"pr-3","pl-3")}),y&&jsxRuntime.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:_[r].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-6 h-6 rounded border shadow-sm",Oe(V)?"border-border-default":"border-border-default bg-background-muted"),style:Oe(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Oe(V)&&jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsxRuntime.jsx("div",{ref:N,children:jsxRuntime.jsx(h,{variant:"secondary",size:r,icon:"Palette",onPress:()=>w(!$),isDisabled:q,className:"flex-shrink-0",children:"Pick"})})]})}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&l?jsxRuntime.jsx(p,{size:r,children:t(l)}):o?jsxRuntime.jsx(I,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(l)}):o?jsxRuntime.jsx(I,{size:r,className:"mt-1",children:o}):null}),$&&F&&jsxRuntime.jsx(Ve,{triggerRef:{current:F},isOpen:$,onOpenChange:w,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsx(reactColorful.HexColorPicker,{color:V||"#000000",onChange:G,style:{width:"200px",height:"200px"}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:V||"#000000"}}),jsxRuntime.jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function ju({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(rr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function Yn({isSelected:e,isDisabled:o}){let t=[Te,"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-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function ro({errorMessage:e,...o}){return jsxRuntime.jsxs(reactAriaComponents.Calendar,{...o,children:[jsxRuntime.jsx(nr,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(ir,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:t=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${Yn({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function nr(){let{direction:e}=reactAriaComponents.useLocale(),o=18;return jsxRuntime.jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsxRuntime.jsx(h,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(f,{name:"CaretRight","aria-hidden":true,size:o}):jsxRuntime.jsx(f,{name:"CaretLeft","aria-hidden":true,size:o})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-zinc-900 dark:text-zinc-200"}),jsxRuntime.jsx(h,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(f,{name:"CaretLeft","aria-hidden":true,size:o}):jsxRuntime.jsx(f,{name:"CaretRight","aria-hidden":true,size:o})})]})}function ir(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function no({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:l=true,reserveErrorSpace:c=true,validationResult:u,className:d,...b}){let[y,g]=Ne.useState(false),m=C=>{b.onChange&&C&&b.onChange(C),g(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...b,isDisabled:i,isRequired:n,isInvalid:s,className:W(d,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(U,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(X,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(lr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:l}),l&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:y,onOpenChange:g,children:[jsxRuntime.jsx(h,{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-muted hover:text-text-body transition-colors","aria-label":"Open calendar",children:jsxRuntime.jsx(f,{name:"Calendar",size:18})}),jsxRuntime.jsx(reactAriaComponents.Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"p-4 outline-none",children:jsxRuntime.jsx(ro,{value:b.value,onChange:m,minValue:b.minValue,maxValue:b.maxValue,isDisabled:i,isReadOnly:b.isReadOnly,isDateUnavailable:b.isDateUnavailable})})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&u?jsxRuntime.jsx(p,{size:r,children:t(u)}):o?jsxRuntime.jsx(I,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(u)}):o?jsxRuntime.jsx(I,{size:r,className:"mt-1",children:o}):null})]})}function oi({isPlaceholder:e,isDisabled:o,size:t="md"}){return tailwindMerge.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-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function lr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Ke({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",a),...n,children:i=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:i,className:oi({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function wm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(no,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function io({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:l=true,placeholder:c="Drop files here or click to browse"}){let[u,d]=Ne.useState(false),[b,y]=Ne.useState(false),[g,m]=Ne.useState(null),[C,P]=Ne.useState(e),x=Ne.useRef(null),B=async F=>{if(m(null),a&&F.size>a){m(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(l&&F.type.startsWith("image/")){let N=new FileReader;N.onloadend=()=>{P(N.result);},N.readAsDataURL(F);}if(i){y(true);try{let N=await i(F);P(N),t?.(N);}catch(N){m("Failed to upload file"),console.error("Upload error:",N);}finally{y(false);}}o?.(F,C);},$=F=>{let N=F.items;if(N.length>0){let Y=N[0];if(Y.kind==="file"){let k=Y.getAsFile();k&&B(k);}}d(false);},w=()=>{P(void 0),m(null),o?.(null),t?.(""),x.current&&(x.current.value="");};return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",s),children:[jsxRuntime.jsxs(reactAriaComponents.DropZone,{className:tailwindMerge.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",g&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:$,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[C?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&C.startsWith("data:image")?jsxRuntime.jsx("img",{src:C,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Image,{className:"h-12 w-12 text-text-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!n&&jsxRuntime.jsx(h,{variant:"icon",size:"sm",onPress:w,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"h-12 w-12 text-text-muted"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-body",children:c}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-muted",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:r.split(","),onSelect:F=>{let N=Array.from(F||[]);N.length>0&&B(N[0]);},children:jsxRuntime.jsx(h,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),b&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"Uploading..."})]})})]}),g&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function qm({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(io,{...r,value:s.value??"",onChange:(l,c)=>s.onChange(c||"")}),t&&i&&jsxRuntime.jsx(p,{children:i})]})})}var yi=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return tailwindMerge.twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function co({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:l=true,descriptionPlacement:c="below",...u}){let d=Ne.useId(),{isFocused:b,handleFocus:y,handleBlur:g}=Ce();return jsxRuntime.jsx(reactAriaComponents.NumberField,{...u,id:d,isRequired:n,className:W(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})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(U,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:d,children:e}),jsxRuntime.jsx("div",{className:"relative",children:jsxRuntime.jsxs(reactAriaComponents.Group,{className:"relative",children:[jsxRuntime.jsx(reactAriaComponents.Input,{onFocus:x=>y(x,u.onFocus),onBlur:x=>g(x,u.onBlur),className:yi({isInvalid:C||!!t,isDisabled:m,isFocused:b,transparent:i,size:r,className:typeof u.className=="string"?u.className:void 0})}),jsxRuntime.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:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(f,{name:"CaretUp",size:14})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(f,{name:"CaretDown",size:14})})]})]})}),l?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsxRuntime.jsx(p,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(I,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:t?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}function dp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(co,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}var Ni=Ne.createContext({variant:"brand"});function uo(e){let{variant:o="default",...t}=e;return jsxRuntime.jsx(Ni.Provider,{value:{variant:o},children:jsxRuntime.jsxs(reactAriaComponents.RadioGroup,{...t,className:W(e.className,"group flex flex-col gap-2"),children:[jsxRuntime.jsx(U,{children:e.label}),jsxRuntime.jsx("div",{className:"flex gap-2 group-orientation-horizontal:gap-4 group-orientation-vertical:flex-col",children:e.children}),e.description&&jsxRuntime.jsx(I,{children:e.description}),jsxRuntime.jsx(p,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function Ip({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(uo,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var $i=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return tailwindMerge.twMerge(o,t,e.className)};function at({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:l,onClear:c,type:u,validationResult:d,reserveErrorSpace:b=true,isLoading:y=false,descriptionPlacement:g="below",...m}){let[C,P]=Ne__namespace.default.useState(false),{isFocused:x,handleFocus:B,handleBlur:$}=Ce(),w=u==="password",F=dt(y,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...m,isRequired:n,className:W(m.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:Y})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(U,{size:r,tooltip:a,description:g==="tooltip"||g==="inline"?o:void 0,descriptionPlacement:g,isRequired:n,children:e}),jsxRuntime.jsxs(X,{children:[s&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:F?jsxRuntime.jsx(He,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(f,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${x?"text-action-brand":"text-text-muted"}`})}),jsxRuntime.jsx(ut,{size:r,disabled:N,type:w?C?"text":"password":u,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:k=>B(k,m.onFocus),onBlur:k=>$(k,m.onBlur),onChange:k=>m.onChange?.(k.target.value),className:$i({isInvalid:Y,isDisabled:N,isFocused:x,size:r,transparent:i,showSearchIcon:s,isClearable:l,hasValue:!!m.value,isPassword:w,className:typeof m.className=="string"?m.className:void 0})}),l&&m.value&&!N&&jsxRuntime.jsx(Ue,{onClick:()=>{c?c():m.onChange&&m.onChange("");},size:r}),w&&!N&&jsxRuntime.jsx("button",{type:"button",onClick:()=>P(!C),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":C?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsxRuntime.jsx(f,{name:C?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),b?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,children:t(d)}):o&&g==="below"?jsxRuntime.jsx(I,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(d)}):o&&g==="below"?jsxRuntime.jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}var Be=({isActive:e=false,onPress:o,children:t})=>jsxRuntime.jsx(h,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function _i({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=Ne.useState(e);return Ne__namespace.default.useEffect(()=>{n(e);},[e]),jsxRuntime.jsx(we,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsxRuntime.jsx(reactAriaComponents.Modal,{isDismissable:true,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:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxRuntime.jsxs("form",{onSubmit:s=>{s.preventDefault(),r(a),t();},children:[jsxRuntime.jsx(Ae,{title:"Insert Link",onClose:t}),jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(at,{label:"URL",type:"url",value:a,onChange:n,autoFocus:true,className:"w-full"})}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsxRuntime.jsx(h,{variant:"secondary",onPress:t,children:"Cancel"}),jsxRuntime.jsx(h,{type:"submit",children:"Save"})]})]})})})})}function po({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n}){let[i,s]=Ne.useState(false),l=react.useEditor({immediatelyRender:false,extensions:[Mi__default.default.configure({heading:{levels:[1,2]}}),Li__default.default.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:d})=>{o?.(d.getHTML());},editorProps:{attributes:{class:tailwindMerge.twMerge("prose prose-sm max-w-none","focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),c=()=>{s(true);},u=d=>{d===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:d}).run();};return l?jsxRuntime.jsxs("div",{id:n,"data-richtexteditor":true,className:tailwindMerge.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:[l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(menus.BubbleMenu,{editor:l,shouldShow:({editor:d})=>d.isActive("link")&&!i,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxRuntime.jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let d=l.getAttributes("link").href;window.open(d,"_blank");},children:[jsxRuntime.jsx(f,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxRuntime.jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:c,children:[jsxRuntime.jsx(f,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxRuntime.jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsxRuntime.jsx(f,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsxRuntime.jsx(_i,{isOpen:i,onClose:()=>s(false),onSubmit:u,initialUrl:l.getAttributes("link").href||""})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 border-b border-border-input p-2",children:[jsxRuntime.jsx(Be,{isActive:l.isActive("heading",{level:1}),onPress:()=>l.chain().focus().toggleHeading({level:1}).run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"H1"})}),jsxRuntime.jsx(Be,{isActive:l.isActive("heading",{level:2}),onPress:()=>l.chain().focus().toggleHeading({level:2}).run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"H2"})}),jsxRuntime.jsx(Be,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"B"})}),jsxRuntime.jsx(Be,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsxRuntime.jsx("span",{className:"text-xs italic",children:"I"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Be,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsxRuntime.jsx(f,{name:"ListBullets",className:"h-4 w-4"})}),jsxRuntime.jsx(Be,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsxRuntime.jsx(f,{name:"ListNumbers",className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Be,{isActive:l.isActive("link"),onPress:c,children:jsxRuntime.jsx(f,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxRuntime.jsxs("div",{className:"relative min-h-[200px] w-full outline-none focus:outline-none",children:[jsxRuntime.jsx(react.EditorContent,{editor:l,className:tailwindMerge.twMerge("w-full p-4 outline-none focus:outline-none","[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none","[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold","[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold","[&_.ProseMirror_p]:mb-2","[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6 [&_.ProseMirror_ol]:list-decimal","[&_.ProseMirror_li]:mb-1","[&_.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&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-4 top-4 text-text-muted",children:a})]})]}):null}function ff({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=reactHookForm.useFormContext(),l=L(s.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsxRuntime.jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-heading",children:t}),r&&jsxRuntime.jsx("p",{className:"text-sm text-text-muted",children:r}),jsxRuntime.jsx(po,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),l&&jsxRuntime.jsx("p",{className:"text-sm text-feedback-error-text",children:l}),a&&!l&&jsxRuntime.jsx("div",{className:"h-5"})]})})}function Cf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(Qt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var bo={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 Xi({isSelected:e,isDisabled:o,variant:t="default",size:r="md"}){let a="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=bo[r].track,i=Te,s=t==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",l="";return e?t==="brand"?l="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":l="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":l="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[a,n,i,s,l,o?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Ji({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",a=bo[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function go({children:e,variant:o="default",size:t="md",...r}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...r,className:W(r.className,`group flex items-center gap-2 ${bo[t].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:a=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:Xi({...a,variant:o,size:t}),children:jsxRuntime.jsx("span",{className:Ji({...a,size:t})})}),e]})})}function Lf({name:e,defaultValue:o,...t}){let{control:r}=reactHookForm.useFormContext();return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsxRuntime.jsx(go,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var as=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 tailwindMerge.twMerge(o,t,e.className)};function xo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:l,isResizable:c=false,className:u,validationResult:d,reserveErrorSpace:b=true,...y}){let{isFocused:g,handleFocus:m,handleBlur:C}=Ce();return jsxRuntime.jsx("div",{className:"group flex flex-col",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(U,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(X,{children:jsxRuntime.jsx("textarea",{...y,required:n,onFocus:P=>{y.onFocus&&y.onFocus(P),m(P);},onBlur:P=>{y.onBlur&&y.onBlur(P),C(P);},className:as({isInvalid:s,isDisabled:l,isResizable:c,isFocused:g,size:r,transparent:i,className:u}),disabled:l})}),b?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,children:t(d)}):o?jsxRuntime.jsx(I,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(d)}):o?jsxRuntime.jsx(I,{size:r,className:"mt-1",children:o}):null})]})})}function Yf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(xo,{...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 eb({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(at,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function fs({isPlaceholder:e,isDisabled:o,size:t="md"}){return tailwindMerge.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-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function ho({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:l=true,validationResult:c,className:u,descriptionPlacement:d="below",...b}){return jsxRuntime.jsxs(reactAriaComponents.TimeField,{...b,isDisabled:i,isRequired:n,isInvalid:s,className:W(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(U,{size:r,tooltip:a,description:d==="tooltip"||d==="inline"?o:void 0,descriptionPlacement:d,isRequired:n,children:e}),jsxRuntime.jsx(X,{children:jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Ke({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:y=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:y,className:fs({isPlaceholder:y.isPlaceholder,isDisabled:!y.isEditable||i,size:r})})})}),l?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,children:t}):typeof t=="function"&&c?jsxRuntime.jsx(p,{size:r,children:t(c)}):o&&d==="below"?jsxRuntime.jsx(I,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsxRuntime.jsx(p,{size:r,className:"mt-1",children:t(c)}):o&&d==="below"?jsxRuntime.jsx(I,{size:r,className:"mt-1",children:o}):null})]})}function yb({name:e,...o}){let{control:t,formState:{errors:r}}=reactHookForm.useFormContext(),a=r[e],n=a?.message;return jsxRuntime.jsx(reactHookForm.Controller,{name:e,control:t,render:({field:i})=>jsxRuntime.jsx(ho,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function Sb({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=reactHookForm.useFormContext(),a=Ne__namespace.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(Ne__namespace.useEffect(()=>{t&&s&&a.current?.focus();},[t,s]),!s)return null;let l=c=>{let u=`[name="${CSS.escape(c)}"]`,d=document.querySelector(u);d&&(d.focus(),d.scrollIntoView({block:"center",behavior:"smooth"}));};return jsxRuntime.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:tailwindMerge.twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsxRuntime.jsx("div",{className:"font-medium",children:o}),jsxRuntime.jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([c,u])=>{let d=u?.message||"Invalid value";return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>l(c),children:d})},c)})})]})}function Ib({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:a,...n}){let{formState:i}=reactHookForm.useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsxRuntime.jsx(h,{type:"submit",form:e,isDisabled:s,...n,children:a})}function Vb({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=reactHookForm.useFormContext(),{fields:n,append:i,remove:s,swap:l}=reactHookForm.useFieldArray({control:a,name:e});return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[n.map((c,u)=>jsxRuntime.jsxs(fe,{children:[jsxRuntime.jsx(mt,{title:o?o(u):`Item ${u+1}`,actions:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[u>0&&jsxRuntime.jsx(h,{size:"sm",variant:"secondary",onPress:()=>l(u,u-1),children:"Up"}),u<n.length-1&&jsxRuntime.jsx(h,{size:"sm",variant:"secondary",onPress:()=>l(u,u+1),children:"Down"}),jsxRuntime.jsx(h,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsxRuntime.jsx(pt,{children:t(u)})]},c.id)),jsxRuntime.jsx("div",{children:jsxRuntime.jsx(h,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function yo(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function Fr(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=reactHookForm.useForm(i),l=(c,u)=>{if(a&&e){let d=document.getElementById(e);d&&Fr(d);}t?.(c,u);};return jsxRuntime.jsx(reactHookForm.FormProvider,{...s,children:jsxRuntime.jsx(yo,{id:e,className:n,onSubmit:s.handleSubmit(o,l),children:r})})}function Sr({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:a="Save changes",secondaryLabel:n="Cancel",className:i}){return o?jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsxRuntime.jsx("div",{className:"text-sm text-text-muted",children:"You have unsaved changes"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(h,{variant:"secondary",onPress:r,children:n}),jsxRuntime.jsx(h,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function ng({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=reactHookForm.useFormContext();return jsxRuntime.jsx(Sr,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function dg(e=true){let{formState:o}=reactHookForm.useFormContext();Ne__namespace.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 mg({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=reactHookForm.useFormContext(),n=Ne__namespace.useRef(void 0);Ne__namespace.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]);}exports.ErrorSummary=Sb;exports.FieldArrayList=Vb;exports.FormAutocomplete=lu;exports.FormCheckbox=Su;exports.FormCheckboxGroup=Bu;exports.FormColorField=ju;exports.FormDateField=wm;exports.FormFileUpload=qm;exports.FormNumberField=dp;exports.FormProvider=Qb;exports.FormRadioGroup=Ip;exports.FormRichTextEditor=ff;exports.FormSaveBar=ng;exports.FormSelect=Cf;exports.FormSwitch=Lf;exports.FormTextArea=Yf;exports.FormTextField=eb;exports.FormTimeField=yb;exports.SubmitButton=Ib;exports.focusFirstError=Fr;exports.useAutoSave=mg;exports.useScrollIntoViewOnError=dg;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|