@texturehq/edges 5.23.1 → 5.23.3

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