var Y2=Object.defineProperty;var G2=(u,a,b)=>a in u?Y2(u,a,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[a]=b;var P=(u,a,b)=>(G2(u,typeof a!="symbol"?a+"":a,b),b);(function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u["@abw/badger-react-ui"]={},u["react/jsx-runtime"],u.react,u.ReactDOM))})(this,function(u,a,b,ft){var qe,$e,xt,se;"use strict";function Ko(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const A=Ko(b),Zu=Ko(ft);var Ju=Object.defineProperty,Qu=(e,t,n)=>t in e?Ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ur=(e,t,n)=>Qu(e,typeof t!="symbol"?t+"":t,n);function Ru(e={},t={},n={}){return Object.entries(t).reduce((s,[r,o])=>{const i=n[o];return i!==null&&typeof i<"u"&&(s[r]=i),s},{...e})}function eh(e,t=[]){return(typeof t=="string"?t.split(/,\s*|\s+/):t).reduce((n,s)=>{const r=e[s]||rh(`Cannot expose non-existent action method: ${s}`);return n[s]=r.bind(e),n},{})}function th(e,t){const n=e.debug??t.debug,s=qo(e.debugPrefix??t.debugPrefix,e),r=qo(e.debugColor??t.debugColor,e);return n?s?(o,...i)=>console.log(`%c${s}%c${o}`,`color: ${r}`,"color:black",...i):console.log.bind(console):()=>{}}function nh(e){return Array.isArray(e)}function _o(e){return typeof e=="function"}function qo(e,t){return _o(e)?e(t):e}function sh(e){return nh(e)?e:[e]}function rh(...e){throw new Error(e.join(""))}const Ie=(e,t={},n=b.createContext(t))=>({Context:n,Provider:s=>a.jsx(e,{...s,render:r=>a.jsx(n.Provider,{value:r,children:s.children})}),Consumer:s=>r=>a.jsx(n.Consumer,{children:o=>a.jsx(s,{...o,...r})}),Children:({children:s})=>sh(s).map((r,o)=>_o(r)?a.jsx(n.Consumer,{children:r},o):r),Use:()=>b.useContext(n)});let gt=class extends b.Component{constructor(t){super(t);const n=this.constructor;this.debug=th(t,n),this.state=Ru(n.initialState,n.initialProps,t),this.actions=eh(this,n.actions)}getContext(){return{...this.props,...this.state,...this.actions}}getRenderProps(){return this.getContext()}render(){return this.props.render(this.getRenderProps())}};ur(gt,"initialState",{}),ur(gt,"initialProps",{}),ur(gt,"actions",[]);const Kn=Ie(({render:e,open:t})=>{const[n,s]=b.useState(t),r=()=>s(l=>!l),o=()=>s(!0),i=()=>s(!1);return b.useEffect(()=>{s(t)},[t]),e({isOpen:n,open:o,close:i,toggleOpen:r})}),oh=Kn.Use,ih="svg",hr="-",Xo="fill",ah="path",lh="line",ch="rect",dh="array",uh="circle",hh="ellipse",fh="polygon",gh="polyline",fr=/-(?!\d)/,Yo="currentColor",gr=512,pr=512,_n={defaults:{width:512,height:512,type:"line"},icons:{alpha:"M102,448L256,64L410,448 M152,333L360,333",angle:"M448,336L256,144L64,336",angles:"M448,448L256,256L64,448M448,256L256,64L64,256",arrow:"M96,224L256,64L416,224M256,86L256,448",arrows:"M160,128L256,32L352,128M352,384L256,480L160,384M256,48L256,464",arrowhead:"M176,112L256,32L336,112M256,48L256,192",asterisk:"M76,152L436,360M76,360L436,152M256,48L256,464",at:"M256,160C309,160 352,203 352,256C352,309 309,352 256,352C203,352 160,309 160,256C160,203 203,160 256,160M256,480C132,480 32,380 32,256C32,132 132,32 256,32C380,32 480,132 480,256L480,288C480,323 451,352 416,352C381,352 352,323 352,288L352,176",ban:"M100,412L412,100 M256,32C380,32 480,132 480,255C480,379 380,480 256,480C132,480 32,379 32,255C32,132 132,32 256,32Z",bars:"M64,96L448,96M64,256L448,256M64,416L448,416",card:"rect:32 96 448 320 32 32",caret:"M448,336L256,144L64,336L448,336Z",check:"M48,248L192,392L464,120",circle:"circle:256 256 224",clipboard:"M192,80L80,80L80,496L432,496L432,80L320,80L320,112L192,112L192,80ZM256,16C282,16 304,38 304,64C304,90 282,112 256,112C230,112 208,90 208,64C208,38 230,16 256,16Z",clone:"M304,416L304,444C304,468 284,488 260,488L68,488C44,488 24,468 24,444L24,252C24,228 44,208 68,208L96,208M480,75L480,277C480,301 461,320 437,320L235,320C211,320 192,301 192,277L192,75C192,51 211,32 235,32L437,32C461,32 480,51 480,75Z",cloud:"M480,293C480,234 437,177 362,196C346,161 319,116 240,120C180,124 139,165 125,224C121,223 116,223 111,223C68,223 32,260 32,307C32,354 68,392 111,392C120,392 366,392 380,392C462,392 480,335 480,293Z",cog:"M306,21L206,21L187,91L147,114L78,95L28,182L78,233L78,279L28,330L78,417L147,398L187,421L206,491L306,491L325,421L365,398L434,417L484,330L434,279L434,233L484,182L434,95L365,114L325,91L306,21Z M256,176C300,176 336,212 336,256C336,300 300,336 256,336C212,336 176,300 176,256C176,212 212,176 256,176Z",columns:["rect:32 32 448 448 45 45","line:180,32 180,480","line:332,32 332,480"],comment:"M256,64C371,64 464,139 464,232C464,325 371,400 256,400C236,400 217,398 199,394C184,390 163,448 80,464C111,426 118,358 110,352C72,321 48,279 48,232C48,139 141,64 256,64Z",crop:"M32,80L288,80 M80,32L80,288M432,480L432,224M480,432L224,432M80,428L432,80",cross:"M112,112L400,400M400,112L112,400",crosshairs:["circle:256 256 192","M256,16L256,112 M496,256L400,256 M16,256L112,256 M256,496L256,400"],diamond:"M256,32L480,256L256,480L32,256L256,32",download:"M256,64L256,320L352,224M256,320L160,224M384,320L425,320C438,320 448,330 448,342L448,426C448,438 438,448 425,448L86,448C74,448 64,438 64,426L64,342C64,330 74,320 86,320L128,320",drag:"M96,128L256,32L416,128M96,384L256,480L416,384M144,256L368,256",envelope:["rect:32 96 448 320 32 32","M32,144C32,144 158.906,243.712 221.676,293.031C241.821,308.86 270.179,308.86 290.324,293.031C353.094,243.712 480,144 480,144"],equals:"M96,320L416,320 M96,192L416,192",exclamation:"M256,96L256,310M254,416L258,416",eye:["M21,256C131,42 381,43 493,256 M21,256C130,470 383,469 493,256","circle:256 256 80"],eyeshut:"M21,256C131,42 381,43 493,256M21,256C130,320 383,320 493,256M21,256C130,470 383,469 493,256",filter:"M64,32L448,32L448,128L320,256L320,432L192,480L192,256L64,128L64,32Z",folder:"M480,128L480,448L32,448L32,64L176,64L240,128L480,128Z",globe:["circle:256 256 224","ellipse:256 256 116 224","M32,255.997L480,256.115M53.867,160L458.413,160M53.867,352.587L458.413,352M256.14,32L256.14,480"],heart:"M256,128C298,48 382,48 424,88C466,128 466,208 424,288C394,348 319,408 256,448C193,408 118,348 88,288C46,208 46,128 88,88C130,48 214,48 256,128Z",hourglass:"M80,32L432,32M80,480L432,480M128,32C128,256 384,256 384,480M384,32C384,256 128,256 128,480",image:["rect:32 80 448 366 32","M32,304L128,240L384,432M272,345L367,281L480,366","circle:288 192 16"],info:"M212,202L256,202L256,416M182,416L330,416M252,96L256,96",key:["M189,246C183,229 180,212 180,194C180,118 242,56 318,56C394,56 456,118 456,194C456,270 394,332 318,332C300,332 283,329 266,323L232,360L184,360L184,408L136,408L136,456L56,456L56,379L189,246Z","circle:344 168 8"],list:"M176,96L448,96M176,256L448,256M176,416L448,416M64,96L80,96M64,256L80,256M64,416L80,416",locked:["M144,224L144,166C144,105 195,54 256,54C317,54 368,105 368,166L368,224M256,320L256,368","rect:80 224 352 240 32 32"],login:"M192,128L320,256L192,384M304,256L64,256M320,64L448,64L448,448L320,448",logout:"M320,128L448,256L320,384M432,256L192,256M192,448L64,448L64,64L192,64",minus:"M96,256L416,256",mobile:["rect:128 48 256 416 32 32","M128,120L384,120M128,392L384,392"],move:"M192,96L256,32L320,96M416,192L480,256L416,320M320,416L256,480L192,416M96,192L32,256L96,320M48,256L464,256M256,48L256,464",number:"M256,448L256,64L176,128 M160,448L336,449",page:"M416,170L416,480L96,480L96,32L288,32L416,170M288,32L288,176L416,176",pen:"M482,143C491,134 491,120 482,112L401,30C392,21 378,21 369,30L72,326L22,489L186,439L482,143M305,93L418,206",phone:"M51,59C40,62 32,72 32,84C41,321 192,472 428,480C440,480 451,471 453,459C459,435 469,395 475,371C478,360 472,348 462,343C438,331 395,309 370,297C360,292 347,295 339,304C325,323 303,352 304,352C255,352 160,257 160,208C160,207 188,186 207,172C217,165 220,152 215,141C202,117 181,74 169,50C164,39 152,34 141,37C116,43 75,53 51,59Z",plus:"M256,96L256,416M96,256L416,256",point:"M448,224L256,16L64,224L160,224L160,480L352,480L352,224L448,224Z",prime:"M256,128L256,256",question:"M160,160C160,126 197,80 255,80C314,80 336,128 336,160C336,236 255,235 255,320 M255,416L256,416",rotate:"M392,120C356,84 307,64 256,64C150,64 64,150 64,256C64,362 150,448 256,448C303,448 349,430 384,399C349,430 303,448 256,448C150,448 64,362 64,256C64,150 150,64 256,64C307,64 356,84 392,120Z M352,208L480,208L480,80",search:"M204,32C300,32 384,111 384,208C384,305 305,384 208,384C111,384 32,305 32,208C32,111 107,32 204,32M480,480L332,332",slash:"M64,448L448,64",square:"rect:32 32 448 448",square10:"rect:32 32 448 448 45 45",square20:"rect:32 32 448 448 90 90",square30:"rect:32 32 448 448 135 135",square40:"rect:32 32 448 448 180 180",star:"M256,32L324,183L489,202L367,313L400,476L256,394L112,476L145,313L23,202L188,183L256,32Z",thumb:"M149,174L32,174L32,448L149,448L149,184 M149,217C277,160 246,36 282,38C372,44 324,192 324,192L440,192C462,192 480,210 480,232C480,254 462,272 440,272L368,272M424,272C446,272 464,290 464,312C464,334 446,352 424,352L352,352M392,352C414,352 432,370 432,392C432,414 414,432 392,432L256,432C220,432 149,409 149,409",time:"M256,128L256,256L336,336",trash:"M32,80L480,80 M80,80C80,80 100,344 109,452C111,477 131,496 156,496C211,496 301,496 356,496C381,496 401,477 403,452C412,344 432,80 432,80 M160,80L208,16L304,16L352,74",triangle:"M256,64L32,448L480,448L256,64Z",unlocked:["M144,224L144,166C144,105 195,54 256,54C304,54 346,85 361,128M256,320L256,368","rect:80 224 352 240 32 32"],upload:"M256,320L256,64L160,160M256,64L352,160M384,320L425,320C438,320 448,330 448,342L448,426C448,438 438,448 425,448L86,448C74,448 64,438 64,426L64,342C64,330 74,320 86,320L128,320",user:["M448,400C448,349 410,308 364,308L149,308C102,308 64,349 64,400C64,424 64,480 64,480L448,480C448,480 448,423 448,400Z","circle:256,144,96"],vertical:"line:256,48 256,464",wrench:"M486,108C493,124 496,142 496,160C496,239 431,304 352,304C330,304 309,299 290,290L98,482C79,501 49,501 30,482C11,463 11,433 30,414L222,222C213,203 208,182 208,160C208,81 273,16 352,16C370,16 388,19 404,26L336,96L352,160L416,176L486,108Z"}};function Go(e,t,n=_n){n.icons[e]=t}function ph(e,t=_n){Object.entries(e).forEach(([n,s])=>Go(n,s,t))}const qn=b.createContext();function Zo(e){return typeof e=="function"}function Jo(e){return typeof e=="object"&&!Qo(e)&&!bh(e)}function Qo(e){return Array.isArray(e)}function bh(e){return e===null}function vh({context:e={},Implementation:t,spec:n=!1,props:s={},ref:r}){if(!n)return a.jsx(t,{...s,ref:r});let o={},i=Zo(n)?n(e):e[n];if(Qo(i)&&(t=i[0],i=i[1]),Zo(i)){const l=i(s,r,e);if(b.isValidElement(l))return l;Jo(l)&&Object.assign(o,s,l)}else Jo(i)?Object.assign(o,i,s):Object.assign(o,s);return a.jsx(t,{...o,ref:r})}const mh=e=>({Context:qn,Provider:({children:t,...n})=>a.jsx(qn.Provider,{value:{...e,...n},children:t}),Consumer:t=>n=>a.jsx(qn.Consumer,{children:s=>a.jsx(t,{...s,...n,context:s})}),Component:(t,n=t.displayName||t.name)=>b.forwardRef((s,r)=>a.jsx(qn.Consumer,{children:o=>a.jsx(vh,{Implementation:t,context:o,spec:n,props:s,ref:r})}))}),Ch=mh(),yh=Ch.Component;function Ee(e){return typeof e=="string"}function rn(e){return Array.isArray(e)}function Xn(e){return typeof e=="object"&&!rn(e)&&!ei(e)}function Ro(e){return e===void 0}function ei(e){return e===null}function Yn(e){return!(Ro(e)||ei(e))}function ti(e){return!Yn(e)}function we(...e){throw new Error(e.join(""))}function Sh(){return Intl.DateTimeFormat().resolvedOptions().locale}Sh();function br(e,t=/,\s*|\s+/){return ti(e)?[]:Ee(e)?e.length?e.split(t):[]:rn(e)?e:[e]}const wh=(e,t)=>{const n=e[t];return delete e[t],n};function on(e){return e.split(/\s*[;&]\s*/).filter(t=>t.length>0).reduce((t,n)=>{const[s,r]=n.split(/\s*[:=]\s*/);return t[s]=Ro(r)?!0:r,t},{})}const vr=e=>e.filter(Yn).join(" "),Mh=e=>Object.entries(e).filter(([,t])=>t).map(([t])=>t),Lh=(...e)=>vr(e.flatMap(t=>Xn(t)?Mh(t):t)),ni=e=>br(e,/\s+/),si={x:0,y:0,size:16,scaleX:1,scaleY:1,flipX:!1,flipY:!1,rotate:0},Ze={flip:(e,t)=>{Ee(t)&&t.match(/^y$/i)?e.flipY=!e.flipY:e.flipX=!e.flipX},flipx:e=>e.flipX=!e.flipX,flipy:e=>e.flipY=!e.flipY,grow:(e,t)=>e.size+=parseFloat(t),shrink:(e,t)=>e.size-=parseFloat(t),scalex:(e,t)=>e.scaleX*=parseFloat(t),scaley:(e,t)=>e.scaleY*=parseFloat(t),left:(e,t)=>t===!0?e.rotate-=90:e.x-=parseFloat(t),right:(e,t)=>t===!0?e.rotate+=90:e.x+=parseFloat(t),up:(e,t)=>t===!0?e.rotate+=0:e.y-=parseFloat(t),down:(e,t)=>t===!0?e.rotate+=180:e.y+=parseFloat(t),rotate:(e,t)=>e.rotate+=parseInt(t)};Ze.flop=Ze.flipy,Ze["flip-x"]=Ze.flipx,Ze["flip-y"]=Ze.flipy;function ri(e,t={...si}){const n=Ee(e)?on(e):e||{};return Object.entries(n).reduce((s,[r,o])=>{const i=r.toLowerCase();return(Ze[i]||we(`Invalid transform: ${i}`))(s,o),s},t)}const Nh=4.42,Pe=e=>`${Nh*e}%`,Dh={},mr={outline:{fill:"none",stroke:"currentColor",strokeWidth:Pe(2),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"1.5"},solid:{fill:"currentColor",stroke:"none"},round:{strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"1.5"},square:{strokeLinecap:"square",strokeLinejoin:"miter",strokeMiterlimit:"1.5"},butt:{strokeLinecap:"butt"},bevel:{strokeLinejoin:"bevel"},thinnest:{strokeWidth:Pe(.5)},thinner:{strokeWidth:Pe(1)},thin:{strokeWidth:Pe(1.5)},medium:{strokeWidth:Pe(2)},thick:{strokeWidth:Pe(2.5)},thicker:{strokeWidth:Pe(3)},thickest:{strokeWidth:Pe(3.5)}};mr.line=mr.outline;const xh={...Object.entries(mr).reduce((e,[t,n])=>(e[t]=s=>Object.assign(s,n),e),{}),fill:(e,t)=>e.fill=t===!0?Yo:t,stroke:(e,t)=>e.stroke=t===!0?Yo:t,nofill:e=>delete e.fill,nostroke:e=>delete e.stroke,strokewidth:(e,t)=>e.strokeWidth=t.match(/^[\d.]+$/)?Pe(parseFloat(t)):t,opacity:(e,t)=>e.opacity=t,fillopacity:(e,t)=>e.fillOpacity=t,strokeopacity:(e,t)=>e.strokeOpacity=t,dasharray:(e,t)=>e.strokeDasharray=t,drawlength:(e,t)=>e["--draw-length"]=t,drawtime:(e,t)=>e["--draw-time"]=t,filltime:(e,t)=>e["--fill-time"]=t};function Gn(e,t){return(Ee(t)?t.split(fr):t).forEach(n=>{const[s,r=!0]=n.split(/[:=]/),o=s.toLowerCase(),i=xh[o];if(i){i(e.style||(e.style={...Dh}),r);return}(Ze[o]||we(`Invalid style or transform: ${o}`))(e.transform||(e.transform={...si}),r)})}const $h={width:gr,height:pr,type:Xo},oi={svg:e=>({element:ih,svg:e}),array:e=>({element:dh,items:e}),path:e=>({element:ah,d:e}),polygon:e=>({element:fh,points:e}),polyline:e=>({element:gh,points:e}),circle:e=>({element:uh,...Zn(e,"cx cy r")}),ellipse:e=>({element:hh,...Zn(e,"cx cy rx ry")}),line:e=>({element:lh,...Zn(e,"x1 y1 x2 y2")}),rect:e=>({element:ch,...Zn(e,"x y width height rx ry")})};function Zn(e,t){const n=rn(t)?[...t]:br(t);return br(e).reduce((s,r)=>{if(n.length){const o=n.shift();s[o]=r}return s},{})}const ii=e=>{const[t,n=""]=e.split("?"),[s,...r]=t.split(/\.(?!\d)/),o=s.split(fr).filter(l=>l.length),i=on(n);return{dashes:o,classes:r,style:i}},Th=(e,t)=>{const n=ii(e),{dashes:s}=n;for(let r=s.length;r>0;r--){const o=s.slice(0,r).join(hr);if(t[o]){n.name=s.splice(0,r).join(hr);break}}return n},ai=(e,t,n={})=>{const{icons:s}=t,r=Th(e,s),{name:o,classes:i,style:l,dashes:c}=r;ti(o)&&we(`No icon found matching any leading subset of ${r.dashes.join(hr)}`);const d=t.icons[o]||we(`Icon not found in data: ${o}`),h=li(d,t,{...n,name:o});if((i.length||n.className)&&(h.className=vr([...i||[],n.className])),h.transform&&(h.transform=ri(h.transform)),h.style&&(h.style=Ee(h.style)?on(h.style):{...h.style}),h.type){const f=h.style&&{...h.style};Gn(h,h.type),delete h.type,f&&Object.assign(h.style,f)}return c.length&&Gn(h,c),Object.keys(l).length&&(h.style=Object.assign(h.style||{},l)),h};function Oh(e){const t=e.match(/^(.*?):(.*)/);return t?{path:t[2],type:t[1]}:{path:e}}const li=(e,t,n={})=>{const{defaults:s={}}=t,r={...$h,...s,...n};return ci(r,e,t)},ci=(e,t,n)=>{if(Ee(t))return kh(e,t);if(Xn(t))return Ih(e,t,n);if(rn(t))return Eh(e,t,n);we(`Cannot parse icon data: ${t}`)};function kh(e,t){if(t.match(/^\w*li(s,n).body)},e}const Ph=({size:e,...t})=>{t.width??(t.width=e||gr),t.height??(t.height=e||pr),t.path&&Object.assign(t,Oh(t.path));let n;return t.style&&(Ee(t.style)?(n=on(t.style),t.style={}):n={...t.style}),Gn(t,t.type?t.type.split(fr).filter(s=>s.length):Xo),delete t.type,t.style&&n&&Object.assign(t.style,n),t.transform&&(t.transform=ri(t.transform)),t},Cr=e=>Xn(e)?Object.entries(e).reduce((t,[n,s])=>(t[n.replace(/(?!-)-./g,r=>r[1].toUpperCase())]=s,t),{}):e,Fh=e=>Yn(e)?Cr(on(e)):null,Fe=({style:e,class:t,...n})=>({style:Ee(e)?Fh(e):Cr(e),className:t,...n}),Ah=e=>a.jsx("circle",{...Fe(e)}),Vh=e=>a.jsx("ellipse",{...Fe(e)}),Bh=e=>a.jsx("line",{...Fe(e)}),di=e=>a.jsx("path",{...Fe(e)}),jh=e=>a.jsx("polygon",{...Fe(e)}),Wh=e=>a.jsx("polyline",{...Fe(e)}),Hh=e=>a.jsx("rect",{...Fe(e)}),Uh=({svg:e,...t})=>a.jsx("g",{dangerouslySetInnerHTML:{__html:e},...Fe(t)}),zh=({items:e,...t})=>a.jsx("g",{...Fe(t),children:e.map((n,s)=>a.jsx(Jn,{body:n},s))}),Kh={array:zh,circle:Ah,ellipse:Vh,line:Bh,path:di,polygon:jh,polyline:Wh,rect:Hh,svg:Uh},Jn=({path:e,body:t,...n})=>{if(e)return a.jsx(di,{d:e,...n});if(Ee(t))return a.jsx("g",{dangerouslySetInnerHTML:{__html:t}});if(Xn(t)){const{element:s,...r}=t,o=Kh[s]||we(`Invalid element type: ${s} => `,JSON.stringify(t));return a.jsx(o,{...r})}if(rn(t))return t.map((s,r)=>a.jsx(Jn,{body:s},r));we(`Don't know how to handle body: ${t}`)};function _h({width:e,height:t,transform:n,children:s}){const r=e/2,o=t/2,i=n.x*e/16,l=n.y*t/16,c=n.size/16*(n.flipX?-1:1)*n.scaleX,d=n.size/16*(n.flipY?-1:1)*n.scaleY,h=n.rotate;return a.jsx("g",{transform:`translate(${r} ${o})`,children:a.jsx("g",{transform:`translate(${i}, ${l}) scale(${c}, ${d}) rotate(${h} 0 0)`,children:a.jsx("g",{transform:`translate(-${r} -${o})`,children:s})})})}const yr=({onClick:e,minx:t=0,miny:n=0,width:s=gr,height:r=pr,style:o,transform:i,className:l="",debug:c,...d})=>a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true",focusable:"false",viewBox:`${t} ${n} ${s} ${r}`,className:`${l} icon`,style:Cr(o),onClick:e,children:[!!c&&console.log("style: ",o),i?a.jsx(_h,{width:s,height:r,transform:i,children:a.jsx(Jn,{...d})}):a.jsx(Jn,{...d})]}),qh=({name:e,iconsClass:t="icons",library:n=_n,...s})=>{if(!e)return a.jsx(yr,{...Ph(s)});try{const r=ni(e);return r.length===1?a.jsx(yr,{...s,...ai(e,n,s)}):a.jsx("div",{className:Lh(t,s.className),children:r.map(o=>a.jsx(yr,{...s,...ai(o,n,s)},o))})}catch(r){we(`Badger Icon failed to render icon "${e}". ${r.message}`)}},ui=yh(qh,"Icon"),Xh=({names:e,className:t})=>a.jsx("div",{className:`grid overlap ${t}`,children:ni(e).map(n=>a.jsx(ui,{name:n},n))});function pt(e){return typeof e=="boolean"}function Ae(e){return typeof e=="string"}function an(e){return typeof e=="number"}function Qn(e){return Number.isInteger(e)}function Me(e){return Array.isArray(e)}function bt(e){return typeof e=="function"}function Yh(e){return e instanceof RegExp}function ie(e){return typeof e=="object"&&!Me(e)&&!Sr(e)}function hi(e){return Ae(e)||an(e)||pt(e)}function fi(e){return e===void 0}function Sr(e){return e===null}function I(e){return!(fi(e)||Sr(e))}function Rn(e){return!I(e)}function es(...e){throw new Error(e.join(""))}const Z=(e,...t)=>bt(e)?e(...t):e;function F(){}const vt=e=>e,gi=e=>{const t=e.toString().split(".");return t.length<2?1:Math.pow(10,t[1].length)},ts=(...e)=>e.reduce((t,n)=>{const s=gi(t),r=gi(n);return s>r?s:r},-1/0),Je=(...e)=>e.reduce((t,n)=>{const s=ts(t,n);return t*s*(n*s)/(s*s)},1),ns=(...e)=>e.reduce((t,n)=>{const s=ts(t,n);return t*s/(n*s)}),pi=(...e)=>{const t=ts.apply(null,e);return e.reduce((n,s)=>n+t*s,0)/t},Gh=(...e)=>{const t=ts.apply(null,e),[n,...s]=e;return s.reduce((r,o)=>r-t*o,n*t)/t},q=(e,t,n)=>Math.min(Math.max(e,t),n);function Zh(){return Intl.DateTimeFormat().resolvedOptions().locale}let wr={locale:Zh(),currency:"GBP",currencySign:"£",thousands:","};const bi=(e,t,n=1)=>{const s=tr+o*s)};function Tt(e,t={}){return new Intl.NumberFormat(t.locale||wr.locale,t).format(e)}function Jh(e,t={}){return Tt(e,{style:"currency",currency:wr.currency,...t})}function Qh(e,t=wr.thousands){if(Rn(e))return"";for(var n=e.toString().split("."),s=/(\d+)(\d{3})/;s.test(n[0]);)n[0]=n[0].replace(s,`$1${t}$2`);return n.join(".")}function Ot(e,t=/,\s*|\s+/){return Rn(e)?[]:Ae(e)?e.length?e.split(t):[]:Me(e)?e:[e]}function mt(e,t=!0,n={}){return ie(e)?e:Ot(e).reduce((s,r)=>(s[r]=bt(t)?t(r):t,s),n)}function Mr(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Rh(e,t={}){const n=t[e];if(I(n))return n;let s;return e.match(/(ss?|sh|ch|x)$/)?e+"es":(s=e.match(/(.*?[^aeiou])y$/))?s[1]+"ies":e.match(/([^s\d\W])$/)?e+"s":e}function ef(e,t,n,s="no"){return(e?Qh(e):s)+" "+(e===1?t:n||Rh(t))}const tf=Mr;function nf(e){if(bt(e))return e;if(Yh(e))return t=>e.test(t);if(ie(e))return t=>!!e[t];if(Me(e)||Ae(e)){const t=mt(e);return n=>!!t[n]}es("Invalid selector() specification: "+e)}const ln=(e,t,n={})=>{let s={},r={delete:!1,...n};const o=nf(t);return Object.keys(e).map(i=>{if(o(i)){let l=e[i];r.delete&&delete e[i],r.key&&(i=r.key(i)),r.value&&(l=r.value(l)),s[i]=l}}),s},Lr=(e,t)=>bt(t)?t(e):e[t],vi=(e,t)=>parseInt(Lr(e,t)||0),mi=(e,t)=>parseFloat(Lr(e,t)||0),Ci=(e,t)=>(Lr(e,t)||"").toString(),yi=e=>(t,n)=>vi(t,e)-vi(n,e),Nr=e=>(t,n)=>mi(t,e)-mi(n,e),Dr=e=>(t,n)=>{let s=Ci(t,e).toLowerCase(),r=Ci(n,e).toLowerCase();return s>r?1:r>s?-1:0},sf=e=>(t,n)=>e(n,t);function rf(e,t=300){let n;return(...s)=>{clearTimeout(n),n=setTimeout(()=>e.apply(this,s),t)}}function xr(e){return new Promise(t=>setTimeout(t,e))}const Si=e=>e.filter(I).join(" "),wi=e=>Object.entries(e).filter(([,t])=>t).map(([t])=>t),x=(...e)=>Si(e.flatMap(t=>ie(t)?wi(t):t)),ss=e=>{if(!e)return null;const[t,n,s,r,o]=e.split("-");return x(t,$i(n),Ti(s),Oi(r),ki(o))},$r=({className:e,size:t,color:n,...s})=>({...s,className:x(e,t,ss(n))}),Mi=({className:e,size:t,color:n,border:s,radius:r,shadow:o,grid:i,stack:l,gap:c,pad:d,mar:h,padding:f=d,margin:p=h,...g},...m)=>({...g,className:x(...m,e,t,ss(n),Ve(s),je(r),Be(o),Li(i),os(c),Ni(l),Di(f),xi(p))}),rs=(...e)=>{const{className:t,...n}=Mi(...e);return x(t,n)},Ve=e=>as(e,"border",t=>`border bdw-${t}`),Be=e=>as(e,"shadow-1",t=>`shadow-${t}`),Li=e=>is(e,"grid-1",t=>`grid-${t}`),Ni=e=>e?`stack-${e}`:null,Di=e=>Tr(e,"pad"),xi=e=>Tr(e,"mar"),je=e=>as(e,"bdr-1",t=>`bdr-${t}`),$i=e=>cn(e,t=>`fgc-${t}`),Ti=e=>cn(e,t=>`bgc-${t}`),Oi=e=>cn(e,t=>`fgd-${t}`),ki=e=>cn(e,t=>`bgd-${t}`),os=e=>is(e,"gap-1",t=>{const n=Ot(t);return n.length===2?ls("gap",["v","h"],n):`gap-${t}`}),cn=(e,t)=>Qn(parseInt(e))?Z(t,e):null,is=(e,t,n)=>e===!0?t:I(e)?Z(n,e):null,as=(e,t,n)=>e===!0?t:Qn(parseInt(e))?Z(n,e):null,Tr=(e,t)=>is(e,t,n=>Ii(t,Ot(n))),Ii=(e,t)=>t.length===2?ls(e,["v","h"],t):t.length===4?ls(e,["t","r","b","l"],t):t.map(n=>`${e}-${n}`).join(" "),ls=(e,t,n)=>n.map((s,r)=>`${e}-${t[r]}-${s}`).join(" "),cs=b.createContext();function Ei(e){return typeof e=="function"}function Pi(e){return typeof e=="object"&&!Fi(e)&&!of(e)}function Fi(e){return Array.isArray(e)}function of(e){return e===null}function af({context:e={},Implementation:t,spec:n=!1,props:s={},ref:r}){if(!n)return a.jsx(t,{...s,ref:r});let o={},i=Ei(n)?n(e):e[n];if(Fi(i)&&(t=i[0],i=i[1]),Ei(i)){const l=i(s,r,e);if(b.isValidElement(l))return l;Pi(l)&&Object.assign(o,s,l)}else Pi(i)?Object.assign(o,i,s):Object.assign(o,s);return a.jsx(t,{...o,ref:r})}const Ai=e=>({Context:cs,Provider:({children:t,...n})=>a.jsx(cs.Provider,{value:{...e,...n},children:t}),Consumer:t=>n=>a.jsx(cs.Consumer,{children:s=>a.jsx(t,{...s,...n,context:s})}),Component:(t,n=t.displayName||t.name)=>b.forwardRef((s,r)=>a.jsx(cs.Consumer,{children:o=>a.jsx(af,{Implementation:t,context:o,spec:n,props:s,ref:r})}))}),Vi=Ai(),D=Vi.Component,H=D(e=>a.jsx(ui,{...$r(e)}),"Icon");function Bi(e,t,n={}){return I(t)&&(n[e]=Qn(t)?`${t}deg`:t),Object.keys(n).length?n:null}const ji=(e,t,n={})=>({...Object.entries(e).reduce((s,[r,o])=>{const i=t[r];return I(i)&&(s[o]=i),s},t.style||{}),...n}),ds=(e,{side:t=""}={})=>{const n=`icon${t}`,s=e[n],r=ie(s)?s:{name:s},o=x(r.className,e[`${n}Class`],t?`on-${t.toLowerCase()}`:null);o.length&&(r.className=o);const i=e[`${n}Rotate`];return I(i)&&(r.style=Bi("--icon-rotate",i,r.style)),r},Or=e=>Ae(e)?{name:e}:e,We=D(({icon:e,iconLeft:t,iconRight:n,spanText:s,spanClass:r,text:o,children:i,...l})=>a.jsxs(a.Fragment,{children:[!!e&&a.jsx(H,{...ds({icon:e,...l}),fixedWidth:!0}),!!t&&a.jsx(H,{...ds({iconLeft:t,...l},{side:"Left"}),fixedWidth:!0}),s?a.jsx("span",{className:r??"",children:o||i}):o||i,!!n&&a.jsx(H,{...ds({iconRight:n,...l},{side:"Right"}),fixedWidth:!0})]}),"WithIcons"),Wi=({summary:e,summaryClass:t,toggleOpen:n,detailsSummaryClass:s="summary",summarySpanClass:r="summary-text",...o})=>a.jsx("div",{onClick:n,className:x(s,t),children:a.jsx(We,{text:e,spanText:!0,spanClass:r,...ln(o,/^(icon|text)/)})}),kr=({content:e,children:t,contentClass:n})=>a.jsx("div",{className:n,children:e||t}),lf=({className:e,size:t,color:n,lined:s,border:r,radius:o,shaded:i,shadow:l,isOpen:c,toggleOpen:d,detailsClass:h="details",noIconClass:f="no-icon",wideSummary:p,wideSummaryClass:g="wide-summary",Summary:m=Wi,Content:v=kr,...C})=>a.jsxs("div",{className:x(h,f,e,n,Ve(r),je(o),Be(l),{size:t,color:n,lined:s,shaded:i,open:c,[g]:p}),children:[a.jsx(m,{toggleOpen:d,...C}),!!c&&a.jsx(v,{...C})]}),Hi=Kn.Consumer(lf),cf=({summary:e,summaryClass:t})=>a.jsx("summary",{className:t,children:e}),df=({className:e,size:t,color:n,lined:s,border:r,radius:o,shaded:i,shadow:l,open:c,Summary:d=cf,Content:h=kr,...f})=>a.jsxs("details",{className:x(e,n,Ve(r),je(o),Be(l),{size:t,color:n,lined:s,shaded:i}),open:c,children:[a.jsx(d,{...f}),a.jsx(h,{...f})]}),uf={iconLeft:"angle-right",iconLeftRotate:90,iconRightRotate:-90},Ui=D(({native:e,open:t,Container:n=e?df:Hi,...s})=>a.jsx(Kn.Provider,{open:t,children:a.jsx(n,{...uf,...s})}),"Details"),hf=D(({items:e,shadow:t,radius:n,className:s,accordionClass:r="accordion",...o})=>a.jsx("div",{className:x(s,r,Be(t),je(n)),children:e.map((i,l)=>a.jsx(Ui,{radius:n,...o,...i},i.key??i.id??l))}),"Accordion"),ff=D(e=>a.jsx(Xh,{...$r(e)}),"Icons"),zi=D(({dismissable:e,dismiss:t,revealable:n,isRevealed:s,openIcon:r="angle-down",closedIcon:o="angle-left",dismissIcon:i="cross"})=>a.jsxs("div",{className:"on-right",children:[!!e&&a.jsx(H,{name:i,fixedWidth:!0,className:"dismiss",onClick:()=>t(!0)}),!!n&&a.jsx(H,{name:s?r:o,fixedWidth:!0,className:"reveal"})]}),"AlertControls"),gf=D(({headline:e,headIcon:t,headicon:n=t,toggle:s,revealable:r=!1,controlProps:o,Controls:i=zi})=>a.jsxs("div",{className:"headline flex space",onClick:r?s:null,children:[a.jsxs("div",{children:[!!n&&a.jsx(H,{name:n,fixedWidth:!0,className:"on-left"}),e]}),a.jsx(i,{...o})]}),"AlertHeadline"),Ki=D(({title:e,text:t,children:n})=>a.jsxs(a.Fragment,{children:[e&&a.jsx("h3",{children:e}),t?a.jsx("p",{children:t}):n]}),"AlertContent"),pf=D(({icon:e,Content:t=Ki,...n})=>a.jsxs("div",{className:"side-icon",children:[a.jsx(H,{name:e}),a.jsx("div",{className:"wide",children:a.jsx(t,{...n})})]}),"AlertIcon");function bf(e){return e.split(/\s*[;&]\s*/).filter(t=>t.length>0).reduce((t,n)=>{const[s,r]=n.split(/\s*[:=]\s*/);return t[s]=fi(r)?!0:r,t},{})}const _i="unknown",qi="mobile",Xi="tablet",Yi="laptop",Gi="desktop",Zi="widescreen",Ji="ultra",dn={[_i]:0,[qi]:480,[Xi]:720,[Yi]:960,[Gi]:1200,[Zi]:1440},vf={breakpoints:dn,largest:Ji},us=(e=0,t={})=>{const n={...vf,...t},s=Object.entries(n.breakpoints).find(([,r])=>e<=r);return s?s[0]:n.largest},Qi=(e=window)=>typeof e>"u"?!1:e.innerWidth,mf=(e,t)=>us(Qi(e),t),kt=e=>hi(e)||!e.separator&&!e.heading&&!e.disabled,Ir=e=>hi(e)?e:e.value??e.id,Er=(e,t,n=Ir)=>{if(Rn(t))return[];const s=n(t),r=e.findIndex(o=>s===n(o));return r>=0?[e[r],r]:[]},Ri=(e,t)=>{const n=e.toLowerCase().split(/\s+/);return t.filter(s=>{const r=ie(s),o=r?s.search??s.text??s.label??s.name??s.value:s;if(r&&s.fixed)return!0;if(I(o)){const i=o.toString().toLowerCase();return n.every(l=>i.indexOf(l)>=0)}return!1})};function ea(e,t=kt){const n=e.findIndex(t);return n<0?null:n}function ta(e,t=kt){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return null}function na(e,t,n=kt){for(let s=1;s<=e.length;s++){const r=(t+s)%e.length;if(n(e[r]))return r}return null}function sa(e,t,n=kt){for(let s=1;s<=e.length;s++){const r=(t+e.length-s)%e.length;if(n(e[r]))return r}return null}const ra=e=>e==null?void 0:e.stopPropagation(),oa={...dn,cols:!0},ia=e=>{const t={...e};return[ln(t,oa,{delete:!0}),t]},aa=(e,t)=>{const[n,s]=ia(e);return[la(n,t),s]},la=(e,t)=>{if(!t)return`grid-${e.cols||1}`;let n=e.cols||1;const s=Object.keys(dn),r=s.indexOf(t);if(r>=0){const i=s.slice(r).find(l=>e[l]);i&&(n=e[i])}return`grid-${n}`},Qe=e=>an(e)?e:parseFloat(e),hs=(e,t,n)=>Ot(e).find(s=>t[s]!==n[s]),fs=e=>t=>{e.forEach(n=>{bt(n)?n(t):n!=null&&(n.current=t)})},Re=e=>{const t=`HINT: define ${e}() to render this value`;return n=>Ae(n)||an(n)?n:ie(n)?n.text??n.label??n.name??n.heading??t:t},ca=e=>Ae(e)||an(e)?e:a.jsx(We,{...e}),Pr=(e,t)=>{if(!e||!t)return;const n=t.offsetTop,s=n+t.offsetHeight,r=e.scrollTop,o=r+e.offsetHeight;no&&e.scrollTo({top:r+(s-o)})},da=e=>{const t=e.match(/^(\d+)px$/);if(t)return parseInt(t[1]);const n=e.match(/^(\d+)rem$/);if(n)return parseInt(n[1]*16);const s=e.match(/^(\d+)$/);return s?parseInt(s[1]):dn[e]||es(`Invalid size specified: ${e}`)};function ua(){let e={};return{clear:()=>e={},getItem:t=>e[t],setItem:(t,n)=>e[t]=n,removeItem:t=>delete e[t]}}const un=typeof window<"u"&&window.localStorage||ua(),hn=(e,t)=>[e,t].join("-");function gs(e){return{get:(t,n)=>{const s=un.getItem(hn(e,t));return I(s)?JSON.parse(s):I(n)?(un.setItem(hn(e,t),JSON.stringify(n)),n):null},set:(t,n)=>un.setItem(hn(e,t),JSON.stringify(n)),delete:t=>un.removeItem(hn(e,t))}}const Fr=e=>e.charAt(0).toUpperCase()+e.slice(1),Cf=(e={},t={})=>Object.entries(t).reduce((n,[s,r])=>{const o=n[s];if(!o)return n;const l={...r[o]||es(`Invalid themedProps() value for ${s}: ${o}`),...n};return delete l[s],l},e),yf=(e,t,n={})=>{const s=e.variant||Object.keys(t).find(r=>e[r])||"default";return t[s]||t.default||n},He=({title:e,headline:t,headicon:n,headIcon:s=n,type:r,size:o,color:i,compact:l,stripe:c,border:d,radius:h,shadow:f,className:p,text:g,children:m,onDismiss:v,icon:C,dismissable:y=!1,revealable:w=!1,revealed:S=!1,openIcon:L,closedIcon:M,dismissIcon:O,Headline:N=gf,Controls:$=zi,Content:E=Ki,Icon:T=pf})=>{const[k,W]=b.useState(w?S:!0),[B,K]=b.useState(!1),Te=x("alert",r,o,i,p,{compact:l,revealable:w,dismissable:y,stripe:c},k?"revealed":null,Be(f),Ve(d),je(h)),re=()=>W(ee=>!ee),_={dismissable:y,revealable:w,isRevealed:k,dismiss:()=>{K(!0),v&&v()},openIcon:L,closedIcon:M,dismissIcon:O},ne={title:e,text:g,children:m},oe={...ne,icon:C,Content:E},Jt={headline:t,headIcon:s,toggle:re,revealable:w,controlProps:_,Controls:$};return B?null:a.jsxs("div",{className:Te,children:[!!t&&a.jsx(N,{...Jt}),k&&(C?a.jsx(T,{...oe}):a.jsx(E,{...ne}))]})},ha=D(e=>a.jsx(He,{...e,type:"info"}),"Info"),fa=D(e=>a.jsx(He,{...e,type:"success"}),"Success"),ga=D(e=>a.jsx(He,{...e,type:"warning"}),"Warning"),pa=D(e=>a.jsx(He,{...e,type:"error"}),"Error");He.Info=ha,He.Success=fa,He.Warning=ga,He.Error=pa;const Sf=D(He,"Alert"),wf=D(({size:e,color:t,compact:n,className:s,tag:r,shadow:o,border:i,radius:l,tooltip:c,icon:d,iconClass:h,iconLeft:f,iconLeftClass:p,iconRight:g,iconRightClass:m,label:v,text:C,children:y,Content:w=We,...S})=>{const L=x("badge",e,t,s,{compact:n,tag:r,icon:d},Be(o),Ve(i),je(l)),M={icon:d,iconClass:h,iconLeft:f,iconLeftClass:p,iconRight:g,iconRightClass:m,text:C,children:y};return a.jsx("div",{className:L,"data-tooltip":c,"aria-label":v,...S,children:a.jsx(w,{...M})})},"Badge"),ae=D(({type:e="button",size:t,color:n,className:s,disabled:r,bright:o,dark:i,outline:l,bare:c,shaded:d,shadow:h,border:f,radius:p,label:g,tooltip:m,tabIndex:v=0,icon:C,iconClass:y,iconLeft:w,iconLeftClass:S,iconRight:L,iconRightClass:M,text:O,children:N,Content:$=We,...E})=>{const T=x(t,n,s,{bright:o,dark:i,outline:l,bare:c,shaded:d,icon:C},Be(h),Ve(f),je(p)),k={icon:C,iconClass:y,iconLeft:w,iconLeftClass:S,iconRight:L,iconRightClass:M,text:O,children:N};return a.jsx("button",{className:T,"aria-label":g,tabIndex:v,type:e,disabled:r,"aria-disabled":r,"data-tooltip":m,...E,children:a.jsx($,{...k})})},"Button"),ps=D(({buttons:e,children:t,className:n="buttons",buttonClass:s,Button:r=ae,...o})=>a.jsx("div",{className:n,children:e?e.map((i,l)=>a.jsx(r,{className:s,...o,...i},l)):t}),"Buttons"),Mf=D(({className:e,disabled:t,children:n,ref:s})=>a.jsx("label",{className:x(e,{disabled:t}),ref:s,children:n}),"CheckboxLabel"),Lf=D(({disabled:e=!1,tabIndex:t=0,onChange:n=F,inputClass:s,round:r,square:o,ref:i,switch:l,...c})=>a.jsx("input",{type:"checkbox",ref:i,"aria-disabled":e,tabIndex:e?-1:t,onChange:d=>n(d.target.checked),className:x(s,{round:r,square:o}),role:l?"switch":null,...c}),"CheckboxInput"),Ar=D(({size:e,color:t,border:n,inline:s,className:r="checkbox",text:o,ref:i,inputRef:l,checked:c,checkedText:d=o,uncheckedText:h=o,Label:f=Mf,Input:p=Lf,...g})=>a.jsxs(f,{className:x(e,t,r,Ve(n),{inline:s}),ref:i,checked:c,...g,children:[a.jsx(p,{ref:l,checked:c,...g}),c?d:h]}),"Checkbox"),ba=({checked:e=!1}={})=>{const[t,n]=b.useState(e);return{isChecked:t,setChecked:n,check:()=>n(!0),uncheck:()=>n(!1)}},Nf=({checked:e=!1,onChange:t,...n})=>{const{isChecked:s,setChecked:r}=ba({checked:e}),o=i=>{r(i),t&&t(i)};return a.jsx(Ar,{checked:s,onChange:o,...n})},bs=({visible:e=!1}={})=>{const[t,n]=b.useState(e);return{isVisible:t,setVisible:n,show:()=>n(!0),hide:()=>n(!1)}},va=D(({close:e,icon:t="cross",className:n="close"})=>a.jsx("div",{className:n,onClick:e,children:a.jsx(H,{name:t})}),"ModalClose"),ma=D(({title:e,header:t})=>e||t?a.jsxs("header",{children:[!!e&&a.jsx("h3",{children:e}),t]}):null,"ModalHeader"),Ca=D(({footer:e})=>!!e&&a.jsx("footer",{children:e}),"ModalFooter"),ya=D(({text:e,children:t,Header:n=ma,Footer:s=Ca,...r})=>a.jsxs("article",{onClick:ra,children:[a.jsx(n,{...r}),e||t,a.jsx(s,{...r})]}),"ModalContent"),Vr=D(({ref:e,open:t,close:n,className:s,closeClass:r="close",closeIcon:o="cross",Close:i=va,Content:l=ya,closeOnClick:c,onClick:d=c?n:null,onCancel:h=n||F,style:f={},maxWidth:p,maxHeight:g,...m})=>{e||(e=b.useRef(null)),b.useEffect(()=>{const{current:C}=e;t?C.showModal():C.close()},[t]);const v={...f};return p&&(v["--max-width"]=p),g&&(v["--max-height"]=g),a.jsxs("dialog",{ref:e,className:s,style:v,onClick:d,onCancel:h,children:[!!n&&a.jsx(i,{close:n,icon:o,className:r}),a.jsx(l,{...m})]})},"Modal"),Df=({isVisible:e,title:t,header:n,prompt:s,modalClass:r,...o})=>a.jsx(Vr,{...o,open:e,title:t,header:n,className:r,text:s??a.jsx(Sa,{...o}),footer:!!s&&a.jsx(Sa,{...o})}),Sa=({buttonClass:e,cancel:t,confirm:n})=>a.jsxs("div",{className:"flex space gap-4",children:[a.jsx(ae,{className:e,...t}),a.jsx(ae,{className:e,...n})]}),xf=D(({initiallyRevealed:e=!1,open:t=e,confirmIcon:n="check",confirmText:s="Confirm",confirmColor:r="red",confirmClass:o,cancelIcon:i="cross",cancelText:l="Cancel",cancelColor:c="grey",cancelClass:d,confirm:h={iconRight:n,text:s,color:r,className:o},cancel:f={iconLeft:i,text:l,color:c,className:d},buttonsClass:p,className:g=p,buttonClass:m,modal:v,modalClass:C,onClick:y=()=>window.alert("No confirm action defined"),...w})=>{const{isVisible:S,hide:L,show:M}=bs({visible:t}),N={iconRight:n,text:s,color:r,className:o,...h,onClick:E=>{E.preventDefault(),L(),y()}},$={iconLeft:i,text:l,color:c,className:d,outline:!0,...f,onClick:L};return v?a.jsxs(a.Fragment,{children:[a.jsx(ps,{className:g,buttonClass:m,buttons:[{...w,onClick:M}]}),a.jsx(Df,{isVisible:S,confirm:N,cancel:$,modalClass:C,...w})]}):a.jsx(ps,{className:g,buttonClass:m,buttons:S?[$,N]:[{...w,onClick:M}]})},"Confirm"),$f=e=>{const t=e,n="text",s=Mr(t);return{field:t,type:n,label:s}},vs=e=>{Ae(e)&&(e={field:e});const{field:t}=e;return e.type||(e.type="text"),e.label||(e.label=Mr(t)),e.heading||(e.heading=e.label),e.id||(e.id=t),e.sortable??(e.sortable=!0),e.filterable??(e.filterable=!0),e},wa=e=>{if(Ae(e))return mt(e,vs);if(Me(e))return e.reduce((t,n)=>{const s=vs(n);return t[s.field]=s,t},{});if(ie(e))return Object.entries(e).reduce((t,[n,s])=>{if(pt(s)&&!s)return t;const r=vs({...ie(s)?s:{},field:n});return t[r.field]=r,t},{});es("Invalid columns definition")},Ma=(e,t)=>{if(t){const n=t.filter(s=>e[s]);if(n.length)return n}return Object.keys(e).filter(n=>!e[n].hidden)},La=(e,t)=>{if(t){const n=t.filter(r=>e[r]),s=mt(n);if(n.push(...Object.keys(e).filter(r=>!s[r])),n.length)return n}return Object.keys(e)},Na=(e,t,n)=>t&&e[t]?[t,n]:[null,null],Da=({value:e,search:t})=>I(e)?e.toString()===t.toString():!1,Ct=({value:e,search:t})=>{const n=t.toLowerCase().split(/\s+/);if(I(e)){const s=e.toString().toLowerCase();return n.every(r=>s.indexOf(r)>-1)}else return!1},xa=({value:e,search:t})=>I(e)?parseInt(e)===parseInt(t):!1,$a=({value:e,search:t})=>I(e)?parseFloat(e)===parseFloat(t):!1,ms=e=>Ae(e)?!!parseInt(e):!!e,Ta=({value:e=!1,search:t})=>ms(e)===ms(t),Br={string:Ct,text:Ct,id:Ct,number:Ct,price:Ct,pounds:Ct,select:Da,boolean:Ta,integer:xa,float:$a},Oa=(e,t,n)=>{const s=Object.keys(n).filter(r=>t[r]);return s.length===0?e:e.filter(r=>s.every(o=>{const i=n[o],l=t[o],c=l.field||o,d=r[c],h=l.filterType||l.type,f=l.filter||Br[h]||Br.text;return I(i)&&(pt(i)||i.length)?f({row:r,field:c,value:d,search:i}):!0}))},ka=(e,t=1,n=e.length)=>{const s=e.length,r=Math.ceil(s/n);t=Math.min(t,r);const o=t-1,i=n*o,l=Math.min(i+n-1,s-1),c=e.slice(i,l+1);return{pageSize:n,pages:r,page:o,pageNo:t,total:s,firstIndex:i,lastIndex:l,firstPage:1,lastPage:r,thisSize:c.length,from:i+1,to:l+1,all:i===l,one:s===1,none:s===0,rows:c}},jr={string:Dr,text:Dr,select:Dr,number:Nr,price:Nr,currency:Nr,integer:yi,id:yi},Ia=(e,t,n,s)=>{if(!n||!t[n])return e;const r=t[n],o=r.sort,i=r.type||"text",l=bt(o)?o:(jr[i]||jr.text)(n);return e.sort(s?sf(l):l)},z=Ie(({render:e,rows:t=[],storageKey:n,storageItem:s="state",debug:r,...o})=>{const i=r?console.log:F,[l,c]=b.useMemo(()=>{const T=n&&gs(n),k=T?T.get(s,{}):{};return[T,k]},[n]),[d,h,f,p,g]=b.useMemo(()=>{i("computing columns: ",o.columns);const T=wa(o.columns);return[T,Ma(T,c.visibleColumns),La(T,c.columnOrder),...Na(T,c.sortColumn??o.sortColumn,c.sortReverse??o.sortReverse)]},[o.columns,o.sortColumn,o.sortReverse,c]),[m,v]=Wu({pageNo:c.pageNo??o.pageNo??1,pageSize:c.pageSize??o.pageSize??10,sortColumn:p,sortReverse:g,columnOrder:f,visibleColumns:h});b.useEffect(()=>{i("columns have changed: ",d),v.setSortColumn(p),v.setSortReverse(g),v.setColumnOrder(f),v.setVisibleColumns(h)},[p,g,f,h]),b.useEffect(()=>{l&&(i("Saving state in local storage:",m),l.set(s,m))},[m,l]);const C=T=>{m.sortColumn===T?(i(`Sort column already set to ${T}, changing direction`),v.setSortReverse(k=>!k)):(i(`Setting sort column to ${T}`),v.setSortColumn(T),v.setSortReverse(!1))},y=T=>v.setVisibleColumns(k=>{const W=mt(k),B=W[T]?k.filter(K=>K!==T):Object.keys(d).filter(K=>K===T||W[K]);return i("New visible columns:",B),B}),w=T=>{let k=[],W=[];const B=mt(m.visibleColumns);T.forEach(K=>{k.push(K),B[K]&&W.push(K)}),i("New order of all columns:",k),i("New order of visible columns:",W),v.setVisibleColumns(W),v.setColumnOrder(k)},[S,L]=b.useState(!1),[M,O]=b.useState({}),N=T=>{T.preventDefault(),T.stopPropagation(),L(k=>!k)},$=(T,k)=>{O(W=>{const B={...W};return I(k)&&(pt(k)||k.length)?B[T]=k:delete B[T],B}),v.setPageNo(1)},E=b.useMemo(()=>ka(Ia(Oa(t,d,M),d,m.sortColumn,m.sortReverse),m.pageNo,m.pageSize),[t,d,M,m.sortColumn,m.sortReverse,m.pageNo,m.pageSize]);return e({...o,rows:t,columns:d,page:E,showFilters:S,toggleFilters:N,filters:M,setFilter:$,hasFilters:Object.keys(M).length,toggleSortColumn:C,toggleVisibleColumn:y,changeColumnOrder:w,...m,...v})}),Tf=z.Use,Of=z.Consumer,kf=({page:e,summaryClass:t="flex center balance mar-b-2"})=>a.jsxs("div",{className:t,children:["Page ",e.pageNo,"/",e.lastPage," ",e.none?"no rows":e.one?"one row":e.all?`all ${Tt(e.total)} rows`:`rows ${Tt(e.from)}-${Tt(e.to)} of ${Tt(e.total)}`," "]}),Ea=z.Consumer(kf),If="-",yt="",St="any",Pa="ArrowLeft",Fa="ArrowRight",fn="ArrowUp",gn="ArrowDown",Aa="Tab",pn="Enter",Cs=" ",bn="Escape",Va="Backspace",Wr="True",Hr="False",Ef=512,Pf=512;let Ba=(qe=class extends gt{componentDidMount(){this.mounted=!0,this.props.onLoad(this)}componentWillUnmount(){this.mounted=!1,this.props.onUnload(this)}onMouseEnter(){this.debug("onMouseEnter()"),this.setState({hasHover:!0},this.props.openOnHover?()=>{this.open(),this.focusTrigger()}:null)}onMouseLeave(){this.debug("onMouseLeave()"),this.setState({hasHover:!1},this.props.openOnHover?()=>this.closeSoon():null)}onFocus(){this.debug("onFocus()"),this.setState({hasFocus:!0},this.props.onFocus)}onBlur(){this.debug("onBlur()"),this.setState({hasFocus:!1},this.props.onBlur),this.props.closeOnBlur&&this.closeSoon()}onClick(){this.debug("onClick()"),this.state.isOpen?this.close():this.open()}open(){this.debug("open()"),this.setState({isOpen:!0},this.props.onOpen)}close(){this.debug("close()"),this.setState(this.closeState(),this.props.onClose)}closeState(){return this.constructor.inactiveState}closeSoon(t=!1){this.debug(`closeSoon() force:${t}`),xr(this.props.closeDelay).then(()=>{this.closeable(t)?this.close():this.debug(`NOT closing force:${t} hasHover:${this.state.hasHover}`)})}closeable(t){return t||!this.state.hasHover}onKeyDown(t){switch(this.debug(`onKeyDown(${t.key})`),t.key){case pn:case Cs:this.state.isOpen?this.close():this.open();break;case bn:this.close();break;default:this.debug(`ignored key ${t.key}`);return}t.preventDefault()}triggerRef(t){this._triggerRef=t}focusTrigger(){this._triggerRef?(this.debug("focussing trigger"),this._triggerRef.focus()):this.debug("no trigger to focus")}},P(qe,"debug",!1),P(qe,"defaultProps",{options:[],openOnHover:!1,closeOnBlur:!0,closeDelay:300,onLoad:F,onUnload:F,onFocus:F,onBlur:F,onClick:F,onOpen:F,onClose:F}),P(qe,"inactiveState",{isOpen:!1}),P(qe,"initialState",{...qe.inactiveState}),qe);const Dt=class Dt extends Ba{open(t=this.initialCursor()??this.cursorFirstIndex()){this.debug(`open(${t})`),this.setState({isOpen:!0,cursor:t},this.props.onOpen)}onKeyDown(t){switch(this.debug(`onKeyDown(${t.key})`),this.debug("alt: ",t.altKey),this.debug("ctrl: ",t.ctrlKey),this.debug("meta: ",t.metaKey),t.key){case gn:this.state.isOpen?this.setCursor(this.cursorNextIndex()):this.open(this.initialCursor()??this.cursorFirstIndex());break;case fn:this.state.isOpen?this.setCursor(this.cursorPrevIndex()):this.open(this.initialCursor()??this.cursorLastIndex());break;case pn:case Cs:this.state.isOpen?this.selectCursor():this.open(this.initialCursor()??this.cursorFirstIndex());break;case bn:this.close();break;default:this.debug(`ignored key ${t.key}`);return}t.preventDefault()}menuOptions(){return this.props.options}initialCursor(){return null}cursorFirstIndex(){return ea(this.menuOptions(),this.props.validOption)}cursorLastIndex(){return ta(this.menuOptions(),this.props.validOption)}cursorNextIndex(){return na(this.menuOptions(),this.state.cursor,this.props.validOption)}cursorPrevIndex(){return sa(this.menuOptions(),this.state.cursor,this.props.validOption)}setCursor(t){this.debug(`setCursor(${t})`),this.setState({cursor:t})}selectCursor(){this.debug("selectCursor()");const{cursor:t}=this.state,n=this.menuOptions();if(n&&n.length&&I(t)){const s=n[t];this.debug(`selectCursor() ${t} =>`,s),this.selectOption(s)}else this.debug("Not selecting: cursor out of range")}selectOption(t){this.debug("selectOption()",t),this.setState(this.selectState(t),()=>this.props.onSelect(t)),this.props.closeOnSelect?(this.debug("closeOnSelect is set, closing"),this.closeSoon(!0)):this.debug("closeOnSelect is not set, NOT closing")}selectState(t){return{selected:t}}menuRef(t){this._menuRef=t}activeRef(t){Pr(this._menuRef,t)}};P(Dt,"debug",!1),P(Dt,"defaultProps",{options:[],openOnHover:!1,closeOnBlur:!0,closeDelay:300,onLoad:F,onUnload:F,onFocus:F,onBlur:F,onClick:F,onOpen:F,onClose:F,onSelect:F,closeOnSelect:!0}),P(Dt,"inactiveState",{isOpen:!1,cursor:void 0,selected:void 0}),P(Dt,"initialState",{...Dt.inactiveState});let ys=Dt,Ff=($e=class extends ys{},P($e,"debug",!1),P($e,"debugPrefix","Dropdown > "),P($e,"debugColor","MediumVioletRed"),P($e,"defaultProps",{...$e.defaultProps,options:[],displayOption:ca}),P($e,"actions",["onMouseEnter","onMouseLeave","onFocus","onBlur","onClick","onKeyDown","open","close","setCursor","selectCursor","selectOption","triggerRef","menuRef","activeRef"]),$e);const wt=Ie(Ff),Af=wt.Use,Vf=({triggerClass:e="trigger",triggerRef:t,triggerColor:n,triggerSize:s,button:r,icon:o,floatingRef:i,safeAreaClass:l="safe-area",onMouseEnter:c,onMouseLeave:d,onKeyDown:h,onFocus:f,onBlur:p,onClick:g,...m})=>a.jsxs("div",{className:x(e,n,s,{button:r,icon:o}),onClick:g,onMouseEnter:c,onMouseLeave:d,onKeyDown:h,onFocus:f,onBlur:p,tabIndex:0,ref:fs([t,i]),children:[a.jsx(We,{icon:o,...ln(m,/^(icon|text)/)}),a.jsx("div",{className:l})]}),ja=wt.Consumer(Vf),Bf=({option:e,active:t,activeRef:n,selected:s,onClick:r,onMouseEnter:o,optionClass:i="item no-hover",activeClass:l="active",selectedClass:c="selected",disabledClass:d="disabled",displayOption:h})=>a.jsx("div",{className:x(i,e.className,e.indent?`indent-${e.indent}`:null,t?l:null,s?c:null,e.disabled?d:null),onMouseEnter:o,onClick:r,ref:t?n:null,"aria-disabled":e.disabled,children:h(e)}),Wa=wt.Consumer(Bf),Ha=({option:e,separatorClass:t="separator"})=>a.jsx("div",{className:x(t,e.className)}),Ua=({option:e,optionClass:t="item no-hover",headingClass:n="heading"})=>a.jsx("h4",{className:x(n,t,e.className),children:e.heading}),jf=({options:e=[],menuClass:t="menu border bdr-1",menuRef:n,floatingRef:s,floatingStyle:r,cursor:o,selected:i,selectOption:l,setCursor:c,onMouseEnter:d,onMouseLeave:h,Option:f=Wa,Separator:p=Ha,Heading:g=Ua})=>a.jsx("div",{className:t,ref:fs([n,s]),onMouseEnter:d,onMouseLeave:h,style:r,children:e.map((m,v)=>m.separator?a.jsx(p,{option:m},v):m.heading?a.jsx(g,{option:m},v):a.jsx(f,{option:m,active:I(o)&&e[o]===m,selected:i===m,onClick:()=>l(m),onMouseEnter:()=>c(v)},m.id??m.value??v))}),za=wt.Consumer(jf);function Ss(){return typeof window<"u"}function It(e){return Ka(e)?(e.nodeName||"").toLowerCase():"#document"}function le(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ue(e){var t;return(t=(Ka(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ka(e){return Ss()?e instanceof Node||e instanceof le(e).Node:!1}function R(e){return Ss()?e instanceof Element||e instanceof le(e).Element:!1}function Le(e){return Ss()?e instanceof HTMLElement||e instanceof le(e).HTMLElement:!1}function _a(e){return!Ss()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof le(e).ShadowRoot}function vn(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function Wf(e){return["table","td","th"].includes(It(e))}function ws(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ur(e){const t=zr(),n=R(e)?ve(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function Hf(e){let t=et(e);for(;Le(t)&&!Et(t);){if(Ur(t))return t;if(ws(t))return null;t=et(t)}return null}function zr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Et(e){return["html","body","#document"].includes(It(e))}function ve(e){return le(e).getComputedStyle(e)}function Ms(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function et(e){if(It(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_a(e)&&e.host||Ue(e);return _a(t)?t.host:t}function qa(e){const t=et(e);return Et(t)?e.ownerDocument?e.ownerDocument.body:e.body:Le(t)&&vn(t)?t:qa(t)}function Kr(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=qa(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=le(r);if(o){const l=_r(i);return t.concat(i,i.visualViewport||[],vn(r)?r:[],l&&n?Kr(l):[])}return t.concat(r,Kr(r,[],n))}function _r(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ls=Math.min,me=Math.max,Ns=Math.round,tt=e=>({x:e,y:e});function qr(e,t){return typeof e=="function"?e(t):e}function Ds(e){return e.split("-")[0]}function Xr(e){return e.split("-")[1]}function Uf(e){return e==="x"?"y":"x"}function zf(e){return e==="y"?"height":"width"}function xs(e){return["top","bottom"].includes(Ds(e))?"y":"x"}function Kf(e){return Uf(xs(e))}function _f(e){return{top:0,right:0,bottom:0,left:0,...e}}function qf(e){return typeof e!="number"?_f(e):{top:e,right:e,bottom:e,left:e}}function $s(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function Xa(e,t,n){let{reference:s,floating:r}=e;const o=xs(t),i=Kf(t),l=zf(i),c=Ds(t),d=o==="y",h=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,p=s[l]/2-r[l]/2;let g;switch(c){case"top":g={x:h,y:s.y-r.height};break;case"bottom":g={x:h,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-r.width,y:f};break;default:g={x:s.x,y:s.y}}switch(Xr(t)){case"start":g[i]-=p*(n&&d?-1:1);break;case"end":g[i]+=p*(n&&d?-1:1);break}return g}const Xf=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,l=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:h,y:f}=Xa(d,s,c),p=s,g={},m=0;for(let v=0;v{},...d}=qr(e,t),h=await Yf(t,d),f=Ds(r),p=Xr(r),g=xs(r)==="y",{width:m,height:v}=o.floating;let C,y;f==="top"||f==="bottom"?(C=f,y=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=f,C=p==="end"?"top":"bottom");const w=v-h.top-h.bottom,S=m-h.left-h.right,L=Ls(v-h[C],w),M=Ls(m-h[y],S),O=!t.middlewareData.shift;let N=L,$=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(N=w),O&&!p){const T=me(h.left,0),k=me(h.right,0),W=me(h.top,0),B=me(h.bottom,0);g?$=m-2*(T!==0||k!==0?T+k:me(h.left,h.right)):N=v-2*(W!==0||B!==0?W+B:me(h.top,h.bottom))}await c({...t,availableWidth:$,availableHeight:N});const E=await i.getDimensions(l.floating);return m!==E.width||v!==E.height?{reset:{rects:!0}}:{}}}};function Ya(e){const t=ve(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Le(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,l=Ns(n)!==o||Ns(s)!==i;return l&&(n=o,s=i),{width:n,height:s,$:l}}function Ga(e){return R(e)?e:e.contextElement}function Pt(e){const t=Ga(e);if(!Le(t))return tt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Ya(t);let i=(o?Ns(n.width):n.width)/s,l=(o?Ns(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Qf=tt(0);function Za(e){const t=le(e);return!zr()||!t.visualViewport?Qf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==le(e)?!1:t}function mn(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=Ga(e);let i=tt(1);t&&(s?R(s)&&(i=Pt(s)):i=Pt(e));const l=Rf(o,n,s)?Za(o):tt(0);let c=(r.left+l.x)/i.x,d=(r.top+l.y)/i.y,h=r.width/i.x,f=r.height/i.y;if(o){const p=le(o),g=s&&R(s)?le(s):s;let m=p,v=_r(m);for(;v&&s&&g!==m;){const C=Pt(v),y=v.getBoundingClientRect(),w=ve(v),S=y.left+(v.clientLeft+parseFloat(w.paddingLeft))*C.x,L=y.top+(v.clientTop+parseFloat(w.paddingTop))*C.y;c*=C.x,d*=C.y,h*=C.x,f*=C.y,c+=S,d+=L,m=le(v),v=_r(m)}}return $s({width:h,height:f,x:c,y:d})}function eg(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=Ue(s),l=t?ws(t.floating):!1;if(s===i||l&&o)return n;let c={scrollLeft:0,scrollTop:0},d=tt(1);const h=tt(0),f=Le(s);if((f||!f&&!o)&&((It(s)!=="body"||vn(i))&&(c=Ms(s)),Le(s))){const p=mn(s);d=Pt(s),h.x=p.x+s.clientLeft,h.y=p.y+s.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+h.x,y:n.y*d.y-c.scrollTop*d.y+h.y}}function tg(e){return Array.from(e.getClientRects())}function Yr(e,t){const n=Ms(e).scrollLeft;return t?t.left+n:mn(Ue(e)).left+n}function ng(e){const t=Ue(e),n=Ms(e),s=e.ownerDocument.body,r=me(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=me(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+Yr(e);const l=-n.scrollTop;return ve(s).direction==="rtl"&&(i+=me(t.clientWidth,s.clientWidth)-r),{width:r,height:o,x:i,y:l}}function sg(e,t){const n=le(e),s=Ue(e),r=n.visualViewport;let o=s.clientWidth,i=s.clientHeight,l=0,c=0;if(r){o=r.width,i=r.height;const d=zr();(!d||d&&t==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:o,height:i,x:l,y:c}}function rg(e,t){const n=mn(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=Le(e)?Pt(e):tt(1),i=e.clientWidth*o.x,l=e.clientHeight*o.y,c=r*o.x,d=s*o.y;return{width:i,height:l,x:c,y:d}}function Ja(e,t,n){let s;if(t==="viewport")s=sg(e,n);else if(t==="document")s=ng(Ue(e));else if(R(t))s=rg(t,n);else{const r=Za(e);s={...t,x:t.x-r.x,y:t.y-r.y}}return $s(s)}function Qa(e,t){const n=et(e);return n===t||!R(n)||Et(n)?!1:ve(n).position==="fixed"||Qa(n,t)}function og(e,t){const n=t.get(e);if(n)return n;let s=Kr(e,[],!1).filter(l=>R(l)&&It(l)!=="body"),r=null;const o=ve(e).position==="fixed";let i=o?et(e):e;for(;R(i)&&!Et(i);){const l=ve(i),c=Ur(i);!c&&l.position==="fixed"&&(r=null),(o?!c&&!r:!c&&l.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||vn(i)&&!c&&Qa(e,i))?s=s.filter(h=>h!==i):r=l,i=et(i)}return t.set(e,s),s}function ig(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ws(t)?[]:og(t,this._c):[].concat(n),s],l=i[0],c=i.reduce((d,h)=>{const f=Ja(t,h,r);return d.top=me(f.top,d.top),d.right=Ls(f.right,d.right),d.bottom=Ls(f.bottom,d.bottom),d.left=me(f.left,d.left),d},Ja(t,l,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ag(e){const{width:t,height:n}=Ya(e);return{width:t,height:n}}function lg(e,t,n){const s=Le(t),r=Ue(t),o=n==="fixed",i=mn(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=tt(0);if(s||!s&&!o)if((It(t)!=="body"||vn(r))&&(l=Ms(t)),s){const g=mn(t,!0,o,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else r&&(c.x=Yr(r));let d=0,h=0;if(r&&!s&&!o){const g=r.getBoundingClientRect();h=g.top+l.scrollTop,d=g.left+l.scrollLeft-Yr(r,g)}const f=i.left+l.scrollLeft-c.x-d,p=i.top+l.scrollTop-c.y-h;return{x:f,y:p,width:i.width,height:i.height}}function Gr(e){return ve(e).position==="static"}function Ra(e,t){if(!Le(e)||ve(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ue(e)===n&&(n=n.ownerDocument.body),n}function el(e,t){const n=le(e);if(ws(e))return n;if(!Le(e)){let r=et(e);for(;r&&!Et(r);){if(R(r)&&!Gr(r))return r;r=et(r)}return n}let s=Ra(e,t);for(;s&&Wf(s)&&Gr(s);)s=Ra(s,t);return s&&Et(s)&&Gr(s)&&!Ur(s)?n:s||Hf(e)||n}const cg=async function(e){const t=this.getOffsetParent||el,n=this.getDimensions,s=await n(e.floating);return{reference:lg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function dg(e){return ve(e).direction==="rtl"}const ug={convertOffsetParentRelativeRectToViewportRelativeRect:eg,getDocumentElement:Ue,getClippingRect:ig,getOffsetParent:el,getElementRects:cg,getClientRects:tg,getDimensions:ag,getScale:Pt,isElement:R,isRTL:dg},hg=Zf,fg=Jf,gg=(e,t,n)=>{const s=new Map,r={platform:ug,...n},o={...r.platform,_c:s};return Xf(e,t,{...r,platform:o})};var Ts=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Os(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Os(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const o=r[s];if(!(o==="_owner"&&e.$$typeof)&&!Os(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function tl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nl(e,t){const n=tl(e);return Math.round(t*n)/n}function Zr(e){const t=A.useRef(e);return Ts(()=>{t.current=e}),t}function pg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[h,f]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=A.useState(s);Os(p,s)||g(s);const[m,v]=A.useState(null),[C,y]=A.useState(null),w=A.useCallback(_=>{_!==O.current&&(O.current=_,v(_))},[]),S=A.useCallback(_=>{_!==N.current&&(N.current=_,y(_))},[]),L=o||m,M=i||C,O=A.useRef(null),N=A.useRef(null),$=A.useRef(h),E=c!=null,T=Zr(c),k=Zr(r),W=Zr(d),B=A.useCallback(()=>{if(!O.current||!N.current)return;const _={placement:t,strategy:n,middleware:p};k.current&&(_.platform=k.current),gg(O.current,N.current,_).then(ne=>{const oe={...ne,isPositioned:W.current!==!1};K.current&&!Os($.current,oe)&&($.current=oe,Zu.flushSync(()=>{f(oe)}))})},[p,t,n,k,W]);Ts(()=>{d===!1&&$.current.isPositioned&&($.current.isPositioned=!1,f(_=>({..._,isPositioned:!1})))},[d]);const K=A.useRef(!1);Ts(()=>(K.current=!0,()=>{K.current=!1}),[]),Ts(()=>{if(L&&(O.current=L),M&&(N.current=M),L&&M){if(T.current)return T.current(L,M,B);B()}},[L,M,B,T,E]);const Te=A.useMemo(()=>({reference:O,floating:N,setReference:w,setFloating:S}),[w,S]),re=A.useMemo(()=>({reference:L,floating:M}),[L,M]),J=A.useMemo(()=>{const _={position:n,left:0,top:0};if(!re.floating)return _;const ne=nl(re.floating,h.x),oe=nl(re.floating,h.y);return l?{..._,transform:"translate("+ne+"px, "+oe+"px)",...tl(re.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:oe}},[n,l,re.floating,h.x,h.y]);return A.useMemo(()=>({...h,update:B,refs:Te,elements:re,floatingStyles:J}),[h,B,Te,re,J])}const bg=(e,t)=>({...hg(e),options:[e,t]}),vg=(e,t)=>({...fg(e),options:[e,t]}),sl={...A},mg=sl.useInsertionEffect||(e=>e());function Cg(e){const t=A.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return mg(()=>{t.current=e}),A.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r"floating-ui-"+Math.random().toString(36).slice(2,6)+yg++;function Sg(){const[e,t]=A.useState(()=>rl?ol():void 0);return Jr(()=>{e==null&&t(ol())},[]),A.useEffect(()=>{rl=!0},[]),e}const wg=sl.useId||Sg;let Qr;process.env.NODE_ENV!=="production"&&(Qr=new Set);function Mg(){for(var e,t=arguments.length,n=new Array(t),s=0;sr(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var s;e.set(t,((s=e.get(t))==null?void 0:s.filter(r=>r!==n))||[])}}}const Ng=A.createContext(null),Dg=A.createContext(null),xg=()=>{var e;return((e=A.useContext(Ng))==null?void 0:e.id)||null},$g=()=>A.useContext(Dg);function Tg(e){const{open:t=!1,onOpenChange:n,elements:s}=e,r=wg(),o=A.useRef({}),[i]=A.useState(()=>Lg()),l=xg()!=null;if(process.env.NODE_ENV!=="production"){const g=s.reference;g&&!R(g)&&Mg("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[c,d]=A.useState(s.reference),h=Cg((g,m,v)=>{o.current.openEvent=g?m:void 0,i.emit("openchange",{open:g,event:m,reason:v,nested:l}),n==null||n(g,m,v)}),f=A.useMemo(()=>({setPositionReference:d}),[]),p=A.useMemo(()=>({reference:c||s.reference||null,floating:s.floating||null,domReference:s.reference}),[c,s.reference,s.floating]);return A.useMemo(()=>({dataRef:o,open:t,onOpenChange:h,elements:p,events:i,floatingId:r,refs:f}),[t,h,p,i,r,f])}function Og(e){e===void 0&&(e={});const{nodeId:t}=e,n=Tg({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||n,r=s.elements,[o,i]=A.useState(null),[l,c]=A.useState(null),h=(r==null?void 0:r.reference)||o,f=A.useRef(null),p=$g();Jr(()=>{h&&(f.current=h)},[h]);const g=pg({...e,elements:{...r,...l&&{reference:l}}}),m=A.useCallback(S=>{const L=R(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;c(L),g.refs.setReference(L)},[g.refs]),v=A.useCallback(S=>{(R(S)||S===null)&&(f.current=S,i(S)),(R(g.refs.reference.current)||g.refs.reference.current===null||S!==null&&!R(S))&&g.refs.setReference(S)},[g.refs]),C=A.useMemo(()=>({...g.refs,setReference:v,setPositionReference:m,domReference:f}),[g.refs,v,m]),y=A.useMemo(()=>({...g.elements,domReference:h}),[g.elements,h]),w=A.useMemo(()=>({...g,...s,refs:C,elements:y,nodeId:t}),[g,C,y,t,s]);return Jr(()=>{s.dataRef.current.floatingContext=w;const S=p==null?void 0:p.nodesRef.current.find(L=>L.id===t);S&&(S.context=w)}),A.useMemo(()=>({...g,context:w,refs:C,elements:y}),[g,C,y,w])}const il=e=>vg({apply({rects:t,elements:n}){Object.assign(n.floating.style,e(t.reference))}}),kg=il(e=>({width:`${e.width}px`})),Ig=il(e=>({height:`${e.height}px`})),al=({offset:e=0,matchWidth:t,matchHeight:n}={})=>{const s=[bg(parseInt(e))];return t&&s.push(kg),n&&s.push(Ig),s},ll=({placement:e,defaultPlacement:t,right:n,vertical:s="bottom"}={})=>e||t||(n?`${s}-end`:`${s}-start`),Rr=e=>Og({middleware:al(e),placement:ll(e)}),Eg=({className:e="dropdown",openClass:t="open",closedClass:n="closed",isOpen:s,size:r,wide:o,offset:i=8,placement:l,right:c,Trigger:d=ja,Options:h=za})=>{const{refs:f,floatingStyles:p}=Rr({offset:i,placement:l,right:c});return a.jsxs("div",{className:x(e,r,s?t:n,{right:c,wide:o}),children:[a.jsx(d,{floatingRef:f.setReference}),s&&a.jsx(h,{floatingRef:f.setFloating,floatingStyle:p})]})},cl=wt.Consumer(Eg),dl=D(({Content:e=cl,...t})=>a.jsx(wt.Provider,{...t,children:a.jsx(e,{})}),"DropdownMenu"),Pg=({setPageSize:e,pageSizes:t=[10,25,50,100,250,500,1e3],pageSizeText:n=s=>`${s} per page`})=>a.jsx("div",{className:"pagesize",children:a.jsx(dl,{right:!0,iconRight:"page",text:"Page Size",size:"small",triggerClass:"trigger pad-v-none",options:t.map(s=>({n:s,text:n(s)})),onSelect:s=>e(s.n)})}),ul=z.Consumer(Pg);class Cn extends Ba{}P(Cn,"debug",!1),P(Cn,"debugPrefix","Dropdown > "),P(Cn,"debugColor","MediumVioletRed"),P(Cn,"actions",["onMouseEnter","onMouseLeave","onFocus","onBlur","onClick","onKeyDown","open","close","triggerRef"]);const Mt=Ie(Cn),Fg=Mt.Use,Ag=({triggerClass:e="trigger",triggerRef:t,triggerColor:n,triggerSize:s,button:r,icon:o,floatingRef:i,safeAreaClass:l="safe-area",onMouseEnter:c,onMouseLeave:d,onKeyDown:h,onFocus:f,onBlur:p,onClick:g,...m})=>a.jsxs("div",{className:x(e,n,s,{button:r,icon:o}),onClick:g,onMouseEnter:c,onMouseLeave:d,onKeyDown:h,onFocus:f,onBlur:p,tabIndex:0,ref:fs([t,i]),children:[a.jsx(We,{icon:o,...ln(m,/^(icon|text)/)}),a.jsx("div",{className:l})]}),hl=Mt.Consumer(Ag),Vg=({bodyClass:e="body border bdr-1",onMouseEnter:t,onMouseLeave:n,floatingRef:s,floatingStyle:r,content:o})=>a.jsx("div",{className:e,onMouseEnter:t,onMouseLeave:n,ref:s,style:r,children:o||"No content defined"}),fl=Mt.Consumer(Vg),Bg=({className:e="dropdown",openClass:t="open",closedClass:n="closed",placement:s,offset:r=8,isOpen:o,right:i,size:l,wide:c,Trigger:d=hl,Body:h=fl})=>{const{refs:f,floatingStyles:p}=Rr({offset:r,placement:s,right:i});return a.jsxs("div",{className:x(e,l,o?t:n,{right:i,wide:c}),children:[a.jsx(d,{floatingRef:f.setReference}),o&&a.jsx(h,{floatingRef:f.setFloating,floatingStyle:p})]})},gl=Mt.Consumer(Bg),pl=D(({Content:e=gl,content:t,children:n,...s})=>a.jsx(Mt.Provider,{content:t||n,...s,children:a.jsx(e,{})}),"Dropdown"),jg=({item:e,setNodeRef:t,style:n,listeners:s,toggleVisibleColumn:r,isVisible:o,...i})=>a.jsxs("div",{ref:t,style:n,className:`sortable item flex middle outline pad-v-none pad-h-1 border mar-b-2 ${e.moved?"moved":""}`,...i,children:[a.jsx(Ar,{className:"fluid flex middle no-focus",checked:o[e.id]||!1,onChange:()=>r(e.id),text:e.heading},e.id),a.jsx("div",{...s,className:"pad-h-2",children:a.jsx(H,{name:"drag",className:"drag-handle"})})]}),Wg=({close:e})=>a.jsx(ae,{className:"wide",size:"smaller",color:"green",text:"OK",onClick:e}),Hg=Mt.Consumer(Wg);function Ug(){for(var e=arguments.length,t=new Array(e),n=0;ns=>{t.forEach(r=>r(s))},t)}const ks=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ft(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function eo(e){return"nodeType"in e}function te(e){var t,n;return e?Ft(e)?e:eo(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function to(e){const{Document:t}=te(e);return e instanceof t}function yn(e){return Ft(e)?!1:e instanceof te(e).HTMLElement}function bl(e){return e instanceof te(e).SVGElement}function At(e){return e?Ft(e)?e.document:eo(e)?to(e)?e:yn(e)||bl(e)?e.ownerDocument:document:document:document}const he=ks?b.useLayoutEffect:b.useEffect;function Is(e){const t=b.useRef(e);return he(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r{e.current=setInterval(s,r)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Sn(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return he(()=>{n.current!==e&&(n.current=e)},t),n}function wn(e,t){const n=b.useRef();return b.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Es(e){const t=Is(e),n=b.useRef(null),s=b.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}function Ps(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let no={};function Mn(e,t){return b.useMemo(()=>{if(t)return t;const n=no[e]==null?0:no[e]+1;return no[e]=n,e+"-"+n},[e,t])}function vl(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r{const l=Object.entries(i);for(const[c,d]of l){const h=o[c];h!=null&&(o[c]=h+e*d)}return o},{...t})}}const Vt=vl(1),Ln=vl(-1);function Kg(e){return"clientX"in e&&"clientY"in e}function Fs(e){if(!e)return!1;const{KeyboardEvent:t}=te(e.target);return t&&e instanceof t}function _g(e){if(!e)return!1;const{TouchEvent:t}=te(e.target);return t&&e instanceof t}function As(e){if(_g(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Kg(e)?{x:e.clientX,y:e.clientY}:null}const nt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[nt.Translate.toString(e),nt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),ml="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qg(e){return e.matches(ml)?e:e.querySelector(ml)}const Xg={display:"none"};function Yg(e){let{id:t,value:n}=e;return b.createElement("div",{id:t,style:Xg},n)}function Gg(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return b.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function Zg(){const[e,t]=b.useState("");return{announce:b.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const Cl=b.createContext(null);function Jg(e){const t=b.useContext(Cl);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Qg(){const[e]=b.useState(()=>new Set),t=b.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[b.useCallback(s=>{let{type:r,event:o}=s;e.forEach(i=>{var l;return(l=i[r])==null?void 0:l.call(i,o)})},[e]),t]}const Rg={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},ep={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tp(e){let{announcements:t=ep,container:n,hiddenTextDescribedById:s,screenReaderInstructions:r=Rg}=e;const{announce:o,announcement:i}=Zg(),l=Mn("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),Jg(b.useMemo(()=>({onDragStart(f){let{active:p}=f;o(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:g}=f;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(f){let{active:p,over:g}=f;o(t.onDragOver({active:p,over:g}))},onDragEnd(f){let{active:p,over:g}=f;o(t.onDragEnd({active:p,over:g}))},onDragCancel(f){let{active:p,over:g}=f;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!c)return null;const h=b.createElement(b.Fragment,null,b.createElement(Yg,{id:s,value:r.draggable}),b.createElement(Gg,{id:l,announcement:i}));return n?ft.createPortal(h,n):h}var Y;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Y||(Y={}));function Vs(){}function yl(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function np(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(s=>s!=null),[...t])}const Ce=Object.freeze({x:0,y:0});function Sl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sp(e,t){const n=As(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function wl(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function rp(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Ml(e){let{left:t,top:n,height:s,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+s},{x:t+r,y:n+s}]}function Ll(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function Nl(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const op=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=Nl(t,t.left,t.top),o=[];for(const i of s){const{id:l}=i,c=n.get(l);if(c){const d=Sl(Nl(c),r);o.push({id:l,data:{droppableContainer:i,value:d}})}}return o.sort(wl)},ip=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=Ml(t),o=[];for(const i of s){const{id:l}=i,c=n.get(l);if(c){const d=Ml(c),h=r.reduce((p,g,m)=>p+Sl(d[m],g),0),f=Number((h/4).toFixed(4));o.push({id:l,data:{droppableContainer:i,value:f}})}}return o.sort(wl)};function ap(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=r-s,l=o-n;if(s{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const r=[];for(const o of s){const{id:i}=o,l=n.get(i);if(l){const c=ap(l,t);c>0&&r.push({id:i,data:{droppableContainer:o,value:c}})}}return r.sort(rp)};function cp(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Dl(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ce}function dp(e){return function(n){for(var s=arguments.length,r=new Array(s>1?s-1:0),o=1;o({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const up=dp(1);function xl(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function hp(e,t,n){const s=xl(t);if(!s)return e;const{scaleX:r,scaleY:o,x:i,y:l}=s,c=e.left-i-(1-r)*parseFloat(n),d=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),h=r?e.width/r:e.width,f=o?e.height/o:e.height;return{width:h,height:f,top:d,right:c+h,bottom:d+f,left:c}}const fp={ignoreTransform:!1};function Bt(e,t){t===void 0&&(t=fp);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:h}=te(e).getComputedStyle(e);d&&(n=hp(n,d,h))}const{top:s,left:r,width:o,height:i,bottom:l,right:c}=n;return{top:s,left:r,width:o,height:i,bottom:l,right:c}}function $l(e){return Bt(e,{ignoreTransform:!0})}function gp(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function pp(e,t){return t===void 0&&(t=te(e).getComputedStyle(e)),t.position==="fixed"}function bp(e,t){t===void 0&&(t=te(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const o=t[r];return typeof o=="string"?n.test(o):!1})}function Bs(e,t){const n=[];function s(r){if(t!=null&&n.length>=t||!r)return n;if(to(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!yn(r)||bl(r)||n.includes(r))return n;const o=te(e).getComputedStyle(r);return r!==e&&bp(r,o)&&n.push(r),pp(r,o)?n:s(r.parentNode)}return e?s(e):n}function Tl(e){const[t]=Bs(e,1);return t??null}function so(e){return!ks||!e?null:Ft(e)?e:eo(e)?to(e)||e===At(e).scrollingElement?window:yn(e)?e:null:null}function Ol(e){return Ft(e)?e.scrollX:e.scrollLeft}function kl(e){return Ft(e)?e.scrollY:e.scrollTop}function ro(e){return{x:Ol(e),y:kl(e)}}var G;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(G||(G={}));function Il(e){return!ks||!e?!1:e===document.scrollingElement}function El(e){const t={x:0,y:0},n=Il(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=s.y,l=e.scrollLeft>=s.x;return{isTop:r,isLeft:o,isBottom:i,isRight:l,maxScroll:s,minScroll:t}}const vp={x:.2,y:.2};function mp(e,t,n,s,r){let{top:o,left:i,right:l,bottom:c}=n;s===void 0&&(s=10),r===void 0&&(r=vp);const{isTop:d,isBottom:h,isLeft:f,isRight:p}=El(e),g={x:0,y:0},m={x:0,y:0},v={height:t.height*r.y,width:t.width*r.x};return!d&&o<=t.top+v.height?(g.y=G.Backward,m.y=s*Math.abs((t.top+v.height-o)/v.height)):!h&&c>=t.bottom-v.height&&(g.y=G.Forward,m.y=s*Math.abs((t.bottom-v.height-c)/v.height)),!p&&l>=t.right-v.width?(g.x=G.Forward,m.x=s*Math.abs((t.right-v.width-l)/v.width)):!f&&i<=t.left+v.width&&(g.x=G.Backward,m.x=s*Math.abs((t.left+v.width-i)/v.width)),{direction:g,speed:m}}function Cp(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Pl(e){return e.reduce((t,n)=>Vt(t,ro(n)),Ce)}function yp(e){return e.reduce((t,n)=>t+Ol(n),0)}function Sp(e){return e.reduce((t,n)=>t+kl(n),0)}function Fl(e,t){if(t===void 0&&(t=Bt),!e)return;const{top:n,left:s,bottom:r,right:o}=t(e);Tl(e)&&(r<=0||o<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const wp=[["x",["left","right"],yp],["y",["top","bottom"],Sp]];class oo{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Bs(n),r=Pl(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,l]of wp)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(s),h=r[o]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Nn{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function Mp(e){const{EventTarget:t}=te(e);return e instanceof t?e:At(e)}function io(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Al(e){e.preventDefault()}function Lp(e){e.stopPropagation()}var V;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(V||(V={}));const Vl={start:[V.Space,V.Enter],cancel:[V.Esc],end:[V.Space,V.Enter]},Np=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case V.Right:return{...n,x:n.x+25};case V.Left:return{...n,x:n.x-25};case V.Down:return{...n,y:n.y+25};case V.Up:return{...n,y:n.y-25}}};class ao{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Nn(At(n)),this.windowListeners=new Nn(te(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&Fl(s),n(Ce)}handleKeyDown(t){if(Fs(t)){const{active:n,context:s,options:r}=this.props,{keyboardCodes:o=Vl,coordinateGetter:i=Np,scrollBehavior:l="smooth"}=r,{code:c}=t;if(o.end.includes(c)){this.handleEnd(t);return}if(o.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=s.current,h=d?{x:d.left,y:d.top}:Ce;this.referenceCoordinates||(this.referenceCoordinates=h);const f=i(t,{active:n,context:s.current,currentCoordinates:h});if(f){const p=Ln(f,h),g={x:0,y:0},{scrollableAncestors:m}=s.current;for(const v of m){const C=t.code,{isTop:y,isRight:w,isLeft:S,isBottom:L,maxScroll:M,minScroll:O}=El(v),N=Cp(v),$={x:Math.min(C===V.Right?N.right-N.width/2:N.right,Math.max(C===V.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(C===V.Down?N.bottom-N.height/2:N.bottom,Math.max(C===V.Down?N.top:N.top+N.height/2,f.y))},E=C===V.Right&&!w||C===V.Left&&!S,T=C===V.Down&&!L||C===V.Up&&!y;if(E&&$.x!==f.x){const k=v.scrollLeft+p.x,W=C===V.Right&&k<=M.x||C===V.Left&&k>=O.x;if(W&&!p.y){v.scrollTo({left:k,behavior:l});return}W?g.x=v.scrollLeft-k:g.x=C===V.Right?v.scrollLeft-M.x:v.scrollLeft-O.x,g.x&&v.scrollBy({left:-g.x,behavior:l});break}else if(T&&$.y!==f.y){const k=v.scrollTop+p.y,W=C===V.Down&&k<=M.y||C===V.Up&&k>=O.y;if(W&&!p.x){v.scrollTo({top:k,behavior:l});return}W?g.y=v.scrollTop-k:g.y=C===V.Down?v.scrollTop-M.y:v.scrollTop-O.y,g.y&&v.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,Vt(Ln(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ao.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=Vl,onActivation:r}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(s.start.includes(i)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),r==null||r({event:e.nativeEvent}),!0)}return!1}}];function Bl(e){return!!(e&&"distance"in e)}function jl(e){return!!(e&&"delay"in e)}class lo{constructor(t,n,s){var r;s===void 0&&(s=Mp(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=At(i),this.documentListeners=new Nn(this.document),this.listeners=new Nn(s),this.windowListeners=new Nn(te(i)),this.initialCoordinates=(r=As(o))!=null?r:Ce,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Al),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Al),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jl(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(Bl(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Lp,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:l}}=o;if(!r)return;const c=(n=As(t))!=null?n:Ce,d=Ln(r,c);if(!s&&l){if(Bl(l)){if(l.tolerance!=null&&io(d,l.tolerance))return this.handleCancel();if(io(d,l.distance))return this.handleStart()}return jl(l)&&io(d,l.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===V.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Dp={move:{name:"pointermove"},end:{name:"pointerup"}};class co extends lo{constructor(t){const{event:n}=t,s=At(n.target);super(t,Dp,s)}}co.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const xp={move:{name:"mousemove"},end:{name:"mouseup"}};var uo;(function(e){e[e.RightClick=2]="RightClick"})(uo||(uo={}));class $p extends lo{constructor(t){super(t,xp,At(t.event.target))}}$p.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===uo.RightClick?!1:(s==null||s({event:n}),!0)}}];const ho={move:{name:"touchmove"},end:{name:"touchend"}};class Tp extends lo{constructor(t){super(t,ho)}static setup(){return window.addEventListener(ho.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ho.move.name,t)};function t(){}}}Tp.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:r}=n;return r.length>1?!1:(s==null||s({event:n}),!0)}}];var Dn;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Dn||(Dn={}));var js;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(js||(js={}));function Op(e){let{acceleration:t,activator:n=Dn.Pointer,canScroll:s,draggingRect:r,enabled:o,interval:i=5,order:l=js.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:f,threshold:p}=e;const g=Ip({delta:f,disabled:!o}),[m,v]=zg(),C=b.useRef({x:0,y:0}),y=b.useRef({x:0,y:0}),w=b.useMemo(()=>{switch(n){case Dn.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Dn.DraggableRect:return r}},[n,r,c]),S=b.useRef(null),L=b.useCallback(()=>{const O=S.current;if(!O)return;const N=C.current.x*y.current.x,$=C.current.y*y.current.y;O.scrollBy(N,$)},[]),M=b.useMemo(()=>l===js.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!o||!d.length||!w){v();return}for(const O of M){if((s==null?void 0:s(O))===!1)continue;const N=d.indexOf(O),$=h[N];if(!$)continue;const{direction:E,speed:T}=mp(O,$,w,t,p);for(const k of["x","y"])g[k][E[k]]||(T[k]=0,E[k]=0);if(T.x>0||T.y>0){v(),S.current=O,m(L,i),C.current=T,y.current=E;return}}C.current={x:0,y:0},y.current={x:0,y:0},v()},[t,L,s,v,o,i,JSON.stringify(w),JSON.stringify(g),m,d,M,h,JSON.stringify(p)])}const kp={x:{[G.Backward]:!1,[G.Forward]:!1},y:{[G.Backward]:!1,[G.Forward]:!1}};function Ip(e){let{delta:t,disabled:n}=e;const s=Ps(t);return wn(r=>{if(n||!s||!r)return kp;const o={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[G.Backward]:r.x[G.Backward]||o.x===-1,[G.Forward]:r.x[G.Forward]||o.x===1},y:{[G.Backward]:r.y[G.Backward]||o.y===-1,[G.Forward]:r.y[G.Forward]||o.y===1}}},[n,t,s])}function Ep(e,t){const n=t!==null?e.get(t):void 0,s=n?n.node.current:null;return wn(r=>{var o;return t===null?null:(o=s??r)!=null?o:null},[s,t])}function Pp(e,t){return b.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,o=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...n,...o]},[]),[e,t])}var xn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xn||(xn={}));var fo;(function(e){e.Optimized="optimized"})(fo||(fo={}));const Wl=new Map;function Fp(e,t){let{dragging:n,dependencies:s,config:r}=t;const[o,i]=b.useState(null),{frequency:l,measure:c,strategy:d}=r,h=b.useRef(e),f=C(),p=Sn(f),g=b.useCallback(function(y){y===void 0&&(y=[]),!p.current&&i(w=>w===null?y:w.concat(y.filter(S=>!w.includes(S))))},[p]),m=b.useRef(null),v=wn(y=>{if(f&&!n)return Wl;if(!y||y===Wl||h.current!==e||o!=null){const w=new Map;for(let S of e){if(!S)continue;if(o&&o.length>0&&!o.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const L=S.node.current,M=L?new oo(c(L),L):null;S.rect.current=M,M&&w.set(S.id,M)}return w}return y},[e,o,n,f,c]);return b.useEffect(()=>{h.current=e},[e]),b.useEffect(()=>{f||g()},[n,f]),b.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),b.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},l))},[l,f,g,...s]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:o!=null};function C(){switch(d){case xn.Always:return!1;case xn.BeforeDragging:return n;default:return!n}}}function go(e,t){return wn(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ap(e,t){return go(e,t)}function Vp(e){let{callback:t,disabled:n}=e;const s=Is(t),r=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(s)},[s,n]);return b.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function Ws(e){let{callback:t,disabled:n}=e;const s=Is(t),r=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(s)},[n]);return b.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function Bp(e){return new oo(Bt(e),e)}function Hl(e,t,n){t===void 0&&(t=Bp);const[s,r]=b.useReducer(l,null),o=Vp({callback(c){if(e)for(const d of c){const{type:h,target:f}=d;if(h==="childList"&&f instanceof HTMLElement&&f.contains(e)){r();break}}}}),i=Ws({callback:r});return he(()=>{r(),e?(i==null||i.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),o==null||o.disconnect())},[e]),s;function l(c){if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const h=t(e);return JSON.stringify(c)===JSON.stringify(h)?c:h}}function jp(e){const t=go(e);return Dl(e,t)}const Ul=[];function Wp(e){const t=b.useRef(e),n=wn(s=>e?s&&s!==Ul&&e&&t.current&&e.parentNode===t.current.parentNode?s:Bs(e):Ul,[e]);return b.useEffect(()=>{t.current=e},[e]),n}function Hp(e){const[t,n]=b.useState(null),s=b.useRef(e),r=b.useCallback(o=>{const i=so(o.target);i&&n(l=>l?(l.set(i,ro(i)),new Map(l)):null)},[]);return b.useEffect(()=>{const o=s.current;if(e!==o){i(o);const l=e.map(c=>{const d=so(c);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,ro(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),s.current=e}return()=>{i(e),i(o)};function i(l){l.forEach(c=>{const d=so(c);d==null||d.removeEventListener("scroll",r)})}},[r,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Vt(o,i),Ce):Pl(e):Ce,[e,t])}function zl(e,t){t===void 0&&(t=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},t),b.useEffect(()=>{const s=e!==Ce;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Ln(e,n.current):Ce}function Up(e){b.useEffect(()=>{if(!ks)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function zp(e,t){return b.useMemo(()=>e.reduce((n,s)=>{let{eventName:r,handler:o}=s;return n[r]=i=>{o(i,t)},n},{}),[e,t])}function Kl(e){return b.useMemo(()=>e?gp(e):null,[e])}const po=[];function Kp(e,t){t===void 0&&(t=Bt);const[n]=e,s=Kl(n?te(n):null),[r,o]=b.useReducer(l,po),i=Ws({callback:o});return e.length>0&&r===po&&o(),he(()=>{e.length?e.forEach(c=>i==null?void 0:i.observe(c)):(i==null||i.disconnect(),o())},[e]),r;function l(){return e.length?e.map(c=>Il(c)?s:new oo(t(c),c)):po}}function _l(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return yn(t)?t:e}function _p(e){let{measure:t}=e;const[n,s]=b.useState(null),r=b.useCallback(d=>{for(const{target:h}of d)if(yn(h)){s(f=>{const p=t(h);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),o=Ws({callback:r}),i=b.useCallback(d=>{const h=_l(d);o==null||o.disconnect(),h&&(o==null||o.observe(h)),s(h?t(h):null)},[t,o]),[l,c]=Es(i);return b.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const qp=[{sensor:co,options:{}},{sensor:ao,options:{}}],Xp={current:{}},Hs={draggable:{measure:$l},droppable:{measure:$l,strategy:xn.WhileDragging,frequency:fo.Optimized},dragOverlay:{measure:Bt}};class $n extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Yp={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new $n,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Vs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hs,measureDroppableContainers:Vs,windowRect:null,measuringScheduled:!1},ql={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Vs,draggableNodes:new Map,over:null,measureDroppableContainers:Vs},Tn=b.createContext(ql),Xl=b.createContext(Yp);function Gp(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new $n}}}function Zp(e,t){switch(t.type){case Y.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Y.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Y.DragEnd:case Y.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Y.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new $n(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case Y.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new $n(e.droppable.containers);return i.set(n,{...o,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Y.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const o=new $n(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Jp(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:r}=b.useContext(Tn),o=Ps(s),i=Ps(n==null?void 0:n.id);return b.useEffect(()=>{if(!t&&!s&&o&&i!=null){if(!Fs(o)||document.activeElement===o.target)return;const l=r.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const f=qg(h);if(f){f.focus();break}}})}},[s,t,r,i,o]),null}function Yl(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...s}),n):n}function Qp(e){return b.useMemo(()=>({draggable:{...Hs.draggable,...e==null?void 0:e.draggable},droppable:{...Hs.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Hs.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Rp(e){let{activeNode:t,measure:n,initialRect:s,config:r=!0}=e;const o=b.useRef(!1),{x:i,y:l}=typeof r=="boolean"?{x:r,y:r}:r;he(()=>{if(!i&&!l||!t){o.current=!1;return}if(o.current||!s)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const h=n(d),f=Dl(h,s);if(i||(f.x=0),l||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Tl(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,s,n])}const Us=b.createContext({...Ce,scaleX:1,scaleY:1});var st;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(st||(st={}));const eb=b.memo(function(t){var n,s,r,o;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:h=qp,collisionDetection:f=lp,measuring:p,modifiers:g,...m}=t;const v=b.useReducer(Zp,void 0,Gp),[C,y]=v,[w,S]=Qg(),[L,M]=b.useState(st.Uninitialized),O=L===st.Initialized,{draggable:{active:N,nodes:$,translate:E},droppable:{containers:T}}=C,k=N?$.get(N):null,W=b.useRef({initial:null,translated:null}),B=b.useMemo(()=>{var Q;return N!=null?{id:N,data:(Q=k==null?void 0:k.data)!=null?Q:Xp,rect:W}:null},[N,k]),K=b.useRef(null),[Te,re]=b.useState(null),[J,_]=b.useState(null),ne=Sn(m,Object.values(m)),oe=Mn("DndDescribedBy",i),Jt=b.useMemo(()=>T.getEnabled(),[T]),ee=Qp(p),{droppableRects:Xe,measureDroppableContainers:$t,measuringScheduled:Vn}=Fp(Jt,{dragging:O,dependencies:[E.x,E.y],config:ee.droppable}),pe=Ep($,N),ir=b.useMemo(()=>J?As(J):null,[J]),ct=X2(),Ye=Ap(pe,ee.draggable.measure);Rp({activeNode:N?$.get(N):null,config:ct.layoutShiftCompensation,initialRect:Ye,measure:ee.draggable.measure});const U=Hl(pe,ee.draggable.measure,Ye),Bn=Hl(pe?pe.parentElement:null),Oe=b.useRef({activatorEvent:null,active:null,activeNode:pe,collisionRect:null,collisions:null,droppableRects:Xe,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Qt=T.getNodeFor((n=Oe.current.over)==null?void 0:n.id),Ge=_p({measure:ee.dragOverlay.measure}),Rt=(s=Ge.nodeRef.current)!=null?s:pe,en=O?(r=Ge.rect)!=null?r:U:null,Hu=!!(Ge.nodeRef.current&&Ge.rect),Uu=jp(Hu?null:U),Uo=Kl(Rt?te(Rt):null),dt=Wp(O?Qt??pe:null),ar=Kp(dt),lr=Yl(g,{transform:{x:E.x-Uu.x,y:E.y-Uu.y,scaleX:1,scaleY:1},activatorEvent:J,active:B,activeNodeRect:U,containerNodeRect:Bn,draggingNodeRect:en,over:Oe.current.over,overlayNodeRect:Ge.rect,scrollableAncestors:dt,scrollableAncestorRects:ar,windowRect:Uo}),zu=ir?Vt(ir,E):null,Ku=Hp(dt),W2=zl(Ku),H2=zl(Ku,[U]),tn=Vt(lr,W2),nn=en?up(en,lr):null,jn=B&&nn?f({active:B,collisionRect:nn,droppableRects:Xe,droppableContainers:Jt,pointerCoordinates:zu}):null,_u=Ll(jn,"id"),[ut,qu]=b.useState(null),U2=Hu?lr:Vt(lr,H2),z2=cp(U2,(o=ut==null?void 0:ut.rect)!=null?o:null,U),Xu=b.useCallback((Q,de)=>{let{sensor:ue,options:ht}=de;if(K.current==null)return;const be=$.get(K.current);if(!be)return;const ye=Q.nativeEvent,ke=new ue({active:K.current,activeNode:be,event:ye,options:ht,context:Oe,onStart(Se){const Wn=K.current;if(Wn==null)return;const Hn=$.get(Wn);if(!Hn)return;const{onDragStart:cr}=ne.current,dr={active:{id:Wn,data:Hn.data,rect:W}};ft.unstable_batchedUpdates(()=>{cr==null||cr(dr),M(st.Initializing),y({type:Y.DragStart,initialCoordinates:Se,active:Wn}),w({type:"onDragStart",event:dr})})},onMove(Se){y({type:Y.DragMove,coordinates:Se})},onEnd:sn(Y.DragEnd),onCancel:sn(Y.DragCancel)});ft.unstable_batchedUpdates(()=>{re(ke),_(Q.nativeEvent)});function sn(Se){return async function(){const{active:Hn,collisions:cr,over:dr,scrollAdjustedTranslate:Gu}=Oe.current;let Un=null;if(Hn&&Gu){const{cancelDrop:zn}=ne.current;Un={activatorEvent:ye,active:Hn,collisions:cr,delta:Gu,over:dr},Se===Y.DragEnd&&typeof zn=="function"&&await Promise.resolve(zn(Un))&&(Se=Y.DragCancel)}K.current=null,ft.unstable_batchedUpdates(()=>{y({type:Se}),M(st.Uninitialized),qu(null),re(null),_(null);const zn=Se===Y.DragEnd?"onDragEnd":"onDragCancel";if(Un){const zo=ne.current[zn];zo==null||zo(Un),w({type:zn,event:Un})}})}}},[$]),K2=b.useCallback((Q,de)=>(ue,ht)=>{const be=ue.nativeEvent,ye=$.get(ht);if(K.current!==null||!ye||be.dndKit||be.defaultPrevented)return;const ke={active:ye};Q(ue,de.options,ke)===!0&&(be.dndKit={capturedBy:de.sensor},K.current=ht,Xu(ue,de))},[$,Xu]),Yu=Pp(h,K2);Up(h),he(()=>{U&&L===st.Initializing&&M(st.Initialized)},[U,L]),b.useEffect(()=>{const{onDragMove:Q}=ne.current,{active:de,activatorEvent:ue,collisions:ht,over:be}=Oe.current;if(!de||!ue)return;const ye={active:de,activatorEvent:ue,collisions:ht,delta:{x:tn.x,y:tn.y},over:be};ft.unstable_batchedUpdates(()=>{Q==null||Q(ye),w({type:"onDragMove",event:ye})})},[tn.x,tn.y]),b.useEffect(()=>{const{active:Q,activatorEvent:de,collisions:ue,droppableContainers:ht,scrollAdjustedTranslate:be}=Oe.current;if(!Q||K.current==null||!de||!be)return;const{onDragOver:ye}=ne.current,ke=ht.get(_u),sn=ke&&ke.rect.current?{id:ke.id,rect:ke.rect.current,data:ke.data,disabled:ke.disabled}:null,Se={active:Q,activatorEvent:de,collisions:ue,delta:{x:be.x,y:be.y},over:sn};ft.unstable_batchedUpdates(()=>{qu(sn),ye==null||ye(Se),w({type:"onDragOver",event:Se})})},[_u]),he(()=>{Oe.current={activatorEvent:J,active:B,activeNode:pe,collisionRect:nn,collisions:jn,droppableRects:Xe,draggableNodes:$,draggingNode:Rt,draggingNodeRect:en,droppableContainers:T,over:ut,scrollableAncestors:dt,scrollAdjustedTranslate:tn},W.current={initial:en,translated:nn}},[B,pe,jn,nn,$,Rt,en,Xe,T,ut,dt,tn]),Op({...ct,delta:E,draggingRect:nn,pointerCoordinates:zu,scrollableAncestors:dt,scrollableAncestorRects:ar});const _2=b.useMemo(()=>({active:B,activeNode:pe,activeNodeRect:U,activatorEvent:J,collisions:jn,containerNodeRect:Bn,dragOverlay:Ge,draggableNodes:$,droppableContainers:T,droppableRects:Xe,over:ut,measureDroppableContainers:$t,scrollableAncestors:dt,scrollableAncestorRects:ar,measuringConfiguration:ee,measuringScheduled:Vn,windowRect:Uo}),[B,pe,U,J,jn,Bn,Ge,$,T,Xe,ut,$t,dt,ar,ee,Vn,Uo]),q2=b.useMemo(()=>({activatorEvent:J,activators:Yu,active:B,activeNodeRect:U,ariaDescribedById:{draggable:oe},dispatch:y,draggableNodes:$,over:ut,measureDroppableContainers:$t}),[J,Yu,B,U,y,oe,$,ut,$t]);return b.createElement(Cl.Provider,{value:S},b.createElement(Tn.Provider,{value:q2},b.createElement(Xl.Provider,{value:_2},b.createElement(Us.Provider,{value:z2},d)),b.createElement(Jp,{disabled:(l==null?void 0:l.restoreFocus)===!1})),b.createElement(tp,{...l,hiddenTextDescribedById:oe}));function X2(){const Q=(Te==null?void 0:Te.autoScrollEnabled)===!1,de=typeof c=="object"?c.enabled===!1:c===!1,ue=O&&!Q&&!de;return typeof c=="object"?{...c,enabled:ue}:{enabled:ue}}}),tb=b.createContext(null),Gl="button",nb="Droppable";function sb(e){let{id:t,data:n,disabled:s=!1,attributes:r}=e;const o=Mn(nb),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:f,over:p}=b.useContext(Tn),{role:g=Gl,roleDescription:m="draggable",tabIndex:v=0}=r??{},C=(c==null?void 0:c.id)===t,y=b.useContext(C?Us:tb),[w,S]=Es(),[L,M]=Es(),O=zp(i,t),N=Sn(n);he(()=>(f.set(t,{id:t,key:o,node:w,activatorNode:L,data:N}),()=>{const E=f.get(t);E&&E.key===o&&f.delete(t)}),[f,t]);const $=b.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":s,"aria-pressed":C&&g===Gl?!0:void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[s,g,v,C,m,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:$,isDragging:C,listeners:s?void 0:O,node:w,over:p,setNodeRef:S,setActivatorNodeRef:M,transform:y}}function Zl(){return b.useContext(Xl)}const rb="Droppable",ob={timeout:25};function ib(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:r}=e;const o=Mn(rb),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Tn),h=b.useRef({disabled:n}),f=b.useRef(!1),p=b.useRef(null),g=b.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:C}={...ob,...r},y=Sn(v??s),w=b.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),g.current=null},C)},[C]),S=Ws({callback:w,disabled:m||!i}),L=b.useCallback(($,E)=>{S&&(E&&(S.unobserve(E),f.current=!1),$&&S.observe($))},[S]),[M,O]=Es(L),N=Sn(t);return b.useEffect(()=>{!S||!M.current||(S.disconnect(),f.current=!1,S.observe(M.current))},[M,S]),he(()=>(l({type:Y.RegisterDroppable,element:{id:s,key:o,disabled:n,node:M,rect:p,data:N}}),()=>l({type:Y.UnregisterDroppable,key:o,id:s})),[s]),b.useEffect(()=>{n!==h.current.disabled&&(l({type:Y.SetDroppableDisabled,id:s,key:o,disabled:n}),h.current.disabled=n)},[s,o,n,l]),{active:i,rect:p,isOver:(c==null?void 0:c.id)===s,node:M,over:c,setNodeRef:O}}function ab(e){let{animation:t,children:n}=e;const[s,r]=b.useState(null),[o,i]=b.useState(null),l=Ps(n);return!n&&!s&&l&&r(l),he(()=>{if(!o)return;const c=s==null?void 0:s.key,d=s==null?void 0:s.props.id;if(c==null||d==null){r(null);return}Promise.resolve(t(d,o)).then(()=>{r(null)})},[t,s,o]),b.createElement(b.Fragment,null,n,s?b.cloneElement(s,{ref:i}):null)}const lb={x:0,y:0,scaleX:1,scaleY:1};function cb(e){let{children:t}=e;return b.createElement(Tn.Provider,{value:ql},b.createElement(Us.Provider,{value:lb},t))}const db={position:"fixed",touchAction:"none"},ub=e=>Fs(e)?"transform 250ms ease":void 0,hb=b.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:r,children:o,className:i,rect:l,style:c,transform:d,transition:h=ub}=e;if(!l)return null;const f=r?d:{...d,scaleX:1,scaleY:1},p={...db,width:l.width,height:l.height,top:l.top,left:l.left,transform:nt.Transform.toString(f),transformOrigin:r&&s?sp(s,l):void 0,transition:typeof h=="function"?h(s):h,...c};return b.createElement(n,{className:i,style:p,ref:t},o)}),fb={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:nt.Transform.toString(t)},{transform:nt.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:s}=t;const r={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[l,c]of Object.entries(o.active))c!==void 0&&(r[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,c));if(o!=null&&o.dragOverlay)for(const[l,c]of Object.entries(o.dragOverlay))c!==void 0&&s.node.style.setProperty(l,c);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&s.node.classList.add(i.dragOverlay),function(){for(const[c,d]of Object.entries(r))n.node.style.setProperty(c,d);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function gb(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:r}=e;return Is((o,i)=>{if(t===null)return;const l=n.get(o);if(!l)return;const c=l.node.current;if(!c)return;const d=_l(i);if(!d)return;const{transform:h}=te(i).getComputedStyle(i),f=xl(h);if(!f)return;const p=typeof t=="function"?t:pb(t);return Fl(c,r.draggable.measure),p({active:{id:o,data:l.data,node:c,rect:r.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:i,rect:r.dragOverlay.measure(d)},droppableContainers:s,measuringConfiguration:r,transform:f})})}function pb(e){const{duration:t,easing:n,sideEffects:s,keyframes:r}={...fb,...e};return o=>{let{active:i,dragOverlay:l,transform:c,...d}=o;if(!t)return;const h={x:l.rect.left-i.rect.left,y:l.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/l.rect.height:1},p={x:c.x-h.x,y:c.y-h.y,...f},g=r({...d,active:i,dragOverlay:l,transform:{initial:c,final:p}}),[m]=g,v=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(v))return;const C=s==null?void 0:s({active:i,dragOverlay:l,...d}),y=l.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(w=>{y.onfinish=()=>{C==null||C(),w()}})}}let Jl=0;function bb(e){return b.useMemo(()=>{if(e!=null)return Jl++,Jl},[e])}const vb=b.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:r,transition:o,modifiers:i,wrapperElement:l="div",className:c,zIndex:d=999}=e;const{activatorEvent:h,active:f,activeNodeRect:p,containerNodeRect:g,draggableNodes:m,droppableContainers:v,dragOverlay:C,over:y,measuringConfiguration:w,scrollableAncestors:S,scrollableAncestorRects:L,windowRect:M}=Zl(),O=b.useContext(Us),N=bb(f==null?void 0:f.id),$=Yl(i,{activatorEvent:h,active:f,activeNodeRect:p,containerNodeRect:g,draggingNodeRect:C.rect,over:y,overlayNodeRect:C.rect,scrollableAncestors:S,scrollableAncestorRects:L,transform:O,windowRect:M}),E=go(p),T=gb({config:s,draggableNodes:m,droppableContainers:v,measuringConfiguration:w}),k=E?C.setRef:void 0;return b.createElement(cb,null,b.createElement(ab,{animation:T},f&&N?b.createElement(hb,{key:N,id:f.id,ref:k,as:l,activatorEvent:h,adjustScale:t,className:c,transition:o,rect:E,style:{zIndex:d,...r},transform:$},n):null))});function bo(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function mb(e,t){return e.reduce((n,s,r)=>{const o=t.get(s);return o&&(n[r]=o),n},Array(e.length))}function zs(e){return e!==null&&e>=0}function Cb(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{var t;let{rects:n,activeNodeRect:s,activeIndex:r,overIndex:o,index:i}=e;const l=(t=n[r])!=null?t:s;if(!l)return null;const c=wb(n,i,r);if(i===r){const d=n[o];return d?{x:rr&&i<=o?{x:-l.width-c,y:0,...Ks}:i=o?{x:l.width+c,y:0,...Ks}:{x:0,y:0,...Ks}};function wb(e,t,n){const s=e[t],r=e[t-1],o=e[t+1];return!s||!r&&!o?0:n{let{rects:t,activeIndex:n,overIndex:s,index:r}=e;const o=bo(t,s,n),i=t[r],l=o[r];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},_s={scaleX:1,scaleY:1},Mb=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:r,rects:o,overIndex:i}=e;const l=(t=o[n])!=null?t:s;if(!l)return null;if(r===n){const d=o[i];return d?{x:0,y:nn&&r<=i?{x:0,y:-l.height-c,..._s}:r=i?{x:0,y:l.height+c,..._s}:{x:0,y:0,..._s}};function Lb(e,t,n){const s=e[t],r=e[t-1],o=e[t+1];return s?ns.map(O=>typeof O=="object"&&"id"in O?O.id:O),[s]),m=i!=null,v=i?g.indexOf(i.id):-1,C=d?g.indexOf(d.id):-1,y=b.useRef(g),w=!Cb(g,y.current),S=C!==-1&&v===-1||w,L=yb(o);he(()=>{w&&m&&h(g)},[w,g,m,h]),b.useEffect(()=>{y.current=g},[g]);const M=b.useMemo(()=>({activeIndex:v,containerId:f,disabled:L,disableTransforms:S,items:g,overIndex:C,useDragOverlay:p,sortedRects:mb(g,c),strategy:r}),[v,f,L.draggable,L.droppable,S,g,C,c,p,r]);return b.createElement(Rl.Provider,{value:M},t)}const Db=e=>{let{id:t,items:n,activeIndex:s,overIndex:r}=e;return bo(n,s,r).indexOf(t)},xb=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:r,items:o,newIndex:i,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!s||l!==o&&r===i?!1:n?!0:i!==r&&t===c},$b={duration:200,easing:"ease"},ec="transform",Tb=nt.Transition.toString({property:ec,duration:0,easing:"linear"}),Ob={roleDescription:"sortable"};function kb(e){let{disabled:t,index:n,node:s,rect:r}=e;const[o,i]=b.useState(null),l=b.useRef(n);return he(()=>{if(!t&&n!==l.current&&s.current){const c=r.current;if(c){const d=Bt(s.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&i(h)}}n!==l.current&&(l.current=n)},[t,n,s,r]),b.useEffect(()=>{o&&i(null)},[o]),o}function Ib(e){let{animateLayoutChanges:t=xb,attributes:n,disabled:s,data:r,getNewIndex:o=Db,id:i,strategy:l,resizeObserverConfig:c,transition:d=$b}=e;const{items:h,containerId:f,activeIndex:p,disabled:g,disableTransforms:m,sortedRects:v,overIndex:C,useDragOverlay:y,strategy:w}=b.useContext(Rl),S=Eb(s,g),L=h.indexOf(i),M=b.useMemo(()=>({sortable:{containerId:f,index:L,items:h},...r}),[f,r,L,h]),O=b.useMemo(()=>h.slice(h.indexOf(i)),[h,i]),{rect:N,node:$,isOver:E,setNodeRef:T}=ib({id:i,data:M,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...c}}),{active:k,activatorEvent:W,activeNodeRect:B,attributes:K,setNodeRef:Te,listeners:re,isDragging:J,over:_,setActivatorNodeRef:ne,transform:oe}=sb({id:i,data:M,attributes:{...Ob,...n},disabled:S.draggable}),Jt=Ug(T,Te),ee=!!k,Xe=ee&&!m&&zs(p)&&zs(C),$t=!y&&J,Vn=$t&&Xe?oe:null,ir=Xe?Vn??(l??w)({rects:v,activeNodeRect:B,activeIndex:p,overIndex:C,index:L}):null,ct=zs(p)&&zs(C)?o({id:i,items:h,activeIndex:p,overIndex:C}):L,Ye=k==null?void 0:k.id,U=b.useRef({activeId:Ye,items:h,newIndex:ct,containerId:f}),Bn=h!==U.current.items,Oe=t({active:k,containerId:f,isDragging:J,isSorting:ee,id:i,index:L,items:h,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:d,wasDragging:U.current.activeId!=null}),Qt=kb({disabled:!Oe,index:L,node:$,rect:N});return b.useEffect(()=>{ee&&U.current.newIndex!==ct&&(U.current.newIndex=ct),f!==U.current.containerId&&(U.current.containerId=f),h!==U.current.items&&(U.current.items=h)},[ee,ct,f,h]),b.useEffect(()=>{if(Ye===U.current.activeId)return;if(Ye&&!U.current.activeId){U.current.activeId=Ye;return}const Rt=setTimeout(()=>{U.current.activeId=Ye},50);return()=>clearTimeout(Rt)},[Ye]),{active:k,activeIndex:p,attributes:K,data:M,rect:N,index:L,newIndex:ct,items:h,isOver:E,isSorting:ee,isDragging:J,listeners:re,node:$,overIndex:C,over:_,setNodeRef:Jt,setActivatorNodeRef:ne,setDroppableNodeRef:T,setDraggableNodeRef:Te,transform:Qt??ir,transition:Ge()};function Ge(){if(Qt||Bn&&U.current.newIndex===L)return Tb;if(!($t&&!Fs(W)||!d)&&(ee||Oe))return nt.Transition.toString({...d,property:ec})}}function Eb(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function qs(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Pb=[V.Down,V.Right,V.Up,V.Left],Fb=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:r,droppableContainers:o,over:i,scrollableAncestors:l}}=t;if(Pb.includes(e.code)){if(e.preventDefault(),!n||!s)return;const c=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=r.get(f.id);if(p)switch(e.code){case V.Down:s.topp.top&&c.push(f);break;case V.Left:s.left>p.left&&c.push(f);break;case V.Right:s.left1&&(h=d[1].id),h!=null){const f=o.get(n.id),p=o.get(h),g=p?r.get(p.id):null,m=p==null?void 0:p.node.current;if(m&&g&&f&&p){const C=Bs(m).some((O,N)=>l[N]!==O),y=tc(f,p),w=Ab(f,p),S=C||!y?{x:0,y:0}:{x:w?s.width-g.width:0,y:w?s.height-g.height:0},L={x:g.left,y:g.top};return S.x&&S.y?L:Ln(L,S)}}}};function tc(e,t){return!qs(e)||!qs(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Ab(e,t){return!qs(e)||!qs(t)||!tc(e,t)?!1:e.data.current.sortable.index{const{attributes:r,listeners:o,setNodeRef:i,transform:l,transition:c}=Ib({id:e}),d={transform:nt.Translate.toString(l),transition:c};return a.jsx(n,{item:t,setNodeRef:i,style:d,listeners:o,...r,...s})},Vb=e=>{let{transform:t}=e;return{...t,y:0}};function sc(e,t,n){const s={...e};return t.top+e.y<=n.top?s.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(s.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?s.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(s.x=n.left+n.width-t.right),s}const mo=e=>{let{containerNodeRect:t,draggingNodeRect:n,transform:s}=e;return!n||!t?s:sc(s,n,t)},Bb=e=>{let{transform:t}=e;return{...t,x:0}},rc=e=>{let{transform:t,draggingNodeRect:n,windowRect:s}=e;return!n||!s?t:sc(t,n,s)},oc={default:{modifiers:[mo],strategy:vo},vertical:{modifiers:[Bb,rc,mo],strategy:Mb},horizontal:{modifiers:[Vb,rc,mo],strategy:Sb}},ic=({items:e,setOrder:t,List:n=({children:h})=>h,Item:s,direction:r,options:o=oc[r]||oc.default,modifiers:i=o.modifiers,strategy:l=o.strategy,Overlay:c,...d})=>({Context:({children:p})=>{const[g,m]=b.useState(null),v=np(yl(co),yl(ao,{coordinateGetter:Fb}));function C(S){const L=e.findIndex(M=>M.id===S.active.id);m(L)}function y(){m(null)}function w(S){const{active:L,over:M}=S;if(L.id!==M.id){const O=e.findIndex($=>$.id===L.id),N=e.findIndex($=>$.id===M.id);e[O].moved=!0,t(bo(e,O,N))}m(null)}return a.jsxs(eb,{sensors:v,collisionDetection:op,onDragStart:C,onDragCancel:y,onDragEnd:w,modifiers:i,children:[a.jsx(Nb,{items:e,strategy:l,children:p}),c&&g&&a.jsx(vb,{children:a.jsx(c,{item:g,...d})})]})},Content:()=>a.jsx(n,{...d,children:e.map(p=>a.jsx(nc,{id:p.id,item:p,Item:s,...d,role:"drag"},p.id))})}),Xs=e=>{const{Context:t,Content:n}=ic(e);return a.jsx(t,{children:a.jsx(n,{})})},ac=({...e})=>a.jsx(Xs,{...e,direction:"vertical"}),jb=({columns:e,visibleColumns:t,toggleVisibleColumn:n,columnOrder:s=Object.keys(e),columnsText:r="Columns",columnsHelpClick:o="Click checkbox to show/hide.",columnsHelpDrag:i="Drag handle to order.",changeColumnOrder:l})=>{const c=mt(t),d=s.filter(f=>e[f]).map(f=>ln(e[f],"id heading")),h=f=>{l(f.map(p=>p.id))};return a.jsxs(pl,{right:!0,iconRight:"columns",text:r,size:"small",closeOnBlur:!1,triggerClass:"trigger pad-v-none",children:[a.jsx("div",{className:"sortable list vertical",children:a.jsx(ac,{items:d,Item:jg,setOrder:h,isVisible:c,toggleVisibleColumn:n})}),a.jsxs("div",{className:"smaller mar-b-2",children:[o,a.jsx("br",{}),i]}),a.jsx(Hg,{})]})},Wb=z.Consumer(jb),lc="cross",Hb="datatable",jt="filter",cc="filters",Wt="filtering",Ub="filter-icon",dc="heading",zb="headings",uc="no-rows",Kb="selectable",Co="sorting",_b="has-filters",qb="scroll-x",Xb=({showFilters:e,toggleFilters:t,hasFilters:n,filterIcon:s=jt,filterText:r=h=>h?ef(h,"Filter"):"Filter",filteringIcon:o=jt,filterIconClass:i=Ub,filterTriggerClass:l="small flex gap-2 middle trigger",filteringClass:c=Wt,hasFiltersClass:d=_b})=>a.jsxs("div",{className:x(l,{[c]:e,[d]:n}),onClick:t,children:[Z(r,n),a.jsx(H,{className:i,name:e?o:s})]}),hc=z.Consumer(Xb),Yb=({PageSize:e=ul,Columns:t=Wb,Filtering:n=hc,controlsClass:s="controls flex center wrap gap-2 mar-b-1"})=>a.jsxs("div",{className:s,children:[a.jsx(n,{}),a.jsx(t,{}),a.jsx(e,{})]}),fc=z.Consumer(Yb),Gb=({page:e,setPageNo:t,prevIcon:n="arrow-left",prevLabel:s=So,nextIcon:r="arrow-right",nextLabel:o=wo,navSize:i="smaller",headerClass:l="small flex space bottom gap-2",Summary:c=Ea,Controls:d=fc})=>a.jsxs("header",{className:l,children:[a.jsx(ae,{icon:n,size:i,disabled:e.pageNo<=e.firstPage,outline:!0,onClick:()=>t(e.pageNo-1),role:"navigation",label:Z(s(e.pageNo-1))}),a.jsxs("div",{children:[a.jsx(c,{}),a.jsx(d,{})]}),a.jsx(ae,{icon:r,size:i,disabled:e.pageNo>=e.lastPage,outline:!0,onClick:()=>t(e.pageNo+1),role:"navigation",label:Z(o(e.pageNo+1))})]}),gc=z.Consumer(Gb),yo=({value:e})=>I(e)?e:"",Zb=({value:e})=>I(e)?Tt(e):"",pc=({value:e})=>I(e)?Jh(e):"",bc={default:yo,text:yo,id:yo,number:Zb,price:pc,currency:pc,boolean:({value:e,column:t})=>I(e)?ms(e)?t.trueText??Wr:t.falseText??Hr:"",title:({value:e})=>I(e)?tf(e):""},ze={left:"text-left",right:"text-right",center:"text-center",centre:"text-center"},Jb=({row:e,column:t,name:n,value:s,rowIndex:r,cellIndex:o,cellClass:i,filters:l,sortColumn:c,sortingClass:d=Co,filteringClass:h=Wt,displayTypes:f=bc})=>{const p=t.type||"text",g=t.display||f[p]||f.default,m=c===n,v=x(i,Z(t.className,{row:e,column:t,value:s,name:n,rowIndex:r,cellIndex:o}),m?d:null,I(l[n])?h:null,t.right&&ze.right,t.center&&ze.center,t.align&&ze[t.align]);return a.jsx("td",{className:v,children:a.jsx(g,{row:e,column:t,value:s,name:n,field:n,rowIndex:r,cellIndex:o})})},vc=z.Consumer(Jb),Qb=({row:e,rowIndex:t,columns:n,rowClass:s,onRowClick:r=F,visibleColumns:o,Cell:i=vc})=>a.jsx("tr",{className:Z(s,{row:e,rowIndex:t}),onClick:()=>r({row:e,rowIndex:t}),children:o.filter(l=>n[l]).map((l,c)=>{const d=n[l],h=d.field??l,f=e[h];return a.jsx(i,{row:e,rowIndex:t,index:c,name:l,field:h,column:d,value:f},l)})}),mc=z.Consumer(Qb),Rb=({noRowsClass:e=uc,noRowsText:t="No rows selected",visibleColumns:n})=>a.jsx("tr",{className:e,children:a.jsx("td",{colSpan:n.length,children:t})}),Cc=z.Consumer(Rb),ev=({page:e,Row:t=mc,NoRows:n=Cc})=>a.jsx("tbody",{children:e.rows.length?e.rows.map((s,r)=>a.jsx(t,{row:s,rowIndex:r},s.id??r)):a.jsx(n,{})}),yc=z.Consumer(ev),tv=({name:e,column:t,filters:n,sortColumn:s,sortReverse:r,toggleSortColumn:o,sortUpIcon:i="arrow-up",sortDownIcon:l="arrow-down",unsortedIcon:c="arrows",sortIconClass:d="sort-icon",sortingClass:h=Co,headingClass:f=dc,filteringClass:p=Wt})=>{const g=e===s,m=g&&r,v=t.sortable,C=v?()=>o(e):null;return a.jsx("th",{className:x(f,g?h:null,{sortable:v},I(n[e])?p:null,t.right&&ze.right,t.center&&ze.center,t.align&&ze[t.align]),onClick:C,children:a.jsxs("div",{className:"flex space middle",children:[a.jsx("span",{className:"wide label",children:t.heading}),!!t.sortable&&a.jsx(H,{className:d,name:g?m?i:l:c})]})})},Sc=z.Consumer(tv),nv=({columns:e,headingsClass:t=zb,visibleColumns:n,Heading:s=Sc})=>a.jsx("thead",{children:a.jsx("tr",{className:t,children:n.filter(r=>e[r]).map(r=>a.jsx(s,{name:r,column:e[r]},r))})}),wc=z.Consumer(nv),sv=({value:e,setFilter:t,column:n,placeholder:s})=>a.jsx(zt,{options:[{value:!0,text:n.trueText??Wr},{value:!1,text:n.falseText??Hr}],wide:!0,value:e,onUpdate:F,onSelect:r=>t(r.value),placeholder:s}),Ys=({value:e,setFilter:t,type:n="text",placeholder:s})=>a.jsx("input",{type:n,value:e??"",onChange:r=>t(r.target.value),placeholder:s}),Ht=e=>a.jsx(Ys,{type:"number",...e}),Ut={default:Ys,string:Ys,text:Ys,id:Ht,number:Ht,integer:Ht,float:Ht,price:Ht,pounds:Ht,select:({value:e,setFilter:t,column:n,placeholder:s})=>a.jsx(zt,{options:n.selectOptions||[],value:e,onUpdate:F,onSelect:r=>t(n.selectValue?n.selectValue(r):ie(r)?r.value:r),placeholder:s,wide:!0}),boolean:sv},rv=({name:e,column:t,filters:n,setFilter:s,filterClass:r=jt,filteringClass:o=Wt,filterIcon:i=jt,clearFilterIcon:l=lc})=>{const c=t.filterComponent||Ut[t.filterType]||Ut[t.type]||Ut.default;return t.filterable?a.jsx("th",{className:x(r,I(n==null?void 0:n[e])?o:null),children:a.jsxs("div",{className:"flex space middle gap-1",children:[a.jsx(c,{value:n[e]??"",setFilter:d=>s(e,d),column:t,placeholder:t.filterPlaceholder||"Filter"}),a.jsx(H,{name:pt(n[e])||n[e]?l:i,onClick:()=>s(e,null)})]})}):a.jsx("th",{})},Mc=z.Consumer(rv),ov=({columns:e,filtersClass:t=cc,visibleColumns:n,Filter:s=Mc})=>a.jsx("thead",{children:a.jsx("tr",{className:t,children:n.filter(r=>e[r]).map(r=>a.jsx(s,{name:r,column:e[r]},r))})}),Lc=z.Consumer(ov),iv=({tableClass:e="celled striped",selectableClass:t=Kb,scrollX:n,onRowClick:s,showFilters:r,Headings:o=wc,Filters:i=Lc,Rows:l=yc})=>a.jsxs("table",{className:x(e,n?"wide nowrap":"wide",{[t]:s}),children:[a.jsx(o,{}),r&&a.jsx(i,{}),a.jsx(l,{})]}),av=z.Consumer(iv),lv=({scrollX:e,Table:t=av})=>a.jsx("div",{className:e?qb:"",children:a.jsx(t,{})}),Nc=z.Consumer(lv),Ke=Ie(({page:e=0,pages:t,buttonClass:n="outline",pageClass:s=n,currentPageClass:r="solid",render:o,...i})=>{const d=t-1,h=t,f=e+1,p=e>0?e-1:null,g=I(p)?p+1:null,m=e`Go to page ${e}`,So=e=>e?`Previous page, page ${e}`:"No previous page",wo=e=>e?`Next page, page ${e}`:"No next page",dv=({prevPage:e,prevPageNo:t,setPage:n,buttonClass:s,prevClass:r=s,prevIcon:o="arrow-left",prevLabel:i=So})=>a.jsx(ae,{className:r,icon:o,onClick:()=>n(e),disabled:Rn(e),label:Z(i,t)}),xc=Ke.Consumer(dv),uv=({nextPage:e,nextPageNo:t,setPage:n,buttonClass:s,nextClass:r=s,nextIcon:o="arrow-right",nextLabel:i=wo})=>a.jsx(ae,{className:r,icon:o,onClick:()=>n(e),disabled:!e,label:Z(i,t)}),$c=Ke.Consumer(uv),hv=({pageNo:e,text:t=e,buttonClass:n,className:s=n,onClick:r,current:o,pageLabel:i=Dc})=>a.jsx(ae,{text:t,className:s,onClick:r,label:o?null:Z(i,e),"aria-current":o?"page":null}),Tc=Ke.Consumer(hv),fv=a.jsx(a.Fragment,{children:"…"}),gv=({pageSeparatorClass:e="separator",pageSeparator:t=fv})=>a.jsx("div",{role:"separator",className:e,children:t}),Oc=Ke.Consumer(gv),pv=({page:e,pageNo:t,firstPage:n,firstPageNo:s,prevPage:r,prevPageNo:o,nextPage:i,nextPageNo:l,lastPage:c,lastPageNo:d,setPage:h,pagesClass:f="pages",buttonClass:p,pageClass:g=p,currentPageClass:m="brand",showFirstLast:v=!0,Separator:C=Oc,Page:y=Tc})=>a.jsxs("div",{className:f,children:[v&&r>n&&a.jsxs(a.Fragment,{children:[a.jsx(y,{page:n,pageNo:s,className:g,onClick:()=>h(n)}),r>n+1&&a.jsx(C,{})]}),I(r)&&a.jsx(y,{page:r,pageNo:o,className:g,onClick:()=>h(r)}),a.jsx(y,{page:e,pageNo:t,className:m,current:!0,disabled:!0}),I(i)&&a.jsx(y,{page:i,pageNo:l,className:g,onClick:()=>h(i)}),v&&i&&ih(c)})]})]}),kc=Ke.Consumer(pv),bv=({className:e="pager",size:t,color:n,label:s="Pagination navigation",Previous:r=xc,Next:o=$c,Pages:i=kc})=>a.jsxs("div",{role:"navigation","aria-label":s,className:x(e,t,n),children:[a.jsx(r,{}),a.jsx(i,{}),a.jsx(o,{})]}),Ic=Ke.Consumer(bv),Ec=D(({Content:e=Ic,...t})=>a.jsx(Ke.Provider,{...t,children:a.jsx(e,{})}),"Pager"),vv=({footerClass:e,pager:t={},page:n,setPageNo:s,pagerSize:r="small"})=>a.jsx("footer",{className:e,children:n.total>0&&a.jsx(Ec,{page:n.page,pages:n.pages,setPage:o=>s(o+1),size:r,...t})}),Pc=z.Consumer(vv),mv=({color:e,className:t=Hb,Header:n=gc,Body:s=Nc,Footer:r=Pc})=>a.jsxs("section",{className:x(t,e),children:[a.jsx(n,{}),a.jsx(s,{}),a.jsx(r,{})]}),Fc=z.Consumer(mv),Gs=D(({Content:e=Fc,...t})=>a.jsx(z.Provider,{...t,children:a.jsx(e,{})}),"DataTable"),Cv=({noRowsClass:e=uc,noRowsText:t="No rows selected"})=>a.jsx("div",{className:e,children:t}),yv=({row:e,column:t,name:n,value:s,rowIndex:r,cellIndex:o,cellClass:i,filters:l,sortColumn:c,sortReverse:d,sortUpIcon:h="arrow-up",sortDownIcon:f="arrow-down",unsortedIcon:p="arrows",sortIconClass:g="sort-icon",toggleSortColumn:m,headingClass:v=dc,sortingClass:C=Co,filteringClass:y=Wt,displayTypes:w=bc})=>{const S=t.type||"text",L=t.display||w[S]||w.default,M=c===n,O=M&&d,N=t.sortable,$=N?()=>m(n):null,E=[M?C:null,I(l[n])?y:null,t.right&&ze.right,t.center&&ze.center,t.align&&ze[t.align]],T=x("split-3",v,{sortable:N},...E),k=x(i,Z(t.className,{row:e,column:t,value:s,name:n,rowIndex:r,cellIndex:o}),...E);return a.jsxs("tr",{children:[a.jsx("th",{className:T,onClick:$,children:a.jsxs("div",{className:"flex space middle",children:[a.jsx("span",{className:"wide label",children:t.heading}),!!N&&a.jsx(H,{className:g,name:M?O?h:f:p})]})}),a.jsx("td",{className:k,children:a.jsx(L,{row:e,column:t,value:s,name:n,field:n,rowIndex:r,cellIndex:o})})]})},Sv=z.Consumer(yv),wv=({row:e,rowIndex:t,columns:n,visibleColumns:s,tableClass:r="wide celled shaded small"})=>a.jsx("table",{className:r,children:a.jsx("tbody",{children:s.filter(o=>n[o]).map((o,i)=>{const l=n[o],c=l.field??o,d=e[c];return a.jsx(Sv,{row:e,rowIndex:t,index:i,name:o,field:c,column:l,value:d},o)})})}),Mv=z.Consumer(wv),Lv=({name:e,column:t,filters:n,setFilter:s,filterClass:r=jt,filteringClass:o=Wt,filterIcon:i=jt,clearFilterIcon:l=lc})=>{const c=t.filterComponent||Ut[t.filterType]||Ut[t.type]||Ut.default;return a.jsxs("div",{className:x(r,"field mar-v-none",I(n==null?void 0:n[e])?o:null),children:[a.jsx("label",{children:t.heading}),a.jsxs("div",{className:"inputs",children:[a.jsx(c,{value:n[e]??"",setFilter:d=>s(e,d),column:t,placeholder:t.filterPlaceholder||"Filter"}),a.jsx("div",{className:"suffix",children:a.jsx(H,{name:pt(n[e])||n[e]?l:i,onClick:()=>s(e,null)})})]})]})},Nv=z.Consumer(Lv),Ac=D(({minWidth:e,gap:t,children:n,className:s,tilesClass:r="tiles",style:o={}})=>(e&&(o["--tile-min-width"]=e),a.jsx("div",{className:x(s,r,os(t)),style:o,children:n})),"Tiles"),Dv=({columns:e,filtersClass:t=cc,visibleColumns:n,Filter:s=Nv,minFilterWidth:r="12rem",filterGap:o="2"})=>a.jsx("div",{className:t,children:a.jsx(Ac,{minWidth:r,gap:o,children:n.filter(i=>{var l;return(l=e[i])==null?void 0:l.filterable}).map(i=>a.jsx(s,{name:i,column:e[i]},i))})}),xv=z.Consumer(Dv),$v=({page:e,showFilters:t,bodyClass:n="grid-1 gap-4 mar-v-4",Filters:s=xv})=>a.jsxs("div",{className:n,children:[!!t&&a.jsx(s,{}),e.rows.length?e.rows.map((r,o)=>a.jsx(Mv,{row:r,rowIndex:o},r.id??o)):a.jsx(Cv,{})]}),Vc=z.Consumer($v),Tv=({breakpoint:e,...t})=>{const n=da(e),{ref:s,width:r}=Ho();return a.jsx("div",{ref:s,children:a.jsx(Gs,{Body:re?a.jsx(Tv,{breakpoint:e,...t}):a.jsx(Gs,{Body:Vc,...t}),Bc=Ot("value values");let kv=(xt=class extends gt{constructor(t){super(t);const n=this.initProps(t);this.state={...n}}initProps(t){const{value:n=[],values:s=n,options:r=[],findOption:o,optionValue:i}=t;return{values:s.map(c=>{const[d]=o(r,i(c));return d}).filter(I)}}componentDidUpdate(t){let n;if(this.props.options!==t.options?n=hs(Bc,this.props,t)?this.initProps(this.props):this.initProps({...this.props,value:this.state.values}):hs(Bc,this.props,t)&&(n=this.initProps(this.props)),n){const s=this.props.onUpdate||this.props.onChange;this.setState(n,()=>s(n.values))}}onSelect(t){return this.debug("selected option:",t),this.debug("current values:",this.state.values),this.unselectMultiOption(t)||this.selectMultiOption(t)}optionIsSelected(t){const[,n]=this.props.findOption(this.state.values,this.props.optionValue(t));return I(n)}unselectMultiOption(t){if(!I(t))return null;const[n,s]=this.props.findOption(this.state.values,this.props.optionValue(t));if(!I(s))return this.debug("item is not selected:",t),!1;this.debug(`unselecting item at ${s}:`,n);const r=this.state.values.filter((o,i)=>i!==s);return this.setValues(r),!0}selectMultiOption(t){if(!I(t))return null;const[n,s]=this.props.findOption(this.props.options,this.props.optionValue(t));if(!I(s))return this.debug("item is not selectable:",t),!1;this.debug(`selecting item at ${s}:`,n);const r=[...this.state.values,n];return this.setValues(r),!0}setValues(t){this.debug("setValues:",t),this.setState({values:t},()=>this.props.onChange(t))}},P(xt,"debug",!1),P(xt,"debugPrefix","MultiSelect > "),P(xt,"debugColor","MediumVioletRed"),P(xt,"defaultProps",{findOption:Er,optionValue:Ir,displaySelection:Re("displaySelection"),onChange:F}),P(xt,"actions",["onSelect","optionIsSelected","selectMultiOption","unselectMultiOption","setValues"]),xt);const rt=Ie(kv),{Provider:Iv,Consumer:Ev,Use:Pv}=rt,Fv=({option:e,optionClass:t="option",selectedIcon:n="check",unselectedIcon:s,noIconClass:r="no-icon",displayOption:o=Re("displayOption"),optionIsSelected:i})=>a.jsxs("div",{className:t,children:[a.jsx("div",{children:o(e)}),i(e)?a.jsx(H,{...Or(n)}):s?a.jsx(H,{...Or(s)}):a.jsx("div",{className:r})]}),jc=rt.Consumer(Fv);let Av=(se=class extends ys{constructor(t){super(t),this.state={...this.state,...this.valueState(),closeOnBlur:!this.props.search},this.debug(`search: ${this.props.search} closeOnBlur: ${this.state.closeOnBlur}`)}componentDidUpdate(t){let n;if(this.props.options!==t.options&&(this.debug("options have changed, current value is",this.state.value),n=this.valueState(this.state.value)),this.props.value!==t.value&&(this.debug(`value has changed from ${t.value} to ${this.props.value}`),n=this.valueState()),n){const s=I(n.value)?this.props.onUpdate||this.props.onSelect:F;this.setState(n,()=>s(n.value))}}initialCursor(){return this.state.cursor}valueState(t=this.props.value){const n=this.props.options,[s,r]=this.props.findOption(n,t);return{value:s,cursor:r,options:n}}selectState(t){return{value:t,selected:t}}closeState(){return{...this.constructor.inactiveState,options:this.props.options}}onKeyDown(t){if(this.debug(`onKeyDown(${t.key})`),!this.props.disabled){switch(t.key){case gn:this.state.isOpen?this.setCursor(this.cursorNextIndex()):this.open(this.initialCursor()??this.cursorFirstIndex());break;case fn:this.state.isOpen?this.setCursor(this.cursorPrevIndex()):this.open(this.initialCursor()??this.cursorLastIndex());break;case pn:this.state.isOpen?this.selectCursor():this.open(this.initialCursor()??this.cursorFirstIndex());break;case bn:this.close();break;case Va:this.debug("backspace"),this.searchBackspace();break;case Aa:return;case Cs:if(this.state.isOpen){if(!(this.state.searchInput??yt).length)break}else{this.debug("space to open"),this.open(this.cursorFirstIndex());break}default:if(this.debug("default keypress"),t.altKey||t.ctrlKey||t.metaKey)return;if(t.key.length===1){this.debug(`typed key ${t.key}`),this.searchKey(t.key),this.state.open||this.open(),this._searchRef&&this._searchRef.focus();break}this.debug(`ignored key ${t.key}`);return}t.preventDefault()}}searchRef(t){this.debug("searchRef()"),this._searchRef=t}focusSearch(t){this.debug("focusSearch()"),t==null||t.stopPropagation(),this.setState({searchFocus:!0})}blurSearch(){this.debug("blurSearch()"),this.setState({searchFocus:!1}),this.closeSoon()}setSearch(t){this.setState({searchInput:t},()=>this.searchOptions())}searchKey(t){this.setSearch((this.state.searchInput??yt)+t)}searchBackspace(){this.setSearch(I(this.state.searchInput)&&this.state.searchInput.length>1?this.state.searchInput.slice(0,-1):void 0)}clearSearch(t){t==null||t.preventDefault(),t==null||t.stopPropagation(),this._searchRef&&(this.debug("re-focussing search input"),this._searchRef.focus()),this.setSearch(void 0)}searchOptions(){this.debug("searchOptions(), searchInput: ",this.state.searchInput);const{options:t,searchOptions:n}=this.props;this.setState(s=>({options:I(s.searchInput)?n(s.searchInput,this.props.options.filter(this.props.validOption)):t,cursor:0}))}closeable(t){return this.debug(`closeable() force:${t} hasHover:${this.state.hasHover} searchFocus:${this.state.searchFocus}`),t||!(this.state.hasHover||this.state.searchFocus)}menuOptions(){return this.state.options}},P(se,"debug",!1),P(se,"debugPrefix","Select > "),P(se,"debugColor","MediumVioletRed"),P(se,"defaultProps",{...se.defaultProps,options:[],search:!1,findOption:Er,validOption:kt,searchOptions:Ri,displayValue:Re("displayValue"),displayOption:Re("displayOption"),displayHeading:Re("displayHeading")}),P(se,"inactiveState",{isOpen:!1,selected:void 0,searchInput:void 0}),P(se,"initialState",{value:yt,cursor:void 0,...se.inactiveState}),P(se,"initialProps",{}),P(se,"actions",["onFocus","onBlur","onClick","onKeyDown","open","close","setCursor","selectCursor","selectOption","menuRef","activeRef","searchRef","focusSearch","blurSearch","setSearch","clearSearch"]),se);const ge=Ie(Av),{Provider:Vv,Consumer:Bv,Use:jv}=ge,Wv=({value:e,onFocus:t,onBlur:n,onClick:s,placeholder:r="Select",placeholderClass:o="placeholder",inputsClass:i="inputs",inputClass:l="input",suffixClass:c="suffix",displayValue:d,disabled:h})=>a.jsxs("div",{className:i,onClick:h?null:s,children:[a.jsx("div",{onFocus:h?null:t,onBlur:h?null:n,disabled:h,className:l,tabIndex:0,children:I(e)?d(e)??a.jsx(a.Fragment,{children:" "}):a.jsx("span",{className:o,children:r})}),a.jsx("div",{className:c,children:a.jsx(H,{name:"angle-down"})})]}),Wc=ge.Consumer(Wv),Hv=({option:e,optionClass:t="item no-hover",headingClass:n="heading",displayHeading:s})=>a.jsx("div",{className:x(t,n,e.indent?`indent-${e.indent}`:null),children:s(e)}),Hc=ge.Consumer(Hv),Uv=({option:e,active:t,activeRef:n,selected:s,onClick:r,onMouseEnter:o,validOption:i,displayOption:l,optionClass:c="item no-hover",activeClass:d="active",selectedClass:h="selected",disabledClass:f="disabled"})=>a.jsx("div",{className:x(c,e.className,e.indent?`indent-${e.indent}`:null,t?d:null,s?h:null,i(e)?null:f),onMouseEnter:o,onClick:r,ref:t?n:null,"aria-disabled":e.disabled,children:l(e)}),Uc=ge.Consumer(Uv),zv=({separatorClass:e="separator"})=>a.jsx("div",{className:e}),zc=ge.Consumer(zv),Kv=({option:e,Heading:t=Hc,Separator:n=zc,Option:s=Uc,...r})=>e.heading?a.jsx(t,{option:e,...r}):e.separator?a.jsx(n,{option:e,...r}):a.jsx(s,{option:e,...r}),Kc=ge.Consumer(Kv),_v=({noOptionsClass:e="none",noOptions:t="No options"})=>a.jsx("div",{className:e,children:t}),_c=ge.Consumer(_v),qv=({options:e,menuRef:t,menuClass:n="menu border bdr-1",cursor:s,selected:r,selectOption:o,setCursor:i,Item:l=Kc,NoOptions:c=_c})=>a.jsx("div",{className:n,ref:t,children:Me(e)&&e.length?e.map((d,h)=>a.jsx(l,{option:d,active:I(s)&&e[s]===d,selected:r===d,onClick:()=>o(d),onMouseEnter:()=>i(h)},d.id??d.value??h)):a.jsx(c,{})}),qc=ge.Consumer(qv),Xv=({searchInput:e,focusSearch:t,blurSearch:n,searchRef:s,setSearch:r,clearSearch:o,searchPlaceholder:i="Search",searchFieldClass:l="search field",searchInputsClass:c="inputs",searchPrefixClass:d="shaded lined prefix",searchSuffixClass:h="shaded lined suffix",searchClearClass:f="clear",inputClass:p,searchIcon:g="search",clearSearchIcon:m="cross"})=>a.jsx("div",{className:l,children:a.jsxs("div",{className:c,children:[a.jsx("div",{className:d,children:a.jsx(H,{name:g})}),a.jsx("input",{ref:s,className:p,type:"text",placeholder:i,value:e??"",onClick:v=>v.stopPropagation(),onChange:v=>r(v.target.value),onFocus:t,onBlur:n,autoComplete:"chrome-is-broken",tabIndex:"0"}),a.jsx("div",{className:x(h,e?f:null),onClick:o,children:a.jsx(H,{name:m})})]})}),Xc=ge.Consumer(Xv),Yv=({onKeyDown:e,isOpen:t,search:n,selectClass:s="select",openClass:r="open",closedClass:o="closed",Input:i=Wc,Search:l=Xc,Menu:c=qc,wide:d})=>a.jsxs("div",{className:x(s,t?r:o,{wide:d}),onKeyDown:e,children:[a.jsx(i,{}),!!t&&!!n&&a.jsx(l,{}),!!t&&a.jsx(c,{})]}),Yc=ge.Consumer(Yv),zt=D(({Content:e=Yc,...t})=>a.jsx(ge.Provider,{...t,children:a.jsx(e,{})}),"Select"),Gv=({selection:e,displaySelection:t,unselectMultiOption:n,selectionClass:s="selection",unselectIcon:r="cross",dragHandle:o})=>a.jsxs("div",{className:s,onClick:()=>n(e),children:[o,a.jsx(We,{iconRight:r,children:t(e)})]}),Mo=rt.Consumer(Gv),Zv=({values:e,selectionsClass:t="selections",Selection:n=Mo})=>a.jsx("div",{className:t,children:e.map((s,r)=>a.jsx(n,{selection:s},r))}),Gc=rt.Consumer(Zv),Jv=({values:e,setValues:t,selectionsClass:n="selections",dragIcon:s="move",dragIconClass:r="drag-icon",Selection:o=Mo})=>{const i=c=>t(c.map(d=>d.value)),l=({item:c,setNodeRef:d,style:h,listeners:f,...p})=>a.jsx("div",{ref:d,style:h,className:`sortable item ${c.moved?"moved":""}`,...p,children:a.jsx(o,{selection:c.value,dragHandle:a.jsx("div",{className:r,...f,children:a.jsx(H,{name:s})})})});return a.jsx("div",{className:n,children:a.jsx(Xs,{items:e.map((c,d)=>({id:d+1,value:c})),Item:l,setOrder:i})})},Zc=rt.Consumer(Jv),Qv=({className:e="multiselect",sortable:t,Option:n=jc,Select:s=zt,Selections:r=Gc,SortSelections:o=Zc,...i})=>a.jsxs("div",{className:e,children:[a.jsx(s,{...i,onUpdate:F,displayOption:l=>a.jsx(n,{option:l})}),t?a.jsx(o,{}):a.jsx(r,{})]}),Jc=rt.Consumer(Qv),Qc=D(({Content:e=Jc,...t})=>a.jsx(rt.Provider,{...t,children:a.jsx(e,{})}),"MultiSelect");var Rv=Object.defineProperty,em=(e,t,n)=>t in e?Rv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ne=(e,t,n)=>(em(e,typeof t!="symbol"?t+"":t,n),n),tm=Object.defineProperty,nm=(e,t,n)=>t in e?tm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lo=(e,t,n)=>nm(e,typeof t!="symbol"?t+"":t,n);function sm(e={},t={},n={}){return Object.entries(t).reduce((s,[r,o])=>{const i=n[o];return i!==null&&typeof i<"u"&&(s[r]=i),s},{...e})}function rm(e,t=[]){return(typeof t=="string"?t.split(/,\s*|\s+/):t).reduce((n,s)=>{const r=e[s]||lm(`Cannot expose non-existent action method: ${s}`);return n[s]=r.bind(e),n},{})}function om(e,t){const n=e.debug??t.debug,s=ed(e.debugPrefix??t.debugPrefix,e),r=ed(e.debugColor??t.debugColor,e);return n?s?(o,...i)=>console.log(`%c${s}%c${o}`,`color: ${r}`,"color:black",...i):console.log.bind(console):()=>{}}function im(e){return Array.isArray(e)}function Rc(e){return typeof e=="function"}function ed(e,t){return Rc(e)?e(t):e}function am(e){return im(e)?e:[e]}function lm(...e){throw new Error(e.join(""))}const td=(e,t={},n=b.createContext(t))=>({Context:n,Provider:s=>a.jsx(e,{...s,render:r=>a.jsx(n.Provider,{value:r,children:s.children})}),Consumer:s=>r=>a.jsx(n.Consumer,{children:o=>a.jsx(s,{...o,...r})}),Children:({children:s})=>am(s).map((r,o)=>Rc(r)?a.jsx(n.Consumer,{children:r},o):r),Use:()=>b.useContext(n)});let Zs=class extends b.Component{constructor(e){super(e);const t=this.constructor;this.debug=om(e,t),this.state=sm(t.initialState,t.initialProps,e),this.actions=rm(this,t.actions)}getContext(){return{...this.props,...this.state,...this.actions}}getRenderProps(){return this.getContext()}render(){return this.props.render(this.getRenderProps())}};Lo(Zs,"initialState",{}),Lo(Zs,"initialProps",{}),Lo(Zs,"actions",[]);function No(e){return typeof e=="boolean"}function Lt(e){return typeof e=="string"}function cm(e){return typeof e=="number"}function On(e){return Array.isArray(e)}function Js(e){return typeof e=="function"}function dm(e){return e instanceof RegExp}function kn(e){return typeof e=="object"&&!On(e)&&!nd(e)}function um(e){return Lt(e)||cm(e)||No(e)}function hm(e){return e===void 0}function nd(e){return e===null}function ce(e){return!(hm(e)||nd(e))}function fm(e){return!ce(e)}function gm(...e){throw new Error(e.join(""))}const sd=(e,...t)=>Js(e)?e(...t):e;function Kt(){}function pm(){return Intl.DateTimeFormat().resolvedOptions().locale}pm();function rd(e,t=/,\s*|\s+/){return fm(e)?[]:Lt(e)?e.length?e.split(t):[]:On(e)?e:[e]}function od(e,t=!0,n={}){return kn(e)?e:rd(e).reduce((s,r)=>(s[r]=Js(t)?t(r):t,s),n)}function bm(e){if(Js(e))return e;if(dm(e))return t=>e.test(t);if(kn(e))return t=>!!e[t];if(On(e)||Lt(e)){const t=od(e);return n=>!!t[n]}gm("Invalid selector() specification: "+e)}const vm=(e,t,n={})=>{let s={},r={delete:!1,...n};const o=bm(t);return Object.keys(e).map(i=>{if(o(i)){let l=e[i];r.delete&&delete e[i],r.key&&(i=r.key(i)),r.value&&(l=r.value(l)),s[i]=l}}),s},mm="",Cm="blur",In="changed",ym="disabled",Qs="focus",Sm="fulfilled",En="invalid",id="Optional",wm="radio",ad="Required",Mm="A value is required",ld="reset",Pn="submitted",_t="submitting",Do="text",Lm="unvalidated",Fn="valid",ot="validating",Nm=["id","name","type","value","checked","disabled","placeholder","autoComplete","onFocus","onBlur","size","rows","min","max","step","minLength","maxLength","pattern","list"],Dm=["id","name","action","method","encType"];let cd=class extends Zs{constructor(e){super(e),this.newStatus=this.constructor.newStatus(e),this.state={status:this.newStatus(ld)}}setStatus(e,t={},n=Kt){this.mounted&&this.setState(s=>({...Js(t)?t(s):t,status:this.newStatus(e,s.status)}),n)}setResetState(e,t){this.setStatus(ld,e,t)}setChangedState(e,t){this.setStatus(In,e,t)}setValidatingState(e,t){this.setStatus(ot,e,t)}setInvalidState(e,t){this.setStatus(En,e,t)}setValidState(e,t){this.setStatus(Fn,e,t)}setUnvalidatedState(e,t){this.setStatus(Lm,e,t)}};function dd(e,t){return t.reduce((n,s)=>{const r=e[s]||e[s.toLowerCase()];return ce(r)&&(n[s]=r),n},{})}const Rs=e=>dd(e,Nm),xm=e=>dd(e,Dm),ud=e=>e.filter(ce).join(" "),$m=e=>Object.entries(e).filter(([,t])=>t).map(([t])=>t),De=(...e)=>ud(e.flatMap(t=>kn(t)?$m(t):t)),An=(e,...t)=>De(e.inputClass,e.inline&&"inline",...t),qt=(e,t,n=t)=>(e==null?void 0:e[t])||n,hd=(e,t={},...n)=>ud(Object.entries(e).reduce((s,[r,o])=>(o&&s.push(t[r]||r),s),[...n])),fd=e=>{const{status:t,className:n,classes:s,required:r,showRequired:o,showOptional:i}=e;return hd(t,s,qt(s,"field"),n,o&&r?"required":null,i&&!r?"optional":null)},gd=(e,...t)=>{const{gap:n,space:s,stack:r,className:o}=e;return o||(s?De("flex","space",...t):De("flex",n?`gap-v-none gap-h-${n}`:null,r?`stack-${r}`:null,...t))},Tm=(e,...t)=>{const{grid:n,gap:s,stack:r,className:o}=e;return o||(n?De(`grid-${n}`,s?`gap-v-none gap-h-${s}`:null,r?`stack-${r}`:null,...t):De(...t))},Om={boolean:!0,string:!0,number:!0},pd=e=>Om[typeof e]?{value:e,text:e}:e,er=(...e)=>function(...t){for(let n of e.filter(Boolean))n(...t)};function bd(e){if(No(e))return[1,!1];if(ce(e)){const t=(e==null?void 0:e.toString().length)??0;return[t,t===0]}return[0,!0]}const km=(e,t)=>Lt(e)?{[t]:e}:e,vd=e=>e.replaceAll(/\W+/g,"").toLowerCase(),Im={submittingClass:_t,validatingClass:ot,resetOnSuccess:!0,focusInvalidField:!0,enctype:"application/x-www-form-urlencoded",method:"post",errorsTitle:e=>`Form Error${e>1?"s":""}`,errorsPrompt:e=>`Please correct ${e===1?"this problem":"these problems"} and re-submit:`},md={validateOnChange:!1,validateOnBlur:!1,validateOnInvalid:!0,showRequired:!1,showOptional:!1,validMessage:null,minValidateLength:1,requiredMessage:Mm,requiredLabel:ad,optionalLabel:id},Em=od(["showRequired","requiredLabel","showOptional","optionalLabel","validateOnChange","validateOnBlur","validateOnInvalid","minValidateLength","validMessage","requiredMessage","classes","wide"]),Xt={[Fn]:!1,[En]:!1},Pm={...Xt,[In]:!0},Fm={...Xt,[ot]:!0},Am={[Fn]:!1,[En]:!0,[ot]:!1},Vm={[Fn]:!0,[En]:!1,[ot]:!1},Bm={[Qs]:!1},jm={[Qs]:!0},Wm={[_t]:!0,[Pn]:!1},Hm={[_t]:!1,[Pn]:!0},Cd={changed:Pm,validating:Fm,invalid:Am,valid:Vm},yd=e=>(t,n={})=>({...n,...e[t]||{[t]:!0}}),Um=()=>{const e={...Xt,[In]:!1,[ot]:!1,[Pn]:!1,[_t]:!1};return yd({...Cd,reset:e,submitting:Wm,submitted:Hm,unvalidated:Xt})},zm=(e={})=>{const t={...Xt,[In]:!1,[ot]:!1,[Qs]:!1,[ym]:e.disabled||!1};return yd({...Cd,reset:t,focus:jm,blur:Bm,unvalidated:Xt})},Km=({status:e,any:t=!1,...n})=>{const s=[In,ot,Fn,En,_t,Pn].filter(r=>ce(n[r])).map(r=>e[r]);return t?s.some(Boolean):s.every(Boolean)};class Yt extends cd{constructor(t){super(t),this.fields={};const{hidden:n={}}=t,s={...n},r={...Im,...this.props};this.state={...r,...this.state,initialValues:s,values:{...s},errors:[],error:null},this.props.onLoad&&this.props.onLoad(this)}componentDidMount(){this.debug("componentDidMount()"),this.mounted=!0}componentWillUnmount(){this.debug("componentWillUnmount()"),this.mounted=!1}fieldSpec(t,n){var s,r;const o=((s=this.props.fields)==null?void 0:s[t])??{},i=n.value??((r=this.props.values)==null?void 0:r[t]);return{name:t,...vm(this.props,Em),...o,...n,value:i}}attachField(t,n){this.debug(`attaching ${t} field`),this.fields[t]=n,this.setState(s=>({values:{...s.values,[t]:n.state.value}}))}detachField(t){this.debug(`detaching ${t} field`),delete this.fields[t]}setSubmittingState(t,n){this.setStatus(_t,t,n)}setSubmittedState(t,n){this.setStatus(Pn,t,n)}setFocus(t,n){var s;n==null||n.preventDefault(),(s=this.fields[t])==null||s.setFocus()}reset(t){this.mounted&&(this.debug("reset()"),t==null||t.preventDefault(),this.resetFields(),this.setResetState({errors:[],error:null},this.props.onReset))}resetFields(){this.debug("resetFields()"),Object.values(this.fields).forEach(t=>t.reset())}setValue(t,n){this.debug(`setValue(${t}, ${n})`),this.setChangedState(s=>({...s,values:{...s.values,[t]:n}}))}setValues(t,n){this.debug("setValues():",t),n==null||n.preventDefault(),Object.entries(t).forEach(([s,r])=>{var o;return(o=this.fields[s])==null?void 0:o.setValue(r)})}setHidden(t){const n={...this.state.hidden,...t};this.setState({hidden:n})}submit(t){this.debug("submit()"),t==null||t.preventDefault(),this.validate().then(n=>this.handleSubmit(n)).catch(n=>this.debug("Form is NOT valid:",n))}validate(){return this.debug("validate()"),this.setValidatingState(),new Promise(this.validator()).then(t=>(this.debug("validate passed: ",t),this.setValidState({submit:t,error:null,errors:[]},this.props.onValid),t)).catch(t=>{throw this.debug("validate failed: ",t),this.handleError({error:t.error,errors:t.errors}),t})}validator(){return(t,n)=>Promise.allSettled(Object.values(this.fields).map(s=>s.validate())).then(s=>s.reduce((r,{status:o,value:i,reason:l})=>(o===Sm?Object.assign(r.values,i.data||{[i.name]:i.value}):r.errors.push(l),r),{values:{...this.state.values},errors:[]})).then(s=>{var r;return this.debug("field validation complete: ",s),(r=s.errors)!=null&&r.length?(this.debug("errors detected, rejecting: ",s),n(s)):this.props.validate?(this.debug("validating form: ",s),this.props.validate(s.values,this.getContext()).then(o=>t({...s,values:o})).catch(o=>n(o))):t(s)})}unvalidate(){Object.values(this.fields).map(t=>t.unvalidate()),this.setUnvalidatedState()}handleSubmit(t){if(this.debug("Form is valid, handling submission:",t),!this.props.onSubmit){window.alert("You haven't defined an onSubmit handler: "+JSON.stringify(t.values));return}this.setSubmittingState({},async()=>{this.debug("calling onSubmit handler: ",t);try{const n=await this.props.onSubmit(t.values,this.getContext());if(this.debug("onSubmit response:",n),this.setSubmittedState(),n!=null&&n.ok||(n==null?void 0:n.status)===200)this.debug(`Success response ok:${n==null?void 0:n.ok} status:${n==null?void 0:n.status}`),this.handleSuccess(n);else if((n==null?void 0:n.status)>=400&&n.status<=500)this.debug(`Error response status:${n==null?void 0:n.status}`),this.handleError(n.data);else throw new Error(`Unknown response: ${n==null?void 0:n.status}`)}catch(n){this.debug("onSubmit error:",n),this.setSubmittedState(),this.handleError(Lt(n)?{error:n}:n instanceof Error?{error:n.message}:n)}})}handleSuccess(t){this.debug("handleSuccess()",t);const n=this.props.onSuccess||Kt;this.setValidState({},er(()=>n(t,this),this.props.resetOnSuccess&&(()=>this.reset()),this.props.unvalidateOnSuccess&&(()=>this.unvalidate())))}handleError(t={}){this.debug("handleError()",t),t.errors&&(t.errors=this.sanitiseErrors(t.errors));const n=On(t==null?void 0:t.errors)&&this.fieldErrors(t.errors),s=this.props.onError||this.props.onFailure||Kt;this.setInvalidState(t,er(()=>s(t),n?()=>n.setFocus():null))}fieldErrors(t){this.debug("fieldErrors: ",t);const n=t.reduce((s,r)=>{const o=r.name??r.param??r.field,{message:i}=r,l=o&&this.fields[o];return l&&(r.label||(r.label=l.props.label),l.setInvalidState({message:i}),s.push(l)),s},[]);return this.state.focusInvalidField&&n.length?n[0]:null}sanitiseErrors(t){if(kn(t)&&(t=Object.entries(t).map(([n,s])=>({name:n,...km(s,"message")}))),!On(t))throw new Error("Invalid errors type (not an array or object)");return t.forEach(n=>n.message??(n.message=n.error)),t}getContext(){return{...this.props,...this.state,...this.actions}}}Ne(Yt,"newStatus",Um),Ne(Yt,"debug",!1),Ne(Yt,"debugPrefix","Form > "),Ne(Yt,"debugColor","rebeccapurple"),Ne(Yt,"actions",["fieldSpec","attachField","detachField","setFocus","reset","validate","unvalidate","submit","setValue","setValues","setHidden","setStatus","setResetState","setChangedState","setValidatingState","setValidState","setInvalidState","setSubmittingState","setSubmittedState","handleError"]);const _m=td(Yt),{Context:P0,Provider:qm,Consumer:Xm,Children:Sd,Use:Nt}=_m,Ym=({children:e})=>{const t=Nt(),n=xm(t),{submit:s,className:r}=t;return a.jsx("form",{className:r,...n,onSubmit:s,noValidate:!0,children:a.jsx(Sd,{children:e})})},Gm=({children:e,Layout:t=Ym,...n})=>a.jsx(qm,{...n,children:a.jsx(t,{children:e})}),Zm=e=>{const{id:t,value:n}=e;return{...e,id:t||b.useId(),value:n??e.default??mm}};class Gt extends cd{constructor(t){super(t),this.name=t.name;const{value:n}=t,s=n;this.form=this.props.form,this.state={...this.state,initialValue:s,value:n,error:null},this.debug("initial state:",this.state),this.inputRef=b.createRef(),this.resetRef=b.createRef(),this.on={load:this.contextFunction(this.props.onLoad),focus:this.contextFunction(this.props.onFocus),blur:this.contextFunction(this.props.onBlur),change:this.contextFunction(this.props.onChange),valid:this.contextFunction(this.props.onValid),invalid:this.contextFunction(this.props.onInvalid),unvalidate:this.contextFunction(this.props.onUnvalidate),reset:this.contextFunction(this.props.onReset)},this.on.load()}contextFunction(t){return t?()=>t(this.getContext()):Kt}componentDidMount(){this.debug("componentDidMount"),this.mounted=!0,this.form.attachField(this.props.name,this)}componentWillUnmount(){this.debug("componentWillUnmount"),this.mounted=!1,this.form.detachField(this.props.name)}setFocusState(t,n){return this.setStatus(Qs,t,n)}setBlurState(t,n){return this.setStatus(Cm,t,n)}onFocus(){this.setFocusState({},this.on.focus)}onBlur(){this.setBlurState({},this.props.validateOnBlur?()=>this.validation(this.on.blur):this.on.blur)}setFocus(t){var n,s;t==null||t.preventDefault(),(s=(n=this.inputRef)==null?void 0:n.current)==null||s.focus()}onChange(t){this.debug(`onChange(${t})`);const n=this.props.prepareValue?this.props.prepareValue(t):t,{invalid:s}=this.state.status,{validateOnChange:r,validateOnInvalid:o=!0,minValidateLength:i=1}=this.props,[l]=bd(n);let c=r||o&&s;l{this.form.setValue(this.props.name,n),c?this.validation(this.on.change):this.on.change()})}setValue(t,n){n==null||n.preventDefault(),this.onChange(t)}reset(t){t==null||t.preventDefault();const n=this.props.prepareValue?this.props.prepareValue(this.state.initialValue):this.state.initialValue;return this.debug(`reset initialValue:${this.state.initialValue} => ${n}`),this.form.setValue(this.props.name,n),this.setResetState({value:n,message:this.props.message},()=>{var s,r;return(r=(s=this.resetRef)==null?void 0:s.current)==null?void 0:r.reset()}),n}validation(t){this.validate(t).then(Kt).catch(Kt)}validate(t){this.debug("validate()");const n={name:this.name,label:this.props.label};return new Promise(this.validator()).then(s=>(this.debug("validate() passed:",s),this.setValidState(s,er(this.on.valid,t)),{...n,...s})).catch(s=>{throw this.debug("validate() failed:",s),this.setInvalidState(s,er(this.on.invalid,t)),{...n,...s}})}validator(){return async(t,n)=>{const{value:s=""}=this.state,{validate:r,required:o,optional:i,requiredMessage:l,validMessage:c}={...md,...this.props},[,d]=bd(s);if(this.setValidatingState(),r)return d&&i?(this.debug("optional field is empty"),t({value:s,message:c})):await this.validateValidator(t,n,r,c);if(d)return await this.validateEmpty(t,n,o,c,l);this.debug("no validation defined"),t({value:s,message:c})}}async validateValidator(t,n,s,r){this.debug("calling validate function");const o=this.getContext();try{this.debug(`calling validate function with value [${o.value}]`);const i=await s(o.value,o,t,n);this.debug("validate function passed:",i),t(kn(i)?{message:r,...i}:{value:i,message:r})}catch(i){this.debug("validate threw an error:",i);const l=Lt(i)?i:i.message;this.debug("rejecting with message:",l),n({message:l})}}validateEmpty(t,n,s,r,o){s?(this.debug("failing validation - required field is empty"),n({message:o})):(this.debug("passing validation - value is empty but not required"),t({message:r}))}setValid(t,n){n==null||n.preventDefault(),this.setValidState({message:t},this.on.valid)}setInvalid(t,n){n==null||n.preventDefault(),this.setInvalidState({message:t},this.on.invalid)}unvalidate(){this.setUnvalidatedState({message:this.props.message})}getContext(){const t={...md,...this.props,...this.state,...this.actions,name:this.name,inputRef:this.inputRef,resetRef:this.resetRef,setRef:this.resetRef};return delete t.form,delete t.children,delete t.render,t}}Ne(Gt,"newStatus",zm),Ne(Gt,"debug",!1),Ne(Gt,"debugPrefix",e=>`Field [${e.name}] > `),Ne(Gt,"debugColor","teal"),Ne(Gt,"actions",["onFocus","onBlur","onChange","setFocus","setValue","setValid","setInvalid","reset","setResetState","setChangedState","setValidatingState","setValidState","setInvalidState","setFocusState","setBlurState"]);const Jm=td(Gt),{Context:F0,Provider:Qm,Consumer:A0,Children:wd,Use:X}=Jm,Md=({field:e=X()})=>{const{label:t,id:n,required:s,optional:r}=e,o=e.showRequired&&s,i=e.showOptional&&(r||!s),l=t||o||i,c=e.labelClass,d={};return o&&e.requiredLabel!==ad&&(d["--required-text"]=`"${e.requiredLabel}"`),i&&e.optionalLabel!==id&&(d["--optional-text"]=`"${e.optionalLabel}"`),l&&a.jsx("label",{htmlFor:n,className:c,style:d,children:t||a.jsx("span",{children:" "})})},Rm=({field:e=X()})=>a.jsx("div",{className:De("prefix",e.prefixClass),children:e.prefix}),eC=({field:e=X()})=>a.jsx("div",{className:De("suffix",e.suffixClass),children:e.suffix}),tC=e=>t=>e.onChange(t.target.value),nC=e=>t=>e.onChange(t.target.checked),it={default:tC,checkbox:nC},Ld=({field:e=X()})=>{const{id:t,text:n,inline:s,border:r,labelClass:o,type:i="checkbox",switch:l,round:c,square:d,handler:h=it[i]||it.default}=e,f=Rs(e),p=De("checkbox",o,{inline:s,border:r});return a.jsxs("label",{htmlFor:t,className:p,children:[a.jsx("input",{type:i,ref:e.inputRef,"aria-disabled":e.disabled,tabIndex:e.disabled?-1:e.tabIndex,onChange:h(e),className:An(e,{round:c,square:d}),...f,checked:e.value,role:l?"switch":""}),n]})},xo=({field:e=X()})=>a.jsx("input",{type:"hidden",name:e.name,value:e.value}),Nd=({field:e=X()})=>{const{inline:t,border:n,options:s=[],inputClass:r,optionClass:o,optionsClass:i="options",type:l="radio",handler:c=it[l]||it.default}=e,d=Rs(e);return a.jsx("div",{className:De(i),children:s.map((h,f)=>{h=pd(h);const p=`${e.id}-${h.value}`,g=e.value==h.value,m=(e.value?g:f==0)?e.inputRef:null,v=De("radio",o,h.className,{inline:t,border:n});return a.jsxs("label",{className:v,disabled:h.disabled,htmlFor:p,children:[a.jsx("input",{type:l,className:r,ref:m,"aria-disabled":e.disabled,tabIndex:e.disabled?-1:e.tabIndex,onChange:c(e),...d,id:p,checked:g,value:h.value}),h.text]},h.value)})})},Dd=({field:e=X()})=>{const{options:t=[],placeholder:n,type:s="select",optionClass:r="option",handler:o=it[s]||it.default}=e,i=Rs(e);return a.jsxs("select",{ref:e.inputRef,"aria-disabled":e.disabled,tabIndex:e.disabled?-1:e.tabIndex,className:An(e),onChange:o(e),...i,value:e.value,required:e.required||!!n,children:[!!n&&a.jsx("option",{value:"",hidden:!0,disabled:!0,children:n}),t.map(l=>(l=pd(l),a.jsx("option",{className:r,value:l.value,disabled:l.disabled,children:l.text},l.value)))]})},$o=({field:e=X()})=>{const{type:t=Do,handler:n=it[t]||it.default}=e,s=Rs(e);return a.jsx("input",{type:t,ref:e.inputRef,className:An(e),"aria-disabled":e.disabled,tabIndex:e.disabled?-1:e.tabIndex,onFocus:e.onFocus,onBlur:e.onBlur,onChange:n(e),...s})},xd=({field:e=X()})=>{const{rows:t=5,cols:n=20}=e;return a.jsx("textarea",{id:e.id,ref:e.inputRef,className:An(e),name:e.name,value:e.value,disabled:e.disabled,"aria-disabled":e.disabled,tabIndex:e.disabled?-1:e.tabIndex,placeholder:e.placeholder,autoComplete:e.autocomplete,onChange:s=>e.onChange(s.target.value),onFocus:e.onFocus,onBlur:e.onBlur,onSelect:e.onSelect,rows:t,cols:n})},To={default:$o,checkbox:Ld,hidden:xo,radio:Nd,select:Dd,text:$o,textarea:xd},at=(e,t)=>To[vd(e)]=t,$d=(e="text")=>To[vd(e)]||To.default,sC=({field:e=X()})=>{const{classes:t,prefix:n,suffix:s,inputsClass:r,inline:o,type:i=Do,Prefix:l=Rm,Suffix:c=eC}=e,d=$d(i);let h=[qt(t,"inputs")];ce(n)&&h.push(qt(t,"prefixed")),ce(s)&&h.push(qt(t,"suffixed")),o&&h.push(qt(t,"inline")),ce(r)&&h.push(r);const f=h.join(" ");return a.jsxs("div",{className:f,children:[ce(n)&&a.jsx(l,{field:e}),a.jsx(d,{field:e}),ce(s)&&a.jsx(c,{field:e})]})},Td=({field:e=X()})=>{const{prefix:t,suffix:n,type:s=Do}=e,r=$d(s);return s==wm?a.jsx(r,{field:e}):ce(t)||ce(n)?a.jsx(sC,{}):a.jsx(r,{field:e})},Od=({field:e=X()})=>{const{help:t,message:n,classes:s}=e,r=n??t,o=qt(s,"help");return r?a.jsx("div",{className:o,children:r}):null},kd=({field:e=X(),children:t})=>{const{type:n,Label:s=Md,Message:r=Od,Input:o=Td}=e,i=fd(e);return n==="hidden"?a.jsx(xo,{field:e}):a.jsx("div",{className:i,children:t||a.jsxs(a.Fragment,{children:[a.jsx(s,{field:e}),a.jsx(o,{field:e}),a.jsx(r,{field:e})]})})},Id=({name:e,children:t,...n})=>{const s=Nt(),r=Zm(s.fieldSpec(e,n)),o=r.Layout||kd;return a.jsx(Qm,{form:s,...r,children:t?a.jsx(wd,{children:t}):a.jsx(o,{})})},Ed=({names:e,className:t,grid:n=!1,gap:s=4,stack:r,...o})=>{const i=rd(e);return No(n)&&n&&(n=i.length),a.jsx("div",{className:Tm({grid:n,gap:s,stack:r,props:o},t),children:i.map(l=>a.jsx(Id,{name:l,...o},l))})},rC=({className:e="",legend:t,children:n,fields:s,...r})=>a.jsxs("fieldset",{className:e,children:[!!t&&a.jsx("legend",{children:t}),!!s&&a.jsx(Ed,{names:s,...r}),n]}),oC=({children:e,...t})=>Km(t)&&e,Pd=Xm(oC),iC=({values:e=!0,status:t=!1,all:n=!1,className:s="border bdr-2 shadow-2 mar-v-4 pad-4 form-debug",title:r="Form Debugging",valuesTitle:o="Values",statusTitle:i="Status",...l})=>{const c=Nt();return a.jsxs("div",{className:s,children:[r&&a.jsx("h3",{className:"mar-v-none",children:r}),a.jsxs("div",{className:"grid-1 gap-4",children:[e&&a.jsxs("div",{children:[o&&a.jsx("h4",{className:"mar-v-none",children:o}),a.jsx(Fd,{rows:Object.entries(c.values),...l})]}),(t||n)&&c.status&&a.jsxs("div",{children:[i&&a.jsx("h4",{children:i}),a.jsx(Fd,{title:"Status",rows:Object.entries(c.status),...l})]})]})]})},Fd=({rows:e,children:t,color:n="brand",tableClass:s=`${n} shaded celled wide small pad-none mar-b-0`,...r})=>a.jsx("table",{className:s,children:a.jsx("tbody",{children:t||e.map(([o,i])=>a.jsx(aC,{name:o,value:i,...r},o))})}),aC=({name:e,value:t,keyClass:n="text-right split-3",valueClass:s="font-mono bgc-95 bgd-5"})=>a.jsxs("tr",{valign:"top",children:[a.jsx("th",{className:n,children:e}),a.jsx("td",{className:s,children:a.jsx(lC,{value:t})})]}),lC=({value:e})=>ce(e)?um(e)?e.toString():JSON.stringify(e):"",cC=({children:e})=>a.jsx(Sd,{children:e}),dC=({error:e})=>{const t=e.label||e.name;return a.jsxs(a.Fragment,{children:[!!t&&a.jsxs("b",{children:[t,": "]}),e.message]})},uC=({error:e})=>Lt(e)?e:a.jsx(dC,{error:e}),hC=({form:e=Nt(),title:t=e.errorsTitle,prompt:n=e.errorsPrompt,fieldErrors:s=!1,className:r="error alert border"})=>{const{error:o,errors:i,Error:l=uC}=e,c=!!o,d=(s?i.length:0)+(c?1:0);return d!==0?a.jsxs("div",{className:r,children:[!!t&&a.jsx("div",{className:"headline",children:sd(t,d)}),a.jsxs("div",{children:[c&&a.jsx("h4",{children:a.jsx(l,{error:o})}),s&&i.length!==0&&a.jsxs(a.Fragment,{children:[!!n&&a.jsx("p",{className:"wide",children:sd(n,i.length)}),a.jsx("ul",{children:i.map((h,f)=>a.jsx("li",{children:a.jsx(l,{error:h})},f))})]})]})]}):null},fC=({children:e})=>a.jsx(wd,{children:e}),gC=({field:e=X(),selectValue:t=e.selectValue||vt})=>a.jsx(Qc,{...e,values:I(e.value)?Me(e.value)?e.value:e.value.length?[e.value]:[]:[],onUpdate:e.onUpdate||F,onChange:n=>e.onChange(n.map(t))}),pC=({field:e=X(),selectValue:t=e.selectValue||vt})=>a.jsx(zt,{...e,onUpdate:e.onUpdate||F,onSelect:n=>e.onChange(t(n))}),tr={searching:!1,search:void 0,results:void 0,result:void 0,cursor:void 0};class lt extends gt{constructor(t){super(t),this.state={...this.state,...this.valueState(),searching:!1},this.startSearch=t.debounceTime?rf(this.search.bind(this),t.debounceTime):this.search.bind(this)}componentDidMount(){this.mounted=!0,this.props.onLoad(this)}componentWillUnmount(){this.setState({results:null}),this.mounted=!1,this.props.onUnload(this)}componentDidUpdate(t){this.props.value!==t.value&&(this.debug(`value has changed from ${t.value} to ${this.props.value}`),this.setState(this.valueState()))}valueState(t=this.props.value){const n=this.inputValue(t);return{value:t,input:n}}inputValue(t=this.props.value){return I(t)?this.props.displayValue(t)??yt:yt}onFocus(){this.debug("onFocus()"),this.setState({hasFocus:!0},this.props.onFocus)}onBlur(){this.debug("onBlur()"),this.setState({hasFocus:!1},this.props.onBlur),xr(500).then(()=>this.clearResults())}onChange(t){const n=t.target.value;this.debug(`input: ${n}`),n.length>=this.props.minLength?this.setState({input:n},this.startSearch):this.setState({input:n,...tr})}onKeyDown(t){if(this.debug(`onKeyDown(${t.key})`),this.props.disabled)return;const n=this.state.cursor;switch(t.key){case gn:this.setCursor(n+1);break;case fn:this.setCursor(n-1);break;case pn:this.selectCursor();break;case bn:this.reset();break;default:return}t.preventDefault()}reset(){this.debug("reset()");const t=this.props.initialValue,n=this.inputValue(t);this.setState({value:t,input:n,error:null,...tr},this.props.onReset)}clear(){this.debug("clear()"),this.setState({value:void 0,error:null,input:yt,...tr},this.props.onClear)}search(){const{input:t}=this.state,{minLength:n,onSearch:s}=this.props;if(t.length{try{this.searchResults(await s(t,this))}catch(r){this.setState({searching:!1,results:null,error:r.message??r})}})}searchResults(t){this.debug("searchResults()",t),this.setState({results:t,searching:!1,cursor:0})}selectResult(t){this.debug("selectResult()",t);const n=this.inputValue(t);this.setState({value:t,input:n,...tr},()=>this.props.onSelect(t))}setCursor(t){this.debug(`setCursor(${t})`);const{results:n}=this.state;this.setState({cursor:n&&n.length?(t+n.length)%n.length:void 0})}selectCursor(){const{cursor:t,results:n}=this.state;n&&n.length&&I(t)&&this.selectResult(n[t])}clearResults(){this.mounted&&this.setState({results:null,error:null})}resultsRef(t){this._resultsRef=t}activeRef(t){Pr(this._resultsRef,t)}}P(lt,"debug",!1),P(lt,"debugPrefix","Search > "),P(lt,"debugColor","MediumVioletRed"),P(lt,"defaultProps",{minLength:2,debounceTime:500,onLoad:F,onUnload:F,onFocus:F,onBlur:F,onReset:F,onClear:F,onSelect:F,displayValue:Re("displayValue"),displayResult:Re("displayResult")}),P(lt,"initialState",{value:"",searching:!1}),P(lt,"initialProps",{value:"initialValue"}),P(lt,"actions",["onFocus","onBlur","onChange","onKeyDown","reset","clear","selectResult","setCursor","selectCursor","resultsRef","activeRef"]);const _e=Ie(lt),bC=_e.Use,vC=({input:e,onFocus:t,onBlur:n,onChange:s,clear:r,autocomplete:o,autoComplete:i=o,placeholder:l="Search",clearIcon:c="cross",searchIcon:d="search",searchingIcon:h="cog.spin",inputsClass:f="inputs round",prefixClass:p="prefix",suffixClass:g="suffix",inputType:m="text",inputClass:v="",disabled:C,searching:y})=>a.jsxs("div",{className:f,children:[a.jsx("div",{className:p,children:a.jsx(H,{name:d})}),a.jsx("input",{type:m,placeholder:l,value:e,onFocus:t,onBlur:n,onChange:s,disabled:C,className:v,autoComplete:i}),a.jsx("div",{className:g,onClick:C?null:r,children:a.jsx(H,{name:y?h:c})})]}),Ad=_e.Consumer(vC),mC=({result:e,active:t,activeRef:n,onClick:s,onMouseEnter:r,displayResult:o,resultClass:i="item",activeClass:l="active"})=>a.jsx("div",{className:x(i,{[l]:t}),onClick:s,onMouseEnter:r,ref:t?n:null,children:o(e)}),Vd=_e.Consumer(mC),CC=({noResultsClass:e="none",noResults:t="No results"})=>a.jsx("div",{className:e,children:t}),Bd=_e.Consumer(CC),yC=({results:e,resultsRef:t,cursor:n,selectResult:s,setCursor:r,resultsClass:o="menu border bdr-1",Result:i=Vd,NoResults:l=Bd})=>a.jsx("div",{className:o,ref:t,children:Me(e)&&e.length?e.map((c,d)=>a.jsx(i,{result:c,active:I(n)&&e[n]===c,onClick:()=>s(c),onMouseEnter:()=>r(d)},c.id??c.value??d)):a.jsx(l,{})}),jd=_e.Consumer(yC),SC=({error:e,resultsClass:t="menu border bdr-1",errorClass:n="error item no-hover"})=>a.jsx("div",{className:t,children:a.jsx("div",{className:n,children:e})}),Wd=_e.Consumer(SC),wC=({results:e,error:t,onKeyDown:n,Input:s=Ad,Results:r=jd,Error:o=Wd})=>a.jsxs("div",{className:"search",onKeyDown:n,children:[a.jsx(s,{}),!!t&&a.jsx(o,{}),!!e&&a.jsx(r,{})]}),Hd=_e.Consumer(wC),Ud=D(({Content:e=Hd,...t})=>a.jsx(_e.Provider,{...t,children:a.jsx(e,{})}),"Search"),MC=({field:e=X(),selectValue:t=e.selectValue||vt})=>a.jsx(Ud,{...e,onSelect:n=>e.onChange(t(n)),onClear:()=>e.setValue(null)}),zd=(e={})=>{let{min:t=0,max:n=100,minNormal:s=.25,maxNormal:r=.75,value:o,minValue:i,maxValue:l,minRange:c,maxRange:d,step:h,tickStep:f,quantize:p,options:g,displayValue:m}=e;if(I(g))if(Me(g))t=0,n=g.length-1,h=1,c??(c=1),m||(m=qd);else throw"range options should be an array";else m||(m=vt);t=Qe(t),n=Qe(n);const v=n-t;I(o)&&(Me(o)?[i,l]=o:ie(o)?(i=o.min,l=o.max):an(o)&&(l=o)),i=I(i)?q(Qe(i),t,n):t+v*s,l=I(l)?q(Qe(l),t,n):t+v*r,c=I(c)?q(Qe(c),0,v):0,d=I(d)?q(Qe(d),0,v):v,h===St||Sr(h)?h=St:I(h)?h=Qe(h):h=1;const C=h===St?null:ns(v,h);f??(f=h);const y=f===St?null:ns(v,f);p=Kd({min:t,max:n,step:h,quantize:p}),i=p(i),l=p(l);const w=O=>p(pi(t,Je(v,q(O,0,1)))),S=(O,N=t,$=n)=>ns(Gh(q(O,N,$),t),v);s=S(i),r=S(l);const L=Je(s,100),M=Je(r,100);return{min:t,max:n,range:v,minValue:i,maxValue:l,minRange:c,maxRange:d,options:g,minInput:i,maxInput:l,step:h,steps:C,tickStep:f,tickSteps:y,quantize:p,minNormal:s,maxNormal:r,minPercent:L,maxPercent:M,normalToValue:w,valueToNormal:S,displayValue:m}},Kd=({min:e,max:t,step:n,quantize:s})=>bt(s)?(r,o=e,i=t)=>q(s(r),o,i):n===St?(r,o=e,i=t)=>q(r,o,i):(r,o=e,i=t)=>{r=q(r,o,i);const l=Math.round((r-e)/n);return pi(e,Je(l,n))},_d=(e,t,n,s,r)=>{if(en)return r(e);const o=e-t,i=n-e;return ot[e],LC=Ot("min max value options minValue maxValue minRange maxRange step tickStep quantize");class Zt extends gt{constructor(t){super(t);const n=this.initProps(t);this.normalClick=t.normalClick,this.windowEventListeners={},this.state={...this.state,...n,minInput:n.minValue,maxInput:n.maxValue}}initProps(t){const{normalToValue:n,valueToNormal:s,quantize:r,...o}=zd(t);return this.quantize=r,this.normalToValue=n,this.valueToNormal=s,o}componentDidUpdate(t){hs(LC,this.props,t)&&(this.debug("props have changed"),this.setState(this.initProps(this.props)))}componentWillUnmount(){this.debug("unmount"),this.removeAllWindowEventListeners()}addWindowEventListener(t,n){var r;const s=(r=this.windowEventListeners)[t]||(r[t]=[]);window.addEventListener(t,n),s.push(n)}removeWindowEventListener(t,n){var o;const s=(o=this.windowEventListeners)[t]||(o[t]=[]);window.removeEventListener(t,n);const r=s.indexOf(n);r>=0?(this.debug(`removing existing ${t} window listener`),this.debug(`had ${s.length} listeners`),s.splice(r,1),this.debug(`now got ${s.length} listeners`)):this.debug(`could not find cached ${t} listener to remove`)}removeAllWindowEventListeners(){this.debug("Removing all window event listeners"),Object.entries(this.windowEventListeners).forEach(([t,n])=>{this.debug(`Removing ${n.length} ${t} listeners`),n.forEach(s=>window.removeEventListener(t,s))}),this.windowEventListeners={}}minValueLimits(){const{maxValue:t,min:n,max:s,minRange:r,maxRange:o}=this.state;return[q(t-o,n,s),q(t-r,n,s)]}maxValueLimits(){const{minValue:t,min:n,max:s,minRange:r,maxRange:o}=this.state;return[q(t+r,n,s),q(t+o,n,s)]}setMinInput(t){this.setState({minInput:t},()=>this.setMinValue(t))}setMaxInput(t){this.setState({maxInput:t},()=>this.setMaxValue(t))}setMinValue(t){t=this.quantize(t,...this.minValueLimits());const n=this.valueToNormal(t),s=Je(n,100);return this.setState({minNormal:n,minValue:t,minPercent:s},()=>this.onChange()),t}setMaxValue(t){t=this.quantize(t,...this.maxValueLimits());const n=this.valueToNormal(t),s=Je(n,100);return this.setState({maxNormal:n,maxValue:t,maxPercent:s},()=>this.onChange()),t}setValues(t,n){this.setMinValue(t),this.setMaxValue(n)}setNormalisedMinValue(t){const n=q(this.normalToValue(t),...this.minValueLimits());t=this.valueToNormal(n);const s=Je(100,t).toFixed(2);return this.setState({minNormal:t,minValue:n,minPercent:s,minInput:n},()=>this.onChange()),n}setNormalisedMaxValue(t){const n=q(this.normalToValue(t),...this.maxValueLimits());t=this.valueToNormal(n);const s=Je(100,t).toFixed(2);return this.setState({maxNormal:t,maxValue:n,maxPercent:s,maxInput:n},()=>this.onChange()),n}step(){const t=this.state.step;return t===St?1:t}stepMinUp(){const t=this.state.minValue+this.step();this.setMinInput(t)}stepMaxUp(){const t=this.state.maxValue+this.step();this.setMaxInput(t)}stepMinDown(){const t=this.state.minValue-this.step();this.setMinInput(t)}stepMaxDown(){const t=this.state.maxValue-this.step();this.setMaxInput(t)}thumbsRef(t){this._thumbsRef=t}trackRef(t){this._trackRef=t}onKeyDown(t,n,s){switch(this.debug(`onKeyDown(${t.key})`),t.key){case Pa:case gn:n();break;case Fa:case fn:s();break;default:this.debug(`ignored key ${t.key}`);return}t.preventDefault()}onKeyDownMin(t){this.onKeyDown(t,()=>this.stepMinDown(),()=>this.stepMinUp())}onKeyDownMax(t){this.onKeyDown(t,()=>this.stepMaxDown(),()=>this.stepMaxUp())}onDrag(t,n,s){const r=t.target;if(!this._thumbsRef){console.error("No thumbsRef. Did you forget to set it in Thumbs?");return}const{clientX:o}=t,{left:i,width:l}=r.getBoundingClientRect(),c=i+l/2,d=i-o,h={initialX:o,thumbLeft:i,thumbMid:c,thumbOffset:d,control:n},{left:f,width:p}=this._thumbsRef.getBoundingClientRect();h.thumbsLeft=f,h.thumbsWidth=p,h.thumbPos=(c-f)*100/p,this.debug("drag start: ",h),this.setState({dragging:h});const g=v=>{v.preventDefault();const C=v.clientX-h.initialX,y=q(h.thumbMid+C-h.thumbsLeft,0,h.thumbsWidth);this.debug("drag"),s(ns(y,h.thumbsWidth))},m=v=>{v.preventDefault(),v.stopPropagation(),this.debug("drag end"),this.removeWindowEventListener("pointermove",g),this.removeWindowEventListener("pointerup",m),xr(this.props.dragTimeout).then(()=>this.setState({dragging:null}))};this.addWindowEventListener("pointermove",g),this.addWindowEventListener("pointerup",m)}onDragMin(t){this.onDrag(t,"min",n=>this.setNormalisedMinValue(n))}onDragMax(t){this.onDrag(t,"max",n=>this.setNormalisedMaxValue(n))}onClick(t){if(!this._trackRef){console.error("No trackRef. Did you forget to set it in Track?");return}if(this.state.dragging){this.debug("Just finished dragging... ignoring click");return}const{clientX:s}=t,{left:r,width:o}=this._trackRef.getBoundingClientRect(),i=(s-r)/o,{minNormal:l,maxNormal:c}=this.state;this.debug(`click at ${s} from ${r} with width ${o}: ${i}`),this.normalClick(i,l,c,d=>this.setNormalisedMinValue(d),d=>this.setNormalisedMaxValue(d))}onChange(){const{minValue:t,maxValue:n}=this.state;this.props.onChange(t,n,this.state);const[s,r]=this.lastChange||[];(t!==s||n!==r)&&(this.debug("min and/or max value have changed, firing onChangeValue"),this.props.onChangeValue(t,n,this.state),this.lastChange=[t,n])}getRenderProps(){const t=this.getContext(),{minNormal:n,maxNormal:s,minPercent:r,maxPercent:o,className:i,rangeClass:l,draggingClass:c,hasScaleClass:d,showScale:h,dragging:f,color:p,size:g}=t;return t.quantize=this.quantize,t.normalToValue=this.normalToValue,t.rangeProps={className:x(l,i,p,g,{[d]:h,[c]:f}),style:ji({},this.props,{"--min-position":n,"--max-position":s,"--min-percent":`${r}%`,"--max-percent":`${o}%`})},this.props.prepareRenderProps(t)}}P(Zt,"debug",!1),P(Zt,"debugPrefix","Range > "),P(Zt,"debugColor","rebeccapurple"),P(Zt,"defaultProps",{onChange:F,onChangeValue:F,normalClick:_d,prepareRenderProps:vt,minNormal:0,maxNormal:1,dragTimeout:300,color:"brand",rangeClass:"range",draggingClass:"range-dragging",hasScaleClass:"range-has-scale"}),P(Zt,"actions",["trackRef","thumbsRef","setMinValue","setMaxValue","setValues","setMinInput","setMaxInput","stepMinUp","stepMaxUp","stepMinDown","stepMaxDown","onDragMin","onDragMax","onKeyDownMin","onKeyDownMax","onClick"]);const j=Ie(Zt),{Provider:NC,Consumer:DC,Children:xC,Use:$C}=j,TC=({selectionClass:e="range-selection"})=>a.jsx("div",{className:e}),Xd=j.Consumer(TC),OC=({thumbClass:e="range-thumb",minClass:t="min",dragging:n,onDragMin:s,onKeyDownMin:r})=>a.jsx("div",{className:x(e,t,{dragging:(n==null?void 0:n.control)==="min"}),onPointerDown:s,onKeyDown:r,tabIndex:"0"}),Oo=j.Consumer(OC),kC=({thumbClass:e="range-thumb",maxClass:t="max",dragging:n,onDragMax:s,onKeyDownMax:r})=>a.jsx("div",{className:x(e,t,{dragging:(n==null?void 0:n.control)==="max"}),onPointerDown:s,onKeyDown:r,tabIndex:"0"}),ko=j.Consumer(kC),IC=({thumbsClass:e="range-thumbs",ThumbMin:t=Oo,ThumbMax:n=ko,thumbsRef:s})=>a.jsxs("div",{className:e,ref:s,children:[a.jsx(t,{}),a.jsx(n,{})]}),Yd=j.Consumer(IC),EC=({trackClass:e="range-track",Selection:t=Xd,Thumbs:n=Yd,onClick:s,trackRef:r})=>a.jsxs("div",{className:e,ref:r,onClick:s,children:[a.jsx(t,{}),a.jsx(n,{})]}),Gd=j.Consumer(EC),PC=({ticksClass:e="range-ticks",tickClass:t="range-tick",scaleValueClass:n="range-scale-value",scaleSize:s="smaller",tickSteps:r,showScale:o,displayValue:i,normalToValue:l,options:c})=>{const d=x(n,s);return a.jsx("div",{className:e,children:bi(0,r).map(h=>a.jsx("div",{className:t,children:!!o&&a.jsx("div",{className:d,children:i(l(h/r),c)})},h))})},Zd=j.Consumer(PC),FC=({sliderClass:e="range-slider",Track:t=Gd,Ticks:n=Zd,steps:s,showTicks:r})=>a.jsxs("div",{className:e,children:[s&&r&&a.jsx(n,{}),a.jsx(t,{})]}),Jd=j.Consumer(FC),AC=({inputClass:e="range-input field mar-b-none",stepClass:t="step",inputInputsClass:n="inputs inline",inputPrefixClass:s="prefix shaded lined",inputSuffixClass:r="suffix shaded lined",disabledClass:o="disabled",stepDownIcon:i="minus",stepUpIcon:l="plus",min:c,max:d,step:h,stepUp:f,stepDown:p,input:g,setInput:m})=>a.jsx("div",{className:e,children:a.jsxs("div",{className:n,children:[a.jsx("div",{className:x(s,t,p?null:o),onClick:p,children:a.jsx(H,{name:i})}),a.jsx("input",{type:"number",min:c,max:d,step:h,value:g,className:"inline",onChange:v=>m(v.target.value)}),a.jsx("div",{className:x(r,t,f?null:o),onClick:f,children:a.jsx(H,{name:l})})]})}),Io=j.Consumer(AC),VC=({inputClass:e="range-input field mar-b-none",stepClass:t="step",inputInputsClass:n="inputs inline",inputPrefixClass:s="prefix shaded lined",inputSuffixClass:r="suffix shaded lined",disabledClass:o="disabled",stepDownIcon:i="minus",stepUpIcon:l="plus",selectOptions:c={},min:d,max:h,stepUp:f,stepDown:p,input:g,setInput:m,options:v,displayValue:C})=>a.jsx("div",{className:e,children:a.jsxs("div",{className:n,children:[a.jsx("div",{className:x(s,t,p?null:o),onClick:p,children:a.jsx(H,{name:i})}),a.jsx(zt,{...c,value:g,options:bi(d,h).map(y=>({value:y,text:C(y,v)})),onSelect:y=>m((y==null?void 0:y.value)||0),onUpdate:F}),a.jsx("div",{className:x(r,t,f?null:o),onClick:f,children:a.jsx(H,{name:l})})]})}),Eo=j.Consumer(VC),BC=({min:e,max:t,minRange:n,maxRange:s,minInput:r,setMinInput:o,stepMinUp:i,stepMinDown:l,minValue:c,maxValue:d,options:h,Input:f=h?Eo:Io})=>{const p=q(d-s,e,t),g=q(d-n,e,t),m=c>p,v=c{const p=q(c+n,e,t),g=q(c+s,e,t),m=dp;return a.jsx(f,{stepDown:v?l:null,stepUp:m?i:null,min:p,max:g,input:r,setInput:o})},Fo=j.Consumer(jC),WC=({inputsClass:e="range-inputs",alignInput:t="space",alignInputs:n=t,inputSize:s,inputsSize:r=s,InputMin:o=Po,InputMax:i=Fo})=>a.jsxs("div",{className:x(e,n,r),children:[a.jsx(o,{}),a.jsx(i,{})]}),Qd=j.Consumer(WC),HC={space:"left"},UC=({valueClass:e="range-value",minClass:t="min",alignValue:n="thumb",alignValues:s=n,alignMinValue:r=HC[s]||s,minValue:o,displayValue:i,options:l})=>a.jsx("div",{className:x(e,t,r),children:i(o,l)}),Ao=j.Consumer(UC),zC={space:"right"},KC=({valueClass:e="range-value",maxClass:t="max",alignValue:n="thumb",alignValues:s=n,alignMaxValue:r=zC[s]||s,maxValue:o,displayValue:i,options:l})=>a.jsx("div",{className:x(e,t,r),children:i(o,l)}),Vo=j.Consumer(KC),_C=({valuesClass:e="range-values",ValueMin:t=Ao,ValueMax:n=Vo,valueSize:s="small",valuesSize:r=s})=>a.jsxs("div",{className:x(e,r),children:[a.jsx(t,{}),a.jsx(n,{})]}),Rd=j.Consumer(_C),qC=({outputClass:e="range-output",Values:t=Rd})=>a.jsx("div",{className:e,children:a.jsx(t,{})}),eu=j.Consumer(qC),XC=({limitsClass:e="range-limits",scaleValueClass:t="range-scale-value",scaleSize:n="smaller",displayValue:s,min:r,max:o,options:i})=>{const l=x(t,n);return a.jsxs("div",{className:e,children:[a.jsx("div",{className:l,children:s(r,i)}),a.jsx("div",{className:l,children:s(o,i)})]})},tu=j.Consumer(XC),YC=({min:e,max:t,minValue:n,maxValue:s,minNormal:r,maxNormal:o,minPercent:i,maxPercent:l,step:c,steps:d})=>a.jsx("table",{className:"celled shaded grey smaller",children:a.jsxs("tbody",{children:[xe("minValue",n),xe("maxValue",s),xe("minNormal",r),xe("maxNormal",o),xe("minPercent",i),xe("maxPercent",l),xe("min",e),xe("max",t),xe("step",c),xe("steps",d)]})}),xe=(e,t)=>a.jsxs("tr",{children:[a.jsx("th",{className:"font-mono split-3",children:e}),a.jsx("td",{children:t})]}),nu=j.Consumer(YC),GC=({Slider:e=Jd,Inputs:t=Qd,Output:n=eu,Limits:s=tu,Debug:r=nu,debug:o,showInput:i,showInputs:l=i,showValue:c,showValues:d=c,showScale:h,showLimits:f})=>a.jsxs(a.Fragment,{children:[!!d&&a.jsx(n,{}),a.jsx(e,{}),f&&!h&&a.jsx(s,{}),l&&a.jsx(t,{}),!!o&&a.jsx(r,{})]}),su=j.Consumer(GC),ZC=({rangeProps:e,Layout:t=su,children:n})=>a.jsx("div",{...e,children:n?a.jsx(j.Children,{children:n}):a.jsx(t,{})}),ru=j.Consumer(ZC),nr=D(({Content:e=ru,children:t,...n})=>a.jsx(j.Provider,{...n,children:a.jsx(e,{children:t})}),"Range"),JC=(e,t)=>[e,t],ou=({field:e=X(),changeValue:t=e.changeValue||JC})=>a.jsx(nr,{...e,onChange:(...n)=>e.onChange(t(...n))}),QC=({thumbsClass:e="range-thumbs",Thumb:t=Oo,thumbsRef:n})=>a.jsx("div",{className:e,ref:n,children:a.jsx(t,{})}),iu=j.Consumer(QC),RC=({valuesClass:e="range-values",ValueMin:t=Ao})=>a.jsx("div",{className:e,children:a.jsx(t,{})}),au=j.Consumer(RC),e2=({inputsClass:e="range-inputs",alignInput:t="center",alignInputs:n=t,inputSize:s,inputsSize:r=s,InputMin:o=Po})=>a.jsx("div",{className:x(e,n,r),children:a.jsx(o,{})}),lu=j.Consumer(e2),cu=(e,t,n,s)=>s(e),du=e=>(e.value=e.maxValue,e.input=e.maxInput,e.normal=e.maxNormal,e.percent=e.maxPercent,e.setValue=e.setMaxValue,e.setInput=e.setMaxInput,e.stepUp=e.stepMaxUp,e.stepDown=e.stepMaxDown,e.onDrag=e.onDragMax,e.onKeyDown=e.onKeyDownMax,e),uu=D(({children:e,value:t,minNormal:n=.5,maxNormal:s=1,minRange:r=0,rangeClass:o="range range-min",Thumbs:i=iu,Values:l=au,Inputs:c=lu,normalClick:d=cu,prepareRenderProps:h=du,onChange:f=F,...p})=>a.jsx(nr,{minValue:t,minNormal:n,maxNormal:s,minRange:r,rangeClass:o,normalClick:d,prepareRenderProps:h,onChange:(g,m,...v)=>f(g,...v),Thumbs:i,Values:l,Inputs:c,...p,children:e}),"RangeMin"),t2=({field:e=X(),changeValue:t=e.changeValue||vt})=>a.jsx(uu,{...e,onChange:(...n)=>e.onChange(t(...n))}),n2=({thumbsClass:e="range-thumbs",Thumb:t=ko,thumbsRef:n})=>a.jsx("div",{className:e,ref:n,children:a.jsx(t,{})}),hu=j.Consumer(n2),s2=({valuesClass:e="range-values",ValueMax:t=Vo})=>a.jsx("div",{className:e,children:a.jsx(t,{})}),fu=j.Consumer(s2),r2=({inputsClass:e="range-inputs",alignInput:t="center",alignInputs:n=t,inputSize:s,inputsSize:r=s,InputMax:o=Fo})=>a.jsx("div",{className:x(e,n,r),children:a.jsx(o,{})}),gu=j.Consumer(r2),pu=(e,t,n,s,r)=>r(e),bu=e=>(e.value=e.maxValue,e.input=e.maxInput,e.normal=e.maxNormal,e.percent=e.maxPercent,e.setValue=e.setMaxValue,e.setInput=e.setMaxInput,e.stepUp=e.stepMaxUp,e.stepDown=e.stepMaxDown,e.onDrag=e.onDragMax,e.onKeyDown=e.onKeyDownMax,e),vu=D(({children:e,value:t,minNormal:n=0,maxNormal:s=.5,minRange:r=0,rangeClass:o="range range-max",Thumbs:i=hu,Values:l=fu,Inputs:c=gu,normalClick:d=pu,prepareRenderProps:h=bu,onChange:f=F,...p})=>a.jsx(nr,{maxValue:t,minNormal:n,maxNormal:s,minRange:r,rangeClass:o,normalClick:d,prepareRenderProps:h,onChange:(g,m,...v)=>f(m,...v),Thumbs:i,Values:l,Inputs:c,...p,children:e}),"RangeMax"),o2=({field:e=X(),changeValue:t=e.changeValue||vt})=>a.jsx(vu,{...e,onChange:(...n)=>e.onChange(t(...n))}),Bo=D(({color:e,className:t,style:n,fixed:s,light:r,dark:o,onClick:i,children:l})=>a.jsx("div",{className:x("overlay",t,e,{fixed:s,light:r,dark:o}),style:n,onClick:i,children:l}),"Overlay"),mu=(e,t)=>[e.length?"-"+e.join("-"):"",t.length?"."+t.join("."):""].join(""),Cu=(e,t,n,s,r,o)=>{n?(t.push(`stc-${r}`,`std-${o}`),pt(n)?s&&e.push(`strokeWidth=${s}`):e.push(n)):e.push("stroke=none")},yu=(e,t,n,s,r)=>{n?t.push(`flc-${s}`,`fld-${r}`):e.push("fill=none")},Su=D(({size:e,className:t,icon:n="cog",color:s="brand",stroke:r=!0,strokeWidth:o,strokeStop:i=40,strokeStopDark:l=50,fill:c=!1,fillStop:d=50,fillStopDark:h=20,bgIcon:f=!1,bgColor:p=s,bgStroke:g=!1,bgStrokeWidth:m,bgStrokeStop:v=60,bgStrokeStopDark:C=70,bgFill:y=!0,bgFillStop:w=70,bgFillStopDark:S=30,shrink:L=f?5:0,reverse:M=!1,animation:O=M?"spin.reverse":"spin"})=>{const N=x(e,t),$=[],E=[p],T=[],k=[s,O];Cu($,E,g,m,v,C),Cu(T,k,r,o,i,l),yu($,E,y,w,S),yu(T,k,c,d,h),L&&T.push(`shrink=${L}`);const W=f?`${f}${mu($,E)}`:"",B=`${n}${mu(T,k)}`,K=f?`${W} ${B}`:B;return a.jsx(H,{name:K,className:N})},"Spinner"),i2=D(({text:e="Submitting...",size:t="largest",className:n="flex middle center pad-8",light:s,dark:r,fixed:o,spinnerSize:i="x4",Spinner:l=Su,...c})=>a.jsx(Pd,{submitting:!0,children:a.jsx(Bo,{className:x(n,t),light:s,dark:r,fixed:o,children:a.jsxs("div",{className:"text-center",children:[l&&a.jsx(l,{size:i,...c}),a.jsx("div",{className:"mar-t-4",children:e})]})})}),"Submitting"),wu=D(({text:e="Cancel",className:t="cancel",Button:n=ae,...s})=>a.jsx(n,{text:e,className:t,...s}),"Cancel"),Mu=D(({type:e="reset",text:t="Reset",className:n="reset",Button:s=ae,...r})=>{const{reset:o}=Nt();return a.jsx(s,{type:e,text:t,className:n,onClick:o,...r})},"Reset"),jo=D(({type:e="submit",text:t="Submit",className:n="submit",Button:s=ae,...r})=>{const{submit:o,status:i}=Nt();return a.jsx(s,{type:e,text:t,className:n,onClick:o,disabled:i.submitting,...r})},"Submit"),a2=D(({className:e,gap:t=4,space:n=!1,size:s,reset:r={},submit:o={}})=>a.jsxs("div",{className:gd({className:e,gap:t,space:n},s,"controls"),children:[a.jsx(Mu,{...r}),a.jsx(jo,{...o})]}),"ResetSubmit"),l2=D(({className:e,gap:t=4,space:n=!1,size:s,cancel:r={},submit:o={}})=>a.jsxs("div",{className:gd({className:e,gap:t,space:n},s,"controls"),children:[a.jsx(wu,{...r}),a.jsx(jo,{...o})]}),"CancelSubmit");at("multiselect",gC),at("uiselect",pC),at("search",MC),at("uirange",ou),at("rangeminmax",ou),at("rangemin",t2),at("rangemax",o2);const c2=D(Gm,"Form"),d2=D(Id,"Field"),u2=D(Ed,"Fields"),h2=D(rC,"Fieldset"),f2=D(hC,"Errors"),g2=D(Pd,"Status"),p2=D(iC,"Debug"),b2=D(kd,"Layout"),v2=D(Md,"Label"),m2=D(Td,"Input"),C2=D(Od,"Message"),y2=D(Ld,"CheckboxField"),S2=D(xo,"HiddenField"),w2=D(Nd,"RadioField"),M2=D(Dd,"SelectField"),L2=D($o,"TextField"),N2=D(xd,"TextAreaField"),D2=({open:e=!1}={})=>{const{isVisible:t,show:n,hide:s}=bs({visible:e});return{show:n,hide:s,Modal:r=>a.jsx(Vr,{open:t,...r})}},x2=({open:e=!1}={})=>{const{isVisible:t,show:n,hide:s}=bs({visible:e});return{show:n,hide:s,Overlay:r=>t&&a.jsx(Bo,{...r})}},Lu=D(({className:e,disabled:t,children:n})=>a.jsx("label",{className:x(e,{disabled:t}),children:n}),"RadioLabel"),Nu=D(({name:e,option:t,tabIndex:n=0,onChange:s=F,checked:r})=>a.jsx("input",{type:"radio",name:e,disabled:t.disabled,"aria-disabled":t.disabled,tabIndex:t.disabled?-1:n,onChange:o=>s(o.target.checked),checked:r}),"RadioInput"),Du=D(({name:e,option:t,checked:n,inline:s,border:r,labelClass:o="radio",inputClass:i,Label:l=Lu,Input:c=Nu,onChange:d})=>a.jsxs(l,{className:x(o,t.labelClass,{inline:s,border:r}),disabled:t.disabled,option:t,children:[a.jsx(c,{name:e,option:t,checked:n,className:x(i,t.inputClass),onChange:()=>d(t.value)}),t.text??t.label??t.name]}),"RadioOption"),$2=D(({name:e=b.useId(),value:t,options:n,className:s="radioset",disabled:r,Option:o=Du,...i})=>a.jsx("div",{className:x(s,{disabled:r}),children:n.map(l=>{const c=ie(l)?l:{value:l,label:l};return a.jsx(o,{name:e,option:c,checked:c.value===t,value:t,...i},c.value)})}),"Radio"),T2=({...e})=>a.jsx(Xs,{...e,direction:"horizontal"}),Wo=({th:e,text:t,...n})=>e?a.jsx("th",{...n,children:Z(t,n)}):a.jsx("td",{...n,children:Z(t,n)}),sr=e=>Me(e)?{cells:e}:e,rr=e=>ie(e)?e:{text:e},O2=({columns:e})=>a.jsx("thead",{children:a.jsx("tr",{children:Object.entries(e).map(([t,n])=>{const s=n.head?rr(n.head):{text:t};return a.jsx(Wo,{th:s.th??!0,...s},t)})})}),k2=({th:e,text:t,row:n,...s})=>e?a.jsx("th",{...s,children:Z(t,{row:n,text:t})}):a.jsx("td",{...s,children:Z(t,{row:n,text:t})}),I2=({row:e,columns:t})=>a.jsx("tr",{children:Object.entries(t).map(([n,s])=>{const r=s.body?rr(s.body):{text:e[n]};return a.jsx(k2,{th:r.th??!1,row:e,...r},n)})}),E2=({columns:e,rows:t=[],...n})=>a.jsx("tbody",{children:t.map((s,r)=>a.jsx(I2,{row:s,columns:e,...n},s.id??r))}),xu=({rows:e,columns:t,...n})=>a.jsxs(a.Fragment,{children:[a.jsx(O2,{columns:t,...n}),a.jsx(E2,{columns:t,rows:e,...n})]}),or=({cells:e,th:t=!1,Cell:n=Wo,...s})=>a.jsx("tr",{...s,children:e.map((r,o)=>a.jsx(n,{th:r.th??t,...rr(r)},r.key??o))}),$u=({headRows:e,Row:t=or,HeadRow:n=t,...s})=>a.jsx("thead",{children:e.map((r,o)=>a.jsx(n,{th:!0,...sr(r),...s},r.key??o))}),Tu=({bodyRows:e,Row:t=or,BodyRow:n=t,...s})=>a.jsx("tbody",{children:e.map((r,o)=>a.jsx(n,{...sr(r),...s},r.key??o))}),Ou=({footRows:e,Row:t=or,FootRow:n=t,...s})=>a.jsx("tfoot",{children:e.map((r,o)=>a.jsx(n,{...sr(r),...s},r.key??o))}),ku=({bodyRows:e,headRows:t,footRows:n,Head:s=$u,Body:r=Tu,Foot:o=Ou,...i})=>a.jsxs(a.Fragment,{children:[!!t&&a.jsx(s,{headRows:t,...i}),a.jsx(r,{bodyRows:e,...i}),!!n&&a.jsx(o,{footRows:n,...i})]}),P2=D(({className:e,border:t,color:n,radius:s,shadow:r,size:o,lined:i,celled:l,shaded:c,striped:d,wide:h,compact:f,compressed:p=f,expanded:g,headings:m,rows:v,footings:C,columns:y,bodyRows:w=v,headRows:S=m&&[m],footRows:L=C&&[C],...M})=>{const O=x(e,o,ss(n),Ve(t),je(s),Be(r),{celled:l,lined:i,shaded:c,striped:d,wide:h,compressed:p,expanded:g});return a.jsx("table",{className:O,children:y?a.jsx(xu,{columns:mt(y,N=>({head:Fr(N)})),rows:v,...M}):a.jsx(ku,{headRows:S,bodyRows:w,footRows:L,...M})})},"Table"),Iu=({tab:e})=>{if(!e)return null;const{content:t,Component:n}=e;return t||(n?a.jsx(n,{tab:e}):"No content, element or Component defined for tab")},F2=D(({tabs:e,storageKey:t,storageItem:n="active-tab",tabsetClass:s="tabset",tabsClass:r="tabs",activeClass:o="active",disabledClass:i="disabled",className:l,bodyClass:c,color:d,size:h,solid:f,lined:p,center:g,right:m,activeTab:v=0,Body:C=Iu})=>{const y=t&&gs(t),[w,S]=b.useState(y&&y.get(n)||v),L=N=>{S(N),y&&y.set(n,N)},M=x(s,l,d,h,{solid:f,lined:p,center:g,right:m}),O=x(r,d,h);return a.jsxs("div",{className:M,children:[a.jsx("ul",{className:O,children:e.map((N,$)=>a.jsx("li",{className:x({[o]:w===$,[i]:N.disabled}),onClick:()=>N.disabled?F:L($),children:a.jsx(We,{...N})},N.id||$))}),a.jsx("div",{className:c,children:a.jsx(C,{tabs:e,active:w,tab:e[w]})})]})},"Tabset"),Eu=[{text:"On",value:!0},{text:"Off",value:!1}],A2=(e,t)=>e.value===(ie(t)?t.value:t),Pu=(e,t)=>Qn(t)?t:e.findIndex(n=>A2(n,t)),Fu=D(({selected:e=0,findSelectedIndex:t=Pu,onSelect:n=F,options:s=Eu,activeProps:r={},inactiveProps:o={className:"outline"},buttonsClass:i="buttons",size:l,className:c,...d}={})=>{const h=t(s,e),f=s.map((p,g)=>{const m=g===h;return{...p,...m?r:o,className:x(p.className,m?r.className:o.className),onClick:()=>n(p,g)}});return a.jsx(ps,{buttons:f,className:x(l,c,i),...d})},"Toggle"),Au=({selected:e=0,findSelectedIndex:t=Pu,options:n=Eu,onSelect:s=F,storageKey:r,storageItem:o="selected",...i}={})=>{const l=t(n,e),c=r&&gs(r),[d,h]=b.useState(c?c.get(o)??l:l),[f,p]=b.useState(n[d]),g=v=>{const C=t(n,v);if(C>=0&&Ca.jsx(Fu,{options:n,selected:d,onSelect:(C,y)=>g(y),...i,...v}),g,()=>g((d+1)%n.length)]},V2=e=>{const[,t]=Au(e);return a.jsx(t,{})},Vu=({style:e,content:t,children:n,...s})=>a.jsx("div",{className:rs(s),style:e,children:t||n});D(Vu,"Div");const Bu=({children:e,...t})=>a.jsx("div",{className:rs(t,"flex"),children:e});D(Bu,"Flex");const ju=({gap:e,children:t,...n})=>{const{ref:s,breakpoint:r}=Ho(),[o,i]=aa(n,r);return a.jsx("div",{ref:s,className:x(o,os(e),rs(i)),children:t})};D(ju,"Grid");const Ho=(e={})=>{const[t,n]=b.useState(!1),[s,r]=b.useState(!1),[o,i]=b.useState(!1),[l,c]=b.useState(!1),[d,h]=b.useState(!1),f=b.useRef();return b.useEffect(()=>{if(!f.current||typeof ResizeObserver>"u")return;const p=new ResizeObserver(g=>{const m=g[0],v=m.contentRect,C=m.borderBoxSize[0];if(v){const y=Math.round(v.width),w=Math.round(v.height);n(y),r(w),h(us(y,e))}if(C){const y=Math.round(C.inlineSize),w=Math.round(C.blockSize);i(y),c(w)}});return p.observe(f.current),()=>p.disconnect()},[]),{ref:f,width:t,height:s,boxWidth:o,boxHeight:l,breakpoint:d}};function B2(){const e=b.useRef(0);return e.current++,e.current}const Wu=(e,t={})=>{const{onChange:n,convertCase:s=Fr,setterNamer:r=c=>`set${s(c)}`}=t,[o,i]=b.useState(n?n(e):e),l=Object.keys(e).reduce((c,d)=>{const h=r(d);return c[h]=f=>i(p=>{const g={...p,[d]:Z(f,p[d])};return n?n(g):g}),c},{});return[o,l]},j2=(e={})=>{const t=e.element||window,[n,s]=b.useState(!1),[r,o]=b.useState(!1),[i,l]=b.useState(!1),c=()=>{if(!t)return;s(t.innerWidth),o(t.innerHeight);const d=us(t.innerWidth,e);l(d)};return b.useEffect(()=>{if(typeof t<"u"&&t.addEventListener)return c(),t.addEventListener("resize",c),()=>{t.removeEventListener("resize",c)}},[]),{width:n,height:r,breakpoint:i}};u.ANY=St,u.ARROW_DOWN=gn,u.ARROW_LEFT=Pa,u.ARROW_RIGHT=Fa,u.ARROW_UP=fn,u.Accordion=hf,u.Alert=Sf,u.BACKSPACE=Va,u.BLANK=yt,u.Badge=wf,u.Button=ae,u.Buttons=ps,u.Cancel=wu,u.CancelSubmit=l2,u.Checkbox=Ar,u.CheckboxField=y2,u.CheckboxState=Nf,u.CheckedState=ba,u.Confirm=xf,u.DASH=If,u.DEFAULT_ICON_HEIGHT=Pf,u.DEFAULT_ICON_WIDTH=Ef,u.DESKTOP=Gi,u.DataTable=Gs,u.DataTableBody=Nc,u.DataTableCell=vc,u.DataTableConsumer=Of,u.DataTableContent=Fc,u.DataTableContext=z,u.DataTableControls=fc,u.DataTableFilter=Mc,u.DataTableFiltering=hc,u.DataTableFilters=Lc,u.DataTableFooter=Pc,u.DataTableHeader=gc,u.DataTableHeading=Sc,u.DataTableHeadings=wc,u.DataTableNoRows=Cc,u.DataTablePageSize=ul,u.DataTableRow=mc,u.DataTableRows=yc,u.DataTableSummary=Ea,u.DataTables=Ov,u.Datatable=Gs,u.Debug=p2,u.Details=Ui,u.DetailsContainer=Hi,u.DetailsContent=kr,u.DetailsContext=Kn,u.DetailsSummary=Wi,u.Div=Vu,u.Dropdown=pl,u.DropdownBody=fl,u.DropdownContent=gl,u.DropdownContext=Mt,u.DropdownMenu=dl,u.DropdownMenuContent=cl,u.DropdownMenuContext=wt,u.DropdownMenuHeading=Ua,u.DropdownMenuOption=Wa,u.DropdownMenuOptions=za,u.DropdownMenuSeparator=Ha,u.DropdownMenuTrigger=ja,u.DropdownTrigger=hl,u.ENTER=pn,u.ESCAPE=bn,u.Error=pa,u.Errors=f2,u.FALSE=Hr,u.Field=d2,u.Fields=u2,u.Fieldset=h2,u.Flex=Bu,u.Form=c2,u.Grid=ju,u.HiddenField=S2,u.HorizontalSort=T2,u.Icon=H,u.IconLibrary=_n,u.Icons=ff,u.Info=ha,u.Input=m2,u.LAPTOP=Yi,u.Label=v2,u.Layout=b2,u.LocalStorage=ua,u.MOBILE=qi,u.MakeSortable=ic,u.Message=C2,u.Modal=Vr,u.ModalClose=va,u.ModalContent=ya,u.ModalFooter=Ca,u.ModalHeader=ma,u.ModalState=D2,u.MultiSelect=Qc,u.MultiSelectConsumer=Ev,u.MultiSelectContent=Jc,u.MultiSelectContext=rt,u.MultiSelectOption=jc,u.MultiSelectProvider=Iv,u.MultiSelectSelection=Mo,u.MultiSelectSelections=Gc,u.MultiSelectSortSelections=Zc,u.Overlay=Bo,u.OverlayState=x2,u.Pager=Ec,u.PagerContent=Ic,u.PagerContext=Ke,u.PagerNext=$c,u.PagerPage=Tc,u.PagerPages=kc,u.PagerPrevious=xc,u.PagerSeparator=Oc,u.Radio=$2,u.RadioField=w2,u.RadioInput=Nu,u.RadioLabel=Lu,u.RadioOption=Du,u.Range=nr,u.RangeChildren=xC,u.RangeConsumer=DC,u.RangeContent=ru,u.RangeContext=j,u.RangeDebug=nu,u.RangeInput=Io,u.RangeInputMax=Fo,u.RangeInputMin=Po,u.RangeInputs=Qd,u.RangeLayout=su,u.RangeLimits=tu,u.RangeMax=vu,u.RangeMaxInputs=gu,u.RangeMaxThumbs=hu,u.RangeMaxValues=fu,u.RangeMin=uu,u.RangeMinInputs=lu,u.RangeMinThumbs=iu,u.RangeMinValues=au,u.RangeOutput=eu,u.RangeProvider=NC,u.RangeSelect=Eo,u.RangeSelection=Xd,u.RangeSlider=Jd,u.RangeThumbMax=ko,u.RangeThumbMin=Oo,u.RangeThumbs=Yd,u.RangeTicks=Zd,u.RangeTrack=Gd,u.RangeValueMax=Vo,u.RangeValueMin=Ao,u.RangeValues=Rd,u.Reset=Mu,u.ResetSubmit=a2,u.SPACE=Cs,u.Search=Ud,u.SearchContent=Hd,u.SearchContext=_e,u.SearchError=Wd,u.SearchInput=Ad,u.SearchNoResults=Bd,u.SearchResult=Vd,u.SearchResults=jd,u.Select=zt,u.SelectConsumer=Bv,u.SelectContent=Yc,u.SelectContext=ge,u.SelectField=M2,u.SelectHeading=Hc,u.SelectInput=Wc,u.SelectItem=Kc,u.SelectMenu=qc,u.SelectNoOptions=_c,u.SelectOption=Uc,u.SelectProvider=Vv,u.SelectSearch=Xc,u.SelectSeparator=zc,u.Sortable=Xs,u.SortableItem=nc,u.Spinner=Su,u.Status=g2,u.Storage=gs,u.Store=un,u.Submit=jo,u.Submitting=i2,u.Success=fa,u.TAB=Aa,u.TABLET=Xi,u.TRUE=Wr,u.Table=P2,u.TableBody=Tu,u.TableCell=Wo,u.TableColumns=xu,u.TableFoot=Ou,u.TableHead=$u,u.TableRow=or,u.TableRows=ku,u.Tabset=F2,u.TabsetBody=Iu,u.TextAreaField=N2,u.TextField=L2,u.Theme=Vi,u.Themed=D,u.Themer=Ai,u.Tiles=Ac,u.Toggle=Fu,u.ToggleState=V2,u.ULTRA=Ji,u.UNKNOWN=_i,u.UseField=fC,u.UseForm=cC,u.VerticalSort=ac,u.VisibleState=bs,u.WIDESCREEN=Zi,u.Warning=ga,u.WithIcons=We,u.addIcon=Go,u.addIcons=ph,u.addInputType=at,u.anyPropsChanged=hs,u.backgroundClass=Ti,u.backgroundDarkClass=ki,u.borderClass=Ve,u.breakpoints=dn,u.capitalFirstLetter=Fr,u.cellProps=rr,u.classInt=cn,u.classTrue=is,u.classTrueInt=as,u.classTrueVHTRBL=Tr,u.classVHTRBL=Ii,u.classes=x,u.coerceBoolean=ms,u.coerceNumber=Qe,u.colorClass=ss,u.cursorFirst=ea,u.cursorLast=ta,u.cursorNext=na,u.cursorPrev=sa,u.dataTableColumnDefinition=vs,u.dataTableColumnDefinitions=wa,u.dataTableColumnOrder=La,u.dataTableColumnString=$f,u.dataTableFilter=Oa,u.dataTableFilterTypes=Br,u.dataTablePaginate=ka,u.dataTableSort=Ia,u.dataTableSortColumn=Na,u.dataTableSorters=jr,u.dataTableVisibleColumns=Ma,u.defaultRenderer=Re,u.displayValueFromOptions=qd,u.elementBreakpoint=mf,u.elementWidth=Qi,u.extractGridProp=aa,u.extractGridProps=ia,u.extractStyleProps=ji,u.fieldClass=fd,u.filterBoolean=Ta,u.filterFloat=$a,u.filterInteger=xa,u.filterStringContains=Ct,u.filterStringExact=Da,u.findOption=Er,u.fixValues=ls,u.floatingMiddleware=al,u.floatingPlacement=ll,u.foregroundClass=$i,u.foregroundDarkClass=Oi,u.gapClass=os,u.gridClass=Li,u.gridPropBestMatch=la,u.iconNameOrProps=Or,u.iconProps=ds,u.initRange=zd,u.inputClasses=An,u.joinClasses=Si,u.lookupVariant=yf,u.marginClass=xi,u.mergeRefs=fs,u.optionValue=Ir,u.paddingClass=Di,u.pagerNextPageLabel=wo,u.pagerPageLabel=Dc,u.pagerPreviousPageLabel=So,u.parseAttrs=bf,u.parseSize=da,u.prefixKey=hn,u.radiusClass=je,u.rangeMaxNormalClick=pu,u.rangeMaxPrepareRenderProps=bu,u.rangeMinNormalClick=cu,u.rangeMinPrepareRenderProps=du,u.rangeNormalClick=_d,u.rangeQuantizer=Kd,u.rotateStyle=Bi,u.rowProps=sr,u.scrollParentChild=Pr,u.searchOptions=Ri,u.selectGridProps=oa,u.setKeys=wi,u.shadowClass=Be,u.sizeColorProps=$r,u.stackClass=Ni,u.statusClasses=hd,u.stopPropagation=ra,u.styleProps=Mi,u.stylePropsClasses=rs,u.themedProps=Cf,u.useComplexState=Wu,u.useContainer=Ho,u.useDataTable=Tf,u.useDetails=oh,u.useDropdown=Fg,u.useDropdownMenu=Af,u.useField=X,u.useFloating=Rr,u.useForm=Nt,u.useMultiSelect=Pv,u.usePager=cv,u.useRange=$C,u.useRenderCount=B2,u.useSearch=bC,u.useSelect=jv,u.useToggle=Au,u.useWindow=j2,u.validOption=kt,u.widthBreakpoint=us,u.withIconsRenderer=ca,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=badger-react-ui.umd.cjs.map