plainframe-ui 0.1.14 → 0.1.16
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 +5 -5
- package/package.json +1 -1
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:{}}),mc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],Ra=e=>mc.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 U(){return useTheme()}function bc(){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 hc(){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 rb(e){let t=me.useContext(Pa);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=bc(),{primary:o}=hc(),r=me.useMemo(()=>{let s=n==="light"?t.light:t.dark,a=s.palette[eo(o)]??s.palette.primary,u=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:u,[eo(o)]:u,[o]:u}}}},[t,n,o]);return e?e(r):r}function Uo(e,t){return t?{...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:{...e.palette,...t.palette??{}},neutral:t.neutral??e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}:e}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=u=>{let i=u/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(([c,p])=>{o.push(`--pf-palette-${i}-${c}:${p};`);});});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 u=e.text.onColors[a]??(()=>{let l=(e.palette[a]?.[600]??e.palette.primary[600]).replace("#",""),c=parseInt(l.slice(0,2),16),p=parseInt(l.slice(2,4),16),R=parseInt(l.slice(4,6),16),f=k=>{let C=k/255;return C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4)};return .2126*f(c)+.7152*f(p)+.0722*f(R)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${u};`),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 g=JSON.parse(localStorage.getItem(o)||"null");if(g?.mode==="light"||g?.mode==="dark")return g.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})()),l=me.useMemo(()=>Ea(i.current),[]),c=me.useMemo(()=>Ea(a),[a]),p=useRef(null),R=useRef(0),f=useRef(r??"__root__");me.useLayoutEffect(()=>{let g=0,b=p.current;for(;b&&b!==document.body;)b.hasAttribute("data-pfui-scope")&&g++,b=b.parentElement;R.current=g;},[r]);let v=useMemo(()=>{let g=Uo(Vo,t),b=Uo(g,t?.light),A=t?.light?.primaryKey??a,H=eo(A),B=b.palette.primary??b.palette[H]??b.palette.mono,M=an({..._o(b.neutral).onColors,...b.text.onColors}),E=M[H]??Yr(B[600]),L=t?.surface||t?.light?.surface?b.surface:Qn("light",b.neutral),O={...t?.text||t?.light?.text?b.text:_o(b.neutral),onColors:an({...M,primary:E,[H]:E})};return {...b,palette:{...b.palette,primary:B},surface:L,text:O}},[t,a]),k=useMemo(()=>{let g=Uo(Ta,t),b=Uo(g,t?.dark),A=t?.dark?.primaryKey??a,H=eo(A),B=b.palette.primary??b.palette[H]??b.palette.mono,M=an({...jo(b.neutral).onColors,...b.text.onColors}),E=M[H]??Yr(B[600]),L=t?.surface||t?.dark?.surface?b.surface:Qn("dark",b.neutral),O={...t?.text||t?.dark?.text?b.text:jo(b.neutral),onColors:an({...M,primary:E,[H]:E})};return {...b,palette:{...b.palette,primary:B},surface:L,text:O}},[t,a]),C=useRef(null),T=useRef(null),h=me.useInsertionEffect||me.useLayoutEffect,d=me.useRef(false),m=useCallback(()=>{let g=Xr(r);ka(T,s?`pfui-guard-${r}`:"pfui-guard-root"),T.current.textContent=`${g} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{T.current.textContent="";});},[r,s]);h(()=>{ka(C,s?`pfui-vars-${r}`:"pfui-vars-root");let g=t?.light?.primaryKey??t?.primaryKey??a,b=t?.dark?.primaryKey??t?.primaryKey??a,A=Xr(r),H=qo(v,g,"light"),B=qo(k,b,"dark");C.current.textContent=`${A}.pf-light{${H}}
|
|
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:{}}),mc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],Ra=e=>mc.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 U(){return useTheme()}function bc(){let e=me.useContext(Sa);if(!e)throw new Error("useColorMode must be used within ThemeProvider");console.log("[useColorMode] store:",e),console.log("[useColorMode] store.get():",e.get());let t=me.useContext(Fa),[n,o]=me.useState(()=>{let s=e.get();return console.log("[useColorMode] useState initializer, store.get():",s),s});console.log("[useColorMode] mode state value:",n),me.useEffect(()=>{console.log("[useColorMode] useEffect running, store.get():",e.get()),o(e.get());let s=e.subscribe(()=>{console.log("[useColorMode] subscription fired, new value:",e.get()),o(e.get());});return ()=>{s();}},[e]);let r={mode:n,setMode:t.setMode,toggleMode:t.toggleMode};return console.log("[useColorMode] returning:",r),r}function hc(){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 rb(e){let t=me.useContext(Pa);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=bc(),{primary:o}=hc(),r=me.useMemo(()=>{let s=n==="light"?t.light:t.dark,i=s.palette[eo(o)]??s.palette.primary,u=an(s.text.onColors)[eo(o)]??Yr(i[600]);return {...s,palette:{...s.palette,primary:i},text:{...s.text,onColors:{...an(s.text.onColors),primary:u,[eo(o)]:u,[o]:u}}}},[t,n,o]);return e?e(r):r}function Uo(e,t){return t?{...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:{...e.palette,...t.palette??{}},neutral:t.neutral??e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}:e}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=u=>{let a=u/255;return a<=.03928?a/12.92:Math.pow((a+.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=a=>a.startsWith("var(")?a.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():a;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(([a,l])=>o.push(`--pf-text-on-${a}:${l};`)),Object.entries(e.spacing).forEach(([a,l])=>o.push(`--pf-space-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([a,l])=>o.push(`--pf-radius-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([a,l])=>o.push(`--pf-fontSize-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([a,l])=>o.push(`--pf-cmph-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([a,l])=>o.push(`--pf-neutral-${a}:${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(([a,l])=>{Object.entries(l).forEach(([c,p])=>{o.push(`--pf-palette-${a}-${c}:${p};`);});});let s="300";Object.keys(e.palette).forEach(a=>{o.push(`--pf-focus-${a}-main: var(--pf-palette-${a}-${s});`),o.push(`--pf-focus-${a}-soft: transparent;`);});let i=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(a=>o.push(`--pf-primary-${a}:var(--pf-palette-${i}-${a});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let u=e.text.onColors[i]??(()=>{let l=(e.palette[i]?.[600]??e.palette.primary[600]).replace("#",""),c=parseInt(l.slice(0,2),16),p=parseInt(l.slice(2,4),16),R=parseInt(l.slice(4,6),16),f=k=>{let C=k/255;return C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4)};return .2126*f(c)+.7152*f(p)+.0722*f(R)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${u};`),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,i=t?.primaryKey??"mono",a=useRef((()=>{if(!s)try{let g=JSON.parse(localStorage.getItem(o)||"null");if(g?.mode==="light"||g?.mode==="dark")return g.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})());console.log("[ThemeProvider] initialModeRef.current:",a.current);let l=me.useMemo(()=>{let g=Ea(a.current);return console.log("[ThemeProvider] created modeStore, initial value:",g.get()),g},[]),c=me.useMemo(()=>Ea(i),[i]),p=useRef(null),R=useRef(0),f=useRef(r??"__root__");me.useLayoutEffect(()=>{let g=0,b=p.current;for(;b&&b!==document.body;)b.hasAttribute("data-pfui-scope")&&g++,b=b.parentElement;R.current=g;},[r]);let v=useMemo(()=>{let g=Uo(Vo,t),b=Uo(g,t?.light),A=t?.light?.primaryKey??i,H=eo(A),B=b.palette.primary??b.palette[H]??b.palette.mono,M=an({..._o(b.neutral).onColors,...b.text.onColors}),E=M[H]??Yr(B[600]),L=t?.surface||t?.light?.surface?b.surface:Qn("light",b.neutral),O={...t?.text||t?.light?.text?b.text:_o(b.neutral),onColors:an({...M,primary:E,[H]:E})};return {...b,palette:{...b.palette,primary:B},surface:L,text:O}},[t,i]),k=useMemo(()=>{let g=Uo(Ta,t),b=Uo(g,t?.dark),A=t?.dark?.primaryKey??i,H=eo(A),B=b.palette.primary??b.palette[H]??b.palette.mono,M=an({...jo(b.neutral).onColors,...b.text.onColors}),E=M[H]??Yr(B[600]),L=t?.surface||t?.dark?.surface?b.surface:Qn("dark",b.neutral),O={...t?.text||t?.dark?.text?b.text:jo(b.neutral),onColors:an({...M,primary:E,[H]:E})};return {...b,palette:{...b.palette,primary:B},surface:L,text:O}},[t,i]),C=useRef(null),T=useRef(null),h=me.useInsertionEffect||me.useLayoutEffect,d=me.useRef(false),m=useCallback(()=>{let g=Xr(r);ka(T,s?`pfui-guard-${r}`:"pfui-guard-root"),T.current.textContent=`${g} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{T.current.textContent="";});},[r,s]);h(()=>{ka(C,s?`pfui-vars-${r}`:"pfui-vars-root");let g=t?.light?.primaryKey??t?.primaryKey??i,b=t?.dark?.primaryKey??t?.primaryKey??i,A=Xr(r),H=qo(v,g,"light"),B=qo(k,b,"dark");C.current.textContent=`${A}.pf-light{${H}}
|
|
2
2
|
${A}.pf-dark{${B}}`+(s?`
|
|
3
|
-
${A}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[v,k,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,
|
|
3
|
+
${A}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[v,k,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,i]),me.useLayoutEffect(()=>{if(!d.current){d.current=true;let g=s?p.current:document.documentElement;g&&(g.classList.toggle("pf-dark",a.current==="dark"),g.classList.toggle("pf-light",a.current!=="dark"),l.set(a.current));}},[s,l]);let y=useCallback(()=>{window.__pfuiActiveScope={id:f.current,depth:R.current,ts:Date.now()};},[]),N=useCallback(()=>{let g=s?p.current:document.documentElement,b={capture:true},A=()=>y();return g?.addEventListener("pointerdown",A,b),g?.addEventListener("mouseenter",A,b),g?.addEventListener("focusin",A,b),g?.addEventListener("keydown",A,b),()=>{g?.removeEventListener("pointerdown",A,b),g?.removeEventListener("mouseenter",A,b),g?.removeEventListener("focusin",A,b),g?.removeEventListener("keydown",A,b);}},[s,y]),x=useCallback(g=>{let b=window.__pfuiActiveScope,A=b&&Date.now()-b.ts<1500;if(!b||!A||b.id!==f.current)return;let H=l.get(),B=c.get(),E=Go(H==="light"?v:k,B,H).join("");g.style.cssText+=`;${E}`,g.classList.toggle("pf-light",H==="light"),g.classList.toggle("pf-dark",H==="dark"),g.setAttribute("data-pfui-portal-owner",f.current);},[l,c,v,k]),w=g=>{if(g.getAttribute("data-floating-ui-portal")==="true"||g.getAttribute("data-radix-portal")==="true"||g.getAttribute("data-portal")==="true")return true;let b=g.getAttribute("role");if(b==="tooltip"||b==="dialog")return true;let A=window.getComputedStyle(g);return A.position==="fixed"||A.position==="absolute"},P=useCallback(()=>{let g=new MutationObserver(b=>{for(let A of b)A.addedNodes.forEach(H=>{H instanceof HTMLElement&&(w(H)&&x(H),H.querySelectorAll('[data-floating-ui-portal="true"],[data-radix-portal="true"],[data-portal="true"],[role="tooltip"],[role="dialog"]').forEach(B=>x(B)));});});return g.observe(document.body,{childList:true,subtree:true}),()=>g.disconnect()},[x]);me.useEffect(()=>{let g=N(),b=P();return ()=>{g(),b();}},[N,P]);let $=useCallback(g=>{let b=s?p.current:document.documentElement,A=c.get(),B=Go(g==="light"?v:k,A,g).join("");b.style.cssText+=`;${B}`,b.classList.toggle("pf-light",g==="light"),b.classList.toggle("pf-dark",g==="dark");},[s,v,k,c]),W=useCallback(g=>{let b=c.get(),H=Go(g==="light"?v:k,b,g).join("");document.querySelectorAll(`[data-pfui-portal-owner="${f.current}"]`).forEach(B=>{B.style.cssText+=`;${H}`,B.classList.toggle("pf-light",g==="light"),B.classList.toggle("pf-dark",g==="dark");});},[v,k,c]),K=useCallback(g=>{if(l.get()!==g&&(m(),l.set(g),$(g),W(g),!s))try{let b=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...b,mode:g}));}catch{}},[l,s,o,m,$,W]),I=useCallback(()=>K(l.get()==="light"?"dark":"light"),[K,l]),F=useCallback(g=>{c.set(g);let b=Xr(r),A=qo(v,g,"light"),H=qo(k,g,"dark");C.current&&(C.current.textContent=`${b}.pf-light{${A}}
|
|
4
4
|
${b}.pf-dark{${H}}`+(s?`
|
|
5
|
-
${b}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m();let B=l.get();if($(B),W(B),!s)try{let M=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...M,primary:g}));}catch{}},[v,k,r,s,l,c,m,$,W]),S=jsx(Pa.Provider,{value:{light:v,dark:k},children:jsx(Sa.Provider,{value:l,children:jsx(Ma.Provider,{value:c,children:jsx(Fa.Provider,{value:{setMode:K,toggleMode:I},children:jsx(Aa.Provider,{value:{setPrimary:F},children:jsx(ThemeProvider,{theme:yc(v),children:e})})})})})});return s?jsx("div",{ref:p,"data-pfui-scope":r,style:{background:"var(--pf-surface-appBg)",color:"var(--pf-text-primary)"},children:S}):jsx("div",{ref:p,children:S})};function yc(e){let t=(l,c)=>Object.fromEntries(Object.keys(l).map(p=>[p,c(p)])),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)"},u=t(e.neutral,l=>`var(--pf-neutral-${l})`),i={};return Object.keys(e.palette).forEach(l=>{i[l]={},Object.keys(e.palette[l]).forEach(c=>{i[l][c]=`var(--pf-palette-${l}-${c})`;});}),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:u,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 xc=(e,t)=>{let n=e?.palette??{};return !t||t==="neutral"?"neutral":n[t]?t:"neutral"},Da=(e,t)=>{let n=xc(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=U();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,u=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[u]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e4},css(i)}}function Yo(){let e=U();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,u=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[u]={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},u)=>{let i=U(),l=i.typography.sizes.sm,c=20,p=10,R=i.spacing.lg,f=i.spacing.md,v=Number(i.componentHeights?.md),k=i.text,C=css({display:"flex",alignItems:"center",outline:"none",userSelect:"none",fontWeight:500,minHeight:v,padding:`${f} ${R}`,gap:p,fontSize:l,color:k.primary}),T=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:8}),h=css({marginRight:0,marginLeft:-2,lineHeight:0,color:i.text.secondary}),d=css({marginLeft:5,marginRight:-2,lineHeight:0,color:i.text.secondary});return jsxs("div",{ref:u,role:"presentation",tabIndex:-1,className:["plainframe-ui-accordion-summary",r||""].join(" ").trim(),css:[C,s],children:[!o&&n==="left"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-left",css:[h,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:c,height:c}})}),jsx("span",{className:"plainframe-ui-accordion-content",css:T,children:e}),!o&&n==="right"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-right",css:[d,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:c,height:c}})})]})});es.__PFUI_SLOT="AccordionSummary";es.displayName="AccordionSummary";var ts=({children:e,className:t,css:n})=>{let o=U(),r=o.typography.sizes.sm,s=o.spacing.lg,a="0.15rem",u=o.spacing.md,i=css({padding:`${a} ${s} ${u} ${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:u=false,css:i,children:l})=>{let c=U(),p=useId(),R=useId(),f=c.radius?.md,v=c.text,k=c.componentHeights?.border??1,C=$a(k)??"1px",T=e!==void 0,[h,d]=useState(!!t),m=T?!!e:h,y=xe(),[N,x]=useState(0),[w,P]=useState(false),$=useRef(null),W=useRef(null),K=useRef(null),I=()=>{if(!m)return;let D=document.activeElement;W.current?.contains(D)&&K.current?.focus();},F=()=>{s||(I(),T?n?.(!e):d(D=>{let V=!D;return n?.(V),V}));},S=me.Children.toArray(l).filter(D=>isValidElement(D)),g=S.findIndex(D=>za(D)==="AccordionSummary"),b=S.findIndex(D=>za(D)==="AccordionDetails");g===-1&&S.length&&(g=0),b===-1&&(b=S.findIndex((D,V)=>V!==g),b===-1&&S.length>=2&&(b=1));let A=S[g]??null,H=S[b]??null,B=r==="subtle"?c.surface.subtleBg:r==="outlined"?c.surface.panelBg:"transparent",M=css({backgroundColor:B,color:v.primary,borderRadius:f,border:r==="outlined"?`${C} solid ${c.surface.border}`:"none",outline:"none",marginBottom:c.spacing.sm,maxWidth:a!=null?$a(a):void 0,width:u?"100%":a!=null?void 0:"auto",boxSizing:"border-box",opacity:s?.55:1,cursor:s?"not-allowed":void 0});useLayoutEffect(()=>{let D=$.current;D&&x(D.scrollHeight);},[m,l]),useEffect(()=>{let D=$.current;if(!D)return;let V=new ResizeObserver(()=>x(D.scrollHeight));return V.observe(D),()=>V.disconnect()},[]),useEffect(()=>{N>0&&!w&&P(true);},[N,w]),useLayoutEffect(()=>{if(!m&&W.current){let D=document.activeElement;W.current.contains(D)&&K.current?.focus();}},[m]),useLayoutEffect(()=>{let D=W.current;if(!D)return;let V=Array.from(D.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]"));m?(V.forEach(J=>{let ae=J.dataset.accordionTabindex;ae!=null&&(ae===""?J.removeAttribute("tabindex"):J.tabIndex=Number(ae),delete J.dataset.accordionTabindex);}),D.removeAttribute("inert")):(V.forEach(J=>{J.dataset.accordionTabindex==null&&(J.dataset.accordionTabindex=J.hasAttribute("tabindex")?J.getAttribute("tabindex")??"":""),J.tabIndex=-1;}),D.setAttribute("inert",""));},[m]);let E=css({maxHeight:m?N||"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}),L=css({opacity:m?1:0,transform:m?"translateY(0)":"translateY(1rem)",transition:w?"transform 0.28s ease, opacity 0.28s ease":"none"}),z=css({"& .plainframe-ui-accordion-icon":{transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1)",transform:m?"rotate(180deg)":"rotate(0deg)"}}),O=A&&cloneElement(A,{...typeof A.props=="object"&&A.props?A.props:{},className:[A.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:[y(),M,i],tabIndex:s?-1:0,ref:K,role:"button","aria-expanded":m,"aria-controls":p,"aria-labelledby":R,"aria-disabled":s||void 0,onClick:D=>{D.detail===0&&document.activeElement!==K.current||F();},onKeyDown:D=>{s||document.activeElement===K.current&&D.target===K.current&&(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),F());},children:[jsx("div",{id:R,className:"plainframe-ui-accordion-summary-wrapper",css:[css({cursor:s?"not-allowed":"pointer"}),z],children:O}),jsx("div",{id:p,"aria-hidden":!m,className:"plainframe-ui-accordion-details-clip",css:E,tabIndex:-1,ref:W,onClick:D=>D.stopPropagation(),children:jsx("div",{ref:$,className:"plainframe-ui-accordion-details-inner",css:L,children:_})})]})};Oa.displayName="Accordion";var Fc=e=>isValidElement(e),Ac=e=>Fc(e)?e.type?.displayName||e.type?.name:void 0,Ka=e=>Ac(e)==="Accordion",Pc=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,_a=({children:e,attached:t=false,variant:n,exclusive:o=false,openIndex:r,defaultOpenIndex:s,onOpenIndexChange:a,disabled:u=false,width:i,fullWidth:l=false,className:c,role:p="group",css:R})=>{let f=U(),v=useRef(null),k=Children.toArray(e),C=k.filter(Ka),T=C.length,h=o&&r!==void 0,[d,m]=useState(()=>{if(!o)return null;if(s!==void 0)return s;for(let F=0;F<C.length;F++){let S=C[F].props;if(S.open||S.defaultOpen)return F}return null}),y=o?h?r??null:d:null,N=Nc(f.componentHeights?.border,1),x=f.surface.border,w=f.radius.md,P=n,$=P==="outlined";useEffect(()=>{let F=v.current;if(!F)return;let S=g=>{if(g.key!=="ArrowDown"&&g.key!=="ArrowUp"&&g.key!=="Home"&&g.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 H=document.activeElement,B=A.findIndex(E=>E.contains(H));if(B===-1)return;g.preventDefault();let M=B;g.key==="ArrowDown"?M=(B+1)%A.length:g.key==="ArrowUp"?M=(B-1+A.length)%A.length:g.key==="Home"?M=0:g.key==="End"&&(M=A.length-1),A[M]?.focus();};return F.addEventListener("keydown",S),()=>F.removeEventListener("keydown",S)},[T]);let W=css({display:"flex",flexDirection:"column",maxWidth:i!=null?Pc(i):void 0,width:l?"100%":i!=null?void 0:"auto",gap:t?0:f.spacing.sm,border:t&&$?`${N} solid ${x}`:"none",borderRadius:t&&$?w:void 0,background:t&&$?f.surface.panelBg:"transparent"}),K=0,I=[];return k.forEach((F,S)=>{if(!Ka(F)){I.push(F);return}let g=F.props,b=K++,A=b===0,H=b===T-1,B=u||!!g.disabled,M=P??g.variant,E=t?css({width:"100%",marginBottom:0,borderTopLeftRadius:A?w:0,borderTopRightRadius:A?w:0,borderBottomLeftRadius:H?w:0,borderBottomRightRadius:H?w:0}):css({width:"100%",marginBottom:0}),L=!A&&T>1&&t?css({borderTop:`${N} solid ${x}`}):null,z=$?css({border:"1px solid transparent"}):null,O={variant:M,disabled:B,width:"100%",css:[g.css,E,z,L],className:[g.className,"plainframe-ui-accordion-group-item"].filter(Boolean).join(" ")};if(o){let _=g.onChange,D=y===b;O.open=D,O.defaultOpen=void 0,O.onChange=V=>{let J=V?b:null;h||m(J),a?.(J),_?.(V);};}I.push(cloneElement(F,{...g,...O,key:F?.key??S}));}),jsx("div",{ref:v,role:p,"aria-orientation":"vertical","data-attached":t||void 0,"data-exclusive":o||void 0,className:["plainframe-ui-accordion-group",c||""].join(" ").trim(),css:[W,R],children:I})};_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:u=0,offsetX:i=0,offsetY:l=0,elevated:c=true,unstyled:p=false,fullWidth:R=false,width:f,height:v,role:k="toolbar","aria-label":C,onClose:T})=>{let h=U(),d=useRef(null),m=useRef(null),y=useRef(false),N=useRef(t),x=n.horizontal??"center",w=n.vertical??"bottom",P=M=>typeof M=="string"?h.spacing[M]??M:M,$=M=>typeof M=="string"?h.radius[M]??M:M,W=jt(P(u)),K=jt(P(i)),I=jt(P(l)),F={position:"fixed",left:0,right:0,top:0,bottom:0,display:"flex",pointerEvents:"none",zIndex:1e3,justifyContent:x==="left"?"flex-start":x==="right"?"flex-end":"center",alignItems:w==="top"?"flex-start":w==="bottom"?"flex-end":"center"},S=()=>`${x==="left"?"left":x==="right"?"right":"center"} ${w==="top"?"top":w==="bottom"?"bottom":"center"}`,g=()=>w==="top"||w==="bottom"?`translateY(${w==="bottom"?100:-100}px) scale(0.98)`:w==="center"?x==="left"?"translateX(-100px) scale(0.98)":x==="right"?"translateX(100px) scale(0.98)":"scale(0.95)":"scale(0.98)",b=()=>w==="center"&&x==="center"?"scale(1)":"translateX(0) translateY(0) scale(1)",A=24,H={margin:A,marginTop:w==="top"?`calc(${A}px + ${W} + ${I})`:A,marginBottom:w==="bottom"?`calc(${A}px + ${W} + ${I})`:A,marginLeft:x==="left"?`calc(${A}px + ${W} + ${K})`:A,marginRight:x==="right"?`calc(${A}px + ${W} + ${K})`:A,padding:p?0:jt(P(r)),background:p?"transparent":h.surface.panelBg,border:p?"none":`1px solid ${h.surface.border}`,borderRadius:p?0:jt($(a)),boxShadow:p||!c?"none":"0 20px 40px rgba(0,0,0,.08)",display:"flex",flexDirection:o==="vertical"?"column":"row",gap:jt(P(s)),transformOrigin:S(),pointerEvents:t?"auto":"none",width:R?"calc(100% - 48px)":f?jt(f):"auto",height:v?jt(v):"auto",maxWidth:R?"100%":"none"},B=css({"& .plainframe-ui-textfield":{flex:1,minWidth:0}});return useLayoutEffect(()=>{let M=d.current;if(!M)return;let E=g(),L=b();if(!y.current){y.current=true,N.current=t,M.style.opacity=t?"1":"0",M.style.transform=t?L:E;return}if(N.current===t){M.style.opacity=t?"1":"0",M.style.transform=t?L:E;return}N.current=t,m.current&&m.current.cancel();let z=t?[{opacity:0,transform:E},{opacity:1,transform:L}]:[{opacity:1,transform:L},{opacity:0,transform:E}];return m.current=M.animate(z,{duration:250,easing:"ease",fill:"forwards"}),()=>{m.current&&m.current.cancel();}},[t,x,w]),useEffect(()=>{if(!t||!T)return;let M=E=>{E.key==="Escape"&&T();};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,T]),jsx("div",{css:F,children:jsx("div",{ref:d,css:B,style:H,role:k,"aria-label":C,"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,zc=keyframes`100% { transform: rotate(360deg); }`,Oc=keyframes`
|
|
5
|
+
${b}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m();let B=l.get();if($(B),W(B),!s)try{let M=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...M,primary:g}));}catch{}},[v,k,r,s,l,c,m,$,W]),S=jsx(Pa.Provider,{value:{light:v,dark:k},children:jsx(Sa.Provider,{value:l,children:jsx(Ma.Provider,{value:c,children:jsx(Fa.Provider,{value:{setMode:K,toggleMode:I},children:jsx(Aa.Provider,{value:{setPrimary:F},children:jsx(ThemeProvider,{theme:yc(v),children:e})})})})})});return s?jsx("div",{ref:p,"data-pfui-scope":r,style:{background:"var(--pf-surface-appBg)",color:"var(--pf-text-primary)"},children:S}):jsx("div",{ref:p,children:S})};function yc(e){let t=(l,c)=>Object.fromEntries(Object.keys(l).map(p=>[p,c(p)])),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})`),i={sans:"var(--pf-font-sans)",mono:"var(--pf-font-mono)"},u=t(e.neutral,l=>`var(--pf-neutral-${l})`),a={};return Object.keys(e.palette).forEach(l=>{a[l]={},Object.keys(e.palette[l]).forEach(c=>{a[l][c]=`var(--pf-palette-${l}-${c})`;});}),a.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:i,sizes:r},neutral:u,palette:a,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 xc=(e,t)=>{let n=e?.palette??{};return !t||t==="neutral"?"neutral":n[t]?t:"neutral"},Da=(e,t)=>{let n=xc(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=U();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,i=t?.offset??0,u=t?.mode==="always"?"&:focus":"&:focus-visible",a={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 a[u]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:i,zIndex:1e4},css(a)}}function Yo(){let e=U();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,i=t?.offset??0,u=t?.mode==="always"?"&:focus-within":"&:has(:focus-visible)",a={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 a[u]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:i,zIndex:1e3},css(a)}}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:i},u)=>{let a=U(),l=a.typography.sizes.sm,c=20,p=10,R=a.spacing.lg,f=a.spacing.md,v=Number(a.componentHeights?.md),k=a.text,C=css({display:"flex",alignItems:"center",outline:"none",userSelect:"none",fontWeight:500,minHeight:v,padding:`${f} ${R}`,gap:p,fontSize:l,color:k.primary}),T=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:8}),h=css({marginRight:0,marginLeft:-2,lineHeight:0,color:a.text.secondary}),d=css({marginLeft:5,marginRight:-2,lineHeight:0,color:a.text.secondary});return jsxs("div",{ref:u,role:"presentation",tabIndex:-1,className:["plainframe-ui-accordion-summary",r||""].join(" ").trim(),css:[C,s],children:[!o&&n==="left"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-left",css:[h,i],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:c,height:c}})}),jsx("span",{className:"plainframe-ui-accordion-content",css:T,children:e}),!o&&n==="right"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-right",css:[d,i],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:c,height:c}})})]})});es.__PFUI_SLOT="AccordionSummary";es.displayName="AccordionSummary";var ts=({children:e,className:t,css:n})=>{let o=U(),r=o.typography.sizes.sm,s=o.spacing.lg,i="0.15rem",u=o.spacing.md,a=css({padding:`${i} ${s} ${u} ${s}`,fontSize:r,boxSizing:"border-box",minHeight:0});return jsx("div",{className:["plainframe-ui-accordion-details",t||""].join(" ").trim(),css:[a,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:i,fullWidth:u=false,css:a,children:l})=>{let c=U(),p=useId(),R=useId(),f=c.radius?.md,v=c.text,k=c.componentHeights?.border??1,C=$a(k)??"1px",T=e!==void 0,[h,d]=useState(!!t),m=T?!!e:h,y=xe(),[N,x]=useState(0),[w,P]=useState(false),$=useRef(null),W=useRef(null),K=useRef(null),I=()=>{if(!m)return;let D=document.activeElement;W.current?.contains(D)&&K.current?.focus();},F=()=>{s||(I(),T?n?.(!e):d(D=>{let V=!D;return n?.(V),V}));},S=me.Children.toArray(l).filter(D=>isValidElement(D)),g=S.findIndex(D=>za(D)==="AccordionSummary"),b=S.findIndex(D=>za(D)==="AccordionDetails");g===-1&&S.length&&(g=0),b===-1&&(b=S.findIndex((D,V)=>V!==g),b===-1&&S.length>=2&&(b=1));let A=S[g]??null,H=S[b]??null,B=r==="subtle"?c.surface.subtleBg:r==="outlined"?c.surface.panelBg:"transparent",M=css({backgroundColor:B,color:v.primary,borderRadius:f,border:r==="outlined"?`${C} solid ${c.surface.border}`:"none",outline:"none",marginBottom:c.spacing.sm,maxWidth:i!=null?$a(i):void 0,width:u?"100%":i!=null?void 0:"auto",boxSizing:"border-box",opacity:s?.55:1,cursor:s?"not-allowed":void 0});useLayoutEffect(()=>{let D=$.current;D&&x(D.scrollHeight);},[m,l]),useEffect(()=>{let D=$.current;if(!D)return;let V=new ResizeObserver(()=>x(D.scrollHeight));return V.observe(D),()=>V.disconnect()},[]),useEffect(()=>{N>0&&!w&&P(true);},[N,w]),useLayoutEffect(()=>{if(!m&&W.current){let D=document.activeElement;W.current.contains(D)&&K.current?.focus();}},[m]),useLayoutEffect(()=>{let D=W.current;if(!D)return;let V=Array.from(D.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]"));m?(V.forEach(J=>{let ae=J.dataset.accordionTabindex;ae!=null&&(ae===""?J.removeAttribute("tabindex"):J.tabIndex=Number(ae),delete J.dataset.accordionTabindex);}),D.removeAttribute("inert")):(V.forEach(J=>{J.dataset.accordionTabindex==null&&(J.dataset.accordionTabindex=J.hasAttribute("tabindex")?J.getAttribute("tabindex")??"":""),J.tabIndex=-1;}),D.setAttribute("inert",""));},[m]);let E=css({maxHeight:m?N||"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}),L=css({opacity:m?1:0,transform:m?"translateY(0)":"translateY(1rem)",transition:w?"transform 0.28s ease, opacity 0.28s ease":"none"}),z=css({"& .plainframe-ui-accordion-icon":{transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1)",transform:m?"rotate(180deg)":"rotate(0deg)"}}),O=A&&cloneElement(A,{...typeof A.props=="object"&&A.props?A.props:{},className:[A.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:[y(),M,a],tabIndex:s?-1:0,ref:K,role:"button","aria-expanded":m,"aria-controls":p,"aria-labelledby":R,"aria-disabled":s||void 0,onClick:D=>{D.detail===0&&document.activeElement!==K.current||F();},onKeyDown:D=>{s||document.activeElement===K.current&&D.target===K.current&&(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),F());},children:[jsx("div",{id:R,className:"plainframe-ui-accordion-summary-wrapper",css:[css({cursor:s?"not-allowed":"pointer"}),z],children:O}),jsx("div",{id:p,"aria-hidden":!m,className:"plainframe-ui-accordion-details-clip",css:E,tabIndex:-1,ref:W,onClick:D=>D.stopPropagation(),children:jsx("div",{ref:$,className:"plainframe-ui-accordion-details-inner",css:L,children:_})})]})};Oa.displayName="Accordion";var Fc=e=>isValidElement(e),Ac=e=>Fc(e)?e.type?.displayName||e.type?.name:void 0,Ka=e=>Ac(e)==="Accordion",Pc=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,_a=({children:e,attached:t=false,variant:n,exclusive:o=false,openIndex:r,defaultOpenIndex:s,onOpenIndexChange:i,disabled:u=false,width:a,fullWidth:l=false,className:c,role:p="group",css:R})=>{let f=U(),v=useRef(null),k=Children.toArray(e),C=k.filter(Ka),T=C.length,h=o&&r!==void 0,[d,m]=useState(()=>{if(!o)return null;if(s!==void 0)return s;for(let F=0;F<C.length;F++){let S=C[F].props;if(S.open||S.defaultOpen)return F}return null}),y=o?h?r??null:d:null,N=Nc(f.componentHeights?.border,1),x=f.surface.border,w=f.radius.md,P=n,$=P==="outlined";useEffect(()=>{let F=v.current;if(!F)return;let S=g=>{if(g.key!=="ArrowDown"&&g.key!=="ArrowUp"&&g.key!=="Home"&&g.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 H=document.activeElement,B=A.findIndex(E=>E.contains(H));if(B===-1)return;g.preventDefault();let M=B;g.key==="ArrowDown"?M=(B+1)%A.length:g.key==="ArrowUp"?M=(B-1+A.length)%A.length:g.key==="Home"?M=0:g.key==="End"&&(M=A.length-1),A[M]?.focus();};return F.addEventListener("keydown",S),()=>F.removeEventListener("keydown",S)},[T]);let W=css({display:"flex",flexDirection:"column",maxWidth:a!=null?Pc(a):void 0,width:l?"100%":a!=null?void 0:"auto",gap:t?0:f.spacing.sm,border:t&&$?`${N} solid ${x}`:"none",borderRadius:t&&$?w:void 0,background:t&&$?f.surface.panelBg:"transparent"}),K=0,I=[];return k.forEach((F,S)=>{if(!Ka(F)){I.push(F);return}let g=F.props,b=K++,A=b===0,H=b===T-1,B=u||!!g.disabled,M=P??g.variant,E=t?css({width:"100%",marginBottom:0,borderTopLeftRadius:A?w:0,borderTopRightRadius:A?w:0,borderBottomLeftRadius:H?w:0,borderBottomRightRadius:H?w:0}):css({width:"100%",marginBottom:0}),L=!A&&T>1&&t?css({borderTop:`${N} solid ${x}`}):null,z=$?css({border:"1px solid transparent"}):null,O={variant:M,disabled:B,width:"100%",css:[g.css,E,z,L],className:[g.className,"plainframe-ui-accordion-group-item"].filter(Boolean).join(" ")};if(o){let _=g.onChange,D=y===b;O.open=D,O.defaultOpen=void 0,O.onChange=V=>{let J=V?b:null;h||m(J),i?.(J),_?.(V);};}I.push(cloneElement(F,{...g,...O,key:F?.key??S}));}),jsx("div",{ref:v,role:p,"aria-orientation":"vertical","data-attached":t||void 0,"data-exclusive":o||void 0,className:["plainframe-ui-accordion-group",c||""].join(" ").trim(),css:[W,R],children:I})};_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:i="lg",offset:u=0,offsetX:a=0,offsetY:l=0,elevated:c=true,unstyled:p=false,fullWidth:R=false,width:f,height:v,role:k="toolbar","aria-label":C,onClose:T})=>{let h=U(),d=useRef(null),m=useRef(null),y=useRef(false),N=useRef(t),x=n.horizontal??"center",w=n.vertical??"bottom",P=M=>typeof M=="string"?h.spacing[M]??M:M,$=M=>typeof M=="string"?h.radius[M]??M:M,W=jt(P(u)),K=jt(P(a)),I=jt(P(l)),F={position:"fixed",left:0,right:0,top:0,bottom:0,display:"flex",pointerEvents:"none",zIndex:1e3,justifyContent:x==="left"?"flex-start":x==="right"?"flex-end":"center",alignItems:w==="top"?"flex-start":w==="bottom"?"flex-end":"center"},S=()=>`${x==="left"?"left":x==="right"?"right":"center"} ${w==="top"?"top":w==="bottom"?"bottom":"center"}`,g=()=>w==="top"||w==="bottom"?`translateY(${w==="bottom"?100:-100}px) scale(0.98)`:w==="center"?x==="left"?"translateX(-100px) scale(0.98)":x==="right"?"translateX(100px) scale(0.98)":"scale(0.95)":"scale(0.98)",b=()=>w==="center"&&x==="center"?"scale(1)":"translateX(0) translateY(0) scale(1)",A=24,H={margin:A,marginTop:w==="top"?`calc(${A}px + ${W} + ${I})`:A,marginBottom:w==="bottom"?`calc(${A}px + ${W} + ${I})`:A,marginLeft:x==="left"?`calc(${A}px + ${W} + ${K})`:A,marginRight:x==="right"?`calc(${A}px + ${W} + ${K})`:A,padding:p?0:jt(P(r)),background:p?"transparent":h.surface.panelBg,border:p?"none":`1px solid ${h.surface.border}`,borderRadius:p?0:jt($(i)),boxShadow:p||!c?"none":"0 20px 40px rgba(0,0,0,.08)",display:"flex",flexDirection:o==="vertical"?"column":"row",gap:jt(P(s)),transformOrigin:S(),pointerEvents:t?"auto":"none",width:R?"calc(100% - 48px)":f?jt(f):"auto",height:v?jt(v):"auto",maxWidth:R?"100%":"none"},B=css({"& .plainframe-ui-textfield":{flex:1,minWidth:0}});return useLayoutEffect(()=>{let M=d.current;if(!M)return;let E=g(),L=b();if(!y.current){y.current=true,N.current=t,M.style.opacity=t?"1":"0",M.style.transform=t?L:E;return}if(N.current===t){M.style.opacity=t?"1":"0",M.style.transform=t?L:E;return}N.current=t,m.current&&m.current.cancel();let z=t?[{opacity:0,transform:E},{opacity:1,transform:L}]:[{opacity:1,transform:L},{opacity:0,transform:E}];return m.current=M.animate(z,{duration:250,easing:"ease",fill:"forwards"}),()=>{m.current&&m.current.cancel();}},[t,x,w]),useEffect(()=>{if(!t||!T)return;let M=E=>{E.key==="Escape"&&T();};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,T]),jsx("div",{css:F,children:jsx("div",{ref:d,css:B,style:H,role:k,"aria-label":C,"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,zc=keyframes`100% { transform: rotate(360deg); }`,Oc=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 @@ ${b}{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
|
-
`,Kc=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("),_c=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(Kc(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]&&_c.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:u=.75,wrapperCss:i,trackCss:l,barCss:c,circleCss:p,"aria-label":R})=>{let f=U(),v=typeof t=="number",k=Math.max(o-n,1),C=v?qa(t,n,o):void 0,T=v?(C-n)/k*100:void 0,h=jc(f,r),d=f.surface.subtleBg,m=f.radius?.md;return e==="circular"?jsx(Uc,{size:s,active:h,isDeterminate:v,percent:T,spinDuration:u,wrapperCss:i,trackCss:l,circleCss:p,ariaLabel:R,thickness:a}):jsx(Vc,{thickness:a,active:h,track:d,radius:m,isDeterminate:v,percent:T,wrapperCss:i,trackCss:l,barCss:c,ariaLabel:R,min:n,max:o,value:C})}),Vc=({thickness:e=4,active:t,track:n,radius:o,isDeterminate:r,percent:s,wrapperCss:a,trackCss:u,barCss:i,ariaLabel:l,min:c,max:p,value:R})=>{let f=o==null?"8px":typeof o=="number"?`${o}px`:String(o),v=css([{display:"inline-block",width:"100%"},...Array.isArray(a)?a:a?[a]:[]]),k=css([{position:"relative",width:"100%",height:ns(e,"6px"),backgroundColor:n,borderRadius:f,overflow:"hidden"},...Array.isArray(u)?u:u?[u]:[]]),C=r?Math.max(s??0,Ua):Ua,T=css([{position:"absolute",inset:0,backgroundColor:t,borderRadius:"inherit",transformOrigin:"left",transform:`scaleX(${C/100})`,transition:"transform 160ms cubic-bezier(.2,0,.2,1)",willChange:"transform"},...Array.isArray(i)?i:i?[i]:[]]),h={position:"absolute",top:0,bottom:0,backgroundColor:t,borderRadius:"inherit",willChange:"left,right","@media (prefers-reduced-motion: reduce)":{animation:"none"}},d=css([{...h,left:"-35%",right:"100%",animation:`${Oc} 2.1s cubic-bezier(.65,.815,.735,.395) infinite`},...Array.isArray(i)?i:i?[i]:[]]),m=css([{...h,left:"-200%",right:"100%",animation:`${Wc} 2.1s cubic-bezier(.165,.84,.44,1) 1.15s infinite`},...Array.isArray(i)?i:i?[i]:[]]),y=r?{role:"progressbar","aria-valuemin":c,"aria-valuemax":p,"aria-valuenow":R}:{role:"progressbar","aria-busy":true};return l&&(y["aria-label"]=l),jsx("span",{css:v,...y,children:jsx("div",{className:"plainframe-ui-progress-linear-track",css:k,children:r?jsx("div",{className:"plainframe-ui-progress-linear-fill",css:T}):jsxs(Fragment,{children:[jsx("div",{className:"plainframe-ui-progress-linear-runner1",css:d}),jsx("div",{className:"plainframe-ui-progress-linear-runner2",css:m})]})})})},Uc=({size:e,thickness:t=4,active:n,isDeterminate:o,percent:r,spinDuration:s,wrapperCss:a,trackCss:u,circleCss:i,ariaLabel:l})=>{let c=U(),p=40,R=(p-t)/2,f=2*Math.PI*R,k=`${(o?qa((r??0)/100,.01,1):.7)*f} ${f}`,C=css([{display:"inline-block",width:ns(e,`${c.componentHeights.md}`),height:ns(e,`${c.componentHeights.md}`)},...Array.isArray(a)?a:a?[a]:[]]),T=css([{width:"100%",height:"100%",transform:"rotate(-90deg)",transformBox:"fill-box",transformOrigin:"50% 50%"},...Array.isArray(u)?u:u?[u]:[]]),h=css([{stroke:n,strokeLinecap:"butt",strokeDasharray:k,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":`${zc} ${s}s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},...Array.isArray(i)?i:i?[i]:[]]),d=o?{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r??0)}:{role:"progressbar","aria-busy":true};return l&&(d["aria-label"]=l),jsx("span",{css:C,className:"plainframe-ui-progress-circular",...d,children:jsx("svg",{css:T,viewBox:`0 0 ${p} ${p}`,focusable:"false","aria-hidden":true,children:jsx("circle",{cx:p/2,cy:p/2,r:R,strokeWidth:t,css:h})})})};var Ya=createContext(null),Ja=()=>{let e=useContext(Ya);if(!e)throw new Error("AlertTitle and AlertDescription must be used inside <Alert>.");return e},nu=css({display:"flex",flexDirection:"column",textAlign:"left",minWidth:0,flex:1}),ou=css({lineHeight:0,display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"}),ru=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:u="md",loading:i=false,css:l,children:c,...p},R){let f=U(),v=useId(),k=useId(),C=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(u)?F[u]:F.md},[u,f.typography,f.radius,f.spacing]),T=f.palette??{},h=f.neutral??{},d=useMemo(()=>{let S=(E=>E==="danger"?T.danger??T.error??h:E==="warning"?T.warning??h:E==="success"?T.success??h:E==="info"?T.info??T.primary??h:h)(t),g=S?.[50]??h[50],b=S?.[300]??h[300],A=S?.[600]??S?.[500]??h[600],H=S?.[700]??A,B=S?.[800]??f.text?.primary??"#000",M=f.text?.onColors?.[t]??f.text?.onColors?.primary??f.text?.primary??"#fff";return n==="filled"?{bg:A,fg:M,border:void 0,iconColor:M}:n==="outlined"?{bg:g,fg:B,border:`1px solid ${b}`,iconColor:B}:n==="ghost"?{bg:"transparent",fg:H,border:"none",iconColor:H}:{bg:g,fg:B,border:void 0,iconColor:H}},[t,n,h,T,f.text]),m=t==="danger"||t==="warning"?"alert":"status",y=useMemo(()=>i?jsx(no,{variant:"circular",color:d.iconColor,size:C.iconSize/1.25,thickness:4.5}):o??(t==="danger"?jsx(CircleAlert,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor}):t==="warning"?jsx(TriangleAlert,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor}):t==="success"?jsx(CircleCheckBig,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor}):jsx(Info,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor})),[i,o,t,C.iconSize,d.iconColor]),N=useMemo(()=>css({display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:`${C.paddingY} ${C.paddingX}`,gap:C.gap,borderRadius:C.radius,backgroundColor:d.bg,color:d.fg,border:d.border,fontSize:C.fontSize,fontWeight:500,maxWidth:typeof a=="number"?`${a}px`:a,width:"100%"}),[d.bg,d.border,d.fg,C.fontSize,C.gap,C.paddingX,C.paddingY,C.radius,a]),x=useMemo(()=>css({display:"flex",alignItems:"flex-start",gap:C.gap,minWidth:0,flex:1}),[C.gap]),w=useMemo(()=>[ou,{color:d.iconColor}],[d.iconColor]),P=useMemo(()=>css({display:"flex",alignItems:"center",gap:C.gap,marginLeft:C.gap,flex:"0 0 auto"}),[C.gap]),$=useMemo(()=>[ru,{color:d.fg}],[d.fg]),W=useMemo(()=>({fg:d.fg,iconColor:d.iconColor,s:C,titleId:v,descId:k}),[d.fg,d.iconColor,C,v,k]),K=me.Children.toArray(c).some(F=>me.isValidElement(F)&&F.type===ss),I=me.Children.toArray(c).some(F=>me.isValidElement(F)&&F.type===as);return jsx(Ya.Provider,{value:W,children:jsxs("div",{ref:R,role:m,"aria-live":m==="alert"?"assertive":"polite","aria-atomic":"true","aria-busy":i,"aria-labelledby":K?v:void 0,"aria-describedby":I?k:void 0,className:`plainframe-ui-alert plainframe-ui-alert-${t} plainframe-ui-alert-${n}`,css:[N,l],...p,children:[jsxs("div",{className:"plainframe-ui-alert-left",css:x,children:[y&&jsx("span",{className:"plainframe-ui-alert-icon",css:w,children:y}),jsx("div",{className:"plainframe-ui-alert-content",css:nu,children:c})]}),s&&jsx("div",{className:"plainframe-ui-alert-actions",css:P,children:jsx("button",{type:"button","aria-label":"Close alert",onClick:s,disabled:i,className:"plainframe-ui-alert-close",css:$,children:r??jsx(X,{strokeWidth:2,size:C.iconSize-2})})})]})})});Za.displayName="Alert";var ss=forwardRef(function({children:t,css:n,...o},r){let{fg:s,s:a,titleId:u}=Ja(),i=useMemo(()=>css({color:s,fontWeight:a.titleWeight,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[s,a.titleWeight]);return jsx("span",{ref:r,id:u,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(),u=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:[u,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:u,disabled:i=false,fullWidth:l=false,width:c=250,size:p="md",variant:R="subtle",rounded:f=false,startIcon:v,endIcon:k,togglePasswordVisible:C=false,showClear:T,type:h="text",step:d,focusRingMode:m="always",className:y,wrapperCss:N,inputCss:x,labelCss:w,helperRowCss:P,helperTextCss:$,startIconCss:W,endIconCss:K,css:I,onBlur:F,onFocus:S,onKeyDown:g,autoFocus:b,name:A,id:H,tabIndex:B,autoComplete:M,readOnly:E,required:L,maxLength:z,onSurfaceClick:O},_){let D=U(),V=Yo(),J=useId(),ae=useMemo(()=>{let ce={sm:{fontSize:D.typography.sizes.sm,minHeight:D.componentHeights.sm,labelFont:D.typography.sizes.xs,helperFont:D.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:D.spacing.md,iconSize:D.typography.sizes.xs,codeFontSize:21},md:{fontSize:D.typography.sizes.sm,minHeight:D.componentHeights.md,labelFont:D.typography.sizes.sm,helperFont:D.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:D.spacing.md,iconSize:D.typography.sizes.xs,codeFontSize:24},lg:{fontSize:D.typography.sizes.sm,minHeight:D.componentHeights.lg,labelFont:D.typography.sizes.md,helperFont:D.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:D.spacing.md,iconSize:D.typography.sizes.xs,codeFontSize:28}},ke=["sm","md","lg"].includes(p)?p:"md";return ce[ke]},[p,D]),q=D.neutral,X$1=D.text,le=h==="number",ie=h==="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&&(d!=null&&String(d).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&&R==="outlined"?D.palette.danger?.[50]??D.surface.panelBg:a&&R==="subtle"?D.palette.danger?.[50]??D.surface.subtleBg:R==="outlined"?D.surface.panelBg:R==="subtle"?D.surface.subtleBg:"transparent",Q=D.componentHeights.border,ee=R==="outlined"?`${Q} solid ${a?D.palette.danger?.[300]??D.surface.border:D.surface.border}`:"none",se=Xt({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:l?"100%":c!=null?is(c):void 0,flex:"0 0 auto",fontWeight:500}),pe=useMemo(()=>Xt({fontSize:ae.labelFont,fontWeight:500,color:a?D.palette.danger?.[700]??X$1.primary:i?q[500]:X$1.primary,marginBottom:4,display:"inline-block"},...Gt(w)),[ae.labelFont,a,i,q,X$1,D.palette.danger,w]),Se=useMemo(()=>Xt({display:"flex",alignItems:"center",gap:D.spacing.sm,padding:`${is(ae.paddingY)} ${is(ae.paddingX)}`,background:Ee,border:ee,borderRadius:f?D.radius.full:D.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(N),...Gt(I)),[D,ae.minHeight,ae.paddingX,ae.paddingY,Ee,ee,f,i,N,I]),Ne=useMemo(()=>Xt({flex:1,minWidth:0,fontSize:ae.fontSize,fontWeight:500,fontFamily:"inherit",color:i?q[500]:a?D.palette.danger?.[800]??X$1.primary:X$1.primary,background:"transparent",border:"none",outline:"none",padding:0,lineHeight:1.25,cursor:i?"not-allowed":"text",appearance:le?"textfield":"auto","&::placeholder":{color:a?D.palette.danger?.[700]??X$1.secondary:X$1.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${a?D.palette.danger?.[800]??X$1.primary:X$1.primary} !important`,boxShadow:`0 0 0 1000px ${Ee} inset !important`,transition:"opacity 99999s ease-out",caretColor:a?D.palette.danger?.[800]??X$1.primary:X$1.primary},":focus-within":{outline:"none",border:"none",boxShadow:"none"}},...Gt(x)),[ae.fontSize,i,q,X$1,a,D.palette.danger,le,Ee,x]),Y=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:a?D.palette.danger?.[800]??X$1.secondary:X$1.secondary,marginLeft:-3},...Gt(W)),[a,D.palette.danger,X$1.secondary,W]),oe=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:a?D.palette.danger?.[800]??X$1.secondary:X$1.secondary,border:"none",background:"transparent",lineHeight:0,cursor:"inherit",padding:0},...Gt(K)),[a,D.palette.danger,X$1.secondary,i,K]),re=useMemo(()=>Xt({minHeight:16,fontSize:ae.helperFont,color:a?D.palette.danger?.[700]??X$1.secondary:X$1.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Gt(P)),[ae.helperFont,a,D.palette.danger,X$1.secondary,P]),qe=useMemo(()=>Xt({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400},...Gt($)),[$]),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}z&&ke.length>z||Ie(ke);},[le,z,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(()=>v?jsx("span",{css:Y,children:ei(v,Ye)}):null,[v,Y,Ye]),tn=useMemo(()=>css({display:"flex",alignItems:"center",gap:4}),[]),nn=useMemo(()=>{let ce=[];if(ie&&C){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"));}T&&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=k?jsx("span",{css:oe,children:ei(k,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,C,fe,Ye,oe,tn,i,T,Ce,k,Oe,st]),Sn=u!=null?`${H??J}-help`:void 0,on=H??J,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&&(O?.(ce),document.activeElement!==ke)){ke.focus({preventScroll:true});try{let at=ke.value?.length??0;ke.setSelectionRange?.(at,at);}catch{}}},[i,O]);return jsxs("div",{className:["plainframe-ui-textfield",y||""].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:[V({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?"password":h==="number"?"text":h,inputMode:he,pattern:je,value:Ce,maxLength:le?void 0:z,onChange:le?ce=>Z(ce.target.value):de,placeholder:s||"",disabled:i,onBlur:F,onFocus:S,onKeyDown:g,autoFocus:b,name:A,tabIndex:B,autoComplete:M,readOnly:E,required:L,"aria-invalid":!!a||void 0,"aria-describedby":Sn}),nn]}),u!=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:u})})]})}));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:u,children:i,label:l,allItemsTabbable:c=false,...p},R){let f=U(),[v,k]=useState(false),C=useRef(null),T=typeof f.spacing.xs=="number"?`${f.spacing.xs}px`:String(f.spacing.xs),h=t==="outlined"?f.surface.panelBg:t==="subtle"?f.surface.subtleBg??f.neutral[50]:"transparent",d=s?void 0:css({background:h,border:t==="outlined"?`${f.componentHeights.border} solid ${f.surface.border}`:"none",borderRadius:f.radius.lg,"--pfui-panel-pad":T,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",y=useMemo(()=>({isKeyboardNav:v,setIsKeyboardNav:k}),[v]),N=useMemo(()=>({allItemsTabbable:c}),[c]),x=useCallback(S=>Array.from(S.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(g=>{if(g.closest('[role="menu"]')!==S)return false;let b=window.getComputedStyle(g);return b.display!=="none"&&b.visibility!=="hidden"}),[]),w=useCallback(S=>{S.removeAttribute("data-keyboard-nav"),S.querySelectorAll("[data-highlighted]").forEach(g=>g.removeAttribute("data-highlighted")),k(false);},[]),P=useRef(false),$=useCallback(S=>{if(S.target!==S.currentTarget)return;if(P.current){P.current=false;return}let g=S.currentTarget,b=x(g);b.length>0&&(k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(A=>A.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(A=>A.removeAttribute("data-hovered")),b[0].setAttribute("data-highlighted",""),b[0].focus({preventScroll:true}));},[x]),W=useCallback(S=>{let g=S.currentTarget,b=x(g);if(b.length===0)return;if(S.key==="Tab"){P.current=true,g.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),k(false),g.tabIndex=-1,requestAnimationFrame(()=>{g.tabIndex=0,P.current=false;});return}let A=g.querySelector("[data-highlighted]"),H=g.querySelector("[data-hovered]"),B=A||H,M=B?b.indexOf(B):-1;if(S.key==="ArrowDown"||S.key==="ArrowUp"){S.preventDefault(),S.stopPropagation(),k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(z=>z.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(z=>z.removeAttribute("data-hovered")),M===-1&&(M=S.key==="ArrowDown"?-1:b.length);let E=S.key==="ArrowDown"?1:-1,L=(M+E+b.length)%b.length;b[L].setAttribute("data-highlighted",""),b[L].focus({preventScroll:true});return}if(S.key==="Home"){S.preventDefault(),S.stopPropagation(),k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),b[0].setAttribute("data-highlighted",""),b[0].focus({preventScroll:true});return}if(S.key==="End"){S.preventDefault(),S.stopPropagation(),k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),b[b.length-1].setAttribute("data-highlighted",""),b[b.length-1].focus({preventScroll:true});return}if(S.key==="Escape"){S.preventDefault(),g.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),k(false),g.blur();return}},[x]),K=useCallback(S=>{let g=S.currentTarget;g.hasAttribute("data-keyboard-nav")&&w(g);},[w]),I=useCallback(S=>{let g=S.currentTarget;g.hasAttribute("data-keyboard-nav")&&w(g);},[w]),F=useCallback(S=>{C.current=S,typeof R=="function"?R(S):R&&(R.current=S);},[R]);return jsx(oo.Provider,{value:y,children:jsx(ro.Provider,{value:N,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":v?"":void 0,tabIndex:0,"aria-label":l||void 0,className:["plainframe-ui-menu",a||""].join(" ").trim(),css:[d,u],onFocus:$,onKeyDown:W,onPointerMove:K,onPointerDown:I,...p,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 Nu(e,t){e&&(typeof e=="function"?e(t):e.current=t);}var io=(...e)=>t=>{for(let n of e)Nu(n,t);},cs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Du=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}},Hu=({open:e,defaultOpen:t,onOpenChange:n,triggerOn:o="click",lockScroll:r=true,trapFocus:s=true,children:a})=>{let[u,i]=useState(!!t),l=e??u,c=C=>{e===void 0&&i(C),n?.(C);},p=useRef(null),R=useRef(null),f=(C=120)=>{R.current!=null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>c(false),C);},v=()=>{R.current!=null&&(window.clearTimeout(R.current),R.current=null);};Du(r&&l),useEffect(()=>{if(!s||!l||typeof document>"u")return;let C=T=>{if(T.key!=="Tab")return;let h=document.querySelector(".plainframe-ui-popover");if(!h)return;let d=Array.from(h.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(x=>{let w=window.getComputedStyle(x);return w.display!=="none"&&w.visibility!=="hidden"});if(d.length===0)return;let m=d[0],y=d[d.length-1],N=document.activeElement;T.shiftKey&&N===m?(T.preventDefault(),y.focus()):!T.shiftKey&&N===y&&(T.preventDefault(),m.focus());};return document.addEventListener("keydown",C,true),()=>document.removeEventListener("keydown",C,true)},[s,l]);let k=useMemo(()=>({open:l,setOpen:c,triggerOn:o,referenceRef:p,scheduleClose:f,cancelClose:v}),[l,o]);return jsx(ii.Provider,{value:k,children:a})},li=forwardRef(({asChild:e=true,children:t,css:n},o)=>{let{open:r,setOpen:s,triggerOn:a,referenceRef:u,scheduleClose:i,cancelClose:l}=or(),c=me.Children.only(t),p=c.props||{},R=io(u,o,c.ref),f=a==="click"?{onClick:k=>{k.stopPropagation(),s(!r),p.onClick?.(k);}}:{onMouseEnter:k=>{l(),r||s(true),p.onMouseEnter?.(k);},onMouseLeave:k=>{i(),p.onMouseLeave?.(k);}},v={"aria-haspopup":"dialog","aria-expanded":r};if(e){let k=c.props?.css;return me.cloneElement(c,{...f,...v,ref:R,css:[k,n].filter(Boolean)})}return me.createElement("button",{ref:R,type:"button",css:[n],...f,...v,children:c})});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),u=io(s,r,a.ref);if(e){let l=a.props?.css;return me.cloneElement(a,{ref:u,css:[l,n].filter(Boolean)})}let i=css({display:"inline-block",width:cs(t),verticalAlign:"middle",...n});return jsx("span",{ref:u,css:i,children:a})});ci.displayName="PopoverAnchor";function Lu(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:u,padding:i,paddingX:l,paddingY:c,radius:p="lg",css:R,...f},v)=>{let{open:k,setOpen:C,triggerOn:T,referenceRef:h,scheduleClose:d,cancelClose:m}=or(),y=U(),N=Lu(e),{refs:x,x:w,y:P,strategy:$,context:W}=useFloating({open:k,onOpenChange:C,whileElementsMounted:autoUpdate,placement:N,strategy:"fixed",middleware:[offset({mainAxis:t,crossAxis:n}),flip({padding:o}),shift({padding:o})]});useEffect(()=>{h.current&&x.setReference(h.current);},[x,h]);let K=useDismiss(W,{outsidePressEvent:"pointerdown",escapeKey:true}),I=useRole(W,{role:"dialog"}),{getFloatingProps:F}=useInteractions([K,I]),[S]=W.placement.split("-"),g=S,b=`${g==="left"?"right":g==="right"?"left":"center"} ${g==="top"?"bottom":g==="bottom"?"top":"center"}`,A=8,H=g==="top"?{y:A}:g==="bottom"?{y:-A}:g==="left"?{x:A}:{x:-A},B={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"}}},M=y.surface.panelBg,E=y.text.primary,L=`${y.componentHeights.border} solid ${y.surface.border}`,z=tr(i,y.spacing),O=tr(l,y.spacing),_=tr(c,y.spacing),D={};z&&(D.padding=z),O&&(D.paddingInline=O),_&&(D.paddingBlock=_);let V=tr(p,y.radius)??y.radius.md,J="0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)",ae=css({position:$,top:P??0,left:w??0,zIndex:1e3,transformOrigin:b,pointerEvents:"auto",display:"inline-flex",flexDirection:"column",width:cs(a)??"fit-content",height:cs(u)??"fit-content",boxSizing:"border-box",willChange:"opacity, transform"}),q=r?css({}):css({background:M,color:E,border:L,borderRadius:V,boxShadow:J,...D,...D.padding||D.paddingInline||D.paddingBlock?{}:{padding:typeof y.spacing?.sm=="number"?`${y.spacing.sm}px ${y.spacing.md}px`:`${y.spacing?.sm??"0.5rem"} ${y.spacing?.md??"1rem"}`}}),X=T==="hover"?{onMouseEnter:m,onMouseLeave:()=>d()}:{},le=io(x.setFloating,v),ie=jsx(motion.div,{className:"plainframe-ui-popover",...F({...f,ref:le,...X}),...B,css:[ae,q,R],children:s});return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:k?ie:null})})});ui.displayName="PopoverContent";var Bu=()=>{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:u,css:i,trackCss:l,thumbCss:c,labelCss:p,...R},f){let v=U(),k=xe(),C={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}},T={slideMs:250,pressMs:150,easing:"ease"},h=t!==void 0,[d,m]=useState(n),y=h?!!t:d,[N,x]=useState(false);useEffect(()=>{if(r)return;x(true);let O=setTimeout(()=>x(false),T.pressMs);return ()=>clearTimeout(O)},[y,r]);let w=["sm","md","lg"].includes(s)?s:"md",P=C[w],$=`${T.slideMs}ms ${T.easing}`,W=v.palette?.primary?.[600]??v.neutral[900],K=v.neutral[300],I=y?W:K,F=y?v.text.onColors.primary:"#ffffff",{trackW:S,trackH:g,thumb:b}=P,A=(g-b)/2,H=css({display:"inline-flex",alignItems:"center",gap:P.labelGap,cursor:r?"not-allowed":"pointer",width:"fit-content",padding:v.spacing.xs,borderRadius:v.radius.sm,outline:"none"}),B=css({position:"relative",width:S,height:g,backgroundColor:I,borderRadius:v.radius.full,transition:`background-color ${$}, opacity 120ms ease`,willChange:"background-color",cursor:r?"not-allowed":"pointer",opacity:r?.5:1}),M=css({position:"absolute",top:A,left:y?S-b-A:A,width:b,height:b,backgroundColor:F,borderRadius:v.radius.full,transition:`left ${$}, transform ${$}, background-color 0.25s ease`,transform:N?"scaleX(1.2)":"scaleX(1)",transformOrigin:y?"right center":"left center"}),E=css({fontSize:v.typography.sizes.sm,fontWeight:500,color:r?v.text.muted:v.text.primary}),L=()=>{if(r)return;let O=!y;h||m(O),o?.(O);};return jsxs("label",{ref:f,role:"switch","aria-checked":y,"aria-disabled":r||void 0,"data-checked":y?"":void 0,"data-disabled":r?"":void 0,tabIndex:r?-1:0,onClick:L,onKeyDown:O=>{r||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),L());},className:["plainframe-ui-switch",u||""].join(" ").trim(),css:[H,k({color:y?"primary":"neutral"}),i],...R,children:[jsx("div",{className:"plainframe-ui-switch-track",css:[B,l],children:jsx("div",{className:"plainframe-ui-switch-thumb",css:[M,c]})}),a!=null&&jsx("span",{className:"plainframe-ui-switch-label",css:[E,p],children:a})]})}));var Vu=(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:u=false,checkedIcon:i,color:l="primary",css:c,boxCss:p,checkCss:R,labelCss:f,descriptionCss:v,className:k,...C},T)=>{let h=U(),d=xe(),m=typeof e=="boolean",[y,N]=useState(t),x=m?e:y,w=r==="sm"||r==="lg"?r:"md",P=useMemo(()=>Vu(h,w),[h,w]),{checkedBg:$,checkColor:W,borderCol:K,hoverBg:I,gapPx:F}=useMemo(()=>{let O=h.palette||{},_=h.neutral||{},D=h.text?.onColors||{},V,J;l==="neutral"||l==="secondary"?(V=_,J="neutral"):typeof l=="string"&&Object.prototype.hasOwnProperty.call(O,l)?(V=O[l]||O.primary||_,J=l):(V=O.primary||_,J="primary");let ae=V[600]??V[500]??V[400]??Object.values(V)[0]??h.palette.primary[600],q=D[J]??D.primary??h.text?.onColors?.primary??h.text.primary,X=typeof P.gap=="number"?P.gap+2:P.gap;return {checkedBg:ae,checkColor:q,borderCol:h.surface.border,hoverBg:h.surface.panelHover,gapPx:X}},[P.gap,l,h]),S=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:h.radius.sm,padding:h.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:K,backgroundColor:I},"input:checked + .plainframe-ui-checkbox-box":{backgroundColor:$,outlineColor:$,"--pfui-bleed":$},'&:not([data-disabled="true"]):hover input:checked + .plainframe-ui-checkbox-box':{outlineColor:$,backgroundColor:$,"--pfui-bleed":$},".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)"}}),[K,$,a,o,F,I,s,h.radius.sm,h.spacing.xs]),g=useMemo(()=>css({position:"absolute",opacity:0,width:0,height:0,margin:0,padding:0,pointerEvents:"none"}),[]),b=useMemo(()=>css({width:P.box,height:P.box,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",outline:`${P.borderWidth} solid ${K}`,outlineOffset:`-${P.borderWidth}`,boxShadow:"inset 0 0 0 0.5px var(--pfui-bleed, transparent)",borderRadius:u?h.radius.full:P.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"}),[P.box,P.borderRadius,P.borderWidth,K,u,h.radius.full]),A=useMemo(()=>({w:Math.round(P.box*P.iconRatioW),h:Math.round(P.box*P.iconRatioH)}),[P.box,P.iconRatioH,P.iconRatioW]),H=useMemo(()=>css({width:A.w,height:A.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,A.h,A.w]),B=useMemo(()=>css({display:"flex",flexDirection:"column",minWidth:0,userSelect:"text",WebkitUserSelect:"text"}),[]),M=useMemo(()=>css({fontSize:P.labelFont,lineHeight:1.1,fontWeight:500,userSelect:"text",WebkitUserSelect:"text",color:h.text.primary}),[P.labelFont,h.text.primary]),E=useMemo(()=>css({fontSize:P.labelFont,lineHeight:1.25,color:h.text.secondary,fontWeight:400,marginTop:s&&a?h.spacing.xs:0,userSelect:"text",WebkitUserSelect:"text"}),[P.labelFont,a,s,h.spacing.xs,h.text.secondary]),L=useCallback(()=>{o||(m?n?.(!x):N(O=>{let _=!O;return n?.(_),_}));},[o,m,x,n]),z=useCallback(O=>{o||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),L());},[o,L]);return jsxs("label",{ref:T,role:"checkbox","aria-checked":x,"aria-disabled":o||void 0,"data-state":x?"checked":"unchecked",className:["plainframe-ui-checkbox",k||""].join(" ").trim(),css:[S,d({color:x?"primary":"neutral"}),c,o?css({opacity:.6}):null],"data-disabled":o?"true":"false",tabIndex:o?-1:0,onKeyDown:z,children:[jsx("input",{type:"checkbox",checked:x,onChange:L,disabled:o,css:g,...C,tabIndex:-1}),jsx("span",{className:"plainframe-ui-checkbox-box",css:[b,p],"aria-hidden":"true",children:jsx("span",{className:"plainframe-ui-checkbox-check",css:[H,R],children:x&&(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:B,children:[s&&jsx("span",{className:"plainframe-ui-checkbox-label",css:[M,f],children:s}),a&&jsx("span",{className:"plainframe-ui-checkbox-description",css:[E,v],children:a})]})]})}));sr.displayName="Checkbox";var Gu=()=>useContext(fn),Xu=()=>useContext(ro),Yu=()=>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:u,css:i,startIcon:l,endIcon:c,selected:p=false,active:R,meta:f,__index:v,__skipListReg:k,...C},T){let h=Gu(),d=Yu(),m=cr(),y=uo(),N=Xu(),x=U(),P=!!useContext(Tt),$=C["data-subtrigger"]!==void 0,W=$&&c===void 0?jsx(ChevronRight,{size:18,strokeWidth:2.5}):c,I=typeof o=="number"?o:o===false?0:0,F=useContext(er),S=F==="subtle"?x.surface?.subtleHover??x.neutral[100]:x.surface?.subtleBg??x.neutral[100],g=useMemo(()=>css({width:"100%",borderRadius:x.radius.md,padding:`${x.spacing.sm} ${x.spacing.sm}`,paddingLeft:I>0?`calc(${x.spacing.md} + (${x.spacing.xl} * ${I}))`:x.spacing.md,minHeight:P?x.componentHeights.sm:x.componentHeights.md,display:"flex",alignItems:"center",gap:x.spacing.sm,fontWeight:500,fontSize:x.typography.sizes.sm,cursor:t?"not-allowed":"pointer",opacity:t?.55:1,userSelect:"none",background:"transparent",color:n?x.palette.danger[800]:x.text.primary,transition:"background-color .16s ease, color .16s ease",outline:"none","[role='menu']:not([data-keyboard-nav]) &:hover":t?{}:{background:n?x.palette.danger[50]:S},"&[data-highlighted]":t?{}:{background:n?x.palette.danger[50]:S},"&[data-active]":t?{}:{background:n?x.palette.danger[50]:S},"&[data-subtrigger][aria-expanded='true']":t?{}:{background:n?x.palette.danger[50]:S},"[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:x.surface.border},"& > [data-label]":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),[x,P,I,t,n,S]),b=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:x.spacing.sm,"& > svg":{width:16,height:16,display:"block"},color:x.text.secondary}),[x.text.secondary,x.spacing.sm]),H=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:x.palette.primary[600],"& > svg":{width:16,height:16,display:"block"}}),[x.palette.primary]),B=[];P&&B.push({minHeight:x.componentHeights.sm,paddingLeft:x.spacing.sm,paddingRight:x.spacing.xs,paddingTop:x.spacing.xs,paddingBottom:x.spacing.xs});let M=()=>{s?.(),r&&!$&&d?.closeAll();},E=(z,O)=>{let _=z.closest('[role="menu"]');if(!_)return;let D=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(X=>{if(X.closest('[role="menu"]')!==_)return false;let le=window.getComputedStyle(X);return le.display!=="none"&&le.visibility!=="hidden"});if(!D.length)return;let V=D.indexOf(z),J=V>=0?V:0,ae=O(D.length,J),q=D[ae];q&&(document.querySelectorAll("[data-highlighted]").forEach(X=>{X.removeAttribute("data-highlighted");}),q.setAttribute("data-highlighted",""),q.focus(),h&&v!=null&&h.setActiveIndex(ae));},L=t?-1:N?.allItemsTabbable?0:-1;return jsxs("div",{role:"menuitem","aria-disabled":t||void 0,"data-disabled":t?"":void 0,"data-active":R?"":void 0,tabIndex:L,ref:z=>{if(h&&!k){let O=h.listRef.current;z&&(v!=null?O[v]=z:O.includes(z)||O.push(z));}typeof T=="function"?T(z):T&&"current"in T&&(T.current=z);},onMouseMove:z=>{if(z.currentTarget.hasAttribute("data-hovered"))return;let O=!!z.currentTarget.closest("[data-submenu-content]");!$&&m&&!O&&gi(m.closeAllSubMenus),document.querySelectorAll("[data-hovered]").forEach(D=>{D.removeAttribute("data-hovered");}),document.querySelectorAll("[data-highlighted]").forEach(D=>{D.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-active]").forEach(D=>{D.removeAttribute("data-active");}),z.currentTarget.setAttribute("data-hovered","");let _=z.currentTarget.closest("[data-menu-id]")||z.currentTarget.closest('[role="menu"]');_?.hasAttribute("data-keyboard-nav")&&_.removeAttribute("data-keyboard-nav"),!t&&h&&v!=null&&h.setActiveIndex(v),!t&&!N?.allItemsTabbable&&z.currentTarget.focus({preventScroll:true});},onMouseEnter:z=>{if($)lo();else {let D=!!z.currentTarget.closest("[data-submenu-content]");m&&!D&&gi(m.closeAllSubMenus);}z.currentTarget.hasAttribute("data-hovered")||(document.querySelectorAll("[data-highlighted]").forEach(D=>{D.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-hovered]").forEach(D=>{D.removeAttribute("data-hovered");}),document.querySelectorAll("[data-active]").forEach(D=>{D.removeAttribute("data-active");})),z.currentTarget.setAttribute("data-hovered","");let _=z.currentTarget.closest("[data-menu-id]")||z.currentTarget.closest('[role="menu"]');!t&&h&&v!=null&&(_?.hasAttribute("data-keyboard-nav")&&(_.removeAttribute("data-keyboard-nav"),y&&y.setIsKeyboardNav(false)),h.setActiveIndex(v)),!t&&!N?.allItemsTabbable&&z.currentTarget.focus({preventScroll:true});},onFocus:()=>{},onMouseLeave:()=>{h&&h.setActiveIndex(null);},onKeyDown:z=>{if(t)return;let O=z.currentTarget;if(z.key==="Tab"&&h&&!N?.allItemsTabbable){z.preventDefault();return}if(z.key==="Tab"&&!h){let _=O.closest('[role="menu"]');if(_){_.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(V=>V.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(V=>V.removeAttribute("data-hovered"));let D=_.tabIndex;_.tabIndex=-1,requestAnimationFrame(()=>{_.tabIndex=D>=0?D:0;});}y&&y.setIsKeyboardNav(false);return}if(z.key==="Enter"||z.key===" "||z.key==="ArrowRight"){$||z.key!=="ArrowRight"&&(z.preventDefault(),z.stopPropagation(),M());return}if(z.key==="ArrowLeft"&&O.closest('[role="menu"]')?.closest("[data-submenu-content]")){z.preventDefault(),z.stopPropagation();let V=document.querySelector('[data-subtrigger][aria-expanded="true"]');if(V){let J=V.__pfuiCloseSubmenu;J&&J(),document.querySelectorAll("[data-highlighted]").forEach(q=>q.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(q=>q.removeAttribute("data-hovered")),V.setAttribute("data-highlighted",""),V.focus();let ae=V.closest("[data-menu-id]");ae&&ae.setAttribute("data-keyboard-nav","");}return}if(z.key==="Escape"){z.preventDefault(),z.stopPropagation(),d?.closeAll(),O.closest('[role="menu"]')&&document.querySelector('[aria-expanded="true"][aria-haspopup="menu"]')?.focus();return}if(z.key==="ArrowDown"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),y&&y.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,(D,V)=>(V+1)%D);return}if(z.key==="ArrowUp"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),y&&y.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,(D,V)=>(V-1+D)%D);return}if(z.key==="Home"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,()=>0);return}if(z.key==="End"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,D=>D-1);return}},className:["plainframe-ui-menu-item",u||""].join(" ").trim(),css:css(...[g,...B,i].flat()),...C,onClick:z=>{t||(z.currentTarget.removeAttribute("data-highlighted"),M());},children:[l&&jsx("span",{className:"plainframe-ui-menu-item-start",css:b,children:l}),a,(f!=null||W||p)&&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:x.typography.sizes.sm,color:x.text.secondary,whiteSpace:"nowrap"}),children:f}):null,W,p&&jsx("span",{className:"plainframe-ui-menu-item-selected",css:H,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,u=a?e:r,i=useRef(u);i.current=u;let l=useRef(n);l.current=n;let c=useCallback(R=>{let f=i.current,k=f.some(C=>Object.is(C,R))?f.filter(C=>!Object.is(C,R)):[...f,R];a||s(k),l.current?.(k);},[a]),p=useMemo(()=>({values:u,toggle:c}),[u,c]);return jsx(hi.Provider,{value:p,children:o})},co=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,value:r,children:s,__index:a,disabled:u=false,css:i,className:l,startIcon:c,endIcon:p,...R},f){let v=useContext(hi),k=!!v&&r!==void 0,C=!k&&t!==void 0,[T,h]=useState(()=>k?v.values.some(K=>Object.is(K,r)):!!n),d=k?v.values.some(K=>Object.is(K,r)):C?!!t:T,m=U(),N=!!useContext(Tt),x=()=>{if(!u)if(k)v.toggle(r);else {let K=!d;C||h(K),o?.(K);}},w=css({width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,marginLeft:N?-1:-3,borderRadius:m.radius.xs,transition:"background-color .12s ease"}),P=css({pointerEvents:"none"}),$=useCallback(K=>{K&&(K.querySelectorAll("[tabindex]").forEach(I=>{I.tabIndex=-1;}),K.querySelectorAll('input, button, a, [role="checkbox"]').forEach(I=>{I.tabIndex=-1;}));},[]),W=jsxs(Fragment,{children:[jsx("span",{ref:$,"data-menu-checkbox-wrapper":true,className:"plainframe-ui-menu-checkbox-wrapper",css:w,"aria-hidden":"true",children:jsx(sr,{size:"sm",checked:d,css:P})}),c]});return jsx(pn,{...R,className:["plainframe-ui-menu-checkbox-item",l||""].join(" ").trim(),ref:f,__index:a,role:"menuitemcheckbox","aria-checked":d,closeOnSelect:false,onSelect:x,disabled:u,startIcon:W,endIcon:p,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:u,switchSize:i="md",switchCss:l,startIcon:c,className:p,...R},f){let v=t!==void 0,[k,C]=useState(!!n),T=v?!!t:k,d=!!useContext(Tt),m=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),y=css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,paddingRight:d?2:void 0}),N=()=>{if(a)return;let w=!T;v||C(w),o?.(w);},x=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,{...R,className:["plainframe-ui-menu-switch-item",p||""].join(" ").trim(),ref:f,__index:s,disabled:a,closeOnSelect:false,onSelect:N,css:u,selected:false,children:[c&&jsx("span",{className:"plainframe-ui-menu-item-start",css:x,children:c}),jsx("span",{"data-label":true,css:m,className:"plainframe-ui-menu-item-label",children:r}),jsx("span",{className:"plainframe-ui-menu-switch-wrap",css:y,children:jsx(ms,{checked:T,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,u=l=>{e!==void 0||s(l),n?.(l);},i=useMemo(()=>({value:a,onChange:u}),[a]);return jsx(xi.Provider,{value:i,children:o})};lr.displayName="MenuRadioGroup";var Ju=forwardRef(function({value:t,children:n,__index:o,disabled:r=false,css:s,className:a,...u},i){let l=useContext(xi),c=l?.value===t,p=U(),R=css({width:p.spacing.md,display:"inline-flex",justifyContent:"center",alignItems:"center",marginLeft:-1}),f=css({width:7,height:7,borderRadius:"100%",backgroundColor:p.palette.primary[600],transform:c?"scale(1)":"scale(0.4)",opacity:c?1:0,transition:"transform 140ms ease-out, opacity 140ms linear",transformOrigin:"center center"}),v=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"});return jsxs(pn,{...u,className:["plainframe-ui-menu-radio-item",a||""].join(" ").trim(),ref:i,__index:o,role:"menuitemradio","aria-checked":c,closeOnSelect:false,onSelect:()=>{r||l?.onChange?.(t);},disabled:r,css:s,selected:false,children:[jsx("span",{className:"plainframe-ui-menu-radio-dotbox",css:R,children:jsx("span",{className:"plainframe-ui-menu-radio-dot",css:f})}),jsx("span",{className:"plainframe-ui-menu-item-label",css:v,children:n})]})}),mn=forwardRef(function({inset:t,className:n,css:o,children:r,startIcon:s,endIcon:a,wrap:u=false,color:i="primary",...l},c){let p=U(),f=!!useContext(Tt),v=i==="primary"?p.text.primary:i==="secondary"?p.text.secondary:p.palette[i]?.[700]??p.text.primary,k=css({display:"flex",alignItems:"center",padding:f?`${p.spacing.sm} ${p.spacing.md}`:`${p.spacing.sm} ${p.spacing.md}`,fontSize:p.typography.sizes.sm,color:v,fontWeight:500,...t?{paddingLeft:`calc(${p.spacing.lg} * 2)`}:null,gap:p.spacing.xs}),C=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:u?"normal":"nowrap"}),T=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"}}),h=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:c,role:"presentation",className:["plainframe-ui-menu-label",n||""].join(" ").trim(),css:css(k,o),...l,children:[s&&jsx("span",{className:"plainframe-ui-menu-label-start",css:T,children:s}),jsx("span",{className:"plainframe-ui-menu-label-text",css:C,children:r}),a&&jsx("span",{className:"plainframe-ui-menu-label-end",css:h,children:a})]})});mn.displayName="MenuLabel";var Zu=({className:e,css:t,variant:n="full",...o})=>{let r=U(),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)"}),u=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"?u: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,dd=()=>typeof window>"u"||typeof document>"u"?0:window.innerWidth-document.documentElement.clientWidth;function pd(){if(!(typeof document>"u")){if(po===0){let e=document.body;dr=e.style.overflow||"",pr=e.style.paddingRight||"";let t=dd();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}po+=1;}}function md(){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),fd=()=>useContext(mo),oo=createContext(null),uo=()=>useContext(oo),Ci=createContext(null),cr=()=>useContext(Ci),Ri=createContext(false),gd=()=>useContext(Ri),ro=createContext({allItemsTabbable:true}),ur=me.createContext(null),hs=()=>useContext(ur);function bd(){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 hd=()=>fd()?.activeIndex??null,Ti=0,$n=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="click",lockScroll:r=true,size:s="md",children:a})=>{let[u,i]=useState(!!t),l=e??u,c=useCallback(F=>{e===void 0&&i(F),n?.(F);},[e,n]),p=useRef(`pfui-menu-${++Ti}`),R=useRef(null),f=useRef([]),v=useRef(null),[k,C]=useState(null),[T,h]=useState(false);useEffect(()=>{l||(C(null),f.current=[],h(false));},[l]);let d=useRef(null),m=useCallback((F,S)=>{if(o!=="hover")return;window.clearTimeout(d.current??0);let g=S??20;d.current=window.setTimeout(()=>c(F),g);},[o,c]),y=useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null);},[]);useEffect(()=>()=>y(),[y]),useEffect(()=>{if(!(!r||!l))return pd(),()=>md()},[l,r]);let N=hs(),[x]=useState(()=>N??bd()),w=useRef(new Set),P=useMemo(()=>({registerSubMenu:F=>(w.current.add(F),()=>w.current.delete(F)),closeAllSubMenus:()=>{w.current.forEach(F=>F());}}),[]),$=useMemo(()=>({open:l,setOpen:c,trigger:o,referenceRef:R,listRef:f,floatingRef:v,setActiveIndex:C,scheduleSubmenuHover:m,clearSubmenuHover:y,menuId:p.current}),[l,c,o,C,m,y]),W=useMemo(()=>({activeIndex:k,setActiveIndex:C}),[k,C]),K=useMemo(()=>({isKeyboardNav:T,setIsKeyboardNav:h}),[T]),I=s==="sm";return jsx(ur.Provider,{value:x,children:jsx(Tt.Provider,{value:I,children:jsx(oo.Provider,{value:K,children:jsx(Ci.Provider,{value:P,children:jsx(mo.Provider,{value:W,children:jsx(fn.Provider,{value:$,children:a})})})})})})};$n.displayName="DropdownMenu";var zn=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:u,setOpen:i,trigger:l,referenceRef:c,listRef:p,setActiveIndex:R,scheduleSubmenuHover:f,clearSubmenuHover:v,floatingRef:k,menuId:C}=mr(),T=uo(),h=cr(),d=!!e&&isValidElement(t),m=d?t:null,y=m&&m.props&&typeof m.props=="object"&&"onKeyDown"in m.props?m.props.onKeyDown:void 0,N=m&&m.props&&typeof m.props=="object"&&"onClick"in m.props?m.props.onClick:void 0,{onKeyDown:x,onClick:w,...P}=s,$=useMemo(()=>bs(a,d&&isValidElement(t)&&"ref"in t?t.ref:void 0,c),[a,d,t,c]),W=useCallback(()=>p.current.filter(Boolean),[p]),K=useCallback(b=>{let A=W();requestAnimationFrame(()=>A[b]?.focus());},[W]),I=useCallback(b=>{if(b.key==="Tab"&&u){b.preventDefault(),T?.setIsKeyboardNav(true);let A=k?.current;if(A){A.setAttribute("data-keyboard-nav","");let H=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])');H&&(document.querySelectorAll("[data-highlighted]").forEach(B=>B.removeAttribute("data-highlighted")),H.setAttribute("data-highlighted",""),H.focus());}return}if(b.key==="ArrowRight"&&u){let A=document.querySelector("[data-subtrigger][data-hovered]");if(A){b.preventDefault(),b.stopPropagation(),T?.setIsKeyboardNav(true),A.removeAttribute("data-hovered"),A.setAttribute("data-highlighted",""),A.focus(),requestAnimationFrame(()=>{let H=new KeyboardEvent("keydown",{key:"ArrowRight",bubbles:true,cancelable:true});A.dispatchEvent(H);});return}}if(b.key==="ArrowDown"||b.key==="ArrowUp"){if(T?.setIsKeyboardNav(true),!u){b.preventDefault(),i(true),requestAnimationFrame(()=>{let A=C?document.querySelector(`[data-menu-id="${C}"]`):k?.current;if(A){A.setAttribute("data-keyboard-nav","");let H=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(B=>{let M=B.closest("[data-submenu-content]");if(M&&M!==A)return false;let E=window.getComputedStyle(B);return E.display!=="none"&&E.visibility!=="hidden"});if(H.length>0){let B=b.key==="ArrowDown"?0:H.length-1;R(B),H[B]?.setAttribute("data-highlighted",""),H[B]?.focus();}}}),y?.(b),x?.(b);return}if(u){b.preventDefault();let A=document.querySelectorAll("[data-hovered]");for(let B of Array.from(A))if(B.closest("[data-submenu-content]")){let E=B.closest('[role="menu"]');if(E){E.setAttribute("data-keyboard-nav","");let L=Array.from(E.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')).filter(O=>{if(O.closest('[role="menu"]')!==E)return false;let _=window.getComputedStyle(O);return _.display!=="none"&&_.visibility!=="hidden"}),z=L.indexOf(B);if(document.querySelectorAll("[data-highlighted]").forEach(O=>O.removeAttribute("data-highlighted")),B.removeAttribute("data-hovered"),z!==-1&&L.length>0){let O=b.key==="ArrowDown"?1:-1,_=(z+O+L.length)%L.length;L[_]?.setAttribute("data-highlighted",""),L[_]?.focus();}return}}let H=C?document.querySelector(`[data-menu-id="${C}"]`):k?.current;if(H){H.setAttribute("data-keyboard-nav",""),h?.closeAllSubMenus();let B=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(M=>{if(M.closest('[role="menu"]')!==H)return false;let E=window.getComputedStyle(M);return E.display!=="none"&&E.visibility!=="hidden"});if(B.length>0){let M=H.querySelector("[data-highlighted]"),E=H.querySelector("[data-hovered]"),L=-1;M?L=B.indexOf(M):E&&(L=B.indexOf(E)),document.querySelectorAll("[data-highlighted]").forEach(_=>_.removeAttribute("data-highlighted")),E&&E.removeAttribute("data-hovered"),L===-1&&(L=b.key==="ArrowDown"?-1:B.length);let z=b.key==="ArrowDown"?1:-1,O=(L+z+B.length)%B.length;R(O),B[O]?.setAttribute("data-highlighted",""),B[O]?.focus();}}y?.(b),x?.(b);return}}if((b.key==="Enter"||b.key===" ")&&!u){b.preventDefault(),T?.setIsKeyboardNav(true),i(true),requestAnimationFrame(()=>{let A=C?document.querySelector(`[data-menu-id="${C}"]`):k?.current;if(A){A.setAttribute("data-keyboard-nav","");let H=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(B=>{let M=B.closest("[data-submenu-content]");if(M&&M!==A)return false;let E=window.getComputedStyle(B);return E.display!=="none"&&E.visibility!=="hidden"});H.length>0&&(R(0),H[0]?.setAttribute("data-highlighted",""),H[0]?.focus());}}),y?.(b),x?.(b);return}y?.(b),x?.(b);},[u,i,R,y,x,W,K,p,T,C,k,h]),F=useCallback(b=>{l==="click"&&((b.nativeEvent.composedPath?.()??[]).some(M=>{let E=M;if(!E||!("tagName"in E))return false;let L=String(E.tagName).toUpperCase();if(L==="INPUT"||L==="TEXTAREA"||"isContentEditable"in E&&E.isContentEditable)return true;let z="getAttribute"in E?E.getAttribute("role"):null;return z==="textbox"||z==="combobox"})||(b.stopPropagation(),i(!u))),N?.(b),w?.(b);},[l,u,i,N,w]),S=l==="hover"?{onMouseEnter:()=>{v(),i(true);},onMouseLeave:()=>{f(false);}}:{},g=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0;if(d&&m){let b=m.props,A=b.css,H=typeof b.className=="string"?b.className:void 0,B=typeof b.tabIndex=="number"?b.tabIndex:0,M={ref:$,tabIndex:B,className:[H,o].filter(Boolean).join(" ")||void 0,css:[A,g,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":u,onClick:F,onKeyDown:I,...S,...P};return cloneElement(m,M)}return jsx("button",{ref:$,className:o,css:[css({display:"inline-block"}),g,r],type:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":u,onClick:F,onKeyDown:I,...S,...P,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:u,height:i,maxHeight:l,unstyled:c=false,closeOnBlur:p=false,allItemsTabbable:R=false,className:f,css:v,children:k,exitPlacement:C,animateOnBusClose:T=true,gap:h,ignoreOutsidePressRefs:d,disableOutsidePressDismiss:m=false,returnFocus:y=false,...N},x)=>{let{open:w,setOpen:P,referenceRef:$,clearSubmenuHover:W,setActiveIndex:K,floatingRef:I,menuId:F}=mr(),S=U(),g=hs(),b=uo();useEffect(()=>{if(!g)return;let Y=g.registerCloser(()=>P(false));return ()=>{Y&&Y();}},[g,P]);let A=typeof o=="string"?parseFloat(o):o,H=typeof r=="string"?parseFloat(r):r,B=typeof s=="string"?parseFloat(s):s,M=`${t}${n==="center"?"":`-${n}`}`,E=useCallback(Y=>({getBoundingClientRect:()=>{let oe=Math.round(Y.x),re=Math.round(Y.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}),[]),L=useMemo(()=>{if(!e)return null;if(e instanceof HTMLElement||typeof e=="object"&&e!==null&&"getBoundingClientRect"in e&&typeof e.getBoundingClientRect=="function")return e;let Y=e;return E({x:Y.x,y:Y.y})},[e,E]),{refs:z,x:O,y:_,strategy:D,context:V,update:J}=useFloating({open:w,onOpenChange:P,placement:M,whileElementsMounted:autoUpdate,middleware:[offset({mainAxis:A??0,crossAxis:H??0}),flip({padding:B??8}),shift({padding:B??8}),size({apply({rects:Y,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"),u!=null?re.style.width=typeof u=="number"?`${u}px`:String(u):a?re.style.width=`${Math.round(Y.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(()=>{L?z.setReference(L):$.current&&z.setReference($.current);},[z,L,$]),useEffect(()=>{if(!w)return;let Y=L||$.current,oe=z.floating.current;if(!(!Y||!oe))return autoUpdate(Y,oe,J)},[w,L,$,z,J]),useEffect(()=>{J();},[J,a,u,i,l]),useEffect(()=>{w&&!R&&K(0);},[w,R,K]),useEffect(()=>{if(!p||!w)return;let Y=()=>{let oe=document.activeElement,re=$.current,qe=z.floating.current;oe&&(re?.contains(oe)||qe?.contains(oe)||P(false));};return document.addEventListener("focusin",Y,true),()=>document.removeEventListener("focusin",Y,true)},[p,w,P,$,z.floating]);let ae=useDismiss(V,{outsidePressEvent:"pointerdown",escapeKey:true,outsidePress:m?false:Y=>{if(d?.length){let oe=Y.target;for(let re of d)if(re.current?.contains(oe))return false}return true}}),q=useRole(V,{role:"menu"}),{getFloatingProps:X}=useInteractions([ae,q]),le=useRef(false);useEffect(()=>{w?le.current=true:le.current&&$.current&&y&&(g?.isBusClosingRef.current||requestAnimationFrame(()=>{$.current?.focus();}));},[w,$,g,y]);let ie=typeof S.spacing.xs=="number"?`${S.spacing.xs}px`:String(S.spacing.xs),be=h===void 0?void 0:typeof h=="number"?h:S.spacing[h]??h,Pe=c?void 0:css({boxSizing:"border-box",background:S.surface.panelBg,border:`${S.componentHeights.border} solid ${S.surface.border}`,borderRadius:S.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:S.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=Y=>{if(!Y||typeof Y!="object"||!isValidElement(Y))return Y;let re=Y.type?.displayName;if(re==="DropdownMenu"||re==="DropdownMenuSub")return Y;if(re==="MenuItem"||re==="MenuCheckboxItem"||re==="MenuRadioItem"||re==="MenuSwitchItem")return Re+=1,cloneElement(Y,{__index:Re,key:Y.key??Re});if(re==="DropdownMenuTrigger"){let j=Y.props.children;return cloneElement(Y,{children:me.Children.map(j,Ce)})}if(re==="DropdownMenuSubTrigger"){Re+=1;let j=Re;return cloneElement(Y,{__index:j,key:Y.key??j})}let qe=Y.props.children;return qe==null?Y:cloneElement(Y,{children:me.Children.map(qe,Ce)})},Ie=me.Children.map(k,Ce),we=V.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=C??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=!!g?.isBusClosingRef.current&&!T?{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:D,top:_??0,left:O??0,zIndex:1e3,transformOrigin:he}),pe=useCallback(Y=>{if(Y.key==="Tab"){Y.preventDefault();return}if(Y.key==="ArrowDown"||Y.key==="ArrowUp"){Y.preventDefault(),b?.setIsKeyboardNav(true);let oe=Y.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=Y.key==="ArrowDown"?-1:re.length);let de=Y.key==="ArrowDown"?1:-1,fe=(ue+de+re.length)%re.length;K(fe),re[fe]?.setAttribute("data-highlighted",""),re[fe]?.focus();}}},[b,K]),Se=useCallback(Y=>{let oe=Y.currentTarget;oe.removeAttribute("data-keyboard-nav"),oe.querySelectorAll("[data-highlighted]").forEach(re=>re.removeAttribute("data-highlighted")),b?.isKeyboardNav&&b.setIsKeyboardNav(false);},[b]),Ne=useCallback(Y=>{Y.removeAttribute("data-keyboard-nav"),Y.querySelectorAll("[data-highlighted]").forEach(oe=>oe.removeAttribute("data-highlighted")),b?.isKeyboardNav&&b.setIsKeyboardNav(false);},[b]);return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:w?jsx(ro.Provider,{value:{allItemsTabbable:R},children:jsx(motion.div,{...X({...N,ref:bs(x,z.setFloating,Y=>{I&&(I.current=Y);})}),"data-menu-id":F,"data-keyboard-nav":b?.isKeyboardNav?"":void 0,className:f,css:[Pe,se,v],initial:je,animate:{opacity:1,x:0,y:0,scale:1},exit:Ee,transition:ee,onPointerMove:Y=>Ne(Y.currentTarget),onPointerDown:Y=>Ne(Y.currentTarget),onKeyDown:pe,onMouseMove:Se,onMouseEnter:()=>{W(),g?.clearAllHover();},onMouseLeave:()=>{document.querySelectorAll("[data-hovered]").forEach(Y=>Y.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=gd(),[u,i]=useState(!!t),l=e??u,c=useCallback(I=>{e===void 0&&i(I),n?.(I);},[e,n]),p=useRef(null),R=useRef(false),f=useCallback((I,F)=>{if(o!=="hover")return;window.clearTimeout(p.current??0),R.current=I;let S=F??20;p.current=window.setTimeout(()=>{R.current=false,c(I);},S);},[o,c]),v=useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null,R.current=false);},[]);useEffect(()=>()=>v(),[v]);let k=cr();useEffect(()=>{if(!k)return;let I=()=>{v(),c(false);};return k.registerSubMenu(I)},[k,c,v]);let C=useRef(`pfui-submenu-${++Ti}`),T=useRef(null),h=useRef([]),d=useRef(null),[m,y]=useState(null),[N,x]=useState(false);useEffect(()=>{l||(y(null),h.current=[],x(false));},[l]);let w=useContext(Tt),P=r??w,$=useMemo(()=>({open:l,setOpen:c,trigger:o,referenceRef:T,listRef:h,floatingRef:d,setActiveIndex:y,scheduleSubmenuHover:f,clearSubmenuHover:v,pendingOpenRef:R,menuId:C.current}),[l,c,o,y,f,v]),W=useMemo(()=>({activeIndex:m,setActiveIndex:y}),[m,y]),K=useMemo(()=>({isKeyboardNav:N,setIsKeyboardNav:x}),[N]);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,I=>{if(!isValidElement(I))return I;let F=I.type;return F?.displayName==="DropdownMenuSubTrigger"||F?.displayName==="DropdownMenuSubContent"?null:I})})):jsx(Ri.Provider,{value:true,children:jsx(Tt.Provider,{value:P,children:jsx(mo.Provider,{value:W,children:jsx(oo.Provider,{value:K,children:jsx(fn.Provider,{value:$,children:s})})})})})};wi.displayName="DropdownMenuSub";var Ei=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:u,setOpen:i,trigger:l,referenceRef:c,scheduleSubmenuHover:p,clearSubmenuHover:R,pendingOpenRef:f,menuId:v}=mr(),k=uo(),C=useCallback(I=>{I&&(I.__pfuiCloseSubmenu=()=>i(false));},[i]),T=!!e&&isValidElement(t),h=T?t:null,d=h?.props,m=d?.onKeyDown,y=d?.onClick,{onKeyDown:N,onClick:x,...w}=s,P=useMemo(()=>bs(a,T&&isValidElement(t)&&"ref"in t?t.ref:void 0,c,C),[a,T,t,c,C]),$=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0,W=useCallback(I=>{if(I.key==="Tab"){I.preventDefault();return}let F=I.currentTarget,S=g=>{k?.setIsKeyboardNav(true);let b=F.closest("[data-menu-id]");if(!b)return;b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted"));let A=Array.from(b.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]")!==b)return false;let L=window.getComputedStyle(E);return L.display!=="none"&&L.visibility!=="hidden"});if(!A.length)return;let H=A.indexOf(F),B=H>=0?H:0,M=g==="next"?(B+1)%A.length:(B-1+A.length)%A.length;A[M]?.setAttribute("data-highlighted",""),A[M]?.focus();};if(I.key==="ArrowDown"){I.preventDefault(),I.stopPropagation(),u&&i(false),S("next");return}if(I.key==="ArrowUp"){I.preventDefault(),I.stopPropagation(),u&&i(false),S("prev");return}if(I.key==="ArrowRight"||I.key==="Enter"||I.key===" "){I.preventDefault(),I.stopPropagation(),k?.setIsKeyboardNav(true);let g=I.currentTarget;i(true),requestAnimationFrame(()=>{let b=v?document.querySelector(`[data-menu-id="${v}"]`):document.querySelector("[data-submenu-content]");if(b){b.setAttribute("data-keyboard-nav",""),g.removeAttribute("data-highlighted"),g.removeAttribute("data-hovered");let A=b.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(I.key==="ArrowLeft"){I.preventDefault(),I.stopPropagation(),u&&i(false);let g=F.closest("[data-menu-id]");g&&g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(b=>b.removeAttribute("data-hovered")),F.setAttribute("data-highlighted",""),F.focus(),k&&k.setIsKeyboardNav(true);return}if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),m?.(I);return}m?.(I),N?.(I);},[u,i,m,N,c,k,v]),K=l==="hover"?{onMouseEnter:I=>{let F=I.currentTarget;lo(),R(),document.querySelectorAll("[data-hovered]").forEach(g=>g.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(g=>g.removeAttribute("data-highlighted")),F.setAttribute("data-hovered",""),F.focus({preventScroll:true});let S=F.closest("[data-menu-id]");S?.hasAttribute("data-keyboard-nav")&&S.removeAttribute("data-keyboard-nav"),k&&k.setIsKeyboardNav(false),u||p(true,90);},onMouseMove:I=>{let F=I.currentTarget;lo(),F.hasAttribute("data-hovered")||(document.querySelectorAll("[data-hovered]").forEach(S=>S.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted")),F.setAttribute("data-hovered","")),!u&&!f?.current&&p(true,90);},onMouseLeave:()=>{p(false,60);}}:{onClick:I=>{I.stopPropagation(),i(!u),y?.(I),x?.(I);}};if(T&&h){let I=d?.css,F=typeof d?.className=="string"?d.className:void 0,S=typeof d?.tabIndex=="number"?d.tabIndex:0,g={ref:P,tabIndex:S,className:[F,o].filter(Boolean).join(" ")||void 0,css:[I,$,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":u,"data-subtrigger":"",__skipListReg:true,onKeyDown:W,onFocus:b=>{if(b.target.hasAttribute("data-highlighted")){let A=b.target.closest("[data-menu-id]");A&&!A.hasAttribute("data-keyboard-nav")&&(A.setAttribute("data-keyboard-nav",""),k&&k.setIsKeyboardNav(true));}d&&"onFocus"in d&&typeof d.onFocus=="function"&&d.onFocus(b);},...K,...w};return cloneElement(h,g)}return jsx("div",{ref:P,role:"menuitem",tabIndex:0,className:o,css:[css({display:"flex",alignItems:"center",gap:8,cursor:"pointer"}),$,r],"aria-haspopup":"menu","aria-expanded":u,"data-subtrigger":"",onKeyDown:W,onFocus:I=>{if(I.currentTarget.hasAttribute("data-highlighted")){let F=I.currentTarget.closest("[data-menu-id]");F&&!F.hasAttribute("data-keyboard-nav")&&(F.setAttribute("data-keyboard-nav",""),k&&k.setIsKeyboardNav(true));}},...K,...w,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:u=>{r(),n?.clearAllHover(),lo(),e.onMouseEnter?.(u);},onMouseLeave:u=>{s(false,60),e.onMouseLeave?.(u);}})});ki.displayName="DropdownMenuSubContent";var fr=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),vd=css({display:"inline"}),Si=css({display:"inline",fontWeight:700}),Cd=css({position:"absolute",inset:0,pointerEvents:"none",opacity:0,zIndex:-1,outline:"none"}),Rd=css({display:"flex",alignItems:"center",gap:4}),Td=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"}),wd=css({fontSize:"0.875em",overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400}),Ed=()=>{},kd=e=>e,Id=e=>`plainframe-ui-autocomplete${e?`-${e}`:""}`,Sd=e=>{e.preventDefault(),e.stopPropagation();},Md=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());},Fd=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:u,closeOnSelect:i,pickSingle:l,handleItemKeyDown:c,handleItemMouseDown:p,descriptionColor:R})=>{let f=o(),v=useMemo(()=>{let T=String(e.title??e.value);return s?T:a(T)},[a,e.title,e.value,s]),k=useMemo(()=>e.description?jsxs("span",{className:"plainframe-ui-autocomplete-item-content",css:Td,children:[jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:v}),jsx("span",{className:"plainframe-ui-autocomplete-item-description",css:[wd,{color:R}],children:e.description})]}):jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:v}),[v,e.description,R]),C=useCallback(()=>{e.disabled||l(e.value);},[e.disabled,e.value,l]);if(n){let T=f.some(h=>Object.is(h,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 ${u("checkbox-item")}`.trim(),css:e.css,onMouseDown:p,children:s(e,T)},e.value):jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${u("checkbox-item")}`.trim(),css:e.css,onMouseDown:p,startIcon:e.startIcon,endIcon:e.endIcon,children:k},e.value)}return s?jsx(pn,{__index:t,onClick:C,onSelect:C,onKeyDown:c,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:u("item"),css:e.css,closeOnSelect:i,onMouseDown:p,selected:r,children:s(e,r)},e.value):jsx(pn,{startIcon:e.startIcon,endIcon:e.endIcon,__index:t,onClick:C,onSelect:C,onKeyDown:c,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:u("item"),css:e.css,closeOnSelect:i,onMouseDown:p,selected:r,children:k},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:u,inputCss:i,containerCss:l,label:c,helperText:p,variant:R,startIcon:f,endIcon:v,size:k,disabled:C=false,error:T=false,showClear:h=false,open:d,onOpenChange:m,openOnFocus:y=false,openOnType:N=true,openOnClick:x=true,closeOnSelect:w=true,closeOnBlur:P=true,blurOnSelect:$=false,freeSolo:W=false,customValueLabel:K=false,maxHeight:I,maxItems:F,noResultsText:S="No Items Found",highlightTypedValue:g,typedValueHighlightCss:b,showNoResults:A=true,noResultsLabelCss:H,loadingLabelCss:B,loadItems:M,loading:E,loadingText:L="Loading\u2026",debounceMs:z=200,multiple:O=false,selectedValues:_,defaultSelectedValues:D,onChangeSelected:V,expandIcon:J,showExpandIcon:ae=true,expandIconCss:q,textFieldWrapperCss:X,textFieldInputCss:le,textFieldLabelCss:ie,textFieldHelperRowCss:be,textFieldHelperTextCss:Pe,textFieldStartIconCss:Re,textFieldEndIconCss:Ce,menuContentCss:Ie})=>{let we=U().text.secondary,[he,je]=useState(""),Z=typeof d=="boolean",[Ee,Q]=useState(false),ee=Z?d:Ee,se=useRef(null),pe=useRef(null),Se=useRef(null),Ne=useRef(null),Y=useRef(false),oe=useRef(null),re=useRef(false),qe=useRef(0),j=useMemo(()=>[pe],[]),[ue,de]=useState(D??[]),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 M=="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 M(G)||[];nn(Array.isArray(ne)?ne:[]);}catch{nn([]);}finally{on(false);}},Math.max(0,z)),()=>{bt.current&&window.clearTimeout(bt.current);}},[he,Je,M,z]);let Zn=useMemo(()=>{let G=fr(he);return G?xt.some(ne=>fr(ne.title??ne.value)===G):false},[xt,he]),sa=W&&!!K&&he.trim().length>0&&!Zn,tc=G=>{if(typeof K=="object"){let ne=Object.prototype.hasOwnProperty.call(K,"prefix"),ve=Object.prototype.hasOwnProperty.call(K,"suffix");if(ne||ve){let Me=ne?K.prefix??"":"",ge=ve?K.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:tc(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(W&&!O){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,W,O,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});V?.(Me);},[V]),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||(w?(Y.current=false,re.current=true,Q(false),at.current?.(false),setTimeout(()=>{re.current=false;},150)):Y.current=true),!w&&Se.current?.setActiveIndex&&Se.current.setActiveIndex(null),$?(Y.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,w,$]),nc=useCallback(G=>{if(C)return;je(G);let ne=!G.trim();O||(ne?(st(null),t?.(null)):W&&st(null)),!Z&&!ne&&N&&!ee&&De(true);},[O,Z,N,ee,De,C,W,t]),it=Id,la=Ed,oc=kd,ca=useMemo(()=>b?[Si,b]:Si,[b]),rc=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:vd,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=g?rc:oc,sc=useMemo(()=>css({position:"relative",display:o?"block":"inline-block",width:"100%",maxWidth:o?"100%":n}),[o,n]),Oo=Sd,Wo=Md,ac=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]),ic=useCallback(G=>{if(G.key===" "||G.code==="Space"||G.key==="Spacebar"){G.stopPropagation();return}if(G.key==="ArrowDown"||G.key==="ArrowUp"){if(C||!Fn&&!Je)return;G.preventDefault(),!ee&&!Z&&De(true),ua(G.key==="ArrowDown"?1:-1);return}if(G.key==="Enter"){if(C)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(),O?(ia(ve.value),w||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,O,w,ua,ia,$o,De,C]),lc=useCallback(()=>{C||re.current||y&&Lo&&(qe.current=Date.now(),Z||De(true));},[Z,y,Lo,De,C]),cc=useCallback(()=>{if(Y.current){Y.current=false;return}P&&De(false),!W&&!O&&(Oe?je(Oe.title??Oe.value):he.trim()&&je(""));},[P,W,O,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:w,pickSingle:$o,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),G},[Kt,it,Oe,yt,s,zo,w,$o,Wo,Oo,we]),uc=useMemo(()=>ke?jsx(mn,{css:B,className:it("label-loading"),children:L},"loading"):Wr?jsx(mn,{css:H,className:it("label-empty"),children:S},"empty"):Kt.length===0?null:O?da():pa(),[ke,Wr,Kt.length,it,L,S,O,da,pa]),rn=ee?false:C||!Je&&!Ho&&!A,ma=useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(rn||C)&&(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,C,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:Fd,onClick:ma,children:J??jsx(ChevronDown,{size:18,strokeWidth:2})}):null,[ae,fa,q,rn,ma,J]),dc=useMemo(()=>v&&Ko?jsxs("span",{css:Rd,children:[v,Ko]}):v??Ko,[v,Ko]),pc=useCallback(G=>{if(!(oe.current&&oe.current.contains(G.target)||re.current||C||Date.now()-qe.current<300)){if(ee){!he.trim()&&!Z&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));return}x&&Lo&&(!Z||x)&&De(true);}},[ee,he,x,Lo,De,C,Z]);return jsx("div",{ref:pe,className:it(""),css:[sc,l,u],children:jsxs($n,{open:C?false:ee,onOpenChange:C?void 0:De,children:[jsx(Fi,{onCapture:ac}),jsx(zn,{asChild:true,children:jsx("span",{className:it("anchor"),css:Cd,style:{pointerEvents:"none",position:"absolute",visibility:"hidden"},tabIndex:-1})}),jsx(Qo,{ref:se,className:it("input"),focusRingMode:a,value:he,onChange:nc,onKeyDown:ic,onFocus:lc,onBlur:cc,onSurfaceClick:pc,placeholder:r,label:c,helperText:p,variant:R,startIcon:f,endIcon:dc,size:k,width:n,fullWidth:o,disabled:C,error:T,showClear:h,css:i,wrapperCss:X,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 I=="number"?`${I}px`:I,css:Ie,ignoreOutsidePressRefs:j,disableOutsidePressDismiss:Z,returnFocus:!$,children:uc})]})})});Ai.displayName="Autocomplete";var Hd=["sm","md","lg"],Ld=(e,t)=>typeof e=="number"?e:Hd.includes(e)?t.componentHeights[e]:t.componentHeights.md,Bd=(e,t)=>{let n=e.palette?.[t??"primary"]??e.palette.primary;return n?.[600]??n?.[500]??e.neutral?.[600]??e.neutral?.[500]},$d=(e,t)=>{let n=e.text?.onColors??{};return n[t??"primary"]??n.primary??e.text?.primary??"#fff"},zd=(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:u,...i},l)=>{let c=U(),[p,R]=useState(!!e);useEffect(()=>{R(!!e);},[e]);let f=Ld(n,c),v=typeof f=="number"?f:Number.parseFloat(String(f))||0,k=v?Math.round(v*(v<=28?.55:.52)):void 0,C=r?c.radius.full:c.radius.md,T=Bd(c,o),h=$d(c,o),d=zd(u,t),m=css({width:f,height:f,borderRadius:C,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:p?"transparent":T,color:p?"inherit":h,boxSizing:"border-box",userSelect:"none"}),y=css({width:"100%",height:"100%",display:"block",objectFit:"cover"}),N=css({fontSize:k,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:p?void 0:"img","aria-label":p?void 0:t,...i,children:p&&e?jsx("img",{className:"plainframe-ui-avatar-img",src:e,alt:t,css:y,onError:()=>R(false),decoding:"async",loading:"lazy"}):typeof u=="string"?jsx("span",{className:"plainframe-ui-avatar-initials",css:N,children:u}):u||jsx("span",{className:"plainframe-ui-avatar-initials",css:N,children:d})})}));Pi.displayName="Avatar";var Ni=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,_d=({children:e,max:t,size:n="md",overlap:o=-7,css:r,rounded:s=true,bgColor:a,extraLabelCss:u,outlineThickness:i=4,className:l})=>{let c=U(),p=xe(),f=(()=>{if(typeof n=="number")return `${n}px`;if(typeof n=="string"){let x=(c.componentHeights&&c.componentHeights[n])??(c.spacing&&c.spacing[n]);return Ni(x??n)}return "32px"})(),v=Children.toArray(e).filter(Boolean),k=typeof t=="number"&&t>=0,C=k&&v.length>t?v.slice(0,t):v,T=k&&v.length>t?v.length-t:0,h=a==="panel"?c.surface.panelBg:a==="subtle"?c.surface.subtleBg:a??c.surface.appBg,d=Ni(i)??"4px",m=css({display:"flex",alignItems:"center"}),y=x=>css({marginLeft:x===0?0:o,zIndex:C.length-x,boxShadow:`0 0 0 ${d} ${h}`,backgroundColor:h,borderRadius:s?c.radius.full:c.radius.md,display:"inline-flex",width:f,height:f,overflow:"hidden",alignItems:"center",justifyContent:"center",lineHeight:0,flex:"0 0 auto"}),N=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,p()],children:[C.map((x,w)=>{if(!isValidElement(x))return jsx("div",{className:"plainframe-ui-avatar-group-item",css:y(w),children:jsx("span",{css:N,children:x})},w);let P=x,$=P.props?.css,W=$==null?N:[N,$],K=cloneElement(P,{size:n,rounded:s,css:W,style:{...P.props?.style,width:"100%",height:"100%",objectFit:P.props?.objectFit??"cover"}});return jsx("div",{className:"plainframe-ui-avatar-group-item",css:y(w),children:K},w)}),T>0&&jsxs("span",{className:"plainframe-ui-avatar-group-extra",css:[css({marginLeft:5,fontSize:c.typography.sizes.sm,fontWeight:600,lineHeight:1,padding:"2px 1px",zIndex:2,color:c.text.secondary}),u],"aria-label":`+${T} more`,children:["+",T]})]})};var Li=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Vd=(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"}},Ud=e=>e[600]??e[500]??e[400]??Object.values(e)[0]??"#000",qd=(e,t,n,o)=>o??t[n]??t.primary??e.text?.primary??"#fff",Gd=(e,t,n)=>n==="dot"?"":typeof e=="number"&&typeof t=="number"&&e>t?`${t}+`:e??"",Xd=(e,t,n,o)=>e&&(t==="dot"||!!n||n===0&&o),Yd=me.memo(({content:e,color:t="primary",fontColor:n,fontWeight:o=600,fontSize:r,variant:s="dot",max:a=99,showZero:u=false,visible:i=true,anchorOrigin:l={vertical:"top",horizontal:"right"},overlap:c="rectangular",children:p,animate:R=true,size:f,outline:v=false,outlineColor:k,className:C,badgeClassName:T,css:h,badgeCss:d,offsetX:m,offsetY:y})=>{let N=U(),x=s==="dot",w=f??(x?8:17),P=r??(x?0:10),{scale:$,onKey:W}=Vd(N,t),K=Ud($),I=N.text?.onColors||{},F=qd(N,I,W,n),S=Gd(e,a,s),g=Xd(i,s,e,u),b=css({position:"relative",display:"inline-block"}),A=c==="circular"?x?"12.5%":"5%":x?"5%":"2.5%",H=Li(m??A),B=Li(y??A),M=l.vertical||"top",E=l.horizontal||"right",L={},z="0",O="0";M==="center"?(L.top="50%",O="-50%"):M==="top"?(L.top=B,O="-45%"):(L.bottom=B,O="45%"),E==="center"?(L.left="50%",z="-50%"):E==="right"?(L.right=H,z="45%"):(L.left=H,z="-45%");let _=g?1:.8,D=css({minWidth:x?w:w/2,height:w,background:K,color:F,fontSize:typeof P=="number"?`${P}px`:P,fontWeight:o,borderRadius:999,padding:x?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",...v?{boxShadow:`0 0 0 2px ${k??N.surface?.appBg}`}:{},opacity:g?1:0,transform:`translate(${z}, ${O}) scale(${g?_:.5})`,...R?{transition:"opacity .18s cubic-bezier(.4,1.6,.6,1), transform .18s cubic-bezier(.4,1.6,.6,1)"}:{},...L});return jsxs("div",{className:["plainframe-ui-badge-wrapper",C||""].join(" ").trim(),css:[b,h],children:[p,jsx("span",{"aria-hidden":!g,className:["plainframe-ui-badge",T||""].join(" ").trim(),css:[D,d],children:S})]})});var Es=({on:e,onClickAway:t,blur:n=false,blurDepth:o=2.5,color:r,zIndex:s=1e3,css:a,contentCss:u,overlayCss:i,children:l,transitionDuration:c=300,keepMounted:p=true,className:R,contentClassName:f,lockScroll:v=true,...k})=>{let C=U(),T=useMemo(()=>r??C.surface.overlayBg,[r,C.surface.overlayBg]),[h,d]=useState(e),[m,y]=useState(e),N=useRef(null),x=useRef(null),w=useRef(null);useEffect(()=>(N.current&&(clearTimeout(N.current),N.current=null),x.current!=null&&(cancelAnimationFrame(x.current),x.current=null),e?(d(true),x.current=requestAnimationFrame(()=>{y(true),x.current=null;})):(y(false),N.current=setTimeout(()=>{d(false),N.current=null;},c)),()=>{N.current&&(clearTimeout(N.current),N.current=null),x.current!=null&&(cancelAnimationFrame(x.current),x.current=null);}),[e,c]),useEffect(()=>{if(!v||!e)return;let F=document.body,S=F.style.overflow,g=F.style.paddingRight,b=window.innerWidth-document.documentElement.clientWidth,A=parseFloat(getComputedStyle(F).paddingRight||"0");return F.style.overflow="hidden",b>0&&(F.style.paddingRight=`${A+b}px`),()=>{F.style.overflow=S,F.style.paddingRight=g;}},[e,v]),useEffect(()=>{if(!m||!t)return;let F=S=>{S.key==="Escape"&&t();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[m,t]);let P=F=>{if(!m||!t||!w.current)return;let S=F.target;S&&!w.current.contains(S)&&t();},$=n&&o?typeof o=="number"?`${o}px`:o:void 0;if(!p&&!h)return null;let W=css({position:"fixed",inset:0,width:"100vw",height:"100vh",zIndex:s,display:"grid",placeItems:"center",pointerEvents:m?"auto":"none",visibility:h?"visible":"hidden"}),K=css({position:"absolute",inset:0,background:T,backdropFilter:$?`blur(${$})`:void 0,WebkitBackdropFilter:$?`blur(${$})`:void 0,opacity:m?1:0,transition:`opacity ${c}ms cubic-bezier(.4,0,.2,1)`,pointerEvents:m?"auto":"none"}),I=css({position:"relative",zIndex:1,pointerEvents:m?"auto":"none"});return jsxs("div",{"aria-hidden":!h||void 0,className:["plainframe-ui-backdrop",R||""].join(" ").trim(),css:[W,a],onPointerDown:P,...k,children:[jsx("div",{className:"plainframe-ui-backdrop-overlay",css:[K,i],role:"presentation"}),jsx("div",{ref:w,className:["plainframe-ui-backdrop-content",f||""].join(" ").trim(),css:[I,u],children:l})]})};var yr=()=>null;Object.defineProperty(yr,"displayName",{value:"PF.BreadCrumbItem",configurable:true});function tp(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 np=me.memo(({children:e,separator:t="/",css:n,crumbCss:o,activeCrumbCss:r,inactiveCrumbCss:s,linkCrumbCss:a,separatorCss:u,hover:i=true,className:l,...c})=>{let p=U(),R=xe(),f=me.useMemo(()=>me.Children.toArray(e).flatMap(d=>{if(!me.isValidElement(d))return [];let{type:m,props:y}=tp(d);if(!(m===yr||typeof m=="function"&&"displayName"in m&&m.displayName===yr.displayName))return [];let x=y;return [{href:x.href,disabled:x.disabled,node:x.children,className:x.className,css:x.css,onClick:x.onClick,startIcon:x.startIcon,endIcon:x.endIcon}]}),[e]),v=me.useMemo(()=>css({display:"flex",alignItems:"center",fontSize:p.typography.sizes.sm,fontWeight:500,gap:p.spacing.xs,cursor:"default"}),[p]),k=me.useMemo(()=>css({margin:"0 0.15rem",color:p.neutral[500],flex:"0 0 auto",justifyContent:"center",alignItems:"center",display:"flex"}),[p]),C=me.useCallback((d,m,y)=>{let N=d?p.text.primary:p.text.secondary,x=i&&m&&!y;return css({display:"inline-flex",alignItems:"center",gap:p.spacing.xs,color:N,cursor:m&&!y?"pointer":"default",textDecoration:"none",borderRadius:p.radius.xs,fontWeight:500,outline:"none",transition:"all .16s ease !important","&:hover":x?{textDecoration:"underline",color:p.text.primary}:{textDecoration:"none"}})},[p,i]),T=me.useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0}),[]),h=me.useMemo(()=>css({display:"inline-block"}),[]);return jsx("nav",{"aria-label":"Breadcrumb",className:["plainframe-ui-breadcrumbs",l||""].join(" ").trim(),css:[v,n],...c,children:f.map((d,m)=>{let y=m===f.length-1,N=!!d.href&&!d.disabled&&!y,x=["plainframe-ui-breadcrumb",y?"plainframe-ui-breadcrumb--active":"plainframe-ui-breadcrumb--inactive",N?"plainframe-ui-breadcrumb--link":"",d.className||""].join(" ").trim(),w=[C(y,N,d.disabled),o,y?r:s,N?a:void 0,R(),d.css],P=jsxs(Fragment,{children:[d.startIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-start",css:T,children:d.startIcon}),jsx("span",{className:"plainframe-ui-breadcrumb-label",css:h,children:d.node}),d.endIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-end",css:T,children:d.endIcon})]});return jsxs(me.Fragment,{children:[m!==0&&jsx("span",{className:"plainframe-ui-breadcrumb-separator",css:[k,u],children:t}),N?jsx("a",{href:d.href,onClick:d.onClick,tabIndex:0,"data-active":y?"true":"false","data-link":"true",className:x,css:w,children:P}):jsx("span",{"aria-current":y?"page":void 0,tabIndex:y?-1:0,"data-active":y?"true":"false","data-link":"false",className:x,css:w,children:P})]},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 ap(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 ip(e,t){let n=e.neutral,o=e.text,r=e.palette,s=r.primary||n,a=r.danger||r.error||s,u=e.text.onColors||{},i=u.primary??o.onColors.primary,l=u.danger??i,c=(p,R,f)=>p&&p[R]||f;if(t==="primary"){let p=s,R=c(p,600,n[900])||c(p,500,n[900]),f=c(p,500,n[800])||c(p,600,n[800]);return {bg:R,fg:i,hoverBg:f,border:"none"}}if(t==="destructive"){let p=a,R=c(p,600,n[900])||c(p,500,n[900]),f=c(p,500,n[800])||c(p,600,n[800]);return {bg:R,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:u=false,loadingIndicator:i,loadingPosition:l="center",children:c,className:p,hoverEffect:R=true,onClick:f,css:v,...k},C)=>{let T=U(),h=xe(),d=useMemo(()=>ap(T,t),[T,t]),m=useMemo(()=>ip(T,e),[T,e]),y=useMemo(()=>!n&&!o&&!Oi(c)&&me.Children.count(c)===1,[n,o,c]),N=d.iconSize,x=useMemo(()=>ks(n,N),[n,N]),w=useMemo(()=>ks(o,N),[o,N]),P=useMemo(()=>i??jsx(no,{color:m.fg,variant:"circular",size:14,thickness:5}),[i,m]),$=useMemo(()=>y?"center":l??"center",[y,l]),W=!!u&&$==="center",K=!!u&&$==="start",I=!!u&&$==="end",F=a||u,S=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",gap:0,width:s?"100%":"auto",minHeight:d.minHeight,lineHeight:1,fontWeight:600,cursor:F?"not-allowed":"pointer",opacity:F?.5:1,userSelect:"none",position:"relative",borderRadius:r?T.radius.full:d.radius,outline:"none",willChange:"box-shadow, transform, outline-offset",transition:"box-shadow 140ms ease, transform 90ms ease, outline-offset 140ms ease"}),[s,d,r,T,F]),g=useMemo(()=>css({backgroundColor:m.bg,color:m.fg,border:m.border}),[m,T]),b=useMemo(()=>css({overflow:"hidden","::before":{content:'""',position:"absolute",inset:0,backgroundColor:m.hoverBg,opacity:0,pointerEvents:"none",transition:"opacity 140ms ease",zIndex:0},"@media (hover: hover) and (pointer: fine)":R&&!F?{":hover::before":{opacity:1}}:{}}),[m,R,F]),A=useMemo(()=>css(y&&!s?{width:"100%",height:"100%",maxWidth:d.minHeight,minWidth:d.minHeight,maxHeight:d.minHeight,display:"flex",alignItems:"center",justifyContent:"center",fontSize:Is(d.iconSize)}:{fontSize:Is(d.fontSize),padding:n||o?`${d.paddingY} ${d.paddingXIcon}`:`${d.paddingY} ${d.paddingX}`}),[y,s,d,n,o]),H=useMemo(()=>css({position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Is(T.spacing.sm),opacity:W?0:1,transition:"opacity 140ms ease"}),[T,W]),B=useMemo(()=>css({height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),[]),M=useMemo(()=>typeof d.iconSize=="number"?d.iconSize:Math.max(12,Math.round(parseFloat(String(d.iconSize))||16)),[d.iconSize]),E=useMemo(()=>css({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:M,minWidth:M,maxWidth:M,height:"1em"}),[M]),L=useMemo(()=>V=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:V?1:0,transition:"opacity 140ms ease"}),[]),z=useMemo(()=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:W?1:0,pointerEvents:"none",zIndex:2,transition:"opacity 140ms ease"}),[W]),O=useMemo(()=>()=>{if(y)return null;let V=!!n;return !V&&!K?null:jsxs("span",{css:E,"aria-hidden":u?true:void 0,children:[jsx("span",{css:L(!K),children:V?x||n:null}),jsx("span",{css:L(!!K),children:P})]})},[y,n,K,E,L,x,u,P]),_=useMemo(()=>()=>{if(y)return null;let V=!!o;return !V&&!I?null:jsxs("span",{css:E,"aria-hidden":u?true:void 0,children:[jsx("span",{css:L(!I),children:V?w||o:null}),jsx("span",{css:L(!!I),children:P})]})},[y,o,I,E,L,w,u,P]),D=!(a||u);return jsxs("button",{ref:C,type:"type"in k&&k.type?k.type:"button","data-variant":e,className:["plainframe-ui-button",p||""].join(" ").trim(),css:[S,h({color:e==="primary"?"primary":e==="destructive"||e==="ghost-destructive"?"danger":"neutral"}),g,b,A,v],onClick:D?f:void 0,disabled:a||void 0,tabIndex:u?-1:void 0,"aria-disabled":a||void 0,"aria-busy":u||void 0,...k,children:[jsxs("span",{className:"plainframe-ui-button-content",css:H,children:[O(),jsx("span",{className:"plainframe-ui-button-label",css:B,children:y?u?P:ks(c,d.iconSize):c}),_()]}),jsx("span",{className:"plainframe-ui-button-center-overlay",css:z,"aria-hidden":"true",children:W?P:null})]})}));Wi.displayName="Button";var Rr=e=>isValidElement(e),lp=e=>{let t=e.type;return t.displayName??t.name},As=(e,t)=>lp(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,cp=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,up=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 up(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:u=false,gap:i,width:l,className:c,role:p="group",css:R,__clipLeft:f,__clipRight:v,...k},C){let T=U(),h=a==="sm"?T.radius.sm:T.radius.md,d=u?T.radius.full:h,m=o==="vertical",y=cp(T.componentHeights.border,1),N=T.surface.border,x=n&&!!f,w=n&&!!v,P=css({display:"flex",flexDirection:m?"column":"row",width:r?"100%":l!=null?Kn(l):"auto",maxWidth:"none",backgroundColor:"transparent",gap:n?0:Kn(i??T.spacing.sm)}),$=Children.toArray(t),K=$.filter(Rr).length,I=0,F=false,S=[];for(let g of $){if(!Rr(g)){S.push(g);continue}let b=I===0,A=I===K-1,H=g.props??{},B=H.disabled??s,M=H.size??a,E=0,L=0,z=0,O=0;n&&(m?(E=b?x?0:d:0,L=b?w?0:d:0,O=A?x?0:d:0,z=A?w?0:d:0):(E=b?x?0:d:0,O=b?x?0:d:0,L=A?w?0:d:0,z=A?w?0:d:0));let _=_i(g,"left"),D=_i(g,"right"),ae=n&&!b&&!(F&&_)&&!(F||_)?css({[m?"borderTop":"borderLeft"]:`${y} solid ${N}`}):null,q=n&&!b&&F&&_?css(m?{borderTopWidth:0}:{borderLeftWidth:0}):null,X=n?css({borderTopLeftRadius:Kn(E),borderTopRightRadius:Kn(L),borderBottomRightRadius:Kn(z),borderBottomLeftRadius:Kn(O)}):null,le=r?css({flex:1}):null,ie=css([X,ae,q,le]);if(!Vi(g)){let Ce=H.css,Ie=[H.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" "),Te=ji(g)&&n?{__clipLeft:!b,__clipRight:!A}:{},we=cloneElement(g,{...H,disabled:B,size:M,className:Ie,css:[Ce,ie],...Te});S.push(we),F=D,I+=1;continue}let be=H.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:B,size:M})}),Re=cloneElement(g,{...H,children:Pe});S.push(Re),F=D,I+=1;}return jsx("div",{ref:C,role:p,"aria-orientation":m?"vertical":"horizontal","data-attached":n||void 0,"data-direction":o,className:["plainframe-ui-button-group",c||""].join(" ").trim(),css:[P,R],...k,children:S})}));Ui.displayName="ButtonGroup";var Tr=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,bp=(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)}}},hp=(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)}}},yp=(e,t)=>{let n=t.surface??{};return e==="panel"||e==="outlined"?n.panelBg??"transparent":e==="subtle"?n.subtleBg??"transparent":"transparent"},xp=(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:u,selectable:i,selected:l,defaultSelected:c,onSelectedChange:p,width:R,height:f,onClick:v,onKeyDown:k,role:C,tabIndex:T,...h},d){let m=U(),y=m.surface??{},[N,x]=useState(!!c),w=l!=null,P=w?!!l:N,$=useMemo(()=>yp(o,m),[o,m]),W=useMemo(()=>xp(o,m,$),[o,m,$]),K=W,I=useMemo(()=>bp(r,m),[r,m]),F=useMemo(()=>hp(s,m),[s,m]),S=!!u||!!i,g=useMemo(()=>css({backgroundColor:$,padding:I,borderRadius:F,border:o==="outlined"?`${m.componentHeights?.border??"1px"} solid ${y.border??"transparent"}`:void 0,backgroundClip:"padding-box",boxSizing:"border-box",width:R?"100%":void 0,maxWidth:Tr(R),height:Tr(f),outline:"none",transition:"background-color .16s ease, border-color .16s ease",cursor:S?"pointer":void 0,...S?{"&:hover":{backgroundColor:W}}:{},'&[data-selected="true"]':{backgroundColor:K},...S?{'&[data-selected="true"]:hover':{backgroundColor:K}}:{}}),[$,I,F,o,m.componentHeights,y.border,R,f,S,W,K]),b=useCallback(()=>{if(!i)return;let M=!P;w||x(M),p?.(M);},[w,p,i,P]),A=useCallback(M=>{i&&b(),v?.(M);},[i,b,v]),H=useCallback(M=>{i&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),b()),k?.(M);},[i,b,k]),B=xe();return jsx("div",{ref:d,"data-variant":o,"data-selected":i&&P?"true":void 0,"aria-pressed":i?P:void 0,className:["plainframe-ui-container",a||""].join(" ").trim(),css:[B(),g,n],onClick:A,onKeyDown:H,role:i?C??"button":C,tabIndex:i?T??0:T,...h,children:t})}));_n.displayName="Container";var Cp=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 Cp(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 Rp(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),u={};return r&&!s&&!a&&(u.padding=r),s&&(u.paddingLeft=s,u.paddingRight=s),a&&(u.paddingTop=a,u.paddingBottom=a),u}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:u,defaultSelected:i,onSelectedChange:l,width:c="100%",height:p,gap:R,direction:f="horizontal",className:v,onClick:k,...C},T)=>{let h=U(),d=xe(),m=f==="vertical",y=css({position:"relative",display:"flex",flexDirection:m?"column":"row",gap:Rp(R,h),alignItems:m?"stretch":"center",transition:"all .16s ease"});return jsx(Gi.Provider,{value:f,children:jsx(_n,{ref:T,variant:n,padding:o,radius:r,hoverable:s,selectable:a,selected:u,defaultSelected:i,onSelectedChange:l,width:c,height:p,className:["plainframe-ui-card",v||""].join(" ").trim(),css:[d(),y,t],onClick:k,tabIndex:k?0:void 0,...C,children:e})})}));Xi.displayName="Card";me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...u})=>{let i=U(),c=Hs()==="vertical",p=css({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:yo(o),textAlign:Ds(o),...c?{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:[p,t],...u,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...u})=>{let i=U(),c=Hs()==="vertical",p=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...c?{width:"100%"}:{},...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-start",className:["plainframe-ui-card-start",n||""].join(" ").trim(),css:[p,t],...u,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...u})=>{let i=U(),c=Hs()==="vertical",p=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...c?{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:[p,t],...u,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:u,size:i,color:l,...c})=>{let p=U(),R=css({fontWeight:u??500,fontSize:i??(p.typography?.sizes?.sm!==void 0?p.typography.sizes.sm:"1rem"),color:qi(p,l)??p.text?.primary,textAlign:Ds(o),...xo(p,r,s,a),display:"flex",alignItems:"center",gap:p.spacing?.xs??6});return jsx("div",{"data-slot":"card-title",className:["plainframe-ui-card-title",n||""].join(" ").trim(),css:[R,t],...c,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:u,size:i,color:l,...c})=>{let p=U(),R=css({fontWeight:u??400,fontSize:i??(p.typography?.sizes?.sm!==void 0?p.typography.sizes.sm:"0.875rem"),color:qi(p,l)??p.text?.secondary,marginTop:p.spacing?.xxs??2,textAlign:Ds(o),...xo(p,r,s,a)});return jsx("div",{"data-slot":"card-description",className:["plainframe-ui-card-description",n||""].join(" ").trim(),css:[R,t],...c,children:e})});var Ji=e=>isValidElement(e),kp=e=>Ji(e)?e.type?.displayName||e.type?.name:void 0,Yi=e=>kp(e)==="Card",Ip=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:u="group",css:i})=>{let l=U(),c=r==="vertical",p=String(l.componentHeights?.border??"1px"),R=l.surface.border,f={display:"flex",flexDirection:c?"column":"row",width:typeof o=="string"||typeof o=="number"?Ip(o):"auto",maxWidth:"none",gap:t?0:n??l.spacing?.sm},v=Children.toArray(e),C=v.filter(Yi).length,T=0,h=v.map((d,m)=>{if(!Yi(d)||!Ji(d))return d;let y=d.props,N=T++,x=N===0,w=N===C-1,P=s??y.variant,$=t?c?{borderTopLeftRadius:x?y.radius:0,borderTopRightRadius:x?y.radius:0,borderBottomLeftRadius:w?y.radius:0,borderBottomRightRadius:w?y.radius:0}:{borderTopLeftRadius:x?y.radius:0,borderBottomLeftRadius:x?y.radius:0,borderTopRightRadius:w?y.radius:0,borderBottomRightRadius:w?y.radius:0}:void 0,W=t&&!x?c?{borderTopWidth:0}:{borderLeftWidth:0}:void 0,K=P==="subtle"&&C>1&&!x?c?{borderTop:`${p} solid ${R}`}:{borderLeft:`${p} solid ${R}`}:null,F=[$,W,K,t?{width:"100%"}:{width:"100%",marginBottom:c?0:void 0,marginRight:c?void 0:0}].filter(Boolean),S=[y.className,"plainframe-ui-card-group-item"].filter(Boolean).join(" ");return cloneElement(d,{...y,variant:P??y.variant,css:[y.css,...F],className:S,key:typeof d=="object"&&"key"in d?d.key:m})});return jsx("div",{role:u,"aria-orientation":c?"vertical":"horizontal","data-attached":t||void 0,"data-direction":r,className:["plainframe-ui-card-group",a||""].join(" ").trim(),css:[f,i],children:h})};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},Ap=(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:u,size:i="md",onClick:l,onDelete:c,deleteIcon:p,disabled:R,cursor:f,className:v,css:k},C){let T=U(),h=xe(),d=["sm","md","lg"].includes(i)?i:"md",m=useMemo(()=>Ap(T,d),[T,d]),y=!!l&&!R,N=R?"not-allowed":f||(y?"pointer":"inherit"),x=String(T.componentHeights?.border??"1px"),w=useMemo(()=>{let J=T.palette;return r==="secondary"||r==="neutral"?"neutral":r&&J[r]?r:"primary"},[r,T.palette]),P=useCallback(J=>{let ae=T.palette;return (w==="neutral"?T.neutral[J]:ae[w]?.[J])??ae.primary?.[J]},[w,T.neutral,T.palette]),$=useMemo(()=>w==="neutral"?T.neutral[100]:P(50),[w,P,T.neutral]),W=useMemo(()=>w==="neutral"?T.text.secondary:P(800),[w,P,T.text.secondary]),K=useMemo(()=>w==="neutral"?T.neutral[100]:P(50),[w,P,T.neutral]),I=useMemo(()=>w==="neutral"?T.text.secondary:P(800),[w,P,T.text.secondary]),F=useMemo(()=>w==="neutral"?T.neutral[400]:P(300),[w,P,T.neutral]),S=useMemo(()=>w==="neutral"?T.surface.subtleBg:P(600),[w,P,T.surface.subtleBg]),g=useMemo(()=>(T.text.onColors??{})[w]??(w==="neutral"?T.neutral[900]:T.neutral[0]??"#fff"),[w,T.text.onColors,T.neutral]),b="transparent",A=useMemo(()=>w==="neutral"?T.text.secondary:P(700)??T.text.primary,[w,P,T.text.primary,T.text.secondary]),H=useMemo(()=>!a&&!u&&t!=null&&!el(t)&&me.Children.count(t)===1,[a,u,t]),B=useMemo(()=>o==="filled"?css({backgroundColor:S,color:g,border:"none",boxShadow:"none"}):o==="outlined"?css({backgroundColor:K,color:I,border:"none",boxShadow:`inset 0 0 0 ${x} ${F}`}):o==="ghost"?css({backgroundColor:b,color:A,border:"none",boxShadow:"none"}):css({backgroundColor:$,color:W,border:"none",boxShadow:"none"}),[S,g,A,K,I,F,$,W,x,o]),M=useMemo(()=>css({display:"inline-flex",alignItems:"center",gap:Le(m.gap),padding:o==="ghost"?0:H||t==null?Le(m.soloPadding):`${Le(m.paddingY)} ${Le(m.paddingX)}`,borderRadius:s?T.radius.full:m.radius,fontWeight:600,cursor:N,opacity:R?.55:1,transition:"outline .16s ease, outline-offset .16s ease",overflow:o==="ghost"?"visible":"hidden",...H?{lineHeight:1,minWidth:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,minHeight:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,justifyContent:"center"}:null}),[m,N,t,R,H,s,T.radius.full,o]),E=useMemo(()=>css({fontSize:Le(H?m.iconSize:m.fontSize),lineHeight:1.2,minWidth:0,display:"inline-flex",alignItems:"center",justifyContent:"center","& > svg":{width:H?Le(m.iconSize):void 0,height:H?Le(m.iconSize):void 0,display:H?"block":void 0}}),[m.fontSize,m.iconSize,H]),L=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]),z=useMemo(()=>css({marginRight:H||t==null?0:Le(m.gap),marginLeft:H||t==null?0:Le(m.iconOffset)}),[m.gap,m.iconOffset,t,H]),O=useMemo(()=>css({marginLeft:H||t==null?0:Le(m.gap),marginRight:H||t==null?0:Le(s?m.iconOffsetRounded:m.iconOffset)}),[m.gap,m.iconOffset,m.iconOffsetRounded,t,H,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:R?"not-allowed":"pointer",color:"currentColor",opacity:R?.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:T.radius.xs}),[m.iconOffset,m.iconSize,R,s,T.radius.xs]),D=useCallback(J=>{y&&(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),l?.());},[y,l]),V=useMemo(()=>jsx(X,{css:{width:m.iconSize,height:m.iconSize},strokeWidth:2.5}),[m.iconSize]);return jsxs("div",{ref:C,className:["plainframe-ui-chip",y?"plainframe-ui-chip-clickable":"",v||""].join(" ").trim(),css:[M,B,y?h({color:r??"primary"}):null,k],onClick:y?l:void 0,onKeyDown:D,role:y?"button":void 0,tabIndex:y?0:void 0,"aria-disabled":R||void 0,"data-variant":o,"data-color":w,"data-size":i,"data-icon-only":H||void 0,children:[a&&jsx("span",{css:[L,z],className:"plainframe-ui-chip-icon-left",children:a}),t!=null&&jsx("span",{css:[E,n],className:"plainframe-ui-chip-label",children:t}),u&&jsx("span",{css:[L,O],className:"plainframe-ui-chip-icon-right",children:u}),c&&jsx("button",{type:"button","aria-label":"Delete",disabled:R,tabIndex:0,onClick:J=>{J.stopPropagation(),R||c?.();},css:[_,h({color:r??"primary"})],className:"plainframe-ui-chip-delete",children:p||V})]})}));tl.displayName="Chip";var Hp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Lp=me.memo(function({value:t,onChange:n,len:o,theme:r,sizeKey:s,s:a,variant:u,error:i,disabled:l,ringEnabled:c,focusRingMode:p,placeholder:R,separator:f,gapPx:v}){let k=xe(),C=r.neutral,T=r.text,h=r.componentHeights.border,d=useRef([]),[m,y]=useState(0),N=useMemo(()=>(t??"").padEnd(o,"").slice(0,o).split(""),[t,o]),x=useMemo(()=>{if(!R)return Array(o).fill("");if(R.length===1)return Array(o).fill(R);let H=R.slice(0,o).split("");for(;H.length<o;)H.push("");return H},[R,o]),w=useMemo(()=>{let H=r.componentHeights[s];return `calc(${typeof H=="number"?`${H}px`:H} * 1.5)`},[r.componentHeights,s]),P=l?C[200]:i&&u==="outlined"?r.palette.danger?.[50]??r.surface.panelBg:i&&u==="subtle"?r.palette.danger?.[50]??r.surface.subtleBg:u==="subtle"?r.surface.subtleBg:u==="outlined"?r.surface.panelBg:"transparent",$=u==="outlined"?`${h} 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:P,border:$,borderRadius:r.radius.lg,transition:"box-shadow .16s, border-color .16s, background .16s",fontSize:a.codeFontSize,fontWeight:600,color:l?C[500]:i?r.palette.danger?.[800]??T.primary:T.primary,textAlign:"center",backgroundClip:"padding-box",appearance:"textfield",outline:"none",caretColor:i?r.palette.danger?.[800]??T.primary:T.primary,"&::placeholder":{color:i?r.palette.danger?.[700]??T.secondary:T.secondary,opacity:.85}},c?k({enabled:true,disabled:l,mode:p==="always"?"always":"visible",color:i?"danger":void 0}):void 0,H?css({}):null),K=css({display:"flex",gap:v,justifyContent:"center",width:"auto",pointerEvents:l?"none":"auto",opacity:l?.65:1}),I=css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:T.secondary,userSelect:"none"}),F=H=>H.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),S=useCallback(H=>{let B=Math.max(0,Math.min(o-1,H));y(B),d.current[B]?.focus();},[o]),g=useCallback((H,B)=>{let M=F(B).slice(0,1),E=[...N];E[H]=M,n(E.join("")),M&&H<o-1&&S(H+1);},[N,o,n,S]),b=useCallback((H,B)=>{if(B.key==="Backspace")if(!N[H]&&H>0){let M=[...N];M[H-1]="",n(M.join("")),S(H-1),B.preventDefault();return}else {let M=[...N];M[H]="",n(M.join(""));return}if(B.key==="ArrowLeft"&&H>0){B.preventDefault(),S(H-1);return}if(B.key==="ArrowRight"&&H<o-1){B.preventDefault(),S(H+1);return}if(B.key==="Home"){B.preventDefault(),S(0);return}if(B.key==="End"){B.preventDefault(),S(o-1);return}},[N,o,n,S]),A=useCallback(H=>{let B=F(H.clipboardData.getData("text")).slice(0,o);B&&(n(B),requestAnimationFrame(()=>{let M=Math.min(B.length,o-1);S(M);}),H.preventDefault());},[o,n,S]);return jsx("div",{className:"plainframe-ui-code-boxes",css:K,children:Array.from({length:o}).map((H,B)=>jsxs(me.Fragment,{children:[jsx("input",{ref:M=>{d.current[B]=M;},type:"text",inputMode:"text",maxLength:1,value:N[B]||"",placeholder:N[B]?"":x[B]||"",disabled:l,onChange:M=>g(B,M.target.value),onKeyDown:M=>b(B,M),onFocus:()=>y(B),onPaste:B===0?A:void 0,className:"plainframe-ui-code-box",css:W(B===m),"aria-label":`Code character ${B+1}`,tabIndex:B===m?0:-1}),f&&B<o-1?jsx("span",{"aria-hidden":true,role:"presentation",css:I,children:f}):null]},B))})}),Bp=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,separator:s,error:a,helperText:u,disabled:i=false,gap:l,size:c="md",variant:p="subtle",length:R=4,focusRingMode:f="always",className:v,wrapperCss:k,labelCss:C,helperRowCss:T,helperTextCss:h,css:d})=>{let m=U(),y=useId(),N=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]),x=["sm","md","lg"].includes(c)?c:"md",w=N[x],P=m.neutral,$=m.text,W=t!=null,[K,I]=useState(n),F=W?t:K,S=z=>{W||I(z),o?.(z);},g=Math.max(2,Math.min(R,10)),b=m.spacing.sm,A=Hp(l??b)??"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(k)?k:k?[k]:[]),B=css({fontSize:w.labelFont,fontWeight:500,color:a?m.palette.danger?.[700]??$.primary:i?P[500]:$.primary,marginBottom:4,display:"block",cursor:i?"not-allowed":"auto"},...Array.isArray(C)?C:C?[C]:[]),M=css({display:"flex",alignItems:"center",justifyContent:"center",gap:A,width:"auto",background:"transparent",outline:"none",boxShadow:"none"},...Array.isArray(d)?d:d?[d]:[]),E=css({minHeight:16,fontSize:w.helperFont,color:a?m.palette.danger?.[700]??$.secondary:$.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Array.isArray(T)?T:T?[T]:[]),L=css({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400,color:a?m.palette.danger?.[700]??$.primary:i?P[500]:$.primary},...Array.isArray(h)?h:h?[h]:[]);return jsxs("div",{className:["plainframe-ui-codefield",v||""].join(" ").trim(),css:H,children:[e&&jsx("span",{id:y,className:"plainframe-ui-codefield-label",css:B,children:e}),jsx("div",{className:"plainframe-ui-codefield-row",css:M,role:"group","aria-labelledby":e?y:void 0,tabIndex:-1,children:jsx(Lp,{value:F||"",onChange:S,len:g,theme:m,sizeKey:x,s:{codeFontSize:w.codeFontSize},variant:p,error:!!a,disabled:i,ringEnabled:f!=="none",focusRingMode:f,placeholder:r,separator:s,gapPx:A})}),u!=null&&jsx("div",{className:"plainframe-ui-codefield-helper",css:E,children:jsx("span",{className:"plainframe-ui-codefield-helper-text",css:L,children:u})})]})};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)},zp=({children:e,content:t,trigger:n="contextmenu",onOpenChange:o,hoverPosition:r="cursor",hoverOffset:s=10})=>{let a=me.useRef(null),[u,i]=me.useState(false),l=me.useCallback(E=>{i(E),o?.(E);},[o]),c=me.useCallback(()=>l(false),[l]),p=me.useRef({x:0,y:0}),R=me.useRef(null),f=me.useRef(null),v=me.useCallback(()=>{f.current=null;let E=R.current;if(!E)return;let L=Math.round(p.current.x),z=Math.round(p.current.y);E.style.transform=`translate3d(${L}px, ${z}px, 0)`;},[]),k=me.useCallback(()=>{f.current==null&&(f.current=requestAnimationFrame(v));},[v]);me.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current);},[]);let C=me.useMemo(()=>({getBoundingClientRect:()=>{let E=Math.round(p.current.x),L=Math.round(p.current.y);return {x:E,y:L,left:E,top:L,right:E,bottom:L,width:0,height:0,toJSON:()=>({x:E,y:L})}}}),[]),T=me.useRef(`cz-${Math.random().toString(36).slice(2)}`),h=me.useCallback(()=>typeof document<"u"?document.querySelector(`[data-cz-id="${T.current}"]`):null,[]),d=me.useRef(null),m=me.useRef(null),y=me.useCallback(()=>{d.current!=null&&clearTimeout(d.current),d.current=null;},[]),N=me.useCallback(()=>{m.current!=null&&clearTimeout(m.current),m.current=null;},[]),x=me.useCallback(()=>{N(),m.current=window.setTimeout(()=>l(false),0);},[N,l]),w=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}},[]),P=me.useCallback((E,L)=>{p.current={x:E,y:L},k(),l(true);},[k,l]),$=typeof t=="function"?t({close:c}):t,W=Bs($),K=E=>{if(!me.isValidElement(E))return E;let L=al(E),z=E,O=z.props.children,_=O==null?O:Array.isArray(O)?O.map(D=>me.isValidElement(D)?K(D):D):me.isValidElement(O)?K(O):O;if(L==="DropdownMenu"){let D=z.props.onOpenChange;return me.cloneElement(z,{...z.props,open:u,onOpenChange:V=>{D?.(V),l(V);},children:_})}if(L==="DropdownMenuContent"){let D=z.props.onMouseEnter,V=z.props.onMouseLeave;return me.cloneElement(z,{...z.props,anchor:C,"data-cz-id":T.current,onMouseEnter:J=>{N(),D?.(J);},onMouseLeave:J=>{x(),V?.(J);},children:_})}return _===O?z:me.cloneElement(z,{...z.props,children:_})},I=W?K($):$,F=me.useCallback(E=>{E.preventDefault(),P(E.clientX,E.clientY);},[P]),S=me.useCallback(E=>{n==="contextmenu"&&F(E);},[n,F]),g=me.useCallback(E=>{n==="dblclick"&&F(E);},[n,F]),b=me.useCallback(E=>{n==="click"&&F(E);},[n,F]),A=me.useCallback(E=>{if(n!=="hover")return;y(),N();let L=r==="center"?w():{x:E.clientX,y:E.clientY};d.current=window.setTimeout(()=>{let z=L.x+(r==="cursor"?s:0),O=L.y+(r==="cursor"?s:0);P(z,O);},0);},[n,r,s,w,P,y,N]),H=me.useCallback(E=>{n==="hover"&&u&&r==="cursor"&&!W&&(p.current={x:E.clientX+s,y:E.clientY+s},k());},[n,u,r,W,s,k]),B=me.useCallback(()=>{n==="hover"&&(y(),x());},[n,y,x]);me.useEffect(()=>{if(n!=="hover")return;let E=()=>{if(!u)return;let L=a.current?.matches(":hover"),z=h()?.matches?.(":hover");L||z?N():x();};return window.addEventListener("pointermove",E,{passive:true,capture:true}),()=>window.removeEventListener("pointermove",E,{capture:true})},[u,n,h,N,x]),me.useEffect(()=>{let E=()=>{if(u)if(n==="hover"){let L=a.current?.matches(":hover"),z=h()?.matches?.(":hover");if(L||z?N():x(),r==="center"&&a.current){let O=w();p.current={x:O.x,y:O.y},k();}}else l(false);};return window.addEventListener("scroll",E,true),window.addEventListener("resize",E,true),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E,true);}},[u,n,r,w,k,l,N,x,h]),me.useEffect(()=>()=>{y(),N();},[y,N]);let M=({children:E})=>u?jsx("div",{ref:R,style:{position:"fixed",left:0,top:0,transform:`translate3d(${Math.round(p.current.x)}px, ${Math.round(p.current.y)}px, 0)`,willChange:"transform",zIndex:1e3,pointerEvents:"auto"},onMouseEnter:()=>n==="hover"&&N(),onMouseLeave:()=>n==="hover"&&x(),children:E}):null;return jsxs("div",{ref:a,onContextMenu:S,onDoubleClick:g,onClick:b,onMouseEnter:A,onMouseMove:H,onMouseLeave:B,css:css({position:"relative"}),className:"plainframe-ui-context-zone-wrapper",children:[e,W?I:jsx(M,{children:I})]})};var Vn=(e,t="0px")=>e==null?t:typeof e=="number"?`${e}px`:e,_p=me.memo(forwardRef(function({label:t,variant:n="full",direction:o="horizontal",labelPosition:r="center",thickness:s=1,width:a,middleMargin:u="5px",insetMargin:i="10px",chip:l=false,chipVariant:c="subtle",rounded:p=false,margin:R=10,css:f,labelCss:v,strokeCss:k,className:C,...T},h){let d=U(),{t:m,strokeColor:y,labelTextColor:N,chipSubtleBg:x,chipOutlinedBg:w,outerM:P,padX:$,verticalStrokeMargin:W}=useMemo(()=>{let g=typeof s=="number"?`${s}px`:s,b=d.surface.border,A=d.text.secondary,H=d.surface.subtleBg,B=d.surface.panelBg,M=Vn(R,"10px"),E=o==="horizontal"?n==="middle"?Vn(u):n==="inset"?Vn(i,"0px"):"0":"0",L=o==="vertical"?n==="middle"?Vn(u):n==="inset"?Vn(i,"0px"):"0":"0";return {t:g,strokeColor:b,labelTextColor:A,chipSubtleBg:H,chipOutlinedBg:B,outerM:M,padX:E,verticalStrokeMargin:L}},[s,d,o,n,u,i,R]),K=useMemo(()=>css([{display:"flex",alignItems:"center"},o==="vertical"?{flexDirection:"column",alignSelf:"stretch",width:t?"max-content":m,minWidth:t?"max-content":m,marginLeft:P,marginRight:P}:{flexDirection:"row",width:a?Vn(a):"100%",minWidth:0,paddingLeft:$,paddingRight:n==="middle"?$:"0",marginTop:P,marginBottom:P},...Array.isArray(f)?f:f?[f]:[]]),[o,t,m,P,a,$,n,f]),I=useMemo(()=>css([{background:y,borderRadius:p?d.radius.full:d.radius.xs},o==="vertical"?{width:m,minHeight:18,flex:1,marginTop:W,marginBottom:W}:{height:m,flex:1}]),[y,p,d.radius.full,d.radius.xs,o,m,W]),F=useMemo(()=>css([{margin:l?o==="vertical"?"4px 0":0:o==="vertical"?"2px 0":0,padding:l?"3px 7px":0,borderRadius:l?p?d.radius.full:`calc(${d.radius.sm} * 0.75)`:`calc(${d.radius.sm} * 0.75)`,color:N,fontWeight:500,fontSize:13,textAlign:"center",alignSelf:"center",whiteSpace:o==="vertical"?"normal":"pre",wordBreak:o==="vertical"?"break-all":void 0,...l?c==="subtle"?{background:x,border:"none"}:{background:w,border:`${m} solid ${y}`}:{}},...Array.isArray(v)?v:v?[v]:[]]),[l,o,p,d.radius.full,d.radius.sm,N,c,x,w,m,y,v]),S=useMemo(()=>jsx("div",{className:"plainframe-ui-divider-stroke",css:[I,k]}),[I,k]);return o==="vertical"?jsxs("div",{ref:h,"data-direction":"vertical","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper","is-vertical",C||""].join(" ").trim(),css:K,...T,children:[t&&r!=="top"&&S,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="bottom"&&S,!t&&S]}):jsxs("div",{ref:h,"data-direction":"horizontal","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper",C||""].join(" ").trim(),css:K,...T,children:[t&&r!=="left"&&S,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="right"&&S,!t&&S]})}));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,u]=useState(!!n),i=t??a,l=useCallback(p=>{t===void 0&&u(p),o?.(p);},[t,o]),c=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(ml.Provider,{value:c,children:e})},Up=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=fl(),u=!!e&&me.isValidElement(t),i=useCallback(c=>{if(u){let p;me.isValidElement(t)&&(p=t.props.onClick),p?.(c);}r.onClick?.(c),c.defaultPrevented||a(true);},[u,t,r.onClick,a]),l=useCallback(c=>{if((c.key==="Enter"||c.key===" ")&&(c.preventDefault(),a(true)),u){let p;me.isValidElement(t)&&(p=t.props.onKeyDown),p?.(c);}r.onKeyDown?.(c);},[u,t,r.onKeyDown,a]);if(u){let c=t,p=c.props.css;return me.cloneElement(c,{...c.props||{},className:[c.props.className,n].filter(Boolean).join(" ")||void 0,css:[p,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})});Up.displayName="DrawerTrigger";var To=0,bl="",hl="",qp=()=>typeof window>"u"?0:window.innerWidth-document.documentElement.clientWidth;function Gp(){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 Xp(){if(!(typeof document>"u")&&(To>0&&(To-=1),To===0)){let e=document.body;e.style.overflow=bl,e.style.paddingRight=hl;}}var Yp=(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:u,backdropBlur:i=true,backdropBlurDepth:l,closeOnClickAway:c=true,transitionMs:p,snapClosePct:R=.33,velocityClosePxS:f=950,dragElasticOut:v=.2,className:k,css:C,...T},h){let d=U(),{open:m,setOpen:y,lockScroll:N,closeOnEscape:x}=fl();useEffect(()=>{if(!(!N||!m))return Gp(),()=>Xp()},[m,N]);let w=useMemo(()=>Yp(a,0),[a]),P=useMemo(()=>r==="left"||r==="right"?"x":"y",[r]),$=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]),K=useMemo(()=>o??(r==="top"||r==="bottom"?420:s==="inset"?`calc(100% - ${w*2}px)`:"100%"),[o,r,s,w]),I=useMemo(()=>{let q=String(d.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,d.radius.lg]),F=useMemo(()=>u??(s==="inset"?d.radius.lg:I),[u,s,d.radius.lg,I]),S=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]),g=useRef(null),b=useCallback(()=>{let q=g.current;if(!q)return 1;let X=q.getBoundingClientRect();return P==="x"?X.width:X.height},[P]),A=useMemo(()=>({type:"spring",stiffness:520,damping:40,mass:.7}),[]),H=useMemo(()=>({duration:(p??280)/1e3,ease:[.22,1,.36,1]}),[p]),B=useMemo(()=>$*1.1,[$]),M=useMemo(()=>P==="x"?{x:`${B*100}%`,y:0}:{y:`${B*100}%`,x:0},[P,B]),E=useMemo(()=>css({position:"fixed",zIndex:1100,...S,width:W,height:K,backgroundColor:d.surface.panelBg,borderRadius:F,overflowY:"auto",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",willChange:"transform, box-shadow, opacity",backfaceVisibility:"hidden",pointerEvents:m?"auto":"none",touchAction:P==="x"?"pan-y":"pan-x","@media (prefers-reduced-motion: reduce)":{transition:"none"}}),[S,W,K,d.surface,F,m,P]),L=useMemo(()=>css({position:"fixed",inset:0,zIndex:1099,background:d.surface.overlayBg,transition:"all .3s ease",...i?{backdropFilter:`blur(${l??"2px"})`}:null}),[i,l,d.surface]),z=useCallback(()=>{c&&y(false);},[c,y]),O=useMemo(()=>P==="x"?{left:$===-1?v:0,right:$===1?v:0}:{top:$===-1?v:0,bottom:$===1?v:0},[P,$,v]),_=useMemo(()=>P==="x"?{left:0,right:0}:{top:0,bottom:0},[P]),D=useMemo(()=>Math.max(0,Math.min(1,R)),[R]),V=useCallback((q,X)=>{let le=P==="x"?X.offset.x:X.offset.y,ie=P==="x"?X.velocity.x:X.velocity.y,be=$*le>0,Pe=Math.abs(le)>=b()*D,Re=$*ie>f;be&&(Pe||Re)&&y(false);},[P,$,b,D,f,y]),J=useRef(null);useEffect(()=>{if(!m)return;J.current=document.activeElement;let q=setTimeout(()=>{let ie=g.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),X=ie=>{let be=g.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"&&x&&(ie.stopPropagation(),y(false));};return document.addEventListener("focusin",X,true),window.addEventListener("keydown",le),()=>{clearTimeout(q),document.removeEventListener("focusin",X,true),window.removeEventListener("keydown",le),J.current&&typeof J.current.focus=="function"&&J.current.focus();}},[m,y,x]);let{...ae}=T;return jsx(AnimatePresence,{children:m?jsxs(Fragment,{children:[jsx(motion.div,{role:"presentation","aria-hidden":true,css:L,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:p?H:{duration:.18,ease:"linear"},onClick:z},"overlay"),jsx(motion.div,{ref:q=>{g.current=q,typeof h=="function"?h(q):h&&(h.current=q);},role:"dialog","aria-modal":"true",tabIndex:-1,"data-position":r,"data-variant":s,className:["plainframe-ui-drawer",k||""].join(" ").trim(),css:[E,C],drag:P,dragConstraints:_,dragElastic:O,dragMomentum:false,dragDirectionLock:true,onDragEnd:V,initial:{...M,opacity:.98},animate:{x:0,y:0,opacity:1},exit:{...M,opacity:.98},transition:p?H:A,...ae,children:t},"panel")]}):null})});yl.displayName="DrawerContent";var Jp=forwardRef(function({open:t,on:n,defaultOpen:o,defaultOn:r,onOpenChange:s,onClose:a,children:u,...i},l){let c=t!==void 0?t:n,p=o!==void 0?o:r,R=c!==void 0,[f,v]=useState(!!p),k=R?!!c:f,C=useCallback(T=>{R||v(T),T||a?.(),s?.(T);},[R,a,s]);return jsx(gl,{open:k,onOpenChange:C,children:jsx(yl,{ref:l,...i,children:u})})});Jp.displayName="DrawerLegacy";var Ws=({children:e,duration:t=300,delay:n=0,on:o=false,onAnimationEnd:r,asChild:s=true,className:a,blur:u=false})=>{let i={opacity:o?1:0,filter:u?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=p=>R=>{R.target===R.currentTarget&&(R.propertyName==="opacity"||R.propertyName==="filter")&&r?.(),p?.(R);};if(s&&isValidElement(e)){let p=e,R=p.props.css,f=Array.isArray(R)?[...R,i]:R?[R,i]:[i],v=["plainframe-ui-transition-fade",p.props.className||"",a||""].join(" ").trim(),k=p.props.onTransitionEnd;return cloneElement(p,{...p.props,css:f,className:v,onTransitionEnd:l(k)})}let c=css(i);return jsx("div",{className:["plainframe-ui-transition-fade",a||""].join(" ").trim(),css:c,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:u,height:i,...l})=>{let c=U(),p=e==="vertical"||e==="column"?"column":"row",R=t===void 0?void 0:typeof t=="number"?t:c.spacing[t]??t,f=css({display:"flex",flexDirection:p,gap:R,justifyContent:n,alignItems:o,maxWidth:xl(u),width:u?"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:u=true,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"},c=R=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),R?.(f);};if(u&&isValidElement(e)){let R=e,f=R.props.css,v=Array.isArray(f)?[...f,l]:f?[f,l]:[l],k=R.props.onTransitionEnd,C=["plainframe-ui-transition-grow",R.props.className||"",i||""].join(" ").trim();return cloneElement(R,{...R.props,css:v,className:C,onTransitionEnd:c(k)})}let p=css(l);return jsx("div",{className:["plainframe-ui-transition-grow",i||""].join(" ").trim(),css:p,onTransitionEnd:c(),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"}},pm=e=>e==null?void 0:typeof e=="number"?`${e}px`:String(e),mm={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:u="left",textTransform:i="none",whiteSpace:l="normal",decoration:c="none",decorationStyle:p="solid",decorationThickness:R=1,decorationColor:f,italic:v,className:k,style:C,as:T})=>{let h=U(),d=Cl[e]??Cl.body,m=T??mm[e]??"span",y=F=>F==null?d.size:typeof F=="number"?F:h?.typography?.sizes?.[F]??F,N=y(o)??y(d.size),x=r??d.weight,w=s??d.lh,P=a??d.ls,$=n==="secondary"?h.text.secondary:n==="primary"?h.text.primary:n??"inherit",W=f??h.surface.border,K=css({boxSizing:"border-box",display:u==="left"?"inline":"block",textAlign:u==="left"?void 0:u,fontFamily:h?.typography?.fonts?.sans||"inherit",fontSize:N,fontWeight:x,lineHeight:w,letterSpacing:P,color:$,textTransform:i,whiteSpace:l,fontStyle:v?"italic":"normal",margin:0,padding:0}),I=c==="none"?css({textDecoration:"none"}):css({textDecorationLine:c,textDecorationStyle:p,textDecorationColor:W,textDecorationThickness:pm(R),textDecorationSkipInk:"auto"});return jsx(m,{className:[`pfui-typo-${e}`,k||""].join(" ").trim(),css:[K,I],style:C,"data-variant":e,children:t})});Un.displayName="Typography";var Us=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,bm=(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:u="none",label:i,labelAlign:l="center",aspectRatio:c,loading:p="lazy",decoding:R="async",fetchPriority:f,srcSet:v,sizes:k,placeholder:C,blurDataURL:T,placeholderColor:h="#f1f1f1",fallbackSrc:d,className:m,css:y,onClick:N,onLoad:x,onError:w,...P},$){let[W,K]=useState(false),[I,F]=useState(false),[S,g]=useState(false),b=U(),A=bm(s,b)??"0px",H=i?"figure":"div",B=css({display:"flex",flexDirection:"column",gap:i?b.spacing.xs:0,width:"fit-content",borderRadius:`var(--pfui-image-radius, ${A})`}),M=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:c,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&&(u==="rotate"||u==="scale-rotate")?"rotate(3deg)":"none",cursor:N?"pointer":void 0}),E=css({position:"absolute",inset:0,background:C==="color"?h:void 0,backgroundImage:C==="blur"&&T?`url(${T})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:C==="blur"?"blur(8px)":void 0,transition:"opacity 0.3s ease",opacity:S?0:1,pointerEvents:"none"}),L=css({width:"100%",height:"100%",display:"block",objectFit:"cover",transform:W&&(u==="scale"||u==="scale-rotate")?"scale(1.08)":"none",transition:"transform 0.3s ease",willChange:"transform"});return jsxs(H,{className:["plainframe-ui-image",m||""].join(" ").trim(),css:[B,y],tabIndex:-1,children:[jsxs("div",{className:"plainframe-ui-image-frame",css:M,onMouseEnter:()=>K(true),onMouseLeave:()=>K(false),onClick:N,children:[!S&&C&&jsx("div",{"aria-hidden":true,className:"plainframe-ui-image-placeholder",css:E}),jsx("img",{ref:$,className:"plainframe-ui-image-img",css:L,src:I&&d?d:t,alt:n,srcSet:v,sizes:k,loading:p,decoding:R,fetchPriority:f,onLoad:z=>{g(true),x?.(z);},onError:z=>{F(true),w?.(z);},...P})]}),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,vm=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}},Cm=e=>e*Math.PI/180,Rm=(e,t,n)=>{let o=Math.abs(Cm(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 Tm(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 wm=(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],Em={sm:150,md:200,lg:260,xl:340},km=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Im(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 km(typeof n=="number"||typeof n=="string"?n:e)}return e}}}var Sm=memo(function({children:t,variant:n="fan",width:o,aspectRatio:r="4/5",size:s="md",hoverEffect:a="none",hovering:u,maxItems:i=3,shadow:l=false,cursor:c,outline:p,outlineColor:R,outlineWidth:f=3,outlineOffset:v=0,radius:k="md",label:C,labelAlign:T="center",css:h,className:d,...m}){let y=U(),N=vm(r)??4/5,x=typeof o=="string"?o:void 0,w=typeof o=="number"?o:x&&/px$/.test(x)?parseFloat(x):Em[s],P=Math.max(1,w/N),W=Children.toArray(t).filter(isValidElement).slice(0,i),K=W.length,I=Tm(n,K),F=W.map((q,X)=>wm(n,K,X)),S=q=>P*.6*F[q],g=q=>S(q)*N,b=0,A=0;for(let q=0;q<K;q++){let X=g(q),le=S(q),ie=Math.max(Math.abs(I.base.ang[q]??0),Math.abs(I.exp.ang[q]??0)),be=Math.max(Math.abs(I.base.dx[q]??0),Math.abs(I.exp.dx[q]??0)),Pe=Math.max(Math.abs(I.base.dy[q]??0),Math.abs(I.exp.dy[q]??0)),Re=a==="expand"?kl[q]??1.08:a==="reveal"?El[q]??1.03:1,Ce=Rm(X,le,ie),Ie=Ce.w*Re,Te=Ce.h*Re,we=be/100*X*Re,he=Pe/100*le*Re;b=Math.max(b,Ie/2+we),A=Math.max(A,Te/2+he);}let H=Math.max(1,2*b),B=Math.max(1,2*A),M=Math.min(1,w/H,P/B),E=u===void 0?"pointer":"controlled",L=u?"true":void 0,z=css({display:"flex",flexDirection:"column",cursor:c||"auto",lineHeight:0,position:"relative",isolation:"isolate",gap:C?y.spacing.xs:0}),O=css({position:"relative",width:wl(typeof o=="number"?o:w)??(typeof o=="string"?o:void 0),height:wl(P)}),_=css({position:"absolute",inset:0,left:"50%",top:"50%",width:`${H}px`,height:`${B}px`,transform:`translate(-50%, -50%) scale(${M})`,transformOrigin:"center center"}),D=Im(k,y)??"0px",V=q=>{let X=n==="fan"?`rotate(${I.base.ang[q]}deg) translate(${I.base.dx[q]}%, ${I.base.dy[q]}%)`:n==="slide"?`translate(${I.base.dx[q]}%, ${I.base.dy[q]}%) rotate(${I.base.ang[q]}deg)`:n==="domino"?`translate(0%, ${I.base.dy[q]}%)`:`translate(${I.base.dx[q]}%, ${I.base.dy[q]}%) rotate(${I.base.ang[q]}deg)`,le=n==="fan"?`rotate(${I.exp.ang[q]}deg) translate(${I.exp.dx[q]}%, ${I.exp.dy[q]}%)`:n==="slide"?`translate(${I.exp.dx[q]}%, ${I.exp.dy[q]}%) rotate(${I.exp.ang[q]}deg)`:n==="domino"?`translate(0%, ${I.exp.dy[q]}%)`:`translate(${I.exp.dx[q]}%, ${I.exp.dy[q]}%) rotate(${I.exp.ang[q]}deg)`,ie=a==="reveal"?"translate(0,0) rotate(0) scale(1)":`${X} scale(1)`,be=a==="expand"?`${le} scale(${kl[q]??1.06})`:a==="reveal"?`${X} scale(${El[q]??1.03})`:`${X} 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:p?`${f}px solid ${R??y.surface.appBg}`:void 0,outlineOffset:p?v: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}`}})},J=q=>css({width:`${g(q)}px`,aspectRatio:`${N}`,position:"relative",overflow:"hidden",borderRadius:D,"--pfui-image-radius":D,"& > *":{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(C?"figure":"div",{className:["plainframe-ui-image-stack-wrapper",d||""].join(" ").trim(),"data-hover-mode":E,"data-hovered":L,css:[z,h],tabIndex:-1,...m,children:[jsx("div",{className:"plainframe-ui-image-stack",css:O,children:jsx("div",{className:"plainframe-ui-image-stack-stage",css:_,children:W.map((q,X)=>jsx("div",{className:"plainframe-ui-image-stack-item",css:V(X),children:jsx("div",{className:"plainframe-ui-image-stack-frame",css:J(X),children:q})},X))})}),C&&jsx(Un,{as:"figcaption",variant:"caption",align:T,children:C})]})});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 Am(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}var Pm=forwardRef(function({children:t,variant:n="outlined",size:o="sm",radius:r,mono:s=true,uppercase:a=false,css:u,className:i="plainframe-ui-kbd",...l},c){let p=U(),R=xe(),f=Sl[o]??Sl.sm,v=Am(r,p),k={br:p.neutral[300],txt:p.neutral[800],inset:p.neutral[0]},C=css({all:"unset",boxSizing:"border-box",display:"inline-flex !important",alignItems:"center",justifyContent:"center",height:n==="ghost"?void 0:`${f.h}px !important`,minHeight:n==="ghost"?void 0:`${f.h}px !important`,paddingInline:n==="ghost"?0:`${f.px}px !important`,paddingBlock:"0 !important",fontFamily:s?p.typography.fonts.mono:"inherit",fontSize:n==="ghost"?`${f.font*1.2}px !important`:`${f.font}px !important`,fontWeight:600,letterSpacing:.2,lineHeight:"0.2 !important",textTransform:a?"uppercase":"none",borderRadius:v,userSelect:"none",whiteSpace:"nowrap",verticalAlign:"baseline",position:"relative",outline:"none"}),T=css({"&&":{background:p.neutral[200],border:"none",boxShadow:"none",color:k.txt}}),h=css({"&&":{background:"transparent",color:k.txt,border:"none",boxShadow:"none"}}),d=css({"&&":{background:p.surface.panelBg,color:k.txt,border:`1px solid ${k.br}`,boxShadow:`inset 0 1px 0 ${k.inset}AA, 0 1px 0 rgba(0,0,0,0.03)`}}),m=n==="subtle"?T:n==="ghost"?h:d;return jsx("kbd",{ref:c,className:i,css:[R(),C,m,u],...l,children:t})});var Bm=(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=true,className:u,distance:i})=>{let c=Bm(i,t==="left"||t==="right"?"100vw":"100vh"),p=t==="left"?`-${c}`:t==="right"?c:"0",R=t==="up"?c:t==="down"?`-${c}`:"0",f={transform:r?"translate3d(0,0,0)":`translate3d(${p}, ${R}, 0)`,transition:`transform ${n}ms ease ${o}ms`,pointerEvents:r?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},v=C=>T=>{T.target===T.currentTarget&&T.propertyName==="transform"&&s?.(),C?.(T);};if(a&&isValidElement(e)){let C=e,T=C.props.css,h=Array.isArray(T)?[...T,f]:T?[T,f]:[f],d=["plainframe-ui-transition-slide",C.props.className||"",u||""].join(" ").trim(),m=C.props.onTransitionEnd;return cloneElement(C,{...C.props,css:h,className:d,onTransitionEnd:v(m)})}let k=css(f);return jsx("div",{className:["plainframe-ui-transition-slide",u||""].join(" ").trim(),css:k,onTransitionEnd:v(),children:e})};var Gs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Al=me.createContext(null),Pl=()=>{let e=useContext(Al);if(!e)throw new Error("Modal components must be used within <Modal>.");return e},_m=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,u]=useState(!!n),i=t??a,l=useCallback(p=>{t===void 0&&u(p),o?.(p);},[t,o]);useEffect(()=>{if(!i||!s)return;let p=R=>{R.key==="Escape"&&(R.stopPropagation(),l(false));};return window.addEventListener("keydown",p,true),()=>window.removeEventListener("keydown",p,true)},[i,s,l]);let c=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(Al.Provider,{value:c,children:e})},Nl=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=Pl(),u=!!e&&me.isValidElement(t),i=useCallback(c=>{if(u){let p;me.isValidElement(t)&&(p=t.props.onClick),p?.(c);}r.onClick?.(c),c.defaultPrevented||a(true);},[u,t,r.onClick,a]),l=useCallback(c=>{if((c.key==="Enter"||c.key===" ")&&(c.preventDefault(),a(true)),u){let p;me.isValidElement(t)&&(p=t.props.onKeyDown),p?.(c);}r.onKeyDown?.(c);},[u,t,r.onKeyDown,a]);if(u){let c=t,p=c.props.css;return me.cloneElement(c,{...c.props||{},className:[c.props.className,n].filter(Boolean).join(" ")||void 0,css:[p,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})});Nl.displayName="ModalTrigger";var Dl=forwardRef(({children:e,variant:t="inset",width:n=500,height:o="auto",radius:r="lg",padding:s="lg",backdrop:a=true,backdropBlur:u=true,backdropBlurDepth:i=5,closeOnClickAway:l=true,transitionVariant:c="fade",direction:p="up",transitionDuration:R=300,containerCss:f,backdropCss:v,className:k,...C},T)=>{let h=U(),{open:d,setOpen:m,lockScroll:y}=Pl(),N=me.useRef(null),x=me.useRef(null);me.useEffect(()=>{if(!d)return;x.current=document.activeElement;let I=setTimeout(()=>{let S=N.current;if(!S)return;let g=S.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');g.length>0?g[0].focus():S.focus();},100),F=S=>{let g=N.current;if(!g||!S.target)return;let b=S.target;if(!g.contains(b)){S.preventDefault();let A=g.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');A.length>0?A[0].focus():g.focus();}};return document.addEventListener("focusin",F,true),()=>{clearTimeout(I),document.removeEventListener("focusin",F,true),x.current&&typeof x.current.focus=="function"&&x.current.focus();}},[d]);let w=typeof h.spacing.sm=="number"?`${h.spacing.sm}px`:String(h.spacing.sm),P=css({width:"100%",height:Gs(o),maxWidth:t==="inset"?`min(${Gs(n)||"100%"}, calc(100% - ${w} * 2))`:Gs(n),maxHeight:t==="inset"?`calc(100% - ${w} * 2)`:"100%",margin:t==="inset"?w:void 0}),$=jsx(_n,{role:"dialog","aria-modal":"true",tabIndex:-1,className:["plainframe-ui-modal",k||""].join(" ").trim(),padding:s,radius:r,variant:"panel",css:[P,f],ref:I=>{N.current=I,typeof T=="function"?T(I):T&&(T.current=I);},...C,children:e}),W=c==="none"?$:c==="slide"?jsx(qs,{on:d,direction:p,duration:R,children:$}):c==="grow"?jsx(Ks,{initialScale:.75,on:d,duration:R,children:$}):jsx(Ws,{on:d,duration:R,children:$});if(!a)return jsx(Fragment,{children:W});let K=css(t==="full"?{alignItems:"start",justifyItems:"start",justifyContent:"start"}:{alignItems:"center",justifyItems:"center",justifyContent:"center"});return jsx(Es,{on:d,blur:u,blurDepth:i,onClickAway:l?()=>m(false):void 0,css:[K,v].filter(Boolean),contentCss:K,lockScroll:y,children:W})});Dl.displayName="ModalContent";var Jm={xs:{h:22,px:8,font:11,radius:8,gap:4,icon:12},sm:{h:28,px:10,font:13,radius:9,gap:6,icon:14},md:{h:34,px:12,font:14,radius:10,gap:8,icon:16}},Zm=({count:e,page:t,defaultPage:n=1,onChange:o,siblingCount:r=1,boundaryCount:s=1,disabled:a=false,showFirstLast:u=false,loop:i=false,size:l="sm",variant:c="subtle",gap:p,className:R,css:f})=>{let v=U(),k=xe(),C=t!==void 0,[T,h]=useState(n),d=Math.max(1,e),m=Mr(C?t:T,1,d),y=useCallback(L=>{let z=Mr(L,1,d);C||h(z),o?.(z);},[C,d,o]),N=useMemo(()=>Qm({count:d,page:m,siblingCount:r,boundaryCount:s}),[d,m,r,s]),x=Jm[l],w=v.palette?.primary?.[600],P=v.surface?.border,$=c==="subtle"?v.surface.subtleHover:c==="ghost"?v.surface?.subtleBg:v.surface.panelHover,W=v.text?.primary??"#111",K=c==="subtle"?v.surface?.subtleBg:"transparent",I=css({display:"inline-flex",alignItems:"center",gap:p??x.gap,flexWrap:"wrap",borderRadius:v.radius?.md,background:K,padding:c==="subtle"?v.spacing.xs:0,userSelect:"none"},...Array.isArray(f)?f:f?[f]:[]),F=css({minWidth:x.h,height:x.h,padding:`0 ${x.px}px`,borderRadius:x.radius,fontSize:x.font,lineHeight:1,border:"1px solid transparent",background:"transparent",color:W,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:x.h,minWidth:x.h,height:x.h,padding:0}),g=(L=false)=>css([F,k({color:L?"primary":"neutral"}),c==="outlined"?L?{background:w,color:v.text.onColors.primary,borderColor:w}:{background:"transparent",borderColor:P,":hover":{background:$}}:c==="ghost"?L?{background:w,color:v.text.onColors.primary}:{":hover":{background:$}}:L?{background:w,color:v.text.onColors.primary,borderColor:w}:{":hover":{background:$}}]),b=useCallback(()=>y(1),[y]),A=useCallback(()=>y(d),[y,d]),H=useCallback(()=>{m===1?i&&y(d):y(m-1);},[m,i,d,y]),B=useCallback(()=>{m===d?i&&y(1):y(m+1);},[m,i,d,y]),M=a||m===1&&!i,E=a||m===d&&!i;return jsxs("nav",{"aria-label":"Pagination",className:["plainframe-ui-pagination",R||""].join(" ").trim(),css:I,onKeyDown:L=>{a||(L.key==="ArrowLeft"&&(L.preventDefault(),H()),L.key==="ArrowRight"&&(L.preventDefault(),B()),L.key==="Home"&&(L.preventDefault(),b()),L.key==="End"&&(L.preventDefault(),A()));},children:[u&&jsx("button",{className:"plainframe-ui-pagination-first-button",type:"button","aria-label":"First page","aria-disabled":M,disabled:M,css:[g(false),S],onClick:b,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronFirst,{strokeWidth:3,css:{width:x.icon,height:x.icon}})}),jsx("button",{className:"plainframe-ui-pagination-previous-button",type:"button","aria-label":"Previous page","aria-disabled":M,disabled:M,css:[g(false),S],onClick:H,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronLeft,{strokeWidth:3,css:{width:x.icon,height:x.icon}})}),N.map((L,z)=>typeof L=="number"?jsx("button",{className:"plainframe-ui-pagination-page-button",type:"button","aria-label":L===m?`Page ${L}, current page`:`Go to page ${L}`,"aria-current":L===m?"page":void 0,css:g(L===m),onClick:()=>y(L),children:L},L):jsx("span",{className:"plainframe-ui-pagination-ellipsis","aria-hidden":true,css:css([F,k(),{borderColor:"transparent",cursor:"default",opacity:.8,padding:0,minWidth:x.h}]),children:"\u2026"},`e${z}`)),jsx("button",{className:"plainframe-ui-pagination-next-button",type:"button","aria-label":"Next page","aria-disabled":E,disabled:E,css:[g(false),S],onClick:B,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronRight,{strokeWidth:3,css:{width:x.icon,height:x.icon}})}),u&&jsx("button",{className:"plainframe-ui-pagination-last-button",type:"button","aria-label":"Last page","aria-disabled":E,disabled:E,css:[g(false),S],onClick:A,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronLast,{strokeWidth:3,css:{width:x.icon,height:x.icon}})})]})};function Mr(e,t,n){return Math.max(t,Math.min(n,e))}function Qm({count:e,page:t,siblingCount:n,boundaryCount:o}){if(e<=0)return [1];let r=2*o+2*n+3;if(e<=r)return Sr(1,e);let s=Sr(1,Math.min(o,e)),a=Sr(Math.max(e-o+1,o+1),e),u=Mr(t-n,o+2,Math.max(o+2,e-o-2*n-1)),i=Mr(t+n,Math.min(o+2+2*n,e-o-1),e-o-1),l=[],c=p=>{let R=l[l.length-1];R!==p&&(R==="ellipsis"&&p==="ellipsis"||l.push(p));};return s.forEach(c),u>o+2?c("ellipsis"):o+1<u&&c(o+1),Sr(u,i).forEach(c),i<e-o-1?c("ellipsis"):e-o>i&&c(e-o),a.forEach(c),l}function Sr(e,t){if(t<e)return [];let n=[];for(let o=e;o<=t;o++)n.push(o);return n}var of=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,rf=me.memo(({children:e,direction:t="left",width:n,variant:o="solid",className:r,css:s})=>{let a=U(),u=a.surface.border,i=css({display:"inline-block",boxSizing:"border-box",maxWidth:of(n,"fit-content"),width:"100%",padding:`0 ${a.spacing.md}`,borderLeft:t==="left"?`3px ${o==="dashed"?"dashed":"solid"} ${u}`:"none",borderRight:t==="right"?`3px ${o==="dashed"?"dashed":"solid"} ${u}`:"none"},...Array.isArray(s)?s:s?[s]:[]);return jsx("div",{className:r??"plainframe-ui-quote",css:i,children:e})});var $l=createContext(null),cf=()=>{let e=useContext($l);if(!e)throw new Error("RadioItem must be used within a RadioGroup");return e},uf=e=>{let t=e?.horizontal??"left",n=e?.vertical??"center";return t==="center"&&n==="center"?{horizontal:"left",vertical:"center"}:{horizontal:t,vertical:n}},df=({value:e,defaultValue:t,onChange:n,disabled:o=false,size:r="md",direction:s="horizontal",variant:a="filled",className:u,children:i,anchorOrigin:l,css:c})=>{let p=U(),R=e!==void 0&&n!==void 0,[f,v]=useState(t),k=R?e:f,C=useRef([]),[T,h]=useState(0),d=()=>h(F=>F+1),m=useCallback(F=>{R||v(F),n?.(F);},[R,n]),y=useCallback(F=>(C.current.push(F),d(),C.current.length-1),[]),N=useCallback((F,S)=>{let g=C.current[F];g&&(C.current[F]={...g,...S},d());},[]),x=()=>C.current.map((F,S)=>({it:F,i:S})).filter(({it:F})=>F.ref&&!F.disabled).map(({i:F})=>F),w=useCallback((F,S)=>{let g=x();if(!g.length)return;let b=Math.max(0,g.indexOf(F)),A=g[(b+S+g.length)%g.length],H=C.current[A]?.ref;if(H){H.focus();let B=C.current[A]?.value;B!==void 0&&m(B);}},[m]),P=useCallback(F=>{let S=x();if(!S.length)return;let g=F==="first"?S[0]:S[S.length-1],b=C.current[g]?.ref;if(b){b.focus();let A=C.current[g]?.value;A!==void 0&&m(A);}},[m]),$=useMemo(()=>{let F=C.current.filter(g=>g.ref&&!g.disabled);return F.length?F.some(g=>g.value===k)?k:F[0]?.value:void 0},[k,T]),W=useMemo(()=>({selected:k,setSelected:m,disabled:o,size:r,direction:s,variant:a,register:y,update:N,moveFocusBy:w,moveToEdge:P,focusValue:$,theme:p,anchorOrigin:uf(l)}),[k,m,o,r,s,a,y,N,w,P,$,p,l]),K=css({width:"fit-content"}),I=css({display:"flex",flexDirection:s==="vertical"?"column":"row",gap:p.spacing.sm,width:"fit-content",alignItems:s==="vertical"?"stretch":"center"});return jsx("div",{className:u??"plainframe-ui-radio-group",css:[K,c],children:jsx("div",{className:"plainframe-ui-radio-row",role:"radiogroup","aria-disabled":o||void 0,css:I,children:jsx($l.Provider,{value:W,children:i})})})},pf=({value:e,disabled:t=false,className:n,children:o,css:r})=>{let{selected:s,setSelected:a,disabled:u,size:i,register:l,update:c,moveFocusBy:p,moveToEdge:R,theme:f,variant:v,focusValue:k,anchorOrigin:C}=cf(),T=u||t,h=s===e,d=["sm","md","lg"].includes(i)?i:"md",m=d==="sm"?16:d==="lg"?24:20,y=O=>f.palette?.primary?.[O],N=y(600),x=y(100),w=f.neutral[300],P=f.palette.primary[300],$=f.text.onColors?.primary??f.neutral[0],W="transparent",K=P,I=$;v==="soft"?(W=x,K=null,I=N):v==="outlined"?(W=y(50),K=P,I=N):(W=f.neutral[200],K="transparent",I=$),h&&(v==="outlined"?(W=x,K=P,I=N):v==="filled"?(W=N,K=null,I=$):(W=x,K=null,I=N));let F=v==="filled"?w:f.palette.primary[100],S=useRef(null),g=useRef(-1);useEffect(()=>{g.current=l({ref:S.current,value:e,disabled:!!T});},[l]),useEffect(()=>{c(g.current,{ref:S.current,value:e,disabled:!!T});},[c,T,e]);let b=css({border:"none",background:"transparent",display:"inline-grid",gridTemplateColumns:"auto auto auto",gridTemplateRows:"auto auto auto",columnGap:C.vertical==="center"?f.spacing.sm:0,rowGap:C.vertical==="center"?0:f.spacing.xs,justifyItems:"center",alignItems:"center",opacity:T?.5:1,borderRadius:f.radius.md,cursor:T?"not-allowed":"pointer",transition:"transform .16s ease",fontSize:f.typography.sizes.sm,fontWeight:500,padding:f.spacing.sm,"&:hover .plainframe-ui-radio-circle-outer":T||h?{}:{background:F,boxShadow:v==="outlined"?`inset 0 0 0 ${f.componentHeights.border} ${P}`:"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:W,boxShadow:K?`inset 0 0 0 ${f.componentHeights.border} ${K}`:"none",transition:"background-color .16s ease, box-shadow .16s ease, filter .16s ease",display:"inline-flex",alignItems:"center",justifyContent:"center"}),H=css({width:h?m*.45:0,height:h?m*.45:0,borderRadius:f.radius.full,background:h?I:"transparent",transition:"all 250ms cubic-bezier(.72,1.6,.32,1)",transform:h?"scale(1)":"scale(0.6)",opacity:h?1:0}),B=css({gridColumn:2,gridRow:2,minWidth:0,maxWidth:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",textAlign:"left"}),M=(()=>{let O=C.horizontal,_=C.vertical;return _==="center"?{col:O==="right"?3:1,row:2}:{col:2,row:_==="top"?1:3}})(),L=!T&&k===e?0:-1,z=xe();return jsxs("button",{ref:S,className:n??"plainframe-ui-radio-item",type:"button",role:"radio","aria-checked":h,"aria-disabled":T||void 0,disabled:T,tabIndex:L,onClick:()=>{T||a(e);},onKeyDown:O=>{T||(O.key==="Enter"||O.key===" "?(O.preventDefault(),a(e)):O.key==="ArrowRight"||O.key==="ArrowDown"?(O.preventDefault(),p(g.current,1)):O.key==="ArrowLeft"||O.key==="ArrowUp"?(O.preventDefault(),p(g.current,-1)):O.key==="Home"?(O.preventDefault(),R("first")):O.key==="End"&&(O.preventDefault(),R("last")));},css:[b,z({color:"primary"}),r],children:[jsx("span",{className:"plainframe-ui-radio-circle-outer",css:[A,css({gridColumn:M.col,gridRow:M.row})],children:jsx("span",{className:"plainframe-ui-radio-circle-dot",css:H})}),o!=null&&jsx("span",{className:"plainframe-ui-radio-label",css:B,children:o})]})};var hf=({children:e,duration:t=400,delay:n=0,on:o=false,initialAngle:r=360,finalAngle:s=0,onAnimationEnd:a,asChild:u=true,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"},c=R=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),R?.(f);};if(u&&isValidElement(e)){let R=e,f=R.props.css,v=Array.isArray(f)?[...f,l]:f?[f,l]:[l],k=["plainframe-ui-transition-rotate",R.props.className||"",i||""].join(" ").trim(),C=R.props.onTransitionEnd;return cloneElement(R,{...R.props,css:v,className:k,onTransitionEnd:c(C)})}let p=css(l);return jsx("div",{className:["plainframe-ui-transition-rotate",i||""].join(" ").trim(),css:p,onTransitionEnd:c(),children:e})};var Mo=(...e)=>e.filter(Boolean).flat(),Fr=e=>me.isValidElement(e),Fo=(e,t)=>{if(!Fr(e))return false;let n=e.type,o=(n?.displayName??n?.name??"")||"";return typeof o=="string"&&t.includes(o)},vf=(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 Cf({value:e,defaultValue:t,onChange:n,label:o,placeholder:r="Select\u2026",startIcon:s,endIcon:a,disabled:u,size:i="md",variant:l="subtle",fullWidth:c,width:p=200,menuAlign:R="left",menuWidth:f,menuMaxHeight:v=280,wrapperCss:k,labelCss:C,triggerCss:T,menuCss:h,optionCss:d,children:m,className:y,menuSize:N="md",triggerRender:x}){let w=U(),P=xe(),$=me.useId(),W=`${$}-label`,K=`${$}-menu`,I={sm:{minHeight:w.componentHeights.sm,radius:w.radius.sm},md:{minHeight:w.componentHeights.md,radius:w.radius.md},lg:{minHeight:w.componentHeights.lg,radius:w.radius.md}},F=I[i]||I.md,[S,g]=me.useState(false),b=j=>g(!!j),A=typeof e<"u",H=Array.isArray(e)||Array.isArray(t),[B,M]=me.useState(typeof t<"u"?t:H?[]:void 0),E=A?e:B,L=j=>{A||M(j),n?.(j);},z=me.Children.toArray(m).filter(Fr),O,_=[];for(let j of z)if(Fo(j,["MenuRadioGroup"]))O=j;else if(Fo(j,["MenuCheckboxGroup"])){let ue=j.props.children,de=ue?me.Children.toArray(ue).filter(Fr):[];_.push(...de);}else _.push(j);let V=(O?me.Children.toArray(O.props.children).filter(Fr):_).filter(j=>!Fo(j,["MenuLabel","MenuSeparator"])).map((j,ue)=>{let de=j.props,fe=vf(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=Fo(j,["MenuCheckboxItem"]),tn=Fo(j,["MenuRadioItem"]),nn=yt||Ye==="menuitemcheckbox"||typeof de.onCheckedChange=="function"||typeof de.checked=="boolean"||typeof de.defaultChecked=="boolean",Sn=!nn&&(tn||Ye==="menuitemradio"||!!O),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}}),J=V.some(j=>j.isCheckbox),ae=V.length>0&&V.every(j=>j.isRadio),X=(H||J)&&!ae,le=me.useCallback(j=>X?(Array.isArray(E)?E:[]).some(de=>Object.is(de,j)):Object.is(E,j),[E,X]),ie=me.useMemo(()=>{if(X){let ue=Array.isArray(E)?E:[];return V.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=V.find(ue=>Object.is(ue.value,E));if(j)return typeof j.nodeForTrigger=="string"||typeof j.nodeForTrigger=="number"?String(j.nodeForTrigger):j.nodeForTrigger},[E,X,V]),be=j=>{u||(Object.is(j,E)||L(j),b(false));},Pe=j=>{u||Object.is(j,E)||L(j);},Re=j=>{if(u)return;let ue=Array.isArray(E)?E:[],fe=ue.some(ze=>Object.is(ze,j))?ue.filter(ze=>!Object.is(ze,j)):[...ue,j];L(fe);},Ce={position:"relative",width:c?"100%":typeof p=="number"?`${p}px`:p,maxWidth:"100%"},Ie={width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:F.radius,minHeight:F.minHeight,fontSize:w.typography.sizes.sm,padding:`0 ${typeof w.spacing.sm=="number"?`${w.spacing.sm}px`:w.spacing.sm} 0 ${typeof w.spacing.md=="number"?`${w.spacing.md}px`:w.spacing.md}`,fontWeight:500,lineHeight:1,userSelect:"none",cursor:u?"not-allowed":"pointer",border:"none",outline:"none",transition:"box-shadow .16s ease",color:w.text.primary,background:"transparent",whiteSpace:"nowrap"},Te=l==="subtle"?{background:w.surface.subtleBg}:l==="outlined"?{background:w.surface.panelBg,border:`1px solid ${w.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:w.text.secondary,flexShrink:0}),strokeWidth:2.5,className:"plainframe-ui-select-chevron"}),Ee=()=>{if(x)return x(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=>{u||(j.key==="ArrowDown"||j.key==="ArrowUp"||j.key==="Enter"||j.key===" ")&&(j.preventDefault(),b(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"},Y={fontSize:"0.875em",color:w.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(Y),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=Mo(d,j.itemCss),Oe=j.el.props,st=typeof Oe.children>"u"?j.labelText??String(de):Oe.children;if(X||j.isCheckbox)return me.cloneElement(j.el,{key:j.key??ue,disabled:u||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:u||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":u||j.disabled||void 0,disabled:u||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=!X&&(O||V.length>0&&V.every(ue=>ue.isRadio));return O?me.cloneElement(O,{key:"controlled-inner-group",value:E,onValueChange:ue=>Pe(ue),children:V.map(re)}):j?jsx(lr,{value:E,onValueChange:ue=>Pe(ue),children:V.map(re)}):V.map(re)})();return jsxs("div",{css:Mo(Ce,k),className:["plainframe-ui-select-wrapper",y||""].join(" ").trim(),children:[o&&jsx("div",{id:W,className:"plainframe-ui-select-label",css:Mo({marginBottom:6,fontSize:w.typography.sizes.sm,fontWeight:500,color:w.text.secondary},C),children:o}),jsxs($n,{size:N,open:S,onOpenChange:b,children:[jsx(zn,{width:"100%",asChild:true,children:jsxs("button",{type:"button",disabled:u,"aria-haspopup":"menu","aria-expanded":S||void 0,"aria-controls":K,"aria-labelledby":o?W:void 0,onKeyDown:ee,onClick:()=>b(!S),className:"plainframe-ui-select-trigger",css:Mo(css(Ie),css(Te),T,P()),children:[jsx("div",{className:"plainframe-ui-select-trigger-content",css:css(we),children:Ee()}),a??Z]})}),jsx(hn,{id:K,gap:"xs",align:Q[R],sameWidth:f==null,width:f??p,className:"plainframe-ui-select-menu",css:Mo({maxHeight:typeof v=="number"?`${v}px`:v,overflowY:"auto"},h),children:qe})]})]})}var Zs=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Tf=keyframes`
|
|
13
|
+
`,Kc=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("),_c=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(Kc(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]&&_c.has(o[2])?o[2]:"600";if(r==="primary"&&e.palette.primary?.[s])return e.palette.primary[s];let i=e.palette[r];if(i&&i[s]!=null)return i[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:i,spinDuration:u=.75,wrapperCss:a,trackCss:l,barCss:c,circleCss:p,"aria-label":R})=>{let f=U(),v=typeof t=="number",k=Math.max(o-n,1),C=v?qa(t,n,o):void 0,T=v?(C-n)/k*100:void 0,h=jc(f,r),d=f.surface.subtleBg,m=f.radius?.md;return e==="circular"?jsx(Uc,{size:s,active:h,isDeterminate:v,percent:T,spinDuration:u,wrapperCss:a,trackCss:l,circleCss:p,ariaLabel:R,thickness:i}):jsx(Vc,{thickness:i,active:h,track:d,radius:m,isDeterminate:v,percent:T,wrapperCss:a,trackCss:l,barCss:c,ariaLabel:R,min:n,max:o,value:C})}),Vc=({thickness:e=4,active:t,track:n,radius:o,isDeterminate:r,percent:s,wrapperCss:i,trackCss:u,barCss:a,ariaLabel:l,min:c,max:p,value:R})=>{let f=o==null?"8px":typeof o=="number"?`${o}px`:String(o),v=css([{display:"inline-block",width:"100%"},...Array.isArray(i)?i:i?[i]:[]]),k=css([{position:"relative",width:"100%",height:ns(e,"6px"),backgroundColor:n,borderRadius:f,overflow:"hidden"},...Array.isArray(u)?u:u?[u]:[]]),C=r?Math.max(s??0,Ua):Ua,T=css([{position:"absolute",inset:0,backgroundColor:t,borderRadius:"inherit",transformOrigin:"left",transform:`scaleX(${C/100})`,transition:"transform 160ms cubic-bezier(.2,0,.2,1)",willChange:"transform"},...Array.isArray(a)?a:a?[a]:[]]),h={position:"absolute",top:0,bottom:0,backgroundColor:t,borderRadius:"inherit",willChange:"left,right","@media (prefers-reduced-motion: reduce)":{animation:"none"}},d=css([{...h,left:"-35%",right:"100%",animation:`${Oc} 2.1s cubic-bezier(.65,.815,.735,.395) infinite`},...Array.isArray(a)?a:a?[a]:[]]),m=css([{...h,left:"-200%",right:"100%",animation:`${Wc} 2.1s cubic-bezier(.165,.84,.44,1) 1.15s infinite`},...Array.isArray(a)?a:a?[a]:[]]),y=r?{role:"progressbar","aria-valuemin":c,"aria-valuemax":p,"aria-valuenow":R}:{role:"progressbar","aria-busy":true};return l&&(y["aria-label"]=l),jsx("span",{css:v,...y,children:jsx("div",{className:"plainframe-ui-progress-linear-track",css:k,children:r?jsx("div",{className:"plainframe-ui-progress-linear-fill",css:T}):jsxs(Fragment,{children:[jsx("div",{className:"plainframe-ui-progress-linear-runner1",css:d}),jsx("div",{className:"plainframe-ui-progress-linear-runner2",css:m})]})})})},Uc=({size:e,thickness:t=4,active:n,isDeterminate:o,percent:r,spinDuration:s,wrapperCss:i,trackCss:u,circleCss:a,ariaLabel:l})=>{let c=U(),p=40,R=(p-t)/2,f=2*Math.PI*R,k=`${(o?qa((r??0)/100,.01,1):.7)*f} ${f}`,C=css([{display:"inline-block",width:ns(e,`${c.componentHeights.md}`),height:ns(e,`${c.componentHeights.md}`)},...Array.isArray(i)?i:i?[i]:[]]),T=css([{width:"100%",height:"100%",transform:"rotate(-90deg)",transformBox:"fill-box",transformOrigin:"50% 50%"},...Array.isArray(u)?u:u?[u]:[]]),h=css([{stroke:n,strokeLinecap:"butt",strokeDasharray:k,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":`${zc} ${s}s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},...Array.isArray(a)?a:a?[a]:[]]),d=o?{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r??0)}:{role:"progressbar","aria-busy":true};return l&&(d["aria-label"]=l),jsx("span",{css:C,className:"plainframe-ui-progress-circular",...d,children:jsx("svg",{css:T,viewBox:`0 0 ${p} ${p}`,focusable:"false","aria-hidden":true,children:jsx("circle",{cx:p/2,cy:p/2,r:R,strokeWidth:t,css:h})})})};var Ya=createContext(null),Ja=()=>{let e=useContext(Ya);if(!e)throw new Error("AlertTitle and AlertDescription must be used inside <Alert>.");return e},nu=css({display:"flex",flexDirection:"column",textAlign:"left",minWidth:0,flex:1}),ou=css({lineHeight:0,display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"}),ru=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:i="100%",size:u="md",loading:a=false,css:l,children:c,...p},R){let f=U(),v=useId(),k=useId(),C=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(u)?F[u]:F.md},[u,f.typography,f.radius,f.spacing]),T=f.palette??{},h=f.neutral??{},d=useMemo(()=>{let S=(E=>E==="danger"?T.danger??T.error??h:E==="warning"?T.warning??h:E==="success"?T.success??h:E==="info"?T.info??T.primary??h:h)(t),g=S?.[50]??h[50],b=S?.[300]??h[300],A=S?.[600]??S?.[500]??h[600],H=S?.[700]??A,B=S?.[800]??f.text?.primary??"#000",M=f.text?.onColors?.[t]??f.text?.onColors?.primary??f.text?.primary??"#fff";return n==="filled"?{bg:A,fg:M,border:void 0,iconColor:M}:n==="outlined"?{bg:g,fg:B,border:`1px solid ${b}`,iconColor:B}:n==="ghost"?{bg:"transparent",fg:H,border:"none",iconColor:H}:{bg:g,fg:B,border:void 0,iconColor:H}},[t,n,h,T,f.text]),m=t==="danger"||t==="warning"?"alert":"status",y=useMemo(()=>a?jsx(no,{variant:"circular",color:d.iconColor,size:C.iconSize/1.25,thickness:4.5}):o??(t==="danger"?jsx(CircleAlert,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor}):t==="warning"?jsx(TriangleAlert,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor}):t==="success"?jsx(CircleCheckBig,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor}):jsx(Info,{css:{width:C.iconSize,height:C.iconSize},color:d.iconColor})),[a,o,t,C.iconSize,d.iconColor]),N=useMemo(()=>css({display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:`${C.paddingY} ${C.paddingX}`,gap:C.gap,borderRadius:C.radius,backgroundColor:d.bg,color:d.fg,border:d.border,fontSize:C.fontSize,fontWeight:500,maxWidth:typeof i=="number"?`${i}px`:i,width:"100%"}),[d.bg,d.border,d.fg,C.fontSize,C.gap,C.paddingX,C.paddingY,C.radius,i]),x=useMemo(()=>css({display:"flex",alignItems:"flex-start",gap:C.gap,minWidth:0,flex:1}),[C.gap]),w=useMemo(()=>[ou,{color:d.iconColor}],[d.iconColor]),P=useMemo(()=>css({display:"flex",alignItems:"center",gap:C.gap,marginLeft:C.gap,flex:"0 0 auto"}),[C.gap]),$=useMemo(()=>[ru,{color:d.fg}],[d.fg]),W=useMemo(()=>({fg:d.fg,iconColor:d.iconColor,s:C,titleId:v,descId:k}),[d.fg,d.iconColor,C,v,k]),K=me.Children.toArray(c).some(F=>me.isValidElement(F)&&F.type===ss),I=me.Children.toArray(c).some(F=>me.isValidElement(F)&&F.type===as);return jsx(Ya.Provider,{value:W,children:jsxs("div",{ref:R,role:m,"aria-live":m==="alert"?"assertive":"polite","aria-atomic":"true","aria-busy":a,"aria-labelledby":K?v:void 0,"aria-describedby":I?k:void 0,className:`plainframe-ui-alert plainframe-ui-alert-${t} plainframe-ui-alert-${n}`,css:[N,l],...p,children:[jsxs("div",{className:"plainframe-ui-alert-left",css:x,children:[y&&jsx("span",{className:"plainframe-ui-alert-icon",css:w,children:y}),jsx("div",{className:"plainframe-ui-alert-content",css:nu,children:c})]}),s&&jsx("div",{className:"plainframe-ui-alert-actions",css:P,children:jsx("button",{type:"button","aria-label":"Close alert",onClick:s,disabled:a,className:"plainframe-ui-alert-close",css:$,children:r??jsx(X,{strokeWidth:2,size:C.iconSize-2})})})]})})});Za.displayName="Alert";var ss=forwardRef(function({children:t,css:n,...o},r){let{fg:s,s:i,titleId:u}=Ja(),a=useMemo(()=>css({color:s,fontWeight:i.titleWeight,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[s,i.titleWeight]);return jsx("span",{ref:r,id:u,className:"plainframe-ui-alert-title",css:[a,n],...o,children:t})});ss.displayName="AlertTitle";var as=forwardRef(function({children:t,css:n,...o},r){let{fg:s,descId:i}=Ja(),u=useMemo(()=>css({color:s,marginTop:2,lineHeight:1.35,wordBreak:"break-word"}),[s]);return jsx("span",{ref:r,id:i,className:"plainframe-ui-alert-desc",css:[u,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:i,helperText:u,disabled:a=false,fullWidth:l=false,width:c=250,size:p="md",variant:R="subtle",rounded:f=false,startIcon:v,endIcon:k,togglePasswordVisible:C=false,showClear:T,type:h="text",step:d,focusRingMode:m="always",className:y,wrapperCss:N,inputCss:x,labelCss:w,helperRowCss:P,helperTextCss:$,startIconCss:W,endIconCss:K,css:I,onBlur:F,onFocus:S,onKeyDown:g,autoFocus:b,name:A,id:H,tabIndex:B,autoComplete:M,readOnly:E,required:L,maxLength:z,onSurfaceClick:O},_){let D=U(),V=Yo(),J=useId(),ae=useMemo(()=>{let ce={sm:{fontSize:D.typography.sizes.sm,minHeight:D.componentHeights.sm,labelFont:D.typography.sizes.xs,helperFont:D.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:D.spacing.md,iconSize:D.typography.sizes.xs,codeFontSize:21},md:{fontSize:D.typography.sizes.sm,minHeight:D.componentHeights.md,labelFont:D.typography.sizes.sm,helperFont:D.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:D.spacing.md,iconSize:D.typography.sizes.xs,codeFontSize:24},lg:{fontSize:D.typography.sizes.sm,minHeight:D.componentHeights.lg,labelFont:D.typography.sizes.md,helperFont:D.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:D.spacing.md,iconSize:D.typography.sizes.xs,codeFontSize:28}},ke=["sm","md","lg"].includes(p)?p:"md";return ce[ke]},[p,D]),q=D.neutral,X$1=D.text,le=h==="number",ie=h==="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&&(d!=null&&String(d).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=a?q[200]:i&&R==="outlined"?D.palette.danger?.[50]??D.surface.panelBg:i&&R==="subtle"?D.palette.danger?.[50]??D.surface.subtleBg:R==="outlined"?D.surface.panelBg:R==="subtle"?D.surface.subtleBg:"transparent",Q=D.componentHeights.border,ee=R==="outlined"?`${Q} solid ${i?D.palette.danger?.[300]??D.surface.border:D.surface.border}`:"none",se=Xt({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:l?"100%":c!=null?is(c):void 0,flex:"0 0 auto",fontWeight:500}),pe=useMemo(()=>Xt({fontSize:ae.labelFont,fontWeight:500,color:i?D.palette.danger?.[700]??X$1.primary:a?q[500]:X$1.primary,marginBottom:4,display:"inline-block"},...Gt(w)),[ae.labelFont,i,a,q,X$1,D.palette.danger,w]),Se=useMemo(()=>Xt({display:"flex",alignItems:"center",gap:D.spacing.sm,padding:`${is(ae.paddingY)} ${is(ae.paddingX)}`,background:Ee,border:ee,borderRadius:f?D.radius.full:D.radius.md,minHeight:ae.minHeight,boxSizing:"border-box",width:"100%",cursor:a?"not-allowed":"text",opacity:a?.65:1,transition:"box-shadow .18s, border-color .16s"},...Gt(N),...Gt(I)),[D,ae.minHeight,ae.paddingX,ae.paddingY,Ee,ee,f,a,N,I]),Ne=useMemo(()=>Xt({flex:1,minWidth:0,fontSize:ae.fontSize,fontWeight:500,fontFamily:"inherit",color:a?q[500]:i?D.palette.danger?.[800]??X$1.primary:X$1.primary,background:"transparent",border:"none",outline:"none",padding:0,lineHeight:1.25,cursor:a?"not-allowed":"text",appearance:le?"textfield":"auto","&::placeholder":{color:i?D.palette.danger?.[700]??X$1.secondary:X$1.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${i?D.palette.danger?.[800]??X$1.primary:X$1.primary} !important`,boxShadow:`0 0 0 1000px ${Ee} inset !important`,transition:"opacity 99999s ease-out",caretColor:i?D.palette.danger?.[800]??X$1.primary:X$1.primary},":focus-within":{outline:"none",border:"none",boxShadow:"none"}},...Gt(x)),[ae.fontSize,a,q,X$1,i,D.palette.danger,le,Ee,x]),Y=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:i?D.palette.danger?.[800]??X$1.secondary:X$1.secondary,marginLeft:-3},...Gt(W)),[i,D.palette.danger,X$1.secondary,W]),oe=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:i?D.palette.danger?.[800]??X$1.secondary:X$1.secondary,border:"none",background:"transparent",lineHeight:0,cursor:"inherit",padding:0},...Gt(K)),[i,D.palette.danger,X$1.secondary,a,K]),re=useMemo(()=>Xt({minHeight:16,fontSize:ae.helperFont,color:i?D.palette.danger?.[700]??X$1.secondary:X$1.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Gt(P)),[ae.helperFont,i,D.palette.danger,X$1.secondary,P]),qe=useMemo(()=>Xt({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400},...Gt($)),[$]),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}z&&ke.length>z||Ie(ke);},[le,z,Ie,Z]),[fe,ze]=useState(false),Oe=useCallback(()=>{a||ze(ce=>!ce);},[a]),st=useCallback(()=>{a||(Ie(""),j.current?.focus());},[a,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(()=>v?jsx("span",{css:Y,children:ei(v,Ye)}):null,[v,Y,Ye]),tn=useMemo(()=>css({display:"flex",alignItems:"center",gap:4}),[]),nn=useMemo(()=>{let ce=[];if(ie&&C){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:a,children:bt},"pw-toggle"));}T&&Ce&&Ce.length>0&&!a&&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=k?jsx("span",{css:oe,children:ei(k,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,C,fe,Ye,oe,tn,a,T,Ce,k,Oe,st]),Sn=u!=null?`${H??J}-help`:void 0,on=H??J,Je=useCallback(ce=>{if(a)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();}},[a]),xt=useCallback(ce=>{if(a)return;let ke=j.current;if(ke&&(O?.(ce),document.activeElement!==ke)){ke.focus({preventScroll:true});try{let at=ke.value?.length??0;ke.setSelectionRange?.(at,at);}catch{}}},[a,O]);return jsxs("div",{className:["plainframe-ui-textfield",y||""].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:[V({enabled:m!=="none",color:i?"danger":void 0}),Se],onPointerDownCapture:Je,onClick:xt,"aria-invalid":!!i||void 0,children:[yt,jsx("input",{ref:ue,id:on,className:"plainframe-ui-textfield-input",css:Ne,type:ie&&!fe?"password":h==="number"?"text":h,inputMode:he,pattern:je,value:Ce,maxLength:le?void 0:z,onChange:le?ce=>Z(ce.target.value):de,placeholder:s||"",disabled:a,onBlur:F,onFocus:S,onKeyDown:g,autoFocus:b,name:A,tabIndex:B,autoComplete:M,readOnly:E,required:L,"aria-invalid":!!i||void 0,"aria-describedby":Sn}),nn]}),u!=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:u})})]})}));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:i,css:u,children:a,label:l,allItemsTabbable:c=false,...p},R){let f=U(),[v,k]=useState(false),C=useRef(null),T=typeof f.spacing.xs=="number"?`${f.spacing.xs}px`:String(f.spacing.xs),h=t==="outlined"?f.surface.panelBg:t==="subtle"?f.surface.subtleBg??f.neutral[50]:"transparent",d=s?void 0:css({background:h,border:t==="outlined"?`${f.componentHeights.border} solid ${f.surface.border}`:"none",borderRadius:f.radius.lg,"--pfui-panel-pad":T,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",y=useMemo(()=>({isKeyboardNav:v,setIsKeyboardNav:k}),[v]),N=useMemo(()=>({allItemsTabbable:c}),[c]),x=useCallback(S=>Array.from(S.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(g=>{if(g.closest('[role="menu"]')!==S)return false;let b=window.getComputedStyle(g);return b.display!=="none"&&b.visibility!=="hidden"}),[]),w=useCallback(S=>{S.removeAttribute("data-keyboard-nav"),S.querySelectorAll("[data-highlighted]").forEach(g=>g.removeAttribute("data-highlighted")),k(false);},[]),P=useRef(false),$=useCallback(S=>{if(S.target!==S.currentTarget)return;if(P.current){P.current=false;return}let g=S.currentTarget,b=x(g);b.length>0&&(k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(A=>A.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(A=>A.removeAttribute("data-hovered")),b[0].setAttribute("data-highlighted",""),b[0].focus({preventScroll:true}));},[x]),W=useCallback(S=>{let g=S.currentTarget,b=x(g);if(b.length===0)return;if(S.key==="Tab"){P.current=true,g.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),k(false),g.tabIndex=-1,requestAnimationFrame(()=>{g.tabIndex=0,P.current=false;});return}let A=g.querySelector("[data-highlighted]"),H=g.querySelector("[data-hovered]"),B=A||H,M=B?b.indexOf(B):-1;if(S.key==="ArrowDown"||S.key==="ArrowUp"){S.preventDefault(),S.stopPropagation(),k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(z=>z.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(z=>z.removeAttribute("data-hovered")),M===-1&&(M=S.key==="ArrowDown"?-1:b.length);let E=S.key==="ArrowDown"?1:-1,L=(M+E+b.length)%b.length;b[L].setAttribute("data-highlighted",""),b[L].focus({preventScroll:true});return}if(S.key==="Home"){S.preventDefault(),S.stopPropagation(),k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),b[0].setAttribute("data-highlighted",""),b[0].focus({preventScroll:true});return}if(S.key==="End"){S.preventDefault(),S.stopPropagation(),k(true),g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),b[b.length-1].setAttribute("data-highlighted",""),b[b.length-1].focus({preventScroll:true});return}if(S.key==="Escape"){S.preventDefault(),g.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),k(false),g.blur();return}},[x]),K=useCallback(S=>{let g=S.currentTarget;g.hasAttribute("data-keyboard-nav")&&w(g);},[w]),I=useCallback(S=>{let g=S.currentTarget;g.hasAttribute("data-keyboard-nav")&&w(g);},[w]),F=useCallback(S=>{C.current=S,typeof R=="function"?R(S):R&&(R.current=S);},[R]);return jsx(oo.Provider,{value:y,children:jsx(ro.Provider,{value:N,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":v?"":void 0,tabIndex:0,"aria-label":l||void 0,className:["plainframe-ui-menu",i||""].join(" ").trim(),css:[d,u],onFocus:$,onKeyDown:W,onPointerMove:K,onPointerDown:I,...p,children:a})]})})})})})});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 Nu(e,t){e&&(typeof e=="function"?e(t):e.current=t);}var io=(...e)=>t=>{for(let n of e)Nu(n,t);},cs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Du=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}},Hu=({open:e,defaultOpen:t,onOpenChange:n,triggerOn:o="click",lockScroll:r=true,trapFocus:s=true,children:i})=>{let[u,a]=useState(!!t),l=e??u,c=C=>{e===void 0&&a(C),n?.(C);},p=useRef(null),R=useRef(null),f=(C=120)=>{R.current!=null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>c(false),C);},v=()=>{R.current!=null&&(window.clearTimeout(R.current),R.current=null);};Du(r&&l),useEffect(()=>{if(!s||!l||typeof document>"u")return;let C=T=>{if(T.key!=="Tab")return;let h=document.querySelector(".plainframe-ui-popover");if(!h)return;let d=Array.from(h.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(x=>{let w=window.getComputedStyle(x);return w.display!=="none"&&w.visibility!=="hidden"});if(d.length===0)return;let m=d[0],y=d[d.length-1],N=document.activeElement;T.shiftKey&&N===m?(T.preventDefault(),y.focus()):!T.shiftKey&&N===y&&(T.preventDefault(),m.focus());};return document.addEventListener("keydown",C,true),()=>document.removeEventListener("keydown",C,true)},[s,l]);let k=useMemo(()=>({open:l,setOpen:c,triggerOn:o,referenceRef:p,scheduleClose:f,cancelClose:v}),[l,o]);return jsx(ii.Provider,{value:k,children:i})},li=forwardRef(({asChild:e=true,children:t,css:n},o)=>{let{open:r,setOpen:s,triggerOn:i,referenceRef:u,scheduleClose:a,cancelClose:l}=or(),c=me.Children.only(t),p=c.props||{},R=io(u,o,c.ref),f=i==="click"?{onClick:k=>{k.stopPropagation(),s(!r),p.onClick?.(k);}}:{onMouseEnter:k=>{l(),r||s(true),p.onMouseEnter?.(k);},onMouseLeave:k=>{a(),p.onMouseLeave?.(k);}},v={"aria-haspopup":"dialog","aria-expanded":r};if(e){let k=c.props?.css;return me.cloneElement(c,{...f,...v,ref:R,css:[k,n].filter(Boolean)})}return me.createElement("button",{ref:R,type:"button",css:[n],...f,...v,children:c})});li.displayName="PopoverTrigger";var ci=forwardRef(({asChild:e=true,width:t,css:n,children:o},r)=>{let{referenceRef:s}=or(),i=me.Children.only(o),u=io(s,r,i.ref);if(e){let l=i.props?.css;return me.cloneElement(i,{ref:u,css:[l,n].filter(Boolean)})}let a=css({display:"inline-block",width:cs(t),verticalAlign:"middle",...n});return jsx("span",{ref:u,css:a,children:i})});ci.displayName="PopoverAnchor";function Lu(e){let t=e?.vertical??"bottom",n=e?.horizontal??"center";if(t==="top"||t==="bottom"){let s=t,i=n==="left"?"start":n==="right"?"end":"center";return i==="center"?s:`${s}-${i}`}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:i,height:u,padding:a,paddingX:l,paddingY:c,radius:p="lg",css:R,...f},v)=>{let{open:k,setOpen:C,triggerOn:T,referenceRef:h,scheduleClose:d,cancelClose:m}=or(),y=U(),N=Lu(e),{refs:x,x:w,y:P,strategy:$,context:W}=useFloating({open:k,onOpenChange:C,whileElementsMounted:autoUpdate,placement:N,strategy:"fixed",middleware:[offset({mainAxis:t,crossAxis:n}),flip({padding:o}),shift({padding:o})]});useEffect(()=>{h.current&&x.setReference(h.current);},[x,h]);let K=useDismiss(W,{outsidePressEvent:"pointerdown",escapeKey:true}),I=useRole(W,{role:"dialog"}),{getFloatingProps:F}=useInteractions([K,I]),[S]=W.placement.split("-"),g=S,b=`${g==="left"?"right":g==="right"?"left":"center"} ${g==="top"?"bottom":g==="bottom"?"top":"center"}`,A=8,H=g==="top"?{y:A}:g==="bottom"?{y:-A}:g==="left"?{x:A}:{x:-A},B={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"}}},M=y.surface.panelBg,E=y.text.primary,L=`${y.componentHeights.border} solid ${y.surface.border}`,z=tr(a,y.spacing),O=tr(l,y.spacing),_=tr(c,y.spacing),D={};z&&(D.padding=z),O&&(D.paddingInline=O),_&&(D.paddingBlock=_);let V=tr(p,y.radius)??y.radius.md,J="0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)",ae=css({position:$,top:P??0,left:w??0,zIndex:1e3,transformOrigin:b,pointerEvents:"auto",display:"inline-flex",flexDirection:"column",width:cs(i)??"fit-content",height:cs(u)??"fit-content",boxSizing:"border-box",willChange:"opacity, transform"}),q=r?css({}):css({background:M,color:E,border:L,borderRadius:V,boxShadow:J,...D,...D.padding||D.paddingInline||D.paddingBlock?{}:{padding:typeof y.spacing?.sm=="number"?`${y.spacing.sm}px ${y.spacing.md}px`:`${y.spacing?.sm??"0.5rem"} ${y.spacing?.md??"1rem"}`}}),X=T==="hover"?{onMouseEnter:m,onMouseLeave:()=>d()}:{},le=io(x.setFloating,v),ie=jsx(motion.div,{className:"plainframe-ui-popover",...F({...f,ref:le,...X}),...B,css:[ae,q,R],children:s});return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:k?ie:null})})});ui.displayName="PopoverContent";var Bu=()=>{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:i,className:u,css:a,trackCss:l,thumbCss:c,labelCss:p,...R},f){let v=U(),k=xe(),C={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}},T={slideMs:250,pressMs:150,easing:"ease"},h=t!==void 0,[d,m]=useState(n),y=h?!!t:d,[N,x]=useState(false);useEffect(()=>{if(r)return;x(true);let O=setTimeout(()=>x(false),T.pressMs);return ()=>clearTimeout(O)},[y,r]);let w=["sm","md","lg"].includes(s)?s:"md",P=C[w],$=`${T.slideMs}ms ${T.easing}`,W=v.palette?.primary?.[600]??v.neutral[900],K=v.neutral[300],I=y?W:K,F=y?v.text.onColors.primary:"#ffffff",{trackW:S,trackH:g,thumb:b}=P,A=(g-b)/2,H=css({display:"inline-flex",alignItems:"center",gap:P.labelGap,cursor:r?"not-allowed":"pointer",width:"fit-content",padding:v.spacing.xs,borderRadius:v.radius.sm,outline:"none"}),B=css({position:"relative",width:S,height:g,backgroundColor:I,borderRadius:v.radius.full,transition:`background-color ${$}, opacity 120ms ease`,willChange:"background-color",cursor:r?"not-allowed":"pointer",opacity:r?.5:1}),M=css({position:"absolute",top:A,left:y?S-b-A:A,width:b,height:b,backgroundColor:F,borderRadius:v.radius.full,transition:`left ${$}, transform ${$}, background-color 0.25s ease`,transform:N?"scaleX(1.2)":"scaleX(1)",transformOrigin:y?"right center":"left center"}),E=css({fontSize:v.typography.sizes.sm,fontWeight:500,color:r?v.text.muted:v.text.primary}),L=()=>{if(r)return;let O=!y;h||m(O),o?.(O);};return jsxs("label",{ref:f,role:"switch","aria-checked":y,"aria-disabled":r||void 0,"data-checked":y?"":void 0,"data-disabled":r?"":void 0,tabIndex:r?-1:0,onClick:L,onKeyDown:O=>{r||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),L());},className:["plainframe-ui-switch",u||""].join(" ").trim(),css:[H,k({color:y?"primary":"neutral"}),a],...R,children:[jsx("div",{className:"plainframe-ui-switch-track",css:[B,l],children:jsx("div",{className:"plainframe-ui-switch-thumb",css:[M,c]})}),i!=null&&jsx("span",{className:"plainframe-ui-switch-label",css:[E,p],children:i})]})}));var Vu=(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:i,rounded:u=false,checkedIcon:a,color:l="primary",css:c,boxCss:p,checkCss:R,labelCss:f,descriptionCss:v,className:k,...C},T)=>{let h=U(),d=xe(),m=typeof e=="boolean",[y,N]=useState(t),x=m?e:y,w=r==="sm"||r==="lg"?r:"md",P=useMemo(()=>Vu(h,w),[h,w]),{checkedBg:$,checkColor:W,borderCol:K,hoverBg:I,gapPx:F}=useMemo(()=>{let O=h.palette||{},_=h.neutral||{},D=h.text?.onColors||{},V,J;l==="neutral"||l==="secondary"?(V=_,J="neutral"):typeof l=="string"&&Object.prototype.hasOwnProperty.call(O,l)?(V=O[l]||O.primary||_,J=l):(V=O.primary||_,J="primary");let ae=V[600]??V[500]??V[400]??Object.values(V)[0]??h.palette.primary[600],q=D[J]??D.primary??h.text?.onColors?.primary??h.text.primary,X=typeof P.gap=="number"?P.gap+2:P.gap;return {checkedBg:ae,checkColor:q,borderCol:h.surface.border,hoverBg:h.surface.panelHover,gapPx:X}},[P.gap,l,h]),S=useMemo(()=>css({display:"inline-flex",alignItems:s&&i?"flex-start":"center",gap:F,cursor:o?"not-allowed":"pointer",userSelect:"auto",position:"relative",width:"fit-content",borderRadius:h.radius.sm,padding:h.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:K,backgroundColor:I},"input:checked + .plainframe-ui-checkbox-box":{backgroundColor:$,outlineColor:$,"--pfui-bleed":$},'&:not([data-disabled="true"]):hover input:checked + .plainframe-ui-checkbox-box':{outlineColor:$,backgroundColor:$,"--pfui-bleed":$},".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)"}}),[K,$,i,o,F,I,s,h.radius.sm,h.spacing.xs]),g=useMemo(()=>css({position:"absolute",opacity:0,width:0,height:0,margin:0,padding:0,pointerEvents:"none"}),[]),b=useMemo(()=>css({width:P.box,height:P.box,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",outline:`${P.borderWidth} solid ${K}`,outlineOffset:`-${P.borderWidth}`,boxShadow:"inset 0 0 0 0.5px var(--pfui-bleed, transparent)",borderRadius:u?h.radius.full:P.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"}),[P.box,P.borderRadius,P.borderWidth,K,u,h.radius.full]),A=useMemo(()=>({w:Math.round(P.box*P.iconRatioW),h:Math.round(P.box*P.iconRatioH)}),[P.box,P.iconRatioH,P.iconRatioW]),H=useMemo(()=>css({width:A.w,height:A.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,A.h,A.w]),B=useMemo(()=>css({display:"flex",flexDirection:"column",minWidth:0,userSelect:"text",WebkitUserSelect:"text"}),[]),M=useMemo(()=>css({fontSize:P.labelFont,lineHeight:1.1,fontWeight:500,userSelect:"text",WebkitUserSelect:"text",color:h.text.primary}),[P.labelFont,h.text.primary]),E=useMemo(()=>css({fontSize:P.labelFont,lineHeight:1.25,color:h.text.secondary,fontWeight:400,marginTop:s&&i?h.spacing.xs:0,userSelect:"text",WebkitUserSelect:"text"}),[P.labelFont,i,s,h.spacing.xs,h.text.secondary]),L=useCallback(()=>{o||(m?n?.(!x):N(O=>{let _=!O;return n?.(_),_}));},[o,m,x,n]),z=useCallback(O=>{o||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),L());},[o,L]);return jsxs("label",{ref:T,role:"checkbox","aria-checked":x,"aria-disabled":o||void 0,"data-state":x?"checked":"unchecked",className:["plainframe-ui-checkbox",k||""].join(" ").trim(),css:[S,d({color:x?"primary":"neutral"}),c,o?css({opacity:.6}):null],"data-disabled":o?"true":"false",tabIndex:o?-1:0,onKeyDown:z,children:[jsx("input",{type:"checkbox",checked:x,onChange:L,disabled:o,css:g,...C,tabIndex:-1}),jsx("span",{className:"plainframe-ui-checkbox-box",css:[b,p],"aria-hidden":"true",children:jsx("span",{className:"plainframe-ui-checkbox-check",css:[H,R],children:x&&(a||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||i)&&jsxs("span",{className:"plainframe-ui-checkbox-text",css:B,children:[s&&jsx("span",{className:"plainframe-ui-checkbox-label",css:[M,f],children:s}),i&&jsx("span",{className:"plainframe-ui-checkbox-description",css:[E,v],children:i})]})]})}));sr.displayName="Checkbox";var Gu=()=>useContext(fn),Xu=()=>useContext(ro),Yu=()=>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:i,className:u,css:a,startIcon:l,endIcon:c,selected:p=false,active:R,meta:f,__index:v,__skipListReg:k,...C},T){let h=Gu(),d=Yu(),m=cr(),y=uo(),N=Xu(),x=U(),P=!!useContext(Tt),$=C["data-subtrigger"]!==void 0,W=$&&c===void 0?jsx(ChevronRight,{size:18,strokeWidth:2.5}):c,I=typeof o=="number"?o:o===false?0:0,F=useContext(er),S=F==="subtle"?x.surface?.subtleHover??x.neutral[100]:x.surface?.subtleBg??x.neutral[100],g=useMemo(()=>css({width:"100%",borderRadius:x.radius.md,padding:`${x.spacing.sm} ${x.spacing.sm}`,paddingLeft:I>0?`calc(${x.spacing.md} + (${x.spacing.xl} * ${I}))`:x.spacing.md,minHeight:P?x.componentHeights.sm:x.componentHeights.md,display:"flex",alignItems:"center",gap:x.spacing.sm,fontWeight:500,fontSize:x.typography.sizes.sm,cursor:t?"not-allowed":"pointer",opacity:t?.55:1,userSelect:"none",background:"transparent",color:n?x.palette.danger[800]:x.text.primary,transition:"background-color .16s ease, color .16s ease",outline:"none","[role='menu']:not([data-keyboard-nav]) &:hover":t?{}:{background:n?x.palette.danger[50]:S},"&[data-highlighted]":t?{}:{background:n?x.palette.danger[50]:S},"&[data-active]":t?{}:{background:n?x.palette.danger[50]:S},"&[data-subtrigger][aria-expanded='true']":t?{}:{background:n?x.palette.danger[50]:S},"[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:x.surface.border},"& > [data-label]":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),[x,P,I,t,n,S]),b=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:x.spacing.sm,"& > svg":{width:16,height:16,display:"block"},color:x.text.secondary}),[x.text.secondary,x.spacing.sm]),H=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:x.palette.primary[600],"& > svg":{width:16,height:16,display:"block"}}),[x.palette.primary]),B=[];P&&B.push({minHeight:x.componentHeights.sm,paddingLeft:x.spacing.sm,paddingRight:x.spacing.xs,paddingTop:x.spacing.xs,paddingBottom:x.spacing.xs});let M=()=>{s?.(),r&&!$&&d?.closeAll();},E=(z,O)=>{let _=z.closest('[role="menu"]');if(!_)return;let D=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(X=>{if(X.closest('[role="menu"]')!==_)return false;let le=window.getComputedStyle(X);return le.display!=="none"&&le.visibility!=="hidden"});if(!D.length)return;let V=D.indexOf(z),J=V>=0?V:0,ae=O(D.length,J),q=D[ae];q&&(document.querySelectorAll("[data-highlighted]").forEach(X=>{X.removeAttribute("data-highlighted");}),q.setAttribute("data-highlighted",""),q.focus(),h&&v!=null&&h.setActiveIndex(ae));},L=t?-1:N?.allItemsTabbable?0:-1;return jsxs("div",{role:"menuitem","aria-disabled":t||void 0,"data-disabled":t?"":void 0,"data-active":R?"":void 0,tabIndex:L,ref:z=>{if(h&&!k){let O=h.listRef.current;z&&(v!=null?O[v]=z:O.includes(z)||O.push(z));}typeof T=="function"?T(z):T&&"current"in T&&(T.current=z);},onMouseMove:z=>{if(z.currentTarget.hasAttribute("data-hovered"))return;let O=!!z.currentTarget.closest("[data-submenu-content]");!$&&m&&!O&&gi(m.closeAllSubMenus),document.querySelectorAll("[data-hovered]").forEach(D=>{D.removeAttribute("data-hovered");}),document.querySelectorAll("[data-highlighted]").forEach(D=>{D.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-active]").forEach(D=>{D.removeAttribute("data-active");}),z.currentTarget.setAttribute("data-hovered","");let _=z.currentTarget.closest("[data-menu-id]")||z.currentTarget.closest('[role="menu"]');_?.hasAttribute("data-keyboard-nav")&&_.removeAttribute("data-keyboard-nav"),!t&&h&&v!=null&&h.setActiveIndex(v),!t&&!N?.allItemsTabbable&&z.currentTarget.focus({preventScroll:true});},onMouseEnter:z=>{if($)lo();else {let D=!!z.currentTarget.closest("[data-submenu-content]");m&&!D&&gi(m.closeAllSubMenus);}z.currentTarget.hasAttribute("data-hovered")||(document.querySelectorAll("[data-highlighted]").forEach(D=>{D.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-hovered]").forEach(D=>{D.removeAttribute("data-hovered");}),document.querySelectorAll("[data-active]").forEach(D=>{D.removeAttribute("data-active");})),z.currentTarget.setAttribute("data-hovered","");let _=z.currentTarget.closest("[data-menu-id]")||z.currentTarget.closest('[role="menu"]');!t&&h&&v!=null&&(_?.hasAttribute("data-keyboard-nav")&&(_.removeAttribute("data-keyboard-nav"),y&&y.setIsKeyboardNav(false)),h.setActiveIndex(v)),!t&&!N?.allItemsTabbable&&z.currentTarget.focus({preventScroll:true});},onFocus:()=>{},onMouseLeave:()=>{h&&h.setActiveIndex(null);},onKeyDown:z=>{if(t)return;let O=z.currentTarget;if(z.key==="Tab"&&h&&!N?.allItemsTabbable){z.preventDefault();return}if(z.key==="Tab"&&!h){let _=O.closest('[role="menu"]');if(_){_.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(V=>V.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(V=>V.removeAttribute("data-hovered"));let D=_.tabIndex;_.tabIndex=-1,requestAnimationFrame(()=>{_.tabIndex=D>=0?D:0;});}y&&y.setIsKeyboardNav(false);return}if(z.key==="Enter"||z.key===" "||z.key==="ArrowRight"){$||z.key!=="ArrowRight"&&(z.preventDefault(),z.stopPropagation(),M());return}if(z.key==="ArrowLeft"&&O.closest('[role="menu"]')?.closest("[data-submenu-content]")){z.preventDefault(),z.stopPropagation();let V=document.querySelector('[data-subtrigger][aria-expanded="true"]');if(V){let J=V.__pfuiCloseSubmenu;J&&J(),document.querySelectorAll("[data-highlighted]").forEach(q=>q.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(q=>q.removeAttribute("data-hovered")),V.setAttribute("data-highlighted",""),V.focus();let ae=V.closest("[data-menu-id]");ae&&ae.setAttribute("data-keyboard-nav","");}return}if(z.key==="Escape"){z.preventDefault(),z.stopPropagation(),d?.closeAll(),O.closest('[role="menu"]')&&document.querySelector('[aria-expanded="true"][aria-haspopup="menu"]')?.focus();return}if(z.key==="ArrowDown"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),y&&y.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,(D,V)=>(V+1)%D);return}if(z.key==="ArrowUp"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),y&&y.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,(D,V)=>(V-1+D)%D);return}if(z.key==="Home"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,()=>0);return}if(z.key==="End"){z.preventDefault(),z.stopPropagation();let _=O.closest("[data-menu-id]")||O.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(D=>D.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(D=>D.removeAttribute("data-hovered")),E(O,D=>D-1);return}},className:["plainframe-ui-menu-item",u||""].join(" ").trim(),css:css(...[g,...B,a].flat()),...C,onClick:z=>{t||(z.currentTarget.removeAttribute("data-highlighted"),M());},children:[l&&jsx("span",{className:"plainframe-ui-menu-item-start",css:b,children:l}),i,(f!=null||W||p)&&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:x.typography.sizes.sm,color:x.text.secondary,whiteSpace:"nowrap"}),children:f}):null,W,p&&jsx("span",{className:"plainframe-ui-menu-item-selected",css:H,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??[]),i=e!==void 0,u=i?e:r,a=useRef(u);a.current=u;let l=useRef(n);l.current=n;let c=useCallback(R=>{let f=a.current,k=f.some(C=>Object.is(C,R))?f.filter(C=>!Object.is(C,R)):[...f,R];i||s(k),l.current?.(k);},[i]),p=useMemo(()=>({values:u,toggle:c}),[u,c]);return jsx(hi.Provider,{value:p,children:o})},co=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,value:r,children:s,__index:i,disabled:u=false,css:a,className:l,startIcon:c,endIcon:p,...R},f){let v=useContext(hi),k=!!v&&r!==void 0,C=!k&&t!==void 0,[T,h]=useState(()=>k?v.values.some(K=>Object.is(K,r)):!!n),d=k?v.values.some(K=>Object.is(K,r)):C?!!t:T,m=U(),N=!!useContext(Tt),x=()=>{if(!u)if(k)v.toggle(r);else {let K=!d;C||h(K),o?.(K);}},w=css({width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,marginLeft:N?-1:-3,borderRadius:m.radius.xs,transition:"background-color .12s ease"}),P=css({pointerEvents:"none"}),$=useCallback(K=>{K&&(K.querySelectorAll("[tabindex]").forEach(I=>{I.tabIndex=-1;}),K.querySelectorAll('input, button, a, [role="checkbox"]').forEach(I=>{I.tabIndex=-1;}));},[]),W=jsxs(Fragment,{children:[jsx("span",{ref:$,"data-menu-checkbox-wrapper":true,className:"plainframe-ui-menu-checkbox-wrapper",css:w,"aria-hidden":"true",children:jsx(sr,{size:"sm",checked:d,css:P})}),c]});return jsx(pn,{...R,className:["plainframe-ui-menu-checkbox-item",l||""].join(" ").trim(),ref:f,__index:i,role:"menuitemcheckbox","aria-checked":d,closeOnSelect:false,onSelect:x,disabled:u,startIcon:W,endIcon:p,css:a,selected:false,children:s})});co.displayName="MenuCheckboxItem";var yi=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,children:r,__index:s,disabled:i=false,css:u,switchSize:a="md",switchCss:l,startIcon:c,className:p,...R},f){let v=t!==void 0,[k,C]=useState(!!n),T=v?!!t:k,d=!!useContext(Tt),m=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),y=css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,paddingRight:d?2:void 0}),N=()=>{if(i)return;let w=!T;v||C(w),o?.(w);},x=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,{...R,className:["plainframe-ui-menu-switch-item",p||""].join(" ").trim(),ref:f,__index:s,disabled:i,closeOnSelect:false,onSelect:N,css:u,selected:false,children:[c&&jsx("span",{className:"plainframe-ui-menu-item-start",css:x,children:c}),jsx("span",{"data-label":true,css:m,className:"plainframe-ui-menu-item-label",children:r}),jsx("span",{className:"plainframe-ui-menu-switch-wrap",css:y,children:jsx(ms,{checked:T,css:css({pointerEvents:"none",padding:0,marginRight:-1},l),className:"plainframe-ui-menu-switch",tabIndex:-1,size:a})})]})});yi.displayName="MenuSwitchItem";var xi=me.createContext(null),lr=({value:e,defaultValue:t,onValueChange:n,children:o})=>{let[r,s]=useState(t),i=e??r,u=l=>{e!==void 0||s(l),n?.(l);},a=useMemo(()=>({value:i,onChange:u}),[i]);return jsx(xi.Provider,{value:a,children:o})};lr.displayName="MenuRadioGroup";var Ju=forwardRef(function({value:t,children:n,__index:o,disabled:r=false,css:s,className:i,...u},a){let l=useContext(xi),c=l?.value===t,p=U(),R=css({width:p.spacing.md,display:"inline-flex",justifyContent:"center",alignItems:"center",marginLeft:-1}),f=css({width:7,height:7,borderRadius:"100%",backgroundColor:p.palette.primary[600],transform:c?"scale(1)":"scale(0.4)",opacity:c?1:0,transition:"transform 140ms ease-out, opacity 140ms linear",transformOrigin:"center center"}),v=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"});return jsxs(pn,{...u,className:["plainframe-ui-menu-radio-item",i||""].join(" ").trim(),ref:a,__index:o,role:"menuitemradio","aria-checked":c,closeOnSelect:false,onSelect:()=>{r||l?.onChange?.(t);},disabled:r,css:s,selected:false,children:[jsx("span",{className:"plainframe-ui-menu-radio-dotbox",css:R,children:jsx("span",{className:"plainframe-ui-menu-radio-dot",css:f})}),jsx("span",{className:"plainframe-ui-menu-item-label",css:v,children:n})]})}),mn=forwardRef(function({inset:t,className:n,css:o,children:r,startIcon:s,endIcon:i,wrap:u=false,color:a="primary",...l},c){let p=U(),f=!!useContext(Tt),v=a==="primary"?p.text.primary:a==="secondary"?p.text.secondary:p.palette[a]?.[700]??p.text.primary,k=css({display:"flex",alignItems:"center",padding:f?`${p.spacing.sm} ${p.spacing.md}`:`${p.spacing.sm} ${p.spacing.md}`,fontSize:p.typography.sizes.sm,color:v,fontWeight:500,...t?{paddingLeft:`calc(${p.spacing.lg} * 2)`}:null,gap:p.spacing.xs}),C=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:u?"normal":"nowrap"}),T=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"}}),h=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:c,role:"presentation",className:["plainframe-ui-menu-label",n||""].join(" ").trim(),css:css(k,o),...l,children:[s&&jsx("span",{className:"plainframe-ui-menu-label-start",css:T,children:s}),jsx("span",{className:"plainframe-ui-menu-label-text",css:C,children:r}),i&&jsx("span",{className:"plainframe-ui-menu-label-end",css:h,children:i})]})});mn.displayName="MenuLabel";var Zu=({className:e,css:t,variant:n="full",...o})=>{let r=U(),s=`var(--pfui-panel-pad, ${typeof r.spacing.xs=="number"?r.spacing.xs+"px":String(r.spacing.xs)})`,i=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)"}),u=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.md}`,marginRight:`${r.spacing.md}`}),a=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.lg}`,marginRight:0}),l=n==="full"?i:n==="middle"?u:a;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,dd=()=>typeof window>"u"||typeof document>"u"?0:window.innerWidth-document.documentElement.clientWidth;function pd(){if(!(typeof document>"u")){if(po===0){let e=document.body;dr=e.style.overflow||"",pr=e.style.paddingRight||"";let t=dd();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}po+=1;}}function md(){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),fd=()=>useContext(mo),oo=createContext(null),uo=()=>useContext(oo),Ci=createContext(null),cr=()=>useContext(Ci),Ri=createContext(false),gd=()=>useContext(Ri),ro=createContext({allItemsTabbable:true}),ur=me.createContext(null),hs=()=>useContext(ur);function bd(){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 hd=()=>fd()?.activeIndex??null,Ti=0,$n=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="click",lockScroll:r=true,size:s="md",children:i})=>{let[u,a]=useState(!!t),l=e??u,c=useCallback(F=>{e===void 0&&a(F),n?.(F);},[e,n]),p=useRef(`pfui-menu-${++Ti}`),R=useRef(null),f=useRef([]),v=useRef(null),[k,C]=useState(null),[T,h]=useState(false);useEffect(()=>{l||(C(null),f.current=[],h(false));},[l]);let d=useRef(null),m=useCallback((F,S)=>{if(o!=="hover")return;window.clearTimeout(d.current??0);let g=S??20;d.current=window.setTimeout(()=>c(F),g);},[o,c]),y=useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null);},[]);useEffect(()=>()=>y(),[y]),useEffect(()=>{if(!(!r||!l))return pd(),()=>md()},[l,r]);let N=hs(),[x]=useState(()=>N??bd()),w=useRef(new Set),P=useMemo(()=>({registerSubMenu:F=>(w.current.add(F),()=>w.current.delete(F)),closeAllSubMenus:()=>{w.current.forEach(F=>F());}}),[]),$=useMemo(()=>({open:l,setOpen:c,trigger:o,referenceRef:R,listRef:f,floatingRef:v,setActiveIndex:C,scheduleSubmenuHover:m,clearSubmenuHover:y,menuId:p.current}),[l,c,o,C,m,y]),W=useMemo(()=>({activeIndex:k,setActiveIndex:C}),[k,C]),K=useMemo(()=>({isKeyboardNav:T,setIsKeyboardNav:h}),[T]),I=s==="sm";return jsx(ur.Provider,{value:x,children:jsx(Tt.Provider,{value:I,children:jsx(oo.Provider,{value:K,children:jsx(Ci.Provider,{value:P,children:jsx(mo.Provider,{value:W,children:jsx(fn.Provider,{value:$,children:i})})})})})})};$n.displayName="DropdownMenu";var zn=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},i)=>{let{open:u,setOpen:a,trigger:l,referenceRef:c,listRef:p,setActiveIndex:R,scheduleSubmenuHover:f,clearSubmenuHover:v,floatingRef:k,menuId:C}=mr(),T=uo(),h=cr(),d=!!e&&isValidElement(t),m=d?t:null,y=m&&m.props&&typeof m.props=="object"&&"onKeyDown"in m.props?m.props.onKeyDown:void 0,N=m&&m.props&&typeof m.props=="object"&&"onClick"in m.props?m.props.onClick:void 0,{onKeyDown:x,onClick:w,...P}=s,$=useMemo(()=>bs(i,d&&isValidElement(t)&&"ref"in t?t.ref:void 0,c),[i,d,t,c]),W=useCallback(()=>p.current.filter(Boolean),[p]),K=useCallback(b=>{let A=W();requestAnimationFrame(()=>A[b]?.focus());},[W]),I=useCallback(b=>{if(b.key==="Tab"&&u){b.preventDefault(),T?.setIsKeyboardNav(true);let A=k?.current;if(A){A.setAttribute("data-keyboard-nav","");let H=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])');H&&(document.querySelectorAll("[data-highlighted]").forEach(B=>B.removeAttribute("data-highlighted")),H.setAttribute("data-highlighted",""),H.focus());}return}if(b.key==="ArrowRight"&&u){let A=document.querySelector("[data-subtrigger][data-hovered]");if(A){b.preventDefault(),b.stopPropagation(),T?.setIsKeyboardNav(true),A.removeAttribute("data-hovered"),A.setAttribute("data-highlighted",""),A.focus(),requestAnimationFrame(()=>{let H=new KeyboardEvent("keydown",{key:"ArrowRight",bubbles:true,cancelable:true});A.dispatchEvent(H);});return}}if(b.key==="ArrowDown"||b.key==="ArrowUp"){if(T?.setIsKeyboardNav(true),!u){b.preventDefault(),a(true),requestAnimationFrame(()=>{let A=C?document.querySelector(`[data-menu-id="${C}"]`):k?.current;if(A){A.setAttribute("data-keyboard-nav","");let H=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(B=>{let M=B.closest("[data-submenu-content]");if(M&&M!==A)return false;let E=window.getComputedStyle(B);return E.display!=="none"&&E.visibility!=="hidden"});if(H.length>0){let B=b.key==="ArrowDown"?0:H.length-1;R(B),H[B]?.setAttribute("data-highlighted",""),H[B]?.focus();}}}),y?.(b),x?.(b);return}if(u){b.preventDefault();let A=document.querySelectorAll("[data-hovered]");for(let B of Array.from(A))if(B.closest("[data-submenu-content]")){let E=B.closest('[role="menu"]');if(E){E.setAttribute("data-keyboard-nav","");let L=Array.from(E.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')).filter(O=>{if(O.closest('[role="menu"]')!==E)return false;let _=window.getComputedStyle(O);return _.display!=="none"&&_.visibility!=="hidden"}),z=L.indexOf(B);if(document.querySelectorAll("[data-highlighted]").forEach(O=>O.removeAttribute("data-highlighted")),B.removeAttribute("data-hovered"),z!==-1&&L.length>0){let O=b.key==="ArrowDown"?1:-1,_=(z+O+L.length)%L.length;L[_]?.setAttribute("data-highlighted",""),L[_]?.focus();}return}}let H=C?document.querySelector(`[data-menu-id="${C}"]`):k?.current;if(H){H.setAttribute("data-keyboard-nav",""),h?.closeAllSubMenus();let B=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(M=>{if(M.closest('[role="menu"]')!==H)return false;let E=window.getComputedStyle(M);return E.display!=="none"&&E.visibility!=="hidden"});if(B.length>0){let M=H.querySelector("[data-highlighted]"),E=H.querySelector("[data-hovered]"),L=-1;M?L=B.indexOf(M):E&&(L=B.indexOf(E)),document.querySelectorAll("[data-highlighted]").forEach(_=>_.removeAttribute("data-highlighted")),E&&E.removeAttribute("data-hovered"),L===-1&&(L=b.key==="ArrowDown"?-1:B.length);let z=b.key==="ArrowDown"?1:-1,O=(L+z+B.length)%B.length;R(O),B[O]?.setAttribute("data-highlighted",""),B[O]?.focus();}}y?.(b),x?.(b);return}}if((b.key==="Enter"||b.key===" ")&&!u){b.preventDefault(),T?.setIsKeyboardNav(true),a(true),requestAnimationFrame(()=>{let A=C?document.querySelector(`[data-menu-id="${C}"]`):k?.current;if(A){A.setAttribute("data-keyboard-nav","");let H=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(B=>{let M=B.closest("[data-submenu-content]");if(M&&M!==A)return false;let E=window.getComputedStyle(B);return E.display!=="none"&&E.visibility!=="hidden"});H.length>0&&(R(0),H[0]?.setAttribute("data-highlighted",""),H[0]?.focus());}}),y?.(b),x?.(b);return}y?.(b),x?.(b);},[u,a,R,y,x,W,K,p,T,C,k,h]),F=useCallback(b=>{l==="click"&&((b.nativeEvent.composedPath?.()??[]).some(M=>{let E=M;if(!E||!("tagName"in E))return false;let L=String(E.tagName).toUpperCase();if(L==="INPUT"||L==="TEXTAREA"||"isContentEditable"in E&&E.isContentEditable)return true;let z="getAttribute"in E?E.getAttribute("role"):null;return z==="textbox"||z==="combobox"})||(b.stopPropagation(),a(!u))),N?.(b),w?.(b);},[l,u,a,N,w]),S=l==="hover"?{onMouseEnter:()=>{v(),a(true);},onMouseLeave:()=>{f(false);}}:{},g=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0;if(d&&m){let b=m.props,A=b.css,H=typeof b.className=="string"?b.className:void 0,B=typeof b.tabIndex=="number"?b.tabIndex:0,M={ref:$,tabIndex:B,className:[H,o].filter(Boolean).join(" ")||void 0,css:[A,g,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":u,onClick:F,onKeyDown:I,...S,...P};return cloneElement(m,M)}return jsx("button",{ref:$,className:o,css:[css({display:"inline-block"}),g,r],type:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":u,onClick:F,onKeyDown:I,...S,...P,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:i=false,width:u,height:a,maxHeight:l,unstyled:c=false,closeOnBlur:p=false,allItemsTabbable:R=false,className:f,css:v,children:k,exitPlacement:C,animateOnBusClose:T=true,gap:h,ignoreOutsidePressRefs:d,disableOutsidePressDismiss:m=false,returnFocus:y=false,...N},x)=>{let{open:w,setOpen:P,referenceRef:$,clearSubmenuHover:W,setActiveIndex:K,floatingRef:I,menuId:F}=mr(),S=U(),g=hs(),b=uo();useEffect(()=>{if(!g)return;let Y=g.registerCloser(()=>P(false));return ()=>{Y&&Y();}},[g,P]);let A=typeof o=="string"?parseFloat(o):o,H=typeof r=="string"?parseFloat(r):r,B=typeof s=="string"?parseFloat(s):s,M=`${t}${n==="center"?"":`-${n}`}`,E=useCallback(Y=>({getBoundingClientRect:()=>{let oe=Math.round(Y.x),re=Math.round(Y.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}),[]),L=useMemo(()=>{if(!e)return null;if(e instanceof HTMLElement||typeof e=="object"&&e!==null&&"getBoundingClientRect"in e&&typeof e.getBoundingClientRect=="function")return e;let Y=e;return E({x:Y.x,y:Y.y})},[e,E]),{refs:z,x:O,y:_,strategy:D,context:V,update:J}=useFloating({open:w,onOpenChange:P,placement:M,whileElementsMounted:autoUpdate,middleware:[offset({mainAxis:A??0,crossAxis:H??0}),flip({padding:B??8}),shift({padding:B??8}),size({apply({rects:Y,elements:oe}){let re=oe.floating;re.style.boxSizing="border-box",a!=null?re.style.height=typeof a=="number"?`${a}px`:String(a):re.style.removeProperty("height"),u!=null?re.style.width=typeof u=="number"?`${u}px`:String(u):i?re.style.width=`${Math.round(Y.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(()=>{L?z.setReference(L):$.current&&z.setReference($.current);},[z,L,$]),useEffect(()=>{if(!w)return;let Y=L||$.current,oe=z.floating.current;if(!(!Y||!oe))return autoUpdate(Y,oe,J)},[w,L,$,z,J]),useEffect(()=>{J();},[J,i,u,a,l]),useEffect(()=>{w&&!R&&K(0);},[w,R,K]),useEffect(()=>{if(!p||!w)return;let Y=()=>{let oe=document.activeElement,re=$.current,qe=z.floating.current;oe&&(re?.contains(oe)||qe?.contains(oe)||P(false));};return document.addEventListener("focusin",Y,true),()=>document.removeEventListener("focusin",Y,true)},[p,w,P,$,z.floating]);let ae=useDismiss(V,{outsidePressEvent:"pointerdown",escapeKey:true,outsidePress:m?false:Y=>{if(d?.length){let oe=Y.target;for(let re of d)if(re.current?.contains(oe))return false}return true}}),q=useRole(V,{role:"menu"}),{getFloatingProps:X}=useInteractions([ae,q]),le=useRef(false);useEffect(()=>{w?le.current=true:le.current&&$.current&&y&&(g?.isBusClosingRef.current||requestAnimationFrame(()=>{$.current?.focus();}));},[w,$,g,y]);let ie=typeof S.spacing.xs=="number"?`${S.spacing.xs}px`:String(S.spacing.xs),be=h===void 0?void 0:typeof h=="number"?h:S.spacing[h]??h,Pe=c?void 0:css({boxSizing:"border-box",background:S.surface.panelBg,border:`${S.componentHeights.border} solid ${S.surface.border}`,borderRadius:S.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:S.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=Y=>{if(!Y||typeof Y!="object"||!isValidElement(Y))return Y;let re=Y.type?.displayName;if(re==="DropdownMenu"||re==="DropdownMenuSub")return Y;if(re==="MenuItem"||re==="MenuCheckboxItem"||re==="MenuRadioItem"||re==="MenuSwitchItem")return Re+=1,cloneElement(Y,{__index:Re,key:Y.key??Re});if(re==="DropdownMenuTrigger"){let j=Y.props.children;return cloneElement(Y,{children:me.Children.map(j,Ce)})}if(re==="DropdownMenuSubTrigger"){Re+=1;let j=Re;return cloneElement(Y,{__index:j,key:Y.key??j})}let qe=Y.props.children;return qe==null?Y:cloneElement(Y,{children:me.Children.map(qe,Ce)})},Ie=me.Children.map(k,Ce),we=V.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=C??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=!!g?.isBusClosingRef.current&&!T?{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:D,top:_??0,left:O??0,zIndex:1e3,transformOrigin:he}),pe=useCallback(Y=>{if(Y.key==="Tab"){Y.preventDefault();return}if(Y.key==="ArrowDown"||Y.key==="ArrowUp"){Y.preventDefault(),b?.setIsKeyboardNav(true);let oe=Y.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=Y.key==="ArrowDown"?-1:re.length);let de=Y.key==="ArrowDown"?1:-1,fe=(ue+de+re.length)%re.length;K(fe),re[fe]?.setAttribute("data-highlighted",""),re[fe]?.focus();}}},[b,K]),Se=useCallback(Y=>{let oe=Y.currentTarget;oe.removeAttribute("data-keyboard-nav"),oe.querySelectorAll("[data-highlighted]").forEach(re=>re.removeAttribute("data-highlighted")),b?.isKeyboardNav&&b.setIsKeyboardNav(false);},[b]),Ne=useCallback(Y=>{Y.removeAttribute("data-keyboard-nav"),Y.querySelectorAll("[data-highlighted]").forEach(oe=>oe.removeAttribute("data-highlighted")),b?.isKeyboardNav&&b.setIsKeyboardNav(false);},[b]);return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:w?jsx(ro.Provider,{value:{allItemsTabbable:R},children:jsx(motion.div,{...X({...N,ref:bs(x,z.setFloating,Y=>{I&&(I.current=Y);})}),"data-menu-id":F,"data-keyboard-nav":b?.isKeyboardNav?"":void 0,className:f,css:[Pe,se,v],initial:je,animate:{opacity:1,x:0,y:0,scale:1},exit:Ee,transition:ee,onPointerMove:Y=>Ne(Y.currentTarget),onPointerDown:Y=>Ne(Y.currentTarget),onKeyDown:pe,onMouseMove:Se,onMouseEnter:()=>{W(),g?.clearAllHover();},onMouseLeave:()=>{document.querySelectorAll("[data-hovered]").forEach(Y=>Y.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 i=gd(),[u,a]=useState(!!t),l=e??u,c=useCallback(I=>{e===void 0&&a(I),n?.(I);},[e,n]),p=useRef(null),R=useRef(false),f=useCallback((I,F)=>{if(o!=="hover")return;window.clearTimeout(p.current??0),R.current=I;let S=F??20;p.current=window.setTimeout(()=>{R.current=false,c(I);},S);},[o,c]),v=useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null,R.current=false);},[]);useEffect(()=>()=>v(),[v]);let k=cr();useEffect(()=>{if(!k)return;let I=()=>{v(),c(false);};return k.registerSubMenu(I)},[k,c,v]);let C=useRef(`pfui-submenu-${++Ti}`),T=useRef(null),h=useRef([]),d=useRef(null),[m,y]=useState(null),[N,x]=useState(false);useEffect(()=>{l||(y(null),h.current=[],x(false));},[l]);let w=useContext(Tt),P=r??w,$=useMemo(()=>({open:l,setOpen:c,trigger:o,referenceRef:T,listRef:h,floatingRef:d,setActiveIndex:y,scheduleSubmenuHover:f,clearSubmenuHover:v,pendingOpenRef:R,menuId:C.current}),[l,c,o,y,f,v]),W=useMemo(()=>({activeIndex:m,setActiveIndex:y}),[m,y]),K=useMemo(()=>({isKeyboardNav:N,setIsKeyboardNav:x}),[N]);return i?(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,I=>{if(!isValidElement(I))return I;let F=I.type;return F?.displayName==="DropdownMenuSubTrigger"||F?.displayName==="DropdownMenuSubContent"?null:I})})):jsx(Ri.Provider,{value:true,children:jsx(Tt.Provider,{value:P,children:jsx(mo.Provider,{value:W,children:jsx(oo.Provider,{value:K,children:jsx(fn.Provider,{value:$,children:s})})})})})};wi.displayName="DropdownMenuSub";var Ei=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},i)=>{let{open:u,setOpen:a,trigger:l,referenceRef:c,scheduleSubmenuHover:p,clearSubmenuHover:R,pendingOpenRef:f,menuId:v}=mr(),k=uo(),C=useCallback(I=>{I&&(I.__pfuiCloseSubmenu=()=>a(false));},[a]),T=!!e&&isValidElement(t),h=T?t:null,d=h?.props,m=d?.onKeyDown,y=d?.onClick,{onKeyDown:N,onClick:x,...w}=s,P=useMemo(()=>bs(i,T&&isValidElement(t)&&"ref"in t?t.ref:void 0,c,C),[i,T,t,c,C]),$=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0,W=useCallback(I=>{if(I.key==="Tab"){I.preventDefault();return}let F=I.currentTarget,S=g=>{k?.setIsKeyboardNav(true);let b=F.closest("[data-menu-id]");if(!b)return;b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted"));let A=Array.from(b.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]")!==b)return false;let L=window.getComputedStyle(E);return L.display!=="none"&&L.visibility!=="hidden"});if(!A.length)return;let H=A.indexOf(F),B=H>=0?H:0,M=g==="next"?(B+1)%A.length:(B-1+A.length)%A.length;A[M]?.setAttribute("data-highlighted",""),A[M]?.focus();};if(I.key==="ArrowDown"){I.preventDefault(),I.stopPropagation(),u&&a(false),S("next");return}if(I.key==="ArrowUp"){I.preventDefault(),I.stopPropagation(),u&&a(false),S("prev");return}if(I.key==="ArrowRight"||I.key==="Enter"||I.key===" "){I.preventDefault(),I.stopPropagation(),k?.setIsKeyboardNav(true);let g=I.currentTarget;a(true),requestAnimationFrame(()=>{let b=v?document.querySelector(`[data-menu-id="${v}"]`):document.querySelector("[data-submenu-content]");if(b){b.setAttribute("data-keyboard-nav",""),g.removeAttribute("data-highlighted"),g.removeAttribute("data-hovered");let A=b.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(I.key==="ArrowLeft"){I.preventDefault(),I.stopPropagation(),u&&a(false);let g=F.closest("[data-menu-id]");g&&g.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(b=>b.removeAttribute("data-hovered")),F.setAttribute("data-highlighted",""),F.focus(),k&&k.setIsKeyboardNav(true);return}if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),m?.(I);return}m?.(I),N?.(I);},[u,a,m,N,c,k,v]),K=l==="hover"?{onMouseEnter:I=>{let F=I.currentTarget;lo(),R(),document.querySelectorAll("[data-hovered]").forEach(g=>g.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(g=>g.removeAttribute("data-highlighted")),F.setAttribute("data-hovered",""),F.focus({preventScroll:true});let S=F.closest("[data-menu-id]");S?.hasAttribute("data-keyboard-nav")&&S.removeAttribute("data-keyboard-nav"),k&&k.setIsKeyboardNav(false),u||p(true,90);},onMouseMove:I=>{let F=I.currentTarget;lo(),F.hasAttribute("data-hovered")||(document.querySelectorAll("[data-hovered]").forEach(S=>S.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(S=>S.removeAttribute("data-highlighted")),F.setAttribute("data-hovered","")),!u&&!f?.current&&p(true,90);},onMouseLeave:()=>{p(false,60);}}:{onClick:I=>{I.stopPropagation(),a(!u),y?.(I),x?.(I);}};if(T&&h){let I=d?.css,F=typeof d?.className=="string"?d.className:void 0,S=typeof d?.tabIndex=="number"?d.tabIndex:0,g={ref:P,tabIndex:S,className:[F,o].filter(Boolean).join(" ")||void 0,css:[I,$,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":u,"data-subtrigger":"",__skipListReg:true,onKeyDown:W,onFocus:b=>{if(b.target.hasAttribute("data-highlighted")){let A=b.target.closest("[data-menu-id]");A&&!A.hasAttribute("data-keyboard-nav")&&(A.setAttribute("data-keyboard-nav",""),k&&k.setIsKeyboardNav(true));}d&&"onFocus"in d&&typeof d.onFocus=="function"&&d.onFocus(b);},...K,...w};return cloneElement(h,g)}return jsx("div",{ref:P,role:"menuitem",tabIndex:0,className:o,css:[css({display:"flex",alignItems:"center",gap:8,cursor:"pointer"}),$,r],"aria-haspopup":"menu","aria-expanded":u,"data-subtrigger":"",onKeyDown:W,onFocus:I=>{if(I.currentTarget.hasAttribute("data-highlighted")){let F=I.currentTarget.closest("[data-menu-id]");F&&!F.hasAttribute("data-keyboard-nav")&&(F.setAttribute("data-keyboard-nav",""),k&&k.setIsKeyboardNav(true));}},...K,...w,children:t})});Ei.displayName="DropdownMenuSubTrigger";var ki=me.forwardRef((e,t)=>{let n=hs(),{referenceRef:o,clearSubmenuHover:r,scheduleSubmenuHover:s}=mr(),i=[e.className,"plainframe-ui-submenu-content"].filter(Boolean).join(" ");return jsx(hn,{ref:t,side:"right",align:"start",exitPlacement:"bottom",animateOnBusClose:true,...e,className:i,"data-submenu-content":"",anchor:o.current,onMouseEnter:u=>{r(),n?.clearAllHover(),lo(),e.onMouseEnter?.(u);},onMouseLeave:u=>{s(false,60),e.onMouseLeave?.(u);}})});ki.displayName="DropdownMenuSubContent";var fr=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),vd=css({display:"inline"}),Si=css({display:"inline",fontWeight:700}),Cd=css({position:"absolute",inset:0,pointerEvents:"none",opacity:0,zIndex:-1,outline:"none"}),Rd=css({display:"flex",alignItems:"center",gap:4}),Td=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"}),wd=css({fontSize:"0.875em",overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400}),Ed=()=>{},kd=e=>e,Id=e=>`plainframe-ui-autocomplete${e?`-${e}`:""}`,Sd=e=>{e.preventDefault(),e.stopPropagation();},Md=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());},Fd=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:i,cls:u,closeOnSelect:a,pickSingle:l,handleItemKeyDown:c,handleItemMouseDown:p,descriptionColor:R})=>{let f=o(),v=useMemo(()=>{let T=String(e.title??e.value);return s?T:i(T)},[i,e.title,e.value,s]),k=useMemo(()=>e.description?jsxs("span",{className:"plainframe-ui-autocomplete-item-content",css:Td,children:[jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:v}),jsx("span",{className:"plainframe-ui-autocomplete-item-description",css:[wd,{color:R}],children:e.description})]}):jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:v}),[v,e.description,R]),C=useCallback(()=>{e.disabled||l(e.value);},[e.disabled,e.value,l]);if(n){let T=f.some(h=>Object.is(h,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 ${u("checkbox-item")}`.trim(),css:e.css,onMouseDown:p,children:s(e,T)},e.value):jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${u("checkbox-item")}`.trim(),css:e.css,onMouseDown:p,startIcon:e.startIcon,endIcon:e.endIcon,children:k},e.value)}return s?jsx(pn,{__index:t,onClick:C,onSelect:C,onKeyDown:c,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:u("item"),css:e.css,closeOnSelect:a,onMouseDown:p,selected:r,children:s(e,r)},e.value):jsx(pn,{startIcon:e.startIcon,endIcon:e.endIcon,__index:t,onClick:C,onSelect:C,onKeyDown:c,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:u("item"),css:e.css,closeOnSelect:a,onMouseDown:p,selected:r,children:k},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:i,css:u,inputCss:a,containerCss:l,label:c,helperText:p,variant:R,startIcon:f,endIcon:v,size:k,disabled:C=false,error:T=false,showClear:h=false,open:d,onOpenChange:m,openOnFocus:y=false,openOnType:N=true,openOnClick:x=true,closeOnSelect:w=true,closeOnBlur:P=true,blurOnSelect:$=false,freeSolo:W=false,customValueLabel:K=false,maxHeight:I,maxItems:F,noResultsText:S="No Items Found",highlightTypedValue:g,typedValueHighlightCss:b,showNoResults:A=true,noResultsLabelCss:H,loadingLabelCss:B,loadItems:M,loading:E,loadingText:L="Loading\u2026",debounceMs:z=200,multiple:O=false,selectedValues:_,defaultSelectedValues:D,onChangeSelected:V,expandIcon:J,showExpandIcon:ae=true,expandIconCss:q,textFieldWrapperCss:X,textFieldInputCss:le,textFieldLabelCss:ie,textFieldHelperRowCss:be,textFieldHelperTextCss:Pe,textFieldStartIconCss:Re,textFieldEndIconCss:Ce,menuContentCss:Ie})=>{let we=U().text.secondary,[he,je]=useState(""),Z=typeof d=="boolean",[Ee,Q]=useState(false),ee=Z?d:Ee,se=useRef(null),pe=useRef(null),Se=useRef(null),Ne=useRef(null),Y=useRef(false),oe=useRef(null),re=useRef(false),qe=useRef(0),j=useMemo(()=>[pe],[]),[ue,de]=useState(D??[]),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 M=="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 M(G)||[];nn(Array.isArray(ne)?ne:[]);}catch{nn([]);}finally{on(false);}},Math.max(0,z)),()=>{bt.current&&window.clearTimeout(bt.current);}},[he,Je,M,z]);let Zn=useMemo(()=>{let G=fr(he);return G?xt.some(ne=>fr(ne.title??ne.value)===G):false},[xt,he]),sa=W&&!!K&&he.trim().length>0&&!Zn,tc=G=>{if(typeof K=="object"){let ne=Object.prototype.hasOwnProperty.call(K,"prefix"),ve=Object.prototype.hasOwnProperty.call(K,"suffix");if(ne||ve){let Me=ne?K.prefix??"":"",ge=ve?K.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:tc(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(W&&!O){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,W,O,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});V?.(Me);},[V]),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||(w?(Y.current=false,re.current=true,Q(false),at.current?.(false),setTimeout(()=>{re.current=false;},150)):Y.current=true),!w&&Se.current?.setActiveIndex&&Se.current.setActiveIndex(null),$?(Y.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,w,$]),nc=useCallback(G=>{if(C)return;je(G);let ne=!G.trim();O||(ne?(st(null),t?.(null)):W&&st(null)),!Z&&!ne&&N&&!ee&&De(true);},[O,Z,N,ee,De,C,W,t]),it=Id,la=Ed,oc=kd,ca=useMemo(()=>b?[Si,b]:Si,[b]),rc=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:vd,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=g?rc:oc,sc=useMemo(()=>css({position:"relative",display:o?"block":"inline-block",width:"100%",maxWidth:o?"100%":n}),[o,n]),Oo=Sd,Wo=Md,ac=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]),ic=useCallback(G=>{if(G.key===" "||G.code==="Space"||G.key==="Spacebar"){G.stopPropagation();return}if(G.key==="ArrowDown"||G.key==="ArrowUp"){if(C||!Fn&&!Je)return;G.preventDefault(),!ee&&!Z&&De(true),ua(G.key==="ArrowDown"?1:-1);return}if(G.key==="Enter"){if(C)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(),O?(ia(ve.value),w||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,O,w,ua,ia,$o,De,C]),lc=useCallback(()=>{C||re.current||y&&Lo&&(qe.current=Date.now(),Z||De(true));},[Z,y,Lo,De,C]),cc=useCallback(()=>{if(Y.current){Y.current=false;return}P&&De(false),!W&&!O&&(Oe?je(Oe.title??Oe.value):he.trim()&&je(""));},[P,W,O,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:w,pickSingle:$o,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),G},[Kt,it,Oe,yt,s,zo,w,$o,Wo,Oo,we]),uc=useMemo(()=>ke?jsx(mn,{css:B,className:it("label-loading"),children:L},"loading"):Wr?jsx(mn,{css:H,className:it("label-empty"),children:S},"empty"):Kt.length===0?null:O?da():pa(),[ke,Wr,Kt.length,it,L,S,O,da,pa]),rn=ee?false:C||!Je&&!Ho&&!A,ma=useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(rn||C)&&(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,C,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:Fd,onClick:ma,children:J??jsx(ChevronDown,{size:18,strokeWidth:2})}):null,[ae,fa,q,rn,ma,J]),dc=useMemo(()=>v&&Ko?jsxs("span",{css:Rd,children:[v,Ko]}):v??Ko,[v,Ko]),pc=useCallback(G=>{if(!(oe.current&&oe.current.contains(G.target)||re.current||C||Date.now()-qe.current<300)){if(ee){!he.trim()&&!Z&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));return}x&&Lo&&(!Z||x)&&De(true);}},[ee,he,x,Lo,De,C,Z]);return jsx("div",{ref:pe,className:it(""),css:[sc,l,u],children:jsxs($n,{open:C?false:ee,onOpenChange:C?void 0:De,children:[jsx(Fi,{onCapture:ac}),jsx(zn,{asChild:true,children:jsx("span",{className:it("anchor"),css:Cd,style:{pointerEvents:"none",position:"absolute",visibility:"hidden"},tabIndex:-1})}),jsx(Qo,{ref:se,className:it("input"),focusRingMode:i,value:he,onChange:nc,onKeyDown:ic,onFocus:lc,onBlur:cc,onSurfaceClick:pc,placeholder:r,label:c,helperText:p,variant:R,startIcon:f,endIcon:dc,size:k,width:n,fullWidth:o,disabled:C,error:T,showClear:h,css:a,wrapperCss:X,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 I=="number"?`${I}px`:I,css:Ie,ignoreOutsidePressRefs:j,disableOutsidePressDismiss:Z,returnFocus:!$,children:uc})]})})});Ai.displayName="Autocomplete";var Hd=["sm","md","lg"],Ld=(e,t)=>typeof e=="number"?e:Hd.includes(e)?t.componentHeights[e]:t.componentHeights.md,Bd=(e,t)=>{let n=e.palette?.[t??"primary"]??e.palette.primary;return n?.[600]??n?.[500]??e.neutral?.[600]??e.neutral?.[500]},$d=(e,t)=>{let n=e.text?.onColors??{};return n[t??"primary"]??n.primary??e.text?.primary??"#fff"},zd=(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:i,children:u,...a},l)=>{let c=U(),[p,R]=useState(!!e);useEffect(()=>{R(!!e);},[e]);let f=Ld(n,c),v=typeof f=="number"?f:Number.parseFloat(String(f))||0,k=v?Math.round(v*(v<=28?.55:.52)):void 0,C=r?c.radius.full:c.radius.md,T=Bd(c,o),h=$d(c,o),d=zd(u,t),m=css({width:f,height:f,borderRadius:C,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:p?"transparent":T,color:p?"inherit":h,boxSizing:"border-box",userSelect:"none"}),y=css({width:"100%",height:"100%",display:"block",objectFit:"cover"}),N=css({fontSize:k,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,i],role:p?void 0:"img","aria-label":p?void 0:t,...a,children:p&&e?jsx("img",{className:"plainframe-ui-avatar-img",src:e,alt:t,css:y,onError:()=>R(false),decoding:"async",loading:"lazy"}):typeof u=="string"?jsx("span",{className:"plainframe-ui-avatar-initials",css:N,children:u}):u||jsx("span",{className:"plainframe-ui-avatar-initials",css:N,children:d})})}));Pi.displayName="Avatar";var Ni=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,_d=({children:e,max:t,size:n="md",overlap:o=-7,css:r,rounded:s=true,bgColor:i,extraLabelCss:u,outlineThickness:a=4,className:l})=>{let c=U(),p=xe(),f=(()=>{if(typeof n=="number")return `${n}px`;if(typeof n=="string"){let x=(c.componentHeights&&c.componentHeights[n])??(c.spacing&&c.spacing[n]);return Ni(x??n)}return "32px"})(),v=Children.toArray(e).filter(Boolean),k=typeof t=="number"&&t>=0,C=k&&v.length>t?v.slice(0,t):v,T=k&&v.length>t?v.length-t:0,h=i==="panel"?c.surface.panelBg:i==="subtle"?c.surface.subtleBg:i??c.surface.appBg,d=Ni(a)??"4px",m=css({display:"flex",alignItems:"center"}),y=x=>css({marginLeft:x===0?0:o,zIndex:C.length-x,boxShadow:`0 0 0 ${d} ${h}`,backgroundColor:h,borderRadius:s?c.radius.full:c.radius.md,display:"inline-flex",width:f,height:f,overflow:"hidden",alignItems:"center",justifyContent:"center",lineHeight:0,flex:"0 0 auto"}),N=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,p()],children:[C.map((x,w)=>{if(!isValidElement(x))return jsx("div",{className:"plainframe-ui-avatar-group-item",css:y(w),children:jsx("span",{css:N,children:x})},w);let P=x,$=P.props?.css,W=$==null?N:[N,$],K=cloneElement(P,{size:n,rounded:s,css:W,style:{...P.props?.style,width:"100%",height:"100%",objectFit:P.props?.objectFit??"cover"}});return jsx("div",{className:"plainframe-ui-avatar-group-item",css:y(w),children:K},w)}),T>0&&jsxs("span",{className:"plainframe-ui-avatar-group-extra",css:[css({marginLeft:5,fontSize:c.typography.sizes.sm,fontWeight:600,lineHeight:1,padding:"2px 1px",zIndex:2,color:c.text.secondary}),u],"aria-label":`+${T} more`,children:["+",T]})]})};var Li=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Vd=(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"}},Ud=e=>e[600]??e[500]??e[400]??Object.values(e)[0]??"#000",qd=(e,t,n,o)=>o??t[n]??t.primary??e.text?.primary??"#fff",Gd=(e,t,n)=>n==="dot"?"":typeof e=="number"&&typeof t=="number"&&e>t?`${t}+`:e??"",Xd=(e,t,n,o)=>e&&(t==="dot"||!!n||n===0&&o),Yd=me.memo(({content:e,color:t="primary",fontColor:n,fontWeight:o=600,fontSize:r,variant:s="dot",max:i=99,showZero:u=false,visible:a=true,anchorOrigin:l={vertical:"top",horizontal:"right"},overlap:c="rectangular",children:p,animate:R=true,size:f,outline:v=false,outlineColor:k,className:C,badgeClassName:T,css:h,badgeCss:d,offsetX:m,offsetY:y})=>{let N=U(),x=s==="dot",w=f??(x?8:17),P=r??(x?0:10),{scale:$,onKey:W}=Vd(N,t),K=Ud($),I=N.text?.onColors||{},F=qd(N,I,W,n),S=Gd(e,i,s),g=Xd(a,s,e,u),b=css({position:"relative",display:"inline-block"}),A=c==="circular"?x?"12.5%":"5%":x?"5%":"2.5%",H=Li(m??A),B=Li(y??A),M=l.vertical||"top",E=l.horizontal||"right",L={},z="0",O="0";M==="center"?(L.top="50%",O="-50%"):M==="top"?(L.top=B,O="-45%"):(L.bottom=B,O="45%"),E==="center"?(L.left="50%",z="-50%"):E==="right"?(L.right=H,z="45%"):(L.left=H,z="-45%");let _=g?1:.8,D=css({minWidth:x?w:w/2,height:w,background:K,color:F,fontSize:typeof P=="number"?`${P}px`:P,fontWeight:o,borderRadius:999,padding:x?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",...v?{boxShadow:`0 0 0 2px ${k??N.surface?.appBg}`}:{},opacity:g?1:0,transform:`translate(${z}, ${O}) scale(${g?_:.5})`,...R?{transition:"opacity .18s cubic-bezier(.4,1.6,.6,1), transform .18s cubic-bezier(.4,1.6,.6,1)"}:{},...L});return jsxs("div",{className:["plainframe-ui-badge-wrapper",C||""].join(" ").trim(),css:[b,h],children:[p,jsx("span",{"aria-hidden":!g,className:["plainframe-ui-badge",T||""].join(" ").trim(),css:[D,d],children:S})]})});var Es=({on:e,onClickAway:t,blur:n=false,blurDepth:o=2.5,color:r,zIndex:s=1e3,css:i,contentCss:u,overlayCss:a,children:l,transitionDuration:c=300,keepMounted:p=true,className:R,contentClassName:f,lockScroll:v=true,...k})=>{let C=U(),T=useMemo(()=>r??C.surface.overlayBg,[r,C.surface.overlayBg]),[h,d]=useState(e),[m,y]=useState(e),N=useRef(null),x=useRef(null),w=useRef(null);useEffect(()=>(N.current&&(clearTimeout(N.current),N.current=null),x.current!=null&&(cancelAnimationFrame(x.current),x.current=null),e?(d(true),x.current=requestAnimationFrame(()=>{y(true),x.current=null;})):(y(false),N.current=setTimeout(()=>{d(false),N.current=null;},c)),()=>{N.current&&(clearTimeout(N.current),N.current=null),x.current!=null&&(cancelAnimationFrame(x.current),x.current=null);}),[e,c]),useEffect(()=>{if(!v||!e)return;let F=document.body,S=F.style.overflow,g=F.style.paddingRight,b=window.innerWidth-document.documentElement.clientWidth,A=parseFloat(getComputedStyle(F).paddingRight||"0");return F.style.overflow="hidden",b>0&&(F.style.paddingRight=`${A+b}px`),()=>{F.style.overflow=S,F.style.paddingRight=g;}},[e,v]),useEffect(()=>{if(!m||!t)return;let F=S=>{S.key==="Escape"&&t();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[m,t]);let P=F=>{if(!m||!t||!w.current)return;let S=F.target;S&&!w.current.contains(S)&&t();},$=n&&o?typeof o=="number"?`${o}px`:o:void 0;if(!p&&!h)return null;let W=css({position:"fixed",inset:0,width:"100vw",height:"100vh",zIndex:s,display:"grid",placeItems:"center",pointerEvents:m?"auto":"none",visibility:h?"visible":"hidden"}),K=css({position:"absolute",inset:0,background:T,backdropFilter:$?`blur(${$})`:void 0,WebkitBackdropFilter:$?`blur(${$})`:void 0,opacity:m?1:0,transition:`opacity ${c}ms cubic-bezier(.4,0,.2,1)`,pointerEvents:m?"auto":"none"}),I=css({position:"relative",zIndex:1,pointerEvents:m?"auto":"none"});return jsxs("div",{"aria-hidden":!h||void 0,className:["plainframe-ui-backdrop",R||""].join(" ").trim(),css:[W,i],onPointerDown:P,...k,children:[jsx("div",{className:"plainframe-ui-backdrop-overlay",css:[K,a],role:"presentation"}),jsx("div",{ref:w,className:["plainframe-ui-backdrop-content",f||""].join(" ").trim(),css:[I,u],children:l})]})};var yr=()=>null;Object.defineProperty(yr,"displayName",{value:"PF.BreadCrumbItem",configurable:true});function tp(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 np=me.memo(({children:e,separator:t="/",css:n,crumbCss:o,activeCrumbCss:r,inactiveCrumbCss:s,linkCrumbCss:i,separatorCss:u,hover:a=true,className:l,...c})=>{let p=U(),R=xe(),f=me.useMemo(()=>me.Children.toArray(e).flatMap(d=>{if(!me.isValidElement(d))return [];let{type:m,props:y}=tp(d);if(!(m===yr||typeof m=="function"&&"displayName"in m&&m.displayName===yr.displayName))return [];let x=y;return [{href:x.href,disabled:x.disabled,node:x.children,className:x.className,css:x.css,onClick:x.onClick,startIcon:x.startIcon,endIcon:x.endIcon}]}),[e]),v=me.useMemo(()=>css({display:"flex",alignItems:"center",fontSize:p.typography.sizes.sm,fontWeight:500,gap:p.spacing.xs,cursor:"default"}),[p]),k=me.useMemo(()=>css({margin:"0 0.15rem",color:p.neutral[500],flex:"0 0 auto",justifyContent:"center",alignItems:"center",display:"flex"}),[p]),C=me.useCallback((d,m,y)=>{let N=d?p.text.primary:p.text.secondary,x=a&&m&&!y;return css({display:"inline-flex",alignItems:"center",gap:p.spacing.xs,color:N,cursor:m&&!y?"pointer":"default",textDecoration:"none",borderRadius:p.radius.xs,fontWeight:500,outline:"none",transition:"all .16s ease !important","&:hover":x?{textDecoration:"underline",color:p.text.primary}:{textDecoration:"none"}})},[p,a]),T=me.useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0}),[]),h=me.useMemo(()=>css({display:"inline-block"}),[]);return jsx("nav",{"aria-label":"Breadcrumb",className:["plainframe-ui-breadcrumbs",l||""].join(" ").trim(),css:[v,n],...c,children:f.map((d,m)=>{let y=m===f.length-1,N=!!d.href&&!d.disabled&&!y,x=["plainframe-ui-breadcrumb",y?"plainframe-ui-breadcrumb--active":"plainframe-ui-breadcrumb--inactive",N?"plainframe-ui-breadcrumb--link":"",d.className||""].join(" ").trim(),w=[C(y,N,d.disabled),o,y?r:s,N?i:void 0,R(),d.css],P=jsxs(Fragment,{children:[d.startIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-start",css:T,children:d.startIcon}),jsx("span",{className:"plainframe-ui-breadcrumb-label",css:h,children:d.node}),d.endIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-end",css:T,children:d.endIcon})]});return jsxs(me.Fragment,{children:[m!==0&&jsx("span",{className:"plainframe-ui-breadcrumb-separator",css:[k,u],children:t}),N?jsx("a",{href:d.href,onClick:d.onClick,tabIndex:0,"data-active":y?"true":"false","data-link":"true",className:x,css:w,children:P}):jsx("span",{"aria-current":y?"page":void 0,tabIndex:y?-1:0,"data-active":y?"true":"false","data-link":"false",className:x,css:w,children:P})]},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 ap(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 ip(e,t){let n=e.neutral,o=e.text,r=e.palette,s=r.primary||n,i=r.danger||r.error||s,u=e.text.onColors||{},a=u.primary??o.onColors.primary,l=u.danger??a,c=(p,R,f)=>p&&p[R]||f;if(t==="primary"){let p=s,R=c(p,600,n[900])||c(p,500,n[900]),f=c(p,500,n[800])||c(p,600,n[800]);return {bg:R,fg:a,hoverBg:f,border:"none"}}if(t==="destructive"){let p=i,R=c(p,600,n[900])||c(p,500,n[900]),f=c(p,500,n[800])||c(p,600,n[800]);return {bg:R,fg:l,hoverBg:f,border:"none"}}return t==="ghost-destructive"?{bg:"transparent",fg:i[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:i=false,loading:u=false,loadingIndicator:a,loadingPosition:l="center",children:c,className:p,hoverEffect:R=true,onClick:f,css:v,...k},C)=>{let T=U(),h=xe(),d=useMemo(()=>ap(T,t),[T,t]),m=useMemo(()=>ip(T,e),[T,e]),y=useMemo(()=>!n&&!o&&!Oi(c)&&me.Children.count(c)===1,[n,o,c]),N=d.iconSize,x=useMemo(()=>ks(n,N),[n,N]),w=useMemo(()=>ks(o,N),[o,N]),P=useMemo(()=>a??jsx(no,{color:m.fg,variant:"circular",size:14,thickness:5}),[a,m]),$=useMemo(()=>y?"center":l??"center",[y,l]),W=!!u&&$==="center",K=!!u&&$==="start",I=!!u&&$==="end",F=i||u,S=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",gap:0,width:s?"100%":"auto",minHeight:d.minHeight,lineHeight:1,fontWeight:600,cursor:F?"not-allowed":"pointer",opacity:F?.5:1,userSelect:"none",position:"relative",borderRadius:r?T.radius.full:d.radius,outline:"none",willChange:"box-shadow, transform, outline-offset",transition:"box-shadow 140ms ease, transform 90ms ease, outline-offset 140ms ease"}),[s,d,r,T,F]),g=useMemo(()=>css({backgroundColor:m.bg,color:m.fg,border:m.border}),[m,T]),b=useMemo(()=>css({overflow:"hidden","::before":{content:'""',position:"absolute",inset:0,backgroundColor:m.hoverBg,opacity:0,pointerEvents:"none",transition:"opacity 140ms ease",zIndex:0},"@media (hover: hover) and (pointer: fine)":R&&!F?{":hover::before":{opacity:1}}:{}}),[m,R,F]),A=useMemo(()=>css(y&&!s?{width:"100%",height:"100%",maxWidth:d.minHeight,minWidth:d.minHeight,maxHeight:d.minHeight,display:"flex",alignItems:"center",justifyContent:"center",fontSize:Is(d.iconSize)}:{fontSize:Is(d.fontSize),padding:n||o?`${d.paddingY} ${d.paddingXIcon}`:`${d.paddingY} ${d.paddingX}`}),[y,s,d,n,o]),H=useMemo(()=>css({position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Is(T.spacing.sm),opacity:W?0:1,transition:"opacity 140ms ease"}),[T,W]),B=useMemo(()=>css({height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),[]),M=useMemo(()=>typeof d.iconSize=="number"?d.iconSize:Math.max(12,Math.round(parseFloat(String(d.iconSize))||16)),[d.iconSize]),E=useMemo(()=>css({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:M,minWidth:M,maxWidth:M,height:"1em"}),[M]),L=useMemo(()=>V=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:V?1:0,transition:"opacity 140ms ease"}),[]),z=useMemo(()=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:W?1:0,pointerEvents:"none",zIndex:2,transition:"opacity 140ms ease"}),[W]),O=useMemo(()=>()=>{if(y)return null;let V=!!n;return !V&&!K?null:jsxs("span",{css:E,"aria-hidden":u?true:void 0,children:[jsx("span",{css:L(!K),children:V?x||n:null}),jsx("span",{css:L(!!K),children:P})]})},[y,n,K,E,L,x,u,P]),_=useMemo(()=>()=>{if(y)return null;let V=!!o;return !V&&!I?null:jsxs("span",{css:E,"aria-hidden":u?true:void 0,children:[jsx("span",{css:L(!I),children:V?w||o:null}),jsx("span",{css:L(!!I),children:P})]})},[y,o,I,E,L,w,u,P]),D=!(i||u);return jsxs("button",{ref:C,type:"type"in k&&k.type?k.type:"button","data-variant":e,className:["plainframe-ui-button",p||""].join(" ").trim(),css:[S,h({color:e==="primary"?"primary":e==="destructive"||e==="ghost-destructive"?"danger":"neutral"}),g,b,A,v],onClick:D?f:void 0,disabled:i||void 0,tabIndex:u?-1:void 0,"aria-disabled":i||void 0,"aria-busy":u||void 0,...k,children:[jsxs("span",{className:"plainframe-ui-button-content",css:H,children:[O(),jsx("span",{className:"plainframe-ui-button-label",css:B,children:y?u?P:ks(c,d.iconSize):c}),_()]}),jsx("span",{className:"plainframe-ui-button-center-overlay",css:z,"aria-hidden":"true",children:W?P:null})]})}));Wi.displayName="Button";var Rr=e=>isValidElement(e),lp=e=>{let t=e.type;return t.displayName??t.name},As=(e,t)=>lp(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,cp=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,up=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 up(o)},Ui=me.memo(me.forwardRef(function({children:t,attached:n=false,direction:o="horizontal",fullWidth:r=false,disabled:s=false,size:i="md",rounded:u=false,gap:a,width:l,className:c,role:p="group",css:R,__clipLeft:f,__clipRight:v,...k},C){let T=U(),h=i==="sm"?T.radius.sm:T.radius.md,d=u?T.radius.full:h,m=o==="vertical",y=cp(T.componentHeights.border,1),N=T.surface.border,x=n&&!!f,w=n&&!!v,P=css({display:"flex",flexDirection:m?"column":"row",width:r?"100%":l!=null?Kn(l):"auto",maxWidth:"none",backgroundColor:"transparent",gap:n?0:Kn(a??T.spacing.sm)}),$=Children.toArray(t),K=$.filter(Rr).length,I=0,F=false,S=[];for(let g of $){if(!Rr(g)){S.push(g);continue}let b=I===0,A=I===K-1,H=g.props??{},B=H.disabled??s,M=H.size??i,E=0,L=0,z=0,O=0;n&&(m?(E=b?x?0:d:0,L=b?w?0:d:0,O=A?x?0:d:0,z=A?w?0:d:0):(E=b?x?0:d:0,O=b?x?0:d:0,L=A?w?0:d:0,z=A?w?0:d:0));let _=_i(g,"left"),D=_i(g,"right"),ae=n&&!b&&!(F&&_)&&!(F||_)?css({[m?"borderTop":"borderLeft"]:`${y} solid ${N}`}):null,q=n&&!b&&F&&_?css(m?{borderTopWidth:0}:{borderLeftWidth:0}):null,X=n?css({borderTopLeftRadius:Kn(E),borderTopRightRadius:Kn(L),borderBottomRightRadius:Kn(z),borderBottomLeftRadius:Kn(O)}):null,le=r?css({flex:1}):null,ie=css([X,ae,q,le]);if(!Vi(g)){let Ce=H.css,Ie=[H.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" "),Te=ji(g)&&n?{__clipLeft:!b,__clipRight:!A}:{},we=cloneElement(g,{...H,disabled:B,size:M,className:Ie,css:[Ce,ie],...Te});S.push(we),F=D,I+=1;continue}let be=H.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:B,size:M})}),Re=cloneElement(g,{...H,children:Pe});S.push(Re),F=D,I+=1;}return jsx("div",{ref:C,role:p,"aria-orientation":m?"vertical":"horizontal","data-attached":n||void 0,"data-direction":o,className:["plainframe-ui-button-group",c||""].join(" ").trim(),css:[P,R],...k,children:S})}));Ui.displayName="ButtonGroup";var Tr=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,bp=(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)}}},hp=(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)}}},yp=(e,t)=>{let n=t.surface??{};return e==="panel"||e==="outlined"?n.panelBg??"transparent":e==="subtle"?n.subtleBg??"transparent":"transparent"},xp=(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:i,hoverable:u,selectable:a,selected:l,defaultSelected:c,onSelectedChange:p,width:R,height:f,onClick:v,onKeyDown:k,role:C,tabIndex:T,...h},d){let m=U(),y=m.surface??{},[N,x]=useState(!!c),w=l!=null,P=w?!!l:N,$=useMemo(()=>yp(o,m),[o,m]),W=useMemo(()=>xp(o,m,$),[o,m,$]),K=W,I=useMemo(()=>bp(r,m),[r,m]),F=useMemo(()=>hp(s,m),[s,m]),S=!!u||!!a,g=useMemo(()=>css({backgroundColor:$,padding:I,borderRadius:F,border:o==="outlined"?`${m.componentHeights?.border??"1px"} solid ${y.border??"transparent"}`:void 0,backgroundClip:"padding-box",boxSizing:"border-box",width:R?"100%":void 0,maxWidth:Tr(R),height:Tr(f),outline:"none",transition:"background-color .16s ease, border-color .16s ease",cursor:S?"pointer":void 0,...S?{"&:hover":{backgroundColor:W}}:{},'&[data-selected="true"]':{backgroundColor:K},...S?{'&[data-selected="true"]:hover':{backgroundColor:K}}:{}}),[$,I,F,o,m.componentHeights,y.border,R,f,S,W,K]),b=useCallback(()=>{if(!a)return;let M=!P;w||x(M),p?.(M);},[w,p,a,P]),A=useCallback(M=>{a&&b(),v?.(M);},[a,b,v]),H=useCallback(M=>{a&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),b()),k?.(M);},[a,b,k]),B=xe();return jsx("div",{ref:d,"data-variant":o,"data-selected":a&&P?"true":void 0,"aria-pressed":a?P:void 0,className:["plainframe-ui-container",i||""].join(" ").trim(),css:[B(),g,n],onClick:A,onKeyDown:H,role:a?C??"button":C,tabIndex:a?T??0:T,...h,children:t})}));_n.displayName="Container";var Cp=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 Cp(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 Rp(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),i=Ns(o,e),u={};return r&&!s&&!i&&(u.padding=r),s&&(u.paddingLeft=s,u.paddingRight=s),i&&(u.paddingTop=i,u.paddingBottom=i),u}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:i,selected:u,defaultSelected:a,onSelectedChange:l,width:c="100%",height:p,gap:R,direction:f="horizontal",className:v,onClick:k,...C},T)=>{let h=U(),d=xe(),m=f==="vertical",y=css({position:"relative",display:"flex",flexDirection:m?"column":"row",gap:Rp(R,h),alignItems:m?"stretch":"center",transition:"all .16s ease"});return jsx(Gi.Provider,{value:f,children:jsx(_n,{ref:T,variant:n,padding:o,radius:r,hoverable:s,selectable:i,selected:u,defaultSelected:a,onSelectedChange:l,width:c,height:p,className:["plainframe-ui-card",v||""].join(" ").trim(),css:[d(),y,t],onClick:k,tabIndex:k?0:void 0,...C,children:e})})}));Xi.displayName="Card";me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,...u})=>{let a=U(),c=Hs()==="vertical",p=css({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:yo(o),textAlign:Ds(o),...c?{width:"100%"}:{flex:1,minWidth:0},...xo(a,r,s,i)});return jsx("div",{"data-slot":"card-content",className:["plainframe-ui-card-content",n||""].join(" ").trim(),css:[p,t],...u,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,...u})=>{let a=U(),c=Hs()==="vertical",p=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...c?{width:"100%"}:{},...xo(a,r,s,i)});return jsx("div",{"data-slot":"card-start",className:["plainframe-ui-card-start",n||""].join(" ").trim(),css:[p,t],...u,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,...u})=>{let a=U(),c=Hs()==="vertical",p=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...c?{width:"100%"}:{},gap:a.spacing.xs,color:a.text.secondary,...xo(a,r,s,i)});return jsx("div",{"data-slot":"card-end",className:["plainframe-ui-card-end",n||""].join(" ").trim(),css:[p,t],...u,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,weight:u,size:a,color:l,...c})=>{let p=U(),R=css({fontWeight:u??500,fontSize:a??(p.typography?.sizes?.sm!==void 0?p.typography.sizes.sm:"1rem"),color:qi(p,l)??p.text?.primary,textAlign:Ds(o),...xo(p,r,s,i),display:"flex",alignItems:"center",gap:p.spacing?.xs??6});return jsx("div",{"data-slot":"card-title",className:["plainframe-ui-card-title",n||""].join(" ").trim(),css:[R,t],...c,children:e})});me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,weight:u,size:a,color:l,...c})=>{let p=U(),R=css({fontWeight:u??400,fontSize:a??(p.typography?.sizes?.sm!==void 0?p.typography.sizes.sm:"0.875rem"),color:qi(p,l)??p.text?.secondary,marginTop:p.spacing?.xxs??2,textAlign:Ds(o),...xo(p,r,s,i)});return jsx("div",{"data-slot":"card-description",className:["plainframe-ui-card-description",n||""].join(" ").trim(),css:[R,t],...c,children:e})});var Ji=e=>isValidElement(e),kp=e=>Ji(e)?e.type?.displayName||e.type?.name:void 0,Yi=e=>kp(e)==="Card",Ip=e=>typeof e=="number"?`${e}px`:e,Zi=({children:e,attached:t=false,gap:n,width:o,direction:r="vertical",variant:s,className:i,role:u="group",css:a})=>{let l=U(),c=r==="vertical",p=String(l.componentHeights?.border??"1px"),R=l.surface.border,f={display:"flex",flexDirection:c?"column":"row",width:typeof o=="string"||typeof o=="number"?Ip(o):"auto",maxWidth:"none",gap:t?0:n??l.spacing?.sm},v=Children.toArray(e),C=v.filter(Yi).length,T=0,h=v.map((d,m)=>{if(!Yi(d)||!Ji(d))return d;let y=d.props,N=T++,x=N===0,w=N===C-1,P=s??y.variant,$=t?c?{borderTopLeftRadius:x?y.radius:0,borderTopRightRadius:x?y.radius:0,borderBottomLeftRadius:w?y.radius:0,borderBottomRightRadius:w?y.radius:0}:{borderTopLeftRadius:x?y.radius:0,borderBottomLeftRadius:x?y.radius:0,borderTopRightRadius:w?y.radius:0,borderBottomRightRadius:w?y.radius:0}:void 0,W=t&&!x?c?{borderTopWidth:0}:{borderLeftWidth:0}:void 0,K=P==="subtle"&&C>1&&!x?c?{borderTop:`${p} solid ${R}`}:{borderLeft:`${p} solid ${R}`}:null,F=[$,W,K,t?{width:"100%"}:{width:"100%",marginBottom:c?0:void 0,marginRight:c?void 0:0}].filter(Boolean),S=[y.className,"plainframe-ui-card-group-item"].filter(Boolean).join(" ");return cloneElement(d,{...y,variant:P??y.variant,css:[y.css,...F],className:S,key:typeof d=="object"&&"key"in d?d.key:m})});return jsx("div",{role:u,"aria-orientation":c?"vertical":"horizontal","data-attached":t||void 0,"data-direction":r,className:["plainframe-ui-card-group",i||""].join(" ").trim(),css:[f,a],children:h})};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},Ap=(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:i,endIcon:u,size:a="md",onClick:l,onDelete:c,deleteIcon:p,disabled:R,cursor:f,className:v,css:k},C){let T=U(),h=xe(),d=["sm","md","lg"].includes(a)?a:"md",m=useMemo(()=>Ap(T,d),[T,d]),y=!!l&&!R,N=R?"not-allowed":f||(y?"pointer":"inherit"),x=String(T.componentHeights?.border??"1px"),w=useMemo(()=>{let J=T.palette;return r==="secondary"||r==="neutral"?"neutral":r&&J[r]?r:"primary"},[r,T.palette]),P=useCallback(J=>{let ae=T.palette;return (w==="neutral"?T.neutral[J]:ae[w]?.[J])??ae.primary?.[J]},[w,T.neutral,T.palette]),$=useMemo(()=>w==="neutral"?T.neutral[100]:P(50),[w,P,T.neutral]),W=useMemo(()=>w==="neutral"?T.text.secondary:P(800),[w,P,T.text.secondary]),K=useMemo(()=>w==="neutral"?T.neutral[100]:P(50),[w,P,T.neutral]),I=useMemo(()=>w==="neutral"?T.text.secondary:P(800),[w,P,T.text.secondary]),F=useMemo(()=>w==="neutral"?T.neutral[400]:P(300),[w,P,T.neutral]),S=useMemo(()=>w==="neutral"?T.surface.subtleBg:P(600),[w,P,T.surface.subtleBg]),g=useMemo(()=>(T.text.onColors??{})[w]??(w==="neutral"?T.neutral[900]:T.neutral[0]??"#fff"),[w,T.text.onColors,T.neutral]),b="transparent",A=useMemo(()=>w==="neutral"?T.text.secondary:P(700)??T.text.primary,[w,P,T.text.primary,T.text.secondary]),H=useMemo(()=>!i&&!u&&t!=null&&!el(t)&&me.Children.count(t)===1,[i,u,t]),B=useMemo(()=>o==="filled"?css({backgroundColor:S,color:g,border:"none",boxShadow:"none"}):o==="outlined"?css({backgroundColor:K,color:I,border:"none",boxShadow:`inset 0 0 0 ${x} ${F}`}):o==="ghost"?css({backgroundColor:b,color:A,border:"none",boxShadow:"none"}):css({backgroundColor:$,color:W,border:"none",boxShadow:"none"}),[S,g,A,K,I,F,$,W,x,o]),M=useMemo(()=>css({display:"inline-flex",alignItems:"center",gap:Le(m.gap),padding:o==="ghost"?0:H||t==null?Le(m.soloPadding):`${Le(m.paddingY)} ${Le(m.paddingX)}`,borderRadius:s?T.radius.full:m.radius,fontWeight:600,cursor:N,opacity:R?.55:1,transition:"outline .16s ease, outline-offset .16s ease",overflow:o==="ghost"?"visible":"hidden",...H?{lineHeight:1,minWidth:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,minHeight:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,justifyContent:"center"}:null}),[m,N,t,R,H,s,T.radius.full,o]),E=useMemo(()=>css({fontSize:Le(H?m.iconSize:m.fontSize),lineHeight:1.2,minWidth:0,display:"inline-flex",alignItems:"center",justifyContent:"center","& > svg":{width:H?Le(m.iconSize):void 0,height:H?Le(m.iconSize):void 0,display:H?"block":void 0}}),[m.fontSize,m.iconSize,H]),L=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]),z=useMemo(()=>css({marginRight:H||t==null?0:Le(m.gap),marginLeft:H||t==null?0:Le(m.iconOffset)}),[m.gap,m.iconOffset,t,H]),O=useMemo(()=>css({marginLeft:H||t==null?0:Le(m.gap),marginRight:H||t==null?0:Le(s?m.iconOffsetRounded:m.iconOffset)}),[m.gap,m.iconOffset,m.iconOffsetRounded,t,H,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:R?"not-allowed":"pointer",color:"currentColor",opacity:R?.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:T.radius.xs}),[m.iconOffset,m.iconSize,R,s,T.radius.xs]),D=useCallback(J=>{y&&(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),l?.());},[y,l]),V=useMemo(()=>jsx(X,{css:{width:m.iconSize,height:m.iconSize},strokeWidth:2.5}),[m.iconSize]);return jsxs("div",{ref:C,className:["plainframe-ui-chip",y?"plainframe-ui-chip-clickable":"",v||""].join(" ").trim(),css:[M,B,y?h({color:r??"primary"}):null,k],onClick:y?l:void 0,onKeyDown:D,role:y?"button":void 0,tabIndex:y?0:void 0,"aria-disabled":R||void 0,"data-variant":o,"data-color":w,"data-size":a,"data-icon-only":H||void 0,children:[i&&jsx("span",{css:[L,z],className:"plainframe-ui-chip-icon-left",children:i}),t!=null&&jsx("span",{css:[E,n],className:"plainframe-ui-chip-label",children:t}),u&&jsx("span",{css:[L,O],className:"plainframe-ui-chip-icon-right",children:u}),c&&jsx("button",{type:"button","aria-label":"Delete",disabled:R,tabIndex:0,onClick:J=>{J.stopPropagation(),R||c?.();},css:[_,h({color:r??"primary"})],className:"plainframe-ui-chip-delete",children:p||V})]})}));tl.displayName="Chip";var Hp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Lp=me.memo(function({value:t,onChange:n,len:o,theme:r,sizeKey:s,s:i,variant:u,error:a,disabled:l,ringEnabled:c,focusRingMode:p,placeholder:R,separator:f,gapPx:v}){let k=xe(),C=r.neutral,T=r.text,h=r.componentHeights.border,d=useRef([]),[m,y]=useState(0),N=useMemo(()=>(t??"").padEnd(o,"").slice(0,o).split(""),[t,o]),x=useMemo(()=>{if(!R)return Array(o).fill("");if(R.length===1)return Array(o).fill(R);let H=R.slice(0,o).split("");for(;H.length<o;)H.push("");return H},[R,o]),w=useMemo(()=>{let H=r.componentHeights[s];return `calc(${typeof H=="number"?`${H}px`:H} * 1.5)`},[r.componentHeights,s]),P=l?C[200]:a&&u==="outlined"?r.palette.danger?.[50]??r.surface.panelBg:a&&u==="subtle"?r.palette.danger?.[50]??r.surface.subtleBg:u==="subtle"?r.surface.subtleBg:u==="outlined"?r.surface.panelBg:"transparent",$=u==="outlined"?`${h} solid ${a?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:P,border:$,borderRadius:r.radius.lg,transition:"box-shadow .16s, border-color .16s, background .16s",fontSize:i.codeFontSize,fontWeight:600,color:l?C[500]:a?r.palette.danger?.[800]??T.primary:T.primary,textAlign:"center",backgroundClip:"padding-box",appearance:"textfield",outline:"none",caretColor:a?r.palette.danger?.[800]??T.primary:T.primary,"&::placeholder":{color:a?r.palette.danger?.[700]??T.secondary:T.secondary,opacity:.85}},c?k({enabled:true,disabled:l,mode:p==="always"?"always":"visible",color:a?"danger":void 0}):void 0,H?css({}):null),K=css({display:"flex",gap:v,justifyContent:"center",width:"auto",pointerEvents:l?"none":"auto",opacity:l?.65:1}),I=css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:T.secondary,userSelect:"none"}),F=H=>H.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),S=useCallback(H=>{let B=Math.max(0,Math.min(o-1,H));y(B),d.current[B]?.focus();},[o]),g=useCallback((H,B)=>{let M=F(B).slice(0,1),E=[...N];E[H]=M,n(E.join("")),M&&H<o-1&&S(H+1);},[N,o,n,S]),b=useCallback((H,B)=>{if(B.key==="Backspace")if(!N[H]&&H>0){let M=[...N];M[H-1]="",n(M.join("")),S(H-1),B.preventDefault();return}else {let M=[...N];M[H]="",n(M.join(""));return}if(B.key==="ArrowLeft"&&H>0){B.preventDefault(),S(H-1);return}if(B.key==="ArrowRight"&&H<o-1){B.preventDefault(),S(H+1);return}if(B.key==="Home"){B.preventDefault(),S(0);return}if(B.key==="End"){B.preventDefault(),S(o-1);return}},[N,o,n,S]),A=useCallback(H=>{let B=F(H.clipboardData.getData("text")).slice(0,o);B&&(n(B),requestAnimationFrame(()=>{let M=Math.min(B.length,o-1);S(M);}),H.preventDefault());},[o,n,S]);return jsx("div",{className:"plainframe-ui-code-boxes",css:K,children:Array.from({length:o}).map((H,B)=>jsxs(me.Fragment,{children:[jsx("input",{ref:M=>{d.current[B]=M;},type:"text",inputMode:"text",maxLength:1,value:N[B]||"",placeholder:N[B]?"":x[B]||"",disabled:l,onChange:M=>g(B,M.target.value),onKeyDown:M=>b(B,M),onFocus:()=>y(B),onPaste:B===0?A:void 0,className:"plainframe-ui-code-box",css:W(B===m),"aria-label":`Code character ${B+1}`,tabIndex:B===m?0:-1}),f&&B<o-1?jsx("span",{"aria-hidden":true,role:"presentation",css:I,children:f}):null]},B))})}),Bp=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,separator:s,error:i,helperText:u,disabled:a=false,gap:l,size:c="md",variant:p="subtle",length:R=4,focusRingMode:f="always",className:v,wrapperCss:k,labelCss:C,helperRowCss:T,helperTextCss:h,css:d})=>{let m=U(),y=useId(),N=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]),x=["sm","md","lg"].includes(c)?c:"md",w=N[x],P=m.neutral,$=m.text,W=t!=null,[K,I]=useState(n),F=W?t:K,S=z=>{W||I(z),o?.(z);},g=Math.max(2,Math.min(R,10)),b=m.spacing.sm,A=Hp(l??b)??"0px",H=css({boxSizing:"border-box",display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"auto",maxWidth:"unset",fontWeight:500,cursor:a?"not-allowed":"auto"},...Array.isArray(k)?k:k?[k]:[]),B=css({fontSize:w.labelFont,fontWeight:500,color:i?m.palette.danger?.[700]??$.primary:a?P[500]:$.primary,marginBottom:4,display:"block",cursor:a?"not-allowed":"auto"},...Array.isArray(C)?C:C?[C]:[]),M=css({display:"flex",alignItems:"center",justifyContent:"center",gap:A,width:"auto",background:"transparent",outline:"none",boxShadow:"none"},...Array.isArray(d)?d:d?[d]:[]),E=css({minHeight:16,fontSize:w.helperFont,color:i?m.palette.danger?.[700]??$.secondary:$.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Array.isArray(T)?T:T?[T]:[]),L=css({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400,color:i?m.palette.danger?.[700]??$.primary:a?P[500]:$.primary},...Array.isArray(h)?h:h?[h]:[]);return jsxs("div",{className:["plainframe-ui-codefield",v||""].join(" ").trim(),css:H,children:[e&&jsx("span",{id:y,className:"plainframe-ui-codefield-label",css:B,children:e}),jsx("div",{className:"plainframe-ui-codefield-row",css:M,role:"group","aria-labelledby":e?y:void 0,tabIndex:-1,children:jsx(Lp,{value:F||"",onChange:S,len:g,theme:m,sizeKey:x,s:{codeFontSize:w.codeFontSize},variant:p,error:!!i,disabled:a,ringEnabled:f!=="none",focusRingMode:f,placeholder:r,separator:s,gapPx:A})}),u!=null&&jsx("div",{className:"plainframe-ui-codefield-helper",css:E,children:jsx("span",{className:"plainframe-ui-codefield-helper-text",css:L,children:u})})]})};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)},zp=({children:e,content:t,trigger:n="contextmenu",onOpenChange:o,hoverPosition:r="cursor",hoverOffset:s=10})=>{let i=me.useRef(null),[u,a]=me.useState(false),l=me.useCallback(E=>{a(E),o?.(E);},[o]),c=me.useCallback(()=>l(false),[l]),p=me.useRef({x:0,y:0}),R=me.useRef(null),f=me.useRef(null),v=me.useCallback(()=>{f.current=null;let E=R.current;if(!E)return;let L=Math.round(p.current.x),z=Math.round(p.current.y);E.style.transform=`translate3d(${L}px, ${z}px, 0)`;},[]),k=me.useCallback(()=>{f.current==null&&(f.current=requestAnimationFrame(v));},[v]);me.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current);},[]);let C=me.useMemo(()=>({getBoundingClientRect:()=>{let E=Math.round(p.current.x),L=Math.round(p.current.y);return {x:E,y:L,left:E,top:L,right:E,bottom:L,width:0,height:0,toJSON:()=>({x:E,y:L})}}}),[]),T=me.useRef(`cz-${Math.random().toString(36).slice(2)}`),h=me.useCallback(()=>typeof document<"u"?document.querySelector(`[data-cz-id="${T.current}"]`):null,[]),d=me.useRef(null),m=me.useRef(null),y=me.useCallback(()=>{d.current!=null&&clearTimeout(d.current),d.current=null;},[]),N=me.useCallback(()=>{m.current!=null&&clearTimeout(m.current),m.current=null;},[]),x=me.useCallback(()=>{N(),m.current=window.setTimeout(()=>l(false),0);},[N,l]),w=me.useCallback(()=>{let E=i.current?.getBoundingClientRect();return E?{x:E.left+E.width/2,y:E.top+E.height/2}:{x:0,y:0}},[]),P=me.useCallback((E,L)=>{p.current={x:E,y:L},k(),l(true);},[k,l]),$=typeof t=="function"?t({close:c}):t,W=Bs($),K=E=>{if(!me.isValidElement(E))return E;let L=al(E),z=E,O=z.props.children,_=O==null?O:Array.isArray(O)?O.map(D=>me.isValidElement(D)?K(D):D):me.isValidElement(O)?K(O):O;if(L==="DropdownMenu"){let D=z.props.onOpenChange;return me.cloneElement(z,{...z.props,open:u,onOpenChange:V=>{D?.(V),l(V);},children:_})}if(L==="DropdownMenuContent"){let D=z.props.onMouseEnter,V=z.props.onMouseLeave;return me.cloneElement(z,{...z.props,anchor:C,"data-cz-id":T.current,onMouseEnter:J=>{N(),D?.(J);},onMouseLeave:J=>{x(),V?.(J);},children:_})}return _===O?z:me.cloneElement(z,{...z.props,children:_})},I=W?K($):$,F=me.useCallback(E=>{E.preventDefault(),P(E.clientX,E.clientY);},[P]),S=me.useCallback(E=>{n==="contextmenu"&&F(E);},[n,F]),g=me.useCallback(E=>{n==="dblclick"&&F(E);},[n,F]),b=me.useCallback(E=>{n==="click"&&F(E);},[n,F]),A=me.useCallback(E=>{if(n!=="hover")return;y(),N();let L=r==="center"?w():{x:E.clientX,y:E.clientY};d.current=window.setTimeout(()=>{let z=L.x+(r==="cursor"?s:0),O=L.y+(r==="cursor"?s:0);P(z,O);},0);},[n,r,s,w,P,y,N]),H=me.useCallback(E=>{n==="hover"&&u&&r==="cursor"&&!W&&(p.current={x:E.clientX+s,y:E.clientY+s},k());},[n,u,r,W,s,k]),B=me.useCallback(()=>{n==="hover"&&(y(),x());},[n,y,x]);me.useEffect(()=>{if(n!=="hover")return;let E=()=>{if(!u)return;let L=i.current?.matches(":hover"),z=h()?.matches?.(":hover");L||z?N():x();};return window.addEventListener("pointermove",E,{passive:true,capture:true}),()=>window.removeEventListener("pointermove",E,{capture:true})},[u,n,h,N,x]),me.useEffect(()=>{let E=()=>{if(u)if(n==="hover"){let L=i.current?.matches(":hover"),z=h()?.matches?.(":hover");if(L||z?N():x(),r==="center"&&i.current){let O=w();p.current={x:O.x,y:O.y},k();}}else l(false);};return window.addEventListener("scroll",E,true),window.addEventListener("resize",E,true),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E,true);}},[u,n,r,w,k,l,N,x,h]),me.useEffect(()=>()=>{y(),N();},[y,N]);let M=({children:E})=>u?jsx("div",{ref:R,style:{position:"fixed",left:0,top:0,transform:`translate3d(${Math.round(p.current.x)}px, ${Math.round(p.current.y)}px, 0)`,willChange:"transform",zIndex:1e3,pointerEvents:"auto"},onMouseEnter:()=>n==="hover"&&N(),onMouseLeave:()=>n==="hover"&&x(),children:E}):null;return jsxs("div",{ref:i,onContextMenu:S,onDoubleClick:g,onClick:b,onMouseEnter:A,onMouseMove:H,onMouseLeave:B,css:css({position:"relative"}),className:"plainframe-ui-context-zone-wrapper",children:[e,W?I:jsx(M,{children:I})]})};var Vn=(e,t="0px")=>e==null?t:typeof e=="number"?`${e}px`:e,_p=me.memo(forwardRef(function({label:t,variant:n="full",direction:o="horizontal",labelPosition:r="center",thickness:s=1,width:i,middleMargin:u="5px",insetMargin:a="10px",chip:l=false,chipVariant:c="subtle",rounded:p=false,margin:R=10,css:f,labelCss:v,strokeCss:k,className:C,...T},h){let d=U(),{t:m,strokeColor:y,labelTextColor:N,chipSubtleBg:x,chipOutlinedBg:w,outerM:P,padX:$,verticalStrokeMargin:W}=useMemo(()=>{let g=typeof s=="number"?`${s}px`:s,b=d.surface.border,A=d.text.secondary,H=d.surface.subtleBg,B=d.surface.panelBg,M=Vn(R,"10px"),E=o==="horizontal"?n==="middle"?Vn(u):n==="inset"?Vn(a,"0px"):"0":"0",L=o==="vertical"?n==="middle"?Vn(u):n==="inset"?Vn(a,"0px"):"0":"0";return {t:g,strokeColor:b,labelTextColor:A,chipSubtleBg:H,chipOutlinedBg:B,outerM:M,padX:E,verticalStrokeMargin:L}},[s,d,o,n,u,a,R]),K=useMemo(()=>css([{display:"flex",alignItems:"center"},o==="vertical"?{flexDirection:"column",alignSelf:"stretch",width:t?"max-content":m,minWidth:t?"max-content":m,marginLeft:P,marginRight:P}:{flexDirection:"row",width:i?Vn(i):"100%",minWidth:0,paddingLeft:$,paddingRight:n==="middle"?$:"0",marginTop:P,marginBottom:P},...Array.isArray(f)?f:f?[f]:[]]),[o,t,m,P,i,$,n,f]),I=useMemo(()=>css([{background:y,borderRadius:p?d.radius.full:d.radius.xs},o==="vertical"?{width:m,minHeight:18,flex:1,marginTop:W,marginBottom:W}:{height:m,flex:1}]),[y,p,d.radius.full,d.radius.xs,o,m,W]),F=useMemo(()=>css([{margin:l?o==="vertical"?"4px 0":0:o==="vertical"?"2px 0":0,padding:l?"3px 7px":0,borderRadius:l?p?d.radius.full:`calc(${d.radius.sm} * 0.75)`:`calc(${d.radius.sm} * 0.75)`,color:N,fontWeight:500,fontSize:13,textAlign:"center",alignSelf:"center",whiteSpace:o==="vertical"?"normal":"pre",wordBreak:o==="vertical"?"break-all":void 0,...l?c==="subtle"?{background:x,border:"none"}:{background:w,border:`${m} solid ${y}`}:{}},...Array.isArray(v)?v:v?[v]:[]]),[l,o,p,d.radius.full,d.radius.sm,N,c,x,w,m,y,v]),S=useMemo(()=>jsx("div",{className:"plainframe-ui-divider-stroke",css:[I,k]}),[I,k]);return o==="vertical"?jsxs("div",{ref:h,"data-direction":"vertical","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper","is-vertical",C||""].join(" ").trim(),css:K,...T,children:[t&&r!=="top"&&S,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="bottom"&&S,!t&&S]}):jsxs("div",{ref:h,"data-direction":"horizontal","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper",C||""].join(" ").trim(),css:K,...T,children:[t&&r!=="left"&&S,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="right"&&S,!t&&S]})}));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[i,u]=useState(!!n),a=t??i,l=useCallback(p=>{t===void 0&&u(p),o?.(p);},[t,o]),c=useMemo(()=>({open:a,setOpen:l,lockScroll:r,closeOnEscape:s}),[a,l,r,s]);return jsx(ml.Provider,{value:c,children:e})},Up=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:i}=fl(),u=!!e&&me.isValidElement(t),a=useCallback(c=>{if(u){let p;me.isValidElement(t)&&(p=t.props.onClick),p?.(c);}r.onClick?.(c),c.defaultPrevented||i(true);},[u,t,r.onClick,i]),l=useCallback(c=>{if((c.key==="Enter"||c.key===" ")&&(c.preventDefault(),i(true)),u){let p;me.isValidElement(t)&&(p=t.props.onKeyDown),p?.(c);}r.onKeyDown?.(c);},[u,t,r.onKeyDown,i]);if(u){let c=t,p=c.props.css;return me.cloneElement(c,{...c.props||{},className:[c.props.className,n].filter(Boolean).join(" ")||void 0,css:[p,o].filter(Boolean),onClick:a,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,onClick:a,onKeyDown:l,...r,children:t})});Up.displayName="DrawerTrigger";var To=0,bl="",hl="",qp=()=>typeof window>"u"?0:window.innerWidth-document.documentElement.clientWidth;function Gp(){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 Xp(){if(!(typeof document>"u")&&(To>0&&(To-=1),To===0)){let e=document.body;e.style.overflow=bl,e.style.paddingRight=hl;}}var Yp=(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:i=10,radius:u,backdropBlur:a=true,backdropBlurDepth:l,closeOnClickAway:c=true,transitionMs:p,snapClosePct:R=.33,velocityClosePxS:f=950,dragElasticOut:v=.2,className:k,css:C,...T},h){let d=U(),{open:m,setOpen:y,lockScroll:N,closeOnEscape:x}=fl();useEffect(()=>{if(!(!N||!m))return Gp(),()=>Xp()},[m,N]);let w=useMemo(()=>Yp(i,0),[i]),P=useMemo(()=>r==="left"||r==="right"?"x":"y",[r]),$=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]),K=useMemo(()=>o??(r==="top"||r==="bottom"?420:s==="inset"?`calc(100% - ${w*2}px)`:"100%"),[o,r,s,w]),I=useMemo(()=>{let q=String(d.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,d.radius.lg]),F=useMemo(()=>u??(s==="inset"?d.radius.lg:I),[u,s,d.radius.lg,I]),S=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]),g=useRef(null),b=useCallback(()=>{let q=g.current;if(!q)return 1;let X=q.getBoundingClientRect();return P==="x"?X.width:X.height},[P]),A=useMemo(()=>({type:"spring",stiffness:520,damping:40,mass:.7}),[]),H=useMemo(()=>({duration:(p??280)/1e3,ease:[.22,1,.36,1]}),[p]),B=useMemo(()=>$*1.1,[$]),M=useMemo(()=>P==="x"?{x:`${B*100}%`,y:0}:{y:`${B*100}%`,x:0},[P,B]),E=useMemo(()=>css({position:"fixed",zIndex:1100,...S,width:W,height:K,backgroundColor:d.surface.panelBg,borderRadius:F,overflowY:"auto",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",willChange:"transform, box-shadow, opacity",backfaceVisibility:"hidden",pointerEvents:m?"auto":"none",touchAction:P==="x"?"pan-y":"pan-x","@media (prefers-reduced-motion: reduce)":{transition:"none"}}),[S,W,K,d.surface,F,m,P]),L=useMemo(()=>css({position:"fixed",inset:0,zIndex:1099,background:d.surface.overlayBg,transition:"all .3s ease",...a?{backdropFilter:`blur(${l??"2px"})`}:null}),[a,l,d.surface]),z=useCallback(()=>{c&&y(false);},[c,y]),O=useMemo(()=>P==="x"?{left:$===-1?v:0,right:$===1?v:0}:{top:$===-1?v:0,bottom:$===1?v:0},[P,$,v]),_=useMemo(()=>P==="x"?{left:0,right:0}:{top:0,bottom:0},[P]),D=useMemo(()=>Math.max(0,Math.min(1,R)),[R]),V=useCallback((q,X)=>{let le=P==="x"?X.offset.x:X.offset.y,ie=P==="x"?X.velocity.x:X.velocity.y,be=$*le>0,Pe=Math.abs(le)>=b()*D,Re=$*ie>f;be&&(Pe||Re)&&y(false);},[P,$,b,D,f,y]),J=useRef(null);useEffect(()=>{if(!m)return;J.current=document.activeElement;let q=setTimeout(()=>{let ie=g.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),X=ie=>{let be=g.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"&&x&&(ie.stopPropagation(),y(false));};return document.addEventListener("focusin",X,true),window.addEventListener("keydown",le),()=>{clearTimeout(q),document.removeEventListener("focusin",X,true),window.removeEventListener("keydown",le),J.current&&typeof J.current.focus=="function"&&J.current.focus();}},[m,y,x]);let{...ae}=T;return jsx(AnimatePresence,{children:m?jsxs(Fragment,{children:[jsx(motion.div,{role:"presentation","aria-hidden":true,css:L,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:p?H:{duration:.18,ease:"linear"},onClick:z},"overlay"),jsx(motion.div,{ref:q=>{g.current=q,typeof h=="function"?h(q):h&&(h.current=q);},role:"dialog","aria-modal":"true",tabIndex:-1,"data-position":r,"data-variant":s,className:["plainframe-ui-drawer",k||""].join(" ").trim(),css:[E,C],drag:P,dragConstraints:_,dragElastic:O,dragMomentum:false,dragDirectionLock:true,onDragEnd:V,initial:{...M,opacity:.98},animate:{x:0,y:0,opacity:1},exit:{...M,opacity:.98},transition:p?H:A,...ae,children:t},"panel")]}):null})});yl.displayName="DrawerContent";var Jp=forwardRef(function({open:t,on:n,defaultOpen:o,defaultOn:r,onOpenChange:s,onClose:i,children:u,...a},l){let c=t!==void 0?t:n,p=o!==void 0?o:r,R=c!==void 0,[f,v]=useState(!!p),k=R?!!c:f,C=useCallback(T=>{R||v(T),T||i?.(),s?.(T);},[R,i,s]);return jsx(gl,{open:k,onOpenChange:C,children:jsx(yl,{ref:l,...a,children:u})})});Jp.displayName="DrawerLegacy";var Ws=({children:e,duration:t=300,delay:n=0,on:o=false,onAnimationEnd:r,asChild:s=true,className:i,blur:u=false})=>{let a={opacity:o?1:0,filter:u?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=p=>R=>{R.target===R.currentTarget&&(R.propertyName==="opacity"||R.propertyName==="filter")&&r?.(),p?.(R);};if(s&&isValidElement(e)){let p=e,R=p.props.css,f=Array.isArray(R)?[...R,a]:R?[R,a]:[a],v=["plainframe-ui-transition-fade",p.props.className||"",i||""].join(" ").trim(),k=p.props.onTransitionEnd;return cloneElement(p,{...p.props,css:f,className:v,onTransitionEnd:l(k)})}let c=css(a);return jsx("div",{className:["plainframe-ui-transition-fade",i||""].join(" ").trim(),css:c,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:i,width:u,height:a,...l})=>{let c=U(),p=e==="vertical"||e==="column"?"column":"row",R=t===void 0?void 0:typeof t=="number"?t:c.spacing[t]??t,f=css({display:"flex",flexDirection:p,gap:R,justifyContent:n,alignItems:o,maxWidth:xl(u),width:u?"100%":void 0,maxHeight:xl(a),height:a?"100%":void 0,boxSizing:"border-box"});return jsx("div",{className:["plainframe-ui-flex",r||""].join(" ").trim(),css:[f,s],...l,children:i})});vl.displayName="Flex";var Ks=({children:e,duration:t=300,delay:n=0,on:o=false,initialScale:r=0,finalScale:s=1,onAnimationEnd:i,asChild:u=true,className:a})=>{let l={transform:o?`scale(${s})`:`scale(${r})`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},c=R=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&i?.(),R?.(f);};if(u&&isValidElement(e)){let R=e,f=R.props.css,v=Array.isArray(f)?[...f,l]:f?[f,l]:[l],k=R.props.onTransitionEnd,C=["plainframe-ui-transition-grow",R.props.className||"",a||""].join(" ").trim();return cloneElement(R,{...R.props,css:v,className:C,onTransitionEnd:c(k)})}let p=css(l);return jsx("div",{className:["plainframe-ui-transition-grow",a||""].join(" ").trim(),css:p,onTransitionEnd:c(),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"}},pm=e=>e==null?void 0:typeof e=="number"?`${e}px`:String(e),mm={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:i,align:u="left",textTransform:a="none",whiteSpace:l="normal",decoration:c="none",decorationStyle:p="solid",decorationThickness:R=1,decorationColor:f,italic:v,className:k,style:C,as:T})=>{let h=U(),d=Cl[e]??Cl.body,m=T??mm[e]??"span",y=F=>F==null?d.size:typeof F=="number"?F:h?.typography?.sizes?.[F]??F,N=y(o)??y(d.size),x=r??d.weight,w=s??d.lh,P=i??d.ls,$=n==="secondary"?h.text.secondary:n==="primary"?h.text.primary:n??"inherit",W=f??h.surface.border,K=css({boxSizing:"border-box",display:u==="left"?"inline":"block",textAlign:u==="left"?void 0:u,fontFamily:h?.typography?.fonts?.sans||"inherit",fontSize:N,fontWeight:x,lineHeight:w,letterSpacing:P,color:$,textTransform:a,whiteSpace:l,fontStyle:v?"italic":"normal",margin:0,padding:0}),I=c==="none"?css({textDecoration:"none"}):css({textDecorationLine:c,textDecorationStyle:p,textDecorationColor:W,textDecorationThickness:pm(R),textDecorationSkipInk:"auto"});return jsx(m,{className:[`pfui-typo-${e}`,k||""].join(" ").trim(),css:[K,I],style:C,"data-variant":e,children:t})});Un.displayName="Typography";var Us=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,bm=(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:i=false,hoverEffect:u="none",label:a,labelAlign:l="center",aspectRatio:c,loading:p="lazy",decoding:R="async",fetchPriority:f,srcSet:v,sizes:k,placeholder:C,blurDataURL:T,placeholderColor:h="#f1f1f1",fallbackSrc:d,className:m,css:y,onClick:N,onLoad:x,onError:w,...P},$){let[W,K]=useState(false),[I,F]=useState(false),[S,g]=useState(false),b=U(),A=bm(s,b)??"0px",H=a?"figure":"div",B=css({display:"flex",flexDirection:"column",gap:a?b.spacing.xs:0,width:"fit-content",borderRadius:`var(--pfui-image-radius, ${A})`}),M=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:c,boxShadow:i?"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&&(u==="rotate"||u==="scale-rotate")?"rotate(3deg)":"none",cursor:N?"pointer":void 0}),E=css({position:"absolute",inset:0,background:C==="color"?h:void 0,backgroundImage:C==="blur"&&T?`url(${T})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:C==="blur"?"blur(8px)":void 0,transition:"opacity 0.3s ease",opacity:S?0:1,pointerEvents:"none"}),L=css({width:"100%",height:"100%",display:"block",objectFit:"cover",transform:W&&(u==="scale"||u==="scale-rotate")?"scale(1.08)":"none",transition:"transform 0.3s ease",willChange:"transform"});return jsxs(H,{className:["plainframe-ui-image",m||""].join(" ").trim(),css:[B,y],tabIndex:-1,children:[jsxs("div",{className:"plainframe-ui-image-frame",css:M,onMouseEnter:()=>K(true),onMouseLeave:()=>K(false),onClick:N,children:[!S&&C&&jsx("div",{"aria-hidden":true,className:"plainframe-ui-image-placeholder",css:E}),jsx("img",{ref:$,className:"plainframe-ui-image-img",css:L,src:I&&d?d:t,alt:n,srcSet:v,sizes:k,loading:p,decoding:R,fetchPriority:f,onLoad:z=>{g(true),x?.(z);},onError:z=>{F(true),w?.(z);},...P})]}),a&&jsx(Un,{as:"figcaption",variant:"caption",align:l,children:a})]})});Tl.displayName="Image";var wl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,vm=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}},Cm=e=>e*Math.PI/180,Rm=(e,t,n)=>{let o=Math.abs(Cm(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 Tm(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 wm=(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],Em={sm:150,md:200,lg:260,xl:340},km=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Im(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 km(typeof n=="number"||typeof n=="string"?n:e)}return e}}}var Sm=memo(function({children:t,variant:n="fan",width:o,aspectRatio:r="4/5",size:s="md",hoverEffect:i="none",hovering:u,maxItems:a=3,shadow:l=false,cursor:c,outline:p,outlineColor:R,outlineWidth:f=3,outlineOffset:v=0,radius:k="md",label:C,labelAlign:T="center",css:h,className:d,...m}){let y=U(),N=vm(r)??4/5,x=typeof o=="string"?o:void 0,w=typeof o=="number"?o:x&&/px$/.test(x)?parseFloat(x):Em[s],P=Math.max(1,w/N),W=Children.toArray(t).filter(isValidElement).slice(0,a),K=W.length,I=Tm(n,K),F=W.map((q,X)=>wm(n,K,X)),S=q=>P*.6*F[q],g=q=>S(q)*N,b=0,A=0;for(let q=0;q<K;q++){let X=g(q),le=S(q),ie=Math.max(Math.abs(I.base.ang[q]??0),Math.abs(I.exp.ang[q]??0)),be=Math.max(Math.abs(I.base.dx[q]??0),Math.abs(I.exp.dx[q]??0)),Pe=Math.max(Math.abs(I.base.dy[q]??0),Math.abs(I.exp.dy[q]??0)),Re=i==="expand"?kl[q]??1.08:i==="reveal"?El[q]??1.03:1,Ce=Rm(X,le,ie),Ie=Ce.w*Re,Te=Ce.h*Re,we=be/100*X*Re,he=Pe/100*le*Re;b=Math.max(b,Ie/2+we),A=Math.max(A,Te/2+he);}let H=Math.max(1,2*b),B=Math.max(1,2*A),M=Math.min(1,w/H,P/B),E=u===void 0?"pointer":"controlled",L=u?"true":void 0,z=css({display:"flex",flexDirection:"column",cursor:c||"auto",lineHeight:0,position:"relative",isolation:"isolate",gap:C?y.spacing.xs:0}),O=css({position:"relative",width:wl(typeof o=="number"?o:w)??(typeof o=="string"?o:void 0),height:wl(P)}),_=css({position:"absolute",inset:0,left:"50%",top:"50%",width:`${H}px`,height:`${B}px`,transform:`translate(-50%, -50%) scale(${M})`,transformOrigin:"center center"}),D=Im(k,y)??"0px",V=q=>{let X=n==="fan"?`rotate(${I.base.ang[q]}deg) translate(${I.base.dx[q]}%, ${I.base.dy[q]}%)`:n==="slide"?`translate(${I.base.dx[q]}%, ${I.base.dy[q]}%) rotate(${I.base.ang[q]}deg)`:n==="domino"?`translate(0%, ${I.base.dy[q]}%)`:`translate(${I.base.dx[q]}%, ${I.base.dy[q]}%) rotate(${I.base.ang[q]}deg)`,le=n==="fan"?`rotate(${I.exp.ang[q]}deg) translate(${I.exp.dx[q]}%, ${I.exp.dy[q]}%)`:n==="slide"?`translate(${I.exp.dx[q]}%, ${I.exp.dy[q]}%) rotate(${I.exp.ang[q]}deg)`:n==="domino"?`translate(0%, ${I.exp.dy[q]}%)`:`translate(${I.exp.dx[q]}%, ${I.exp.dy[q]}%) rotate(${I.exp.ang[q]}deg)`,ie=i==="reveal"?"translate(0,0) rotate(0) scale(1)":`${X} scale(1)`,be=i==="expand"?`${le} scale(${kl[q]??1.06})`:i==="reveal"?`${X} scale(${El[q]??1.03})`:`${X} 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:p?`${f}px solid ${R??y.surface.appBg}`:void 0,outlineOffset:p?v: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}`}})},J=q=>css({width:`${g(q)}px`,aspectRatio:`${N}`,position:"relative",overflow:"hidden",borderRadius:D,"--pfui-image-radius":D,"& > *":{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(C?"figure":"div",{className:["plainframe-ui-image-stack-wrapper",d||""].join(" ").trim(),"data-hover-mode":E,"data-hovered":L,css:[z,h],tabIndex:-1,...m,children:[jsx("div",{className:"plainframe-ui-image-stack",css:O,children:jsx("div",{className:"plainframe-ui-image-stack-stage",css:_,children:W.map((q,X)=>jsx("div",{className:"plainframe-ui-image-stack-item",css:V(X),children:jsx("div",{className:"plainframe-ui-image-stack-frame",css:J(X),children:q})},X))})}),C&&jsx(Un,{as:"figcaption",variant:"caption",align:T,children:C})]})});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 Am(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}var Pm=forwardRef(function({children:t,variant:n="outlined",size:o="sm",radius:r,mono:s=true,uppercase:i=false,css:u,className:a="plainframe-ui-kbd",...l},c){let p=U(),R=xe(),f=Sl[o]??Sl.sm,v=Am(r,p),k={br:p.neutral[300],txt:p.neutral[800],inset:p.neutral[0]},C=css({all:"unset",boxSizing:"border-box",display:"inline-flex !important",alignItems:"center",justifyContent:"center",height:n==="ghost"?void 0:`${f.h}px !important`,minHeight:n==="ghost"?void 0:`${f.h}px !important`,paddingInline:n==="ghost"?0:`${f.px}px !important`,paddingBlock:"0 !important",fontFamily:s?p.typography.fonts.mono:"inherit",fontSize:n==="ghost"?`${f.font*1.2}px !important`:`${f.font}px !important`,fontWeight:600,letterSpacing:.2,lineHeight:"0.2 !important",textTransform:i?"uppercase":"none",borderRadius:v,userSelect:"none",whiteSpace:"nowrap",verticalAlign:"baseline",position:"relative",outline:"none"}),T=css({"&&":{background:p.neutral[200],border:"none",boxShadow:"none",color:k.txt}}),h=css({"&&":{background:"transparent",color:k.txt,border:"none",boxShadow:"none"}}),d=css({"&&":{background:p.surface.panelBg,color:k.txt,border:`1px solid ${k.br}`,boxShadow:`inset 0 1px 0 ${k.inset}AA, 0 1px 0 rgba(0,0,0,0.03)`}}),m=n==="subtle"?T:n==="ghost"?h:d;return jsx("kbd",{ref:c,className:a,css:[R(),C,m,u],...l,children:t})});var Bm=(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:i=true,className:u,distance:a})=>{let c=Bm(a,t==="left"||t==="right"?"100vw":"100vh"),p=t==="left"?`-${c}`:t==="right"?c:"0",R=t==="up"?c:t==="down"?`-${c}`:"0",f={transform:r?"translate3d(0,0,0)":`translate3d(${p}, ${R}, 0)`,transition:`transform ${n}ms ease ${o}ms`,pointerEvents:r?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},v=C=>T=>{T.target===T.currentTarget&&T.propertyName==="transform"&&s?.(),C?.(T);};if(i&&isValidElement(e)){let C=e,T=C.props.css,h=Array.isArray(T)?[...T,f]:T?[T,f]:[f],d=["plainframe-ui-transition-slide",C.props.className||"",u||""].join(" ").trim(),m=C.props.onTransitionEnd;return cloneElement(C,{...C.props,css:h,className:d,onTransitionEnd:v(m)})}let k=css(f);return jsx("div",{className:["plainframe-ui-transition-slide",u||""].join(" ").trim(),css:k,onTransitionEnd:v(),children:e})};var Gs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Al=me.createContext(null),Pl=()=>{let e=useContext(Al);if(!e)throw new Error("Modal components must be used within <Modal>.");return e},_m=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[i,u]=useState(!!n),a=t??i,l=useCallback(p=>{t===void 0&&u(p),o?.(p);},[t,o]);useEffect(()=>{if(!a||!s)return;let p=R=>{R.key==="Escape"&&(R.stopPropagation(),l(false));};return window.addEventListener("keydown",p,true),()=>window.removeEventListener("keydown",p,true)},[a,s,l]);let c=useMemo(()=>({open:a,setOpen:l,lockScroll:r,closeOnEscape:s}),[a,l,r,s]);return jsx(Al.Provider,{value:c,children:e})},Nl=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:i}=Pl(),u=!!e&&me.isValidElement(t),a=useCallback(c=>{if(u){let p;me.isValidElement(t)&&(p=t.props.onClick),p?.(c);}r.onClick?.(c),c.defaultPrevented||i(true);},[u,t,r.onClick,i]),l=useCallback(c=>{if((c.key==="Enter"||c.key===" ")&&(c.preventDefault(),i(true)),u){let p;me.isValidElement(t)&&(p=t.props.onKeyDown),p?.(c);}r.onKeyDown?.(c);},[u,t,r.onKeyDown,i]);if(u){let c=t,p=c.props.css;return me.cloneElement(c,{...c.props||{},className:[c.props.className,n].filter(Boolean).join(" ")||void 0,css:[p,o].filter(Boolean),"aria-haspopup":"dialog",onClick:a,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,"aria-haspopup":"dialog",onClick:a,onKeyDown:l,...r,children:t})});Nl.displayName="ModalTrigger";var Dl=forwardRef(({children:e,variant:t="inset",width:n=500,height:o="auto",radius:r="lg",padding:s="lg",backdrop:i=true,backdropBlur:u=true,backdropBlurDepth:a=5,closeOnClickAway:l=true,transitionVariant:c="fade",direction:p="up",transitionDuration:R=300,containerCss:f,backdropCss:v,className:k,...C},T)=>{let h=U(),{open:d,setOpen:m,lockScroll:y}=Pl(),N=me.useRef(null),x=me.useRef(null);me.useEffect(()=>{if(!d)return;x.current=document.activeElement;let I=setTimeout(()=>{let S=N.current;if(!S)return;let g=S.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');g.length>0?g[0].focus():S.focus();},100),F=S=>{let g=N.current;if(!g||!S.target)return;let b=S.target;if(!g.contains(b)){S.preventDefault();let A=g.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');A.length>0?A[0].focus():g.focus();}};return document.addEventListener("focusin",F,true),()=>{clearTimeout(I),document.removeEventListener("focusin",F,true),x.current&&typeof x.current.focus=="function"&&x.current.focus();}},[d]);let w=typeof h.spacing.sm=="number"?`${h.spacing.sm}px`:String(h.spacing.sm),P=css({width:"100%",height:Gs(o),maxWidth:t==="inset"?`min(${Gs(n)||"100%"}, calc(100% - ${w} * 2))`:Gs(n),maxHeight:t==="inset"?`calc(100% - ${w} * 2)`:"100%",margin:t==="inset"?w:void 0}),$=jsx(_n,{role:"dialog","aria-modal":"true",tabIndex:-1,className:["plainframe-ui-modal",k||""].join(" ").trim(),padding:s,radius:r,variant:"panel",css:[P,f],ref:I=>{N.current=I,typeof T=="function"?T(I):T&&(T.current=I);},...C,children:e}),W=c==="none"?$:c==="slide"?jsx(qs,{on:d,direction:p,duration:R,children:$}):c==="grow"?jsx(Ks,{initialScale:.75,on:d,duration:R,children:$}):jsx(Ws,{on:d,duration:R,children:$});if(!i)return jsx(Fragment,{children:W});let K=css(t==="full"?{alignItems:"start",justifyItems:"start",justifyContent:"start"}:{alignItems:"center",justifyItems:"center",justifyContent:"center"});return jsx(Es,{on:d,blur:u,blurDepth:a,onClickAway:l?()=>m(false):void 0,css:[K,v].filter(Boolean),contentCss:K,lockScroll:y,children:W})});Dl.displayName="ModalContent";var Jm={xs:{h:22,px:8,font:11,radius:8,gap:4,icon:12},sm:{h:28,px:10,font:13,radius:9,gap:6,icon:14},md:{h:34,px:12,font:14,radius:10,gap:8,icon:16}},Zm=({count:e,page:t,defaultPage:n=1,onChange:o,siblingCount:r=1,boundaryCount:s=1,disabled:i=false,showFirstLast:u=false,loop:a=false,size:l="sm",variant:c="subtle",gap:p,className:R,css:f})=>{let v=U(),k=xe(),C=t!==void 0,[T,h]=useState(n),d=Math.max(1,e),m=Mr(C?t:T,1,d),y=useCallback(L=>{let z=Mr(L,1,d);C||h(z),o?.(z);},[C,d,o]),N=useMemo(()=>Qm({count:d,page:m,siblingCount:r,boundaryCount:s}),[d,m,r,s]),x=Jm[l],w=v.palette?.primary?.[600],P=v.surface?.border,$=c==="subtle"?v.surface.subtleHover:c==="ghost"?v.surface?.subtleBg:v.surface.panelHover,W=v.text?.primary??"#111",K=c==="subtle"?v.surface?.subtleBg:"transparent",I=css({display:"inline-flex",alignItems:"center",gap:p??x.gap,flexWrap:"wrap",borderRadius:v.radius?.md,background:K,padding:c==="subtle"?v.spacing.xs:0,userSelect:"none"},...Array.isArray(f)?f:f?[f]:[]),F=css({minWidth:x.h,height:x.h,padding:`0 ${x.px}px`,borderRadius:x.radius,fontSize:x.font,lineHeight:1,border:"1px solid transparent",background:"transparent",color:W,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:i?"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:x.h,minWidth:x.h,height:x.h,padding:0}),g=(L=false)=>css([F,k({color:L?"primary":"neutral"}),c==="outlined"?L?{background:w,color:v.text.onColors.primary,borderColor:w}:{background:"transparent",borderColor:P,":hover":{background:$}}:c==="ghost"?L?{background:w,color:v.text.onColors.primary}:{":hover":{background:$}}:L?{background:w,color:v.text.onColors.primary,borderColor:w}:{":hover":{background:$}}]),b=useCallback(()=>y(1),[y]),A=useCallback(()=>y(d),[y,d]),H=useCallback(()=>{m===1?a&&y(d):y(m-1);},[m,a,d,y]),B=useCallback(()=>{m===d?a&&y(1):y(m+1);},[m,a,d,y]),M=i||m===1&&!a,E=i||m===d&&!a;return jsxs("nav",{"aria-label":"Pagination",className:["plainframe-ui-pagination",R||""].join(" ").trim(),css:I,onKeyDown:L=>{i||(L.key==="ArrowLeft"&&(L.preventDefault(),H()),L.key==="ArrowRight"&&(L.preventDefault(),B()),L.key==="Home"&&(L.preventDefault(),b()),L.key==="End"&&(L.preventDefault(),A()));},children:[u&&jsx("button",{className:"plainframe-ui-pagination-first-button",type:"button","aria-label":"First page","aria-disabled":M,disabled:M,css:[g(false),S],onClick:b,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronFirst,{strokeWidth:3,css:{width:x.icon,height:x.icon}})}),jsx("button",{className:"plainframe-ui-pagination-previous-button",type:"button","aria-label":"Previous page","aria-disabled":M,disabled:M,css:[g(false),S],onClick:H,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronLeft,{strokeWidth:3,css:{width:x.icon,height:x.icon}})}),N.map((L,z)=>typeof L=="number"?jsx("button",{className:"plainframe-ui-pagination-page-button",type:"button","aria-label":L===m?`Page ${L}, current page`:`Go to page ${L}`,"aria-current":L===m?"page":void 0,css:g(L===m),onClick:()=>y(L),children:L},L):jsx("span",{className:"plainframe-ui-pagination-ellipsis","aria-hidden":true,css:css([F,k(),{borderColor:"transparent",cursor:"default",opacity:.8,padding:0,minWidth:x.h}]),children:"\u2026"},`e${z}`)),jsx("button",{className:"plainframe-ui-pagination-next-button",type:"button","aria-label":"Next page","aria-disabled":E,disabled:E,css:[g(false),S],onClick:B,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronRight,{strokeWidth:3,css:{width:x.icon,height:x.icon}})}),u&&jsx("button",{className:"plainframe-ui-pagination-last-button",type:"button","aria-label":"Last page","aria-disabled":E,disabled:E,css:[g(false),S],onClick:A,style:{backgroundColor:c==="subtle"?v.surface?.panelBg:void 0},children:jsx(ChevronLast,{strokeWidth:3,css:{width:x.icon,height:x.icon}})})]})};function Mr(e,t,n){return Math.max(t,Math.min(n,e))}function Qm({count:e,page:t,siblingCount:n,boundaryCount:o}){if(e<=0)return [1];let r=2*o+2*n+3;if(e<=r)return Sr(1,e);let s=Sr(1,Math.min(o,e)),i=Sr(Math.max(e-o+1,o+1),e),u=Mr(t-n,o+2,Math.max(o+2,e-o-2*n-1)),a=Mr(t+n,Math.min(o+2+2*n,e-o-1),e-o-1),l=[],c=p=>{let R=l[l.length-1];R!==p&&(R==="ellipsis"&&p==="ellipsis"||l.push(p));};return s.forEach(c),u>o+2?c("ellipsis"):o+1<u&&c(o+1),Sr(u,a).forEach(c),a<e-o-1?c("ellipsis"):e-o>a&&c(e-o),i.forEach(c),l}function Sr(e,t){if(t<e)return [];let n=[];for(let o=e;o<=t;o++)n.push(o);return n}var of=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,rf=me.memo(({children:e,direction:t="left",width:n,variant:o="solid",className:r,css:s})=>{let i=U(),u=i.surface.border,a=css({display:"inline-block",boxSizing:"border-box",maxWidth:of(n,"fit-content"),width:"100%",padding:`0 ${i.spacing.md}`,borderLeft:t==="left"?`3px ${o==="dashed"?"dashed":"solid"} ${u}`:"none",borderRight:t==="right"?`3px ${o==="dashed"?"dashed":"solid"} ${u}`:"none"},...Array.isArray(s)?s:s?[s]:[]);return jsx("div",{className:r??"plainframe-ui-quote",css:a,children:e})});var $l=createContext(null),cf=()=>{let e=useContext($l);if(!e)throw new Error("RadioItem must be used within a RadioGroup");return e},uf=e=>{let t=e?.horizontal??"left",n=e?.vertical??"center";return t==="center"&&n==="center"?{horizontal:"left",vertical:"center"}:{horizontal:t,vertical:n}},df=({value:e,defaultValue:t,onChange:n,disabled:o=false,size:r="md",direction:s="horizontal",variant:i="filled",className:u,children:a,anchorOrigin:l,css:c})=>{let p=U(),R=e!==void 0&&n!==void 0,[f,v]=useState(t),k=R?e:f,C=useRef([]),[T,h]=useState(0),d=()=>h(F=>F+1),m=useCallback(F=>{R||v(F),n?.(F);},[R,n]),y=useCallback(F=>(C.current.push(F),d(),C.current.length-1),[]),N=useCallback((F,S)=>{let g=C.current[F];g&&(C.current[F]={...g,...S},d());},[]),x=()=>C.current.map((F,S)=>({it:F,i:S})).filter(({it:F})=>F.ref&&!F.disabled).map(({i:F})=>F),w=useCallback((F,S)=>{let g=x();if(!g.length)return;let b=Math.max(0,g.indexOf(F)),A=g[(b+S+g.length)%g.length],H=C.current[A]?.ref;if(H){H.focus();let B=C.current[A]?.value;B!==void 0&&m(B);}},[m]),P=useCallback(F=>{let S=x();if(!S.length)return;let g=F==="first"?S[0]:S[S.length-1],b=C.current[g]?.ref;if(b){b.focus();let A=C.current[g]?.value;A!==void 0&&m(A);}},[m]),$=useMemo(()=>{let F=C.current.filter(g=>g.ref&&!g.disabled);return F.length?F.some(g=>g.value===k)?k:F[0]?.value:void 0},[k,T]),W=useMemo(()=>({selected:k,setSelected:m,disabled:o,size:r,direction:s,variant:i,register:y,update:N,moveFocusBy:w,moveToEdge:P,focusValue:$,theme:p,anchorOrigin:uf(l)}),[k,m,o,r,s,i,y,N,w,P,$,p,l]),K=css({width:"fit-content"}),I=css({display:"flex",flexDirection:s==="vertical"?"column":"row",gap:p.spacing.sm,width:"fit-content",alignItems:s==="vertical"?"stretch":"center"});return jsx("div",{className:u??"plainframe-ui-radio-group",css:[K,c],children:jsx("div",{className:"plainframe-ui-radio-row",role:"radiogroup","aria-disabled":o||void 0,css:I,children:jsx($l.Provider,{value:W,children:a})})})},pf=({value:e,disabled:t=false,className:n,children:o,css:r})=>{let{selected:s,setSelected:i,disabled:u,size:a,register:l,update:c,moveFocusBy:p,moveToEdge:R,theme:f,variant:v,focusValue:k,anchorOrigin:C}=cf(),T=u||t,h=s===e,d=["sm","md","lg"].includes(a)?a:"md",m=d==="sm"?16:d==="lg"?24:20,y=O=>f.palette?.primary?.[O],N=y(600),x=y(100),w=f.neutral[300],P=f.palette.primary[300],$=f.text.onColors?.primary??f.neutral[0],W="transparent",K=P,I=$;v==="soft"?(W=x,K=null,I=N):v==="outlined"?(W=y(50),K=P,I=N):(W=f.neutral[200],K="transparent",I=$),h&&(v==="outlined"?(W=x,K=P,I=N):v==="filled"?(W=N,K=null,I=$):(W=x,K=null,I=N));let F=v==="filled"?w:f.palette.primary[100],S=useRef(null),g=useRef(-1);useEffect(()=>{g.current=l({ref:S.current,value:e,disabled:!!T});},[l]),useEffect(()=>{c(g.current,{ref:S.current,value:e,disabled:!!T});},[c,T,e]);let b=css({border:"none",background:"transparent",display:"inline-grid",gridTemplateColumns:"auto auto auto",gridTemplateRows:"auto auto auto",columnGap:C.vertical==="center"?f.spacing.sm:0,rowGap:C.vertical==="center"?0:f.spacing.xs,justifyItems:"center",alignItems:"center",opacity:T?.5:1,borderRadius:f.radius.md,cursor:T?"not-allowed":"pointer",transition:"transform .16s ease",fontSize:f.typography.sizes.sm,fontWeight:500,padding:f.spacing.sm,"&:hover .plainframe-ui-radio-circle-outer":T||h?{}:{background:F,boxShadow:v==="outlined"?`inset 0 0 0 ${f.componentHeights.border} ${P}`:"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:W,boxShadow:K?`inset 0 0 0 ${f.componentHeights.border} ${K}`:"none",transition:"background-color .16s ease, box-shadow .16s ease, filter .16s ease",display:"inline-flex",alignItems:"center",justifyContent:"center"}),H=css({width:h?m*.45:0,height:h?m*.45:0,borderRadius:f.radius.full,background:h?I:"transparent",transition:"all 250ms cubic-bezier(.72,1.6,.32,1)",transform:h?"scale(1)":"scale(0.6)",opacity:h?1:0}),B=css({gridColumn:2,gridRow:2,minWidth:0,maxWidth:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",textAlign:"left"}),M=(()=>{let O=C.horizontal,_=C.vertical;return _==="center"?{col:O==="right"?3:1,row:2}:{col:2,row:_==="top"?1:3}})(),L=!T&&k===e?0:-1,z=xe();return jsxs("button",{ref:S,className:n??"plainframe-ui-radio-item",type:"button",role:"radio","aria-checked":h,"aria-disabled":T||void 0,disabled:T,tabIndex:L,onClick:()=>{T||i(e);},onKeyDown:O=>{T||(O.key==="Enter"||O.key===" "?(O.preventDefault(),i(e)):O.key==="ArrowRight"||O.key==="ArrowDown"?(O.preventDefault(),p(g.current,1)):O.key==="ArrowLeft"||O.key==="ArrowUp"?(O.preventDefault(),p(g.current,-1)):O.key==="Home"?(O.preventDefault(),R("first")):O.key==="End"&&(O.preventDefault(),R("last")));},css:[b,z({color:"primary"}),r],children:[jsx("span",{className:"plainframe-ui-radio-circle-outer",css:[A,css({gridColumn:M.col,gridRow:M.row})],children:jsx("span",{className:"plainframe-ui-radio-circle-dot",css:H})}),o!=null&&jsx("span",{className:"plainframe-ui-radio-label",css:B,children:o})]})};var hf=({children:e,duration:t=400,delay:n=0,on:o=false,initialAngle:r=360,finalAngle:s=0,onAnimationEnd:i,asChild:u=true,className:a})=>{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"},c=R=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&i?.(),R?.(f);};if(u&&isValidElement(e)){let R=e,f=R.props.css,v=Array.isArray(f)?[...f,l]:f?[f,l]:[l],k=["plainframe-ui-transition-rotate",R.props.className||"",a||""].join(" ").trim(),C=R.props.onTransitionEnd;return cloneElement(R,{...R.props,css:v,className:k,onTransitionEnd:c(C)})}let p=css(l);return jsx("div",{className:["plainframe-ui-transition-rotate",a||""].join(" ").trim(),css:p,onTransitionEnd:c(),children:e})};var Mo=(...e)=>e.filter(Boolean).flat(),Fr=e=>me.isValidElement(e),Fo=(e,t)=>{if(!Fr(e))return false;let n=e.type,o=(n?.displayName??n?.name??"")||"";return typeof o=="string"&&t.includes(o)},vf=(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 Cf({value:e,defaultValue:t,onChange:n,label:o,placeholder:r="Select\u2026",startIcon:s,endIcon:i,disabled:u,size:a="md",variant:l="subtle",fullWidth:c,width:p=200,menuAlign:R="left",menuWidth:f,menuMaxHeight:v=280,wrapperCss:k,labelCss:C,triggerCss:T,menuCss:h,optionCss:d,children:m,className:y,menuSize:N="md",triggerRender:x}){let w=U(),P=xe(),$=me.useId(),W=`${$}-label`,K=`${$}-menu`,I={sm:{minHeight:w.componentHeights.sm,radius:w.radius.sm},md:{minHeight:w.componentHeights.md,radius:w.radius.md},lg:{minHeight:w.componentHeights.lg,radius:w.radius.md}},F=I[a]||I.md,[S,g]=me.useState(false),b=j=>g(!!j),A=typeof e<"u",H=Array.isArray(e)||Array.isArray(t),[B,M]=me.useState(typeof t<"u"?t:H?[]:void 0),E=A?e:B,L=j=>{A||M(j),n?.(j);},z=me.Children.toArray(m).filter(Fr),O,_=[];for(let j of z)if(Fo(j,["MenuRadioGroup"]))O=j;else if(Fo(j,["MenuCheckboxGroup"])){let ue=j.props.children,de=ue?me.Children.toArray(ue).filter(Fr):[];_.push(...de);}else _.push(j);let V=(O?me.Children.toArray(O.props.children).filter(Fr):_).filter(j=>!Fo(j,["MenuLabel","MenuSeparator"])).map((j,ue)=>{let de=j.props,fe=vf(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=Fo(j,["MenuCheckboxItem"]),tn=Fo(j,["MenuRadioItem"]),nn=yt||Ye==="menuitemcheckbox"||typeof de.onCheckedChange=="function"||typeof de.checked=="boolean"||typeof de.defaultChecked=="boolean",Sn=!nn&&(tn||Ye==="menuitemradio"||!!O),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}}),J=V.some(j=>j.isCheckbox),ae=V.length>0&&V.every(j=>j.isRadio),X=(H||J)&&!ae,le=me.useCallback(j=>X?(Array.isArray(E)?E:[]).some(de=>Object.is(de,j)):Object.is(E,j),[E,X]),ie=me.useMemo(()=>{if(X){let ue=Array.isArray(E)?E:[];return V.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=V.find(ue=>Object.is(ue.value,E));if(j)return typeof j.nodeForTrigger=="string"||typeof j.nodeForTrigger=="number"?String(j.nodeForTrigger):j.nodeForTrigger},[E,X,V]),be=j=>{u||(Object.is(j,E)||L(j),b(false));},Pe=j=>{u||Object.is(j,E)||L(j);},Re=j=>{if(u)return;let ue=Array.isArray(E)?E:[],fe=ue.some(ze=>Object.is(ze,j))?ue.filter(ze=>!Object.is(ze,j)):[...ue,j];L(fe);},Ce={position:"relative",width:c?"100%":typeof p=="number"?`${p}px`:p,maxWidth:"100%"},Ie={width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:F.radius,minHeight:F.minHeight,fontSize:w.typography.sizes.sm,padding:`0 ${typeof w.spacing.sm=="number"?`${w.spacing.sm}px`:w.spacing.sm} 0 ${typeof w.spacing.md=="number"?`${w.spacing.md}px`:w.spacing.md}`,fontWeight:500,lineHeight:1,userSelect:"none",cursor:u?"not-allowed":"pointer",border:"none",outline:"none",transition:"box-shadow .16s ease",color:w.text.primary,background:"transparent",whiteSpace:"nowrap"},Te=l==="subtle"?{background:w.surface.subtleBg}:l==="outlined"?{background:w.surface.panelBg,border:`1px solid ${w.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:w.text.secondary,flexShrink:0}),strokeWidth:2.5,className:"plainframe-ui-select-chevron"}),Ee=()=>{if(x)return x(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=>{u||(j.key==="ArrowDown"||j.key==="ArrowUp"||j.key==="Enter"||j.key===" ")&&(j.preventDefault(),b(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"},Y={fontSize:"0.875em",color:w.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(Y),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=Mo(d,j.itemCss),Oe=j.el.props,st=typeof Oe.children>"u"?j.labelText??String(de):Oe.children;if(X||j.isCheckbox)return me.cloneElement(j.el,{key:j.key??ue,disabled:u||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:u||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":u||j.disabled||void 0,disabled:u||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=!X&&(O||V.length>0&&V.every(ue=>ue.isRadio));return O?me.cloneElement(O,{key:"controlled-inner-group",value:E,onValueChange:ue=>Pe(ue),children:V.map(re)}):j?jsx(lr,{value:E,onValueChange:ue=>Pe(ue),children:V.map(re)}):V.map(re)})();return jsxs("div",{css:Mo(Ce,k),className:["plainframe-ui-select-wrapper",y||""].join(" ").trim(),children:[o&&jsx("div",{id:W,className:"plainframe-ui-select-label",css:Mo({marginBottom:6,fontSize:w.typography.sizes.sm,fontWeight:500,color:w.text.secondary},C),children:o}),jsxs($n,{size:N,open:S,onOpenChange:b,children:[jsx(zn,{width:"100%",asChild:true,children:jsxs("button",{type:"button",disabled:u,"aria-haspopup":"menu","aria-expanded":S||void 0,"aria-controls":K,"aria-labelledby":o?W:void 0,onKeyDown:ee,onClick:()=>b(!S),className:"plainframe-ui-select-trigger",css:Mo(css(Ie),css(Te),T,P()),children:[jsx("div",{className:"plainframe-ui-select-trigger-content",css:css(we),children:Ee()}),i??Z]})}),jsx(hn,{id:K,gap:"xs",align:Q[R],sameWidth:f==null,width:f??p,className:"plainframe-ui-select-menu",css:Mo({maxHeight:typeof v=="number"?`${v}px`:v,overflowY:"auto"},h),children:qe})]})]})}var Zs=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Tf=keyframes`
|
|
14
14
|
0% { background-position: -200% 0; }
|
|
15
15
|
100% { background-position: 200% 0; }
|
|
16
16
|
`,wf=keyframes`
|
|
17
17
|
0% { opacity: .6; }
|
|
18
18
|
50% { opacity: 1; }
|
|
19
19
|
100% { opacity: .6; }
|
|
20
|
-
`,Ef=me.memo(({isLoading:e=true,radius:t,animation:n="wave",children:o,width:r,height:s,style:a,className:u,css:i})=>{let l=U(),c=l.surface.subtleBg,p=l.neutral[200],R=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))}),v=css({position:"absolute",inset:0,borderRadius:R,pointerEvents:"none",background:c,willChange:"background-position, opacity"}),k=n==="wave"?css({backgroundImage:`linear-gradient(90deg, ${c} 25%, ${p} 50%, ${c} 75%)`,backgroundSize:"200% 100%",animation:`${Tf} 1.4s ease-in-out infinite`}):n==="pulse"?css({animation:`${wf} 1.2s ease-in-out infinite`}):css({}),C=css({visibility:e?"hidden":"visible",display:"inline-block",borderRadius:R});return jsxs("span",{className:["plainframe-ui-skeleton",u||""].join(" ").trim(),css:[f,i],style:a,"aria-busy":e||void 0,children:[e&&jsx("span",{"aria-hidden":true,css:[v,k]}),jsx("span",{className:"plainframe-ui-skeleton-content",css:C,children:o})]})});var Pr=8,Qs=20,Xn=4,_l=({value:e,defaultValue:t,onChange:n,min:o=0,max:r=100,step:s=1,disabled:a=false,rounded:u=false,showValue:i=false,showStepper:l=false,label:c,fullWidth:p=false,css:R,trackCss:f,thumbCss:v,direction:k="horizontal",className:C,...T})=>{let h=U(),d=k==="vertical",m=useRef(null),[y,N]=useState(false),[x,w]=useState(false),[P,$]=useState(false),W=e!==void 0,K=useCallback(Z=>Math.min(r,Math.max(o,Z)),[o,r]),I=useCallback(Z=>K(Math.round((Z-o)/s)*s+o),[o,s,K]),[F,S]=useState(()=>I(t??o)),g=W?I(e):F;useEffect(()=>{W||S(Z=>I(Z));},[o,r,s,W,I]);let b=h.palette.primary[600],A=h.surface.panelBg,H=h.neutral[500],B=useMemo(()=>{let Z=r-o||1;return (g-o)/Z*100},[g,o,r]),M=useCallback(Z=>{W||S(Z),n?.(Z);},[W,n]),E=useCallback((Z,Ee)=>{let Q=m.current;if(!Q)return g;let ee=Q.getBoundingClientRect(),se=d?(ee.bottom-Ee)/ee.height:(Z-ee.left)/ee.width;return se=Math.max(0,Math.min(1,se)),I(o+se*(r-o))},[g,d,o,r,I]),L=useCallback(Z=>{a||(Z.currentTarget.setPointerCapture?.(Z.pointerId),M(E(Z.clientX,Z.clientY)),N(true));},[a,M,E]),z=useCallback(Z=>{a||(Z.currentTarget.setPointerCapture?.(Z.pointerId),N(true));},[a]),O=useCallback(Z=>{!y||a||M(E(Z.clientX,Z.clientY));},[y,a,M,E]),_=useCallback(()=>N(false),[]);useEffect(()=>{if(y)return window.addEventListener("pointermove",O),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_);}},[y,O,_]);let D=useCallback(Z=>{if(a)return;let Ee=g;if(Z.key==="ArrowRight"||Z.key==="ArrowUp")Ee=g+s;else if(Z.key==="ArrowLeft"||Z.key==="ArrowDown")Ee=g-s;else if(Z.key==="Home")Ee=o;else if(Z.key==="End")Ee=r;else return;Z.preventDefault(),M(I(Ee));},[a,g,s,o,r,M,I]),V=y||x||P,J=(x||y)&&!a,ae=`color-mix(in srgb, ${b} 25%, transparent)`,q=css({display:"flex",flexDirection:d?"row":"column",alignItems:"center",padding:d?"1rem":"1rem 0",width:d?"fit-content":p?"100%":350,height:d?250:"auto",boxSizing:"border-box"}),X=css({marginBottom:d?0:4,marginRight:d?8:0,color:h.text.primary,userSelect:"none"}),le=css({position:"relative",width:d?Pr:"100%",height:d?"100%":Pr,backgroundColor:h.neutral[200],borderRadius:h.radius.xs,cursor:a?"not-allowed":"pointer",touchAction:"none",outline:"none",overflow:"visible"}),ie=css({position:"absolute",left:d?"50%":0,top:d?2:"50%",transform:d?"translateX(-50%)":"translateY(-50%)",width:d?Pr:`calc(100% - ${Xn*.5}px)`,height:d?`calc(100% - ${Xn*.5}px)`:Pr,display:"flex",flexDirection:d?"column":"row",justifyContent:"space-between",alignItems:"center",pointerEvents:"none",zIndex:0,padding:0}),be=css({width:Xn,height:Xn,borderRadius:"50%",backgroundColor:h.text.primary,opacity:.15,flex:"0 0 auto"}),Pe=css({position:"absolute",left:0,top:d?`calc(${100-B}% )`:0,bottom:0,width:d?"100%":`${B}%`,height:d?`${B}%`:"100%",backgroundColor:a?H:b,borderRadius:h.radius.sm,zIndex:1,transition:"none",pointerEvents:"none"}),Re=css({position:"absolute",appearance:"none",WebkitAppearance:"none",background:A,width:Qs,height:Qs,left:d?"50%":`calc(${B}% - ${Qs/2}px)`,bottom:d?`${B}%`:"auto",top:d?"auto":"50%",transform:d?"translate(-50%, 50%)":"translateY(-50%)",borderRadius:u?h.radius.full:`calc(${h.radius.md} * 0.75)`,border:`2px solid ${a?H:b}`,cursor:a?"not-allowed":"grab",zIndex:5,padding:0,lineHeight:0,transition:"box-shadow .16s ease",boxShadow:J?`0 0 0 ${y?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:d?-7.5:-28,left:d?9:-7.5,pointerEvents:"none"}),Ie=css({position:"absolute",top:d?`calc(50% - ${Xn*2.5}px)`:0,left:d?"auto":`calc(50% - ${Xn*3}px)`,transform:d?"translateY(-50%)":"translateX(-50%)",backgroundColor:h.neutral[800],color:h.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:h.neutral[800],borderRadius:2,bottom:d?"50%":-2,left:d?-2.5:"50%",transform:d?"translateY(50%) rotate(45deg)":"translateX(-50%) rotate(45deg)"}}),Te=R,we=f,he=v,je=Math.floor((r-o)/s)+1;return jsxs("div",{...T,role:"group","aria-label":c,className:["plainframe-ui-slider",C||""].join(" ").trim(),css:[q,Te],"data-orientation":d?"vertical":"horizontal",children:[c&&!d&&jsx("div",{className:"plainframe-ui-slider-label",css:X,children:c}),jsxs("div",{ref:m,className:"plainframe-ui-slider-track",css:[le,we],onPointerDown:L,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":g,"aria-disabled":a||void 0,tabIndex:a?-1:0,onKeyDown:D,onPointerDown:z,onPointerUp:_,onPointerCancel:_,onMouseEnter:()=>w(true),onMouseLeave:()=>w(false),className:"plainframe-ui-slider-thumb",css:[Re,he],children:[jsx(AnimatePresence,{children:V&&jsx(motion.div,{className:"plainframe-ui-slider-tooltip-anchor",css:Ce,initial:{opacity:0,scale:.9,y:d?0:4,x:d?4:0},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.9,y:d?0:4,x:d?4:0},transition:{duration:.16,ease:"easeOut"},children:jsx(motion.div,{className:"plainframe-ui-slider-tooltip",css:Ie,initial:{opacity:0,y:d?0:4,x:d?-4:0},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:d?0:4,x:d?-4:0},transition:{duration:.16,ease:"easeOut"},onMouseEnter:()=>$(true),onMouseLeave:()=>$(false),children:g})})}),null]})]}),c&&d&&jsx("div",{className:"plainframe-ui-slider-label",css:[X,{marginLeft:8}],children:c})]})};_l.displayName="Slider";var Af=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%"}),Pf=css({display:"flex",alignItems:"center",width:"100%",gap:12}),Nf=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"}),Df=e=>css({position:"relative",flex:"1 1 24px",minWidth:6,height:2,borderRadius:1,background:e,overflow:"hidden"}),Hf=(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"}),Lf=css({flex:"1 1 24px",minWidth:2,display:"flex",alignItems:"center",justifyContent:"center"}),Bf=(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"}),zf=(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}),Of=me.memo(function({i:t,item:n,size:o,tokens:r,variant:s,titlePosition:a,isActive:u,completed:i,disabled:l,connectorColor:c,showConnector:p,animate:R,separator:f,canGoToIndex:v,setSelected:k}){let C=U(),T=xe(),{MAIN:h,ACTIVE_TEXT:d,ACTIVE_TEXT_OUTLINED:m,COMPLETE_BG:y,COMPLETE_FG:N,UPCOMING_BG_FILLED:x,UPCOMING_OUTLINE:w,UPCOMING_FG:P}=r,$="transparent",W=P,K=w;s==="subtle"?i?($=y,W=N,K=y):u?($=h,W=d,K=h):($=x,W=P,K=x):i?($=y,W=N,K=y):u?($="transparent",W=m,K=h):($="transparent",W=P,K=w);let I=n.label,F=n.icon??jsx("span",{css:$f,children:typeof I=="number"?I:t+1}),S=n.completedIcon??jsx(Check,{strokeWidth:3.25,size:16});return jsxs(Fragment,{children:[jsxs("div",{className:"plainframe-ui-step",css:Nf(a),children:[jsxs("button",{className:"plainframe-ui-step-node",css:[Bf(o,$,W,K,String(C.radius.full)),!l&&T({color:u?"primary":"neutral"})],onClick:()=>{!l&&v(t)&&k(n.value);},tabIndex:l?-1:0,"aria-current":u?"step":void 0,"aria-disabled":l||void 0,disabled:l,"aria-label":typeof I=="string"?I:`Step ${t+1}`,children:[jsx("span",{className:"plainframe-ui-step-content",css:jl(!i),children:F}),jsx("span",{className:"plainframe-ui-step-check",css:jl(!!i),children:S})]}),I&&jsx("span",{className:"plainframe-ui-step-label",css:zf(i||u,C.text.primary,C.text.secondary,String(C.radius.xs),Number(C.spacing.xs)),children:I})]}),p&&(f?jsx("div",{className:"plainframe-ui-stepper-separator",css:Lf,children:f}):jsx("div",{className:"plainframe-ui-step-connector",css:Df(C.neutral[300]),children:jsx("div",{className:"plainframe-ui-step-connector-fill",css:Hf(i?1:0,c,R),"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 Wf=({variant:e="subtle",value:t,defaultValue:n,onChange:o,disabled:r=false,allowForward:s=true,allComplete:a=false,color:u,activeBgColor:i,activeColor:l,completeBgColor:c,completeColor:p,separator:R,titlePosition:f="right",width:v,css:k,className:C,children:T,...h})=>{let d=U(),m=e==="outlined"?"outlined":"subtle",y=me.useMemo(()=>{let E=me.Children.toArray(T).filter(L=>me.isValidElement(L)&&L.type===na);return E.length?E.map((L,z)=>({index:z,...L.props})):[{value:1},{value:2},{value:3}]},[T]),N=me.useCallback((E,L)=>E?d.palette?.[E]??E:L,[d.palette]),x=me.useMemo(()=>({MAIN:String(N(i,typeof d.palette.primary[600]=="string"?d.palette.primary[600]:"")),ACTIVE_TEXT:String(N(l,typeof d.text.onColors?.primary=="string"?d.text.onColors?.primary:"")),ACTIVE_TEXT_OUTLINED:String(N(l,typeof d.text.primary=="string"?d.text.primary:"")),COMPLETE_BG:String(N(c,typeof d.palette.primary[600]=="string"?d.palette.primary[600]:"")),COMPLETE_FG:String(N(p,typeof d.text.onColors?.primary=="string"?d.text.onColors?.primary:"")),UPCOMING_BG_FILLED:String(typeof d.neutral[100]=="string"?d.neutral[100]:""),UPCOMING_OUTLINE:String(typeof d.neutral[300]=="string"?d.neutral[300]:""),UPCOMING_FG:String(typeof d.text.secondary=="string"?d.text.secondary:"")}),[N,i,l,c,p,d.palette.primary,d.neutral,d.text]),w=me.useMemo(()=>{let E=N(u,d.palette.primary[600]);return typeof E=="string"?E:String(E)},[N,u,d.palette.primary]),[P,$]=me.useState(()=>y.some(L=>L?.value===n)?n:y[0]?.value),W=t!==void 0,K=W?t:P,{activeIndex:I,afterLast:F}=me.useMemo(()=>{let E=y.findIndex(L=>L.value===K);if(E!==-1)return {activeIndex:E,afterLast:false};if(typeof K=="number"){let L=Math.floor(K)-1;if(L>=y.length)return {activeIndex:y.length-1,afterLast:true};if(L>=0)return {activeIndex:L,afterLast:false}}return {activeIndex:0,afterLast:false}},[y,K]),S=me.useCallback(E=>{r||(W||$(E),o?.(E));},[r,W,o]),g=me.useCallback(E=>a||!!y[E]?.complete||(F?true:E<I),[a,y,F,I]),b=me.useCallback(E=>{if(r)return false;let L=y[E];if(!L||L.disabled)return false;if(typeof s=="boolean"){if(s===false&&E>I)return false}else if(typeof s=="function"&&!s(I,E))return false;return true},[r,y,s,I]),[A,H]=me.useState(false);me.useEffect(()=>{let E=requestAnimationFrame(()=>H(true));return ()=>cancelAnimationFrame(E)},[]);let B=me.useCallback(E=>{if(!y.length||r)return;let L=I;if(E.key==="ArrowRight")L=Math.min(y.length-1,I+1);else if(E.key==="ArrowLeft")L=Math.max(0,I-1);else if(E.key==="Home")L=0;else if(E.key==="End")L=y.length-1;else return;E.preventDefault(),b(L)&&S(y[L].value);},[y,r,I,b,S]),M=34;return jsx("div",{tabIndex:-1,className:["plainframe-ui-stepper",C||""].join(" ").trim(),css:[Af(v),k],...h,children:jsx("div",{tabIndex:-1,className:"plainframe-ui-stepper-track",role:"list",onKeyDown:B,css:Pf,children:y.map((E,L)=>jsx(me.Fragment,{children:jsx(Of,{i:L,item:E,size:M,tokens:x,variant:m,titlePosition:f,isActive:!F&&L===I,completed:g(L),disabled:r||!!E.disabled,connectorColor:w,showConnector:L<y.length-1,animate:A,separator:R,canGoToIndex:b,setSelected:S})},String(E.value??L)))})})};var Nr=()=>null;Nr.displayName="PF.Tab";var Dr=({children:e})=>jsx(Fragment,{children:e});Dr.displayName="PF.TabContent";function _f(e){let t=e.props;return {type:t?.__EMOTION_TYPE_PLEASE_DO_NOT_USE__??e.type,props:t}}var jf=({children:e,defaultValue:t,value:n,onChange:o,variant:r="subtle",direction:s="horizontal",className:a,shadow:u=false,width:i,fullWidth:l=false,rounded:c=false,titlePosition:p="right",align:R,css:f,trackCss:v,thumbCss:k,activeTabCss:C,activeIndicatorCss:T})=>{let h=U(),d=xe(),m=s==="vertical",y=l||i!=null,N=R??(m?"left":"center"),x={left:"flex-start",center:"center",right:"flex-end"},{tabs:w,contents:P}=me.useMemo(()=>{let Q=[],ee=[];return me.Children.forEach(e,se=>{if(!me.isValidElement(se))return;let{type:pe,props:Se}=_f(se),Ne=pe===Nr||pe?.displayName===Nr.displayName,Y=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(Y){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]),$=me.useMemo(()=>w.find(Q=>!Q.disabled)?.value,[w]),[W,K]=me.useState(()=>t!==void 0&&w.some(ee=>ee.value===t&&!ee.disabled)?t:$),I=n!==void 0,F=I?n:W,S=me.useRef(null),g=me.useRef([]),b=Math.max(0,w.findIndex(Q=>Q.value===F)),[A,H]=me.useState({left:0,top:0,width:0,height:0}),[B,M]=me.useState(false),[E,L]=me.useState(false),z=me.useCallback(()=>{let Q=S.current,ee=g.current[b];if(!Q||!ee)return;let se=Q.getBoundingClientRect(),pe=ee.getBoundingClientRect();H({left:pe.left-se.left,top:pe.top-se.top,width:pe.width,height:pe.height});},[b]);me.useLayoutEffect(()=>{z(),B||(M(true),requestAnimationFrame(()=>L(true)));},[z,B]),me.useEffect(()=>{let Q=new ResizeObserver(()=>z());S.current&&Q.observe(S.current);let ee=g.current[b];ee&&Q.observe(ee);let se=()=>z();return window.addEventListener("resize",se),()=>{Q.disconnect(),window.removeEventListener("resize",se);}},[z,b]);let O=(Q,ee)=>{if(!w.length)return Q;let se=Q;for(let pe=0;pe<w.length;pe++)if(se=(se+ee+w.length)%w.length,!w[se].disabled)return se;return Q},_=Q=>{I||K(Q),o?.(Q);},D=Q=>{if(!w.length)return;let ee=b;if(Q.key===(m?"ArrowDown":"ArrowRight"))ee=O(b,1);else if(Q.key===(m?"ArrowUp":"ArrowLeft"))ee=O(b,-1);else if(Q.key==="Home")ee=w.findIndex(pe=>!pe.disabled);else if(Q.key==="End"){let pe=[...w].reverse().findIndex(Se=>!Se.disabled);ee=pe===-1?b:w.length-1-pe;}else return;Q.preventDefault();let se=w[ee]?.value;se!==void 0&&_(se),requestAnimationFrame(()=>g.current[ee]?.focus());},V=h.text.primary,J=h.text.secondary,ae=h.neutral[500],q=r==="subtle"?h.surface.subtleBg:"transparent",X=r==="subtle"?h.surface.panelBg??h.surface.panelBg:r==="ghost"?h.surface.subtleBg:"transparent",le=h.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:y?"flex":"inline-flex",width:y?"100%":"auto",flexDirection:m?"column":"row",alignItems:m?"stretch":"center",flexWrap:"nowrap",gap:h.spacing.xs,padding:Pe?h.spacing.xs:0,background:q,borderRadius:r==="subtle"?c?m?h.radius.lg:h.radius.full:h.radius.lg:"none"}),Ce=css({position:"absolute",zIndex:0,pointerEvents:"none",opacity:B?1:0,visibility:B?"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"?c?h.radius.full:h.radius.md:0,background:r==="underlined"?"transparent":X,...m?{top:`${A.top}px`,height:`${A.height}px`,left:h.spacing.xs,right:h.spacing.xs}:{left:`${A.left}px`,width:`${A.width}px`,top:h.spacing.xs,bottom:h.spacing.xs},boxShadow:u&&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"?`${h.spacing.md}`:r==="ghost"&&s!=="vertical"?`${h.spacing.md}`:`${h.spacing.xs} ${h.spacing.md}`,borderRadius:(r==="subtle"||r==="ghost")&&c?h.radius.full:h.radius.md,minHeight:h.componentHeights.sm,outline:"none",transition:"color .16s ease !important",display:"flex",alignItems:"center",justifyContent:"center",...m?{width:y?"100%":"auto",flex:"0 0 auto",textAlign:N}:y?{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:h.typography.sizes.sm,fontWeight:600,color:J,"&[aria-selected='true']":{color:V},"&:hover":{color:V},"&[aria-disabled='true'], &:disabled":{opacity:.55,cursor:"not-allowed",color:ae}}),we=css({display:"inline-flex",alignItems:"center",justifyContent:m?x[N]:"center",gap:6,width:"100%",flexDirection:p==="top"?"column-reverse":p==="bottom"?"column":p==="left"?"row-reverse":"row"}),he=css({marginTop:h.spacing.sm,width:"100%"}),je=me.useId(),Z=new Map;P.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:S,role:"tablist","aria-orientation":m?"vertical":"horizontal",onKeyDown:D,css:[Re,v],children:[ie&&jsx("div",{className:"plainframe-ui-tabs-thumb",css:[Ce,Ie,k,T]}),w.map((Q,ee)=>{let se=F===Q.value;return jsx("button",{ref:pe=>{g.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===b?0:-1,className:["plainframe-ui-tab",Q.className||""].join(" ").trim(),onClick:()=>{Q.disabled||_(Q.value);},css:[Te,!Q.disabled&&d(),Q.css,se?Q.activeCss??C:void 0],children:jsx("span",{className:"plainframe-ui-tab-content",css:we,children:Q.node})},String(Q.value??ee))})]}),P.map((Q,ee)=>{let se=Q.value===F,pe=w.findIndex(Ne=>Ne.value===Q.value),Se=pe>=0?Ee(pe):void 0;return jsx("div",{role:"tabpanel",id:Z.get(Q.value),"aria-labelledby":Se,hidden:!se,className:["plainframe-ui-tab-panel",Q.className||""].join(" ").trim(),css:[he,Q.css],children:se?Q.node:null},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)),Jf=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,error:s,helperText:a,disabled:u=false,fullWidth:i=false,width:l=235,size:c="md",variant:p="subtle",rounded:R=false,rows:f=3,maxRows:v,maxLength:k,showCharCount:C,focusRingMode:T="always",resizable:h=false,className:d,wrapperCss:m,inputCss:y,labelCss:N,helperRowCss:x,helperTextCss:w,charCountCss:P,css:$,onBlur:W,onFocus:K,onKeyDown:I,autoFocus:F,name:S,id:g,tabIndex:b,autoComplete:A,readOnly:H,required:B})=>{let M=U(),E=Yo(),L=useId(),z=useMemo(()=>({sm:{fontSize:M.typography.sizes.sm,minHeight:M.componentHeights.sm,labelFont:M.typography.sizes.xs,helperFont:M.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:M.spacing.md},md:{fontSize:M.typography.sizes.sm,minHeight:M.componentHeights.md,labelFont:M.typography.sizes.sm,helperFont:M.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:M.spacing.md},lg:{fontSize:M.typography.sizes.sm,minHeight:M.componentHeights.lg,labelFont:M.typography.sizes.md,helperFont:M.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:M.spacing.md}}),[M]),O=["sm","md","lg"].includes(c)?c:"md",_=z[O],D=M.neutral,V=M.text,J=t!==void 0,[ae,q]=useState(n),X=J?t:ae,le=useCallback(se=>{J||q(se),o?.(se);},[J,o]),ie=useMemo(()=>u?D[200]:s&&p==="outlined"?M.palette.danger?.[50]??M.surface.panelBg:s&&p==="subtle"?M.palette.danger?.[50]??M.surface.subtleBg:p==="outlined"?M.surface.panelBg:p==="subtle"?M.surface.subtleBg:"transparent",[u,s,p,D,M.surface,M.palette.danger]),be=M.componentHeights.border,Pe=useMemo(()=>p==="outlined"?`${be} solid ${s?M.palette.danger?.[300]??M.surface.border:M.surface.border}`:"none",[p,be,s,M.palette.danger,M.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?M.palette.danger?.[700]??V.primary:u?D[500]:V.primary,marginBottom:4,display:"inline-block"},...kn(N)),[_.labelFont,s,u,D,V,M.palette.danger,N]),Ie=useMemo(()=>[{display:"flex",alignItems:"stretch",gap:M.spacing.sm,padding:`${Po(_.paddingY)} 0 ${Po(_.paddingY)} ${Po(_.paddingX)}`,background:ie,border:Pe,borderRadius:R?M.radius.full:M.radius.md,minHeight:_.minHeight,width:"100%",cursor:u?"not-allowed":"text",opacity:u?.65:1,transition:"box-shadow .18s, border-color .16s"},...kn(m),...kn($)],[M,_,ie,Pe,be,R,u,m,$]),Te=typeof _.minHeight=="number"?`${_.minHeight}px`:_.minHeight,we=useMemo(()=>No({width:"100%",minWidth:0,flex:1,resize:h?"vertical":"none",font:"inherit",fontWeight:500,fontSize:_.fontSize,lineHeight:1.5,color:u?D[500]:s?M.palette.danger?.[800]??V.primary:V.primary,background:"transparent",border:"none",outline:"none",padding:0,paddingRight:Po(_.paddingX),overflowY:"auto",minHeight:Te,"&::placeholder":{color:s?M.palette.danger?.[700]??V.secondary:V.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${s?M.palette.danger?.[800]??V.primary:V.primary} !important`,boxShadow:`0 0 0 1000px ${ie} inset !important`,transition:"opacity 99999s ease-out",caretColor:s?M.palette.danger?.[800]??V.primary:V.primary},":focus-within":{outline:"none",boxShadow:"none"},...f===1?{paddingBlock:`calc((${Te} - 1.5em) / 2)`}:{paddingBlock:"clamp(4px, 0.5em, 12px)"}},...kn(y)),[h,_,u,s,D,V,M.palette.danger,Te,ie,f,y]),he=useMemo(()=>No({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,paddingTop:3},...kn(x)),[x]),je=useMemo(()=>No({fontSize:_.helperFont,color:s?M.palette.danger?.[700]??V.secondary:V.secondary,flex:1,minWidth:0},...kn(w)),[_.helperFont,s,M.palette.danger,V,w]),Z=useMemo(()=>No({fontSize:_.helperFont,color:k&&X.length>k?M.palette.danger?.[700]??V.secondary:V.secondary,flexShrink:0},...kn(P)),[_.helperFont,k,X.length,M.palette.danger,V,P]),Ee=useRef(null);useLayoutEffect(()=>{if(typeof window>"u")return;let se=Ee.current;if(!se)return;if(h){let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),Y=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),Y);se.style.setProperty("--pf-minh",`${oe}px`);return}(()=>{let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),Y=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),Y);se.style.setProperty("--pf-minh",`${oe}px`);let re=v?Ne*v:1/0;se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,re)}px`;})();},[X,f,v,_.minHeight,h]);let Q=a!=null||C?`${g??L}-help`:void 0,ee=g??L;return jsxs("div",{className:["plainframe-ui-textarea",d||""].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:T!=="none",disabled:u,color:s?"danger":void 0}),Ie],"aria-invalid":!!s||void 0,"aria-disabled":u||void 0,onClick:()=>!u&&Ee.current?.focus(),children:jsx("textarea",{ref:Ee,id:ee,className:"plainframe-ui-textarea-input",css:we,rows:f,value:X,onChange:se=>{let pe=se.target.value;k&&pe.length>k||le(pe);},placeholder:r||"",disabled:u,onBlur:W,onFocus:K,onKeyDown:I,autoFocus:F,name:S,tabIndex:b,autoComplete:A,readOnly:H,required:B,"aria-invalid":!!s||void 0,"aria-describedby":Q})}),(a!=null||C&&k!=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}),C&&k!=null&&jsxs("span",{className:"plainframe-ui-textarea-char-count",css:Z,children:[X.length,"/",k]})]})]})};var sg=Vo,ag={type:"spring",stiffness:920,damping:100},ql="__toast_root__",ig=(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=ig(e,n);if(o!=null&&o!=="")return o}},ra=(e,t)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:String(e);function lg(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 cg=lg(sg),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 Yl(){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[ql]??null,Yn||(Yn=createRoot(Wt),Wt[ql]=Yn,Yn.render(jsx(Na,{children:jsx(vg,{})})))));}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();},ug=()=>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 dg(){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 pg(){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 mg=e=>e==="danger"?"error":["default","success","error","warning","info"].includes(e)?e:"default";function fg(e,t){let n=mg(t),o=e,r=o.surface,s=o.text,a=r?.panelBg??"#fff",u=s?.primary??"#111",i=r?.border;if(n==="default"||n==="info")return {bg:a,fg:u,border:i};let l=s?.onColors??{},c=(p,R,f)=>{let v=o.colors,k=o.palette;return {bg:v?.[p]??k?.[p]?.[700]??R,fg:l?.[p]??f,border:"transparent"}};return n==="success"?c("success","#22C55E","#fff"):n==="warning"?c("warning","#F59E0B","#fff"):n==="error"?c("error","#EF4444","#fff"):{bg:a,fg:u,border:i}}var Be=Object.assign((e,t)=>{Yl();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??ug(),a=i=>{let l=i.findIndex(R=>R.id===s);if(l===-1)return false;let c=i[l],p={...c,status:r.status??c.status,content:r.content??c.content,title:r.title??c.title,description:r.description??c.description,startIcon:r.startIcon??c.startIcon,endIcon:r.endIcon??c.endIcon,action:r.action??c.action,onClose:r.onClose??c.onClose,duration:r.duration===void 0?c.duration:r.duration,pauseOnHover:r.pauseOnHover??c.pauseOnHover,showDismiss:r.showDismiss??c.showDismiss,render:r.render??c.render,bare:r.bare??c.bare,onClick:r.onClick??c.onClick,width:r.width??c.width};return i[l]=p,$r(s),te.remaining.delete(s),te.paused.has(s)||Br(p),In(),true};if(a(te.displayed)||a(te.queue))return s;let u={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&&pg(),te.displayed=[...te.displayed,u],te.enterFrom[u.id]="tail",te.entering[u.id]=true,requestAnimationFrame(()=>{delete te.entering[u.id],In();}),In(),Br(u),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),dg();},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 gg(e){return typeof e=="string"?e:e===true?"always":e===false?"never":ye.showDismiss}function bg(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 hg=css({display:"flex",alignItems:"flex-start",gap:10}),Gl=css({flex:"0 0 auto",paddingTop:1,lineHeight:0,marginLeft:-3,"& svg, & img, & canvas, & video":{display:"block"}}),yg=css({fontSize:14,lineHeight:1.4,fontWeight:500,flex:1,minWidth:0}),xg=css({display:"flex",alignItems:"center",gap:6,marginRight:-2}),vg=me.memo(function(){let t=useSyncExternalStore(te.subscribe.bind(te),()=>te.snapshot,()=>te.snapshot),n=U(),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",...bg(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,u)=>{let i=t.enterFrom[a.id]||"tail",l=o?i==="head"?-16:16:i==="head"?16:-16,c=u>0?ye.gutter:0,p={toast:a,close:Be.dismiss,pause:Be.pause,resume:Be.resume},{bg:R,fg:f,border:v}=fg(n,a.status),k={position:"relative",overflow:"hidden",borderRadius:n.radius.md,boxShadow:cg.shadow,padding:`${n.spacing.md} calc(${n.spacing.lg} + 30px) ${n.spacing.md} ${n.spacing.lg}`,display:"grid",gridTemplateColumns:"1fr auto",gap:10,background:R,color:f,cursor:a.onClick?"pointer":"default",border:v?`1px solid ${v}`:"1px solid transparent"},C=typeof ye.styles.surface=="function"?ye.styles.surface(a):ye.styles.surface??{},T=gg(a.showDismiss),h={},d="& .plainframe-ui-toast-close",m="&:hover .plainframe-ui-toast-close";T==="hover"?(h[d]={opacity:0,pointerEvents:"none"},h[m]={opacity:1,pointerEvents:"auto"}):T==="always"?h[d]={opacity:1,pointerEvents:"auto"}:T==="never"&&(h[d]={display:"none"});let y=css({...k,...C,...h}),N=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??{}}),x;if(a.bare&&a.render){let w=typeof a.render=="function"?a.render(p):a.render;x=jsx("div",{style:{pointerEvents:"auto"},onClick:P=>a.onClick?.(a.id,P),children:w});}else if(ye.bareRenderer&&ye.renderer){let w=typeof ye.renderer=="function"?ye.renderer(p):ye.renderer;x=jsx("div",{style:{pointerEvents:"auto"},onClick:P=>a.onClick?.(a.id,P),children:w});}else {let w;ye.renderer?w=typeof ye.renderer=="function"?ye.renderer(p):ye.renderer:a.render&&!a.bare?w=typeof a.render=="function"?a.render(p):a.render:w=jsxs(Fragment,{children:[jsxs("div",{css:hg,children:[a.startIcon&&jsx("div",{css:Gl,children:a.startIcon}),jsx("div",{css:yg,children:a.content}),a.endIcon&&jsx("div",{css:Gl,children:a.endIcon})]}),a.action&&jsx("div",{css:xg,children:a.action})]}),x=jsxs("div",{css:y,onClick:P=>a.onClick?.(a.id,P),children:[w,jsx("button",{className:"plainframe-ui-toast-close","aria-label":"Close",css:N,onClick:P=>{P.stopPropagation(),Be.dismiss(a.id);},children:jsx(X,{strokeWidth:2.5,size:14})})]});}return jsx(Cg,{id:a.id,isBottom:o,mt:c,enterY:l,width:a.width,pauseOnHover:a.pauseOnHover!==false,children:x},a.id)})})})}),Cg=me.memo(function(t){let{id:n,isBottom:o,mt:r,enterY:s,width:a,pauseOnHover:u,children:i}=t,l=useAnimationControls();useEffect(()=>{l.start({opacity:1,y:0,height:"auto",x:0,transition:ag});},[l]);let c={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(c),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:(p,R)=>{let f=Math.abs(R.offset.x),v=Math.abs(R.velocity.x);if(!(f>60||v>600)){l.start({x:0,opacity:1,transition:{type:"spring",stiffness:700,damping:40}});return}let T=(R.offset.x!==0?Math.sign(R.offset.x):Math.sign(R.velocity.x||1))*(window.innerWidth+160),h=typeof R.velocity.x=="number"?R.velocity.x/10:0;l.start({x:T,opacity:.9,transition:{type:"spring",stiffness:280,damping:24,velocity:h}}).then(()=>Be.dismiss(n));},onMouseEnter:u?()=>Be.pause(n):void 0,onMouseLeave:u?()=>Be.resume(n):void 0,children:i})}),Xl=false;(function(){Xl||(Xl=true,Yl());})();var jg=(...e)=>t=>{for(let n of e)if(n)if(typeof n=="function")n(t);else try{n.current=t;}catch{}},Ql=createContext(null),ec=()=>{let e=useContext(Ql);if(!e)throw new Error("TooltipTrigger/TooltipContent must be inside <Tooltip>.");return e},Vg=({children:e,placement:t="top",open:n,defaultOpen:o=false,onOpenChange:r,delay:s=80,arrow:a=true,autoWidth:u=false,disableHoverListener:i=false})=>{let[l,c]=useState(!!o),p=n??l,R=x=>{n===void 0&&c(x),r?.(x);},f=useRef(null),v=useFloating({placement:t,open:p,onOpenChange:R,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)}),k=useHover(v.context,{enabled:!i,delay:{open:s,close:60},handleClose:safePolygon(),restMs:20}),C=useFocus(v.context),T=useDismiss(v.context,{escapeKey:true,outsidePress:true}),h=useRole(v.context,{role:"tooltip"}),{getReferenceProps:d,getFloatingProps:m}=useInteractions([k,C,T,h]),y=useId(),N=useMemo(()=>({open:p,setOpen:R,id:y,placement:v.placement,autoWidth:u,allowArrow:!!a,refs:v.refs,floatingStyles:v.floatingStyles,middlewareData:v.middlewareData,getReferenceProps:d,getFloatingProps:m,arrowRef:f}),[p,u,a,v.placement,v.refs,v.floatingStyles,v.middlewareData,d,m]);return jsx(Ql.Provider,{value:N,children:e})},Ug=({asChild:e=true,children:t,className:n,css:o})=>{let{refs:r,getReferenceProps:s,id:a}=ec(),u=me.isValidElement(t),i=u&&typeof t.type=="string";if(e&&u&&i){let l=t,c="ref"in l?l.ref:void 0,p=s({...l.props,"aria-describedby":a,ref:jg(c,r.setReference),className:[l.props?.className||"",n||""].join(" ").trim()||void 0}),R=[l.props?.css||void 0,o].filter(Boolean);return me.cloneElement(l,{...p,css:R})}return jsx("span",{ref:r.setReference,className:n,css:o,style:{display:"inline-flex"},...s({"aria-describedby":a}),children:t})},qg=({children:e,className:t,css:n,arrowCss:o})=>{let {open:r,refs:s,floatingStyles:a,middlewareData:u,getFloatingProps:i,placement:l,id:c,autoWidth:p,allowArrow:R,arrowRef:f}=ec(),v=U(),k=l.split("-")[0]||"top",T=k==="bottom"?{opacity:0,y:-8,scale:.98}:k==="top"?{opacity:0,y:8,scale:.98}:k==="left"?{opacity:0,x:8,scale:.98}:{opacity:0,x:-8,scale:.98},h=T,d=k==="bottom"?"center top":k==="top"?"center bottom":k==="left"?"right center":"left center",m=css({zIndex:1300,backgroundColor:v.neutral[900],color:v.neutral[0],borderRadius:8,padding:"6px 9px",fontSize:12,fontWeight:500,lineHeight:1.25,maxWidth:260,whiteSpace:p?"nowrap":"normal",boxShadow:"0 10px 30px rgba(0,0,0,.18)",pointerEvents:"auto",transformOrigin:d}),y=css({position:"absolute",width:10,height:10,borderRadius:2,backgroundColor:v.neutral[900],transform:"rotate(45deg)",pointerEvents:"none"}),N=u.arrow,x={top:"bottom",bottom:"top",left:"right",right:"left"}[k];return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:r&&jsxs(motion.div,{id:c,ref:s.setFloating,role:"tooltip","data-state":"open",className:["plainframe-ui-tooltip",t||""].join(" ").trim(),css:[m,n],style:a,initial:T,animate:{opacity:1,x:0,y:0,scale:1},exit:h,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,R&&jsx("div",{ref:f,className:"plainframe-ui-tooltip-arrow",css:[y,o],style:{left:N?.x!=null?`${N.x}px`:void 0,top:N?.y!=null?`${N.y}px`:void 0,[x]:"-3px"}})]})})})};function Jg(){let e=U();return jsx(Global,{styles:css`
|
|
20
|
+
`,Ef=me.memo(({isLoading:e=true,radius:t,animation:n="wave",children:o,width:r,height:s,style:i,className:u,css:a})=>{let l=U(),c=l.surface.subtleBg,p=l.neutral[200],R=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))}),v=css({position:"absolute",inset:0,borderRadius:R,pointerEvents:"none",background:c,willChange:"background-position, opacity"}),k=n==="wave"?css({backgroundImage:`linear-gradient(90deg, ${c} 25%, ${p} 50%, ${c} 75%)`,backgroundSize:"200% 100%",animation:`${Tf} 1.4s ease-in-out infinite`}):n==="pulse"?css({animation:`${wf} 1.2s ease-in-out infinite`}):css({}),C=css({visibility:e?"hidden":"visible",display:"inline-block",borderRadius:R});return jsxs("span",{className:["plainframe-ui-skeleton",u||""].join(" ").trim(),css:[f,a],style:i,"aria-busy":e||void 0,children:[e&&jsx("span",{"aria-hidden":true,css:[v,k]}),jsx("span",{className:"plainframe-ui-skeleton-content",css:C,children:o})]})});var Pr=8,Qs=20,Xn=4,_l=({value:e,defaultValue:t,onChange:n,min:o=0,max:r=100,step:s=1,disabled:i=false,rounded:u=false,showValue:a=false,showStepper:l=false,label:c,fullWidth:p=false,css:R,trackCss:f,thumbCss:v,direction:k="horizontal",className:C,...T})=>{let h=U(),d=k==="vertical",m=useRef(null),[y,N]=useState(false),[x,w]=useState(false),[P,$]=useState(false),W=e!==void 0,K=useCallback(Z=>Math.min(r,Math.max(o,Z)),[o,r]),I=useCallback(Z=>K(Math.round((Z-o)/s)*s+o),[o,s,K]),[F,S]=useState(()=>I(t??o)),g=W?I(e):F;useEffect(()=>{W||S(Z=>I(Z));},[o,r,s,W,I]);let b=h.palette.primary[600],A=h.surface.panelBg,H=h.neutral[500],B=useMemo(()=>{let Z=r-o||1;return (g-o)/Z*100},[g,o,r]),M=useCallback(Z=>{W||S(Z),n?.(Z);},[W,n]),E=useCallback((Z,Ee)=>{let Q=m.current;if(!Q)return g;let ee=Q.getBoundingClientRect(),se=d?(ee.bottom-Ee)/ee.height:(Z-ee.left)/ee.width;return se=Math.max(0,Math.min(1,se)),I(o+se*(r-o))},[g,d,o,r,I]),L=useCallback(Z=>{i||(Z.currentTarget.setPointerCapture?.(Z.pointerId),M(E(Z.clientX,Z.clientY)),N(true));},[i,M,E]),z=useCallback(Z=>{i||(Z.currentTarget.setPointerCapture?.(Z.pointerId),N(true));},[i]),O=useCallback(Z=>{!y||i||M(E(Z.clientX,Z.clientY));},[y,i,M,E]),_=useCallback(()=>N(false),[]);useEffect(()=>{if(y)return window.addEventListener("pointermove",O),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_);}},[y,O,_]);let D=useCallback(Z=>{if(i)return;let Ee=g;if(Z.key==="ArrowRight"||Z.key==="ArrowUp")Ee=g+s;else if(Z.key==="ArrowLeft"||Z.key==="ArrowDown")Ee=g-s;else if(Z.key==="Home")Ee=o;else if(Z.key==="End")Ee=r;else return;Z.preventDefault(),M(I(Ee));},[i,g,s,o,r,M,I]),V=y||x||P,J=(x||y)&&!i,ae=`color-mix(in srgb, ${b} 25%, transparent)`,q=css({display:"flex",flexDirection:d?"row":"column",alignItems:"center",padding:d?"1rem":"1rem 0",width:d?"fit-content":p?"100%":350,height:d?250:"auto",boxSizing:"border-box"}),X=css({marginBottom:d?0:4,marginRight:d?8:0,color:h.text.primary,userSelect:"none"}),le=css({position:"relative",width:d?Pr:"100%",height:d?"100%":Pr,backgroundColor:h.neutral[200],borderRadius:h.radius.xs,cursor:i?"not-allowed":"pointer",touchAction:"none",outline:"none",overflow:"visible"}),ie=css({position:"absolute",left:d?"50%":0,top:d?2:"50%",transform:d?"translateX(-50%)":"translateY(-50%)",width:d?Pr:`calc(100% - ${Xn*.5}px)`,height:d?`calc(100% - ${Xn*.5}px)`:Pr,display:"flex",flexDirection:d?"column":"row",justifyContent:"space-between",alignItems:"center",pointerEvents:"none",zIndex:0,padding:0}),be=css({width:Xn,height:Xn,borderRadius:"50%",backgroundColor:h.text.primary,opacity:.15,flex:"0 0 auto"}),Pe=css({position:"absolute",left:0,top:d?`calc(${100-B}% )`:0,bottom:0,width:d?"100%":`${B}%`,height:d?`${B}%`:"100%",backgroundColor:i?H:b,borderRadius:h.radius.sm,zIndex:1,transition:"none",pointerEvents:"none"}),Re=css({position:"absolute",appearance:"none",WebkitAppearance:"none",background:A,width:Qs,height:Qs,left:d?"50%":`calc(${B}% - ${Qs/2}px)`,bottom:d?`${B}%`:"auto",top:d?"auto":"50%",transform:d?"translate(-50%, 50%)":"translateY(-50%)",borderRadius:u?h.radius.full:`calc(${h.radius.md} * 0.75)`,border:`2px solid ${i?H:b}`,cursor:i?"not-allowed":"grab",zIndex:5,padding:0,lineHeight:0,transition:"box-shadow .16s ease",boxShadow:J?`0 0 0 ${y?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:d?-7.5:-28,left:d?9:-7.5,pointerEvents:"none"}),Ie=css({position:"absolute",top:d?`calc(50% - ${Xn*2.5}px)`:0,left:d?"auto":`calc(50% - ${Xn*3}px)`,transform:d?"translateY(-50%)":"translateX(-50%)",backgroundColor:h.neutral[800],color:h.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:h.neutral[800],borderRadius:2,bottom:d?"50%":-2,left:d?-2.5:"50%",transform:d?"translateY(50%) rotate(45deg)":"translateX(-50%) rotate(45deg)"}}),Te=R,we=f,he=v,je=Math.floor((r-o)/s)+1;return jsxs("div",{...T,role:"group","aria-label":c,className:["plainframe-ui-slider",C||""].join(" ").trim(),css:[q,Te],"data-orientation":d?"vertical":"horizontal",children:[c&&!d&&jsx("div",{className:"plainframe-ui-slider-label",css:X,children:c}),jsxs("div",{ref:m,className:"plainframe-ui-slider-track",css:[le,we],onPointerDown:L,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":g,"aria-disabled":i||void 0,tabIndex:i?-1:0,onKeyDown:D,onPointerDown:z,onPointerUp:_,onPointerCancel:_,onMouseEnter:()=>w(true),onMouseLeave:()=>w(false),className:"plainframe-ui-slider-thumb",css:[Re,he],children:[jsx(AnimatePresence,{children:V&&jsx(motion.div,{className:"plainframe-ui-slider-tooltip-anchor",css:Ce,initial:{opacity:0,scale:.9,y:d?0:4,x:d?4:0},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.9,y:d?0:4,x:d?4:0},transition:{duration:.16,ease:"easeOut"},children:jsx(motion.div,{className:"plainframe-ui-slider-tooltip",css:Ie,initial:{opacity:0,y:d?0:4,x:d?-4:0},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:d?0:4,x:d?-4:0},transition:{duration:.16,ease:"easeOut"},onMouseEnter:()=>$(true),onMouseLeave:()=>$(false),children:g})})}),null]})]}),c&&d&&jsx("div",{className:"plainframe-ui-slider-label",css:[X,{marginLeft:8}],children:c})]})};_l.displayName="Slider";var Af=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%"}),Pf=css({display:"flex",alignItems:"center",width:"100%",gap:12}),Nf=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"}),Df=e=>css({position:"relative",flex:"1 1 24px",minWidth:6,height:2,borderRadius:1,background:e,overflow:"hidden"}),Hf=(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"}),Lf=css({flex:"1 1 24px",minWidth:2,display:"flex",alignItems:"center",justifyContent:"center"}),Bf=(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"}),zf=(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}),Of=me.memo(function({i:t,item:n,size:o,tokens:r,variant:s,titlePosition:i,isActive:u,completed:a,disabled:l,connectorColor:c,showConnector:p,animate:R,separator:f,canGoToIndex:v,setSelected:k}){let C=U(),T=xe(),{MAIN:h,ACTIVE_TEXT:d,ACTIVE_TEXT_OUTLINED:m,COMPLETE_BG:y,COMPLETE_FG:N,UPCOMING_BG_FILLED:x,UPCOMING_OUTLINE:w,UPCOMING_FG:P}=r,$="transparent",W=P,K=w;s==="subtle"?a?($=y,W=N,K=y):u?($=h,W=d,K=h):($=x,W=P,K=x):a?($=y,W=N,K=y):u?($="transparent",W=m,K=h):($="transparent",W=P,K=w);let I=n.label,F=n.icon??jsx("span",{css:$f,children:typeof I=="number"?I:t+1}),S=n.completedIcon??jsx(Check,{strokeWidth:3.25,size:16});return jsxs(Fragment,{children:[jsxs("div",{className:"plainframe-ui-step",css:Nf(i),children:[jsxs("button",{className:"plainframe-ui-step-node",css:[Bf(o,$,W,K,String(C.radius.full)),!l&&T({color:u?"primary":"neutral"})],onClick:()=>{!l&&v(t)&&k(n.value);},tabIndex:l?-1:0,"aria-current":u?"step":void 0,"aria-disabled":l||void 0,disabled:l,"aria-label":typeof I=="string"?I:`Step ${t+1}`,children:[jsx("span",{className:"plainframe-ui-step-content",css:jl(!a),children:F}),jsx("span",{className:"plainframe-ui-step-check",css:jl(!!a),children:S})]}),I&&jsx("span",{className:"plainframe-ui-step-label",css:zf(a||u,C.text.primary,C.text.secondary,String(C.radius.xs),Number(C.spacing.xs)),children:I})]}),p&&(f?jsx("div",{className:"plainframe-ui-stepper-separator",css:Lf,children:f}):jsx("div",{className:"plainframe-ui-step-connector",css:Df(C.neutral[300]),children:jsx("div",{className:"plainframe-ui-step-connector-fill",css:Hf(a?1:0,c,R),"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 Wf=({variant:e="subtle",value:t,defaultValue:n,onChange:o,disabled:r=false,allowForward:s=true,allComplete:i=false,color:u,activeBgColor:a,activeColor:l,completeBgColor:c,completeColor:p,separator:R,titlePosition:f="right",width:v,css:k,className:C,children:T,...h})=>{let d=U(),m=e==="outlined"?"outlined":"subtle",y=me.useMemo(()=>{let E=me.Children.toArray(T).filter(L=>me.isValidElement(L)&&L.type===na);return E.length?E.map((L,z)=>({index:z,...L.props})):[{value:1},{value:2},{value:3}]},[T]),N=me.useCallback((E,L)=>E?d.palette?.[E]??E:L,[d.palette]),x=me.useMemo(()=>({MAIN:String(N(a,typeof d.palette.primary[600]=="string"?d.palette.primary[600]:"")),ACTIVE_TEXT:String(N(l,typeof d.text.onColors?.primary=="string"?d.text.onColors?.primary:"")),ACTIVE_TEXT_OUTLINED:String(N(l,typeof d.text.primary=="string"?d.text.primary:"")),COMPLETE_BG:String(N(c,typeof d.palette.primary[600]=="string"?d.palette.primary[600]:"")),COMPLETE_FG:String(N(p,typeof d.text.onColors?.primary=="string"?d.text.onColors?.primary:"")),UPCOMING_BG_FILLED:String(typeof d.neutral[100]=="string"?d.neutral[100]:""),UPCOMING_OUTLINE:String(typeof d.neutral[300]=="string"?d.neutral[300]:""),UPCOMING_FG:String(typeof d.text.secondary=="string"?d.text.secondary:"")}),[N,a,l,c,p,d.palette.primary,d.neutral,d.text]),w=me.useMemo(()=>{let E=N(u,d.palette.primary[600]);return typeof E=="string"?E:String(E)},[N,u,d.palette.primary]),[P,$]=me.useState(()=>y.some(L=>L?.value===n)?n:y[0]?.value),W=t!==void 0,K=W?t:P,{activeIndex:I,afterLast:F}=me.useMemo(()=>{let E=y.findIndex(L=>L.value===K);if(E!==-1)return {activeIndex:E,afterLast:false};if(typeof K=="number"){let L=Math.floor(K)-1;if(L>=y.length)return {activeIndex:y.length-1,afterLast:true};if(L>=0)return {activeIndex:L,afterLast:false}}return {activeIndex:0,afterLast:false}},[y,K]),S=me.useCallback(E=>{r||(W||$(E),o?.(E));},[r,W,o]),g=me.useCallback(E=>i||!!y[E]?.complete||(F?true:E<I),[i,y,F,I]),b=me.useCallback(E=>{if(r)return false;let L=y[E];if(!L||L.disabled)return false;if(typeof s=="boolean"){if(s===false&&E>I)return false}else if(typeof s=="function"&&!s(I,E))return false;return true},[r,y,s,I]),[A,H]=me.useState(false);me.useEffect(()=>{let E=requestAnimationFrame(()=>H(true));return ()=>cancelAnimationFrame(E)},[]);let B=me.useCallback(E=>{if(!y.length||r)return;let L=I;if(E.key==="ArrowRight")L=Math.min(y.length-1,I+1);else if(E.key==="ArrowLeft")L=Math.max(0,I-1);else if(E.key==="Home")L=0;else if(E.key==="End")L=y.length-1;else return;E.preventDefault(),b(L)&&S(y[L].value);},[y,r,I,b,S]),M=34;return jsx("div",{tabIndex:-1,className:["plainframe-ui-stepper",C||""].join(" ").trim(),css:[Af(v),k],...h,children:jsx("div",{tabIndex:-1,className:"plainframe-ui-stepper-track",role:"list",onKeyDown:B,css:Pf,children:y.map((E,L)=>jsx(me.Fragment,{children:jsx(Of,{i:L,item:E,size:M,tokens:x,variant:m,titlePosition:f,isActive:!F&&L===I,completed:g(L),disabled:r||!!E.disabled,connectorColor:w,showConnector:L<y.length-1,animate:A,separator:R,canGoToIndex:b,setSelected:S})},String(E.value??L)))})})};var Nr=()=>null;Nr.displayName="PF.Tab";var Dr=({children:e})=>jsx(Fragment,{children:e});Dr.displayName="PF.TabContent";function _f(e){let t=e.props;return {type:t?.__EMOTION_TYPE_PLEASE_DO_NOT_USE__??e.type,props:t}}var jf=({children:e,defaultValue:t,value:n,onChange:o,variant:r="subtle",direction:s="horizontal",className:i,shadow:u=false,width:a,fullWidth:l=false,rounded:c=false,titlePosition:p="right",align:R,css:f,trackCss:v,thumbCss:k,activeTabCss:C,activeIndicatorCss:T})=>{let h=U(),d=xe(),m=s==="vertical",y=l||a!=null,N=R??(m?"left":"center"),x={left:"flex-start",center:"center",right:"flex-end"},{tabs:w,contents:P}=me.useMemo(()=>{let Q=[],ee=[];return me.Children.forEach(e,se=>{if(!me.isValidElement(se))return;let{type:pe,props:Se}=_f(se),Ne=pe===Nr||pe?.displayName===Nr.displayName,Y=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(Y){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]),$=me.useMemo(()=>w.find(Q=>!Q.disabled)?.value,[w]),[W,K]=me.useState(()=>t!==void 0&&w.some(ee=>ee.value===t&&!ee.disabled)?t:$),I=n!==void 0,F=I?n:W,S=me.useRef(null),g=me.useRef([]),b=Math.max(0,w.findIndex(Q=>Q.value===F)),[A,H]=me.useState({left:0,top:0,width:0,height:0}),[B,M]=me.useState(false),[E,L]=me.useState(false),z=me.useCallback(()=>{let Q=S.current,ee=g.current[b];if(!Q||!ee)return;let se=Q.getBoundingClientRect(),pe=ee.getBoundingClientRect();H({left:pe.left-se.left,top:pe.top-se.top,width:pe.width,height:pe.height});},[b]);me.useLayoutEffect(()=>{z(),B||(M(true),requestAnimationFrame(()=>L(true)));},[z,B]),me.useEffect(()=>{let Q=new ResizeObserver(()=>z());S.current&&Q.observe(S.current);let ee=g.current[b];ee&&Q.observe(ee);let se=()=>z();return window.addEventListener("resize",se),()=>{Q.disconnect(),window.removeEventListener("resize",se);}},[z,b]);let O=(Q,ee)=>{if(!w.length)return Q;let se=Q;for(let pe=0;pe<w.length;pe++)if(se=(se+ee+w.length)%w.length,!w[se].disabled)return se;return Q},_=Q=>{I||K(Q),o?.(Q);},D=Q=>{if(!w.length)return;let ee=b;if(Q.key===(m?"ArrowDown":"ArrowRight"))ee=O(b,1);else if(Q.key===(m?"ArrowUp":"ArrowLeft"))ee=O(b,-1);else if(Q.key==="Home")ee=w.findIndex(pe=>!pe.disabled);else if(Q.key==="End"){let pe=[...w].reverse().findIndex(Se=>!Se.disabled);ee=pe===-1?b:w.length-1-pe;}else return;Q.preventDefault();let se=w[ee]?.value;se!==void 0&&_(se),requestAnimationFrame(()=>g.current[ee]?.focus());},V=h.text.primary,J=h.text.secondary,ae=h.neutral[500],q=r==="subtle"?h.surface.subtleBg:"transparent",X=r==="subtle"?h.surface.panelBg??h.surface.panelBg:r==="ghost"?h.surface.subtleBg:"transparent",le=h.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%":a==null?"auto":typeof a=="number"?`${a}px`:a}),Pe=r==="subtle",Re=css({position:"relative",display:y?"flex":"inline-flex",width:y?"100%":"auto",flexDirection:m?"column":"row",alignItems:m?"stretch":"center",flexWrap:"nowrap",gap:h.spacing.xs,padding:Pe?h.spacing.xs:0,background:q,borderRadius:r==="subtle"?c?m?h.radius.lg:h.radius.full:h.radius.lg:"none"}),Ce=css({position:"absolute",zIndex:0,pointerEvents:"none",opacity:B?1:0,visibility:B?"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"?c?h.radius.full:h.radius.md:0,background:r==="underlined"?"transparent":X,...m?{top:`${A.top}px`,height:`${A.height}px`,left:h.spacing.xs,right:h.spacing.xs}:{left:`${A.left}px`,width:`${A.width}px`,top:h.spacing.xs,bottom:h.spacing.xs},boxShadow:u&&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"?`${h.spacing.md}`:r==="ghost"&&s!=="vertical"?`${h.spacing.md}`:`${h.spacing.xs} ${h.spacing.md}`,borderRadius:(r==="subtle"||r==="ghost")&&c?h.radius.full:h.radius.md,minHeight:h.componentHeights.sm,outline:"none",transition:"color .16s ease !important",display:"flex",alignItems:"center",justifyContent:"center",...m?{width:y?"100%":"auto",flex:"0 0 auto",textAlign:N}:y?{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:h.typography.sizes.sm,fontWeight:600,color:J,"&[aria-selected='true']":{color:V},"&:hover":{color:V},"&[aria-disabled='true'], &:disabled":{opacity:.55,cursor:"not-allowed",color:ae}}),we=css({display:"inline-flex",alignItems:"center",justifyContent:m?x[N]:"center",gap:6,width:"100%",flexDirection:p==="top"?"column-reverse":p==="bottom"?"column":p==="left"?"row-reverse":"row"}),he=css({marginTop:h.spacing.sm,width:"100%"}),je=me.useId(),Z=new Map;P.forEach((Q,ee)=>Z.set(Q.value,`${je}-panel-${ee}`));let Ee=Q=>`${je}-tab-${Q}`;return jsxs("div",{className:["plainframe-ui-tabs",i||""].join(" ").trim(),css:[be,f],children:[jsxs("div",{className:"plainframe-ui-tabs-track",ref:S,role:"tablist","aria-orientation":m?"vertical":"horizontal",onKeyDown:D,css:[Re,v],children:[ie&&jsx("div",{className:"plainframe-ui-tabs-thumb",css:[Ce,Ie,k,T]}),w.map((Q,ee)=>{let se=F===Q.value;return jsx("button",{ref:pe=>{g.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===b?0:-1,className:["plainframe-ui-tab",Q.className||""].join(" ").trim(),onClick:()=>{Q.disabled||_(Q.value);},css:[Te,!Q.disabled&&d(),Q.css,se?Q.activeCss??C:void 0],children:jsx("span",{className:"plainframe-ui-tab-content",css:we,children:Q.node})},String(Q.value??ee))})]}),P.map((Q,ee)=>{let se=Q.value===F,pe=w.findIndex(Ne=>Ne.value===Q.value),Se=pe>=0?Ee(pe):void 0;return jsx("div",{role:"tabpanel",id:Z.get(Q.value),"aria-labelledby":Se,hidden:!se,className:["plainframe-ui-tab-panel",Q.className||""].join(" ").trim(),css:[he,Q.css],children:se?Q.node:null},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)),Jf=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,error:s,helperText:i,disabled:u=false,fullWidth:a=false,width:l=235,size:c="md",variant:p="subtle",rounded:R=false,rows:f=3,maxRows:v,maxLength:k,showCharCount:C,focusRingMode:T="always",resizable:h=false,className:d,wrapperCss:m,inputCss:y,labelCss:N,helperRowCss:x,helperTextCss:w,charCountCss:P,css:$,onBlur:W,onFocus:K,onKeyDown:I,autoFocus:F,name:S,id:g,tabIndex:b,autoComplete:A,readOnly:H,required:B})=>{let M=U(),E=Yo(),L=useId(),z=useMemo(()=>({sm:{fontSize:M.typography.sizes.sm,minHeight:M.componentHeights.sm,labelFont:M.typography.sizes.xs,helperFont:M.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:M.spacing.md},md:{fontSize:M.typography.sizes.sm,minHeight:M.componentHeights.md,labelFont:M.typography.sizes.sm,helperFont:M.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:M.spacing.md},lg:{fontSize:M.typography.sizes.sm,minHeight:M.componentHeights.lg,labelFont:M.typography.sizes.md,helperFont:M.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:M.spacing.md}}),[M]),O=["sm","md","lg"].includes(c)?c:"md",_=z[O],D=M.neutral,V=M.text,J=t!==void 0,[ae,q]=useState(n),X=J?t:ae,le=useCallback(se=>{J||q(se),o?.(se);},[J,o]),ie=useMemo(()=>u?D[200]:s&&p==="outlined"?M.palette.danger?.[50]??M.surface.panelBg:s&&p==="subtle"?M.palette.danger?.[50]??M.surface.subtleBg:p==="outlined"?M.surface.panelBg:p==="subtle"?M.surface.subtleBg:"transparent",[u,s,p,D,M.surface,M.palette.danger]),be=M.componentHeights.border,Pe=useMemo(()=>p==="outlined"?`${be} solid ${s?M.palette.danger?.[300]??M.surface.border:M.surface.border}`:"none",[p,be,s,M.palette.danger,M.surface.border]),Re=useMemo(()=>css({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:a?"100%":l!=null?Po(l):void 0,flex:"0 0 auto",fontWeight:500}),[a,l]),Ce=useMemo(()=>No({fontSize:_.labelFont,fontWeight:500,color:s?M.palette.danger?.[700]??V.primary:u?D[500]:V.primary,marginBottom:4,display:"inline-block"},...kn(N)),[_.labelFont,s,u,D,V,M.palette.danger,N]),Ie=useMemo(()=>[{display:"flex",alignItems:"stretch",gap:M.spacing.sm,padding:`${Po(_.paddingY)} 0 ${Po(_.paddingY)} ${Po(_.paddingX)}`,background:ie,border:Pe,borderRadius:R?M.radius.full:M.radius.md,minHeight:_.minHeight,width:"100%",cursor:u?"not-allowed":"text",opacity:u?.65:1,transition:"box-shadow .18s, border-color .16s"},...kn(m),...kn($)],[M,_,ie,Pe,be,R,u,m,$]),Te=typeof _.minHeight=="number"?`${_.minHeight}px`:_.minHeight,we=useMemo(()=>No({width:"100%",minWidth:0,flex:1,resize:h?"vertical":"none",font:"inherit",fontWeight:500,fontSize:_.fontSize,lineHeight:1.5,color:u?D[500]:s?M.palette.danger?.[800]??V.primary:V.primary,background:"transparent",border:"none",outline:"none",padding:0,paddingRight:Po(_.paddingX),overflowY:"auto",minHeight:Te,"&::placeholder":{color:s?M.palette.danger?.[700]??V.secondary:V.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${s?M.palette.danger?.[800]??V.primary:V.primary} !important`,boxShadow:`0 0 0 1000px ${ie} inset !important`,transition:"opacity 99999s ease-out",caretColor:s?M.palette.danger?.[800]??V.primary:V.primary},":focus-within":{outline:"none",boxShadow:"none"},...f===1?{paddingBlock:`calc((${Te} - 1.5em) / 2)`}:{paddingBlock:"clamp(4px, 0.5em, 12px)"}},...kn(y)),[h,_,u,s,D,V,M.palette.danger,Te,ie,f,y]),he=useMemo(()=>No({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,paddingTop:3},...kn(x)),[x]),je=useMemo(()=>No({fontSize:_.helperFont,color:s?M.palette.danger?.[700]??V.secondary:V.secondary,flex:1,minWidth:0},...kn(w)),[_.helperFont,s,M.palette.danger,V,w]),Z=useMemo(()=>No({fontSize:_.helperFont,color:k&&X.length>k?M.palette.danger?.[700]??V.secondary:V.secondary,flexShrink:0},...kn(P)),[_.helperFont,k,X.length,M.palette.danger,V,P]),Ee=useRef(null);useLayoutEffect(()=>{if(typeof window>"u")return;let se=Ee.current;if(!se)return;if(h){let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),Y=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),Y);se.style.setProperty("--pf-minh",`${oe}px`);return}(()=>{let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),Y=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),Y);se.style.setProperty("--pf-minh",`${oe}px`);let re=v?Ne*v:1/0;se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,re)}px`;})();},[X,f,v,_.minHeight,h]);let Q=i!=null||C?`${g??L}-help`:void 0,ee=g??L;return jsxs("div",{className:["plainframe-ui-textarea",d||""].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:T!=="none",disabled:u,color:s?"danger":void 0}),Ie],"aria-invalid":!!s||void 0,"aria-disabled":u||void 0,onClick:()=>!u&&Ee.current?.focus(),children:jsx("textarea",{ref:Ee,id:ee,className:"plainframe-ui-textarea-input",css:we,rows:f,value:X,onChange:se=>{let pe=se.target.value;k&&pe.length>k||le(pe);},placeholder:r||"",disabled:u,onBlur:W,onFocus:K,onKeyDown:I,autoFocus:F,name:S,tabIndex:b,autoComplete:A,readOnly:H,required:B,"aria-invalid":!!s||void 0,"aria-describedby":Q})}),(i!=null||C&&k!=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:i}),C&&k!=null&&jsxs("span",{className:"plainframe-ui-textarea-char-count",css:Z,children:[X.length,"/",k]})]})]})};var sg=Vo,ag={type:"spring",stiffness:920,damping:100},ql="__toast_root__",ig=(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=ig(e,n);if(o!=null&&o!=="")return o}},ra=(e,t)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:String(e);function lg(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 cg=lg(sg),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 Yl(){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[ql]??null,Yn||(Yn=createRoot(Wt),Wt[ql]=Yn,Yn.render(jsx(Na,{children:jsx(vg,{})})))));}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();},ug=()=>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 i=window.setTimeout(()=>Be.dismiss(e.id),s);te.timers.set(e.id,i);}function $r(e){let t=te.timers.get(e);t&&(clearTimeout(t),te.timers.delete(e));}function dg(){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 pg(){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 mg=e=>e==="danger"?"error":["default","success","error","warning","info"].includes(e)?e:"default";function fg(e,t){let n=mg(t),o=e,r=o.surface,s=o.text,i=r?.panelBg??"#fff",u=s?.primary??"#111",a=r?.border;if(n==="default"||n==="info")return {bg:i,fg:u,border:a};let l=s?.onColors??{},c=(p,R,f)=>{let v=o.colors,k=o.palette;return {bg:v?.[p]??k?.[p]?.[700]??R,fg:l?.[p]??f,border:"transparent"}};return n==="success"?c("success","#22C55E","#fff"):n==="warning"?c("warning","#F59E0B","#fff"):n==="error"?c("error","#EF4444","#fff"):{bg:i,fg:u,border:a}}var Be=Object.assign((e,t)=>{Yl();let n=a=>a!=null&&typeof a[Symbol.iterator]=="function",o=a=>!!a&&(typeof a=="object"||typeof a=="function")&&typeof a.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??ug(),i=a=>{let l=a.findIndex(R=>R.id===s);if(l===-1)return false;let c=a[l],p={...c,status:r.status??c.status,content:r.content??c.content,title:r.title??c.title,description:r.description??c.description,startIcon:r.startIcon??c.startIcon,endIcon:r.endIcon??c.endIcon,action:r.action??c.action,onClose:r.onClose??c.onClose,duration:r.duration===void 0?c.duration:r.duration,pauseOnHover:r.pauseOnHover??c.pauseOnHover,showDismiss:r.showDismiss??c.showDismiss,render:r.render??c.render,bare:r.bare??c.bare,onClick:r.onClick??c.onClick,width:r.width??c.width};return a[l]=p,$r(s),te.remaining.delete(s),te.paused.has(s)||Br(p),In(),true};if(i(te.displayed)||i(te.queue))return s;let u={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&&pg(),te.displayed=[...te.displayed,u],te.enterFrom[u.id]="tail",te.entering[u.id]=true,requestAnimationFrame(()=>{delete te.entering[u.id],In();}),In(),Br(u),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),dg();},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 gg(e){return typeof e=="string"?e:e===true?"always":e===false?"never":ye.showDismiss}function bg(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 hg=css({display:"flex",alignItems:"flex-start",gap:10}),Gl=css({flex:"0 0 auto",paddingTop:1,lineHeight:0,marginLeft:-3,"& svg, & img, & canvas, & video":{display:"block"}}),yg=css({fontSize:14,lineHeight:1.4,fontWeight:500,flex:1,minWidth:0}),xg=css({display:"flex",alignItems:"center",gap:6,marginRight:-2}),vg=me.memo(function(){let t=useSyncExternalStore(te.subscribe.bind(te),()=>te.snapshot,()=>te.snapshot),n=U(),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",...bg(ye.position),...ye.styles.stack??{}}),[]);return jsx("div",{className:"plainframe-ui-toast-stack",css:css(s),children:jsx(AnimatePresence,{initial:false,children:r.map((i,u)=>{let a=t.enterFrom[i.id]||"tail",l=o?a==="head"?-16:16:a==="head"?16:-16,c=u>0?ye.gutter:0,p={toast:i,close:Be.dismiss,pause:Be.pause,resume:Be.resume},{bg:R,fg:f,border:v}=fg(n,i.status),k={position:"relative",overflow:"hidden",borderRadius:n.radius.md,boxShadow:cg.shadow,padding:`${n.spacing.md} calc(${n.spacing.lg} + 30px) ${n.spacing.md} ${n.spacing.lg}`,display:"grid",gridTemplateColumns:"1fr auto",gap:10,background:R,color:f,cursor:i.onClick?"pointer":"default",border:v?`1px solid ${v}`:"1px solid transparent"},C=typeof ye.styles.surface=="function"?ye.styles.surface(i):ye.styles.surface??{},T=gg(i.showDismiss),h={},d="& .plainframe-ui-toast-close",m="&:hover .plainframe-ui-toast-close";T==="hover"?(h[d]={opacity:0,pointerEvents:"none"},h[m]={opacity:1,pointerEvents:"auto"}):T==="always"?h[d]={opacity:1,pointerEvents:"auto"}:T==="never"&&(h[d]={display:"none"});let y=css({...k,...C,...h}),N=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??{}}),x;if(i.bare&&i.render){let w=typeof i.render=="function"?i.render(p):i.render;x=jsx("div",{style:{pointerEvents:"auto"},onClick:P=>i.onClick?.(i.id,P),children:w});}else if(ye.bareRenderer&&ye.renderer){let w=typeof ye.renderer=="function"?ye.renderer(p):ye.renderer;x=jsx("div",{style:{pointerEvents:"auto"},onClick:P=>i.onClick?.(i.id,P),children:w});}else {let w;ye.renderer?w=typeof ye.renderer=="function"?ye.renderer(p):ye.renderer:i.render&&!i.bare?w=typeof i.render=="function"?i.render(p):i.render:w=jsxs(Fragment,{children:[jsxs("div",{css:hg,children:[i.startIcon&&jsx("div",{css:Gl,children:i.startIcon}),jsx("div",{css:yg,children:i.content}),i.endIcon&&jsx("div",{css:Gl,children:i.endIcon})]}),i.action&&jsx("div",{css:xg,children:i.action})]}),x=jsxs("div",{css:y,onClick:P=>i.onClick?.(i.id,P),children:[w,jsx("button",{className:"plainframe-ui-toast-close","aria-label":"Close",css:N,onClick:P=>{P.stopPropagation(),Be.dismiss(i.id);},children:jsx(X,{strokeWidth:2.5,size:14})})]});}return jsx(Cg,{id:i.id,isBottom:o,mt:c,enterY:l,width:i.width,pauseOnHover:i.pauseOnHover!==false,children:x},i.id)})})})}),Cg=me.memo(function(t){let{id:n,isBottom:o,mt:r,enterY:s,width:i,pauseOnHover:u,children:a}=t,l=useAnimationControls();useEffect(()=>{l.start({opacity:1,y:0,height:"auto",x:0,transition:ag});},[l]);let c={pointerEvents:"auto",willChange:"transform, opacity, height, margin, scale, width, max-width",marginTop:r,width:"100%",maxWidth:i!=null?typeof i=="number"?`${i}px`:i:"none",...ye.styles.item??{}};return jsx(motion.div,{layout:"position",className:"plainframe-ui-toast-item",css:css(c),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:(p,R)=>{let f=Math.abs(R.offset.x),v=Math.abs(R.velocity.x);if(!(f>60||v>600)){l.start({x:0,opacity:1,transition:{type:"spring",stiffness:700,damping:40}});return}let T=(R.offset.x!==0?Math.sign(R.offset.x):Math.sign(R.velocity.x||1))*(window.innerWidth+160),h=typeof R.velocity.x=="number"?R.velocity.x/10:0;l.start({x:T,opacity:.9,transition:{type:"spring",stiffness:280,damping:24,velocity:h}}).then(()=>Be.dismiss(n));},onMouseEnter:u?()=>Be.pause(n):void 0,onMouseLeave:u?()=>Be.resume(n):void 0,children:a})}),Xl=false;(function(){Xl||(Xl=true,Yl());})();var jg=(...e)=>t=>{for(let n of e)if(n)if(typeof n=="function")n(t);else try{n.current=t;}catch{}},Ql=createContext(null),ec=()=>{let e=useContext(Ql);if(!e)throw new Error("TooltipTrigger/TooltipContent must be inside <Tooltip>.");return e},Vg=({children:e,placement:t="top",open:n,defaultOpen:o=false,onOpenChange:r,delay:s=80,arrow:i=true,autoWidth:u=false,disableHoverListener:a=false})=>{let[l,c]=useState(!!o),p=n??l,R=x=>{n===void 0&&c(x),r?.(x);},f=useRef(null),v=useFloating({placement:t,open:p,onOpenChange:R,whileElementsMounted:autoUpdate,strategy:"fixed",transform:false,middleware:[offset(8),flip({padding:8}),shift({padding:8}),i?arrow({element:f,padding:4}):void 0].filter(Boolean)}),k=useHover(v.context,{enabled:!a,delay:{open:s,close:60},handleClose:safePolygon(),restMs:20}),C=useFocus(v.context),T=useDismiss(v.context,{escapeKey:true,outsidePress:true}),h=useRole(v.context,{role:"tooltip"}),{getReferenceProps:d,getFloatingProps:m}=useInteractions([k,C,T,h]),y=useId(),N=useMemo(()=>({open:p,setOpen:R,id:y,placement:v.placement,autoWidth:u,allowArrow:!!i,refs:v.refs,floatingStyles:v.floatingStyles,middlewareData:v.middlewareData,getReferenceProps:d,getFloatingProps:m,arrowRef:f}),[p,u,i,v.placement,v.refs,v.floatingStyles,v.middlewareData,d,m]);return jsx(Ql.Provider,{value:N,children:e})},Ug=({asChild:e=true,children:t,className:n,css:o})=>{let{refs:r,getReferenceProps:s,id:i}=ec(),u=me.isValidElement(t),a=u&&typeof t.type=="string";if(e&&u&&a){let l=t,c="ref"in l?l.ref:void 0,p=s({...l.props,"aria-describedby":i,ref:jg(c,r.setReference),className:[l.props?.className||"",n||""].join(" ").trim()||void 0}),R=[l.props?.css||void 0,o].filter(Boolean);return me.cloneElement(l,{...p,css:R})}return jsx("span",{ref:r.setReference,className:n,css:o,style:{display:"inline-flex"},...s({"aria-describedby":i}),children:t})},qg=({children:e,className:t,css:n,arrowCss:o})=>{let {open:r,refs:s,floatingStyles:i,middlewareData:u,getFloatingProps:a,placement:l,id:c,autoWidth:p,allowArrow:R,arrowRef:f}=ec(),v=U(),k=l.split("-")[0]||"top",T=k==="bottom"?{opacity:0,y:-8,scale:.98}:k==="top"?{opacity:0,y:8,scale:.98}:k==="left"?{opacity:0,x:8,scale:.98}:{opacity:0,x:-8,scale:.98},h=T,d=k==="bottom"?"center top":k==="top"?"center bottom":k==="left"?"right center":"left center",m=css({zIndex:1300,backgroundColor:v.neutral[900],color:v.neutral[0],borderRadius:8,padding:"6px 9px",fontSize:12,fontWeight:500,lineHeight:1.25,maxWidth:260,whiteSpace:p?"nowrap":"normal",boxShadow:"0 10px 30px rgba(0,0,0,.18)",pointerEvents:"auto",transformOrigin:d}),y=css({position:"absolute",width:10,height:10,borderRadius:2,backgroundColor:v.neutral[900],transform:"rotate(45deg)",pointerEvents:"none"}),N=u.arrow,x={top:"bottom",bottom:"top",left:"right",right:"left"}[k];return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:r&&jsxs(motion.div,{id:c,ref:s.setFloating,role:"tooltip","data-state":"open",className:["plainframe-ui-tooltip",t||""].join(" ").trim(),css:[m,n],style:i,initial:T,animate:{opacity:1,x:0,y:0,scale:1},exit:h,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"}},...a(),children:[e,R&&jsx("div",{ref:f,className:"plainframe-ui-tooltip-arrow",css:[y,o],style:{left:N?.x!=null?`${N.x}px`:void 0,top:N?.y!=null?`${N.y}px`:void 0,[x]:"-3px"}})]})})})};function Jg(){let e=U();return jsx(Global,{styles:css`
|
|
21
21
|
*,*::before,*::after{box-sizing:border-box}
|
|
22
22
|
|
|
23
23
|
body{
|