@texturehq/edges 2.0.1 → 2.1.0

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