plainframe-ui 0.1.44 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import me,{forwardRef,createContext,useId,useMemo,useState,useCallback,useRef,useEffect,useContext,isValidElement,cloneElement,Children,memo,useSyncExternalStore,useLayoutEffect}from'react';import {css,keyframes,useTheme,ThemeProvider,Global}from'@emotion/react';import {jsxs,jsx,Fragment}from'@emotion/react/jsx-runtime';import {ChevronDown,CircleAlert,TriangleAlert,CircleCheckBig,Info,X,Eye,EyeOff,ChevronRight,Check,ChevronFirst,ChevronLeft,ChevronLast,ChevronsUpDown}from'lucide-react';import {useFloating,offset,flip,shift,autoUpdate,useDismiss,useRole,useInteractions,FloatingPortal,size,arrow,useHover,safePolygon,useFocus}from'@floating-ui/react';import {motion,AnimatePresence,useAnimationControls}from'framer-motion';import {createRoot}from'react-dom/client';var ha={xxs:"0.15rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem"},ya={xxs:"0.3rem",xs:"0.4rem",sm:"0.6rem",md:"0.7rem",lg:"1rem",xl:"2rem",full:"9999px"},xa={sm:32,md:36,lg:40,border:"1px"},va={fonts:{sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},sizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px","6xl":"60px"}},qr={0:"#ffffff",50:"#f9f9f9",100:"#f5f5f5",200:"#eeeeee",300:"#e5e5e5",400:"#C6C6C6",500:"#b3b3b3",600:"#737373",700:"#4a4a4a",800:"#2b2b2b",900:"#111111"},Gr={0:"#0c0c0c",50:"#121212",100:"#1a1a1a",200:"#222222",300:"#2b2b2b",400:"#333333",500:"#444444",600:"#6e6e6e",700:"#a6a6a6",800:"#e5e5e5",900:"#ffffff"},ga={mono:{0:"#FFFFFF",50:"#FAFAFA",100:"#F2F2F2",200:"#E6E6E6",300:"#D1D1D1",400:"#8A8A8A",500:"#2A2A2A",600:"#1A1A1A",700:"#121212",800:"#0B0B0B",900:"#000000"},danger:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},success:{0:"#FFFFFF",50:"#EEFFF3",100:"#D7FFE8",200:"#d6ffe7ff",300:"#8EF5BB",400:"#5BEA9A",500:"#0FD45D",600:"#00C853",700:"#109C47",800:"#0E8242",900:"#064D2B"},warning:{0:"#FFFFFF",50:"#FFF7EB",100:"#FFEFC6",200:"#FFE094",300:"#FFC552",400:"#FFB83A",500:"#FFA414",600:"#FF9F0A",700:"#D97500",800:"#AF5E00",900:"#6E3600"},info:{0:"#FFFFFF",50:"#ECFAFF",100:"#D2F2FF",200:"#AEE6FF",300:"#84D6FF",400:"#4BC1FF",500:"#2B9FFF",600:"#1093FF",700:"#0077C0",800:"#0066A8",900:"#083B61"},red:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},amber:{0:"#FFFFFF",50:"#FFF3EA",100:"#FFE3D1",200:"#FFC7A6",300:"#FFAC80",400:"#FF874D",500:"#FF6C1F",600:"#FF5A00",700:"#D24500",800:"#B63C00",900:"#6F2300"},orange:{0:"#FFFFFF",50:"#FFF4EB",100:"#FFE6CC",200:"#FFCE9E",300:"#FFAE66",400:"#FF8B33",500:"#FF7310",600:"#FF6B00",700:"#CC4400",800:"#AF3F00",900:"#6B2400"},yellow:{0:"#FFFFFF",50:"#FFFAE6",100:"#FFF2BF",200:"#FFE780",300:"#FFDB3D",400:"#FFD000",500:"#FFE03F",600:"#FFD60A",700:"#B38600",800:"#8E6D00",900:"#534300"},lime:{0:"#FFFFFF",50:"#F6FFE8",100:"#E7FFC2",200:"#CCFF83",300:"#A8FA3D",400:"#8BE11C",500:"#87DE10",600:"#7ACC00",700:"#4A8C00",800:"#3B7100",900:"#224300"},green:{0:"#FFFFFF",50:"#F0FFF5",100:"#DBFFE9",200:"#BDF7CF",300:"#8FE7A8",400:"#5BD57D",500:"#1DAE52",600:"#16A34A",700:"#168A40",800:"#136A34",900:"#0B3D1F"},teal:{0:"#FFFFFF",50:"#EDFFFB",100:"#D2FFF4",200:"#A6FAEA",300:"#74EEDC",400:"#41DECB",500:"#00CFAA",600:"#00BFA5",700:"#0C8C7F",800:"#0B786C",900:"#084741"},cyan:{0:"#FFFFFF",50:"#EFFFFF",100:"#D4FCFF",200:"#AFF5FD",300:"#7FE8F6",400:"#45D3EB",500:"#09C6E7",600:"#00B8D9",700:"#0A7C92",800:"#0B6E81",900:"#0A4250"},blue:{0:"#FFFFFF",50:"#EFF6FF",100:"#DBE8FF",200:"#B8D3FF",300:"#90BAFF",400:"#5E97FF",500:"#406FFF",600:"#2F66FF",700:"#2452DE",800:"#2248C8",900:"#172C80"},indigo:{0:"#FFFFFF",50:"#EEF2FF",100:"#E0E6FF",200:"#C5D0FF",300:"#A3B5FF",400:"#879CFF",500:"#707AF5",600:"#5A63F3",700:"#4951DA",800:"#3E40BF",900:"#2A2A82"},purple:{0:"#FFFFFF",50:"#F4F0FF",100:"#E8DBFF",200:"#D2B8FF",300:"#B590FF",400:"#996AF5",500:"#7A52F1",600:"#6B3CF0",700:"#592FBE",800:"#4D27A3",900:"#2F1767"},magenta:{0:"#FFFFFF",50:"#FFF0FE",100:"#FCE0FF",200:"#F7BCFF",300:"#F393FD",400:"#E85FF8",500:"#C645D6",600:"#C026D3",700:"#951CAB",800:"#801790",900:"#4C0C59"},pink:{0:"#FFFFFF",50:"#FFF0F7",100:"#FFE0F0",200:"#FFC0E2",300:"#FF9ACE",400:"#FF6CB3",500:"#ED5CA2",600:"#EC4899",700:"#AB236F",800:"#96205D",900:"#5A1238"},rose:{0:"#FFFFFF",50:"#FFF0F3",100:"#FFE1E9",200:"#FFC1D3",300:"#FF98B8",400:"#FF6B98",500:"#EE4278",600:"#E52E69",700:"#B52156",800:"#991A43",900:"#5B0F28"}},ba={mono:{0:"#0B0B0C",50:"#0F0F10",100:"#151515",200:"#1B1B1C",300:"#232323",400:"#DADADA",500:"#E0E0E0",600:"#EDEDED",700:"#F5F5F5",800:"#FCFCFC",900:"#FFFFFF"},danger:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},success:{0:"#06150B",50:"#0A1B10",100:"#0E2416",200:"#11301C",300:"#143B21",400:"#16502C",500:"#22D85A",600:"#00C853",700:"#2FE976",800:"#7FF1AE",900:"#D6FADF"},warning:{0:"#150E05",50:"#1C1408",100:"#261B0B",200:"#31240E",300:"#3D2C12",400:"#583C16",500:"#FFA61A",600:"#FF9F0A",700:"#FFB347",800:"#FFD089",900:"#FFF0C9"},info:{0:"#07131E",50:"#0A1926",100:"#0E2233",200:"#112C44",300:"#143654",400:"#184A78",500:"#1C9CFF",600:"#1093FF",700:"#4FB2FF",800:"#9DD2FF",900:"#D8ECFF"},red:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},amber:{0:"#150D07",50:"#1C120A",100:"#26180E",200:"#311F12",300:"#3E2716",400:"#59361C",500:"#FF6A1E",600:"#FF5A00",700:"#FF8747",800:"#FFB98A",900:"#FFE2CC"},orange:{0:"#140D07",50:"#1B120A",100:"#25190D",200:"#302010",300:"#3B2813",400:"#553817",500:"#FF7F22",600:"#FF6B00",700:"#FF9247",800:"#FFBE8A",900:"#FFE1CC"},yellow:{0:"#141303",50:"#1B1906",100:"#25210A",200:"#2F2A0D",300:"#383212",400:"#524717",500:"#FFE042",600:"#FFD60A",700:"#FFE457",800:"#FFF194",900:"#FFF8CF"},lime:{0:"#0C1306",50:"#101A08",100:"#14210B",200:"#1A2B0F",300:"#203614",400:"#2A4A1A",500:"#86E21A",600:"#7ACC00",700:"#9EEA3B",800:"#C9F57F",900:"#EAFCC4"},green:{0:"#07140C",50:"#0B1B11",100:"#0E2416",200:"#112C1B",300:"#143722",400:"#17502F",500:"#20BF55",600:"#16A34A",700:"#39C964",800:"#86E5A5",900:"#D4F6E1"},teal:{0:"#081815",50:"#0B1F1C",100:"#0F2824",200:"#13322E",300:"#173E39",400:"#14584F",500:"#14CEBD",600:"#00BFA5",700:"#2CD6C6",800:"#7FEAE3",900:"#CFF7F3"},cyan:{0:"#07171C",50:"#0A1E24",100:"#0E2830",200:"#11333D",300:"#153E4A",400:"#165B6A",500:"#20CBE6",600:"#00B8D9",700:"#3FD2E9",800:"#93EBF6",900:"#D5F7FC"},blue:{0:"#081421",50:"#0A1829",100:"#0E2139",200:"#112A4B",300:"#153660",400:"#184A86",500:"#4A78FF",600:"#2F66FF",700:"#5A8AFF",800:"#A7C3FF",900:"#D9E7FF"},indigo:{0:"#0B1023",50:"#0E162C",100:"#141F3F",200:"#1C2A56",300:"#24366E",400:"#2F4894",500:"#707CF6",600:"#5A63F3",700:"#7D86FF",800:"#B5C0FF",900:"#E0E6FF"},purple:{0:"#100B1F",50:"#130E26",100:"#1A1638",200:"#231F4E",300:"#2E2A67",400:"#3C388D",500:"#8256F3",600:"#6B3CF0",700:"#8B66FA",800:"#C1B0FF",900:"#E4DCFF"},magenta:{0:"#160A18",50:"#1C0C21",100:"#25102E",200:"#321544",300:"#421A5C",400:"#58247C",500:"#CB44DB",600:"#C026D3",700:"#D960EB",800:"#F0B5FA",900:"#F9E4FE"},pink:{0:"#170911",50:"#1D0C18",100:"#271220",200:"#371830",300:"#462042",400:"#622C5C",500:"#F067AE",600:"#EC4899",700:"#F679BB",800:"#FFC2E1",900:"#FFE6F3"},rose:{0:"#17090E",50:"#1F0C13",100:"#2A121B",200:"#3A1B28",300:"#4B2636",400:"#673449",500:"#EE457B",600:"#E52E69",700:"#FF558A",800:"#FFA9C6",900:"#FFE0EA"}},Ca=e=>({...e,red:e.danger,error:e.danger,green:e.success,success:e.success,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,teal:e.teal,cyan:e.cyan,blue:e.blue,indigo:e.indigo,purple:e.purple,violet:e.purple,magenta:e.magenta,fuchsia:e.magenta,pink:e.pink,rose:e.rose,gray:e.mono,grey:e.mono,neutral:e.mono}),Qn=(e,t)=>e==="light"?{appBg:t[0],panelBg:t[0],subtleBg:t[100],panelHover:t[50],subtleHover:t[200],overlayBg:"linear-gradient(rgba(0,0,0,.15),rgba(0,0,0,.525))",border:t[300]}:{appBg:t[0],panelBg:t[0],subtleBg:t[50],panelHover:t[50],subtleHover:t[100],overlayBg:"linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.75))",border:t[200]},_o=e=>({primary:e[900],secondary:e[600],muted:e[500],onColors:{}}),jo=e=>({primary:e[900],secondary:e[700],muted:e[600],onColors:{}}),fc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],Ra=e=>fc.reduce((t,n)=>(t[n]=e[n]??"#FFFFFF",t),{}),Vo={spacing:ha,radius:ya,componentHeights:xa,typography:va,neutral:qr,palette:{...Ca(ga),primary:ga.mono},surface:Qn("light",qr),text:{..._o(qr),onColors:{primary:"#FFFFFF",...Ra({yellow:"#000000"})}}},Ta={spacing:ha,radius:ya,componentHeights:xa,typography:va,neutral:Gr,palette:{...Ca(ba),primary:ba.mono},surface:Qn("dark",Gr),text:{...jo(Gr),onColors:{primary:"#000000",...Ra({yellow:"#000000",lime:"#000000"})}}};function Ea(e){let t=e,n=new Set;return {get:()=>t,set:o=>{t=o,n.forEach(r=>r());},subscribe:o=>(n.add(o),()=>n.delete(o))}}var Ia={destructive:"danger",error:"danger",violet:"purple",fuchsia:"magenta",gray:"mono",grey:"mono",neutral:"mono"},eo=e=>Ia[e]??e;function an(e){let t={...e};return Object.entries(Ia).forEach(([n,o])=>{t[o]!=null&&t[n]==null&&(t[n]=t[o]);}),t}var Sa=me.createContext(null),Ma=me.createContext(null),Fa=me.createContext({setMode:e=>{},toggleMode:()=>{}}),Aa=me.createContext({setPrimary:e=>{}}),Pa=me.createContext(null);function V(){return useTheme()}function hc(){let e=me.useContext(Sa);if(!e)throw new Error("useColorMode must be used within ThemeProvider");let t=me.useContext(Fa),[n,o]=me.useState(()=>e.get());return me.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{mode:n,setMode:t.setMode,toggleMode:t.toggleMode}}function yc(){let e=me.useContext(Ma);if(!e)throw new Error("usePrimary must be used within ThemeProvider");let t=me.useContext(Aa),[n,o]=me.useState(()=>e.get());return me.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{primary:n,setPrimary:t.setPrimary}}function lb(e){let t=me.useContext(Pa);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=hc(),{primary:o}=yc(),r=me.useMemo(()=>{let s=n==="light"?t.light:t.dark,a=s.palette[eo(o)]??s.palette.primary,c=an(s.text.onColors)[eo(o)]??Yr(a[600]);return {...s,palette:{...s.palette,primary:a},text:{...s.text,onColors:{...an(s.text.onColors),primary:c,[eo(o)]:c,[o]:c}}}},[t,n,o]);return e?e(r):r}function Uo(e,t){if(!t)return e;let n={...e.palette};if(t.palette)for(let o of Object.keys(t.palette)){let r=t.palette[o];r&&(n[o]={...e.palette[o]??{},...r});}return {...e,spacing:{...e.spacing,...t.spacing??{}},radius:{...e.radius,...t.radius??{}},componentHeights:{...e.componentHeights,...t.componentHeights??{}},typography:{fonts:{...e.typography.fonts,...t.typography?.fonts??{}},sizes:{...e.typography.sizes,...t.typography?.sizes??{}}},palette:n,neutral:t.neutral?{...e.neutral,...t.neutral}:e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}}function Yr(e){let t=e.replace("#",""),n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16),s=c=>{let i=c/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*s(n)+.7152*s(o)+.0722*s(r)>.53?"#000":"#FFF"}function ka(e,t){if(e.current)return;let n=document.createElement("style");n.id=t,document.head.appendChild(n),e.current=n;}function Xr(e){return e?`[data-pfui-scope="${e}"]`:":root"}function Go(e,t,n){let o=[],r=i=>i.startsWith("var(")?i.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():i;o.push(`--pf-font-sans:${r(e.typography.fonts.sans)};`),o.push(`--pf-font-mono:${r(e.typography.fonts.mono)};`),o.push(`--pf-text-primary:${e.text.primary};`),o.push(`--pf-text-secondary:${e.text.secondary};`),o.push(`--pf-text-muted:${e.text.muted};`),Object.entries(e.text.onColors).forEach(([i,l])=>o.push(`--pf-text-on-${i}:${l};`)),Object.entries(e.spacing).forEach(([i,l])=>o.push(`--pf-space-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([i,l])=>o.push(`--pf-radius-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([i,l])=>o.push(`--pf-fontSize-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([i,l])=>o.push(`--pf-cmph-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([i,l])=>o.push(`--pf-neutral-${i}:${l};`)),o.push(`--pf-surface-appBg:${e.surface.appBg};`),o.push(`--pf-surface-panelBg:${e.surface.panelBg};`),o.push(`--pf-surface-subtleBg:${e.surface.subtleBg};`),o.push(`--pf-surface-panelHover:${e.surface.panelHover};`),o.push(`--pf-surface-subtleHover:${e.surface.subtleHover};`),o.push(`--pf-surface-overlayBg:${e.surface.overlayBg};`),o.push(`--pf-surface-border:${e.surface.border};`),o.push("--pf-focus-main:var(--pf-neutral-400);"),o.push(n==="dark"?"--pf-focus-soft:var(--pf-neutral-200);":"--pf-focus-soft:var(--pf-neutral-300);"),Object.entries(e.palette).forEach(([i,l])=>{Object.entries(l).forEach(([u,d])=>{o.push(`--pf-palette-${i}-${u}:${d};`);});});let s="300";Object.keys(e.palette).forEach(i=>{o.push(`--pf-focus-${i}-main: var(--pf-palette-${i}-${s});`),o.push(`--pf-focus-${i}-soft: transparent;`);});let a=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(i=>o.push(`--pf-primary-${i}:var(--pf-palette-${a}-${i});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let c=e.text.onColors[a]??(()=>{let l=(e.palette[a]?.[600]??e.palette.primary[600]).replace("#",""),u=parseInt(l.slice(0,2),16),d=parseInt(l.slice(2,4),16),y=parseInt(l.slice(4,6),16),f=I=>{let x=I/255;return x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4)};return .2126*f(u)+.7152*f(d)+.0722*f(y)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${c};`),o.push(`color-scheme:${n==="dark"?"dark":"light"};`),o}function qo(e,t,n){return Go(e,t,n).join("")}var Na=({children:e,theme:t,initialMode:n="light",storageKey:o="pfui:pref",scope:r})=>{let s=!!r,a=t?.primaryKey??"mono",i=useRef((()=>{if(!s)try{let b=JSON.parse(localStorage.getItem(o)||"null");if(b?.mode==="light"||b?.mode==="dark")return b.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})()),l=me.useMemo(()=>Ea(i.current),[]),u=me.useMemo(()=>Ea(a),[a]),d=useRef(null),y=useRef(0),f=useRef(r??"__root__");me.useLayoutEffect(()=>{let b=0,h=d.current;for(;h&&h!==document.body;)h.hasAttribute("data-pfui-scope")&&b++,h=h.parentElement;y.current=b;},[r]);let T=useMemo(()=>{let b=Uo(Vo,t),h=Uo(b,t?.light),A=t?.light?.primaryKey??a,D=eo(A),L=h.palette.primary??h.palette[D]??h.palette.mono,k=an({..._o(h.neutral).onColors,...h.text.onColors}),E=k[D]??Yr(L[600]),W=t?.surface||t?.light?.surface?h.surface:Qn("light",h.neutral),z={...t?.text||t?.light?.text?h.text:_o(h.neutral),onColors:an({...k,primary:E,[D]:E})};return {...h,palette:{...h.palette,primary:L},surface:W,text:z}},[t,a]),I=useMemo(()=>{let b=Uo(Ta,t),h=Uo(b,t?.dark),A=t?.dark?.primaryKey??a,D=eo(A),L=h.palette.primary??h.palette[D]??h.palette.mono,k=an({...jo(h.neutral).onColors,...h.text.onColors}),E=k[D]??Yr(L[600]),W=t?.surface||t?.dark?.surface?h.surface:Qn("dark",h.neutral),z={...t?.text||t?.dark?.text?h.text:jo(h.neutral),onColors:an({...k,primary:E,[D]:E})};return {...h,palette:{...h.palette,primary:L},surface:W,text:z}},[t,a]),x=useRef(null),R=useRef(null),g=me.useInsertionEffect||me.useLayoutEffect,p=me.useRef(false),m=useCallback(()=>{let b=Xr(r);ka(R,s?`pfui-guard-${r}`:"pfui-guard-root"),R.current.textContent=`${b} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{R.current.textContent="";});},[r,s]);g(()=>{ka(x,s?`pfui-vars-${r}`:"pfui-vars-root");let b=t?.light?.primaryKey??t?.primaryKey??a,h=t?.dark?.primaryKey??t?.primaryKey??a,A=Xr(r),D=qo(T,b,"light"),L=qo(I,h,"dark");x.current.textContent=`${A}.pf-light{${D}}
2
- ${A}.pf-dark{${L}}`+(s?`
3
- ${A}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[T,I,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,a]),me.useLayoutEffect(()=>{if(!p.current){p.current=true;let b=s?d.current:document.documentElement;b&&(b.classList.toggle("pf-dark",i.current==="dark"),b.classList.toggle("pf-light",i.current!=="dark"),l.set(i.current));}},[s,l]);let C=useCallback(()=>{window.__pfuiActiveScope={id:f.current,depth:y.current,ts:Date.now()};},[]),P=useCallback(()=>{let b=s?d.current:document.documentElement,h={capture:true},A=()=>C();return b?.addEventListener("pointerdown",A,h),b?.addEventListener("mouseenter",A,h),b?.addEventListener("focusin",A,h),b?.addEventListener("keydown",A,h),()=>{b?.removeEventListener("pointerdown",A,h),b?.removeEventListener("mouseenter",A,h),b?.removeEventListener("focusin",A,h),b?.removeEventListener("keydown",A,h);}},[s,C]),w=useCallback(b=>{let h=window.__pfuiActiveScope,A=h&&Date.now()-h.ts<1500;if(!h||!A||h.id!==f.current)return;let D=l.get(),L=u.get(),E=Go(D==="light"?T:I,L,D).join("");b.style.cssText+=`;${E}`,b.classList.toggle("pf-light",D==="light"),b.classList.toggle("pf-dark",D==="dark"),b.setAttribute("data-pfui-portal-owner",f.current);},[l,u,T,I]),v=b=>{if(b.getAttribute("data-floating-ui-portal")==="true"||b.getAttribute("data-radix-portal")==="true"||b.getAttribute("data-portal")==="true")return true;let h=b.getAttribute("role");if(h==="tooltip"||h==="dialog")return true;let A=window.getComputedStyle(b);return A.position==="fixed"||A.position==="absolute"},N=useCallback(()=>{let b=new MutationObserver(h=>{for(let A of h)A.addedNodes.forEach(D=>{D instanceof HTMLElement&&(v(D)&&w(D),D.querySelectorAll('[data-floating-ui-portal="true"],[data-radix-portal="true"],[data-portal="true"],[role="tooltip"],[role="dialog"]').forEach(L=>w(L)));});});return b.observe(document.body,{childList:true,subtree:true}),()=>b.disconnect()},[w]);me.useEffect(()=>{let b=P(),h=N();return ()=>{b(),h();}},[P,N]);let B=useCallback(b=>{let h=s?d.current:document.documentElement,A=u.get(),L=Go(b==="light"?T:I,A,b).join("");h.style.cssText+=`;${L}`,h.classList.toggle("pf-light",b==="light"),h.classList.toggle("pf-dark",b==="dark");},[s,T,I,u]),K=useCallback(b=>{let h=u.get(),D=Go(b==="light"?T:I,h,b).join("");document.querySelectorAll(`[data-pfui-portal-owner="${f.current}"]`).forEach(L=>{L.style.cssText+=`;${D}`,L.classList.toggle("pf-light",b==="light"),L.classList.toggle("pf-dark",b==="dark");});},[T,I,u]),O=useCallback(b=>{if(l.get()!==b&&(m(),l.set(b),B(b),K(b),!s))try{let h=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...h,mode:b}));}catch{}},[l,s,o,m,B,K]),S=useCallback(()=>O(l.get()==="light"?"dark":"light"),[O,l]),F=useCallback(b=>{u.set(b);let h=Xr(r),A=qo(T,b,"light"),D=qo(I,b,"dark");x.current&&(x.current.textContent=`${h}.pf-light{${A}}
4
- ${h}.pf-dark{${D}}`+(s?`
5
- ${h}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m();let L=l.get();if(B(L),K(L),!s)try{let k=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...k,primary:b}));}catch{}},[T,I,r,s,l,u,m,B,K]),M=jsx(Pa.Provider,{value:{light:T,dark:I},children:jsx(Sa.Provider,{value:l,children:jsx(Ma.Provider,{value:u,children:jsx(Fa.Provider,{value:{setMode:O,toggleMode:S},children:jsx(Aa.Provider,{value:{setPrimary:F},children:jsx(ThemeProvider,{theme:xc(T),children:e})})})})})});return s?jsx("div",{ref:d,"data-pfui-scope":r,style:{background:"var(--pf-surface-appBg)",color:"var(--pf-text-primary)"},children:M}):jsx("div",{ref:d,children:M})};function xc(e){let t=(l,u)=>Object.fromEntries(Object.keys(l).map(d=>[d,u(d)])),n=t(e.spacing,l=>`var(--pf-space-${l})`),o=t(e.radius,l=>`var(--pf-radius-${l})`),r=t(e.typography.sizes,l=>`var(--pf-fontSize-${l})`),s=t(e.componentHeights,l=>`var(--pf-cmph-${l})`),a={sans:"var(--pf-font-sans)",mono:"var(--pf-font-mono)"},c=t(e.neutral,l=>`var(--pf-neutral-${l})`),i={};return Object.keys(e.palette).forEach(l=>{i[l]={},Object.keys(e.palette[l]).forEach(u=>{i[l][u]=`var(--pf-palette-${l}-${u})`;});}),i.primary=Object.fromEntries(["0","50","100","200","300","400","500","600","700","800","900"].map(l=>[l,`var(--pf-primary-${l})`])),{...e,spacing:n,radius:o,componentHeights:s,typography:{fonts:a,sizes:r},neutral:c,palette:i,surface:{appBg:"var(--pf-surface-appBg)",panelBg:"var(--pf-surface-panelBg)",subtleBg:"var(--pf-surface-subtleBg)",panelHover:"var(--pf-surface-panelHover)",subtleHover:"var(--pf-surface-subtleHover)",overlayBg:"var(--pf-surface-overlayBg)",border:"var(--pf-surface-border)"},text:{primary:"var(--pf-text-primary)",secondary:"var(--pf-text-secondary)",muted:"var(--pf-text-muted)",onColors:Object.fromEntries(Object.keys(an(e.text.onColors)).map(l=>[l,`var(--pf-text-on-${l})`]))}}}var vc=(e,t)=>{let n=e?.palette??{};return !t||t==="neutral"?"neutral":n[t]?t:"neutral"},Da=(e,t)=>{let n=vc(e,t);if(n==="neutral")return {soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"};let o=e?.palette?.[n];return o?{soft:o[300]??"transparent",main:o[600]??o[500]??"currentColor"}:{soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"}};function xe(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Da(e,t?.color),s=t?.haloWidth??3,a=t?.offset??0,c=t?.mode==="always"?"&:focus":"&:focus-visible",i={transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return i[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e4},css(i)}}function Yo(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Da(e,t?.color),s=t?.haloWidth??3,a=t?.offset??0,c=t?.mode==="always"?"&:focus-within":"&:has(:focus-visible)",i={position:"relative",transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return i[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e3},css(i)}}var $a=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,za=e=>{let t=e.type;return t?.__PFUI_SLOT||t?.displayName||t?.name||""},es=forwardRef(({children:e,expandIcon:t,expandIconPosition:n="right",hideExpandIcon:o=false,className:r,css:s,expandIconCss:a},c)=>{let i=V(),l=i.typography.sizes.sm,u=20,d=10,y=i.spacing.lg,f=i.spacing.md,T=Number(i.componentHeights?.md),I=i.text,x=css({display:"flex",alignItems:"center",outline:"none",userSelect:"none",fontWeight:500,minHeight:T,padding:`${f} ${y}`,gap:d,fontSize:l,color:I.primary}),R=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:8}),g=css({marginRight:0,marginLeft:-2,lineHeight:0,color:i.text.secondary}),p=css({marginLeft:5,marginRight:-2,lineHeight:0,color:i.text.secondary});return jsxs("div",{ref:c,role:"presentation",tabIndex:-1,className:["plainframe-ui-accordion-summary",r||""].join(" ").trim(),css:[x,s],children:[!o&&n==="left"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-left",css:[g,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})}),jsx("span",{className:"plainframe-ui-accordion-content",css:R,children:e}),!o&&n==="right"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-right",css:[p,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})})]})});es.__PFUI_SLOT="AccordionSummary";es.displayName="AccordionSummary";var ts=({children:e,className:t,css:n})=>{let o=V(),r=o.typography.sizes.sm,s=o.spacing.lg,a="0.15rem",c=o.spacing.md,i=css({padding:`${a} ${s} ${c} ${s}`,fontSize:r,boxSizing:"border-box",minHeight:0});return jsx("div",{className:["plainframe-ui-accordion-details",t||""].join(" ").trim(),css:[i,n],tabIndex:-1,children:e})};ts.__PFUI_SLOT="AccordionDetails";ts.displayName="AccordionDetails";var Oa=({open:e,defaultOpen:t=false,onChange:n,className:o,variant:r="subtle",disabled:s=false,width:a,fullWidth:c=false,css:i,children:l})=>{let u=V(),d=useId(),y=useId(),f=u.radius?.md,T=u.text,I=u.componentHeights?.border??1,x=$a(I)??"1px",R=e!==void 0,[g,p]=useState(!!t),m=R?!!e:g,C=xe(),[P,w]=useState(0),[v,N]=useState(false),B=useRef(null),K=useRef(null),O=useRef(null),S=()=>{if(!m)return;let H=document.activeElement;K.current?.contains(H)&&O.current?.focus();},F=()=>{s||(S(),R?n?.(!e):p(H=>{let U=!H;return n?.(U),U}));},M=me.Children.toArray(l).filter(H=>isValidElement(H)),b=M.findIndex(H=>za(H)==="AccordionSummary"),h=M.findIndex(H=>za(H)==="AccordionDetails");b===-1&&M.length&&(b=0),h===-1&&(h=M.findIndex((H,U)=>U!==b),h===-1&&M.length>=2&&(h=1));let A=M[b]??null,D=M[h]??null,L=r==="subtle"?u.surface.subtleBg:r==="outlined"?u.surface.panelBg:"transparent",k=css({backgroundColor:L,color:T.primary,borderRadius:f,border:r==="outlined"?`${x} solid ${u.surface.border}`:"none",outline:"none",marginBottom:u.spacing.sm,maxWidth:a!=null?$a(a):void 0,width:c?"100%":a!=null?void 0:"auto",boxSizing:"border-box",opacity:s?.55:1,cursor:s?"not-allowed":void 0});useLayoutEffect(()=>{let H=B.current;H&&w(H.scrollHeight);},[m,l]),useEffect(()=>{let H=B.current;if(!H)return;let U=new ResizeObserver(()=>w(H.scrollHeight));return U.observe(H),()=>U.disconnect()},[]),useEffect(()=>{P>0&&!v&&N(true);},[P,v]),useLayoutEffect(()=>{if(!m&&K.current){let H=document.activeElement;K.current.contains(H)&&O.current?.focus();}},[m]),useLayoutEffect(()=>{let H=K.current;if(!H)return;let U=Array.from(H.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]"));m?(U.forEach(X=>{let ae=X.dataset.accordionTabindex;ae!=null&&(ae===""?X.removeAttribute("tabindex"):X.tabIndex=Number(ae),delete X.dataset.accordionTabindex);}),H.removeAttribute("inert")):(U.forEach(X=>{X.dataset.accordionTabindex==null&&(X.dataset.accordionTabindex=X.hasAttribute("tabindex")?X.getAttribute("tabindex")??"":""),X.tabIndex=-1;}),H.setAttribute("inert",""));},[m]);let E=css({maxHeight:m?P||"none":0,overflow:m&&!v?"visible":"hidden",transition:v?"max-height 0.36s cubic-bezier(.25,.8,.4,1)":"none",willChange:v?"max-height":void 0}),W=css({opacity:m?1:0,transform:m?"translateY(0)":"translateY(1rem)",transition:v?"transform 0.28s ease, opacity 0.28s ease":"none"}),$=css({"& .plainframe-ui-accordion-icon":{transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1)",transform:m?"rotate(180deg)":"rotate(0deg)"}}),z=A&&cloneElement(A,{...typeof A.props=="object"&&A.props?A.props:{},className:[A.props?.className,"plainframe-ui-accordion-summary-managed"].filter(Boolean).join(" ")}),_=D;return jsxs("div",{className:["plainframe-ui-accordion",`plainframe-ui-accordion-${r}`,o||""].join(" ").trim(),"data-variant":r,"data-open":m?"true":"false","data-disabled":s?"true":"false",css:[C(),k,i],tabIndex:s?-1:0,ref:O,role:"button","aria-expanded":m,"aria-controls":d,"aria-labelledby":y,"aria-disabled":s||void 0,onClick:H=>{H.detail===0&&document.activeElement!==O.current||F();},onKeyDown:H=>{s||document.activeElement===O.current&&H.target===O.current&&(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),F());},children:[jsx("div",{id:y,className:"plainframe-ui-accordion-summary-wrapper",css:[css({cursor:s?"not-allowed":"pointer"}),$],children:z}),jsx("div",{id:d,"aria-hidden":!m,className:"plainframe-ui-accordion-details-clip",css:E,tabIndex:-1,ref:K,onClick:H=>H.stopPropagation(),children:jsx("div",{ref:B,className:"plainframe-ui-accordion-details-inner",css:W,children:_})})]})};Oa.displayName="Accordion";var Ac=e=>isValidElement(e),Pc=e=>Ac(e)?e.type?.displayName||e.type?.name:void 0,Ka=e=>Pc(e)==="Accordion",Nc=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Dc=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,_a=({children:e,attached:t=false,variant:n,exclusive:o=false,openIndex:r,defaultOpenIndex:s,onOpenIndexChange:a,disabled:c=false,width:i,fullWidth:l=false,className:u,role:d="group",css:y})=>{let f=V(),T=useRef(null),I=Children.toArray(e),x=I.filter(Ka),R=x.length,g=o&&r!==void 0,[p,m]=useState(()=>{if(!o)return null;if(s!==void 0)return s;for(let F=0;F<x.length;F++){let M=x[F].props;if(M.open||M.defaultOpen)return F}return null}),C=o?g?r??null:p:null,P=Dc(f.componentHeights?.border,1),w=f.surface.border,v=f.radius.md,N=n,B=N==="outlined";useEffect(()=>{let F=T.current;if(!F)return;let M=b=>{if(b.key!=="ArrowDown"&&b.key!=="ArrowUp"&&b.key!=="Home"&&b.key!=="End")return;let A=Array.from(F.querySelectorAll(".plainframe-ui-accordion")).filter(E=>E.getAttribute("data-disabled")!=="true");if(A.length===0)return;let D=document.activeElement,L=A.findIndex(E=>E.contains(D));if(L===-1)return;b.preventDefault();let k=L;b.key==="ArrowDown"?k=(L+1)%A.length:b.key==="ArrowUp"?k=(L-1+A.length)%A.length:b.key==="Home"?k=0:b.key==="End"&&(k=A.length-1),A[k]?.focus();};return F.addEventListener("keydown",M),()=>F.removeEventListener("keydown",M)},[R]);let K=css({display:"flex",flexDirection:"column",maxWidth:i!=null?Nc(i):void 0,width:l?"100%":i!=null?void 0:"auto",gap:t?0:f.spacing.sm,border:t&&B?`${P} solid ${w}`:"none",borderRadius:t&&B?v:void 0,background:t&&B?f.surface.panelBg:"transparent"}),O=0,S=[];return I.forEach((F,M)=>{if(!Ka(F)){S.push(F);return}let b=F.props,h=O++,A=h===0,D=h===R-1,L=c||!!b.disabled,k=N??b.variant,E=t?css({width:"100%",marginBottom:0,borderTopLeftRadius:A?v:0,borderTopRightRadius:A?v:0,borderBottomLeftRadius:D?v:0,borderBottomRightRadius:D?v:0}):css({width:"100%",marginBottom:0}),W=!A&&R>1&&t?css({borderTop:`${P} solid ${w}`}):null,$=B?css({border:"1px solid transparent"}):null,z={variant:k,disabled:L,width:"100%",css:[b.css,E,$,W],className:[b.className,"plainframe-ui-accordion-group-item"].filter(Boolean).join(" ")};if(o){let _=b.onChange,H=C===h;z.open=H,z.defaultOpen=void 0,z.onChange=U=>{let X=U?h:null;g||m(X),a?.(X),_?.(U);};}S.push(cloneElement(F,{...b,...z,key:F?.key??M}));}),jsx("div",{ref:T,role:d,"aria-orientation":"vertical","data-attached":t||void 0,"data-exclusive":o||void 0,className:["plainframe-ui-accordion-group",u||""].join(" ").trim(),css:[K,y],children:S})};_a.displayName="AccordionGroup";var jt=e=>typeof e=="number"?`${e}px`:e,Va=({children:e,open:t=true,anchorOrigin:n={horizontal:"center",vertical:"bottom"},direction:o="horizontal",padding:r="sm",gap:s="xs",radius:a="lg",offset:c=0,offsetX:i=0,offsetY:l=0,elevated:u=true,unstyled:d=false,fullWidth:y=false,width:f,height:T,role:I="toolbar","aria-label":x,onClose:R})=>{let g=V(),p=useRef(null),m=useRef(null),C=useRef(false),P=useRef(t),w=n.horizontal??"center",v=n.vertical??"bottom",N=k=>typeof k=="string"?g.spacing[k]??k:k,B=k=>typeof k=="string"?g.radius[k]??k:k,K=jt(N(c)),O=jt(N(i)),S=jt(N(l)),F={position:"fixed",left:0,right:0,top:0,bottom:0,display:"flex",pointerEvents:"none",zIndex:1e3,justifyContent:w==="left"?"flex-start":w==="right"?"flex-end":"center",alignItems:v==="top"?"flex-start":v==="bottom"?"flex-end":"center"},M=()=>`${w==="left"?"left":w==="right"?"right":"center"} ${v==="top"?"top":v==="bottom"?"bottom":"center"}`,b=()=>v==="top"||v==="bottom"?`translateY(${v==="bottom"?100:-100}px) scale(0.98)`:v==="center"?w==="left"?"translateX(-100px) scale(0.98)":w==="right"?"translateX(100px) scale(0.98)":"scale(0.95)":"scale(0.98)",h=()=>v==="center"&&w==="center"?"scale(1)":"translateX(0) translateY(0) scale(1)",A=24,D={margin:A,marginTop:v==="top"?`calc(${A}px + ${K} + ${S})`:A,marginBottom:v==="bottom"?`calc(${A}px + ${K} + ${S})`:A,marginLeft:w==="left"?`calc(${A}px + ${K} + ${O})`:A,marginRight:w==="right"?`calc(${A}px + ${K} + ${O})`:A,padding:d?0:jt(N(r)),background:d?"transparent":g.surface.panelBg,border:d?"none":`1px solid ${g.surface.border}`,borderRadius:d?0:jt(B(a)),boxShadow:d||!u?"none":"0 20px 40px rgba(0,0,0,.08)",display:"flex",flexDirection:o==="vertical"?"column":"row",gap:jt(N(s)),transformOrigin:M(),pointerEvents:t?"auto":"none",width:y?"calc(100% - 48px)":f?jt(f):"auto",height:T?jt(T):"auto",maxWidth:y?"100%":"none"},L=css({"& .plainframe-ui-textfield":{flex:1,minWidth:0}});return useLayoutEffect(()=>{let k=p.current;if(!k)return;let E=b(),W=h();if(!C.current){C.current=true,P.current=t,k.style.opacity=t?"1":"0",k.style.transform=t?W:E;return}if(P.current===t){k.style.opacity=t?"1":"0",k.style.transform=t?W:E;return}P.current=t,m.current&&m.current.cancel();let $=t?[{opacity:0,transform:E},{opacity:1,transform:W}]:[{opacity:1,transform:W},{opacity:0,transform:E}];return m.current=k.animate($,{duration:250,easing:"ease",fill:"forwards"}),()=>{m.current&&m.current.cancel();}},[t,w,v]),useEffect(()=>{if(!t||!R)return;let k=E=>{E.key==="Escape"&&R();};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[t,R]),jsx("div",{css:F,children:jsx("div",{ref:p,css:L,style:D,role:I,"aria-label":x,"aria-hidden":!t,...!t&&{inert:true},children:e})})};Va.displayName="ActionBar";var qa=(e,t,n)=>Math.min(n,Math.max(t,e)),ns=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Ua=1,Oc=keyframes`100% { transform: rotate(360deg); }`,Wc=keyframes`
1
+ import de,{forwardRef,createContext,useId,useMemo,useState,useCallback,useRef,useEffect,useContext,isValidElement,cloneElement,Children,memo,useSyncExternalStore,useLayoutEffect}from'react';import {css,keyframes,useTheme,ThemeProvider,Global}from'@emotion/react';import {jsxs,jsx,Fragment}from'@emotion/react/jsx-runtime';import {ChevronDown,CircleAlert,TriangleAlert,CircleCheckBig,Info,X,Eye,EyeOff,ChevronRight,Check,ChevronFirst,ChevronLeft,ChevronLast,ChevronsUpDown}from'lucide-react';import {useFloating,offset,flip,shift,autoUpdate,useDismiss,useRole,useInteractions,FloatingPortal,size,arrow,useHover,safePolygon,useFocus}from'@floating-ui/react';import {motion,AnimatePresence,useAnimationControls}from'framer-motion';import {createRoot}from'react-dom/client';var ma={xxs:"0.15rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem"},fa={xxs:"0.3rem",xs:"0.4rem",sm:"0.6rem",md:"0.7rem",lg:"1rem",xl:"2rem",full:"9999px"},ga={sm:32,md:36,lg:40,border:"1px"},ba={fonts:{sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},sizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px","6xl":"60px"}},Vr={0:"#ffffff",50:"#f9f9f9",100:"#f5f5f5",200:"#eeeeee",300:"#e5e5e5",400:"#C6C6C6",500:"#b3b3b3",600:"#737373",700:"#4a4a4a",800:"#2b2b2b",900:"#111111"},jr={0:"#0c0c0c",50:"#121212",100:"#1a1a1a",200:"#222222",300:"#2b2b2b",400:"#333333",500:"#444444",600:"#6e6e6e",700:"#a6a6a6",800:"#e5e5e5",900:"#ffffff"},da={mono:{0:"#FFFFFF",50:"#FAFAFA",100:"#F2F2F2",200:"#E6E6E6",300:"#D1D1D1",400:"#8A8A8A",500:"#2A2A2A",600:"#1A1A1A",700:"#121212",800:"#0B0B0B",900:"#000000"},danger:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},success:{0:"#FFFFFF",50:"#EEFFF3",100:"#D7FFE8",200:"#d6ffe7ff",300:"#8EF5BB",400:"#5BEA9A",500:"#0FD45D",600:"#00C853",700:"#109C47",800:"#0E8242",900:"#064D2B"},warning:{0:"#FFFFFF",50:"#FFF7EB",100:"#FFEFC6",200:"#FFE094",300:"#FFC552",400:"#FFB83A",500:"#FFA414",600:"#FF9F0A",700:"#D97500",800:"#AF5E00",900:"#6E3600"},info:{0:"#FFFFFF",50:"#ECFAFF",100:"#D2F2FF",200:"#AEE6FF",300:"#84D6FF",400:"#4BC1FF",500:"#2B9FFF",600:"#1093FF",700:"#0077C0",800:"#0066A8",900:"#083B61"},red:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},amber:{0:"#FFFFFF",50:"#FFF3EA",100:"#FFE3D1",200:"#FFC7A6",300:"#FFAC80",400:"#FF874D",500:"#FF6C1F",600:"#FF5A00",700:"#D24500",800:"#B63C00",900:"#6F2300"},orange:{0:"#FFFFFF",50:"#FFF4EB",100:"#FFE6CC",200:"#FFCE9E",300:"#FFAE66",400:"#FF8B33",500:"#FF7310",600:"#FF6B00",700:"#CC4400",800:"#AF3F00",900:"#6B2400"},yellow:{0:"#FFFFFF",50:"#FFFAE6",100:"#FFF2BF",200:"#FFE780",300:"#FFDB3D",400:"#FFD000",500:"#FFE03F",600:"#FFD60A",700:"#B38600",800:"#8E6D00",900:"#534300"},lime:{0:"#FFFFFF",50:"#F6FFE8",100:"#E7FFC2",200:"#CCFF83",300:"#A8FA3D",400:"#8BE11C",500:"#87DE10",600:"#7ACC00",700:"#4A8C00",800:"#3B7100",900:"#224300"},green:{0:"#FFFFFF",50:"#F0FFF5",100:"#DBFFE9",200:"#BDF7CF",300:"#8FE7A8",400:"#5BD57D",500:"#1DAE52",600:"#16A34A",700:"#168A40",800:"#136A34",900:"#0B3D1F"},teal:{0:"#FFFFFF",50:"#EDFFFB",100:"#D2FFF4",200:"#A6FAEA",300:"#74EEDC",400:"#41DECB",500:"#00CFAA",600:"#00BFA5",700:"#0C8C7F",800:"#0B786C",900:"#084741"},cyan:{0:"#FFFFFF",50:"#EFFFFF",100:"#D4FCFF",200:"#AFF5FD",300:"#7FE8F6",400:"#45D3EB",500:"#09C6E7",600:"#00B8D9",700:"#0A7C92",800:"#0B6E81",900:"#0A4250"},blue:{0:"#FFFFFF",50:"#EFF6FF",100:"#DBE8FF",200:"#B8D3FF",300:"#90BAFF",400:"#5E97FF",500:"#406FFF",600:"#2F66FF",700:"#2452DE",800:"#2248C8",900:"#172C80"},indigo:{0:"#FFFFFF",50:"#EEF2FF",100:"#E0E6FF",200:"#C5D0FF",300:"#A3B5FF",400:"#879CFF",500:"#707AF5",600:"#5A63F3",700:"#4951DA",800:"#3E40BF",900:"#2A2A82"},purple:{0:"#FFFFFF",50:"#F4F0FF",100:"#E8DBFF",200:"#D2B8FF",300:"#B590FF",400:"#996AF5",500:"#7A52F1",600:"#6B3CF0",700:"#592FBE",800:"#4D27A3",900:"#2F1767"},magenta:{0:"#FFFFFF",50:"#FFF0FE",100:"#FCE0FF",200:"#F7BCFF",300:"#F393FD",400:"#E85FF8",500:"#C645D6",600:"#C026D3",700:"#951CAB",800:"#801790",900:"#4C0C59"},pink:{0:"#FFFFFF",50:"#FFF0F7",100:"#FFE0F0",200:"#FFC0E2",300:"#FF9ACE",400:"#FF6CB3",500:"#ED5CA2",600:"#EC4899",700:"#AB236F",800:"#96205D",900:"#5A1238"},rose:{0:"#FFFFFF",50:"#FFF0F3",100:"#FFE1E9",200:"#FFC1D3",300:"#FF98B8",400:"#FF6B98",500:"#EE4278",600:"#E52E69",700:"#B52156",800:"#991A43",900:"#5B0F28"}},pa={mono:{0:"#0B0B0C",50:"#0F0F10",100:"#151515",200:"#1B1B1C",300:"#232323",400:"#DADADA",500:"#E0E0E0",600:"#EDEDED",700:"#F5F5F5",800:"#FCFCFC",900:"#FFFFFF"},danger:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},success:{0:"#06150B",50:"#0A1B10",100:"#0E2416",200:"#11301C",300:"#143B21",400:"#16502C",500:"#22D85A",600:"#00C853",700:"#2FE976",800:"#7FF1AE",900:"#D6FADF"},warning:{0:"#150E05",50:"#1C1408",100:"#261B0B",200:"#31240E",300:"#3D2C12",400:"#583C16",500:"#FFA61A",600:"#FF9F0A",700:"#FFB347",800:"#FFD089",900:"#FFF0C9"},info:{0:"#07131E",50:"#0A1926",100:"#0E2233",200:"#112C44",300:"#143654",400:"#184A78",500:"#1C9CFF",600:"#1093FF",700:"#4FB2FF",800:"#9DD2FF",900:"#D8ECFF"},red:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},amber:{0:"#150D07",50:"#1C120A",100:"#26180E",200:"#311F12",300:"#3E2716",400:"#59361C",500:"#FF6A1E",600:"#FF5A00",700:"#FF8747",800:"#FFB98A",900:"#FFE2CC"},orange:{0:"#140D07",50:"#1B120A",100:"#25190D",200:"#302010",300:"#3B2813",400:"#553817",500:"#FF7F22",600:"#FF6B00",700:"#FF9247",800:"#FFBE8A",900:"#FFE1CC"},yellow:{0:"#141303",50:"#1B1906",100:"#25210A",200:"#2F2A0D",300:"#383212",400:"#524717",500:"#FFE042",600:"#FFD60A",700:"#FFE457",800:"#FFF194",900:"#FFF8CF"},lime:{0:"#0C1306",50:"#101A08",100:"#14210B",200:"#1A2B0F",300:"#203614",400:"#2A4A1A",500:"#86E21A",600:"#7ACC00",700:"#9EEA3B",800:"#C9F57F",900:"#EAFCC4"},green:{0:"#07140C",50:"#0B1B11",100:"#0E2416",200:"#112C1B",300:"#143722",400:"#17502F",500:"#20BF55",600:"#16A34A",700:"#39C964",800:"#86E5A5",900:"#D4F6E1"},teal:{0:"#081815",50:"#0B1F1C",100:"#0F2824",200:"#13322E",300:"#173E39",400:"#14584F",500:"#14CEBD",600:"#00BFA5",700:"#2CD6C6",800:"#7FEAE3",900:"#CFF7F3"},cyan:{0:"#07171C",50:"#0A1E24",100:"#0E2830",200:"#11333D",300:"#153E4A",400:"#165B6A",500:"#20CBE6",600:"#00B8D9",700:"#3FD2E9",800:"#93EBF6",900:"#D5F7FC"},blue:{0:"#081421",50:"#0A1829",100:"#0E2139",200:"#112A4B",300:"#153660",400:"#184A86",500:"#4A78FF",600:"#2F66FF",700:"#5A8AFF",800:"#A7C3FF",900:"#D9E7FF"},indigo:{0:"#0B1023",50:"#0E162C",100:"#141F3F",200:"#1C2A56",300:"#24366E",400:"#2F4894",500:"#707CF6",600:"#5A63F3",700:"#7D86FF",800:"#B5C0FF",900:"#E0E6FF"},purple:{0:"#100B1F",50:"#130E26",100:"#1A1638",200:"#231F4E",300:"#2E2A67",400:"#3C388D",500:"#8256F3",600:"#6B3CF0",700:"#8B66FA",800:"#C1B0FF",900:"#E4DCFF"},magenta:{0:"#160A18",50:"#1C0C21",100:"#25102E",200:"#321544",300:"#421A5C",400:"#58247C",500:"#CB44DB",600:"#C026D3",700:"#D960EB",800:"#F0B5FA",900:"#F9E4FE"},pink:{0:"#170911",50:"#1D0C18",100:"#271220",200:"#371830",300:"#462042",400:"#622C5C",500:"#F067AE",600:"#EC4899",700:"#F679BB",800:"#FFC2E1",900:"#FFE6F3"},rose:{0:"#17090E",50:"#1F0C13",100:"#2A121B",200:"#3A1B28",300:"#4B2636",400:"#673449",500:"#EE457B",600:"#E52E69",700:"#FF558A",800:"#FFA9C6",900:"#FFE0EA"}},ha=e=>({...e,red:e.danger,error:e.danger,green:e.success,success:e.success,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,teal:e.teal,cyan:e.cyan,blue:e.blue,indigo:e.indigo,purple:e.purple,violet:e.purple,magenta:e.magenta,fuchsia:e.magenta,pink:e.pink,rose:e.rose,gray:e.mono,grey:e.mono,neutral:e.mono}),Yn=(e,t)=>e==="light"?{appBg:t[0],panelBg:t[0],subtleBg:t[100],panelHover:t[50],subtleHover:t[200],overlayBg:"linear-gradient(rgba(0,0,0,.15),rgba(0,0,0,.525))",border:t[300]}:{appBg:t[0],panelBg:t[0],subtleBg:t[50],panelHover:t[50],subtleHover:t[100],overlayBg:"linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.75))",border:t[200]},Ko=e=>({primary:e[900],secondary:e[600],muted:e[500],onColors:{}}),_o=e=>({primary:e[900],secondary:e[700],muted:e[600],onColors:{}}),fc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],ya=e=>fc.reduce((t,n)=>(t[n]=e[n]??"#FFFFFF",t),{}),Vo={spacing:ma,radius:fa,componentHeights:ga,typography:ba,neutral:Vr,palette:{...ha(da),primary:da.mono},surface:Yn("light",Vr),text:{...Ko(Vr),onColors:{primary:"#FFFFFF",...ya({yellow:"#000000"})}}},xa={spacing:ma,radius:fa,componentHeights:ga,typography:ba,neutral:jr,palette:{...ha(pa),primary:pa.mono},surface:Yn("dark",jr),text:{..._o(jr),onColors:{primary:"#000000",...ya({yellow:"#000000",lime:"#000000"})}}};function Ca(e){let t=e,n=new Set;return {get:()=>t,set:o=>{t=o,n.forEach(r=>r());},subscribe:o=>(n.add(o),()=>n.delete(o))}}var Ta={destructive:"danger",error:"danger",violet:"purple",fuchsia:"magenta",gray:"mono",grey:"mono",neutral:"mono"},Jn=e=>Ta[e]??e;function Qt(e){let t={...e};return Object.entries(Ta).forEach(([n,o])=>{t[o]!=null&&t[n]==null&&(t[n]=t[o]);}),t}var wa=de.createContext(null),Ea=de.createContext(null),Sa=de.createContext({setMode:e=>{},toggleMode:()=>{}}),Ia=de.createContext({setPrimary:e=>{}}),ka=de.createContext(null);function V(){return useTheme()}function hc(){let e=de.useContext(wa);if(!e)throw new Error("useColorMode must be used within ThemeProvider");let t=de.useContext(Sa),[n,o]=de.useState(()=>e.get());return de.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{mode:n,setMode:t.setMode,toggleMode:t.toggleMode}}function yc(){let e=de.useContext(Ea);if(!e)throw new Error("usePrimary must be used within ThemeProvider");let t=de.useContext(Ia),[n,o]=de.useState(()=>e.get());return de.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{primary:n,setPrimary:t.setPrimary}}function lb(e){let t=de.useContext(ka);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=hc(),{primary:o}=yc(),r=de.useMemo(()=>{let s=n==="light"?t.light:t.dark,a=s.palette[Jn(o)]??s.palette.primary,c=Qt(s.text.onColors)[Jn(o)]??qr(a[600]);return {...s,palette:{...s.palette,primary:a},text:{...s.text,onColors:{...Qt(s.text.onColors),primary:c,[Jn(o)]:c,[o]:c}}}},[t,n,o]);return e?e(r):r}function jo(e,t){if(!t)return e;let n={...e.palette};if(t.palette)for(let o of Object.keys(t.palette)){let r=t.palette[o];r&&(n[o]={...e.palette[o]??{},...r});}return {...e,spacing:{...e.spacing,...t.spacing??{}},radius:{...e.radius,...t.radius??{}},componentHeights:{...e.componentHeights,...t.componentHeights??{}},typography:{fonts:{...e.typography.fonts,...t.typography?.fonts??{}},sizes:{...e.typography.sizes,...t.typography?.sizes??{}}},palette:n,neutral:t.neutral?{...e.neutral,...t.neutral}:e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}}function qr(e){let t=e.replace("#",""),n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16),s=c=>{let i=c/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*s(n)+.7152*s(o)+.0722*s(r)>.53?"#000":"#FFF"}function Ra(e,t){if(e.current)return;let n=document.createElement("style");n.id=t,document.head.appendChild(n),e.current=n;}function Ur(e){return e?`[data-pfui-scope="${e}"]`:":root"}function qo(e,t,n){let o=[],r=i=>i.startsWith("var(")?i.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():i;o.push(`--pf-font-sans:${r(e.typography.fonts.sans)};`),o.push(`--pf-font-mono:${r(e.typography.fonts.mono)};`),o.push(`--pf-text-primary:${e.text.primary};`),o.push(`--pf-text-secondary:${e.text.secondary};`),o.push(`--pf-text-muted:${e.text.muted};`),Object.entries(e.text.onColors).forEach(([i,l])=>o.push(`--pf-text-on-${i}:${l};`)),Object.entries(e.spacing).forEach(([i,l])=>o.push(`--pf-space-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([i,l])=>o.push(`--pf-radius-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([i,l])=>o.push(`--pf-fontSize-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([i,l])=>o.push(`--pf-cmph-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([i,l])=>o.push(`--pf-neutral-${i}:${l};`)),o.push(`--pf-surface-appBg:${e.surface.appBg};`),o.push(`--pf-surface-panelBg:${e.surface.panelBg};`),o.push(`--pf-surface-subtleBg:${e.surface.subtleBg};`),o.push(`--pf-surface-panelHover:${e.surface.panelHover};`),o.push(`--pf-surface-subtleHover:${e.surface.subtleHover};`),o.push(`--pf-surface-overlayBg:${e.surface.overlayBg};`),o.push(`--pf-surface-border:${e.surface.border};`),o.push("--pf-focus-main:var(--pf-neutral-400);"),o.push(n==="dark"?"--pf-focus-soft:var(--pf-neutral-200);":"--pf-focus-soft:var(--pf-neutral-300);"),Object.entries(e.palette).forEach(([i,l])=>{Object.entries(l).forEach(([u,d])=>{o.push(`--pf-palette-${i}-${u}:${d};`);});});let s="300";Object.keys(e.palette).forEach(i=>{o.push(`--pf-focus-${i}-main: var(--pf-palette-${i}-${s});`),o.push(`--pf-focus-${i}-soft: transparent;`);});let a=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(i=>o.push(`--pf-primary-${i}:var(--pf-palette-${a}-${i});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let c=e.text.onColors[a]??(()=>{let l=(e.palette[a]?.[600]??e.palette.primary[600]).replace("#",""),u=parseInt(l.slice(0,2),16),d=parseInt(l.slice(2,4),16),h=parseInt(l.slice(4,6),16),f=I=>{let x=I/255;return x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4)};return .2126*f(u)+.7152*f(d)+.0722*f(h)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${c};`),o.push(`color-scheme:${n==="dark"?"dark":"light"};`),o}function Uo(e,t,n){return qo(e,t,n).join("")}var Ma=({children:e,theme:t,initialMode:n="light",storageKey:o="pfui:pref",scope:r})=>{let s=!!r,a=t?.primaryKey??"mono",i=useRef((()=>{if(!s)try{let b=JSON.parse(localStorage.getItem(o)||"null");if(b?.mode==="light"||b?.mode==="dark")return b.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})()),l=de.useMemo(()=>Ca(i.current),[]),u=de.useMemo(()=>Ca(a),[a]),d=useRef(null),h=useRef(0),f=useRef(r??"__root__");de.useLayoutEffect(()=>{let b=0,y=d.current;for(;y&&y!==document.body;)y.hasAttribute("data-pfui-scope")&&b++,y=y.parentElement;h.current=b;},[r]);let R=useMemo(()=>{let b=jo(Vo,t),y=jo(b,t?.light),P=t?.light?.primaryKey??a,H=Jn(P),L=y.palette.primary??y.palette[H]??y.palette.mono,E=Qt({...Ko(y.neutral).onColors,...y.text.onColors}),S=E[H]??qr(L[600]),z=t?.surface||t?.light?.surface?y.surface:Yn("light",y.neutral),K={...t?.text||t?.light?.text?y.text:Ko(y.neutral),onColors:Qt({...E,primary:S,[H]:S})};return {...y,palette:{...y.palette,primary:L},surface:z,text:K}},[t,a]),I=useMemo(()=>{let b=jo(xa,t),y=jo(b,t?.dark),P=t?.dark?.primaryKey??a,H=Jn(P),L=y.palette.primary??y.palette[H]??y.palette.mono,E=Qt({..._o(y.neutral).onColors,...y.text.onColors}),S=E[H]??qr(L[600]),z=t?.surface||t?.dark?.surface?y.surface:Yn("dark",y.neutral),K={...t?.text||t?.dark?.text?y.text:_o(y.neutral),onColors:Qt({...E,primary:S,[H]:S})};return {...y,palette:{...y.palette,primary:L},surface:z,text:K}},[t,a]),x=useRef(null),C=useRef(null),g=de.useInsertionEffect||de.useLayoutEffect,p=de.useRef(false),m=useCallback(()=>{let b=Ur(r);Ra(C,s?`pfui-guard-${r}`:"pfui-guard-root"),C.current.textContent=`${b} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{C.current.textContent="";});},[r,s]);g(()=>{Ra(x,s?`pfui-vars-${r}`:"pfui-vars-root");let b=t?.light?.primaryKey??t?.primaryKey??a,y=t?.dark?.primaryKey??t?.primaryKey??a,P=Ur(r),H=Uo(R,b,"light"),L=Uo(I,y,"dark");x.current.textContent=`${P}.pf-light{${H}}
2
+ ${P}.pf-dark{${L}}`+(s?`
3
+ ${P}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[R,I,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,a]),de.useLayoutEffect(()=>{if(!p.current){p.current=true;let b=s?d.current:document.documentElement;b&&(b.classList.toggle("pf-dark",i.current==="dark"),b.classList.toggle("pf-light",i.current!=="dark"),l.set(i.current));}},[s,l]);let v=useCallback(()=>{window.__pfuiActiveScope={id:f.current,depth:h.current,ts:Date.now()};},[]),D=useCallback(()=>{let b=s?d.current:document.documentElement,y={capture:true},P=()=>v();return b?.addEventListener("pointerdown",P,y),b?.addEventListener("mouseenter",P,y),b?.addEventListener("focusin",P,y),b?.addEventListener("keydown",P,y),()=>{b?.removeEventListener("pointerdown",P,y),b?.removeEventListener("mouseenter",P,y),b?.removeEventListener("focusin",P,y),b?.removeEventListener("keydown",P,y);}},[s,v]),T=useCallback(b=>{let y=window.__pfuiActiveScope,P=y&&Date.now()-y.ts<1500;if(!y||!P||y.id!==f.current)return;let H=l.get(),L=u.get(),S=qo(H==="light"?R:I,L,H).join("");b.style.cssText+=`;${S}`,b.classList.toggle("pf-light",H==="light"),b.classList.toggle("pf-dark",H==="dark"),b.setAttribute("data-pfui-portal-owner",f.current);},[l,u,R,I]),w=b=>{if(b.getAttribute("data-floating-ui-portal")==="true"||b.getAttribute("data-radix-portal")==="true"||b.getAttribute("data-portal")==="true")return true;let y=b.getAttribute("role");if(y==="tooltip"||y==="dialog")return true;let P=window.getComputedStyle(b);return P.position==="fixed"||P.position==="absolute"},F=useCallback(()=>{let b=new MutationObserver(y=>{for(let P of y)P.addedNodes.forEach(H=>{H instanceof HTMLElement&&(w(H)&&T(H),H.querySelectorAll('[data-floating-ui-portal="true"],[data-radix-portal="true"],[data-portal="true"],[role="tooltip"],[role="dialog"]').forEach(L=>T(L)));});});return b.observe(document.body,{childList:true,subtree:true}),()=>b.disconnect()},[T]);de.useEffect(()=>{let b=D(),y=F();return ()=>{b(),y();}},[D,F]);let B=useCallback(b=>{let y=s?d.current:document.documentElement,P=u.get(),L=qo(b==="light"?R:I,P,b).join("");y.style.cssText+=`;${L}`,y.classList.toggle("pf-light",b==="light"),y.classList.toggle("pf-dark",b==="dark");},[s,R,I,u]),W=useCallback(b=>{let y=u.get(),H=qo(b==="light"?R:I,y,b).join("");document.querySelectorAll(`[data-pfui-portal-owner="${f.current}"]`).forEach(L=>{L.style.cssText+=`;${H}`,L.classList.toggle("pf-light",b==="light"),L.classList.toggle("pf-dark",b==="dark");});},[R,I,u]),O=useCallback(b=>{if(l.get()!==b&&(m(),l.set(b),B(b),W(b),!s))try{let y=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...y,mode:b}));}catch{}},[l,s,o,m,B,W]),k=useCallback(()=>O(l.get()==="light"?"dark":"light"),[O,l]),A=useCallback(b=>{u.set(b);let y=Ur(r),P=Uo(R,b,"light"),H=Uo(I,b,"dark");x.current&&(x.current.textContent=`${y}.pf-light{${P}}
4
+ ${y}.pf-dark{${H}}`+(s?`
5
+ ${y}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m();let L=l.get();if(B(L),W(L),!s)try{let E=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...E,primary:b}));}catch{}},[R,I,r,s,l,u,m,B,W]),M=jsx(ka.Provider,{value:{light:R,dark:I},children:jsx(wa.Provider,{value:l,children:jsx(Ea.Provider,{value:u,children:jsx(Sa.Provider,{value:{setMode:O,toggleMode:k},children:jsx(Ia.Provider,{value:{setPrimary:A},children:jsx(ThemeProvider,{theme:xc(R),children:e})})})})})});return s?jsx("div",{ref:d,"data-pfui-scope":r,style:{background:"var(--pf-surface-appBg)",color:"var(--pf-text-primary)"},children:M}):jsx("div",{ref:d,children:M})};function xc(e){let t=(l,u)=>Object.fromEntries(Object.keys(l).map(d=>[d,u(d)])),n=t(e.spacing,l=>`var(--pf-space-${l})`),o=t(e.radius,l=>`var(--pf-radius-${l})`),r=t(e.typography.sizes,l=>`var(--pf-fontSize-${l})`),s=t(e.componentHeights,l=>`var(--pf-cmph-${l})`),a={sans:"var(--pf-font-sans)",mono:"var(--pf-font-mono)"},c=t(e.neutral,l=>`var(--pf-neutral-${l})`),i={};return Object.keys(e.palette).forEach(l=>{i[l]={},Object.keys(e.palette[l]).forEach(u=>{i[l][u]=`var(--pf-palette-${l}-${u})`;});}),i.primary=Object.fromEntries(["0","50","100","200","300","400","500","600","700","800","900"].map(l=>[l,`var(--pf-primary-${l})`])),{...e,spacing:n,radius:o,componentHeights:s,typography:{fonts:a,sizes:r},neutral:c,palette:i,surface:{appBg:"var(--pf-surface-appBg)",panelBg:"var(--pf-surface-panelBg)",subtleBg:"var(--pf-surface-subtleBg)",panelHover:"var(--pf-surface-panelHover)",subtleHover:"var(--pf-surface-subtleHover)",overlayBg:"var(--pf-surface-overlayBg)",border:"var(--pf-surface-border)"},text:{primary:"var(--pf-text-primary)",secondary:"var(--pf-text-secondary)",muted:"var(--pf-text-muted)",onColors:Object.fromEntries(Object.keys(Qt(e.text.onColors)).map(l=>[l,`var(--pf-text-on-${l})`]))}}}var vc=(e,t)=>{let n=e?.palette??{};return !t||t==="neutral"?"neutral":n[t]?t:"neutral"},Fa=(e,t)=>{let n=vc(e,t);if(n==="neutral")return {soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"};let o=e?.palette?.[n];return o?{soft:o[300]??"transparent",main:o[600]??o[500]??"currentColor"}:{soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"}};function he(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Fa(e,t?.color),s=t?.haloWidth??3,a=t?.offset??0,c=t?.mode==="always"?"&:focus":"&:focus-visible",i={transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return i[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e4},css(i)}}function Xo(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Fa(e,t?.color),s=t?.haloWidth??3,a=t?.offset??0,c=t?.mode==="always"?"&:focus-within":"&:has(:focus-visible)",i={position:"relative",transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return i[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e3},css(i)}}var Na=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Ha=e=>{let t=e.type;return t?.__PFUI_SLOT||t?.displayName||t?.name||""},Jr=forwardRef(({children:e,expandIcon:t,expandIconPosition:n="right",hideExpandIcon:o=false,className:r,css:s,expandIconCss:a},c)=>{let i=V(),l=i.typography.sizes.sm,u=20,d=10,h=i.spacing.lg,f=i.spacing.md,R=Number(i.componentHeights?.md),I=i.text,x=css({display:"flex",alignItems:"center",outline:"none",userSelect:"none",fontWeight:500,minHeight:R,padding:`${f} ${h}`,gap:d,fontSize:l,color:I.primary}),C=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:8}),g=css({marginRight:0,marginLeft:-2,lineHeight:0,color:i.text.secondary}),p=css({marginLeft:5,marginRight:-2,lineHeight:0,color:i.text.secondary});return jsxs("div",{ref:c,role:"presentation",tabIndex:-1,className:["plainframe-ui-accordion-summary",r||""].join(" ").trim(),css:[x,s],children:[!o&&n==="left"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-left",css:[g,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})}),jsx("span",{className:"plainframe-ui-accordion-content",css:C,children:e}),!o&&n==="right"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-right",css:[p,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})})]})});Jr.__PFUI_SLOT="AccordionSummary";Jr.displayName="AccordionSummary";var Zr=({children:e,className:t,css:n})=>{let o=V(),r=o.typography.sizes.sm,s=o.spacing.lg,a="0.15rem",c=o.spacing.md,i=css({padding:`${a} ${s} ${c} ${s}`,fontSize:r,boxSizing:"border-box",minHeight:0});return jsx("div",{className:["plainframe-ui-accordion-details",t||""].join(" ").trim(),css:[i,n],tabIndex:-1,children:e})};Zr.__PFUI_SLOT="AccordionDetails";Zr.displayName="AccordionDetails";var La=({open:e,defaultOpen:t=false,onChange:n,className:o,variant:r="subtle",disabled:s=false,width:a,fullWidth:c=false,css:i,children:l})=>{let u=V(),d=useId(),h=useId(),f=u.radius?.md,R=u.text,I=u.componentHeights?.border??1,x=Na(I)??"1px",C=e!==void 0,[g,p]=useState(!!t),m=C?!!e:g,v=he(),[D,T]=useState(0),[w,F]=useState(false),B=useRef(null),W=useRef(null),O=useRef(null),k=()=>{if(!m)return;let N=document.activeElement;W.current?.contains(N)&&O.current?.focus();},A=()=>{s||(k(),C?n?.(!e):p(N=>{let U=!N;return n?.(U),U}));},M=de.Children.toArray(l).filter(N=>isValidElement(N)),b=M.findIndex(N=>Ha(N)==="AccordionSummary"),y=M.findIndex(N=>Ha(N)==="AccordionDetails");b===-1&&M.length&&(b=0),y===-1&&(y=M.findIndex((N,U)=>U!==b),y===-1&&M.length>=2&&(y=1));let P=M[b]??null,H=M[y]??null,L=r==="subtle"?u.surface.subtleBg:r==="outlined"?u.surface.panelBg:"transparent",E=css({backgroundColor:L,color:R.primary,borderRadius:f,border:r==="outlined"?`${x} solid ${u.surface.border}`:"none",outline:"none",marginBottom:u.spacing.sm,maxWidth:a!=null?Na(a):void 0,width:c?"100%":a!=null?void 0:"auto",boxSizing:"border-box",opacity:s?.55:1,cursor:s?"not-allowed":void 0});useLayoutEffect(()=>{let N=B.current;N&&T(N.scrollHeight);},[m,l]),useEffect(()=>{let N=B.current;if(!N)return;let U=new ResizeObserver(()=>T(N.scrollHeight));return U.observe(N),()=>U.disconnect()},[]),useEffect(()=>{D>0&&!w&&F(true);},[D,w]),useLayoutEffect(()=>{if(!m&&W.current){let N=document.activeElement;W.current.contains(N)&&O.current?.focus();}},[m]),useLayoutEffect(()=>{let N=W.current;if(!N)return;let U=Array.from(N.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]"));m?(U.forEach(X=>{let se=X.dataset.accordionTabindex;se!=null&&(se===""?X.removeAttribute("tabindex"):X.tabIndex=Number(se),delete X.dataset.accordionTabindex);}),N.removeAttribute("inert")):(U.forEach(X=>{X.dataset.accordionTabindex==null&&(X.dataset.accordionTabindex=X.hasAttribute("tabindex")?X.getAttribute("tabindex")??"":""),X.tabIndex=-1;}),N.setAttribute("inert",""));},[m]);let S=css({maxHeight:m?D||"none":0,overflow:m&&!w?"visible":"hidden",transition:w?"max-height 0.36s cubic-bezier(.25,.8,.4,1)":"none",willChange:w?"max-height":void 0}),z=css({opacity:m?1:0,transform:m?"translateY(0)":"translateY(1rem)",transition:w?"transform 0.28s ease, opacity 0.28s ease":"none"}),$=css({"& .plainframe-ui-accordion-icon":{transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1)",transform:m?"rotate(180deg)":"rotate(0deg)"}}),K=P&&cloneElement(P,{...typeof P.props=="object"&&P.props?P.props:{},className:[P.props?.className,"plainframe-ui-accordion-summary-managed"].filter(Boolean).join(" ")}),_=H;return jsxs("div",{className:["plainframe-ui-accordion",`plainframe-ui-accordion-${r}`,o||""].join(" ").trim(),"data-variant":r,"data-open":m?"true":"false","data-disabled":s?"true":"false",css:[v(),E,i],tabIndex:s?-1:0,ref:O,role:"button","aria-expanded":m,"aria-controls":d,"aria-labelledby":h,"aria-disabled":s||void 0,onClick:N=>{N.detail===0&&document.activeElement!==O.current||A();},onKeyDown:N=>{s||document.activeElement===O.current&&N.target===O.current&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),A());},children:[jsx("div",{id:h,className:"plainframe-ui-accordion-summary-wrapper",css:[css({cursor:s?"not-allowed":"pointer"}),$],children:K}),jsx("div",{id:d,"aria-hidden":!m,className:"plainframe-ui-accordion-details-clip",css:S,tabIndex:-1,ref:W,onClick:N=>N.stopPropagation(),children:jsx("div",{ref:B,className:"plainframe-ui-accordion-details-inner",css:z,children:_})})]})};La.displayName="Accordion";var Ac=e=>isValidElement(e),Pc=e=>Ac(e)?e.type?.displayName||e.type?.name:void 0,$a=e=>Pc(e)==="Accordion",Dc=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Nc=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,za=({children:e,attached:t=false,variant:n,exclusive:o=false,openIndex:r,defaultOpenIndex:s,onOpenIndexChange:a,disabled:c=false,width:i,fullWidth:l=false,className:u,role:d="group",css:h})=>{let f=V(),R=useRef(null),I=Children.toArray(e),x=I.filter($a),C=x.length,g=o&&r!==void 0,[p,m]=useState(()=>{if(!o)return null;if(s!==void 0)return s;for(let A=0;A<x.length;A++){let M=x[A].props;if(M.open||M.defaultOpen)return A}return null}),v=o?g?r??null:p:null,D=Nc(f.componentHeights?.border,1),T=f.surface.border,w=f.radius.md,F=n,B=F==="outlined";useEffect(()=>{let A=R.current;if(!A)return;let M=b=>{if(b.key!=="ArrowDown"&&b.key!=="ArrowUp"&&b.key!=="Home"&&b.key!=="End")return;let P=Array.from(A.querySelectorAll(".plainframe-ui-accordion")).filter(S=>S.getAttribute("data-disabled")!=="true");if(P.length===0)return;let H=document.activeElement,L=P.findIndex(S=>S.contains(H));if(L===-1)return;b.preventDefault();let E=L;b.key==="ArrowDown"?E=(L+1)%P.length:b.key==="ArrowUp"?E=(L-1+P.length)%P.length:b.key==="Home"?E=0:b.key==="End"&&(E=P.length-1),P[E]?.focus();};return A.addEventListener("keydown",M),()=>A.removeEventListener("keydown",M)},[C]);let W=css({display:"flex",flexDirection:"column",maxWidth:i!=null?Dc(i):void 0,width:l?"100%":i!=null?void 0:"auto",gap:t?0:f.spacing.sm,border:t&&B?`${D} solid ${T}`:"none",borderRadius:t&&B?w:void 0,background:t&&B?f.surface.panelBg:"transparent"}),O=0,k=[];return I.forEach((A,M)=>{if(!$a(A)){k.push(A);return}let b=A.props,y=O++,P=y===0,H=y===C-1,L=c||!!b.disabled,E=F??b.variant,S=t?css({width:"100%",marginBottom:0,borderTopLeftRadius:P?w:0,borderTopRightRadius:P?w:0,borderBottomLeftRadius:H?w:0,borderBottomRightRadius:H?w:0}):css({width:"100%",marginBottom:0}),z=!P&&C>1&&t?css({borderTop:`${D} solid ${T}`}):null,$=B?css({border:"1px solid transparent"}):null,K={variant:E,disabled:L,width:"100%",css:[b.css,S,$,z],className:[b.className,"plainframe-ui-accordion-group-item"].filter(Boolean).join(" ")};if(o){let _=b.onChange,N=v===y;K.open=N,K.defaultOpen=void 0,K.onChange=U=>{let X=U?y:null;g||m(X),a?.(X),_?.(U);};}k.push(cloneElement(A,{...b,...K,key:A?.key??M}));}),jsx("div",{ref:R,role:d,"aria-orientation":"vertical","data-attached":t||void 0,"data-exclusive":o||void 0,className:["plainframe-ui-accordion-group",u||""].join(" ").trim(),css:[W,h],children:k})};za.displayName="AccordionGroup";var zt=e=>typeof e=="number"?`${e}px`:e,Wa=({children:e,open:t=true,anchorOrigin:n={horizontal:"center",vertical:"bottom"},direction:o="horizontal",padding:r="sm",gap:s="xs",radius:a="lg",offset:c=0,offsetX:i=0,offsetY:l=0,elevated:u=true,unstyled:d=false,fullWidth:h=false,width:f,height:R,role:I="toolbar","aria-label":x,onClose:C})=>{let g=V(),p=useRef(null),m=useRef(null),v=useRef(false),D=useRef(t),T=n.horizontal??"center",w=n.vertical??"bottom",F=E=>typeof E=="string"?g.spacing[E]??E:E,B=E=>typeof E=="string"?g.radius[E]??E:E,W=zt(F(c)),O=zt(F(i)),k=zt(F(l)),A={position:"fixed",left:0,right:0,top:0,bottom:0,display:"flex",pointerEvents:"none",zIndex:1e3,justifyContent:T==="left"?"flex-start":T==="right"?"flex-end":"center",alignItems:w==="top"?"flex-start":w==="bottom"?"flex-end":"center"},M=()=>`${T==="left"?"left":T==="right"?"right":"center"} ${w==="top"?"top":w==="bottom"?"bottom":"center"}`,b=()=>w==="top"||w==="bottom"?`translateY(${w==="bottom"?100:-100}px) scale(0.98)`:w==="center"?T==="left"?"translateX(-100px) scale(0.98)":T==="right"?"translateX(100px) scale(0.98)":"scale(0.95)":"scale(0.98)",y=()=>w==="center"&&T==="center"?"scale(1)":"translateX(0) translateY(0) scale(1)",P=24,H={margin:P,marginTop:w==="top"?`calc(${P}px + ${W} + ${k})`:P,marginBottom:w==="bottom"?`calc(${P}px + ${W} + ${k})`:P,marginLeft:T==="left"?`calc(${P}px + ${W} + ${O})`:P,marginRight:T==="right"?`calc(${P}px + ${W} + ${O})`:P,padding:d?0:zt(F(r)),background:d?"transparent":g.surface.panelBg,border:d?"none":`1px solid ${g.surface.border}`,borderRadius:d?0:zt(B(a)),boxShadow:d||!u?"none":"0 20px 40px rgba(0,0,0,.08)",display:"flex",flexDirection:o==="vertical"?"column":"row",gap:zt(F(s)),transformOrigin:M(),pointerEvents:t?"auto":"none",width:h?"calc(100% - 48px)":f?zt(f):"auto",height:R?zt(R):"auto",maxWidth:h?"100%":"none"},L=css({"& .plainframe-ui-textfield":{flex:1,minWidth:0}});return useLayoutEffect(()=>{let E=p.current;if(!E)return;let S=b(),z=y();if(!v.current){v.current=true,D.current=t,E.style.opacity=t?"1":"0",E.style.transform=t?z:S;return}if(D.current===t){E.style.opacity=t?"1":"0",E.style.transform=t?z:S;return}D.current=t,m.current&&m.current.cancel();let $=t?[{opacity:0,transform:S},{opacity:1,transform:z}]:[{opacity:1,transform:z},{opacity:0,transform:S}];return m.current=E.animate($,{duration:250,easing:"ease",fill:"forwards"}),()=>{m.current&&m.current.cancel();}},[t,T,w]),useEffect(()=>{if(!t||!C)return;let E=S=>{S.key==="Escape"&&C();};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,C]),jsx("div",{css:A,children:jsx("div",{ref:p,css:L,style:H,role:I,"aria-label":x,"aria-hidden":!t,...!t&&{inert:true},children:e})})};Wa.displayName="ActionBar";var _a=(e,t,n)=>Math.min(n,Math.max(t,e)),Qr=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Ka=1,Oc=keyframes`100% { transform: rotate(360deg); }`,Wc=keyframes`
6
6
  0% { left: -35%; right: 100%; }
7
7
  60% { left: 100%; right: -90%; }
8
8
  100% { left: 100%; right: -90%; }
@@ -10,14 +10,14 @@ ${h}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m()
10
10
  0% { left: -200%; right: 100%; }
11
11
  60% { left: 107%; right: -8%; }
12
12
  100% { left: 107%; right: -8%; }
13
- `,_c=e=>e.startsWith("#")||e.startsWith("rgb(")||e.startsWith("rgba(")||e.startsWith("hsl(")||e.startsWith("hsla(")||e.startsWith("oklch(")||e.startsWith("lab(")||e.startsWith("color(")||e.startsWith("var("),jc=new Set(["0","50","100","200","300","400","500","600","700","800","900"]);function Vc(e,t){if(!t||t.trim()==="")return e.text.primary;let n=t.trim();if(_c(n))return n;let o=n.match(/^([a-zA-Z0-9_-]+)[\.\-:\s]?([0-9]{1,3})?$/);if(o){let r=o[1],s=o[2]&&jc.has(o[2])?o[2]:"600";if(r==="primary"&&e.palette.primary?.[s])return e.palette.primary[s];let a=e.palette[r];if(a&&a[s]!=null)return a[s];if(r==="neutral"||r==="secondary"&&e.neutral[s]!=null)return e.neutral[s]}return e.palette.primary[600]}var no=me.memo(({variant:e="circular",value:t,min:n=0,max:o=100,color:r,size:s,thickness:a,spinDuration:c=.75,wrapperCss:i,trackCss:l,barCss:u,circleCss:d,"aria-label":y})=>{let f=V(),T=typeof t=="number",I=Math.max(o-n,1),x=T?qa(t,n,o):void 0,R=T?(x-n)/I*100:void 0,g=Vc(f,r),p=f.surface.subtleBg,m=f.radius?.md;return e==="circular"?jsx(qc,{size:s,active:g,isDeterminate:T,percent:R,spinDuration:c,wrapperCss:i,trackCss:l,circleCss:d,ariaLabel:y,thickness:a}):jsx(Uc,{thickness:a,active:g,track:p,radius:m,isDeterminate:T,percent:R,wrapperCss:i,trackCss:l,barCss:u,ariaLabel:y,min:n,max:o,value:x})}),Uc=({thickness:e=4,active:t,track:n,radius:o,isDeterminate:r,percent:s,wrapperCss:a,trackCss:c,barCss:i,ariaLabel:l,min:u,max:d,value:y})=>{let f=o==null?"8px":typeof o=="number"?`${o}px`:String(o),T=css([{display:"inline-block",width:"100%"},...Array.isArray(a)?a:a?[a]:[]]),I=css([{position:"relative",width:"100%",height:ns(e,"6px"),backgroundColor:n,borderRadius:f,overflow:"hidden"},...Array.isArray(c)?c:c?[c]:[]]),x=r?Math.max(s??0,Ua):Ua,R=css([{position:"absolute",inset:0,backgroundColor:t,borderRadius:"inherit",transformOrigin:"left",transform:`scaleX(${x/100})`,transition:"transform 160ms cubic-bezier(.2,0,.2,1)",willChange:"transform"},...Array.isArray(i)?i:i?[i]:[]]),g={position:"absolute",top:0,bottom:0,backgroundColor:t,borderRadius:"inherit",willChange:"left,right","@media (prefers-reduced-motion: reduce)":{animation:"none"}},p=css([{...g,left:"-35%",right:"100%",animation:`${Wc} 2.1s cubic-bezier(.65,.815,.735,.395) infinite`},...Array.isArray(i)?i:i?[i]:[]]),m=css([{...g,left:"-200%",right:"100%",animation:`${Kc} 2.1s cubic-bezier(.165,.84,.44,1) 1.15s infinite`},...Array.isArray(i)?i:i?[i]:[]]),C=r?{role:"progressbar","aria-valuemin":u,"aria-valuemax":d,"aria-valuenow":y}:{role:"progressbar","aria-busy":true};return l&&(C["aria-label"]=l),jsx("span",{css:T,...C,children:jsx("div",{className:"plainframe-ui-progress-linear-track",css:I,children:r?jsx("div",{className:"plainframe-ui-progress-linear-fill",css:R}):jsxs(Fragment,{children:[jsx("div",{className:"plainframe-ui-progress-linear-runner1",css:p}),jsx("div",{className:"plainframe-ui-progress-linear-runner2",css:m})]})})})},qc=({size:e,thickness:t=4,active:n,isDeterminate:o,percent:r,spinDuration:s,wrapperCss:a,trackCss:c,circleCss:i,ariaLabel:l})=>{let u=V(),d=40,y=(d-t)/2,f=2*Math.PI*y,I=`${(o?qa((r??0)/100,.01,1):.7)*f} ${f}`,x=css([{display:"inline-block",width:ns(e,`${u.componentHeights.md}`),height:ns(e,`${u.componentHeights.md}`)},...Array.isArray(a)?a:a?[a]:[]]),R=css([{width:"100%",height:"100%",transform:"rotate(-90deg)",transformBox:"fill-box",transformOrigin:"50% 50%"},...Array.isArray(c)?c:c?[c]:[]]),g=css([{stroke:n,strokeLinecap:"butt",strokeDasharray:I,strokeDashoffset:0,transition:o?"stroke-dasharray 160ms cubic-bezier(.2,0,.2,1)":"none",transformBox:"fill-box",transformOrigin:"50% 50%",fill:"none",willChange:o?"stroke-dasharray":"transform",animation:o?"none":`${Oc} ${s}s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},...Array.isArray(i)?i:i?[i]:[]]),p=o?{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r??0)}:{role:"progressbar","aria-busy":true};return l&&(p["aria-label"]=l),jsx("span",{css:x,className:"plainframe-ui-progress-circular",...p,children:jsx("svg",{css:R,viewBox:`0 0 ${d} ${d}`,focusable:"false","aria-hidden":true,children:jsx("circle",{cx:d/2,cy:d/2,r:y,strokeWidth:t,css:g})})})};var Ya=createContext(null),Ja=()=>{let e=useContext(Ya);if(!e)throw new Error("AlertTitle and AlertDescription must be used inside <Alert>.");return e},ou=css({display:"flex",flexDirection:"column",textAlign:"left",minWidth:0,flex:1}),ru=css({lineHeight:0,display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"}),su=css({display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",padding:0,cursor:"pointer",lineHeight:0,transition:"opacity 140ms ease","&:disabled":{cursor:"not-allowed",opacity:.5}}),Za=forwardRef(function({intent:t="neutral",variant:n="soft",intentIcon:o,closeIcon:r,onClose:s,width:a="100%",size:c="md",loading:i=false,css:l,children:u,...d},y){let f=V(),T=useId(),I=useId(),x=useMemo(()=>{let F={sm:{paddingX:f.spacing?.md,paddingY:f.spacing?.md,gap:f.spacing?.sm,radius:f.radius?.md,fontSize:f.typography?.sizes?.xs,titleWeight:600,iconSize:16},md:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.sm,titleWeight:600,iconSize:20},lg:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.md,titleWeight:600,iconSize:24}};return ["sm","md","lg"].includes(c)?F[c]:F.md},[c,f.typography,f.radius,f.spacing]),R=f.palette??{},g=f.neutral??{},p=useMemo(()=>{let M=(E=>E==="danger"?R.danger??R.error??g:E==="warning"?R.warning??g:E==="success"?R.success??g:E==="info"?R.info??R.primary??g:g)(t),b=M?.[50]??g[50],h=M?.[300]??g[300],A=M?.[600]??M?.[500]??g[600],D=M?.[700]??A,L=M?.[800]??f.text?.primary??"#000",k=f.text?.onColors?.[t]??f.text?.onColors?.primary??f.text?.primary??"#fff";return n==="filled"?{bg:A,fg:k,border:void 0,iconColor:k}:n==="outlined"?{bg:b,fg:L,border:`1px solid ${h}`,iconColor:L}:n==="ghost"?{bg:"transparent",fg:D,border:"none",iconColor:D}:{bg:b,fg:L,border:void 0,iconColor:D}},[t,n,g,R,f.text]),m=t==="danger"||t==="warning"?"alert":"status",C=useMemo(()=>i?jsx(no,{variant:"circular",color:p.iconColor,size:x.iconSize/1.25,thickness:4.5}):o??(t==="danger"?jsx(CircleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="warning"?jsx(TriangleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="success"?jsx(CircleCheckBig,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):jsx(Info,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor})),[i,o,t,x.iconSize,p.iconColor]),P=useMemo(()=>css({display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:`${x.paddingY} ${x.paddingX}`,gap:x.gap,borderRadius:x.radius,backgroundColor:p.bg,color:p.fg,border:p.border,fontSize:x.fontSize,fontWeight:500,maxWidth:typeof a=="number"?`${a}px`:a,width:"100%"}),[p.bg,p.border,p.fg,x.fontSize,x.gap,x.paddingX,x.paddingY,x.radius,a]),w=useMemo(()=>css({display:"flex",alignItems:"flex-start",gap:x.gap,minWidth:0,flex:1}),[x.gap]),v=useMemo(()=>[ru,{color:p.iconColor}],[p.iconColor]),N=useMemo(()=>css({display:"flex",alignItems:"center",gap:x.gap,marginLeft:x.gap,flex:"0 0 auto"}),[x.gap]),B=useMemo(()=>[su,{color:p.fg}],[p.fg]),K=useMemo(()=>({fg:p.fg,iconColor:p.iconColor,s:x,titleId:T,descId:I}),[p.fg,p.iconColor,x,T,I]),O=me.Children.toArray(u).some(F=>me.isValidElement(F)&&F.type===ss),S=me.Children.toArray(u).some(F=>me.isValidElement(F)&&F.type===as);return jsx(Ya.Provider,{value:K,children:jsxs("div",{ref:y,role:m,"aria-live":m==="alert"?"assertive":"polite","aria-atomic":"true","aria-busy":i,"aria-labelledby":O?T:void 0,"aria-describedby":S?I:void 0,className:`plainframe-ui-alert plainframe-ui-alert-${t} plainframe-ui-alert-${n}`,css:[P,l],...d,children:[jsxs("div",{className:"plainframe-ui-alert-left",css:w,children:[C&&jsx("span",{className:"plainframe-ui-alert-icon",css:v,children:C}),jsx("div",{className:"plainframe-ui-alert-content",css:ou,children:u})]}),s&&jsx("div",{className:"plainframe-ui-alert-actions",css:N,children:jsx("button",{type:"button","aria-label":"Close alert",onClick:s,disabled:i,className:"plainframe-ui-alert-close",css:B,children:r??jsx(X,{strokeWidth:2,size:x.iconSize-2})})})]})})});Za.displayName="Alert";var ss=forwardRef(function({children:t,css:n,...o},r){let{fg:s,s:a,titleId:c}=Ja(),i=useMemo(()=>css({color:s,fontWeight:a.titleWeight,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[s,a.titleWeight]);return jsx("span",{ref:r,id:c,className:"plainframe-ui-alert-title",css:[i,n],...o,children:t})});ss.displayName="AlertTitle";var as=forwardRef(function({children:t,css:n,...o},r){let{fg:s,descId:a}=Ja(),c=useMemo(()=>css({color:s,marginTop:2,lineHeight:1.35,wordBreak:"break-word"}),[s]);return jsx("span",{ref:r,id:a,className:"plainframe-ui-alert-desc",css:[c,n],...o,children:t})});as.displayName="AlertDescription";var is=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Gt=e=>e==null?[]:Array.isArray(e)?e:[e],Xt=(...e)=>css(e.filter(Boolean));function ei(e,t,n="currentColor"){if(!isValidElement(e))return e;let o=e.props,r={};o.size==null&&(r.size=t),o.color==null&&(r.color=n);let s=o.style;return s?.fontSize==null&&(r.style={...s||{},fontSize:t}),cloneElement(e,{...o,...r})}var Qo=me.memo(forwardRef(function({label:t,value:n,defaultValue:o="",onChange:r,placeholder:s,error:a,helperText:c,disabled:i=false,fullWidth:l=false,width:u=250,size:d="md",variant:y="subtle",rounded:f=false,startIcon:T,endIcon:I,togglePasswordVisible:x=false,showClear:R,type:g="text",step:p,focusRingMode:m="always",className:C,wrapperCss:P,inputCss:w,labelCss:v,helperRowCss:N,helperTextCss:B,startIconCss:K,endIconCss:O,css:S,onBlur:F,onFocus:M,onKeyDown:b,autoFocus:h,name:A,id:D,tabIndex:L,autoComplete:k,readOnly:E,required:W,maxLength:$,onSurfaceClick:z},_){let H=V(),U=Yo(),X$1=useId(),ae=useMemo(()=>{let ce={sm:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.sm,labelFont:H.typography.sizes.xs,helperFont:H.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:21},md:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.md,labelFont:H.typography.sizes.sm,helperFont:H.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:24},lg:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.lg,labelFont:H.typography.sizes.md,helperFont:H.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:28}},ke=["sm","md","lg"].includes(d)?d:"md";return ce[ke]},[d,H]),q=H.neutral,Y=H.text,le=g==="number",ie=g==="password",be=n!==void 0,[Pe,Re]=useState(o),Ce=be?n:Pe,Ie=useCallback(ce=>{be||Re(ce),r?.(ce);},[be,r]),Te=/^-?\d*(?:[.,]\d*)?$/,we=le&&(p!=null&&String(p).includes(".")||/[.,]/.test(Ce??"")),he=le?we?"decimal":"numeric":void 0,je=le?we?"[0-9]*[.,]?[0-9]*":"[0-9]*":void 0,Z=useCallback(ce=>{(ce===""||Te.test(ce))&&Ie(ce);},[Ie]),Ee=i?q[200]:a&&y==="outlined"?H.palette.danger?.[50]??H.surface.panelBg:a&&y==="subtle"?H.palette.danger?.[50]??H.surface.subtleBg:y==="outlined"?H.surface.panelBg:y==="subtle"?H.surface.subtleBg:"transparent",Q=H.componentHeights.border,ee=y==="outlined"?`${Q} solid ${a?H.palette.danger?.[300]??H.surface.border:H.surface.border}`:"none",se=Xt({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:l?"100%":u!=null?is(u):void 0,flex:"0 0 auto",fontWeight:500}),pe=useMemo(()=>Xt({fontSize:ae.labelFont,fontWeight:500,color:a?H.palette.danger?.[700]??Y.primary:i?q[500]:Y.primary,marginBottom:4,display:"inline-block"},...Gt(v)),[ae.labelFont,a,i,q,Y,H.palette.danger,v]),Se=useMemo(()=>Xt({display:"flex",alignItems:"center",gap:H.spacing.sm,padding:`${is(ae.paddingY)} ${is(ae.paddingX)}`,background:Ee,border:ee,borderRadius:f?H.radius.full:H.radius.md,minHeight:ae.minHeight,boxSizing:"border-box",width:"100%",cursor:i?"not-allowed":"text",opacity:i?.65:1,transition:"box-shadow .18s, border-color .16s"},...Gt(P),...Gt(S)),[H,ae.minHeight,ae.paddingX,ae.paddingY,Ee,ee,f,i,P,S]),Ne=useMemo(()=>Xt({flex:1,minWidth:0,fontSize:ae.fontSize,fontWeight:500,fontFamily:"inherit",color:i?q[500]:a?H.palette.danger?.[800]??Y.primary:Y.primary,background:"transparent",border:"none",outline:"none",padding:0,lineHeight:1.25,cursor:i?"not-allowed":"text",appearance:le?"textfield":"auto","&::placeholder":{color:a?H.palette.danger?.[700]??Y.secondary:Y.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${a?H.palette.danger?.[800]??Y.primary:Y.primary} !important`,boxShadow:`0 0 0 1000px ${Ee} inset !important`,transition:"opacity 99999s ease-out",caretColor:a?H.palette.danger?.[800]??Y.primary:Y.primary},":focus-within":{outline:"none",border:"none",boxShadow:"none"}},...Gt(w)),[ae.fontSize,i,q,Y,a,H.palette.danger,le,Ee,w]),J=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:a?H.palette.danger?.[800]??Y.secondary:Y.secondary,marginLeft:-3},...Gt(K)),[a,H.palette.danger,Y.secondary,K]),oe=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:a?H.palette.danger?.[800]??Y.secondary:Y.secondary,border:"none",background:"transparent",lineHeight:0,cursor:"inherit",padding:0},...Gt(O)),[a,H.palette.danger,Y.secondary,i,O]),re=useMemo(()=>Xt({minHeight:16,fontSize:ae.helperFont,color:a?H.palette.danger?.[700]??Y.secondary:Y.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Gt(N)),[ae.helperFont,a,H.palette.danger,Y.secondary,N]),qe=useMemo(()=>Xt({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400},...Gt(B)),[B]),j=useRef(null),ue=useCallback(ce=>{j.current=ce,_&&(typeof _=="function"?_(ce):_.current=ce);},[_]),de=useCallback(ce=>{let ke=ce.target.value;if(le){Z(ke);return}$&&ke.length>$||Ie(ke);},[le,$,Ie,Z]),[fe,ze]=useState(false),Oe=useCallback(()=>{i||ze(ce=>!ce);},[i]),st=useCallback(()=>{i||(Ie(""),j.current?.focus());},[i,Ie]),Ye=useMemo(()=>{let ce=ae.fontSize;if(typeof ce=="number")return ce;let ke=parseFloat(String(ce));return Number.isFinite(ke)?ke:16},[ae.fontSize]),yt=useMemo(()=>T?jsx("span",{css:J,children:ei(T,Ye)}):null,[T,J,Ye]),tn=useMemo(()=>css({display:"flex",alignItems:"center",gap:4}),[]),nn=useMemo(()=>{let ce=[];if(ie&&x){let bt=fe?jsx(Eye,{strokeWidth:2.5,size:Ye}):jsx(EyeOff,{strokeWidth:2.5,size:Ye});ce.push(jsx("button",{type:"button",css:oe,onMouseDown:Zn=>Zn.preventDefault(),onClick:Zn=>{Zn.stopPropagation(),Oe();},tabIndex:-1,"aria-label":fe?"Hide password":"Show password",disabled:i,children:bt},"pw-toggle"));}R&&Ce&&Ce.length>0&&!i&&ce.push(jsx("button",{type:"button",css:oe,onMouseDown:bt=>bt.preventDefault(),onClick:bt=>{bt.stopPropagation(),st();},tabIndex:-1,"aria-label":"Clear",children:jsx(X,{strokeWidth:2.5,size:Ye})},"clear"));let ke=I?jsx("span",{css:oe,children:ei(I,Ye)},"user-end"):null,at=ce.length>0,De=!!ke;return !at&&!De?null:!at&&De?ke:at&&!De?ce.length===1?ce[0]:jsx("span",{css:tn,children:ce}):jsxs("span",{css:tn,children:[ce,ke]})},[ie,x,fe,Ye,oe,tn,i,R,Ce,I,Oe,st]),Sn=c!=null?`${D??X$1}-help`:void 0,on=D??X$1,Je=useCallback(ce=>{if(i)return;ce.stopPropagation();let ke=j.current;if(!ke)return;let at=ce.target;if(!(ke.contains(at)||at.closest("button,[role='button']"))){if(document.activeElement===ke){ce.preventDefault();return}ce.preventDefault();}},[i]),xt=useCallback(ce=>{if(i)return;let ke=j.current;if(ke&&(z?.(ce),document.activeElement!==ke)){ke.focus({preventScroll:true});try{let at=ke.value?.length??0;ke.setSelectionRange?.(at,at);}catch{}}},[i,z]);return jsxs("div",{className:["plainframe-ui-textfield",C||""].join(" ").trim(),css:se,children:[t&&jsx("label",{htmlFor:on,className:"plainframe-ui-textfield-label",css:pe,children:t}),jsxs("div",{className:"plainframe-ui-textfield-surface",css:[U({enabled:m!=="none",color:a?"danger":void 0}),Se],onPointerDownCapture:Je,onClick:xt,"aria-invalid":!!a||void 0,children:[yt,jsx("input",{ref:ue,id:on,className:"plainframe-ui-textfield-input",css:Ne,type:ie?fe?"text":"password":g==="number"?"text":g,inputMode:he,pattern:je,value:Ce,maxLength:le?void 0:$,onChange:le?ce=>Z(ce.target.value):de,placeholder:s||"",disabled:i,onBlur:F,onFocus:M,onKeyDown:b,autoFocus:h,name:A,tabIndex:L,autoComplete:k,readOnly:E,required:W,"aria-invalid":!!a||void 0,"aria-describedby":Sn}),nn]}),c!=null&&jsx("div",{className:"plainframe-ui-textfield-helper-row",css:re,children:jsx("span",{id:Sn,className:"plainframe-ui-textfield-helper-text",css:qe,children:c})})]})}));Qo.displayName="TextField";var er=me.createContext("ghost"),Tt=me.createContext(false),si=forwardRef(function({variant:t="ghost",size:n="md",width:o,maxHeight:r,unstyled:s=false,className:a,css:c,children:i,label:l,allItemsTabbable:u=false,...d},y){let f=V(),[T,I]=useState(false),x=useRef(null),R=typeof f.spacing.xs=="number"?`${f.spacing.xs}px`:String(f.spacing.xs),g=t==="outlined"?f.surface.panelBg:t==="subtle"?f.surface.subtleBg??f.neutral[50]:"transparent",p=s?void 0:css({background:g,border:t==="outlined"?`${f.componentHeights.border} solid ${f.surface.border}`:"none",borderRadius:f.radius.lg,"--pfui-panel-pad":R,padding:t==="ghost"?0:"var(--pfui-panel-pad)",color:f.text.primary,width:"100%",maxHeight:r,overflowY:r!=null?"auto":void 0,display:"flex",flexDirection:"column",outline:"none",position:"relative","&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),m=n==="sm",C=useMemo(()=>({isKeyboardNav:T,setIsKeyboardNav:I}),[T]),P=useMemo(()=>({allItemsTabbable:u}),[u]),w=useCallback(M=>Array.from(M.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(b=>{if(b.closest('[role="menu"]')!==M)return false;let h=window.getComputedStyle(b);return h.display!=="none"&&h.visibility!=="hidden"}),[]),v=useCallback(M=>{M.removeAttribute("data-keyboard-nav"),M.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),I(false);},[]),N=useRef(false),B=useCallback(M=>{if(M.target!==M.currentTarget)return;if(N.current){N.current=false;return}let b=M.currentTarget,h=w(b);h.length>0&&(I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(A=>A.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(A=>A.removeAttribute("data-hovered")),h[0].setAttribute("data-highlighted",""),h[0].focus({preventScroll:true}));},[w]),K=useCallback(M=>{let b=M.currentTarget,h=w(b);if(h.length===0)return;if(M.key==="Tab"){N.current=true,b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),I(false),b.tabIndex=-1,requestAnimationFrame(()=>{b.tabIndex=0,N.current=false;});return}let A=b.querySelector("[data-highlighted]"),D=b.querySelector("[data-hovered]"),L=A||D,k=L?h.indexOf(L):-1;if(M.key==="ArrowDown"||M.key==="ArrowUp"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach($=>$.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach($=>$.removeAttribute("data-hovered")),k===-1&&(k=M.key==="ArrowDown"?-1:h.length);let E=M.key==="ArrowDown"?1:-1,W=(k+E+h.length)%h.length;h[W].setAttribute("data-highlighted",""),h[W].focus({preventScroll:true});return}if(M.key==="Home"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),h[0].setAttribute("data-highlighted",""),h[0].focus({preventScroll:true});return}if(M.key==="End"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),h[h.length-1].setAttribute("data-highlighted",""),h[h.length-1].focus({preventScroll:true});return}if(M.key==="Escape"){M.preventDefault(),b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),I(false),b.blur();return}},[w]),O=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&v(b);},[v]),S=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&v(b);},[v]),F=useCallback(M=>{x.current=M,typeof y=="function"?y(M):y&&(y.current=M);},[y]);return jsx(oo.Provider,{value:C,children:jsx(ro.Provider,{value:P,children:jsx(Tt.Provider,{value:m,children:jsx(er.Provider,{value:t,children:jsxs("div",{css:{display:"flex",flexDirection:"column",gap:f.spacing.sm,width:"100%",maxWidth:o},children:[l?jsx("div",{css:{width:"100%",textAlign:"left"},children:jsx("span",{css:{display:"block",color:f.text.secondary,fontSize:f.typography.sizes.xs,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",padding:typeof f.spacing.sm=="number"?`${f.spacing.sm}px`:f.spacing.sm,paddingTop:0},children:l})}):null,jsx("div",{ref:F,role:"menu","data-keyboard-nav":T?"":void 0,tabIndex:0,"aria-label":l||void 0,className:["plainframe-ui-menu",a||""].join(" ").trim(),css:[p,c],onFocus:B,onKeyDown:K,onPointerMove:O,onPointerDown:S,...d,children:i})]})})})})})});si.displayName="Menu";var ii=createContext(null),or=()=>{let e=useContext(ii);if(!e)throw new Error("Popover components must be used inside <Popover>.");return e};function Du(e,t){e&&(typeof e=="function"?e(t):e.current=t);}var io=(...e)=>t=>{for(let n of e)Du(n,t);},cs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Hu=e=>{useEffect(()=>{if(!e||typeof document>"u"||typeof window>"u")return;let t=document.body,n=t.style.overflow,o=t.style.paddingRight,r=window.innerWidth-document.documentElement.clientWidth,s=parseFloat(getComputedStyle(t).paddingRight||"0");return t.style.overflow="hidden",r>0&&(t.style.paddingRight=`${s+r}px`),()=>{t.style.overflow=n,t.style.paddingRight=o;}},[e]);},tr=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"&&t&&e in t){let n=t[e];return typeof n=="number"?`${n}px`:String(n)}return e}},Lu=({open:e,defaultOpen:t,onOpenChange:n,triggerOn:o="click",lockScroll:r=true,trapFocus:s=true,children:a})=>{let[c,i]=useState(!!t),l=e??c,u=x=>{e===void 0&&i(x),n?.(x);},d=useRef(null),y=useRef(null),f=(x=120)=>{y.current!=null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>u(false),x);},T=()=>{y.current!=null&&(window.clearTimeout(y.current),y.current=null);};Hu(r&&l),useEffect(()=>{if(!s||!l||typeof document>"u")return;let x=R=>{if(R.key!=="Tab")return;let g=document.querySelector(".plainframe-ui-popover");if(!g)return;let p=Array.from(g.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(w=>{let v=window.getComputedStyle(w);return v.display!=="none"&&v.visibility!=="hidden"});if(p.length===0)return;let m=p[0],C=p[p.length-1],P=document.activeElement;R.shiftKey&&P===m?(R.preventDefault(),C.focus()):!R.shiftKey&&P===C&&(R.preventDefault(),m.focus());};return document.addEventListener("keydown",x,true),()=>document.removeEventListener("keydown",x,true)},[s,l]);let I=useMemo(()=>({open:l,setOpen:u,triggerOn:o,referenceRef:d,scheduleClose:f,cancelClose:T}),[l,o]);return jsx(ii.Provider,{value:I,children:a})},li=forwardRef(({asChild:e=true,children:t,css:n},o)=>{let{open:r,setOpen:s,triggerOn:a,referenceRef:c,scheduleClose:i,cancelClose:l}=or(),u=me.Children.only(t),d=u.props||{},y=io(c,o,u.ref),f=a==="click"?{onClick:I=>{I.stopPropagation(),s(!r),d.onClick?.(I);}}:{onMouseEnter:I=>{l(),r||s(true),d.onMouseEnter?.(I);},onMouseLeave:I=>{i(),d.onMouseLeave?.(I);}},T={"aria-haspopup":"dialog","aria-expanded":r};if(e){let I=u.props?.css;return me.cloneElement(u,{...f,...T,ref:y,css:[I,n].filter(Boolean)})}return me.createElement("button",{ref:y,type:"button",css:[n],...f,...T,children:u})});li.displayName="PopoverTrigger";var ci=forwardRef(({asChild:e=true,width:t,css:n,children:o},r)=>{let{referenceRef:s}=or(),a=me.Children.only(o),c=io(s,r,a.ref);if(e){let l=a.props?.css;return me.cloneElement(a,{ref:c,css:[l,n].filter(Boolean)})}let i=css({display:"inline-block",width:cs(t),verticalAlign:"middle",...n});return jsx("span",{ref:c,css:i,children:a})});ci.displayName="PopoverAnchor";function Bu(e){let t=e?.vertical??"bottom",n=e?.horizontal??"center";if(t==="top"||t==="bottom"){let s=t,a=n==="left"?"start":n==="right"?"end":"center";return a==="center"?s:`${s}-${a}`}let o=n==="left"?"left":"right",r="center";return r==="center"?o:`${o}-${r}`}var ui=forwardRef(({anchorOrigin:e={vertical:"bottom",horizontal:"center"},sideOffset:t=8,alignOffset:n=0,collisionPadding:o=8,unstyled:r=false,children:s,width:a,height:c,padding:i,paddingX:l,paddingY:u,radius:d="lg",css:y,...f},T)=>{let{open:I,setOpen:x,triggerOn:R,referenceRef:g,scheduleClose:p,cancelClose:m}=or(),C=V(),P=Bu(e),{refs:w,x:v,y:N,strategy:B,context:K}=useFloating({open:I,onOpenChange:x,whileElementsMounted:autoUpdate,placement:P,strategy:"fixed",middleware:[offset({mainAxis:t,crossAxis:n}),flip({padding:o}),shift({padding:o})]});useEffect(()=>{g.current&&w.setReference(g.current);},[w,g]);let O=useDismiss(K,{outsidePressEvent:"pointerdown",escapeKey:true}),S=useRole(K,{role:"dialog"}),{getFloatingProps:F}=useInteractions([O,S]),[M]=K.placement.split("-"),b=M,h=`${b==="left"?"right":b==="right"?"left":"center"} ${b==="top"?"bottom":b==="bottom"?"top":"center"}`,A=8,D=b==="top"?{y:A}:b==="bottom"?{y:-A}:b==="left"?{x:A}:{x:-A},L={initial:{opacity:0,scale:.96,...D},animate:{opacity:1,scale:1,x:0,y:0},exit:{opacity:0,scale:.96,...D},transition:{scale:{type:"spring",stiffness:520,damping:32,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.16,ease:"linear"}}},k=C.surface.panelBg,E=C.text.primary,W=`${C.componentHeights.border} solid ${C.surface.border}`,$=tr(i,C.spacing),z=tr(l,C.spacing),_=tr(u,C.spacing),H={};$&&(H.padding=$),z&&(H.paddingInline=z),_&&(H.paddingBlock=_);let U=tr(d,C.radius)??C.radius.md,X="0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)",ae=css({position:B,top:N??0,left:v??0,zIndex:1e3,transformOrigin:h,pointerEvents:"auto",display:"inline-flex",flexDirection:"column",width:cs(a)??"fit-content",height:cs(c)??"fit-content",boxSizing:"border-box",willChange:"opacity, transform"}),q=r?css({}):css({background:k,color:E,border:W,borderRadius:U,boxShadow:X,...H,...H.padding||H.paddingInline||H.paddingBlock?{}:{padding:typeof C.spacing?.sm=="number"?`${C.spacing.sm}px ${C.spacing.md}px`:`${C.spacing?.sm??"0.5rem"} ${C.spacing?.md??"1rem"}`}}),Y=R==="hover"?{onMouseEnter:m,onMouseLeave:()=>p()}:{},le=io(w.setFloating,T),ie=jsx(motion.div,{className:"plainframe-ui-popover",...F({...f,ref:le,...Y}),...L,css:[ae,q,y],children:s});return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:I?ie:null})})});ui.displayName="PopoverContent";var $u=()=>{let e=or();return {open:e.open,close:()=>e.setOpen(false),setOpen:e.setOpen}};var ms=me.memo(forwardRef(function({checked:t,defaultChecked:n=false,onChange:o,disabled:r=false,size:s="md",label:a,className:c,css:i,trackCss:l,thumbCss:u,labelCss:d,...y},f){let T=V(),I=xe(),x={sm:{trackW:25,trackH:16,thumb:11,labelGap:8},md:{trackW:35,trackH:20,thumb:14,labelGap:8},lg:{trackW:45,trackH:24,thumb:18,labelGap:10}},R={slideMs:250,pressMs:150,easing:"ease"},g=t!==void 0,[p,m]=useState(n),C=g?!!t:p,[P,w]=useState(false);useEffect(()=>{if(r)return;w(true);let z=setTimeout(()=>w(false),R.pressMs);return ()=>clearTimeout(z)},[C,r]);let v=["sm","md","lg"].includes(s)?s:"md",N=x[v],B=`${R.slideMs}ms ${R.easing}`,K=T.palette?.primary?.[600]??T.neutral[900],O=T.neutral[300],S=C?K:O,F=C?T.text.onColors.primary:"#ffffff",{trackW:M,trackH:b,thumb:h}=N,A=(b-h)/2,D=css({display:"inline-flex",alignItems:"center",gap:N.labelGap,cursor:r?"not-allowed":"pointer",width:"fit-content",padding:T.spacing.xs,borderRadius:T.radius.sm,outline:"none"}),L=css({position:"relative",width:M,height:b,backgroundColor:S,borderRadius:T.radius.xl,transition:`background-color ${B}, opacity 120ms ease`,willChange:"background-color",cursor:r?"not-allowed":"pointer",opacity:r?.5:1}),k=css({position:"absolute",top:A,left:C?M-h-A:A,width:h,height:h,backgroundColor:F,borderRadius:T.radius.xl,transition:`left ${B}, transform ${B}, background-color 0.25s ease`,transform:P?"scaleX(1.2)":"scaleX(1)",transformOrigin:C?"right center":"left center"}),E=css({fontSize:T.typography.sizes.sm,fontWeight:500,color:r?T.text.muted:T.text.primary}),W=()=>{if(r)return;let z=!C;g||m(z),o?.(z);};return jsxs("label",{ref:f,role:"switch","aria-checked":C,"aria-disabled":r||void 0,"data-checked":C?"":void 0,"data-disabled":r?"":void 0,tabIndex:r?-1:0,onClick:W,onKeyDown:z=>{r||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),W());},className:["plainframe-ui-switch",c||""].join(" ").trim(),css:[D,I({color:C?"primary":"neutral"}),i],...y,children:[jsx("div",{className:"plainframe-ui-switch-track",css:[L,l],children:jsx("div",{className:"plainframe-ui-switch-thumb",css:[k,u]})}),a!=null&&jsx("span",{className:"plainframe-ui-switch-label",css:[E,d],children:a})]})}));var Uu=(e,t)=>t==="sm"?{box:16,labelFont:e.typography.sizes.xs,gap:8,borderRadius:e.radius.xxs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:t==="lg"?{box:24,labelFont:e.typography.sizes.md,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:{box:20,labelFont:e.typography.sizes.sm,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75},sr=me.memo(forwardRef(({checked:e,defaultChecked:t=false,onChange:n,disabled:o=false,size:r="md",label:s,description:a,rounded:c=false,checkedIcon:i,color:l="primary",css:u,boxCss:d,checkCss:y,labelCss:f,descriptionCss:T,className:I,...x},R)=>{let g=V(),p=xe(),m=typeof e=="boolean",[C,P]=useState(t),w=m?e:C,v=r==="sm"||r==="lg"?r:"md",N=useMemo(()=>Uu(g,v),[g,v]),{checkedBg:B,checkColor:K,borderCol:O,hoverBg:S,gapPx:F}=useMemo(()=>{let z=g.palette||{},_=g.neutral||{},H=g.text?.onColors||{},U,X;l==="neutral"||l==="secondary"?(U=_,X="neutral"):typeof l=="string"&&Object.prototype.hasOwnProperty.call(z,l)?(U=z[l]||z.primary||_,X=l):(U=z.primary||_,X="primary");let ae=U[600]??U[500]??U[400]??Object.values(U)[0]??g.palette.primary[600],q=H[X]??H.primary??g.text?.onColors?.primary??g.text.primary,Y=typeof N.gap=="number"?N.gap+2:N.gap;return {checkedBg:ae,checkColor:q,borderCol:g.surface.border,hoverBg:g.surface.panelHover,gapPx:Y}},[N.gap,l,g]),M=useMemo(()=>css({display:"inline-flex",alignItems:s&&a?"flex-start":"center",gap:F,cursor:o?"not-allowed":"pointer",userSelect:"auto",position:"relative",width:"fit-content",borderRadius:g.radius.sm,padding:g.spacing.xs,transition:"background-color .16s ease, color .16s ease, opacity .16s ease",'&:not([data-disabled="true"]):hover input:not(:checked) + .plainframe-ui-checkbox-box':{outlineColor:O,backgroundColor:S},"input:checked + .plainframe-ui-checkbox-box":{backgroundColor:B,outlineColor:B,"--pfui-bleed":B},'&:not([data-disabled="true"]):hover input:checked + .plainframe-ui-checkbox-box':{outlineColor:B,backgroundColor:B,"--pfui-bleed":B},".plainframe-ui-checkbox-check":{opacity:0,transform:"scale(0.2)"},"input:checked + .plainframe-ui-checkbox-box .plainframe-ui-checkbox-check":{opacity:1,transform:"scale(1)"}}),[O,B,a,o,F,S,s,g.radius.sm,g.spacing.xs]),b=useMemo(()=>css({position:"absolute",opacity:0,width:0,height:0,margin:0,padding:0,pointerEvents:"none"}),[]),h=useMemo(()=>css({width:N.box,height:N.box,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",outline:`${N.borderWidth} solid ${O}`,outlineOffset:`-${N.borderWidth}`,boxShadow:"inset 0 0 0 0.5px var(--pfui-bleed, transparent)",borderRadius:c?g.radius.full:N.borderRadius,transition:"background-color .16s ease, outline-color .05s ease, box-shadow .16s ease, transform .16s ease",flex:"0 0 auto",verticalAlign:"middle",overflow:"hidden",transform:"translateZ(0)",backfaceVisibility:"hidden"}),[N.box,N.borderRadius,N.borderWidth,O,c,g.radius.full]),A=useMemo(()=>({w:Math.round(N.box*N.iconRatioW),h:Math.round(N.box*N.iconRatioH)}),[N.box,N.iconRatioH,N.iconRatioW]),D=useMemo(()=>css({width:A.w,height:A.h,transition:"opacity .14s ease, transform .14s ease",color:K,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,pointerEvents:"none","& > svg, & > img":{width:"100%",height:"100%",display:"block"}}),[K,A.h,A.w]),L=useMemo(()=>css({display:"flex",flexDirection:"column",minWidth:0,userSelect:"text",WebkitUserSelect:"text"}),[]),k=useMemo(()=>css({fontSize:N.labelFont,lineHeight:1.1,fontWeight:500,userSelect:"text",WebkitUserSelect:"text",color:g.text.primary}),[N.labelFont,g.text.primary]),E=useMemo(()=>css({fontSize:N.labelFont,lineHeight:1.25,color:g.text.secondary,fontWeight:400,marginTop:s&&a?g.spacing.xs:0,userSelect:"text",WebkitUserSelect:"text"}),[N.labelFont,a,s,g.spacing.xs,g.text.secondary]),W=useCallback(()=>{o||(m?n?.(!w):P(z=>{let _=!z;return n?.(_),_}));},[o,m,w,n]),$=useCallback(z=>{o||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),W());},[o,W]);return jsxs("label",{ref:R,role:"checkbox","aria-checked":w,"aria-disabled":o||void 0,"data-state":w?"checked":"unchecked",className:["plainframe-ui-checkbox",I||""].join(" ").trim(),css:[M,p({color:w?"primary":"neutral"}),u,o?css({opacity:.6}):null],"data-disabled":o?"true":"false",tabIndex:o?-1:0,onKeyDown:$,children:[jsx("input",{type:"checkbox",checked:w,onChange:W,disabled:o,css:b,...x,tabIndex:-1}),jsx("span",{className:"plainframe-ui-checkbox-box",css:[h,d],"aria-hidden":"true",children:jsx("span",{className:"plainframe-ui-checkbox-check",css:[D,y],children:w&&(i||jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:K,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",css:css({width:"100%",height:"100%",display:"block"}),"aria-hidden":"true",focusable:"false",children:jsx("polyline",{points:"20 6 9 17 4 12"})}))})}),(s||a)&&jsxs("span",{className:"plainframe-ui-checkbox-text",css:L,children:[s&&jsx("span",{className:"plainframe-ui-checkbox-label",css:[k,f],children:s}),a&&jsx("span",{className:"plainframe-ui-checkbox-description",css:[E,T],children:a})]})]})}));sr.displayName="Checkbox";var Xu=()=>useContext(fn),Yu=()=>useContext(ro),Ju=()=>useContext(ur),dn=null,gi=(e,t=35)=>{dn!==null&&window.clearTimeout(dn),dn=window.setTimeout(()=>{e(),dn=null;},t);},lo=()=>{dn!==null&&(window.clearTimeout(dn),dn=null);},pn=me.forwardRef(function({disabled:t=false,destructive:n=false,inset:o,closeOnSelect:r=true,onSelect:s,children:a,className:c,css:i,startIcon:l,endIcon:u,selected:d=false,active:y,meta:f,__index:T,__skipListReg:I,...x},R){let g=Xu(),p=Ju(),m=cr(),C=uo(),P=Yu(),w=V(),N=!!useContext(Tt),B=x["data-subtrigger"]!==void 0,K=B&&u===void 0?jsx(ChevronRight,{size:18,strokeWidth:2.5}):u,S=typeof o=="number"?o:o===false?0:0,F=useContext(er),M=F==="subtle"?w.surface?.subtleHover??w.neutral[100]:w.surface?.subtleBg??w.neutral[100],b=useMemo(()=>css({width:"100%",borderRadius:w.radius.md,padding:`${w.spacing.sm} ${w.spacing.sm}`,paddingLeft:S>0?`calc(${w.spacing.md} + (${w.spacing.xl} * ${S}))`:w.spacing.md,minHeight:N?w.componentHeights.sm:w.componentHeights.md,display:"flex",alignItems:"center",gap:w.spacing.sm,fontWeight:500,fontSize:w.typography.sizes.sm,cursor:t?"not-allowed":"pointer",opacity:t?.55:1,userSelect:"none",background:"transparent",color:n?w.palette.danger[800]:w.text.primary,transition:"background-color .16s ease, color .16s ease",outline:"none","[role='menu']:not([data-keyboard-nav]) &:hover":t?{}:{background:n?w.palette.danger[50]:M},"&[data-highlighted]":t?{}:{background:n?w.palette.danger[50]:M},"&[data-active]":t?{}:{background:n?w.palette.danger[50]:M},"&[data-subtrigger][aria-expanded='true']":t?{}:{background:n?w.palette.danger[50]:M},"[role='menu']:not([data-keyboard-nav]) &:not([data-disabled]):hover [data-menu-checkbox-wrapper],&:not([data-disabled])[data-highlighted] [data-menu-checkbox-wrapper],&:not([data-disabled])[data-active] [data-menu-checkbox-wrapper],&[data-subtrigger][aria-expanded='true'] [data-menu-checkbox-wrapper]":{background:w.surface.border},"& > [data-label]":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),[w,N,S,t,n,M]),h=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}}),[]),A=useMemo(()=>css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,whiteSpace:"nowrap",lineHeight:0,gap:w.spacing.sm,"& > svg":{width:16,height:16,display:"block"},color:w.text.secondary}),[w.text.secondary,w.spacing.sm]),D=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:w.palette.primary[600],"& > svg":{width:16,height:16,display:"block"}}),[w.palette.primary]),L=[];N&&L.push({minHeight:w.componentHeights.sm,paddingLeft:w.spacing.sm,paddingRight:w.spacing.xs,paddingTop:w.spacing.xs,paddingBottom:w.spacing.xs});let k=()=>{s?.(),r&&!B&&p?.closeAll();},E=($,z)=>{let _=$.closest('[role="menu"]');if(!_)return;let H=Array.from(_.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(Y=>{if(Y.closest('[role="menu"]')!==_)return false;let le=window.getComputedStyle(Y);return le.display!=="none"&&le.visibility!=="hidden"});if(!H.length)return;let U=H.indexOf($),X=U>=0?U:0,ae=z(H.length,X),q=H[ae];q&&(document.querySelectorAll("[data-highlighted]").forEach(Y=>{Y.removeAttribute("data-highlighted");}),q.setAttribute("data-highlighted",""),q.focus(),g&&T!=null&&g.setActiveIndex(ae));},W=t?-1:P?.allItemsTabbable?0:-1;return jsxs("div",{role:"menuitem","aria-disabled":t||void 0,"data-disabled":t?"":void 0,"data-active":y?"":void 0,tabIndex:W,ref:$=>{if(g&&!I){let z=g.listRef.current;$&&(T!=null?z[T]=$:z.includes($)||z.push($));}typeof R=="function"?R($):R&&"current"in R&&(R.current=$);},onMouseMove:$=>{if($.currentTarget.hasAttribute("data-hovered"))return;let z=!!$.currentTarget.closest("[data-submenu-content]");!B&&m&&!z&&gi(m.closeAllSubMenus),document.querySelectorAll("[data-hovered]").forEach(H=>{H.removeAttribute("data-hovered");}),document.querySelectorAll("[data-highlighted]").forEach(H=>{H.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-active]").forEach(H=>{H.removeAttribute("data-active");}),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');_?.hasAttribute("data-keyboard-nav")&&_.removeAttribute("data-keyboard-nav"),!t&&g&&T!=null&&g.setActiveIndex(T),!t&&!P?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onMouseEnter:$=>{if(B)lo();else {let H=!!$.currentTarget.closest("[data-submenu-content]");m&&!H&&gi(m.closeAllSubMenus);}$.currentTarget.hasAttribute("data-hovered")||(document.querySelectorAll("[data-highlighted]").forEach(H=>{H.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-hovered]").forEach(H=>{H.removeAttribute("data-hovered");}),document.querySelectorAll("[data-active]").forEach(H=>{H.removeAttribute("data-active");})),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');!t&&g&&T!=null&&(_?.hasAttribute("data-keyboard-nav")&&(_.removeAttribute("data-keyboard-nav"),C&&C.setIsKeyboardNav(false)),g.setActiveIndex(T)),!t&&!P?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onFocus:()=>{},onMouseLeave:()=>{g&&g.setActiveIndex(null);},onKeyDown:$=>{if(t)return;let z=$.currentTarget;if($.key==="Tab"&&g&&!P?.allItemsTabbable){$.preventDefault();return}if($.key==="Tab"&&!g){let _=z.closest('[role="menu"]');if(_){_.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(U=>U.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(U=>U.removeAttribute("data-hovered"));let H=_.tabIndex;_.tabIndex=-1,requestAnimationFrame(()=>{_.tabIndex=H>=0?H:0;});}C&&C.setIsKeyboardNav(false);return}if($.key==="Enter"||$.key===" "||$.key==="ArrowRight"){B||$.key!=="ArrowRight"&&($.preventDefault(),$.stopPropagation(),k());return}if($.key==="ArrowLeft"&&z.closest('[role="menu"]')?.closest("[data-submenu-content]")){$.preventDefault(),$.stopPropagation();let U=document.querySelector('[data-subtrigger][aria-expanded="true"]');if(U){let X=U.__pfuiCloseSubmenu;X&&X(),document.querySelectorAll("[data-highlighted]").forEach(q=>q.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(q=>q.removeAttribute("data-hovered")),U.setAttribute("data-highlighted",""),U.focus();let ae=U.closest("[data-menu-id]");ae&&ae.setAttribute("data-keyboard-nav","");}return}if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),p?.closeAll(),z.closest('[role="menu"]')&&document.querySelector('[aria-expanded="true"][aria-haspopup="menu"]')?.focus();return}if($.key==="ArrowDown"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),C&&C.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,(H,U)=>(U+1)%H);return}if($.key==="ArrowUp"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),C&&C.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,(H,U)=>(U-1+H)%H);return}if($.key==="Home"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,()=>0);return}if($.key==="End"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,H=>H-1);return}},className:["plainframe-ui-menu-item",c||""].join(" ").trim(),css:css(...[b,...L,i].flat()),...x,onClick:$=>{t||($.currentTarget.removeAttribute("data-highlighted"),k());},children:[l&&jsx("span",{className:"plainframe-ui-menu-item-start",css:h,children:l}),a,(f!=null||K||d)&&jsxs("span",{className:"plainframe-ui-menu-item-end",css:A,children:[f!=null?jsx("span",{className:"plainframe-ui-menu-item-meta",css:css({lineHeight:1,fontSize:w.typography.sizes.sm,color:w.text.secondary,whiteSpace:"nowrap"}),children:f}):null,K,d&&jsx("span",{className:"plainframe-ui-menu-item-selected",css:D,children:jsx(Check,{size:16,strokeWidth:2.5})})]})]})}),hi=me.createContext(null),gs=({values:e,defaultValues:t,onValuesChange:n,children:o})=>{let[r,s]=useState(t??[]),a=e!==void 0,c=a?e:r,i=useRef(c);i.current=c;let l=useRef(n);l.current=n;let u=useCallback(y=>{let f=i.current,I=f.some(x=>Object.is(x,y))?f.filter(x=>!Object.is(x,y)):[...f,y];a||s(I),l.current?.(I);},[a]),d=useMemo(()=>({values:c,toggle:u}),[c,u]);return jsx(hi.Provider,{value:d,children:o})},co=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,value:r,children:s,__index:a,disabled:c=false,css:i,className:l,startIcon:u,endIcon:d,...y},f){let T=useContext(hi),I=!!T&&r!==void 0,x=!I&&t!==void 0,[R,g]=useState(()=>I?T.values.some(O=>Object.is(O,r)):!!n),p=I?T.values.some(O=>Object.is(O,r)):x?!!t:R,m=V(),P=!!useContext(Tt),w=()=>{if(!c)if(I)T.toggle(r);else {let O=!p;x||g(O),o?.(O);}},v=css({width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,marginLeft:P?-1:-3,borderRadius:m.radius.xs,transition:"background-color .12s ease"}),N=css({pointerEvents:"none"}),B=useCallback(O=>{O&&(O.querySelectorAll("[tabindex]").forEach(S=>{S.tabIndex=-1;}),O.querySelectorAll('input, button, a, [role="checkbox"]').forEach(S=>{S.tabIndex=-1;}));},[]),K=jsxs(Fragment,{children:[jsx("span",{ref:B,"data-menu-checkbox-wrapper":true,className:"plainframe-ui-menu-checkbox-wrapper",css:v,"aria-hidden":"true",children:jsx(sr,{size:"sm",checked:p,css:N})}),u]});return jsx(pn,{...y,className:["plainframe-ui-menu-checkbox-item",l||""].join(" ").trim(),ref:f,__index:a,role:"menuitemcheckbox","aria-checked":p,closeOnSelect:false,onSelect:w,disabled:c,startIcon:K,endIcon:d,css:i,selected:false,children:s})});co.displayName="MenuCheckboxItem";var yi=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,children:r,__index:s,disabled:a=false,css:c,switchSize:i="md",switchCss:l,startIcon:u,className:d,...y},f){let T=t!==void 0,[I,x]=useState(!!n),R=T?!!t:I,p=!!useContext(Tt),m=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),C=css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,paddingRight:p?2:void 0}),P=()=>{if(a)return;let v=!R;T||x(v),o?.(v);},w=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}});return jsxs(pn,{...y,className:["plainframe-ui-menu-switch-item",d||""].join(" ").trim(),ref:f,__index:s,disabled:a,closeOnSelect:false,onSelect:P,css:c,selected:false,children:[u&&jsx("span",{className:"plainframe-ui-menu-item-start",css:w,children:u}),jsx("span",{"data-label":true,css:m,className:"plainframe-ui-menu-item-label",children:r}),jsx("span",{className:"plainframe-ui-menu-switch-wrap",css:C,children:jsx(ms,{checked:R,css:css({pointerEvents:"none",padding:0,marginRight:-1},l),className:"plainframe-ui-menu-switch",tabIndex:-1,size:i})})]})});yi.displayName="MenuSwitchItem";var xi=me.createContext(null),lr=({value:e,defaultValue:t,onValueChange:n,children:o})=>{let[r,s]=useState(t),a=e??r,c=l=>{e!==void 0||s(l),n?.(l);},i=useMemo(()=>({value:a,onChange:c}),[a]);return jsx(xi.Provider,{value:i,children:o})};lr.displayName="MenuRadioGroup";var Zu=forwardRef(function({value:t,children:n,__index:o,disabled:r=false,css:s,className:a,...c},i){let l=useContext(xi),u=l?.value===t,d=V(),y=css({width:d.spacing.md,display:"inline-flex",justifyContent:"center",alignItems:"center",marginLeft:-1}),f=css({width:7,height:7,borderRadius:"100%",backgroundColor:d.palette.primary[600],transform:u?"scale(1)":"scale(0.4)",opacity:u?1:0,transition:"transform 140ms ease-out, opacity 140ms linear",transformOrigin:"center center"}),T=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"});return jsxs(pn,{...c,className:["plainframe-ui-menu-radio-item",a||""].join(" ").trim(),ref:i,__index:o,role:"menuitemradio","aria-checked":u,closeOnSelect:false,onSelect:()=>{r||l?.onChange?.(t);},disabled:r,css:s,selected:false,children:[jsx("span",{className:"plainframe-ui-menu-radio-dotbox",css:y,children:jsx("span",{className:"plainframe-ui-menu-radio-dot",css:f})}),jsx("span",{className:"plainframe-ui-menu-item-label",css:T,children:n})]})}),mn=forwardRef(function({inset:t,className:n,css:o,children:r,startIcon:s,endIcon:a,wrap:c=false,color:i="primary",...l},u){let d=V(),f=!!useContext(Tt),T=i==="primary"?d.text.primary:i==="secondary"?d.text.secondary:d.palette[i]?.[700]??d.text.primary,I=css({display:"flex",alignItems:"center",padding:f?`${d.spacing.sm} ${d.spacing.md}`:`${d.spacing.sm} ${d.spacing.md}`,fontSize:d.typography.sizes.sm,color:T,fontWeight:500,...t?{paddingLeft:`calc(${d.spacing.lg} * 2)`}:null,gap:d.spacing.xs}),x=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:c?"normal":"nowrap"}),R=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,padding:"0 3px 0 2px",marginLeft:-2,"& > svg":{width:16,height:16,display:"block"}}),g=css({display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,lineHeight:0,"& > svg":{width:16,height:16,display:"block"}});return jsxs("div",{ref:u,role:"presentation",className:["plainframe-ui-menu-label",n||""].join(" ").trim(),css:css(I,o),...l,children:[s&&jsx("span",{className:"plainframe-ui-menu-label-start",css:R,children:s}),jsx("span",{className:"plainframe-ui-menu-label-text",css:x,children:r}),a&&jsx("span",{className:"plainframe-ui-menu-label-end",css:g,children:a})]})});mn.displayName="MenuLabel";var Qu=({className:e,css:t,variant:n="full",...o})=>{let r=V(),s=`var(--pfui-panel-pad, ${typeof r.spacing.xs=="number"?r.spacing.xs+"px":String(r.spacing.xs)})`,a=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:"calc(var(--pfui-panel-pad, 0px) * -1)",marginRight:"calc(var(--pfui-panel-pad, 0px) * -1)"}),c=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.md}`,marginRight:`${r.spacing.md}`}),i=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.lg}`,marginRight:0}),l=n==="full"?a:n==="middle"?c:i;return jsx("div",{role:"separator",className:["plainframe-ui-menu-separator",e||""].join(" ").trim(),css:css(l,t),...o})};var bs=io,po=0,dr=null,pr=null,pd=()=>typeof window>"u"||typeof document>"u"?0:window.innerWidth-document.documentElement.clientWidth;function md(){if(!(typeof document>"u")){if(po===0){let e=document.body;dr=e.style.overflow||"",pr=e.style.paddingRight||"";let t=pd();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}po+=1;}}function fd(){if(!(typeof document>"u")&&(po>0&&(po-=1),po===0)){let e=document.body;dr!==null&&(e.style.overflow=dr),pr!==null&&(e.style.paddingRight=pr),dr=null,pr=null;}}var fn=createContext(null),mr=()=>{let e=useContext(fn);if(!e)throw new Error("DropdownMenu components must be used inside <DropdownMenu>.");return e},mo=createContext(null),gd=()=>useContext(mo),oo=createContext(null),uo=()=>useContext(oo),Ci=createContext(null),cr=()=>useContext(Ci),Ri=createContext(false),bd=()=>useContext(Ri),ro=createContext({allItemsTabbable:true}),ur=me.createContext(null),hs=()=>useContext(ur);function hd(){let e=[],t=new Set,n={current:false};return {registerCloser(o){return e.push(o),()=>{let r=e.indexOf(o);r>=0&&e.splice(r,1);}},closeAll(){if(!n.current){n.current=true;for(let o=e.length-1;o>=0;o--)try{e[o]();}catch{}queueMicrotask(()=>{n.current=false;});}},registerHoverCtl(o){return t.add(o),()=>t.delete(o)},clearAllHover(){t.forEach(o=>o.clear());},isBusClosingRef:n}}var yd=()=>gd()?.activeIndex??null,Ti=0,$n=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="click",lockScroll:r=true,size:s="md",children:a})=>{let[c,i]=useState(!!t),l=e??c,u=useCallback(F=>{e===void 0&&i(F),n?.(F);},[e,n]),d=useRef(`pfui-menu-${++Ti}`),y=useRef(null),f=useRef([]),T=useRef(null),[I,x]=useState(null),[R,g]=useState(false);useEffect(()=>{l||(x(null),f.current=[],g(false));},[l]);let p=useRef(null),m=useCallback((F,M)=>{if(o!=="hover")return;window.clearTimeout(p.current??0);let b=M??20;p.current=window.setTimeout(()=>u(F),b);},[o,u]),C=useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null);},[]);useEffect(()=>()=>C(),[C]),useEffect(()=>{if(!(!r||!l))return md(),()=>fd()},[l,r]);let P=hs(),[w]=useState(()=>P??hd()),v=useRef(new Set),N=useMemo(()=>({registerSubMenu:F=>(v.current.add(F),()=>v.current.delete(F)),closeAllSubMenus:()=>{v.current.forEach(F=>F());}}),[]),B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:y,listRef:f,floatingRef:T,setActiveIndex:x,scheduleSubmenuHover:m,clearSubmenuHover:C,menuId:d.current}),[l,u,o,x,m,C]),K=useMemo(()=>({activeIndex:I,setActiveIndex:x}),[I,x]),O=useMemo(()=>({isKeyboardNav:R,setIsKeyboardNav:g}),[R]),S=s==="sm";return jsx(ur.Provider,{value:w,children:jsx(Tt.Provider,{value:S,children:jsx(oo.Provider,{value:O,children:jsx(Ci.Provider,{value:N,children:jsx(mo.Provider,{value:K,children:jsx(fn.Provider,{value:B,children:a})})})})})})};$n.displayName="DropdownMenu";var zn=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:c,setOpen:i,trigger:l,referenceRef:u,listRef:d,setActiveIndex:y,scheduleSubmenuHover:f,clearSubmenuHover:T,floatingRef:I,menuId:x}=mr(),R=uo(),g=cr(),p=!!e&&isValidElement(t),m=p?t:null,C=m&&m.props&&typeof m.props=="object"&&"onKeyDown"in m.props?m.props.onKeyDown:void 0,P=m&&m.props&&typeof m.props=="object"&&"onClick"in m.props?m.props.onClick:void 0,{onKeyDown:w,onClick:v,...N}=s,B=useMemo(()=>bs(a,p&&isValidElement(t)&&"ref"in t?t.ref:void 0,u),[a,p,t,u]),K=useCallback(()=>d.current.filter(Boolean),[d]),O=useCallback(h=>{let A=K();requestAnimationFrame(()=>A[h]?.focus());},[K]),S=useCallback(h=>{if(h.key==="Tab"&&c){h.preventDefault(),R?.setIsKeyboardNav(true);let A=I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=A.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');D&&(document.querySelectorAll("[data-highlighted]").forEach(L=>L.removeAttribute("data-highlighted")),D.setAttribute("data-highlighted",""),D.focus());}return}if(h.key==="ArrowRight"&&c){let A=document.querySelector("[data-subtrigger][data-hovered]");if(A){h.preventDefault(),h.stopPropagation(),R?.setIsKeyboardNav(true),A.removeAttribute("data-hovered"),A.setAttribute("data-highlighted",""),A.focus(),requestAnimationFrame(()=>{let D=new KeyboardEvent("keydown",{key:"ArrowRight",bubbles:true,cancelable:true});A.dispatchEvent(D);});return}}if(h.key==="ArrowDown"||h.key==="ArrowUp"){if(R?.setIsKeyboardNav(true),!c){h.preventDefault(),i(true),requestAnimationFrame(()=>{let A=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=Array.from(A.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let k=L.closest("[data-submenu-content]");if(k&&k!==A)return false;let E=window.getComputedStyle(L);return E.display!=="none"&&E.visibility!=="hidden"});if(D.length>0){let L=h.key==="ArrowDown"?0:D.length-1;y(L),D[L]?.setAttribute("data-highlighted",""),D[L]?.focus();}}}),C?.(h),w?.(h);return}if(c){h.preventDefault();let A=document.querySelectorAll("[data-hovered]");for(let L of Array.from(A))if(L.closest("[data-submenu-content]")){let E=L.closest('[role="menu"]');if(E){E.setAttribute("data-keyboard-nav","");let W=Array.from(E.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')).filter(z=>{if(z.closest('[role="menu"]')!==E)return false;let _=window.getComputedStyle(z);return _.display!=="none"&&_.visibility!=="hidden"}),$=W.indexOf(L);if(document.querySelectorAll("[data-highlighted]").forEach(z=>z.removeAttribute("data-highlighted")),L.removeAttribute("data-hovered"),$!==-1&&W.length>0){let z=h.key==="ArrowDown"?1:-1,_=($+z+W.length)%W.length;W[_]?.setAttribute("data-highlighted",""),W[_]?.focus();}return}}let D=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(D){D.setAttribute("data-keyboard-nav",""),g?.closeAllSubMenus();let L=Array.from(D.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(k=>{if(k.closest('[role="menu"]')!==D)return false;let E=window.getComputedStyle(k);return E.display!=="none"&&E.visibility!=="hidden"});if(L.length>0){let k=D.querySelector("[data-highlighted]"),E=D.querySelector("[data-hovered]"),W=-1;k?W=L.indexOf(k):E&&(W=L.indexOf(E)),document.querySelectorAll("[data-highlighted]").forEach(_=>_.removeAttribute("data-highlighted")),E&&E.removeAttribute("data-hovered"),W===-1&&(W=h.key==="ArrowDown"?-1:L.length);let $=h.key==="ArrowDown"?1:-1,z=(W+$+L.length)%L.length;y(z),L[z]?.setAttribute("data-highlighted",""),L[z]?.focus();}}C?.(h),w?.(h);return}}if((h.key==="Enter"||h.key===" ")&&!c){h.preventDefault(),R?.setIsKeyboardNav(true),i(true),requestAnimationFrame(()=>{let A=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=Array.from(A.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let k=L.closest("[data-submenu-content]");if(k&&k!==A)return false;let E=window.getComputedStyle(L);return E.display!=="none"&&E.visibility!=="hidden"});D.length>0&&(y(0),D[0]?.setAttribute("data-highlighted",""),D[0]?.focus());}}),C?.(h),w?.(h);return}C?.(h),w?.(h);},[c,i,y,C,w,K,O,d,R,x,I,g]),F=useCallback(h=>{l==="click"&&((h.nativeEvent.composedPath?.()??[]).some(k=>{let E=k;if(!E||!("tagName"in E))return false;let W=String(E.tagName).toUpperCase();if(W==="INPUT"||W==="TEXTAREA"||"isContentEditable"in E&&E.isContentEditable)return true;let $="getAttribute"in E?E.getAttribute("role"):null;return $==="textbox"||$==="combobox"})||(h.stopPropagation(),i(!c))),P?.(h),v?.(h);},[l,c,i,P,v]),M=l==="hover"?{onMouseEnter:()=>{T(),i(true);},onMouseLeave:()=>{f(false);}}:{},b=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0;if(p&&m){let h=m.props,A=h.css,D=typeof h.className=="string"?h.className:void 0,L=typeof h.tabIndex=="number"?h.tabIndex:0,k={ref:B,tabIndex:L,className:[D,o].filter(Boolean).join(" ")||void 0,css:[A,b,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,onClick:F,onKeyDown:S,...M,...N};return cloneElement(m,k)}return jsx("button",{ref:B,className:o,css:[css({display:"inline-block"}),b,r],type:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":c,onClick:F,onKeyDown:S,...M,...N,children:t})});zn.displayName="DropdownMenuTrigger";var hn=me.forwardRef(({anchor:e,side:t="bottom",align:n="start",sideOffset:o=6,alignOffset:r=0,collisionPadding:s=8,sameWidth:a=false,width:c,height:i,maxHeight:l,unstyled:u=false,closeOnBlur:d=false,allItemsTabbable:y=false,className:f,css:T,children:I,exitPlacement:x,animateOnBusClose:R=true,gap:g,ignoreOutsidePressRefs:p,disableOutsidePressDismiss:m=false,returnFocus:C=false,...P},w)=>{let{open:v,setOpen:N,referenceRef:B,clearSubmenuHover:K,setActiveIndex:O,floatingRef:S,menuId:F}=mr(),M=V(),b=hs(),h=uo();useEffect(()=>{if(!b)return;let J=b.registerCloser(()=>N(false));return ()=>{J&&J();}},[b,N]);let A=typeof o=="string"?parseFloat(o):o,D=typeof r=="string"?parseFloat(r):r,L=typeof s=="string"?parseFloat(s):s,k=`${t}${n==="center"?"":`-${n}`}`,E=useCallback(J=>({getBoundingClientRect:()=>{let oe=Math.round(J.x),re=Math.round(J.y);return {x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0,toJSON:()=>({x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0})}},contextElement:void 0}),[]),W=useMemo(()=>{if(!e)return null;if(e instanceof HTMLElement||typeof e=="object"&&e!==null&&"getBoundingClientRect"in e&&typeof e.getBoundingClientRect=="function")return e;let J=e;return E({x:J.x,y:J.y})},[e,E]),{refs:$,x:z,y:_,strategy:H,context:U,update:X}=useFloating({open:v,onOpenChange:N,placement:k,whileElementsMounted:autoUpdate,middleware:[offset({mainAxis:A??0,crossAxis:D??0}),flip({padding:L??8}),shift({padding:L??8}),size({apply({rects:J,elements:oe}){let re=oe.floating;re.style.boxSizing="border-box",i!=null?re.style.height=typeof i=="number"?`${i}px`:String(i):re.style.removeProperty("height"),c!=null?re.style.width=typeof c=="number"?`${c}px`:String(c):a?re.style.width=`${Math.round(J.reference.width)}px`:re.style.width="200px",l!=null?re.style.maxHeight=typeof l=="number"?`${l}px`:String(l):re.style.removeProperty("max-height");}})]});useEffect(()=>{W?$.setReference(W):B.current&&$.setReference(B.current);},[$,W,B]),useEffect(()=>{if(!v)return;let J=W||B.current,oe=$.floating.current;if(!(!J||!oe))return autoUpdate(J,oe,X)},[v,W,B,$,X]),useEffect(()=>{X();},[X,a,c,i,l]),useEffect(()=>{v&&!y&&O(0);},[v,y,O]),useEffect(()=>{if(!d||!v)return;let J=()=>{let oe=document.activeElement,re=B.current,qe=$.floating.current;oe&&(re?.contains(oe)||qe?.contains(oe)||N(false));};return document.addEventListener("focusin",J,true),()=>document.removeEventListener("focusin",J,true)},[d,v,N,B,$.floating]);let ae=useDismiss(U,{outsidePressEvent:"pointerdown",escapeKey:true,outsidePress:m?false:J=>{if(p?.length){let oe=J.target;for(let re of p)if(re.current?.contains(oe))return false}return true}}),q=useRole(U,{role:"menu"}),{getFloatingProps:Y}=useInteractions([ae,q]),le=useRef(false);useEffect(()=>{v?le.current=true:le.current&&B.current&&C&&(b?.isBusClosingRef.current||requestAnimationFrame(()=>{B.current?.focus();}));},[v,B,b,C]);let ie=typeof M.spacing.xs=="number"?`${M.spacing.xs}px`:String(M.spacing.xs),be=g===void 0?void 0:typeof g=="number"?g:M.spacing[g]??g,Pe=u?void 0:css({boxSizing:"border-box",background:M.surface.panelBg,border:`${M.componentHeights.border} solid ${M.surface.border}`,borderRadius:M.radius.lg,boxShadow:"0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)","--pfui-panel-pad":ie,padding:"var(--pfui-panel-pad)",color:M.text.primary,maxHeight:l,overflowY:"auto",display:"flex",flexDirection:"column",gap:be,"& > *":{flexShrink:0},"&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),Re=-1,Ce=J=>{if(!J||typeof J!="object"||!isValidElement(J))return J;let re=J.type?.displayName;if(re==="DropdownMenu"||re==="DropdownMenuSub")return J;if(re==="MenuItem"||re==="MenuCheckboxItem"||re==="MenuRadioItem"||re==="MenuSwitchItem")return Re+=1,cloneElement(J,{__index:Re,key:J.key??Re});if(re==="DropdownMenuTrigger"){let j=J.props.children;return cloneElement(J,{children:me.Children.map(j,Ce)})}if(re==="DropdownMenuSubTrigger"){Re+=1;let j=Re;return cloneElement(J,{__index:j,key:J.key??j})}let qe=J.props.children;return qe==null?J:cloneElement(J,{children:me.Children.map(qe,Ce)})},Ie=me.Children.map(I,Ce),we=U.placement.split("-")[0]||"bottom",he=we==="bottom"?"center top":we==="top"?"center bottom":we==="left"?"right center":"left center",je=we==="bottom"?{opacity:0,y:-8,scale:.96}:we==="top"?{opacity:0,y:8,scale:.96}:we==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},Z=x??we,Ee=Z==="bottom"?{opacity:0,y:-8,scale:.96}:Z==="top"?{opacity:0,y:8,scale:.96}:Z==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},ee=!!b?.isBusClosingRef.current&&!R?{scale:{duration:0},x:{duration:0},y:{duration:0},opacity:{duration:0}}:{scale:{type:"spring",stiffness:520,damping:38,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.12,ease:"linear"}},se=css({position:H,top:_??0,left:z??0,zIndex:1e3,transformOrigin:he}),pe=useCallback(J=>{if(J.key==="Tab"){J.preventDefault();return}if(J.key==="ArrowDown"||J.key==="ArrowUp"){J.preventDefault(),h?.setIsKeyboardNav(true);let oe=J.currentTarget;oe.setAttribute("data-keyboard-nav","");let re=Array.from(oe.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(qe=>{if(qe.closest('[role="menu"]')!==oe)return false;let j=window.getComputedStyle(qe);return j.display!=="none"&&j.visibility!=="hidden"});if(re.length>0){let qe=oe.querySelector("[data-highlighted]"),j=oe.querySelector("[data-hovered]"),ue=-1;qe?ue=re.indexOf(qe):j&&(ue=re.indexOf(j)),document.querySelectorAll("[data-highlighted]").forEach(ze=>ze.removeAttribute("data-highlighted")),j&&j.removeAttribute("data-hovered"),ue===-1&&(ue=J.key==="ArrowDown"?-1:re.length);let de=J.key==="ArrowDown"?1:-1,fe=(ue+de+re.length)%re.length;O(fe),re[fe]?.setAttribute("data-highlighted",""),re[fe]?.focus();}}},[h,O]),Se=useCallback(J=>{let oe=J.currentTarget;oe.removeAttribute("data-keyboard-nav"),oe.querySelectorAll("[data-highlighted]").forEach(re=>re.removeAttribute("data-highlighted")),h?.isKeyboardNav&&h.setIsKeyboardNav(false);},[h]),Ne=useCallback(J=>{J.removeAttribute("data-keyboard-nav"),J.querySelectorAll("[data-highlighted]").forEach(oe=>oe.removeAttribute("data-highlighted")),h?.isKeyboardNav&&h.setIsKeyboardNav(false);},[h]);return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:v?jsx(ro.Provider,{value:{allItemsTabbable:y},children:jsx(motion.div,{...Y({...P,ref:bs(w,$.setFloating,J=>{S&&(S.current=J);})}),"data-menu-id":F,"data-keyboard-nav":h?.isKeyboardNav?"":void 0,className:f,css:[Pe,se,T],initial:je,animate:{opacity:1,x:0,y:0,scale:1},exit:Ee,transition:ee,onPointerMove:J=>Ne(J.currentTarget),onPointerDown:J=>Ne(J.currentTarget),onKeyDown:pe,onMouseMove:Se,onMouseEnter:()=>{K(),b?.clearAllHover();},onMouseLeave:()=>{document.querySelectorAll("[data-hovered]").forEach(J=>J.removeAttribute("data-hovered"));},children:Ie})}):null})})});hn.displayName="DropdownMenuContent";var wi=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="hover",dense:r,children:s})=>{let a=bd(),[c,i]=useState(!!t),l=e??c,u=useCallback(S=>{e===void 0&&i(S),n?.(S);},[e,n]),d=useRef(null),y=useRef(false),f=useCallback((S,F)=>{if(o!=="hover")return;window.clearTimeout(d.current??0),y.current=S;let M=F??20;d.current=window.setTimeout(()=>{y.current=false,u(S);},M);},[o,u]),T=useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null,y.current=false);},[]);useEffect(()=>()=>T(),[T]);let I=cr();useEffect(()=>{if(!I)return;let S=()=>{T(),u(false);};return I.registerSubMenu(S)},[I,u,T]);let x=useRef(`pfui-submenu-${++Ti}`),R=useRef(null),g=useRef([]),p=useRef(null),[m,C]=useState(null),[P,w]=useState(false);useEffect(()=>{l||(C(null),g.current=[],w(false));},[l]);let v=useContext(Tt),N=r??v,B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:R,listRef:g,floatingRef:p,setActiveIndex:C,scheduleSubmenuHover:f,clearSubmenuHover:T,pendingOpenRef:y,menuId:x.current}),[l,u,o,C,f,T]),K=useMemo(()=>({activeIndex:m,setActiveIndex:C}),[m,C]),O=useMemo(()=>({isKeyboardNav:P,setIsKeyboardNav:w}),[P]);return a?(console.warn("[DropdownMenu] Nested submenus are not supported. DropdownMenuSub can only be used one level deep inside DropdownMenu. The nested submenu content will not be rendered."),jsx(Fragment,{children:me.Children.map(s,S=>{if(!isValidElement(S))return S;let F=S.type;return F?.displayName==="DropdownMenuSubTrigger"||F?.displayName==="DropdownMenuSubContent"?null:S})})):jsx(Ri.Provider,{value:true,children:jsx(Tt.Provider,{value:N,children:jsx(mo.Provider,{value:K,children:jsx(oo.Provider,{value:O,children:jsx(fn.Provider,{value:B,children:s})})})})})};wi.displayName="DropdownMenuSub";var Ei=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:c,setOpen:i,trigger:l,referenceRef:u,scheduleSubmenuHover:d,clearSubmenuHover:y,pendingOpenRef:f,menuId:T}=mr(),I=uo(),x=useCallback(S=>{S&&(S.__pfuiCloseSubmenu=()=>i(false));},[i]),R=!!e&&isValidElement(t),g=R?t:null,p=g?.props,m=p?.onKeyDown,C=p?.onClick,{onKeyDown:P,onClick:w,...v}=s,N=useMemo(()=>bs(a,R&&isValidElement(t)&&"ref"in t?t.ref:void 0,u,x),[a,R,t,u,x]),B=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0,K=useCallback(S=>{if(S.key==="Tab"){S.preventDefault();return}let F=S.currentTarget,M=b=>{I?.setIsKeyboardNav(true);let h=F.closest("[data-menu-id]");if(!h)return;h.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted"));let A=Array.from(h.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(E=>{if(E.closest("[data-menu-id]")!==h)return false;let W=window.getComputedStyle(E);return W.display!=="none"&&W.visibility!=="hidden"});if(!A.length)return;let D=A.indexOf(F),L=D>=0?D:0,k=b==="next"?(L+1)%A.length:(L-1+A.length)%A.length;A[k]?.setAttribute("data-highlighted",""),A[k]?.focus();};if(S.key==="ArrowDown"){S.preventDefault(),S.stopPropagation(),c&&i(false),M("next");return}if(S.key==="ArrowUp"){S.preventDefault(),S.stopPropagation(),c&&i(false),M("prev");return}if(S.key==="ArrowRight"||S.key==="Enter"||S.key===" "){S.preventDefault(),S.stopPropagation(),I?.setIsKeyboardNav(true);let b=S.currentTarget;i(true),requestAnimationFrame(()=>{let h=T?document.querySelector(`[data-menu-id="${T}"]`):document.querySelector("[data-submenu-content]");if(h){h.setAttribute("data-keyboard-nav",""),b.removeAttribute("data-highlighted"),b.removeAttribute("data-hovered");let A=h.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]):not([data-subtrigger]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');A&&(A.setAttribute("data-highlighted",""),A.focus());}});return}if(S.key==="ArrowLeft"){S.preventDefault(),S.stopPropagation(),c&&i(false);let b=F.closest("[data-menu-id]");b&&b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(h=>h.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(h=>h.removeAttribute("data-hovered")),F.setAttribute("data-highlighted",""),F.focus(),I&&I.setIsKeyboardNav(true);return}if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),m?.(S);return}m?.(S),P?.(S);},[c,i,m,P,u,I,T]),O=l==="hover"?{onMouseEnter:S=>{let F=S.currentTarget;lo(),y(),document.querySelectorAll("[data-hovered]").forEach(b=>b.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),F.setAttribute("data-hovered",""),F.focus({preventScroll:true});let M=F.closest("[data-menu-id]");M?.hasAttribute("data-keyboard-nav")&&M.removeAttribute("data-keyboard-nav"),I&&I.setIsKeyboardNav(false),c||d(true,90);},onMouseMove:S=>{let F=S.currentTarget;lo(),F.hasAttribute("data-hovered")||(document.querySelectorAll("[data-hovered]").forEach(M=>M.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(M=>M.removeAttribute("data-highlighted")),F.setAttribute("data-hovered","")),!c&&!f?.current&&d(true,90);},onMouseLeave:()=>{d(false,60);}}:{onClick:S=>{S.stopPropagation(),i(!c),C?.(S),w?.(S);}};if(R&&g){let S=p?.css,F=typeof p?.className=="string"?p.className:void 0,M=typeof p?.tabIndex=="number"?p.tabIndex:0,b={ref:N,tabIndex:M,className:[F,o].filter(Boolean).join(" ")||void 0,css:[S,B,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",__skipListReg:true,onKeyDown:K,onFocus:h=>{if(h.target.hasAttribute("data-highlighted")){let A=h.target.closest("[data-menu-id]");A&&!A.hasAttribute("data-keyboard-nav")&&(A.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}p&&"onFocus"in p&&typeof p.onFocus=="function"&&p.onFocus(h);},...O,...v};return cloneElement(g,b)}return jsx("div",{ref:N,role:"menuitem",tabIndex:0,className:o,css:[css({display:"flex",alignItems:"center",gap:8,cursor:"pointer"}),B,r],"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",onKeyDown:K,onFocus:S=>{if(S.currentTarget.hasAttribute("data-highlighted")){let F=S.currentTarget.closest("[data-menu-id]");F&&!F.hasAttribute("data-keyboard-nav")&&(F.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}},...O,...v,children:t})});Ei.displayName="DropdownMenuSubTrigger";var ki=me.forwardRef((e,t)=>{let n=hs(),{referenceRef:o,clearSubmenuHover:r,scheduleSubmenuHover:s}=mr(),a=[e.className,"plainframe-ui-submenu-content"].filter(Boolean).join(" ");return jsx(hn,{ref:t,side:"right",align:"start",exitPlacement:"bottom",animateOnBusClose:true,...e,className:a,"data-submenu-content":"",anchor:o.current,onMouseEnter:c=>{r(),n?.clearAllHover(),lo(),e.onMouseEnter?.(c);},onMouseLeave:c=>{s(false,60),e.onMouseLeave?.(c);}})});ki.displayName="DropdownMenuSubContent";var fr=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),Cd=css({display:"inline"}),Si=css({display:"inline",fontWeight:700}),Rd=css({position:"absolute",inset:0,pointerEvents:"none",opacity:0,zIndex:-1,outline:"none"}),Td=css({display:"flex",alignItems:"center",gap:4}),wd=css({flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2}),Mi=css({fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"}),Ed=css({fontSize:"0.875em",overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400}),kd=()=>{},Id=e=>e,Sd=e=>`plainframe-ui-autocomplete${e?`-${e}`:""}`,Md=e=>{e.preventDefault(),e.stopPropagation();},Fd=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());},Ad=e=>{e.preventDefault(),e.stopPropagation();},Fi=me.memo(({onCapture:e})=>{let t=useContext(fn),n=useContext(mo),o=useMemo(()=>({...t,activeIndex:n?.activeIndex??null,setActiveIndex:n?.setActiveIndex??t?.setActiveIndex}),[t,n]);return useEffect(()=>{e(o);},[o,e]),null});Fi.displayName="CtxCapture";var ys=me.memo(({item:e,absIndex:t,multiple:n,getCurrentMulti:o,isSelected:r,renderItem:s,paint:a,cls:c,closeOnSelect:i,pickSingle:l,handleItemKeyDown:u,handleItemMouseDown:d,descriptionColor:y})=>{let f=o(),T=useMemo(()=>{let R=String(e.title??e.value);return s?R:a(R)},[a,e.title,e.value,s]),I=useMemo(()=>e.description?jsxs("span",{className:"plainframe-ui-autocomplete-item-content",css:wd,children:[jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:T}),jsx("span",{className:"plainframe-ui-autocomplete-item-description",css:[Ed,{color:y}],children:e.description})]}):jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:T}),[T,e.description,y]),x=useCallback(()=>{e.disabled||l(e.value);},[e.disabled,e.value,l]);if(n){let R=f.some(g=>Object.is(g,e.value));return s?jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,children:s(e,R)},e.value):jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,startIcon:e.startIcon,endIcon:e.endIcon,children:I},e.value)}return s?jsx(pn,{__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:i,onMouseDown:d,selected:r,children:s(e,r)},e.value):jsx(pn,{startIcon:e.startIcon,endIcon:e.endIcon,__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:i,onMouseDown:d,selected:r,children:I},e.value)},(e,t)=>!(e.item.value!==t.item.value||e.item.disabled!==t.item.disabled||e.item.description!==t.item.description||e.absIndex!==t.absIndex||e.multiple!==t.multiple||e.closeOnSelect!==t.closeOnSelect||e.renderItem!==t.renderItem||e.pickSingle!==t.pickSingle||e.isSelected!==t.isSelected||e.paint!==t.paint||e.descriptionColor!==t.descriptionColor));ys.displayName="AutocompleteRow";var Ai=me.memo(({items:e=[],onSelect:t,width:n=300,fullWidth:o=false,placeholder:r,renderItem:s,focusRingMode:a,css:c,inputCss:i,containerCss:l,label:u,helperText:d,variant:y,startIcon:f,endIcon:T,size:I,disabled:x=false,error:R=false,showClear:g=false,open:p,onOpenChange:m,openOnFocus:C=false,openOnType:P=true,openOnClick:w=true,closeOnSelect:v=true,closeOnBlur:N=true,blurOnSelect:B=false,freeSolo:K=false,customValueLabel:O=false,maxHeight:S,maxItems:F,noResultsText:M="No Items Found",highlightTypedValue:b,typedValueHighlightCss:h,showNoResults:A=true,noResultsLabelCss:D,loadingLabelCss:L,loadItems:k,loading:E,loadingText:W="Loading\u2026",debounceMs:$=200,multiple:z=false,selectedValues:_,defaultSelectedValues:H,onChangeSelected:U,expandIcon:X,showExpandIcon:ae=true,expandIconCss:q,textFieldWrapperCss:Y,textFieldInputCss:le,textFieldLabelCss:ie,textFieldHelperRowCss:be,textFieldHelperTextCss:Pe,textFieldStartIconCss:Re,textFieldEndIconCss:Ce,menuContentCss:Ie})=>{let we=V().text.secondary,[he,je]=useState(""),Z=typeof p=="boolean",[Ee,Q]=useState(false),ee=Z?p:Ee,se=useRef(null),pe=useRef(null),Se=useRef(null),Ne=useRef(null),J=useRef(false),oe=useRef(null),re=useRef(false),qe=useRef(0),j=useMemo(()=>[pe],[]),[ue,de]=useState(H??[]),fe=_??ue,ze=useRef(fe);ze.current=fe;let[Oe,st]=useState(null),Ye=useRef(Oe);Ye.current=Oe;let yt=useCallback(()=>ze.current,[]),[tn,nn]=useState([]),[Sn,on]=useState(false),Je=typeof k=="function",xt=Je?tn:e,ce=useRef(xt);ce.current=xt;let ke=!!E||Sn&&Je,at=useRef(m);useEffect(()=>{at.current=m;},[m]);let De=useCallback(G=>{Z||Q(G),at.current?.(G);},[Z]),bt=useRef(null);useEffect(()=>{if(!Je)return;bt.current&&window.clearTimeout(bt.current);let G=he;return bt.current=window.setTimeout(async()=>{on(true);try{let ne=await k(G)||[];nn(Array.isArray(ne)?ne:[]);}catch{nn([]);}finally{on(false);}},Math.max(0,$)),()=>{bt.current&&window.clearTimeout(bt.current);}},[he,Je,k,$]);let Zn=useMemo(()=>{let G=fr(he);return G?xt.some(ne=>fr(ne.title??ne.value)===G):false},[xt,he]),sa=K&&!!O&&he.trim().length>0&&!Zn,nc=G=>{if(typeof O=="object"){let ne=Object.prototype.hasOwnProperty.call(O,"prefix"),ve=Object.prototype.hasOwnProperty.call(O,"suffix");if(ne||ve){let Me=ne?O.prefix??"":"",ge=ve?O.suffix??"":"";return `${Me}${G}${ge}`}return `Add "${G}"`}return `Add "${G}"`},Or=useMemo(()=>{if(Je)return xt;let G=fr(he);if(!G)return xt;let ne=[],ve=[];for(let Me of xt){let ge=fr(Me.title??Me.value);ge.split(" ").some(Ze=>Ze.startsWith(G))?ne.push(Me):ge.includes(G)&&ve.push(Me);}return ne.length>0?ne:ve},[xt,he,Je]),aa=useMemo(()=>{if(sa){let G=he.trim();return [...Or,{value:G,title:nc(G),__pfui_free__:true}]}return Or},[Or,sa,he]),Kt=useMemo(()=>{let G=[],ne=new Map;for(let pt of aa){let Ze=pt.group??"__ungrouped__";ne.has(Ze)||(ne.set(Ze,[]),G.push(Ze)),ne.get(Ze).push(pt);}let Me=typeof F=="number"?Math.max(0,F):1/0,ge=[];for(let pt of G){if(Me<=0)break;let sn=ne.get(pt).slice(0,Me);sn.length>0&&(ge.push({label:pt==="__ungrouped__"?void 0:pt,items:sn}),Me-=sn.length);}return ge},[aa,F]),Mn=useMemo(()=>Kt.reduce((G,ne)=>(G.push(...ne.items),G),[]),[Kt]),Ho=Mn.length>0,Wr=!Ho&&!!A&&!ke&&he.trim().length>0,Fn=ke||Ho||Wr,Lo=Fn||Je;useEffect(()=>{!Je&&ee&&!Fn&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));},[Je,ee,Fn,De]);let Kr=useRef(null),_r=useRef(false);useEffect(()=>{if(K&&!z){if(_r.current){_r.current=false;return}let G=he.trim();if(Kr.current===G)return;Kr.current=G,t?.({value:G,title:G});}},[he,K,z,t]);let jr=useCallback(G=>{let ne=ce.current,ve=new Map(ne.map(ge=>[ge.value,ge])),Me=G.map(ge=>ve.get(ge)??{value:ge,title:ge});U?.(Me);},[U]),Bo=useCallback(G=>{let ne=G.map(String);_||de(ne),jr(ne);},[_,jr]),ia=useCallback(G=>{let ve=fe.includes(G)?fe.filter(Me=>Me!==G):[...fe,G];Bo(ve);},[fe,Bo]),$o=useCallback(G=>{let ne=ce.current.find(ve=>ve.value===G)??{value:G,title:G};ne.disabled||(_r.current=true,Kr.current=(ne.title??ne.value).trim(),st(ne),je(ne.title??ne.value),t?.(ne),Z||(v?(J.current=false,re.current=true,Q(false),at.current?.(false),setTimeout(()=>{re.current=false;},150)):J.current=true),!v&&Se.current?.setActiveIndex&&Se.current.setActiveIndex(null),B?(J.current=false,setTimeout(()=>{Ne.current&&se.current?(Ne.current.tabIndex=0,Ne.current.focus(),Ne.current.blur(),Ne.current.tabIndex=-1):se.current?.blur();},0)):requestAnimationFrame(()=>se.current?.focus()));},[t,Z,v,B]),oc=useCallback(G=>{if(x)return;je(G);let ne=!G.trim();z||(ne?(st(null),t?.(null)):K&&st(null)),!Z&&!ne&&P&&!ee&&De(true);},[z,Z,P,ee,De,x,K,t]),it=Sd,la=kd,rc=Id,ca=useMemo(()=>h?[Si,h]:Si,[h]),sc=useCallback(G=>{let ne=he.trim();if(!ne||ne.length<1)return G;let ve=ne.toLowerCase(),ge=G.toLowerCase().indexOf(ve);return ge<0?G:jsxs("span",{className:"plainframe-ui-autocomplete-highlight-wrap",css:Cd,children:[G.slice(0,ge),jsx("span",{className:"plainframe-ui-autocomplete-highlight",css:ca,children:G.slice(ge,ge+ne.length)}),G.slice(ge+ne.length)]})},[he,ca]),zo=b?sc:rc,ac=useMemo(()=>css({position:"relative",display:o?"block":"inline-block",width:"100%",maxWidth:o?"100%":n}),[o,n]),Oo=Md,Wo=Fd,ic=useCallback(G=>{Se.current=G;},[]),ua=useCallback(G=>{let ne=Se.current;if(!ne)return;let ve=Mn.length;if(ve===0)return;let Me=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]"),ge=-1;if(Me){let Ze=Me.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]'),sn=Me.querySelector("[data-active]")||Me.querySelector("[data-hovered]");sn&&(ge=Array.from(Ze).indexOf(sn));}ge<0&&typeof ne.activeIndex=="number"&&(ge=ne.activeIndex);let pt=ge<0?G===1?0:ve-1:(ge+G+ve)%ve;ne.setActiveIndex?.(pt),requestAnimationFrame(()=>{let Ze=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]");if(!Ze)return;Ze.setAttribute("data-keyboard-nav",""),Ze.querySelectorAll("[data-active]").forEach(Ur=>Ur.removeAttribute("data-active")),Ze.querySelectorAll("[data-hovered]").forEach(Ur=>Ur.removeAttribute("data-hovered"));let Vr=Ze.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]')[pt];Vr&&(Vr.setAttribute("data-active",""),Vr.scrollIntoView?.({block:"nearest"}));});},[Mn.length]),lc=useCallback(G=>{if(G.key===" "||G.code==="Space"||G.key==="Spacebar"){G.stopPropagation();return}if(G.key==="ArrowDown"||G.key==="ArrowUp"){if(x||!Fn&&!Je)return;G.preventDefault(),!ee&&!Z&&De(true),ua(G.key==="ArrowDown"?1:-1);return}if(G.key==="Enter"){if(x)return;let ne=Se.current&&typeof Se.current.activeIndex=="number"?Se.current.activeIndex:-1,ve=ne>=0&&ne<Mn.length?Mn[ne]:null;if(ee&&ve&&ne>=0){G.preventDefault(),G.stopPropagation(),z?(ia(ve.value),v||requestAnimationFrame(()=>se.current?.focus())):$o(ve.value);return}}else G.key==="Escape"?(G.preventDefault(),G.stopPropagation(),ee&&!Z&&(re.current=true,De(false),G.target.focus(),setTimeout(()=>{re.current=false;},150))):G.key==="Tab"&&ee&&!Z&&De(false);},[Fn,Je,ee,Z,Mn,z,v,ua,ia,$o,De,x]),cc=useCallback(()=>{x||re.current||C&&Lo&&(qe.current=Date.now(),Z||De(true));},[Z,C,Lo,De,x]),uc=useCallback(()=>{if(J.current){J.current=false;return}N&&De(false),!K&&!z&&(Oe?je(Oe.title??Oe.value):he.trim()&&je(""));},[N,K,z,Oe,he,De]),da=useCallback(()=>{let G=[],ne=0;return Kt.forEach((ve,Me)=>{ve.label&&G.push(jsx(mn,{className:it("group-label"),children:ve.label},`g-${Me}`)),ve.items.forEach(ge=>{G.push(jsx(ys,{item:ge,absIndex:ne,multiple:true,getCurrentMulti:yt,isSelected:false,renderItem:s,paint:zo,cls:it,closeOnSelect:false,pickSingle:la,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),jsx(gs,{values:fe,onValuesChange:Bo,children:G},"multi-group")},[Kt,it,yt,s,zo,fe,Bo,la,Wo,Oo,we]),pa=useCallback(()=>{let G=[],ne=0;return Kt.forEach((ve,Me)=>{ve.label&&G.push(jsx(mn,{className:it("group-label"),children:ve.label},`g-${Me}`)),ve.items.forEach(ge=>{let pt=Oe?.value===ge.value;G.push(jsx(ys,{item:ge,absIndex:ne,multiple:false,getCurrentMulti:yt,isSelected:pt,renderItem:s,paint:zo,cls:it,closeOnSelect:v,pickSingle:$o,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),G},[Kt,it,Oe,yt,s,zo,v,$o,Wo,Oo,we]),dc=useMemo(()=>ke?jsx(mn,{css:L,className:it("label-loading"),children:W},"loading"):Wr?jsx(mn,{css:D,className:it("label-empty"),children:M},"empty"):Kt.length===0?null:z?da():pa(),[ke,Wr,Kt.length,it,W,M,z,da,pa]),rn=ee?false:x||!Je&&!Ho&&!A,ma=useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(rn||x)&&(Z||(ee?(re.current=true,De(false),queueMicrotask(()=>se.current?.focus()),setTimeout(()=>{re.current=false;},150)):(De(true),queueMicrotask(()=>se.current?.focus()))));},[ee,Ho,Je,De,rn,x,Z]),fa=useMemo(()=>css({transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1), opacity 0.15s ease",transform:ee?"rotate(180deg)":"rotate(0deg)",display:"flex",alignItems:"center",justifyContent:"center",cursor:rn?"not-allowed":"pointer",userSelect:"none",opacity:rn?.5:1}),[ee,rn]),Ko=useMemo(()=>ae?jsx("span",{ref:oe,role:"button",tabIndex:-1,css:[fa,q],"aria-disabled":rn||void 0,onMouseDown:Ad,onClick:ma,children:X??jsx(ChevronDown,{size:18,strokeWidth:2})}):null,[ae,fa,q,rn,ma,X]),pc=useMemo(()=>T&&Ko?jsxs("span",{css:Td,children:[T,Ko]}):T??Ko,[T,Ko]),mc=useCallback(G=>{if(!(oe.current&&oe.current.contains(G.target)||re.current||x||Date.now()-qe.current<300)){if(ee){!he.trim()&&!Z&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));return}w&&Lo&&(!Z||w)&&De(true);}},[ee,he,w,Lo,De,x,Z]);return jsx("div",{ref:pe,className:it(""),css:[ac,l,c],children:jsxs($n,{open:x?false:ee,onOpenChange:x?void 0:De,children:[jsx(Fi,{onCapture:ic}),jsx(zn,{asChild:true,children:jsx("span",{className:it("anchor"),css:Rd,style:{pointerEvents:"none",position:"absolute",visibility:"hidden"},tabIndex:-1})}),jsx(Qo,{ref:se,className:it("input"),focusRingMode:a,value:he,onChange:oc,onKeyDown:lc,onFocus:cc,onBlur:uc,onSurfaceClick:mc,placeholder:r,label:u,helperText:d,variant:y,startIcon:f,endIcon:pc,size:I,width:n,fullWidth:o,disabled:x,error:R,showClear:g,css:i,wrapperCss:Y,inputCss:le,labelCss:ie,helperRowCss:be,helperTextCss:Pe,startIconCss:Re,endIconCss:Ce}),jsx("span",{ref:Ne,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),Fn&&jsx(hn,{className:it("menu"),side:"bottom",align:"start",sameWidth:true,allItemsTabbable:true,maxHeight:typeof S=="number"?`${S}px`:S,css:Ie,ignoreOutsidePressRefs:j,disableOutsidePressDismiss:Z,returnFocus:!B,children:dc})]})})});Ai.displayName="Autocomplete";var Ld=["sm","md","lg"],Bd=(e,t)=>typeof e=="number"?e:Ld.includes(e)?t.componentHeights[e]:t.componentHeights.md,$d=(e,t)=>{let n=e.palette?.[t??"primary"]??e.palette.primary;return n?.[600]??n?.[500]??e.neutral?.[600]??e.neutral?.[500]},zd=(e,t)=>{let n=e.text?.onColors??{};return n[t??"primary"]??n.primary??e.text?.primary??"#fff"},Od=(e,t)=>typeof e=="string"?e:(t?.trim()?.[0]||"").toUpperCase(),Pi=me.memo(forwardRef(({src:e,alt:t,size:n="md",color:o="primary",rounded:r=true,className:s,css:a,children:c,...i},l)=>{let u=V(),[d,y]=useState(!!e);useEffect(()=>{y(!!e);},[e]);let f=Bd(n,u),T=typeof f=="number"?f:Number.parseFloat(String(f))||0,I=T?Math.round(T*(T<=28?.55:.52)):void 0,x=r?u.radius.full:u.radius.md,R=$d(u,o),g=zd(u,o),p=Od(c,t),m=css({width:f,height:f,borderRadius:x,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:d?"transparent":R,color:d?"inherit":g,boxSizing:"border-box",userSelect:"none"}),C=css({width:"100%",height:"100%",display:"block",objectFit:"cover"}),P=css({fontSize:I,lineHeight:1,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",marginTop:-1});return jsx("div",{ref:l,className:["plainframe-ui-avatar",s||""].join(" ").trim(),css:[m,a],role:d?void 0:"img","aria-label":d?void 0:t,...i,children:d&&e?jsx("img",{className:"plainframe-ui-avatar-img",src:e,alt:t,css:C,onError:()=>y(false),decoding:"async",loading:"lazy"}):typeof c=="string"?jsx("span",{className:"plainframe-ui-avatar-initials",css:P,children:c}):c||jsx("span",{className:"plainframe-ui-avatar-initials",css:P,children:p})})}));Pi.displayName="Avatar";var Ni=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,jd=({children:e,max:t,size:n="md",overlap:o=-7,css:r,rounded:s=true,bgColor:a,extraLabelCss:c,outlineThickness:i=4,className:l})=>{let u=V(),d=xe(),f=(()=>{if(typeof n=="number")return `${n}px`;if(typeof n=="string"){let w=(u.componentHeights&&u.componentHeights[n])??(u.spacing&&u.spacing[n]);return Ni(w??n)}return "32px"})(),T=Children.toArray(e).filter(Boolean),I=typeof t=="number"&&t>=0,x=I&&T.length>t?T.slice(0,t):T,R=I&&T.length>t?T.length-t:0,g=a==="panel"?u.surface.panelBg:a==="subtle"?u.surface.subtleBg:a??u.surface.appBg,p=Ni(i)??"4px",m=css({display:"flex",alignItems:"center"}),C=w=>css({marginLeft:w===0?0:o,zIndex:x.length-w,boxShadow:`0 0 0 ${p} ${g}`,backgroundColor:g,borderRadius:s?u.radius.full:u.radius.md,display:"inline-flex",width:f,height:f,overflow:"hidden",alignItems:"center",justifyContent:"center",lineHeight:0,flex:"0 0 auto"}),P=css({width:"100%",height:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",objectFit:"cover",boxSizing:"border-box"});return jsxs("div",{role:"group",tabIndex:-1,"aria-label":"Avatar group",className:`plainframe-ui-avatar-group${l?` ${l}`:""}`,css:[m,r,d()],children:[x.map((w,v)=>{if(!isValidElement(w))return jsx("div",{className:"plainframe-ui-avatar-group-item",css:C(v),children:jsx("span",{css:P,children:w})},v);let N=w,B=N.props?.css,K=B==null?P:[P,B],O=cloneElement(N,{size:n,rounded:s,css:K,style:{...N.props?.style,width:"100%",height:"100%",objectFit:N.props?.objectFit??"cover"}});return jsx("div",{className:"plainframe-ui-avatar-group-item",css:C(v),children:O},v)}),R>0&&jsxs("span",{className:"plainframe-ui-avatar-group-extra",css:[css({marginLeft:5,fontSize:u.typography.sizes.sm,fontWeight:600,lineHeight:1,padding:"2px 1px",zIndex:2,color:u.text.secondary}),c],"aria-label":`+${R} more`,children:["+",R]})]})};var Li=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Ud=(e,t)=>{let n=e,o=n.palette||{},r=n.neutral||{};return t==="neutral"||t==="secondary"?{scale:r,onKey:"neutral"}:typeof t=="string"&&o[t]?{scale:o[t],onKey:t}:{scale:n.primary||r,onKey:"primary"}},qd=e=>e[600]??e[500]??e[400]??Object.values(e)[0]??"#000",Gd=(e,t,n,o)=>o??t[n]??t.primary??e.text?.primary??"#fff",Xd=(e,t,n)=>n==="dot"?"":typeof e=="number"&&typeof t=="number"&&e>t?`${t}+`:e??"",Yd=(e,t,n,o)=>e&&(t==="dot"||!!n||n===0&&o),Jd=me.memo(({content:e,color:t="primary",fontColor:n,fontWeight:o=600,fontSize:r,variant:s="dot",max:a=99,showZero:c=false,visible:i=true,anchorOrigin:l={vertical:"top",horizontal:"right"},overlap:u="rectangular",children:d,animate:y=true,size:f,outline:T=false,outlineColor:I,className:x,badgeClassName:R,css:g,badgeCss:p,offsetX:m,offsetY:C})=>{let P=V(),w=s==="dot",v=f??(w?8:17),N=r??(w?0:10),{scale:B,onKey:K}=Ud(P,t),O=qd(B),S=P.text?.onColors||{},F=Gd(P,S,K,n),M=Xd(e,a,s),b=Yd(i,s,e,c),h=css({position:"relative",display:"inline-block"}),A=u==="circular"?w?"12.5%":"5%":w?"5%":"2.5%",D=Li(m??A),L=Li(C??A),k=l.vertical||"top",E=l.horizontal||"right",W={},$="0",z="0";k==="center"?(W.top="50%",z="-50%"):k==="top"?(W.top=L,z="-45%"):(W.bottom=L,z="45%"),E==="center"?(W.left="50%",$="-50%"):E==="right"?(W.right=D,$="45%"):(W.left=D,$="-45%");let _=b?1:.8,H=css({minWidth:w?v:v/2,height:v,background:O,color:F,fontSize:typeof N=="number"?`${N}px`:N,fontWeight:o,borderRadius:999,padding:w?0:`0 ${v/4}px`,boxShadow:"0 2px 8px rgba(0,0,0,0.04)",lineHeight:1,position:"absolute",pointerEvents:"none",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",...T?{boxShadow:`0 0 0 2px ${I??P.surface?.appBg}`}:{},opacity:b?1:0,transform:`translate(${$}, ${z}) scale(${b?_:.5})`,...y?{transition:"opacity .18s cubic-bezier(.4,1.6,.6,1), transform .18s cubic-bezier(.4,1.6,.6,1)"}:{},...W});return jsxs("div",{className:["plainframe-ui-badge-wrapper",x||""].join(" ").trim(),css:[h,g],children:[d,jsx("span",{"aria-hidden":!b,className:["plainframe-ui-badge",R||""].join(" ").trim(),css:[H,p],children:M})]})});var Es=({on:e,onClickAway:t,blur:n=false,blurDepth:o=2.5,color:r,zIndex:s=1e3,css:a,contentCss:c,overlayCss:i,children:l,transitionDuration:u=300,keepMounted:d=true,className:y,contentClassName:f,lockScroll:T=true,...I})=>{let x=V(),R=useMemo(()=>r??x.surface.overlayBg,[r,x.surface.overlayBg]),[g,p]=useState(e),[m,C]=useState(e),P=useRef(null),w=useRef(null),v=useRef(null);useEffect(()=>(P.current&&(clearTimeout(P.current),P.current=null),w.current!=null&&(cancelAnimationFrame(w.current),w.current=null),e?(p(true),w.current=requestAnimationFrame(()=>{C(true),w.current=null;})):(C(false),P.current=setTimeout(()=>{p(false),P.current=null;},u)),()=>{P.current&&(clearTimeout(P.current),P.current=null),w.current!=null&&(cancelAnimationFrame(w.current),w.current=null);}),[e,u]),useEffect(()=>{if(!T||!e)return;let F=document.body,M=F.style.overflow,b=F.style.paddingRight,h=window.innerWidth-document.documentElement.clientWidth,A=parseFloat(getComputedStyle(F).paddingRight||"0");return F.style.overflow="hidden",h>0&&(F.style.paddingRight=`${A+h}px`),()=>{F.style.overflow=M,F.style.paddingRight=b;}},[e,T]),useEffect(()=>{if(!m||!t)return;let F=M=>{M.key==="Escape"&&t();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[m,t]);let N=F=>{if(!m||!t||!v.current)return;let M=F.target;M&&!v.current.contains(M)&&t();},B=n&&o?typeof o=="number"?`${o}px`:o:void 0;if(!d&&!g)return null;let K=css({position:"fixed",inset:0,width:"100vw",height:"100vh",zIndex:s,display:"grid",placeItems:"center",pointerEvents:m?"auto":"none",visibility:g?"visible":"hidden"}),O=css({position:"absolute",inset:0,background:R,backdropFilter:B?`blur(${B})`:void 0,WebkitBackdropFilter:B?`blur(${B})`:void 0,opacity:m?1:0,transition:`opacity ${u}ms cubic-bezier(.4,0,.2,1)`,pointerEvents:m?"auto":"none"}),S=css({position:"relative",zIndex:1,pointerEvents:m?"auto":"none"});return jsxs("div",{"aria-hidden":!g||void 0,className:["plainframe-ui-backdrop",y||""].join(" ").trim(),css:[K,a],onPointerDown:N,...I,children:[jsx("div",{className:"plainframe-ui-backdrop-overlay",css:[O,i],role:"presentation"}),jsx("div",{ref:v,className:["plainframe-ui-backdrop-content",f||""].join(" ").trim(),css:[S,c],children:l})]})};var yr=()=>null;Object.defineProperty(yr,"displayName",{value:"PF.BreadCrumbItem",configurable:true});function np(e){let t=e.props??{};return {type:typeof t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__<"u"?t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__:e.type,props:t}}var op=me.memo(({children:e,separator:t="/",css:n,crumbCss:o,activeCrumbCss:r,inactiveCrumbCss:s,linkCrumbCss:a,separatorCss:c,hover:i=true,className:l,...u})=>{let d=V(),y=xe(),f=me.useMemo(()=>me.Children.toArray(e).flatMap(p=>{if(!me.isValidElement(p))return [];let{type:m,props:C}=np(p);if(!(m===yr||typeof m=="function"&&"displayName"in m&&m.displayName===yr.displayName))return [];let w=C;return [{href:w.href,disabled:w.disabled,node:w.children,className:w.className,css:w.css,onClick:w.onClick,startIcon:w.startIcon,endIcon:w.endIcon}]}),[e]),T=me.useMemo(()=>css({display:"flex",alignItems:"center",fontSize:d.typography.sizes.sm,fontWeight:500,gap:d.spacing.xs,cursor:"default"}),[d]),I=me.useMemo(()=>css({margin:"0 0.15rem",color:d.neutral[500],flex:"0 0 auto",justifyContent:"center",alignItems:"center",display:"flex"}),[d]),x=me.useCallback((p,m,C)=>{let P=p?d.text.primary:d.text.secondary,w=i&&m&&!C;return css({display:"inline-flex",alignItems:"center",gap:d.spacing.xs,color:P,cursor:m&&!C?"pointer":"default",textDecoration:"none",borderRadius:d.radius.xs,fontWeight:500,outline:"none",transition:"all .16s ease !important","&:hover":w?{textDecoration:"underline",color:d.text.primary}:{textDecoration:"none"}})},[d,i]),R=me.useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0}),[]),g=me.useMemo(()=>css({display:"inline-block"}),[]);return jsx("nav",{"aria-label":"Breadcrumb",className:["plainframe-ui-breadcrumbs",l||""].join(" ").trim(),css:[T,n],...u,children:f.map((p,m)=>{let C=m===f.length-1,P=!!p.href&&!p.disabled&&!C,w=["plainframe-ui-breadcrumb",C?"plainframe-ui-breadcrumb--active":"plainframe-ui-breadcrumb--inactive",P?"plainframe-ui-breadcrumb--link":"",p.className||""].join(" ").trim(),v=[x(C,P,p.disabled),o,C?r:s,P?a:void 0,y(),p.css],N=jsxs(Fragment,{children:[p.startIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-start",css:R,children:p.startIcon}),jsx("span",{className:"plainframe-ui-breadcrumb-label",css:g,children:p.node}),p.endIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-end",css:R,children:p.endIcon})]});return jsxs(me.Fragment,{children:[m!==0&&jsx("span",{className:"plainframe-ui-breadcrumb-separator",css:[I,c],children:t}),P?jsx("a",{href:p.href,onClick:p.onClick,tabIndex:0,"data-active":C?"true":"false","data-link":"true",className:w,css:v,children:N}):jsx("span",{"aria-current":C?"page":void 0,tabIndex:C?-1:0,"data-active":C?"true":"false","data-link":"false",className:w,css:v,children:N})]},m)})})});var ks=(e,t)=>{if(!isValidElement(e))return e;let n=e.props,o={};return n.size===void 0&&(o.size=t),n.color===void 0&&(o.color="currentColor"),cloneElement(e,{...n,...o})},Is=e=>typeof e=="number"?`${e}px`:e,Oi=e=>{let t=false;return me.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&Oi(n)&&(t=true));}),t};function ip(e,t){let n=e,o=typeof t=="string"&&(t==="sm"||t==="md"||t==="lg")?t:"md";return o==="sm"?{fontSize:n.typography.sizes.sm,paddingY:n.spacing.xs,paddingX:n.spacing.md,paddingXIcon:n.spacing.md,iconSize:14,minHeight:n.componentHeights.sm,radius:n.radius.sm}:o==="lg"?{fontSize:n.typography.sizes.md,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:18,minHeight:n.componentHeights.lg,radius:n.radius.md}:{fontSize:n.typography.sizes.sm,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:16,minHeight:n.componentHeights.md,radius:n.radius.md}}function lp(e,t){let n=e.neutral,o=e.text,r=e.palette,s=r.primary||n,a=r.danger||r.error||s,c=e.text.onColors||{},i=c.primary??o.onColors.primary,l=c.danger??i,u=(d,y,f)=>d&&d[y]||f;if(t==="primary"){let d=s,y=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:y,fg:i,hoverBg:f,border:"none"}}if(t==="destructive"){let d=a,y=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:y,fg:l,hoverBg:f,border:"none"}}return t==="ghost-destructive"?{bg:"transparent",fg:a[700],hoverBg:e.palette.danger[50],border:"none"}:t==="subtle"?{bg:e.surface.subtleBg,fg:o.primary,hoverBg:e.surface.subtleHover,border:"none"}:t==="outlined"?{bg:e.surface.panelBg,fg:o.primary,hoverBg:e.surface.panelHover,border:`${e.componentHeights.border} solid ${e.surface.border}`}:t==="ghost"?{bg:"transparent",fg:e.text.primary,hoverBg:e.surface.subtleBg,border:"none"}:t==="quiet"?{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}:{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}}var Wi=me.memo(me.forwardRef(({variant:e="primary",size:t="md",startIcon:n,endIcon:o,rounded:r=false,fullWidth:s=false,disabled:a=false,loading:c=false,loadingIndicator:i,loadingPosition:l="center",children:u,className:d,hoverEffect:y=true,icon:f,onClick:T,css:I,...x},R)=>{let g=V(),p=xe(),m=useMemo(()=>ip(g,t),[g,t]),C=useMemo(()=>lp(g,e),[g,e]),P=useMemo(()=>f===true?true:f===false?false:!n&&!o&&!Oi(u)&&me.Children.count(u)===1,[f,n,o,u]),w=m.iconSize,v=useMemo(()=>ks(n,w),[n,w]),N=useMemo(()=>ks(o,w),[o,w]),B=useMemo(()=>i??jsx(no,{color:C.fg,variant:"circular",size:14,thickness:5}),[i,C]),K=useMemo(()=>P?"center":l??"center",[P,l]),O=!!c&&K==="center",S=!!c&&K==="start",F=!!c&&K==="end",M=a||c,b=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",gap:0,width:s?"100%":"auto",minHeight:m.minHeight,lineHeight:1,fontWeight:600,cursor:M?"not-allowed":"pointer",opacity:M?.5:1,userSelect:"none",position:"relative",borderRadius:r?g.radius.full:m.radius,outline:"none",willChange:"box-shadow, transform, outline-offset",transition:"box-shadow 140ms ease, transform 90ms ease, outline-offset 140ms ease"}),[s,m,r,g,M]),h=useMemo(()=>css({backgroundColor:C.bg,color:C.fg,border:C.border}),[C]),A=useMemo(()=>css({overflow:"hidden","::before":{content:'""',position:"absolute",inset:0,backgroundColor:C.hoverBg,opacity:0,pointerEvents:"none",transition:"opacity 140ms ease",zIndex:0},"@media (hover: hover) and (pointer: fine)":y&&!M?{":hover::before":{opacity:1}}:{}}),[C,y,M]),D=useMemo(()=>css(P&&!s?{width:"100%",height:"100%",maxWidth:m.minHeight,minWidth:m.minHeight,maxHeight:m.minHeight,display:"flex",alignItems:"center",justifyContent:"center",fontSize:Is(m.iconSize)}:{fontSize:Is(m.fontSize),padding:n||o?`${m.paddingY} ${m.paddingXIcon}`:`${m.paddingY} ${m.paddingX}`}),[P,s,m,n,o]),L=useMemo(()=>css({position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Is(g.spacing.sm),opacity:O?0:1,transition:"opacity 140ms ease"}),[g,O]),k=useMemo(()=>css({height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),[]),E=useMemo(()=>typeof m.iconSize=="number"?m.iconSize:Math.max(12,Math.round(parseFloat(String(m.iconSize))||16)),[m.iconSize]),W=useMemo(()=>css({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:E,minWidth:E,maxWidth:E,height:"1em"}),[E]),$=useMemo(()=>X=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:X?1:0,transition:"opacity 140ms ease"}),[]),z=useMemo(()=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:O?1:0,pointerEvents:"none",zIndex:2,transition:"opacity 140ms ease"}),[O]),_=useMemo(()=>()=>{if(P)return null;let X=!!n;return !X&&!S?null:jsxs("span",{css:W,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!S),children:X?v||n:null}),jsx("span",{css:$(!!S),children:B})]})},[P,n,S,W,$,v,c,B]),H=useMemo(()=>()=>{if(P)return null;let X=!!o;return !X&&!F?null:jsxs("span",{css:W,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!F),children:X?N||o:null}),jsx("span",{css:$(!!F),children:B})]})},[P,o,F,W,$,N,c,B]),U=!(a||c);return jsxs("button",{ref:R,type:"type"in x&&x.type?x.type:"button","data-variant":e,className:["plainframe-ui-button",d||""].join(" ").trim(),css:[b,p({color:e==="primary"?"primary":e==="destructive"||e==="ghost-destructive"?"danger":"neutral"}),h,A,D,I],onClick:U?T:void 0,disabled:a||void 0,tabIndex:c?-1:void 0,"aria-disabled":a||void 0,"aria-busy":c||void 0,...x,children:[jsxs("span",{className:"plainframe-ui-button-content",css:L,children:[_(),jsx("span",{className:"plainframe-ui-button-label",css:k,children:P?c?B:ks(u,m.iconSize):u}),H()]}),jsx("span",{className:"plainframe-ui-button-center-overlay",css:z,"aria-hidden":"true",children:O?B:null})]})}));Wi.displayName="Button";var Rr=e=>isValidElement(e),cp=e=>{let t=e.type;return t.displayName??t.name},As=(e,t)=>cp(e)===t,ji=e=>As(e,"ButtonGroup"),Vi=e=>As(e,"DropdownMenu"),Ms=e=>As(e,"DropdownMenuTrigger"),Kn=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,up=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,dp=e=>typeof e=="string"&&/^(outlined|outlined-soft|outline-soft)$/i.test(e),Fs=(e,t)=>{if(!Rr(e))return null;if(ji(e)){let n=Children.toArray(e.props.children).filter(isValidElement);return n.length?Fs(t?n[0]:n[n.length-1],t):null}if(Vi(e)){let o=Children.toArray(e.props.children).filter(isValidElement).find(Ms);return o?Fs(o,t):null}if(Ms(e)){let n=Children.toArray(e.props.children??[]).filter(isValidElement);return n.length?n[0]:null}return e},_i=(e,t)=>{if(!e)return false;let n=Fs(e,t==="left"),o=n&&n.props&&typeof n.props=="object"?n.props.variant:void 0;return dp(o)},Ui=me.memo(me.forwardRef(function({children:t,attached:n=false,direction:o="horizontal",fullWidth:r=false,disabled:s=false,size:a="md",rounded:c=false,gap:i,width:l,className:u,role:d="group",css:y,__clipLeft:f,__clipRight:T,...I},x){let R=V(),g=a==="sm"?R.radius.sm:R.radius.md,p=c?R.radius.full:g,m=o==="vertical",C=up(R.componentHeights.border,1),P=R.surface.border,w=n&&!!f,v=n&&!!T,N=css({display:"flex",flexDirection:m?"column":"row",width:r?"100%":l!=null?Kn(l):"auto",maxWidth:"none",backgroundColor:"transparent",gap:n?0:Kn(i??R.spacing.sm)}),B=Children.toArray(t),O=B.filter(Rr).length,S=0,F=false,M=[];for(let b of B){if(!Rr(b)){M.push(b);continue}let h=S===0,A=S===O-1,D=b.props??{},L=D.disabled??s,k=D.size??a,E=0,W=0,$=0,z=0;n&&(m?(E=h?w?0:p:0,W=h?v?0:p:0,z=A?w?0:p:0,$=A?v?0:p:0):(E=h?w?0:p:0,z=h?w?0:p:0,W=A?v?0:p:0,$=A?v?0:p:0));let _=_i(b,"left"),H=_i(b,"right"),ae=n&&!h&&!(F&&_)&&!(F||_)?css({[m?"borderTop":"borderLeft"]:`${C} solid ${P}`}):null,q=n&&!h&&F&&_?css(m?{borderTopWidth:0}:{borderLeftWidth:0}):null,Y=n?css({borderTopLeftRadius:Kn(E),borderTopRightRadius:Kn(W),borderBottomRightRadius:Kn($),borderBottomLeftRadius:Kn(z)}):null,le=r?css({flex:"1 1 0%",minWidth:0,width:"100%"}):null,ie=css([Y,ae,q,le]);if(!Vi(b)){let Ce=D.css,Ie=[D.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" "),Te=ji(b)&&n?{__clipLeft:!h,__clipRight:!A}:{},we=cloneElement(b,{...D,disabled:L,size:k,className:Ie,css:[Ce,ie],...Te});M.push(we),F=H,S+=1;continue}let be=D.children,Pe=Children.map(be,Ce=>{if(!Rr(Ce)||!Ms(Ce))return Ce;let Ie=Ce.props,Te=[Ie.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" ");return cloneElement(Ce,{...Ie,css:[Ie.css,ie],className:Te,disabled:L,size:k})}),Re=cloneElement(b,{...D,children:Pe});M.push(Re),F=H,S+=1;}return jsx("div",{ref:x,role:d,"aria-orientation":m?"vertical":"horizontal","data-attached":n||void 0,"data-direction":o,className:["plainframe-ui-button-group",u||""].join(" ").trim(),css:[N,y],...I,children:M})}));Ui.displayName="ButtonGroup";var Tr=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,hp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;return Tr(n?.[e]??e)}}},yp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius??t.radii;return Tr(n?.[e]??e)}}},xp=(e,t)=>{let n=t.surface??{};return e==="panel"||e==="outlined"?n.panelBg??"transparent":e==="subtle"?n.subtleBg??"transparent":"transparent"},vp=(e,t,n)=>{let o=t.surface??{};return e==="panel"||e==="outlined"?o.panelHover??o.panelBg??n:e==="subtle"?o.subtleHover??o.subtleBg??n:o.subtleBg??n},_n=me.memo(forwardRef(function({children:t,css:n,variant:o="ghost",padding:r,radius:s,className:a,hoverable:c,selectable:i,selected:l,defaultSelected:u,onSelectedChange:d,width:y,height:f,onClick:T,onKeyDown:I,role:x,tabIndex:R,...g},p){let m=V(),C=m.surface??{},[P,w]=useState(!!u),v=l!=null,N=v?!!l:P,B=useMemo(()=>xp(o,m),[o,m]),K=useMemo(()=>vp(o,m,B),[o,m,B]),O=K,S=useMemo(()=>hp(r,m),[r,m]),F=useMemo(()=>yp(s,m),[s,m]),M=!!c||!!i,b=useMemo(()=>css({backgroundColor:B,padding:S,borderRadius:F,border:o==="outlined"?`${m.componentHeights?.border??"1px"} solid ${C.border??"transparent"}`:void 0,backgroundClip:"padding-box",boxSizing:"border-box",width:y?"100%":void 0,maxWidth:Tr(y),height:Tr(f),outline:"none",transition:"background-color .16s ease, border-color .16s ease",cursor:M?"pointer":void 0,...M?{"&:hover":{backgroundColor:K}}:{},'&[data-selected="true"]':{backgroundColor:O},...M?{'&[data-selected="true"]:hover':{backgroundColor:O}}:{}}),[B,S,F,o,m.componentHeights,C.border,y,f,M,K,O]),h=useCallback(()=>{if(!i)return;let k=!N;v||w(k),d?.(k);},[v,d,i,N]),A=useCallback(k=>{i&&h(),T?.(k);},[i,h,T]),D=useCallback(k=>{i&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),h()),I?.(k);},[i,h,I]),L=xe();return jsx("div",{ref:p,"data-variant":o,"data-selected":i&&N?"true":void 0,"aria-pressed":i?N:void 0,className:["plainframe-ui-container",a||""].join(" ").trim(),css:[L(),b,n],onClick:A,onKeyDown:D,role:i?x??"button":x,tabIndex:i?R??0:R,...g,children:t})}));_n.displayName="Container";var Rp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Ns(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;if(n&&e in n){let o=n[e];return Rp(o)}return e}}}function yo(e){switch(e){case "center":return "center";case "end":return "flex-end";case "start":default:return "flex-start"}}function Ds(e){switch(e){case "center":return "center";case "end":return "right";case "start":default:return "left"}}function Tp(e,t){if(e==null)return t.spacing?.md??void 0;if(typeof e=="number")return e;if(typeof e=="string"){let n=t.spacing??t.space??{};return e in n?n[e]:e}}function xo(e,t,n,o){let r=Ns(t,e),s=Ns(n,e),a=Ns(o,e),c={};return r&&!s&&!a&&(c.padding=r),s&&(c.paddingLeft=s,c.paddingRight=s),a&&(c.paddingTop=a,c.paddingBottom=a),c}function qi(e,t){if(t)return t==="primary"?e.text?.primary:t==="secondary"?e.text?.secondary:t}var Gi=me.createContext("horizontal"),Hs=()=>me.useContext(Gi),Xi=me.memo(me.forwardRef(({children:e,css:t,variant:n="ghost",padding:o="md",radius:r="lg",hoverable:s,selectable:a,selected:c,defaultSelected:i,onSelectedChange:l,width:u="100%",height:d,gap:y,direction:f="horizontal",className:T,onClick:I,...x},R)=>{let g=V(),p=xe(),m=f==="vertical",C=css({position:"relative",display:"flex",flexDirection:m?"column":"row",gap:Tp(y,g),alignItems:m?"stretch":"center",transition:"all .16s ease"});return jsx(Gi.Provider,{value:f,children:jsx(_n,{ref:R,variant:n,padding:o,radius:r,hoverable:s,selectable:a,selected:c,defaultSelected:i,onSelectedChange:l,width:u,height:d,className:["plainframe-ui-card",T||""].join(" ").trim(),css:[p(),C,t],onClick:I,tabIndex:I?0:void 0,...x,children:e})})}));Xi.displayName="Card";var wp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Hs()==="vertical",d=css({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:yo(o),textAlign:Ds(o),...u?{width:"100%"}:{flex:1,minWidth:0},...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-content",className:["plainframe-ui-card-content",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ep=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Hs()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...u?{width:"100%"}:{},...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-start",className:["plainframe-ui-card-start",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),kp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Hs()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...u?{width:"100%"}:{},gap:i.spacing.xs,color:i.text.secondary,...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-end",className:["plainframe-ui-card-end",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ip=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:c,size:i,color:l,...u})=>{let d=V(),y=css({fontWeight:c??500,fontSize:i??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"1rem"),color:qi(d,l)??d.text?.primary,textAlign:Ds(o),...xo(d,r,s,a),display:"flex",alignItems:"center",gap:d.spacing?.xs??6});return jsx("div",{"data-slot":"card-title",className:["plainframe-ui-card-title",n||""].join(" ").trim(),css:[y,t],...u,children:e})}),Sp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:c,size:i,color:l,...u})=>{let d=V(),y=css({fontWeight:c??400,fontSize:i??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"0.875rem"),color:qi(d,l)??d.text?.secondary,marginTop:d.spacing?.xxs??2,textAlign:Ds(o),...xo(d,r,s,a)});return jsx("div",{"data-slot":"card-description",className:["plainframe-ui-card-description",n||""].join(" ").trim(),css:[y,t],...u,children:e})});var Ji=e=>isValidElement(e),Pp=e=>Ji(e)?e.type?.displayName||e.type?.name:void 0,Yi=e=>Pp(e)==="Card",Np=e=>typeof e=="number"?`${e}px`:e,Zi=({children:e,attached:t=false,gap:n,width:o,direction:r="vertical",variant:s,className:a,role:c="group",css:i})=>{let l=V(),u=r==="vertical",d=String(l.componentHeights?.border??"1px"),y=l.surface.border,f={display:"flex",flexDirection:u?"column":"row",width:typeof o=="string"||typeof o=="number"?Np(o):"auto",maxWidth:"none",gap:t?0:n??l.spacing?.sm},T=Children.toArray(e),x=T.filter(Yi).length,R=0,g=T.map((p,m)=>{if(!Yi(p)||!Ji(p))return p;let C=p.props,P=R++,w=P===0,v=P===x-1,N=s??C.variant,B=t?u?{borderTopLeftRadius:w?C.radius:0,borderTopRightRadius:w?C.radius:0,borderBottomLeftRadius:v?C.radius:0,borderBottomRightRadius:v?C.radius:0}:{borderTopLeftRadius:w?C.radius:0,borderBottomLeftRadius:w?C.radius:0,borderTopRightRadius:v?C.radius:0,borderBottomRightRadius:v?C.radius:0}:void 0,K=t&&!w?u?{borderTopWidth:0}:{borderLeftWidth:0}:void 0,O=N==="subtle"&&x>1&&!w?u?{borderTop:`${d} solid ${y}`}:{borderLeft:`${d} solid ${y}`}:null,F=[B,K,O,t?{width:"100%"}:{width:"100%",marginBottom:u?0:void 0,marginRight:u?void 0:0}].filter(Boolean),M=[C.className,"plainframe-ui-card-group-item"].filter(Boolean).join(" ");return cloneElement(p,{...C,variant:N??C.variant,css:[C.css,...F],className:M,key:typeof p=="object"&&"key"in p?p.key:m})});return jsx("div",{role:c,"aria-orientation":u?"vertical":"horizontal","data-attached":t||void 0,"data-direction":r,className:["plainframe-ui-card-group",a||""].join(" ").trim(),css:[f,i],children:g})};Zi.displayName="CardGroup";var Le=e=>typeof e=="number"?`${e}px`:e,el=e=>{let t=false;return me.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&el(n)&&(t=true));}),t},Bp=(e,t)=>t==="sm"?{fontSize:e.typography.sizes.xs,paddingX:`calc(${e.spacing.sm} * 0.7)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.xs,radius:`calc(${e.radius.sm} * 0.8)`,soloPadding:e.spacing.xs,iconOffset:"0px",iconOffsetRounded:"-2px"}:t==="lg"?{fontSize:e.typography.sizes.md,paddingX:e.spacing.sm,paddingY:`calc(${e.spacing.sm} * 0.6)`,gap:e.spacing.xs,iconSize:e.typography.sizes.md,radius:e.radius.md,soloPadding:e.spacing.sm,iconOffset:"0px",iconOffsetRounded:"-3px"}:{fontSize:e.typography.sizes.sm,paddingX:`calc(${e.spacing.sm} * 0.9)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.sm,radius:e.radius.sm,soloPadding:e.spacing.xs,iconOffset:"-1px",iconOffsetRounded:"-3px"},tl=me.memo(forwardRef(function({children:t,labelCss:n,variant:o="soft",color:r="primary",rounded:s=false,startIcon:a,endIcon:c,size:i="md",onClick:l,onDelete:u,deleteIcon:d,disabled:y,cursor:f,className:T,css:I},x){let R=V(),g=xe(),p=["sm","md","lg"].includes(i)?i:"md",m=useMemo(()=>Bp(R,p),[R,p]),C=!!l&&!y,P=y?"not-allowed":f||(C?"pointer":"inherit"),w=String(R.componentHeights?.border??"1px"),v=useMemo(()=>{let X=R.palette;return r==="secondary"||r==="neutral"?"neutral":r&&X[r]?r:"primary"},[r,R.palette]),N=useCallback(X=>{let ae=R.palette;return (v==="neutral"?R.neutral[X]:ae[v]?.[X])??ae.primary?.[X]},[v,R.neutral,R.palette]),B=useMemo(()=>v==="neutral"?R.neutral[100]:N(50),[v,N,R.neutral]),K=useMemo(()=>v==="neutral"?R.text.secondary:N(800),[v,N,R.text.secondary]),O=useMemo(()=>v==="neutral"?R.neutral[100]:N(50),[v,N,R.neutral]),S=useMemo(()=>v==="neutral"?R.text.secondary:N(800),[v,N,R.text.secondary]),F=useMemo(()=>v==="neutral"?R.neutral[400]:N(300),[v,N,R.neutral]),M=useMemo(()=>v==="neutral"?R.surface.subtleBg:N(600),[v,N,R.surface.subtleBg]),b=useMemo(()=>(R.text.onColors??{})[v]??(v==="neutral"?R.neutral[900]:R.neutral[0]??"#fff"),[v,R.text.onColors,R.neutral]),h="transparent",A=useMemo(()=>v==="neutral"?R.text.secondary:N(700)??R.text.primary,[v,N,R.text.primary,R.text.secondary]),D=useMemo(()=>!a&&!c&&t!=null&&!el(t)&&me.Children.count(t)===1,[a,c,t]),L=useMemo(()=>o==="filled"?css({backgroundColor:M,color:b,border:"none",boxShadow:"none"}):o==="outlined"?css({backgroundColor:O,color:S,border:"none",boxShadow:`inset 0 0 0 ${w} ${F}`}):o==="ghost"?css({backgroundColor:h,color:A,border:"none",boxShadow:"none"}):css({backgroundColor:B,color:K,border:"none",boxShadow:"none"}),[M,b,A,O,S,F,B,K,w,o]),k=useMemo(()=>css({display:"inline-flex",alignItems:"center",gap:Le(m.gap),padding:o==="ghost"?0:D||t==null?Le(m.soloPadding):`${Le(m.paddingY)} ${Le(m.paddingX)}`,borderRadius:s?R.radius.full:m.radius,fontWeight:600,cursor:P,opacity:y?.55:1,transition:"outline .16s ease, outline-offset .16s ease",overflow:o==="ghost"?"visible":"hidden",...D?{lineHeight:1,minWidth:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,minHeight:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,justifyContent:"center"}:null}),[m,P,t,y,D,s,R.radius.full,o]),E=useMemo(()=>css({fontSize:Le(D?m.iconSize:m.fontSize),lineHeight:1.2,minWidth:0,display:"inline-flex",alignItems:"center",justifyContent:"center","& > svg":{width:D?Le(m.iconSize):void 0,height:D?Le(m.iconSize):void 0,display:D?"block":void 0}}),[m.fontSize,m.iconSize,D]),W=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:Le(m.iconSize),lineHeight:0,"& > svg":{width:Le(m.iconSize),height:Le(m.iconSize),display:"block"}}),[m.iconSize]),$=useMemo(()=>css({marginRight:D||t==null?0:Le(m.gap),marginLeft:D||t==null?0:Le(m.iconOffset)}),[m.gap,m.iconOffset,t,D]),z=useMemo(()=>css({marginLeft:D||t==null?0:Le(m.gap),marginRight:D||t==null?0:Le(s?m.iconOffsetRounded:m.iconOffset)}),[m.gap,m.iconOffset,m.iconOffsetRounded,t,D,s]),_=useMemo(()=>css({marginRight:s?0:Le(m.iconOffset),padding:0,border:"none",outline:"none",background:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:y?"not-allowed":"pointer",color:"currentColor",opacity:y?.4:.85,transition:"background-color .16s ease, color .16s ease, opacity .16s ease, outline .16s ease, outline-offset .16s ease",fontSize:Le(m.iconSize),borderRadius:R.radius.xs}),[m.iconOffset,m.iconSize,y,s,R.radius.xs]),H=useCallback(X=>{C&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),l?.());},[C,l]),U=useMemo(()=>jsx(X,{css:{width:m.iconSize,height:m.iconSize},strokeWidth:2.5}),[m.iconSize]);return jsxs("div",{ref:x,className:["plainframe-ui-chip",C?"plainframe-ui-chip-clickable":"",T||""].join(" ").trim(),css:[k,L,C?g({color:r??"primary"}):null,I],onClick:C?l:void 0,onKeyDown:H,role:C?"button":void 0,tabIndex:C?0:void 0,"aria-disabled":y||void 0,"data-variant":o,"data-color":v,"data-size":i,"data-icon-only":D||void 0,children:[a&&jsx("span",{css:[W,$],className:"plainframe-ui-chip-icon-left",children:a}),t!=null&&jsx("span",{css:[E,n],className:"plainframe-ui-chip-label",children:t}),c&&jsx("span",{css:[W,z],className:"plainframe-ui-chip-icon-right",children:c}),u&&jsx("button",{type:"button","aria-label":"Delete",disabled:y,tabIndex:0,onClick:X=>{X.stopPropagation(),y||u?.();},css:[_,g({color:r??"primary"})],className:"plainframe-ui-chip-delete",children:d||U})]})}));tl.displayName="Chip";var Wp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Kp=me.memo(function({value:t,onChange:n,len:o,theme:r,sizeKey:s,s:a,variant:c,error:i,disabled:l,ringEnabled:u,focusRingMode:d,placeholder:y,separator:f,gapPx:T}){let I=xe(),x=r.neutral,R=r.text,g=r.componentHeights.border,p=useRef([]),[m,C]=useState(0),P=useMemo(()=>(t??"").padEnd(o,"").slice(0,o).split(""),[t,o]),w=useMemo(()=>{if(!y)return Array(o).fill("");if(y.length===1)return Array(o).fill(y);let D=y.slice(0,o).split("");for(;D.length<o;)D.push("");return D},[y,o]),v=useMemo(()=>{let D=r.componentHeights[s];return `calc(${typeof D=="number"?`${D}px`:D} * 1.5)`},[r.componentHeights,s]),N=l?x[200]:i&&c==="outlined"?r.palette.danger?.[50]??r.surface.panelBg:i&&c==="subtle"?r.palette.danger?.[50]??r.surface.subtleBg:c==="subtle"?r.surface.subtleBg:c==="outlined"?r.surface.panelBg:"transparent",B=c==="outlined"?`${g} solid ${i?r.palette.danger?.[300]??r.surface.border:r.surface.border}`:"none",K=D=>css({width:v,height:v,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:N,border:B,borderRadius:r.radius.lg,transition:"box-shadow .16s, border-color .16s, background .16s",fontSize:a.codeFontSize,fontWeight:600,color:l?x[500]:i?r.palette.danger?.[800]??R.primary:R.primary,textAlign:"center",backgroundClip:"padding-box",appearance:"textfield",outline:"none",caretColor:i?r.palette.danger?.[800]??R.primary:R.primary,"&::placeholder":{color:i?r.palette.danger?.[700]??R.secondary:R.secondary,opacity:.85}},u?I({enabled:true,disabled:l,mode:d==="always"?"always":"visible",color:i?"danger":void 0}):void 0,D?css({}):null),O=css({display:"flex",gap:T,justifyContent:"center",width:"auto",pointerEvents:l?"none":"auto",opacity:l?.65:1}),S=css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:R.secondary,userSelect:"none"}),F=D=>D.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),M=useCallback(D=>{let L=Math.max(0,Math.min(o-1,D));C(L),p.current[L]?.focus();},[o]),b=useCallback((D,L)=>{let k=F(L).slice(0,1),E=[...P];E[D]=k,n(E.join("")),k&&D<o-1&&M(D+1);},[P,o,n,M]),h=useCallback((D,L)=>{if(L.key==="Backspace")if(!P[D]&&D>0){let k=[...P];k[D-1]="",n(k.join("")),M(D-1),L.preventDefault();return}else {let k=[...P];k[D]="",n(k.join(""));return}if(L.key==="ArrowLeft"&&D>0){L.preventDefault(),M(D-1);return}if(L.key==="ArrowRight"&&D<o-1){L.preventDefault(),M(D+1);return}if(L.key==="Home"){L.preventDefault(),M(0);return}if(L.key==="End"){L.preventDefault(),M(o-1);return}},[P,o,n,M]),A=useCallback(D=>{let L=F(D.clipboardData.getData("text")).slice(0,o);L&&(n(L),requestAnimationFrame(()=>{let k=Math.min(L.length,o-1);M(k);}),D.preventDefault());},[o,n,M]);return jsx("div",{className:"plainframe-ui-code-boxes",css:O,children:Array.from({length:o}).map((D,L)=>jsxs(me.Fragment,{children:[jsx("input",{ref:k=>{p.current[L]=k;},type:"text",inputMode:"text",maxLength:1,value:P[L]||"",placeholder:P[L]?"":w[L]||"",disabled:l,onChange:k=>b(L,k.target.value),onKeyDown:k=>h(L,k),onFocus:()=>C(L),onPaste:L===0?A:void 0,className:"plainframe-ui-code-box",css:K(L===m),"aria-label":`Code character ${L+1}`,tabIndex:L===m?0:-1}),f&&L<o-1?jsx("span",{"aria-hidden":true,role:"presentation",css:S,children:f}):null]},L))})}),_p=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,separator:s,error:a,helperText:c,disabled:i=false,gap:l,size:u="md",variant:d="subtle",length:y=4,focusRingMode:f="always",className:T,wrapperCss:I,labelCss:x,helperRowCss:R,helperTextCss:g,css:p})=>{let m=V(),C=useId(),P=useMemo(()=>({sm:{labelFont:m.typography.sizes.xs,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.sm,paddingY:0,paddingX:m.spacing.md,codeFontSize:21},md:{labelFont:m.typography.sizes.sm,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.md,paddingY:0,paddingX:m.spacing.md,codeFontSize:24},lg:{labelFont:m.typography.sizes.md,helperFont:m.typography.sizes.sm,minHeight:m.componentHeights.lg,paddingY:0,paddingX:m.spacing.md,codeFontSize:28}}),[m]),w=["sm","md","lg"].includes(u)?u:"md",v=P[w],N=m.neutral,B=m.text,K=t!=null,[O,S]=useState(n),F=K?t:O,M=$=>{K||S($),o?.($);},b=Math.max(2,Math.min(y,10)),h=m.spacing.sm,A=Wp(l??h)??"0px",D=css({boxSizing:"border-box",display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"auto",maxWidth:"unset",fontWeight:500,cursor:i?"not-allowed":"auto"},...Array.isArray(I)?I:I?[I]:[]),L=css({fontSize:v.labelFont,fontWeight:500,color:a?m.palette.danger?.[700]??B.primary:i?N[500]:B.primary,marginBottom:4,display:"block",cursor:i?"not-allowed":"auto"},...Array.isArray(x)?x:x?[x]:[]),k=css({display:"flex",alignItems:"center",justifyContent:"center",gap:A,width:"auto",background:"transparent",outline:"none",boxShadow:"none"},...Array.isArray(p)?p:p?[p]:[]),E=css({minHeight:16,fontSize:v.helperFont,color:a?m.palette.danger?.[700]??B.secondary:B.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Array.isArray(R)?R:R?[R]:[]),W=css({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400,color:a?m.palette.danger?.[700]??B.primary:i?N[500]:B.primary},...Array.isArray(g)?g:g?[g]:[]);return jsxs("div",{className:["plainframe-ui-codefield",T||""].join(" ").trim(),css:D,children:[e&&jsx("span",{id:C,className:"plainframe-ui-codefield-label",css:L,children:e}),jsx("div",{className:"plainframe-ui-codefield-row",css:k,role:"group","aria-labelledby":e?C:void 0,tabIndex:-1,children:jsx(Kp,{value:F||"",onChange:M,len:b,theme:m,sizeKey:w,s:{codeFontSize:v.codeFontSize},variant:d,error:!!a,disabled:i,ringEnabled:f!=="none",focusRingMode:f,placeholder:r,separator:s,gapPx:A})}),c!=null&&jsx("div",{className:"plainframe-ui-codefield-helper",css:E,children:jsx("span",{className:"plainframe-ui-codefield-helper-text",css:W,children:c})})]})};var al=e=>{if(typeof e=="object"&&e!==null&&"type"in e&&e.type){let t=e.type;return (typeof t=="object"&&t!==null||typeof t=="function")&&(t?.displayName||t?.name)||""}return ""},Bs=e=>{if(!e||typeof e!="object")return false;let t=al(e);if(t==="DropdownMenu"||t==="DropdownMenuContent")return true;let n=e?.props,o=n&&typeof n=="object"&&n!==null&&"children"in n?n.children:void 0;return o==null?false:Array.isArray(o)?o.some(Bs):Bs(o)},Vp=({children:e,content:t,trigger:n="contextmenu",onOpenChange:o,hoverPosition:r="cursor",hoverOffset:s=10})=>{let a=me.useRef(null),[c,i]=me.useState(false),l=me.useCallback(E=>{i(E),o?.(E);},[o]),u=me.useCallback(()=>l(false),[l]),d=me.useRef({x:0,y:0}),y=me.useRef(null),f=me.useRef(null),T=me.useCallback(()=>{f.current=null;let E=y.current;if(!E)return;let W=Math.round(d.current.x),$=Math.round(d.current.y);E.style.transform=`translate3d(${W}px, ${$}px, 0)`;},[]),I=me.useCallback(()=>{f.current==null&&(f.current=requestAnimationFrame(T));},[T]);me.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current);},[]);let x=me.useMemo(()=>({getBoundingClientRect:()=>{let E=Math.round(d.current.x),W=Math.round(d.current.y);return {x:E,y:W,left:E,top:W,right:E,bottom:W,width:0,height:0,toJSON:()=>({x:E,y:W})}}}),[]),R=me.useRef(`cz-${Math.random().toString(36).slice(2)}`),g=me.useCallback(()=>typeof document<"u"?document.querySelector(`[data-cz-id="${R.current}"]`):null,[]),p=me.useRef(null),m=me.useRef(null),C=me.useCallback(()=>{p.current!=null&&clearTimeout(p.current),p.current=null;},[]),P=me.useCallback(()=>{m.current!=null&&clearTimeout(m.current),m.current=null;},[]),w=me.useCallback(()=>{P(),m.current=window.setTimeout(()=>l(false),0);},[P,l]),v=me.useCallback(()=>{let E=a.current?.getBoundingClientRect();return E?{x:E.left+E.width/2,y:E.top+E.height/2}:{x:0,y:0}},[]),N=me.useCallback((E,W)=>{d.current={x:E,y:W},I(),l(true);},[I,l]),B=typeof t=="function"?t({close:u}):t,K=Bs(B),O=E=>{if(!me.isValidElement(E))return E;let W=al(E),$=E,z=$.props.children,_=z==null?z:Array.isArray(z)?z.map(H=>me.isValidElement(H)?O(H):H):me.isValidElement(z)?O(z):z;if(W==="DropdownMenu"){let H=$.props.onOpenChange;return me.cloneElement($,{...$.props,open:c,onOpenChange:U=>{H?.(U),l(U);},children:_})}if(W==="DropdownMenuContent"){let H=$.props.onMouseEnter,U=$.props.onMouseLeave;return me.cloneElement($,{...$.props,anchor:x,"data-cz-id":R.current,onMouseEnter:X=>{P(),H?.(X);},onMouseLeave:X=>{w(),U?.(X);},children:_})}return _===z?$:me.cloneElement($,{...$.props,children:_})},S=K?O(B):B,F=me.useCallback(E=>{E.preventDefault(),N(E.clientX,E.clientY);},[N]),M=me.useCallback(E=>{n==="contextmenu"&&F(E);},[n,F]),b=me.useCallback(E=>{n==="dblclick"&&F(E);},[n,F]),h=me.useCallback(E=>{n==="click"&&F(E);},[n,F]),A=me.useCallback(E=>{if(n!=="hover")return;C(),P();let W=r==="center"?v():{x:E.clientX,y:E.clientY};p.current=window.setTimeout(()=>{let $=W.x+(r==="cursor"?s:0),z=W.y+(r==="cursor"?s:0);N($,z);},0);},[n,r,s,v,N,C,P]),D=me.useCallback(E=>{n==="hover"&&c&&r==="cursor"&&!K&&(d.current={x:E.clientX+s,y:E.clientY+s},I());},[n,c,r,K,s,I]),L=me.useCallback(()=>{n==="hover"&&(C(),w());},[n,C,w]);me.useEffect(()=>{if(n!=="hover")return;let E=()=>{if(!c)return;let W=a.current?.matches(":hover"),$=g()?.matches?.(":hover");W||$?P():w();};return window.addEventListener("pointermove",E,{passive:true,capture:true}),()=>window.removeEventListener("pointermove",E,{capture:true})},[c,n,g,P,w]),me.useEffect(()=>{let E=()=>{if(c)if(n==="hover"){let W=a.current?.matches(":hover"),$=g()?.matches?.(":hover");if(W||$?P():w(),r==="center"&&a.current){let z=v();d.current={x:z.x,y:z.y},I();}}else l(false);};return window.addEventListener("scroll",E,true),window.addEventListener("resize",E,true),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E,true);}},[c,n,r,v,I,l,P,w,g]),me.useEffect(()=>()=>{C(),P();},[C,P]);let k=({children:E})=>c?jsx("div",{ref:y,style:{position:"fixed",left:0,top:0,transform:`translate3d(${Math.round(d.current.x)}px, ${Math.round(d.current.y)}px, 0)`,willChange:"transform",zIndex:1e3,pointerEvents:"auto"},onMouseEnter:()=>n==="hover"&&P(),onMouseLeave:()=>n==="hover"&&w(),children:E}):null;return jsxs("div",{ref:a,onContextMenu:M,onDoubleClick:b,onClick:h,onMouseEnter:A,onMouseMove:D,onMouseLeave:L,css:css({position:"relative"}),className:"plainframe-ui-context-zone-wrapper",children:[e,K?S:jsx(k,{children:S})]})};var Vn=(e,t="0px")=>e==null?t:typeof e=="number"?`${e}px`:e,Xp=me.memo(forwardRef(function({label:t,variant:n="full",direction:o="horizontal",labelPosition:r="center",thickness:s=1,width:a,middleMargin:c="5px",insetMargin:i="10px",chip:l=false,chipVariant:u="subtle",rounded:d=false,margin:y=10,css:f,labelCss:T,strokeCss:I,className:x,...R},g){let p=V(),{t:m,strokeColor:C,labelTextColor:P,chipSubtleBg:w,chipOutlinedBg:v,outerM:N,padX:B,verticalStrokeMargin:K}=useMemo(()=>{let b=typeof s=="number"?`${s}px`:s,h=p.surface.border,A=p.text.secondary,D=p.surface.subtleBg,L=p.surface.panelBg,k=Vn(y,"10px"),E=o==="horizontal"?n==="middle"?Vn(c):n==="inset"?Vn(i,"0px"):"0":"0",W=o==="vertical"?n==="middle"?Vn(c):n==="inset"?Vn(i,"0px"):"0":"0";return {t:b,strokeColor:h,labelTextColor:A,chipSubtleBg:D,chipOutlinedBg:L,outerM:k,padX:E,verticalStrokeMargin:W}},[s,p,o,n,c,i,y]),O=useMemo(()=>css([{display:"flex",alignItems:"center"},o==="vertical"?{flexDirection:"column",alignSelf:"stretch",width:t?"max-content":m,minWidth:t?"max-content":m,marginLeft:N,marginRight:N}:{flexDirection:"row",width:a?Vn(a):"100%",minWidth:0,paddingLeft:B,paddingRight:n==="middle"?B:"0",marginTop:N,marginBottom:N},...Array.isArray(f)?f:f?[f]:[]]),[o,t,m,N,a,B,n,f]),S=useMemo(()=>css([{background:C,borderRadius:d?p.radius.full:p.radius.xs},o==="vertical"?{width:m,minHeight:18,flex:1,marginTop:K,marginBottom:K}:{height:m,flex:1}]),[C,d,p.radius.full,p.radius.xs,o,m,K]),F=useMemo(()=>css([{margin:l?o==="vertical"?"4px 0":0:o==="vertical"?"2px 0":0,padding:l?"3px 7px":0,borderRadius:l?d?p.radius.full:`calc(${p.radius.sm} * 0.75)`:`calc(${p.radius.sm} * 0.75)`,color:P,fontWeight:500,fontSize:13,textAlign:"center",alignSelf:"center",whiteSpace:o==="vertical"?"normal":"pre",wordBreak:o==="vertical"?"break-all":void 0,...l?u==="subtle"?{background:w,border:"none"}:{background:v,border:`${m} solid ${C}`}:{}},...Array.isArray(T)?T:T?[T]:[]]),[l,o,d,p.radius.full,p.radius.sm,P,u,w,v,m,C,T]),M=useMemo(()=>jsx("div",{className:"plainframe-ui-divider-stroke",css:[S,I]}),[S,I]);return o==="vertical"?jsxs("div",{ref:g,"data-direction":"vertical","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper","is-vertical",x||""].join(" ").trim(),css:O,...R,children:[t&&r!=="top"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="bottom"&&M,!t&&M]}):jsxs("div",{ref:g,"data-direction":"horizontal","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper",x||""].join(" ").trim(),css:O,...R,children:[t&&r!=="left"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="right"&&M,!t&&M]})}));var ml=me.createContext(null),fl=()=>{let e=useContext(ml);if(!e)throw new Error("Drawer components must be used within <Drawer>.");return e},gl=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,c]=useState(!!n),i=t??a,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]),u=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(ml.Provider,{value:u,children:e})},Zp=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=fl(),c=!!e&&me.isValidElement(t),i=useCallback(u=>{if(c){let d;me.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||a(true);},[c,t,r.onClick,a]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(true)),c){let d;me.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,a]);if(c){let u=t,d=u.props.css;return me.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),onClick:i,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,onClick:i,onKeyDown:l,...r,children:t})});Zp.displayName="DrawerTrigger";var To=0,bl="",hl="",Qp=()=>typeof window>"u"?0:window.innerWidth-document.documentElement.clientWidth;function em(){if(!(typeof document>"u")){if(To===0){let e=document.body;bl=e.style.overflow||"",hl=e.style.paddingRight||"";let t=Qp();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}To+=1;}}function tm(){if(!(typeof document>"u")&&(To>0&&(To-=1),To===0)){let e=document.body;e.style.overflow=bl,e.style.paddingRight=hl;}}var nm=(e,t=0)=>e==null?t:typeof e=="number"?e:parseFloat(String(e))||t,yl=forwardRef(function({children:t,width:n,height:o,position:r="left",variant:s="inset",margin:a=10,radius:c,backdropBlur:i=true,backdropBlurDepth:l,closeOnClickAway:u=true,transitionMs:d,snapClosePct:y=.33,velocityClosePxS:f=950,dragElasticOut:T=.2,className:I,css:x,...R},g){let p=V(),{open:m,setOpen:C,lockScroll:P,closeOnEscape:w}=fl();useEffect(()=>{if(!(!P||!m))return em(),()=>tm()},[m,P]);let v=useMemo(()=>nm(a,0),[a]),N=useMemo(()=>r==="left"||r==="right"?"x":"y",[r]),B=useMemo(()=>r==="left"||r==="top"?-1:1,[r]),K=useMemo(()=>n??(r==="left"||r==="right"?320:s==="inset"?`calc(100% - ${v*2}px)`:"100%"),[n,r,s,v]),O=useMemo(()=>o??(r==="top"||r==="bottom"?420:s==="inset"?`calc(100% - ${v*2}px)`:"100%"),[o,r,s,v]),S=useMemo(()=>{let q=String(p.radius.lg);switch(r){case "left":return `0 ${q} ${q} 0`;case "right":return `${q} 0 0 ${q}`;case "top":return `0 0 ${q} ${q}`;default:return `${q} ${q} 0 0`}},[r,p.radius.lg]),F=useMemo(()=>c??(s==="inset"?p.radius.lg:S),[c,s,p.radius.lg,S]),M=useMemo(()=>s==="inset"?{top:r==="bottom"?void 0:v,bottom:r==="top"?void 0:v,left:r==="right"?void 0:v,right:r==="left"?void 0:v}:{top:r==="bottom"?void 0:0,bottom:r==="top"?void 0:0,left:r==="right"?void 0:0,right:r==="left"?void 0:0},[s,r,v]),b=useRef(null),h=useCallback(()=>{let q=b.current;if(!q)return 1;let Y=q.getBoundingClientRect();return N==="x"?Y.width:Y.height},[N]),A=useMemo(()=>({type:"spring",stiffness:520,damping:40,mass:.7}),[]),D=useMemo(()=>({duration:(d??280)/1e3,ease:[.22,1,.36,1]}),[d]),L=useMemo(()=>B*1.1,[B]),k=useMemo(()=>N==="x"?{x:`${L*100}%`,y:0}:{y:`${L*100}%`,x:0},[N,L]),E=useMemo(()=>css({position:"fixed",zIndex:1100,...M,width:K,height:O,backgroundColor:p.surface.panelBg,borderRadius:F,overflowY:"auto",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",willChange:"transform, box-shadow, opacity",backfaceVisibility:"hidden",pointerEvents:m?"auto":"none",touchAction:N==="x"?"pan-y":"pan-x","@media (prefers-reduced-motion: reduce)":{transition:"none"}}),[M,K,O,p.surface,F,m,N]),W=useMemo(()=>css({position:"fixed",inset:0,zIndex:1099,background:p.surface.overlayBg,transition:"all .3s ease",...i?{backdropFilter:`blur(${l??"2px"})`}:null}),[i,l,p.surface]),$=useCallback(()=>{u&&C(false);},[u,C]),z=useMemo(()=>N==="x"?{left:B===-1?T:0,right:B===1?T:0}:{top:B===-1?T:0,bottom:B===1?T:0},[N,B,T]),_=useMemo(()=>N==="x"?{left:0,right:0}:{top:0,bottom:0},[N]),H=useMemo(()=>Math.max(0,Math.min(1,y)),[y]),U=useCallback((q,Y)=>{let le=N==="x"?Y.offset.x:Y.offset.y,ie=N==="x"?Y.velocity.x:Y.velocity.y,be=B*le>0,Pe=Math.abs(le)>=h()*H,Re=B*ie>f;be&&(Pe||Re)&&C(false);},[N,B,h,H,f,C]),X=useRef(null);useEffect(()=>{if(!m)return;X.current=document.activeElement;let q=setTimeout(()=>{let ie=b.current;if(!ie)return;let be=ie.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');be.length>0?be[0].focus():ie.focus();},100),Y=ie=>{let be=b.current;if(!be||!ie.target)return;let Pe=ie.target;if(!be.contains(Pe)){ie.preventDefault();let Re=be.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');Re.length>0?Re[0].focus():be.focus();}},le=ie=>{ie.key==="Escape"&&w&&(ie.stopPropagation(),C(false));};return document.addEventListener("focusin",Y,true),window.addEventListener("keydown",le),()=>{clearTimeout(q),document.removeEventListener("focusin",Y,true),window.removeEventListener("keydown",le),X.current&&typeof X.current.focus=="function"&&X.current.focus();}},[m,C,w]);let{...ae}=R;return jsx(AnimatePresence,{children:m?jsxs(Fragment,{children:[jsx(motion.div,{role:"presentation","aria-hidden":true,css:W,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:d?D:{duration:.18,ease:"linear"},onClick:$},"overlay"),jsx(motion.div,{ref:q=>{b.current=q,typeof g=="function"?g(q):g&&(g.current=q);},role:"dialog","aria-modal":"true",tabIndex:-1,"data-position":r,"data-variant":s,className:["plainframe-ui-drawer",I||""].join(" ").trim(),css:[E,x],drag:N,dragConstraints:_,dragElastic:z,dragMomentum:false,dragDirectionLock:true,onDragEnd:U,initial:{...k,opacity:.98},animate:{x:0,y:0,opacity:1},exit:{...k,opacity:.98},transition:d?D:A,...ae,children:t},"panel")]}):null})});yl.displayName="DrawerContent";var om=forwardRef(function({open:t,on:n,defaultOpen:o,defaultOn:r,onOpenChange:s,onClose:a,children:c,...i},l){let u=t!==void 0?t:n,d=o!==void 0?o:r,y=u!==void 0,[f,T]=useState(!!d),I=y?!!u:f,x=useCallback(R=>{y||T(R),R||a?.(),s?.(R);},[y,a,s]);return jsx(gl,{open:I,onOpenChange:x,children:jsx(yl,{ref:l,...i,children:c})})});om.displayName="DrawerLegacy";var Ws=({children:e,duration:t=300,delay:n=0,on:o=false,onAnimationEnd:r,asChild:s=false,className:a,blur:c=false})=>{let i={opacity:o?1:0,filter:c?o?"none":"blur(10px)":"none",transition:`opacity ${t}ms ease ${n}ms, filter ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"opacity, filter",backfaceVisibility:"hidden"},l=d=>y=>{y.target===y.currentTarget&&(y.propertyName==="opacity"||y.propertyName==="filter")&&r?.(),d?.(y);};if(s&&isValidElement(e)){let d=e,y=d.props.css,f=Array.isArray(y)?[...y,i]:y?[y,i]:[i],T=["plainframe-ui-transition-fade",d.props.className||"",a||""].join(" ").trim(),I=d.props.onTransitionEnd;return cloneElement(d,{...d.props,css:f,className:T,onTransitionEnd:l(I)})}let u=css(i);return jsx("div",{className:["plainframe-ui-transition-fade",a||""].join(" ").trim(),css:u,onTransitionEnd:l(),children:e})};var xl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,vl=me.memo(({direction:e="row",gap:t="sm",justify:n,align:o="center",className:r,css:s,children:a,width:c,height:i,...l})=>{let u=V(),d=e==="vertical"||e==="column"?"column":"row",y=t===void 0?void 0:typeof t=="number"?t:u.spacing[t]??t,f=css({display:"flex",flexDirection:d,gap:y,justifyContent:n,alignItems:o,maxWidth:xl(c),width:c?"100%":void 0,maxHeight:xl(i),height:i?"100%":void 0,boxSizing:"border-box"});return jsx("div",{className:["plainframe-ui-flex",r||""].join(" ").trim(),css:[f,s],...l,children:a})});vl.displayName="Flex";var Ks=({children:e,duration:t=300,delay:n=0,on:o=false,initialScale:r=0,finalScale:s=1,onAnimationEnd:a,asChild:c=false,className:i})=>{let l={transform:o?`scale(${s})`:`scale(${r})`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},u=y=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),y?.(f);};if(c&&isValidElement(e)){let y=e,f=y.props.css,T=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=y.props.onTransitionEnd,x=["plainframe-ui-transition-grow",y.props.className||"",i||""].join(" ").trim();return cloneElement(y,{...y.props,css:T,className:x,onTransitionEnd:u(I)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-grow",i||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Cl={h1:{size:"2.25rem",weight:800,lh:1.1,ls:"-0.02em"},h2:{size:"1.875rem",weight:700,lh:1.15,ls:"-0.01em"},h3:{size:"1.5rem",weight:600,lh:1.2,ls:"-0.005em"},h4:{size:"1.25rem",weight:500,lh:1.2,ls:"0"},h5:{size:"1.125rem",weight:500,lh:1.3,ls:"0"},h6:{size:"1rem",weight:500,lh:1.3,ls:"0"},body:{size:"sm",weight:400,lh:1.4,ls:"0"},caption:{size:"xs",weight:400,lh:1.4,ls:"0.01em"}},ym=e=>e==null?void 0:typeof e=="number"?`${e}px`:String(e),xm={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",body:"span",caption:"span"},Un=me.memo(({variant:e="body",children:t,color:n,size:o,weight:r,lineHeight:s,letterSpacing:a,align:c="left",textTransform:i="none",whiteSpace:l="normal",decoration:u="none",decorationStyle:d="solid",decorationThickness:y=1,decorationColor:f,italic:T,className:I,style:x,as:R})=>{let g=V(),p=Cl[e]??Cl.body,m=R??xm[e]??"span",C=F=>F==null?p.size:typeof F=="number"?F:g?.typography?.sizes?.[F]??F,P=C(o)??C(p.size),w=r??p.weight,v=s??p.lh,N=a??p.ls,B=n==="secondary"?g.text.secondary:n==="primary"?g.text.primary:n??"inherit",K=f??g.surface.border,O=css({boxSizing:"border-box",display:c==="left"?"inline":"block",textAlign:c==="left"?void 0:c,fontFamily:g?.typography?.fonts?.sans||"inherit",fontSize:P,fontWeight:w,lineHeight:v,letterSpacing:N,color:B,textTransform:i,whiteSpace:l,fontStyle:T?"italic":"normal",margin:0,padding:0}),S=u==="none"?css({textDecoration:"none"}):css({textDecorationLine:u,textDecorationStyle:d,textDecorationColor:K,textDecorationThickness:ym(y),textDecorationSkipInk:"auto"});return jsx(m,{className:[`pfui-typo-${e}`,I||""].join(" ").trim(),css:[O,S],style:x,"data-variant":e,children:t})});Un.displayName="Typography";var Us=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Rm=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Us(typeof n=="number"||typeof n=="string"?n:e)}return e}}},Tl=forwardRef(function({src:t,alt:n="",width:o,height:r,radius:s="md",shadow:a=false,hoverEffect:c="none",label:i,labelAlign:l="center",aspectRatio:u,loading:d="lazy",decoding:y="async",fetchPriority:f,srcSet:T,sizes:I,placeholder:x,blurDataURL:R,placeholderColor:g="#f1f1f1",fallbackSrc:p,className:m,css:C,onClick:P,onLoad:w,onError:v,...N},B){let[K,O]=useState(false),[S,F]=useState(false),[M,b]=useState(false),h=V(),A=Rm(s,h)??"0px",D=i?"figure":"div",L=css({display:"flex",flexDirection:"column",gap:i?h.spacing.xs:0,width:"fit-content",borderRadius:`var(--pfui-image-radius, ${A})`}),k=css({position:"relative",borderRadius:`var(--pfui-image-radius, ${A})`,maxWidth:o?Us(o):"100%",maxHeight:r?Us(r):void 0,width:o?"100%":void 0,height:r?"100%":void 0,aspectRatio:u,boxShadow:a?"0 12px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.04)":"none",overflow:"hidden",padding:0,lineHeight:0,transition:"transform 0.3s ease",willChange:"transform",transform:K&&(c==="rotate"||c==="scale-rotate")?"rotate(3deg)":"none",cursor:P?"pointer":void 0}),E=css({position:"absolute",inset:0,background:x==="color"?g:void 0,backgroundImage:x==="blur"&&R?`url(${R})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:x==="blur"?"blur(8px)":void 0,transition:"opacity 0.3s ease",opacity:M?0:1,pointerEvents:"none"}),W=css({width:"100%",height:"100%",display:"block",objectFit:"cover",transform:K&&(c==="scale"||c==="scale-rotate")?"scale(1.08)":"none",transition:"transform 0.3s ease",willChange:"transform"});return jsxs(D,{className:["plainframe-ui-image",m||""].join(" ").trim(),css:[L,C],tabIndex:-1,children:[jsxs("div",{className:"plainframe-ui-image-frame",css:k,onMouseEnter:()=>O(true),onMouseLeave:()=>O(false),onClick:P,children:[!M&&x&&jsx("div",{"aria-hidden":true,className:"plainframe-ui-image-placeholder",css:E}),jsx("img",{ref:B,className:"plainframe-ui-image-img",css:W,src:S&&p?p:t,alt:n,srcSet:T,sizes:I,loading:d,decoding:y,fetchPriority:f,onLoad:$=>{b(true),w?.($);},onError:$=>{F(true),v?.($);},...N})]}),i&&jsx(Un,{as:"figcaption",variant:"caption",align:l,children:i})]})});Tl.displayName="Image";var wl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,km=e=>{if(typeof e=="number"&&isFinite(e)&&e>0)return e;if(typeof e=="string"){let t=e.trim().match(/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/);if(t){let o=parseFloat(t[1]),r=parseFloat(t[2]);if(o>0&&r>0)return o/r}let n=parseFloat(e);if(isFinite(n)&&n>0)return n}},Im=e=>e*Math.PI/180,Sm=(e,t,n)=>{let o=Math.abs(Im(n)),r=Math.cos(o),s=Math.sin(o);return {w:Math.abs(e*r)+Math.abs(t*s),h:Math.abs(t*r)+Math.abs(e*s)}};function Mm(e,t){if(t<=1){let r={ang:[0],dx:[0],dy:[0]};return {base:r,exp:r}}return e==="fan"?{base:t===2?{ang:[-14,10],dx:[-40,24],dy:[0,0]}:{ang:[-14,0,14],dx:[-55,0,55],dy:[-7.5,0,-7.5]},exp:t===2?{ang:[-7,5],dx:[-20,12],dy:[0,0]}:{ang:[-7,0,7],dx:[-32.5,0,32.5],dy:[0,0,0]}}:e==="slide"?{base:t===2?{ang:[-20,3],dx:[-10,5],dy:[-2,0]}:{ang:[-20,-5,10],dx:[-35,-10,12],dy:[4,0,4]},exp:t===2?{ang:[-10,1.5],dx:[-10,5],dy:[-2,0]}:{ang:[-10,-2.5,5],dx:[-30.5,-7.5,6],dy:[4,0,4]}}:e==="domino"?{base:t===2?{ang:[0,0],dx:[0,0],dy:[-11,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-18,-5,6]},exp:t===2?{ang:[0,0],dx:[0,0],dy:[-5,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-14,-2.5,7]}}:{base:t===2?{ang:[-4,8],dx:[-22,18],dy:[-30,40]}:{ang:[-10,10,.5],dx:[-30,30,-15],dy:[-65,2,65]},exp:t===2?{ang:[-3,6],dx:[-11,9],dy:[-22.5,30]}:{ang:[-7.5,7.5,.35],dx:[-15,20,-10.5],dy:[-55.5,2,55.5]}}}var Fm=(e,t,n)=>e==="fan"?t===2?[.9,1.08][n]??1:[.8,1,.8][n]??1:e==="slide"?t===2?[.8,1][n]??1:[.7,.85,1][n]??1:e==="domino"?t===2?[.9,1][n]??1:[.85,.95,1][n]??1:1,El=[1.02,1.03,1.02],kl=[1.06,1.08,1.06],Am={sm:150,md:200,lg:260,xl:340},Pm=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Nm(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Pm(typeof n=="number"||typeof n=="string"?n:e)}return e}}}var Dm=memo(function({children:t,variant:n="fan",width:o,aspectRatio:r="4/5",size:s="md",hoverEffect:a="none",hovering:c,maxItems:i=3,shadow:l=false,cursor:u,outline:d,outlineColor:y,outlineWidth:f=3,outlineOffset:T=0,radius:I="md",label:x,labelAlign:R="center",css:g,className:p,...m}){let C=V(),P=km(r)??4/5,w=typeof o=="string"?o:void 0,v=typeof o=="number"?o:w&&/px$/.test(w)?parseFloat(w):Am[s],N=Math.max(1,v/P),K=Children.toArray(t).filter(isValidElement).slice(0,i),O=K.length,S=Mm(n,O),F=K.map((q,Y)=>Fm(n,O,Y)),M=q=>N*.6*F[q],b=q=>M(q)*P,h=0,A=0;for(let q=0;q<O;q++){let Y=b(q),le=M(q),ie=Math.max(Math.abs(S.base.ang[q]??0),Math.abs(S.exp.ang[q]??0)),be=Math.max(Math.abs(S.base.dx[q]??0),Math.abs(S.exp.dx[q]??0)),Pe=Math.max(Math.abs(S.base.dy[q]??0),Math.abs(S.exp.dy[q]??0)),Re=a==="expand"?kl[q]??1.08:a==="reveal"?El[q]??1.03:1,Ce=Sm(Y,le,ie),Ie=Ce.w*Re,Te=Ce.h*Re,we=be/100*Y*Re,he=Pe/100*le*Re;h=Math.max(h,Ie/2+we),A=Math.max(A,Te/2+he);}let D=Math.max(1,2*h),L=Math.max(1,2*A),k=Math.min(1,v/D,N/L),E=c===void 0?"pointer":"controlled",W=c?"true":void 0,$=css({display:"flex",flexDirection:"column",cursor:u||"auto",lineHeight:0,position:"relative",isolation:"isolate",gap:x?C.spacing.xs:0}),z=css({position:"relative",width:wl(typeof o=="number"?o:v)??(typeof o=="string"?o:void 0),height:wl(N)}),_=css({position:"absolute",inset:0,left:"50%",top:"50%",width:`${D}px`,height:`${L}px`,transform:`translate(-50%, -50%) scale(${k})`,transformOrigin:"center center"}),H=Nm(I,C)??"0px",U=q=>{let Y=n==="fan"?`rotate(${S.base.ang[q]}deg) translate(${S.base.dx[q]}%, ${S.base.dy[q]}%)`:n==="slide"?`translate(${S.base.dx[q]}%, ${S.base.dy[q]}%) rotate(${S.base.ang[q]}deg)`:n==="domino"?`translate(0%, ${S.base.dy[q]}%)`:`translate(${S.base.dx[q]}%, ${S.base.dy[q]}%) rotate(${S.base.ang[q]}deg)`,le=n==="fan"?`rotate(${S.exp.ang[q]}deg) translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%)`:n==="slide"?`translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%) rotate(${S.exp.ang[q]}deg)`:n==="domino"?`translate(0%, ${S.exp.dy[q]}%)`:`translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%) rotate(${S.exp.ang[q]}deg)`,ie=a==="reveal"?"translate(0,0) rotate(0) scale(1)":`${Y} scale(1)`,be=a==="expand"?`${le} scale(${kl[q]??1.06})`:a==="reveal"?`${Y} scale(${El[q]??1.03})`:`${Y} scale(1)`;return css({position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) ${ie}`,transition:"transform .22s ease",willChange:"transform",backfaceVisibility:"hidden",zIndex:n==="fan"&&q===1?10:q+1,lineHeight:0,boxShadow:l?"rgba(0,0,0,.12) 0 8px 20px":"none",outline:d?`${f}px solid ${y??C.surface.appBg}`:void 0,outlineOffset:d?T:void 0,pointerEvents:"auto",".plainframe-ui-image-stack-wrapper[data-hover-mode='pointer']:hover &":{transform:`translate(-50%, -50%) ${be}`},".plainframe-ui-image-stack-wrapper[data-hover-mode='controlled'][data-hovered='true'] &":{transform:`translate(-50%, -50%) ${be}`}})},X=q=>css({width:`${b(q)}px`,aspectRatio:`${P}`,position:"relative",overflow:"hidden",borderRadius:H,"--pfui-image-radius":H,"& > *":{position:"absolute",inset:"0",width:"100% !important",height:"100% !important",maxWidth:"none !important",maxHeight:"none !important",display:"block"},"& img, & picture img, & video, & canvas":{width:"100% !important",height:"100% !important",objectFit:"cover",display:"block"}});return jsxs(x?"figure":"div",{className:["plainframe-ui-image-stack-wrapper",p||""].join(" ").trim(),"data-hover-mode":E,"data-hovered":W,css:[$,g],tabIndex:-1,...m,children:[jsx("div",{className:"plainframe-ui-image-stack",css:z,children:jsx("div",{className:"plainframe-ui-image-stack-stage",css:_,children:K.map((q,Y)=>jsx("div",{className:"plainframe-ui-image-stack-item",css:U(Y),children:jsx("div",{className:"plainframe-ui-image-stack-frame",css:X(Y),children:q})},Y))})}),x&&jsx(Un,{as:"figcaption",variant:"caption",align:R,children:x})]})});var Il=e=>typeof e=="number"?`${e}px`:e,Sl={sm:{h:20,px:6,font:10},md:{h:24,px:7,font:12},lg:{h:28,px:8,font:14}};function Bm(e,t){if(e==null){let n=t.radius?.xs??t.radius?.sm??3;return Il(n)}if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius?.[e]??t.radii?.[e];if(n!=null)return Il(n)}return e}function $m(e){if(typeof e!="string")return false;let t=e.trim();return !(!t||t.length>4||/[A-Za-z0-9]/.test(t))}var zm=forwardRef(function({children:t,variant:n="outlined",size:o="sm",radius:r,mono:s=true,uppercase:a=false,symbolBoost:c=2,css:i,className:l="plainframe-ui-kbd",...u},d){let y=V(),f=xe(),T=Sl[o]??Sl.sm,I=Bm(r,y),x={br:y.neutral[300],txt:y.neutral[800],inset:y.neutral[0]},R=css({all:"unset",boxSizing:"border-box",display:"inline-flex !important",alignItems:"center",justifyContent:"center",minHeight:n==="ghost"?void 0:`${T.h}px !important`,paddingInline:n==="ghost"?0:`${T.px}px !important`,paddingBlock:"0 !important",fontFamily:s?y.typography.fonts.mono:"inherit",fontSize:`${T.font}px !important`,fontWeight:600,letterSpacing:.2,textTransform:a?"uppercase":"none",borderRadius:I,userSelect:"none",verticalAlign:"baseline",position:"relative",outline:"none"}),g=css({"&&":{background:y.surface.subtleBg,border:"none",boxShadow:"none",color:x.txt}}),p=css({"&&":{background:"transparent",color:x.txt,border:"none",boxShadow:"none"}}),m=css({"&&":{background:y.surface.panelBg,color:x.txt,border:`1px solid ${x.br}`,boxShadow:`inset 0 1px 0 ${x.inset}AA, 0 1px 0 rgba(0,0,0,0.03)`}}),C=n==="subtle"?g:n==="ghost"?p:m,w=s&&c>0&&$m(t)?jsx("span",{css:css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:`${T.font+c}px`,lineHeight:1}),children:t}):t;return jsx("kbd",{ref:d,className:l,css:[f(),R,C,i],...u,children:w})});var _m=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,qs=({children:e,direction:t="up",duration:n=450,delay:o=0,on:r=false,onAnimationEnd:s,asChild:a=false,className:c,distance:i})=>{let u=_m(i,t==="left"||t==="right"?"100vw":"100vh"),d=t==="left"?`-${u}`:t==="right"?u:"0",y=t==="up"?u:t==="down"?`-${u}`:"0",f={transform:r?"translate3d(0,0,0)":`translate3d(${d}, ${y}, 0)`,transition:`transform ${n}ms ease ${o}ms`,pointerEvents:r?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},T=x=>R=>{R.target===R.currentTarget&&R.propertyName==="transform"&&s?.(),x?.(R);};if(a&&isValidElement(e)){let x=e,R=x.props.css,g=Array.isArray(R)?[...R,f]:R?[R,f]:[f],p=["plainframe-ui-transition-slide",x.props.className||"",c||""].join(" ").trim(),m=x.props.onTransitionEnd;return cloneElement(x,{...x.props,css:g,className:p,onTransitionEnd:T(m)})}let I=css(f);return jsx("div",{className:["plainframe-ui-transition-slide",c||""].join(" ").trim(),css:I,onTransitionEnd:T(),children:e})};var Gs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Pl=me.createContext(null),Nl=()=>{let e=useContext(Pl);if(!e)throw new Error("Modal components must be used within <Modal>.");return e},Xm=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,c]=useState(!!n),i=t??a,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]);useEffect(()=>{if(!i||!s)return;let d=y=>{y.key==="Escape"&&(y.stopPropagation(),l(false));};return window.addEventListener("keydown",d,true),()=>window.removeEventListener("keydown",d,true)},[i,s,l]);let u=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(Pl.Provider,{value:u,children:e})},Dl=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=Nl(),c=!!e&&me.isValidElement(t),i=useCallback(u=>{if(c){let d;me.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||a(true);},[c,t,r.onClick,a]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(true)),c){let d;me.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,a]);if(c){let u=t,d=u.props.css;return me.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),"aria-haspopup":"dialog",onClick:i,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,"aria-haspopup":"dialog",onClick:i,onKeyDown:l,...r,children:t})});Dl.displayName="ModalTrigger";var Hl=forwardRef(({children:e,variant:t="inset",width:n=500,height:o="auto",radius:r="lg",padding:s="lg",backdrop:a=true,backdropBlur:c=true,backdropBlurDepth:i=5,closeOnClickAway:l=true,transitionVariant:u="fade",direction:d="up",transitionDuration:y=300,containerCss:f,backdropCss:T,className:I,...x},R)=>{let g=V(),{open:p,setOpen:m,lockScroll:C}=Nl(),P=me.useRef(null),w=me.useRef(null);me.useEffect(()=>{if(!p)return;w.current=document.activeElement;let S=setTimeout(()=>{let M=P.current;if(!M)return;let b=M.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');b.length>0?b[0].focus():M.focus();},100),F=M=>{let b=P.current;if(!b||!M.target)return;let h=M.target;if(!b.contains(h)){M.preventDefault();let A=b.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');A.length>0?A[0].focus():b.focus();}};return document.addEventListener("focusin",F,true),()=>{clearTimeout(S),document.removeEventListener("focusin",F,true),w.current&&typeof w.current.focus=="function"&&w.current.focus();}},[p]);let v=typeof g.spacing.sm=="number"?`${g.spacing.sm}px`:String(g.spacing.sm),N=css({width:"100%",height:Gs(o),maxWidth:t==="inset"?`min(${Gs(n)||"100%"}, calc(100% - ${v} * 2))`:Gs(n),maxHeight:t==="inset"?`calc(100% - ${v} * 2)`:"100%",margin:t==="inset"?v:void 0}),B=jsx(_n,{role:"dialog","aria-modal":"true",tabIndex:-1,className:["plainframe-ui-modal",I||""].join(" ").trim(),padding:s,radius:r,variant:"panel",css:[N,f],ref:S=>{P.current=S,typeof R=="function"?R(S):R&&(R.current=S);},...x,children:e}),K=u==="none"?B:u==="slide"?jsx(qs,{on:p,direction:d,duration:y,children:B}):u==="grow"?jsx(Ks,{initialScale:.75,on:p,duration:y,children:B}):jsx(Ws,{on:p,duration:y,children:B});if(!a)return jsx(Fragment,{children:K});let O=css(t==="full"?{alignItems:"start",justifyItems:"start",justifyContent:"start"}:{alignItems:"center",justifyItems:"center",justifyContent:"center"});return jsx(Es,{on:p,blur:c,blurDepth:i,onClickAway:l?()=>m(false):void 0,css:[O,T].filter(Boolean),contentCss:O,lockScroll:C,children:K})});Hl.displayName="ModalContent";var of=({count:e,page:t,defaultPage:n=1,onChange:o,siblingCount:r=1,boundaryCount:s=1,disabled:a=false,showFirstLast:c=false,loop:i=false,variant:l="subtle",gap:u,className:d,css:y})=>{let f=V(),T=xe(),I=t!==void 0,[x,R]=useState(n),g=Math.max(1,e),p=Sr(I?t:x,1,g),m=useCallback(k=>{let E=Sr(k,1,g);I||R(E),o?.(E);},[I,g,o]),C=useMemo(()=>rf({count:g,page:p,siblingCount:r,boundaryCount:s}),[g,p,r,s]),P=f.palette?.primary?.[600],w=f.surface?.border,v=l==="subtle"?f.surface.subtleHover:l==="ghost"?f.surface?.subtleBg:f.surface.panelHover,N=f.text?.primary??"#111",B=l==="subtle"?f.surface?.subtleBg:"transparent",K=css({display:"inline-flex",alignItems:"center",gap:u??6,flexWrap:"wrap",borderRadius:f.radius?.md,background:B,padding:l==="subtle"?f.spacing.xs:0,userSelect:"none"},...Array.isArray(y)?y:y?[y]:[]),O=css({minWidth:28,height:28,padding:"0 10px",borderRadius:f.radius.sm,fontSize:13,lineHeight:1,border:"1px solid transparent",background:"transparent",color:N,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:a?"not-allowed":"pointer",outline:"none",transition:"all .16s ease !important","&[aria-disabled='true']":{opacity:.55,pointerEvents:"none",cursor:"not-allowed"},fontWeight:600}),S=css({width:28,minWidth:28,height:28,padding:0}),F=(k=false)=>css([O,T({color:k?"primary":"neutral"}),l==="outlined"?k?{background:P,color:f.text.onColors.primary,borderColor:P}:{background:"transparent",borderColor:w,":hover":{background:v}}:l==="ghost"?k?{background:P,color:f.text.onColors.primary}:{":hover":{background:v}}:k?{background:P,color:f.text.onColors.primary,borderColor:P}:{":hover":{background:v}}]),M=useCallback(()=>m(1),[m]),b=useCallback(()=>m(g),[m,g]),h=useCallback(()=>{p===1?i&&m(g):m(p-1);},[p,i,g,m]),A=useCallback(()=>{p===g?i&&m(1):m(p+1);},[p,i,g,m]),D=a||p===1&&!i,L=a||p===g&&!i;return jsxs("nav",{"aria-label":"Pagination",className:["plainframe-ui-pagination",d||""].join(" ").trim(),css:K,onKeyDown:k=>{a||(k.key==="ArrowLeft"&&(k.preventDefault(),h()),k.key==="ArrowRight"&&(k.preventDefault(),A()),k.key==="Home"&&(k.preventDefault(),M()),k.key==="End"&&(k.preventDefault(),b()));},children:[c&&jsx("button",{className:"plainframe-ui-pagination-first-button",type:"button","aria-label":"First page","aria-disabled":D,disabled:D,css:[F(false),S],onClick:M,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronFirst,{strokeWidth:3,css:{width:14,height:14}})}),jsx("button",{className:"plainframe-ui-pagination-previous-button",type:"button","aria-label":"Previous page","aria-disabled":D,disabled:D,css:[F(false),S],onClick:h,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLeft,{strokeWidth:3,css:{width:14,height:14}})}),C.map((k,E)=>typeof k=="number"?jsx("button",{className:"plainframe-ui-pagination-page-button",type:"button","aria-label":k===p?`Page ${k}, current page`:`Go to page ${k}`,"aria-current":k===p?"page":void 0,css:F(k===p),onClick:()=>m(k),children:k},k):jsx("span",{className:"plainframe-ui-pagination-ellipsis","aria-hidden":true,css:css([O,T(),{borderColor:"transparent",cursor:"default",opacity:.8,padding:0,minWidth:28}]),children:"\u2026"},`e${E}`)),jsx("button",{className:"plainframe-ui-pagination-next-button",type:"button","aria-label":"Next page","aria-disabled":L,disabled:L,css:[F(false),S],onClick:A,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronRight,{strokeWidth:3,css:{width:14,height:14}})}),c&&jsx("button",{className:"plainframe-ui-pagination-last-button",type:"button","aria-label":"Last page","aria-disabled":L,disabled:L,css:[F(false),S],onClick:b,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLast,{strokeWidth:3,css:{width:14,height:14}})})]})};function Sr(e,t,n){return Math.max(t,Math.min(n,e))}function rf({count:e,page:t,siblingCount:n,boundaryCount:o}){if(e<=0)return [1];let r=2*o+2*n+3;if(e<=r)return Ir(1,e);let s=Ir(1,Math.min(o,e)),a=Ir(Math.max(e-o+1,o+1),e),c=Sr(t-n,o+2,Math.max(o+2,e-o-2*n-1)),i=Sr(t+n,Math.min(o+2+2*n,e-o-1),e-o-1),l=[],u=d=>{let y=l[l.length-1];y!==d&&(y==="ellipsis"&&d==="ellipsis"||l.push(d));};return s.forEach(u),c>o+2?u("ellipsis"):o+1<c&&u(o+1),Ir(c,i).forEach(u),i<e-o-1?u("ellipsis"):e-o>i&&u(e-o),a.forEach(u),l}function Ir(e,t){if(t<e)return [];let n=[];for(let o=e;o<=t;o++)n.push(o);return n}var cf=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,uf=me.memo(({children:e,direction:t="left",width:n,variant:o="solid",className:r,css:s})=>{let a=V(),c=a.surface.border,i=css({display:"inline-block",boxSizing:"border-box",maxWidth:cf(n,"fit-content"),width:"100%",padding:`0 ${a.spacing.md}`,borderLeft:t==="left"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none",borderRight:t==="right"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none"},...Array.isArray(s)?s:s?[s]:[]);return jsx("div",{className:r??"plainframe-ui-quote",css:i,children:e})});var zl=createContext(null),ff=()=>{let e=useContext(zl);if(!e)throw new Error("RadioItem must be used within a RadioGroup");return e},gf=e=>{let t=e?.horizontal??"left",n=e?.vertical??"center";return t==="center"&&n==="center"?{horizontal:"left",vertical:"center"}:{horizontal:t,vertical:n}},bf=({value:e,defaultValue:t,onChange:n,disabled:o=false,size:r="md",direction:s="horizontal",variant:a="filled",className:c,children:i,anchorOrigin:l,css:u})=>{let d=V(),y=e!==void 0&&n!==void 0,[f,T]=useState(t),I=y?e:f,x=useRef([]),[R,g]=useState(0),p=()=>g(F=>F+1),m=useCallback(F=>{y||T(F),n?.(F);},[y,n]),C=useCallback(F=>(x.current.push(F),p(),x.current.length-1),[]),P=useCallback((F,M)=>{let b=x.current[F];b&&(x.current[F]={...b,...M},p());},[]),w=()=>x.current.map((F,M)=>({it:F,i:M})).filter(({it:F})=>F.ref&&!F.disabled).map(({i:F})=>F),v=useCallback((F,M)=>{let b=w();if(!b.length)return;let h=Math.max(0,b.indexOf(F)),A=b[(h+M+b.length)%b.length],D=x.current[A]?.ref;if(D){D.focus();let L=x.current[A]?.value;L!==void 0&&m(L);}},[m]),N=useCallback(F=>{let M=w();if(!M.length)return;let b=F==="first"?M[0]:M[M.length-1],h=x.current[b]?.ref;if(h){h.focus();let A=x.current[b]?.value;A!==void 0&&m(A);}},[m]),B=useMemo(()=>{let F=x.current.filter(b=>b.ref&&!b.disabled);return F.length?F.some(b=>b.value===I)?I:F[0]?.value:void 0},[I,R]),K=useMemo(()=>({selected:I,setSelected:m,disabled:o,size:r,direction:s,variant:a,register:C,update:P,moveFocusBy:v,moveToEdge:N,focusValue:B,theme:d,anchorOrigin:gf(l)}),[I,m,o,r,s,a,C,P,v,N,B,d,l]),O=css({width:"fit-content"}),S=css({display:"flex",flexDirection:s==="vertical"?"column":"row",gap:d.spacing.sm,width:"fit-content",alignItems:s==="vertical"?"stretch":"center"});return jsx("div",{className:c??"plainframe-ui-radio-group",css:[O,u],children:jsx("div",{className:"plainframe-ui-radio-row",role:"radiogroup","aria-disabled":o||void 0,css:S,children:jsx(zl.Provider,{value:K,children:i})})})},hf=({value:e,disabled:t=false,className:n,children:o,css:r})=>{let{selected:s,setSelected:a,disabled:c,size:i,register:l,update:u,moveFocusBy:d,moveToEdge:y,theme:f,variant:T,focusValue:I,anchorOrigin:x}=ff(),R=c||t,g=s===e,p=["sm","md","lg"].includes(i)?i:"md",m=p==="sm"?16:p==="lg"?24:20,C=z=>f.palette?.primary?.[z],P=C(600),w=C(100),v=f.neutral[300],N=f.palette.primary[300],B=f.text.onColors?.primary??f.neutral[0],K="transparent",O=N,S=B;T==="soft"?(K=w,O=null,S=P):T==="outlined"?(K=C(50),O=N,S=P):(K=f.neutral[200],O="transparent",S=B),g&&(T==="outlined"?(K=w,O=N,S=P):T==="filled"?(K=P,O=null,S=B):(K=w,O=null,S=P));let F=T==="filled"?v:f.palette.primary[100],M=useRef(null),b=useRef(-1);useEffect(()=>{b.current=l({ref:M.current,value:e,disabled:!!R});},[l]),useEffect(()=>{u(b.current,{ref:M.current,value:e,disabled:!!R});},[u,R,e]);let h=css({border:"none",background:"transparent",display:"inline-grid",gridTemplateColumns:"auto auto auto",gridTemplateRows:"auto auto auto",columnGap:x.vertical==="center"?f.spacing.sm:0,rowGap:x.vertical==="center"?0:f.spacing.xs,justifyItems:"center",alignItems:"center",opacity:R?.5:1,borderRadius:f.radius.md,cursor:R?"not-allowed":"pointer",transition:"transform .16s ease",fontSize:f.typography.sizes.sm,fontWeight:500,padding:f.spacing.sm,"&:hover .plainframe-ui-radio-circle-outer":R||g?{}:{background:F,boxShadow:T==="outlined"?`inset 0 0 0 ${f.componentHeights.border} ${N}`:"none"},"&:focus-visible .plainframe-ui-radio-circle-outer":{outline:"none"}}),A=css({width:m,height:m,minWidth:m,minHeight:m,borderRadius:f.radius.full,background:K,boxShadow:O?`inset 0 0 0 ${f.componentHeights.border} ${O}`:"none",transition:"background-color .16s ease, box-shadow .16s ease, filter .16s ease",display:"inline-flex",alignItems:"center",justifyContent:"center"}),D=css({width:g?m*.45:0,height:g?m*.45:0,borderRadius:f.radius.full,background:g?S:"transparent",transition:"all 250ms cubic-bezier(.72,1.6,.32,1)",transform:g?"scale(1)":"scale(0.6)",opacity:g?1:0}),L=css({gridColumn:2,gridRow:2,minWidth:0,maxWidth:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",textAlign:"left"}),k=(()=>{let z=x.horizontal,_=x.vertical;return _==="center"?{col:z==="right"?3:1,row:2}:{col:2,row:_==="top"?1:3}})(),W=!R&&I===e?0:-1,$=xe();return jsxs("button",{ref:M,className:n??"plainframe-ui-radio-item",type:"button",role:"radio","aria-checked":g,"aria-disabled":R||void 0,disabled:R,tabIndex:W,onClick:()=>{R||a(e);},onKeyDown:z=>{R||(z.key==="Enter"||z.key===" "?(z.preventDefault(),a(e)):z.key==="ArrowRight"||z.key==="ArrowDown"?(z.preventDefault(),d(b.current,1)):z.key==="ArrowLeft"||z.key==="ArrowUp"?(z.preventDefault(),d(b.current,-1)):z.key==="Home"?(z.preventDefault(),y("first")):z.key==="End"&&(z.preventDefault(),y("last")));},css:[h,$({color:"primary"}),r],children:[jsx("span",{className:"plainframe-ui-radio-circle-outer",css:[A,css({gridColumn:k.col,gridRow:k.row})],children:jsx("span",{className:"plainframe-ui-radio-circle-dot",css:D})}),o!=null&&jsx("span",{className:"plainframe-ui-radio-label",css:L,children:o})]})};var Rf=({children:e,duration:t=400,delay:n=0,on:o=false,initialAngle:r=360,finalAngle:s=0,onAnimationEnd:a,asChild:c=false,className:i})=>{let l={transform:`rotate(${o?s:r}deg)`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",transformOrigin:"center center",willChange:"transform",backfaceVisibility:"hidden"},u=y=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),y?.(f);};if(c&&isValidElement(e)){let y=e,f=y.props.css,T=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=["plainframe-ui-transition-rotate",y.props.className||"",i||""].join(" ").trim(),x=y.props.onTransitionEnd;return cloneElement(y,{...y.props,css:T,className:I,onTransitionEnd:u(x)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-rotate",i||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Fo=(...e)=>e.filter(Boolean).flat(),Mr=e=>me.isValidElement(e),Ao=(e,t)=>{if(!Mr(e))return false;let n=e.type,o=(n?.displayName??n?.name??"")||"";return typeof o=="string"&&t.includes(o)},Ef=(e,t)=>{let n=e.props,o=n.value;if(typeof o<"u")return o;let r=n["data-value"];return typeof r<"u"?r:t};function kf({value:e,defaultValue:t,onChange:n,label:o,placeholder:r="Select\u2026",startIcon:s,endIcon:a,disabled:c,size:i="md",variant:l="subtle",fullWidth:u,width:d=200,menuAlign:y="left",menuWidth:f,menuMaxHeight:T=280,wrapperCss:I,labelCss:x,triggerCss:R,menuCss:g,optionCss:p,children:m,className:C,menuSize:P="md",triggerRender:w}){let v=V(),N=xe(),B=me.useId(),K=`${B}-label`,O=`${B}-menu`,S={sm:{minHeight:v.componentHeights.sm,radius:v.radius.sm},md:{minHeight:v.componentHeights.md,radius:v.radius.md},lg:{minHeight:v.componentHeights.lg,radius:v.radius.md}},F=S[i]||S.md,[M,b]=me.useState(false),h=j=>b(!!j),A=typeof e<"u",D=Array.isArray(e)||Array.isArray(t),[L,k]=me.useState(typeof t<"u"?t:D?[]:void 0),E=A?e:L,W=j=>{A||k(j),n?.(j);},$=me.Children.toArray(m).filter(Mr),z,_=[];for(let j of $)if(Ao(j,["MenuRadioGroup"]))z=j;else if(Ao(j,["MenuCheckboxGroup"])){let ue=j.props.children,de=ue?me.Children.toArray(ue).filter(Mr):[];_.push(...de);}else _.push(j);let U=(z?me.Children.toArray(z.props.children).filter(Mr):_).filter(j=>!Ao(j,["MenuLabel","MenuSeparator"])).map((j,ue)=>{let de=j.props,fe=Ef(j,ue),ze=de.children,Oe=de.label,st=typeof Oe=="string"||typeof Oe=="number"?String(Oe):typeof ze=="string"||typeof ze=="number"?String(ze):void 0,Ye=de.role??"",yt=Ao(j,["MenuCheckboxItem"]),tn=Ao(j,["MenuRadioItem"]),nn=yt||Ye==="menuitemcheckbox"||typeof de.onCheckedChange=="function"||typeof de.checked=="boolean"||typeof de.defaultChecked=="boolean",Sn=!nn&&(tn||Ye==="menuitemradio"||!!z),on=typeof de.children>"u"?st??String(fe):de.children;return {el:j,key:j.key??ue,value:fe,labelText:st,title:de.title,description:de.description,nodeForTrigger:on,disabled:!!de.disabled,className:de.className,itemCss:de.css,startIcon:de.startIcon,endIcon:de.endIcon,isCheckbox:nn,isRadio:Sn}}),X=U.some(j=>j.isCheckbox),ae=U.length>0&&U.every(j=>j.isRadio),Y=(D||X)&&!ae,le=me.useCallback(j=>Y?(Array.isArray(E)?E:[]).some(de=>Object.is(de,j)):Object.is(E,j),[E,Y]),ie=me.useMemo(()=>{if(Y){let ue=Array.isArray(E)?E:[];return U.filter(fe=>ue.some(ze=>Object.is(ze,fe.value))).map(fe=>typeof fe.nodeForTrigger=="string"||typeof fe.nodeForTrigger=="number"?String(fe.nodeForTrigger):fe.nodeForTrigger)}let j=U.find(ue=>Object.is(ue.value,E));if(j)return typeof j.nodeForTrigger=="string"||typeof j.nodeForTrigger=="number"?String(j.nodeForTrigger):j.nodeForTrigger},[E,Y,U]),be=j=>{c||(Object.is(j,E)||W(j),h(false));},Pe=j=>{c||Object.is(j,E)||W(j);},Re=j=>{if(c)return;let ue=Array.isArray(E)?E:[],fe=ue.some(ze=>Object.is(ze,j))?ue.filter(ze=>!Object.is(ze,j)):[...ue,j];W(fe);},Ce={position:"relative",width:u?"100%":typeof d=="number"?`${d}px`:d,maxWidth:"100%"},Ie={width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:F.radius,minHeight:F.minHeight,fontSize:v.typography.sizes.sm,padding:`0 ${typeof v.spacing.sm=="number"?`${v.spacing.sm}px`:v.spacing.sm} 0 ${typeof v.spacing.md=="number"?`${v.spacing.md}px`:v.spacing.md}`,fontWeight:500,lineHeight:1,userSelect:"none",cursor:c?"not-allowed":"pointer",border:"none",outline:"none",transition:"box-shadow .16s ease",color:v.text.primary,background:"transparent",whiteSpace:"nowrap"},Te=l==="subtle"?{background:v.surface.subtleBg}:l==="outlined"?{background:v.surface.panelBg,border:`1px solid ${v.surface.border}`}:{background:"transparent"},we={flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",textAlign:"left",gap:8},he={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},je={flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:500,display:"block"},Z=jsx(ChevronsUpDown,{size:16,css:css({color:v.text.secondary,flexShrink:0}),strokeWidth:2.5,className:"plainframe-ui-select-chevron"}),Ee=()=>{if(w)return w(ie);if(Array.isArray(ie)){let ue=ie.map(fe=>typeof fe=="string"?fe:"").filter(Boolean),de=ue.length?ue.join(", "):String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(he),children:s}),jsx("span",{css:css(je),title:de,children:de})]})}let j=ie??String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(he),children:s}),jsx("span",{css:css(je),title:typeof j=="string"?j:void 0,children:j})]})},Q={left:"start",center:"center",right:"end"},ee=j=>{c||(j.key==="ArrowDown"||j.key==="ArrowUp"||j.key==="Enter"||j.key===" ")&&(j.preventDefault(),h(true));},se={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",marginRight:8},pe={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",marginLeft:8},Se={flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2},Ne={fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"},J={fontSize:"0.875em",color:v.text.secondary,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400},oe=(j,ue)=>{let de=j.title||j.description?jsxs("span",{className:"plainframe-ui-select-option-content",css:css(Se),children:[jsx("span",{className:"plainframe-ui-select-option-title",css:css(Ne),children:j.title??ue}),j.description&&jsx("span",{className:"plainframe-ui-select-option-description",css:css(J),children:j.description})]}):jsx("span",{className:"plainframe-ui-select-option-text",css:css(Ne),children:ue});return jsxs(Fragment,{children:[j.startIcon&&jsx("span",{css:css(se),children:j.startIcon}),de,j.endIcon&&jsx("span",{css:css(pe),children:j.endIcon})]})},re=(j,ue)=>{let de=j.value,fe=le(de),ze=Fo(p,j.itemCss),Oe=j.el.props,st=typeof Oe.children>"u"?j.labelText??String(de):Oe.children;if(Y||j.isCheckbox)return me.cloneElement(j.el,{key:j.key??ue,disabled:c||j.disabled,checked:!!Oe.checked||fe,onCheckedChange:()=>Re(de),closeOnSelect:false,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)});if(j.isRadio)return me.cloneElement(j.el,{key:j.key??ue,value:de,disabled:c||j.disabled,closeOnSelect:false,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)});let Ye=yt=>{yt?.preventDefault?.(),be(de);};return me.cloneElement(j.el,{key:j.key??ue,role:"menuitem","aria-checked":void 0,"aria-selected":fe||void 0,"aria-disabled":c||j.disabled||void 0,disabled:c||j.disabled,closeOnSelect:true,onSelect:Ye,onClick:Ye,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)})},qe=(()=>{let j=!Y&&(z||U.length>0&&U.every(ue=>ue.isRadio));return z?me.cloneElement(z,{key:"controlled-inner-group",value:E,onValueChange:ue=>Pe(ue),children:U.map(re)}):j?jsx(lr,{value:E,onValueChange:ue=>Pe(ue),children:U.map(re)}):U.map(re)})();return jsxs("div",{css:Fo(Ce,I),className:["plainframe-ui-select-wrapper",C||""].join(" ").trim(),children:[o&&jsx("div",{id:K,className:"plainframe-ui-select-label",css:Fo({marginBottom:6,fontSize:v.typography.sizes.sm,fontWeight:500,color:v.text.secondary},x),children:o}),jsxs($n,{size:P,open:M,onOpenChange:h,children:[jsx(zn,{width:"100%",asChild:true,children:jsxs("button",{type:"button",disabled:c,"aria-haspopup":"menu","aria-expanded":M||void 0,"aria-controls":O,"aria-labelledby":o?K:void 0,onKeyDown:ee,onClick:()=>h(!M),className:"plainframe-ui-select-trigger",css:Fo(css(Ie),css(Te),R,N()),children:[jsx("div",{className:"plainframe-ui-select-trigger-content",css:css(we),children:Ee()}),a??Z]})}),jsx(hn,{id:O,gap:"xs",align:Q[y],sameWidth:f==null,width:f??d,className:"plainframe-ui-select-menu",css:Fo({maxHeight:typeof T=="number"?`${T}px`:T,overflowY:"auto"},g),children:qe})]})]})}var Zs=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Sf=keyframes`
13
+ `,_c=e=>e.startsWith("#")||e.startsWith("rgb(")||e.startsWith("rgba(")||e.startsWith("hsl(")||e.startsWith("hsla(")||e.startsWith("oklch(")||e.startsWith("lab(")||e.startsWith("color(")||e.startsWith("var("),Vc=new Set(["0","50","100","200","300","400","500","600","700","800","900"]);function jc(e,t){if(!t||t.trim()==="")return e.text.primary;let n=t.trim();if(_c(n))return n;let o=n.match(/^([a-zA-Z0-9_-]+)[\.\-:\s]?([0-9]{1,3})?$/);if(o){let r=o[1],s=o[2]&&Vc.has(o[2])?o[2]:"600";if(r==="primary"&&e.palette.primary?.[s])return e.palette.primary[s];let a=e.palette[r];if(a&&a[s]!=null)return a[s];if(r==="neutral"||r==="secondary"&&e.neutral[s]!=null)return e.neutral[s]}return e.palette.primary[600]}var Qn=de.memo(({variant:e="circular",value:t,min:n=0,max:o=100,color:r,size:s,thickness:a,spinDuration:c=.75,wrapperCss:i,trackCss:l,barCss:u,circleCss:d,"aria-label":h})=>{let f=V(),R=typeof t=="number",I=Math.max(o-n,1),x=R?_a(t,n,o):void 0,C=R?(x-n)/I*100:void 0,g=jc(f,r),p=f.surface.subtleBg,m=f.radius?.md;return e==="circular"?jsx(qc,{size:s,active:g,isDeterminate:R,percent:C,spinDuration:c,wrapperCss:i,trackCss:l,circleCss:d,ariaLabel:h,thickness:a}):jsx(Uc,{thickness:a,active:g,track:p,radius:m,isDeterminate:R,percent:C,wrapperCss:i,trackCss:l,barCss:u,ariaLabel:h,min:n,max:o,value:x})}),Uc=({thickness:e=4,active:t,track:n,radius:o,isDeterminate:r,percent:s,wrapperCss:a,trackCss:c,barCss:i,ariaLabel:l,min:u,max:d,value:h})=>{let f=o==null?"8px":typeof o=="number"?`${o}px`:String(o),R=css([{display:"inline-block",width:"100%"},...Array.isArray(a)?a:a?[a]:[]]),I=css([{position:"relative",width:"100%",height:Qr(e,"6px"),backgroundColor:n,borderRadius:f,overflow:"hidden"},...Array.isArray(c)?c:c?[c]:[]]),x=r?Math.max(s??0,Ka):Ka,C=css([{position:"absolute",inset:0,backgroundColor:t,borderRadius:"inherit",transformOrigin:"left",transform:`scaleX(${x/100})`,transition:"transform 160ms cubic-bezier(.2,0,.2,1)",willChange:"transform"},...Array.isArray(i)?i:i?[i]:[]]),g={position:"absolute",top:0,bottom:0,backgroundColor:t,borderRadius:"inherit",willChange:"left,right","@media (prefers-reduced-motion: reduce)":{animation:"none"}},p=css([{...g,left:"-35%",right:"100%",animation:`${Wc} 2.1s cubic-bezier(.65,.815,.735,.395) infinite`},...Array.isArray(i)?i:i?[i]:[]]),m=css([{...g,left:"-200%",right:"100%",animation:`${Kc} 2.1s cubic-bezier(.165,.84,.44,1) 1.15s infinite`},...Array.isArray(i)?i:i?[i]:[]]),v=r?{role:"progressbar","aria-valuemin":u,"aria-valuemax":d,"aria-valuenow":h}:{role:"progressbar","aria-busy":true};return l&&(v["aria-label"]=l),jsx("span",{css:R,...v,children:jsx("div",{className:"plainframe-ui-progress-linear-track",css:I,children:r?jsx("div",{className:"plainframe-ui-progress-linear-fill",css:C}):jsxs(Fragment,{children:[jsx("div",{className:"plainframe-ui-progress-linear-runner1",css:p}),jsx("div",{className:"plainframe-ui-progress-linear-runner2",css:m})]})})})},qc=({size:e,thickness:t=4,active:n,isDeterminate:o,percent:r,spinDuration:s,wrapperCss:a,trackCss:c,circleCss:i,ariaLabel:l})=>{let u=V(),d=40,h=(d-t)/2,f=2*Math.PI*h,I=`${(o?_a((r??0)/100,.01,1):.7)*f} ${f}`,x=css([{display:"inline-block",width:Qr(e,`${u.componentHeights.md}`),height:Qr(e,`${u.componentHeights.md}`)},...Array.isArray(a)?a:a?[a]:[]]),C=css([{width:"100%",height:"100%",transform:"rotate(-90deg)",transformBox:"fill-box",transformOrigin:"50% 50%"},...Array.isArray(c)?c:c?[c]:[]]),g=css([{stroke:n,strokeLinecap:"butt",strokeDasharray:I,strokeDashoffset:0,transition:o?"stroke-dasharray 160ms cubic-bezier(.2,0,.2,1)":"none",transformBox:"fill-box",transformOrigin:"50% 50%",fill:"none",willChange:o?"stroke-dasharray":"transform",animation:o?"none":`${Oc} ${s}s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},...Array.isArray(i)?i:i?[i]:[]]),p=o?{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r??0)}:{role:"progressbar","aria-busy":true};return l&&(p["aria-label"]=l),jsx("span",{css:x,className:"plainframe-ui-progress-circular",...p,children:jsx("svg",{css:C,viewBox:`0 0 ${d} ${d}`,focusable:"false","aria-hidden":true,children:jsx("circle",{cx:d/2,cy:d/2,r:h,strokeWidth:t,css:g})})})};var Ua=createContext(null),qa=()=>{let e=useContext(Ua);if(!e)throw new Error("AlertTitle and AlertDescription must be used inside <Alert>.");return e},ou=css({display:"flex",flexDirection:"column",textAlign:"left",minWidth:0,flex:1}),ru=css({lineHeight:0,display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"}),su=css({display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",padding:0,cursor:"pointer",lineHeight:0,transition:"opacity 140ms ease","&:disabled":{cursor:"not-allowed",opacity:.5}}),Ga=forwardRef(function({intent:t="neutral",variant:n="soft",intentIcon:o,closeIcon:r,onClose:s,width:a="100%",size:c="md",loading:i=false,css:l,children:u,...d},h){let f=V(),R=useId(),I=useId(),x=useMemo(()=>{let A={sm:{paddingX:f.spacing?.md,paddingY:f.spacing?.md,gap:f.spacing?.sm,radius:f.radius?.md,fontSize:f.typography?.sizes?.xs,titleWeight:600,iconSize:16},md:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.sm,titleWeight:600,iconSize:20},lg:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.md,titleWeight:600,iconSize:24}};return ["sm","md","lg"].includes(c)?A[c]:A.md},[c,f.typography,f.radius,f.spacing]),C=f.palette??{},g=f.neutral??{},p=useMemo(()=>{let M=(S=>S==="danger"?C.danger??C.error??g:S==="warning"?C.warning??g:S==="success"?C.success??g:S==="info"?C.info??C.primary??g:g)(t),b=M?.[50]??g[50],y=M?.[300]??g[300],P=M?.[600]??M?.[500]??g[600],H=M?.[700]??P,L=M?.[800]??f.text?.primary??"#000",E=f.text?.onColors?.[t]??f.text?.onColors?.primary??f.text?.primary??"#fff";return n==="filled"?{bg:P,fg:E,border:void 0,iconColor:E}:n==="outlined"?{bg:b,fg:L,border:`1px solid ${y}`,iconColor:L}:n==="ghost"?{bg:"transparent",fg:H,border:"none",iconColor:H}:{bg:b,fg:L,border:void 0,iconColor:H}},[t,n,g,C,f.text]),m=t==="danger"||t==="warning"?"alert":"status",v=useMemo(()=>i?jsx(Qn,{variant:"circular",color:p.iconColor,size:x.iconSize/1.25,thickness:4.5}):o??(t==="danger"?jsx(CircleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="warning"?jsx(TriangleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="success"?jsx(CircleCheckBig,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):jsx(Info,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor})),[i,o,t,x.iconSize,p.iconColor]),D=useMemo(()=>css({display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:`${x.paddingY} ${x.paddingX}`,gap:x.gap,borderRadius:x.radius,backgroundColor:p.bg,color:p.fg,border:p.border,fontSize:x.fontSize,fontWeight:500,maxWidth:typeof a=="number"?`${a}px`:a,width:"100%"}),[p.bg,p.border,p.fg,x.fontSize,x.gap,x.paddingX,x.paddingY,x.radius,a]),T=useMemo(()=>css({display:"flex",alignItems:"flex-start",gap:x.gap,minWidth:0,flex:1}),[x.gap]),w=useMemo(()=>[ru,{color:p.iconColor}],[p.iconColor]),F=useMemo(()=>css({display:"flex",alignItems:"center",gap:x.gap,marginLeft:x.gap,flex:"0 0 auto"}),[x.gap]),B=useMemo(()=>[su,{color:p.fg}],[p.fg]),W=useMemo(()=>({fg:p.fg,iconColor:p.iconColor,s:x,titleId:R,descId:I}),[p.fg,p.iconColor,x,R,I]),O=de.Children.toArray(u).some(A=>de.isValidElement(A)&&A.type===ns),k=de.Children.toArray(u).some(A=>de.isValidElement(A)&&A.type===os);return jsx(Ua.Provider,{value:W,children:jsxs("div",{ref:h,role:m,"aria-live":m==="alert"?"assertive":"polite","aria-atomic":"true","aria-busy":i,"aria-labelledby":O?R:void 0,"aria-describedby":k?I:void 0,className:`plainframe-ui-alert plainframe-ui-alert-${t} plainframe-ui-alert-${n}`,css:[D,l],...d,children:[jsxs("div",{className:"plainframe-ui-alert-left",css:T,children:[v&&jsx("span",{className:"plainframe-ui-alert-icon",css:w,children:v}),jsx("div",{className:"plainframe-ui-alert-content",css:ou,children:u})]}),s&&jsx("div",{className:"plainframe-ui-alert-actions",css:F,children:jsx("button",{type:"button","aria-label":"Close alert",onClick:s,disabled:i,className:"plainframe-ui-alert-close",css:B,children:r??jsx(X,{strokeWidth:2,size:x.iconSize-2})})})]})})});Ga.displayName="Alert";var ns=forwardRef(function({children:t,css:n,...o},r){let{fg:s,s:a,titleId:c}=qa(),i=useMemo(()=>css({color:s,fontWeight:a.titleWeight,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[s,a.titleWeight]);return jsx("span",{ref:r,id:c,className:"plainframe-ui-alert-title",css:[i,n],...o,children:t})});ns.displayName="AlertTitle";var os=forwardRef(function({children:t,css:n,...o},r){let{fg:s,descId:a}=qa(),c=useMemo(()=>css({color:s,marginTop:2,lineHeight:1.35,wordBreak:"break-word"}),[s]);return jsx("span",{ref:r,id:a,className:"plainframe-ui-alert-desc",css:[c,n],...o,children:t})});os.displayName="AlertDescription";var rs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,_t=e=>e==null?[]:Array.isArray(e)?e:[e],Vt=(...e)=>css(e.filter(Boolean));function Ya(e,t,n="currentColor"){if(!isValidElement(e))return e;let o=e.props,r={};o.size==null&&(r.size=t),o.color==null&&(r.color=n);let s=o.style;return s?.fontSize==null&&(r.style={...s||{},fontSize:t}),cloneElement(e,{...o,...r})}var Zo=de.memo(forwardRef(function({label:t,value:n,defaultValue:o="",onChange:r,placeholder:s,error:a,helperText:c,disabled:i=false,fullWidth:l=false,width:u=250,size:d="md",variant:h="subtle",rounded:f=false,startIcon:R,endIcon:I,togglePasswordVisible:x=false,showClear:C,type:g="text",step:p,focusRingMode:m="always",className:v,wrapperCss:D,inputCss:T,labelCss:w,helperRowCss:F,helperTextCss:B,startIconCss:W,endIconCss:O,css:k,onBlur:A,onFocus:M,onKeyDown:b,autoFocus:y,name:P,id:H,tabIndex:L,autoComplete:E,readOnly:S,required:z,maxLength:$,onSurfaceClick:K},_){let N=V(),U=Xo(),X$1=useId(),se=useMemo(()=>{let ce={sm:{fontSize:N.typography.sizes.sm,minHeight:N.componentHeights.sm,labelFont:N.typography.sizes.xs,helperFont:N.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:N.spacing.md,iconSize:N.typography.sizes.xs,codeFontSize:21},md:{fontSize:N.typography.sizes.sm,minHeight:N.componentHeights.md,labelFont:N.typography.sizes.sm,helperFont:N.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:N.spacing.md,iconSize:N.typography.sizes.xs,codeFontSize:24},lg:{fontSize:N.typography.sizes.sm,minHeight:N.componentHeights.lg,labelFont:N.typography.sizes.md,helperFont:N.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:N.spacing.md,iconSize:N.typography.sizes.xs,codeFontSize:28}},Te=["sm","md","lg"].includes(d)?d:"md";return ce[Te]},[d,N]),j=N.neutral,J=N.text,le=g==="number",ue=g==="password",fe=n!==void 0,[Fe,ve]=useState(o),ye=fe?n:Fe,we=useCallback(ce=>{fe||ve(ce),r?.(ce);},[fe,r]),Ce=/^-?\d*(?:[.,]\d*)?$/,Re=le&&(p!=null&&String(p).includes(".")||/[.,]/.test(ye??"")),be=le?Re?"decimal":"numeric":void 0,ne=le?Re?"[0-9]*[.,]?[0-9]*":"[0-9]*":void 0,G=useCallback(ce=>{(ce===""||Ce.test(ce))&&we(ce);},[we]),ie=i?j[200]:a&&h==="outlined"?N.palette.danger?.[50]??N.surface.panelBg:a&&h==="subtle"?N.palette.danger?.[50]??N.surface.subtleBg:h==="outlined"?N.surface.panelBg:h==="subtle"?N.surface.subtleBg:"transparent",Y=N.componentHeights.border,Q=h==="outlined"?`${Y} solid ${a?N.palette.danger?.[300]??N.surface.border:N.surface.border}`:"none",ae=Vt({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:l?"100%":u!=null?rs(u):void 0,flex:"0 0 auto",fontWeight:500}),pe=useMemo(()=>Vt({fontSize:se.labelFont,fontWeight:500,color:a?N.palette.danger?.[700]??J.primary:i?j[500]:J.primary,marginBottom:4,display:"inline-block"},..._t(w)),[se.labelFont,a,i,j,J,N.palette.danger,w]),Ae=useMemo(()=>Vt({display:"flex",alignItems:"center",gap:N.spacing.sm,padding:`${rs(se.paddingY)} ${rs(se.paddingX)}`,background:ie,border:Q,borderRadius:f?N.radius.full:N.radius.md,minHeight:se.minHeight,boxSizing:"border-box",width:"100%",cursor:i?"not-allowed":"text",opacity:i?.65:1,transition:"box-shadow .18s, border-color .16s"},..._t(D),..._t(k)),[N,se.minHeight,se.paddingX,se.paddingY,ie,Q,f,i,D,k]),He=useMemo(()=>Vt({flex:1,minWidth:0,fontSize:se.fontSize,fontWeight:500,fontFamily:"inherit",color:i?j[500]:a?N.palette.danger?.[800]??J.primary:J.primary,background:"transparent",border:"none",outline:"none",padding:0,lineHeight:1.25,cursor:i?"not-allowed":"text",appearance:le?"textfield":"auto","&::placeholder":{color:a?N.palette.danger?.[700]??J.secondary:J.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${a?N.palette.danger?.[800]??J.primary:J.primary} !important`,boxShadow:`0 0 0 1000px ${ie} inset !important`,transition:"opacity 99999s ease-out",caretColor:a?N.palette.danger?.[800]??J.primary:J.primary},":focus-within":{outline:"none",border:"none",boxShadow:"none"}},..._t(T)),[se.fontSize,i,j,J,a,N.palette.danger,le,ie,T]),Z=useMemo(()=>Vt({display:"inline-flex",alignItems:"center",color:a?N.palette.danger?.[800]??J.secondary:J.secondary,marginLeft:-3},..._t(W)),[a,N.palette.danger,J.secondary,W]),oe=useMemo(()=>Vt({display:"inline-flex",alignItems:"center",color:a?N.palette.danger?.[800]??J.secondary:J.secondary,border:"none",background:"transparent",lineHeight:0,cursor:"inherit",padding:0},..._t(O)),[a,N.palette.danger,J.secondary,i,O]),re=useMemo(()=>Vt({minHeight:16,fontSize:se.helperFont,color:a?N.palette.danger?.[700]??J.secondary:J.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},..._t(F)),[se.helperFont,a,N.palette.danger,J.secondary,F]),je=useMemo(()=>Vt({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400},..._t(B)),[B]),Le=useRef(null),wt=useCallback(ce=>{Le.current=ce,_&&(typeof _=="function"?_(ce):_.current=ce);},[_]),Un=useCallback(ce=>{let Te=ce.target.value;if(le){G(Te);return}$&&Te.length>$||we(Te);},[le,$,we,G]),[Ke,xn]=useState(false),it=useCallback(()=>{i||xn(ce=>!ce);},[i]),vn=useCallback(()=>{i||(we(""),Le.current?.focus());},[i,we]),Et=useMemo(()=>{let ce=se.fontSize;if(typeof ce=="number")return ce;let Te=parseFloat(String(ce));return Number.isFinite(Te)?Te:16},[se.fontSize]),Cn=useMemo(()=>R?jsx("span",{css:Z,children:Ya(R,Et)}):null,[R,Z,Et]),qn=useMemo(()=>css({display:"flex",alignItems:"center",gap:4}),[]),Po=useMemo(()=>{let ce=[];if(ue&&x){let lt=Ke?jsx(Eye,{strokeWidth:2.5,size:Et}):jsx(EyeOff,{strokeWidth:2.5,size:Et});ce.push(jsx("button",{type:"button",css:oe,onMouseDown:Xn=>Xn.preventDefault(),onClick:Xn=>{Xn.stopPropagation(),it();},tabIndex:-1,"aria-label":Ke?"Hide password":"Show password",disabled:i,children:lt},"pw-toggle"));}C&&ye&&ye.length>0&&!i&&ce.push(jsx("button",{type:"button",css:oe,onMouseDown:lt=>lt.preventDefault(),onClick:lt=>{lt.stopPropagation(),vn();},tabIndex:-1,"aria-label":"Clear",children:jsx(X,{strokeWidth:2.5,size:Et})},"clear"));let Te=I?jsx("span",{css:oe,children:Ya(I,Et)},"user-end"):null,Ze=ce.length>0,ke=!!Te;return !Ze&&!ke?null:!Ze&&ke?Te:Ze&&!ke?ce.length===1?ce[0]:jsx("span",{css:qn,children:ce}):jsxs("span",{css:qn,children:[ce,Te]})},[ue,x,Ke,Et,oe,qn,i,C,ye,I,it,vn]),Do=c!=null?`${H??X$1}-help`:void 0,Gn=H??X$1,Ue=useCallback(ce=>{if(i)return;ce.stopPropagation();let Te=Le.current;if(!Te)return;let Ze=ce.target;if(!(Te.contains(Ze)||Ze.closest("button,[role='button']"))){if(document.activeElement===Te){ce.preventDefault();return}ce.preventDefault();}},[i]),ut=useCallback(ce=>{if(i)return;let Te=Le.current;if(Te&&(K?.(ce),document.activeElement!==Te)){Te.focus({preventScroll:true});try{let Ze=Te.value?.length??0;Te.setSelectionRange?.(Ze,Ze);}catch{}}},[i,K]);return jsxs("div",{className:["plainframe-ui-textfield",v||""].join(" ").trim(),css:ae,children:[t&&jsx("label",{htmlFor:Gn,className:"plainframe-ui-textfield-label",css:pe,children:t}),jsxs("div",{className:"plainframe-ui-textfield-surface",css:[U({enabled:m!=="none",color:a?"danger":void 0}),Ae],onPointerDownCapture:Ue,onClick:ut,"aria-invalid":!!a||void 0,children:[Cn,jsx("input",{ref:wt,id:Gn,className:"plainframe-ui-textfield-input",css:He,type:ue?Ke?"text":"password":g==="number"?"text":g,inputMode:be,pattern:ne,value:ye,maxLength:le?void 0:$,onChange:le?ce=>G(ce.target.value):Un,placeholder:s||"",disabled:i,onBlur:A,onFocus:M,onKeyDown:b,autoFocus:y,name:P,tabIndex:L,autoComplete:E,readOnly:S,required:z,"aria-invalid":!!a||void 0,"aria-describedby":Do}),Po]}),c!=null&&jsx("div",{className:"plainframe-ui-textfield-helper-row",css:re,children:jsx("span",{id:Do,className:"plainframe-ui-textfield-helper-text",css:je,children:c})})]})}));Zo.displayName="TextField";var Qo=de.createContext("ghost"),ft=de.createContext(false),ti=forwardRef(function({variant:t="ghost",size:n="md",width:o,maxHeight:r,unstyled:s=false,className:a,css:c,children:i,label:l,allItemsTabbable:u=false,...d},h){let f=V(),[R,I]=useState(false),x=useRef(null),C=typeof f.spacing.xs=="number"?`${f.spacing.xs}px`:String(f.spacing.xs),g=t==="outlined"?f.surface.panelBg:t==="subtle"?f.surface.subtleBg??f.neutral[50]:"transparent",p=s?void 0:css({background:g,border:t==="outlined"?`${f.componentHeights.border} solid ${f.surface.border}`:"none",borderRadius:f.radius.lg,"--pfui-panel-pad":C,padding:t==="ghost"?0:"var(--pfui-panel-pad)",color:f.text.primary,width:"100%",maxHeight:r,overflowY:r!=null?"auto":void 0,display:"flex",flexDirection:"column",outline:"none",position:"relative","&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),m=n==="sm",v=useMemo(()=>({isKeyboardNav:R,setIsKeyboardNav:I}),[R]),D=useMemo(()=>({allItemsTabbable:u}),[u]),T=useCallback(M=>Array.from(M.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(b=>{if(b.closest('[role="menu"]')!==M)return false;let y=window.getComputedStyle(b);return y.display!=="none"&&y.visibility!=="hidden"}),[]),w=useCallback(M=>{M.removeAttribute("data-keyboard-nav"),M.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),I(false);},[]),F=useRef(false),B=useCallback(M=>{if(M.target!==M.currentTarget)return;if(F.current){F.current=false;return}let b=M.currentTarget,y=T(b);y.length>0&&(I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(P=>P.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(P=>P.removeAttribute("data-hovered")),y[0].setAttribute("data-highlighted",""),y[0].focus({preventScroll:true}));},[T]),W=useCallback(M=>{let b=M.currentTarget,y=T(b);if(y.length===0)return;if(M.key==="Tab"){F.current=true,b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted")),I(false),b.tabIndex=-1,requestAnimationFrame(()=>{b.tabIndex=0,F.current=false;});return}let P=b.querySelector("[data-highlighted]"),H=b.querySelector("[data-hovered]"),L=P||H,E=L?y.indexOf(L):-1;if(M.key==="ArrowDown"||M.key==="ArrowUp"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach($=>$.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach($=>$.removeAttribute("data-hovered")),E===-1&&(E=M.key==="ArrowDown"?-1:y.length);let S=M.key==="ArrowDown"?1:-1,z=(E+S+y.length)%y.length;y[z].setAttribute("data-highlighted",""),y[z].focus({preventScroll:true});return}if(M.key==="Home"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(S=>S.removeAttribute("data-hovered")),y[0].setAttribute("data-highlighted",""),y[0].focus({preventScroll:true});return}if(M.key==="End"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(S=>S.removeAttribute("data-hovered")),y[y.length-1].setAttribute("data-highlighted",""),y[y.length-1].focus({preventScroll:true});return}if(M.key==="Escape"){M.preventDefault(),b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted")),I(false),b.blur();return}},[T]),O=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&w(b);},[w]),k=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&w(b);},[w]),A=useCallback(M=>{x.current=M,typeof h=="function"?h(M):h&&(h.current=M);},[h]);return jsx(eo.Provider,{value:v,children:jsx(to.Provider,{value:D,children:jsx(ft.Provider,{value:m,children:jsx(Qo.Provider,{value:t,children:jsxs("div",{css:{display:"flex",flexDirection:"column",gap:f.spacing.sm,width:"100%",maxWidth:o},children:[l?jsx("div",{css:{width:"100%",textAlign:"left"},children:jsx("span",{css:{display:"block",color:f.text.secondary,fontSize:f.typography.sizes.xs,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",padding:typeof f.spacing.sm=="number"?`${f.spacing.sm}px`:f.spacing.sm,paddingTop:0},children:l})}):null,jsx("div",{ref:A,role:"menu","data-keyboard-nav":R?"":void 0,tabIndex:0,"aria-label":l||void 0,className:["plainframe-ui-menu",a||""].join(" ").trim(),css:[p,c],onFocus:B,onKeyDown:W,onPointerMove:O,onPointerDown:k,...d,children:i})]})})})})})});ti.displayName="Menu";var oi=createContext(null),nr=()=>{let e=useContext(oi);if(!e)throw new Error("Popover components must be used inside <Popover>.");return e};function Nu(e,t){e&&(typeof e=="function"?e(t):e.current=t);}var ro=(...e)=>t=>{for(let n of e)Nu(n,t);},as=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Hu=e=>{useEffect(()=>{if(!e||typeof document>"u"||typeof window>"u")return;let t=document.body,n=t.style.overflow,o=t.style.paddingRight,r=window.innerWidth-document.documentElement.clientWidth,s=parseFloat(getComputedStyle(t).paddingRight||"0");return t.style.overflow="hidden",r>0&&(t.style.paddingRight=`${s+r}px`),()=>{t.style.overflow=n,t.style.paddingRight=o;}},[e]);},er=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"&&t&&e in t){let n=t[e];return typeof n=="number"?`${n}px`:String(n)}return e}},Lu=({open:e,defaultOpen:t,onOpenChange:n,triggerOn:o="click",lockScroll:r=true,trapFocus:s=true,children:a})=>{let[c,i]=useState(!!t),l=e??c,u=x=>{e===void 0&&i(x),n?.(x);},d=useRef(null),h=useRef(null),f=(x=120)=>{h.current!=null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>u(false),x);},R=()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null);};Hu(r&&l),useEffect(()=>{if(!s||!l||typeof document>"u")return;let x=C=>{if(C.key!=="Tab")return;let g=document.querySelector(".plainframe-ui-popover");if(!g)return;let p=Array.from(g.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(T=>{let w=window.getComputedStyle(T);return w.display!=="none"&&w.visibility!=="hidden"});if(p.length===0)return;let m=p[0],v=p[p.length-1],D=document.activeElement;C.shiftKey&&D===m?(C.preventDefault(),v.focus()):!C.shiftKey&&D===v&&(C.preventDefault(),m.focus());};return document.addEventListener("keydown",x,true),()=>document.removeEventListener("keydown",x,true)},[s,l]);let I=useMemo(()=>({open:l,setOpen:u,triggerOn:o,referenceRef:d,scheduleClose:f,cancelClose:R}),[l,o]);return jsx(oi.Provider,{value:I,children:a})},ri=forwardRef(({asChild:e=true,children:t,css:n},o)=>{let{open:r,setOpen:s,triggerOn:a,referenceRef:c,scheduleClose:i,cancelClose:l}=nr(),u=de.Children.only(t),d=u.props||{},h=ro(c,o,u.ref),f=a==="click"?{onClick:I=>{I.stopPropagation(),s(!r),d.onClick?.(I);}}:{onMouseEnter:I=>{l(),r||s(true),d.onMouseEnter?.(I);},onMouseLeave:I=>{i(),d.onMouseLeave?.(I);}},R={"aria-haspopup":"dialog","aria-expanded":r};if(e){let I=u.props?.css;return de.cloneElement(u,{...f,...R,ref:h,css:[I,n].filter(Boolean)})}return de.createElement("button",{ref:h,type:"button",css:[n],...f,...R,children:u})});ri.displayName="PopoverTrigger";var si=forwardRef(({asChild:e=true,width:t,css:n,children:o},r)=>{let{referenceRef:s}=nr(),a=de.Children.only(o),c=ro(s,r,a.ref);if(e){let l=a.props?.css;return de.cloneElement(a,{ref:c,css:[l,n].filter(Boolean)})}let i=css({display:"inline-block",width:as(t),verticalAlign:"middle",...n});return jsx("span",{ref:c,css:i,children:a})});si.displayName="PopoverAnchor";function Bu(e){let t=e?.vertical??"bottom",n=e?.horizontal??"center";if(t==="top"||t==="bottom"){let s=t,a=n==="left"?"start":n==="right"?"end":"center";return a==="center"?s:`${s}-${a}`}let o=n==="left"?"left":"right",r="center";return r==="center"?o:`${o}-${r}`}var ai=forwardRef(({anchorOrigin:e={vertical:"bottom",horizontal:"center"},sideOffset:t=8,alignOffset:n=0,collisionPadding:o=8,unstyled:r=false,children:s,width:a,height:c,padding:i,paddingX:l,paddingY:u,radius:d="lg",css:h,...f},R)=>{let{open:I,setOpen:x,triggerOn:C,referenceRef:g,scheduleClose:p,cancelClose:m}=nr(),v=V(),D=Bu(e),{refs:T,x:w,y:F,strategy:B,context:W}=useFloating({open:I,onOpenChange:x,whileElementsMounted:autoUpdate,placement:D,strategy:"fixed",middleware:[offset({mainAxis:t,crossAxis:n}),flip({padding:o}),shift({padding:o})]});useEffect(()=>{g.current&&T.setReference(g.current);},[T,g]);let O=useDismiss(W,{outsidePressEvent:"pointerdown",escapeKey:true}),k=useRole(W,{role:"dialog"}),{getFloatingProps:A}=useInteractions([O,k]),[M]=W.placement.split("-"),b=M,y=`${b==="left"?"right":b==="right"?"left":"center"} ${b==="top"?"bottom":b==="bottom"?"top":"center"}`,P=8,H=b==="top"?{y:P}:b==="bottom"?{y:-P}:b==="left"?{x:P}:{x:-P},L={initial:{opacity:0,scale:.96,...H},animate:{opacity:1,scale:1,x:0,y:0},exit:{opacity:0,scale:.96,...H},transition:{scale:{type:"spring",stiffness:520,damping:32,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.16,ease:"linear"}}},E=v.surface.panelBg,S=v.text.primary,z=`${v.componentHeights.border} solid ${v.surface.border}`,$=er(i,v.spacing),K=er(l,v.spacing),_=er(u,v.spacing),N={};$&&(N.padding=$),K&&(N.paddingInline=K),_&&(N.paddingBlock=_);let U=er(d,v.radius)??v.radius.md,X="0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)",se=css({position:B,top:F??0,left:w??0,zIndex:1e3,transformOrigin:y,pointerEvents:"auto",display:"inline-flex",flexDirection:"column",width:as(a)??"fit-content",height:as(c)??"fit-content",boxSizing:"border-box",willChange:"opacity, transform"}),j=r?css({}):css({background:E,color:S,border:z,borderRadius:U,boxShadow:X,...N,...N.padding||N.paddingInline||N.paddingBlock?{}:{padding:typeof v.spacing?.sm=="number"?`${v.spacing.sm}px ${v.spacing.md}px`:`${v.spacing?.sm??"0.5rem"} ${v.spacing?.md??"1rem"}`}}),J=C==="hover"?{onMouseEnter:m,onMouseLeave:()=>p()}:{},le=ro(T.setFloating,R),ue=jsx(motion.div,{className:"plainframe-ui-popover",...A({...f,ref:le,...J}),...L,css:[se,j,h],children:s});return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:I?ue:null})})});ai.displayName="PopoverContent";var $u=()=>{let e=nr();return {open:e.open,close:()=>e.setOpen(false),setOpen:e.setOpen}};var us=de.memo(forwardRef(function({checked:t,defaultChecked:n=false,onChange:o,disabled:r=false,size:s="md",label:a,className:c,css:i,trackCss:l,thumbCss:u,labelCss:d,...h},f){let R=V(),I=he(),x={sm:{trackW:25,trackH:16,thumb:11,labelGap:8},md:{trackW:35,trackH:20,thumb:14,labelGap:8},lg:{trackW:45,trackH:24,thumb:18,labelGap:10}},C={slideMs:250,pressMs:150,easing:"ease"},g=t!==void 0,[p,m]=useState(n),v=g?!!t:p,[D,T]=useState(false);useEffect(()=>{if(r)return;T(true);let K=setTimeout(()=>T(false),C.pressMs);return ()=>clearTimeout(K)},[v,r]);let w=["sm","md","lg"].includes(s)?s:"md",F=x[w],B=`${C.slideMs}ms ${C.easing}`,W=R.palette?.primary?.[600]??R.neutral[900],O=R.neutral[300],k=v?W:O,A=v?R.text.onColors.primary:"#ffffff",{trackW:M,trackH:b,thumb:y}=F,P=(b-y)/2,H=css({display:"inline-flex",alignItems:"center",gap:F.labelGap,cursor:r?"not-allowed":"pointer",width:"fit-content",padding:R.spacing.xs,borderRadius:R.radius.sm,outline:"none"}),L=css({position:"relative",width:M,height:b,backgroundColor:k,borderRadius:R.radius.xl,transition:`background-color ${B}, opacity 120ms ease`,willChange:"background-color",cursor:r?"not-allowed":"pointer",opacity:r?.5:1}),E=css({position:"absolute",top:P,left:v?M-y-P:P,width:y,height:y,backgroundColor:A,borderRadius:R.radius.xl,transition:`left ${B}, transform ${B}, background-color 0.25s ease`,transform:D?"scaleX(1.2)":"scaleX(1)",transformOrigin:v?"right center":"left center"}),S=css({fontSize:R.typography.sizes.sm,fontWeight:500,color:r?R.text.muted:R.text.primary}),z=()=>{if(r)return;let K=!v;g||m(K),o?.(K);};return jsxs("label",{ref:f,role:"switch","aria-checked":v,"aria-disabled":r||void 0,"data-checked":v?"":void 0,"data-disabled":r?"":void 0,tabIndex:r?-1:0,onClick:z,onKeyDown:K=>{r||(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),z());},className:["plainframe-ui-switch",c||""].join(" ").trim(),css:[H,I({color:v?"primary":"neutral"}),i],...h,children:[jsx("div",{className:"plainframe-ui-switch-track",css:[L,l],children:jsx("div",{className:"plainframe-ui-switch-thumb",css:[E,u]})}),a!=null&&jsx("span",{className:"plainframe-ui-switch-label",css:[S,d],children:a})]})}));var Uu=(e,t)=>t==="sm"?{box:16,labelFont:e.typography.sizes.xs,gap:8,borderRadius:e.radius.xxs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:t==="lg"?{box:24,labelFont:e.typography.sizes.md,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:{box:20,labelFont:e.typography.sizes.sm,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75},rr=de.memo(forwardRef(({checked:e,defaultChecked:t=false,onChange:n,disabled:o=false,size:r="md",label:s,description:a,rounded:c=false,checkedIcon:i,color:l="primary",css:u,boxCss:d,checkCss:h,labelCss:f,descriptionCss:R,className:I,...x},C)=>{let g=V(),p=he(),m=typeof e=="boolean",[v,D]=useState(t),T=m?e:v,w=r==="sm"||r==="lg"?r:"md",F=useMemo(()=>Uu(g,w),[g,w]),{checkedBg:B,checkColor:W,borderCol:O,hoverBg:k,gapPx:A}=useMemo(()=>{let K=g.palette||{},_=g.neutral||{},N=g.text?.onColors||{},U,X;l==="neutral"||l==="secondary"?(U=_,X="neutral"):typeof l=="string"&&Object.prototype.hasOwnProperty.call(K,l)?(U=K[l]||K.primary||_,X=l):(U=K.primary||_,X="primary");let se=U[600]??U[500]??U[400]??Object.values(U)[0]??g.palette.primary[600],j=N[X]??N.primary??g.text?.onColors?.primary??g.text.primary,J=typeof F.gap=="number"?F.gap+2:F.gap;return {checkedBg:se,checkColor:j,borderCol:g.surface.border,hoverBg:g.surface.panelHover,gapPx:J}},[F.gap,l,g]),M=useMemo(()=>css({display:"inline-flex",alignItems:s&&a?"flex-start":"center",gap:A,cursor:o?"not-allowed":"pointer",userSelect:"auto",position:"relative",width:"fit-content",borderRadius:g.radius.sm,padding:g.spacing.xs,transition:"background-color .16s ease, color .16s ease, opacity .16s ease",'&:not([data-disabled="true"]):hover input:not(:checked) + .plainframe-ui-checkbox-box':{outlineColor:O,backgroundColor:k},"input:checked + .plainframe-ui-checkbox-box":{backgroundColor:B,outlineColor:B,"--pfui-bleed":B},'&:not([data-disabled="true"]):hover input:checked + .plainframe-ui-checkbox-box':{outlineColor:B,backgroundColor:B,"--pfui-bleed":B},".plainframe-ui-checkbox-check":{opacity:0,transform:"scale(0.2)"},"input:checked + .plainframe-ui-checkbox-box .plainframe-ui-checkbox-check":{opacity:1,transform:"scale(1)"}}),[O,B,a,o,A,k,s,g.radius.sm,g.spacing.xs]),b=useMemo(()=>css({position:"absolute",opacity:0,width:0,height:0,margin:0,padding:0,pointerEvents:"none"}),[]),y=useMemo(()=>css({width:F.box,height:F.box,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",outline:`${F.borderWidth} solid ${O}`,outlineOffset:`-${F.borderWidth}`,boxShadow:"inset 0 0 0 0.5px var(--pfui-bleed, transparent)",borderRadius:c?g.radius.full:F.borderRadius,transition:"background-color .16s ease, outline-color .05s ease, box-shadow .16s ease, transform .16s ease",flex:"0 0 auto",verticalAlign:"middle",overflow:"hidden",transform:"translateZ(0)",backfaceVisibility:"hidden"}),[F.box,F.borderRadius,F.borderWidth,O,c,g.radius.full]),P=useMemo(()=>({w:Math.round(F.box*F.iconRatioW),h:Math.round(F.box*F.iconRatioH)}),[F.box,F.iconRatioH,F.iconRatioW]),H=useMemo(()=>css({width:P.w,height:P.h,transition:"opacity .14s ease, transform .14s ease",color:W,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,pointerEvents:"none","& > svg, & > img":{width:"100%",height:"100%",display:"block"}}),[W,P.h,P.w]),L=useMemo(()=>css({display:"flex",flexDirection:"column",minWidth:0,userSelect:"text",WebkitUserSelect:"text"}),[]),E=useMemo(()=>css({fontSize:F.labelFont,lineHeight:1.1,fontWeight:500,userSelect:"text",WebkitUserSelect:"text",color:g.text.primary}),[F.labelFont,g.text.primary]),S=useMemo(()=>css({fontSize:F.labelFont,lineHeight:1.25,color:g.text.secondary,fontWeight:400,marginTop:s&&a?g.spacing.xs:0,userSelect:"text",WebkitUserSelect:"text"}),[F.labelFont,a,s,g.spacing.xs,g.text.secondary]),z=useCallback(()=>{o||(m?n?.(!T):D(K=>{let _=!K;return n?.(_),_}));},[o,m,T,n]),$=useCallback(K=>{o||(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),z());},[o,z]);return jsxs("label",{ref:C,role:"checkbox","aria-checked":T,"aria-disabled":o||void 0,"data-state":T?"checked":"unchecked",className:["plainframe-ui-checkbox",I||""].join(" ").trim(),css:[M,p({color:T?"primary":"neutral"}),u,o?css({opacity:.6}):null],"data-disabled":o?"true":"false",tabIndex:o?-1:0,onKeyDown:$,children:[jsx("input",{type:"checkbox",checked:T,onChange:z,disabled:o,css:b,...x,tabIndex:-1}),jsx("span",{className:"plainframe-ui-checkbox-box",css:[y,d],"aria-hidden":"true",children:jsx("span",{className:"plainframe-ui-checkbox-check",css:[H,h],children:T&&(i||jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:W,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",css:css({width:"100%",height:"100%",display:"block"}),"aria-hidden":"true",focusable:"false",children:jsx("polyline",{points:"20 6 9 17 4 12"})}))})}),(s||a)&&jsxs("span",{className:"plainframe-ui-checkbox-text",css:L,children:[s&&jsx("span",{className:"plainframe-ui-checkbox-label",css:[E,f],children:s}),a&&jsx("span",{className:"plainframe-ui-checkbox-description",css:[S,R],children:a})]})]})}));rr.displayName="Checkbox";var Xu=()=>useContext(sn),Yu=()=>useContext(to),Ju=()=>useContext(lr),on=null,di=(e,t=35)=>{on!==null&&window.clearTimeout(on),on=window.setTimeout(()=>{e(),on=null;},t);},so=()=>{on!==null&&(window.clearTimeout(on),on=null);},kt=de.forwardRef(function({disabled:t=false,destructive:n=false,inset:o,closeOnSelect:r=true,onSelect:s,children:a,className:c,css:i,startIcon:l,endIcon:u,selected:d=false,active:h,meta:f,__index:R,__skipListReg:I,...x},C){let g=Xu(),p=Ju(),m=ir(),v=io(),D=Yu(),T=V(),F=!!useContext(ft),B=x["data-subtrigger"]!==void 0,W=B&&u===void 0?jsx(ChevronRight,{size:18,strokeWidth:2.5}):u,k=typeof o=="number"?o:o===false?0:0,A=useContext(Qo),M=A==="subtle"?T.surface?.subtleHover??T.neutral[100]:T.surface?.subtleBg??T.neutral[100],b=useMemo(()=>css({width:"100%",borderRadius:T.radius.md,padding:`${T.spacing.sm} ${T.spacing.sm}`,paddingLeft:k>0?`calc(${T.spacing.md} + (${T.spacing.xl} * ${k}))`:T.spacing.md,minHeight:F?T.componentHeights.sm:T.componentHeights.md,display:"flex",alignItems:"center",gap:T.spacing.sm,fontWeight:500,fontSize:T.typography.sizes.sm,cursor:t?"not-allowed":"pointer",opacity:t?.55:1,userSelect:"none",background:"transparent",color:n?T.palette.danger[800]:T.text.primary,transition:"background-color .16s ease, color .16s ease",outline:"none","[role='menu']:not([data-keyboard-nav]) &:hover":t?{}:{background:n?T.palette.danger[50]:M},"&[data-highlighted]":t?{}:{background:n?T.palette.danger[50]:M},"&[data-active]":t?{}:{background:n?T.palette.danger[50]:M},"&[data-subtrigger][aria-expanded='true']":t?{}:{background:n?T.palette.danger[50]:M},"[role='menu']:not([data-keyboard-nav]) &:not([data-disabled]):hover [data-menu-checkbox-wrapper],&:not([data-disabled])[data-highlighted] [data-menu-checkbox-wrapper],&:not([data-disabled])[data-active] [data-menu-checkbox-wrapper],&[data-subtrigger][aria-expanded='true'] [data-menu-checkbox-wrapper]":{background:T.surface.border},"& > [data-label]":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),[T,F,k,t,n,M]),y=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}}),[]),P=useMemo(()=>css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,whiteSpace:"nowrap",lineHeight:0,gap:T.spacing.sm,"& > svg":{width:16,height:16,display:"block"},color:T.text.secondary}),[T.text.secondary,T.spacing.sm]),H=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:T.palette.primary[600],"& > svg":{width:16,height:16,display:"block"}}),[T.palette.primary]),L=[];F&&L.push({minHeight:T.componentHeights.sm,paddingLeft:T.spacing.sm,paddingRight:T.spacing.xs,paddingTop:T.spacing.xs,paddingBottom:T.spacing.xs});let E=()=>{s?.(),r&&!B&&p?.closeAll();},S=($,K)=>{let _=$.closest('[role="menu"]');if(!_)return;let N=Array.from(_.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(J=>{if(J.closest('[role="menu"]')!==_)return false;let le=window.getComputedStyle(J);return le.display!=="none"&&le.visibility!=="hidden"});if(!N.length)return;let U=N.indexOf($),X=U>=0?U:0,se=K(N.length,X),j=N[se];j&&(document.querySelectorAll("[data-highlighted]").forEach(J=>{J.removeAttribute("data-highlighted");}),j.setAttribute("data-highlighted",""),j.focus(),g&&R!=null&&g.setActiveIndex(se));},z=t?-1:D?.allItemsTabbable?0:-1;return jsxs("div",{role:"menuitem","aria-disabled":t||void 0,"data-disabled":t?"":void 0,"data-active":h?"":void 0,tabIndex:z,ref:$=>{if(g&&!I){let K=g.listRef.current;$&&(R!=null?K[R]=$:K.includes($)||K.push($));}typeof C=="function"?C($):C&&"current"in C&&(C.current=$);},onMouseMove:$=>{if($.currentTarget.hasAttribute("data-hovered"))return;let K=!!$.currentTarget.closest("[data-submenu-content]");!B&&m&&!K&&di(m.closeAllSubMenus),document.querySelectorAll("[data-hovered]").forEach(N=>{N.removeAttribute("data-hovered");}),document.querySelectorAll("[data-highlighted]").forEach(N=>{N.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-active]").forEach(N=>{N.removeAttribute("data-active");}),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');_?.hasAttribute("data-keyboard-nav")&&_.removeAttribute("data-keyboard-nav"),!t&&g&&R!=null&&g.setActiveIndex(R),!t&&!D?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onMouseEnter:$=>{if(B)so();else {let N=!!$.currentTarget.closest("[data-submenu-content]");m&&!N&&di(m.closeAllSubMenus);}$.currentTarget.hasAttribute("data-hovered")||(document.querySelectorAll("[data-highlighted]").forEach(N=>{N.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-hovered]").forEach(N=>{N.removeAttribute("data-hovered");}),document.querySelectorAll("[data-active]").forEach(N=>{N.removeAttribute("data-active");})),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');!t&&g&&R!=null&&(_?.hasAttribute("data-keyboard-nav")&&(_.removeAttribute("data-keyboard-nav"),v&&v.setIsKeyboardNav(false)),g.setActiveIndex(R)),!t&&!D?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onFocus:()=>{},onMouseLeave:()=>{g&&g.setActiveIndex(null);},onKeyDown:$=>{if(t)return;let K=$.currentTarget;if($.key==="Tab"&&g&&!D?.allItemsTabbable){$.preventDefault();return}if($.key==="Tab"&&!g){let _=K.closest('[role="menu"]');if(_){_.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(U=>U.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(U=>U.removeAttribute("data-hovered"));let N=_.tabIndex;_.tabIndex=-1,requestAnimationFrame(()=>{_.tabIndex=N>=0?N:0;});}v&&v.setIsKeyboardNav(false);return}if($.key==="Enter"||$.key===" "||$.key==="ArrowRight"){B||$.key!=="ArrowRight"&&($.preventDefault(),$.stopPropagation(),E());return}if($.key==="ArrowLeft"&&K.closest('[role="menu"]')?.closest("[data-submenu-content]")){$.preventDefault(),$.stopPropagation();let U=document.querySelector('[data-subtrigger][aria-expanded="true"]');if(U){let X=U.__pfuiCloseSubmenu;X&&X(),document.querySelectorAll("[data-highlighted]").forEach(j=>j.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(j=>j.removeAttribute("data-hovered")),U.setAttribute("data-highlighted",""),U.focus();let se=U.closest("[data-menu-id]");se&&se.setAttribute("data-keyboard-nav","");}return}if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),p?.closeAll(),K.closest('[role="menu"]')&&document.querySelector('[aria-expanded="true"][aria-haspopup="menu"]')?.focus();return}if($.key==="ArrowDown"){$.preventDefault(),$.stopPropagation();let _=K.closest("[data-menu-id]")||K.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),v&&v.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(N=>N.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(N=>N.removeAttribute("data-hovered")),S(K,(N,U)=>(U+1)%N);return}if($.key==="ArrowUp"){$.preventDefault(),$.stopPropagation();let _=K.closest("[data-menu-id]")||K.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),v&&v.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(N=>N.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(N=>N.removeAttribute("data-hovered")),S(K,(N,U)=>(U-1+N)%N);return}if($.key==="Home"){$.preventDefault(),$.stopPropagation();let _=K.closest("[data-menu-id]")||K.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(N=>N.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(N=>N.removeAttribute("data-hovered")),S(K,()=>0);return}if($.key==="End"){$.preventDefault(),$.stopPropagation();let _=K.closest("[data-menu-id]")||K.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(N=>N.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(N=>N.removeAttribute("data-hovered")),S(K,N=>N-1);return}},className:["plainframe-ui-menu-item",c||""].join(" ").trim(),css:css(...[b,...L,i].flat()),...x,onClick:$=>{t||($.currentTarget.removeAttribute("data-highlighted"),E());},children:[l&&jsx("span",{className:"plainframe-ui-menu-item-start",css:y,children:l}),a,(f!=null||W||d)&&jsxs("span",{className:"plainframe-ui-menu-item-end",css:P,children:[f!=null?jsx("span",{className:"plainframe-ui-menu-item-meta",css:css({lineHeight:1,fontSize:T.typography.sizes.sm,color:T.text.secondary,whiteSpace:"nowrap"}),children:f}):null,W,d&&jsx("span",{className:"plainframe-ui-menu-item-selected",css:H,children:jsx(Check,{size:16,strokeWidth:2.5})})]})]})}),mi=de.createContext(null),ps=({values:e,defaultValues:t,onValuesChange:n,children:o})=>{let[r,s]=useState(t??[]),a=e!==void 0,c=a?e:r,i=useRef(c);i.current=c;let l=useRef(n);l.current=n;let u=useCallback(h=>{let f=i.current,I=f.some(x=>Object.is(x,h))?f.filter(x=>!Object.is(x,h)):[...f,h];a||s(I),l.current?.(I);},[a]),d=useMemo(()=>({values:c,toggle:u}),[c,u]);return jsx(mi.Provider,{value:d,children:o})},ao=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,value:r,children:s,__index:a,disabled:c=false,css:i,className:l,startIcon:u,endIcon:d,...h},f){let R=useContext(mi),I=!!R&&r!==void 0,x=!I&&t!==void 0,[C,g]=useState(()=>I?R.values.some(O=>Object.is(O,r)):!!n),p=I?R.values.some(O=>Object.is(O,r)):x?!!t:C,m=V(),D=!!useContext(ft),T=()=>{if(!c)if(I)R.toggle(r);else {let O=!p;x||g(O),o?.(O);}},w=css({width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,marginLeft:D?-1:-3,borderRadius:m.radius.xs,transition:"background-color .12s ease"}),F=css({pointerEvents:"none"}),B=useCallback(O=>{O&&(O.querySelectorAll("[tabindex]").forEach(k=>{k.tabIndex=-1;}),O.querySelectorAll('input, button, a, [role="checkbox"]').forEach(k=>{k.tabIndex=-1;}));},[]),W=jsxs(Fragment,{children:[jsx("span",{ref:B,"data-menu-checkbox-wrapper":true,className:"plainframe-ui-menu-checkbox-wrapper",css:w,"aria-hidden":"true",children:jsx(rr,{size:"sm",checked:p,css:F})}),u]});return jsx(kt,{...h,className:["plainframe-ui-menu-checkbox-item",l||""].join(" ").trim(),ref:f,__index:a,role:"menuitemcheckbox","aria-checked":p,closeOnSelect:false,onSelect:T,disabled:c,startIcon:W,endIcon:d,css:i,selected:false,children:s})});ao.displayName="MenuCheckboxItem";var fi=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,children:r,__index:s,disabled:a=false,css:c,switchSize:i="md",switchCss:l,startIcon:u,className:d,...h},f){let R=t!==void 0,[I,x]=useState(!!n),C=R?!!t:I,p=!!useContext(ft),m=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),v=css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,paddingRight:p?2:void 0}),D=()=>{if(a)return;let w=!C;R||x(w),o?.(w);},T=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}});return jsxs(kt,{...h,className:["plainframe-ui-menu-switch-item",d||""].join(" ").trim(),ref:f,__index:s,disabled:a,closeOnSelect:false,onSelect:D,css:c,selected:false,children:[u&&jsx("span",{className:"plainframe-ui-menu-item-start",css:T,children:u}),jsx("span",{"data-label":true,css:m,className:"plainframe-ui-menu-item-label",children:r}),jsx("span",{className:"plainframe-ui-menu-switch-wrap",css:v,children:jsx(us,{checked:C,css:css({pointerEvents:"none",padding:0,marginRight:-1},l),className:"plainframe-ui-menu-switch",tabIndex:-1,size:i})})]})});fi.displayName="MenuSwitchItem";var gi=de.createContext(null),bi=({value:e,defaultValue:t,onValueChange:n,children:o})=>{let[r,s]=useState(t),a=e??r,c=l=>{e!==void 0||s(l),n?.(l);},i=useMemo(()=>({value:a,onChange:c}),[a]);return jsx(gi.Provider,{value:i,children:o})};bi.displayName="MenuRadioGroup";var Zu=forwardRef(function({value:t,children:n,__index:o,disabled:r=false,css:s,className:a,...c},i){let l=useContext(gi),u=l?.value===t,d=V(),h=css({width:d.spacing.md,display:"inline-flex",justifyContent:"center",alignItems:"center",marginLeft:-1}),f=css({width:7,height:7,borderRadius:"100%",backgroundColor:d.palette.primary[600],transform:u?"scale(1)":"scale(0.4)",opacity:u?1:0,transition:"transform 140ms ease-out, opacity 140ms linear",transformOrigin:"center center"}),R=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"});return jsxs(kt,{...c,className:["plainframe-ui-menu-radio-item",a||""].join(" ").trim(),ref:i,__index:o,role:"menuitemradio","aria-checked":u,closeOnSelect:false,onSelect:()=>{r||l?.onChange?.(t);},disabled:r,css:s,selected:false,children:[jsx("span",{className:"plainframe-ui-menu-radio-dotbox",css:h,children:jsx("span",{className:"plainframe-ui-menu-radio-dot",css:f})}),jsx("span",{className:"plainframe-ui-menu-item-label",css:R,children:n})]})}),rn=forwardRef(function({inset:t,className:n,css:o,children:r,startIcon:s,endIcon:a,wrap:c=false,color:i="primary",...l},u){let d=V(),f=!!useContext(ft),R=i==="primary"?d.text.primary:i==="secondary"?d.text.secondary:d.palette[i]?.[700]??d.text.primary,I=css({display:"flex",alignItems:"center",padding:f?`${d.spacing.sm} ${d.spacing.md}`:`${d.spacing.sm} ${d.spacing.md}`,fontSize:d.typography.sizes.sm,color:R,fontWeight:500,...t?{paddingLeft:`calc(${d.spacing.lg} * 2)`}:null,gap:d.spacing.xs}),x=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:c?"normal":"nowrap"}),C=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,padding:"0 3px 0 2px",marginLeft:-2,"& > svg":{width:16,height:16,display:"block"}}),g=css({display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,lineHeight:0,"& > svg":{width:16,height:16,display:"block"}});return jsxs("div",{ref:u,role:"presentation",className:["plainframe-ui-menu-label",n||""].join(" ").trim(),css:css(I,o),...l,children:[s&&jsx("span",{className:"plainframe-ui-menu-label-start",css:C,children:s}),jsx("span",{className:"plainframe-ui-menu-label-text",css:x,children:r}),a&&jsx("span",{className:"plainframe-ui-menu-label-end",css:g,children:a})]})});rn.displayName="MenuLabel";var Qu=({className:e,css:t,variant:n="full",...o})=>{let r=V(),s=`var(--pfui-panel-pad, ${typeof r.spacing.xs=="number"?r.spacing.xs+"px":String(r.spacing.xs)})`,a=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:"calc(var(--pfui-panel-pad, 0px) * -1)",marginRight:"calc(var(--pfui-panel-pad, 0px) * -1)"}),c=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.md}`,marginRight:`${r.spacing.md}`}),i=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.lg}`,marginRight:0}),l=n==="full"?a:n==="middle"?c:i;return jsx("div",{role:"separator",className:["plainframe-ui-menu-separator",e||""].join(" ").trim(),css:css(l,t),...o})};var ms=ro,lo=0,cr=null,ur=null,pd=()=>typeof window>"u"||typeof document>"u"?0:window.innerWidth-document.documentElement.clientWidth;function md(){if(!(typeof document>"u")){if(lo===0){let e=document.body;cr=e.style.overflow||"",ur=e.style.paddingRight||"";let t=pd();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}lo+=1;}}function fd(){if(!(typeof document>"u")&&(lo>0&&(lo-=1),lo===0)){let e=document.body;cr!==null&&(e.style.overflow=cr),ur!==null&&(e.style.paddingRight=ur),cr=null,ur=null;}}var sn=createContext(null),dr=()=>{let e=useContext(sn);if(!e)throw new Error("DropdownMenu components must be used inside <DropdownMenu>.");return e},co=createContext(null),gd=()=>useContext(co),eo=createContext(null),io=()=>useContext(eo),yi=createContext(null),ir=()=>useContext(yi),xi=createContext(false),bd=()=>useContext(xi),to=createContext({allItemsTabbable:true}),lr=de.createContext(null),fs=()=>useContext(lr);function hd(){let e=[],t=new Set,n={current:false};return {registerCloser(o){return e.push(o),()=>{let r=e.indexOf(o);r>=0&&e.splice(r,1);}},closeAll(){if(!n.current){n.current=true;for(let o=e.length-1;o>=0;o--)try{e[o]();}catch{}queueMicrotask(()=>{n.current=false;});}},registerHoverCtl(o){return t.add(o),()=>t.delete(o)},clearAllHover(){t.forEach(o=>o.clear());},isBusClosingRef:n}}var yd=()=>gd()?.activeIndex??null,vi=0,An=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="click",lockScroll:r=true,size:s="md",children:a})=>{let[c,i]=useState(!!t),l=e??c,u=useCallback(A=>{e===void 0&&i(A),n?.(A);},[e,n]),d=useRef(`pfui-menu-${++vi}`),h=useRef(null),f=useRef([]),R=useRef(null),[I,x]=useState(null),[C,g]=useState(false);useEffect(()=>{l||(x(null),f.current=[],g(false));},[l]);let p=useRef(null),m=useCallback((A,M)=>{if(o!=="hover")return;window.clearTimeout(p.current??0);let b=M??20;p.current=window.setTimeout(()=>u(A),b);},[o,u]),v=useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null);},[]);useEffect(()=>()=>v(),[v]),useEffect(()=>{if(!(!r||!l))return md(),()=>fd()},[l,r]);let D=fs(),[T]=useState(()=>D??hd()),w=useRef(new Set),F=useMemo(()=>({registerSubMenu:A=>(w.current.add(A),()=>w.current.delete(A)),closeAllSubMenus:()=>{w.current.forEach(A=>A());}}),[]),B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:h,listRef:f,floatingRef:R,setActiveIndex:x,scheduleSubmenuHover:m,clearSubmenuHover:v,menuId:d.current}),[l,u,o,x,m,v]),W=useMemo(()=>({activeIndex:I,setActiveIndex:x}),[I,x]),O=useMemo(()=>({isKeyboardNav:C,setIsKeyboardNav:g}),[C]),k=s==="sm";return jsx(lr.Provider,{value:T,children:jsx(ft.Provider,{value:k,children:jsx(eo.Provider,{value:O,children:jsx(yi.Provider,{value:F,children:jsx(co.Provider,{value:W,children:jsx(sn.Provider,{value:B,children:a})})})})})})};An.displayName="DropdownMenu";var Pn=de.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:c,setOpen:i,trigger:l,referenceRef:u,listRef:d,setActiveIndex:h,scheduleSubmenuHover:f,clearSubmenuHover:R,floatingRef:I,menuId:x}=dr(),C=io(),g=ir(),p=!!e&&isValidElement(t),m=p?t:null,v=m&&m.props&&typeof m.props=="object"&&"onKeyDown"in m.props?m.props.onKeyDown:void 0,D=m&&m.props&&typeof m.props=="object"&&"onClick"in m.props?m.props.onClick:void 0,{onKeyDown:T,onClick:w,...F}=s,B=useMemo(()=>ms(a,p&&isValidElement(t)&&"ref"in t?t.ref:void 0,u),[a,p,t,u]),W=useCallback(()=>d.current.filter(Boolean),[d]),O=useCallback(y=>{let P=W();requestAnimationFrame(()=>P[y]?.focus());},[W]),k=useCallback(y=>{if(y.key==="Tab"&&c){y.preventDefault(),C?.setIsKeyboardNav(true);let P=I?.current;if(P){P.setAttribute("data-keyboard-nav","");let H=P.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');H&&(document.querySelectorAll("[data-highlighted]").forEach(L=>L.removeAttribute("data-highlighted")),H.setAttribute("data-highlighted",""),H.focus());}return}if(y.key==="ArrowRight"&&c){let P=document.querySelector("[data-subtrigger][data-hovered]");if(P){y.preventDefault(),y.stopPropagation(),C?.setIsKeyboardNav(true),P.removeAttribute("data-hovered"),P.setAttribute("data-highlighted",""),P.focus(),requestAnimationFrame(()=>{let H=new KeyboardEvent("keydown",{key:"ArrowRight",bubbles:true,cancelable:true});P.dispatchEvent(H);});return}}if(y.key==="ArrowDown"||y.key==="ArrowUp"){if(C?.setIsKeyboardNav(true),!c){y.preventDefault(),i(true),requestAnimationFrame(()=>{let P=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(P){P.setAttribute("data-keyboard-nav","");let H=Array.from(P.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let E=L.closest("[data-submenu-content]");if(E&&E!==P)return false;let S=window.getComputedStyle(L);return S.display!=="none"&&S.visibility!=="hidden"});if(H.length>0){let L=y.key==="ArrowDown"?0:H.length-1;h(L),H[L]?.setAttribute("data-highlighted",""),H[L]?.focus();}}}),v?.(y),T?.(y);return}if(c){y.preventDefault();let P=document.querySelectorAll("[data-hovered]");for(let L of Array.from(P))if(L.closest("[data-submenu-content]")){let S=L.closest('[role="menu"]');if(S){S.setAttribute("data-keyboard-nav","");let z=Array.from(S.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')).filter(K=>{if(K.closest('[role="menu"]')!==S)return false;let _=window.getComputedStyle(K);return _.display!=="none"&&_.visibility!=="hidden"}),$=z.indexOf(L);if(document.querySelectorAll("[data-highlighted]").forEach(K=>K.removeAttribute("data-highlighted")),L.removeAttribute("data-hovered"),$!==-1&&z.length>0){let K=y.key==="ArrowDown"?1:-1,_=($+K+z.length)%z.length;z[_]?.setAttribute("data-highlighted",""),z[_]?.focus();}return}}let H=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(H){H.setAttribute("data-keyboard-nav",""),g?.closeAllSubMenus();let L=Array.from(H.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(E=>{if(E.closest('[role="menu"]')!==H)return false;let S=window.getComputedStyle(E);return S.display!=="none"&&S.visibility!=="hidden"});if(L.length>0){let E=H.querySelector("[data-highlighted]"),S=H.querySelector("[data-hovered]"),z=-1;E?z=L.indexOf(E):S&&(z=L.indexOf(S)),document.querySelectorAll("[data-highlighted]").forEach(_=>_.removeAttribute("data-highlighted")),S&&S.removeAttribute("data-hovered"),z===-1&&(z=y.key==="ArrowDown"?-1:L.length);let $=y.key==="ArrowDown"?1:-1,K=(z+$+L.length)%L.length;h(K),L[K]?.setAttribute("data-highlighted",""),L[K]?.focus();}}v?.(y),T?.(y);return}}if((y.key==="Enter"||y.key===" ")&&!c){y.preventDefault(),C?.setIsKeyboardNav(true),i(true),requestAnimationFrame(()=>{let P=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(P){P.setAttribute("data-keyboard-nav","");let H=Array.from(P.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let E=L.closest("[data-submenu-content]");if(E&&E!==P)return false;let S=window.getComputedStyle(L);return S.display!=="none"&&S.visibility!=="hidden"});H.length>0&&(h(0),H[0]?.setAttribute("data-highlighted",""),H[0]?.focus());}}),v?.(y),T?.(y);return}v?.(y),T?.(y);},[c,i,h,v,T,W,O,d,C,x,I,g]),A=useCallback(y=>{l==="click"&&((y.nativeEvent.composedPath?.()??[]).some(E=>{let S=E;if(!S||!("tagName"in S))return false;let z=String(S.tagName).toUpperCase();if(z==="INPUT"||z==="TEXTAREA"||"isContentEditable"in S&&S.isContentEditable)return true;let $="getAttribute"in S?S.getAttribute("role"):null;return $==="textbox"||$==="combobox"})||(y.stopPropagation(),i(!c))),D?.(y),w?.(y);},[l,c,i,D,w]),M=l==="hover"?{onMouseEnter:()=>{R(),i(true);},onMouseLeave:()=>{f(false);}}:{},b=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0;if(p&&m){let y=m.props,P=y.css,H=typeof y.className=="string"?y.className:void 0,L=typeof y.tabIndex=="number"?y.tabIndex:0,E={ref:B,tabIndex:L,className:[H,o].filter(Boolean).join(" ")||void 0,css:[P,b,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,onClick:A,onKeyDown:k,...M,...F};return cloneElement(m,E)}return jsx("button",{ref:B,className:o,css:[css({display:"inline-block"}),b,r],type:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":c,onClick:A,onKeyDown:k,...M,...F,children:t})});Pn.displayName="DropdownMenuTrigger";var cn=de.forwardRef(({anchor:e,side:t="bottom",align:n="start",sideOffset:o=6,alignOffset:r=0,collisionPadding:s=8,sameWidth:a=false,width:c,height:i,maxHeight:l,unstyled:u=false,closeOnBlur:d=false,allItemsTabbable:h=false,className:f,css:R,children:I,exitPlacement:x,animateOnBusClose:C=true,gap:g,ignoreOutsidePressRefs:p,disableOutsidePressDismiss:m=false,returnFocus:v=false,...D},T)=>{let{open:w,setOpen:F,referenceRef:B,clearSubmenuHover:W,setActiveIndex:O,floatingRef:k,menuId:A}=dr(),M=V(),b=fs(),y=io();useEffect(()=>{if(!b)return;let Z=b.registerCloser(()=>F(false));return ()=>{Z&&Z();}},[b,F]);let P=typeof o=="string"?parseFloat(o):o,H=typeof r=="string"?parseFloat(r):r,L=typeof s=="string"?parseFloat(s):s,E=`${t}${n==="center"?"":`-${n}`}`,S=useCallback(Z=>({getBoundingClientRect:()=>{let oe=Math.round(Z.x),re=Math.round(Z.y);return {x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0,toJSON:()=>({x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0})}},contextElement:void 0}),[]),z=useMemo(()=>{if(!e)return null;if(e instanceof HTMLElement||typeof e=="object"&&e!==null&&"getBoundingClientRect"in e&&typeof e.getBoundingClientRect=="function")return e;let Z=e;return S({x:Z.x,y:Z.y})},[e,S]),{refs:$,x:K,y:_,strategy:N,context:U,update:X}=useFloating({open:w,onOpenChange:F,placement:E,whileElementsMounted:autoUpdate,middleware:[offset({mainAxis:P??0,crossAxis:H??0}),flip({padding:L??8}),shift({padding:L??8}),size({apply({rects:Z,elements:oe}){let re=oe.floating;re.style.boxSizing="border-box",i!=null?re.style.height=typeof i=="number"?`${i}px`:String(i):re.style.removeProperty("height"),c!=null?re.style.width=typeof c=="number"?`${c}px`:String(c):a?re.style.width=`${Math.round(Z.reference.width)}px`:re.style.width="200px",l!=null?re.style.maxHeight=typeof l=="number"?`${l}px`:String(l):re.style.removeProperty("max-height");}})]});useEffect(()=>{z?$.setReference(z):B.current&&$.setReference(B.current);},[$,z,B]),useEffect(()=>{if(!w)return;let Z=z||B.current,oe=$.floating.current;if(!(!Z||!oe))return autoUpdate(Z,oe,X)},[w,z,B,$,X]),useEffect(()=>{X();},[X,a,c,i,l]),useEffect(()=>{w&&!h&&O(0);},[w,h,O]),useEffect(()=>{if(!d||!w)return;let Z=()=>{let oe=document.activeElement,re=B.current,je=$.floating.current;oe&&(re?.contains(oe)||je?.contains(oe)||F(false));};return document.addEventListener("focusin",Z,true),()=>document.removeEventListener("focusin",Z,true)},[d,w,F,B,$.floating]);let se=useDismiss(U,{outsidePressEvent:"pointerdown",escapeKey:true,outsidePress:m?false:Z=>{if(p?.length){let oe=Z.target;for(let re of p)if(re.current?.contains(oe))return false}return true}}),j=useRole(U,{role:"menu"}),{getFloatingProps:J}=useInteractions([se,j]),le=useRef(false);useEffect(()=>{w?le.current=true:le.current&&B.current&&v&&(b?.isBusClosingRef.current||requestAnimationFrame(()=>{B.current?.focus();}));},[w,B,b,v]);let ue=typeof M.spacing.xs=="number"?`${M.spacing.xs}px`:String(M.spacing.xs),fe=g===void 0?void 0:typeof g=="number"?g:M.spacing[g]??g,Fe=u?void 0:css({boxSizing:"border-box",background:M.surface.panelBg,border:`${M.componentHeights.border} solid ${M.surface.border}`,borderRadius:M.radius.lg,boxShadow:"0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)","--pfui-panel-pad":ue,padding:"var(--pfui-panel-pad)",color:M.text.primary,maxHeight:l,overflowY:"auto",display:"flex",flexDirection:"column",gap:fe,"& > *":{flexShrink:0},"&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),ve=-1,ye=Z=>{if(!Z||typeof Z!="object"||!isValidElement(Z))return Z;let re=Z.type?.displayName;if(re==="DropdownMenu"||re==="DropdownMenuSub")return Z;if(re==="MenuItem"||re==="MenuCheckboxItem"||re==="MenuRadioItem"||re==="MenuSwitchItem")return ve+=1,cloneElement(Z,{__index:ve,key:Z.key??ve});if(re==="DropdownMenuTrigger"){let Le=Z.props.children;return cloneElement(Z,{children:de.Children.map(Le,ye)})}if(re==="DropdownMenuSubTrigger"){ve+=1;let Le=ve;return cloneElement(Z,{__index:Le,key:Z.key??Le})}let je=Z.props.children;return je==null?Z:cloneElement(Z,{children:de.Children.map(je,ye)})},we=de.Children.map(I,ye),Re=U.placement.split("-")[0]||"bottom",be=Re==="bottom"?"center top":Re==="top"?"center bottom":Re==="left"?"right center":"left center",ne=Re==="bottom"?{opacity:0,y:-8,scale:.96}:Re==="top"?{opacity:0,y:8,scale:.96}:Re==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},G=x??Re,ie=G==="bottom"?{opacity:0,y:-8,scale:.96}:G==="top"?{opacity:0,y:8,scale:.96}:G==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},Q=!!b?.isBusClosingRef.current&&!C?{scale:{duration:0},x:{duration:0},y:{duration:0},opacity:{duration:0}}:{scale:{type:"spring",stiffness:520,damping:38,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.12,ease:"linear"}},ae=css({position:N,top:_??0,left:K??0,zIndex:1e3,transformOrigin:be}),pe=useCallback(Z=>{if(Z.key==="Tab"){Z.preventDefault();return}if(Z.key==="ArrowDown"||Z.key==="ArrowUp"){Z.preventDefault(),y?.setIsKeyboardNav(true);let oe=Z.currentTarget;oe.setAttribute("data-keyboard-nav","");let re=Array.from(oe.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(je=>{if(je.closest('[role="menu"]')!==oe)return false;let Le=window.getComputedStyle(je);return Le.display!=="none"&&Le.visibility!=="hidden"});if(re.length>0){let je=oe.querySelector("[data-highlighted]"),Le=oe.querySelector("[data-hovered]"),wt=-1;je?wt=re.indexOf(je):Le&&(wt=re.indexOf(Le)),document.querySelectorAll("[data-highlighted]").forEach(xn=>xn.removeAttribute("data-highlighted")),Le&&Le.removeAttribute("data-hovered"),wt===-1&&(wt=Z.key==="ArrowDown"?-1:re.length);let Un=Z.key==="ArrowDown"?1:-1,Ke=(wt+Un+re.length)%re.length;O(Ke),re[Ke]?.setAttribute("data-highlighted",""),re[Ke]?.focus();}}},[y,O]),Ae=useCallback(Z=>{let oe=Z.currentTarget;oe.removeAttribute("data-keyboard-nav"),oe.querySelectorAll("[data-highlighted]").forEach(re=>re.removeAttribute("data-highlighted")),y?.isKeyboardNav&&y.setIsKeyboardNav(false);},[y]),He=useCallback(Z=>{Z.removeAttribute("data-keyboard-nav"),Z.querySelectorAll("[data-highlighted]").forEach(oe=>oe.removeAttribute("data-highlighted")),y?.isKeyboardNav&&y.setIsKeyboardNav(false);},[y]);return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:w?jsx(to.Provider,{value:{allItemsTabbable:h},children:jsx(motion.div,{...J({...D,ref:ms(T,$.setFloating,Z=>{k&&(k.current=Z);})}),"data-menu-id":A,"data-keyboard-nav":y?.isKeyboardNav?"":void 0,className:f,css:[Fe,ae,R],initial:ne,animate:{opacity:1,x:0,y:0,scale:1},exit:ie,transition:Q,onPointerMove:Z=>He(Z.currentTarget),onPointerDown:Z=>He(Z.currentTarget),onKeyDown:pe,onMouseMove:Ae,onMouseEnter:()=>{W(),b?.clearAllHover();},onMouseLeave:()=>{document.querySelectorAll("[data-hovered]").forEach(Z=>Z.removeAttribute("data-hovered"));},children:we})}):null})})});cn.displayName="DropdownMenuContent";var Ci=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="hover",dense:r,children:s})=>{let a=bd(),[c,i]=useState(!!t),l=e??c,u=useCallback(k=>{e===void 0&&i(k),n?.(k);},[e,n]),d=useRef(null),h=useRef(false),f=useCallback((k,A)=>{if(o!=="hover")return;window.clearTimeout(d.current??0),h.current=k;let M=A??20;d.current=window.setTimeout(()=>{h.current=false,u(k);},M);},[o,u]),R=useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null,h.current=false);},[]);useEffect(()=>()=>R(),[R]);let I=ir();useEffect(()=>{if(!I)return;let k=()=>{R(),u(false);};return I.registerSubMenu(k)},[I,u,R]);let x=useRef(`pfui-submenu-${++vi}`),C=useRef(null),g=useRef([]),p=useRef(null),[m,v]=useState(null),[D,T]=useState(false);useEffect(()=>{l||(v(null),g.current=[],T(false));},[l]);let w=useContext(ft),F=r??w,B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:C,listRef:g,floatingRef:p,setActiveIndex:v,scheduleSubmenuHover:f,clearSubmenuHover:R,pendingOpenRef:h,menuId:x.current}),[l,u,o,v,f,R]),W=useMemo(()=>({activeIndex:m,setActiveIndex:v}),[m,v]),O=useMemo(()=>({isKeyboardNav:D,setIsKeyboardNav:T}),[D]);return a?(console.warn("[DropdownMenu] Nested submenus are not supported. DropdownMenuSub can only be used one level deep inside DropdownMenu. The nested submenu content will not be rendered."),jsx(Fragment,{children:de.Children.map(s,k=>{if(!isValidElement(k))return k;let A=k.type;return A?.displayName==="DropdownMenuSubTrigger"||A?.displayName==="DropdownMenuSubContent"?null:k})})):jsx(xi.Provider,{value:true,children:jsx(ft.Provider,{value:F,children:jsx(co.Provider,{value:W,children:jsx(eo.Provider,{value:O,children:jsx(sn.Provider,{value:B,children:s})})})})})};Ci.displayName="DropdownMenuSub";var Ri=de.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:c,setOpen:i,trigger:l,referenceRef:u,scheduleSubmenuHover:d,clearSubmenuHover:h,pendingOpenRef:f,menuId:R}=dr(),I=io(),x=useCallback(k=>{k&&(k.__pfuiCloseSubmenu=()=>i(false));},[i]),C=!!e&&isValidElement(t),g=C?t:null,p=g?.props,m=p?.onKeyDown,v=p?.onClick,{onKeyDown:D,onClick:T,...w}=s,F=useMemo(()=>ms(a,C&&isValidElement(t)&&"ref"in t?t.ref:void 0,u,x),[a,C,t,u,x]),B=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0,W=useCallback(k=>{if(k.key==="Tab"){k.preventDefault();return}let A=k.currentTarget,M=b=>{I?.setIsKeyboardNav(true);let y=A.closest("[data-menu-id]");if(!y)return;y.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted"));let P=Array.from(y.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(S=>{if(S.closest("[data-menu-id]")!==y)return false;let z=window.getComputedStyle(S);return z.display!=="none"&&z.visibility!=="hidden"});if(!P.length)return;let H=P.indexOf(A),L=H>=0?H:0,E=b==="next"?(L+1)%P.length:(L-1+P.length)%P.length;P[E]?.setAttribute("data-highlighted",""),P[E]?.focus();};if(k.key==="ArrowDown"){k.preventDefault(),k.stopPropagation(),c&&i(false),M("next");return}if(k.key==="ArrowUp"){k.preventDefault(),k.stopPropagation(),c&&i(false),M("prev");return}if(k.key==="ArrowRight"||k.key==="Enter"||k.key===" "){k.preventDefault(),k.stopPropagation(),I?.setIsKeyboardNav(true);let b=k.currentTarget;i(true),requestAnimationFrame(()=>{let y=R?document.querySelector(`[data-menu-id="${R}"]`):document.querySelector("[data-submenu-content]");if(y){y.setAttribute("data-keyboard-nav",""),b.removeAttribute("data-highlighted"),b.removeAttribute("data-hovered");let P=y.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]):not([data-subtrigger]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');P&&(P.setAttribute("data-highlighted",""),P.focus());}});return}if(k.key==="ArrowLeft"){k.preventDefault(),k.stopPropagation(),c&&i(false);let b=A.closest("[data-menu-id]");b&&b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(y=>y.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(y=>y.removeAttribute("data-hovered")),A.setAttribute("data-highlighted",""),A.focus(),I&&I.setIsKeyboardNav(true);return}if(k.key==="Escape"){k.preventDefault(),k.stopPropagation(),m?.(k);return}m?.(k),D?.(k);},[c,i,m,D,u,I,R]),O=l==="hover"?{onMouseEnter:k=>{let A=k.currentTarget;so(),h(),document.querySelectorAll("[data-hovered]").forEach(b=>b.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),A.setAttribute("data-hovered",""),A.focus({preventScroll:true});let M=A.closest("[data-menu-id]");M?.hasAttribute("data-keyboard-nav")&&M.removeAttribute("data-keyboard-nav"),I&&I.setIsKeyboardNav(false),c||d(true,90);},onMouseMove:k=>{let A=k.currentTarget;so(),A.hasAttribute("data-hovered")||(document.querySelectorAll("[data-hovered]").forEach(M=>M.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(M=>M.removeAttribute("data-highlighted")),A.setAttribute("data-hovered","")),!c&&!f?.current&&d(true,90);},onMouseLeave:()=>{d(false,60);}}:{onClick:k=>{k.stopPropagation(),i(!c),v?.(k),T?.(k);}};if(C&&g){let k=p?.css,A=typeof p?.className=="string"?p.className:void 0,M=typeof p?.tabIndex=="number"?p.tabIndex:0,b={ref:F,tabIndex:M,className:[A,o].filter(Boolean).join(" ")||void 0,css:[k,B,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",__skipListReg:true,onKeyDown:W,onFocus:y=>{if(y.target.hasAttribute("data-highlighted")){let P=y.target.closest("[data-menu-id]");P&&!P.hasAttribute("data-keyboard-nav")&&(P.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}p&&"onFocus"in p&&typeof p.onFocus=="function"&&p.onFocus(y);},...O,...w};return cloneElement(g,b)}return jsx("div",{ref:F,role:"menuitem",tabIndex:0,className:o,css:[css({display:"flex",alignItems:"center",gap:8,cursor:"pointer"}),B,r],"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",onKeyDown:W,onFocus:k=>{if(k.currentTarget.hasAttribute("data-highlighted")){let A=k.currentTarget.closest("[data-menu-id]");A&&!A.hasAttribute("data-keyboard-nav")&&(A.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}},...O,...w,children:t})});Ri.displayName="DropdownMenuSubTrigger";var Ti=de.forwardRef((e,t)=>{let n=fs(),{referenceRef:o,clearSubmenuHover:r,scheduleSubmenuHover:s}=dr(),a=[e.className,"plainframe-ui-submenu-content"].filter(Boolean).join(" ");return jsx(cn,{ref:t,side:"right",align:"start",exitPlacement:"bottom",animateOnBusClose:true,...e,className:a,"data-submenu-content":"",anchor:o.current,onMouseEnter:c=>{r(),n?.clearAllHover(),so(),e.onMouseEnter?.(c);},onMouseLeave:c=>{s(false,60),e.onMouseLeave?.(c);}})});Ti.displayName="DropdownMenuSubContent";var pr=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),Cd=css({display:"inline"}),Ei=css({display:"inline",fontWeight:700}),Rd=css({position:"absolute",inset:0,pointerEvents:"none",opacity:0,zIndex:-1,outline:"none"}),Td=css({display:"flex",alignItems:"center",gap:4}),wd=css({flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2}),Si=css({fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"}),Ed=css({fontSize:"0.875em",overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400}),Sd=()=>{},Id=e=>e,kd=e=>`plainframe-ui-autocomplete${e?`-${e}`:""}`,Md=e=>{e.preventDefault(),e.stopPropagation();},Fd=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());},Ad=e=>{e.preventDefault(),e.stopPropagation();},Ii=de.memo(({onCapture:e})=>{let t=useContext(sn),n=useContext(co),o=useMemo(()=>({...t,activeIndex:n?.activeIndex??null,setActiveIndex:n?.setActiveIndex??t?.setActiveIndex}),[t,n]);return useEffect(()=>{e(o);},[o,e]),null});Ii.displayName="CtxCapture";var gs=de.memo(({item:e,absIndex:t,multiple:n,getCurrentMulti:o,isSelected:r,renderItem:s,paint:a,cls:c,closeOnSelect:i,pickSingle:l,handleItemKeyDown:u,handleItemMouseDown:d,descriptionColor:h})=>{let f=o(),R=useMemo(()=>{let C=String(e.title??e.value);return s?C:a(C)},[a,e.title,e.value,s]),I=useMemo(()=>e.description?jsxs("span",{className:"plainframe-ui-autocomplete-item-content",css:wd,children:[jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Si,children:R}),jsx("span",{className:"plainframe-ui-autocomplete-item-description",css:[Ed,{color:h}],children:e.description})]}):jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Si,children:R}),[R,e.description,h]),x=useCallback(()=>{e.disabled||l(e.value);},[e.disabled,e.value,l]);if(n){let C=f.some(g=>Object.is(g,e.value));return s?jsx(ao,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,children:s(e,C)},e.value):jsx(ao,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,startIcon:e.startIcon,endIcon:e.endIcon,children:I},e.value)}return s?jsx(kt,{__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:i,onMouseDown:d,selected:r,children:s(e,r)},e.value):jsx(kt,{startIcon:e.startIcon,endIcon:e.endIcon,__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:i,onMouseDown:d,selected:r,children:I},e.value)},(e,t)=>!(e.item.value!==t.item.value||e.item.disabled!==t.item.disabled||e.item.description!==t.item.description||e.absIndex!==t.absIndex||e.multiple!==t.multiple||e.closeOnSelect!==t.closeOnSelect||e.renderItem!==t.renderItem||e.pickSingle!==t.pickSingle||e.isSelected!==t.isSelected||e.paint!==t.paint||e.descriptionColor!==t.descriptionColor));gs.displayName="AutocompleteRow";var ki=de.memo(({items:e=[],onSelect:t,width:n=300,fullWidth:o=false,placeholder:r,renderItem:s,focusRingMode:a,css:c,inputCss:i,containerCss:l,label:u,helperText:d,variant:h,startIcon:f,endIcon:R,size:I,disabled:x=false,error:C=false,showClear:g=false,open:p,onOpenChange:m,openOnFocus:v=false,openOnType:D=true,openOnClick:T=true,closeOnSelect:w=true,closeOnBlur:F=true,blurOnSelect:B=false,freeSolo:W=false,customValueLabel:O=false,maxHeight:k,maxItems:A,noResultsText:M="No Items Found",highlightTypedValue:b,typedValueHighlightCss:y,showNoResults:P=true,noResultsLabelCss:H,loadingLabelCss:L,loadItems:E,loading:S,loadingText:z="Loading\u2026",debounceMs:$=200,multiple:K=false,selectedValues:_,defaultSelectedValues:N,onChangeSelected:U,expandIcon:X,showExpandIcon:se=true,expandIconCss:j,textFieldWrapperCss:J,textFieldInputCss:le,textFieldLabelCss:ue,textFieldHelperRowCss:fe,textFieldHelperTextCss:Fe,textFieldStartIconCss:ve,textFieldEndIconCss:ye,menuContentCss:we})=>{let Re=V().text.secondary,[be,ne]=useState(""),G=typeof p=="boolean",[ie,Y]=useState(false),Q=G?p:ie,ae=useRef(null),pe=useRef(null),Ae=useRef(null),He=useRef(null),Z=useRef(false),oe=useRef(null),re=useRef(false),je=useRef(0),Le=useMemo(()=>[pe],[]),[wt,Un]=useState(N??[]),Ke=_??wt,xn=useRef(Ke);xn.current=Ke;let[it,vn]=useState(null),Et=useRef(it);Et.current=it;let Cn=useCallback(()=>xn.current,[]),[qn,Po]=useState([]),[Do,Gn]=useState(false),Ue=typeof E=="function",ut=Ue?qn:e,ce=useRef(ut);ce.current=ut;let Te=!!S||Do&&Ue,Ze=useRef(m);useEffect(()=>{Ze.current=m;},[m]);let ke=useCallback(q=>{G||Y(q),Ze.current?.(q);},[G]),lt=useRef(null);useEffect(()=>{if(!Ue)return;lt.current&&window.clearTimeout(lt.current);let q=be;return lt.current=window.setTimeout(async()=>{Gn(true);try{let te=await E(q)||[];Po(Array.isArray(te)?te:[]);}catch{Po([]);}finally{Gn(false);}},Math.max(0,$)),()=>{lt.current&&window.clearTimeout(lt.current);}},[be,Ue,E,$]);let Xn=useMemo(()=>{let q=pr(be);return q?ut.some(te=>pr(te.title??te.value)===q):false},[ut,be]),ta=W&&!!O&&be.trim().length>0&&!Xn,nc=q=>{if(typeof O=="object"){let te=Object.prototype.hasOwnProperty.call(O,"prefix"),xe=Object.prototype.hasOwnProperty.call(O,"suffix");if(te||xe){let Ee=te?O.prefix??"":"",me=xe?O.suffix??"":"";return `${Ee}${q}${me}`}return `Add "${q}"`}return `Add "${q}"`},Br=useMemo(()=>{if(Ue)return ut;let q=pr(be);if(!q)return ut;let te=[],xe=[];for(let Ee of ut){let me=pr(Ee.title??Ee.value);me.split(" ").some(qe=>qe.startsWith(q))?te.push(Ee):me.includes(q)&&xe.push(Ee);}return te.length>0?te:xe},[ut,be,Ue]),na=useMemo(()=>{if(ta){let q=be.trim();return [...Br,{value:q,title:nc(q),__pfui_free__:true}]}return Br},[Br,ta,be]),Bt=useMemo(()=>{let q=[],te=new Map;for(let ot of na){let qe=ot.group??"__ungrouped__";te.has(qe)||(te.set(qe,[]),q.push(qe)),te.get(qe).push(ot);}let Ee=typeof A=="number"?Math.max(0,A):1/0,me=[];for(let ot of q){if(Ee<=0)break;let Zt=te.get(ot).slice(0,Ee);Zt.length>0&&(me.push({label:ot==="__ungrouped__"?void 0:ot,items:Zt}),Ee-=Zt.length);}return me},[na,A]),Rn=useMemo(()=>Bt.reduce((q,te)=>(q.push(...te.items),q),[]),[Bt]),No=Rn.length>0,$r=!No&&!!P&&!Te&&be.trim().length>0,Tn=Te||No||$r,Ho=Tn||Ue;useEffect(()=>{!Ue&&Q&&!Tn&&(re.current=true,ke(false),setTimeout(()=>{re.current=false;},150));},[Ue,Q,Tn,ke]);let zr=useRef(null),Or=useRef(false);useEffect(()=>{if(W&&!K){if(Or.current){Or.current=false;return}let q=be.trim();if(zr.current===q)return;zr.current=q,t?.({value:q,title:q});}},[be,W,K,t]);let Wr=useCallback(q=>{let te=ce.current,xe=new Map(te.map(me=>[me.value,me])),Ee=q.map(me=>xe.get(me)??{value:me,title:me});U?.(Ee);},[U]),Lo=useCallback(q=>{let te=q.map(String);_||Un(te),Wr(te);},[_,Wr]),oa=useCallback(q=>{let xe=Ke.includes(q)?Ke.filter(Ee=>Ee!==q):[...Ke,q];Lo(xe);},[Ke,Lo]),Bo=useCallback(q=>{let te=ce.current.find(xe=>xe.value===q)??{value:q,title:q};te.disabled||(Or.current=true,zr.current=(te.title??te.value).trim(),vn(te),ne(te.title??te.value),t?.(te),G||(w?(Z.current=false,re.current=true,Y(false),Ze.current?.(false),setTimeout(()=>{re.current=false;},150)):Z.current=true),!w&&Ae.current?.setActiveIndex&&Ae.current.setActiveIndex(null),B?(Z.current=false,setTimeout(()=>{He.current&&ae.current?(He.current.tabIndex=0,He.current.focus(),He.current.blur(),He.current.tabIndex=-1):ae.current?.blur();},0)):requestAnimationFrame(()=>ae.current?.focus()));},[t,G,w,B]),oc=useCallback(q=>{if(x)return;ne(q);let te=!q.trim();K||(te?(vn(null),t?.(null)):W&&vn(null)),!G&&!te&&D&&!Q&&ke(true);},[K,G,D,Q,ke,x,W,t]),Qe=kd,ra=Sd,rc=Id,sa=useMemo(()=>y?[Ei,y]:Ei,[y]),sc=useCallback(q=>{let te=be.trim();if(!te||te.length<1)return q;let xe=te.toLowerCase(),me=q.toLowerCase().indexOf(xe);return me<0?q:jsxs("span",{className:"plainframe-ui-autocomplete-highlight-wrap",css:Cd,children:[q.slice(0,me),jsx("span",{className:"plainframe-ui-autocomplete-highlight",css:sa,children:q.slice(me,me+te.length)}),q.slice(me+te.length)]})},[be,sa]),$o=b?sc:rc,ac=useMemo(()=>css({position:"relative",display:o?"block":"inline-block",width:"100%",maxWidth:o?"100%":n}),[o,n]),zo=Md,Oo=Fd,ic=useCallback(q=>{Ae.current=q;},[]),aa=useCallback(q=>{let te=Ae.current;if(!te)return;let xe=Rn.length;if(xe===0)return;let Ee=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]"),me=-1;if(Ee){let qe=Ee.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]'),Zt=Ee.querySelector("[data-active]")||Ee.querySelector("[data-hovered]");Zt&&(me=Array.from(qe).indexOf(Zt));}me<0&&typeof te.activeIndex=="number"&&(me=te.activeIndex);let ot=me<0?q===1?0:xe-1:(me+q+xe)%xe;te.setActiveIndex?.(ot),requestAnimationFrame(()=>{let qe=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]");if(!qe)return;qe.setAttribute("data-keyboard-nav",""),qe.querySelectorAll("[data-active]").forEach(_r=>_r.removeAttribute("data-active")),qe.querySelectorAll("[data-hovered]").forEach(_r=>_r.removeAttribute("data-hovered"));let Kr=qe.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]')[ot];Kr&&(Kr.setAttribute("data-active",""),Kr.scrollIntoView?.({block:"nearest"}));});},[Rn.length]),lc=useCallback(q=>{if(q.key===" "||q.code==="Space"||q.key==="Spacebar"){q.stopPropagation();return}if(q.key==="ArrowDown"||q.key==="ArrowUp"){if(x||!Tn&&!Ue)return;q.preventDefault(),!Q&&!G&&ke(true),aa(q.key==="ArrowDown"?1:-1);return}if(q.key==="Enter"){if(x)return;let te=Ae.current&&typeof Ae.current.activeIndex=="number"?Ae.current.activeIndex:-1,xe=te>=0&&te<Rn.length?Rn[te]:null;if(Q&&xe&&te>=0){q.preventDefault(),q.stopPropagation(),K?(oa(xe.value),w||requestAnimationFrame(()=>ae.current?.focus())):Bo(xe.value);return}}else q.key==="Escape"?(q.preventDefault(),q.stopPropagation(),Q&&!G&&(re.current=true,ke(false),q.target.focus(),setTimeout(()=>{re.current=false;},150))):q.key==="Tab"&&Q&&!G&&ke(false);},[Tn,Ue,Q,G,Rn,K,w,aa,oa,Bo,ke,x]),cc=useCallback(()=>{x||re.current||v&&Ho&&(je.current=Date.now(),G||ke(true));},[G,v,Ho,ke,x]),uc=useCallback(()=>{if(Z.current){Z.current=false;return}F&&ke(false),!W&&!K&&(it?ne(it.title??it.value):be.trim()&&ne(""));},[F,W,K,it,be,ke]),ia=useCallback(()=>{let q=[],te=0;return Bt.forEach((xe,Ee)=>{xe.label&&q.push(jsx(rn,{className:Qe("group-label"),children:xe.label},`g-${Ee}`)),xe.items.forEach(me=>{q.push(jsx(gs,{item:me,absIndex:te,multiple:true,getCurrentMulti:Cn,isSelected:false,renderItem:s,paint:$o,cls:Qe,closeOnSelect:false,pickSingle:ra,handleItemKeyDown:Oo,handleItemMouseDown:zo,descriptionColor:Re},`${me.group??"__"}|${me.value}`)),te+=1;});}),jsx(ps,{values:Ke,onValuesChange:Lo,children:q},"multi-group")},[Bt,Qe,Cn,s,$o,Ke,Lo,ra,Oo,zo,Re]),la=useCallback(()=>{let q=[],te=0;return Bt.forEach((xe,Ee)=>{xe.label&&q.push(jsx(rn,{className:Qe("group-label"),children:xe.label},`g-${Ee}`)),xe.items.forEach(me=>{let ot=it?.value===me.value;q.push(jsx(gs,{item:me,absIndex:te,multiple:false,getCurrentMulti:Cn,isSelected:ot,renderItem:s,paint:$o,cls:Qe,closeOnSelect:w,pickSingle:Bo,handleItemKeyDown:Oo,handleItemMouseDown:zo,descriptionColor:Re},`${me.group??"__"}|${me.value}`)),te+=1;});}),q},[Bt,Qe,it,Cn,s,$o,w,Bo,Oo,zo,Re]),dc=useMemo(()=>Te?jsx(rn,{css:L,className:Qe("label-loading"),children:z},"loading"):$r?jsx(rn,{css:H,className:Qe("label-empty"),children:M},"empty"):Bt.length===0?null:K?ia():la(),[Te,$r,Bt.length,Qe,z,M,K,ia,la]),Jt=Q?false:x||!Ue&&!No&&!P,ca=useCallback(q=>{q.preventDefault(),q.stopPropagation(),!(Jt||x)&&(G||(Q?(re.current=true,ke(false),queueMicrotask(()=>ae.current?.focus()),setTimeout(()=>{re.current=false;},150)):(ke(true),queueMicrotask(()=>ae.current?.focus()))));},[Q,No,Ue,ke,Jt,x,G]),ua=useMemo(()=>css({transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1), opacity 0.15s ease",transform:Q?"rotate(180deg)":"rotate(0deg)",display:"flex",alignItems:"center",justifyContent:"center",cursor:Jt?"not-allowed":"pointer",userSelect:"none",opacity:Jt?.5:1}),[Q,Jt]),Wo=useMemo(()=>se?jsx("span",{ref:oe,role:"button",tabIndex:-1,css:[ua,j],"aria-disabled":Jt||void 0,onMouseDown:Ad,onClick:ca,children:X??jsx(ChevronDown,{size:18,strokeWidth:2})}):null,[se,ua,j,Jt,ca,X]),pc=useMemo(()=>R&&Wo?jsxs("span",{css:Td,children:[R,Wo]}):R??Wo,[R,Wo]),mc=useCallback(q=>{if(!(oe.current&&oe.current.contains(q.target)||re.current||x||Date.now()-je.current<300)){if(Q){!be.trim()&&!G&&(re.current=true,ke(false),setTimeout(()=>{re.current=false;},150));return}T&&Ho&&(!G||T)&&ke(true);}},[Q,be,T,Ho,ke,x,G]);return jsx("div",{ref:pe,className:Qe(""),css:[ac,l,c],children:jsxs(An,{open:x?false:Q,onOpenChange:x?void 0:ke,children:[jsx(Ii,{onCapture:ic}),jsx(Pn,{asChild:true,children:jsx("span",{className:Qe("anchor"),css:Rd,style:{pointerEvents:"none",position:"absolute",visibility:"hidden"},tabIndex:-1})}),jsx(Zo,{ref:ae,className:Qe("input"),focusRingMode:a,value:be,onChange:oc,onKeyDown:lc,onFocus:cc,onBlur:uc,onSurfaceClick:mc,placeholder:r,label:u,helperText:d,variant:h,startIcon:f,endIcon:pc,size:I,width:n,fullWidth:o,disabled:x,error:C,showClear:g,css:i,wrapperCss:J,inputCss:le,labelCss:ue,helperRowCss:fe,helperTextCss:Fe,startIconCss:ve,endIconCss:ye}),jsx("span",{ref:He,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),Tn&&jsx(cn,{className:Qe("menu"),side:"bottom",align:"start",sameWidth:true,allItemsTabbable:true,maxHeight:typeof k=="number"?`${k}px`:k,css:we,ignoreOutsidePressRefs:Le,disableOutsidePressDismiss:G,returnFocus:!B,children:dc})]})})});ki.displayName="Autocomplete";var Ld=["sm","md","lg"],Bd=(e,t)=>typeof e=="number"?e:Ld.includes(e)?t.componentHeights[e]:t.componentHeights.md,$d=(e,t)=>{let n=e.palette?.[t??"primary"]??e.palette.primary;return n?.[600]??n?.[500]??e.neutral?.[600]??e.neutral?.[500]},zd=(e,t)=>{let n=e.text?.onColors??{};return n[t??"primary"]??n.primary??e.text?.primary??"#fff"},Od=(e,t)=>typeof e=="string"?e:(t?.trim()?.[0]||"").toUpperCase(),Mi=de.memo(forwardRef(({src:e,alt:t,size:n="md",color:o="primary",rounded:r=true,className:s,css:a,children:c,...i},l)=>{let u=V(),[d,h]=useState(!!e);useEffect(()=>{h(!!e);},[e]);let f=Bd(n,u),R=typeof f=="number"?f:Number.parseFloat(String(f))||0,I=R?Math.round(R*(R<=28?.55:.52)):void 0,x=r?u.radius.full:u.radius.md,C=$d(u,o),g=zd(u,o),p=Od(c,t),m=css({width:f,height:f,borderRadius:x,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:d?"transparent":C,color:d?"inherit":g,boxSizing:"border-box",userSelect:"none"}),v=css({width:"100%",height:"100%",display:"block",objectFit:"cover"}),D=css({fontSize:I,lineHeight:1,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",marginTop:-1});return jsx("div",{ref:l,className:["plainframe-ui-avatar",s||""].join(" ").trim(),css:[m,a],role:d?void 0:"img","aria-label":d?void 0:t,...i,children:d&&e?jsx("img",{className:"plainframe-ui-avatar-img",src:e,alt:t,css:v,onError:()=>h(false),decoding:"async",loading:"lazy"}):typeof c=="string"?jsx("span",{className:"plainframe-ui-avatar-initials",css:D,children:c}):c||jsx("span",{className:"plainframe-ui-avatar-initials",css:D,children:p})})}));Mi.displayName="Avatar";var Fi=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Vd=({children:e,max:t,size:n="md",overlap:o=-7,css:r,rounded:s=true,bgColor:a,extraLabelCss:c,outlineThickness:i=4,className:l})=>{let u=V(),d=he(),f=(()=>{if(typeof n=="number")return `${n}px`;if(typeof n=="string"){let T=(u.componentHeights&&u.componentHeights[n])??(u.spacing&&u.spacing[n]);return Fi(T??n)}return "32px"})(),R=Children.toArray(e).filter(Boolean),I=typeof t=="number"&&t>=0,x=I&&R.length>t?R.slice(0,t):R,C=I&&R.length>t?R.length-t:0,g=a==="panel"?u.surface.panelBg:a==="subtle"?u.surface.subtleBg:a??u.surface.appBg,p=Fi(i)??"4px",m=css({display:"flex",alignItems:"center"}),v=T=>css({marginLeft:T===0?0:o,zIndex:x.length-T,boxShadow:`0 0 0 ${p} ${g}`,backgroundColor:g,borderRadius:s?u.radius.full:u.radius.md,display:"inline-flex",width:f,height:f,overflow:"hidden",alignItems:"center",justifyContent:"center",lineHeight:0,flex:"0 0 auto"}),D=css({width:"100%",height:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",objectFit:"cover",boxSizing:"border-box"});return jsxs("div",{role:"group",tabIndex:-1,"aria-label":"Avatar group",className:`plainframe-ui-avatar-group${l?` ${l}`:""}`,css:[m,r,d()],children:[x.map((T,w)=>{if(!isValidElement(T))return jsx("div",{className:"plainframe-ui-avatar-group-item",css:v(w),children:jsx("span",{css:D,children:T})},w);let F=T,B=F.props?.css,W=B==null?D:[D,B],O=cloneElement(F,{size:n,rounded:s,css:W,style:{...F.props?.style,width:"100%",height:"100%",objectFit:F.props?.objectFit??"cover"}});return jsx("div",{className:"plainframe-ui-avatar-group-item",css:v(w),children:O},w)}),C>0&&jsxs("span",{className:"plainframe-ui-avatar-group-extra",css:[css({marginLeft:5,fontSize:u.typography.sizes.sm,fontWeight:600,lineHeight:1,padding:"2px 1px",zIndex:2,color:u.text.secondary}),c],"aria-label":`+${C} more`,children:["+",C]})]})};var Di=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Ud=(e,t)=>{let n=e,o=n.palette||{},r=n.neutral||{};return t==="neutral"||t==="secondary"?{scale:r,onKey:"neutral"}:typeof t=="string"&&o[t]?{scale:o[t],onKey:t}:{scale:n.primary||r,onKey:"primary"}},qd=e=>e[600]??e[500]??e[400]??Object.values(e)[0]??"#000",Gd=(e,t,n,o)=>o??t[n]??t.primary??e.text?.primary??"#fff",Xd=(e,t,n)=>n==="dot"?"":typeof e=="number"&&typeof t=="number"&&e>t?`${t}+`:e??"",Yd=(e,t,n,o)=>e&&(t==="dot"||!!n||n===0&&o),Jd=de.memo(({content:e,color:t="primary",fontColor:n,fontWeight:o=600,fontSize:r,variant:s="dot",max:a=99,showZero:c=false,visible:i=true,anchorOrigin:l={vertical:"top",horizontal:"right"},overlap:u="rectangular",children:d,animate:h=true,size:f,outline:R=false,outlineColor:I,className:x,badgeClassName:C,css:g,badgeCss:p,offsetX:m,offsetY:v})=>{let D=V(),T=s==="dot",w=f??(T?8:17),F=r??(T?0:10),{scale:B,onKey:W}=Ud(D,t),O=qd(B),k=D.text?.onColors||{},A=Gd(D,k,W,n),M=Xd(e,a,s),b=Yd(i,s,e,c),y=css({position:"relative",display:"inline-block"}),P=u==="circular"?T?"12.5%":"5%":T?"5%":"2.5%",H=Di(m??P),L=Di(v??P),E=l.vertical||"top",S=l.horizontal||"right",z={},$="0",K="0";E==="center"?(z.top="50%",K="-50%"):E==="top"?(z.top=L,K="-45%"):(z.bottom=L,K="45%"),S==="center"?(z.left="50%",$="-50%"):S==="right"?(z.right=H,$="45%"):(z.left=H,$="-45%");let _=b?1:.8,N=css({minWidth:T?w:w/2,height:w,background:O,color:A,fontSize:typeof F=="number"?`${F}px`:F,fontWeight:o,borderRadius:999,padding:T?0:`0 ${w/4}px`,boxShadow:"0 2px 8px rgba(0,0,0,0.04)",lineHeight:1,position:"absolute",pointerEvents:"none",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",...R?{boxShadow:`0 0 0 2px ${I??D.surface?.appBg}`}:{},opacity:b?1:0,transform:`translate(${$}, ${K}) scale(${b?_:.5})`,...h?{transition:"opacity .18s cubic-bezier(.4,1.6,.6,1), transform .18s cubic-bezier(.4,1.6,.6,1)"}:{},...z});return jsxs("div",{className:["plainframe-ui-badge-wrapper",x||""].join(" ").trim(),css:[y,g],children:[d,jsx("span",{"aria-hidden":!b,className:["plainframe-ui-badge",C||""].join(" ").trim(),css:[N,p],children:M})]})});var Rs=({on:e,onClickAway:t,blur:n=false,blurDepth:o=2.5,color:r,zIndex:s=1e3,css:a,contentCss:c,overlayCss:i,children:l,transitionDuration:u=300,keepMounted:d=true,className:h,contentClassName:f,lockScroll:R=true,...I})=>{let x=V(),C=useMemo(()=>r??x.surface.overlayBg,[r,x.surface.overlayBg]),[g,p]=useState(e),[m,v]=useState(e),D=useRef(null),T=useRef(null),w=useRef(null);useEffect(()=>(D.current&&(clearTimeout(D.current),D.current=null),T.current!=null&&(cancelAnimationFrame(T.current),T.current=null),e?(p(true),T.current=requestAnimationFrame(()=>{v(true),T.current=null;})):(v(false),D.current=setTimeout(()=>{p(false),D.current=null;},u)),()=>{D.current&&(clearTimeout(D.current),D.current=null),T.current!=null&&(cancelAnimationFrame(T.current),T.current=null);}),[e,u]),useEffect(()=>{if(!R||!e)return;let A=document.body,M=A.style.overflow,b=A.style.paddingRight,y=window.innerWidth-document.documentElement.clientWidth,P=parseFloat(getComputedStyle(A).paddingRight||"0");return A.style.overflow="hidden",y>0&&(A.style.paddingRight=`${P+y}px`),()=>{A.style.overflow=M,A.style.paddingRight=b;}},[e,R]),useEffect(()=>{if(!m||!t)return;let A=M=>{M.key==="Escape"&&t();};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[m,t]);let F=A=>{if(!m||!t||!w.current)return;let M=A.target;M&&!w.current.contains(M)&&t();},B=n&&o?typeof o=="number"?`${o}px`:o:void 0;if(!d&&!g)return null;let W=css({position:"fixed",inset:0,width:"100vw",height:"100vh",zIndex:s,display:"grid",placeItems:"center",pointerEvents:m?"auto":"none",visibility:g?"visible":"hidden"}),O=css({position:"absolute",inset:0,background:C,backdropFilter:B?`blur(${B})`:void 0,WebkitBackdropFilter:B?`blur(${B})`:void 0,opacity:m?1:0,transition:`opacity ${u}ms cubic-bezier(.4,0,.2,1)`,pointerEvents:m?"auto":"none"}),k=css({position:"relative",zIndex:1,pointerEvents:m?"auto":"none"});return jsxs("div",{"aria-hidden":!g||void 0,className:["plainframe-ui-backdrop",h||""].join(" ").trim(),css:[W,a],onPointerDown:F,...I,children:[jsx("div",{className:"plainframe-ui-backdrop-overlay",css:[O,i],role:"presentation"}),jsx("div",{ref:w,className:["plainframe-ui-backdrop-content",f||""].join(" ").trim(),css:[k,c],children:l})]})};var br=()=>null;Object.defineProperty(br,"displayName",{value:"PF.BreadCrumbItem",configurable:true});function np(e){let t=e.props??{};return {type:typeof t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__<"u"?t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__:e.type,props:t}}var op=de.memo(({children:e,separator:t="/",css:n,crumbCss:o,activeCrumbCss:r,inactiveCrumbCss:s,linkCrumbCss:a,separatorCss:c,hover:i=true,className:l,...u})=>{let d=V(),h=he(),f=de.useMemo(()=>de.Children.toArray(e).flatMap(p=>{if(!de.isValidElement(p))return [];let{type:m,props:v}=np(p);if(!(m===br||typeof m=="function"&&"displayName"in m&&m.displayName===br.displayName))return [];let T=v;return [{href:T.href,disabled:T.disabled,node:T.children,className:T.className,css:T.css,onClick:T.onClick,startIcon:T.startIcon,endIcon:T.endIcon}]}),[e]),R=de.useMemo(()=>css({display:"flex",alignItems:"center",fontSize:d.typography.sizes.sm,fontWeight:500,gap:d.spacing.xs,cursor:"default"}),[d]),I=de.useMemo(()=>css({margin:"0 0.15rem",color:d.neutral[500],flex:"0 0 auto",justifyContent:"center",alignItems:"center",display:"flex"}),[d]),x=de.useCallback((p,m,v)=>{let D=p?d.text.primary:d.text.secondary,T=i&&m&&!v;return css({display:"inline-flex",alignItems:"center",gap:d.spacing.xs,color:D,cursor:m&&!v?"pointer":"default",textDecoration:"none",borderRadius:d.radius.xs,fontWeight:500,outline:"none",transition:"all .16s ease !important","&:hover":T?{textDecoration:"underline",color:d.text.primary}:{textDecoration:"none"}})},[d,i]),C=de.useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0}),[]),g=de.useMemo(()=>css({display:"inline-block"}),[]);return jsx("nav",{"aria-label":"Breadcrumb",className:["plainframe-ui-breadcrumbs",l||""].join(" ").trim(),css:[R,n],...u,children:f.map((p,m)=>{let v=m===f.length-1,D=!!p.href&&!p.disabled&&!v,T=["plainframe-ui-breadcrumb",v?"plainframe-ui-breadcrumb--active":"plainframe-ui-breadcrumb--inactive",D?"plainframe-ui-breadcrumb--link":"",p.className||""].join(" ").trim(),w=[x(v,D,p.disabled),o,v?r:s,D?a:void 0,h(),p.css],F=jsxs(Fragment,{children:[p.startIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-start",css:C,children:p.startIcon}),jsx("span",{className:"plainframe-ui-breadcrumb-label",css:g,children:p.node}),p.endIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-end",css:C,children:p.endIcon})]});return jsxs(de.Fragment,{children:[m!==0&&jsx("span",{className:"plainframe-ui-breadcrumb-separator",css:[I,c],children:t}),D?jsx("a",{href:p.href,onClick:p.onClick,tabIndex:0,"data-active":v?"true":"false","data-link":"true",className:T,css:w,children:F}):jsx("span",{"aria-current":v?"page":void 0,tabIndex:v?-1:0,"data-active":v?"true":"false","data-link":"false",className:T,css:w,children:F})]},m)})})});var Ts=(e,t)=>{if(!isValidElement(e))return e;let n=e.props,o={};return n.size===void 0&&(o.size=t),n.color===void 0&&(o.color="currentColor"),cloneElement(e,{...n,...o})},ws=e=>typeof e=="number"?`${e}px`:e,Bi=e=>{let t=false;return de.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&Bi(n)&&(t=true));}),t};function ip(e,t){let n=e,o=typeof t=="string"&&(t==="sm"||t==="md"||t==="lg")?t:"md";return o==="sm"?{fontSize:n.typography.sizes.sm,paddingY:n.spacing.xs,paddingX:n.spacing.md,paddingXIcon:n.spacing.md,iconSize:14,minHeight:n.componentHeights.sm,radius:n.radius.sm}:o==="lg"?{fontSize:n.typography.sizes.md,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:18,minHeight:n.componentHeights.lg,radius:n.radius.md}:{fontSize:n.typography.sizes.sm,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:16,minHeight:n.componentHeights.md,radius:n.radius.md}}function lp(e,t){let n=e.neutral,o=e.text,r=e.palette,s=r.primary||n,a=r.danger||r.error||s,c=e.text.onColors||{},i=c.primary??o.onColors.primary,l=c.danger??i,u=(d,h,f)=>d&&d[h]||f;if(t==="primary"){let d=s,h=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:h,fg:i,hoverBg:f,border:"none"}}if(t==="destructive"){let d=a,h=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:h,fg:l,hoverBg:f,border:"none"}}return t==="ghost-destructive"?{bg:"transparent",fg:a[700],hoverBg:e.palette.danger[50],border:"none"}:t==="subtle"?{bg:e.surface.subtleBg,fg:o.primary,hoverBg:e.surface.subtleHover,border:"none"}:t==="outlined"?{bg:e.surface.panelBg,fg:o.primary,hoverBg:e.surface.panelHover,border:`${e.componentHeights.border} solid ${e.surface.border}`}:t==="ghost"?{bg:"transparent",fg:e.text.primary,hoverBg:e.surface.subtleBg,border:"none"}:t==="quiet"?{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}:{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}}var $i=de.memo(de.forwardRef(({variant:e="primary",size:t="md",startIcon:n,endIcon:o,rounded:r=false,fullWidth:s=false,disabled:a=false,loading:c=false,loadingIndicator:i,loadingPosition:l="center",children:u,className:d,hoverEffect:h=true,icon:f,onClick:R,css:I,...x},C)=>{let g=V(),p=he(),m=useMemo(()=>ip(g,t),[g,t]),v=useMemo(()=>lp(g,e),[g,e]),D=useMemo(()=>f===true?true:f===false?false:!n&&!o&&!Bi(u)&&de.Children.count(u)===1,[f,n,o,u]),T=m.iconSize,w=useMemo(()=>Ts(n,T),[n,T]),F=useMemo(()=>Ts(o,T),[o,T]),B=useMemo(()=>i??jsx(Qn,{color:v.fg,variant:"circular",size:14,thickness:5}),[i,v]),W=useMemo(()=>D?"center":l??"center",[D,l]),O=!!c&&W==="center",k=!!c&&W==="start",A=!!c&&W==="end",M=a||c,b=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",gap:0,width:s?"100%":"auto",minHeight:m.minHeight,lineHeight:1,fontWeight:600,cursor:M?"not-allowed":"pointer",opacity:M?.5:1,userSelect:"none",position:"relative",borderRadius:r?g.radius.full:m.radius,outline:"none",willChange:"box-shadow, transform, outline-offset",transition:"box-shadow 140ms ease, transform 90ms ease, outline-offset 140ms ease"}),[s,m,r,g,M]),y=useMemo(()=>css({backgroundColor:v.bg,color:v.fg,border:v.border}),[v]),P=useMemo(()=>css({overflow:"hidden","::before":{content:'""',position:"absolute",inset:0,backgroundColor:v.hoverBg,opacity:0,pointerEvents:"none",transition:"opacity 140ms ease",zIndex:0},"@media (hover: hover) and (pointer: fine)":h&&!M?{":hover::before":{opacity:1}}:{}}),[v,h,M]),H=useMemo(()=>css(D&&!s?{width:"100%",height:"100%",maxWidth:m.minHeight,minWidth:m.minHeight,maxHeight:m.minHeight,display:"flex",alignItems:"center",justifyContent:"center",fontSize:ws(m.iconSize)}:{fontSize:ws(m.fontSize),padding:n||o?`${m.paddingY} ${m.paddingXIcon}`:`${m.paddingY} ${m.paddingX}`}),[D,s,m,n,o]),L=useMemo(()=>css({position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:ws(g.spacing.sm),opacity:O?0:1,transition:"opacity 140ms ease"}),[g,O]),E=useMemo(()=>css({height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),[]),S=useMemo(()=>typeof m.iconSize=="number"?m.iconSize:Math.max(12,Math.round(parseFloat(String(m.iconSize))||16)),[m.iconSize]),z=useMemo(()=>css({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:S,minWidth:S,maxWidth:S,height:"1em"}),[S]),$=useMemo(()=>X=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:X?1:0,transition:"opacity 140ms ease"}),[]),K=useMemo(()=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:O?1:0,pointerEvents:"none",zIndex:2,transition:"opacity 140ms ease"}),[O]),_=useMemo(()=>()=>{if(D)return null;let X=!!n;return !X&&!k?null:jsxs("span",{css:z,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!k),children:X?w||n:null}),jsx("span",{css:$(!!k),children:B})]})},[D,n,k,z,$,w,c,B]),N=useMemo(()=>()=>{if(D)return null;let X=!!o;return !X&&!A?null:jsxs("span",{css:z,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!A),children:X?F||o:null}),jsx("span",{css:$(!!A),children:B})]})},[D,o,A,z,$,F,c,B]),U=!(a||c);return jsxs("button",{ref:C,type:"type"in x&&x.type?x.type:"button","data-variant":e,className:["plainframe-ui-button",d||""].join(" ").trim(),css:[b,p({color:e==="primary"?"primary":e==="destructive"||e==="ghost-destructive"?"danger":"neutral"}),y,P,H,I],onClick:U?R:void 0,disabled:a||void 0,tabIndex:c?-1:void 0,"aria-disabled":a||void 0,"aria-busy":c||void 0,...x,children:[jsxs("span",{className:"plainframe-ui-button-content",css:L,children:[_(),jsx("span",{className:"plainframe-ui-button-label",css:E,children:D?c?B:Ts(u,m.iconSize):u}),N()]}),jsx("span",{className:"plainframe-ui-button-center-overlay",css:K,"aria-hidden":"true",children:O?B:null})]})}));$i.displayName="Button";var vr=e=>isValidElement(e),cp=e=>{let t=e.type;return t.displayName??t.name},ks=(e,t)=>cp(e)===t,Wi=e=>ks(e,"ButtonGroup"),Ki=e=>ks(e,"DropdownMenu"),Ss=e=>ks(e,"DropdownMenuTrigger"),Hn=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,up=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,dp=e=>typeof e=="string"&&/^(outlined|outlined-soft|outline-soft)$/i.test(e),Is=(e,t)=>{if(!vr(e))return null;if(Wi(e)){let n=Children.toArray(e.props.children).filter(isValidElement);return n.length?Is(t?n[0]:n[n.length-1],t):null}if(Ki(e)){let o=Children.toArray(e.props.children).filter(isValidElement).find(Ss);return o?Is(o,t):null}if(Ss(e)){let n=Children.toArray(e.props.children??[]).filter(isValidElement);return n.length?n[0]:null}return e},Oi=(e,t)=>{if(!e)return false;let n=Is(e,t==="left"),o=n&&n.props&&typeof n.props=="object"?n.props.variant:void 0;return dp(o)},_i=de.memo(de.forwardRef(function({children:t,attached:n=false,direction:o="horizontal",fullWidth:r=false,disabled:s=false,size:a="md",rounded:c=false,gap:i,width:l,className:u,role:d="group",css:h,__clipLeft:f,__clipRight:R,...I},x){let C=V(),g=a==="sm"?C.radius.sm:C.radius.md,p=c?C.radius.full:g,m=o==="vertical",v=up(C.componentHeights.border,1),D=C.surface.border,T=n&&!!f,w=n&&!!R,F=css({display:"flex",flexDirection:m?"column":"row",width:r?"100%":l!=null?Hn(l):"auto",maxWidth:"none",backgroundColor:"transparent",gap:n?0:Hn(i??C.spacing.sm)}),B=Children.toArray(t),O=B.filter(vr).length,k=0,A=false,M=[];for(let b of B){if(!vr(b)){M.push(b);continue}let y=k===0,P=k===O-1,H=b.props??{},L=H.disabled??s,E=H.size??a,S=0,z=0,$=0,K=0;n&&(m?(S=y?T?0:p:0,z=y?w?0:p:0,K=P?T?0:p:0,$=P?w?0:p:0):(S=y?T?0:p:0,K=y?T?0:p:0,z=P?w?0:p:0,$=P?w?0:p:0));let _=Oi(b,"left"),N=Oi(b,"right"),se=n&&!y&&!(A&&_)&&!(A||_)?css({[m?"borderTop":"borderLeft"]:`${v} solid ${D}`}):null,j=n&&!y&&A&&_?css(m?{borderTopWidth:0}:{borderLeftWidth:0}):null,J=n?css({borderTopLeftRadius:Hn(S),borderTopRightRadius:Hn(z),borderBottomRightRadius:Hn($),borderBottomLeftRadius:Hn(K)}):null,le=r?css({flex:"1 1 0%",minWidth:0,width:"100%"}):null,ue=css([J,se,j,le]);if(!Ki(b)){let ye=H.css,we=[H.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" "),Ce=Wi(b)&&n?{__clipLeft:!y,__clipRight:!P}:{},Re=cloneElement(b,{...H,disabled:L,size:E,className:we,css:[ye,ue],...Ce});M.push(Re),A=N,k+=1;continue}let fe=H.children,Fe=Children.map(fe,ye=>{if(!vr(ye)||!Ss(ye))return ye;let we=ye.props,Ce=[we.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" ");return cloneElement(ye,{...we,css:[we.css,ue],className:Ce,disabled:L,size:E})}),ve=cloneElement(b,{...H,children:Fe});M.push(ve),A=N,k+=1;}return jsx("div",{ref:x,role:d,"aria-orientation":m?"vertical":"horizontal","data-attached":n||void 0,"data-direction":o,className:["plainframe-ui-button-group",u||""].join(" ").trim(),css:[F,h],...I,children:M})}));_i.displayName="ButtonGroup";var Cr=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,hp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;return Cr(n?.[e]??e)}}},yp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius??t.radii;return Cr(n?.[e]??e)}}},xp=(e,t)=>{let n=t.surface??{};return e==="panel"||e==="outlined"?n.panelBg??"transparent":e==="subtle"?n.subtleBg??"transparent":"transparent"},vp=(e,t,n)=>{let o=t.surface??{};return e==="panel"||e==="outlined"?o.panelHover??o.panelBg??n:e==="subtle"?o.subtleHover??o.subtleBg??n:o.subtleBg??n},Ln=de.memo(forwardRef(function({children:t,css:n,variant:o="ghost",padding:r,radius:s,className:a,hoverable:c,selectable:i,selected:l,defaultSelected:u,onSelectedChange:d,width:h,height:f,onClick:R,onKeyDown:I,role:x,tabIndex:C,...g},p){let m=V(),v=m.surface??{},[D,T]=useState(!!u),w=l!=null,F=w?!!l:D,B=useMemo(()=>xp(o,m),[o,m]),W=useMemo(()=>vp(o,m,B),[o,m,B]),O=W,k=useMemo(()=>hp(r,m),[r,m]),A=useMemo(()=>yp(s,m),[s,m]),M=!!c||!!i,b=useMemo(()=>css({backgroundColor:B,padding:k,borderRadius:A,border:o==="outlined"?`${m.componentHeights?.border??"1px"} solid ${v.border??"transparent"}`:void 0,backgroundClip:"padding-box",boxSizing:"border-box",width:h?"100%":void 0,maxWidth:Cr(h),height:Cr(f),outline:"none",transition:"background-color .16s ease, border-color .16s ease",cursor:M?"pointer":void 0,...M?{"&:hover":{backgroundColor:W}}:{},'&[data-selected="true"]':{backgroundColor:O},...M?{'&[data-selected="true"]:hover':{backgroundColor:O}}:{}}),[B,k,A,o,m.componentHeights,v.border,h,f,M,W,O]),y=useCallback(()=>{if(!i)return;let E=!F;w||T(E),d?.(E);},[w,d,i,F]),P=useCallback(E=>{i&&y(),R?.(E);},[i,y,R]),H=useCallback(E=>{i&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),y()),I?.(E);},[i,y,I]),L=he();return jsx("div",{ref:p,"data-variant":o,"data-selected":i&&F?"true":void 0,"aria-pressed":i?F:void 0,className:["plainframe-ui-container",a||""].join(" ").trim(),css:[L(),b,n],onClick:P,onKeyDown:H,role:i?x??"button":x,tabIndex:i?C??0:C,...g,children:t})}));Ln.displayName="Container";var Rp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Fs(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;if(n&&e in n){let o=n[e];return Rp(o)}return e}}}function go(e){switch(e){case "center":return "center";case "end":return "flex-end";case "start":default:return "flex-start"}}function As(e){switch(e){case "center":return "center";case "end":return "right";case "start":default:return "left"}}function Tp(e,t){if(e==null)return t.spacing?.md??void 0;if(typeof e=="number")return e;if(typeof e=="string"){let n=t.spacing??t.space??{};return e in n?n[e]:e}}function bo(e,t,n,o){let r=Fs(t,e),s=Fs(n,e),a=Fs(o,e),c={};return r&&!s&&!a&&(c.padding=r),s&&(c.paddingLeft=s,c.paddingRight=s),a&&(c.paddingTop=a,c.paddingBottom=a),c}function Vi(e,t){if(t)return t==="primary"?e.text?.primary:t==="secondary"?e.text?.secondary:t}var ji=de.createContext("horizontal"),Ps=()=>de.useContext(ji),Ui=de.memo(de.forwardRef(({children:e,css:t,variant:n="ghost",padding:o="md",radius:r="lg",hoverable:s,selectable:a,selected:c,defaultSelected:i,onSelectedChange:l,width:u="100%",height:d,gap:h,direction:f="horizontal",className:R,onClick:I,...x},C)=>{let g=V(),p=he(),m=f==="vertical",v=css({position:"relative",display:"flex",flexDirection:m?"column":"row",gap:Tp(h,g),alignItems:m?"stretch":"center",transition:"all .16s ease"});return jsx(ji.Provider,{value:f,children:jsx(Ln,{ref:C,variant:n,padding:o,radius:r,hoverable:s,selectable:a,selected:c,defaultSelected:i,onSelectedChange:l,width:u,height:d,className:["plainframe-ui-card",R||""].join(" ").trim(),css:[p(),v,t],onClick:I,tabIndex:I?0:void 0,...x,children:e})})}));Ui.displayName="Card";var wp=de.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Ps()==="vertical",d=css({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:go(o),textAlign:As(o),...u?{width:"100%"}:{flex:1,minWidth:0},...bo(i,r,s,a)});return jsx("div",{"data-slot":"card-content",className:["plainframe-ui-card-content",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ep=de.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Ps()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:go(o),alignItems:go(o),...u?{width:"100%"}:{},...bo(i,r,s,a)});return jsx("div",{"data-slot":"card-start",className:["plainframe-ui-card-start",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Sp=de.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Ps()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:go(o),alignItems:go(o),...u?{width:"100%"}:{},gap:i.spacing.xs,color:i.text.secondary,...bo(i,r,s,a)});return jsx("div",{"data-slot":"card-end",className:["plainframe-ui-card-end",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ip=de.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:c,size:i,color:l,...u})=>{let d=V(),h=css({fontWeight:c??500,fontSize:i??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"1rem"),color:Vi(d,l)??d.text?.primary,textAlign:As(o),...bo(d,r,s,a),display:"flex",alignItems:"center",gap:d.spacing?.xs??6});return jsx("div",{"data-slot":"card-title",className:["plainframe-ui-card-title",n||""].join(" ").trim(),css:[h,t],...u,children:e})}),kp=de.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:c,size:i,color:l,...u})=>{let d=V(),h=css({fontWeight:c??400,fontSize:i??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"0.875rem"),color:Vi(d,l)??d.text?.secondary,marginTop:d.spacing?.xxs??2,textAlign:As(o),...bo(d,r,s,a)});return jsx("div",{"data-slot":"card-description",className:["plainframe-ui-card-description",n||""].join(" ").trim(),css:[h,t],...u,children:e})});var Gi=e=>isValidElement(e),Pp=e=>Gi(e)?e.type?.displayName||e.type?.name:void 0,qi=e=>Pp(e)==="Card",Dp=e=>typeof e=="number"?`${e}px`:e,Xi=({children:e,attached:t=false,gap:n,width:o,direction:r="vertical",variant:s,className:a,role:c="group",css:i})=>{let l=V(),u=r==="vertical",d=String(l.componentHeights?.border??"1px"),h=l.surface.border,f={display:"flex",flexDirection:u?"column":"row",width:typeof o=="string"||typeof o=="number"?Dp(o):"auto",maxWidth:"none",gap:t?0:n??l.spacing?.sm},R=Children.toArray(e),x=R.filter(qi).length,C=0,g=R.map((p,m)=>{if(!qi(p)||!Gi(p))return p;let v=p.props,D=C++,T=D===0,w=D===x-1,F=s??v.variant,B=t?u?{borderTopLeftRadius:T?v.radius:0,borderTopRightRadius:T?v.radius:0,borderBottomLeftRadius:w?v.radius:0,borderBottomRightRadius:w?v.radius:0}:{borderTopLeftRadius:T?v.radius:0,borderBottomLeftRadius:T?v.radius:0,borderTopRightRadius:w?v.radius:0,borderBottomRightRadius:w?v.radius:0}:void 0,W=t&&!T?u?{borderTopWidth:0}:{borderLeftWidth:0}:void 0,O=F==="subtle"&&x>1&&!T?u?{borderTop:`${d} solid ${h}`}:{borderLeft:`${d} solid ${h}`}:null,A=[B,W,O,t?{width:"100%"}:{width:"100%",marginBottom:u?0:void 0,marginRight:u?void 0:0}].filter(Boolean),M=[v.className,"plainframe-ui-card-group-item"].filter(Boolean).join(" ");return cloneElement(p,{...v,variant:F??v.variant,css:[v.css,...A],className:M,key:typeof p=="object"&&"key"in p?p.key:m})});return jsx("div",{role:c,"aria-orientation":u?"vertical":"horizontal","data-attached":t||void 0,"data-direction":r,className:["plainframe-ui-card-group",a||""].join(" ").trim(),css:[f,i],children:g})};Xi.displayName="CardGroup";var Pe=e=>typeof e=="number"?`${e}px`:e,Ji=e=>{let t=false;return de.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&Ji(n)&&(t=true));}),t},Bp=(e,t)=>t==="sm"?{fontSize:e.typography.sizes.xs,paddingX:`calc(${e.spacing.sm} * 0.7)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.xs,radius:`calc(${e.radius.sm} * 0.8)`,soloPadding:e.spacing.xs,iconOffset:"0px",iconOffsetRounded:"-2px"}:t==="lg"?{fontSize:e.typography.sizes.md,paddingX:e.spacing.sm,paddingY:`calc(${e.spacing.sm} * 0.6)`,gap:e.spacing.xs,iconSize:e.typography.sizes.md,radius:e.radius.md,soloPadding:e.spacing.sm,iconOffset:"0px",iconOffsetRounded:"-3px"}:{fontSize:e.typography.sizes.sm,paddingX:`calc(${e.spacing.sm} * 0.9)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.sm,radius:e.radius.sm,soloPadding:e.spacing.xs,iconOffset:"-1px",iconOffsetRounded:"-3px"},Zi=de.memo(forwardRef(function({children:t,labelCss:n,variant:o="soft",color:r="primary",rounded:s=false,startIcon:a,endIcon:c,size:i="md",onClick:l,onDelete:u,deleteIcon:d,disabled:h,cursor:f,className:R,css:I},x){let C=V(),g=he(),p=["sm","md","lg"].includes(i)?i:"md",m=useMemo(()=>Bp(C,p),[C,p]),v=!!l&&!h,D=h?"not-allowed":f||(v?"pointer":"inherit"),T=String(C.componentHeights?.border??"1px"),w=useMemo(()=>{let X=C.palette;return r==="secondary"||r==="neutral"?"neutral":r&&X[r]?r:"primary"},[r,C.palette]),F=useCallback(X=>{let se=C.palette;return (w==="neutral"?C.neutral[X]:se[w]?.[X])??se.primary?.[X]},[w,C.neutral,C.palette]),B=useMemo(()=>w==="neutral"?C.neutral[100]:F(50),[w,F,C.neutral]),W=useMemo(()=>w==="neutral"?C.text.secondary:F(800),[w,F,C.text.secondary]),O=useMemo(()=>w==="neutral"?C.neutral[100]:F(50),[w,F,C.neutral]),k=useMemo(()=>w==="neutral"?C.text.secondary:F(800),[w,F,C.text.secondary]),A=useMemo(()=>w==="neutral"?C.neutral[400]:F(300),[w,F,C.neutral]),M=useMemo(()=>w==="neutral"?C.surface.subtleBg:F(600),[w,F,C.surface.subtleBg]),b=useMemo(()=>(C.text.onColors??{})[w]??(w==="neutral"?C.neutral[900]:C.neutral[0]??"#fff"),[w,C.text.onColors,C.neutral]),y="transparent",P=useMemo(()=>w==="neutral"?C.text.secondary:F(700)??C.text.primary,[w,F,C.text.primary,C.text.secondary]),H=useMemo(()=>!a&&!c&&t!=null&&!Ji(t)&&de.Children.count(t)===1,[a,c,t]),L=useMemo(()=>o==="filled"?css({backgroundColor:M,color:b,border:"none",boxShadow:"none"}):o==="outlined"?css({backgroundColor:O,color:k,border:"none",boxShadow:`inset 0 0 0 ${T} ${A}`}):o==="ghost"?css({backgroundColor:y,color:P,border:"none",boxShadow:"none"}):css({backgroundColor:B,color:W,border:"none",boxShadow:"none"}),[M,b,P,O,k,A,B,W,T,o]),E=useMemo(()=>css({display:"inline-flex",alignItems:"center",gap:Pe(m.gap),padding:o==="ghost"?0:H||t==null?Pe(m.soloPadding):`${Pe(m.paddingY)} ${Pe(m.paddingX)}`,borderRadius:s?C.radius.full:m.radius,fontWeight:600,cursor:D,opacity:h?.55:1,transition:"outline .16s ease, outline-offset .16s ease",overflow:o==="ghost"?"visible":"hidden",...H?{lineHeight:1,minWidth:`calc(${Pe(m.iconSize)} + ${Pe(m.soloPadding)} * 2)`,minHeight:`calc(${Pe(m.iconSize)} + ${Pe(m.soloPadding)} * 2)`,justifyContent:"center"}:null}),[m,D,t,h,H,s,C.radius.full,o]),S=useMemo(()=>css({fontSize:Pe(H?m.iconSize:m.fontSize),lineHeight:1.2,minWidth:0,display:"inline-flex",alignItems:"center",justifyContent:"center","& > svg":{width:H?Pe(m.iconSize):void 0,height:H?Pe(m.iconSize):void 0,display:H?"block":void 0}}),[m.fontSize,m.iconSize,H]),z=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:Pe(m.iconSize),lineHeight:0,"& > svg":{width:Pe(m.iconSize),height:Pe(m.iconSize),display:"block"}}),[m.iconSize]),$=useMemo(()=>css({marginRight:H||t==null?0:Pe(m.gap),marginLeft:H||t==null?0:Pe(m.iconOffset)}),[m.gap,m.iconOffset,t,H]),K=useMemo(()=>css({marginLeft:H||t==null?0:Pe(m.gap),marginRight:H||t==null?0:Pe(s?m.iconOffsetRounded:m.iconOffset)}),[m.gap,m.iconOffset,m.iconOffsetRounded,t,H,s]),_=useMemo(()=>css({marginRight:s?0:Pe(m.iconOffset),padding:0,border:"none",outline:"none",background:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:h?"not-allowed":"pointer",color:"currentColor",opacity:h?.4:.85,transition:"background-color .16s ease, color .16s ease, opacity .16s ease, outline .16s ease, outline-offset .16s ease",fontSize:Pe(m.iconSize),borderRadius:C.radius.xs}),[m.iconOffset,m.iconSize,h,s,C.radius.xs]),N=useCallback(X=>{v&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),l?.());},[v,l]),U=useMemo(()=>jsx(X,{css:{width:m.iconSize,height:m.iconSize},strokeWidth:2.5}),[m.iconSize]);return jsxs("div",{ref:x,className:["plainframe-ui-chip",v?"plainframe-ui-chip-clickable":"",R||""].join(" ").trim(),css:[E,L,v?g({color:r??"primary"}):null,I],onClick:v?l:void 0,onKeyDown:N,role:v?"button":void 0,tabIndex:v?0:void 0,"aria-disabled":h||void 0,"data-variant":o,"data-color":w,"data-size":i,"data-icon-only":H||void 0,children:[a&&jsx("span",{css:[z,$],className:"plainframe-ui-chip-icon-left",children:a}),t!=null&&jsx("span",{css:[S,n],className:"plainframe-ui-chip-label",children:t}),c&&jsx("span",{css:[z,K],className:"plainframe-ui-chip-icon-right",children:c}),u&&jsx("button",{type:"button","aria-label":"Delete",disabled:h,tabIndex:0,onClick:X=>{X.stopPropagation(),h||u?.();},css:[_,g({color:r??"primary"})],className:"plainframe-ui-chip-delete",children:d||U})]})}));Zi.displayName="Chip";var Wp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Kp=de.memo(function({value:t,onChange:n,len:o,theme:r,sizeKey:s,s:a,variant:c,error:i,disabled:l,ringEnabled:u,focusRingMode:d,placeholder:h,separator:f,gapPx:R}){let I=he(),x=r.neutral,C=r.text,g=r.componentHeights.border,p=useRef([]),[m,v]=useState(0),D=useMemo(()=>(t??"").padEnd(o,"").slice(0,o).split(""),[t,o]),T=useMemo(()=>{if(!h)return Array(o).fill("");if(h.length===1)return Array(o).fill(h);let H=h.slice(0,o).split("");for(;H.length<o;)H.push("");return H},[h,o]),w=useMemo(()=>{let H=r.componentHeights[s];return `calc(${typeof H=="number"?`${H}px`:H} * 1.5)`},[r.componentHeights,s]),F=l?x[200]:i&&c==="outlined"?r.palette.danger?.[50]??r.surface.panelBg:i&&c==="subtle"?r.palette.danger?.[50]??r.surface.subtleBg:c==="subtle"?r.surface.subtleBg:c==="outlined"?r.surface.panelBg:"transparent",B=c==="outlined"?`${g} solid ${i?r.palette.danger?.[300]??r.surface.border:r.surface.border}`:"none",W=H=>css({width:w,height:w,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:F,border:B,borderRadius:r.radius.lg,transition:"box-shadow .16s, border-color .16s, background .16s",fontSize:a.codeFontSize,fontWeight:600,color:l?x[500]:i?r.palette.danger?.[800]??C.primary:C.primary,textAlign:"center",backgroundClip:"padding-box",appearance:"textfield",outline:"none",caretColor:i?r.palette.danger?.[800]??C.primary:C.primary,"&::placeholder":{color:i?r.palette.danger?.[700]??C.secondary:C.secondary,opacity:.85}},u?I({enabled:true,disabled:l,mode:d==="always"?"always":"visible",color:i?"danger":void 0}):void 0,H?css({}):null),O=css({display:"flex",gap:R,justifyContent:"center",width:"auto",pointerEvents:l?"none":"auto",opacity:l?.65:1}),k=css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:C.secondary,userSelect:"none"}),A=H=>H.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),M=useCallback(H=>{let L=Math.max(0,Math.min(o-1,H));v(L),p.current[L]?.focus();},[o]),b=useCallback((H,L)=>{let E=A(L).slice(0,1),S=[...D];S[H]=E,n(S.join("")),E&&H<o-1&&M(H+1);},[D,o,n,M]),y=useCallback((H,L)=>{if(L.key==="Backspace")if(!D[H]&&H>0){let E=[...D];E[H-1]="",n(E.join("")),M(H-1),L.preventDefault();return}else {let E=[...D];E[H]="",n(E.join(""));return}if(L.key==="ArrowLeft"&&H>0){L.preventDefault(),M(H-1);return}if(L.key==="ArrowRight"&&H<o-1){L.preventDefault(),M(H+1);return}if(L.key==="Home"){L.preventDefault(),M(0);return}if(L.key==="End"){L.preventDefault(),M(o-1);return}},[D,o,n,M]),P=useCallback(H=>{let L=A(H.clipboardData.getData("text")).slice(0,o);L&&(n(L),requestAnimationFrame(()=>{let E=Math.min(L.length,o-1);M(E);}),H.preventDefault());},[o,n,M]);return jsx("div",{className:"plainframe-ui-code-boxes",css:O,children:Array.from({length:o}).map((H,L)=>jsxs(de.Fragment,{children:[jsx("input",{ref:E=>{p.current[L]=E;},type:"text",inputMode:"text",maxLength:1,value:D[L]||"",placeholder:D[L]?"":T[L]||"",disabled:l,onChange:E=>b(L,E.target.value),onKeyDown:E=>y(L,E),onFocus:()=>v(L),onPaste:L===0?P:void 0,className:"plainframe-ui-code-box",css:W(L===m),"aria-label":`Code character ${L+1}`,tabIndex:L===m?0:-1}),f&&L<o-1?jsx("span",{"aria-hidden":true,role:"presentation",css:k,children:f}):null]},L))})}),_p=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,separator:s,error:a,helperText:c,disabled:i=false,gap:l,size:u="md",variant:d="subtle",length:h=4,focusRingMode:f="always",className:R,wrapperCss:I,labelCss:x,helperRowCss:C,helperTextCss:g,css:p})=>{let m=V(),v=useId(),D=useMemo(()=>({sm:{labelFont:m.typography.sizes.xs,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.sm,paddingY:0,paddingX:m.spacing.md,codeFontSize:21},md:{labelFont:m.typography.sizes.sm,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.md,paddingY:0,paddingX:m.spacing.md,codeFontSize:24},lg:{labelFont:m.typography.sizes.md,helperFont:m.typography.sizes.sm,minHeight:m.componentHeights.lg,paddingY:0,paddingX:m.spacing.md,codeFontSize:28}}),[m]),T=["sm","md","lg"].includes(u)?u:"md",w=D[T],F=m.neutral,B=m.text,W=t!=null,[O,k]=useState(n),A=W?t:O,M=$=>{W||k($),o?.($);},b=Math.max(2,Math.min(h,10)),y=m.spacing.sm,P=Wp(l??y)??"0px",H=css({boxSizing:"border-box",display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"auto",maxWidth:"unset",fontWeight:500,cursor:i?"not-allowed":"auto"},...Array.isArray(I)?I:I?[I]:[]),L=css({fontSize:w.labelFont,fontWeight:500,color:a?m.palette.danger?.[700]??B.primary:i?F[500]:B.primary,marginBottom:4,display:"block",cursor:i?"not-allowed":"auto"},...Array.isArray(x)?x:x?[x]:[]),E=css({display:"flex",alignItems:"center",justifyContent:"center",gap:P,width:"auto",background:"transparent",outline:"none",boxShadow:"none"},...Array.isArray(p)?p:p?[p]:[]),S=css({minHeight:16,fontSize:w.helperFont,color:a?m.palette.danger?.[700]??B.secondary:B.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Array.isArray(C)?C:C?[C]:[]),z=css({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400,color:a?m.palette.danger?.[700]??B.primary:i?F[500]:B.primary},...Array.isArray(g)?g:g?[g]:[]);return jsxs("div",{className:["plainframe-ui-codefield",R||""].join(" ").trim(),css:H,children:[e&&jsx("span",{id:v,className:"plainframe-ui-codefield-label",css:L,children:e}),jsx("div",{className:"plainframe-ui-codefield-row",css:E,role:"group","aria-labelledby":e?v:void 0,tabIndex:-1,children:jsx(Kp,{value:A||"",onChange:M,len:b,theme:m,sizeKey:T,s:{codeFontSize:w.codeFontSize},variant:d,error:!!a,disabled:i,ringEnabled:f!=="none",focusRingMode:f,placeholder:r,separator:s,gapPx:P})}),c!=null&&jsx("div",{className:"plainframe-ui-codefield-helper",css:S,children:jsx("span",{className:"plainframe-ui-codefield-helper-text",css:z,children:c})})]})};var ol=e=>{if(typeof e=="object"&&e!==null&&"type"in e&&e.type){let t=e.type;return (typeof t=="object"&&t!==null||typeof t=="function")&&(t?.displayName||t?.name)||""}return ""},Ns=e=>{if(!e||typeof e!="object")return false;let t=ol(e);if(t==="DropdownMenu"||t==="DropdownMenuContent")return true;let n=e?.props,o=n&&typeof n=="object"&&n!==null&&"children"in n?n.children:void 0;return o==null?false:Array.isArray(o)?o.some(Ns):Ns(o)},jp=({children:e,content:t,trigger:n="contextmenu",onOpenChange:o,hoverPosition:r="cursor",hoverOffset:s=10})=>{let a=de.useRef(null),[c,i]=de.useState(false),l=de.useCallback(S=>{i(S),o?.(S);},[o]),u=de.useCallback(()=>l(false),[l]),d=de.useRef({x:0,y:0}),h=de.useRef(null),f=de.useRef(null),R=de.useCallback(()=>{f.current=null;let S=h.current;if(!S)return;let z=Math.round(d.current.x),$=Math.round(d.current.y);S.style.transform=`translate3d(${z}px, ${$}px, 0)`;},[]),I=de.useCallback(()=>{f.current==null&&(f.current=requestAnimationFrame(R));},[R]);de.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current);},[]);let x=de.useMemo(()=>({getBoundingClientRect:()=>{let S=Math.round(d.current.x),z=Math.round(d.current.y);return {x:S,y:z,left:S,top:z,right:S,bottom:z,width:0,height:0,toJSON:()=>({x:S,y:z})}}}),[]),C=de.useRef(`cz-${Math.random().toString(36).slice(2)}`),g=de.useCallback(()=>typeof document<"u"?document.querySelector(`[data-cz-id="${C.current}"]`):null,[]),p=de.useRef(null),m=de.useRef(null),v=de.useCallback(()=>{p.current!=null&&clearTimeout(p.current),p.current=null;},[]),D=de.useCallback(()=>{m.current!=null&&clearTimeout(m.current),m.current=null;},[]),T=de.useCallback(()=>{D(),m.current=window.setTimeout(()=>l(false),0);},[D,l]),w=de.useCallback(()=>{let S=a.current?.getBoundingClientRect();return S?{x:S.left+S.width/2,y:S.top+S.height/2}:{x:0,y:0}},[]),F=de.useCallback((S,z)=>{d.current={x:S,y:z},I(),l(true);},[I,l]),B=typeof t=="function"?t({close:u}):t,W=Ns(B),O=S=>{if(!de.isValidElement(S))return S;let z=ol(S),$=S,K=$.props.children,_=K==null?K:Array.isArray(K)?K.map(N=>de.isValidElement(N)?O(N):N):de.isValidElement(K)?O(K):K;if(z==="DropdownMenu"){let N=$.props.onOpenChange;return de.cloneElement($,{...$.props,open:c,onOpenChange:U=>{N?.(U),l(U);},children:_})}if(z==="DropdownMenuContent"){let N=$.props.onMouseEnter,U=$.props.onMouseLeave;return de.cloneElement($,{...$.props,anchor:x,"data-cz-id":C.current,onMouseEnter:X=>{D(),N?.(X);},onMouseLeave:X=>{T(),U?.(X);},children:_})}return _===K?$:de.cloneElement($,{...$.props,children:_})},k=W?O(B):B,A=de.useCallback(S=>{S.preventDefault(),F(S.clientX,S.clientY);},[F]),M=de.useCallback(S=>{n==="contextmenu"&&A(S);},[n,A]),b=de.useCallback(S=>{n==="dblclick"&&A(S);},[n,A]),y=de.useCallback(S=>{n==="click"&&A(S);},[n,A]),P=de.useCallback(S=>{if(n!=="hover")return;v(),D();let z=r==="center"?w():{x:S.clientX,y:S.clientY};p.current=window.setTimeout(()=>{let $=z.x+(r==="cursor"?s:0),K=z.y+(r==="cursor"?s:0);F($,K);},0);},[n,r,s,w,F,v,D]),H=de.useCallback(S=>{n==="hover"&&c&&r==="cursor"&&!W&&(d.current={x:S.clientX+s,y:S.clientY+s},I());},[n,c,r,W,s,I]),L=de.useCallback(()=>{n==="hover"&&(v(),T());},[n,v,T]);de.useEffect(()=>{if(n!=="hover")return;let S=()=>{if(!c)return;let z=a.current?.matches(":hover"),$=g()?.matches?.(":hover");z||$?D():T();};return window.addEventListener("pointermove",S,{passive:true,capture:true}),()=>window.removeEventListener("pointermove",S,{capture:true})},[c,n,g,D,T]),de.useEffect(()=>{let S=()=>{if(c)if(n==="hover"){let z=a.current?.matches(":hover"),$=g()?.matches?.(":hover");if(z||$?D():T(),r==="center"&&a.current){let K=w();d.current={x:K.x,y:K.y},I();}}else l(false);};return window.addEventListener("scroll",S,true),window.addEventListener("resize",S,true),()=>{window.removeEventListener("scroll",S,true),window.removeEventListener("resize",S,true);}},[c,n,r,w,I,l,D,T,g]),de.useEffect(()=>()=>{v(),D();},[v,D]);let E=({children:S})=>c?jsx("div",{ref:h,style:{position:"fixed",left:0,top:0,transform:`translate3d(${Math.round(d.current.x)}px, ${Math.round(d.current.y)}px, 0)`,willChange:"transform",zIndex:1e3,pointerEvents:"auto"},onMouseEnter:()=>n==="hover"&&D(),onMouseLeave:()=>n==="hover"&&T(),children:S}):null;return jsxs("div",{ref:a,onContextMenu:M,onDoubleClick:b,onClick:y,onMouseEnter:P,onMouseMove:H,onMouseLeave:L,css:css({position:"relative"}),className:"plainframe-ui-context-zone-wrapper",children:[e,W?k:jsx(E,{children:k})]})};var $n=(e,t="0px")=>e==null?t:typeof e=="number"?`${e}px`:e,Xp=de.memo(forwardRef(function({label:t,variant:n="full",direction:o="horizontal",labelPosition:r="center",thickness:s=1,width:a,middleMargin:c="5px",insetMargin:i="10px",chip:l=false,chipVariant:u="subtle",rounded:d=false,margin:h=10,css:f,labelCss:R,strokeCss:I,className:x,...C},g){let p=V(),{t:m,strokeColor:v,labelTextColor:D,chipSubtleBg:T,chipOutlinedBg:w,outerM:F,padX:B,verticalStrokeMargin:W}=useMemo(()=>{let b=typeof s=="number"?`${s}px`:s,y=p.surface.border,P=p.text.secondary,H=p.surface.subtleBg,L=p.surface.panelBg,E=$n(h,"10px"),S=o==="horizontal"?n==="middle"?$n(c):n==="inset"?$n(i,"0px"):"0":"0",z=o==="vertical"?n==="middle"?$n(c):n==="inset"?$n(i,"0px"):"0":"0";return {t:b,strokeColor:y,labelTextColor:P,chipSubtleBg:H,chipOutlinedBg:L,outerM:E,padX:S,verticalStrokeMargin:z}},[s,p,o,n,c,i,h]),O=useMemo(()=>css([{display:"flex",alignItems:"center"},o==="vertical"?{flexDirection:"column",alignSelf:"stretch",width:t?"max-content":m,minWidth:t?"max-content":m,marginLeft:F,marginRight:F}:{flexDirection:"row",width:a?$n(a):"100%",minWidth:0,paddingLeft:B,paddingRight:n==="middle"?B:"0",marginTop:F,marginBottom:F},...Array.isArray(f)?f:f?[f]:[]]),[o,t,m,F,a,B,n,f]),k=useMemo(()=>css([{background:v,borderRadius:d?p.radius.full:p.radius.xs},o==="vertical"?{width:m,minHeight:18,flex:1,marginTop:W,marginBottom:W}:{height:m,flex:1}]),[v,d,p.radius.full,p.radius.xs,o,m,W]),A=useMemo(()=>css([{margin:l?o==="vertical"?"4px 0":0:o==="vertical"?"2px 0":0,padding:l?"3px 7px":0,borderRadius:l?d?p.radius.full:`calc(${p.radius.sm} * 0.75)`:`calc(${p.radius.sm} * 0.75)`,color:D,fontWeight:500,fontSize:13,textAlign:"center",alignSelf:"center",whiteSpace:o==="vertical"?"normal":"pre",wordBreak:o==="vertical"?"break-all":void 0,...l?u==="subtle"?{background:T,border:"none"}:{background:w,border:`${m} solid ${v}`}:{}},...Array.isArray(R)?R:R?[R]:[]]),[l,o,d,p.radius.full,p.radius.sm,D,u,T,w,m,v,R]),M=useMemo(()=>jsx("div",{className:"plainframe-ui-divider-stroke",css:[k,I]}),[k,I]);return o==="vertical"?jsxs("div",{ref:g,"data-direction":"vertical","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper","is-vertical",x||""].join(" ").trim(),css:O,...C,children:[t&&r!=="top"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:A,children:t}),t&&r!=="bottom"&&M,!t&&M]}):jsxs("div",{ref:g,"data-direction":"horizontal","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper",x||""].join(" ").trim(),css:O,...C,children:[t&&r!=="left"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:A,children:t}),t&&r!=="right"&&M,!t&&M]})}));var ul=de.createContext(null),dl=()=>{let e=useContext(ul);if(!e)throw new Error("Drawer components must be used within <Drawer>.");return e},pl=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,c]=useState(!!n),i=t??a,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]),u=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(ul.Provider,{value:u,children:e})},Zp=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=dl(),c=!!e&&de.isValidElement(t),i=useCallback(u=>{if(c){let d;de.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||a(true);},[c,t,r.onClick,a]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(true)),c){let d;de.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,a]);if(c){let u=t,d=u.props.css;return de.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),onClick:i,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,onClick:i,onKeyDown:l,...r,children:t})});Zp.displayName="DrawerTrigger";var vo=0,ml="",fl="",Qp=()=>typeof window>"u"?0:window.innerWidth-document.documentElement.clientWidth;function em(){if(!(typeof document>"u")){if(vo===0){let e=document.body;ml=e.style.overflow||"",fl=e.style.paddingRight||"";let t=Qp();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}vo+=1;}}function tm(){if(!(typeof document>"u")&&(vo>0&&(vo-=1),vo===0)){let e=document.body;e.style.overflow=ml,e.style.paddingRight=fl;}}var nm=(e,t=0)=>e==null?t:typeof e=="number"?e:parseFloat(String(e))||t,gl=forwardRef(function({children:t,width:n,height:o,position:r="left",variant:s="inset",margin:a=10,radius:c,backdropBlur:i=true,backdropBlurDepth:l,closeOnClickAway:u=true,transitionMs:d,snapClosePct:h=.33,velocityClosePxS:f=950,dragElasticOut:R=.2,className:I,css:x,...C},g){let p=V(),{open:m,setOpen:v,lockScroll:D,closeOnEscape:T}=dl();useEffect(()=>{if(!(!D||!m))return em(),()=>tm()},[m,D]);let w=useMemo(()=>nm(a,0),[a]),F=useMemo(()=>r==="left"||r==="right"?"x":"y",[r]),B=useMemo(()=>r==="left"||r==="top"?-1:1,[r]),W=useMemo(()=>n??(r==="left"||r==="right"?320:s==="inset"?`calc(100% - ${w*2}px)`:"100%"),[n,r,s,w]),O=useMemo(()=>o??(r==="top"||r==="bottom"?420:s==="inset"?`calc(100% - ${w*2}px)`:"100%"),[o,r,s,w]),k=useMemo(()=>{let j=String(p.radius.lg);switch(r){case "left":return `0 ${j} ${j} 0`;case "right":return `${j} 0 0 ${j}`;case "top":return `0 0 ${j} ${j}`;default:return `${j} ${j} 0 0`}},[r,p.radius.lg]),A=useMemo(()=>c??(s==="inset"?p.radius.lg:k),[c,s,p.radius.lg,k]),M=useMemo(()=>s==="inset"?{top:r==="bottom"?void 0:w,bottom:r==="top"?void 0:w,left:r==="right"?void 0:w,right:r==="left"?void 0:w}:{top:r==="bottom"?void 0:0,bottom:r==="top"?void 0:0,left:r==="right"?void 0:0,right:r==="left"?void 0:0},[s,r,w]),b=useRef(null),y=useCallback(()=>{let j=b.current;if(!j)return 1;let J=j.getBoundingClientRect();return F==="x"?J.width:J.height},[F]),P=useMemo(()=>({type:"spring",stiffness:520,damping:40,mass:.7}),[]),H=useMemo(()=>({duration:(d??280)/1e3,ease:[.22,1,.36,1]}),[d]),L=useMemo(()=>B*1.1,[B]),E=useMemo(()=>F==="x"?{x:`${L*100}%`,y:0}:{y:`${L*100}%`,x:0},[F,L]),S=useMemo(()=>css({position:"fixed",zIndex:1100,...M,width:W,height:O,backgroundColor:p.surface.panelBg,borderRadius:A,overflowY:"auto",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",willChange:"transform, box-shadow, opacity",backfaceVisibility:"hidden",pointerEvents:m?"auto":"none",touchAction:F==="x"?"pan-y":"pan-x","@media (prefers-reduced-motion: reduce)":{transition:"none"}}),[M,W,O,p.surface,A,m,F]),z=useMemo(()=>css({position:"fixed",inset:0,zIndex:1099,background:p.surface.overlayBg,transition:"all .3s ease",...i?{backdropFilter:`blur(${l??"2px"})`}:null}),[i,l,p.surface]),$=useCallback(()=>{u&&v(false);},[u,v]),K=useMemo(()=>F==="x"?{left:B===-1?R:0,right:B===1?R:0}:{top:B===-1?R:0,bottom:B===1?R:0},[F,B,R]),_=useMemo(()=>F==="x"?{left:0,right:0}:{top:0,bottom:0},[F]),N=useMemo(()=>Math.max(0,Math.min(1,h)),[h]),U=useCallback((j,J)=>{let le=F==="x"?J.offset.x:J.offset.y,ue=F==="x"?J.velocity.x:J.velocity.y,fe=B*le>0,Fe=Math.abs(le)>=y()*N,ve=B*ue>f;fe&&(Fe||ve)&&v(false);},[F,B,y,N,f,v]),X=useRef(null);useEffect(()=>{if(!m)return;X.current=document.activeElement;let j=setTimeout(()=>{let ue=b.current;if(!ue)return;let fe=ue.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');fe.length>0?fe[0].focus():ue.focus();},100),J=ue=>{let fe=b.current;if(!fe||!ue.target)return;let Fe=ue.target;if(!fe.contains(Fe)){ue.preventDefault();let ve=fe.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');ve.length>0?ve[0].focus():fe.focus();}},le=ue=>{ue.key==="Escape"&&T&&(ue.stopPropagation(),v(false));};return document.addEventListener("focusin",J,true),window.addEventListener("keydown",le),()=>{clearTimeout(j),document.removeEventListener("focusin",J,true),window.removeEventListener("keydown",le),X.current&&typeof X.current.focus=="function"&&X.current.focus();}},[m,v,T]);let{...se}=C;return jsx(AnimatePresence,{children:m?jsxs(Fragment,{children:[jsx(motion.div,{role:"presentation","aria-hidden":true,css:z,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:d?H:{duration:.18,ease:"linear"},onClick:$},"overlay"),jsx(motion.div,{ref:j=>{b.current=j,typeof g=="function"?g(j):g&&(g.current=j);},role:"dialog","aria-modal":"true",tabIndex:-1,"data-position":r,"data-variant":s,className:["plainframe-ui-drawer",I||""].join(" ").trim(),css:[S,x],drag:F,dragConstraints:_,dragElastic:K,dragMomentum:false,dragDirectionLock:true,onDragEnd:U,initial:{...E,opacity:.98},animate:{x:0,y:0,opacity:1},exit:{...E,opacity:.98},transition:d?H:P,...se,children:t},"panel")]}):null})});gl.displayName="DrawerContent";var om=forwardRef(function({open:t,on:n,defaultOpen:o,defaultOn:r,onOpenChange:s,onClose:a,children:c,...i},l){let u=t!==void 0?t:n,d=o!==void 0?o:r,h=u!==void 0,[f,R]=useState(!!d),I=h?!!u:f,x=useCallback(C=>{h||R(C),C||a?.(),s?.(C);},[h,a,s]);return jsx(pl,{open:I,onOpenChange:x,children:jsx(gl,{ref:l,...i,children:c})})});om.displayName="DrawerLegacy";var $s=({children:e,duration:t=300,delay:n=0,on:o=false,onAnimationEnd:r,asChild:s=false,className:a,blur:c=false})=>{let i={opacity:o?1:0,filter:c?o?"none":"blur(10px)":"none",transition:`opacity ${t}ms ease ${n}ms, filter ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"opacity, filter",backfaceVisibility:"hidden"},l=d=>h=>{h.target===h.currentTarget&&(h.propertyName==="opacity"||h.propertyName==="filter")&&r?.(),d?.(h);};if(s&&isValidElement(e)){let d=e,h=d.props.css,f=Array.isArray(h)?[...h,i]:h?[h,i]:[i],R=["plainframe-ui-transition-fade",d.props.className||"",a||""].join(" ").trim(),I=d.props.onTransitionEnd;return cloneElement(d,{...d.props,css:f,className:R,onTransitionEnd:l(I)})}let u=css(i);return jsx("div",{className:["plainframe-ui-transition-fade",a||""].join(" ").trim(),css:u,onTransitionEnd:l(),children:e})};var bl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,hl=de.memo(({direction:e="row",gap:t="sm",justify:n,align:o="center",className:r,css:s,children:a,width:c,height:i,...l})=>{let u=V(),d=e==="vertical"||e==="column"?"column":"row",h=t===void 0?void 0:typeof t=="number"?t:u.spacing[t]??t,f=css({display:"flex",flexDirection:d,gap:h,justifyContent:n,alignItems:o,maxWidth:bl(c),width:c?"100%":void 0,maxHeight:bl(i),height:i?"100%":void 0,boxSizing:"border-box"});return jsx("div",{className:["plainframe-ui-flex",r||""].join(" ").trim(),css:[f,s],...l,children:a})});hl.displayName="Flex";var zs=({children:e,duration:t=300,delay:n=0,on:o=false,initialScale:r=0,finalScale:s=1,onAnimationEnd:a,asChild:c=false,className:i})=>{let l={transform:o?`scale(${s})`:`scale(${r})`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},u=h=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),h?.(f);};if(c&&isValidElement(e)){let h=e,f=h.props.css,R=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=h.props.onTransitionEnd,x=["plainframe-ui-transition-grow",h.props.className||"",i||""].join(" ").trim();return cloneElement(h,{...h.props,css:R,className:x,onTransitionEnd:u(I)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-grow",i||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var yl={h1:{size:"2.25rem",weight:800,lh:1.1,ls:"-0.02em"},h2:{size:"1.875rem",weight:700,lh:1.15,ls:"-0.01em"},h3:{size:"1.5rem",weight:600,lh:1.2,ls:"-0.005em"},h4:{size:"1.25rem",weight:500,lh:1.2,ls:"0"},h5:{size:"1.125rem",weight:500,lh:1.3,ls:"0"},h6:{size:"1rem",weight:500,lh:1.3,ls:"0"},body:{size:"sm",weight:400,lh:1.4,ls:"0"},caption:{size:"xs",weight:400,lh:1.4,ls:"0.01em"}},ym=e=>e==null?void 0:typeof e=="number"?`${e}px`:String(e),xm={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",body:"span",caption:"span"},zn=de.memo(({variant:e="body",children:t,color:n,size:o,weight:r,lineHeight:s,letterSpacing:a,align:c="left",textTransform:i="none",whiteSpace:l="normal",decoration:u="none",decorationStyle:d="solid",decorationThickness:h=1,decorationColor:f,italic:R,className:I,style:x,as:C})=>{let g=V(),p=yl[e]??yl.body,m=C??xm[e]??"span",v=A=>A==null?p.size:typeof A=="number"?A:g?.typography?.sizes?.[A]??A,D=v(o)??v(p.size),T=r??p.weight,w=s??p.lh,F=a??p.ls,B=n==="secondary"?g.text.secondary:n==="primary"?g.text.primary:n??"inherit",W=f??g.surface.border,O=css({boxSizing:"border-box",display:c==="left"?"inline":"block",textAlign:c==="left"?void 0:c,fontFamily:g?.typography?.fonts?.sans||"inherit",fontSize:D,fontWeight:T,lineHeight:w,letterSpacing:F,color:B,textTransform:i,whiteSpace:l,fontStyle:R?"italic":"normal",margin:0,padding:0}),k=u==="none"?css({textDecoration:"none"}):css({textDecorationLine:u,textDecorationStyle:d,textDecorationColor:W,textDecorationThickness:ym(h),textDecorationSkipInk:"auto"});return jsx(m,{className:[`pfui-typo-${e}`,I||""].join(" ").trim(),css:[O,k],style:x,"data-variant":e,children:t})});zn.displayName="Typography";var _s=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Rm=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return _s(typeof n=="number"||typeof n=="string"?n:e)}return e}}},vl=forwardRef(function({src:t,alt:n="",width:o,height:r,radius:s="md",shadow:a=false,hoverEffect:c="none",label:i,labelAlign:l="center",aspectRatio:u,loading:d="lazy",decoding:h="async",fetchPriority:f,srcSet:R,sizes:I,placeholder:x,blurDataURL:C,placeholderColor:g="#f1f1f1",fallbackSrc:p,className:m,css:v,onClick:D,onLoad:T,onError:w,...F},B){let[W,O]=useState(false),[k,A]=useState(false),[M,b]=useState(false),y=V(),P=Rm(s,y)??"0px",H=i?"figure":"div",L=css({display:"flex",flexDirection:"column",gap:i?y.spacing.xs:0,width:"fit-content",borderRadius:`var(--pfui-image-radius, ${P})`}),E=css({position:"relative",borderRadius:`var(--pfui-image-radius, ${P})`,maxWidth:o?_s(o):"100%",maxHeight:r?_s(r):void 0,width:o?"100%":void 0,height:r?"100%":void 0,aspectRatio:u,boxShadow:a?"0 12px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.04)":"none",overflow:"hidden",padding:0,lineHeight:0,transition:"transform 0.3s ease",willChange:"transform",transform:W&&(c==="rotate"||c==="scale-rotate")?"rotate(3deg)":"none",cursor:D?"pointer":void 0}),S=css({position:"absolute",inset:0,background:x==="color"?g:void 0,backgroundImage:x==="blur"&&C?`url(${C})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:x==="blur"?"blur(8px)":void 0,transition:"opacity 0.3s ease",opacity:M?0:1,pointerEvents:"none"}),z=css({width:"100%",height:"100%",display:"block",objectFit:"cover",transform:W&&(c==="scale"||c==="scale-rotate")?"scale(1.08)":"none",transition:"transform 0.3s ease",willChange:"transform"});return jsxs(H,{className:["plainframe-ui-image",m||""].join(" ").trim(),css:[L,v],tabIndex:-1,children:[jsxs("div",{className:"plainframe-ui-image-frame",css:E,onMouseEnter:()=>O(true),onMouseLeave:()=>O(false),onClick:D,children:[!M&&x&&jsx("div",{"aria-hidden":true,className:"plainframe-ui-image-placeholder",css:S}),jsx("img",{ref:B,className:"plainframe-ui-image-img",css:z,src:k&&p?p:t,alt:n,srcSet:R,sizes:I,loading:d,decoding:h,fetchPriority:f,onLoad:$=>{b(true),T?.($);},onError:$=>{A(true),w?.($);},...F})]}),i&&jsx(zn,{as:"figcaption",variant:"caption",align:l,children:i})]})});vl.displayName="Image";var Cl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Sm=e=>{if(typeof e=="number"&&isFinite(e)&&e>0)return e;if(typeof e=="string"){let t=e.trim().match(/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/);if(t){let o=parseFloat(t[1]),r=parseFloat(t[2]);if(o>0&&r>0)return o/r}let n=parseFloat(e);if(isFinite(n)&&n>0)return n}},Im=e=>e*Math.PI/180,km=(e,t,n)=>{let o=Math.abs(Im(n)),r=Math.cos(o),s=Math.sin(o);return {w:Math.abs(e*r)+Math.abs(t*s),h:Math.abs(t*r)+Math.abs(e*s)}};function Mm(e,t){if(t<=1){let r={ang:[0],dx:[0],dy:[0]};return {base:r,exp:r}}return e==="fan"?{base:t===2?{ang:[-14,10],dx:[-40,24],dy:[0,0]}:{ang:[-14,0,14],dx:[-55,0,55],dy:[-7.5,0,-7.5]},exp:t===2?{ang:[-7,5],dx:[-20,12],dy:[0,0]}:{ang:[-7,0,7],dx:[-32.5,0,32.5],dy:[0,0,0]}}:e==="slide"?{base:t===2?{ang:[-20,3],dx:[-10,5],dy:[-2,0]}:{ang:[-20,-5,10],dx:[-35,-10,12],dy:[4,0,4]},exp:t===2?{ang:[-10,1.5],dx:[-10,5],dy:[-2,0]}:{ang:[-10,-2.5,5],dx:[-30.5,-7.5,6],dy:[4,0,4]}}:e==="domino"?{base:t===2?{ang:[0,0],dx:[0,0],dy:[-11,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-18,-5,6]},exp:t===2?{ang:[0,0],dx:[0,0],dy:[-5,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-14,-2.5,7]}}:{base:t===2?{ang:[-4,8],dx:[-22,18],dy:[-30,40]}:{ang:[-10,10,.5],dx:[-30,30,-15],dy:[-65,2,65]},exp:t===2?{ang:[-3,6],dx:[-11,9],dy:[-22.5,30]}:{ang:[-7.5,7.5,.35],dx:[-15,20,-10.5],dy:[-55.5,2,55.5]}}}var Fm=(e,t,n)=>e==="fan"?t===2?[.9,1.08][n]??1:[.8,1,.8][n]??1:e==="slide"?t===2?[.8,1][n]??1:[.7,.85,1][n]??1:e==="domino"?t===2?[.9,1][n]??1:[.85,.95,1][n]??1:1,Rl=[1.02,1.03,1.02],Tl=[1.06,1.08,1.06],Am={sm:150,md:200,lg:260,xl:340},Pm=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Dm(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Pm(typeof n=="number"||typeof n=="string"?n:e)}return e}}}var Nm=memo(function({children:t,variant:n="fan",width:o,aspectRatio:r="4/5",size:s="md",hoverEffect:a="none",hovering:c,maxItems:i=3,shadow:l=false,cursor:u,outline:d,outlineColor:h,outlineWidth:f=3,outlineOffset:R=0,radius:I="md",label:x,labelAlign:C="center",css:g,className:p,...m}){let v=V(),D=Sm(r)??4/5,T=typeof o=="string"?o:void 0,w=typeof o=="number"?o:T&&/px$/.test(T)?parseFloat(T):Am[s],F=Math.max(1,w/D),W=Children.toArray(t).filter(isValidElement).slice(0,i),O=W.length,k=Mm(n,O),A=W.map((j,J)=>Fm(n,O,J)),M=j=>F*.6*A[j],b=j=>M(j)*D,y=0,P=0;for(let j=0;j<O;j++){let J=b(j),le=M(j),ue=Math.max(Math.abs(k.base.ang[j]??0),Math.abs(k.exp.ang[j]??0)),fe=Math.max(Math.abs(k.base.dx[j]??0),Math.abs(k.exp.dx[j]??0)),Fe=Math.max(Math.abs(k.base.dy[j]??0),Math.abs(k.exp.dy[j]??0)),ve=a==="expand"?Tl[j]??1.08:a==="reveal"?Rl[j]??1.03:1,ye=km(J,le,ue),we=ye.w*ve,Ce=ye.h*ve,Re=fe/100*J*ve,be=Fe/100*le*ve;y=Math.max(y,we/2+Re),P=Math.max(P,Ce/2+be);}let H=Math.max(1,2*y),L=Math.max(1,2*P),E=Math.min(1,w/H,F/L),S=c===void 0?"pointer":"controlled",z=c?"true":void 0,$=css({display:"flex",flexDirection:"column",cursor:u||"auto",lineHeight:0,position:"relative",isolation:"isolate",gap:x?v.spacing.xs:0}),K=css({position:"relative",width:Cl(typeof o=="number"?o:w)??(typeof o=="string"?o:void 0),height:Cl(F)}),_=css({position:"absolute",inset:0,left:"50%",top:"50%",width:`${H}px`,height:`${L}px`,transform:`translate(-50%, -50%) scale(${E})`,transformOrigin:"center center"}),N=Dm(I,v)??"0px",U=j=>{let J=n==="fan"?`rotate(${k.base.ang[j]}deg) translate(${k.base.dx[j]}%, ${k.base.dy[j]}%)`:n==="slide"?`translate(${k.base.dx[j]}%, ${k.base.dy[j]}%) rotate(${k.base.ang[j]}deg)`:n==="domino"?`translate(0%, ${k.base.dy[j]}%)`:`translate(${k.base.dx[j]}%, ${k.base.dy[j]}%) rotate(${k.base.ang[j]}deg)`,le=n==="fan"?`rotate(${k.exp.ang[j]}deg) translate(${k.exp.dx[j]}%, ${k.exp.dy[j]}%)`:n==="slide"?`translate(${k.exp.dx[j]}%, ${k.exp.dy[j]}%) rotate(${k.exp.ang[j]}deg)`:n==="domino"?`translate(0%, ${k.exp.dy[j]}%)`:`translate(${k.exp.dx[j]}%, ${k.exp.dy[j]}%) rotate(${k.exp.ang[j]}deg)`,ue=a==="reveal"?"translate(0,0) rotate(0) scale(1)":`${J} scale(1)`,fe=a==="expand"?`${le} scale(${Tl[j]??1.06})`:a==="reveal"?`${J} scale(${Rl[j]??1.03})`:`${J} scale(1)`;return css({position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) ${ue}`,transition:"transform .22s ease",willChange:"transform",backfaceVisibility:"hidden",zIndex:n==="fan"&&j===1?10:j+1,lineHeight:0,boxShadow:l?"rgba(0,0,0,.12) 0 8px 20px":"none",outline:d?`${f}px solid ${h??v.surface.appBg}`:void 0,outlineOffset:d?R:void 0,pointerEvents:"auto",".plainframe-ui-image-stack-wrapper[data-hover-mode='pointer']:hover &":{transform:`translate(-50%, -50%) ${fe}`},".plainframe-ui-image-stack-wrapper[data-hover-mode='controlled'][data-hovered='true'] &":{transform:`translate(-50%, -50%) ${fe}`}})},X=j=>css({width:`${b(j)}px`,aspectRatio:`${D}`,position:"relative",overflow:"hidden",borderRadius:N,"--pfui-image-radius":N,"& > *":{position:"absolute",inset:"0",width:"100% !important",height:"100% !important",maxWidth:"none !important",maxHeight:"none !important",display:"block"},"& img, & picture img, & video, & canvas":{width:"100% !important",height:"100% !important",objectFit:"cover",display:"block"}});return jsxs(x?"figure":"div",{className:["plainframe-ui-image-stack-wrapper",p||""].join(" ").trim(),"data-hover-mode":S,"data-hovered":z,css:[$,g],tabIndex:-1,...m,children:[jsx("div",{className:"plainframe-ui-image-stack",css:K,children:jsx("div",{className:"plainframe-ui-image-stack-stage",css:_,children:W.map((j,J)=>jsx("div",{className:"plainframe-ui-image-stack-item",css:U(J),children:jsx("div",{className:"plainframe-ui-image-stack-frame",css:X(J),children:j})},J))})}),x&&jsx(zn,{as:"figcaption",variant:"caption",align:C,children:x})]})});var wl=e=>typeof e=="number"?`${e}px`:e,El={sm:{h:20,px:6,font:10},md:{h:24,px:7,font:12},lg:{h:28,px:8,font:14}};function Bm(e,t){if(e==null){let n=t.radius?.xs??t.radius?.sm??3;return wl(n)}if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius?.[e]??t.radii?.[e];if(n!=null)return wl(n)}return e}function $m(e){if(typeof e!="string")return false;let t=e.trim();return !(!t||t.length>4||/[A-Za-z0-9]/.test(t))}var zm=forwardRef(function({children:t,variant:n="outlined",size:o="sm",radius:r,mono:s=true,uppercase:a=false,symbolBoost:c=2,css:i,className:l="plainframe-ui-kbd",...u},d){let h=V(),f=he(),R=El[o]??El.sm,I=Bm(r,h),x={br:h.neutral[300],txt:h.neutral[800],inset:h.neutral[0]},C=css({all:"unset",boxSizing:"border-box",display:"inline-flex !important",alignItems:"center",justifyContent:"center",minHeight:n==="ghost"?void 0:`${R.h}px !important`,paddingInline:n==="ghost"?0:`${R.px}px !important`,paddingBlock:"0 !important",fontFamily:s?h.typography.fonts.mono:"inherit",fontSize:`${R.font}px !important`,fontWeight:600,letterSpacing:.2,textTransform:a?"uppercase":"none",borderRadius:I,userSelect:"none",verticalAlign:"baseline",position:"relative",outline:"none"}),g=css({"&&":{background:h.surface.subtleBg,border:"none",boxShadow:"none",color:x.txt}}),p=css({"&&":{background:"transparent",color:x.txt,border:"none",boxShadow:"none"}}),m=css({"&&":{background:h.surface.panelBg,color:x.txt,border:`1px solid ${x.br}`,boxShadow:`inset 0 1px 0 ${x.inset}AA, 0 1px 0 rgba(0,0,0,0.03)`}}),v=n==="subtle"?g:n==="ghost"?p:m,T=s&&c>0&&$m(t)?jsx("span",{css:css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:`${R.font+c}px`,lineHeight:1}),children:t}):t;return jsx("kbd",{ref:d,className:l,css:[f(),C,v,i],...u,children:T})});var _m=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Vs=({children:e,direction:t="up",duration:n=450,delay:o=0,on:r=false,onAnimationEnd:s,asChild:a=false,className:c,distance:i})=>{let u=_m(i,t==="left"||t==="right"?"100vw":"100vh"),d=t==="left"?`-${u}`:t==="right"?u:"0",h=t==="up"?u:t==="down"?`-${u}`:"0",f={transform:r?"translate3d(0,0,0)":`translate3d(${d}, ${h}, 0)`,transition:`transform ${n}ms ease ${o}ms`,pointerEvents:r?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},R=x=>C=>{C.target===C.currentTarget&&C.propertyName==="transform"&&s?.(),x?.(C);};if(a&&isValidElement(e)){let x=e,C=x.props.css,g=Array.isArray(C)?[...C,f]:C?[C,f]:[f],p=["plainframe-ui-transition-slide",x.props.className||"",c||""].join(" ").trim(),m=x.props.onTransitionEnd;return cloneElement(x,{...x.props,css:g,className:p,onTransitionEnd:R(m)})}let I=css(f);return jsx("div",{className:["plainframe-ui-transition-slide",c||""].join(" ").trim(),css:I,onTransitionEnd:R(),children:e})};var js=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Ml=de.createContext(null),Fl=()=>{let e=useContext(Ml);if(!e)throw new Error("Modal components must be used within <Modal>.");return e},Xm=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,c]=useState(!!n),i=t??a,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]);useEffect(()=>{if(!i||!s)return;let d=h=>{h.key==="Escape"&&(h.stopPropagation(),l(false));};return window.addEventListener("keydown",d,true),()=>window.removeEventListener("keydown",d,true)},[i,s,l]);let u=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(Ml.Provider,{value:u,children:e})},Al=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=Fl(),c=!!e&&de.isValidElement(t),i=useCallback(u=>{if(c){let d;de.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||a(true);},[c,t,r.onClick,a]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(true)),c){let d;de.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,a]);if(c){let u=t,d=u.props.css;return de.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),"aria-haspopup":"dialog",onClick:i,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,"aria-haspopup":"dialog",onClick:i,onKeyDown:l,...r,children:t})});Al.displayName="ModalTrigger";var Pl=forwardRef(({children:e,variant:t="inset",width:n=500,height:o="auto",radius:r="lg",padding:s="lg",backdrop:a=true,backdropBlur:c=true,backdropBlurDepth:i=5,closeOnClickAway:l=true,transitionVariant:u="fade",direction:d="up",transitionDuration:h=300,containerCss:f,backdropCss:R,className:I,...x},C)=>{let g=V(),{open:p,setOpen:m,lockScroll:v}=Fl(),D=de.useRef(null),T=de.useRef(null);de.useEffect(()=>{if(!p)return;T.current=document.activeElement;let k=setTimeout(()=>{let M=D.current;if(!M)return;let b=M.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');b.length>0?b[0].focus():M.focus();},100),A=M=>{let b=D.current;if(!b||!M.target)return;let y=M.target;if(!b.contains(y)){M.preventDefault();let P=b.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');P.length>0?P[0].focus():b.focus();}};return document.addEventListener("focusin",A,true),()=>{clearTimeout(k),document.removeEventListener("focusin",A,true),T.current&&typeof T.current.focus=="function"&&T.current.focus();}},[p]);let w=typeof g.spacing.sm=="number"?`${g.spacing.sm}px`:String(g.spacing.sm),F=css({width:"100%",height:js(o),maxWidth:t==="inset"?`min(${js(n)||"100%"}, calc(100% - ${w} * 2))`:js(n),maxHeight:t==="inset"?`calc(100% - ${w} * 2)`:"100%",margin:t==="inset"?w:void 0}),B=jsx(Ln,{role:"dialog","aria-modal":"true",tabIndex:-1,className:["plainframe-ui-modal",I||""].join(" ").trim(),padding:s,radius:r,variant:"panel",css:[F,f],ref:k=>{D.current=k,typeof C=="function"?C(k):C&&(C.current=k);},...x,children:e}),W=u==="none"?B:u==="slide"?jsx(Vs,{on:p,direction:d,duration:h,children:B}):u==="grow"?jsx(zs,{initialScale:.75,on:p,duration:h,children:B}):jsx($s,{on:p,duration:h,children:B});if(!a)return jsx(Fragment,{children:W});let O=css(t==="full"?{alignItems:"start",justifyItems:"start",justifyContent:"start"}:{alignItems:"center",justifyItems:"center",justifyContent:"center"});return jsx(Rs,{on:p,blur:c,blurDepth:i,onClickAway:l?()=>m(false):void 0,css:[O,R].filter(Boolean),contentCss:O,lockScroll:v,children:W})});Pl.displayName="ModalContent";var of=({count:e,page:t,defaultPage:n=1,onChange:o,siblingCount:r=1,boundaryCount:s=1,disabled:a=false,showFirstLast:c=false,loop:i=false,variant:l="subtle",gap:u,className:d,css:h})=>{let f=V(),R=he(),I=t!==void 0,[x,C]=useState(n),g=Math.max(1,e),p=Sr(I?t:x,1,g),m=useCallback(E=>{let S=Sr(E,1,g);I||C(S),o?.(S);},[I,g,o]),v=useMemo(()=>rf({count:g,page:p,siblingCount:r,boundaryCount:s}),[g,p,r,s]),D=f.palette?.primary?.[600],T=f.surface?.border,w=l==="subtle"?f.surface.subtleHover:l==="ghost"?f.surface?.subtleBg:f.surface.panelHover,F=f.text?.primary??"#111",B=l==="subtle"?f.surface?.subtleBg:"transparent",W=css({display:"inline-flex",alignItems:"center",gap:u??6,flexWrap:"wrap",borderRadius:f.radius?.md,background:B,padding:l==="subtle"?f.spacing.xs:0,userSelect:"none"},...Array.isArray(h)?h:h?[h]:[]),O=css({minWidth:28,height:28,padding:"0 10px",borderRadius:f.radius.sm,fontSize:13,lineHeight:1,border:"1px solid transparent",background:"transparent",color:F,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:a?"not-allowed":"pointer",outline:"none",transition:"all .16s ease !important","&[aria-disabled='true']":{opacity:.55,pointerEvents:"none",cursor:"not-allowed"},fontWeight:600}),k=css({width:28,minWidth:28,height:28,padding:0}),A=(E=false)=>css([O,R({color:E?"primary":"neutral"}),l==="outlined"?E?{background:D,color:f.text.onColors.primary,borderColor:D}:{background:"transparent",borderColor:T,":hover":{background:w}}:l==="ghost"?E?{background:D,color:f.text.onColors.primary}:{":hover":{background:w}}:E?{background:D,color:f.text.onColors.primary,borderColor:D}:{":hover":{background:w}}]),M=useCallback(()=>m(1),[m]),b=useCallback(()=>m(g),[m,g]),y=useCallback(()=>{p===1?i&&m(g):m(p-1);},[p,i,g,m]),P=useCallback(()=>{p===g?i&&m(1):m(p+1);},[p,i,g,m]),H=a||p===1&&!i,L=a||p===g&&!i;return jsxs("nav",{"aria-label":"Pagination",className:["plainframe-ui-pagination",d||""].join(" ").trim(),css:W,onKeyDown:E=>{a||(E.key==="ArrowLeft"&&(E.preventDefault(),y()),E.key==="ArrowRight"&&(E.preventDefault(),P()),E.key==="Home"&&(E.preventDefault(),M()),E.key==="End"&&(E.preventDefault(),b()));},children:[c&&jsx("button",{className:"plainframe-ui-pagination-first-button",type:"button","aria-label":"First page","aria-disabled":H,disabled:H,css:[A(false),k],onClick:M,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronFirst,{strokeWidth:3,css:{width:14,height:14}})}),jsx("button",{className:"plainframe-ui-pagination-previous-button",type:"button","aria-label":"Previous page","aria-disabled":H,disabled:H,css:[A(false),k],onClick:y,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLeft,{strokeWidth:3,css:{width:14,height:14}})}),v.map((E,S)=>typeof E=="number"?jsx("button",{className:"plainframe-ui-pagination-page-button",type:"button","aria-label":E===p?`Page ${E}, current page`:`Go to page ${E}`,"aria-current":E===p?"page":void 0,css:A(E===p),onClick:()=>m(E),children:E},E):jsx("span",{className:"plainframe-ui-pagination-ellipsis","aria-hidden":true,css:css([O,R(),{borderColor:"transparent",cursor:"default",opacity:.8,padding:0,minWidth:28}]),children:"\u2026"},`e${S}`)),jsx("button",{className:"plainframe-ui-pagination-next-button",type:"button","aria-label":"Next page","aria-disabled":L,disabled:L,css:[A(false),k],onClick:P,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronRight,{strokeWidth:3,css:{width:14,height:14}})}),c&&jsx("button",{className:"plainframe-ui-pagination-last-button",type:"button","aria-label":"Last page","aria-disabled":L,disabled:L,css:[A(false),k],onClick:b,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLast,{strokeWidth:3,css:{width:14,height:14}})})]})};function Sr(e,t,n){return Math.max(t,Math.min(n,e))}function rf({count:e,page:t,siblingCount:n,boundaryCount:o}){if(e<=0)return [1];let r=2*o+2*n+3;if(e<=r)return Er(1,e);let s=Er(1,Math.min(o,e)),a=Er(Math.max(e-o+1,o+1),e),c=Sr(t-n,o+2,Math.max(o+2,e-o-2*n-1)),i=Sr(t+n,Math.min(o+2+2*n,e-o-1),e-o-1),l=[],u=d=>{let h=l[l.length-1];h!==d&&(h==="ellipsis"&&d==="ellipsis"||l.push(d));};return s.forEach(u),c>o+2?u("ellipsis"):o+1<c&&u(o+1),Er(c,i).forEach(u),i<e-o-1?u("ellipsis"):e-o>i&&u(e-o),a.forEach(u),l}function Er(e,t){if(t<e)return [];let n=[];for(let o=e;o<=t;o++)n.push(o);return n}var cf=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,uf=de.memo(({children:e,direction:t="left",width:n,variant:o="solid",className:r,css:s})=>{let a=V(),c=a.surface.border,i=css({display:"inline-block",boxSizing:"border-box",maxWidth:cf(n,"fit-content"),width:"100%",padding:`0 ${a.spacing.md}`,borderLeft:t==="left"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none",borderRight:t==="right"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none"},...Array.isArray(s)?s:s?[s]:[]);return jsx("div",{className:r??"plainframe-ui-quote",css:i,children:e})});var Ll=createContext(null),ff=()=>{let e=useContext(Ll);if(!e)throw new Error("RadioItem must be used within a RadioGroup");return e},gf=e=>{let t=e?.horizontal??"left",n=e?.vertical??"center";return t==="center"&&n==="center"?{horizontal:"left",vertical:"center"}:{horizontal:t,vertical:n}},bf=({value:e,defaultValue:t,onChange:n,disabled:o=false,size:r="md",direction:s="horizontal",variant:a="filled",className:c,children:i,anchorOrigin:l,css:u})=>{let d=V(),h=e!==void 0&&n!==void 0,[f,R]=useState(t),I=h?e:f,x=useRef([]),[C,g]=useState(0),p=()=>g(A=>A+1),m=useCallback(A=>{h||R(A),n?.(A);},[h,n]),v=useCallback(A=>(x.current.push(A),p(),x.current.length-1),[]),D=useCallback((A,M)=>{let b=x.current[A];b&&(x.current[A]={...b,...M},p());},[]),T=()=>x.current.map((A,M)=>({it:A,i:M})).filter(({it:A})=>A.ref&&!A.disabled).map(({i:A})=>A),w=useCallback((A,M)=>{let b=T();if(!b.length)return;let y=Math.max(0,b.indexOf(A)),P=b[(y+M+b.length)%b.length],H=x.current[P]?.ref;if(H){H.focus();let L=x.current[P]?.value;L!==void 0&&m(L);}},[m]),F=useCallback(A=>{let M=T();if(!M.length)return;let b=A==="first"?M[0]:M[M.length-1],y=x.current[b]?.ref;if(y){y.focus();let P=x.current[b]?.value;P!==void 0&&m(P);}},[m]),B=useMemo(()=>{let A=x.current.filter(b=>b.ref&&!b.disabled);return A.length?A.some(b=>b.value===I)?I:A[0]?.value:void 0},[I,C]),W=useMemo(()=>({selected:I,setSelected:m,disabled:o,size:r,direction:s,variant:a,register:v,update:D,moveFocusBy:w,moveToEdge:F,focusValue:B,theme:d,anchorOrigin:gf(l)}),[I,m,o,r,s,a,v,D,w,F,B,d,l]),O=css({width:"fit-content"}),k=css({display:"flex",flexDirection:s==="vertical"?"column":"row",gap:d.spacing.sm,width:"fit-content",alignItems:s==="vertical"?"stretch":"center"});return jsx("div",{className:c??"plainframe-ui-radio-group",css:[O,u],children:jsx("div",{className:"plainframe-ui-radio-row",role:"radiogroup","aria-disabled":o||void 0,css:k,children:jsx(Ll.Provider,{value:W,children:i})})})},hf=({value:e,disabled:t=false,className:n,children:o,css:r})=>{let{selected:s,setSelected:a,disabled:c,size:i,register:l,update:u,moveFocusBy:d,moveToEdge:h,theme:f,variant:R,focusValue:I,anchorOrigin:x}=ff(),C=c||t,g=s===e,p=["sm","md","lg"].includes(i)?i:"md",m=p==="sm"?16:p==="lg"?24:20,v=K=>f.palette?.primary?.[K],D=v(600),T=v(100),w=f.neutral[300],F=f.palette.primary[300],B=f.text.onColors?.primary??f.neutral[0],W="transparent",O=F,k=B;R==="soft"?(W=T,O=null,k=D):R==="outlined"?(W=v(50),O=F,k=D):(W=f.neutral[200],O="transparent",k=B),g&&(R==="outlined"?(W=T,O=F,k=D):R==="filled"?(W=D,O=null,k=B):(W=T,O=null,k=D));let A=R==="filled"?w:f.palette.primary[100],M=useRef(null),b=useRef(-1);useEffect(()=>{b.current=l({ref:M.current,value:e,disabled:!!C});},[l]),useEffect(()=>{u(b.current,{ref:M.current,value:e,disabled:!!C});},[u,C,e]);let y=css({border:"none",background:"transparent",display:"inline-grid",gridTemplateColumns:"auto auto auto",gridTemplateRows:"auto auto auto",columnGap:x.vertical==="center"?f.spacing.sm:0,rowGap:x.vertical==="center"?0:f.spacing.xs,justifyItems:"center",alignItems:"center",opacity:C?.5:1,borderRadius:f.radius.md,cursor:C?"not-allowed":"pointer",transition:"transform .16s ease",fontSize:f.typography.sizes.sm,fontWeight:500,padding:f.spacing.sm,"&:hover .plainframe-ui-radio-circle-outer":C||g?{}:{background:A,boxShadow:R==="outlined"?`inset 0 0 0 ${f.componentHeights.border} ${F}`:"none"},"&:focus-visible .plainframe-ui-radio-circle-outer":{outline:"none"}}),P=css({width:m,height:m,minWidth:m,minHeight:m,borderRadius:f.radius.full,background:W,boxShadow:O?`inset 0 0 0 ${f.componentHeights.border} ${O}`:"none",transition:"background-color .16s ease, box-shadow .16s ease, filter .16s ease",display:"inline-flex",alignItems:"center",justifyContent:"center"}),H=css({width:g?m*.45:0,height:g?m*.45:0,borderRadius:f.radius.full,background:g?k:"transparent",transition:"all 250ms cubic-bezier(.72,1.6,.32,1)",transform:g?"scale(1)":"scale(0.6)",opacity:g?1:0}),L=css({gridColumn:2,gridRow:2,minWidth:0,maxWidth:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",textAlign:"left"}),E=(()=>{let K=x.horizontal,_=x.vertical;return _==="center"?{col:K==="right"?3:1,row:2}:{col:2,row:_==="top"?1:3}})(),z=!C&&I===e?0:-1,$=he();return jsxs("button",{ref:M,className:n??"plainframe-ui-radio-item",type:"button",role:"radio","aria-checked":g,"aria-disabled":C||void 0,disabled:C,tabIndex:z,onClick:()=>{C||a(e);},onKeyDown:K=>{C||(K.key==="Enter"||K.key===" "?(K.preventDefault(),a(e)):K.key==="ArrowRight"||K.key==="ArrowDown"?(K.preventDefault(),d(b.current,1)):K.key==="ArrowLeft"||K.key==="ArrowUp"?(K.preventDefault(),d(b.current,-1)):K.key==="Home"?(K.preventDefault(),h("first")):K.key==="End"&&(K.preventDefault(),h("last")));},css:[y,$({color:"primary"}),r],children:[jsx("span",{className:"plainframe-ui-radio-circle-outer",css:[P,css({gridColumn:E.col,gridRow:E.row})],children:jsx("span",{className:"plainframe-ui-radio-circle-dot",css:H})}),o!=null&&jsx("span",{className:"plainframe-ui-radio-label",css:L,children:o})]})};var Rf=({children:e,duration:t=400,delay:n=0,on:o=false,initialAngle:r=360,finalAngle:s=0,onAnimationEnd:a,asChild:c=false,className:i})=>{let l={transform:`rotate(${o?s:r}deg)`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",transformOrigin:"center center",willChange:"transform",backfaceVisibility:"hidden"},u=h=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),h?.(f);};if(c&&isValidElement(e)){let h=e,f=h.props.css,R=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=["plainframe-ui-transition-rotate",h.props.className||"",i||""].join(" ").trim(),x=h.props.onTransitionEnd;return cloneElement(h,{...h.props,css:R,className:I,onTransitionEnd:u(x)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-rotate",i||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Io=(...e)=>e.filter(Boolean).flat(),$l=e=>de.isValidElement(e),Sf=(e,t)=>{if(!$l(e))return false;let n=e.type,o=(n?.displayName??n?.name??"")||"";return typeof o=="string"&&t.includes(o)},zl=({value:e,defaultValue:t,onChange:n,label:o,placeholder:r="Select\u2026",startIcon:s,endIcon:a,disabled:c,size:i="md",variant:l="subtle",fullWidth:u,width:d=200,menuAlign:h="left",menuWidth:f,menuMaxHeight:R=280,wrapperCss:I,labelCss:x,triggerCss:C,menuCss:g,optionCss:p,children:m,className:v,menuSize:D="md",triggerRender:T,multiple:w=false})=>{let F=V(),B=he(),W=de.useId(),O=`${W}-label`,k=`${W}-menu`,A={sm:{minHeight:F.componentHeights.sm,radius:F.radius.sm},md:{minHeight:F.componentHeights.md,radius:F.radius.md},lg:{minHeight:F.componentHeights.lg,radius:F.radius.md}},M=A[i]||A.md,[b,y]=de.useState(false),P=ne=>y(!!ne),H=typeof e<"u",L=Array.isArray(e)||Array.isArray(t),[E,S]=de.useState(typeof t<"u"?t:L?[]:void 0),z=H?e:E,$=ne=>{H||S(ne),n?.(ne);},N=de.Children.toArray(m).filter($l).filter(ne=>Sf(ne,["SelectItem"])).map((ne,G)=>{let ie=ne.props,Y=typeof ie.children=="string"||typeof ie.children=="number"?String(ie.children):void 0;return {key:ne.key??G,value:ie.value,startIcon:ie.startIcon,endIcon:ie.endIcon,node:ie.children,labelText:Y}}),U=!!w||L,X=ne=>U?(Array.isArray(z)?z:[]).some(ie=>Object.is(ie,ne)):Object.is(z,ne),se=de.useMemo(()=>{if(U){let G=Array.isArray(z)?z:[];return N.filter(Y=>G.some(Q=>Object.is(Q,Y.value))).map(Y=>Y.labelText??Y.node)}let ne=N.find(G=>Object.is(G.value,z));if(ne)return ne.labelText??ne.node},[z,U,N]),j=ne=>{c||(Object.is(ne,z)||$(ne),P(false));},J=ne=>{if(c)return;let G=Array.isArray(z)?z:[],Y=G.some(Q=>Object.is(Q,ne))?G.filter(Q=>!Object.is(Q,ne)):[...G,ne];$(Y);},le={position:"relative",width:u?"100%":typeof d=="number"?`${d}px`:d,maxWidth:"100%"},ue={width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:M.radius,minHeight:M.minHeight,fontSize:F.typography.sizes.sm,padding:`0 ${typeof F.spacing.sm=="number"?`${F.spacing.sm}px`:F.spacing.sm} 0 ${typeof F.spacing.md=="number"?`${F.spacing.md}px`:F.spacing.md}`,fontWeight:500,lineHeight:1,userSelect:"none",cursor:c?"not-allowed":"pointer",border:"none",outline:"none",transition:"box-shadow .16s ease",color:F.text.primary,background:"transparent",whiteSpace:"nowrap"},fe=l==="subtle"?{background:F.surface.subtleBg}:l==="outlined"?{background:F.surface.panelBg,border:`1px solid ${F.surface.border}`}:{background:"transparent"},Fe={flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",textAlign:"left",gap:8},ve={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},ye={flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:500,display:"block"},we=jsx(ChevronsUpDown,{size:16,css:css({color:F.text.secondary,flexShrink:0}),strokeWidth:2.5,className:"plainframe-ui-select-chevron"}),Ce=()=>{if(T)return T(se);if(Array.isArray(se)){let G=se.map(Y=>typeof Y=="string"?Y:"").filter(Boolean),ie=G.length?G.join(", "):String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(ve),children:s}),jsx("span",{css:css(ye),title:ie,children:ie})]})}let ne=se??String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(ve),children:s}),jsx("span",{css:css(ye),title:typeof ne=="string"?ne:void 0,children:ne})]})},Re={left:"start",center:"center",right:"end"},be=ne=>{c||(ne.key==="ArrowDown"||ne.key==="ArrowUp"||ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),P(true));};return jsxs("div",{css:Io(le,I),className:["plainframe-ui-select-wrapper",v||""].join(" ").trim(),children:[o&&jsx("div",{id:O,className:"plainframe-ui-select-label",css:Io({marginBottom:6,fontSize:F.typography.sizes.sm,fontWeight:500,color:F.text.secondary},x),children:o}),jsxs(An,{size:D,open:b,onOpenChange:P,children:[jsx(Pn,{width:"100%",asChild:true,children:jsxs("button",{type:"button",disabled:c,"aria-haspopup":"menu","aria-expanded":b||void 0,"aria-controls":k,"aria-labelledby":o?O:void 0,onKeyDown:be,onClick:()=>P(!b),className:"plainframe-ui-select-trigger",css:Io(css(ue),css(fe),C,B()),children:[jsx("div",{className:"plainframe-ui-select-trigger-content",css:css(Fe),children:Ce()}),a??we]})}),jsx(cn,{id:k,gap:"xs",align:Re[h],sameWidth:f==null,width:f??d,className:"plainframe-ui-select-menu",css:Io({maxHeight:typeof R=="number"?`${R}px`:R,overflowY:"auto"},g),children:N.map((ne,G)=>{let ie=X(ne.value);return jsx(kt,{startIcon:ne.startIcon,endIcon:ne.endIcon,selected:ie,disabled:c,closeOnSelect:!U,onSelect:()=>U?J(ne.value):j(ne.value),css:Io(p),className:"plainframe-ui-select-option",children:ne.node},ne.key??G)})})]})]})};zl.DisplayName="Select";var Gs=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,kf=keyframes`
14
14
  0% { background-position: -200% 0; }
15
15
  100% { background-position: 200% 0; }
16
16
  `,Mf=keyframes`
17
17
  0% { opacity: .6; }
18
18
  50% { opacity: 1; }
19
19
  100% { opacity: .6; }
20
- `,Ff=me.memo(({isLoading:e=true,radius:t,animation:n="wave",children:o,width:r,height:s,style:a,className:c,css:i})=>{let l=V(),u=l.surface.subtleBg,d=l.neutral[200],y=Zs(t??l.radius?.lg??8,"8px"),f=css({position:"relative",display:"inline-block",verticalAlign:"middle",width:r==null?"fit-content":Zs(r,String(r)),height:s==null?"fit-content":Zs(s,String(s))}),T=css({position:"absolute",inset:0,borderRadius:y,pointerEvents:"none",background:u,willChange:"background-position, opacity"}),I=n==="wave"?css({backgroundImage:`linear-gradient(90deg, ${u} 25%, ${d} 50%, ${u} 75%)`,backgroundSize:"200% 100%",animation:`${Sf} 1.4s ease-in-out infinite`}):n==="pulse"?css({animation:`${Mf} 1.2s ease-in-out infinite`}):css({}),x=css({visibility:e?"hidden":"visible",display:"inline-block",borderRadius:y});return jsxs("span",{className:["plainframe-ui-skeleton",c||""].join(" ").trim(),css:[f,i],style:a,"aria-busy":e||void 0,children:[e&&jsx("span",{"aria-hidden":true,css:[T,I]}),jsx("span",{className:"plainframe-ui-skeleton-content",css:x,children:o})]})});var Ar=8,Qs=20,Xn=4,jl=({value:e,defaultValue:t,onChange:n,min:o=0,max:r=100,step:s=1,disabled:a=false,rounded:c=false,showValue:i=false,showStepper:l=false,label:u,fullWidth:d=false,css:y,trackCss:f,thumbCss:T,direction:I="horizontal",className:x,...R})=>{let g=V(),p=I==="vertical",m=useRef(null),[C,P]=useState(false),[w,v]=useState(false),[N,B]=useState(false),K=e!==void 0,O=useCallback(Z=>Math.min(r,Math.max(o,Z)),[o,r]),S=useCallback(Z=>O(Math.round((Z-o)/s)*s+o),[o,s,O]),[F,M]=useState(()=>S(t??o)),b=K?S(e):F;useEffect(()=>{K||M(Z=>S(Z));},[o,r,s,K,S]);let h=g.palette.primary[600],A=g.surface.panelBg,D=g.neutral[500],L=useMemo(()=>{let Z=r-o||1;return (b-o)/Z*100},[b,o,r]),k=useCallback(Z=>{K||M(Z),n?.(Z);},[K,n]),E=useCallback((Z,Ee)=>{let Q=m.current;if(!Q)return b;let ee=Q.getBoundingClientRect(),se=p?(ee.bottom-Ee)/ee.height:(Z-ee.left)/ee.width;return se=Math.max(0,Math.min(1,se)),S(o+se*(r-o))},[b,p,o,r,S]),W=useCallback(Z=>{a||(Z.currentTarget.setPointerCapture?.(Z.pointerId),k(E(Z.clientX,Z.clientY)),P(true));},[a,k,E]),$=useCallback(Z=>{a||(Z.currentTarget.setPointerCapture?.(Z.pointerId),P(true));},[a]),z=useCallback(Z=>{!C||a||k(E(Z.clientX,Z.clientY));},[C,a,k,E]),_=useCallback(()=>P(false),[]);useEffect(()=>{if(C)return window.addEventListener("pointermove",z),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_);}},[C,z,_]);let H=useCallback(Z=>{if(a)return;let Ee=b;if(Z.key==="ArrowRight"||Z.key==="ArrowUp")Ee=b+s;else if(Z.key==="ArrowLeft"||Z.key==="ArrowDown")Ee=b-s;else if(Z.key==="Home")Ee=o;else if(Z.key==="End")Ee=r;else return;Z.preventDefault(),k(S(Ee));},[a,b,s,o,r,k,S]),U=C||w||N,X=(w||C)&&!a,ae=`color-mix(in srgb, ${h} 25%, transparent)`,q=css({display:"flex",flexDirection:p?"row":"column",alignItems:"center",padding:p?"1rem":"1rem 0",width:p?"fit-content":d?"100%":350,height:p?250:"auto",boxSizing:"border-box"}),Y=css({marginBottom:p?0:4,marginRight:p?8:0,color:g.text.primary,userSelect:"none"}),le=css({position:"relative",width:p?Ar:"100%",height:p?"100%":Ar,backgroundColor:g.neutral[200],borderRadius:g.radius.xs,cursor:a?"not-allowed":"pointer",touchAction:"none",outline:"none",overflow:"visible"}),ie=css({position:"absolute",left:p?"50%":0,top:p?2:"50%",transform:p?"translateX(-50%)":"translateY(-50%)",width:p?Ar:`calc(100% - ${Xn*.5}px)`,height:p?`calc(100% - ${Xn*.5}px)`:Ar,display:"flex",flexDirection:p?"column":"row",justifyContent:"space-between",alignItems:"center",pointerEvents:"none",zIndex:0,padding:0}),be=css({width:Xn,height:Xn,borderRadius:"50%",backgroundColor:g.text.primary,opacity:.15,flex:"0 0 auto"}),Pe=css({position:"absolute",left:0,top:p?`calc(${100-L}% )`:0,bottom:0,width:p?"100%":`${L}%`,height:p?`${L}%`:"100%",backgroundColor:a?D:h,borderRadius:g.radius.sm,zIndex:1,transition:"none",pointerEvents:"none"}),Re=css({position:"absolute",appearance:"none",WebkitAppearance:"none",background:A,width:Qs,height:Qs,left:p?"50%":`calc(${L}% - ${Qs/2}px)`,bottom:p?`${L}%`:"auto",top:p?"auto":"50%",transform:p?"translate(-50%, 50%)":"translateY(-50%)",borderRadius:c?g.radius.full:`calc(${g.radius.md} * 0.75)`,border:`2px solid ${a?D:h}`,cursor:a?"not-allowed":"grab",zIndex:5,padding:0,lineHeight:0,transition:"box-shadow .16s ease",boxShadow:X?`0 0 0 ${C?4:8}px ${ae}`:`0 0 0 0px ${ae}`,"&:focus-visible":{boxShadow:`0 0 0 4px ${ae}`,outline:"none"}}),Ce=css({position:"relative",backgroundColor:"transparent",padding:"1rem",top:p?-7.5:-28,left:p?9:-7.5,pointerEvents:"none"}),Ie=css({position:"absolute",top:p?`calc(50% - ${Xn*2.5}px)`:0,left:p?"auto":`calc(50% - ${Xn*3}px)`,transform:p?"translateY(-50%)":"translateX(-50%)",backgroundColor:g.neutral[800],color:g.neutral[0],padding:"0.6rem 0.25rem",fontSize:12,borderRadius:6,whiteSpace:"nowrap",pointerEvents:"auto",zIndex:6,"&::after":{content:'""',position:"absolute",width:6,height:6,backgroundColor:g.neutral[800],borderRadius:2,bottom:p?"50%":-2,left:p?-2.5:"50%",transform:p?"translateY(50%) rotate(45deg)":"translateX(-50%) rotate(45deg)"}}),Te=y,we=f,he=T,je=Math.floor((r-o)/s)+1;return jsxs("div",{...R,role:"group","aria-label":u,className:["plainframe-ui-slider",x||""].join(" ").trim(),css:[q,Te],"data-orientation":p?"vertical":"horizontal",children:[u&&!p&&jsx("div",{className:"plainframe-ui-slider-label",css:Y,children:u}),jsxs("div",{ref:m,className:"plainframe-ui-slider-track",css:[le,we],onPointerDown:W,children:[l&&s>0&&jsx("div",{className:"plainframe-ui-slider-stepper",css:ie,children:Array.from({length:je}).map((Z,Ee)=>jsx("span",{className:"plainframe-ui-slider-step-dot",css:be},Ee))}),jsx("div",{className:"plainframe-ui-slider-fill",css:Pe}),jsxs("button",{type:"button",role:"slider","aria-valuemin":o,"aria-valuemax":r,"aria-valuenow":b,"aria-disabled":a||void 0,tabIndex:a?-1:0,onKeyDown:H,onPointerDown:$,onPointerUp:_,onPointerCancel:_,onMouseEnter:()=>v(true),onMouseLeave:()=>v(false),className:"plainframe-ui-slider-thumb",css:[Re,he],children:[jsx(AnimatePresence,{children:U&&jsx(motion.div,{className:"plainframe-ui-slider-tooltip-anchor",css:Ce,initial:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},transition:{duration:.16,ease:"easeOut"},children:jsx(motion.div,{className:"plainframe-ui-slider-tooltip",css:Ie,initial:{opacity:0,y:p?0:4,x:p?-4:0},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:p?0:4,x:p?-4:0},transition:{duration:.16,ease:"easeOut"},onMouseEnter:()=>B(true),onMouseLeave:()=>B(false),children:b})})}),null]})]}),u&&p&&jsx("div",{className:"plainframe-ui-slider-label",css:[Y,{marginLeft:8}],children:u})]})};jl.displayName="Slider";var Lf=e=>css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",maxWidth:e==null?"100%":typeof e=="number"?`${e}px`:e,width:"100%"}),Bf=css({display:"flex",alignItems:"center",width:"100%",gap:12}),$f=e=>css({display:"flex",minWidth:0,flex:"0 0 auto",alignItems:"center",justifyContent:"center",gap:8,flexDirection:e==="left"?"row-reverse":e==="right"?"row":e==="top"?"column-reverse":"column"}),zf=e=>css({position:"relative",flex:"1 1 24px",minWidth:6,height:2,borderRadius:1,background:e,overflow:"hidden"}),Of=(e,t,n)=>css({position:"absolute",inset:0,transformOrigin:"left center",transform:`scaleX(${e})`,background:t,transition:n?"all .28s var(--pf-ease)":"none",willChange:"transform"}),Wf=css({flex:"1 1 24px",minWidth:2,display:"flex",alignItems:"center",justifyContent:"center"}),Kf=(e,t,n,o,r)=>css({position:"relative",appearance:"none",border:`2px solid ${o}`,width:e,height:e,minWidth:e,minHeight:e,borderRadius:r,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",background:t,color:n,transition:"all .22s var(--pf-ease)","&:disabled, &[aria-disabled='true']":{opacity:.55,cursor:"not-allowed"}}),_f=css({fontWeight:700,fontSize:14,lineHeight:1,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"}),Vl=e=>css({position:"absolute",inset:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transform:`scale(${e?1:.3})`,opacity:e?1:0,transition:"background .22s var(--pf-ease), transform .16s var(--pf-ease), opacity .16s var(--pf-ease)",willChange:"transform, opacity"}),jf=(e,t,n,o,r)=>css({fontSize:14,color:e?t:n,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",transition:"all .16s ease",textAlign:"center",fontWeight:700,margin:`0 ${r}px`,borderRadius:o}),Vf=me.memo(function({i:t,item:n,size:o,tokens:r,variant:s,titlePosition:a,isActive:c,completed:i,disabled:l,connectorColor:u,showConnector:d,animate:y,separator:f,canGoToIndex:T,setSelected:I}){let x=V(),R=xe(),{MAIN:g,ACTIVE_TEXT:p,ACTIVE_TEXT_OUTLINED:m,COMPLETE_BG:C,COMPLETE_FG:P,UPCOMING_BG_FILLED:w,UPCOMING_OUTLINE:v,UPCOMING_FG:N}=r,B="transparent",K=N,O=v;s==="subtle"?i?(B=C,K=P,O=C):c?(B=g,K=p,O=g):(B=w,K=N,O=w):i?(B=C,K=P,O=C):c?(B="transparent",K=m,O=g):(B="transparent",K=N,O=v);let S=n.label,F=n.icon??jsx("span",{css:_f,children:typeof S=="number"?S:t+1}),M=n.completedIcon??jsx(Check,{strokeWidth:3.25,size:16});return jsxs(Fragment,{children:[jsxs("div",{className:"plainframe-ui-step",css:$f(a),children:[jsxs("button",{className:"plainframe-ui-step-node",css:[Kf(o,B,K,O,String(x.radius.full)),!l&&R({color:c?"primary":"neutral"})],onClick:()=>{!l&&T(t)&&I(n.value);},tabIndex:l?-1:0,"aria-current":c?"step":void 0,"aria-disabled":l||void 0,disabled:l,"aria-label":typeof S=="string"?S:`Step ${t+1}`,children:[jsx("span",{className:"plainframe-ui-step-content",css:Vl(!i),children:F}),jsx("span",{className:"plainframe-ui-step-check",css:Vl(!!i),children:M})]}),S&&jsx("span",{className:"plainframe-ui-step-label",css:jf(i||c,x.text.primary,x.text.secondary,String(x.radius.xs),Number(x.spacing.xs)),children:S})]}),d&&(f?jsx("div",{className:"plainframe-ui-stepper-separator",css:Wf,children:f}):jsx("div",{className:"plainframe-ui-step-connector",css:zf(x.neutral[300]),children:jsx("div",{className:"plainframe-ui-step-connector-fill",css:Of(i?1:0,u,y),"aria-hidden":"true"})}))]})},(e,t)=>e.isActive===t.isActive&&e.completed===t.completed&&e.disabled===t.disabled&&e.variant===t.variant&&e.separator===t.separator&&e.connectorColor===t.connectorColor&&e.titlePosition===t.titlePosition&&e.size===t.size),na=()=>null;na.displayName="PlainframeUIStep";var Uf=({variant:e="subtle",value:t,defaultValue:n,onChange:o,disabled:r=false,allowForward:s=true,allComplete:a=false,color:c,activeBgColor:i,activeColor:l,completeBgColor:u,completeColor:d,separator:y,titlePosition:f="right",width:T,css:I,className:x,children:R,...g})=>{let p=V(),m=e==="outlined"?"outlined":"subtle",C=me.useMemo(()=>{let E=me.Children.toArray(R).filter(W=>me.isValidElement(W)&&W.type===na);return E.length?E.map((W,$)=>({index:$,...W.props})):[{value:1},{value:2},{value:3}]},[R]),P=me.useCallback((E,W)=>E?p.palette?.[E]??E:W,[p.palette]),w=me.useMemo(()=>({MAIN:String(P(i,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),ACTIVE_TEXT:String(P(l,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),ACTIVE_TEXT_OUTLINED:String(P(l,typeof p.text.primary=="string"?p.text.primary:"")),COMPLETE_BG:String(P(u,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),COMPLETE_FG:String(P(d,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),UPCOMING_BG_FILLED:String(typeof p.neutral[100]=="string"?p.neutral[100]:""),UPCOMING_OUTLINE:String(typeof p.neutral[300]=="string"?p.neutral[300]:""),UPCOMING_FG:String(typeof p.text.secondary=="string"?p.text.secondary:"")}),[P,i,l,u,d,p.palette.primary,p.neutral,p.text]),v=me.useMemo(()=>{let E=P(c,p.palette.primary[600]);return typeof E=="string"?E:String(E)},[P,c,p.palette.primary]),[N,B]=me.useState(()=>C.some(W=>W?.value===n)?n:C[0]?.value),K=t!==void 0,O=K?t:N,{activeIndex:S,afterLast:F}=me.useMemo(()=>{let E=C.findIndex(W=>W.value===O);if(E!==-1)return {activeIndex:E,afterLast:false};if(typeof O=="number"){let W=Math.floor(O)-1;if(W>=C.length)return {activeIndex:C.length-1,afterLast:true};if(W>=0)return {activeIndex:W,afterLast:false}}return {activeIndex:0,afterLast:false}},[C,O]),M=me.useCallback(E=>{r||(K||B(E),o?.(E));},[r,K,o]),b=me.useCallback(E=>a||!!C[E]?.complete||(F?true:E<S),[a,C,F,S]),h=me.useCallback(E=>{if(r)return false;let W=C[E];if(!W||W.disabled)return false;if(typeof s=="boolean"){if(s===false&&E>S)return false}else if(typeof s=="function"&&!s(S,E))return false;return true},[r,C,s,S]),[A,D]=me.useState(false);me.useEffect(()=>{let E=requestAnimationFrame(()=>D(true));return ()=>cancelAnimationFrame(E)},[]);let L=me.useCallback(E=>{if(!C.length||r)return;let W=S;if(E.key==="ArrowRight")W=Math.min(C.length-1,S+1);else if(E.key==="ArrowLeft")W=Math.max(0,S-1);else if(E.key==="Home")W=0;else if(E.key==="End")W=C.length-1;else return;E.preventDefault(),h(W)&&M(C[W].value);},[C,r,S,h,M]),k=34;return jsx("div",{tabIndex:-1,className:["plainframe-ui-stepper",x||""].join(" ").trim(),css:[Lf(T),I],...g,children:jsx("div",{tabIndex:-1,className:"plainframe-ui-stepper-track",role:"list",onKeyDown:L,css:Bf,children:C.map((E,W)=>jsx(me.Fragment,{children:jsx(Vf,{i:W,item:E,size:k,tokens:w,variant:m,titlePosition:f,isActive:!F&&W===S,completed:b(W),disabled:r||!!E.disabled,connectorColor:v,showConnector:W<C.length-1,animate:A,separator:y,canGoToIndex:h,setSelected:M})},String(E.value??W)))})})};var Nr=()=>null;Nr.displayName="PF.Tab";var Dr=()=>null;Dr.displayName="PF.TabContent";function Gf(e){let t=e.props;return {type:t?.__EMOTION_TYPE_PLEASE_DO_NOT_USE__??e.type,props:t}}var Xf=({children:e,defaultValue:t,value:n,onChange:o,variant:r="subtle",direction:s="horizontal",className:a,shadow:c=false,width:i,fullWidth:l=false,rounded:u=false,titlePosition:d="right",align:y,css:f,trackCss:T,thumbCss:I,activeTabCss:x,activeIndicatorCss:R})=>{let g=V(),p=xe(),m=s==="vertical",C=l||i!=null,P=y??(m?"left":"center"),w={left:"flex-start",center:"center",right:"flex-end"},{tabs:v,contents:N}=me.useMemo(()=>{let Q=[],ee=[];return me.Children.forEach(e,se=>{if(!me.isValidElement(se))return;let{type:pe,props:Se}=Gf(se),Ne=pe===Nr||pe?.displayName===Nr.displayName,J=pe===Dr||pe?.displayName===Dr.displayName;if(Ne){let oe=Se;if(oe?.value===void 0)return;Q.push({value:oe.value,disabled:oe.disabled,node:oe.children,className:oe.className,css:oe.css,activeCss:oe.activeCss});}else if(J){let oe=Se;if(oe?.value===void 0)return;ee.push({value:oe.value,node:oe.children,className:oe.className,css:oe.css});}}),{tabs:Q,contents:ee}},[e]),B=me.useMemo(()=>v.find(Q=>!Q.disabled)?.value,[v]),[K,O]=me.useState(()=>t!==void 0&&v.some(ee=>ee.value===t&&!ee.disabled)?t:B),S=n!==void 0,F=S?n:K,M=me.useRef(null),b=me.useRef([]),h=Math.max(0,v.findIndex(Q=>Q.value===F)),[A,D]=me.useState({left:0,top:0,width:0,height:0}),[L,k]=me.useState(false),[E,W]=me.useState(false),$=me.useCallback(()=>{let Q=M.current,ee=b.current[h];if(!Q||!ee)return;let se=Q.getBoundingClientRect(),pe=ee.getBoundingClientRect();D({left:pe.left-se.left,top:pe.top-se.top,width:pe.width,height:pe.height});},[h]);me.useLayoutEffect(()=>{$(),L||(k(true),requestAnimationFrame(()=>W(true)));},[$,L]),me.useEffect(()=>{let Q=new ResizeObserver(()=>$());M.current&&Q.observe(M.current);let ee=b.current[h];ee&&Q.observe(ee);let se=()=>$();return window.addEventListener("resize",se),()=>{Q.disconnect(),window.removeEventListener("resize",se);}},[$,h]);let z=(Q,ee)=>{if(!v.length)return Q;let se=Q;for(let pe=0;pe<v.length;pe++)if(se=(se+ee+v.length)%v.length,!v[se].disabled)return se;return Q},_=Q=>{S||O(Q),o?.(Q);},H=Q=>{if(!v.length)return;let ee=h;if(Q.key===(m?"ArrowDown":"ArrowRight"))ee=z(h,1);else if(Q.key===(m?"ArrowUp":"ArrowLeft"))ee=z(h,-1);else if(Q.key==="Home")ee=v.findIndex(pe=>!pe.disabled);else if(Q.key==="End"){let pe=[...v].reverse().findIndex(Se=>!Se.disabled);ee=pe===-1?h:v.length-1-pe;}else return;Q.preventDefault();let se=v[ee]?.value;se!==void 0&&_(se),requestAnimationFrame(()=>b.current[ee]?.focus());},U=g.text.primary,X=g.text.secondary,ae=g.neutral[500],q=r==="subtle"?g.surface.subtleBg:"transparent",Y=r==="subtle"?g.surface.panelBg??g.surface.panelBg:r==="ghost"?g.surface.subtleBg:"transparent",le=g.text.primary,ie=r==="subtle"||r==="ghost"||r==="underlined",be=css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",width:l?"100%":i==null?"auto":typeof i=="number"?`${i}px`:i}),Pe=r==="subtle",Re=css({position:"relative",display:C?"flex":"inline-flex",width:C?"100%":"auto",flexDirection:m?"column":"row",alignItems:m?"stretch":"center",flexWrap:"nowrap",gap:g.spacing.xs,padding:Pe?g.spacing.xs:0,background:q,borderRadius:r==="subtle"?u?m?g.radius.lg:g.radius.full:g.radius.lg:"none"}),Ce=css({position:"absolute",zIndex:0,pointerEvents:"none",opacity:L?1:0,visibility:L?"visible":"hidden",transition:E?`${m?"top":"left"} .24s var(--pf-ease), ${m?"height":"width"} .24s var(--pf-ease), background-color .18s var(--pf-ease)`:"none",borderRadius:r==="subtle"||r==="ghost"?u?g.radius.full:g.radius.md:0,background:r==="underlined"?"transparent":Y,...m?{top:`${A.top}px`,height:`${A.height}px`,left:g.spacing.xs,right:g.spacing.xs}:{left:`${A.left}px`,width:`${A.width}px`,top:g.spacing.xs,bottom:g.spacing.xs},boxShadow:c&&r==="subtle"?"0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.04)":"none"}),Ie=css(r!=="underlined"?{}:m?{background:"transparent",top:`${A.top}px`,height:`${A.height}px`,left:0,width:0,borderLeft:`2px solid ${le}`,borderBottom:"none",borderRadius:2}:{background:"transparent",left:`${A.left}px`,width:`${A.width}px`,bottom:0,top:"auto",height:0,borderBottom:`2px solid ${le}`,borderLeft:"none",borderRadius:2}),Te=css({position:"relative",zIndex:1,border:"none",background:"transparent",padding:r==="underlined"&&s!=="vertical"?`${g.spacing.md}`:r==="ghost"&&s!=="vertical"?`${g.spacing.md}`:`${g.spacing.xs} ${g.spacing.md}`,borderRadius:(r==="subtle"||r==="ghost")&&u?g.radius.full:g.radius.md,minHeight:g.componentHeights.sm,outline:"none",transition:"color .16s ease !important",display:"flex",alignItems:"center",justifyContent:"center",...m?{width:C?"100%":"auto",flex:"0 0 auto",textAlign:P}:C?{flex:"1 1 0",minWidth:0,textAlign:"center"}:{flex:"0 0 auto",minWidth:"max-content",textAlign:"center"},whiteSpace:"nowrap",boxSizing:"border-box",cursor:"pointer",userSelect:"none",fontSize:g.typography.sizes.sm,fontWeight:600,color:X,"&[aria-selected='true']":{color:U},"&:hover":{color:U},"&[aria-disabled='true'], &:disabled":{opacity:.55,cursor:"not-allowed",color:ae}}),we=css({display:"inline-flex",alignItems:"center",justifyContent:m?w[P]:"center",gap:6,width:"100%",flexDirection:d==="top"?"column-reverse":d==="bottom"?"column":d==="left"?"row-reverse":"row"}),he=css({marginTop:g.spacing.sm,width:"100%"}),je=me.useId(),Z=new Map;N.forEach((Q,ee)=>Z.set(Q.value,`${je}-panel-${ee}`));let Ee=Q=>`${je}-tab-${Q}`;return jsxs("div",{className:["plainframe-ui-tabs",a||""].join(" ").trim(),css:[be,f],children:[jsxs("div",{className:"plainframe-ui-tabs-track",ref:M,role:"tablist","aria-orientation":m?"vertical":"horizontal",onKeyDown:H,css:[Re,T],children:[ie&&jsx("div",{className:"plainframe-ui-tabs-thumb",css:[Ce,Ie,I,R]}),v.map((Q,ee)=>{let se=F===Q.value;return jsx("button",{ref:pe=>{b.current[ee]=pe;},role:"tab",id:Ee(ee),"aria-selected":se,"aria-controls":Z.get(Q.value),"aria-disabled":Q.disabled||void 0,disabled:Q.disabled,tabIndex:Q.disabled?-1:ee===h?0:-1,className:["plainframe-ui-tab",Q.className||""].join(" ").trim(),onClick:()=>{Q.disabled||_(Q.value);},css:[Te,!Q.disabled&&p(),Q.css,se?Q.activeCss??x:void 0],children:jsx("span",{className:"plainframe-ui-tab-content",css:we,children:Q.node})},String(Q.value??ee))})]}),N.map((Q,ee)=>{let se=Q.value===F;if(!se)return null;let pe=v.findIndex(Ne=>Ne.value===Q.value),Se=pe>=0?Ee(pe):void 0;return console.log("rendering panel for",Q.value,"active:",se),jsx("div",{role:"tabpanel",id:Z.get(Q.value),"aria-labelledby":Se,className:["plainframe-ui-tab-panel",Q.className||""].join(" ").trim(),css:[he,Q.css],children:Q.node},ee)})]})};var Po=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,kn=e=>e==null?[]:Array.isArray(e)?e:[e],No=(...e)=>css(e.filter(Boolean)),tg=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,error:s,helperText:a,disabled:c=false,fullWidth:i=false,width:l=235,size:u="md",variant:d="subtle",rounded:y=false,rows:f=3,maxRows:T,maxLength:I,showCharCount:x,focusRingMode:R="always",resizable:g=false,className:p,wrapperCss:m,inputCss:C,labelCss:P,helperRowCss:w,helperTextCss:v,charCountCss:N,css:B,onBlur:K,onFocus:O,onKeyDown:S,autoFocus:F,name:M,id:b,tabIndex:h,autoComplete:A,readOnly:D,required:L})=>{let k=V(),E=Yo(),W=useId(),$=useMemo(()=>({sm:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.sm,labelFont:k.typography.sizes.xs,helperFont:k.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:k.spacing.md},md:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.md,labelFont:k.typography.sizes.sm,helperFont:k.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:k.spacing.md},lg:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.lg,labelFont:k.typography.sizes.md,helperFont:k.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:k.spacing.md}}),[k]),z=["sm","md","lg"].includes(u)?u:"md",_=$[z],H=k.neutral,U=k.text,X=t!==void 0,[ae,q]=useState(n),Y=X?t:ae,le=useCallback(se=>{X||q(se),o?.(se);},[X,o]),ie=useMemo(()=>c?H[200]:s&&d==="outlined"?k.palette.danger?.[50]??k.surface.panelBg:s&&d==="subtle"?k.palette.danger?.[50]??k.surface.subtleBg:d==="outlined"?k.surface.panelBg:d==="subtle"?k.surface.subtleBg:"transparent",[c,s,d,H,k.surface,k.palette.danger]),be=k.componentHeights.border,Pe=useMemo(()=>d==="outlined"?`${be} solid ${s?k.palette.danger?.[300]??k.surface.border:k.surface.border}`:"none",[d,be,s,k.palette.danger,k.surface.border]),Re=useMemo(()=>css({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:i?"100%":l!=null?Po(l):void 0,flex:"0 0 auto",fontWeight:500}),[i,l]),Ce=useMemo(()=>No({fontSize:_.labelFont,fontWeight:500,color:s?k.palette.danger?.[700]??U.primary:c?H[500]:U.primary,marginBottom:4,display:"inline-block"},...kn(P)),[_.labelFont,s,c,H,U,k.palette.danger,P]),Ie=useMemo(()=>[{display:"flex",alignItems:"stretch",gap:k.spacing.sm,padding:`${Po(_.paddingY)} 0 ${Po(_.paddingY)} ${Po(_.paddingX)}`,background:ie,border:Pe,borderRadius:y?k.radius.full:k.radius.md,minHeight:_.minHeight,width:"100%",cursor:c?"not-allowed":"text",opacity:c?.65:1,transition:"box-shadow .18s, border-color .16s"},...kn(m),...kn(B)],[k,_,ie,Pe,be,y,c,m,B]),Te=typeof _.minHeight=="number"?`${_.minHeight}px`:_.minHeight,we=useMemo(()=>No({width:"100%",minWidth:0,flex:1,resize:g?"vertical":"none",font:"inherit",fontWeight:500,fontSize:_.fontSize,lineHeight:1.5,color:c?H[500]:s?k.palette.danger?.[800]??U.primary:U.primary,background:"transparent",border:"none",outline:"none",padding:0,paddingRight:Po(_.paddingX),overflowY:"auto",minHeight:Te,"&::placeholder":{color:s?k.palette.danger?.[700]??U.secondary:U.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${s?k.palette.danger?.[800]??U.primary:U.primary} !important`,boxShadow:`0 0 0 1000px ${ie} inset !important`,transition:"opacity 99999s ease-out",caretColor:s?k.palette.danger?.[800]??U.primary:U.primary},":focus-within":{outline:"none",boxShadow:"none"},...f===1?{paddingBlock:`calc((${Te} - 1.5em) / 2)`}:{paddingBlock:"clamp(4px, 0.5em, 12px)"}},...kn(C)),[g,_,c,s,H,U,k.palette.danger,Te,ie,f,C]),he=useMemo(()=>No({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,paddingTop:3},...kn(w)),[w]),je=useMemo(()=>No({fontSize:_.helperFont,color:s?k.palette.danger?.[700]??U.secondary:U.secondary,flex:1,minWidth:0},...kn(v)),[_.helperFont,s,k.palette.danger,U,v]),Z=useMemo(()=>No({fontSize:_.helperFont,color:I&&Y.length>I?k.palette.danger?.[700]??U.secondary:U.secondary,flexShrink:0},...kn(N)),[_.helperFont,I,Y.length,k.palette.danger,U,N]),Ee=useRef(null);useLayoutEffect(()=>{if(typeof window>"u")return;let se=Ee.current;if(!se)return;if(g){let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),J=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),J);se.style.setProperty("--pf-minh",`${oe}px`);return}(()=>{let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),J=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),J);se.style.setProperty("--pf-minh",`${oe}px`);let re=T?Ne*T:1/0;se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,re)}px`;})();},[Y,f,T,_.minHeight,g]);let Q=a!=null||x?`${b??W}-help`:void 0,ee=b??W;return jsxs("div",{className:["plainframe-ui-textarea",p||""].join(" ").trim(),css:Re,children:[e&&jsx("label",{htmlFor:ee,className:"plainframe-ui-textarea-label",css:Ce,children:e}),jsx("div",{className:"plainframe-ui-textarea-surface",css:[E({enabled:R!=="none",disabled:c,color:s?"danger":void 0}),Ie],"aria-invalid":!!s||void 0,"aria-disabled":c||void 0,onClick:()=>!c&&Ee.current?.focus(),children:jsx("textarea",{ref:Ee,id:ee,className:"plainframe-ui-textarea-input",css:we,rows:f,value:Y,onChange:se=>{let pe=se.target.value;I&&pe.length>I||le(pe);},placeholder:r||"",disabled:c,onBlur:K,onFocus:O,onKeyDown:S,autoFocus:F,name:M,tabIndex:h,autoComplete:A,readOnly:D,required:L,"aria-invalid":!!s||void 0,"aria-describedby":Q})}),(a!=null||x&&I!=null)&&jsxs("div",{className:"plainframe-ui-textarea-helper-row",css:he,children:[jsx("span",{id:Q,className:"plainframe-ui-textarea-helper-text",css:je,children:a}),x&&I!=null&&jsxs("span",{className:"plainframe-ui-textarea-char-count",css:Z,children:[Y.length,"/",I]})]})]})};var cg=Vo,ug={type:"spring",stiffness:920,damping:100},Gl="__toast_root__",dg=(e,t)=>t.split(".").reduce((n,o)=>n!=null&&typeof n=="object"?n[o]:void 0,e),Lr=(e,t)=>{for(let n of t){let o=dg(e,n);if(o!=null&&o!=="")return o}},ra=(e,t)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:String(e);function pg(e){let t=Lr(e,["radius.md","shape.borderRadius","radii.md"]),n=Lr(e,["spacing.lg","space.4","spacing.4"]),o=Lr(e,["spacing.md","space.3","spacing.3"]),r=Lr(e,["shadows.lg","elevation.lg"])??"0 8px 24px rgba(0,0,0,.03), 0 2px 8px rgba(0,0,0,.05)";return {radius:ra(t,16),padX:ra(n,14),padY:ra(o,12),shadow:String(r)}}var mg=pg(cg),Wt=null,Yn=null,ye={max:5,position:"bottom-right",gutter:5,zIndex:1e3,duration:5e3,showDismiss:"hover",styles:{},renderer:void 0,bareRenderer:false};function Jl(){typeof document>"u"||(Wt||(Wt=document.getElementById("toast-host"),Wt||(Wt=document.createElement("div"),Wt.id="toast-host",document.body.appendChild(Wt))),Yn||(Yn=Wt[Gl]??null,Yn||(Yn=createRoot(Wt),Wt[Gl]=Yn,Yn.render(jsx(Na,{children:jsx(wg,{})})))));}var te={displayed:[],queue:[],entering:{},exiting:{},enterFrom:{},timers:new Map,expiry:new Map,remaining:new Map,paused:new Set,listeners:new Set,snapshot:{displayed:[],entering:{},exiting:{},enterFrom:{}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)},notify(){this.listeners.forEach(e=>e());},sync(){this.snapshot={displayed:[...this.displayed],entering:{...this.entering},exiting:{...this.exiting},enterFrom:{...this.enterFrom}};}},In=()=>{te.sync(),te.notify();},fg=()=>typeof crypto<"u"&&"randomUUID"in crypto&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2);function Br(e,t){if(t===null)return;let n=t??e.duration;if(n==null||te.timers.has(e.id))return;let o=Date.now(),r=te.remaining.get(e.id),s=r!=null?Math.max(0,r):n;te.expiry.set(e.id,o+s);let a=window.setTimeout(()=>Be.dismiss(e.id),s);te.timers.set(e.id,a);}function $r(e){let t=te.timers.get(e);t&&(clearTimeout(t),te.timers.delete(e));}function gg(){let e=false;for(;te.displayed.length<ye.max&&te.queue.length;){let t=te.queue.shift();te.displayed=[t,...te.displayed],te.enterFrom[t.id]="head",te.entering[t.id]=true,e=true,requestAnimationFrame(()=>{delete te.entering[t.id],In();}),Br(t);}e&&In();}function bg(){if(te.displayed.length<ye.max)return;let e=te.displayed.filter(o=>!te.exiting[o.id]);if(!e.length)return;let t=e.reduce((o,r)=>o.createdAt<=r.createdAt?o:r),n=te.expiry.get(t.id);n!=null&&te.remaining.set(t.id,Math.max(0,n-Date.now())),$r(t.id),te.exiting[t.id]=true,te.displayed=te.displayed.filter(o=>o.id!==t.id),delete te.enterFrom[t.id],te.queue.push(t),In();}var hg=e=>e==="danger"?"error":["default","success","error","warning","info"].includes(e)?e:"default";function yg(e,t){let n=hg(t),o=e,r=o.surface,s=o.text,a=r?.panelBg??"#fff",c=s?.primary??"#111",i=r?.border;if(n==="default"||n==="info")return {bg:a,fg:c,border:i};let l=s?.onColors??{},u=(d,y,f)=>{let T=o.colors,I=o.palette;return {bg:T?.[d]??I?.[d]?.[700]??y,fg:l?.[d]??f,border:"transparent"}};return n==="success"?u("success","#22C55E","#fff"):n==="warning"?u("warning","#F59E0B","#fff"):n==="error"?u("error","#EF4444","#fff"):{bg:a,fg:c,border:i}}var Be=Object.assign((e,t)=>{Jl();let n=i=>i!=null&&typeof i[Symbol.iterator]=="function",o=i=>!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function",r;typeof e=="object"&&e!=null&&!me.isValidElement(e)&&!n(e)&&!o(e)?r=e:r={content:(me.isValidElement(e),e),...t||{}},r.content==null&&(r.title!=null||r.description!=null)&&(r.content=jsxs("div",{children:[r.title&&jsx("strong",{style:{display:"block",marginBottom:2},children:r.title}),r.description]}));let s=r.id??fg(),a=i=>{let l=i.findIndex(y=>y.id===s);if(l===-1)return false;let u=i[l],d={...u,status:r.status??u.status,content:r.content??u.content,title:r.title??u.title,description:r.description??u.description,startIcon:r.startIcon??u.startIcon,endIcon:r.endIcon??u.endIcon,action:r.action??u.action,onClose:r.onClose??u.onClose,duration:r.duration===void 0?u.duration:r.duration,pauseOnHover:r.pauseOnHover??u.pauseOnHover,showDismiss:r.showDismiss??u.showDismiss,render:r.render??u.render,bare:r.bare??u.bare,onClick:r.onClick??u.onClick,width:r.width??u.width};return i[l]=d,$r(s),te.remaining.delete(s),te.paused.has(s)||Br(d),In(),true};if(a(te.displayed)||a(te.queue))return s;let c={id:s,status:r.status??"default",content:r.content,title:r.title,description:r.description,startIcon:r.startIcon,endIcon:r.endIcon,action:r.action,duration:r.duration===void 0?ye.duration:r.duration,onClose:r.onClose,createdAt:Date.now(),pauseOnHover:r.pauseOnHover??true,showDismiss:r.showDismiss,render:r.render,bare:r.bare,onClick:r.onClick,width:r.width??300};return te.displayed.length>=ye.max&&bg(),te.displayed=[...te.displayed,c],te.enterFrom[c.id]="tail",te.entering[c.id]=true,requestAnimationFrame(()=>{delete te.entering[c.id],In();}),In(),Br(c),s},{success:(e,t={})=>Be(e,{...t,status:"success"}),error:(e,t={})=>Be(e,{...t,status:"error"}),warning:(e,t={})=>Be(e,{...t,status:"warning"}),info:(e,t={})=>Be(e,{...t,status:"info"}),custom:(e,t={})=>Be(e,{...t}),update:(e,t)=>Be({id:e,...t}),dismiss:e=>{if(!e){let n=te.displayed.find(o=>!te.exiting[o.id])?.id;n&&Be.dismiss(n);return}$r(e),te.remaining.delete(e),te.paused.delete(e),te.exiting[e]=true;let t=te.displayed.find(n=>n.id===e);te.displayed=te.displayed.filter(n=>n.id!==e),delete te.enterFrom[e],In(),window.setTimeout(()=>t?.onClose?.(),120),gg();},clear:()=>{[...te.displayed.map(t=>t.id)].forEach(t=>Be.dismiss(t));},pause:e=>{if(te.paused.has(e))return;let t=te.expiry.get(e);t!=null&&te.remaining.set(e,Math.max(0,t-Date.now())),te.paused.add(e),$r(e);},resume:e=>{if(!te.paused.has(e))return;te.paused.delete(e);let t=te.displayed.find(o=>o.id===e)??te.queue.find(o=>o.id===e),n=te.remaining.get(e);t&&Br(t,n??void 0),te.remaining.delete(e);},pauseLatest:()=>{let e=te.displayed.at(-1);e&&Be.pause(e.id);},resumeLatest:()=>{let e=te.displayed.at(-1);e&&Be.resume(e.id);},promise:(e,t,n={})=>{let o=Be(t.loading,{...n,status:"info",duration:null});return e.then(r=>{Be.update(o,{status:"success",content:t.success(r),duration:n.duration??2500});}).catch(r=>{Be.update(o,{status:"error",content:t.error(r),duration:n.duration??3e3});}),e},config:e=>{e.max!=null&&(ye.max=e.max),e.position&&(ye.position=e.position),e.gutter!=null&&(ye.gutter=e.gutter),e.zIndex!=null&&(ye.zIndex=e.zIndex),e.duration!==void 0&&(ye.duration=e.duration),e.showDismiss&&(ye.showDismiss=e.showDismiss),e.styles&&(ye.styles={...ye.styles,...e.styles}),e.renderer!==void 0&&(ye.renderer=e.renderer),e.bareRenderer!==void 0&&(ye.bareRenderer=e.bareRenderer);}});function xg(e){return typeof e=="string"?e:e===true?"always":e===false?"never":ye.showDismiss}function vg(e){return {"top-left":{top:16,left:16,alignItems:"flex-start"},"top-center":{top:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"top-right":{top:16,right:16,alignItems:"flex-end"},"bottom-left":{bottom:16,left:16,alignItems:"flex-start"},"bottom-center":{bottom:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"bottom-right":{bottom:16,right:16,alignItems:"flex-end"}}[e]}var Cg=css({display:"flex",alignItems:"flex-start",gap:10}),Xl=css({flex:"0 0 auto",paddingTop:1,lineHeight:0,marginLeft:-3,"& svg, & img, & canvas, & video":{display:"block"}}),Rg=css({fontSize:14,lineHeight:1.4,fontWeight:500,flex:1,minWidth:0}),Tg=css({display:"flex",alignItems:"center",gap:6,marginRight:-2}),wg=me.memo(function(){let t=useSyncExternalStore(te.subscribe.bind(te),()=>te.snapshot,()=>te.snapshot),n=V(),o=ye.position.startsWith("bottom"),r=me.useMemo(()=>o?t.displayed:[...t.displayed].reverse(),[t.displayed,o]),s=me.useMemo(()=>({position:"fixed",zIndex:ye.zIndex,pointerEvents:"none",width:"100%",display:"flex",flexDirection:"column",...vg(ye.position),...ye.styles.stack??{}}),[]);return jsx("div",{className:"plainframe-ui-toast-stack",css:css(s),children:jsx(AnimatePresence,{initial:false,children:r.map((a,c)=>{let i=t.enterFrom[a.id]||"tail",l=o?i==="head"?-16:16:i==="head"?16:-16,u=c>0?ye.gutter:0,d={toast:a,close:Be.dismiss,pause:Be.pause,resume:Be.resume},{bg:y,fg:f,border:T}=yg(n,a.status),I={position:"relative",overflow:"hidden",borderRadius:n.radius.md,boxShadow:mg.shadow,padding:`${n.spacing.md} calc(${n.spacing.lg} + 30px) ${n.spacing.md} ${n.spacing.lg}`,display:"grid",gridTemplateColumns:"1fr auto",gap:10,background:y,color:f,cursor:a.onClick?"pointer":"default",border:T?`1px solid ${T}`:"1px solid transparent"},x=typeof ye.styles.surface=="function"?ye.styles.surface(a):ye.styles.surface??{},R=xg(a.showDismiss),g={},p="& .plainframe-ui-toast-close",m="&:hover .plainframe-ui-toast-close";R==="hover"?(g[p]={opacity:0,pointerEvents:"none"},g[m]={opacity:1,pointerEvents:"auto"}):R==="always"?g[p]={opacity:1,pointerEvents:"auto"}:R==="never"&&(g[p]={display:"none"});let C=css({...I,...x,...g}),P=css({position:"absolute",top:8,right:8,appearance:"none",border:0,background:"transparent",color:f,width:28,height:28,borderRadius:8,cursor:"pointer",lineHeight:1,transition:"opacity .12s ease",display:"grid",placeItems:"center",...ye.styles.close??{}}),w;if(a.bare&&a.render){let v=typeof a.render=="function"?a.render(d):a.render;w=jsx("div",{style:{pointerEvents:"auto"},onClick:N=>a.onClick?.(a.id,N),children:v});}else if(ye.bareRenderer&&ye.renderer){let v=typeof ye.renderer=="function"?ye.renderer(d):ye.renderer;w=jsx("div",{style:{pointerEvents:"auto"},onClick:N=>a.onClick?.(a.id,N),children:v});}else {let v;ye.renderer?v=typeof ye.renderer=="function"?ye.renderer(d):ye.renderer:a.render&&!a.bare?v=typeof a.render=="function"?a.render(d):a.render:v=jsxs(Fragment,{children:[jsxs("div",{css:Cg,children:[a.startIcon&&jsx("div",{css:Xl,children:a.startIcon}),jsx("div",{css:Rg,children:a.content}),a.endIcon&&jsx("div",{css:Xl,children:a.endIcon})]}),a.action&&jsx("div",{css:Tg,children:a.action})]}),w=jsxs("div",{css:C,onClick:N=>a.onClick?.(a.id,N),children:[v,jsx("button",{className:"plainframe-ui-toast-close","aria-label":"Close",css:P,onClick:N=>{N.stopPropagation(),Be.dismiss(a.id);},children:jsx(X,{strokeWidth:2.5,size:14})})]});}return jsx(Eg,{id:a.id,isBottom:o,mt:u,enterY:l,width:a.width,pauseOnHover:a.pauseOnHover!==false,children:w},a.id)})})})}),Eg=me.memo(function(t){let{id:n,isBottom:o,mt:r,enterY:s,width:a,pauseOnHover:c,children:i}=t,l=useAnimationControls();useEffect(()=>{l.start({opacity:1,y:0,height:"auto",x:0,transition:ug});},[l]);let u={pointerEvents:"auto",willChange:"transform, opacity, height, margin, scale, width, max-width",marginTop:r,width:"100%",maxWidth:a!=null?typeof a=="number"?`${a}px`:a:"none",...ye.styles.item??{}};return jsx(motion.div,{layout:"position",className:"plainframe-ui-toast-item",css:css(u),initial:{opacity:0,y:s,height:"auto",x:0},animate:l,exit:{opacity:0,y:o?6:-6,height:0,marginTop:0,transition:{type:"tween",ease:"easeInOut",duration:.14}},drag:"x",dragElastic:.2,dragMomentum:true,whileDrag:{scale:.98,opacity:.95},onDragEnd:(d,y)=>{let f=Math.abs(y.offset.x),T=Math.abs(y.velocity.x);if(!(f>60||T>600)){l.start({x:0,opacity:1,transition:{type:"spring",stiffness:700,damping:40}});return}let R=(y.offset.x!==0?Math.sign(y.offset.x):Math.sign(y.velocity.x||1))*(window.innerWidth+160),g=typeof y.velocity.x=="number"?y.velocity.x/10:0;l.start({x:R,opacity:.9,transition:{type:"spring",stiffness:280,damping:24,velocity:g}}).then(()=>Be.dismiss(n));},onMouseEnter:c?()=>Be.pause(n):void 0,onMouseLeave:c?()=>Be.resume(n):void 0,children:i})}),Yl=false;(function(){Yl||(Yl=true,Jl());})();var Gg=(...e)=>t=>{for(let n of e)if(n)if(typeof n=="function")n(t);else try{n.current=t;}catch{}},ec=createContext(null),tc=()=>{let e=useContext(ec);if(!e)throw new Error("TooltipTrigger/TooltipContent must be inside <Tooltip>.");return e},Xg=({children:e,placement:t="top",open:n,defaultOpen:o=false,onOpenChange:r,delay:s=80,arrow:a=true,autoWidth:c=false,disableHoverListener:i=false})=>{let[l,u]=useState(!!o),d=n??l,y=w=>{n===void 0&&u(w),r?.(w);},f=useRef(null),T=useFloating({placement:t,open:d,onOpenChange:y,whileElementsMounted:autoUpdate,strategy:"fixed",transform:false,middleware:[offset(8),flip({padding:8}),shift({padding:8}),a?arrow({element:f,padding:4}):void 0].filter(Boolean)}),I=useHover(T.context,{enabled:!i,delay:{open:s,close:60},handleClose:safePolygon(),restMs:20}),x=useFocus(T.context),R=useDismiss(T.context,{escapeKey:true,outsidePress:true}),g=useRole(T.context,{role:"tooltip"}),{getReferenceProps:p,getFloatingProps:m}=useInteractions([I,x,R,g]),C=useId(),P=useMemo(()=>({open:d,setOpen:y,id:C,placement:T.placement,autoWidth:c,allowArrow:!!a,refs:T.refs,floatingStyles:T.floatingStyles,middlewareData:T.middlewareData,getReferenceProps:p,getFloatingProps:m,arrowRef:f}),[d,c,a,T.placement,T.refs,T.floatingStyles,T.middlewareData,p,m]);return jsx(ec.Provider,{value:P,children:e})},Yg=({asChild:e=true,children:t,className:n,css:o})=>{let{refs:r,getReferenceProps:s,id:a}=tc(),c=me.isValidElement(t),i=c&&typeof t.type=="string";if(e&&c&&i){let l=t,u="ref"in l?l.ref:void 0,d=s({...l.props,"aria-describedby":a,ref:Gg(u,r.setReference),className:[l.props?.className||"",n||""].join(" ").trim()||void 0}),y=[l.props?.css||void 0,o].filter(Boolean);return me.cloneElement(l,{...d,css:y})}return jsx("span",{ref:r.setReference,className:n,css:o,style:{display:"inline-flex"},...s({"aria-describedby":a}),children:t})},Jg=({children:e,className:t,css:n,arrowCss:o})=>{let {open:r,refs:s,floatingStyles:a,middlewareData:c,getFloatingProps:i,placement:l,id:u,autoWidth:d,allowArrow:y,arrowRef:f}=tc(),T=V(),I=l.split("-")[0]||"top",R=I==="bottom"?{opacity:0,y:-8,scale:.98}:I==="top"?{opacity:0,y:8,scale:.98}:I==="left"?{opacity:0,x:8,scale:.98}:{opacity:0,x:-8,scale:.98},g=R,p=I==="bottom"?"center top":I==="top"?"center bottom":I==="left"?"right center":"left center",m=css({zIndex:1300,backgroundColor:T.neutral[900],color:T.neutral[0],borderRadius:8,padding:"6px 9px",fontSize:12,fontWeight:500,lineHeight:1.25,maxWidth:260,whiteSpace:d?"nowrap":"normal",boxShadow:"0 10px 30px rgba(0,0,0,.18)",pointerEvents:"auto",transformOrigin:p}),C=css({position:"absolute",width:10,height:10,borderRadius:2,backgroundColor:T.neutral[900],transform:"rotate(45deg)",pointerEvents:"none"}),P=c.arrow,w={top:"bottom",bottom:"top",left:"right",right:"left"}[I];return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:r&&jsxs(motion.div,{id:u,ref:s.setFloating,role:"tooltip","data-state":"open",className:["plainframe-ui-tooltip",t||""].join(" ").trim(),css:[m,n],style:a,initial:R,animate:{opacity:1,x:0,y:0,scale:1},exit:g,transition:{scale:{type:"spring",stiffness:520,damping:36,mass:.6},x:{type:"spring",stiffness:420,damping:32,mass:.6},y:{type:"spring",stiffness:420,damping:32,mass:.6},opacity:{duration:.14,ease:"linear"}},...i(),children:[e,y&&jsx("div",{ref:f,className:"plainframe-ui-tooltip-arrow",css:[C,o],style:{left:P?.x!=null?`${P.x}px`:void 0,top:P?.y!=null?`${P.y}px`:void 0,[w]:"-3px"}})]})})})};function tb(){let e=V();return jsx(Global,{styles:css`
20
+ `,Ff=de.memo(({isLoading:e=true,radius:t,animation:n="wave",children:o,width:r,height:s,style:a,className:c,css:i})=>{let l=V(),u=l.surface.subtleBg,d=l.neutral[200],h=Gs(t??l.radius?.lg??8,"8px"),f=css({position:"relative",display:"inline-block",verticalAlign:"middle",width:r==null?"fit-content":Gs(r,String(r)),height:s==null?"fit-content":Gs(s,String(s))}),R=css({position:"absolute",inset:0,borderRadius:h,pointerEvents:"none",background:u,willChange:"background-position, opacity"}),I=n==="wave"?css({backgroundImage:`linear-gradient(90deg, ${u} 25%, ${d} 50%, ${u} 75%)`,backgroundSize:"200% 100%",animation:`${kf} 1.4s ease-in-out infinite`}):n==="pulse"?css({animation:`${Mf} 1.2s ease-in-out infinite`}):css({}),x=css({visibility:e?"hidden":"visible",display:"inline-block",borderRadius:h});return jsxs("span",{className:["plainframe-ui-skeleton",c||""].join(" ").trim(),css:[f,i],style:a,"aria-busy":e||void 0,children:[e&&jsx("span",{"aria-hidden":true,css:[R,I]}),jsx("span",{className:"plainframe-ui-skeleton-content",css:x,children:o})]})});var kr=8,Xs=20,_n=4,Vl=({value:e,defaultValue:t,onChange:n,min:o=0,max:r=100,step:s=1,disabled:a=false,rounded:c=false,showValue:i=false,showStepper:l=false,label:u,fullWidth:d=false,css:h,trackCss:f,thumbCss:R,direction:I="horizontal",className:x,...C})=>{let g=V(),p=I==="vertical",m=useRef(null),[v,D]=useState(false),[T,w]=useState(false),[F,B]=useState(false),W=e!==void 0,O=useCallback(G=>Math.min(r,Math.max(o,G)),[o,r]),k=useCallback(G=>O(Math.round((G-o)/s)*s+o),[o,s,O]),[A,M]=useState(()=>k(t??o)),b=W?k(e):A;useEffect(()=>{W||M(G=>k(G));},[o,r,s,W,k]);let y=g.palette.primary[600],P=g.surface.panelBg,H=g.neutral[500],L=useMemo(()=>{let G=r-o||1;return (b-o)/G*100},[b,o,r]),E=useCallback(G=>{W||M(G),n?.(G);},[W,n]),S=useCallback((G,ie)=>{let Y=m.current;if(!Y)return b;let Q=Y.getBoundingClientRect(),ae=p?(Q.bottom-ie)/Q.height:(G-Q.left)/Q.width;return ae=Math.max(0,Math.min(1,ae)),k(o+ae*(r-o))},[b,p,o,r,k]),z=useCallback(G=>{a||(G.currentTarget.setPointerCapture?.(G.pointerId),E(S(G.clientX,G.clientY)),D(true));},[a,E,S]),$=useCallback(G=>{a||(G.currentTarget.setPointerCapture?.(G.pointerId),D(true));},[a]),K=useCallback(G=>{!v||a||E(S(G.clientX,G.clientY));},[v,a,E,S]),_=useCallback(()=>D(false),[]);useEffect(()=>{if(v)return window.addEventListener("pointermove",K),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_);}},[v,K,_]);let N=useCallback(G=>{if(a)return;let ie=b;if(G.key==="ArrowRight"||G.key==="ArrowUp")ie=b+s;else if(G.key==="ArrowLeft"||G.key==="ArrowDown")ie=b-s;else if(G.key==="Home")ie=o;else if(G.key==="End")ie=r;else return;G.preventDefault(),E(k(ie));},[a,b,s,o,r,E,k]),U=v||T||F,X=(T||v)&&!a,se=`color-mix(in srgb, ${y} 25%, transparent)`,j=css({display:"flex",flexDirection:p?"row":"column",alignItems:"center",padding:p?"1rem":"1rem 0",width:p?"fit-content":d?"100%":350,height:p?250:"auto",boxSizing:"border-box"}),J=css({marginBottom:p?0:4,marginRight:p?8:0,color:g.text.primary,userSelect:"none"}),le=css({position:"relative",width:p?kr:"100%",height:p?"100%":kr,backgroundColor:g.neutral[200],borderRadius:g.radius.xs,cursor:a?"not-allowed":"pointer",touchAction:"none",outline:"none",overflow:"visible"}),ue=css({position:"absolute",left:p?"50%":0,top:p?2:"50%",transform:p?"translateX(-50%)":"translateY(-50%)",width:p?kr:`calc(100% - ${_n*.5}px)`,height:p?`calc(100% - ${_n*.5}px)`:kr,display:"flex",flexDirection:p?"column":"row",justifyContent:"space-between",alignItems:"center",pointerEvents:"none",zIndex:0,padding:0}),fe=css({width:_n,height:_n,borderRadius:"50%",backgroundColor:g.text.primary,opacity:.15,flex:"0 0 auto"}),Fe=css({position:"absolute",left:0,top:p?`calc(${100-L}% )`:0,bottom:0,width:p?"100%":`${L}%`,height:p?`${L}%`:"100%",backgroundColor:a?H:y,borderRadius:g.radius.sm,zIndex:1,transition:"none",pointerEvents:"none"}),ve=css({position:"absolute",appearance:"none",WebkitAppearance:"none",background:P,width:Xs,height:Xs,left:p?"50%":`calc(${L}% - ${Xs/2}px)`,bottom:p?`${L}%`:"auto",top:p?"auto":"50%",transform:p?"translate(-50%, 50%)":"translateY(-50%)",borderRadius:c?g.radius.full:`calc(${g.radius.md} * 0.75)`,border:`2px solid ${a?H:y}`,cursor:a?"not-allowed":"grab",zIndex:5,padding:0,lineHeight:0,transition:"box-shadow .16s ease",boxShadow:X?`0 0 0 ${v?4:8}px ${se}`:`0 0 0 0px ${se}`,"&:focus-visible":{boxShadow:`0 0 0 4px ${se}`,outline:"none"}}),ye=css({position:"relative",backgroundColor:"transparent",padding:"1rem",top:p?-7.5:-28,left:p?9:-7.5,pointerEvents:"none"}),we=css({position:"absolute",top:p?`calc(50% - ${_n*2.5}px)`:0,left:p?"auto":`calc(50% - ${_n*3}px)`,transform:p?"translateY(-50%)":"translateX(-50%)",backgroundColor:g.neutral[800],color:g.neutral[0],padding:"0.6rem 0.25rem",fontSize:12,borderRadius:6,whiteSpace:"nowrap",pointerEvents:"auto",zIndex:6,"&::after":{content:'""',position:"absolute",width:6,height:6,backgroundColor:g.neutral[800],borderRadius:2,bottom:p?"50%":-2,left:p?-2.5:"50%",transform:p?"translateY(50%) rotate(45deg)":"translateX(-50%) rotate(45deg)"}}),Ce=h,Re=f,be=R,ne=Math.floor((r-o)/s)+1;return jsxs("div",{...C,role:"group","aria-label":u,className:["plainframe-ui-slider",x||""].join(" ").trim(),css:[j,Ce],"data-orientation":p?"vertical":"horizontal",children:[u&&!p&&jsx("div",{className:"plainframe-ui-slider-label",css:J,children:u}),jsxs("div",{ref:m,className:"plainframe-ui-slider-track",css:[le,Re],onPointerDown:z,children:[l&&s>0&&jsx("div",{className:"plainframe-ui-slider-stepper",css:ue,children:Array.from({length:ne}).map((G,ie)=>jsx("span",{className:"plainframe-ui-slider-step-dot",css:fe},ie))}),jsx("div",{className:"plainframe-ui-slider-fill",css:Fe}),jsxs("button",{type:"button",role:"slider","aria-valuemin":o,"aria-valuemax":r,"aria-valuenow":b,"aria-disabled":a||void 0,tabIndex:a?-1:0,onKeyDown:N,onPointerDown:$,onPointerUp:_,onPointerCancel:_,onMouseEnter:()=>w(true),onMouseLeave:()=>w(false),className:"plainframe-ui-slider-thumb",css:[ve,be],children:[jsx(AnimatePresence,{children:U&&jsx(motion.div,{className:"plainframe-ui-slider-tooltip-anchor",css:ye,initial:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},transition:{duration:.16,ease:"easeOut"},children:jsx(motion.div,{className:"plainframe-ui-slider-tooltip",css:we,initial:{opacity:0,y:p?0:4,x:p?-4:0},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:p?0:4,x:p?-4:0},transition:{duration:.16,ease:"easeOut"},onMouseEnter:()=>B(true),onMouseLeave:()=>B(false),children:b})})}),null]})]}),u&&p&&jsx("div",{className:"plainframe-ui-slider-label",css:[J,{marginLeft:8}],children:u})]})};Vl.displayName="Slider";var Lf=e=>css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",maxWidth:e==null?"100%":typeof e=="number"?`${e}px`:e,width:"100%"}),Bf=css({display:"flex",alignItems:"center",width:"100%",gap:12}),$f=e=>css({display:"flex",minWidth:0,flex:"0 0 auto",alignItems:"center",justifyContent:"center",gap:8,flexDirection:e==="left"?"row-reverse":e==="right"?"row":e==="top"?"column-reverse":"column"}),zf=e=>css({position:"relative",flex:"1 1 24px",minWidth:6,height:2,borderRadius:1,background:e,overflow:"hidden"}),Of=(e,t,n)=>css({position:"absolute",inset:0,transformOrigin:"left center",transform:`scaleX(${e})`,background:t,transition:n?"all .28s var(--pf-ease)":"none",willChange:"transform"}),Wf=css({flex:"1 1 24px",minWidth:2,display:"flex",alignItems:"center",justifyContent:"center"}),Kf=(e,t,n,o,r)=>css({position:"relative",appearance:"none",border:`2px solid ${o}`,width:e,height:e,minWidth:e,minHeight:e,borderRadius:r,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",background:t,color:n,transition:"all .22s var(--pf-ease)","&:disabled, &[aria-disabled='true']":{opacity:.55,cursor:"not-allowed"}}),_f=css({fontWeight:700,fontSize:14,lineHeight:1,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"}),jl=e=>css({position:"absolute",inset:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transform:`scale(${e?1:.3})`,opacity:e?1:0,transition:"background .22s var(--pf-ease), transform .16s var(--pf-ease), opacity .16s var(--pf-ease)",willChange:"transform, opacity"}),Vf=(e,t,n,o,r)=>css({fontSize:14,color:e?t:n,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",transition:"all .16s ease",textAlign:"center",fontWeight:700,margin:`0 ${r}px`,borderRadius:o}),jf=de.memo(function({i:t,item:n,size:o,tokens:r,variant:s,titlePosition:a,isActive:c,completed:i,disabled:l,connectorColor:u,showConnector:d,animate:h,separator:f,canGoToIndex:R,setSelected:I}){let x=V(),C=he(),{MAIN:g,ACTIVE_TEXT:p,ACTIVE_TEXT_OUTLINED:m,COMPLETE_BG:v,COMPLETE_FG:D,UPCOMING_BG_FILLED:T,UPCOMING_OUTLINE:w,UPCOMING_FG:F}=r,B="transparent",W=F,O=w;s==="subtle"?i?(B=v,W=D,O=v):c?(B=g,W=p,O=g):(B=T,W=F,O=T):i?(B=v,W=D,O=v):c?(B="transparent",W=m,O=g):(B="transparent",W=F,O=w);let k=n.label,A=n.icon??jsx("span",{css:_f,children:typeof k=="number"?k:t+1}),M=n.completedIcon??jsx(Check,{strokeWidth:3.25,size:16});return jsxs(Fragment,{children:[jsxs("div",{className:"plainframe-ui-step",css:$f(a),children:[jsxs("button",{className:"plainframe-ui-step-node",css:[Kf(o,B,W,O,String(x.radius.full)),!l&&C({color:c?"primary":"neutral"})],onClick:()=>{!l&&R(t)&&I(n.value);},tabIndex:l?-1:0,"aria-current":c?"step":void 0,"aria-disabled":l||void 0,disabled:l,"aria-label":typeof k=="string"?k:`Step ${t+1}`,children:[jsx("span",{className:"plainframe-ui-step-content",css:jl(!i),children:A}),jsx("span",{className:"plainframe-ui-step-check",css:jl(!!i),children:M})]}),k&&jsx("span",{className:"plainframe-ui-step-label",css:Vf(i||c,x.text.primary,x.text.secondary,String(x.radius.xs),Number(x.spacing.xs)),children:k})]}),d&&(f?jsx("div",{className:"plainframe-ui-stepper-separator",css:Wf,children:f}):jsx("div",{className:"plainframe-ui-step-connector",css:zf(x.neutral[300]),children:jsx("div",{className:"plainframe-ui-step-connector-fill",css:Of(i?1:0,u,h),"aria-hidden":"true"})}))]})},(e,t)=>e.isActive===t.isActive&&e.completed===t.completed&&e.disabled===t.disabled&&e.variant===t.variant&&e.separator===t.separator&&e.connectorColor===t.connectorColor&&e.titlePosition===t.titlePosition&&e.size===t.size),Zs=()=>null;Zs.displayName="PlainframeUIStep";var Uf=({variant:e="subtle",value:t,defaultValue:n,onChange:o,disabled:r=false,allowForward:s=true,allComplete:a=false,color:c,activeBgColor:i,activeColor:l,completeBgColor:u,completeColor:d,separator:h,titlePosition:f="right",width:R,css:I,className:x,children:C,...g})=>{let p=V(),m=e==="outlined"?"outlined":"subtle",v=de.useMemo(()=>{let S=de.Children.toArray(C).filter(z=>de.isValidElement(z)&&z.type===Zs);return S.length?S.map((z,$)=>({index:$,...z.props})):[{value:1},{value:2},{value:3}]},[C]),D=de.useCallback((S,z)=>S?p.palette?.[S]??S:z,[p.palette]),T=de.useMemo(()=>({MAIN:String(D(i,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),ACTIVE_TEXT:String(D(l,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),ACTIVE_TEXT_OUTLINED:String(D(l,typeof p.text.primary=="string"?p.text.primary:"")),COMPLETE_BG:String(D(u,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),COMPLETE_FG:String(D(d,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),UPCOMING_BG_FILLED:String(typeof p.neutral[100]=="string"?p.neutral[100]:""),UPCOMING_OUTLINE:String(typeof p.neutral[300]=="string"?p.neutral[300]:""),UPCOMING_FG:String(typeof p.text.secondary=="string"?p.text.secondary:"")}),[D,i,l,u,d,p.palette.primary,p.neutral,p.text]),w=de.useMemo(()=>{let S=D(c,p.palette.primary[600]);return typeof S=="string"?S:String(S)},[D,c,p.palette.primary]),[F,B]=de.useState(()=>v.some(z=>z?.value===n)?n:v[0]?.value),W=t!==void 0,O=W?t:F,{activeIndex:k,afterLast:A}=de.useMemo(()=>{let S=v.findIndex(z=>z.value===O);if(S!==-1)return {activeIndex:S,afterLast:false};if(typeof O=="number"){let z=Math.floor(O)-1;if(z>=v.length)return {activeIndex:v.length-1,afterLast:true};if(z>=0)return {activeIndex:z,afterLast:false}}return {activeIndex:0,afterLast:false}},[v,O]),M=de.useCallback(S=>{r||(W||B(S),o?.(S));},[r,W,o]),b=de.useCallback(S=>a||!!v[S]?.complete||(A?true:S<k),[a,v,A,k]),y=de.useCallback(S=>{if(r)return false;let z=v[S];if(!z||z.disabled)return false;if(typeof s=="boolean"){if(s===false&&S>k)return false}else if(typeof s=="function"&&!s(k,S))return false;return true},[r,v,s,k]),[P,H]=de.useState(false);de.useEffect(()=>{let S=requestAnimationFrame(()=>H(true));return ()=>cancelAnimationFrame(S)},[]);let L=de.useCallback(S=>{if(!v.length||r)return;let z=k;if(S.key==="ArrowRight")z=Math.min(v.length-1,k+1);else if(S.key==="ArrowLeft")z=Math.max(0,k-1);else if(S.key==="Home")z=0;else if(S.key==="End")z=v.length-1;else return;S.preventDefault(),y(z)&&M(v[z].value);},[v,r,k,y,M]),E=34;return jsx("div",{tabIndex:-1,className:["plainframe-ui-stepper",x||""].join(" ").trim(),css:[Lf(R),I],...g,children:jsx("div",{tabIndex:-1,className:"plainframe-ui-stepper-track",role:"list",onKeyDown:L,css:Bf,children:v.map((S,z)=>jsx(de.Fragment,{children:jsx(jf,{i:z,item:S,size:E,tokens:T,variant:m,titlePosition:f,isActive:!A&&z===k,completed:b(z),disabled:r||!!S.disabled,connectorColor:w,showConnector:z<v.length-1,animate:P,separator:h,canGoToIndex:y,setSelected:M})},String(S.value??z)))})})};var Fr=()=>null;Fr.displayName="PF.Tab";var Ar=()=>null;Ar.displayName="PF.TabContent";function Gf(e){let t=e.props;return {type:t?.__EMOTION_TYPE_PLEASE_DO_NOT_USE__??e.type,props:t}}var Xf=({children:e,defaultValue:t,value:n,onChange:o,variant:r="subtle",direction:s="horizontal",className:a,shadow:c=false,width:i,fullWidth:l=false,rounded:u=false,titlePosition:d="right",align:h,css:f,trackCss:R,thumbCss:I,activeTabCss:x,activeIndicatorCss:C})=>{let g=V(),p=he(),m=s==="vertical",v=l||i!=null,D=h??(m?"left":"center"),T={left:"flex-start",center:"center",right:"flex-end"},{tabs:w,contents:F}=de.useMemo(()=>{let Y=[],Q=[];return de.Children.forEach(e,ae=>{if(!de.isValidElement(ae))return;let{type:pe,props:Ae}=Gf(ae),He=pe===Fr||pe?.displayName===Fr.displayName,Z=pe===Ar||pe?.displayName===Ar.displayName;if(He){let oe=Ae;if(oe?.value===void 0)return;Y.push({value:oe.value,disabled:oe.disabled,node:oe.children,className:oe.className,css:oe.css,activeCss:oe.activeCss});}else if(Z){let oe=Ae;if(oe?.value===void 0)return;Q.push({value:oe.value,node:oe.children,className:oe.className,css:oe.css});}}),{tabs:Y,contents:Q}},[e]),B=de.useMemo(()=>w.find(Y=>!Y.disabled)?.value,[w]),[W,O]=de.useState(()=>t!==void 0&&w.some(Q=>Q.value===t&&!Q.disabled)?t:B),k=n!==void 0,A=k?n:W,M=de.useRef(null),b=de.useRef([]),y=Math.max(0,w.findIndex(Y=>Y.value===A)),[P,H]=de.useState({left:0,top:0,width:0,height:0}),[L,E]=de.useState(false),[S,z]=de.useState(false),$=de.useCallback(()=>{let Y=M.current,Q=b.current[y];if(!Y||!Q)return;let ae=Y.getBoundingClientRect(),pe=Q.getBoundingClientRect();H({left:pe.left-ae.left,top:pe.top-ae.top,width:pe.width,height:pe.height});},[y]);de.useLayoutEffect(()=>{$(),L||(E(true),requestAnimationFrame(()=>z(true)));},[$,L]),de.useEffect(()=>{let Y=new ResizeObserver(()=>$());M.current&&Y.observe(M.current);let Q=b.current[y];Q&&Y.observe(Q);let ae=()=>$();return window.addEventListener("resize",ae),()=>{Y.disconnect(),window.removeEventListener("resize",ae);}},[$,y]);let K=(Y,Q)=>{if(!w.length)return Y;let ae=Y;for(let pe=0;pe<w.length;pe++)if(ae=(ae+Q+w.length)%w.length,!w[ae].disabled)return ae;return Y},_=Y=>{k||O(Y),o?.(Y);},N=Y=>{if(!w.length)return;let Q=y;if(Y.key===(m?"ArrowDown":"ArrowRight"))Q=K(y,1);else if(Y.key===(m?"ArrowUp":"ArrowLeft"))Q=K(y,-1);else if(Y.key==="Home")Q=w.findIndex(pe=>!pe.disabled);else if(Y.key==="End"){let pe=[...w].reverse().findIndex(Ae=>!Ae.disabled);Q=pe===-1?y:w.length-1-pe;}else return;Y.preventDefault();let ae=w[Q]?.value;ae!==void 0&&_(ae),requestAnimationFrame(()=>b.current[Q]?.focus());},U=g.text.primary,X=g.text.secondary,se=g.neutral[500],j=r==="subtle"?g.surface.subtleBg:"transparent",J=r==="subtle"?g.surface.panelBg??g.surface.panelBg:r==="ghost"?g.surface.subtleBg:"transparent",le=g.text.primary,ue=r==="subtle"||r==="ghost"||r==="underlined",fe=css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",width:l?"100%":i==null?"auto":typeof i=="number"?`${i}px`:i}),Fe=r==="subtle",ve=css({position:"relative",display:v?"flex":"inline-flex",width:v?"100%":"auto",flexDirection:m?"column":"row",alignItems:m?"stretch":"center",flexWrap:"nowrap",gap:g.spacing.xs,padding:Fe?g.spacing.xs:0,background:j,borderRadius:r==="subtle"?u?m?g.radius.lg:g.radius.full:g.radius.lg:"none"}),ye=css({position:"absolute",zIndex:0,pointerEvents:"none",opacity:L?1:0,visibility:L?"visible":"hidden",transition:S?`${m?"top":"left"} .24s var(--pf-ease), ${m?"height":"width"} .24s var(--pf-ease), background-color .18s var(--pf-ease)`:"none",borderRadius:r==="subtle"||r==="ghost"?u?g.radius.full:g.radius.md:0,background:r==="underlined"?"transparent":J,...m?{top:`${P.top}px`,height:`${P.height}px`,left:g.spacing.xs,right:g.spacing.xs}:{left:`${P.left}px`,width:`${P.width}px`,top:g.spacing.xs,bottom:g.spacing.xs},boxShadow:c&&r==="subtle"?"0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.04)":"none"}),we=css(r!=="underlined"?{}:m?{background:"transparent",top:`${P.top}px`,height:`${P.height}px`,left:0,width:0,borderLeft:`2px solid ${le}`,borderBottom:"none",borderRadius:2}:{background:"transparent",left:`${P.left}px`,width:`${P.width}px`,bottom:0,top:"auto",height:0,borderBottom:`2px solid ${le}`,borderLeft:"none",borderRadius:2}),Ce=css({position:"relative",zIndex:1,border:"none",background:"transparent",padding:r==="underlined"&&s!=="vertical"?`${g.spacing.md}`:r==="ghost"&&s!=="vertical"?`${g.spacing.md}`:`${g.spacing.xs} ${g.spacing.md}`,borderRadius:(r==="subtle"||r==="ghost")&&u?g.radius.full:g.radius.md,minHeight:g.componentHeights.sm,outline:"none",transition:"color .16s ease !important",display:"flex",alignItems:"center",justifyContent:"center",...m?{width:v?"100%":"auto",flex:"0 0 auto",textAlign:D}:v?{flex:"1 1 0",minWidth:0,textAlign:"center"}:{flex:"0 0 auto",minWidth:"max-content",textAlign:"center"},whiteSpace:"nowrap",boxSizing:"border-box",cursor:"pointer",userSelect:"none",fontSize:g.typography.sizes.sm,fontWeight:600,color:X,"&[aria-selected='true']":{color:U},"&:hover":{color:U},"&[aria-disabled='true'], &:disabled":{opacity:.55,cursor:"not-allowed",color:se}}),Re=css({display:"inline-flex",alignItems:"center",justifyContent:m?T[D]:"center",gap:6,width:"100%",flexDirection:d==="top"?"column-reverse":d==="bottom"?"column":d==="left"?"row-reverse":"row"}),be=css({marginTop:g.spacing.sm,width:"100%"}),ne=de.useId(),G=new Map;F.forEach((Y,Q)=>G.set(Y.value,`${ne}-panel-${Q}`));let ie=Y=>`${ne}-tab-${Y}`;return jsxs("div",{className:["plainframe-ui-tabs",a||""].join(" ").trim(),css:[fe,f],children:[jsxs("div",{className:"plainframe-ui-tabs-track",ref:M,role:"tablist","aria-orientation":m?"vertical":"horizontal",onKeyDown:N,css:[ve,R],children:[ue&&jsx("div",{className:"plainframe-ui-tabs-thumb",css:[ye,we,I,C]}),w.map((Y,Q)=>{let ae=A===Y.value;return jsx("button",{ref:pe=>{b.current[Q]=pe;},role:"tab",id:ie(Q),"aria-selected":ae,"aria-controls":G.get(Y.value),"aria-disabled":Y.disabled||void 0,disabled:Y.disabled,tabIndex:Y.disabled?-1:Q===y?0:-1,className:["plainframe-ui-tab",Y.className||""].join(" ").trim(),onClick:()=>{Y.disabled||_(Y.value);},css:[Ce,!Y.disabled&&p(),Y.css,ae?Y.activeCss??x:void 0],children:jsx("span",{className:"plainframe-ui-tab-content",css:Re,children:Y.node})},String(Y.value??Q))})]}),F.map((Y,Q)=>{let ae=Y.value===A;if(!ae)return null;let pe=w.findIndex(He=>He.value===Y.value),Ae=pe>=0?ie(pe):void 0;return console.log("rendering panel for",Y.value,"active:",ae),jsx("div",{role:"tabpanel",id:G.get(Y.value),"aria-labelledby":Ae,className:["plainframe-ui-tab-panel",Y.className||""].join(" ").trim(),css:[be,Y.css],children:Y.node},Q)})]})};var Mo=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,hn=e=>e==null?[]:Array.isArray(e)?e:[e],Fo=(...e)=>css(e.filter(Boolean)),tg=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,error:s,helperText:a,disabled:c=false,fullWidth:i=false,width:l=235,size:u="md",variant:d="subtle",rounded:h=false,rows:f=3,maxRows:R,maxLength:I,showCharCount:x,focusRingMode:C="always",resizable:g=false,className:p,wrapperCss:m,inputCss:v,labelCss:D,helperRowCss:T,helperTextCss:w,charCountCss:F,css:B,onBlur:W,onFocus:O,onKeyDown:k,autoFocus:A,name:M,id:b,tabIndex:y,autoComplete:P,readOnly:H,required:L})=>{let E=V(),S=Xo(),z=useId(),$=useMemo(()=>({sm:{fontSize:E.typography.sizes.sm,minHeight:E.componentHeights.sm,labelFont:E.typography.sizes.xs,helperFont:E.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:E.spacing.md},md:{fontSize:E.typography.sizes.sm,minHeight:E.componentHeights.md,labelFont:E.typography.sizes.sm,helperFont:E.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:E.spacing.md},lg:{fontSize:E.typography.sizes.sm,minHeight:E.componentHeights.lg,labelFont:E.typography.sizes.md,helperFont:E.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:E.spacing.md}}),[E]),K=["sm","md","lg"].includes(u)?u:"md",_=$[K],N=E.neutral,U=E.text,X=t!==void 0,[se,j]=useState(n),J=X?t:se,le=useCallback(ae=>{X||j(ae),o?.(ae);},[X,o]),ue=useMemo(()=>c?N[200]:s&&d==="outlined"?E.palette.danger?.[50]??E.surface.panelBg:s&&d==="subtle"?E.palette.danger?.[50]??E.surface.subtleBg:d==="outlined"?E.surface.panelBg:d==="subtle"?E.surface.subtleBg:"transparent",[c,s,d,N,E.surface,E.palette.danger]),fe=E.componentHeights.border,Fe=useMemo(()=>d==="outlined"?`${fe} solid ${s?E.palette.danger?.[300]??E.surface.border:E.surface.border}`:"none",[d,fe,s,E.palette.danger,E.surface.border]),ve=useMemo(()=>css({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:i?"100%":l!=null?Mo(l):void 0,flex:"0 0 auto",fontWeight:500}),[i,l]),ye=useMemo(()=>Fo({fontSize:_.labelFont,fontWeight:500,color:s?E.palette.danger?.[700]??U.primary:c?N[500]:U.primary,marginBottom:4,display:"inline-block"},...hn(D)),[_.labelFont,s,c,N,U,E.palette.danger,D]),we=useMemo(()=>[{display:"flex",alignItems:"stretch",gap:E.spacing.sm,padding:`${Mo(_.paddingY)} 0 ${Mo(_.paddingY)} ${Mo(_.paddingX)}`,background:ue,border:Fe,borderRadius:h?E.radius.full:E.radius.md,minHeight:_.minHeight,width:"100%",cursor:c?"not-allowed":"text",opacity:c?.65:1,transition:"box-shadow .18s, border-color .16s"},...hn(m),...hn(B)],[E,_,ue,Fe,fe,h,c,m,B]),Ce=typeof _.minHeight=="number"?`${_.minHeight}px`:_.minHeight,Re=useMemo(()=>Fo({width:"100%",minWidth:0,flex:1,resize:g?"vertical":"none",font:"inherit",fontWeight:500,fontSize:_.fontSize,lineHeight:1.5,color:c?N[500]:s?E.palette.danger?.[800]??U.primary:U.primary,background:"transparent",border:"none",outline:"none",padding:0,paddingRight:Mo(_.paddingX),overflowY:"auto",minHeight:Ce,"&::placeholder":{color:s?E.palette.danger?.[700]??U.secondary:U.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${s?E.palette.danger?.[800]??U.primary:U.primary} !important`,boxShadow:`0 0 0 1000px ${ue} inset !important`,transition:"opacity 99999s ease-out",caretColor:s?E.palette.danger?.[800]??U.primary:U.primary},":focus-within":{outline:"none",boxShadow:"none"},...f===1?{paddingBlock:`calc((${Ce} - 1.5em) / 2)`}:{paddingBlock:"clamp(4px, 0.5em, 12px)"}},...hn(v)),[g,_,c,s,N,U,E.palette.danger,Ce,ue,f,v]),be=useMemo(()=>Fo({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,paddingTop:3},...hn(T)),[T]),ne=useMemo(()=>Fo({fontSize:_.helperFont,color:s?E.palette.danger?.[700]??U.secondary:U.secondary,flex:1,minWidth:0},...hn(w)),[_.helperFont,s,E.palette.danger,U,w]),G=useMemo(()=>Fo({fontSize:_.helperFont,color:I&&J.length>I?E.palette.danger?.[700]??U.secondary:U.secondary,flexShrink:0},...hn(F)),[_.helperFont,I,J.length,E.palette.danger,U,F]),ie=useRef(null);useLayoutEffect(()=>{if(typeof window>"u")return;let ae=ie.current;if(!ae)return;if(g){let Ae=window.getComputedStyle(ae),He=parseFloat(Ae.lineHeight||"20"),Z=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(He*(f??1),Z);ae.style.setProperty("--pf-minh",`${oe}px`);return}(()=>{let Ae=window.getComputedStyle(ae),He=parseFloat(Ae.lineHeight||"20"),Z=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(He*(f??1),Z);ae.style.setProperty("--pf-minh",`${oe}px`);let re=R?He*R:1/0;ae.style.height="auto",ae.style.height=`${Math.min(ae.scrollHeight,re)}px`;})();},[J,f,R,_.minHeight,g]);let Y=a!=null||x?`${b??z}-help`:void 0,Q=b??z;return jsxs("div",{className:["plainframe-ui-textarea",p||""].join(" ").trim(),css:ve,children:[e&&jsx("label",{htmlFor:Q,className:"plainframe-ui-textarea-label",css:ye,children:e}),jsx("div",{className:"plainframe-ui-textarea-surface",css:[S({enabled:C!=="none",disabled:c,color:s?"danger":void 0}),we],"aria-invalid":!!s||void 0,"aria-disabled":c||void 0,onClick:()=>!c&&ie.current?.focus(),children:jsx("textarea",{ref:ie,id:Q,className:"plainframe-ui-textarea-input",css:Re,rows:f,value:J,onChange:ae=>{let pe=ae.target.value;I&&pe.length>I||le(pe);},placeholder:r||"",disabled:c,onBlur:W,onFocus:O,onKeyDown:k,autoFocus:A,name:M,tabIndex:y,autoComplete:P,readOnly:H,required:L,"aria-invalid":!!s||void 0,"aria-describedby":Y})}),(a!=null||x&&I!=null)&&jsxs("div",{className:"plainframe-ui-textarea-helper-row",css:be,children:[jsx("span",{id:Y,className:"plainframe-ui-textarea-helper-text",css:ne,children:a}),x&&I!=null&&jsxs("span",{className:"plainframe-ui-textarea-char-count",css:G,children:[J.length,"/",I]})]})]})};var cg=Vo,ug={type:"spring",stiffness:920,damping:100},Gl="__toast_root__",dg=(e,t)=>t.split(".").reduce((n,o)=>n!=null&&typeof n=="object"?n[o]:void 0,e),Dr=(e,t)=>{for(let n of t){let o=dg(e,n);if(o!=null&&o!=="")return o}},ea=(e,t)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:String(e);function pg(e){let t=Dr(e,["radius.md","shape.borderRadius","radii.md"]),n=Dr(e,["spacing.lg","space.4","spacing.4"]),o=Dr(e,["spacing.md","space.3","spacing.3"]),r=Dr(e,["shadows.lg","elevation.lg"])??"0 8px 24px rgba(0,0,0,.03), 0 2px 8px rgba(0,0,0,.05)";return {radius:ea(t,16),padX:ea(n,14),padY:ea(o,12),shadow:String(r)}}var mg=pg(cg),Lt=null,Vn=null,ge={max:5,position:"bottom-right",gutter:5,zIndex:1e3,duration:5e3,showDismiss:"hover",styles:{},renderer:void 0,bareRenderer:false};function Jl(){typeof document>"u"||(Lt||(Lt=document.getElementById("toast-host"),Lt||(Lt=document.createElement("div"),Lt.id="toast-host",document.body.appendChild(Lt))),Vn||(Vn=Lt[Gl]??null,Vn||(Vn=createRoot(Lt),Lt[Gl]=Vn,Vn.render(jsx(Ma,{children:jsx(wg,{})})))));}var ee={displayed:[],queue:[],entering:{},exiting:{},enterFrom:{},timers:new Map,expiry:new Map,remaining:new Map,paused:new Set,listeners:new Set,snapshot:{displayed:[],entering:{},exiting:{},enterFrom:{}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)},notify(){this.listeners.forEach(e=>e());},sync(){this.snapshot={displayed:[...this.displayed],entering:{...this.entering},exiting:{...this.exiting},enterFrom:{...this.enterFrom}};}},yn=()=>{ee.sync(),ee.notify();},fg=()=>typeof crypto<"u"&&"randomUUID"in crypto&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2);function Nr(e,t){if(t===null)return;let n=t??e.duration;if(n==null||ee.timers.has(e.id))return;let o=Date.now(),r=ee.remaining.get(e.id),s=r!=null?Math.max(0,r):n;ee.expiry.set(e.id,o+s);let a=window.setTimeout(()=>De.dismiss(e.id),s);ee.timers.set(e.id,a);}function Hr(e){let t=ee.timers.get(e);t&&(clearTimeout(t),ee.timers.delete(e));}function gg(){let e=false;for(;ee.displayed.length<ge.max&&ee.queue.length;){let t=ee.queue.shift();ee.displayed=[t,...ee.displayed],ee.enterFrom[t.id]="head",ee.entering[t.id]=true,e=true,requestAnimationFrame(()=>{delete ee.entering[t.id],yn();}),Nr(t);}e&&yn();}function bg(){if(ee.displayed.length<ge.max)return;let e=ee.displayed.filter(o=>!ee.exiting[o.id]);if(!e.length)return;let t=e.reduce((o,r)=>o.createdAt<=r.createdAt?o:r),n=ee.expiry.get(t.id);n!=null&&ee.remaining.set(t.id,Math.max(0,n-Date.now())),Hr(t.id),ee.exiting[t.id]=true,ee.displayed=ee.displayed.filter(o=>o.id!==t.id),delete ee.enterFrom[t.id],ee.queue.push(t),yn();}var hg=e=>e==="danger"?"error":["default","success","error","warning","info"].includes(e)?e:"default";function yg(e,t){let n=hg(t),o=e,r=o.surface,s=o.text,a=r?.panelBg??"#fff",c=s?.primary??"#111",i=r?.border;if(n==="default"||n==="info")return {bg:a,fg:c,border:i};let l=s?.onColors??{},u=(d,h,f)=>{let R=o.colors,I=o.palette;return {bg:R?.[d]??I?.[d]?.[700]??h,fg:l?.[d]??f,border:"transparent"}};return n==="success"?u("success","#22C55E","#fff"):n==="warning"?u("warning","#F59E0B","#fff"):n==="error"?u("error","#EF4444","#fff"):{bg:a,fg:c,border:i}}var De=Object.assign((e,t)=>{Jl();let n=i=>i!=null&&typeof i[Symbol.iterator]=="function",o=i=>!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function",r;typeof e=="object"&&e!=null&&!de.isValidElement(e)&&!n(e)&&!o(e)?r=e:r={content:(de.isValidElement(e),e),...t||{}},r.content==null&&(r.title!=null||r.description!=null)&&(r.content=jsxs("div",{children:[r.title&&jsx("strong",{style:{display:"block",marginBottom:2},children:r.title}),r.description]}));let s=r.id??fg(),a=i=>{let l=i.findIndex(h=>h.id===s);if(l===-1)return false;let u=i[l],d={...u,status:r.status??u.status,content:r.content??u.content,title:r.title??u.title,description:r.description??u.description,startIcon:r.startIcon??u.startIcon,endIcon:r.endIcon??u.endIcon,action:r.action??u.action,onClose:r.onClose??u.onClose,duration:r.duration===void 0?u.duration:r.duration,pauseOnHover:r.pauseOnHover??u.pauseOnHover,showDismiss:r.showDismiss??u.showDismiss,render:r.render??u.render,bare:r.bare??u.bare,onClick:r.onClick??u.onClick,width:r.width??u.width};return i[l]=d,Hr(s),ee.remaining.delete(s),ee.paused.has(s)||Nr(d),yn(),true};if(a(ee.displayed)||a(ee.queue))return s;let c={id:s,status:r.status??"default",content:r.content,title:r.title,description:r.description,startIcon:r.startIcon,endIcon:r.endIcon,action:r.action,duration:r.duration===void 0?ge.duration:r.duration,onClose:r.onClose,createdAt:Date.now(),pauseOnHover:r.pauseOnHover??true,showDismiss:r.showDismiss,render:r.render,bare:r.bare,onClick:r.onClick,width:r.width??300};return ee.displayed.length>=ge.max&&bg(),ee.displayed=[...ee.displayed,c],ee.enterFrom[c.id]="tail",ee.entering[c.id]=true,requestAnimationFrame(()=>{delete ee.entering[c.id],yn();}),yn(),Nr(c),s},{success:(e,t={})=>De(e,{...t,status:"success"}),error:(e,t={})=>De(e,{...t,status:"error"}),warning:(e,t={})=>De(e,{...t,status:"warning"}),info:(e,t={})=>De(e,{...t,status:"info"}),custom:(e,t={})=>De(e,{...t}),update:(e,t)=>De({id:e,...t}),dismiss:e=>{if(!e){let n=ee.displayed.find(o=>!ee.exiting[o.id])?.id;n&&De.dismiss(n);return}Hr(e),ee.remaining.delete(e),ee.paused.delete(e),ee.exiting[e]=true;let t=ee.displayed.find(n=>n.id===e);ee.displayed=ee.displayed.filter(n=>n.id!==e),delete ee.enterFrom[e],yn(),window.setTimeout(()=>t?.onClose?.(),120),gg();},clear:()=>{[...ee.displayed.map(t=>t.id)].forEach(t=>De.dismiss(t));},pause:e=>{if(ee.paused.has(e))return;let t=ee.expiry.get(e);t!=null&&ee.remaining.set(e,Math.max(0,t-Date.now())),ee.paused.add(e),Hr(e);},resume:e=>{if(!ee.paused.has(e))return;ee.paused.delete(e);let t=ee.displayed.find(o=>o.id===e)??ee.queue.find(o=>o.id===e),n=ee.remaining.get(e);t&&Nr(t,n??void 0),ee.remaining.delete(e);},pauseLatest:()=>{let e=ee.displayed.at(-1);e&&De.pause(e.id);},resumeLatest:()=>{let e=ee.displayed.at(-1);e&&De.resume(e.id);},promise:(e,t,n={})=>{let o=De(t.loading,{...n,status:"info",duration:null});return e.then(r=>{De.update(o,{status:"success",content:t.success(r),duration:n.duration??2500});}).catch(r=>{De.update(o,{status:"error",content:t.error(r),duration:n.duration??3e3});}),e},config:e=>{e.max!=null&&(ge.max=e.max),e.position&&(ge.position=e.position),e.gutter!=null&&(ge.gutter=e.gutter),e.zIndex!=null&&(ge.zIndex=e.zIndex),e.duration!==void 0&&(ge.duration=e.duration),e.showDismiss&&(ge.showDismiss=e.showDismiss),e.styles&&(ge.styles={...ge.styles,...e.styles}),e.renderer!==void 0&&(ge.renderer=e.renderer),e.bareRenderer!==void 0&&(ge.bareRenderer=e.bareRenderer);}});function xg(e){return typeof e=="string"?e:e===true?"always":e===false?"never":ge.showDismiss}function vg(e){return {"top-left":{top:16,left:16,alignItems:"flex-start"},"top-center":{top:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"top-right":{top:16,right:16,alignItems:"flex-end"},"bottom-left":{bottom:16,left:16,alignItems:"flex-start"},"bottom-center":{bottom:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"bottom-right":{bottom:16,right:16,alignItems:"flex-end"}}[e]}var Cg=css({display:"flex",alignItems:"flex-start",gap:10}),Xl=css({flex:"0 0 auto",paddingTop:1,lineHeight:0,marginLeft:-3,"& svg, & img, & canvas, & video":{display:"block"}}),Rg=css({fontSize:14,lineHeight:1.4,fontWeight:500,flex:1,minWidth:0}),Tg=css({display:"flex",alignItems:"center",gap:6,marginRight:-2}),wg=de.memo(function(){let t=useSyncExternalStore(ee.subscribe.bind(ee),()=>ee.snapshot,()=>ee.snapshot),n=V(),o=ge.position.startsWith("bottom"),r=de.useMemo(()=>o?t.displayed:[...t.displayed].reverse(),[t.displayed,o]),s=de.useMemo(()=>({position:"fixed",zIndex:ge.zIndex,pointerEvents:"none",width:"100%",display:"flex",flexDirection:"column",...vg(ge.position),...ge.styles.stack??{}}),[]);return jsx("div",{className:"plainframe-ui-toast-stack",css:css(s),children:jsx(AnimatePresence,{initial:false,children:r.map((a,c)=>{let i=t.enterFrom[a.id]||"tail",l=o?i==="head"?-16:16:i==="head"?16:-16,u=c>0?ge.gutter:0,d={toast:a,close:De.dismiss,pause:De.pause,resume:De.resume},{bg:h,fg:f,border:R}=yg(n,a.status),I={position:"relative",overflow:"hidden",borderRadius:n.radius.md,boxShadow:mg.shadow,padding:`${n.spacing.md} calc(${n.spacing.lg} + 30px) ${n.spacing.md} ${n.spacing.lg}`,display:"grid",gridTemplateColumns:"1fr auto",gap:10,background:h,color:f,cursor:a.onClick?"pointer":"default",border:R?`1px solid ${R}`:"1px solid transparent"},x=typeof ge.styles.surface=="function"?ge.styles.surface(a):ge.styles.surface??{},C=xg(a.showDismiss),g={},p="& .plainframe-ui-toast-close",m="&:hover .plainframe-ui-toast-close";C==="hover"?(g[p]={opacity:0,pointerEvents:"none"},g[m]={opacity:1,pointerEvents:"auto"}):C==="always"?g[p]={opacity:1,pointerEvents:"auto"}:C==="never"&&(g[p]={display:"none"});let v=css({...I,...x,...g}),D=css({position:"absolute",top:8,right:8,appearance:"none",border:0,background:"transparent",color:f,width:28,height:28,borderRadius:8,cursor:"pointer",lineHeight:1,transition:"opacity .12s ease",display:"grid",placeItems:"center",...ge.styles.close??{}}),T;if(a.bare&&a.render){let w=typeof a.render=="function"?a.render(d):a.render;T=jsx("div",{style:{pointerEvents:"auto"},onClick:F=>a.onClick?.(a.id,F),children:w});}else if(ge.bareRenderer&&ge.renderer){let w=typeof ge.renderer=="function"?ge.renderer(d):ge.renderer;T=jsx("div",{style:{pointerEvents:"auto"},onClick:F=>a.onClick?.(a.id,F),children:w});}else {let w;ge.renderer?w=typeof ge.renderer=="function"?ge.renderer(d):ge.renderer:a.render&&!a.bare?w=typeof a.render=="function"?a.render(d):a.render:w=jsxs(Fragment,{children:[jsxs("div",{css:Cg,children:[a.startIcon&&jsx("div",{css:Xl,children:a.startIcon}),jsx("div",{css:Rg,children:a.content}),a.endIcon&&jsx("div",{css:Xl,children:a.endIcon})]}),a.action&&jsx("div",{css:Tg,children:a.action})]}),T=jsxs("div",{css:v,onClick:F=>a.onClick?.(a.id,F),children:[w,jsx("button",{className:"plainframe-ui-toast-close","aria-label":"Close",css:D,onClick:F=>{F.stopPropagation(),De.dismiss(a.id);},children:jsx(X,{strokeWidth:2.5,size:14})})]});}return jsx(Eg,{id:a.id,isBottom:o,mt:u,enterY:l,width:a.width,pauseOnHover:a.pauseOnHover!==false,children:T},a.id)})})})}),Eg=de.memo(function(t){let{id:n,isBottom:o,mt:r,enterY:s,width:a,pauseOnHover:c,children:i}=t,l=useAnimationControls();useEffect(()=>{l.start({opacity:1,y:0,height:"auto",x:0,transition:ug});},[l]);let u={pointerEvents:"auto",willChange:"transform, opacity, height, margin, scale, width, max-width",marginTop:r,width:"100%",maxWidth:a!=null?typeof a=="number"?`${a}px`:a:"none",...ge.styles.item??{}};return jsx(motion.div,{layout:"position",className:"plainframe-ui-toast-item",css:css(u),initial:{opacity:0,y:s,height:"auto",x:0},animate:l,exit:{opacity:0,y:o?6:-6,height:0,marginTop:0,transition:{type:"tween",ease:"easeInOut",duration:.14}},drag:"x",dragElastic:.2,dragMomentum:true,whileDrag:{scale:.98,opacity:.95},onDragEnd:(d,h)=>{let f=Math.abs(h.offset.x),R=Math.abs(h.velocity.x);if(!(f>60||R>600)){l.start({x:0,opacity:1,transition:{type:"spring",stiffness:700,damping:40}});return}let C=(h.offset.x!==0?Math.sign(h.offset.x):Math.sign(h.velocity.x||1))*(window.innerWidth+160),g=typeof h.velocity.x=="number"?h.velocity.x/10:0;l.start({x:C,opacity:.9,transition:{type:"spring",stiffness:280,damping:24,velocity:g}}).then(()=>De.dismiss(n));},onMouseEnter:c?()=>De.pause(n):void 0,onMouseLeave:c?()=>De.resume(n):void 0,children:i})}),Yl=false;(function(){Yl||(Yl=true,Jl());})();var Gg=(...e)=>t=>{for(let n of e)if(n)if(typeof n=="function")n(t);else try{n.current=t;}catch{}},ec=createContext(null),tc=()=>{let e=useContext(ec);if(!e)throw new Error("TooltipTrigger/TooltipContent must be inside <Tooltip>.");return e},Xg=({children:e,placement:t="top",open:n,defaultOpen:o=false,onOpenChange:r,delay:s=80,arrow:a=true,autoWidth:c=false,disableHoverListener:i=false})=>{let[l,u]=useState(!!o),d=n??l,h=T=>{n===void 0&&u(T),r?.(T);},f=useRef(null),R=useFloating({placement:t,open:d,onOpenChange:h,whileElementsMounted:autoUpdate,strategy:"fixed",transform:false,middleware:[offset(8),flip({padding:8}),shift({padding:8}),a?arrow({element:f,padding:4}):void 0].filter(Boolean)}),I=useHover(R.context,{enabled:!i,delay:{open:s,close:60},handleClose:safePolygon(),restMs:20}),x=useFocus(R.context),C=useDismiss(R.context,{escapeKey:true,outsidePress:true}),g=useRole(R.context,{role:"tooltip"}),{getReferenceProps:p,getFloatingProps:m}=useInteractions([I,x,C,g]),v=useId(),D=useMemo(()=>({open:d,setOpen:h,id:v,placement:R.placement,autoWidth:c,allowArrow:!!a,refs:R.refs,floatingStyles:R.floatingStyles,middlewareData:R.middlewareData,getReferenceProps:p,getFloatingProps:m,arrowRef:f}),[d,c,a,R.placement,R.refs,R.floatingStyles,R.middlewareData,p,m]);return jsx(ec.Provider,{value:D,children:e})},Yg=({asChild:e=true,children:t,className:n,css:o})=>{let{refs:r,getReferenceProps:s,id:a}=tc(),c=de.isValidElement(t),i=c&&typeof t.type=="string";if(e&&c&&i){let l=t,u="ref"in l?l.ref:void 0,d=s({...l.props,"aria-describedby":a,ref:Gg(u,r.setReference),className:[l.props?.className||"",n||""].join(" ").trim()||void 0}),h=[l.props?.css||void 0,o].filter(Boolean);return de.cloneElement(l,{...d,css:h})}return jsx("span",{ref:r.setReference,className:n,css:o,style:{display:"inline-flex"},...s({"aria-describedby":a}),children:t})},Jg=({children:e,className:t,css:n,arrowCss:o})=>{let {open:r,refs:s,floatingStyles:a,middlewareData:c,getFloatingProps:i,placement:l,id:u,autoWidth:d,allowArrow:h,arrowRef:f}=tc(),R=V(),I=l.split("-")[0]||"top",C=I==="bottom"?{opacity:0,y:-8,scale:.98}:I==="top"?{opacity:0,y:8,scale:.98}:I==="left"?{opacity:0,x:8,scale:.98}:{opacity:0,x:-8,scale:.98},g=C,p=I==="bottom"?"center top":I==="top"?"center bottom":I==="left"?"right center":"left center",m=css({zIndex:1300,backgroundColor:R.neutral[900],color:R.neutral[0],borderRadius:8,padding:"6px 9px",fontSize:12,fontWeight:500,lineHeight:1.25,maxWidth:260,whiteSpace:d?"nowrap":"normal",boxShadow:"0 10px 30px rgba(0,0,0,.18)",pointerEvents:"auto",transformOrigin:p}),v=css({position:"absolute",width:10,height:10,borderRadius:2,backgroundColor:R.neutral[900],transform:"rotate(45deg)",pointerEvents:"none"}),D=c.arrow,T={top:"bottom",bottom:"top",left:"right",right:"left"}[I];return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:r&&jsxs(motion.div,{id:u,ref:s.setFloating,role:"tooltip","data-state":"open",className:["plainframe-ui-tooltip",t||""].join(" ").trim(),css:[m,n],style:a,initial:C,animate:{opacity:1,x:0,y:0,scale:1},exit:g,transition:{scale:{type:"spring",stiffness:520,damping:36,mass:.6},x:{type:"spring",stiffness:420,damping:32,mass:.6},y:{type:"spring",stiffness:420,damping:32,mass:.6},opacity:{duration:.14,ease:"linear"}},...i(),children:[e,h&&jsx("div",{ref:f,className:"plainframe-ui-tooltip-arrow",css:[v,o],style:{left:D?.x!=null?`${D.x}px`:void 0,top:D?.y!=null?`${D.y}px`:void 0,[T]:"-3px"}})]})})})};function tb(){let e=V();return jsx(Global,{styles:css`
21
21
  *,*::before,*::after{box-sizing:border-box}
22
22
 
23
23
  body{
@@ -45,4 +45,4 @@ ${h}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m()
45
45
  @media (prefers-reduced-motion:reduce){
46
46
  *{animation-duration:0.01ms!important;animation-iteration-count:1!important;transition-duration:0.01ms!important;scroll-behavior:auto!important}
47
47
  }
48
- `})}export{Oa as Accordion,ts as AccordionDetails,_a as AccordionGroup,es as AccordionSummary,Va as ActionBar,Za as Alert,as as AlertDescription,ss as AlertTitle,Ai as Autocomplete,Pi as Avatar,jd as AvatarGroup,Es as Backdrop,Jd as Badge,yr as BreadCrumbItem,op as BreadCrumbs,Wi as Button,Ui as ButtonGroup,Xi as Card,wp as CardContent,Sp as CardDescription,kp as CardEnd,Zi as CardGroup,Ep as CardStart,Ip as CardTitle,sr as Checkbox,tl as Chip,_p as CodeField,_n as Container,Vp as ContextZone,tb as CssBaseline,Xp as Divider,gl as Drawer,$n as DropdownMenu,hn as DropdownMenuContent,wi as DropdownMenuSub,ki as DropdownMenuSubContent,Ei as DropdownMenuSubTrigger,zn as DropdownMenuTrigger,Ws as Fade,vl as Flex,Ks as Grow,Tl as Image,Dm as ImageStack,zm as Kbd,si as Menu,gs as MenuCheckboxGroup,co as MenuCheckboxItem,pn as MenuItem,mn as MenuLabel,lr as MenuRadioGroup,Zu as MenuRadioItem,Qu as MenuSeparator,yi as MenuSwitchItem,er as MenuVariantCtx,Xm as Modal,Hl as ModalContent,Dl as ModalTrigger,of as Pagination,Lu as Popover,ci as PopoverAnchor,ui as PopoverContent,li as PopoverTrigger,no as Progress,uf as Quote,bf as RadioGroup,hf as RadioItem,Rf as Rotate,kf as Select,Ff as Skeleton,qs as Slide,jl as Slider,na as Step,Uf as Stepper,ms as Switch,Nr as Tab,Dr as TabContent,Xf as Tabs,tg as TextArea,Qo as TextField,Na as ThemeProvider,Xg as Tooltip,Jg as TooltipContent,Yg as TooltipTrigger,Un as Typography,Ta as defaultDarkTheme,Vo as defaultLightTheme,Qn as surfaceFromNeutral,jo as textDark,_o as textLight,Be as toast,hc as useColorMode,yd as useDropdownMenuActiveIndex,V as usePlainframeUITheme,$u as usePopoverContext,yc as usePrimary,lb as usePrimitives};
48
+ `})}export{La as Accordion,Zr as AccordionDetails,za as AccordionGroup,Jr as AccordionSummary,Wa as ActionBar,Ga as Alert,os as AlertDescription,ns as AlertTitle,ki as Autocomplete,Mi as Avatar,Vd as AvatarGroup,Rs as Backdrop,Jd as Badge,br as BreadCrumbItem,op as BreadCrumbs,$i as Button,_i as ButtonGroup,Ui as Card,wp as CardContent,kp as CardDescription,Sp as CardEnd,Xi as CardGroup,Ep as CardStart,Ip as CardTitle,rr as Checkbox,Zi as Chip,_p as CodeField,Ln as Container,jp as ContextZone,tb as CssBaseline,Xp as Divider,pl as Drawer,An as DropdownMenu,cn as DropdownMenuContent,Ci as DropdownMenuSub,Ti as DropdownMenuSubContent,Ri as DropdownMenuSubTrigger,Pn as DropdownMenuTrigger,$s as Fade,hl as Flex,zs as Grow,vl as Image,Nm as ImageStack,zm as Kbd,ti as Menu,ps as MenuCheckboxGroup,ao as MenuCheckboxItem,kt as MenuItem,rn as MenuLabel,bi as MenuRadioGroup,Zu as MenuRadioItem,Qu as MenuSeparator,fi as MenuSwitchItem,Qo as MenuVariantCtx,Xm as Modal,Pl as ModalContent,Al as ModalTrigger,of as Pagination,Lu as Popover,si as PopoverAnchor,ai as PopoverContent,ri as PopoverTrigger,Qn as Progress,uf as Quote,bf as RadioGroup,hf as RadioItem,Rf as Rotate,zl as Select,Ff as Skeleton,Vs as Slide,Vl as Slider,Zs as Step,Uf as Stepper,us as Switch,Fr as Tab,Ar as TabContent,Xf as Tabs,tg as TextArea,Zo as TextField,Ma as ThemeProvider,Xg as Tooltip,Jg as TooltipContent,Yg as TooltipTrigger,zn as Typography,xa as defaultDarkTheme,Vo as defaultLightTheme,Yn as surfaceFromNeutral,_o as textDark,Ko as textLight,De as toast,hc as useColorMode,yd as useDropdownMenuActiveIndex,V as usePlainframeUITheme,$u as usePopoverContext,yc as usePrimary,lb as usePrimitives};