@fungi.computer/shed 0.10.14 → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -92,7 +92,7 @@ Example:
|
|
|
92
92
|
For tests, pass a Ghostty instance directly:
|
|
93
93
|
import { Ghostty, Terminal } from "ghostty-web";
|
|
94
94
|
const ghostty = await Ghostty.load();
|
|
95
|
-
const term = new Terminal({ ghostty });`)}var qE;function JE(){return qE??=epe.load().catch(e=>{throw qE=void 0,e}),qE}var ype=[``,`bold `,`italic `,`bold italic `];async function YE(e,t){await Promise.all(ype.map(n=>document.fonts.load(`${n}${String(e)}px ${t}`)))}var XE=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,bpe=see(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${XE}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${XE}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),ZE=(0,I.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=Dd(bpe({size:c,variant:l}),n),p=(0,I.useRef)(a).current,m=(0,I.useRef)(null);return(0,I.useImperativeHandle)(d,()=>m.current),xpe(m,i,a),e?(0,F.jsx)(kd,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,F.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,F.jsxs)(F.Fragment,{children:[i?(0,F.jsx)(um,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,t]}):(0,F.jsx)(Tpe,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function xpe(e,t,n){let r=(0,I.useRef)(null),i=(0,I.useRef)(null),a=(0,I.useRef)(null);(0,I.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!Bd(o))return;let f=Fd(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:zd(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var Spe=1100;function Cpe(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:zd(t,`ease-out`)})}function wpe(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:zd(t,`linear`)})}function QE(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:zd(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:zd(n,n.ease),fill:`backwards`})]}function Tpe({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,I.useRef)(null),s=Hd(),[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)(!1);c&&!u&&d(!0);let f=(0,I.useRef)(a),p=(0,I.useRef)(r);(0,I.useEffect)(()=>{p.current=r},[r]),(0,I.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},Spe);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!Bd(t))return;let n=Fd(t);if(n.shake<=0)return;let r=wpe(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,I.useRef)(c);return(0,I.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!Bd(e)){c||d(!1);return}let r=Fd(e),i=c?QE(t,n,r):QE(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(Cpe(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:zd(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,F.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,F.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,F.jsx)(um,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,e]}),u?(0,F.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,F.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var $E=new Map([[`0`,[`###`,`#.#`,`#.#`,`#.#`,`###`]],[`1`,[`.#.`,`##.`,`.#.`,`.#.`,`###`]],[`2`,[`###`,`..#`,`###`,`#..`,`###`]],[`3`,[`###`,`..#`,`.##`,`..#`,`###`]],[`4`,[`#.#`,`#.#`,`###`,`..#`,`..#`]],[`5`,[`###`,`#..`,`###`,`..#`,`###`]],[`6`,[`###`,`#..`,`###`,`#.#`,`###`]],[`7`,[`###`,`..#`,`.#.`,`.#.`,`.#.`]],[`8`,[`###`,`#.#`,`###`,`#.#`,`###`]],[`9`,[`###`,`#.#`,`###`,`..#`,`###`]],[`:`,[`.`,`#`,`.`,`#`,`.`]],[`.`,[`.`,`.`,`.`,`.`,`#`]],[`+`,[`...`,`.#.`,`###`,`.#.`,`...`]],[`-`,[`...`,`...`,`###`,`...`,`...`]],[`/`,[`..#`,`..#`,`.#.`,`#..`,`#..`]],[`×`,[`...`,`#.#`,`.#.`,`#.#`,`...`]],[`%`,[`#.#`,`..#`,`.#.`,`#..`,`#.#`]],[` `,[`.`,`.`,`.`,`.`,`.`]]]),Epe=[`.`,`.`,`.`,`.`,`.`],Dpe=Object.freeze([...$E.keys()]);function Ope(e,t=0,n=!1){if(!Number.isFinite(e))throw RangeError(`PixelNumber needs a finite number`);let r=String(Math.trunc(Math.abs(e))).padStart(t,`0`),i=String(Math.abs(e)).split(`.`)[1];return eD(`${e<0?`-`:n&&e>0?`+`:``}${r}${i?`.${i}`:``}`)}function eD(e){for(let t of e)if(!$E.has(t))throw RangeError(`PixelNumber cannot draw "${t}"; use digits and ${Dpe.filter(e=>!/\d/.test(e)).join(` `)}`);return e}function kpe(e,t){let n=new Set,r=t;for(let i of e){let e=$E.get(i)??Epe;e.forEach((e,i)=>{for(let a=0;a<e.length;a++)e.charAt(a)===`#`&&n.add(`${String(r+a)},${String(i+t)}`)}),r+=(e.at(0)?.length??1)+1}return{lit:n,width:Math.max(1,r-1-t)+t*2}}function Ape(e){let t=new Set;for(let n of e){let[r=0,i=0]=n.split(`,`).map(Number);for(let n=-1;n<=1;n++)for(let a=-1;a<=1;a++){let o=`${String(r+a)},${String(i+n)}`;e.has(o)||t.add(o)}}return t}function tD(e,t,n){let r=[];for(let i=0;i<n;i++){let n=-1;for(let a=0;a<=t;a++){let t=e.has(`${String(a)},${String(i)}`);t&&n<0&&(n=a),!t&&n>=0&&(r.push([n,i,a-n]),n=-1)}}return r}function nD({runs:e,className:t}){return(0,F.jsx)(`g`,{className:t,children:e.map(([e,t,n])=>(0,F.jsx)(`rect`,{x:e,y:t,width:n,height:1},`${String(e)}-${String(t)}`))})}var jpe=(0,I.forwardRef)(function({value:e,text:t,pad:n,signed:r,size:i=`md`,tone:a=`current`,outline:o=!1,className:s,...c},l){if(t===void 0&&e===void 0)throw TypeError(`PixelNumber needs a value or text`);let u=t===void 0?Ope(e??NaN,n,r):eD(t),d=+!!o,{lit:f,width:p}=kpe(u,d),m=5+d*2,h=Mpe[i];return(0,F.jsxs)(`span`,{...c,ref:l,className:Dd(`caps-pixel-number`,s),"data-size":i,"data-tone":a,"data-outline":o,children:[(0,F.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 ${String(p)} ${String(m)}`,width:p*h,height:m*h,children:[o?(0,F.jsx)(nD,{className:`caps-pixel-number-outline`,runs:tD(Ape(f),p,m)}):null,(0,F.jsx)(nD,{className:`caps-pixel-number-face`,runs:tD(f,p,m)})]}),(0,F.jsx)(`span`,{className:`sr-only`,children:u})]})}),Mpe={sm:2,md:3,lg:4,xl:6};function rD({icon:e,caption:t}){return(0,F.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,F.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,F.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,F.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var Npe=(0,I.forwardRef)(function({label:e,icon:t,caption:n,on:r,stateLabels:i=[`on`,`off`],className:a,...o},s){return(0,F.jsxs)(`span`,{...o,className:Dd(`caps-icon-lamp`,a),"data-on":r,ref:s,children:[(0,F.jsx)(rD,{icon:t,caption:n}),(0,F.jsxs)(`span`,{className:`sr-only`,children:[e,`: `,r?i[0]:i[1]]})]})}),Ppe=(0,I.forwardRef)(function({items:e,stateLabels:t,className:n,...r},i){return(0,F.jsx)(`ul`,{...r,className:Dd(`caps-icon-lamps`,n),ref:i,children:e.map(({id:e,...n})=>(0,F.jsx)(`li`,{children:(0,F.jsx)(Npe,{...n,...t===void 0?{}:{stateLabels:t}})},e))})}),Fpe=(0,I.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,F.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:Dd(`caps-surface`,e)})}),iD=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`div`,{...t,ref:n,className:Dd(`caps-screen`,e)})}),Ipe=(0,I.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,F.jsx)(Fpe,{...a,className:Dd(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,F.jsx)(`div`,{className:Dd(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,F.jsx)(iD,{className:Dd(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),Lpe=(0,I.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,F.jsxs)(`header`,{...i,className:Dd(`caps-screen-header`,e),ref:a,children:[t?(0,F.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,F.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,F.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),Rpe=(0,I.forwardRef)(function({appearance:e,className:t,...n},r){return(0,F.jsx)(`div`,{...n,className:Dd(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),aD=(0,I.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,F.jsxs)(`div`,{...s,className:Dd(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,F.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,F.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,F.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,F.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})}),oD={coral:`var(--stipe-art-coral, #ff6558)`,blue:`var(--stipe-art-blue, #43a6f2)`,mint:`var(--stipe-art-mint, #63cfaa)`,grape:`var(--stipe-art-grape, #a66cc1)`,yellow:`var(--stipe-art-yellow, #ffd05d)`,cream:`var(--stipe-art-cream, #fff4de)`,ink:`var(--stipe-art-ink, #242c28)`,graphite:`var(--stipe-art-graphite, #49423f)`,inkcap:`var(--stipe-art-inkcap, #80499d)`},sD=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,zpe=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function cD({transform:e,fill:t=sD}){return(0,F.jsx)(`path`,{transform:e,style:{fill:t},d:`M-1.264-9.479C-2.098-8.643-1.802-1.057-.907-.332.47.782 1.6-.446 1.618-3.075 1.623-3.888 1.691-5.398 1.77-6.429 1.979-9.202 1.596-10 .055-10-.588-10-.843-9.9-1.264-9.479Z`})}function Bpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(cD,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,F.jsx)(cD,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,F.jsx)(cD,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function Vpe(){return(0,F.jsxs)(`g`,{style:{fill:oD.blue},children:[(0,F.jsx)(`path`,{d:`M10.574 .604C9.804 1.375 9.867-.885 9.961 22.81 10.054 47.202 9.722 45.378 14.193 45.94 25.813 47.399 38.465 52.211 44.662 57.532 47.653 60.097 48.082 59.411 47.967 52.242L47.734 19.335C47.734 17.523 47.13 16.616 45.964 15.076 40.604 8.018 30.127 2.767 16.804 .462 13.045-.184 11.326-.148 10.574 .604Z`}),(0,F.jsx)(`path`,{d:`M81.571 .746C71.063 2.665 62.221 6.713 56.562 12.199 54.242 14.45 52 17.356 52.115 19.335L52.033 52.628C51.927 59.934 51.979 59.994 55.74 57.091 62.423 51.931 71.272 48.541 84.103 46.221 90.625 45.039 89.967 47.631 90.145 22.432 90.326-3.079 91.148-1 81.571 .746Z`}),(0,F.jsx)(`path`,{d:`M1.906 12.692C.1 13.42 .151 12.804 .151 33.825 .151 54.097 .163 54.302 1.447 55.498 2.71 56.674 3.384 56.81 7.937 56.816 20.943 56.834 30.647 58.293 38.776 61.45 45.964 64.242 46.435 61.924 39.526 57.773 32.296 53.429 26.656 51.544 14.943 49.553 5.958 48.027 6.535 49.414 6.408 29.003 6.32 14.74 6.263 13.103 5.816 12.764 5.254 12.335 2.9 12.293 1.906 12.692Z`}),(0,F.jsx)(`path`,{d:`M94.326 12.858C93.656 13.326 93.656 13.326 93.653 28.492 93.653 48.882 93.997 48.063 84.743 49.556 73.574 51.36 64.45 54.695 57.801 59.405 54.082 62.039 55.384 63.864 59.722 62.1 68.897 58.372 76.363 57.115 90.03 56.994 100.405 56.903 99.489 58.976 99.773 34.976 100.018 14.142 100.006 13.958 98.399 12.979 97.236 12.269 95.251 12.208 94.326 12.858Z`})]})}function lD(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M-8.572-25.123C-21.412-23.39-33.235-17.39-44.235-7.027-51.235-.433-51.251 .358-44.524 6.749-20.77 29.316 10.23 31.893 36.364 13.487 41.043 10.187 48.193 3.551 49.235 1.524 50.358-.642 49.471-2.102 43.738-7.497 29.257-21.128 9.968-27.631-8.572-25.123Z`}),(0,F.jsx)(`path`,{style:{fill:oD.ink},d:`M-6.225-16.807C-17.727-13.267-21.176 4.433-12.08 13.257-1.118 23.898 16.829 16.102 17.032 .604 17.209-12.412 6.219-20.642-6.225-16.807Z`})]})}function Hpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{style:{fill:oD.mint},d:`M540 342C520 340 497 355 477 374C450 399 440 421 456 444C465 458 480 462 492 464C503 466 500 477 494 486C487 500 508 496 522 478L530 468C557 468 578 464 591 451C601 442 599 429 585 427C572 425 556 432 547 418C538 403 550 390 568 385C579 382 589 380 584 368C576 352 557 341 540 342Z`}),(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M589 396C614 380 659 381 683 392C709 404 721 428 710 451C704 464 693 472 685 479C680 487 684 498 689 503C695 514 684 513 675 507C667 502 662 497 657 491C637 496 610 495 594 486C584 480 583 469 595 464C607 460 622 454 622 441C622 428 612 423 597 420C580 417 578 407 589 396Z`})]})}function uD({fill:e}){return(0,F.jsx)(`path`,{style:{fill:e},d:`M44.648 .288C26.645 1.615 13.263 8.266 5.942 19.529-4.299 35.277-.917 57.684 13.224 67.784 16.958 70.452 16.936 71.742 13.064 77.665 11.28 80.391 10.895 81.565 11.341 82.914 13.163 88.435 25.022 86.396 36.307 78.62L38.681 76.986 41.294 77.335C45.371 77.878 59.645 77.789 64.125 77.191 89.213 73.837 100.562 61.427 99.92 38.044 99.18 11.1 79.587-2.285 44.648 .288Z`})}function dD({onFigure:e=!1}){return(0,F.jsxs)(`g`,{style:{fill:e?zpe:oD.ink},children:[(0,F.jsx)(`rect`,{x:`-15`,y:`-11`,width:`10`,height:`22`,rx:`5`}),(0,F.jsx)(`rect`,{x:`5`,y:`-11`,width:`10`,height:`22`,rx:`5`})]})}function Upe(){return(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M18.125 .621C.039 1.574-2.575 4.791 2.264 20.133 17.454 68.284 77.345 69.396 96.119 21.875 100.749 10.154 100.318 4.348 94.605 1.513 91.981 .21 37.878-.421 18.125 .621Z`})}function Wpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M31.42 5.279C29.108 5.983 28.068 6.993 25.817 10.732 24.033 13.687 24.027 13.762 25.58 14.265 30.375 15.821 36.711 20.506 39.938 24.885 42.077 27.788 41.835 27.806 45.281 24.463 48.633 21.213 49.164 20.185 48.982 17.325 48.812 14.643 48.174 13.872 42.68 9.741 36.737 5.273 34.439 4.361 31.42 5.279Z`}),(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M22.538 16.207C22.093 16.652 19.732 20.231 13.309 30.196 10.737 34.188 10.723 33.911 13.589 35.351 16.461 36.798 19.778 39.28 21.825 41.523L22.6 42.37Q23.34 43.186 24.05 42.538L24.711 41.933C31.278 35.937 38.928 28.484 38.928 28.083 38.928 24.656 24.521 14.219 22.538 16.207Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M8.89 38.053C8.203 39.566 6.598 44.473 6.598 45.056 6.598 45.137 6.887 45.125 7.236 45.036 9.655 44.404 13.526 47.475 13.526 50.027 13.526 51.132 13.361 51.164 16.187 49.49 21.421 46.387 21.966 45.665 20.575 43.659 19.002 41.387 14.975 38.238 11.909 36.881 9.799 35.949 9.854 35.926 8.89 38.053Z`}),(0,F.jsx)(`path`,{style:{fill:oD.graphite},d:`M6.598 45.056C5.732 46.866 5.155 49.464 6.309 50.907 8.041 53.505 10.928 52.639 13.526 50.907 13.526 48.021 9.978 44.404 7.236 45.036Z`})]})}function Gpe(){return(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M40.804 40.625C38.238 41.462 37.291 41.953 31.169 45.625 15.743 54.871 8.047 56.158 5.879 49.856 5.501 48.754 5.501 48.754 4.843 50.913 1.673 61.302 12.377 61.671 30.386 51.796 39.649 46.719 41.142 46.647 40.81 51.291 40.565 54.775 41.168 56.135 43.486 57.31 49.556 60.387 62.035 54.816 59.605 50.116 58.502 47.983 56.1 47.882 52.163 49.799 47.082 52.273 45.983 51.652 47.998 47.449 50.89 41.416 47.686 38.376 40.804 40.625Z`})}function fD({transform:e}){return(0,F.jsx)(`path`,{style:{fill:oD.mint},transform:e,d:`M0 0C3 -2 5 -5 5 -8 5 -10.5 3 -12 0 -12S-5 -10.5 -5 -8C-5 -5 -3 -2 0 0Z`})}function Kpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{fillRule:`evenodd`,style:{fill:sD},d:`M25.3 17.69C14.8 19.34 10.66 20.18 9.05 20.99 5.51 22.78 4.2 27.21 6.71 28.9 7.47 29.42 8.48 29.4 10.25 28.84 12.41 28.15 12.56 27.57 11.02 25.85 10 24.71 10.53 23.62 11.79 24.27 13.9 25.36 15.02 28.98 15.63 36.66 16.18 43.48 17.33 47.43 19.69 50.49 22.76 54.48 27.69 55.73 30.31 53.19 33 50.57 31.24 46.04 28.44 48.38 26.29 50.17 26.16 47.08 28.3 45.14 29.61 43.95 30.78 43.58 38.92 41.75 39.45 41.63 39.41 41.52 38.39 40.01 36.87 37.78 36.04 35.22 34.72 28.69 33.37 22 32.04 19.3 29.5 18.07 28.69 17.68 26.59 17.49 25.3 17.69M24.11 26.51C18.61 27.67 18.16 27.82 17.98 28.55 17.64 29.91 18.54 30.44 20.51 30.05 25.4 29.08 30.11 28.03 30.49 27.83 31.65 27.23 31 25.33 29.66 25.4 29.5 25.4 27 25.91 24.11 26.51M29.2 31.42C28.64 31.54 26.23 32.07 23.85 32.58 20.01 33.41 19.48 33.57 19.15 33.96 18.67 34.5 18.66 35.05 19.12 35.63 19.61 36.26 19.86 36.23 26.05 34.88 29.05 34.23 31.53 33.7 31.57 33.7 31.82 33.7 32.34 32.88 32.34 32.5 32.34 31.25 31.37 30.92 29.2 31.42M29.79 37.19C28.81 37.41 26.45 37.94 24.53 38.37 22.62 38.8 20.84 39.23 20.58 39.33 19.61 39.71 19.35 40.62 19.98 41.41 20.48 42.05 21 41.99 27.59 40.5 33.85 39.09 34.21 38.91 33.45 37.44 33.02 36.61 32.51 36.58 29.79 37.19M45.41 41.95C44.89 42.09 41.61 42.89 38.12 43.73 30.94 45.45 29.81 45.84 31.05 46.15 33.2 46.69 34.11 50.18 32.77 52.76 32.23 53.79 32.23 54.03 32.76 54.16 33.34 54.31 45.35 51.3 46.72 50.67 50.19 49.06 51.76 45.01 49.79 42.76 48.8 41.64 47.46 41.39 45.41 41.95`}),(0,F.jsx)(`path`,{style:{fill:oD.grape},d:`M48.21 10.15C47.92 10.41 47.5 11.27 46.96 12.74 45.52 16.61 45.24 16.99 43.01 18.15 39.18 20.15 39.05 20.99 42.28 22.73 45.37 24.39 45.68 24.79 47.12 28.95 48.3 32.32 49.28 32.2 50.65 28.52 52.23 24.25 52.26 24.22 55.2 22.56 57.53 21.24 57.79 21 57.79 20.16 57.79 19.49 57.55 19.31 55.01 18.06 52.16 16.66 52.2 16.72 50.31 11.56 49.7 9.89 49.03 9.44 48.21 10.15M32.59 13.92C31.78 14.73 32.28 15.89 33.58 16.22 35.07 16.6 36.19 17.1 37.17 17.84 38.42 18.77 39.23 18.86 39.79 18.15 39.99 17.9 40.15 17.53 40.15 17.32 40.15 15.29 33.99 12.52 32.59 13.92M42.48 34.38C40.96 35.96 40.65 36.88 41.39 37.57 42.2 38.33 43.36 37.74 44.55 35.95 45.2 34.97 45.22 34.35 44.62 33.88 43.89 33.31 43.41 33.42 42.48 34.38`}),(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M40.75 25.96C39.69 27.07 38.11 30.69 38.11 31.98 38.11 32.66 38.55 33.19 39.12 33.19 39.8 33.19 40.24 32.73 40.58 31.66 40.95 30.46 41.65 29.09 42.42 28.01 43.77 26.14 42.29 24.32 40.75 25.96M54.85 27.67C54.71 27.81 54.47 28.32 54.31 28.82 53.67 30.76 53.19 31.37 51.67 32.13 50.25 32.85 50.34 33.36 52.04 34.21 53.25 34.82 53.57 35.23 54.24 37.01 54.98 38.98 55.47 39.08 56.03 37.37 56.7 35.32 57.08 34.81 58.64 33.87 60.18 32.95 60.14 32.65 58.38 31.78 57.02 31.11 56.68 30.66 56.02 28.65 55.69 27.64 55.25 27.27 54.85 27.67`})]})}function qpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{fillRule:`evenodd`,style:{fill:sD},d:`M42.24 14.07C41.52 14.24 40.53 14.54 35.06 16.26 33.33 16.8 31.2 17.47 30.34 17.74 29.47 18.01 27.86 18.52 26.75 18.88 25.64 19.23 24.03 19.74 23.16 20.01 20.16 20.94 19.45 21.4 18.97 22.71 18.71 23.44 18.45 26.33 17.83 35.41 17.64 38.25 17.44 41.03 17.41 41.58 17.32 42.77 17.24 42.69 18.79 42.84L20.01 42.95 21.98 39.97C24.69 35.88 24.85 35.82 27.05 37.9 27.9 38.7 28.43 39.08 28.61 39.02 28.76 38.96 28.91 38.91 28.94 38.91 28.98 38.91 29.38 38.38 29.84 37.73 30.3 37.08 31.47 35.48 32.43 34.17 33.4 32.86 34.86 30.85 35.67 29.71 36.49 28.56 37.5 27.29 37.91 26.88 39.73 25.07 41.01 26.43 43.32 32.67 43.76 33.84 44.3 35.28 44.52 35.86 44.74 36.44 44.97 37.28 45.04 37.74 45.19 38.71 45.17 38.71 46.63 38.03 47.69 37.53 47.77 37.46 47.68 37.02 47.58 36.52 46.97 30.64 46.79 28.41 46.73 27.69 46.62 26.43 46.53 25.61 46.44 24.79 46.24 22.87 46.09 21.32 45.61 16.44 45.5 15.66 45.22 15.12 44.72 14.15 43.59 13.76 42.24 14.07M29.38 22.45C26.04 23.47 24.49 27.62 26.6 29.91 29.17 32.7 34.15 30.16 34.16 26.05 34.16 23.38 31.9 21.68 29.38 22.45M46.7 41.5C39.3 44.23 28.33 46.04 20.1 45.88L17.21 45.82 17.16 46.88C17.08 48.22 17.33 49.03 18.01 49.68 18.73 50.37 19.73 50.35 23.77 49.53 25.46 49.19 29.12 48.47 31.91 47.93 46.31 45.14 46.9 44.99 47.57 43.91 47.95 43.3 48.25 41.29 47.99 41.15 47.91 41.11 47.33 41.26 46.7 41.5`}),(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M29.72 22.45C25.84 23.34 24.28 28.36 27.25 30.42 29.34 31.88 32.91 30.43 33.83 27.75 34.92 24.55 32.75 21.76 29.72 22.45`}),(0,F.jsx)(`path`,{style:{fill:oD.mint},d:`M12.96 14.29C12.87 14.41 12.7 15.03 12.58 15.68 12.37 16.82 11.59 18.26 11.18 18.26 11.08 18.26 10.88 18.46 10.72 18.7 10.36 19.25 10.59 19.58 11.45 19.74 12.18 19.88 13.08 20.63 13.54 21.49 14.23 22.76 14.75 22.53 15.15 20.79 15.39 19.71 15.51 19.51 16.4 18.66 17.54 17.58 17.51 17.36 16.18 16.85 15.16 16.47 14.84 16.19 14.14 15.1 13.56 14.2 13.22 13.96 12.96 14.29M49.04 24.13C48.56 24.86 48.91 25.31 50.59 26.09 53.89 27.64 54.85 29.82 53.45 32.6 52.01 35.43 46.84 38.54 40.51 40.39 39.73 40.62 38.88 40.89 38.62 40.99 37.24 41.52 30.85 42.64 27.54 42.93 20.72 43.52 13.63 42.49 10.57 40.46 5.81 37.3 7.51 32.32 14.74 28.24 15.84 27.61 16.17 27.1 15.9 26.4 15.66 25.78 15.35 25.84 13.19 26.94 6 30.61 2.97 35.32 4.95 39.74 7.86 46.21 22.78 47.8 40.05 43.46 51.97 40.47 58.57 36.38 59.47 31.43 60.09 27.97 57.74 25.34 52.93 24.12 50.6 23.53 49.43 23.54 49.04 24.13`}),(0,F.jsx)(`path`,{style:{fill:oD.grape},d:`M34.82 8.91C33.48 10.04 34.21 12.14 35.94 12.14 37.29 12.14 38.18 10.99 37.77 9.77 37.36 8.53 35.81 8.08 34.82 8.91M53.15 43.16C53 43.28 52.74 43.86 52.57 44.45 52.18 45.78 51.76 46.32 50.64 46.93 49.52 47.53 49.45 47.89 50.33 48.34 51.34 48.85 52.24 49.95 52.56 51.04 53.13 53.01 53.6 53 54.21 50.99 54.61 49.69 55.13 48.93 55.91 48.54 57.17 47.91 57.23 47.51 56.15 46.96 55.23 46.49 54.67 45.76 54.23 44.44 53.8 43.15 53.54 42.84 53.15 43.16M24.18 53.18C22.45 53.9 22.87 56.59 24.71 56.59 26.79 56.59 27.2 53.67 25.2 53.09 24.89 53.01 24.51 53.04 24.18 53.18`}),(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M51.76 11.04C51.21 12.77 50.56 13.61 49.24 14.34 48.6 14.69 48.72 15.07 49.59 15.48 50.54 15.93 51.11 16.69 51.62 18.22 52.06 19.57 52.26 19.54 52.79 18.08 53.29 16.69 53.87 15.91 54.86 15.31 55.76 14.77 55.77 14.48 54.92 14.02 53.91 13.46 53.5 12.99 52.89 11.66 52.23 10.21 52.06 10.12 51.76 11.04M11.06 48.22C10.99 48.35 10.71 48.88 10.46 49.41 9.95 50.48 9.45 50.99 8.59 51.33 7.89 51.61 7.85 52.1 8.52 52.37 9.51 52.79 10.3 53.85 10.89 55.58 11.09 56.18 11.48 55.88 11.87 54.84 12.24 53.87 13.33 52.56 13.79 52.56 14 52.56 14.5 52.06 14.5 51.85 14.5 51.77 14.19 51.54 13.81 51.34 12.98 50.92 12.36 50.14 11.93 48.99 11.6 48.09 11.31 47.83 11.06 48.22`})]})}function Jpe(){return(0,F.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M278 155 482 123C517 117 527 135 530 167L542 309Q543 329 561 341L631 404Q649 419 646 444 645 465 623 472L407 521Q374 531 345 519L156 436Q115 418 128 375L221 191Q238 163 278 155Z`}),(0,F.jsx)(`path`,{style:{fill:oD.ink},d:`M317 183 461 161Q493 155 497 188L504 288Q508 320 478 326L318 356Q289 362 286 331L281 226Q278 194 317 183Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M304 386 553 340Q562 337 570 346L631 404Q649 419 646 444Q645 448 629 452L411 483Q382 492 367 474Z`}),(0,F.jsxs)(`g`,{style:{fill:oD.cream},children:[(0,F.jsx)(`rect`,{x:`319`,y:`236`,width:`26`,height:`59`,rx:`13`}),(0,F.jsx)(`rect`,{x:`364`,y:`229`,width:`26`,height:`59`,rx:`13`})]}),(0,F.jsxs)(`g`,{style:{fill:oD.ink},transform:`rotate(-11 470 411)`,children:[(0,F.jsx)(`rect`,{x:`369`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`444`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`518`,y:`380`,width:`57`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`392`,y:`421`,width:`58`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`462`,y:`421`,width:`65`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`539`,y:`421`,width:`58`,height:`25`,rx:`13`})]})]})}function Ype(){return(0,F.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,F.jsx)(`path`,{style:{fill:oD.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,F.jsx)(`path`,{style:{fill:oD.blue},d:`M824 376Q908 372 871 400C842 427 866 442 902 450L1113 480Q1188 479 1199 392C1207 447 1204 497 1163 511Q1134 521 1097 516C1055 510 991 507 957 507S869 511 826 512C781 513 758 483 760 441Q760 385 824 376Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M824 376 857 184Q864 133 911 141C1039 169 1124 151 1226 153Q1179 159 1184 241L1199 377C1202 434 1174 482 1117 480L902 450C864 445 849 429 871 400Q908 372 824 376Z`}),(0,F.jsxs)(`g`,{style:{fill:oD.coral},children:[(0,F.jsx)(`path`,{d:`M982 198C1008 190 1030 197 1028 220L1023 265Q1020 295 1000 279C981 261 951 223 963 210Q970 202 982 198Z`}),(0,F.jsx)(`path`,{d:`M1063 220C1077 215 1100 237 1102 251Q1107 267 1084 282L1063 295Q1037 307 1040 278L1045 245Q1049 224 1063 220Z`}),(0,F.jsx)(`path`,{d:`M911 252C925 240 939 254 957 269L978 291Q995 311 961 316C938 318 907 316 898 308Q884 296 911 252Z`}),(0,F.jsx)(`path`,{d:`M1106 289Q1127 281 1134 304C1142 327 1146 352 1125 350Q1097 348 1073 335C1051 324 1072 311 1084 302Z`}),(0,F.jsx)(`path`,{d:`M927 338C946 334 972 334 985 343Q1004 353 984 384C970 408 957 418 940 403C922 389 896 356 913 345Z`}),(0,F.jsx)(`path`,{d:`M1010 375Q1025 363 1037 384C1049 407 1064 438 1044 442Q1025 448 1002 436C984 428 991 410 997 393Z`}),(0,F.jsx)(`path`,{d:`M1068 357C1084 359 1110 376 1120 389Q1130 402 1107 419C1090 432 1082 418 1073 401C1062 383 1043 355 1068 357Z`}),(0,F.jsx)(`path`,{d:`M1018 311C1037 312 1050 334 1034 343C1018 351 998 337 1005 320Q1009 311 1018 311Z`})]})]})}function Xpe(){return(0,F.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,F.jsx)(`path`,{style:{fill:oD.inkcap},d:`M1384 276C1394 238 1445 200 1497 158C1547 119 1604 97 1647 97C1690 97 1720 109 1745 138C1772 170 1791 184 1833 194C1870 201 1919 220 1922 257C1923 307 1891 339 1853 336C1801 335 1767 299 1701 294C1666 291 1620 294 1642 303Q1670 307 1675 333C1681 367 1697 389 1717 413C1735 434 1738 443 1719 464C1700 485 1692 502 1686 520Q1682 541 1653 541L1626 541Q1598 541 1594 519C1590 495 1578 474 1563 458C1545 440 1544 429 1559 410C1585 377 1608 337 1572 326C1554 320 1529 333 1506 340C1461 356 1428 357 1402 340Q1371 319 1384 276Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M1634 362Q1641 346 1649 362C1660 390 1676 404 1705 424Q1721 435 1704 453C1685 475 1677 490 1671 513Q1670 526 1653 525L1626 525Q1611 525 1610 513C1606 492 1592 465 1575 449Q1562 437 1577 424C1604 404 1620 390 1634 362Z`}),(0,F.jsx)(`path`,{style:{fill:oD.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,F.jsx)(`path`,{style:{fill:oD.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:pD,blue:mD,mint:hD,grape:gD,yellow:_D,cream:vD,ink:yD}=oD,Zpe={bonsai:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,stroke:hD,strokeWidth:`3.7`,strokeLinecap:`round`,d:`M35 27.5C36 25 35.5 22.5 34 21S31.5 17.5 31.5 14M36 27C40 26.8 43 26 45 24S47 20.5 47.5 18.5M30.5 31C32.5 26.5 30.5 24.6 26.5 24 22 23.5 18.5 21.6 16.8 18.5M29 37C26.5 34.5 25 33.7 21.5 33.2S15.5 32 13 31.6M36 39.5C38 38 40 37.5 42 36.5S47 34 51 32.2`}),(0,F.jsx)(`path`,{fill:hD,d:`M25.5 43.5C28 40.5 28 37 27.5 33 27.3 29.5 29.5 27 33.5 26.3L37.5 26V29.5C35 29.8 34.2 31.5 34.3 34 34.5 37.5 37 39.5 41 43.5Z`}),(0,F.jsx)(`circle`,{fill:mD,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,F.jsx)(`circle`,{fill:gD,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,F.jsx)(`circle`,{fill:_D,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,F.jsx)(`circle`,{fill:_D,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,F.jsx)(`circle`,{fill:mD,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,F.jsx)(`path`,{fill:pD,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,F.jsx)(`rect`,{fill:pD,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,F.jsx)(Jpe,{}),prints:(0,F.jsx)(Ype,{}),inkcap:(0,F.jsx)(Xpe,{}),vishnu:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{fill:pD},d:`M6 37C6 21 17.5 9 32 9s26 12 26 28c0 2.2-1.8 4-4 4H10c-2.2 0-4-1.8-4-4Z`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`19`,cy:`25`,r:`4`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`33`,cy:`19.5`,r:`4.8`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`46`,cy:`28`,r:`3.4`}),(0,F.jsx)(`rect`,{style:{fill:mD},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,F.jsx)(`rect`,{style:{fill:vD},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{style:{fill:vD},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,F.jsx)(`circle`,{style:{fill:_D},cx:`39`,cy:`50.5`,r:`2.7`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,F.jsx)(Kpe,{}),generateMedia:(0,F.jsx)(qpe,{}),buyApps:(0,F.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,F.jsx)(`circle`,{fill:_D,cx:`32`,cy:`20`,r:`12`}),(0,F.jsx)(`circle`,{stroke:vD,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,F.jsx)(`path`,{fill:mD,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,F.jsx)(`rect`,{fill:pD,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`rect`,{x:`20`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,F.jsx)(`rect`,{x:`29.5`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,F.jsx)(`rect`,{x:`39`,y:`41`,width:`5`,height:`11`,rx:`2.5`})]})]}),browseBazaar:(0,F.jsxs)(`g`,{transform:`rotate(-5 32 32)`,children:[(0,F.jsx)(`rect`,{fill:mD,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,F.jsx)(`rect`,{fill:mD,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,F.jsx)(`rect`,{fill:vD,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,F.jsx)(`rect`,{fill:pD,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,F.jsx)(`path`,{fill:pD,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,F.jsx)(`path`,{fill:vD,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,F.jsx)(`path`,{fill:pD,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,F.jsx)(`path`,{fill:vD,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,F.jsx)(`path`,{fill:pD,d:`M49.4 9H61V18A5.8 5.8 0 0 1 49.4 18Z`}),(0,F.jsx)(`g`,{transform:`translate(32 36.5) scale(.34)`,children:(0,F.jsx)(lD,{})})]}),agent:(0,F.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,F.jsx)(`path`,{fill:mD,d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,F.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,F.jsx)(dD,{})})]}),list:(0,F.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,F.jsx)(`path`,{style:{fill:mD},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,F.jsx)(`path`,{style:{fill:vD},d:`M19 7H39Q42 7 44 9L55 20Q57 22 57 26V44Q57 50 51 50H19Q13 50 13 44V13Q13 7 19 7Z`}),(0,F.jsx)(`path`,{style:{fill:pD},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,F.jsxs)(`g`,{style:{fill:pD},children:[(0,F.jsx)(`circle`,{cx:`22`,cy:`21`,r:`3`}),(0,F.jsx)(`circle`,{cx:`22`,cy:`31`,r:`3`}),(0,F.jsx)(`circle`,{cx:`22`,cy:`41`,r:`3`})]}),(0,F.jsx)(`path`,{style:{stroke:mD},strokeWidth:`5`,strokeLinecap:`round`,d:`M31 21H32M31 31H46M31 41H42`})]}),chat:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`g`,{transform:`translate(3 11) scale(.22) translate(-449 -327)`,children:(0,F.jsx)(Hpe,{})}),(0,F.jsx)(cD,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,F.jsx)(cD,{transform:`translate(44.4 20.5) rotate(47) scale(.95 .6)`})]}),read:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`g`,{transform:`translate(4 20.5) scale(.56)`,children:(0,F.jsx)(Vpe,{})}),(0,F.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,F.jsx)(lD,{})}),(0,F.jsx)(Bpe,{})]}),readConversations:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(.9) translate(-32 -32)`,children:[(0,F.jsx)(`g`,{transform:`translate(4 7.88) scale(.56)`,children:(0,F.jsx)(uD,{fill:mD})}),(0,F.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,F.jsx)(lD,{})})]}),listAgents:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,F.jsx)(`path`,{style:{fill:sD},d:`M32.059 10.146C23.878 10.646 18.949 14.844 18.925 21.331 18.912 24.856 20.167 27.259 22.274 27.74 24.437 28.233 26.097 29.061 27.481 30.337 28.275 31.068 28.328 31.096 29.352 31.306 31.161 31.677 31.653 32.094 32.115 33.651 32.392 34.582 32.557 34.868 32.915 35.041 33.919 35.523 35.864 33.733 36.539 31.706L36.775 30.997 38.008 30.681C42.663 29.489 45.29 26.142 45.468 21.176 45.734 13.784 40.673 9.62 32.059 10.146Z`}),(0,F.jsx)(`g`,{transform:`translate(32.4 21.2) scale(.39)`,children:(0,F.jsx)(dD,{onFigure:!0})}),(0,F.jsx)(`path`,{style:{fill:pD},d:`M14.375 27.586C8.014 28.591 4.363 32.396 4.355 38.027 4.347 43.93 8.071 47.469 15.239 48.368L16.828 48.568 17.873 49.568C19.854 51.464 22.469 52.496 23.691 51.864 24.384 51.506 24.431 51.044 23.924 49.606 23.337 47.943 23.479 47.492 24.749 46.977 32.756 43.73 32.643 31.899 24.573 28.49 22.238 27.504 17.535 27.087 14.375 27.586Z`}),(0,F.jsx)(`g`,{transform:`translate(17.6 37.7) scale(.38 .36)`,children:(0,F.jsx)(dD,{})}),(0,F.jsx)(`path`,{style:{fill:mD},d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,F.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,F.jsx)(dD,{})})]}),createAgents:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,F.jsx)(`path`,{style:{fill:sD},d:`M20.436 24.499C13.35 25.216 7.504 28.799 5.442 33.687 3.114 39.208 4.438 45.791 8.593 49.358 10.446 50.949 10.34 50.831 10.34 51.301 10.34 51.796 10.106 52.294 9.281 53.558 7.191 56.76 12.108 56.905 16.701 53.777 17.517 53.221 17.715 53.135 18.015 53.201 20.013 53.639 25.739 53.051 28.595 52.113 35.47 49.857 39.129 44.162 37.83 37.738C37 31 33 26 26.717 24.428L24.075 24.413C22.623 24.405 20.985 24.444 20.436 24.499Z`}),(0,F.jsx)(`g`,{transform:`translate(21.9 40) scale(.46 .43)`,children:(0,F.jsx)(dD,{onFigure:!0})}),(0,F.jsx)(`path`,{style:{fill:hD},d:`M37.987 15.734C32.277 16.627 28.675 20.713 28.92 26.022 29.062 29.118 30.627 31.606 33.331 33.036 34.675 33.747 34.761 34.018 34.237 35.923 33.376 39.051 36.878 38.551 39.174 35.218 39.574 34.637 39.65 34.583 40.058 34.583 46.203 34.583 50.414 30.91 50.424 25.543 50.435 18.989 44.932 14.649 37.987 15.734Z`}),(0,F.jsx)(`g`,{transform:`translate(38.9 24.9) scale(.31)`,children:(0,F.jsx)(dD,{})}),(0,F.jsx)(cD,{fill:_D,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(52.2 19.8) rotate(70) scale(1.25 .85)`})]}),sendPrompts:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,F.jsx)(`g`,{transform:`translate(4 13.2) scale(.412 .436)`,children:(0,F.jsx)(uD,{fill:pD})}),(0,F.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,F.jsx)(Upe,{})}),(0,F.jsx)(cD,{fill:hD,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,F.jsx)(cD,{fill:hD,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Wpe,{}),(0,F.jsx)(Gpe,{})]}),run:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{style:{fill:mD},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,F.jsx)(`path`,{style:{stroke:vD},strokeWidth:`5`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m17 22 9 8-9 8m17 0h12`})]}),stop:(0,F.jsx)(`rect`,{style:{fill:pD},x:`12`,y:`12`,width:`40`,height:`40`,rx:`9`}),connected:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,style:{stroke:mD},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:pD},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,F.jsx)(`path`,{style:{stroke:_D},strokeWidth:`4`,strokeLinecap:`round`,d:`m27 4 2 6m10-5-2 7m12 0-5 4`})]}),working:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ellipse`,{style:{fill:hD},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,F.jsx)(`ellipse`,{style:{fill:_D},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,F.jsx)(`ellipse`,{style:{fill:gD},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:sD},strokeWidth:`3`,strokeLinecap:`round`,d:`M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17`})]}),complete:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{fill:hD},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:yD},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,F.jsx)(`path`,{style:{stroke:sD},strokeWidth:`3`,strokeLinecap:`round`,d:`m4 8 5 6m48-4 5-5M2 24l6 1`})]}),installApps:(0,F.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,F.jsx)(`rect`,{style:{fill:mD},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,F.jsx)(`rect`,{style:{fill:vD},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,F.jsx)(`path`,{style:{fill:hD},d:`M22 38h8v8h-8z`}),(0,F.jsx)(`path`,{style:{fill:gD},d:`M34 38h8v8h-8z`}),(0,F.jsx)(`path`,{style:{stroke:pD},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M32 4v17m-8-7 8 8 8-8`})]}),restricted:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,style:{stroke:pD},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,F.jsx)(`rect`,{style:{fill:pD},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,F.jsx)(`path`,{style:{fill:vD},d:`M32 34a7 7 0 0 0-4 13v7h8v-7a7 7 0 0 0-4-13Z`})]}),error:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{fill:pD},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:vD},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`g`,{fill:_D,children:[(0,F.jsx)(`rect`,{x:`17.25`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,F.jsx)(`rect`,{x:`42.95`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`18`,width:`3.2`,height:`26`}),(0,F.jsx)(`rect`,{x:`14.8`,y:`15.75`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,F.jsx)(`rect`,{x:`14.8`,y:`28.85`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,F.jsx)(`rect`,{x:`14.8`,y:`42.55`,width:`34.4`,height:`3.1`,rx:`1.55`})]}),(0,F.jsx)(`path`,{fill:`none`,stroke:hD,strokeWidth:`3`,strokeLinecap:`round`,d:`M21.9 56.1C31.5 54.4 32.9 47 32.1 45.8`}),(0,F.jsx)(`path`,{fill:`none`,stroke:hD,strokeWidth:`3`,strokeLinecap:`round`,d:`M32 44.2C28.7 41.8 25.2 35.7 32 32.3 38.8 28 38.9 24 31.9 18.8 32.4 16.3 32.8 14.7 34.5 12.2`}),(0,F.jsx)(fD,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,F.jsx)(fD,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,F.jsx)(fD,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,F.jsx)(fD,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,F.jsx)(fD,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,F.jsx)(`circle`,{fill:pD,cx:`31.9`,cy:`18.8`,r:`4`}),(0,F.jsx)(`circle`,{fill:mD,cx:`32`,cy:`32.3`,r:`4`}),(0,F.jsx)(`circle`,{fill:gD,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:mD,d:`M18.5 28.5H45.5C49.5 29.5 53 32 54 35 55 37.5 56.8 45.5 56.6 48 56.5 53 52.5 57.5 47 58H15C9.5 56.5 6.6 51 7.6 45.5 8.6 39.5 9.3 35 10.5 33 12 31 14.5 29.5 18.5 28.5Z`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,F.jsx)(`ellipse`,{fill:yD,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,F.jsx)(`path`,{fill:yD,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,F.jsx)(`circle`,{fill:pD,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,F.jsx)(`circle`,{fill:vD,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,F.jsx)(`ellipse`,{fill:_D,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:gD,d:`M35.5 6C33.7 6.3 32.3 7.6 31.4 9.4 30.9 10.3 30.4 10.3 29.5 10 25.5 9 20.6 11.6 19.6 15.9 19.4 16.6 19 17 18 17.1 14.5 17.6 12 20.6 12.1 24.2 12.2 25.4 12 25.9 11.5 26.5 7.5 30 10.5 34.5 17.5 34.4 15.3 32.6 16 31 19 29 26 24 37 19.5 43.5 19 46 19 46 22 43 25.5 46.5 23.5 51.5 18.5 53.5 15 55 11 50 7 45 9 43.8 9.4 43.3 9.2 42.5 8 40.7 6.3 38 5.6 35.5 6Z`}),(0,F.jsx)(`circle`,{fill:vD,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,F.jsxs)(`g`,{fill:yD,children:[(0,F.jsx)(`rect`,{x:`29.9`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`}),(0,F.jsx)(`rect`,{x:`36.7`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`})]}),(0,F.jsx)(`path`,{fill:gD,d:`M49.5 39C47.9 39.3 46.5 40 46.1 41.6 45.8 43.2 45.5 43.5 44 43.5 38.5 43.5 35 48 39 49.5 40 50 39.5 50.5 38 51 35.5 52.5 32.5 52 30 51 29 50.5 28.5 50 29.5 50 33 47.5 30 43.5 24.5 43.5 23.3 43.5 22.9 43.3 22.5 43 20.5 40.5 19 40 17.5 39.5 13 39.5 13 44 17 47.5 18.3 48.4 18.6 48.7 19 49.5 20.5 53 23 55 26 55 26.8 55 27 55.3 27.5 56 31 58.5 36.5 58.5 40 56 40.8 55.2 41.2 55 42 55 45 55 47.5 53 49 49.5 49.6 48.5 50 48 50.5 47.5 56 43.5 55 38.5 49.5 39Z`}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`3`,strokeLinecap:`round`,d:`M46.6 31.8 49.2 27.8 M49.4 35.5 52.8 33.7 M21.5 32.5 22.9 33.5 M19.3 37.5 21.1 38.1`})]}),tourtois:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:vD,x:`11.07`,y:`35.73`,width:`26.8`,height:`9.7`,rx:`3.25`,transform:`rotate(-5 24.47 40.58)`}),(0,F.jsx)(`path`,{fill:_D,d:`M14.8 16C19 14.6 23 13.5 26.5 12.6 28.4 12.1 29.6 13.4 30.1 15.3L31.6 21 17.4 37.6C13.8 38.2 10.6 37.8 10.1 35.4L9.2 27.8C9.1 26.1 10.1 24.7 11.6 24.1 11.4 22.4 11.4 20.6 11.8 19.1 12.3 17.4 13.3 16.5 14.8 16Z`}),(0,F.jsx)(`path`,{fill:pD,d:`M14.0 24.1Q13.3 21.2 16.2 20.4L30.7 16.2Q33.6 15.4 34.6 18.2L36.0 22.7Q37.0 25.5 34.7 27.4L20.2 39.7Q17.9 41.6 17.2 38.7Z`}),(0,F.jsx)(`path`,{fill:mD,d:`M21 23.4 35.5 20.6C37.3 20.2 38.6 21 38.9 22.6L40 34.5C40.1 36.2 39.1 37.3 37.5 37.7 32.6 39.9 26 41 21 41 16 41 12.2 40.2 11 38.8 10.4 37.6 10.8 36.4 12.4 37L19.6 38.4 18.4 27C18.2 25.2 19.3 23.7 21 23.4Z`}),(0,F.jsx)(`path`,{fill:vD,d:`M22.8 29.6 34.8 26.9C36.2 26.6 37 27.3 37.2 28.6L37.9 33C38.1 34.2 37.5 35 36.3 35.3L24.3 37.8C23 38.1 22.3 37.5 22.1 36.3L21.3 31.6C21.1 30.6 21.7 29.8 22.8 29.6Z`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`circle`,{cx:`14.7`,cy:`18.45`,r:`1`}),(0,F.jsx)(`circle`,{cx:`17.6`,cy:`17.65`,r:`1`}),(0,F.jsx)(`circle`,{cx:`20.5`,cy:`16.85`,r:`1`}),(0,F.jsx)(`circle`,{cx:`17.9`,cy:`22.2`,r:`1`}),(0,F.jsx)(`circle`,{cx:`21`,cy:`21.5`,r:`1`}),(0,F.jsx)(`circle`,{cx:`24.1`,cy:`20.75`,r:`1`}),(0,F.jsx)(`circle`,{cx:`28.2`,cy:`25.3`,r:`1`})]}),(0,F.jsx)(`circle`,{fill:pD,cx:`21.7`,cy:`26.6`,r:`1`}),(0,F.jsx)(`circle`,{fill:_D,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,F.jsxs)(`g`,{fill:hD,children:[(0,F.jsx)(`ellipse`,{cx:`8.8`,cy:`36.6`,rx:`3.6`,ry:`1.9`,transform:`rotate(22 8.8 36.6)`}),(0,F.jsx)(`path`,{d:`M12 41C10 41.5 7.5 44.5 7 46.5 7 48 8.5 49.5 10.5 50 12.5 50.5 13.5 50 15 48 15.5 47 16.5 47.5 19 50 22 49.5 22 46.5 22 45.5 20.5 45.5 17 45 16.5 44.5 16.5 44 16.5 42 13.5 40.5L12 41Z`}),(0,F.jsx)(`path`,{d:`M40 33C39 38 36 42 34.5 41.5 32.5 40.5 29.5 42 28.5 44 26 49 27.5 51.5 32.5 51 36 51 37 50 36 46.5 36 45 37 44.5 38 44.5 38.5 45.5 40.5 49 43.5 50 46.5 47.5 47.5 46.5 46 43.5 44 42 43 41.5 43.5 40.5 44.5 39.5 46 38 47 37.5L47 33Z`})]}),(0,F.jsx)(`ellipse`,{fill:hD,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,F.jsxs)(`g`,{fill:yD,children:[(0,F.jsx)(`rect`,{x:`45.05`,y:`26.95`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 46.2 29.3)`}),(0,F.jsx)(`rect`,{x:`49.25`,y:`26.4`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 50.4 28.7)`})]}),(0,F.jsx)(`path`,{fill:pD,d:`M46.8 32.2H51C51 34.3 50 35.4 48.9 35.4S46.8 34.3 46.8 32.2Z`,transform:`rotate(-8 48.9 33.5)`}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`3`,strokeLinecap:`round`,d:`M50.9 17.7 50.5 19.7 M55.2 20.1 53.4 21.9 M56.5 24.5 55.7 24.7`})]}),allApps:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:pD,x:`7`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 18.6 18.6)`}),(0,F.jsx)(`rect`,{fill:mD,x:`33.9`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 45.5 18.6)`}),(0,F.jsx)(`rect`,{fill:hD,x:`7`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 18.6 45.5)`}),(0,F.jsx)(`rect`,{fill:_D,x:`33.9`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 45.5 45.5)`})]}),search:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,stroke:mD,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,F.jsx)(`path`,{fill:`none`,stroke:pD,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,F.jsx)(`ellipse`,{fill:mD,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:pD,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,F.jsx)(`path`,{fill:vD,d:`M10 16.5H29.4C30.3 16.1 31 14.4 31.8 12.5 32.5 10.9 33.2 10 34.5 10H52.2C53.4 10 54 10.7 54 12V16.5C55.2 16.5 56 17.1 56 18.3V52.4C56 53.7 55.1 54.6 53.8 54.6H10.2C8.9 54.6 8 53.7 8 52.4V18.2C8 17.1 8.7 16.5 10 16.5Z`}),(0,F.jsx)(`circle`,{fill:_D,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,F.jsx)(`circle`,{fill:mD,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,F.jsx)(`circle`,{fill:gD,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,F.jsx)(`circle`,{fill:hD,cx:`32`,cy:`34.9`,r:`14.5`}),(0,F.jsxs)(`g`,{fill:`none`,stroke:vD,strokeWidth:`3`,children:[(0,F.jsx)(`ellipse`,{cx:`32`,cy:`34.9`,rx:`7.7`,ry:`13.3`}),(0,F.jsx)(`path`,{d:`M17.5 34.9H46.5`})]})]}),internet:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ellipse`,{fill:`none`,stroke:_D,strokeWidth:`4.4`,cx:`32.2`,cy:`30.2`,rx:`25.6`,ry:`8.1`,transform:`rotate(-20.8 32.2 30.2)`}),(0,F.jsx)(`circle`,{fill:mD,cx:`32`,cy:`32`,r:`21.1`}),(0,F.jsxs)(`g`,{fill:`none`,stroke:vD,strokeWidth:`3`,children:[(0,F.jsx)(`ellipse`,{cx:`32`,cy:`31.8`,rx:`12.2`,ry:`18.7`}),(0,F.jsx)(`path`,{d:`M32 13.1V50.5M15 20.4Q32 29 49 20.4M12.5 39Q32 44.6 51.5 39`})]}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`4.4`,d:`M6.6 30.2A25.6 8.1 0 0 0 57.8 30.2`,transform:`rotate(-20.8 32.2 30.2)`})]}),members:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{fill:mD,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,F.jsx)(`path`,{fill:mD,d:`M36 34C33.8 34.8 32.2 35.8 31 37 37.5 39.5 40.5 43.5 40.5 49.5V53.5H54.5C57 53.5 58 51 58 47.5 58 40 55 35.5 49 34Z`}),(0,F.jsx)(`circle`,{fill:pD,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,F.jsx)(`path`,{fill:pD,d:`M15.5 38C10.5 39 7.5 42.5 6.5 47 5.5 50.5 6 53.5 8.5 53.5H38.5C42 52 40 43 36 40 34.5 39 32 38 31 38Z`}),(0,F.jsxs)(`g`,{fill:yD,children:[(0,F.jsx)(`circle`,{cx:`18.3`,cy:`28`,r:`1.6`}),(0,F.jsx)(`circle`,{cx:`27.9`,cy:`28`,r:`1.6`}),(0,F.jsx)(`circle`,{cx:`39.1`,cy:`23.05`,r:`1.55`}),(0,F.jsx)(`circle`,{cx:`47.25`,cy:`23.05`,r:`1.55`})]})]}),sell:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:_D,d:`M6.4 41.2V48.4C6.4 51.4 13.2 54 21.8 54S37.2 51.4 37.2 48.4V41.2C37.2 37.8 30.4 35 21.8 35S6.4 37.8 6.4 41.2Z`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`21.9`,cy:`40.8`,rx:`13.2`,ry:`3.6`}),(0,F.jsxs)(`g`,{transform:`rotate(-3 22.5 30) translate(0.5 0)`,children:[(0,F.jsx)(`path`,{fill:_D,d:`M7.5 26V34C7.5 37.3 14.2 40 22.5 40S37.5 37.3 37.5 34V26C37.5 22.7 30.8 20 22.5 20S7.5 22.7 7.5 26Z`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`23.7`,cy:`26.55`,rx:`13.05`,ry:`4.4`})]}),(0,F.jsxs)(`g`,{transform:`translate(46.3 40.3) rotate(-25)`,children:[(0,F.jsx)(`path`,{fill:pD,d:`M-8.5-10Q-8.5-12-7-13L-1.5-16.3Q0-17.2 1.5-16.3L7-13Q8.5-12 8.5-10V9Q8.5 12 5.5 12H-5.5Q-8.5 12-8.5 9Z`}),(0,F.jsx)(`circle`,{fill:vD,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,F.jsx)(cD,{fill:_D,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:vD,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,F.jsx)(`path`,{fill:pD,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`circle`,{cx:`16.1`,cy:`16.15`,r:`3.4`}),(0,F.jsx)(`circle`,{cx:`43.4`,cy:`16.15`,r:`3.4`})]}),(0,F.jsxs)(`g`,{fill:mD,children:[(0,F.jsx)(`rect`,{x:`13.6`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`}),(0,F.jsx)(`rect`,{x:`40.9`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`})]}),(0,F.jsxs)(`g`,{fill:hD,children:[(0,F.jsx)(`rect`,{x:`11.1`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`20.7`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`20.7`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`11.1`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,F.jsxs)(`g`,{fill:gD,children:[(0,F.jsx)(`rect`,{x:`40.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`11.1`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`20.7`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,F.jsx)(`circle`,{fill:_D,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,F.jsx)(`path`,{fill:`none`,stroke:yD,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,F.jsx)(`circle`,{fill:yD,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),loop:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{stroke:pD},strokeWidth:`6`,strokeLinecap:`round`,d:`M47.5 14.5C43 11 37.5 9 32 9 19.5 9 9 19.5 9 32S19.5 55 32 55 55 44.5 55 32`}),(0,F.jsx)(`path`,{style:{fill:pD},d:`M53.5 21.5Q54.5 20 55 22L58 33Q58.5 35 56.5 34.5L48.5 32.5Q47 32 48 30.5Z`}),(0,F.jsx)(`g`,{transform:`translate(18 21) scale(.28)`,children:(0,F.jsx)(uD,{fill:mD})}),(0,F.jsxs)(`g`,{style:{fill:vD},children:[(0,F.jsx)(`rect`,{x:`25`,y:`27.5`,width:`14`,height:`3`,rx:`1.5`}),(0,F.jsx)(`rect`,{x:`25`,y:`33.5`,width:`9`,height:`3`,rx:`1.5`})]})]}),fungi:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ellipse`,{fill:vD,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,F.jsx)(`path`,{fill:pD,d:`M29.5 6.5C22 7.5 16 11 11 18.5 4 29 4.6 39.6 13.5 42.2 24 45 44 40.5 54 34.6 57.6 32.6 58.6 29.2 57.5 25 56.5 20 53 16 48.5 13 43.5 8 37 5.5 29.5 6.5Z`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`ellipse`,{cx:`29`,cy:`15.7`,rx:`8.7`,ry:`6.3`,transform:`rotate(-15.5 29 15.7)`}),(0,F.jsx)(`ellipse`,{cx:`50.8`,cy:`20.1`,rx:`6.5`,ry:`3.5`,transform:`rotate(51.6 50.8 20.1)`}),(0,F.jsx)(`ellipse`,{cx:`13`,cy:`26.8`,rx:`4.2`,ry:`3.3`,transform:`rotate(-54.5 13 26.8)`})]}),(0,F.jsxs)(`g`,{fill:yD,transform:`translate(26.6 46.6) scale(1.1) translate(-33.7 -38.5)`,children:[(0,F.jsx)(`rect`,{x:`31.85`,y:`35.9`,width:`3.75`,height:`5.25`,rx:`1.85`}),(0,F.jsx)(`path`,{d:`M 47.4 34.3 C 46 35 44.6 35.8 43.5 36.7 42.9 37.2 43.2 38.3 44 38.4 45.2 38.6 46.5 38.6 47.7 38.4 48.4 38.3 48.3 37.3 47.6 37.3 46.6 37.4 45.7 37.4 45 37.3 45.9 36.7 46.9 36.1 48 35.6 48.7 35.3 48.2 34 47.4 34.3 Z`}),(0,F.jsx)(`path`,{d:`M 37.4 41.1 C 38.6 44.3 42.6 44.3 43.6 40.5 43.7 40 43.1 39.8 42.9 40.3 41.9 42.8 39.1 42.9 38.3 40.7 38.1 40.2 37.3 40.5 37.4 41.1 Z`})]})]})};function bD({name:e,size:t}){return(0,F.jsx)(`svg`,{viewBox:`0 0 64 64`,width:t,height:t,fill:`none`,stroke:`none`,"aria-hidden":`true`,focusable:`false`,"data-sigil":e,children:Zpe[e]})}var Qpe=[{id:`list`,label:`List files`,contract:jce},{id:`read`,label:`Read files`,contract:Bce},{id:`write`,label:`Write files`,contract:Vce},{id:`run`,label:`Run commands`,contract:wC}],$pe={loading:`Loading`,unavailable:`Unavailable`,error:`Refresh failed`};function eme({app:e,terminal:t=null,processes:n,ports:r}){let[i,a]=(0,I.useState)(!1),o=async()=>{if(e){a(!0);try{await e.ui.requestAppPermissions({})}catch(e){DC(`Could not open App permissions. Try again.`,e)}finally{a(!1)}}};return{id:`access`,label:`Access`,title:`Computer access`,content:(0,F.jsxs)(`div`,{className:`shed-instrument`,children:[(0,F.jsxs)(Ipe,{size:`sm`,children:[(0,F.jsx)(Lpe,{icon:(0,F.jsx)(bD,{name:`computer`}),title:t?.name??`Selected Computer`,status:t?(0,F.jsx)(vm,{size:`compact`,label:`Terminal ${t.state}`,tone:t.state===`open`?`success`:t.state===`failed`?`error`:`neutral`}):null}),(0,F.jsxs)(Rpe,{children:[(0,F.jsx)(aD,{legend:`Shed may`,wide:!0,children:(0,F.jsx)(Ppe,{"aria-label":`Shed may`,stateLabels:[`allowed`,`not allowed`],items:Qpe.map(({id:t,label:n,contract:r})=>({id:t,label:n,caption:t,icon:(0,F.jsx)(bD,{name:t}),on:e?.capabilities.has(r)===!0}))})}),(0,F.jsx)(xD,{label:`Processes`,value:n}),(0,F.jsx)(xD,{label:`Ports open`,value:r})]})]}),e?(0,F.jsx)(`div`,{className:`shed-instrument-keys`,children:(0,F.jsx)(ZE,{size:`sm`,variant:`ghost`,disabled:i,onClick:()=>void o(),children:i?`Opening permissions…`:`App permissions…`})}):null]})}}function xD({label:e,value:t}){return(0,F.jsx)(aD,{legend:e,role:`group`,"aria-label":e,children:t.kind===`loaded`?(0,F.jsx)(jpe,{value:t.count,pad:2,size:`md`}):(0,F.jsx)(`span`,{className:`shed-instrument-note`,children:$pe[t.kind]})})}var tme={2:`h2`,3:`h3`,4:`h4`};function nme(e,t){let{reduced:n}=t,r=e&&!n,i=Rd(t,600),[a,o]=(0,I.useState)(r);return(0,I.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var rme=(0,F.jsx)(um,{decorative:!0,pace:`idle`,size:`md`,tone:`primary`,variant:`wander`}),SD=(0,I.forwardRef)(function({actions:e,secondaryAction:t,className:n,description:r,headingLevel:i=2,primaryAction:a,suggestions:o,thinking:s=!1,title:c,visual:l,renderVisual:u,variant:d=`plain`,...f},p){let m=(0,I.useId)(),h=(0,I.useRef)(null),g=Ld(h),_=nme(d===`speech`,g)&&!s,v=tme[i],y=l??(d===`panel`?`blobs`:void 0),b=u?u({speaking:_,thinking:s}):y===`blobs`?rme:y,x=`${m}-reason`,S=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v,{ref:h,className:`empty-state-title`,id:f[`aria-labelledby`]?void 0:m,children:c}),(0,F.jsx)(`p`,{children:r}),a?(0,F.jsxs)(`div`,{className:`empty-state-primary`,children:[(0,F.jsxs)(`div`,{className:`empty-state-action-row`,children:[(0,F.jsx)(ZE,{"aria-describedby":a.disabled&&a.disabledReason?x:void 0,disabled:a.disabled,loading:a.pending===!0,onClick:a.onSelect,variant:`primary`,children:a.label}),t]}),a.disabled&&a.disabledReason?(0,F.jsx)(`span`,{className:`empty-state-reason`,id:x,children:a.disabledReason}):null]}):null,o&&o.length>0?(0,F.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:o.map((e,t)=>(0,F.jsx)(`li`,{children:(0,F.jsx)(ZE,{disabled:e.disabled,loading:e.pending===!0,size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},`${String(t)}:${e.label}`))}):null,e?(0,F.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,F.jsxs)(`section`,{...f,"aria-labelledby":f[`aria-labelledby`]??m,className:Dd(`empty-state`,d!==`plain`&&`empty-state-${d}`,n),ref:p,children:[b?(0,F.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:b}):null,d===`speech`?(0,F.jsx)(`div`,{className:`empty-state-bubble`,children:S}):S]})}),ime=(0,I.forwardRef)(function({className:e,orientation:t,variant:n=`grip`,value:r,min:i,max:a,onValueChange:o,onKeyDown:s,...c},l){return(0,F.jsx)(`div`,{...c,ref:l,className:Dd(`caps-resize-handle`,e),"data-resize-variant":n,role:`separator`,"aria-orientation":t,"aria-valuemin":Math.round(i),"aria-valuemax":Math.round(a),"aria-valuenow":Math.round(r),tabIndex:c.tabIndex??0,onKeyDown:e=>{if(s?.(e),e.defaultPrevented)return;if(e.key===`Home`||e.key===`End`){e.preventDefault(),o(e.key===`Home`?i:a);return}let n=t===`horizontal`?e.key===`ArrowUp`?-32:e.key===`ArrowDown`?32:null:e.key===`ArrowLeft`?-32:e.key===`ArrowRight`?32:null;n!==null&&(e.preventDefault(),o(Math.min(a,Math.max(i,r+n))))},children:(0,F.jsx)(`span`,{className:`caps-resize-grip`,"aria-hidden":`true`})})});function CD(e){return`init`in e}function wD(e){return typeof e.write==`function`}function ame(e){return!!e.onMount}function TD(e){return`v`in e||`e`in e}function ED(e){if(`e`in e)throw e.e;return e.v}function DD(e){return typeof e?.then==`function`}function ome(e){if(!(e instanceof Error))return!1;let t=e.name,n=e.message.toLowerCase();return(t===`RangeError`||t===`InternalError`)&&(n.includes(`call stack`)||n.includes(`too much recursion`)||n.includes(`stack overflow`))}function OD(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function kD(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}function sme(e){return!!e.INTERNAL_onInit}var cme=(e,t,n,...r)=>n.read(...r),lme=(e,t,n,...r)=>n.write(...r),ume=(e,t,n)=>n.INTERNAL_onInit(t),dme=(e,t,n,r)=>n.onMount?.call(n,r),fme=(e,t,n)=>{var r;let i=e[0],a=i.get(n);if(!a){let o=e[6],s=e[9];a={d:new Map,p:new Set,n:0},i.set(n,a),(r=o.i)==null||r.call(o,n),sme(n)&&s(e,t,n)}return a},pme=(e,t)=>{let n=e[1],r=e[3],i=e[4],a=e[5],o=e[6],s=e[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let c=new Set;for(let e of r){let t=n.get(e)?.l;if(t)for(let e of t)c.add(e)}r.clear();for(let e of a)c.add(e);a.clear();for(let e of i)c.add(e);i.clear();for(let e of c)l(e);r.size&&s(e,t)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},mme=(e,t)=>{let n=e[1],r=e[2],i=e[3],a=e[11],o=e[14],s=e[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let n of i)f.push(n),p.push(a(e,t,n));for(;f.length;){let i=f.length-1,o=f[i],s=p[i];if(d.has(o)){f.pop(),p.pop();continue}if(u.has(o)){r.get(o)===s.n&&(c.push(o),l.push(s)),d.add(o),f.pop(),p.pop();continue}u.add(o);for(let r of kD(o,s,n))u.has(r)||(f.push(r),p.push(a(e,t,r)))}for(let n=c.length-1;n>=0;--n){let a=c[n],u=l[n],d=!1;for(let e of u.d.keys())if(e!==a&&i.has(e)){d=!0;break}d&&(r.set(a,u.n),o(e,t,a),s(e,t,a)),r.delete(a)}},hme=(e,t,n)=>{var r,i;let a=e[1],o=e[2],s=e[3],c=e[6],l=e[7],u=e[11],d=e[12],f=e[13],p=e[14],m=e[16],h=e[17],g=e[20],_=e[26],v=e[28],y=u(e,t,n),b=v[0];if(TD(y)){if(a.has(n)&&o.get(n)!==y.n||y.m===b)return y.m=b,y;let r=!1;for(let[n,i]of y.d)if(p(e,t,n).n!==i){r=!0;break}if(!r)return y.m=b,y}let x=!0,S=new Set(y.d.keys()),C=()=>{for(let e of S)y.d.delete(e)},w=()=>{if(a.has(n)){let r=!s.size;h(e,t,n),r&&(f(e,t),d(e,t))}},T=r=>{var i;if(r===n){let n=u(e,t,r);if(!TD(n)){if(CD(r))g(e,t,r,r.init);else throw Error(`no atom init`)}return ED(n)}let o=p(e,t,r);try{return ED(o)}finally{S.delete(r),y.d.set(r,o.n),DD(y.v)&&OD(n,y.v,o),a.has(n)&&((i=a.get(r))==null||i.t.add(n)),x||w()}},E,D,O={get signal(){return E||=new AbortController,E.signal},get setSelf(){return!D&&wD(n)&&(D=(...r)=>{if(!x)try{return m(e,t,n,r)}finally{f(e,t),d(e,t)}}),D}},k=y.n,A=o.get(n)===k;try{let i=l(e,t,n,T,O);if(g(e,t,n,i),DD(i)){_(e,t,i,()=>E?.abort());let n=()=>{C(),w()};i.then(n,n)}else C();return(r=c.r)==null||r.call(c,n),y.m=b,y}catch(e){if(ome(e))throw e;return delete y.v,y.e=e,++y.n,y.m=b,y}finally{x=!1,y.n!==k&&A&&(o.set(n,y.n),s.add(n),(i=c.c)==null||i.call(c,n))}},gme=(e,t,n)=>{let r=e[1],i=e[2],a=e[11],o=[n];for(;o.length;){let n=o.pop(),s=a(e,t,n);for(let c of kD(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},_me=(e,t,n,r)=>{let i=e[3],a=e[6],o=e[8],s=e[11],c=e[12],l=e[13],u=e[14],d=e[15],f=e[16],p=e[17],m=e[20],h=e[28],g=!0,_=n=>ED(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!CD(r))throw Error(`atom not writable`);let n=_.n,s=o[0];m(e,t,r,s),p(e,t,r),n!==_.n&&(++h[0],i.add(r),d(e,t,r),(u=a.c)==null||u.call(a,r));return}return f(e,t,r,o)}finally{g||(l(e,t),c(e,t))}};try{return o(e,t,n,_,v,...r)}finally{g=!1}},vme=(e,t,n)=>{var r;let i=e[1],a=e[3],o=e[6],s=e[11],c=e[15],l=e[18],u=e[19],d=s(e,t,n),f=i.get(n);if(f&&d.d.size>0){for(let[i,u]of d.d)if(!f.d.has(i)){let d=s(e,t,i);l(e,t,i).t.add(n),f.d.add(i),u!==d.n&&(a.add(i),c(e,t,i),(r=o.c)==null||r.call(o,i))}for(let r of f.d)d.d.has(r)||(f.d.delete(r),u(e,t,r)?.t.delete(n))}},yme=(e,t,n)=>{var r;let i=e[1],a=e[4],o=e[6],s=e[10],c=e[11],l=e[12],u=e[13],d=e[14],f=e[16],p=e[18],m=c(e,t,n),h=i.get(n);if(!h){d(e,t,n);for(let r of m.d.keys())p(e,t,r).t.add(n);h={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(n,h),wD(n)&&ame(n)&&a.add(()=>{let r=!0,i=(...i)=>{try{return f(e,t,n,i)}finally{r||(u(e,t),l(e,t))}};try{let a=s(e,t,n,i);a&&(h.u=()=>{r=!0;try{a()}finally{r=!1}})}finally{r=!1}}),(r=o.m)==null||r.call(o,n)}return h},bme=(e,t,n)=>{var r;let i=e[1],a=e[5],o=e[6],s=e[11],c=e[19],l=s(e,t,n),u=i.get(n);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(n)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(n);for(let r of l.d.keys())c(e,t,r)?.t.delete(n);(r=o.u)==null||r.call(o,n);return}return u},xme=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(DD(r))for(let a of o.d.keys())OD(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,DD(c)&&a(e,t,c))},Sme=(e,t,n)=>{let r=e[14];return ED(r(e,t,n))},Cme=(e,t,n,...r)=>{let i=e[3],a=e[12],o=e[13],s=e[16],c=i.size;try{return s(e,t,n,r)}finally{i.size!==c&&(o(e,t),a(e,t))}},wme=(e,t,n,r)=>{let i=e[12],a=e[13],o=e[18],s=e[19],c=o(e,t,n).l;return c.add(r),a(e,t),i(e,t),()=>{c.delete(r),s(e,t,n),a(e,t),i(e,t)}},Tme=(e,t,n,r)=>{let i=e[25],a=i.get(n);if(!a){a=new Set,i.set(n,a);let e=()=>i.delete(n);n.then(e,e)}a.add(r)},Eme=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},Dme=new WeakMap;function Ome(...e){let t={get(e){return r(n,t,e)},set(e,...r){return i(n,t,e,...r)},sub(e,r){return a(n,t,e,r)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},cme,lme,ume,dme,fme,pme,mme,hme,gme,_me,vme,yme,bme,xme,Sme,Cme,wme,void 0,new WeakMap,Tme,Eme,[0]].map((t,n)=>e[n]||t);Dme.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var kme=0;function Ame(e,t){let n=`atom${++kme}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=jme,r.write=Mme),t&&(r.write=t),r}function jme(e){return e(this)}function Mme(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}function Nme(){return Ome()}var AD=Ame({frames:new Map,order:[],tiles:[],minima:new Map,participating:new Set,mainSize:void 0,zoomed:null,gesture:null,restore:new Map}),jD=(e,t,n)=>Math.min(Math.max(e,t),n),MD=(e,t,n)=>{let r=jD(e.width,n.width,Math.max(n.width,t.width)),i=jD(e.height,n.height,Math.max(n.height,t.height));return{width:r,height:i,x:jD(e.x,0,Math.max(0,t.width-r)),y:jD(e.y,0,Math.max(0,t.height-i))}},ND=(e,t,n)=>{let r=t.width/2,i=t.height/2;return MD(e===`left`?{x:0,y:0,width:r,height:t.height}:e===`right`?{x:r,y:0,width:r,height:t.height}:e===`top-left`?{x:0,y:0,width:r,height:i}:e===`top-right`?{x:r,y:0,width:r,height:i}:e===`bottom-left`?{x:0,y:i,width:r,height:i}:{x:r,y:i,width:r,height:i},t,n)},Pme=()=>{let e=Nme(),t=()=>e.get(AD),n=0,r=r=>{n+=1,e.set(AD,r(t()))},i=(e,t,n)=>{r(r=>{let i=new Map(r.frames);return i.set(e,t),{...r,frames:i,participating:new Set(r.participating).add(e),tiles:r.tiles.includes(e)?r.tiles:[...r.tiles,e],minima:new Map(r.minima).set(e,n),order:r.order.includes(e)?r.order:[...r.order.filter(e=>e!==r.zoomed),e,...r.zoomed?[r.zoomed]:[]]}})},a=e=>t().frames.has(e),o=(e,n)=>{let r=t().gesture;return r?.kind===`frame`&&r.id===e&&r.pointerId===n};return{get version(){return n},get frames(){return t().frames},get order(){return t().order},get tiles(){return t().tiles},get minima(){return t().minima},get participating(){return t().participating},get mainSize(){return t().mainSize},get zoomed(){return t().zoomed},get gesture(){return t().gesture},get restore(){return t().restore},subscribe:t=>e.sub(AD,t),register:i,setParticipation:(e,n)=>{t().frames.has(e)&&r(t=>{if(t.participating.has(e)===n)return t;let r=new Set(t.participating);n?r.add(e):r.delete(e);let i=n?t.tiles.includes(e)?t.tiles:[...t.tiles,e]:t.tiles.filter(t=>t!==e),a=n?t.order.includes(e)?t.order:[...t.order,e]:t.order.filter(t=>t!==e);return{...t,participating:r,tiles:i,order:a,zoomed:n||t.zoomed!==e?t.zoomed:null,gesture:!n&&t.gesture?.kind===`frame`&&t.gesture.id===e?null:t.gesture}})},setMinima:(e,n)=>{let i=t().minima.get(e);!i||i.width===n.width&&i.height===n.height||r(t=>({...t,minima:new Map(t.minima).set(e,n)}))},unregister:e=>{r(t=>{if(!t.frames.has(e))return t;let n=new Map(t.frames);n.delete(e);let r=new Map(t.restore);r.delete(e);let i=t.order.filter(t=>t!==e),a=t.tiles.filter(t=>t!==e),o=new Map(t.minima);o.delete(e);let s=new Set(t.participating);s.delete(e);let c=t.gesture?.kind===`frame`&&t.gesture.id===e?null:t.gesture;return{...t,frames:n,restore:r,order:i,tiles:a,minima:o,participating:s,gesture:c,zoomed:t.zoomed===e?null:t.zoomed}})},begin:(e,n)=>{!a(e)||!t().participating.has(e)||r(t=>({...t,gesture:{kind:`frame`,id:e,pointerId:n,start:t.frames.get(e)??{x:0,y:0,width:0,height:0}},order:[...t.order.filter(t=>t!==e),e]}))},move:(e,n,i,s,c,l=null)=>{a(e)&&t().participating.has(e)&&o(e,n)&&r(t=>({...t,frames:new Map(t.frames).set(e,MD(i,s,c)),gesture:t.gesture?.kind===`frame`?{...t.gesture,snap:l?{side:l,frame:ND(l,s,c)}:null}:t.gesture}))},end:(e,t)=>{o(e,t)&&r(t=>{let n=t.gesture;return n?.kind!==`frame`||!n.snap?{...t,gesture:null}:{...t,frames:new Map(t.frames).set(e,n.snap.frame),restore:new Map(t.restore).set(e,t.restore.get(e)??n.start),gesture:null}})},cancel:(e,n)=>{let i=t().gesture;i?.kind===`frame`&&i.id===e&&i.pointerId===n&&r(t=>{let n=new Map(t.frames);return n.set(e,i.start),{...t,frames:n,gesture:null}})},snap:(e,n,i,o)=>{!a(e)||!t().participating.has(e)||r(t=>{let r=new Map(t.restore);r.set(e,t.frames.get(e)??ND(n,i,o));let a=new Map(t.frames);return a.set(e,ND(n,i,o)),{...t,frames:a,restore:r,order:[...t.order.filter(t=>t!==e),e]}})},restoreFrame:(e,n,i)=>{!a(e)||!t().participating.has(e)||r(t=>{let r=t.restore.get(e);if(!r)return t;let a=new Map(t.frames);a.set(e,MD(r,n,i));let o=new Map(t.restore);return o.delete(e),{...t,frames:a,restore:o}})},focus:e=>{a(e)&&r(t=>({...t,order:[...t.order.filter(t=>t!==e),e],zoomed:t.zoomed===null?null:e}))},swap:(e,n)=>{!a(e)||!a(n)||!t().participating.has(e)||!t().participating.has(n)||r(t=>({...t,tiles:t.tiles.map(t=>t===e?n:t===n?e:t)}))},zoom:e=>{e!==null&&(!a(e)||!t().participating.has(e))||r(t=>({...t,zoomed:e,order:e===null?t.order:[...t.order.filter(t=>t!==e),e]}))},resizeMain:e=>{r(t=>({...t,mainSize:e}))},beginDivider:e=>!t().gesture&&(r(t=>({...t,gesture:{kind:`divider`,pointerId:e,start:t.mainSize}})),!0),finishDivider:(e,n)=>{let i=t().gesture;i?.kind===`divider`&&i.pointerId===e&&r(e=>({...e,gesture:null,mainSize:n?i.start:e.mainSize}))},destroy:()=>{r(e=>({...e,gesture:null,restore:new Map}))}}};function Fme(e,t,n,r,i){let a=i.layout??`main-left`;if(a===`columns`||a===`rows`||a===`grid`)return Ime(e,t,n,r,i,a);if(a===`main-top`){let a=PD(e,new Map([...t].map(([e,t])=>[e,{width:t.height,height:t.width}])),n,{width:r.height,height:r.width},i);return{frames:new Map([...a.frames].map(([e,t])=>[e,{x:t.y,y:t.x,width:t.height,height:t.width}])),tabGroups:a.tabGroups,divider:a.divider&&{...a.divider,axis:`y`}}}return PD(e,t,n,r,i)}function Ime(e,t,n,r,i,a){let o=new Map,s=[];if(!e.length)return{frames:o,tabGroups:s,divider:null};let c=Math.max(0,i.gap??8),l=e.reduce((e,n)=>({width:Math.max(e.width,t.get(n)?.width??0),height:Math.max(e.height,t.get(n)?.height??0)}),{width:0,height:0}),u=(t,n)=>n+c===0?e.length:Math.min(e.length,Math.max(1,Math.floor((t+c)/(n+c)))),d=u(r.width,l.width),f=u(r.height,l.height),p=l.width>r.width||l.height>r.height?1:a===`columns`?d:a===`rows`?f:Math.min(e.length,d*f),m=a===`columns`?p:a===`rows`?1:Math.min(d,Math.max(Math.ceil(Math.sqrt(p)),Math.ceil(p/f))),h=Math.ceil(p/m),g=(r.width-c*(m-1))/m,_=(r.height-c*(h-1))/h;for(let t=0;t<p;t++){let r=e.slice(t,t===p-1?void 0:t+1),i=r.length===1?r[0]:[...n].reverse().find(e=>r.includes(e))??r[0];i&&o.set(i,{x:t%m*(g+c),y:Math.floor(t/m)*(_+c),width:g,height:_}),r.length>1&&s.push(r)}return{frames:o,tabGroups:s,divider:null}}function PD(e,t,n,r,i){let a=new Map,o=[],s={x:0,y:0,...r},[c,...l]=e,u=(e,t)=>{let r=[...n].reverse().find(t=>e.includes(t))??e[0];r&&a.set(r,t),e.length>1&&o.push(e)};if(!c)return{frames:a,tabGroups:o,divider:null};if(!l.length)return a.set(c,s),{frames:a,tabGroups:o,divider:null};let d=Math.max(0,i.gap??8),f=t.get(c)?.width??0,p=Math.max(...l.map(e=>t.get(e)?.width??0)),m=r.width-d-p;if(f>m)return u([...e],s),{frames:a,tabGroups:o,divider:null};let h=Math.min(m,Math.max(f,i.mainSize??r.width/2)),g={axis:`x`,position:h,min:f,max:m};a.set(c,{...s,width:h});let _={...s,x:h+d,width:r.width-h-d},v=l.map(e=>t.get(e)?.height??0).reduce((e,t)=>e+t,0)+d*(l.length-1);if(v>r.height)u(l,_);else{let e=(r.height-v)/l.length,n=0;for(let r of l){let i=(t.get(r)?.height??0)+e;a.set(r,{..._,y:n,height:i}),n+=i+d}}return{frames:a,tabGroups:o,divider:g}}function FD(e,t=!0,n){let r=(0,I.useRef)(e);r.current=e;let i=(0,I.useRef)(null);return(0,I.useEffect)(()=>(t||i.current?.release(!0),()=>i.current?.release(!0)),[t]),(0,I.useEffect)(()=>{let e=()=>{i.current?.release(!0)};return n?.addEventListener(`abort`,e),()=>{n?.removeEventListener(`abort`,e)}},[n]),{onPointerDown:e=>{if(!t||n?.aborted||i.current||e.pointerType===`mouse`&&e.button!==0)return;let{currentTarget:a,pointerId:o}=e;if(a.setPointerCapture(o),!r.current.begin(e)){a.releasePointerCapture(o);return}let s=r.current.end,c=()=>{l(!0)},l=e=>{a.removeEventListener(`lostpointercapture`,c),i.current=null,s(e),a.hasPointerCapture(o)&&a.releasePointerCapture(o)};i.current={id:o,element:a,x:e.clientX,y:e.clientY,release:l},a.addEventListener(`lostpointercapture`,c)},onPointerMove:e=>{let t=i.current;t?.id===e.pointerId&&(r.current.move(e.clientX-t.x,e.clientY-t.y,e),t.x=e.clientX,t.y=e.clientY)},onPointerUp:e=>{i.current?.id===e.pointerId&&i.current.release(!1)},onPointerCancel:e=>{i.current?.id===e.pointerId&&i.current.release(!0)}}}function Lme(e,t){return e.x<20?e.y<20?`top-left`:e.y>t.height-20?`bottom-left`:`left`:e.x>t.width-20?e.y<20?`top-right`:e.y>t.height-20?`bottom-right`:`right`:null}var ID=(0,I.createContext)(null);function Rme({bounds:e,tiling:t,containerRef:n,children:r}){let i=(0,I.useMemo)(Pme,[]);(0,I.useSyncExternalStore)(i.subscribe,()=>i.version,()=>i.version),(0,I.useEffect)(()=>()=>{i.destroy()},[i]);let a={...t};i.mainSize!==void 0&&(a.mainSize=i.mainSize);let o=t?Fme(i.tiles,i.minima,i.order,e,a):{frames:new Map([...i.frames].filter(([e])=>i.participating.has(e)).map(([t,n])=>[t,MD(n,e,i.minima.get(t)??{width:0,height:0})])),tabGroups:[],divider:null};return i.zoomed&&i.participating.has(i.zoomed)&&(o.frames=new Map([[i.zoomed,{x:0,y:0,...e}]]),o.divider=null,o.tabGroups=[]),(0,F.jsx)(ID.Provider,{value:{state:i,bounds:e,tiled:t!==void 0,arrangement:o,containerRef:n},children:r})}function LD(){let e=(0,I.useContext)(ID);if(!e)throw Error(`Maosaico hooks must be used within MaosaicoRoot`);return e}function zme(){let{state:e,arrangement:t,tiled:n,bounds:r}=LD(),i=e.tiles,a=(0,I.useRef)({pointer:0,position:0}),o=t.divider,s=FD({begin:t=>!o||!e.beginDivider(t.pointerId)?!1:(a.current={pointer:t.pointerId,position:o.position},!0),move:(t,n)=>{o&&(a.current.position=Math.min(o.max,Math.max(o.min,a.current.position+(o.axis===`x`?t:n))),e.resizeMain(a.current.position))},end:t=>{e.finishDivider(a.current.pointer,t)}},o!==null);return{bounds:r,stackingStyle:{zIndex:e.order.length},mode:n?`tiled`:`floating`,order:i,interacting:e.gesture!==null,snapPreview:!n&&!e.zoomed&&e.gesture?.kind===`frame`?e.gesture.snap??null:null,activeId:e.order.at(-1)??null,zoomedId:e.zoomed,tabGroups:t.tabGroups,divider:o&&{...o,props:s},focus:e.focus,swap:e.swap,zoom:e.zoom,resizeMain:t=>{o&&e.resizeMain(Math.min(o.max,Math.max(o.min,t)))}}}function Bme(e,t={}){let{state:n,bounds:r,tiled:i,arrangement:a,containerRef:o}=LD();(0,I.useLayoutEffect)(()=>(n.register(e.id,e.frame,e.minima),()=>{n.unregister(e.id)}),[n,e.id]),(0,I.useEffect)(()=>{n.setMinima(e.id,e.minima)},[n,e.id,e.minima.width,e.minima.height]);let s=t.participating??!0;(0,I.useLayoutEffect)(()=>{n.setParticipation(e.id,s)},[n,e.id,s]);let c=(0,I.useRef)(0),l=FD({begin:t=>!n.frames.has(e.id)||n.gesture?!1:(c.current=t.pointerId,n.begin(e.id,t.pointerId),!0),move:(i,a,s)=>{let l=o?.current?.getBoundingClientRect(),u=l&&t.kind!==`resize`?Lme({x:s.clientX-l.left,y:s.clientY-l.top},r):null,d=MD(n.frames.get(e.id)??e.frame,r,e.minima);n.move(e.id,c.current,t.kind===`resize`?{...d,width:d.width+i,height:d.height+a}:{...d,x:d.x+i,y:d.y+a},r,e.minima,u)},end:t=>{t?n.cancel(e.id,c.current):n.end(e.id,c.current)}},s&&!i&&!n.zoomed);return{frame:a.frames.get(e.id)??n.frames.get(e.id)??e.frame,stackingStyle:{zIndex:Math.max(0,n.order.indexOf(e.id))},visible:a.frames.has(e.id),active:s&&n.order.at(-1)===e.id,props:l,focus:()=>{s&&n.focus(e.id)},snap:t=>{s&&!i&&n.snap(e.id,t,r,e.minima)},restore:()=>{s&&!i&&n.restoreFrame(e.id,r,e.minima)}}}var Vme=(0,I.createContext)(null);(0,I.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,I.useContext)(Vme),o=a?.update,s=a?.roots.get(`dialog`),[c,l]=(0,I.useState)(!1);(0,I.useEffect)(()=>{if(!s)return;let e=()=>{l(Array.from(s.querySelectorAll(`*`)).some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}))};e();let t=new MutationObserver(e);return t.observe(s,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[s]);let u=(0,I.useRef)(null);(0,I.useImperativeHandle)(i,()=>u.current);let d=(0,I.useCallback)(t=>{u.current=t,o?.(e,t)},[o,e]);return(0,I.createElement)(`div`,{...r,ref:d,onFocusCapture:t=>{e===`windows`&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&a?.dismiss?.(),r.onFocusCapture?.(t)},"data-maosaico-layer":e,inert:e===`windows`&&c?``:void 0,style:{position:`relative`,...t,isolation:`isolate`,zIndex:`var(--stipe-layer-${e})`}},n)});var Hme={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},RD=(0,I.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,F.jsx)(ZE,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Dd(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,F.jsx)(`span`,{"aria-hidden":`true`,className:Dd(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,Hme[n]),children:t})})}),Ume=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`div`,{...t,ref:n,className:Dd(`caps-popover-anchor`,e)})}),Wme=(0,I.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,F.jsx)(`div`,{...r,ref:i,className:Dd(`caps-popover`,e),"data-side":n}):null});(0,I.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,F.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Dd(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function Gme({items:e,openId:t,onOpenChange:n,leading:r,trailing:i,renderTrigger:a,placement:o=`housing`,align:s=`end`,hostInset:c,className:l,...u}){let d=(0,I.useId)(),f=(0,I.useRef)(null),p=(0,I.useRef)(null),m=(0,I.useRef)(new Map),h=e.find(e=>e.id===t&&!e.disabled),g=h?.id,_=()=>{g&&m.current.get(g)?.focus(),n(null)};return(0,I.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,I.useEffect)(()=>{c===void 0?f.current?.style.removeProperty(`--caps-status-tray-host-inset`):f.current?.style.setProperty(`--caps-status-tray-host-inset`,`${String(Math.max(0,c))}px`)},[c]),(0,I.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),m.current.get(g)?.focus(),n(null))},t=e=>{!(e.target instanceof Node)||f.current?.contains(e.target)||f.current?.querySelector(`[aria-haspopup="menu"][aria-expanded="true"]`)||n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t,!0)}},[g,n]),(0,F.jsxs)(Ume,{...u,ref:f,className:Dd(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,F.jsxs)(Wme,{open:!0,ref:p,tabIndex:-1,side:`top`,id:`${d}-${h.id}`,role:`dialog`,"aria-labelledby":`${d}-title`,className:`caps-status-tray-panel`,"data-status-tray-panel":h.id,children:[(0,F.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,F.jsx)(vm,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,F.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,F.jsx)(RD,{"aria-label":`Close tray`,icon:(0,F.jsx)(dr,{"aria-hidden":`true`}),onClick:_})]}),(0,F.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,F.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,F.jsx)(`div`,{className:`caps-status-tray-chips`,children:e.map(e=>{let r={ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},type:`button`,className:a?void 0:`caps-status-tray-chip`,"aria-expanded":g===e.id,"aria-controls":g===e.id?`${d}-${e.id}`:void 0,"aria-label":e.accessibleLabel,disabled:e.disabled,title:e.disabled?e.accessibleLabel:void 0,"aria-haspopup":`dialog`,"data-status-tray-chip":e.id,onClick:()=>{n(t===e.id?null:e.id)},children:(0,F.jsxs)(F.Fragment,{children:[e.tone?(0,F.jsx)(vm,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,F.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,F.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,F.jsxs)(I.Fragment,{children:[a?a(r):(0,F.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function Kme({children:e,className:t,...n}){return(0,F.jsx)(`div`,{...n,className:Dd(`caps-status-tray-list`,t),children:e})}function zD({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,F.jsxs)(`div`,{...a,className:Dd(`caps-status-tray-item`,i),children:[e?(0,F.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,F.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,F.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,F.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,F.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function BD({children:e=`All caught up.`,title:t}){return(0,F.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,F.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,F.jsx)(`p`,{children:e})]})}function qme({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function VD(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var HD=[],UD=0,{link:WD,unlink:Jme,propagate:Yme,checkDirty:GD,shallowPropagate:KD}=qme({update(e){return e._update()},notify(e){HD[JD++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,QD(e))}}),qD=0,JD=0,YD,XD=0;function ZD(e){try{++XD,e()}finally{--XD||$D()}}function QD(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Jme(n,e)}function $D(){if(!(XD>0)){for(;qD<JD;){let e=HD[qD];HD[qD++]=void 0,e.notify()}qD=0,JD=0}}function eO(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return YD!==void 0&&WD(i,YD,UD),i._snapshot},subscribe(e){let t=VD(e),n={current:!1},r=Xme(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=YD,o=t?.compare??Object.is;if(n)YD=i,++UD,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{YD=a,n&&(i.flags&=-5),QD(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&GD(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&KD(e)}}else e&32&&(i.flags=e&-33);return YD!==void 0&&WD(i,YD,UD),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Yme(e),KD(e),$D())}},i}function Xme(e){let t=()=>{let t=YD;YD=n,++UD,n.depsTail=void 0,n.flags=6;try{return e()}finally{YD=t,n.flags&=-5,QD(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&GD(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,QD(this)}};return t(),n}var tO=class{constructor(e,t){this.atom=eO(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(VD(e))}},Zme=class{constructor(e){this.atom=eO(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(VD(e))}};function nO(e,t){return typeof e==`function`?new Zme(e):t?new tO(e,t):new tO(e)}var Qme=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function $me(e,t){return new Qme(e,t).maybeExecute}var ehe=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},rO=new class extends ehe{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function iO(e,t){return typeof e==`function`?e(t):e}function aO(e,t){return dO(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function oO(e,t,n){let r=dO(t);function i(e){if(!r.length)return iO(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function the(e,t){let n=dO(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var sO=46,cO=91,lO=93,uO=48,nhe=57;function dO(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===cO),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===sO||s===cO||s===lO){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==uO),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==lO&&(a!==-1||s!==lO)&&(a!==s||s!==sO&&s!==cO)&&n.push(``);r=o+1,i=!0}else(s<uO||s>nhe)&&(i=!1);a=s}return n.length||n.push(``),n}function rhe(e){return!(Array.isArray(e)&&e.length===0)}function fO(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function pO(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var mO=e=>!!e&&typeof e==`object`&&`fields`in e;function hO(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!hO(e[i],t[i]))return!1;return!0}var gO=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},_O=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function vO(e,t){return e==null?t:{...e,...t}}for(var yO=256,bO=[],xO;yO--;)bO[yO]=(yO+256).toString(16).substring(1);function SO(){let e=0,t,n=``;if(!xO||yO+16>256){for(xO=Array(256),e=256;e--;)xO[e]=256*Math.random()|0;e=0,yO=0}for(;e<16;e++)t=xO[yO+e],n+=e===6?bO[t&15|64]:e===8?bO[t&63|128]:bO[t],e&1&&e>1&&e<11&&(n+=`-`);return yO++,n}var ihe=$me(e=>rO.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function CO(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=CO(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,CO(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(CO(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=CO(e[n]));return t}function wO(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var TO=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function ahe(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var EO=(e,t)=>{let n=ahe(e,t);return{form:n,fields:n}},DO={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:EO(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:EO(r.issues,e)}},OO=e=>!!e&&`~standard`in e,kO={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function AO(e){function t(t){let n=e.getFieldMeta(t)??kO;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>kO;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function jO(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var MO=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{ihe(this)}),t=rO.on(`request-form-state`,e=>{e.payload.id===this._formId&&rO.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=rO.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=rO.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),rO.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return rO.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!hO(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!hO(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(ZD(()=>{this.baseStore.setState(()=>jO(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=AO(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}rO.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=oO(t,e.instance.name,e.instance.options.defaultValue))}),jO({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return ZD(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return ZD(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=fO(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||TO}),r=!1,i={};return ZD(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=NO(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=PO(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??kO,r=a?.[e],{newErrorValue:s,newSource:c}=gO({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=kO)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=PO(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=PO(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=pO(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||TO});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=PO(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=NO(r);s&&(i=i?{...i,...s}:s);let c=PO(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??kO,r=i?.[e],{newErrorValue:a,newSource:o}=gO({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=kO)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),ZD(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}ZD(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),ZD(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>aO(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:iO(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=kO,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;ZD(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:oO(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=the(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),AO(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],vO(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),AO(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),vO(r,{dontValidate:!0})),AO(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),vO(n,{dontValidate:!0})),AO(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return oO(oO(e,`${t}`,i),`${n}`,r)},vO(r,{dontValidate:!0})),AO(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},vO(r,{dontValidate:!0})),AO(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],vO(t,{dontValidate:!0})),AO(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=aO(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:kO},values:i===void 0?t.values:oO(t.values,e,i)}})},this.setErrorMap=e=>{ZD(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(mO(t)){let{formError:e,fieldErrors:r}=NO(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>DO.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>DO.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??SO(),this._devtoolsSubmissionOverride=!1;let t=jO({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!mO(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=nO(t);let n;this.fieldMetaDerived=nO(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=aO(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!rhe(u),f=!o.isDirty,p=hO(l,this.getFieldInfo(a)?.instance?.options.defaultValue??aO(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=nO(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!wO(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&wO(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=nO(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&mO(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&hO(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return OO(e.validate)?DO[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function NO(e){return e?mO(e)?{formError:NO(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function PO(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var FO=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...kO,isTouched:e.fieldMetaBase[this.name]?.isTouched??kO.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??kO.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??kO.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(hO(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,vO(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,vO(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,vO(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,vO(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=fO(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||TO}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=fO(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;ZD(()=>{let e=(e,n)=>{let r=LO(n.cause),a=n.validate?IO(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=_O({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=LO(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=pO(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||TO}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=pO(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));ZD(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=LO(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=IO(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=_O({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),ZD(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>wO(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[LO(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[LO(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>DO.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>DO.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)wO(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=nO(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...kO,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!hO(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return OO(e.validate)?DO[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function IO(e){if(e)return e}function LO(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function RO(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function ohe(e){return{...kO,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var zO=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??RO({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(hO(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...kO,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??RO({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;VO(t)&&(n=t.group,r=t.fields);let i=BO(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:RO({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,vO(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof FO&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&wO(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=gO({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=kO)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=fO(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||TO}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=fO(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;ZD(()=>{let t=(t,r)=>{let i=UO(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&VO(s)&&(c=s.group,l=s.fields);let u=BO(c),d=n[i],{newErrorValue:f,newSource:p}=_O({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=UO(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=pO(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||TO}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=pO(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=UO(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&VO(o)&&(l=o.group,u=o.fields);let d=BO(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=_O({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return ZD(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>wO(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[UO(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>wO(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),ZD(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}ZD(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),ZD(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=nO(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??ohe(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!hO(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(OO(e.validate)){let t=DO[e.type](e.value,e.validate);return e.type===`validate`?HO(t):t.then(HO)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function BO(e){if(e)return e}function VO(e){return!!e&&typeof e==`object`&&`fields`in e}function HO(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function UO(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function WO(e,t){if(!t)return;let n=Object.assign({},e,{state:CO(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return ZD(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var GO=o((e=>{var t=un();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),KO=o(((e,t)=>{t.exports=GO()})),qO=o((e=>{var t=un(),n=KO();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),JO=o(((e,t)=>{t.exports=qO()}))();function YO(e,t){return e===t}function XO(e,t=e=>e,n){let r=n?.compare??YO,i=(0,I.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,I.useCallback)(()=>e.get(),[e]);return(0,JO.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var ZO=typeof window<`u`?I.useLayoutEffect:I.useEffect;function QO(e){let[t,n]=(0,I.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,I.useState)(()=>new FO({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new FO({...e}),i(a),n({form:e.form,name:e.name}));let o=XO(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=XO(a.store,e=>e.meta.isTouched),c=XO(a.store,e=>e.meta.isBlurred),l=XO(a.store,e=>e.meta.isDirty),u=XO(a.store,e=>e.meta.errorMap),d=XO(a.store,e=>e.meta.errorSourceMap),f=XO(a.store,e=>e.meta.isValidating),p=(0,I.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return ZO(a.mount,[a]),ZO(()=>{a.update(e)}),p}var $O=(({children:e,...t})=>{let n=QO(t),r=(0,I.useMemo)(()=>iO(e,n),[e,n]);return(0,F.jsx)(F.Fragment,{children:r})});function ek(){return(0,I.useState)(()=>SO())[0]}var tk=I,nk=`18.3.1`.split(`.`)[0]===`17`?ek:tk.useId;function rk(e){let[t,n]=(0,I.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,I.useState)(()=>new zO({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new zO({...e})),n({form:e.form,name:e.name}));let a=XO(r.store,e=>e.value),o=XO(r.store,e=>e.meta.isTouched),s=XO(r.store,e=>e.meta.isBlurred),c=XO(r.store,e=>e.meta.isDirty),l=XO(r.store,e=>e.meta.errorMap),u=XO(r.store,e=>e.meta.errorSourceMap),d=XO(r.store,e=>e.meta.isValidating),f=XO(r.store,e=>e.meta.isSubmitting),p=XO(r.store,e=>e.meta.isSubmitted),m=XO(r.store,e=>e.meta.submissionAttempts),h=XO(r.store,e=>e.meta.isSubmitSuccessful),g=XO(r.store,e=>e.meta.canSubmit),_=XO(r.store,e=>e.meta.isValid),v=XO(r.store,e=>e.meta.isFieldsValid),y=XO(r.store,e=>e.meta.isFieldsValidating),b=XO(r.store,e=>e.meta.isGroupValid),x=(0,I.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return ZO(r.mount,[r]),ZO(()=>{r.update(e)}),x}var ik=(({children:e,...t})=>{let n=rk(t),r=(0,I.useMemo)(()=>iO(e,n),[e,n]);return(0,F.jsx)(F.Fragment,{children:r})});function ak({form:e,selector:t=e=>e,children:n}){let r=XO(e.store,t);return(0,F.jsx)(F.Fragment,{children:iO(n,r)})}function ok(e){let t=nk(),[n,r]=(0,I.useState)(e?.formId),[i,a]=(0,I.useState)(()=>new MO({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new MO({...e,formId:n})),r(n)}let o=(0,I.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,F.jsx)($O,{...e,form:i})},e.FormGroup=function(e){return(0,F.jsx)(ik,{...e,form:i})},e.Subscribe=function(e){return(0,F.jsx)(ak,{form:i,selector:e.selector,children:e.children})},e},[i]);ZO(i.mount,[]),ZO(()=>{i.update(e)});let s=(0,I.useRef)(!1);return ZO(()=>{s.current&&e?.transform&&WO(i,e.transform)},[i,e?.transform]),ZO(()=>{s.current=!0}),o}var sk=xb(jb),ck=xb(R({message:jb}));function lk(e){for(let t of e.errors){let e=Km(Wm(Nne(ck(t),e=>e.message),()=>sk(t)));if(e!==void 0&&e.length>0)return e}}var uk=(0,I.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,F.jsxs)(`label`,{...i,className:Dd(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,F.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),dk=(0,I.forwardRef)(function({children:e,className:t,...n},r){return(0,F.jsx)(`div`,{...n,className:Dd(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:I.Children.map(e,e=>(0,I.isValidElement)(e)?(0,I.cloneElement)(e,{className:Dd(`join-item caps-input-group-control`,e.props.className)}):e)})}),fk=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`div`,{...t,className:Dd(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function pk(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,I.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,I.useRef)(null);(0,I.useImperativeHandle)(a,()=>o.current);let s=Hd(),[c,l]=(0,I.useState)(e),u=(0,I.useRef)(!0);return e&&!c&&l(!0),(0,I.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!Bd(n)){e||l(!1);return}let i=Fd(n),a=`translateY(${String(i.distance)}px)`,c=zd(i,i.ease),d=n.getBoundingClientRect().height,f=pk(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:zd(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,F.jsx)(`div`,{...i,ref:o,className:Dd(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var mk=(0,I.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,F.jsx)(`div`,{...r,ref:i,className:Dd(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,F.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,I.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,I.useRef)(null);(0,I.useImperativeHandle)(a,()=>o.current);let s=Hd(),[c,l]=(0,I.useState)({key:e,content:n}),[u,d]=(0,I.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,I.useRef)(null);return(0,I.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,I.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!Bd(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=Fd(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:zd(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:zd(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:zd(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,F.jsx)(`div`,{...i,ref:o,className:Dd(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,F.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,F.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function hk({children:e,...t}){let[n,r]=(0,I.useState)(e);return e&&e!==n&&r(e),(0,F.jsx)(mk,{...t,className:Dd(`caps-field-error-reveal`,t.className),open:!!e,children:(0,F.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function gk({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,F.jsxs)(`footer`,{...a,className:Dd(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,F.jsx)(hk,{children:n}),(0,F.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,F.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,F.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var _k=(0,I.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,F.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Dd(`caps-form`,n),"data-layout":r,ref:a,children:(0,F.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),vk={2:`h2`,3:`h3`,4:`h4`},yk=(0,I.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,I.useId)(),l=vk[i];return(0,F.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Dd(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,F.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,F.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,F.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,F.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),bk=(0,I.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,layout:a,legend:o,legendTitle:s,...c},l){let u=(0,I.useId)(),d=[n?`${u}-description`:c[`aria-describedby`],r?`${u}-error`:null].filter(Boolean).join(` `)||void 0;return(0,F.jsxs)(`fieldset`,{...c,"aria-describedby":d,"aria-invalid":r?!0:c[`aria-invalid`],className:Dd(`caps-fieldset`,t),"data-layout":a,ref:l,children:[(0,F.jsxs)(`legend`,{className:`caps-fieldset-legend`,title:s,children:[i?(0,F.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}):null,o]}),n?(0,F.jsx)(`p`,{className:`caps-fieldset-description`,id:`${u}-description`,children:n}):null,(0,F.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,F.jsx)(hk,{id:`${u}-error`,children:r})]})});function xk(e){let t=[];return I.Children.forEach(e.props.children,e=>{(0,I.isValidElement)(e)&&e.type!==fk&&t.push(e)}),t[0]??null}var Sk=(0,I.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,I.useId)(),m=(0,I.isValidElement)(e)?e:null,h=m?.type===dk,g=h?xk(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,I.cloneElement)(m,void 0,I.Children.map(m.props.children,e=>e===g?(0,I.cloneElement)(g,w):e)):(0,I.cloneElement)(m,w):e,E=a?(0,F.jsx)(uk,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,F.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,F.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,F.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,F.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,F.jsxs)(`div`,{...d,className:Dd(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,F.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,F.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,F.jsxs)(F.Fragment,{children:[O,T]}),(0,F.jsx)(hk,{id:y,children:r})]})});function Ck(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var wk=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,Tk=6,Ek=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),Dk=(0,I.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,I.useState)(n),[y,b]=(0,I.useState)(null),x=p===void 0?_:p,S=Ck(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,I.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/Tk),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,F.jsxs)(`span`,{className:Dd(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,F.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,F.jsx)(`path`,{className:`caps-number-field-dial-track`,d:wk,pathLength:100}),(0,F.jsx)(`path`,{className:`caps-number-field-dial-level`,d:wk,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,F.jsx)(sr,{"aria-hidden":`true`})}),(0,F.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,F.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=Ek.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,F.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,F.jsx)(cr,{"aria-hidden":`true`})})]})}),Ok={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},kk=(0,I.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,F.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:Dd(`progress caps-gooey-motion caps-gooey-progress w-full`,Ok[t],e),ref:r})});(0,I.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,F.jsxs)(`div`,{...a,ref:o,className:Dd(`caps-game-meter`,i),children:[(0,F.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,F.jsx)(`span`,{children:e}),(0,F.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,F.jsx)(kk,{"aria-label":e,value:t,max:n,tone:r})]})});function Ak({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,F.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,F.jsx)(Nk,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function jk({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,F.jsx)(RD,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,F.jsx)(ur,{}):(0,F.jsx)(dr,{}),onClick:()=>void n(t),type:`button`}):null}function Mk({item:e}){return(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,F.jsx)(`div`,{className:`caps-upload-details`,children:(0,F.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function Nk({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,F.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,F.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,F.jsx)(or,{className:`size-4`})}),(0,F.jsx)(Mk,{item:e}),(0,F.jsx)(Pk,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,F.jsx)(kk,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function Pk({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,F.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,F.jsx)(jk,{action:e.retry,id:t,onAction:i,retry:!0}),(0,F.jsx)(jk,{action:e.cancel,id:t,onAction:n}),(0,F.jsx)(jk,{action:e.remove,id:t,onAction:r})]})}var Fk={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},Ik={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function Lk({state:e}){let t=`caps-checkbox-${(0,I.useId)().replaceAll(`:`,``)}`,n=(0,I.useRef)(null),r=(0,I.useRef)(e).current,i=(0,I.useRef)(e),a=Hd();return(0,I.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=Fd(n.current),c=pm(s,{ease:`inCubic`,duration:160}),l=Qp(n.current,{d:{to:Fk[e],...o?dm:pm(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?dm:t?pm(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...pm(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:Rd(s,120),...fm(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,F.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(tm,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,F.jsx)(nm,{id:`${t}-shadow`}),(0,F.jsx)(rm,{id:`${t}-inset`}),(0,F.jsx)(am,{id:`${t}-goo`,values:Ik}),(0,F.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,F.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,F.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,F.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,F.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,F.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,F.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,F.jsx)(`path`,{ref:n,d:Fk[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,F.jsx)(`clipPath`,{id:`${t}-well`,children:(0,F.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,F.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,F.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,F.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,F.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,F.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,F.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var Rk=(0,I.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,I.useRef)(null),[d,f]=(0,I.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,I.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,I.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,I.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,F.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,F.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Dd(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,F.jsx)(Lk,{state:m}):n]})}),zk=Rfe({keyCode:Bfe(229)});function Bk(e){return e.nativeEvent.isComposing||_i(zk,e.nativeEvent).success}var Vk={};function Hk(e,t){let n=I.useRef(Vk);return n.current===Vk&&(n.current=e(t)),n}var Uk=[],Wk=void 0;function Gk(){return Wk}function Kk(e){Uk.push(e)}function qk(e){let t=(t,n)=>{let r=Hk(Yk).current,i;try{Wk=r;for(let e of Uk)e.before(r);i=e(t,n);for(let e of Uk)e.after(r);r.didInitialize=!0}finally{Wk=void 0}return i};return t.displayName=e.displayName||e.name,t}function Jk(e){return I.forwardRef(qk(e))}function Yk(){return{didInitialize:!1}}function Xk(){}var Zk=Object.freeze([]),Qk=Object.freeze({});function $k(e){I.useEffect(e,Zk)}var eA=0,tA=class e{static create(){return new e}currentId=eA;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=eA,t()},e)}isStarted(){return this.currentId!==eA}clear=()=>{this.currentId!==eA&&(clearTimeout(this.currentId),this.currentId=eA)};disposeEffect=()=>this.clear};function nA(){let e=Hk(tA.create).current;return $k(e.disposeEffect),e}var rA=typeof document<`u`?I.useLayoutEffect:()=>{};function iA(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:she,platform:che,maxTouchPoints:lhe}=iA(),aA=she.toLowerCase(),oA=che.toLowerCase(),sA=/^i(os$|p)/.test(oA)||oA===`macintel`&&lhe>1,cA=`android`,lA=oA===cA||aA.includes(cA),uhe=!sA&&oA.startsWith(`mac`);oA.startsWith(`win`),!lA&&/^(linux|chrome os)/.test(oA);var dhe=uhe||sA,uA=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!uA&&aA.includes(`firefox`),!uA&&aA.includes(`chrom`);var fhe=dhe,phe=/jsdom|happydom/.test(aA);function mhe(e){e.preventDefault(),e.stopPropagation()}function hhe(e){return`nativeEvent`in e}function dA(e){return e.pointerType===``&&e.isTrusted?!0:lA&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function fA(e){return phe?!1:!lA&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(lA||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function pA(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ghe(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function mA(){return typeof window<`u`}function hA(e){return vA(e)?(e.nodeName||``).toLowerCase():`#document`}function gA(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _A(e){return((vA(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function vA(e){return mA()?e instanceof Node||e instanceof gA(e).Node:!1}function yA(e){return mA()?e instanceof Element||e instanceof gA(e).Element:!1}function bA(e){return mA()?e instanceof HTMLElement||e instanceof gA(e).HTMLElement:!1}function xA(e){return!mA()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof gA(e).ShadowRoot}function SA(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=kA(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _he(e){return/^(table|td|th)$/.test(hA(e))}function CA(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var vhe=/transform|translate|scale|rotate|perspective|filter/,yhe=/paint|layout|strict|content/,wA=e=>!!e&&e!==`none`,TA;function EA(e){let t=yA(e)?kA(e):e;return wA(t.transform)||wA(t.translate)||wA(t.scale)||wA(t.rotate)||wA(t.perspective)||!DA()&&(wA(t.backdropFilter)||wA(t.filter))||vhe.test(t.willChange||``)||yhe.test(t.contain||``)}function bhe(e){let t=jA(e);for(;bA(t)&&!OA(t);){if(EA(t))return t;if(CA(t))return null;t=jA(t)}return null}function DA(){return TA??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),TA}function OA(e){return/^(html|body|#document)$/.test(hA(e))}function kA(e){return gA(e).getComputedStyle(e)}function AA(e){return yA(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jA(e){if(hA(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||xA(e)&&e.host||_A(e);return xA(t)?t.host:t}function MA(e){let t=jA(e);return OA(t)?(e.ownerDocument||e).body:bA(t)&&SA(t)?t:MA(t)}function NA(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=MA(e),i=r===e.ownerDocument?.body,a=gA(r);if(i){let e=PA(a);return t.concat(a,a.visualViewport||[],SA(r)?r:[],e&&n?NA(e):[])}return t.concat(r,NA(r,[],n))}function PA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function FA(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function IA(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&xA(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function LA(e,t){let n=e;for(;n;){if(yA(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(xA(n)?n.host:null)}return null}function RA(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var xhe=`data-base-ui-focusable`,She=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,zA=`data-starting-style`,Che=`data-ending-style`,whe={[zA]:``},The={[Che]:``},Ehe={transitionStatus(e){return e===`starting`?whe:e===`ending`?The:null}},Dhe=`data-open`,Ohe=`data-closed`,khe=`data-anchor-hidden`,BA=`data-popup-open`,Ahe=`data-pressed`,jhe={[BA]:``},Mhe={[BA]:``,[Ahe]:``},Nhe={[Dhe]:``},Phe={[Ohe]:``},Fhe={[khe]:``},Ihe={open(e){return e?jhe:null}},Lhe={open(e){return e?Mhe:null}},VA={open(e){return e?Nhe:Phe},anchorHidden(e){return e?Fhe:null}},Rhe={...VA,...Ehe},HA=`data-trigger-disabled`;function UA(e,t){if(!yA(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(HA);for(let[,e]of t.entries())if(IA(e,n))return!e.hasAttribute(HA);return!1}function WA(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function zhe(e){return e.matches(`html,body`)}function GA(e){return bA(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Bhe(e){return LA(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${She}`)!=null}function KA(e){return e?e.getAttribute(`role`)===`combobox`&&GA(e):!1}function qA(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Vhe(e,t){return t!=null&&!pA(t)?0:typeof e==`function`?e():e}function JA(e,t,n){let r=Vhe(e,n);return typeof r==`number`?r:r?.[t]}function YA(e){return typeof e==`function`?e():e}function XA(e,t){return t||e===`click`||e===`mousedown`}function Hhe(e){return e?.includes(`mouse`)&&e!==`mousedown`}function ZA(e,t,n,r){let i=!1,a=!1,o=r??Qk;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Uhe=`none`,QA=`trigger-press`,$A=`trigger-hover`,Whe=`outside-press`,ej=`focus-out`,Ghe=`escape-key`,Khe=`imperative-action`;function tj(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function nj(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function rj(e,t,n,r){let i=Hk(ij).current;return Jhe(i,e,t,n,r)&&aj(i,[e,t,n,r]),i.callback}function qhe(e){let t=Hk(ij).current;return Yhe(t,e)&&aj(t,e),t.callback}function ij(){return{callback:null,cleanup:null,refs:[]}}function Jhe(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Yhe(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function aj(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function oj(e){let t=Hk(Xhe,e).current;return t.next=e,rA(t.effect),t}function Xhe(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var sj={...I},cj=sj.useInsertionEffect,Zhe=cj&&cj!==sj.useLayoutEffect?cj:e=>e();function lj(e){let t=Hk(Qhe).current;return t.next=e,Zhe(t.effect),t.trampoline}function Qhe(){let e={next:void 0,callback:$he,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function $he(){}var uj=null;globalThis.requestAnimationFrame;var dj=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},fj=class e{static create(){return new e}static request(e){return dj.request(e)}static cancel(e){return dj.cancel(e)}currentId=uj;request(e){this.cancel(),this.currentId=dj.request(()=>{this.currentId=uj,e()})}cancel=()=>{this.currentId!==uj&&(dj.cancel(this.currentId),this.currentId=uj)};disposeEffect=()=>this.cancel};function pj(){let e=Hk(fj.create).current;return $k(e.disposeEffect),e}function mj(e){return e?.ownerDocument||document}var hj={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},ege={...hj,position:`fixed`,margin:0,top:0,left:0};({...hj});var gj=I.forwardRef(function(e,t){let[n,r]=I.useState();rA(()=>{fhe&&uA&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,F.jsx)(`span`,{...e,ref:t,style:ege,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),_j=Math.min,vj=Math.max,yj=Math.round,bj=Math.floor,xj=e=>({x:e,y:e}),tge={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Sj(e,t,n){return vj(e,_j(t,n))}function Cj(e,t){return typeof e==`function`?e(t):e}function wj(e){return e.split(`-`)[0]}function Tj(e){return e.split(`-`)[1]}function Ej(e){return e===`x`?`y`:`x`}function Dj(e){return e===`y`?`height`:`width`}function Oj(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function kj(e){return Ej(Oj(e))}function nge(e,t,n){n===void 0&&(n=!1);let r=Tj(e),i=kj(e),a=Dj(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Nj(o)),[o,Nj(o)]}function rge(e){let t=Nj(e);return[Aj(e),t,Aj(t)]}function Aj(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var jj=[`left`,`right`],Mj=[`right`,`left`],ige=[`top`,`bottom`],age=[`bottom`,`top`];function oge(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Mj:jj:t?jj:Mj;case`left`:case`right`:return t?ige:age;default:return[]}}function sge(e,t,n,r){let i=Tj(e),a=oge(wj(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Aj)))),a}function Nj(e){let t=wj(e);return tge[t]+e.slice(t.length)}function cge(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Pj(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cge(e)}function Fj(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function lge(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Ij(e,t=e?kA(e):null){return!e||!e.isConnected||!t||lge(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var uge=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function dge(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return xA(n)?n.host:null}function Lj(e){for(let t of Array.from(e.children))if(hA(t)===`summary`)return t;return null}function fge(e,t){let n=Lj(t);return!!n&&(e===n||IA(n,e))}function Rj(e){let t=e?hA(e):``;return e!=null&&e.matches(uge)&&(t!==`summary`||e.parentElement!=null&&hA(e.parentElement)===`details`&&Lj(e.parentElement)===e)&&(t!==`details`||Lj(e)==null)&&(t!==`input`||e.type!==`hidden`)}function zj(e){if(!Rj(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=dge(t)){let n=t!==e,r=hA(t)===`slot`;if(t.hasAttribute(`inert`)||n&&hA(t)===`details`&&!t.open&&!fge(e,t)||t.hasAttribute(`hidden`)||!r&&!pge(t,n))return!1}return!0}function pge(e,t){let n=kA(e);return t?n.display!==`none`:Ij(e,n)}function Bj(e){let t=e.tabIndex;if(t<0){let t=hA(e);if(t===`details`||t===`audio`||t===`video`||bA(e)&&e.isContentEditable)return 0}return t}function Vj(e){if(hA(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Hj(e,t){let n=Vj(e);if(!n)return!0;let r=t.find(e=>{let t=Vj(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Vj(e);return t?.name===n.name&&t.form===n.form})===n}function Uj(e){if(bA(e)&&hA(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return bA(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Wj(e,t){Uj(e).forEach(e=>{Rj(e)&&t.push(e),Wj(e,t)})}function Gj(e,t,n){Uj(e).forEach(e=>{bA(e)&&e.matches(t)&&n.push(e),Gj(e,t,n)})}function Kj(e){return zj(e)&&Bj(e)>=0}function qj(e){let t=[];return Wj(e,t),t.filter(zj)}function Jj(e){let t=qj(e);return t.filter(e=>Bj(e)>=0&&Hj(e,t))}function Yj(e,t){let n=Jj(e),r=n.length;if(r===0)return;let i=FA(mj(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Xj(e){return Yj(mj(e).body,1)||e}function Zj(e){return Yj(mj(e).body,-1)||e}function mge(e,t,n){if(!e)return null;let r=[];Wj(mj(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(zj);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!IA(n,o)&&Kj(o)&&Hj(o,a))return o}return r[i]}function Qj(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!IA(n,r)}function hge(e){Jj(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function $j(e){let t=[];Gj(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function eM(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...eM(e,t.id,n)])}function tM(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function nM(e){return`data-base-ui-${e}`}var rM=0;function iM(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(rM);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Xk;let o=requestAnimationFrame(a);return rM=o,()=>{rM===o&&(cancelAnimationFrame(o),rM=0)}}var aM=`data-base-ui-inert`,oM=new WeakMap,sM=new WeakSet,cM=new WeakMap,lM=0;function uM(e){return e?xA(e)?e.host:uM(e.parentNode):null}var dM=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=uM(t);return e.contains(n)?n:null}).filter(e=>e!=null),fM=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},pM=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{hA(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function gge(e,t,n,{mark:r=!0}){let i=dM(t,e),a=r?pM(t,fM(i),new Set(i)):[],o=[],s=[];if(n){let e=dM(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);pM(t,fM(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(oM.get(e)||0)+1;oM.set(e,r),o.push(e),r===1&&n&&sM.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(cM.get(e)||0)+1;cM.set(e,t),s.push(e),t===1&&e.setAttribute(aM,``)}),lM+=1,()=>{o.forEach(e=>{let t=(oM.get(e)||0)-1;oM.set(e,t),t||(sM.has(e)||e.removeAttribute(`aria-hidden`),sM.delete(e))}),r&&s.forEach(e=>{let t=(cM.get(e)||0)-1;cM.set(e,t),t||e.removeAttribute(aM)}),--lM,lM||(oM=new WeakMap,sM=new WeakSet,cM=new WeakMap)}}function mM(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=mj(e[0]).body;return gge(e,i,n,{mark:r})}function hM(){let[,e]=I.useState({});return I.useCallback(()=>{e({})},[])}var gM=0;function _ge(e,t=`mui`){let n=I.useRef(void 0),r=hM(),i=e??n.current;return I.useEffect(()=>{n.current??(gM+=1,n.current=`${t}-${gM}`,e??r())},[e,t,r]),i}var _M=sj.useId;function vM(e,t){if(_M!==void 0){let n=_M();return e??(t?`${t}-${n}`:n)}return _ge(e,t)}var vge=18;function yM(e){return vge>=e}function bM(e){if(!I.isValidElement(e))return null;let t=e,n=t.props;return(yM(19)?n?.ref:t.ref)??null}function xM(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function yge(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function bge(e,t){return typeof e==`function`?e(t):e}function xge(e,t){return typeof e==`function`?e(t):e}var SM={};function CM(e,t,n,r,i){if(!n&&!r&&!i&&!e)return wM(t);let a=wM(e);return t&&(a=TM(a,t)),n&&(a=TM(a,n)),r&&(a=TM(a,r)),i&&(a=TM(a,i)),a}function Sge(e){if(e.length===0)return SM;if(e.length===1)return wM(e[0]);let t=wM(e[0]);for(let n=1;n<e.length;n+=1)t=TM(t,e[n]);return t}function wM(e){return DM(e)?{...e(SM)}:Cge(e)}function TM(e,t){return DM(t)?t(e):wge(e,t)}function Cge(e){let t={...e};for(let e in t){let n=t[e];EM(e,n)&&(t[e]=OM(n))}return t}function wge(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=xM(e.style,r);break;case`className`:e[n]=AM(e.className,r);break;default:e[n]=EM(n,r)?Tge(e[n],r):r}}return e}function EM(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function DM(e){return typeof e==`function`}function Tge(e,t){return t?e?(...n)=>{let r=n[0];if(jM(r)){let i=r;kM(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:OM(t):e}function OM(e){return e&&((...t)=>{let n=t[0];return jM(n)&&kM(n),e(...t)})}function kM(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function AM(e,t){return t?e?t+` `+e:t:e}function jM(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function MM(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=kge(r));let i=Ege(t,n,r);if(n.enabled===!1)return null;let a=n.state??Qk;return Age(e,r,i,a)}function Ege(e,t,n){let{className:r,style:i}=e,{state:a=Qk,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?bge(r,a):void 0,d=l?xge(i,a):void 0,f=l?yge(a,c):Qk,p=l&&s?Dge(s):void 0,m=l?xM(f,p)??{}:Qk;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?qhe([m.ref,bM(n),...o]):rj(m.ref,bM(n),o):rj(null,null)),l?(u!==void 0&&(m.className=AM(m.className,u)),d!==void 0&&(m.style=xM(m.style,d)),m):Qk}function Dge(e){return Array.isArray(e)?Sge(e):CM(void 0,e)}var Oge=Symbol.for(`react.lazy`);function kge(e){if(e?.$$typeof!==Oge)return e;let t=I.Children.toArray(e)[0];return I.isValidElement(t)?t:e}function Age(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=CM(n,t.props);return e.ref=n.ref,I.cloneElement(t,e)}return jge(e,n)}function jge(e,t){return e===`button`?(0,I.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,I.createElement)(`img`,{alt:``,...t,key:t.key}):I.createElement(e,t)}var Mge={style:{transition:`none`}},Nge=`data-base-ui-click-trigger`,Pge={fallbackAxisSide:`end`},Fge={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},NM=I.createContext(null),PM=()=>I.useContext(NM),Ige=nM(`portal`);function Lge(e={}){let{ref:t,container:n,componentProps:r=Qk,elementProps:i}=e,a=vM(),o=PM()?.portalNode,[s,c]=I.useState(null),[l,u]=I.useState(null),d=lj(e=>{e!==null&&u(e)}),f=I.useRef(null);rA(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(vA(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=MM(`div`,r,{ref:[t,d],props:[{id:a,[Ige]:``},i]}),m=s&&p?gn.createPortal(p,s):null;return{node:l,nodeId:I.isValidElement(p)?p.props.id:void 0,subtree:m}}var Rge=I.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=Lge({container:o,ref:t,componentProps:e,elementProps:c}),f=I.useRef(null),p=I.useRef(null),m=I.useRef(null),h=I.useRef(null),[g,_]=I.useState(null),v=I.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;I.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Qj(e)&&(e.type===`focusin`?v.current&&=($j(l),!1):(hge(l),v.current=!0))}return nj(tj(l,`focusin`,e,!0),tj(l,`focusout`,e,!0))},[l,y]),rA(()=>{!l||b!==!0||!v.current||($j(l),v.current=!1)},[b,l]);let S=I.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,F.jsxs)(I.Fragment,{children:[d,(0,F.jsxs)(NM.Provider,{value:S,children:[x&&l&&(0,F.jsx)(gj,{"data-type":`outside`,ref:f,onFocus:e=>{Qj(e,l)?m.current?.focus():Zj(g?g.domReference:null)?.focus()}}),x&&l&&(0,F.jsx)(`span`,{role:s,"aria-owns":u,style:Fge}),l&&gn.createPortal(a,l),x&&l&&(0,F.jsx)(gj,{"data-type":`outside`,ref:p,onFocus:e=>{Qj(e,l)?h.current?.focus():(Xj(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,ZA(`focus-out`,e.nativeEvent)))}})]})]})});function FM(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var zge=class{nodesRef={current:[]};events=FM();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},IM=I.createContext(null),LM=I.createContext(null),RM=()=>I.useContext(IM)?.id||null,zM=e=>{let t=I.useContext(LM);return e??t};function Bge(e){let t=vM(),n=zM(e),r=RM();return rA(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Vge(e){let{children:t,id:n}=e,r=RM();return(0,F.jsx)(IM.Provider,{value:I.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Hge(e){let{children:t,externalTree:n}=e,r=Hk(()=>n??new zge).current;return(0,F.jsx)(LM.Provider,{value:r,children:t})}function BM(e){return e==null?e:`current`in e?e.current:e}function Uge(e,t){let n=gA(RA(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(dA(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Wge=20,VM=[];function HM(){VM=VM.filter(e=>e.deref()?.isConnected)}function UM(e){HM(),e&&hA(e)!==`body`&&(VM.push(new WeakRef(e)),VM.length>Wge&&(VM=VM.slice(-20)))}function WM(){return HM(),VM[VM.length-1]?.deref()}function Gge(e){return e?Kj(e)?e:Jj(e)[0]||e:null}function GM(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=qj(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Kj(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Kge(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=lj(()=>b.current.floatingContext?.nodeId),S=i===!1,C=KA(_)&&S,w=oj(i),T=oj(a),E=oj(o),D=oj(u),O=oj(g),k=zM(m),A=PM(),j=I.useRef(!1),M=I.useRef(!1),N=I.useRef(!1),P=I.useRef(null),ee=I.useRef(``),te=I.useRef(``),ne=I.useRef(null),re=I.useRef(null),ie=rj(ne,p,A?.beforeInsideRef),ae=rj(re,A?.afterInsideRef),oe=nA(),se=nA(),ce=pj(),le=A!=null,ue=qA(v),de=lj((e=ue)=>e?Jj(e):[]),fe=lj(()=>h?.().filter(e=>e!=null)??[]);I.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&IA(ue,FA(mj(ue)))&&de().length===0&&!C&&mhe(e)}return tj(mj(ue),`keydown`,e)},[r,ue,c,C,de]),I.useEffect(()=>{if(r||!g)return;let e=mj(ue);function t(){N.current=!1}function n(e){let t=RA(e),n=fe(),r=IA(v,t)||IA(_,t)||IA(A?.portalNode,t)||n.some(e=>e===t||IA(e,t));N.current=!r,te.current=e.pointerType||`keyboard`,LA(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,se.start(0,()=>{M.current=!1}))}function i(){te.current=`keyboard`}return nj(tj(e,`pointerdown`,n,!0),tj(e,`pointerup`,t,!0),tj(e,`pointercancel`,t,!0),tj(e,`keydown`,i,!0),t)},[r,v,_,ue,g,A,se,fe]),I.useEffect(()=>{if(r||!l)return;let e=mj(ue);function n(){M.current=!0,se.start(0,()=>{M.current=!1})}function i(e){let t=RA(e);Kj(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=RA(n);c&&r==null&&a!=null&&IA(v,a)&&UM(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=fe(),p=r?.hasAttribute(nM(`focus-guard`))&&[ne.current,re.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,BM(f),BM(d)].includes(r),m=!(IA(_,r)||IA(v,r)||IA(r,v)||IA(A?.portalNode,r)||u.some(e=>e===r||IA(e,r))||l.hasMatchingElement(e=>IA(e,r))||p||k&&(eM(k.nodesRef.current,o).find(e=>IA(e.context?.elements.floating,r)||IA(e.context?.elements.domReference,r))||tM(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,qA(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&ue&&GM(ue),s&&i!==_&&!Ij(a)&&FA(e)===e.body){if(bA(ue)&&(ue.focus(),s===`popup`)){ce.request(()=>{ue.focus()});return}let e=de(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ue;bA(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==WM())&&(j.current=!0,t.setOpen(!1,ZA(ej,n)))})}function o(){N.current||(b.current.insideReactTree=!0,oe.start(0,()=>{b.current.insideReactTree=!1}))}let u=bA(_)?_:null;if(!(!v&&!u))return nj(u&&tj(u,`focusout`,a),u&&tj(u,`pointerdown`,n),v&&tj(v,`focusin`,i),v&&tj(v,`focusout`,a),v&&A&&tj(v,`focusout`,o,!0))},[r,_,v,ue,c,k,A,t,l,s,de,C,x,b,oe,se,ce,d,f,fe]),I.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${nM(`portal`)}]`)||[]),t=(k?tM(k.nodesRef.current,x()):[]).find(e=>KA(e.context?.elements.domReference||null))?.context?.elements.domReference,n=mM([v,...e,ne.current,re.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...fe(),t,BM(f),BM(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=mM([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,fe]),rA(()=>{if(!g||r||!bA(ue))return;ee.current=``,te.current=``;let e=mj(ue),t=FA(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||IA(ue,t))return;let i=null,a=()=>(i??=de(ue),i[0]||ue),o;o=r===!0||r===null?a():BM(r),o||=a();let s=IA(ue,FA(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&dA(c);iM(o,{sync:l,preventScroll:o===ue,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=FA(e);return!(t!==o&&IA(ue,t))}})})},[r,g,ue,de,w,D,O,b]);let pe=I.useRef(null);rA(()=>{if(r||!ue){pe.current=null;return}pe.current&&=(pe.current.cancelled=!0,null);let e=mj(ue),t=FA(e),n=D.current==null;UM(t);function i(e){if(e.open||(ee.current=Uge(e.nativeEvent,te.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(nM(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(dA(e.nativeEvent)||fA(e.nativeEvent))j.current=!1;else{let e=!1;mj(ue).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&hA(t)!==`body`?t:null,s=n?o||a:a||o;return s||=WM()||null,typeof i==`boolean`?s:BM(i)||s||null}return()=>{y.off(`openchange`,i);let t=FA(e),n=fe(),r=IA(v,t)||n.some(e=>e===t||IA(e,t))||k&&eM(k.nodesRef.current,x(),!1).some(e=>IA(e.context?.elements.floating,t)),o=T.current,s=ee.current,c=a(s),l={cancelled:!1};pe.current=l,queueMicrotask(()=>{pe.current===l&&(pe.current=null);let n=Gge(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&bA(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,ue,T,E,D,y,k,_,x,fe]),rA(()=>{if(!uA||g||!v)return;let e=FA(mj(v));!bA(e)||!GA(e)||IA(v,e)&&e.blur()},[g,v]),rA(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),rA(()=>{if(!(r||!ue))return GM(ue),()=>{queueMicrotask(HM)}},[r,ue]);let me=!r&&(!c||!C)&&(le||c);return(0,F.jsxs)(I.Fragment,{children:[me&&(0,F.jsx)(gj,{"data-type":`inside`,ref:ie,onFocus:e=>{if(c){let e=de();iM(e[e.length-1])}else A?.portalNode&&(j.current=!1,Qj(e,A.portalNode)?Xj(_)?.focus():BM(f??A.beforeOutsideRef)?.focus())}}),n,me&&(0,F.jsx)(gj,{"data-type":`inside`,ref:ae,onFocus:e=>{c?iM(de()[0]):A?.portalNode&&(l&&(j.current=!0),Qj(e,A.portalNode)?Zj(_)?.focus():BM(d??A.afterOutsideRef)?.focus())}})]})}function qge(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=QA}=t,l=e.context.dataRef,u=I.useRef(void 0),d=pj(),f=nA(),p=I.useMemo(()=>{function t(t,n,r,i){let a=ZA(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=pA(e.pointerType,!0)&&fA(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||pA(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=RA(s),p=GA(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}pA(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return I.useMemo(()=>n?{reference:p}:Qk,[n,p])}function Jge(){return!1}function Yge(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Xge(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Jge,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=zM(c),m=lj(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=lj(()=>a),{escapeKey:v,outsidePress:y}=Yge(s),b=I.useRef(!1),x=I.useRef(!1),S=I.useRef(!1),C=I.useRef(!1),w=I.useRef(!1),T=I.useRef(``),E=I.useRef(null),D=nA(),O=nA(),k=nA(),A=lj(()=>{O.clear(),d.current.insideReactTree=!1}),j=lj(e=>{let t=d.current.floatingContext?.nodeId;return(p?eM(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=lj(t=>WA(t,e.select(`floatingElement`))||WA(t,e.select(`domReferenceElement`))),N=lj(t=>{o()&&e.setOpen(!1,ZA(QA,t.nativeEvent))}),P=lj(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=hhe(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=ZA(Ghe,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),ee=lj(()=>{d.current.insideReactTree=!0,O.start(0,A)}),te=lj(t=>{if(!l||!n||t.button!==0)return;let r=RA(t.nativeEvent);IA(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),ne=lj(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});I.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),I.useEffect(()=>A,[A]),I.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new tA,i=mj(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(uA?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&eM(p.nodesRef.current,t).some(t=>WA(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=RA(n),i=`[${nM(`inert`)}]`,a=yA(r)?r.getRootNode():null,o=Array.from((xA(a)?a:mj(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>IA(e,r))))return;let c=yA(r)?r:null;for(;c&&!OA(c);){let e=jA(c);if(OA(e)||!yA(e))break;c=e}if(!(o.length&&yA(r)&&!zhe(r)&&!IA(r,e.select(`floatingElement`))&&o.every(e=>!IA(c,e)))){if(bA(r)&&!(`touches`in n)){let e=OA(r),t=kA(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!dA(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,ZA(Whe,n)),A())}}}function ee(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function te(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function ne(e,t){let n=RA(e);if(!n)return;let r=tj(n,e.type,()=>{t(e),r()})}function re(e){T.current=`touch`,ne(e,te)}function ie(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&ne(e,e=>{e.type===`pointerdown`?ee(e):N(e)})}function ae(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function oe(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function se(e){ne(e,oe)}function ce(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function le(e){ne(e,ce)}let ue=nj(r&&nj(tj(i,`keydown`,P),tj(i,`compositionstart`,a),tj(i,`compositionend`,o)),g&&nj(tj(i,`click`,ie,!0),tj(i,`pointerdown`,ie,!0),tj(i,`pointerup`,ae,!0),tj(i,`pointercancel`,ae,!0),tj(i,`mousedown`,ie,!0),tj(i,`mouseup`,ae,!0),tj(i,`touchstart`,re,{capture:!0,passive:!0}),tj(i,`touchmove`,se,{capture:!0,passive:!0}),tj(i,`touchend`,le,{capture:!0,passive:!0})));return()=>{ue(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let re=I.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ie=I.useMemo(()=>({onKeyDown:P,onPointerDown:ne,onMouseDown:ne,onClickCapture:ee,onMouseDownCapture(e){ee(),te(e)},onPointerDownCapture(e){ee(),te(e)},onMouseUpCapture:ee,onTouchEndCapture:ee,onTouchMoveCapture:ee}),[P,ee,te,ne]);return I.useMemo(()=>n?{reference:re,floating:ie,trigger:re}:{},[n,re,ie])}function Zge(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var KM=Zge(`https://base-ui.com/production-error`,`Base UI`);function Qge(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),rA(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};yA(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function $ge(e,t=!1,n=!1,r=!1){let[i,a]=I.useState(e&&t?`idle`:void 0),[o,s]=I.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),rA(()=>{if(!e&&o&&i!==`ending`&&n){let e=fj.request(()=>{a(`ending`)});return()=>{fj.cancel(e)}}},[e,o,i,n]),rA(()=>{if(!e||t||i===void 0)return;let n=fj.request(()=>{a(void 0)});return()=>{fj.cancel(n)}},[t,e,i]),rA(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=fj.request(()=>{a(`idle`)});return()=>{fj.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function qM(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var JM=null;function e_e(e){if(!JM){let e=[];JM=e,queueMicrotask(()=>{JM=null,gn.flushSync(()=>{for(let t of e)t()})})}JM.push(e)}function YM(e,t=!1,n=!1){let r=pj();return lj((i,a=null)=>{r.cancel();let o=BM(e);if(o==null)return;let s=o,c=()=>{if(!n){gn.flushSync(i);return}e_e(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(qM(s).map(e=>e.finished.then(Xk))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(qM(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=zA;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function XM(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=lj(a),s=YM(r,n,i);I.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function t_e(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=lj(i),{mounted:c,setMounted:l,transitionStatus:u}=$ge(t,!1,!1,o),d=!t&&r;rA(()=>{t&&s(!1)},[t,s]);let f=I.useRef(c),p=I.useRef(!1),m=hM(),h=()=>{f.current=!1,l(!1),a()};rA(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=lj(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return XM({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var n_e={tabIndex:-1,[xhe]:``};function r_e(e){return t=>t!==`touch`||e.current}function i_e(e,t=!1){let n=vM(),r=RM()!=null,i=Hk(()=>e(n,r)).current;return Qge({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function a_e({handle:e,store:t}){return rA(()=>e.attachStore(t),[e,t]),null}function ZM(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function o_e(e,t){let n=I.useRef(null);return lj(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),ZM(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ZM(t))})}function s_e(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function c_e(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function l_e(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=o_e(e,n),o=lj(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=lj(e=>{a(e),e&&o(e)});return rA(()=>(s(t.current),()=>s(null)),[s,t,n,e]),rA(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function u_e(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=I.useRef(null),i=e.useState(`open`);rA(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=ZA(Uhe);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function d_e(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=t_e({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return Hk(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function f_e(e,t){e.useSyncedValues(t),rA(()=>()=>{e.update({activeTriggerProps:Qk,inactiveTriggerProps:Qk,popupProps:Qk})},[e])}function p_e(e,t){rA(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),rA(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var m_e=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},QM=KO(),h_e=yM(19)?__e:v_e;function $M(e,t,n,r,i){return h_e(e,t,n,r,i)}function g_e(e,t,n,r,i){let a=I.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,QM.useSyncExternalStore)(e.subscribe,a,a)}Kk({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,QM.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function __e(e,t,n,r,i){let a=Gk();if(!a)return g_e(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function v_e(e,t,n,r,i){return(0,JO.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var y_e=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return $M(this,e,t,n,r)}},eN=class extends y_e{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){I.useDebugValue(e);let n=this;rA(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;rA(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;rA(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){I.useDebugValue(e);let n=this,r=t!==void 0;rA(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return I.useDebugValue(e),$M(this,this.selectors[e],t,n,r)}useContextCallback(e,t){I.useDebugValue(e);let n=lj(t??Xk);this.context[e]=n}useStateSetter(e){let t=I.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},b_e={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},x_e=class extends eN{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:FM(),nested:n,triggerElements:i},b_e),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ghe(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function S_e(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new x_e({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Qk,inactiveTriggerProps:Qk,popupProps:Qk}}var tN=e=>e.triggerIdProp??e.activeTriggerId,nN=e=>e.openProp??e.open,rN=e=>(e.popupElement?.id??e.floatingId)||void 0;function iN(e,t){return t!==void 0&&nN(e)&&tN(e)===t}function C_e(e,t){return iN(e,t)?!0:t!==void 0&&nN(e)&&tN(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var aN={open:nN,mounted:e=>e.mounted,transitionStatus:e=>nN(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:tN,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:rN,isTriggerActive:(e,t)=>t!==void 0&&tN(e)===t,isOpenedByTrigger:(e,t)=>iN(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&tN(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>C_e(e,t)?rN(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function w_e(e){let t=I.useCallback(t=>e===void 0?Xk:e.subscribeStore(t),[e]),n=I.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,QM.useSyncExternalStore)(t,n,()=>e?.serverStore)}var T_e=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new tA;restTimeout=new tA;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},oN=new WeakMap;function sN(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&oN.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),oN.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function cN(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=oN.get(n);a&&a!==e&&sN(a),sN(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,oN.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function lN(e){let t=e.context.dataRef.current,n=Hk(()=>t.hoverInteractionState??T_e.create()).current;return t.hoverInteractionState||=n,$k(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function E_e(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=zM(),u=RM(),d=lN(e),f=nA(),p=lj(()=>XA(c.current.openEvent?.type,d.interactedInside)),m=lj(()=>Hhe(c.current.openEvent?.type)),h=lj(()=>{sN(d)});rA(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),I.useEffect(()=>h,[h]),rA(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&yA(s)&&o){let e=s,t=o,n=mj(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??LA(e,`[data-rootownerid]`)??n.body;return cN(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),I.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&eM(l.nodesRef.current,u).length>0)}function a(t){let n=JA(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,ZA($A,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=RA(e);if(!Bhe(t)){d.interactedInside=!1;return}d.interactedInside=LA(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(UA(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&yA(o)&&eM(l.nodesRef.current,r,!1).some(e=>IA(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,ZA($A,n)),l.events.emit(`floating.closed`,n)})}let y=o;return nj(y&&tj(y,`mouseenter`,g),y&&tj(y,`mouseleave`,_),y&&tj(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var D_e={current:null};function O_e(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=D_e,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=zM(l),v=lN(e),y=I.useRef(!1),b=oj(i),x=oj(r),S=oj(o),C=oj(n),w=oj(p),T=oj(f),E=lj(()=>XA(h.current.openEvent?.type,v.interactedInside)),D=lj(()=>w.current?.()!==!1),O=lj((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!IA(t,n);if(!yA(r))return!1;let a=r;return i.hasMatchingElement(e=>IA(e,a))&&(!t||!IA(t,a))}),k=lj(()=>{v.handler&&=(mj(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=lj(()=>{sN(v)});return u&&(v.handleCloseOptions=i?.__options),I.useEffect(()=>k,[k]),I.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===$A,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),I.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=JA(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,ZA($A,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,ZA($A,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!yA(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!pA(v.pointerType))return;let n=YA(S.current),r=JA(x.current,`open`,v.pointerType),i=RA(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(yA(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(IA(t,i)){c=t;break}}yA(o)&&yA(s)&&!e.context.triggerElements.hasElement(o)&&IA(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&yA(c)&&yA(s)&&IA(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,ZA($A,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,ZA($A,t,c))}):g&&D()&&e.setOpen(!0,ZA($A,t,c)))}function o(n){if(E()){A();return}k();let r=mj(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!UA(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!IA(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){IA(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?tj(r,`mouseout`,l):void 0;return s?nj(tj(r,`mousemove`,i,{once:!0}),tj(r,`mouseenter`,i),tj(r,`mouseleave`,o),f):nj(tj(r,`mouseenter`,i),tj(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),I.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!pA(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;cN(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=YA(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,ZA($A,n,r))}v.pointerType===`touch`?gn.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var uN=.1,k_e=uN*uN,dN=.5;function fN(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function pN(e,t,n,r,i,a,o,s,c,l){let u=!1;return fN(e,t,n,r,i,a)&&(u=!u),fN(e,t,i,a,o,s)&&(u=!u),fN(e,t,o,s,c,l)&&(u=!u),fN(e,t,c,l,n,r)&&(u=!u),u}function A_e(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function mN(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function j_e(e={}){let{blockPointerEvents:t=!1}=e,n=new tA,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*k_e;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=RA(r),g=r.type===`mouseleave`,_=IA(u,h),v=IA(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&yA(r.relatedTarget)&&IA(u,r.relatedTarget))return;function y(){return!!(s&&eM(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=mN(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=mN(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=mN(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=mN(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!A_e(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?dN/2:dN*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+dN+1,o=C||T?S.bottom-dN:S.top,s=C?T?S.bottom-dN:S.top:S.bottom-dN;M=pN(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?dN/2:dN*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-dN,o=C||T?S.top+dN:S.bottom,s=C?T?S.top+dN:S.bottom:S.top+dN;M=pN(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?dN/2:dN*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+dN+1,o=w||E?S.right-dN:S.left,s=w?E?S.right-dN:S.left:S.right-dN;M=pN(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?dN/2:dN*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-dN,o=w||E?S.left+dN:S.right,s=w?E?S.left+dN:S.right:S.left+dN;M=pN(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function hN(e,t,n){let{reference:r,floating:i}=e,a=Oj(t),o=kj(t),s=Dj(o),c=wj(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Tj(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function M_e(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Cj(t,e),p=Pj(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Fj(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Fj(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var N_e=50,P_e=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:M_e},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hN(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<N_e&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=hN(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},F_e=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Cj(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=wj(r),_=Oj(o),v=wj(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Nj(o)]:rge(o)),x=p!==`none`;!d&&x&&b.push(...sge(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=nge(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Oj(t)||T.every(e=>Oj(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Oj(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},gN=new Set([`left`,`top`]);async function I_e(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=wj(n),s=Tj(n),c=Oj(n)===`y`,l=gN.has(o)?-1:1,u=a&&c?-1:1,d=Cj(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var L_e=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await I_e(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},R_e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Cj(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Oj(i),p=Ej(f),m=u[p],h=u[f],g=(e,t)=>Sj(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},z_e=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Cj(e,t),u={x:n,y:r},d=Oj(i),f=Ej(d),p=u[f],m=u[d],h=Cj(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=gN.has(wj(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},B_e=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Cj(e,t),c=await i.detectOverflow(t,s),l=wj(n),u=Tj(n),d=Oj(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=_j(p-c[m],g),y=_j(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*vj(c.left,c.right):S=p-2*vj(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function _N(e){let t=kA(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=bA(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=yj(n)!==a||yj(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function vN(e){return yA(e)?e:e.contextElement}function yN(e){let t=vN(e);if(!bA(t))return xj(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=_N(t),o=(a?yj(n.width):n.width)/r,s=(a?yj(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var V_e=xj(0);function bN(e){let t=gA(e);return!DA()||!t.visualViewport?V_e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function H_e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===gA(e)}function xN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=vN(e),o=xj(1);t&&(r?yA(r)&&(o=yN(r)):o=yN(e));let s=H_e(a,n,r)?bN(a):xj(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=gA(a),t=yA(r)?gA(r):r,n=e,i=PA(n);for(;i&&t!==n;){let e=yN(i),t=i.getBoundingClientRect(),r=kA(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=gA(i),i=PA(n)}}return Fj({width:u,height:d,x:c,y:l})}function SN(e,t){let n=AA(e).scrollLeft;return t?t.left+n:xN(_A(e)).left+n}function CN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-SN(e,n),y:n.top+t.scrollTop}}function U_e(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=_A(r),s=t?CA(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=xj(1),u=xj(0),d=bA(r);if((d||!a)&&((hA(r)!==`body`||SA(o))&&(c=AA(r)),d)){let e=xN(r);l=yN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?CN(o,c):xj(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function W_e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function G_e(e){let t=AA(e),n=e.ownerDocument.body,r=vj(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=vj(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+SN(e),o=-t.scrollTop;return kA(n).direction===`rtl`&&(a+=vj(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var K_e=25;function q_e(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=gA(e),a=_A(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!DA()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(SN(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=K_e&&(s-=o)}return{width:s,height:c,x:l,y:u}}function J_e(e,t){let n=xN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=yN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function wN(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=q_e(e,n,t);else if(t===`document`)r=G_e(_A(e));else if(yA(t))r=J_e(t,n);else{let n=bN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Fj(r)}function Y_e(e,t){let n=t.get(e);if(n)return n;let r=NA(e,[],!1).filter(e=>yA(e)&&hA(e)!==`body`),i=null,a=kA(e).position===`fixed`,o=a?jA(e):e;for(;yA(o)&&!OA(o);){let e=kA(o),t=EA(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=jA(o)}return t.set(e,r),r}function X_e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?CA(t)?[]:Y_e(t,this._c):[].concat(n),r],o=wN(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=wN(t,a[e],i);s=vj(n.top,s),c=_j(n.right,c),l=_j(n.bottom,l),u=vj(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Z_e(e){let{width:t,height:n}=_N(e);return{width:t,height:n}}function Q_e(e,t,n){let r=bA(t),i=_A(t),a=n===`fixed`,o=xN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=xj(0);if((r||!a)&&((hA(t)!==`body`||SA(i))&&(s=AA(t)),r)){let e=xN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=SN(i));let l=i&&!r&&!a?CN(i,s):xj(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function TN(e){return kA(e).position===`static`}function EN(e,t){if(!bA(e)||kA(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return _A(e)===n&&(n=n.ownerDocument.body),n}function DN(e,t){let n=gA(e);if(CA(e))return n;if(!bA(e)){let t=jA(e);for(;t&&!OA(t);){if(yA(t)&&!TN(t))return t;t=jA(t)}return n}let r=EN(e,t);for(;r&&_he(r)&&TN(r);)r=EN(r,t);return r&&OA(r)&&TN(r)&&!EA(r)?n:r||bhe(e)||n}var $_e=async function(e){let t=this.getOffsetParent||DN,n=this.getDimensions,r=await n(e.floating);return{reference:Q_e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eve(e){return kA(e).direction===`rtl`}var tve={convertOffsetParentRelativeRectToViewportRelativeRect:U_e,getDocumentElement:_A,getClippingRect:X_e,getOffsetParent:DN,getElementRects:$_e,getClientRects:W_e,getDimensions:Z_e,getScale:yN,isElement:yA,isRTL:eve};function ON(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nve(e,t,n){let r=null,i,a=_A(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=bj(d),h=bj(a.clientWidth-(u+f)),g=bj(a.clientHeight-(d+p)),_=bj(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:vj(0,_j(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ON(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=gA(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function kN(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=vN(e),u=i||a?[...l?NA(l):[],...t?NA(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?nve(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?xN(e):null;c&&g();function g(){let t=xN(e);h&&!ON(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var rve=L_e,ive=R_e,ave=F_e,ove=B_e,sve=z_e,cve=(e,t,n)=>{let r=new Map,i=n??{},a={...tve,...i.platform,_c:r};return P_e(e,t,{...i,platform:a})},AN=typeof document<`u`?I.useLayoutEffect:function(){};function jN(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,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!jN(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!jN(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function MN(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function NN(e,t){let n=MN(e);return Math.round(t*n)/n}function PN(e){let t=I.useRef(e);return AN(()=>{t.current=e}),t}function lve(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=I.useState(r);jN(f,r)||p(r);let[m,h]=I.useState(null),[g,_]=I.useState(null),v=I.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=I.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=I.useRef(null),C=I.useRef(null),w=I.useRef(u),T=c!=null,E=PN(c),D=PN(i),O=PN(l),k=I.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),cve(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!jN(w.current,t)&&(w.current=t,gn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);AN(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=I.useRef(!1);AN(()=>(A.current=!0,()=>{A.current=!1}),[]),AN(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=I.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=I.useMemo(()=>({reference:b,floating:x}),[b,x]),N=I.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=NN(M.floating,u.x),r=NN(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...MN(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return I.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var uve=(e,t)=>{let n=rve(e);return{name:n.name,fn:n.fn,options:[e,t]}},dve=(e,t)=>{let n=ive(e);return{name:n.name,fn:n.fn,options:[e,t]}},fve=(e,t)=>({fn:sve(e).fn,options:[e,t]}),pve=(e,t)=>{let n=ave(e);return{name:n.name,fn:n.fn,options:[e,t]}},mve=(e,t)=>{let n=ove(e);return{name:n.name,fn:n.fn,options:[e,t]}},FN=I.createContext(void 0);function IN(e){let t=I.useContext(FN);if(t===void 0&&!e)throw Error(KM(47));return t}var hve={...aN,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!aN.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&aN.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>aN.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},gve=class extends eN{constructor(e,t,n){let r=new m_e;super(_ve(e,r,t,n),vve(r),hve)}setOpen=(e,t)=>{let n=t.reason===$A,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=c_e(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=s_e(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),gn.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function _ve(e,t,n,r=!1){let i={...S_e(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function vve(e){return{popupRef:I.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:I.createRef(),beforeTriggerFocusGuardRef:I.createRef(),beforeContentFocusGuardRef:I.createRef(),stickIfOpenTimeout:new tA,stickIfOpen:!0,triggerElements:e}}var LN=qk(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=bve(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),p_e(u,d),u_e(u);let{forceUnmount:m}=d_e(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),I.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),I.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,ZA(Khe))}),[m,u]);let h=d||f||s!=null;return(0,F.jsxs)(FN.Provider,{value:u,children:[s&&(0,F.jsx)(a_e,{handle:s,store:u}),h&&(0,F.jsx)(xve,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function yve(e){return IN(!0)?(0,F.jsx)(LN,{props:e}):(0,F.jsx)(Hge,{children:(0,F.jsx)(LN,{props:e})})}function bve(e,t){let n=i_e((e,n)=>new gve(t,e,n));return I.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function xve({store:e,modal:t}){let n=Xge(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return f_e(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var Sve=I.createContext(void 0);function Cve(e=!1){let t=I.useContext(Sve);if(t===void 0&&!e)throw Error(KM(16));return t}function wve(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:I.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function RN(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(gA(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Tve(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=I.useRef(null),s=Cve(!0),c=a??s!==void 0,{props:l}=wve({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=I.useCallback(()=>{let e=o.current;zN(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return rA(u,[u]),{getButtonProps:I.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return CM({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(kM(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=zN(r),s=!i&&Eve(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),RN(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),RN(r,e)))},onKeyUp(e){if(!t){if(kM(e),a?.(e),e.target===e.currentTarget&&i&&c&&zN(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),RN(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:lj(e=>{o.current=e,u()})}}function zN(e){return bA(e)&&e.tagName===`BUTTON`}function Eve(e){return bA(e)&&e.tagName===`A`&&!!e.href}function Dve(e){return vM(e,`base-ui`)}function Ove(e,t){function n(n,r,i){let a=n.currentTarget;gn.flushSync(()=>{e.setOpen(!1,ZA(ej,n.nativeEvent,a))}),mge(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&Qj(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function kve(e){let t=I.useRef(``),n=I.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:I.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Ave(e,t){let{onClick:n,onPointerDown:r}=kve(lj((n,r)=>{(typeof e==`function`?e():e)||t(r||(sA?`touch`:``))}));return I.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var jve=Jk(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=IN(!0),h=w_e(s)??m;if(!h)throw Error(KM(74));let g=Dve(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=I.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=l_e(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=O_e(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:j_e(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=qge(v,{stickIfOpen:lj(()=>h.context.stickIfOpen)}),k=Ave(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=Tve({disabled:a,native:o}),N={open(e){return w?Lhe.open(e):Ihe.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:ee}=Ove(h,x),te=MM(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[Nge]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),ne=(0,F.jsx)(I.Fragment,{children:te},g);return E?(0,F.jsxs)(I.Fragment,{children:[(0,F.jsx)(gj,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),ne,(0,F.jsx)(gj,{ref:h.context.triggerFocusTargetRef,onFocus:ee})]}):ne}),BN=I.createContext(void 0);function Mve(){let e=I.useContext(BN);if(e===void 0)throw Error(KM(45));return e}var Nve=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return IN().useState(`mounted`)||n?(0,F.jsx)(BN.Provider,{value:n,children:(0,F.jsx)(Rge,{ref:t,...r})}):null});function Pve(e){return yM(19)?e:e?`true`:void 0}var VN=I.createContext(void 0);function Fve(){let e=I.useContext(VN);if(!e)throw Error(KM(46));return e}function Ive(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=I.useState(null),d=I.useRef(null),f=zM(n),p=I.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=lve({...e,elements:{...p,...l&&{reference:l}}}),h=I.useCallback(e=>{let t=yA(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=I.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=I.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=I.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return rA(()=>{o&&(d.current=o)},[o]),rA(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),I.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var Lve=I.createContext(void 0);function Rve(){return I.useContext(Lve)?.direction??`ltr`}var zve=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Cj(e,t)||{};if(l==null)return{};let d=Pj(u),f={x:n,y:r},p=kj(i),m=Dj(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=Sj(D,k,O),j=!c.arrow&&Tj(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Bve=(e,t)=>{let{name:n,fn:r}=zve(e);return{name:n,fn:r,options:[e,t]}},Vve={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Hve={sideX:`left`,sideY:`top`},Uve=`--available-width`,Wve=`--available-height`,Gve=`--anchor-width`,Kve=`--anchor-height`,qve=`--transform-origin`,HN=Uve,UN=Wve;function WN(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function GN(e,t,n){let{rects:r,placement:i}=e;return{side:WN(t,wj(i),n),align:Tj(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Jve(e){return Yve(e,Ive)}function Yve(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=lj(O),A=O?k:n,j=oj(n),M=oj(g),N=Rve()===`rtl`,[P,ee]=I.useState(null);!g&&P!==null&&ee(null);let te=x===`placement`,ne=P?wj(P):null,re=P&&te?Tj(P)||`center`:null,ie=ne||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],ae=re||o,oe=ae===`center`?ie:`${ie}-${ae}`,se=l;typeof se==`number`?se={top:se,right:se,bottom:se,left:se}:se&&={top:se.top||0,right:se.right||0,bottom:se.bottom||0,left:se.left||0};let ce=+(i===`bottom`),le=+(i===`top`),ue=+(i===`right`),de=+(i===`left`),fe={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:se},pe=I.useRef(null),me=oj(a),he=oj(s),ge=typeof a==`function`?0:a,_e=typeof s==`function`?0:s,ve=[];p&&ve.push(p),ve.push(uve(e=>{let t=GN(e,i,N),n=typeof me.current==`function`?me.current(t):me.current,r=typeof he.current==`function`?he.current(t):he.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ge,_e,N,i]));let ye=w===`none`&&C!==`shift`,be=!ye&&(u||E||C===`shift`),xe=C===`none`?null:pve({...fe,padding:{top:se.top+1+ce,right:se.right+1+de,bottom:se.bottom+1+le,left:se.left+1+ue},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),Se=ye?null:dve({...fe,rootBoundary:D,mainAxis:w!==`none`,crossAxis:be,limiter:u||E?void 0:fve(e=>{if(!pe.current)return{};let{width:t,height:n}=pe.current.getBoundingClientRect(),r=Oj(wj(e.placement)),i=r===`y`?t:n,a=r===`y`?se.left+se.right:se.top+se.bottom;return{offset:i/2+a/2}})},[fe,u,E,D,se,w]);C===`shift`||w===`shift`||ae===`center`?ve.push(Se,xe):ve.push(xe,Se),ve.push(mve({...fe,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(HN,`${t}px`),i.setProperty(UN,`${n}px`);let a=gA(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(Gve,`${u}px`),i.setProperty(Kve,`${d}px`)}}),Bve(e=>({element:pe.current||mj(e.elements.floating).createElement(`div`),padding:pe.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=wj(r),u=Tj(r),d=Oj(l)===`y`,f=pe.current,p=typeof a==`function`?a(GN(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return be&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(qve,d?`${m} ${h}`:`${h} ${m}`),{}}},Vve,b),rA(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let Ce=I.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:we,elements:Te,x:Ee,y:De,middlewareData:Oe,update:ke,placement:Ae,context:je,isPositioned:Me,floatingStyles:Ne}=t({rootContext:h,open:m?g:void 0,placement:oe,middleware:ve,strategy:r,whileElementsMounted:m?void 0:(...e)=>kN(...e,Ce),nodeId:y,externalTree:S}),{sideX:Pe,sideY:Fe}=Oe.adaptiveOrigin||Hve,Ie=Me?r:`fixed`,Le=I.useMemo(()=>{let e;return e=Me?b?{position:Ie,[Pe]:Ee,[Fe]:De}:{...Ne,position:Ie}:{position:Ie,top:0,left:0},e[HN]=`100vw`,e[UN]=`100vh`,Me||(e.opacity=0),e},[b,Ie,Pe,Ee,Fe,De,Ne,Me]),Re=I.useRef(null);rA(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(KN(t)?t.current:t)||null;n!==Re.current&&(we.setPositionReference(n),Re.current=n)},[g,we,A,j]),I.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&KN(e)&&e.current!==Re.current&&(we.setPositionReference(e.current),Re.current=e.current)},[g,we,A,j]),I.useEffect(()=>{if(m&&g&&Te.reference&&Te.floating)return kN(Te.reference,Te.floating,ke,Ce)},[m,g,Te,ke,Ce]);let ze=wj(Ae),Be=WN(i,ze,N),Ve=Tj(Ae)||`center`,He=!!Oe.hide?.referenceHidden;rA(()=>{x&&g&&Me&&(ze!==ie||te&&Ve!==ae)&&ee(Ae)},[x,te,g,Me,Ae,ze,Ve,ie,ae]);let Ue=I.useMemo(()=>({position:`absolute`,top:Oe.arrow?.y,left:Oe.arrow?.x}),[Oe.arrow]),We=Oe.arrow?.centerOffset!==0;return I.useMemo(()=>({positionerStyles:Le,arrowStyles:Ue,arrowRef:pe,arrowUncentered:We,side:Be,align:Ve,physicalSide:ze,anchorHidden:He,refs:we,context:je,isPositioned:Me,update:ke}),[Le,Ue,pe,We,Be,Ve,ze,He,we,je,Me,ke])}function KN(e){return e!=null&&`current`in e}var Xve=I.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,F.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Zve(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=I.useRef(null),o=I.useRef(null),s=YM(r);rA(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),rA(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function qN(e){return e===`starting`?Mge:Qk}function Qve(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),MM(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},qN(r),i],stateAttributesMapping:VA})}var JN={},YN={},XN=``;function ZN(e,t){return SA(e)?e:t}function QN(e,t,n){return/hidden|clip/.test(e.getComputedStyle(ZN(t,n)).overflowY)}function $ve(e){if(typeof document>`u`)return!1;let t=mj(e);return gA(t).innerWidth-t.documentElement.clientWidth>0}function eye(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=mj(e),n=t.documentElement,r=t.body,i=ZN(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function tye(e){let t=mj(e),n=t.documentElement,r=t.body,i=ZN(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function nye(e){let t=mj(e),n=t.documentElement,r=t.body,i=gA(n),a=0,o=0,s=!1,c=fj.create();if(uA&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,JN={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},XN=n.style.scrollBehavior,YN={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=ZN(n,r);if(s=eye(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,JN),Object.assign(r.style,YN),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=XN)}function d(){u(),c.request(l)}l();let f=tj(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var rye=new class{lockCount=0;restore=null;timeoutLock=tA.create();timeoutUnlock=tA.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=mj(e),n=t.documentElement,r=t.body,i=gA(n);if(QN(i,n,r)){let t=new i.MutationObserver(()=>{QN(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=sA||!$ve(e);this.restore=a?tye(e):nye(e)}};function iye(e=!0,t=null){rA(()=>{if(e)return rye.acquire(t)},[e,t])}var aye=20;function oye(e,t,n,r){let[i,a]=I.useState(!1);rA(()=>{if(!e||!t||n==null){a(!1);return}let r=mj(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-aye)},[e,t,n]),iye(e&&(!t||i),r)}var sye=I.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=Pge,..._}=e,v=IN(),y=Mve(),b=Bge(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=Jve({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});Zve({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;oye(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=Qve(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,F.jsxs)(VN.Provider,{value:j,children:[S&&M&&(0,F.jsx)(Xve,{inert:Pve(!C),cutout:T}),(0,F.jsx)(Vge,{id:b,children:P})]})}),cye=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),lye=I.createContext(void 0);function uye(e){let t=I.useContext(lye);if(t===void 0&&!e)throw Error(KM(69));return t}var dye=I.createContext(void 0);function fye(){let[e,t]=I.useState(0),n=lj(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:I.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var pye=I.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=IN(),l=Fve(),u=uye(!0)!=null,{context:d,hasClosePart:f}=fye(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);XM({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),E_e(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?r_e(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=MM(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...n_e,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&cye.has(e.key)&&e.stopPropagation()}},qN(g),s],stateAttributesMapping:Rhe});return(0,F.jsx)(Kge,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:bA(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,F.jsx)(dye.Provider,{value:d,children:M})})}),$N=`data-glide-stand-in`;function eP(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function tP(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function mye(e){let t=(0,I.useRef)(null);return(0,I.useCallback)(n=>{t.current?.(),t.current=n?hye(n,e):null},[e])}function hye(e,t){if(!Bd(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?eP(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute($N);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),a=t,t},u=(t,n)=>{let r=Fd(e),u=eP(e,t),d=o&&a?eP(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute($N,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute($N,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([tP(d),tP(u)],{duration:r.normal,easing:zd(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}var nP=(0,I.forwardRef)(function({className:e,invalid:t,...n},r){return(0,F.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Dd(`input caps-input w-full`,e),ref:r})});(0,I.forwardRef)(function({leading:e,className:t,...n},r){return(0,F.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,F.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,F.jsx)(nP,{...n,type:`search`,className:t,ref:r})]})});function gye({getKey:e,isDisabled:t=()=>!1,items:n,getFallbackKey:r}){let i=(0,I.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[a,o]=(0,I.useState)(null),s=r?.(i)??null,c=a!==null&&i.some(t=>e(t)===a)?a:s!==null&&i.some(t=>e(t)===s)?s:null;(0,I.useEffect)(()=>{a!==null&&!i.some(t=>e(t)===a)&&o(null)},[a,i,e]);let l=i.find(t=>e(t)===c),u=l?i.findIndex(t=>e(t)===c):-1;return{activeIndex:u,activeItem:l,activeKey:c,enabledItems:i,move:(t,n)=>{if(i.length===0)return;let r=n?n===`start`?0:i.length-1:u<0?t>0?0:i.length-1:(u+t+i.length)%i.length,a=i[r];a&&o(e(a))},setActiveKey:o}}var _ye=(0,I.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,F.jsxs)(`button`,{...r,ref:i,type:n,className:Dd(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,F.jsx)(`span`,{children:e}),(0,F.jsx)(nr,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function vye({defaultInputValue:e,defaultOpen:t,defaultValue:n,getKey:r,getSearchText:i,groupBy:a,id:o,isDisabled:s,items:c,onOpenChange:l,onCommit:u,multiple:d,controlledOpen:f,controlledKeys:p,trigger:m}){let h=`${o}-listbox`,[g,_]=(0,I.useState)(e),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(n),[S,C]=(0,I.useState)(t),w=p??(b===null?[]:[b]),T=m?f??S:!0,E=(0,I.useMemo)(()=>{let e=g.trim().toLowerCase();return e?c.filter(t=>i(t).toLowerCase().includes(e)):c},[i,c,g]),D=gye({getKey:r,isDisabled:s,items:E});(0,I.useEffect)(()=>{if(D.activeKey!==null)return;let e=D.enabledItems.find(e=>w.includes(r(e)))??D.enabledItems[0];e&&D.setActiveKey(r(e))},[D.activeKey,D.enabledItems,D.setActiveKey,r,w]);let O=e=>{y(!1),e||_(``),f===void 0&&C(e),l?.(e)},k=e=>`${h}-option-${encodeURIComponent(e)}`,A=e=>{let t=r(e);p===void 0&&x(t),u(e),m&&!d&&O(!1)},j=e=>{y(!0),_(e.target.value),D.setActiveKey(null)},M=e=>{if(Bk(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(y(!0),e.preventDefault(),D.move(t[0],t[1])):e.key===`Enter`&&D.activeItem&&(e.preventDefault(),A(D.activeItem))},N=(0,I.useMemo)(()=>{if(!a)return[{label:``,items:E}];let e=new Map;for(let t of E){let n=a(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[E,a]);return{keyboardNavigation:v,onPointerMove:()=>{y(!1)},activeKey:D.activeKey,activeItem:D.activeItem,groups:N,inputValue:g,listboxId:h,onInputChange:j,onInputKeyDown:M,optionId:k,open:T,commit:A,selectedKeys:w,setOpen:O}}function yye(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultInputValue:l=``,defaultOpen:u=!1,defaultValue:d=null,emptyMessage:f=`No matches`,getKey:p,getLabel:m,getSearchText:h=m,groupBy:g,id:_,inputProps:v,inputRef:y,isDisabled:b=()=>!1,items:x,onOpenChange:S,onValueChange:C,multiple:w,open:T,placeholder:E=`Search…`,renderItem:D,rootRef:O,trigger:k,triggerRef:A,value:j,...M}=e,N=e=>{let t=p(e);if(w){let e=j.includes(t)?j.filter(e=>e!==t):[...j,t];C?.(e,x.filter(t=>e.includes(p(t))))}else C?.(t,e)},P;w?P=j:j!==void 0&&(P=j===null?[]:[j]);let ee=(0,I.useId)(),te=k?.props??v,ne=_??te?.id??ee,re={id:ne,"aria-describedby":[t,te?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??te?.[`aria-invalid`],"aria-label":te?.[`aria-label`]??r,"aria-labelledby":te?.[`aria-labelledby`]??i,"aria-required":a??te?.[`aria-required`]},{keyboardNavigation:ie,onPointerMove:ae,activeItem:oe,activeKey:se,commit:ce,groups:le,inputValue:ue,listboxId:de,onInputChange:fe,onInputKeyDown:pe,open:me,optionId:he,selectedKeys:ge,setOpen:_e}=vye({defaultInputValue:l,defaultOpen:u,defaultValue:d,getKey:p,getSearchText:h,groupBy:g,id:ne,isDisabled:b,items:x,onOpenChange:S,onCommit:N,multiple:w??!1,controlledOpen:T,controlledKeys:P,trigger:k});hne(()=>{k&&_e(!1)});let ve=ym(`popover`),ye=s===void 0?ve:s,be=mye(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),xe=(0,F.jsx)(nP,{...v,...k?{}:re,"aria-activedescendant":oe?he(p(oe)):void 0,"aria-autocomplete":`list`,"aria-controls":de,"aria-expanded":!0,className:Dd(`input-sm`,v?.className),id:k?v?.id??`${ne}-input`:ne,onChange:e=>{v?.onChange?.(e),fe(e)},onKeyDown:e=>{v?.onKeyDown?.(e),e.defaultPrevented||pe(e)},placeholder:v?.placeholder??E,ref:y,role:`combobox`,value:ue}),Se=(0,F.jsx)(`div`,{id:de,ref:be,className:`caps-combobox-list`,"data-navigation":ie?`keyboard`:`pointer`,onPointerMove:ae,role:`listbox`,"aria-multiselectable":w??void 0,children:le.every(e=>e.items.length===0)?(0,F.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:f}):le.map(e=>(0,F.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,F.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=p(e),n=b(e),r=se===t,i={active:r,disabled:n,selected:ge.includes(t)};return(0,F.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&ie,disabled:n,id:he(t),onClick:()=>{ce(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,F.jsx)(tr,{}):null}),D?.(e,r,i)??m(e)]},t)})]},e.label))});return k?(0,F.jsx)(`div`,{...M,className:Dd(M.className),ref:O,children:(0,F.jsxs)(yve,{modal:!0,onOpenChange:_e,open:me,children:[(0,F.jsx)(jve,{...re,"aria-haspopup":`dialog`,className:`btn`,ref:A,render:k}),ye===null?null:(0,F.jsx)(Nve,{container:ye,children:(0,F.jsx)(sye,{align:`start`,side:`bottom`,sideOffset:4,children:(0,F.jsxs)(pye,{"data-active-tone":o,className:Dd(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,F.jsx)(`div`,{className:`caps-combobox-search`,children:xe}),Se]})})})]})}):(0,F.jsx)(`div`,{...M,className:Dd(M.className),ref:O,children:(0,F.jsxs)(`div`,{className:Dd(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,F.jsx)(`div`,{className:`caps-combobox-search`,children:xe}),Se]})})}var bye=(0,I.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,F.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,F.jsx)(Rk,{...a,appearance:r??`default`,"aria-label":e,className:Dd(`caps-icon-choice-input`,i),indicator:(0,F.jsx)(rD,{icon:t,caption:n}),ref:o})})}),xye=(0,I.forwardRef)(function({label:e,icon:t,hint:n,className:r,...i},a){let o=(0,I.useId)(),s=[i[`aria-describedby`],n?o:null].filter(Boolean).join(` `)||void 0;return(0,F.jsx)(`label`,{className:`caps-check-key`,children:(0,F.jsx)(Rk,{...i,"aria-label":e,"aria-describedby":s,className:Dd(`caps-check-key-input`,r),indicator:(0,F.jsxs)(`span`,{className:`caps-check-key-face`,"aria-hidden":`true`,children:[t?(0,F.jsx)(`span`,{className:`caps-check-key-icon`,children:t}):null,(0,F.jsxs)(`span`,{className:`caps-check-key-copy`,children:[(0,F.jsx)(`span`,{className:`caps-check-key-label`,children:e}),n?(0,F.jsx)(`span`,{className:`caps-check-key-hint`,id:o,children:n}):null]}),(0,F.jsx)(`span`,{className:`caps-check-key-lamp`})]}),ref:a})})});function Sye({className:e,...t}){return(0,F.jsx)(`div`,{...t,className:Dd(`caps-check-keys`,e)})}function Cye({checked:e}){let t=`caps-radio-${(0,I.useId)().replaceAll(`:`,``)}`,n=(0,I.useRef)(null),r=(0,I.useRef)(e).current,i=(0,I.useRef)(e),a=(0,I.useRef)(null),o=Ld(a),{reduced:s}=o;return(0,I.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=pm(o,{ease:`outCubic`,duration:75}),c=e?fm(o,{bounce:.65,duration:300}):pm(o,{ease:`inCubic`,duration:100}),l=Qp(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,F.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(tm,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,F.jsx)(nm,{id:`${t}-shadow`}),(0,F.jsx)(rm,{id:`${t}-inset`}),(0,F.jsx)(`clipPath`,{id:`${t}-well`,children:(0,F.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,F.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,F.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,F.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var rP=(0,I.createContext)(null),wye=(0,I.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,I.useId)(),d=(0,I.useRef)(null);(0,I.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,I.useState)(n),h=s??p;return(0,I.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,F.jsx)(rP.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,F.jsx)(`fieldset`,{...c,className:Dd(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),iP=(0,I.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,I.useContext)(rP);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,F.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,F.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:Dd(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,F.jsx)(Cye,{checked:c}):t]})}),Tye=(0,I.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,I.useContext)(rP),s=(0,I.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,F.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,F.jsx)(iP,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,F.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,F.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,F.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,F.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),Eye=(0,I.forwardRef)(function({label:e,icon:t,caption:n,art:r=`dim`,className:i,...a},o){return(0,F.jsx)(`label`,{className:`caps-icon-choice`,"data-art":r===`color`?r:void 0,children:(0,F.jsx)(iP,{...a,"aria-label":e,className:Dd(`caps-icon-choice-input`,i),indicator:(0,F.jsx)(rD,{icon:t,caption:n}),ref:o})})});(0,I.forwardRef)(function({label:e,color:t,className:n,...r},i){return(0,F.jsx)(`label`,{className:`caps-icon-choice`,"data-art":`color`,"data-swatch":``,title:e,children:(0,F.jsx)(iP,{...r,"aria-label":e,className:Dd(`caps-icon-choice-input`,n),indicator:(0,F.jsx)(rD,{icon:(0,F.jsx)(`span`,{className:`caps-swatch-dot`,style:{backgroundColor:t}})}),ref:i})})});var Dye=(0,I.forwardRef)(function({className:e,invalid:t,...n},r){return(0,F.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,F.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Dd(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,F.jsx)(nr,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function Oye({checked:e}){let t=`caps-switch-${(0,I.useId)().replaceAll(`:`,``)}`,n=(0,I.useRef)(null),r=(0,I.useRef)(null),i=(0,I.useRef)(e).current,a=(0,I.useRef)(e),o=Hd();return(0,I.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=Fd(n.current),c=fm(s,{bounce:.25,duration:440}),l=pm(s,{ease:`inOutSine`,duration:100}),u=Qp(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=Qp(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,F.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(tm,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,F.jsx)(nm,{id:`${t}-shadow`}),(0,F.jsx)(rm,{id:`${t}-inset`}),(0,F.jsx)(`clipPath`,{id:`${t}-track`,children:(0,F.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,F.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,F.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,F.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var kye=(0,I.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,I.useRef)(null),[c,l]=(0,I.useState)(n),u=t??c;return(0,I.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,I.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,F.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,F.jsx)(`input`,{...a,checked:u,className:Dd(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,F.jsx)(Oye,{checked:u})]})}),Aye=(0,I.forwardRef)(function({className:e,invalid:t,...n},r){return(0,F.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Dd(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})}),jye=xb(jb),Mye=xb(Nb),Nye=xb(zb(Ub)),Pye=xb(Fb(jb)),aP=Fb(Vb(File)),Fye=xb(aP),oP=Lb([jb,Ub,Nb,kb,Ab,Fb(jb),aP]),Iye=xb(oP),sP=e=>Um(jye(e.state.value),()=>``),cP=e=>Um(Mye(e.state.value),()=>!1),Lye=e=>Um(Nye(e.state.value),()=>null),Rye=e=>Um(Pye(e.state.value),()=>[]),zye=e=>Um(Fye(e.state.value),()=>[]),Bye=e=>Um(Iye(e.state.value),()=>null);function Vye({field:e,spec:t,locked:n,...r}){let[i,a]=(0,I.useState)(!1);return(0,F.jsxs)(dk,{children:[(0,F.jsx)(nP,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:sP(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,F.jsx)(ir,{"aria-hidden":`true`}):(0,F.jsx)(ar,{"aria-hidden":`true`})})]})}var Hye={text:`text`,email:`email`,url:`url`,tel:`tel`};function Uye({spec:e,field:t,locked:n,...r}){let i=zye(t),a=n||e.readOnly===!0,o=(0,I.useRef)(null);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,F.jsx)(Md,{asChild:!0,children:(0,F.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,F.jsx)(Ak,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function Wye({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,F.jsx)(nP,{...a,type:Hye[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,F.jsx)(Aye,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,F.jsx)(Vye,{...r,field:t,spec:e,locked:n});case`money`:return(0,F.jsxs)(dk,{children:[(0,F.jsx)(fk,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,F.jsx)(nP,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,F.jsx)(nP,{...a,type:`date`,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,F.jsx)(Dk,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:Lye(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,F.jsxs)(Dye,{...a,value:sP(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,F.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,F.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,F.jsx)(yye,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:sP(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,F.jsx)(_ye,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===sP(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,F.jsx)(Uye,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,F.jsx)(Rk,{...a,disabled:n||e.readOnly===!0,checked:cP(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,F.jsx)(kye,{...a,disabled:n||e.readOnly===!0,checked:cP(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var Gye=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function Kye({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=Rye(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,F.jsx)(bk,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,F.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,F.jsx)(bye,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):(0,F.jsx)(Sye,{children:e.options.map(r=>(0,F.jsx)(xye,{name:e.name,value:r.value,label:r.label,icon:r.icon,hint:r.description,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))})})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,F.jsx)(bk,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,F.jsx)(wye,{name:e.name,"aria-label":o,value:sP(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,F.jsx)(Eye,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,F.jsx)(Tye,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,F.jsx)(Sk,{label:t.label,orientation:`inline`,children:(0,F.jsx)(iP,{value:t.value,disabled:t.disabled})},t.value))})})}function qye({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:Bye(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function Jye({form:e,spec:t,locked:n,layout:r}){let i=QO({form:e,name:t.name}),a=XO(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?lk(i.state.meta):void 0;if(t.render===void 0&&Gye.has(t.kind))return(0,F.jsx)(Kye,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,F.jsx)(Sk,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,F.jsx)(Wye,{spec:t,field:i,locked:n}):(0,F.jsx)(qye,{spec:t,field:i,locked:n,error:o,render:t.render})})}var Yye=xb(noe(jb,oP));function lP({form:e,spec:t,locked:n,layout:r}){let i=t.when;return XO(e.store,e=>i===void 0||i(Um(Yye(e.values),()=>({}))))?(0,F.jsx)(Jye,{form:e,spec:t,locked:n,layout:r}):null}function Xye({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,F.jsx)(lP,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,F.jsx)(yk,{title:t.title,description:t.description,layout:r,children:i})}function uP({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,F.jsx)(Xye,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,F.jsx)(lP,{form:i,spec:a,locked:n,layout:r},t)})}var dP=class{annotation;constructor(e){this.annotation=e}},Zye=class{sections;constructor(e){this.sections=e}},fP=`caps/form`,pP=0;function mP(e){pP+=1;let t={[`${fP}:${String(pP)}`]:new dP(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}jb.annotate(mP({kind:`secret`})).pipe(ioe(`Secret`));var hP=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function Qye(e){return Object.values(e??{}).reduce((e,t)=>t instanceof dP?{...e,...t.annotation}:e,{})}function gP(e){return e.reduce((e,t)=>({...e,...Qye(t)}),{})}function _P(e){let t=e?.[fP];return t instanceof Zye?t.sections:{}}var vP=xb(jb);function yP(e){if(tv(e))return Mne(vP(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!av(e))return null;let t=[];for(let n of e.types){if($_(n))continue;let e=yP(n);if(e===null)return null;t.push(...e)}return t}function bP(e){if(ev(e))return{type:`string`,literals:[]};if(dae(e))return{type:`number`,nullable:!1};if(fae(e))return{type:`boolean`};let t=yP(e);if(t!==null)return{type:`string`,literals:t};if(rv(e)){let[t]=e.rest;if(t===void 0)return null;if(ev(t))return{type:`strings`,literals:[]};let n=yP(t);return n===null?null:{type:`strings`,literals:n}}if(av(e)){let t=e.types.filter(e=>!$_(e)&&!Q_(e)),n=e.types.some(e=>Q_(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=bP(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function $ye(e){let t=e.ast;if(!iv(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Fy(e.type),r=gP([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:bP(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:Zy(e.type),description:Qy(e.type)}}),sections:_P(Xy(t))}}function xP(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof hu)n=!0,t=t.unwrap();else if(t instanceof yu)r=!0,t=t.unwrap();else if(t instanceof xu)t=t.unwrap();else if(t instanceof ku)t=t.in;else return{node:t,optional:n,nullable:r}}function SP(e){if(e instanceof $l){let t=e.options.map(e=>SP(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof lu?e.options:e instanceof du?[...e.values]:null;if(t===null)return null;let n=t.map(e=>vP(e));return n.every(Hm)?n.map(e=>e.value):null}function ebe(e){let{node:t,nullable:n}=xP(e);if(t instanceof ll)return{type:`string`,literals:[]};if(t instanceof Nl)return{type:`number`,nullable:n};if(t instanceof Ll)return{type:`boolean`};let r=SP(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof ql){let e=xP(t.element).node;if(e instanceof ll)return{type:`strings`,literals:[]};let n=SP(e);return n===null?null:{type:`strings`,literals:n}}return null}function CP(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof hu||e instanceof yu||e instanceof xu?e.unwrap():e instanceof ku?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>Zo.get(e))}function wP(e){return CP(e).reduce((e,t)=>({...e,...t}),{})}function tbe(e){return Object.entries(e.shape)}function nbe(e){let t=xP(e).node;if(!(t instanceof Yl))throw Error(`A schema form needs a z.object.`);return{fields:tbe(t).map(([e,t])=>{let n=gP(CP(t)),r=n.kind===`file`?{type:`files`}:ebe(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=wP(t);return{name:e,valueType:r,optional:xP(t).optional,annotation:n,title:i.title,description:i.description}}),sections:_P(wP(e))}}function rbe(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??hP(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function ibe(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function abe(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function obe(e){let t=e instanceof sl?nbe(e):$ye(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=rbe(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??hP(e.name),help:a,kind:n??ibe(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=abe(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function TP(e){let t=e instanceof sl?e:$ae(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>EP(e)):EP(n)}}}}function EP(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var DP=`onServer`;function OP(e){let t=e.querySelector(`[aria-invalid="true"]`),n=t?.matches(`input, select, textarea, button, [tabindex]`)?t:t?.querySelector(`input, select, textarea, button`);return n?.focus(),n!=null}function sbe(e){if(OP(e))return()=>void 0;let t=new MutationObserver(()=>{OP(e)&&t.disconnect()});return t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`aria-invalid`]}),()=>{t.disconnect()}}function cbe(e){return e.state.meta.errorMap.onServer!==void 0}function lbe(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[DP]:void 0}}))}function ube(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[DP]:n}}))}function kP(e){let[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(e.defaultValues),[s,c]=(0,I.useState)(null);hO(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,I.useMemo)(()=>obe(l),[l]),d=(0,I.useMemo)(()=>TP(l),[l]),f=ok({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),cbe(e)&&lbe(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await TP(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&ube(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function AP(e){return{dirty:XO(e.form.store,e=>!e.isDefaultValue),submitting:XO(e.form.store,e=>e.isSubmitting),canSubmit:XO(e.form.store,e=>e.canSubmit)}}function jP({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=AP(e),f=(0,I.useRef)(null),p=(0,I.useRef)(()=>void 0);return(0,I.useEffect)(()=>()=>{p.current()},[]),(0,F.jsxs)(_k,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{p.current();let t=f.current;t!==null&&!e.form.state.isValid&&(p.current=sbe(t))})},children:[c??(0,F.jsx)(uP,{model:e,disabled:l,layout:o}),s===void 0?(0,F.jsx)(fbe,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function dbe({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=kP({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,F.jsx)(jP,{...a,model:o})}function MP(e){return`model`in e?(0,F.jsx)(jP,{...e}):(0,F.jsx)(dbe,{...e})}function fbe({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=AP(e),d=u?null:e.saved&&!l?(0,F.jsx)(vm,{tone:`success`,size:`compact`,label:e.saved}):l?(0,F.jsx)(vm,{tone:`neutral`,size:`compact`,label:o}):null;return(0,F.jsxs)(gk,{...c,error:e.error,status:d,children:[r?(0,F.jsx)(ZE,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,F.jsx)(ZE,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,F.jsx)(ZE,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var NP=new Set([`Enter`,` `]),pbe=(0,I.forwardRef)(function({children:e,onConfirm:t,holdMs:n=900,holdHint:r=`Press and hold to confirm.`,className:i,disabled:a,loading:o=!1,result:s,resultLabel:c,onBlur:l,onKeyDown:u,onKeyUp:d,onPointerDown:f,onPointerUp:p,onPointerLeave:m,onPointerCancel:h,...g},_){let v=(0,I.useRef)(null),y=(0,I.useRef)(null),b=(0,I.useRef)(null),x=(0,I.useRef)(null),S=(0,I.useRef)(t),C=(0,I.useId)();(0,I.useEffect)(()=>{S.current=t},[t]),(0,I.useEffect)(()=>()=>{y.current?.cancel(),b.current!==null&&clearTimeout(b.current)},[]);let w=()=>{y.current=null,b.current=null,x.current=null,S.current();let e=v.current;if(!e||!Bd(e))return;let t=Fd(e);e.animate([{opacity:1},{opacity:0}],{duration:t.normal,easing:zd(t,t.easeExit)})},T=e=>{let t=v.current;if(a===!0||o||!t||y.current||b.current)return;if(x.current=e,!Bd(t)){b.current=setTimeout(w,n);return}let r=Fd(t),i=t.animate([{transform:`scaleY(0)`},{transform:`scaleY(1)`}],{duration:n,easing:r.reduced?`steps(3, end)`:zd(r,`cubic-bezier(0.3, 0, 0.7, 1)`)});i.addEventListener(`finish`,w),y.current=i},E=e=>{if(e!==void 0&&x.current!==e)return;x.current=null,b.current!==null&&(clearTimeout(b.current),b.current=null);let t=y.current,n=v.current;if(!t||!n)return;y.current=null;let r=getComputedStyle(n).transform;t.cancel();let i=Fd(n);n.animate([{transform:r===`none`?`scaleY(0)`:r},{transform:`scaleY(0)`}],{duration:i.fast,easing:zd(i,i.ease)})};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(ZE,{...g,ref:_,disabled:a,loading:o,result:s,resultLabel:c??(s===void 0?void 0:e),"aria-describedby":C,className:Dd(`caps-hold-button`,i),onBlur:e=>{E(),l?.(e)},onPointerDown:e=>{f?.(e),e.button===0&&T(e.pointerId)},onPointerUp:e=>{p?.(e),E(e.pointerId)},onPointerLeave:e=>{m?.(e),E(e.pointerId)},onPointerCancel:e=>{h?.(e),E(e.pointerId)},onKeyDown:e=>{u?.(e),e.key===`Escape`&&E(),NP.has(e.key)&&(e.preventDefault(),e.repeat||T(`key`))},onKeyUp:e=>{d?.(e),NP.has(e.key)&&(e.preventDefault(),E(`key`))},children:[(0,F.jsx)(`span`,{ref:v,"aria-hidden":`true`,className:`caps-hold-fill`}),e]}),(0,F.jsx)(Md,{id:C,children:r})]})}),PP=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`code`,{...t,className:Dd(`caps-inline-code`,e),ref:n})}),mbe=8e3,FP=(0,I.forwardRef)(function({className:e,detail:t,framed:n=!0,icon:r,message:i,onRetry:a,size:o=`md`,slowAfterMs:s=mbe,variant:c=`line`,...l},u){let[d,f]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{if(f(!1),!Number.isFinite(s))return;let e=globalThis.setTimeout(()=>{f(!0)},s);return()=>{globalThis.clearTimeout(e)}},[s,i]),(0,F.jsxs)(`div`,{...l,className:Dd(`caps-loading-state`,e),"data-framed":n?void 0:`false`,"data-icon":r?``:void 0,"data-size":o,"data-slow":d||void 0,ref:u,role:`status`,children:[r?(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`caps-loading-state-icon`,children:r}):null,(0,F.jsx)(um,{decorative:!0,size:o,variant:c}),(0,F.jsxs)(`span`,{className:`caps-loading-state-copy`,children:[(0,F.jsx)(`span`,{children:i}),t?(0,F.jsx)(`span`,{className:`caps-loading-state-detail`,children:t}):null,d?(0,F.jsx)(`span`,{className:`caps-loading-state-detail`,children:`Still working…`}):null]}),d&&a?(0,F.jsx)(ZE,{className:`caps-loading-state-retry`,size:`sm`,variant:`outline`,onClick:a,children:`Retry`}):null]})}),IP=`data-reorder-key`;function hbe(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{element:t,top:r.top-n.top+e.scrollTop,left:r.left-n.left+e.scrollLeft,width:r.width,height:r.height}}function gbe(e,t,n){e.forEach((e,r)=>{e.animate(t.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,transform:`translateY(${String(t.distance)}px)`},{opacity:1,transform:`none`}],{duration:t.normal,delay:n+r*t.stagger,easing:zd(t,t.ease),fill:`backwards`})})}function _be(e,t,n){let r=t.element.cloneNode(!0);if(!(r instanceof HTMLElement))return;r.removeAttribute(IP),r.removeAttribute(`id`),r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`inert`,``),Object.assign(r.style,{position:`absolute`,top:`${String(t.top-e.clientTop)}px`,left:`${String(t.left-e.clientLeft)}px`,width:`${String(t.width)}px`,height:`${String(t.height)}px`,margin:`0`,pointerEvents:`none`});let i=getComputedStyle(e).position!==`static`;i||(e.style.position=`relative`),e.append(r);let a=r.animate(n.reduced?[{opacity:1},{opacity:0}]:[{opacity:1,transform:`none`},{opacity:0,transform:`translateY(${String(-n.distance)}px)`}],{duration:n.fast,easing:zd(n,n.easeExit),fill:`forwards`}),o=()=>{r.remove(),!i&&e.querySelector(`:scope > [inert]`)===null&&e.style.removeProperty(`position`)};a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o)}function vbe(e,t,n,r){let i=e.style.overflow;e.style.overflow=`clip`;let a=e.animate([{height:`${String(t)}px`},{height:`${String(n)}px`}],r),o=()=>{e.style.overflow=i};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a}function ybe(e,t){let n=(0,I.useRef)(null),r=(0,I.useRef)(0),i=(0,I.useRef)(null),a=t.join(`\0`);(0,I.useLayoutEffect)(()=>{let o=e.current;if(o===null){n.current=null;return}let s=n.current,c=s?.order!==a,l=i.current?o.getBoundingClientRect().height:r.current;c&&(i.current?.cancel(),i.current=null);let u=c?o.getBoundingClientRect().height:r.current;r.current=u;let d=new Map;for(let e of o.querySelectorAll(`:scope [${IP}]`)){let t=e.getAttribute(IP);if(t===null)continue;let n=s?.rows.get(t);d.set(t,!c&&n?.element===e?n:hbe(o,e))}let f=new Set(t);if(n.current={order:a,keys:f,rows:d},s===null||!c||!Bd(o))return;let p=Fd(o),m=[...s.rows].filter(([e,t])=>!f.has(e)&&!t.element.isConnected),h={duration:p.slow,delay:m.length>0?p.fast:0,easing:zd(p,p.ease),fill:`backwards`},g=[],_=[];for(let[e,t]of d){let n=s.rows.get(e);if(n===void 0){s.keys.has(e)||g.push(t.element);continue}let r=n.left-t.left,i=n.top-t.top;(r!==0||i!==0)&&(_.push(t.element),!(p.reduced||p.slow<=0)&&t.element.animate([{transform:`translate(${String(r)}px, ${String(i)}px)`},{transform:`none`}],h))}if(p.reduced)for(let e of _)e.animate([{opacity:.3},{opacity:1}],{duration:p.fast,easing:p.ease});else for(let[,e]of m)_be(o,e,p);if(gbe(g,p,_.length>0&&!p.reduced?p.fast:0),!p.reduced&&Math.abs(l-u)>.5){let e=vbe(o,l,u,h);i.current=e,e.addEventListener(`finish`,()=>{i.current===e&&(i.current=null)})}})}var LP=(0,I.createContext)(null);function RP(){let e=(0,I.useContext)(LP);if(!e)throw Error(`Shed data requires a workspace provider`);return e}function zP({label:e,order:t,children:n,listRoot:r}){let i=(0,I.useRef)(null),a=r??i;return ybe(a,t),(0,F.jsx)(`div`,{ref:a,children:(0,F.jsx)(Kme,{role:`list`,"aria-label":e,children:n})})}var bbe=R({command:$b.pipe(Bb(Zb(16384))).annotate(mP({label:`Command`,required:!0,placeholder:`pnpm dev`})),port:zb(vC.fields.port).annotate(mP({label:`Port (optional)`,help:`Web server preview only.`,min:1,max:65535,render:e=>(0,F.jsx)(nP,{name:e.name,id:e.id,type:`number`,inputMode:`numeric`,placeholder:`5173`,min:1,max:65535,step:1,value:e.value??``,disabled:e.disabled,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],onBlur:()=>{e.onBlur()},onChange:t=>{let n=t.currentTarget;e.onChange(n.value===``?null:n.valueAsNumber)}})}))}),xbe=[{command:`pwd`,label:`Folder`,port:null},{command:`ls`,label:`Files`,port:null},{command:`echo hello`,label:`Hello`,port:null}];function BP({openPreview:e,processNavigation:t}){let{ports:{items:n},processes:{items:r,loading:i,error:a,fix:o,actions:s,stop:c,start:l,output:u,unavailableReason:d}}=RP(),f=(0,I.useRef)(null),p=(0,I.useRef)(null),m=(0,I.useRef)(null),h=(0,I.useRef)(null),g=(0,I.useRef)(0),[_,v]=(0,I.useState)(null),y=e=>{Date.now()-g.current<900&&v(e)},b=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!t||b.current===t.requestId||!f.current)return;let e=[...f.current.querySelectorAll(`[${IP}]`)].find(e=>e.getAttribute(IP)===t.processId);e&&(e.focus(),b.current=t.requestId)},[t,r]);let x=u?.processId??null,S=u?.data!==null;(0,I.useEffect)(()=>{x!==null&&S&&m.current?.scrollIntoView({block:`start`})},[x,S]);let C=u?.data?.lines.length??0,w=u?.data?.process.state===`running`;(0,I.useEffect)(()=>{let e=p.current;w&&e&&(e.scrollTop=e.scrollHeight)},[w,C]);let T=kP({schema:bbe,defaultValues:{command:``,port:null},onSubmit:async({command:e,port:t})=>await l?.(t===null?{command:e}:{command:e,port:t})?{kind:`saved`}:{kind:`refused`}}),E=r!==null||i||a!==null?i&&r===null?(0,F.jsx)(FP,{message:`Loading command history`,size:`sm`,framed:!1}):a!==null&&r===null?(0,F.jsx)(`div`,{className:`px-2 pb-3`,children:(0,F.jsx)(SD,{variant:`quiet`,role:`status`,title:`Can't run commands`,description:a.message,actions:o===void 0?void 0:(0,F.jsx)(ZE,{size:`xs`,variant:`outline`,onClick:()=>void o(),children:a.action===`grant`?`Allow access`:`Try again`})})}):r===null||r.length===0?(0,F.jsx)(`div`,{className:`px-2 pb-3`,children:(0,F.jsx)(SD,{variant:`quiet`,visual:`blobs`,headingLevel:3,title:`Your first command starts here`,description:`Choose a starter above, then press Start. Output and past commands stay here.`})}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`-mx-1`,children:(0,F.jsx)(zP,{label:`Computer process inventory`,order:r.map(({id:e})=>e),listRoot:f,children:r.map(t=>{let r=s?.get(t.id),i=t.state===`running`?n?.find(e=>e.port===t.port):void 0,a,o;t.state===`running`?(a=`success`,o=`Running`):t.state===`uncertain`?(a=`warning`,o=`Status unknown`):t.endedReason===`idle-sleep`?(a=`warning`,o=`Stopped when the Computer went to sleep`):t.exitCode===null?(a=`warning`,o=`Ended · exit not recorded`):(a=t.exitCode===0?`success`:`error`,o=`Exit ${String(t.exitCode)}`);let l=t.state===`exited`&&t.sync===`pending`;return(0,F.jsx)(zD,{[IP]:t.id,role:`listitem`,"data-process-state":t.state,"data-process-sync":t.sync,className:`py-2`,tabIndex:-1,primary:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(PP,{className:`block truncate`,"data-process-command":!0,children:t.command}),(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-normal`,children:[(0,F.jsx)(vm,{size:`compact`,tone:a,className:a===`error`?`text-error`:void 0,label:r===`stopping`?`Stopping`:o}),t.port===null?null:(0,F.jsxs)(`span`,{"data-process-port":!0,children:[`Port `,t.port]})]}),(0,F.jsxs)(F.Fragment,{children:[_===t.id?(0,F.jsx)(`span`,{role:`status`,className:`block text-xs font-normal text-(--stipe-fg-muted)`,children:`Hold to stop`}):null,l?(0,F.jsx)(`span`,{className:`block truncate text-xs font-normal text-(--stipe-fg-muted)`,children:`Changes still copying to your files`}):null,t.cwd===null?null:(0,F.jsx)(`span`,{className:`block truncate text-xs font-normal text-(--stipe-fg-muted)`,children:t.cwd})]})]}),actions:(0,F.jsxs)(F.Fragment,{children:[u?(0,F.jsx)(ZE,{size:`sm`,variant:`ghost`,"aria-label":`Show output of ${t.command}`,onClick:()=>{u.select(t.id)},children:`Output`}):null,i?(0,F.jsxs)(ZE,{size:`sm`,variant:`ghost`,"aria-label":`Open preview of port ${String(i.port)}`,onClick:()=>{e(i)},children:[(0,F.jsx)(er,{size:14,"aria-hidden":`true`}),` Open`]}):null,t.state===`running`&&c?(0,F.jsx)(pbe,{holdHint:`A stopped process cannot be resumed. Press and hold to stop it.`,size:`sm`,variant:`ghost`,className:`hover:text-error`,disabled:r===`stopping`,"aria-label":`Stop process ${t.command}`,onPointerDown:()=>{g.current=Date.now(),v(null)},onPointerUp:()=>{y(t.id)},onConfirm:()=>{v(null),c(t.id)},children:r===`stopping`?`Stopping…`:`Stop`}):null]})},t.id)})})}),i?(0,F.jsx)(FP,{message:`Refreshing processes…`,size:`sm`,framed:!1}):null]}):(0,F.jsx)(BD,{title:`Processes can't be listed yet`,children:`Allow Computer access to see and run commands.`});return(0,F.jsxs)(`div`,{className:`space-y-5 p-4 sm:p-6`,ref:h,children:[d?(0,F.jsx)(`p`,{role:`status`,className:`px-2 pt-3 text-sm`,children:d}):null,l&&(a===null||a.reason===`failed`)?(0,F.jsx)(T.form.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(MP,{model:T,"aria-label":`Start a process`,className:`space-y-3`,disabled:e||d!==void 0,footer:null,children:(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,F.jsx)(uP,{model:T,disabled:e||d!==void 0}),(0,F.jsx)(ZE,{className:`sm:col-span-2 sm:justify-self-start`,type:`submit`,variant:`primary`,loading:e,disabled:e||d!==void 0,onClick:()=>{T.form.setFieldMeta(`command`,e=>({...e,errorMap:{...e.errorMap,onServer:void 0}}))},children:`Start`})]})}),(0,F.jsx)(`ul`,{"aria-label":`Try one of these`,className:`m-0 mt-3 flex list-none flex-wrap gap-2 p-0`,children:xbe.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(ZE,{size:`sm`,variant:`outline`,disabled:e||d!==void 0,title:t.command,onClick:()=>{T.form.setFieldValue(`command`,t.command),T.form.setFieldValue(`port`,t.port),h.current?.querySelector(`input[name="command"]`)?.focus()},children:[t.label,` `,(0,F.jsx)(PP,{children:t.command})]})},t.command))})]})}):null,u?.processId?(0,F.jsxs)(`section`,{ref:m,"aria-label":`Process output`,className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`min-w-0 break-words font-mono text-sm font-semibold`,children:u.data?.process.command??`Process output`}),(0,F.jsx)(ZE,{size:`xs`,variant:`ghost`,onClick:()=>{u.select(null)},children:`Close output`})]}),u.failed?(0,F.jsx)(SD,{variant:`quiet`,title:`Output unavailable`,description:`Retry to read this command’s output.`,primaryAction:{label:`Retry`,onSelect:()=>void u.retry()}}):u.loading?(0,F.jsx)(FP,{size:`sm`,message:`Loading output`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(iD,{children:(0,F.jsx)(`pre`,{ref:p,className:`max-h-48 overflow-auto whitespace-pre-wrap break-all p-3 text-xs`,children:u.data?.lines.length===0?u.data.process.state===`exited`?`Finished without output.`:`No output yet.`:u.data?.lines.join(`
|
|
95
|
+
const term = new Terminal({ ghostty });`)}var qE;function JE(){return qE??=epe.load().catch(e=>{throw qE=void 0,e}),qE}var ype=[``,`bold `,`italic `,`bold italic `];async function YE(e,t){await Promise.all(ype.map(n=>document.fonts.load(`${n}${String(e)}px ${t}`)))}var XE=`disabled:bg-base-200 disabled:text-base-content disabled:outline-1 disabled:outline-solid disabled:outline-base-content/25 aria-disabled:bg-base-200 aria-disabled:text-base-content aria-disabled:outline-1 aria-disabled:outline-solid aria-disabled:outline-base-content/25`,bpe=see(`btn caps-button disabled:pointer-events-none`,{variants:{variant:{primary:`btn-primary caps-button-filled`,secondary:`btn-secondary caps-button-filled`,accent:`btn-accent caps-button-filled`,destructive:`btn-error caps-button-filled`,outline:`btn-outline ${XE}`,ghost:`btn-ghost`,"ghost-destructive":`btn-ghost caps-button-ghost-destructive`,link:`btn-link ${XE}`},size:{xs:`btn-xs`,sm:`btn-sm`,default:`btn-md`,lg:`btn-lg`,icon:`btn-square btn-md`,menubar:`caps-button-menubar`}},defaultVariants:{variant:`primary`,size:`default`}}),ZE=(0,I.forwardRef)(function({asChild:e=!1,children:t,className:n,disabled:r,loading:i=!1,result:a,resultLabel:o,onResultEnd:s,size:c=`default`,variant:l=`primary`,...u},d){let f=Dd(bpe({size:c,variant:l}),n),p=(0,I.useRef)(a).current,m=(0,I.useRef)(null);return(0,I.useImperativeHandle)(d,()=>m.current),xpe(m,i,a),e?(0,F.jsx)(kd,{...u,"aria-busy":i?!0:u[`aria-busy`],"aria-disabled":r===!0||i?!0:void 0,className:f,ref:m,children:t}):(0,F.jsx)(`button`,{...u,"aria-busy":i?!0:u[`aria-busy`],className:f,disabled:r===!0||i,ref:m,type:u.type??`button`,children:a===void 0&&o===void 0?(0,F.jsxs)(F.Fragment,{children:[i?(0,F.jsx)(um,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,t]}):(0,F.jsx)(Tpe,{label:o,loading:i,onResultEnd:s,result:a,settled:p,children:t})})});function xpe(e,t,n){let r=(0,I.useRef)(null),i=(0,I.useRef)(null),a=(0,I.useRef)(null);(0,I.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let s=JSON.stringify([t,n??null,o.textContent]),c=s!==i.current;i.current=s;let l=a.current;if(!c&&l)return;let u=l?o.offsetWidth:r.current;l&&(a.current=null,l.cancel(),o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`));let d=o.offsetWidth;if(r.current=d>0?d:null,!c||u===null||d===0||Math.abs(u-d)<1||!Bd(o))return;let f=Fd(o);if(f.reduced)return;let p=o.animate([{width:`${String(u)}px`},{width:`${String(d)}px`}],{duration:f.normal,easing:zd(f,f.ease)});a.current=p,o.style.overflow=`clip`,o.style.whiteSpace=`nowrap`;let m=()=>{a.current===p&&(a.current=null,o.style.removeProperty(`overflow`),o.style.removeProperty(`white-space`))};p.onfinish=m,p.oncancel=m})}var Spe=1100;function Cpe(e,t){let n=t.bounce/.3,r=1+.05*Math.min(1.4,.4+n),i=1-.02*Math.min(1.4,n);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(r)})`,offset:.35},{transform:`scale(${String(i)})`,offset:.7},{transform:`scale(1)`}],{duration:t.springDuration,easing:zd(t,`ease-out`)})}function wpe(e,t){let n=t.shake;return e.animate([{transform:`none`},{transform:`translateX(${String(-n)}px)`},{transform:`translateX(${String(n)}px)`},{transform:`translateX(${String(-n*.6)}px)`},{transform:`translateX(${String(n*.3)}px)`},{transform:`none`}],{duration:t.slow*1.3,easing:zd(t,`linear`)})}function QE(e,t,n){let r=n.distance+2,i=`blur(${String(n.blur)}px)`;return[e.animate([{opacity:1,transform:`none`,filter:`blur(0px)`},{opacity:0,transform:`translateY(${String(-r)}px)`,filter:i}],{duration:n.fast,easing:zd(n,n.ease)}),t.animate([{opacity:0,transform:`translateY(${String(r)}px)`,filter:i},{opacity:1,transform:`none`,filter:`blur(0px)`}],{duration:n.normal,easing:zd(n,n.ease),fill:`backwards`})]}function Tpe({children:e,label:t,loading:n,onResultEnd:r,result:i,settled:a}){let o=(0,I.useRef)(null),s=Hd(),[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)(!1);c&&!u&&d(!0);let f=(0,I.useRef)(a),p=(0,I.useRef)(r);(0,I.useEffect)(()=>{p.current=r},[r]),(0,I.useLayoutEffect)(()=>{let e=f.current;if(f.current=i,i===e)return;if(i===`done`){l(!0);let e=setTimeout(()=>{p.current?p.current():l(!1)},Spe);return()=>{clearTimeout(e)}}l(!1);let t=o.current;if(i!==`failed`||!t||!Bd(t))return;let n=Fd(t);if(n.shake<=0)return;let r=wpe(t,n);return()=>{r.cancel()}},[i,s]);let m=(0,I.useRef)(c);return(0,I.useLayoutEffect)(()=>{let e=o.current;if(!e||m.current===c)return;m.current=c;let t=e.querySelector(`[data-face="label"]`),n=e.querySelector(`[data-face="result"]`);if(!t||!n||!Bd(e)){c||d(!1);return}let r=Fd(e),i=c?QE(t,n,r):QE(n,t,r);if(c||i[0]?.addEventListener(`finish`,()=>{d(!1)}),c&&!r.reduced){i.push(Cpe(e.closest(`button`)??e,r));let t=n.querySelector(`path`);t&&i.push(t.animate([{strokeDashoffset:1},{strokeDashoffset:0}],{duration:r.normal*1.4,delay:r.fast/2,easing:zd(r,r.ease),fill:`backwards`}))}return()=>{for(let e of i)e.cancel()}},[c,s]),(0,F.jsxs)(`span`,{ref:o,className:`caps-button-faces`,"data-showing":c?`result`:`label`,children:[(0,F.jsxs)(`span`,{className:`caps-button-face`,"data-face":`label`,"aria-hidden":c?!0:void 0,children:[n||c?(0,F.jsx)(um,{decorative:!0,size:`sm`,tone:`current`,variant:`wander`}):null,e]}),u?(0,F.jsxs)(`span`,{className:`caps-button-face`,"data-face":`result`,"aria-hidden":!c||void 0,children:[(0,F.jsx)(`svg`,{className:`caps-button-check`,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,F.jsx)(`path`,{d:`M4.5 12.5 9.5 17.5 19.5 6.5`,pathLength:1})}),t===void 0?e:t]}):null]})}var $E=new Map([[`0`,[`###`,`#.#`,`#.#`,`#.#`,`###`]],[`1`,[`.#.`,`##.`,`.#.`,`.#.`,`###`]],[`2`,[`###`,`..#`,`###`,`#..`,`###`]],[`3`,[`###`,`..#`,`.##`,`..#`,`###`]],[`4`,[`#.#`,`#.#`,`###`,`..#`,`..#`]],[`5`,[`###`,`#..`,`###`,`..#`,`###`]],[`6`,[`###`,`#..`,`###`,`#.#`,`###`]],[`7`,[`###`,`..#`,`.#.`,`.#.`,`.#.`]],[`8`,[`###`,`#.#`,`###`,`#.#`,`###`]],[`9`,[`###`,`#.#`,`###`,`..#`,`###`]],[`:`,[`.`,`#`,`.`,`#`,`.`]],[`.`,[`.`,`.`,`.`,`.`,`#`]],[`+`,[`...`,`.#.`,`###`,`.#.`,`...`]],[`-`,[`...`,`...`,`###`,`...`,`...`]],[`/`,[`..#`,`..#`,`.#.`,`#..`,`#..`]],[`×`,[`...`,`#.#`,`.#.`,`#.#`,`...`]],[`%`,[`#.#`,`..#`,`.#.`,`#..`,`#.#`]],[` `,[`.`,`.`,`.`,`.`,`.`]]]),Epe=[`.`,`.`,`.`,`.`,`.`],Dpe=Object.freeze([...$E.keys()]);function Ope(e,t=0,n=!1){if(!Number.isFinite(e))throw RangeError(`PixelNumber needs a finite number`);let r=String(Math.trunc(Math.abs(e))).padStart(t,`0`),i=String(Math.abs(e)).split(`.`)[1];return eD(`${e<0?`-`:n&&e>0?`+`:``}${r}${i?`.${i}`:``}`)}function eD(e){for(let t of e)if(!$E.has(t))throw RangeError(`PixelNumber cannot draw "${t}"; use digits and ${Dpe.filter(e=>!/\d/.test(e)).join(` `)}`);return e}function kpe(e,t){let n=new Set,r=t;for(let i of e){let e=$E.get(i)??Epe;e.forEach((e,i)=>{for(let a=0;a<e.length;a++)e.charAt(a)===`#`&&n.add(`${String(r+a)},${String(i+t)}`)}),r+=(e.at(0)?.length??1)+1}return{lit:n,width:Math.max(1,r-1-t)+t*2}}function Ape(e){let t=new Set;for(let n of e){let[r=0,i=0]=n.split(`,`).map(Number);for(let n=-1;n<=1;n++)for(let a=-1;a<=1;a++){let o=`${String(r+a)},${String(i+n)}`;e.has(o)||t.add(o)}}return t}function tD(e,t,n){let r=[];for(let i=0;i<n;i++){let n=-1;for(let a=0;a<=t;a++){let t=e.has(`${String(a)},${String(i)}`);t&&n<0&&(n=a),!t&&n>=0&&(r.push([n,i,a-n]),n=-1)}}return r}function nD({runs:e,className:t}){return(0,F.jsx)(`g`,{className:t,children:e.map(([e,t,n])=>(0,F.jsx)(`rect`,{x:e,y:t,width:n,height:1},`${String(e)}-${String(t)}`))})}var jpe=(0,I.forwardRef)(function({value:e,text:t,pad:n,signed:r,size:i=`md`,tone:a=`current`,outline:o=!1,className:s,...c},l){if(t===void 0&&e===void 0)throw TypeError(`PixelNumber needs a value or text`);let u=t===void 0?Ope(e??NaN,n,r):eD(t),d=+!!o,{lit:f,width:p}=kpe(u,d),m=5+d*2,h=Mpe[i];return(0,F.jsxs)(`span`,{...c,ref:l,className:Dd(`caps-pixel-number`,s),"data-size":i,"data-tone":a,"data-outline":o,children:[(0,F.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 ${String(p)} ${String(m)}`,width:p*h,height:m*h,children:[o?(0,F.jsx)(nD,{className:`caps-pixel-number-outline`,runs:tD(Ape(f),p,m)}):null,(0,F.jsx)(nD,{className:`caps-pixel-number-face`,runs:tD(f,p,m)})]}),(0,F.jsx)(`span`,{className:`sr-only`,children:u})]})}),Mpe={sm:2,md:3,lg:4,xl:6};function rD({icon:e,caption:t}){return(0,F.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,F.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,F.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,F.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var Npe=(0,I.forwardRef)(function({label:e,icon:t,caption:n,on:r,stateLabels:i=[`on`,`off`],className:a,...o},s){return(0,F.jsxs)(`span`,{...o,className:Dd(`caps-icon-lamp`,a),"data-on":r,ref:s,children:[(0,F.jsx)(rD,{icon:t,caption:n}),(0,F.jsxs)(`span`,{className:`sr-only`,children:[e,`: `,r?i[0]:i[1]]})]})}),Ppe=(0,I.forwardRef)(function({items:e,stateLabels:t,className:n,...r},i){return(0,F.jsx)(`ul`,{...r,className:Dd(`caps-icon-lamps`,n),ref:i,children:e.map(({id:e,...n})=>(0,F.jsx)(`li`,{children:(0,F.jsx)(Npe,{...n,...t===void 0?{}:{stateLabels:t}})},e))})}),Fpe=(0,I.forwardRef)(function({className:e,size:t=`md`,depth:n=`shallow`,placement:r=`standalone`,...i},a){return(0,F.jsx)(`div`,{...i,ref:a,"data-surface-size":t,"data-surface-depth":n,"data-surface-placement":r,className:Dd(`caps-surface`,e)})}),iD=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`div`,{...t,ref:n,className:Dd(`caps-screen`,e)})}),Ipe=(0,I.forwardRef)(function({children:e,className:t,depth:n=`deep`,fit:r=`content`,density:i=`normal`,...a},o){let s=r===`fill`;return(0,F.jsx)(Fpe,{...a,className:Dd(t,s&&`flex min-h-0 flex-1`),depth:n,ref:o,children:(0,F.jsx)(`div`,{className:Dd(`caps-display-gasket`,s&&`flex min-h-0 min-w-0 flex-1`),"data-display-density":i,children:(0,F.jsx)(iD,{className:Dd(s&&`flex min-h-0 min-w-0 flex-1 overflow-hidden`),children:e})})})}),Lpe=(0,I.forwardRef)(function({className:e,icon:t,status:n,title:r,...i},a){return(0,F.jsxs)(`header`,{...i,className:Dd(`caps-screen-header`,e),ref:a,children:[t?(0,F.jsx)(`span`,{className:`caps-screen-header-icon`,"aria-hidden":`true`,children:t}):null,(0,F.jsx)(`span`,{className:`caps-screen-header-title`,children:r}),n?(0,F.jsx)(`span`,{className:`caps-screen-header-status`,children:n}):null]})}),Rpe=(0,I.forwardRef)(function({appearance:e,className:t,...n},r){return(0,F.jsx)(`div`,{...n,className:Dd(`caps-screen-cells`,t),"data-appearance":e===`compact`?e:void 0,ref:r})}),aD=(0,I.forwardRef)(function({children:e,className:t,legend:n,readout:r,icon:i,appearance:a,wide:o=!1,...s},c){return(0,F.jsxs)(`div`,{...s,className:Dd(`caps-screen-cell`,t),"data-wide":o||void 0,"data-appearance":a===`compact`?a:void 0,ref:c,children:[i?(0,F.jsx)(`span`,{className:`caps-screen-cell-icon`,children:i}):null,n?(0,F.jsx)(`span`,{className:`caps-screen-cell-legend`,children:n}):null,r?(0,F.jsx)(`span`,{className:`caps-screen-cell-readout`,children:r}):null,a===`compact`?(0,F.jsx)(`div`,{className:`caps-screen-cell-controls`,children:e}):e]})}),oD={coral:`var(--stipe-art-coral, #ff6558)`,blue:`var(--stipe-art-blue, #43a6f2)`,mint:`var(--stipe-art-mint, #63cfaa)`,grape:`var(--stipe-art-grape, #a66cc1)`,yellow:`var(--stipe-art-yellow, #ffd05d)`,cream:`var(--stipe-art-cream, #fff4de)`,ink:`var(--stipe-art-ink, #242c28)`,graphite:`var(--stipe-art-graphite, #49423f)`,inkcap:`var(--stipe-art-inkcap, #80499d)`},sD=`light-dark(var(--stipe-sketch-ink, #242c28), var(--stipe-art-cream, #fff4de))`,zpe=`var(--color-base-100, light-dark(#fff4de, #242c28))`;function cD({transform:e,fill:t=sD}){return(0,F.jsx)(`path`,{transform:e,style:{fill:t},d:`M-1.264-9.479C-2.098-8.643-1.802-1.057-.907-.332.47.782 1.6-.446 1.618-3.075 1.623-3.888 1.691-5.398 1.77-6.429 1.979-9.202 1.596-10 .055-10-.588-10-.843-9.9-1.264-9.479Z`})}function Bpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(cD,{transform:`translate(25.4 19.8) rotate(-39) scale(.95 .76)`}),(0,F.jsx)(cD,{transform:`translate(32.1 17.8) scale(.96 .95)`}),(0,F.jsx)(cD,{transform:`translate(38.8 19.9) rotate(39) scale(.95 .77)`})]})}function Vpe(){return(0,F.jsxs)(`g`,{style:{fill:oD.blue},children:[(0,F.jsx)(`path`,{d:`M10.574 .604C9.804 1.375 9.867-.885 9.961 22.81 10.054 47.202 9.722 45.378 14.193 45.94 25.813 47.399 38.465 52.211 44.662 57.532 47.653 60.097 48.082 59.411 47.967 52.242L47.734 19.335C47.734 17.523 47.13 16.616 45.964 15.076 40.604 8.018 30.127 2.767 16.804 .462 13.045-.184 11.326-.148 10.574 .604Z`}),(0,F.jsx)(`path`,{d:`M81.571 .746C71.063 2.665 62.221 6.713 56.562 12.199 54.242 14.45 52 17.356 52.115 19.335L52.033 52.628C51.927 59.934 51.979 59.994 55.74 57.091 62.423 51.931 71.272 48.541 84.103 46.221 90.625 45.039 89.967 47.631 90.145 22.432 90.326-3.079 91.148-1 81.571 .746Z`}),(0,F.jsx)(`path`,{d:`M1.906 12.692C.1 13.42 .151 12.804 .151 33.825 .151 54.097 .163 54.302 1.447 55.498 2.71 56.674 3.384 56.81 7.937 56.816 20.943 56.834 30.647 58.293 38.776 61.45 45.964 64.242 46.435 61.924 39.526 57.773 32.296 53.429 26.656 51.544 14.943 49.553 5.958 48.027 6.535 49.414 6.408 29.003 6.32 14.74 6.263 13.103 5.816 12.764 5.254 12.335 2.9 12.293 1.906 12.692Z`}),(0,F.jsx)(`path`,{d:`M94.326 12.858C93.656 13.326 93.656 13.326 93.653 28.492 93.653 48.882 93.997 48.063 84.743 49.556 73.574 51.36 64.45 54.695 57.801 59.405 54.082 62.039 55.384 63.864 59.722 62.1 68.897 58.372 76.363 57.115 90.03 56.994 100.405 56.903 99.489 58.976 99.773 34.976 100.018 14.142 100.006 13.958 98.399 12.979 97.236 12.269 95.251 12.208 94.326 12.858Z`})]})}function lD(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M-8.572-25.123C-21.412-23.39-33.235-17.39-44.235-7.027-51.235-.433-51.251 .358-44.524 6.749-20.77 29.316 10.23 31.893 36.364 13.487 41.043 10.187 48.193 3.551 49.235 1.524 50.358-.642 49.471-2.102 43.738-7.497 29.257-21.128 9.968-27.631-8.572-25.123Z`}),(0,F.jsx)(`path`,{style:{fill:oD.ink},d:`M-6.225-16.807C-17.727-13.267-21.176 4.433-12.08 13.257-1.118 23.898 16.829 16.102 17.032 .604 17.209-12.412 6.219-20.642-6.225-16.807Z`})]})}function Hpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{style:{fill:oD.mint},d:`M540 342C520 340 497 355 477 374C450 399 440 421 456 444C465 458 480 462 492 464C503 466 500 477 494 486C487 500 508 496 522 478L530 468C557 468 578 464 591 451C601 442 599 429 585 427C572 425 556 432 547 418C538 403 550 390 568 385C579 382 589 380 584 368C576 352 557 341 540 342Z`}),(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M589 396C614 380 659 381 683 392C709 404 721 428 710 451C704 464 693 472 685 479C680 487 684 498 689 503C695 514 684 513 675 507C667 502 662 497 657 491C637 496 610 495 594 486C584 480 583 469 595 464C607 460 622 454 622 441C622 428 612 423 597 420C580 417 578 407 589 396Z`})]})}function uD({fill:e}){return(0,F.jsx)(`path`,{style:{fill:e},d:`M44.648 .288C26.645 1.615 13.263 8.266 5.942 19.529-4.299 35.277-.917 57.684 13.224 67.784 16.958 70.452 16.936 71.742 13.064 77.665 11.28 80.391 10.895 81.565 11.341 82.914 13.163 88.435 25.022 86.396 36.307 78.62L38.681 76.986 41.294 77.335C45.371 77.878 59.645 77.789 64.125 77.191 89.213 73.837 100.562 61.427 99.92 38.044 99.18 11.1 79.587-2.285 44.648 .288Z`})}function dD({onFigure:e=!1}){return(0,F.jsxs)(`g`,{style:{fill:e?zpe:oD.ink},children:[(0,F.jsx)(`rect`,{x:`-15`,y:`-11`,width:`10`,height:`22`,rx:`5`}),(0,F.jsx)(`rect`,{x:`5`,y:`-11`,width:`10`,height:`22`,rx:`5`})]})}function Upe(){return(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M18.125 .621C.039 1.574-2.575 4.791 2.264 20.133 17.454 68.284 77.345 69.396 96.119 21.875 100.749 10.154 100.318 4.348 94.605 1.513 91.981 .21 37.878-.421 18.125 .621Z`})}function Wpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M31.42 5.279C29.108 5.983 28.068 6.993 25.817 10.732 24.033 13.687 24.027 13.762 25.58 14.265 30.375 15.821 36.711 20.506 39.938 24.885 42.077 27.788 41.835 27.806 45.281 24.463 48.633 21.213 49.164 20.185 48.982 17.325 48.812 14.643 48.174 13.872 42.68 9.741 36.737 5.273 34.439 4.361 31.42 5.279Z`}),(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M22.538 16.207C22.093 16.652 19.732 20.231 13.309 30.196 10.737 34.188 10.723 33.911 13.589 35.351 16.461 36.798 19.778 39.28 21.825 41.523L22.6 42.37Q23.34 43.186 24.05 42.538L24.711 41.933C31.278 35.937 38.928 28.484 38.928 28.083 38.928 24.656 24.521 14.219 22.538 16.207Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M8.89 38.053C8.203 39.566 6.598 44.473 6.598 45.056 6.598 45.137 6.887 45.125 7.236 45.036 9.655 44.404 13.526 47.475 13.526 50.027 13.526 51.132 13.361 51.164 16.187 49.49 21.421 46.387 21.966 45.665 20.575 43.659 19.002 41.387 14.975 38.238 11.909 36.881 9.799 35.949 9.854 35.926 8.89 38.053Z`}),(0,F.jsx)(`path`,{style:{fill:oD.graphite},d:`M6.598 45.056C5.732 46.866 5.155 49.464 6.309 50.907 8.041 53.505 10.928 52.639 13.526 50.907 13.526 48.021 9.978 44.404 7.236 45.036Z`})]})}function Gpe(){return(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M40.804 40.625C38.238 41.462 37.291 41.953 31.169 45.625 15.743 54.871 8.047 56.158 5.879 49.856 5.501 48.754 5.501 48.754 4.843 50.913 1.673 61.302 12.377 61.671 30.386 51.796 39.649 46.719 41.142 46.647 40.81 51.291 40.565 54.775 41.168 56.135 43.486 57.31 49.556 60.387 62.035 54.816 59.605 50.116 58.502 47.983 56.1 47.882 52.163 49.799 47.082 52.273 45.983 51.652 47.998 47.449 50.89 41.416 47.686 38.376 40.804 40.625Z`})}function fD({transform:e}){return(0,F.jsx)(`path`,{style:{fill:oD.mint},transform:e,d:`M0 0C3 -2 5 -5 5 -8 5 -10.5 3 -12 0 -12S-5 -10.5 -5 -8C-5 -5 -3 -2 0 0Z`})}function Kpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{fillRule:`evenodd`,style:{fill:sD},d:`M25.3 17.69C14.8 19.34 10.66 20.18 9.05 20.99 5.51 22.78 4.2 27.21 6.71 28.9 7.47 29.42 8.48 29.4 10.25 28.84 12.41 28.15 12.56 27.57 11.02 25.85 10 24.71 10.53 23.62 11.79 24.27 13.9 25.36 15.02 28.98 15.63 36.66 16.18 43.48 17.33 47.43 19.69 50.49 22.76 54.48 27.69 55.73 30.31 53.19 33 50.57 31.24 46.04 28.44 48.38 26.29 50.17 26.16 47.08 28.3 45.14 29.61 43.95 30.78 43.58 38.92 41.75 39.45 41.63 39.41 41.52 38.39 40.01 36.87 37.78 36.04 35.22 34.72 28.69 33.37 22 32.04 19.3 29.5 18.07 28.69 17.68 26.59 17.49 25.3 17.69M24.11 26.51C18.61 27.67 18.16 27.82 17.98 28.55 17.64 29.91 18.54 30.44 20.51 30.05 25.4 29.08 30.11 28.03 30.49 27.83 31.65 27.23 31 25.33 29.66 25.4 29.5 25.4 27 25.91 24.11 26.51M29.2 31.42C28.64 31.54 26.23 32.07 23.85 32.58 20.01 33.41 19.48 33.57 19.15 33.96 18.67 34.5 18.66 35.05 19.12 35.63 19.61 36.26 19.86 36.23 26.05 34.88 29.05 34.23 31.53 33.7 31.57 33.7 31.82 33.7 32.34 32.88 32.34 32.5 32.34 31.25 31.37 30.92 29.2 31.42M29.79 37.19C28.81 37.41 26.45 37.94 24.53 38.37 22.62 38.8 20.84 39.23 20.58 39.33 19.61 39.71 19.35 40.62 19.98 41.41 20.48 42.05 21 41.99 27.59 40.5 33.85 39.09 34.21 38.91 33.45 37.44 33.02 36.61 32.51 36.58 29.79 37.19M45.41 41.95C44.89 42.09 41.61 42.89 38.12 43.73 30.94 45.45 29.81 45.84 31.05 46.15 33.2 46.69 34.11 50.18 32.77 52.76 32.23 53.79 32.23 54.03 32.76 54.16 33.34 54.31 45.35 51.3 46.72 50.67 50.19 49.06 51.76 45.01 49.79 42.76 48.8 41.64 47.46 41.39 45.41 41.95`}),(0,F.jsx)(`path`,{style:{fill:oD.grape},d:`M48.21 10.15C47.92 10.41 47.5 11.27 46.96 12.74 45.52 16.61 45.24 16.99 43.01 18.15 39.18 20.15 39.05 20.99 42.28 22.73 45.37 24.39 45.68 24.79 47.12 28.95 48.3 32.32 49.28 32.2 50.65 28.52 52.23 24.25 52.26 24.22 55.2 22.56 57.53 21.24 57.79 21 57.79 20.16 57.79 19.49 57.55 19.31 55.01 18.06 52.16 16.66 52.2 16.72 50.31 11.56 49.7 9.89 49.03 9.44 48.21 10.15M32.59 13.92C31.78 14.73 32.28 15.89 33.58 16.22 35.07 16.6 36.19 17.1 37.17 17.84 38.42 18.77 39.23 18.86 39.79 18.15 39.99 17.9 40.15 17.53 40.15 17.32 40.15 15.29 33.99 12.52 32.59 13.92M42.48 34.38C40.96 35.96 40.65 36.88 41.39 37.57 42.2 38.33 43.36 37.74 44.55 35.95 45.2 34.97 45.22 34.35 44.62 33.88 43.89 33.31 43.41 33.42 42.48 34.38`}),(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M40.75 25.96C39.69 27.07 38.11 30.69 38.11 31.98 38.11 32.66 38.55 33.19 39.12 33.19 39.8 33.19 40.24 32.73 40.58 31.66 40.95 30.46 41.65 29.09 42.42 28.01 43.77 26.14 42.29 24.32 40.75 25.96M54.85 27.67C54.71 27.81 54.47 28.32 54.31 28.82 53.67 30.76 53.19 31.37 51.67 32.13 50.25 32.85 50.34 33.36 52.04 34.21 53.25 34.82 53.57 35.23 54.24 37.01 54.98 38.98 55.47 39.08 56.03 37.37 56.7 35.32 57.08 34.81 58.64 33.87 60.18 32.95 60.14 32.65 58.38 31.78 57.02 31.11 56.68 30.66 56.02 28.65 55.69 27.64 55.25 27.27 54.85 27.67`})]})}function qpe(){return(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`path`,{fillRule:`evenodd`,style:{fill:sD},d:`M42.24 14.07C41.52 14.24 40.53 14.54 35.06 16.26 33.33 16.8 31.2 17.47 30.34 17.74 29.47 18.01 27.86 18.52 26.75 18.88 25.64 19.23 24.03 19.74 23.16 20.01 20.16 20.94 19.45 21.4 18.97 22.71 18.71 23.44 18.45 26.33 17.83 35.41 17.64 38.25 17.44 41.03 17.41 41.58 17.32 42.77 17.24 42.69 18.79 42.84L20.01 42.95 21.98 39.97C24.69 35.88 24.85 35.82 27.05 37.9 27.9 38.7 28.43 39.08 28.61 39.02 28.76 38.96 28.91 38.91 28.94 38.91 28.98 38.91 29.38 38.38 29.84 37.73 30.3 37.08 31.47 35.48 32.43 34.17 33.4 32.86 34.86 30.85 35.67 29.71 36.49 28.56 37.5 27.29 37.91 26.88 39.73 25.07 41.01 26.43 43.32 32.67 43.76 33.84 44.3 35.28 44.52 35.86 44.74 36.44 44.97 37.28 45.04 37.74 45.19 38.71 45.17 38.71 46.63 38.03 47.69 37.53 47.77 37.46 47.68 37.02 47.58 36.52 46.97 30.64 46.79 28.41 46.73 27.69 46.62 26.43 46.53 25.61 46.44 24.79 46.24 22.87 46.09 21.32 45.61 16.44 45.5 15.66 45.22 15.12 44.72 14.15 43.59 13.76 42.24 14.07M29.38 22.45C26.04 23.47 24.49 27.62 26.6 29.91 29.17 32.7 34.15 30.16 34.16 26.05 34.16 23.38 31.9 21.68 29.38 22.45M46.7 41.5C39.3 44.23 28.33 46.04 20.1 45.88L17.21 45.82 17.16 46.88C17.08 48.22 17.33 49.03 18.01 49.68 18.73 50.37 19.73 50.35 23.77 49.53 25.46 49.19 29.12 48.47 31.91 47.93 46.31 45.14 46.9 44.99 47.57 43.91 47.95 43.3 48.25 41.29 47.99 41.15 47.91 41.11 47.33 41.26 46.7 41.5`}),(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M29.72 22.45C25.84 23.34 24.28 28.36 27.25 30.42 29.34 31.88 32.91 30.43 33.83 27.75 34.92 24.55 32.75 21.76 29.72 22.45`}),(0,F.jsx)(`path`,{style:{fill:oD.mint},d:`M12.96 14.29C12.87 14.41 12.7 15.03 12.58 15.68 12.37 16.82 11.59 18.26 11.18 18.26 11.08 18.26 10.88 18.46 10.72 18.7 10.36 19.25 10.59 19.58 11.45 19.74 12.18 19.88 13.08 20.63 13.54 21.49 14.23 22.76 14.75 22.53 15.15 20.79 15.39 19.71 15.51 19.51 16.4 18.66 17.54 17.58 17.51 17.36 16.18 16.85 15.16 16.47 14.84 16.19 14.14 15.1 13.56 14.2 13.22 13.96 12.96 14.29M49.04 24.13C48.56 24.86 48.91 25.31 50.59 26.09 53.89 27.64 54.85 29.82 53.45 32.6 52.01 35.43 46.84 38.54 40.51 40.39 39.73 40.62 38.88 40.89 38.62 40.99 37.24 41.52 30.85 42.64 27.54 42.93 20.72 43.52 13.63 42.49 10.57 40.46 5.81 37.3 7.51 32.32 14.74 28.24 15.84 27.61 16.17 27.1 15.9 26.4 15.66 25.78 15.35 25.84 13.19 26.94 6 30.61 2.97 35.32 4.95 39.74 7.86 46.21 22.78 47.8 40.05 43.46 51.97 40.47 58.57 36.38 59.47 31.43 60.09 27.97 57.74 25.34 52.93 24.12 50.6 23.53 49.43 23.54 49.04 24.13`}),(0,F.jsx)(`path`,{style:{fill:oD.grape},d:`M34.82 8.91C33.48 10.04 34.21 12.14 35.94 12.14 37.29 12.14 38.18 10.99 37.77 9.77 37.36 8.53 35.81 8.08 34.82 8.91M53.15 43.16C53 43.28 52.74 43.86 52.57 44.45 52.18 45.78 51.76 46.32 50.64 46.93 49.52 47.53 49.45 47.89 50.33 48.34 51.34 48.85 52.24 49.95 52.56 51.04 53.13 53.01 53.6 53 54.21 50.99 54.61 49.69 55.13 48.93 55.91 48.54 57.17 47.91 57.23 47.51 56.15 46.96 55.23 46.49 54.67 45.76 54.23 44.44 53.8 43.15 53.54 42.84 53.15 43.16M24.18 53.18C22.45 53.9 22.87 56.59 24.71 56.59 26.79 56.59 27.2 53.67 25.2 53.09 24.89 53.01 24.51 53.04 24.18 53.18`}),(0,F.jsx)(`path`,{style:{fill:oD.yellow},d:`M51.76 11.04C51.21 12.77 50.56 13.61 49.24 14.34 48.6 14.69 48.72 15.07 49.59 15.48 50.54 15.93 51.11 16.69 51.62 18.22 52.06 19.57 52.26 19.54 52.79 18.08 53.29 16.69 53.87 15.91 54.86 15.31 55.76 14.77 55.77 14.48 54.92 14.02 53.91 13.46 53.5 12.99 52.89 11.66 52.23 10.21 52.06 10.12 51.76 11.04M11.06 48.22C10.99 48.35 10.71 48.88 10.46 49.41 9.95 50.48 9.45 50.99 8.59 51.33 7.89 51.61 7.85 52.1 8.52 52.37 9.51 52.79 10.3 53.85 10.89 55.58 11.09 56.18 11.48 55.88 11.87 54.84 12.24 53.87 13.33 52.56 13.79 52.56 14 52.56 14.5 52.06 14.5 51.85 14.5 51.77 14.19 51.54 13.81 51.34 12.98 50.92 12.36 50.14 11.93 48.99 11.6 48.09 11.31 47.83 11.06 48.22`})]})}function Jpe(){return(0,F.jsxs)(`g`,{transform:`translate(2 8) scale(.114) translate(-125 -122)`,children:[(0,F.jsx)(`path`,{style:{fill:oD.coral},d:`M278 155 482 123C517 117 527 135 530 167L542 309Q543 329 561 341L631 404Q649 419 646 444 645 465 623 472L407 521Q374 531 345 519L156 436Q115 418 128 375L221 191Q238 163 278 155Z`}),(0,F.jsx)(`path`,{style:{fill:oD.ink},d:`M317 183 461 161Q493 155 497 188L504 288Q508 320 478 326L318 356Q289 362 286 331L281 226Q278 194 317 183Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M304 386 553 340Q562 337 570 346L631 404Q649 419 646 444Q645 448 629 452L411 483Q382 492 367 474Z`}),(0,F.jsxs)(`g`,{style:{fill:oD.cream},children:[(0,F.jsx)(`rect`,{x:`319`,y:`236`,width:`26`,height:`59`,rx:`13`}),(0,F.jsx)(`rect`,{x:`364`,y:`229`,width:`26`,height:`59`,rx:`13`})]}),(0,F.jsxs)(`g`,{style:{fill:oD.ink},transform:`rotate(-11 470 411)`,children:[(0,F.jsx)(`rect`,{x:`369`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`444`,y:`380`,width:`61`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`518`,y:`380`,width:`57`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`392`,y:`421`,width:`58`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`462`,y:`421`,width:`65`,height:`25`,rx:`13`}),(0,F.jsx)(`rect`,{x:`539`,y:`421`,width:`58`,height:`25`,rx:`13`})]})]})}function Ype(){return(0,F.jsxs)(`g`,{transform:`translate(3 10) scale(.114) translate(-760 -140)`,children:[(0,F.jsx)(`path`,{style:{fill:oD.blue},d:`M1226 153C1257 153 1273 195 1267 231Q1263 265 1237 268L1176 270V215C1176 178 1195 153 1226 153Z`}),(0,F.jsx)(`path`,{style:{fill:oD.blue},d:`M824 376Q908 372 871 400C842 427 866 442 902 450L1113 480Q1188 479 1199 392C1207 447 1204 497 1163 511Q1134 521 1097 516C1055 510 991 507 957 507S869 511 826 512C781 513 758 483 760 441Q760 385 824 376Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M824 376 857 184Q864 133 911 141C1039 169 1124 151 1226 153Q1179 159 1184 241L1199 377C1202 434 1174 482 1117 480L902 450C864 445 849 429 871 400Q908 372 824 376Z`}),(0,F.jsxs)(`g`,{style:{fill:oD.coral},children:[(0,F.jsx)(`path`,{d:`M982 198C1008 190 1030 197 1028 220L1023 265Q1020 295 1000 279C981 261 951 223 963 210Q970 202 982 198Z`}),(0,F.jsx)(`path`,{d:`M1063 220C1077 215 1100 237 1102 251Q1107 267 1084 282L1063 295Q1037 307 1040 278L1045 245Q1049 224 1063 220Z`}),(0,F.jsx)(`path`,{d:`M911 252C925 240 939 254 957 269L978 291Q995 311 961 316C938 318 907 316 898 308Q884 296 911 252Z`}),(0,F.jsx)(`path`,{d:`M1106 289Q1127 281 1134 304C1142 327 1146 352 1125 350Q1097 348 1073 335C1051 324 1072 311 1084 302Z`}),(0,F.jsx)(`path`,{d:`M927 338C946 334 972 334 985 343Q1004 353 984 384C970 408 957 418 940 403C922 389 896 356 913 345Z`}),(0,F.jsx)(`path`,{d:`M1010 375Q1025 363 1037 384C1049 407 1064 438 1044 442Q1025 448 1002 436C984 428 991 410 997 393Z`}),(0,F.jsx)(`path`,{d:`M1068 357C1084 359 1110 376 1120 389Q1130 402 1107 419C1090 432 1082 418 1073 401C1062 383 1043 355 1068 357Z`}),(0,F.jsx)(`path`,{d:`M1018 311C1037 312 1050 334 1034 343C1018 351 998 337 1005 320Q1009 311 1018 311Z`})]})]})}function Xpe(){return(0,F.jsxs)(`g`,{transform:`translate(2 7) scale(.11) translate(-1380 -96)`,children:[(0,F.jsx)(`path`,{style:{fill:oD.inkcap},d:`M1384 276C1394 238 1445 200 1497 158C1547 119 1604 97 1647 97C1690 97 1720 109 1745 138C1772 170 1791 184 1833 194C1870 201 1919 220 1922 257C1923 307 1891 339 1853 336C1801 335 1767 299 1701 294C1666 291 1620 294 1642 303Q1670 307 1675 333C1681 367 1697 389 1717 413C1735 434 1738 443 1719 464C1700 485 1692 502 1686 520Q1682 541 1653 541L1626 541Q1598 541 1594 519C1590 495 1578 474 1563 458C1545 440 1544 429 1559 410C1585 377 1608 337 1572 326C1554 320 1529 333 1506 340C1461 356 1428 357 1402 340Q1371 319 1384 276Z`}),(0,F.jsx)(`path`,{style:{fill:oD.cream},d:`M1634 362Q1641 346 1649 362C1660 390 1676 404 1705 424Q1721 435 1704 453C1685 475 1677 490 1671 513Q1670 526 1653 525L1626 525Q1611 525 1610 513C1606 492 1592 465 1575 449Q1562 437 1577 424C1604 404 1620 390 1634 362Z`}),(0,F.jsx)(`path`,{style:{fill:oD.inkcap},d:`M1634 456A18 18 0 1 1 1648 456V492Q1648 500 1641 500T1634 492Z`}),(0,F.jsx)(`path`,{style:{fill:oD.inkcap},d:`M1780 391Q1786 386 1793 396C1810 420 1828 444 1827 467C1826 508 1768 510 1753 480C1741 456 1762 413 1780 391Z`})]})}var{coral:pD,blue:mD,mint:hD,grape:gD,yellow:_D,cream:vD,ink:yD}=oD,Zpe={bonsai:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,stroke:hD,strokeWidth:`3.7`,strokeLinecap:`round`,d:`M35 27.5C36 25 35.5 22.5 34 21S31.5 17.5 31.5 14M36 27C40 26.8 43 26 45 24S47 20.5 47.5 18.5M30.5 31C32.5 26.5 30.5 24.6 26.5 24 22 23.5 18.5 21.6 16.8 18.5M29 37C26.5 34.5 25 33.7 21.5 33.2S15.5 32 13 31.6M36 39.5C38 38 40 37.5 42 36.5S47 34 51 32.2`}),(0,F.jsx)(`path`,{fill:hD,d:`M25.5 43.5C28 40.5 28 37 27.5 33 27.3 29.5 29.5 27 33.5 26.3L37.5 26V29.5C35 29.8 34.2 31.5 34.3 34 34.5 37.5 37 39.5 41 43.5Z`}),(0,F.jsx)(`circle`,{fill:mD,cx:`31.5`,cy:`10.7`,r:`4.8`}),(0,F.jsx)(`circle`,{fill:gD,cx:`16.6`,cy:`18.3`,r:`4.6`}),(0,F.jsx)(`circle`,{fill:_D,cx:`47.9`,cy:`17.7`,r:`4.6`}),(0,F.jsx)(`circle`,{fill:_D,cx:`12.8`,cy:`31.5`,r:`4.6`}),(0,F.jsx)(`circle`,{fill:mD,cx:`50.9`,cy:`32.1`,r:`4.6`}),(0,F.jsx)(`path`,{fill:pD,d:`M16 46H47.5C47.5 54 44 58 38 58H25.5C19.5 58 16 54 16 46Z`}),(0,F.jsx)(`rect`,{fill:pD,x:`14`,y:`43`,width:`35.5`,height:`4.6`,rx:`2.3`})]}),computer:(0,F.jsx)(Jpe,{}),prints:(0,F.jsx)(Ype,{}),inkcap:(0,F.jsx)(Xpe,{}),vishnu:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{fill:pD},d:`M6 37C6 21 17.5 9 32 9s26 12 26 28c0 2.2-1.8 4-4 4H10c-2.2 0-4-1.8-4-4Z`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`19`,cy:`25`,r:`4`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`33`,cy:`19.5`,r:`4.8`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`46`,cy:`28`,r:`3.4`}),(0,F.jsx)(`rect`,{style:{fill:mD},x:`13`,y:`39`,width:`38`,height:`18`,rx:`9`}),(0,F.jsx)(`rect`,{style:{fill:vD},x:`18.5`,y:`46.2`,width:`10`,height:`3.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{style:{fill:vD},x:`21.7`,y:`43`,width:`3.6`,height:`10`,rx:`1.8`}),(0,F.jsx)(`circle`,{style:{fill:_D},cx:`39`,cy:`50.5`,r:`2.7`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`45`,cy:`45.5`,r:`2.7`})]}),generateText:(0,F.jsx)(Kpe,{}),generateMedia:(0,F.jsx)(qpe,{}),buyApps:(0,F.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,F.jsx)(`circle`,{fill:_D,cx:`32`,cy:`20`,r:`12`}),(0,F.jsx)(`circle`,{stroke:vD,strokeWidth:`4`,cx:`32`,cy:`20`,r:`6`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(15.5 12) rotate(-60) scale(1.1 .85)`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(48.5 12) rotate(60) scale(1.1 .85)`}),(0,F.jsx)(`path`,{fill:mD,d:`M10 35H54L50 53Q49 58 44 58H20Q15 58 14 53Z`}),(0,F.jsx)(`rect`,{fill:pD,x:`5`,y:`27`,width:`54`,height:`10`,rx:`5`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`rect`,{x:`20`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,F.jsx)(`rect`,{x:`29.5`,y:`41`,width:`5`,height:`11`,rx:`2.5`}),(0,F.jsx)(`rect`,{x:`39`,y:`41`,width:`5`,height:`11`,rx:`2.5`})]})]}),browseBazaar:(0,F.jsxs)(`g`,{transform:`rotate(-5 32 32)`,children:[(0,F.jsx)(`rect`,{fill:mD,x:`10`,y:`14`,width:`44`,height:`38`,rx:`6`}),(0,F.jsx)(`rect`,{fill:mD,x:`5`,y:`47`,width:`54`,height:`12`,rx:`6`}),(0,F.jsx)(`rect`,{fill:vD,x:`12`,y:`50.5`,width:`40`,height:`4.5`,rx:`2.25`}),(0,F.jsx)(`rect`,{fill:pD,x:`2`,y:`4`,width:`60`,height:`9`,rx:`4.5`}),(0,F.jsx)(`path`,{fill:pD,d:`M3 9H14.6V18A5.8 5.8 0 0 1 3 18Z`}),(0,F.jsx)(`path`,{fill:vD,d:`M14.6 9H26.2V18A5.8 5.8 0 0 1 14.6 18Z`}),(0,F.jsx)(`path`,{fill:pD,d:`M26.2 9H37.8V18A5.8 5.8 0 0 1 26.2 18Z`}),(0,F.jsx)(`path`,{fill:vD,d:`M37.8 9H49.4V18A5.8 5.8 0 0 1 37.8 18Z`}),(0,F.jsx)(`path`,{fill:pD,d:`M49.4 9H61V18A5.8 5.8 0 0 1 49.4 18Z`}),(0,F.jsx)(`g`,{transform:`translate(32 36.5) scale(.34)`,children:(0,F.jsx)(lD,{})})]}),agent:(0,F.jsxs)(`g`,{transform:`translate(32 33) scale(2.02) translate(-47.2 -41.8)`,children:[(0,F.jsx)(`path`,{fill:mD,d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,F.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,F.jsx)(dD,{})})]}),list:(0,F.jsxs)(`g`,{transform:`rotate(-7 32 32)`,children:[(0,F.jsx)(`path`,{style:{fill:mD},d:`M12 13Q6 13 6 19V50Q6 57 13 57H47Q53 57 53 50V20Q53 13 47 13Z`}),(0,F.jsx)(`path`,{style:{fill:vD},d:`M19 7H39Q42 7 44 9L55 20Q57 22 57 26V44Q57 50 51 50H19Q13 50 13 44V13Q13 7 19 7Z`}),(0,F.jsx)(`path`,{style:{fill:pD},d:`M39 7V18Q39 24 45 24H57Q57 22 55 20L44 9Q42 7 39 7Z`}),(0,F.jsxs)(`g`,{style:{fill:pD},children:[(0,F.jsx)(`circle`,{cx:`22`,cy:`21`,r:`3`}),(0,F.jsx)(`circle`,{cx:`22`,cy:`31`,r:`3`}),(0,F.jsx)(`circle`,{cx:`22`,cy:`41`,r:`3`})]}),(0,F.jsx)(`path`,{style:{stroke:mD},strokeWidth:`5`,strokeLinecap:`round`,d:`M31 21H32M31 31H46M31 41H42`})]}),chat:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`g`,{transform:`translate(3 11) scale(.22) translate(-449 -327)`,children:(0,F.jsx)(Hpe,{})}),(0,F.jsx)(cD,{transform:`translate(38.2 18) rotate(16) scale(.95 .6)`}),(0,F.jsx)(cD,{transform:`translate(44.4 20.5) rotate(47) scale(.95 .6)`})]}),read:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`g`,{transform:`translate(4 20.5) scale(.56)`,children:(0,F.jsx)(Vpe,{})}),(0,F.jsx)(`g`,{transform:`translate(32 38.6) scale(.3164)`,children:(0,F.jsx)(lD,{})}),(0,F.jsx)(Bpe,{})]}),readConversations:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(.9) translate(-32 -32)`,children:[(0,F.jsx)(`g`,{transform:`translate(4 7.88) scale(.56)`,children:(0,F.jsx)(uD,{fill:mD})}),(0,F.jsx)(`g`,{transform:`translate(32.2 30.3) scale(.352)`,children:(0,F.jsx)(lD,{})})]}),listAgents:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(1.04) translate(-32 -32)`,children:[(0,F.jsx)(`path`,{style:{fill:sD},d:`M32.059 10.146C23.878 10.646 18.949 14.844 18.925 21.331 18.912 24.856 20.167 27.259 22.274 27.74 24.437 28.233 26.097 29.061 27.481 30.337 28.275 31.068 28.328 31.096 29.352 31.306 31.161 31.677 31.653 32.094 32.115 33.651 32.392 34.582 32.557 34.868 32.915 35.041 33.919 35.523 35.864 33.733 36.539 31.706L36.775 30.997 38.008 30.681C42.663 29.489 45.29 26.142 45.468 21.176 45.734 13.784 40.673 9.62 32.059 10.146Z`}),(0,F.jsx)(`g`,{transform:`translate(32.4 21.2) scale(.39)`,children:(0,F.jsx)(dD,{onFigure:!0})}),(0,F.jsx)(`path`,{style:{fill:pD},d:`M14.375 27.586C8.014 28.591 4.363 32.396 4.355 38.027 4.347 43.93 8.071 47.469 15.239 48.368L16.828 48.568 17.873 49.568C19.854 51.464 22.469 52.496 23.691 51.864 24.384 51.506 24.431 51.044 23.924 49.606 23.337 47.943 23.479 47.492 24.749 46.977 32.756 43.73 32.643 31.899 24.573 28.49 22.238 27.504 17.535 27.087 14.375 27.586Z`}),(0,F.jsx)(`g`,{transform:`translate(17.6 37.7) scale(.38 .36)`,children:(0,F.jsx)(dD,{})}),(0,F.jsx)(`path`,{style:{fill:mD},d:`M46.666 29.533C39.623 30.116 34.627 34.849 34.603 40.96 34.585 45.387 36.412 47.971 40.602 49.445 42.036 49.95 42.076 50.049 41.491 51.666 40.968 53.111 41.167 53.761 42.201 53.988 43.463 54.265 46.679 52.293 47.929 50.475 48.134 50.178 48.268 50.13 49.332 49.977 56.938 48.882 60.956 43.889 59.582 37.237 58.622 32.59 53.42 29.07 48.034 29.424 47.904 29.432 47.289 29.482 46.666 29.533Z`}),(0,F.jsx)(`g`,{transform:`translate(47.3 40) scale(.36 .34)`,children:(0,F.jsx)(dD,{})})]}),createAgents:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,F.jsx)(`path`,{style:{fill:sD},d:`M20.436 24.499C13.35 25.216 7.504 28.799 5.442 33.687 3.114 39.208 4.438 45.791 8.593 49.358 10.446 50.949 10.34 50.831 10.34 51.301 10.34 51.796 10.106 52.294 9.281 53.558 7.191 56.76 12.108 56.905 16.701 53.777 17.517 53.221 17.715 53.135 18.015 53.201 20.013 53.639 25.739 53.051 28.595 52.113 35.47 49.857 39.129 44.162 37.83 37.738C37 31 33 26 26.717 24.428L24.075 24.413C22.623 24.405 20.985 24.444 20.436 24.499Z`}),(0,F.jsx)(`g`,{transform:`translate(21.9 40) scale(.46 .43)`,children:(0,F.jsx)(dD,{onFigure:!0})}),(0,F.jsx)(`path`,{style:{fill:hD},d:`M37.987 15.734C32.277 16.627 28.675 20.713 28.92 26.022 29.062 29.118 30.627 31.606 33.331 33.036 34.675 33.747 34.761 34.018 34.237 35.923 33.376 39.051 36.878 38.551 39.174 35.218 39.574 34.637 39.65 34.583 40.058 34.583 46.203 34.583 50.414 30.91 50.424 25.543 50.435 18.989 44.932 14.649 37.987 15.734Z`}),(0,F.jsx)(`g`,{transform:`translate(38.9 24.9) scale(.31)`,children:(0,F.jsx)(dD,{})}),(0,F.jsx)(cD,{fill:_D,transform:`translate(48.1 15.7) rotate(31) scale(1.25 .85)`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(52.2 19.8) rotate(70) scale(1.25 .85)`})]}),sendPrompts:(0,F.jsxs)(`g`,{transform:`translate(32 32) scale(1.08) translate(-32 -32)`,children:[(0,F.jsx)(`g`,{transform:`translate(4 13.2) scale(.412 .436)`,children:(0,F.jsx)(uD,{fill:pD})}),(0,F.jsx)(`g`,{transform:`translate(17.1 28.7) scale(.19)`,children:(0,F.jsx)(Upe,{})}),(0,F.jsx)(cD,{fill:hD,transform:`translate(48.1 26.4) rotate(65) scale(1.7 1.28)`}),(0,F.jsx)(cD,{fill:hD,transform:`translate(48.4 33.8) rotate(110) scale(1.7 1.28)`})]}),write:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Wpe,{}),(0,F.jsx)(Gpe,{})]}),run:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{style:{fill:mD},x:`6`,y:`9`,width:`52`,height:`43`,rx:`7`}),(0,F.jsx)(`path`,{style:{stroke:vD},strokeWidth:`5`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m17 22 9 8-9 8m17 0h12`})]}),stop:(0,F.jsx)(`rect`,{style:{fill:pD},x:`12`,y:`12`,width:`40`,height:`40`,rx:`9`}),connected:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,style:{stroke:mD},strokeWidth:`12`,strokeLinecap:`round`,d:`M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:pD},strokeWidth:`12`,strokeLinecap:`round`,d:`M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10`}),(0,F.jsx)(`path`,{style:{stroke:_D},strokeWidth:`4`,strokeLinecap:`round`,d:`m27 4 2 6m10-5-2 7m12 0-5 4`})]}),working:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ellipse`,{style:{fill:hD},cx:`23`,cy:`14`,rx:`13`,ry:`8`,transform:`rotate(-30 23 14)`}),(0,F.jsx)(`ellipse`,{style:{fill:_D},cx:`48`,cy:`36`,rx:`13`,ry:`8`,transform:`rotate(35 48 36)`}),(0,F.jsx)(`ellipse`,{style:{fill:gD},cx:`22`,cy:`48`,rx:`13`,ry:`8`,transform:`rotate(45 22 48)`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:sD},strokeWidth:`3`,strokeLinecap:`round`,d:`M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17`})]}),complete:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{fill:hD},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:yD},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m23 29 7 7 13-15`}),(0,F.jsx)(`path`,{style:{stroke:sD},strokeWidth:`3`,strokeLinecap:`round`,d:`m4 8 5 6m48-4 5-5M2 24l6 1`})]}),installApps:(0,F.jsxs)(`g`,{transform:`rotate(-6 32 32)`,children:[(0,F.jsx)(`rect`,{style:{fill:mD},x:`9`,y:`26`,width:`46`,height:`32`,rx:`10`}),(0,F.jsx)(`rect`,{style:{fill:vD},x:`17`,y:`33`,width:`30`,height:`18`,rx:`5`}),(0,F.jsx)(`path`,{style:{fill:hD},d:`M22 38h8v8h-8z`}),(0,F.jsx)(`path`,{style:{fill:gD},d:`M34 38h8v8h-8z`}),(0,F.jsx)(`path`,{style:{stroke:pD},strokeWidth:`6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M32 4v17m-8-7 8 8 8-8`})]}),restricted:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,style:{stroke:pD},strokeWidth:`9`,strokeLinecap:`round`,d:`M16 23V19q0-17 16-17t16 17v4`}),(0,F.jsx)(`rect`,{style:{fill:pD},x:`8`,y:`26`,width:`48`,height:`36`,rx:`9`}),(0,F.jsx)(`path`,{style:{fill:vD},d:`M32 34a7 7 0 0 0-4 13v7h8v-7a7 7 0 0 0-4-13Z`})]}),error:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{fill:pD},d:`M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z`}),(0,F.jsx)(`path`,{fill:`none`,style:{stroke:vD},strokeWidth:`7`,strokeLinecap:`round`,d:`M32 18v15`}),(0,F.jsx)(`circle`,{style:{fill:vD},cx:`32`,cy:`45`,r:`4`})]}),trellis:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`g`,{fill:_D,children:[(0,F.jsx)(`rect`,{x:`17.25`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,F.jsx)(`rect`,{x:`42.95`,y:`9`,width:`3.9`,height:`49.2`,rx:`1.95`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`18`,width:`3.2`,height:`26`}),(0,F.jsx)(`rect`,{x:`14.8`,y:`15.75`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,F.jsx)(`rect`,{x:`14.8`,y:`28.85`,width:`34.4`,height:`3.1`,rx:`1.55`}),(0,F.jsx)(`rect`,{x:`14.8`,y:`42.55`,width:`34.4`,height:`3.1`,rx:`1.55`})]}),(0,F.jsx)(`path`,{fill:`none`,stroke:hD,strokeWidth:`3`,strokeLinecap:`round`,d:`M21.9 56.1C31.5 54.4 32.9 47 32.1 45.8`}),(0,F.jsx)(`path`,{fill:`none`,stroke:hD,strokeWidth:`3`,strokeLinecap:`round`,d:`M32 44.2C28.7 41.8 25.2 35.7 32 32.3 38.8 28 38.9 24 31.9 18.8 32.4 16.3 32.8 14.7 34.5 12.2`}),(0,F.jsx)(fD,{transform:`translate(32.1 14.1) rotate(45) scale(0.45 0.86)`}),(0,F.jsx)(fD,{transform:`translate(32.2 14.7) rotate(-60) scale(0.42 0.58)`}),(0,F.jsx)(fD,{transform:`translate(34.8 28.3) rotate(65) scale(0.38 0.8)`}),(0,F.jsx)(fD,{transform:`translate(28.2 33.1) rotate(-51) scale(0.5 0.57)`}),(0,F.jsx)(fD,{transform:`translate(28.6 53.3) rotate(-48) scale(0.47 0.6)`}),(0,F.jsx)(`circle`,{fill:pD,cx:`31.9`,cy:`18.8`,r:`4`}),(0,F.jsx)(`circle`,{fill:mD,cx:`32`,cy:`32.3`,r:`4`}),(0,F.jsx)(`circle`,{fill:gD,cx:`32`,cy:`44.2`,r:`4`})]}),games:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:mD,d:`M18.5 28.5H45.5C49.5 29.5 53 32 54 35 55 37.5 56.8 45.5 56.6 48 56.5 53 52.5 57.5 47 58H15C9.5 56.5 6.6 51 7.6 45.5 8.6 39.5 9.3 35 10.5 33 12 31 14.5 29.5 18.5 28.5Z`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`26.8`,cy:`37.9`,rx:`9.1`,ry:`5.6`}),(0,F.jsx)(`ellipse`,{fill:yD,cx:`27`,cy:`37.6`,rx:`4.7`,ry:`2.2`}),(0,F.jsx)(`path`,{fill:yD,d:`M23.1 26V35.4A4 4.2 0 0 0 31.1 35.4V26Z`}),(0,F.jsx)(`circle`,{fill:pD,cx:`27.1`,cy:`18.3`,r:`12.4`}),(0,F.jsx)(`circle`,{fill:vD,cx:`22.6`,cy:`14.3`,r:`3.05`}),(0,F.jsx)(`ellipse`,{fill:_D,cx:`45.1`,cy:`37.2`,rx:`5.6`,ry:`3.95`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`40.1`,cy:`46.6`,rx:`6.2`,ry:`4.4`})]}),oyster:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:gD,d:`M35.5 6C33.7 6.3 32.3 7.6 31.4 9.4 30.9 10.3 30.4 10.3 29.5 10 25.5 9 20.6 11.6 19.6 15.9 19.4 16.6 19 17 18 17.1 14.5 17.6 12 20.6 12.1 24.2 12.2 25.4 12 25.9 11.5 26.5 7.5 30 10.5 34.5 17.5 34.4 15.3 32.6 16 31 19 29 26 24 37 19.5 43.5 19 46 19 46 22 43 25.5 46.5 23.5 51.5 18.5 53.5 15 55 11 50 7 45 9 43.8 9.4 43.3 9.2 42.5 8 40.7 6.3 38 5.6 35.5 6Z`}),(0,F.jsx)(`circle`,{fill:vD,cx:`34.9`,cy:`41.9`,r:`11.3`}),(0,F.jsxs)(`g`,{fill:yD,children:[(0,F.jsx)(`rect`,{x:`29.9`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`}),(0,F.jsx)(`rect`,{x:`36.7`,y:`33.2`,width:`3.2`,height:`5.6`,rx:`1.6`})]}),(0,F.jsx)(`path`,{fill:gD,d:`M49.5 39C47.9 39.3 46.5 40 46.1 41.6 45.8 43.2 45.5 43.5 44 43.5 38.5 43.5 35 48 39 49.5 40 50 39.5 50.5 38 51 35.5 52.5 32.5 52 30 51 29 50.5 28.5 50 29.5 50 33 47.5 30 43.5 24.5 43.5 23.3 43.5 22.9 43.3 22.5 43 20.5 40.5 19 40 17.5 39.5 13 39.5 13 44 17 47.5 18.3 48.4 18.6 48.7 19 49.5 20.5 53 23 55 26 55 26.8 55 27 55.3 27.5 56 31 58.5 36.5 58.5 40 56 40.8 55.2 41.2 55 42 55 45 55 47.5 53 49 49.5 49.6 48.5 50 48 50.5 47.5 56 43.5 55 38.5 49.5 39Z`}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`3`,strokeLinecap:`round`,d:`M46.6 31.8 49.2 27.8 M49.4 35.5 52.8 33.7 M21.5 32.5 22.9 33.5 M19.3 37.5 21.1 38.1`})]}),tourtois:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:vD,x:`11.07`,y:`35.73`,width:`26.8`,height:`9.7`,rx:`3.25`,transform:`rotate(-5 24.47 40.58)`}),(0,F.jsx)(`path`,{fill:_D,d:`M14.8 16C19 14.6 23 13.5 26.5 12.6 28.4 12.1 29.6 13.4 30.1 15.3L31.6 21 17.4 37.6C13.8 38.2 10.6 37.8 10.1 35.4L9.2 27.8C9.1 26.1 10.1 24.7 11.6 24.1 11.4 22.4 11.4 20.6 11.8 19.1 12.3 17.4 13.3 16.5 14.8 16Z`}),(0,F.jsx)(`path`,{fill:pD,d:`M14.0 24.1Q13.3 21.2 16.2 20.4L30.7 16.2Q33.6 15.4 34.6 18.2L36.0 22.7Q37.0 25.5 34.7 27.4L20.2 39.7Q17.9 41.6 17.2 38.7Z`}),(0,F.jsx)(`path`,{fill:mD,d:`M21 23.4 35.5 20.6C37.3 20.2 38.6 21 38.9 22.6L40 34.5C40.1 36.2 39.1 37.3 37.5 37.7 32.6 39.9 26 41 21 41 16 41 12.2 40.2 11 38.8 10.4 37.6 10.8 36.4 12.4 37L19.6 38.4 18.4 27C18.2 25.2 19.3 23.7 21 23.4Z`}),(0,F.jsx)(`path`,{fill:vD,d:`M22.8 29.6 34.8 26.9C36.2 26.6 37 27.3 37.2 28.6L37.9 33C38.1 34.2 37.5 35 36.3 35.3L24.3 37.8C23 38.1 22.3 37.5 22.1 36.3L21.3 31.6C21.1 30.6 21.7 29.8 22.8 29.6Z`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`circle`,{cx:`14.7`,cy:`18.45`,r:`1`}),(0,F.jsx)(`circle`,{cx:`17.6`,cy:`17.65`,r:`1`}),(0,F.jsx)(`circle`,{cx:`20.5`,cy:`16.85`,r:`1`}),(0,F.jsx)(`circle`,{cx:`17.9`,cy:`22.2`,r:`1`}),(0,F.jsx)(`circle`,{cx:`21`,cy:`21.5`,r:`1`}),(0,F.jsx)(`circle`,{cx:`24.1`,cy:`20.75`,r:`1`}),(0,F.jsx)(`circle`,{cx:`28.2`,cy:`25.3`,r:`1`})]}),(0,F.jsx)(`circle`,{fill:pD,cx:`21.7`,cy:`26.6`,r:`1`}),(0,F.jsx)(`circle`,{fill:_D,cx:`24.9`,cy:`25.9`,r:`1.05`}),(0,F.jsxs)(`g`,{fill:hD,children:[(0,F.jsx)(`ellipse`,{cx:`8.8`,cy:`36.6`,rx:`3.6`,ry:`1.9`,transform:`rotate(22 8.8 36.6)`}),(0,F.jsx)(`path`,{d:`M12 41C10 41.5 7.5 44.5 7 46.5 7 48 8.5 49.5 10.5 50 12.5 50.5 13.5 50 15 48 15.5 47 16.5 47.5 19 50 22 49.5 22 46.5 22 45.5 20.5 45.5 17 45 16.5 44.5 16.5 44 16.5 42 13.5 40.5L12 41Z`}),(0,F.jsx)(`path`,{d:`M40 33C39 38 36 42 34.5 41.5 32.5 40.5 29.5 42 28.5 44 26 49 27.5 51.5 32.5 51 36 51 37 50 36 46.5 36 45 37 44.5 38 44.5 38.5 45.5 40.5 49 43.5 50 46.5 47.5 47.5 46.5 46 43.5 44 42 43 41.5 43.5 40.5 44.5 39.5 46 38 47 37.5L47 33Z`})]}),(0,F.jsx)(`ellipse`,{fill:hD,cx:`46.4`,cy:`30.6`,rx:`8.1`,ry:`8.3`}),(0,F.jsxs)(`g`,{fill:yD,children:[(0,F.jsx)(`rect`,{x:`45.05`,y:`26.95`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 46.2 29.3)`}),(0,F.jsx)(`rect`,{x:`49.25`,y:`26.4`,width:`2.25`,height:`4.6`,rx:`1.1`,transform:`rotate(-6 50.4 28.7)`})]}),(0,F.jsx)(`path`,{fill:pD,d:`M46.8 32.2H51C51 34.3 50 35.4 48.9 35.4S46.8 34.3 46.8 32.2Z`,transform:`rotate(-8 48.9 33.5)`}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`3`,strokeLinecap:`round`,d:`M50.9 17.7 50.5 19.7 M55.2 20.1 53.4 21.9 M56.5 24.5 55.7 24.7`})]}),allApps:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:pD,x:`7`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 18.6 18.6)`}),(0,F.jsx)(`rect`,{fill:mD,x:`33.9`,y:`7.25`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 45.5 18.6)`}),(0,F.jsx)(`rect`,{fill:hD,x:`7`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(6.2 18.6 45.5)`}),(0,F.jsx)(`rect`,{fill:_D,x:`33.9`,y:`34.15`,width:`23.2`,height:`22.7`,rx:`4.6`,transform:`rotate(-6.2 45.5 45.5)`})]}),search:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:`none`,stroke:mD,strokeWidth:`6.5`,d:`M37 37.5 43 43.5`}),(0,F.jsx)(`path`,{fill:`none`,stroke:pD,strokeWidth:`12.6`,strokeLinecap:`round`,d:`M44.2 43.8 51.4 51.8`}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`3`,strokeLinecap:`round`,d:`M47.2 42.4 52.8 47.8`}),(0,F.jsx)(`ellipse`,{fill:mD,cx:`25.6`,cy:`24.6`,rx:`19.25`,ry:`18.6`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`25.2`,cy:`24.1`,rx:`14.2`,ry:`13.6`})]}),browser:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:pD,x:`5.9`,y:`6.15`,width:`52.2`,height:`51.7`,rx:`5.5`}),(0,F.jsx)(`path`,{fill:vD,d:`M10 16.5H29.4C30.3 16.1 31 14.4 31.8 12.5 32.5 10.9 33.2 10 34.5 10H52.2C53.4 10 54 10.7 54 12V16.5C55.2 16.5 56 17.1 56 18.3V52.4C56 53.7 55.1 54.6 53.8 54.6H10.2C8.9 54.6 8 53.7 8 52.4V18.2C8 17.1 8.7 16.5 10 16.5Z`}),(0,F.jsx)(`circle`,{fill:_D,cx:`12.2`,cy:`11.9`,r:`1.95`}),(0,F.jsx)(`circle`,{fill:mD,cx:`18.6`,cy:`11.9`,r:`1.95`}),(0,F.jsx)(`circle`,{fill:gD,cx:`25.1`,cy:`11.9`,r:`1.95`}),(0,F.jsx)(`circle`,{fill:hD,cx:`32`,cy:`34.9`,r:`14.5`}),(0,F.jsxs)(`g`,{fill:`none`,stroke:vD,strokeWidth:`3`,children:[(0,F.jsx)(`ellipse`,{cx:`32`,cy:`34.9`,rx:`7.7`,ry:`13.3`}),(0,F.jsx)(`path`,{d:`M17.5 34.9H46.5`})]})]}),internet:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ellipse`,{fill:`none`,stroke:_D,strokeWidth:`4.4`,cx:`32.2`,cy:`30.2`,rx:`25.6`,ry:`8.1`,transform:`rotate(-20.8 32.2 30.2)`}),(0,F.jsx)(`circle`,{fill:mD,cx:`32`,cy:`32`,r:`21.1`}),(0,F.jsxs)(`g`,{fill:`none`,stroke:vD,strokeWidth:`3`,children:[(0,F.jsx)(`ellipse`,{cx:`32`,cy:`31.8`,rx:`12.2`,ry:`18.7`}),(0,F.jsx)(`path`,{d:`M32 13.1V50.5M15 20.4Q32 29 49 20.4M12.5 39Q32 44.6 51.5 39`})]}),(0,F.jsx)(`path`,{fill:`none`,stroke:_D,strokeWidth:`4.4`,d:`M6.6 30.2A25.6 8.1 0 0 0 57.8 30.2`,transform:`rotate(-20.8 32.2 30.2)`})]}),members:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{fill:mD,cx:`41.9`,cy:`22.85`,r:`12.2`}),(0,F.jsx)(`path`,{fill:mD,d:`M36 34C33.8 34.8 32.2 35.8 31 37 37.5 39.5 40.5 43.5 40.5 49.5V53.5H54.5C57 53.5 58 51 58 47.5 58 40 55 35.5 49 34Z`}),(0,F.jsx)(`circle`,{fill:pD,cx:`22.95`,cy:`27.6`,r:`12.85`}),(0,F.jsx)(`path`,{fill:pD,d:`M15.5 38C10.5 39 7.5 42.5 6.5 47 5.5 50.5 6 53.5 8.5 53.5H38.5C42 52 40 43 36 40 34.5 39 32 38 31 38Z`}),(0,F.jsxs)(`g`,{fill:yD,children:[(0,F.jsx)(`circle`,{cx:`18.3`,cy:`28`,r:`1.6`}),(0,F.jsx)(`circle`,{cx:`27.9`,cy:`28`,r:`1.6`}),(0,F.jsx)(`circle`,{cx:`39.1`,cy:`23.05`,r:`1.55`}),(0,F.jsx)(`circle`,{cx:`47.25`,cy:`23.05`,r:`1.55`})]})]}),sell:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{fill:_D,d:`M6.4 41.2V48.4C6.4 51.4 13.2 54 21.8 54S37.2 51.4 37.2 48.4V41.2C37.2 37.8 30.4 35 21.8 35S6.4 37.8 6.4 41.2Z`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`21.9`,cy:`40.8`,rx:`13.2`,ry:`3.6`}),(0,F.jsxs)(`g`,{transform:`rotate(-3 22.5 30) translate(0.5 0)`,children:[(0,F.jsx)(`path`,{fill:_D,d:`M7.5 26V34C7.5 37.3 14.2 40 22.5 40S37.5 37.3 37.5 34V26C37.5 22.7 30.8 20 22.5 20S7.5 22.7 7.5 26Z`}),(0,F.jsx)(`ellipse`,{fill:vD,cx:`23.7`,cy:`26.55`,rx:`13.05`,ry:`4.4`})]}),(0,F.jsxs)(`g`,{transform:`translate(46.3 40.3) rotate(-25)`,children:[(0,F.jsx)(`path`,{fill:pD,d:`M-8.5-10Q-8.5-12-7-13L-1.5-16.3Q0-17.2 1.5-16.3L7-13Q8.5-12 8.5-10V9Q8.5 12 5.5 12H-5.5Q-8.5 12-8.5 9Z`}),(0,F.jsx)(`circle`,{fill:vD,cx:`0`,cy:`-10.7`,r:`2.2`})]}),(0,F.jsx)(cD,{fill:_D,transform:`translate(38.2 18.6) scale(1.1 .86)`}),(0,F.jsx)(cD,{fill:_D,transform:`translate(42.8 21.2) rotate(45) scale(1.1 .85)`})]}),schedule:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{fill:vD,x:`6`,y:`11`,width:`47.6`,height:`44`,rx:`6`}),(0,F.jsx)(`path`,{fill:pD,d:`M12 11H47.6Q53.6 11 53.6 17V21.5H6V17Q6 11 12 11Z`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`circle`,{cx:`16.1`,cy:`16.15`,r:`3.4`}),(0,F.jsx)(`circle`,{cx:`43.4`,cy:`16.15`,r:`3.4`})]}),(0,F.jsxs)(`g`,{fill:mD,children:[(0,F.jsx)(`rect`,{x:`13.6`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`}),(0,F.jsx)(`rect`,{x:`40.9`,y:`6`,width:`5`,height:`11.2`,rx:`2.5`})]}),(0,F.jsxs)(`g`,{fill:hD,children:[(0,F.jsx)(`rect`,{x:`11.1`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`20.7`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`20.7`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`11.1`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`30.4`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,F.jsxs)(`g`,{fill:gD,children:[(0,F.jsx)(`rect`,{x:`40.4`,y:`25.1`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`11.1`,y:`33.9`,width:`6.9`,height:`6.6`,rx:`1.8`}),(0,F.jsx)(`rect`,{x:`20.7`,y:`42.7`,width:`6.9`,height:`6.6`,rx:`1.8`})]}),(0,F.jsx)(`circle`,{fill:_D,cx:`45.5`,cy:`45.6`,r:`12.2`}),(0,F.jsx)(`path`,{fill:`none`,stroke:yD,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M45.1 39.3V46.2L51.3 49.8`}),(0,F.jsx)(`circle`,{fill:yD,cx:`45.1`,cy:`46.2`,r:`2.5`})]}),loop:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{style:{stroke:pD},strokeWidth:`6`,strokeLinecap:`round`,d:`M47.5 14.5C43 11 37.5 9 32 9 19.5 9 9 19.5 9 32S19.5 55 32 55 55 44.5 55 32`}),(0,F.jsx)(`path`,{style:{fill:pD},d:`M53.5 21.5Q54.5 20 55 22L58 33Q58.5 35 56.5 34.5L48.5 32.5Q47 32 48 30.5Z`}),(0,F.jsx)(`g`,{transform:`translate(18 21) scale(.28)`,children:(0,F.jsx)(uD,{fill:mD})}),(0,F.jsxs)(`g`,{style:{fill:vD},children:[(0,F.jsx)(`rect`,{x:`25`,y:`27.5`,width:`14`,height:`3`,rx:`1.5`}),(0,F.jsx)(`rect`,{x:`25`,y:`33.5`,width:`9`,height:`3`,rx:`1.5`})]})]}),fungi:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`ellipse`,{fill:vD,cx:`33.5`,cy:`43.6`,rx:`18.6`,ry:`14.4`,transform:`rotate(-6 33.5 43.6)`}),(0,F.jsx)(`path`,{fill:pD,d:`M29.5 6.5C22 7.5 16 11 11 18.5 4 29 4.6 39.6 13.5 42.2 24 45 44 40.5 54 34.6 57.6 32.6 58.6 29.2 57.5 25 56.5 20 53 16 48.5 13 43.5 8 37 5.5 29.5 6.5Z`}),(0,F.jsxs)(`g`,{fill:vD,children:[(0,F.jsx)(`ellipse`,{cx:`29`,cy:`15.7`,rx:`8.7`,ry:`6.3`,transform:`rotate(-15.5 29 15.7)`}),(0,F.jsx)(`ellipse`,{cx:`50.8`,cy:`20.1`,rx:`6.5`,ry:`3.5`,transform:`rotate(51.6 50.8 20.1)`}),(0,F.jsx)(`ellipse`,{cx:`13`,cy:`26.8`,rx:`4.2`,ry:`3.3`,transform:`rotate(-54.5 13 26.8)`})]}),(0,F.jsxs)(`g`,{fill:yD,transform:`translate(26.6 46.6) scale(1.1) translate(-33.7 -38.5)`,children:[(0,F.jsx)(`rect`,{x:`31.85`,y:`35.9`,width:`3.75`,height:`5.25`,rx:`1.85`}),(0,F.jsx)(`path`,{d:`M 47.4 34.3 C 46 35 44.6 35.8 43.5 36.7 42.9 37.2 43.2 38.3 44 38.4 45.2 38.6 46.5 38.6 47.7 38.4 48.4 38.3 48.3 37.3 47.6 37.3 46.6 37.4 45.7 37.4 45 37.3 45.9 36.7 46.9 36.1 48 35.6 48.7 35.3 48.2 34 47.4 34.3 Z`}),(0,F.jsx)(`path`,{d:`M 37.4 41.1 C 38.6 44.3 42.6 44.3 43.6 40.5 43.7 40 43.1 39.8 42.9 40.3 41.9 42.8 39.1 42.9 38.3 40.7 38.1 40.2 37.3 40.5 37.4 41.1 Z`})]})]})};function bD({name:e,size:t}){return(0,F.jsx)(`svg`,{viewBox:`0 0 64 64`,width:t,height:t,fill:`none`,stroke:`none`,"aria-hidden":`true`,focusable:`false`,"data-sigil":e,children:Zpe[e]})}var Qpe=[{id:`list`,label:`List files`,contract:jce},{id:`read`,label:`Read files`,contract:Bce},{id:`write`,label:`Write files`,contract:Vce},{id:`run`,label:`Run commands`,contract:wC}],$pe={loading:`Loading`,unavailable:`Unavailable`,error:`Refresh failed`};function eme({app:e,terminal:t=null,processes:n,ports:r}){let[i,a]=(0,I.useState)(!1),o=async()=>{if(e){a(!0);try{await e.ui.requestAppPermissions({})}catch(e){DC(`Could not open App permissions. Try again.`,e)}finally{a(!1)}}};return{id:`access`,label:`Access`,title:`Computer access`,content:(0,F.jsxs)(`div`,{className:`shed-instrument`,children:[(0,F.jsxs)(Ipe,{size:`sm`,children:[(0,F.jsx)(Lpe,{icon:(0,F.jsx)(bD,{name:`computer`}),title:t?.name??`Selected Computer`,status:t?(0,F.jsx)(vm,{size:`compact`,label:`Terminal ${t.state}`,tone:t.state===`open`?`success`:t.state===`failed`?`error`:`neutral`}):null}),(0,F.jsxs)(Rpe,{children:[(0,F.jsx)(aD,{legend:`Shed may`,wide:!0,children:(0,F.jsx)(Ppe,{"aria-label":`Shed may`,stateLabels:[`allowed`,`not allowed`],items:Qpe.map(({id:t,label:n,contract:r})=>({id:t,label:n,caption:t,icon:(0,F.jsx)(bD,{name:t}),on:e?.capabilities.has(r)===!0}))})}),(0,F.jsx)(xD,{label:`Processes`,value:n}),(0,F.jsx)(xD,{label:`Ports open`,value:r})]})]}),e?(0,F.jsx)(`div`,{className:`shed-instrument-keys`,children:(0,F.jsx)(ZE,{size:`sm`,variant:`ghost`,disabled:i,onClick:()=>void o(),children:i?`Opening permissions…`:`App permissions…`})}):null]})}}function xD({label:e,value:t}){return(0,F.jsx)(aD,{legend:e,role:`group`,"aria-label":e,children:t.kind===`loaded`?(0,F.jsx)(jpe,{value:t.count,pad:2,size:`md`}):(0,F.jsx)(`span`,{className:`shed-instrument-note`,children:$pe[t.kind]})})}var tme={2:`h2`,3:`h3`,4:`h4`};function nme(e,t){let{reduced:n}=t,r=e&&!n,i=Rd(t,600),[a,o]=(0,I.useState)(r);return(0,I.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var rme=(0,F.jsx)(um,{decorative:!0,pace:`idle`,size:`md`,tone:`primary`,variant:`wander`}),SD=(0,I.forwardRef)(function({actions:e,secondaryAction:t,className:n,description:r,headingLevel:i=2,primaryAction:a,suggestions:o,thinking:s=!1,title:c,visual:l,renderVisual:u,variant:d=`plain`,...f},p){let m=(0,I.useId)(),h=(0,I.useRef)(null),g=Ld(h),_=nme(d===`speech`,g)&&!s,v=tme[i],y=l??(d===`panel`?`blobs`:void 0),b=u?u({speaking:_,thinking:s}):y===`blobs`?rme:y,x=`${m}-reason`,S=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v,{ref:h,className:`empty-state-title`,id:f[`aria-labelledby`]?void 0:m,children:c}),(0,F.jsx)(`p`,{children:r}),a?(0,F.jsxs)(`div`,{className:`empty-state-primary`,children:[(0,F.jsxs)(`div`,{className:`empty-state-action-row`,children:[(0,F.jsx)(ZE,{"aria-describedby":a.disabled&&a.disabledReason?x:void 0,disabled:a.disabled,loading:a.pending===!0,onClick:a.onSelect,variant:`primary`,children:a.label}),t]}),a.disabled&&a.disabledReason?(0,F.jsx)(`span`,{className:`empty-state-reason`,id:x,children:a.disabledReason}):null]}):null,o&&o.length>0?(0,F.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:o.map((e,t)=>(0,F.jsx)(`li`,{children:(0,F.jsx)(ZE,{disabled:e.disabled,loading:e.pending===!0,size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},`${String(t)}:${e.label}`))}):null,e?(0,F.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,F.jsxs)(`section`,{...f,"aria-labelledby":f[`aria-labelledby`]??m,className:Dd(`empty-state`,d!==`plain`&&`empty-state-${d}`,n),ref:p,children:[b?(0,F.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:b}):null,d===`speech`?(0,F.jsx)(`div`,{className:`empty-state-bubble`,children:S}):S]})}),ime=(0,I.forwardRef)(function({className:e,orientation:t,variant:n=`grip`,value:r,min:i,max:a,onValueChange:o,onKeyDown:s,...c},l){return(0,F.jsx)(`div`,{...c,ref:l,className:Dd(`caps-resize-handle`,e),"data-resize-variant":n,role:`separator`,"aria-orientation":t,"aria-valuemin":Math.round(i),"aria-valuemax":Math.round(a),"aria-valuenow":Math.round(r),tabIndex:c.tabIndex??0,onKeyDown:e=>{if(s?.(e),e.defaultPrevented)return;if(e.key===`Home`||e.key===`End`){e.preventDefault(),o(e.key===`Home`?i:a);return}let n=t===`horizontal`?e.key===`ArrowUp`?-32:e.key===`ArrowDown`?32:null:e.key===`ArrowLeft`?-32:e.key===`ArrowRight`?32:null;n!==null&&(e.preventDefault(),o(Math.min(a,Math.max(i,r+n))))},children:(0,F.jsx)(`span`,{className:`caps-resize-grip`,"aria-hidden":`true`})})});function CD(e){return`init`in e}function wD(e){return typeof e.write==`function`}function ame(e){return!!e.onMount}function TD(e){return`v`in e||`e`in e}function ED(e){if(`e`in e)throw e.e;return e.v}function DD(e){return typeof e?.then==`function`}function ome(e){if(!(e instanceof Error))return!1;let t=e.name,n=e.message.toLowerCase();return(t===`RangeError`||t===`InternalError`)&&(n.includes(`call stack`)||n.includes(`too much recursion`)||n.includes(`stack overflow`))}function OD(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function kD(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}function sme(e){return!!e.INTERNAL_onInit}var cme=(e,t,n,...r)=>n.read(...r),lme=(e,t,n,...r)=>n.write(...r),ume=(e,t,n)=>n.INTERNAL_onInit(t),dme=(e,t,n,r)=>n.onMount?.call(n,r),fme=(e,t,n)=>{var r;let i=e[0],a=i.get(n);if(!a){let o=e[6],s=e[9];a={d:new Map,p:new Set,n:0},i.set(n,a),(r=o.i)==null||r.call(o,n),sme(n)&&s(e,t,n)}return a},pme=(e,t)=>{let n=e[1],r=e[3],i=e[4],a=e[5],o=e[6],s=e[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let c=new Set;for(let e of r){let t=n.get(e)?.l;if(t)for(let e of t)c.add(e)}r.clear();for(let e of a)c.add(e);a.clear();for(let e of i)c.add(e);i.clear();for(let e of c)l(e);r.size&&s(e,t)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},mme=(e,t)=>{let n=e[1],r=e[2],i=e[3],a=e[11],o=e[14],s=e[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let n of i)f.push(n),p.push(a(e,t,n));for(;f.length;){let i=f.length-1,o=f[i],s=p[i];if(d.has(o)){f.pop(),p.pop();continue}if(u.has(o)){r.get(o)===s.n&&(c.push(o),l.push(s)),d.add(o),f.pop(),p.pop();continue}u.add(o);for(let r of kD(o,s,n))u.has(r)||(f.push(r),p.push(a(e,t,r)))}for(let n=c.length-1;n>=0;--n){let a=c[n],u=l[n],d=!1;for(let e of u.d.keys())if(e!==a&&i.has(e)){d=!0;break}d&&(r.set(a,u.n),o(e,t,a),s(e,t,a)),r.delete(a)}},hme=(e,t,n)=>{var r,i;let a=e[1],o=e[2],s=e[3],c=e[6],l=e[7],u=e[11],d=e[12],f=e[13],p=e[14],m=e[16],h=e[17],g=e[20],_=e[26],v=e[28],y=u(e,t,n),b=v[0];if(TD(y)){if(a.has(n)&&o.get(n)!==y.n||y.m===b)return y.m=b,y;let r=!1;for(let[n,i]of y.d)if(p(e,t,n).n!==i){r=!0;break}if(!r)return y.m=b,y}let x=!0,S=new Set(y.d.keys()),C=()=>{for(let e of S)y.d.delete(e)},w=()=>{if(a.has(n)){let r=!s.size;h(e,t,n),r&&(f(e,t),d(e,t))}},T=r=>{var i;if(r===n){let n=u(e,t,r);if(!TD(n)){if(CD(r))g(e,t,r,r.init);else throw Error(`no atom init`)}return ED(n)}let o=p(e,t,r);try{return ED(o)}finally{S.delete(r),y.d.set(r,o.n),DD(y.v)&&OD(n,y.v,o),a.has(n)&&((i=a.get(r))==null||i.t.add(n)),x||w()}},E,D,O={get signal(){return E||=new AbortController,E.signal},get setSelf(){return!D&&wD(n)&&(D=(...r)=>{if(!x)try{return m(e,t,n,r)}finally{f(e,t),d(e,t)}}),D}},k=y.n,A=o.get(n)===k;try{let i=l(e,t,n,T,O);if(g(e,t,n,i),DD(i)){_(e,t,i,()=>E?.abort());let n=()=>{C(),w()};i.then(n,n)}else C();return(r=c.r)==null||r.call(c,n),y.m=b,y}catch(e){if(ome(e))throw e;return delete y.v,y.e=e,++y.n,y.m=b,y}finally{x=!1,y.n!==k&&A&&(o.set(n,y.n),s.add(n),(i=c.c)==null||i.call(c,n))}},gme=(e,t,n)=>{let r=e[1],i=e[2],a=e[11],o=[n];for(;o.length;){let n=o.pop(),s=a(e,t,n);for(let c of kD(n,s,r)){let n=a(e,t,c);i.get(c)!==n.n&&(i.set(c,n.n),o.push(c))}}},_me=(e,t,n,r)=>{let i=e[3],a=e[6],o=e[8],s=e[11],c=e[12],l=e[13],u=e[14],d=e[15],f=e[16],p=e[17],m=e[20],h=e[28],g=!0,_=n=>ED(u(e,t,n)),v=(r,...o)=>{var u;let _=s(e,t,r);try{if(r===n){if(!CD(r))throw Error(`atom not writable`);let n=_.n,s=o[0];m(e,t,r,s),p(e,t,r),n!==_.n&&(++h[0],i.add(r),d(e,t,r),(u=a.c)==null||u.call(a,r));return}return f(e,t,r,o)}finally{g||(l(e,t),c(e,t))}};try{return o(e,t,n,_,v,...r)}finally{g=!1}},vme=(e,t,n)=>{var r;let i=e[1],a=e[3],o=e[6],s=e[11],c=e[15],l=e[18],u=e[19],d=s(e,t,n),f=i.get(n);if(f&&d.d.size>0){for(let[i,u]of d.d)if(!f.d.has(i)){let d=s(e,t,i);l(e,t,i).t.add(n),f.d.add(i),u!==d.n&&(a.add(i),c(e,t,i),(r=o.c)==null||r.call(o,i))}for(let r of f.d)d.d.has(r)||(f.d.delete(r),u(e,t,r)?.t.delete(n))}},yme=(e,t,n)=>{var r;let i=e[1],a=e[4],o=e[6],s=e[10],c=e[11],l=e[12],u=e[13],d=e[14],f=e[16],p=e[18],m=c(e,t,n),h=i.get(n);if(!h){d(e,t,n);for(let r of m.d.keys())p(e,t,r).t.add(n);h={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(n,h),wD(n)&&ame(n)&&a.add(()=>{let r=!0,i=(...i)=>{try{return f(e,t,n,i)}finally{r||(u(e,t),l(e,t))}};try{let a=s(e,t,n,i);a&&(h.u=()=>{r=!0;try{a()}finally{r=!1}})}finally{r=!1}}),(r=o.m)==null||r.call(o,n)}return h},bme=(e,t,n)=>{var r;let i=e[1],a=e[5],o=e[6],s=e[11],c=e[19],l=s(e,t,n),u=i.get(n);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(n)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(n);for(let r of l.d.keys())c(e,t,r)?.t.delete(n);(r=o.u)==null||r.call(o,n);return}return u},xme=(e,t,n,r)=>{let i=e[11],a=e[27],o=i(e,t,n),s=`v`in o,c=o.v;if(DD(r))for(let a of o.d.keys())OD(n,r,i(e,t,a));o.v=r,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,DD(c)&&a(e,t,c))},Sme=(e,t,n)=>{let r=e[14];return ED(r(e,t,n))},Cme=(e,t,n,...r)=>{let i=e[3],a=e[12],o=e[13],s=e[16],c=i.size;try{return s(e,t,n,r)}finally{i.size!==c&&(o(e,t),a(e,t))}},wme=(e,t,n,r)=>{let i=e[12],a=e[13],o=e[18],s=e[19],c=o(e,t,n).l;return c.add(r),a(e,t),i(e,t),()=>{c.delete(r),s(e,t,n),a(e,t),i(e,t)}},Tme=(e,t,n,r)=>{let i=e[25],a=i.get(n);if(!a){a=new Set,i.set(n,a);let e=()=>i.delete(n);n.then(e,e)}a.add(r)},Eme=(e,t,n)=>{e[25].get(n)?.forEach(e=>e())},Dme=new WeakMap;function Ome(...e){let t={get(e){return r(n,t,e)},set(e,...r){return i(n,t,e,...r)},sub(e,r){return a(n,t,e,r)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},cme,lme,ume,dme,fme,pme,mme,hme,gme,_me,vme,yme,bme,xme,Sme,Cme,wme,void 0,new WeakMap,Tme,Eme,[0]].map((t,n)=>e[n]||t);Dme.set(t,Object.freeze(n));let r=n[21],i=n[22],a=n[23];return t}var kme=0;function Ame(e,t){let n=`atom${++kme}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=jme,r.write=Mme),t&&(r.write=t),r}function jme(e){return e(this)}function Mme(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}function Nme(){return Ome()}var AD=Ame({frames:new Map,order:[],tiles:[],minima:new Map,participating:new Set,mainSize:void 0,zoomed:null,gesture:null,restore:new Map}),jD=(e,t,n)=>Math.min(Math.max(e,t),n),MD=(e,t,n)=>{let r=jD(e.width,n.width,Math.max(n.width,t.width)),i=jD(e.height,n.height,Math.max(n.height,t.height));return{width:r,height:i,x:jD(e.x,0,Math.max(0,t.width-r)),y:jD(e.y,0,Math.max(0,t.height-i))}},ND=(e,t,n)=>{let r=t.width/2,i=t.height/2;return MD(e===`left`?{x:0,y:0,width:r,height:t.height}:e===`right`?{x:r,y:0,width:r,height:t.height}:e===`top-left`?{x:0,y:0,width:r,height:i}:e===`top-right`?{x:r,y:0,width:r,height:i}:e===`bottom-left`?{x:0,y:i,width:r,height:i}:{x:r,y:i,width:r,height:i},t,n)},Pme=()=>{let e=Nme(),t=()=>e.get(AD),n=0,r=r=>{n+=1,e.set(AD,r(t()))},i=(e,t,n)=>{r(r=>{let i=new Map(r.frames);return i.set(e,t),{...r,frames:i,participating:new Set(r.participating).add(e),tiles:r.tiles.includes(e)?r.tiles:[...r.tiles,e],minima:new Map(r.minima).set(e,n),order:r.order.includes(e)?r.order:[...r.order.filter(e=>e!==r.zoomed),e,...r.zoomed?[r.zoomed]:[]]}})},a=e=>t().frames.has(e),o=(e,n)=>{let r=t().gesture;return r?.kind===`frame`&&r.id===e&&r.pointerId===n};return{get version(){return n},get frames(){return t().frames},get order(){return t().order},get tiles(){return t().tiles},get minima(){return t().minima},get participating(){return t().participating},get mainSize(){return t().mainSize},get zoomed(){return t().zoomed},get gesture(){return t().gesture},get restore(){return t().restore},subscribe:t=>e.sub(AD,t),register:i,setParticipation:(e,n)=>{t().frames.has(e)&&r(t=>{if(t.participating.has(e)===n)return t;let r=new Set(t.participating);n?r.add(e):r.delete(e);let i=n?t.tiles.includes(e)?t.tiles:[...t.tiles,e]:t.tiles.filter(t=>t!==e),a=n?t.order.includes(e)?t.order:[...t.order,e]:t.order.filter(t=>t!==e);return{...t,participating:r,tiles:i,order:a,zoomed:n||t.zoomed!==e?t.zoomed:null,gesture:!n&&t.gesture?.kind===`frame`&&t.gesture.id===e?null:t.gesture}})},setMinima:(e,n)=>{let i=t().minima.get(e);!i||i.width===n.width&&i.height===n.height||r(t=>({...t,minima:new Map(t.minima).set(e,n)}))},unregister:e=>{r(t=>{if(!t.frames.has(e))return t;let n=new Map(t.frames);n.delete(e);let r=new Map(t.restore);r.delete(e);let i=t.order.filter(t=>t!==e),a=t.tiles.filter(t=>t!==e),o=new Map(t.minima);o.delete(e);let s=new Set(t.participating);s.delete(e);let c=t.gesture?.kind===`frame`&&t.gesture.id===e?null:t.gesture;return{...t,frames:n,restore:r,order:i,tiles:a,minima:o,participating:s,gesture:c,zoomed:t.zoomed===e?null:t.zoomed}})},begin:(e,n)=>{!a(e)||!t().participating.has(e)||r(t=>({...t,gesture:{kind:`frame`,id:e,pointerId:n,start:t.frames.get(e)??{x:0,y:0,width:0,height:0}},order:[...t.order.filter(t=>t!==e),e]}))},move:(e,n,i,s,c,l=null)=>{a(e)&&t().participating.has(e)&&o(e,n)&&r(t=>({...t,frames:new Map(t.frames).set(e,MD(i,s,c)),gesture:t.gesture?.kind===`frame`?{...t.gesture,snap:l?{side:l,frame:ND(l,s,c)}:null}:t.gesture}))},end:(e,t)=>{o(e,t)&&r(t=>{let n=t.gesture;return n?.kind!==`frame`||!n.snap?{...t,gesture:null}:{...t,frames:new Map(t.frames).set(e,n.snap.frame),restore:new Map(t.restore).set(e,t.restore.get(e)??n.start),gesture:null}})},cancel:(e,n)=>{let i=t().gesture;i?.kind===`frame`&&i.id===e&&i.pointerId===n&&r(t=>{let n=new Map(t.frames);return n.set(e,i.start),{...t,frames:n,gesture:null}})},snap:(e,n,i,o)=>{!a(e)||!t().participating.has(e)||r(t=>{let r=new Map(t.restore);r.set(e,t.frames.get(e)??ND(n,i,o));let a=new Map(t.frames);return a.set(e,ND(n,i,o)),{...t,frames:a,restore:r,order:[...t.order.filter(t=>t!==e),e]}})},restoreFrame:(e,n,i)=>{!a(e)||!t().participating.has(e)||r(t=>{let r=t.restore.get(e);if(!r)return t;let a=new Map(t.frames);a.set(e,MD(r,n,i));let o=new Map(t.restore);return o.delete(e),{...t,frames:a,restore:o}})},focus:e=>{a(e)&&r(t=>({...t,order:[...t.order.filter(t=>t!==e),e],zoomed:t.zoomed===null?null:e}))},swap:(e,n)=>{!a(e)||!a(n)||!t().participating.has(e)||!t().participating.has(n)||r(t=>({...t,tiles:t.tiles.map(t=>t===e?n:t===n?e:t)}))},zoom:e=>{e!==null&&(!a(e)||!t().participating.has(e))||r(t=>({...t,zoomed:e,order:e===null?t.order:[...t.order.filter(t=>t!==e),e]}))},resizeMain:e=>{r(t=>({...t,mainSize:e}))},beginDivider:e=>!t().gesture&&(r(t=>({...t,gesture:{kind:`divider`,pointerId:e,start:t.mainSize}})),!0),finishDivider:(e,n)=>{let i=t().gesture;i?.kind===`divider`&&i.pointerId===e&&r(e=>({...e,gesture:null,mainSize:n?i.start:e.mainSize}))},destroy:()=>{r(e=>({...e,gesture:null,restore:new Map}))}}};function Fme(e,t,n,r,i){let a=i.layout??`main-left`;if(a===`columns`||a===`rows`||a===`grid`)return Ime(e,t,n,r,i,a);if(a===`main-top`){let a=PD(e,new Map([...t].map(([e,t])=>[e,{width:t.height,height:t.width}])),n,{width:r.height,height:r.width},i);return{frames:new Map([...a.frames].map(([e,t])=>[e,{x:t.y,y:t.x,width:t.height,height:t.width}])),tabGroups:a.tabGroups,divider:a.divider&&{...a.divider,axis:`y`}}}return PD(e,t,n,r,i)}function Ime(e,t,n,r,i,a){let o=new Map,s=[];if(!e.length)return{frames:o,tabGroups:s,divider:null};let c=Math.max(0,i.gap??8),l=e.reduce((e,n)=>({width:Math.max(e.width,t.get(n)?.width??0),height:Math.max(e.height,t.get(n)?.height??0)}),{width:0,height:0}),u=(t,n)=>n+c===0?e.length:Math.min(e.length,Math.max(1,Math.floor((t+c)/(n+c)))),d=u(r.width,l.width),f=u(r.height,l.height),p=l.width>r.width||l.height>r.height?1:a===`columns`?d:a===`rows`?f:Math.min(e.length,d*f),m=a===`columns`?p:a===`rows`?1:Math.min(d,Math.max(Math.ceil(Math.sqrt(p)),Math.ceil(p/f))),h=Math.ceil(p/m),g=(r.width-c*(m-1))/m,_=(r.height-c*(h-1))/h;for(let t=0;t<p;t++){let r=e.slice(t,t===p-1?void 0:t+1),i=r.length===1?r[0]:[...n].reverse().find(e=>r.includes(e))??r[0];i&&o.set(i,{x:t%m*(g+c),y:Math.floor(t/m)*(_+c),width:g,height:_}),r.length>1&&s.push(r)}return{frames:o,tabGroups:s,divider:null}}function PD(e,t,n,r,i){let a=new Map,o=[],s={x:0,y:0,...r},[c,...l]=e,u=(e,t)=>{let r=[...n].reverse().find(t=>e.includes(t))??e[0];r&&a.set(r,t),e.length>1&&o.push(e)};if(!c)return{frames:a,tabGroups:o,divider:null};if(!l.length)return a.set(c,s),{frames:a,tabGroups:o,divider:null};let d=Math.max(0,i.gap??8),f=t.get(c)?.width??0,p=Math.max(...l.map(e=>t.get(e)?.width??0)),m=r.width-d-p;if(f>m)return u([...e],s),{frames:a,tabGroups:o,divider:null};let h=Math.min(m,Math.max(f,i.mainSize??r.width/2)),g={axis:`x`,position:h,min:f,max:m};a.set(c,{...s,width:h});let _={...s,x:h+d,width:r.width-h-d},v=l.map(e=>t.get(e)?.height??0).reduce((e,t)=>e+t,0)+d*(l.length-1);if(v>r.height)u(l,_);else{let e=(r.height-v)/l.length,n=0;for(let r of l){let i=(t.get(r)?.height??0)+e;a.set(r,{..._,y:n,height:i}),n+=i+d}}return{frames:a,tabGroups:o,divider:g}}function FD(e,t=!0,n){let r=(0,I.useRef)(e);r.current=e;let i=(0,I.useRef)(null);return(0,I.useEffect)(()=>(t||i.current?.release(!0),()=>i.current?.release(!0)),[t]),(0,I.useEffect)(()=>{let e=()=>{i.current?.release(!0)};return n?.addEventListener(`abort`,e),()=>{n?.removeEventListener(`abort`,e)}},[n]),{onPointerDown:e=>{if(!t||n?.aborted||i.current||e.pointerType===`mouse`&&e.button!==0)return;let{currentTarget:a,pointerId:o}=e;if(a.setPointerCapture(o),!r.current.begin(e)){a.releasePointerCapture(o);return}let s=r.current.end,c=()=>{l(!0)},l=e=>{a.removeEventListener(`lostpointercapture`,c),i.current=null,s(e),a.hasPointerCapture(o)&&a.releasePointerCapture(o)};i.current={id:o,element:a,x:e.clientX,y:e.clientY,release:l},a.addEventListener(`lostpointercapture`,c)},onPointerMove:e=>{let t=i.current;t?.id===e.pointerId&&(r.current.move(e.clientX-t.x,e.clientY-t.y,e),t.x=e.clientX,t.y=e.clientY)},onPointerUp:e=>{i.current?.id===e.pointerId&&i.current.release(!1)},onPointerCancel:e=>{i.current?.id===e.pointerId&&i.current.release(!0)}}}function Lme(e,t){return e.x<20?e.y<20?`top-left`:e.y>t.height-20?`bottom-left`:`left`:e.x>t.width-20?e.y<20?`top-right`:e.y>t.height-20?`bottom-right`:`right`:null}var ID=(0,I.createContext)(null);function Rme({bounds:e,tiling:t,containerRef:n,children:r}){let i=(0,I.useMemo)(Pme,[]);(0,I.useSyncExternalStore)(i.subscribe,()=>i.version,()=>i.version),(0,I.useEffect)(()=>()=>{i.destroy()},[i]);let a={...t};i.mainSize!==void 0&&(a.mainSize=i.mainSize);let o=t?Fme(i.tiles,i.minima,i.order,e,a):{frames:new Map([...i.frames].filter(([e])=>i.participating.has(e)).map(([t,n])=>[t,MD(n,e,i.minima.get(t)??{width:0,height:0})])),tabGroups:[],divider:null};return i.zoomed&&i.participating.has(i.zoomed)&&(o.frames=new Map([[i.zoomed,{x:0,y:0,...e}]]),o.divider=null,o.tabGroups=[]),(0,F.jsx)(ID.Provider,{value:{state:i,bounds:e,tiled:t!==void 0,arrangement:o,containerRef:n},children:r})}function LD(){let e=(0,I.useContext)(ID);if(!e)throw Error(`Maosaico hooks must be used within MaosaicoRoot`);return e}function zme(){let{state:e,arrangement:t,tiled:n,bounds:r}=LD(),i=e.tiles,a=(0,I.useRef)({pointer:0,position:0}),o=t.divider,s=FD({begin:t=>!o||!e.beginDivider(t.pointerId)?!1:(a.current={pointer:t.pointerId,position:o.position},!0),move:(t,n)=>{o&&(a.current.position=Math.min(o.max,Math.max(o.min,a.current.position+(o.axis===`x`?t:n))),e.resizeMain(a.current.position))},end:t=>{e.finishDivider(a.current.pointer,t)}},o!==null);return{bounds:r,stackingStyle:{zIndex:e.order.length},mode:n?`tiled`:`floating`,order:i,interacting:e.gesture!==null,snapPreview:!n&&!e.zoomed&&e.gesture?.kind===`frame`?e.gesture.snap??null:null,activeId:e.order.at(-1)??null,zoomedId:e.zoomed,tabGroups:t.tabGroups,divider:o&&{...o,props:s},focus:e.focus,swap:e.swap,zoom:e.zoom,resizeMain:t=>{o&&e.resizeMain(Math.min(o.max,Math.max(o.min,t)))}}}function Bme(e,t={}){let{state:n,bounds:r,tiled:i,arrangement:a,containerRef:o}=LD();(0,I.useLayoutEffect)(()=>(n.register(e.id,e.frame,e.minima),()=>{n.unregister(e.id)}),[n,e.id]),(0,I.useEffect)(()=>{n.setMinima(e.id,e.minima)},[n,e.id,e.minima.width,e.minima.height]);let s=t.participating??!0;(0,I.useLayoutEffect)(()=>{n.setParticipation(e.id,s)},[n,e.id,s]);let c=(0,I.useRef)(0),l=FD({begin:t=>!n.frames.has(e.id)||n.gesture?!1:(c.current=t.pointerId,n.begin(e.id,t.pointerId),!0),move:(i,a,s)=>{let l=o?.current?.getBoundingClientRect(),u=l&&t.kind!==`resize`?Lme({x:s.clientX-l.left,y:s.clientY-l.top},r):null,d=MD(n.frames.get(e.id)??e.frame,r,e.minima);n.move(e.id,c.current,t.kind===`resize`?{...d,width:d.width+i,height:d.height+a}:{...d,x:d.x+i,y:d.y+a},r,e.minima,u)},end:t=>{t?n.cancel(e.id,c.current):n.end(e.id,c.current)}},s&&!i&&!n.zoomed);return{frame:a.frames.get(e.id)??n.frames.get(e.id)??e.frame,stackingStyle:{zIndex:Math.max(0,n.order.indexOf(e.id))},visible:a.frames.has(e.id),active:s&&n.order.at(-1)===e.id,props:l,focus:()=>{s&&n.focus(e.id)},snap:t=>{s&&!i&&n.snap(e.id,t,r,e.minima)},restore:()=>{s&&!i&&n.restoreFrame(e.id,r,e.minima)}}}var Vme=(0,I.createContext)(null);(0,I.forwardRef)(function({layer:e,style:t,children:n,...r},i){let a=(0,I.useContext)(Vme),o=a?.update,s=a?.roots.get(`dialog`),[c,l]=(0,I.useState)(!1);(0,I.useEffect)(()=>{if(!s)return;let e=()=>{l(Array.from(s.querySelectorAll(`*`)).some(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}))};e();let t=new MutationObserver(e);return t.observe(s,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[s]);let u=(0,I.useRef)(null);(0,I.useImperativeHandle)(i,()=>u.current);let d=(0,I.useCallback)(t=>{u.current=t,o?.(e,t)},[o,e]);return(0,I.createElement)(`div`,{...r,ref:d,onFocusCapture:t=>{e===`windows`&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&a?.dismiss?.(),r.onFocusCapture?.(t)},"data-maosaico-layer":e,inert:e===`windows`&&c?``:void 0,style:{position:`relative`,...t,isolation:`isolate`,zIndex:`var(--stipe-layer-${e})`}},n)});var Hme={xs:`size-3`,sm:`size-[var(--stipe-icon-size-sm)]`,md:`size-[var(--stipe-icon-size-md)]`,lg:`size-[var(--stipe-icon-size-lg)]`},RD=(0,I.forwardRef)(function({active:e=!1,icon:t,iconSize:n=`xs`,className:r,reveal:i=!1,size:a=`xs`,tone:o=`default`,variant:s=`ghost`,...c},l){let u=a===`responsive`;return(0,F.jsx)(ZE,{...c,resultLabel:c.result===void 0?void 0:null,ref:l,size:u?`sm`:a,variant:s,className:Dd(`caps-icon-button btn-circle`,u&&`caps-icon-button-responsive md:btn-xs`,e&&`text-accent`,i&&`scale-0 transition-transform group-hover:scale-100 focus-visible:scale-100`,o===`destructive`&&`hover:text-error`,r),children:(0,F.jsx)(`span`,{"aria-hidden":`true`,className:Dd(`inline-flex shrink-0 [&>svg]:size-full [&>svg]:[stroke-width:var(--stipe-icon-stroke)]`,Hme[n]),children:t})})}),Ume=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`div`,{...t,ref:n,className:Dd(`caps-popover-anchor`,e)})}),Wme=(0,I.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,F.jsx)(`div`,{...r,ref:i,className:Dd(`caps-popover`,e),"data-side":n}):null});(0,I.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,F.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:Dd(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function Gme({items:e,openId:t,onOpenChange:n,leading:r,trailing:i,renderTrigger:a,placement:o=`housing`,align:s=`end`,hostInset:c,className:l,...u}){let d=(0,I.useId)(),f=(0,I.useRef)(null),p=(0,I.useRef)(null),m=(0,I.useRef)(new Map),h=e.find(e=>e.id===t&&!e.disabled),g=h?.id,_=()=>{g&&m.current.get(g)?.focus(),n(null)};return(0,I.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,I.useEffect)(()=>{c===void 0?f.current?.style.removeProperty(`--caps-status-tray-host-inset`):f.current?.style.setProperty(`--caps-status-tray-host-inset`,`${String(Math.max(0,c))}px`)},[c]),(0,I.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),m.current.get(g)?.focus(),n(null))},t=e=>{!(e.target instanceof Node)||f.current?.contains(e.target)||f.current?.querySelector(`[aria-haspopup="menu"][aria-expanded="true"]`)||n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t,!0)}},[g,n]),(0,F.jsxs)(Ume,{...u,ref:f,className:Dd(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,F.jsxs)(Wme,{open:!0,ref:p,tabIndex:-1,side:`top`,id:`${d}-${h.id}`,role:`dialog`,"aria-labelledby":`${d}-title`,className:`caps-status-tray-panel`,"data-status-tray-panel":h.id,children:[(0,F.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,F.jsx)(vm,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,F.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,F.jsx)(RD,{"aria-label":`Close tray`,icon:(0,F.jsx)(dr,{"aria-hidden":`true`}),onClick:_})]}),(0,F.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,F.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,F.jsx)(`div`,{className:`caps-status-tray-chips`,children:e.map(e=>{let r={ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},type:`button`,className:a?void 0:`caps-status-tray-chip`,"aria-expanded":g===e.id,"aria-controls":g===e.id?`${d}-${e.id}`:void 0,"aria-label":e.accessibleLabel,disabled:e.disabled,title:e.disabled?e.accessibleLabel:void 0,"aria-haspopup":`dialog`,"data-status-tray-chip":e.id,onClick:()=>{n(t===e.id?null:e.id)},children:(0,F.jsxs)(F.Fragment,{children:[e.tone?(0,F.jsx)(vm,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,F.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,F.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,F.jsxs)(I.Fragment,{children:[a?a(r):(0,F.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function Kme({children:e,className:t,...n}){return(0,F.jsx)(`div`,{...n,className:Dd(`caps-status-tray-list`,t),children:e})}function zD({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,F.jsxs)(`div`,{...a,className:Dd(`caps-status-tray-item`,i),children:[e?(0,F.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,F.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,F.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,F.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,F.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function BD({children:e=`All caught up.`,title:t}){return(0,F.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,F.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,F.jsx)(`p`,{children:e})]})}function qme({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function VD(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var HD=[],UD=0,{link:WD,unlink:Jme,propagate:Yme,checkDirty:GD,shallowPropagate:KD}=qme({update(e){return e._update()},notify(e){HD[JD++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,QD(e))}}),qD=0,JD=0,YD,XD=0;function ZD(e){try{++XD,e()}finally{--XD||$D()}}function QD(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Jme(n,e)}function $D(){if(!(XD>0)){for(;qD<JD;){let e=HD[qD];HD[qD++]=void 0,e.notify()}qD=0,JD=0}}function eO(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return YD!==void 0&&WD(i,YD,UD),i._snapshot},subscribe(e){let t=VD(e),n={current:!1},r=Xme(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=YD,o=t?.compare??Object.is;if(n)YD=i,++UD,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{YD=a,n&&(i.flags&=-5),QD(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&GD(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&KD(e)}}else e&32&&(i.flags=e&-33);return YD!==void 0&&WD(i,YD,UD),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Yme(e),KD(e),$D())}},i}function Xme(e){let t=()=>{let t=YD;YD=n,++UD,n.depsTail=void 0,n.flags=6;try{return e()}finally{YD=t,n.flags&=-5,QD(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&GD(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,QD(this)}};return t(),n}var tO=class{constructor(e,t){this.atom=eO(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(VD(e))}},Zme=class{constructor(e){this.atom=eO(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(VD(e))}};function nO(e,t){return typeof e==`function`?new Zme(e):t?new tO(e,t):new tO(e)}var Qme=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function $me(e,t){return new Qme(e,t).maybeExecute}var ehe=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},rO=new class extends ehe{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function iO(e,t){return typeof e==`function`?e(t):e}function aO(e,t){return dO(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function oO(e,t,n){let r=dO(t);function i(e){if(!r.length)return iO(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function the(e,t){let n=dO(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var sO=46,cO=91,lO=93,uO=48,nhe=57;function dO(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===cO),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===sO||s===cO||s===lO){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==uO),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==lO&&(a!==-1||s!==lO)&&(a!==s||s!==sO&&s!==cO)&&n.push(``);r=o+1,i=!0}else(s<uO||s>nhe)&&(i=!1);a=s}return n.length||n.push(``),n}function rhe(e){return!(Array.isArray(e)&&e.length===0)}function fO(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function pO(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var mO=e=>!!e&&typeof e==`object`&&`fields`in e;function hO(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!hO(e[i],t[i]))return!1;return!0}var gO=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},_O=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function vO(e,t){return e==null?t:{...e,...t}}for(var yO=256,bO=[],xO;yO--;)bO[yO]=(yO+256).toString(16).substring(1);function SO(){let e=0,t,n=``;if(!xO||yO+16>256){for(xO=Array(256),e=256;e--;)xO[e]=256*Math.random()|0;e=0,yO=0}for(;e<16;e++)t=xO[yO+e],n+=e===6?bO[t&15|64]:e===8?bO[t&63|128]:bO[t],e&1&&e>1&&e<11&&(n+=`-`);return yO++,n}var ihe=$me(e=>rO.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function CO(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=CO(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,CO(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(CO(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=CO(e[n]));return t}function wO(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var TO=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function ahe(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var EO=(e,t)=>{let n=ahe(e,t);return{form:n,fields:n}},DO={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:EO(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:EO(r.issues,e)}},OO=e=>!!e&&`~standard`in e,kO={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function AO(e){function t(t){let n=e.getFieldMeta(t)??kO;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>kO;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function jO(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var MO=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{ihe(this)}),t=rO.on(`request-form-state`,e=>{e.payload.id===this._formId&&rO.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=rO.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=rO.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),rO.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return rO.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!hO(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!hO(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(ZD(()=>{this.baseStore.setState(()=>jO(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=AO(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}rO.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=oO(t,e.instance.name,e.instance.options.defaultValue))}),jO({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return ZD(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return ZD(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=fO(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||TO}),r=!1,i={};return ZD(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=NO(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=PO(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??kO,r=a?.[e],{newErrorValue:s,newSource:c}=gO({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=kO)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=PO(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=PO(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=pO(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||TO});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=PO(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=NO(r);s&&(i=i?{...i,...s}:s);let c=PO(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??kO,r=i?.[e],{newErrorValue:a,newSource:o}=gO({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=kO)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),ZD(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}ZD(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),ZD(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),rO.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>aO(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:iO(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=kO,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;ZD(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:oO(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=the(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),AO(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],vO(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),AO(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),vO(r,{dontValidate:!0})),AO(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),vO(n,{dontValidate:!0})),AO(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return oO(oO(e,`${t}`,i),`${n}`,r)},vO(r,{dontValidate:!0})),AO(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},vO(r,{dontValidate:!0})),AO(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],vO(t,{dontValidate:!0})),AO(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=aO(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:kO},values:i===void 0?t.values:oO(t.values,e,i)}})},this.setErrorMap=e=>{ZD(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(mO(t)){let{formError:e,fieldErrors:r}=NO(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>DO.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>DO.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??SO(),this._devtoolsSubmissionOverride=!1;let t=jO({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!mO(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=nO(t);let n;this.fieldMetaDerived=nO(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=aO(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!rhe(u),f=!o.isDirty,p=hO(l,this.getFieldInfo(a)?.instance?.options.defaultValue??aO(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=nO(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!wO(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&wO(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=nO(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&mO(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&hO(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return OO(e.validate)?DO[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function NO(e){return e?mO(e)?{formError:NO(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function PO(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var FO=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...kO,isTouched:e.fieldMetaBase[this.name]?.isTouched??kO.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??kO.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??kO.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(hO(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,vO(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,vO(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,vO(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,vO(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,vO(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=fO(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||TO}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=fO(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;ZD(()=>{let e=(e,n)=>{let r=LO(n.cause),a=n.validate?IO(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=_O({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=LO(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=pO(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||TO}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=pO(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));ZD(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=LO(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=IO(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=_O({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),ZD(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>wO(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[LO(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[LO(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>DO.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>DO.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)wO(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=nO(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...kO,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!hO(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return OO(e.validate)?DO[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function IO(e){if(e)return e}function LO(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function RO(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function ohe(e){return{...kO,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var zO=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??RO({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(hO(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...kO,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??RO({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;VO(t)&&(n=t.group,r=t.fields);let i=BO(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:RO({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,vO(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof FO&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&wO(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=gO({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=kO)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=fO(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||TO}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=fO(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;ZD(()=>{let t=(t,r)=>{let i=UO(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&VO(s)&&(c=s.group,l=s.fields);let u=BO(c),d=n[i],{newErrorValue:f,newSource:p}=_O({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=UO(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=pO(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||TO}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=pO(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||TO});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=UO(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&VO(o)&&(l=o.group,u=o.fields);let d=BO(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=_O({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return ZD(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>wO(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[UO(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>wO(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),ZD(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}ZD(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),ZD(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=nO(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??ohe(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!hO(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(OO(e.validate)){let t=DO[e.type](e.value,e.validate);return e.type===`validate`?HO(t):t.then(HO)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function BO(e){if(e)return e}function VO(e){return!!e&&typeof e==`object`&&`fields`in e}function HO(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function UO(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function WO(e,t){if(!t)return;let n=Object.assign({},e,{state:CO(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return ZD(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var GO=o((e=>{var t=un();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),KO=o(((e,t)=>{t.exports=GO()})),qO=o((e=>{var t=un(),n=KO();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),JO=o(((e,t)=>{t.exports=qO()}))();function YO(e,t){return e===t}function XO(e,t=e=>e,n){let r=n?.compare??YO,i=(0,I.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,I.useCallback)(()=>e.get(),[e]);return(0,JO.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var ZO=typeof window<`u`?I.useLayoutEffect:I.useEffect;function QO(e){let[t,n]=(0,I.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,I.useState)(()=>new FO({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new FO({...e}),i(a),n({form:e.form,name:e.name}));let o=XO(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=XO(a.store,e=>e.meta.isTouched),c=XO(a.store,e=>e.meta.isBlurred),l=XO(a.store,e=>e.meta.isDirty),u=XO(a.store,e=>e.meta.errorMap),d=XO(a.store,e=>e.meta.errorSourceMap),f=XO(a.store,e=>e.meta.isValidating),p=(0,I.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return ZO(a.mount,[a]),ZO(()=>{a.update(e)}),p}var $O=(({children:e,...t})=>{let n=QO(t),r=(0,I.useMemo)(()=>iO(e,n),[e,n]);return(0,F.jsx)(F.Fragment,{children:r})});function ek(){return(0,I.useState)(()=>SO())[0]}var tk=I,nk=`18.3.1`.split(`.`)[0]===`17`?ek:tk.useId;function rk(e){let[t,n]=(0,I.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,I.useState)(()=>new zO({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new zO({...e})),n({form:e.form,name:e.name}));let a=XO(r.store,e=>e.value),o=XO(r.store,e=>e.meta.isTouched),s=XO(r.store,e=>e.meta.isBlurred),c=XO(r.store,e=>e.meta.isDirty),l=XO(r.store,e=>e.meta.errorMap),u=XO(r.store,e=>e.meta.errorSourceMap),d=XO(r.store,e=>e.meta.isValidating),f=XO(r.store,e=>e.meta.isSubmitting),p=XO(r.store,e=>e.meta.isSubmitted),m=XO(r.store,e=>e.meta.submissionAttempts),h=XO(r.store,e=>e.meta.isSubmitSuccessful),g=XO(r.store,e=>e.meta.canSubmit),_=XO(r.store,e=>e.meta.isValid),v=XO(r.store,e=>e.meta.isFieldsValid),y=XO(r.store,e=>e.meta.isFieldsValidating),b=XO(r.store,e=>e.meta.isGroupValid),x=(0,I.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return ZO(r.mount,[r]),ZO(()=>{r.update(e)}),x}var ik=(({children:e,...t})=>{let n=rk(t),r=(0,I.useMemo)(()=>iO(e,n),[e,n]);return(0,F.jsx)(F.Fragment,{children:r})});function ak({form:e,selector:t=e=>e,children:n}){let r=XO(e.store,t);return(0,F.jsx)(F.Fragment,{children:iO(n,r)})}function ok(e){let t=nk(),[n,r]=(0,I.useState)(e?.formId),[i,a]=(0,I.useState)(()=>new MO({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new MO({...e,formId:n})),r(n)}let o=(0,I.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,F.jsx)($O,{...e,form:i})},e.FormGroup=function(e){return(0,F.jsx)(ik,{...e,form:i})},e.Subscribe=function(e){return(0,F.jsx)(ak,{form:i,selector:e.selector,children:e.children})},e},[i]);ZO(i.mount,[]),ZO(()=>{i.update(e)});let s=(0,I.useRef)(!1);return ZO(()=>{s.current&&e?.transform&&WO(i,e.transform)},[i,e?.transform]),ZO(()=>{s.current=!0}),o}var sk=xb(jb),ck=xb(R({message:jb}));function lk(e){for(let t of e.errors){let e=Km(Wm(Nne(ck(t),e=>e.message),()=>sk(t)));if(e!==void 0&&e.length>0)return e}}var uk=(0,I.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,F.jsxs)(`label`,{...i,className:Dd(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,F.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),dk=(0,I.forwardRef)(function({children:e,className:t,...n},r){return(0,F.jsx)(`div`,{...n,className:Dd(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:I.Children.map(e,e=>(0,I.isValidElement)(e)?(0,I.cloneElement)(e,{className:Dd(`join-item caps-input-group-control`,e.props.className)}):e)})}),fk=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`div`,{...t,className:Dd(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function pk(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,I.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,I.useRef)(null);(0,I.useImperativeHandle)(a,()=>o.current);let s=Hd(),[c,l]=(0,I.useState)(e),u=(0,I.useRef)(!0);return e&&!c&&l(!0),(0,I.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!Bd(n)){e||l(!1);return}let i=Fd(n),a=`translateY(${String(i.distance)}px)`,c=zd(i,i.ease),d=n.getBoundingClientRect().height,f=pk(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:zd(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,F.jsx)(`div`,{...i,ref:o,className:Dd(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var mk=(0,I.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,F.jsx)(`div`,{...r,ref:i,className:Dd(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,F.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,I.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,I.useRef)(null);(0,I.useImperativeHandle)(a,()=>o.current);let s=Hd(),[c,l]=(0,I.useState)({key:e,content:n}),[u,d]=(0,I.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,I.useRef)(null);return(0,I.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,I.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!Bd(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=Fd(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:zd(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:zd(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:zd(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,F.jsx)(`div`,{...i,ref:o,className:Dd(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,F.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,F.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function hk({children:e,...t}){let[n,r]=(0,I.useState)(e);return e&&e!==n&&r(e),(0,F.jsx)(mk,{...t,className:Dd(`caps-field-error-reveal`,t.className),open:!!e,children:(0,F.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function gk({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,F.jsxs)(`footer`,{...a,className:Dd(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,F.jsx)(hk,{children:n}),(0,F.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,F.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,F.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var _k=(0,I.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,F.jsx)(`form`,{...i,"aria-busy":e||void 0,className:Dd(`caps-form`,n),"data-layout":r,ref:a,children:(0,F.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),vk={2:`h2`,3:`h3`,4:`h4`},yk=(0,I.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,I.useId)(),l=vk[i];return(0,F.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:Dd(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,F.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,F.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,F.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,F.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),bk=(0,I.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,layout:a,legend:o,legendTitle:s,...c},l){let u=(0,I.useId)(),d=[n?`${u}-description`:c[`aria-describedby`],r?`${u}-error`:null].filter(Boolean).join(` `)||void 0;return(0,F.jsxs)(`fieldset`,{...c,"aria-describedby":d,"aria-invalid":r?!0:c[`aria-invalid`],className:Dd(`caps-fieldset`,t),"data-layout":a,ref:l,children:[(0,F.jsxs)(`legend`,{className:`caps-fieldset-legend`,title:s,children:[i?(0,F.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}):null,o]}),n?(0,F.jsx)(`p`,{className:`caps-fieldset-description`,id:`${u}-description`,children:n}):null,(0,F.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,F.jsx)(hk,{id:`${u}-error`,children:r})]})});function xk(e){let t=[];return I.Children.forEach(e.props.children,e=>{(0,I.isValidElement)(e)&&e.type!==fk&&t.push(e)}),t[0]??null}var Sk=(0,I.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,I.useId)(),m=(0,I.isValidElement)(e)?e:null,h=m?.type===dk,g=h?xk(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,I.cloneElement)(m,void 0,I.Children.map(m.props.children,e=>e===g?(0,I.cloneElement)(g,w):e)):(0,I.cloneElement)(m,w):e,E=a?(0,F.jsx)(uk,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,F.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,F.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,F.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,F.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,F.jsxs)(`div`,{...d,className:Dd(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,F.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,F.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,F.jsxs)(F.Fragment,{children:[O,T]}),(0,F.jsx)(hk,{id:y,children:r})]})});function Ck(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var wk=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,Tk=6,Ek=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),Dk=(0,I.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,I.useState)(n),[y,b]=(0,I.useState)(null),x=p===void 0?_:p,S=Ck(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,I.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/Tk),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,F.jsxs)(`span`,{className:Dd(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,F.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,F.jsx)(`path`,{className:`caps-number-field-dial-track`,d:wk,pathLength:100}),(0,F.jsx)(`path`,{className:`caps-number-field-dial-level`,d:wk,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,F.jsx)(sr,{"aria-hidden":`true`})}),(0,F.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,F.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=Ek.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,F.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,F.jsx)(cr,{"aria-hidden":`true`})})]})}),Ok={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},kk=(0,I.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,F.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:Dd(`progress caps-gooey-motion caps-gooey-progress w-full`,Ok[t],e),ref:r})});(0,I.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,F.jsxs)(`div`,{...a,ref:o,className:Dd(`caps-game-meter`,i),children:[(0,F.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,F.jsx)(`span`,{children:e}),(0,F.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,F.jsx)(kk,{"aria-label":e,value:t,max:n,tone:r})]})});function Ak({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,F.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,F.jsx)(Nk,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function jk({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,F.jsx)(RD,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,F.jsx)(ur,{}):(0,F.jsx)(dr,{}),onClick:()=>void n(t),type:`button`}):null}function Mk({item:e}){return(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,F.jsx)(`div`,{className:`caps-upload-details`,children:(0,F.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function Nk({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,F.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,F.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,F.jsx)(or,{className:`size-4`})}),(0,F.jsx)(Mk,{item:e}),(0,F.jsx)(Pk,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,F.jsx)(kk,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function Pk({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,F.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,F.jsx)(jk,{action:e.retry,id:t,onAction:i,retry:!0}),(0,F.jsx)(jk,{action:e.cancel,id:t,onAction:n}),(0,F.jsx)(jk,{action:e.remove,id:t,onAction:r})]})}var Fk={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},Ik={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function Lk({state:e}){let t=`caps-checkbox-${(0,I.useId)().replaceAll(`:`,``)}`,n=(0,I.useRef)(null),r=(0,I.useRef)(e).current,i=(0,I.useRef)(e),a=Hd();return(0,I.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=Fd(n.current),c=pm(s,{ease:`inCubic`,duration:160}),l=Qp(n.current,{d:{to:Fk[e],...o?dm:pm(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?dm:t?pm(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...pm(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:Rd(s,120),...fm(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,F.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(tm,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,F.jsx)(nm,{id:`${t}-shadow`}),(0,F.jsx)(rm,{id:`${t}-inset`}),(0,F.jsx)(am,{id:`${t}-goo`,values:Ik}),(0,F.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,F.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,F.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,F.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,F.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,F.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,F.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,F.jsx)(`path`,{ref:n,d:Fk[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,F.jsx)(`clipPath`,{id:`${t}-well`,children:(0,F.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,F.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,F.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,F.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,F.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,F.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,F.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var Rk=(0,I.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,I.useRef)(null),[d,f]=(0,I.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,I.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,I.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,I.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,F.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,F.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:Dd(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,F.jsx)(Lk,{state:m}):n]})}),zk=Rfe({keyCode:Bfe(229)});function Bk(e){return e.nativeEvent.isComposing||_i(zk,e.nativeEvent).success}var Vk={};function Hk(e,t){let n=I.useRef(Vk);return n.current===Vk&&(n.current=e(t)),n}var Uk=[],Wk=void 0;function Gk(){return Wk}function Kk(e){Uk.push(e)}function qk(e){let t=(t,n)=>{let r=Hk(Yk).current,i;try{Wk=r;for(let e of Uk)e.before(r);i=e(t,n);for(let e of Uk)e.after(r);r.didInitialize=!0}finally{Wk=void 0}return i};return t.displayName=e.displayName||e.name,t}function Jk(e){return I.forwardRef(qk(e))}function Yk(){return{didInitialize:!1}}function Xk(){}var Zk=Object.freeze([]),Qk=Object.freeze({});function $k(e){I.useEffect(e,Zk)}var eA=0,tA=class e{static create(){return new e}currentId=eA;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=eA,t()},e)}isStarted(){return this.currentId!==eA}clear=()=>{this.currentId!==eA&&(clearTimeout(this.currentId),this.currentId=eA)};disposeEffect=()=>this.clear};function nA(){let e=Hk(tA.create).current;return $k(e.disposeEffect),e}var rA=typeof document<`u`?I.useLayoutEffect:()=>{};function iA(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:she,platform:che,maxTouchPoints:lhe}=iA(),aA=she.toLowerCase(),oA=che.toLowerCase(),sA=/^i(os$|p)/.test(oA)||oA===`macintel`&&lhe>1,cA=`android`,lA=oA===cA||aA.includes(cA),uhe=!sA&&oA.startsWith(`mac`);oA.startsWith(`win`),!lA&&/^(linux|chrome os)/.test(oA);var dhe=uhe||sA,uA=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!uA&&aA.includes(`firefox`),!uA&&aA.includes(`chrom`);var fhe=dhe,phe=/jsdom|happydom/.test(aA);function mhe(e){e.preventDefault(),e.stopPropagation()}function hhe(e){return`nativeEvent`in e}function dA(e){return e.pointerType===``&&e.isTrusted?!0:lA&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function fA(e){return phe?!1:!lA&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(lA||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function pA(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ghe(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function mA(){return typeof window<`u`}function hA(e){return vA(e)?(e.nodeName||``).toLowerCase():`#document`}function gA(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _A(e){return((vA(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function vA(e){return mA()?e instanceof Node||e instanceof gA(e).Node:!1}function yA(e){return mA()?e instanceof Element||e instanceof gA(e).Element:!1}function bA(e){return mA()?e instanceof HTMLElement||e instanceof gA(e).HTMLElement:!1}function xA(e){return!mA()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof gA(e).ShadowRoot}function SA(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=kA(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _he(e){return/^(table|td|th)$/.test(hA(e))}function CA(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var vhe=/transform|translate|scale|rotate|perspective|filter/,yhe=/paint|layout|strict|content/,wA=e=>!!e&&e!==`none`,TA;function EA(e){let t=yA(e)?kA(e):e;return wA(t.transform)||wA(t.translate)||wA(t.scale)||wA(t.rotate)||wA(t.perspective)||!DA()&&(wA(t.backdropFilter)||wA(t.filter))||vhe.test(t.willChange||``)||yhe.test(t.contain||``)}function bhe(e){let t=jA(e);for(;bA(t)&&!OA(t);){if(EA(t))return t;if(CA(t))return null;t=jA(t)}return null}function DA(){return TA??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),TA}function OA(e){return/^(html|body|#document)$/.test(hA(e))}function kA(e){return gA(e).getComputedStyle(e)}function AA(e){return yA(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jA(e){if(hA(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||xA(e)&&e.host||_A(e);return xA(t)?t.host:t}function MA(e){let t=jA(e);return OA(t)?(e.ownerDocument||e).body:bA(t)&&SA(t)?t:MA(t)}function NA(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=MA(e),i=r===e.ownerDocument?.body,a=gA(r);if(i){let e=PA(a);return t.concat(a,a.visualViewport||[],SA(r)?r:[],e&&n?NA(e):[])}return t.concat(r,NA(r,[],n))}function PA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function FA(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function IA(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&xA(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function LA(e,t){let n=e;for(;n;){if(yA(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(xA(n)?n.host:null)}return null}function RA(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var xhe=`data-base-ui-focusable`,She=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,zA=`data-starting-style`,Che=`data-ending-style`,whe={[zA]:``},The={[Che]:``},Ehe={transitionStatus(e){return e===`starting`?whe:e===`ending`?The:null}},Dhe=`data-open`,Ohe=`data-closed`,khe=`data-anchor-hidden`,BA=`data-popup-open`,Ahe=`data-pressed`,jhe={[BA]:``},Mhe={[BA]:``,[Ahe]:``},Nhe={[Dhe]:``},Phe={[Ohe]:``},Fhe={[khe]:``},Ihe={open(e){return e?jhe:null}},Lhe={open(e){return e?Mhe:null}},VA={open(e){return e?Nhe:Phe},anchorHidden(e){return e?Fhe:null}},Rhe={...VA,...Ehe},HA=`data-trigger-disabled`;function UA(e,t){if(!yA(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(HA);for(let[,e]of t.entries())if(IA(e,n))return!e.hasAttribute(HA);return!1}function WA(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function zhe(e){return e.matches(`html,body`)}function GA(e){return bA(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Bhe(e){return LA(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${She}`)!=null}function KA(e){return e?e.getAttribute(`role`)===`combobox`&&GA(e):!1}function qA(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Vhe(e,t){return t!=null&&!pA(t)?0:typeof e==`function`?e():e}function JA(e,t,n){let r=Vhe(e,n);return typeof r==`number`?r:r?.[t]}function YA(e){return typeof e==`function`?e():e}function XA(e,t){return t||e===`click`||e===`mousedown`}function Hhe(e){return e?.includes(`mouse`)&&e!==`mousedown`}function ZA(e,t,n,r){let i=!1,a=!1,o=r??Qk;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Uhe=`none`,QA=`trigger-press`,$A=`trigger-hover`,Whe=`outside-press`,ej=`focus-out`,Ghe=`escape-key`,Khe=`imperative-action`;function tj(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function nj(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function rj(e,t,n,r){let i=Hk(ij).current;return Jhe(i,e,t,n,r)&&aj(i,[e,t,n,r]),i.callback}function qhe(e){let t=Hk(ij).current;return Yhe(t,e)&&aj(t,e),t.callback}function ij(){return{callback:null,cleanup:null,refs:[]}}function Jhe(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Yhe(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function aj(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function oj(e){let t=Hk(Xhe,e).current;return t.next=e,rA(t.effect),t}function Xhe(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var sj={...I},cj=sj.useInsertionEffect,Zhe=cj&&cj!==sj.useLayoutEffect?cj:e=>e();function lj(e){let t=Hk(Qhe).current;return t.next=e,Zhe(t.effect),t.trampoline}function Qhe(){let e={next:void 0,callback:$he,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function $he(){}var uj=null;globalThis.requestAnimationFrame;var dj=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},fj=class e{static create(){return new e}static request(e){return dj.request(e)}static cancel(e){return dj.cancel(e)}currentId=uj;request(e){this.cancel(),this.currentId=dj.request(()=>{this.currentId=uj,e()})}cancel=()=>{this.currentId!==uj&&(dj.cancel(this.currentId),this.currentId=uj)};disposeEffect=()=>this.cancel};function pj(){let e=Hk(fj.create).current;return $k(e.disposeEffect),e}function mj(e){return e?.ownerDocument||document}var hj={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},ege={...hj,position:`fixed`,margin:0,top:0,left:0};({...hj});var gj=I.forwardRef(function(e,t){let[n,r]=I.useState();rA(()=>{fhe&&uA&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,F.jsx)(`span`,{...e,ref:t,style:ege,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),_j=Math.min,vj=Math.max,yj=Math.round,bj=Math.floor,xj=e=>({x:e,y:e}),tge={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Sj(e,t,n){return vj(e,_j(t,n))}function Cj(e,t){return typeof e==`function`?e(t):e}function wj(e){return e.split(`-`)[0]}function Tj(e){return e.split(`-`)[1]}function Ej(e){return e===`x`?`y`:`x`}function Dj(e){return e===`y`?`height`:`width`}function Oj(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function kj(e){return Ej(Oj(e))}function nge(e,t,n){n===void 0&&(n=!1);let r=Tj(e),i=kj(e),a=Dj(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Nj(o)),[o,Nj(o)]}function rge(e){let t=Nj(e);return[Aj(e),t,Aj(t)]}function Aj(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var jj=[`left`,`right`],Mj=[`right`,`left`],ige=[`top`,`bottom`],age=[`bottom`,`top`];function oge(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Mj:jj:t?jj:Mj;case`left`:case`right`:return t?ige:age;default:return[]}}function sge(e,t,n,r){let i=Tj(e),a=oge(wj(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Aj)))),a}function Nj(e){let t=wj(e);return tge[t]+e.slice(t.length)}function cge(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Pj(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cge(e)}function Fj(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function lge(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Ij(e,t=e?kA(e):null){return!e||!e.isConnected||!t||lge(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var uge=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function dge(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return xA(n)?n.host:null}function Lj(e){for(let t of Array.from(e.children))if(hA(t)===`summary`)return t;return null}function fge(e,t){let n=Lj(t);return!!n&&(e===n||IA(n,e))}function Rj(e){let t=e?hA(e):``;return e!=null&&e.matches(uge)&&(t!==`summary`||e.parentElement!=null&&hA(e.parentElement)===`details`&&Lj(e.parentElement)===e)&&(t!==`details`||Lj(e)==null)&&(t!==`input`||e.type!==`hidden`)}function zj(e){if(!Rj(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=dge(t)){let n=t!==e,r=hA(t)===`slot`;if(t.hasAttribute(`inert`)||n&&hA(t)===`details`&&!t.open&&!fge(e,t)||t.hasAttribute(`hidden`)||!r&&!pge(t,n))return!1}return!0}function pge(e,t){let n=kA(e);return t?n.display!==`none`:Ij(e,n)}function Bj(e){let t=e.tabIndex;if(t<0){let t=hA(e);if(t===`details`||t===`audio`||t===`video`||bA(e)&&e.isContentEditable)return 0}return t}function Vj(e){if(hA(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Hj(e,t){let n=Vj(e);if(!n)return!0;let r=t.find(e=>{let t=Vj(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Vj(e);return t?.name===n.name&&t.form===n.form})===n}function Uj(e){if(bA(e)&&hA(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return bA(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Wj(e,t){Uj(e).forEach(e=>{Rj(e)&&t.push(e),Wj(e,t)})}function Gj(e,t,n){Uj(e).forEach(e=>{bA(e)&&e.matches(t)&&n.push(e),Gj(e,t,n)})}function Kj(e){return zj(e)&&Bj(e)>=0}function qj(e){let t=[];return Wj(e,t),t.filter(zj)}function Jj(e){let t=qj(e);return t.filter(e=>Bj(e)>=0&&Hj(e,t))}function Yj(e,t){let n=Jj(e),r=n.length;if(r===0)return;let i=FA(mj(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Xj(e){return Yj(mj(e).body,1)||e}function Zj(e){return Yj(mj(e).body,-1)||e}function mge(e,t,n){if(!e)return null;let r=[];Wj(mj(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(zj);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!IA(n,o)&&Kj(o)&&Hj(o,a))return o}return r[i]}function Qj(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!IA(n,r)}function hge(e){Jj(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function $j(e){let t=[];Gj(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function eM(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...eM(e,t.id,n)])}function tM(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function nM(e){return`data-base-ui-${e}`}var rM=0;function iM(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(rM);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Xk;let o=requestAnimationFrame(a);return rM=o,()=>{rM===o&&(cancelAnimationFrame(o),rM=0)}}var aM=`data-base-ui-inert`,oM=new WeakMap,sM=new WeakSet,cM=new WeakMap,lM=0;function uM(e){return e?xA(e)?e.host:uM(e.parentNode):null}var dM=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=uM(t);return e.contains(n)?n:null}).filter(e=>e!=null),fM=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},pM=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{hA(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function gge(e,t,n,{mark:r=!0}){let i=dM(t,e),a=r?pM(t,fM(i),new Set(i)):[],o=[],s=[];if(n){let e=dM(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);pM(t,fM(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(oM.get(e)||0)+1;oM.set(e,r),o.push(e),r===1&&n&&sM.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(cM.get(e)||0)+1;cM.set(e,t),s.push(e),t===1&&e.setAttribute(aM,``)}),lM+=1,()=>{o.forEach(e=>{let t=(oM.get(e)||0)-1;oM.set(e,t),t||(sM.has(e)||e.removeAttribute(`aria-hidden`),sM.delete(e))}),r&&s.forEach(e=>{let t=(cM.get(e)||0)-1;cM.set(e,t),t||e.removeAttribute(aM)}),--lM,lM||(oM=new WeakMap,sM=new WeakSet,cM=new WeakMap)}}function mM(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=mj(e[0]).body;return gge(e,i,n,{mark:r})}function hM(){let[,e]=I.useState({});return I.useCallback(()=>{e({})},[])}var gM=0;function _ge(e,t=`mui`){let n=I.useRef(void 0),r=hM(),i=e??n.current;return I.useEffect(()=>{n.current??(gM+=1,n.current=`${t}-${gM}`,e??r())},[e,t,r]),i}var _M=sj.useId;function vM(e,t){if(_M!==void 0){let n=_M();return e??(t?`${t}-${n}`:n)}return _ge(e,t)}var vge=18;function yM(e){return vge>=e}function bM(e){if(!I.isValidElement(e))return null;let t=e,n=t.props;return(yM(19)?n?.ref:t.ref)??null}function xM(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function yge(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function bge(e,t){return typeof e==`function`?e(t):e}function xge(e,t){return typeof e==`function`?e(t):e}var SM={};function CM(e,t,n,r,i){if(!n&&!r&&!i&&!e)return wM(t);let a=wM(e);return t&&(a=TM(a,t)),n&&(a=TM(a,n)),r&&(a=TM(a,r)),i&&(a=TM(a,i)),a}function Sge(e){if(e.length===0)return SM;if(e.length===1)return wM(e[0]);let t=wM(e[0]);for(let n=1;n<e.length;n+=1)t=TM(t,e[n]);return t}function wM(e){return DM(e)?{...e(SM)}:Cge(e)}function TM(e,t){return DM(t)?t(e):wge(e,t)}function Cge(e){let t={...e};for(let e in t){let n=t[e];EM(e,n)&&(t[e]=OM(n))}return t}function wge(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=xM(e.style,r);break;case`className`:e[n]=AM(e.className,r);break;default:e[n]=EM(n,r)?Tge(e[n],r):r}}return e}function EM(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function DM(e){return typeof e==`function`}function Tge(e,t){return t?e?(...n)=>{let r=n[0];if(jM(r)){let i=r;kM(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:OM(t):e}function OM(e){return e&&((...t)=>{let n=t[0];return jM(n)&&kM(n),e(...t)})}function kM(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function AM(e,t){return t?e?t+` `+e:t:e}function jM(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function MM(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=kge(r));let i=Ege(t,n,r);if(n.enabled===!1)return null;let a=n.state??Qk;return Age(e,r,i,a)}function Ege(e,t,n){let{className:r,style:i}=e,{state:a=Qk,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?bge(r,a):void 0,d=l?xge(i,a):void 0,f=l?yge(a,c):Qk,p=l&&s?Dge(s):void 0,m=l?xM(f,p)??{}:Qk;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?qhe([m.ref,bM(n),...o]):rj(m.ref,bM(n),o):rj(null,null)),l?(u!==void 0&&(m.className=AM(m.className,u)),d!==void 0&&(m.style=xM(m.style,d)),m):Qk}function Dge(e){return Array.isArray(e)?Sge(e):CM(void 0,e)}var Oge=Symbol.for(`react.lazy`);function kge(e){if(e?.$$typeof!==Oge)return e;let t=I.Children.toArray(e)[0];return I.isValidElement(t)?t:e}function Age(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=CM(n,t.props);return e.ref=n.ref,I.cloneElement(t,e)}return jge(e,n)}function jge(e,t){return e===`button`?(0,I.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,I.createElement)(`img`,{alt:``,...t,key:t.key}):I.createElement(e,t)}var Mge={style:{transition:`none`}},Nge=`data-base-ui-click-trigger`,Pge={fallbackAxisSide:`end`},Fge={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},NM=I.createContext(null),PM=()=>I.useContext(NM),Ige=nM(`portal`);function Lge(e={}){let{ref:t,container:n,componentProps:r=Qk,elementProps:i}=e,a=vM(),o=PM()?.portalNode,[s,c]=I.useState(null),[l,u]=I.useState(null),d=lj(e=>{e!==null&&u(e)}),f=I.useRef(null);rA(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(vA(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=MM(`div`,r,{ref:[t,d],props:[{id:a,[Ige]:``},i]}),m=s&&p?gn.createPortal(p,s):null;return{node:l,nodeId:I.isValidElement(p)?p.props.id:void 0,subtree:m}}var Rge=I.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=Lge({container:o,ref:t,componentProps:e,elementProps:c}),f=I.useRef(null),p=I.useRef(null),m=I.useRef(null),h=I.useRef(null),[g,_]=I.useState(null),v=I.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;I.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Qj(e)&&(e.type===`focusin`?v.current&&=($j(l),!1):(hge(l),v.current=!0))}return nj(tj(l,`focusin`,e,!0),tj(l,`focusout`,e,!0))},[l,y]),rA(()=>{!l||b!==!0||!v.current||($j(l),v.current=!1)},[b,l]);let S=I.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,F.jsxs)(I.Fragment,{children:[d,(0,F.jsxs)(NM.Provider,{value:S,children:[x&&l&&(0,F.jsx)(gj,{"data-type":`outside`,ref:f,onFocus:e=>{Qj(e,l)?m.current?.focus():Zj(g?g.domReference:null)?.focus()}}),x&&l&&(0,F.jsx)(`span`,{role:s,"aria-owns":u,style:Fge}),l&&gn.createPortal(a,l),x&&l&&(0,F.jsx)(gj,{"data-type":`outside`,ref:p,onFocus:e=>{Qj(e,l)?h.current?.focus():(Xj(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,ZA(`focus-out`,e.nativeEvent)))}})]})]})});function FM(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var zge=class{nodesRef={current:[]};events=FM();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},IM=I.createContext(null),LM=I.createContext(null),RM=()=>I.useContext(IM)?.id||null,zM=e=>{let t=I.useContext(LM);return e??t};function Bge(e){let t=vM(),n=zM(e),r=RM();return rA(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Vge(e){let{children:t,id:n}=e,r=RM();return(0,F.jsx)(IM.Provider,{value:I.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Hge(e){let{children:t,externalTree:n}=e,r=Hk(()=>n??new zge).current;return(0,F.jsx)(LM.Provider,{value:r,children:t})}function BM(e){return e==null?e:`current`in e?e.current:e}function Uge(e,t){let n=gA(RA(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(dA(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Wge=20,VM=[];function HM(){VM=VM.filter(e=>e.deref()?.isConnected)}function UM(e){HM(),e&&hA(e)!==`body`&&(VM.push(new WeakRef(e)),VM.length>Wge&&(VM=VM.slice(-20)))}function WM(){return HM(),VM[VM.length-1]?.deref()}function Gge(e){return e?Kj(e)?e:Jj(e)[0]||e:null}function GM(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=qj(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Kj(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Kge(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=lj(()=>b.current.floatingContext?.nodeId),S=i===!1,C=KA(_)&&S,w=oj(i),T=oj(a),E=oj(o),D=oj(u),O=oj(g),k=zM(m),A=PM(),j=I.useRef(!1),M=I.useRef(!1),N=I.useRef(!1),P=I.useRef(null),ee=I.useRef(``),te=I.useRef(``),ne=I.useRef(null),re=I.useRef(null),ie=rj(ne,p,A?.beforeInsideRef),ae=rj(re,A?.afterInsideRef),oe=nA(),se=nA(),ce=pj(),le=A!=null,ue=qA(v),de=lj((e=ue)=>e?Jj(e):[]),fe=lj(()=>h?.().filter(e=>e!=null)??[]);I.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&IA(ue,FA(mj(ue)))&&de().length===0&&!C&&mhe(e)}return tj(mj(ue),`keydown`,e)},[r,ue,c,C,de]),I.useEffect(()=>{if(r||!g)return;let e=mj(ue);function t(){N.current=!1}function n(e){let t=RA(e),n=fe(),r=IA(v,t)||IA(_,t)||IA(A?.portalNode,t)||n.some(e=>e===t||IA(e,t));N.current=!r,te.current=e.pointerType||`keyboard`,LA(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,se.start(0,()=>{M.current=!1}))}function i(){te.current=`keyboard`}return nj(tj(e,`pointerdown`,n,!0),tj(e,`pointerup`,t,!0),tj(e,`pointercancel`,t,!0),tj(e,`keydown`,i,!0),t)},[r,v,_,ue,g,A,se,fe]),I.useEffect(()=>{if(r||!l)return;let e=mj(ue);function n(){M.current=!0,se.start(0,()=>{M.current=!1})}function i(e){let t=RA(e);Kj(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=RA(n);c&&r==null&&a!=null&&IA(v,a)&&UM(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=fe(),p=r?.hasAttribute(nM(`focus-guard`))&&[ne.current,re.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,BM(f),BM(d)].includes(r),m=!(IA(_,r)||IA(v,r)||IA(r,v)||IA(A?.portalNode,r)||u.some(e=>e===r||IA(e,r))||l.hasMatchingElement(e=>IA(e,r))||p||k&&(eM(k.nodesRef.current,o).find(e=>IA(e.context?.elements.floating,r)||IA(e.context?.elements.domReference,r))||tM(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,qA(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&ue&&GM(ue),s&&i!==_&&!Ij(a)&&FA(e)===e.body){if(bA(ue)&&(ue.focus(),s===`popup`)){ce.request(()=>{ue.focus()});return}let e=de(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ue;bA(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==WM())&&(j.current=!0,t.setOpen(!1,ZA(ej,n)))})}function o(){N.current||(b.current.insideReactTree=!0,oe.start(0,()=>{b.current.insideReactTree=!1}))}let u=bA(_)?_:null;if(!(!v&&!u))return nj(u&&tj(u,`focusout`,a),u&&tj(u,`pointerdown`,n),v&&tj(v,`focusin`,i),v&&tj(v,`focusout`,a),v&&A&&tj(v,`focusout`,o,!0))},[r,_,v,ue,c,k,A,t,l,s,de,C,x,b,oe,se,ce,d,f,fe]),I.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${nM(`portal`)}]`)||[]),t=(k?tM(k.nodesRef.current,x()):[]).find(e=>KA(e.context?.elements.domReference||null))?.context?.elements.domReference,n=mM([v,...e,ne.current,re.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...fe(),t,BM(f),BM(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=mM([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,fe]),rA(()=>{if(!g||r||!bA(ue))return;ee.current=``,te.current=``;let e=mj(ue),t=FA(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||IA(ue,t))return;let i=null,a=()=>(i??=de(ue),i[0]||ue),o;o=r===!0||r===null?a():BM(r),o||=a();let s=IA(ue,FA(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&dA(c);iM(o,{sync:l,preventScroll:o===ue,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=FA(e);return!(t!==o&&IA(ue,t))}})})},[r,g,ue,de,w,D,O,b]);let pe=I.useRef(null);rA(()=>{if(r||!ue){pe.current=null;return}pe.current&&=(pe.current.cancelled=!0,null);let e=mj(ue),t=FA(e),n=D.current==null;UM(t);function i(e){if(e.open||(ee.current=Uge(e.nativeEvent,te.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(nM(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(dA(e.nativeEvent)||fA(e.nativeEvent))j.current=!1;else{let e=!1;mj(ue).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&hA(t)!==`body`?t:null,s=n?o||a:a||o;return s||=WM()||null,typeof i==`boolean`?s:BM(i)||s||null}return()=>{y.off(`openchange`,i);let t=FA(e),n=fe(),r=IA(v,t)||n.some(e=>e===t||IA(e,t))||k&&eM(k.nodesRef.current,x(),!1).some(e=>IA(e.context?.elements.floating,t)),o=T.current,s=ee.current,c=a(s),l={cancelled:!1};pe.current=l,queueMicrotask(()=>{pe.current===l&&(pe.current=null);let n=Gge(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&bA(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,ue,T,E,D,y,k,_,x,fe]),rA(()=>{if(!uA||g||!v)return;let e=FA(mj(v));!bA(e)||!GA(e)||IA(v,e)&&e.blur()},[g,v]),rA(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),rA(()=>{if(!(r||!ue))return GM(ue),()=>{queueMicrotask(HM)}},[r,ue]);let me=!r&&(!c||!C)&&(le||c);return(0,F.jsxs)(I.Fragment,{children:[me&&(0,F.jsx)(gj,{"data-type":`inside`,ref:ie,onFocus:e=>{if(c){let e=de();iM(e[e.length-1])}else A?.portalNode&&(j.current=!1,Qj(e,A.portalNode)?Xj(_)?.focus():BM(f??A.beforeOutsideRef)?.focus())}}),n,me&&(0,F.jsx)(gj,{"data-type":`inside`,ref:ae,onFocus:e=>{c?iM(de()[0]):A?.portalNode&&(l&&(j.current=!0),Qj(e,A.portalNode)?Zj(_)?.focus():BM(d??A.afterOutsideRef)?.focus())}})]})}function qge(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=QA}=t,l=e.context.dataRef,u=I.useRef(void 0),d=pj(),f=nA(),p=I.useMemo(()=>{function t(t,n,r,i){let a=ZA(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=pA(e.pointerType,!0)&&fA(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||pA(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=RA(s),p=GA(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}pA(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return I.useMemo(()=>n?{reference:p}:Qk,[n,p])}function Jge(){return!1}function Yge(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Xge(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Jge,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=zM(c),m=lj(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=lj(()=>a),{escapeKey:v,outsidePress:y}=Yge(s),b=I.useRef(!1),x=I.useRef(!1),S=I.useRef(!1),C=I.useRef(!1),w=I.useRef(!1),T=I.useRef(``),E=I.useRef(null),D=nA(),O=nA(),k=nA(),A=lj(()=>{O.clear(),d.current.insideReactTree=!1}),j=lj(e=>{let t=d.current.floatingContext?.nodeId;return(p?eM(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=lj(t=>WA(t,e.select(`floatingElement`))||WA(t,e.select(`domReferenceElement`))),N=lj(t=>{o()&&e.setOpen(!1,ZA(QA,t.nativeEvent))}),P=lj(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=hhe(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=ZA(Ghe,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),ee=lj(()=>{d.current.insideReactTree=!0,O.start(0,A)}),te=lj(t=>{if(!l||!n||t.button!==0)return;let r=RA(t.nativeEvent);IA(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),ne=lj(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});I.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),I.useEffect(()=>A,[A]),I.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new tA,i=mj(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(uA?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&eM(p.nodesRef.current,t).some(t=>WA(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=RA(n),i=`[${nM(`inert`)}]`,a=yA(r)?r.getRootNode():null,o=Array.from((xA(a)?a:mj(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>IA(e,r))))return;let c=yA(r)?r:null;for(;c&&!OA(c);){let e=jA(c);if(OA(e)||!yA(e))break;c=e}if(!(o.length&&yA(r)&&!zhe(r)&&!IA(r,e.select(`floatingElement`))&&o.every(e=>!IA(c,e)))){if(bA(r)&&!(`touches`in n)){let e=OA(r),t=kA(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!dA(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,ZA(Whe,n)),A())}}}function ee(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function te(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function ne(e,t){let n=RA(e);if(!n)return;let r=tj(n,e.type,()=>{t(e),r()})}function re(e){T.current=`touch`,ne(e,te)}function ie(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&ne(e,e=>{e.type===`pointerdown`?ee(e):N(e)})}function ae(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function oe(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function se(e){ne(e,oe)}function ce(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function le(e){ne(e,ce)}let ue=nj(r&&nj(tj(i,`keydown`,P),tj(i,`compositionstart`,a),tj(i,`compositionend`,o)),g&&nj(tj(i,`click`,ie,!0),tj(i,`pointerdown`,ie,!0),tj(i,`pointerup`,ae,!0),tj(i,`pointercancel`,ae,!0),tj(i,`mousedown`,ie,!0),tj(i,`mouseup`,ae,!0),tj(i,`touchstart`,re,{capture:!0,passive:!0}),tj(i,`touchmove`,se,{capture:!0,passive:!0}),tj(i,`touchend`,le,{capture:!0,passive:!0})));return()=>{ue(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let re=I.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ie=I.useMemo(()=>({onKeyDown:P,onPointerDown:ne,onMouseDown:ne,onClickCapture:ee,onMouseDownCapture(e){ee(),te(e)},onPointerDownCapture(e){ee(),te(e)},onMouseUpCapture:ee,onTouchEndCapture:ee,onTouchMoveCapture:ee}),[P,ee,te,ne]);return I.useMemo(()=>n?{reference:re,floating:ie,trigger:re}:{},[n,re,ie])}function Zge(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var KM=Zge(`https://base-ui.com/production-error`,`Base UI`);function Qge(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),rA(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};yA(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function $ge(e,t=!1,n=!1,r=!1){let[i,a]=I.useState(e&&t?`idle`:void 0),[o,s]=I.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),rA(()=>{if(!e&&o&&i!==`ending`&&n){let e=fj.request(()=>{a(`ending`)});return()=>{fj.cancel(e)}}},[e,o,i,n]),rA(()=>{if(!e||t||i===void 0)return;let n=fj.request(()=>{a(void 0)});return()=>{fj.cancel(n)}},[t,e,i]),rA(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=fj.request(()=>{a(`idle`)});return()=>{fj.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function qM(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var JM=null;function e_e(e){if(!JM){let e=[];JM=e,queueMicrotask(()=>{JM=null,gn.flushSync(()=>{for(let t of e)t()})})}JM.push(e)}function YM(e,t=!1,n=!1){let r=pj();return lj((i,a=null)=>{r.cancel();let o=BM(e);if(o==null)return;let s=o,c=()=>{if(!n){gn.flushSync(i);return}e_e(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(qM(s).map(e=>e.finished.then(Xk))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(qM(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=zA;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function XM(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=lj(a),s=YM(r,n,i);I.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function t_e(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=lj(i),{mounted:c,setMounted:l,transitionStatus:u}=$ge(t,!1,!1,o),d=!t&&r;rA(()=>{t&&s(!1)},[t,s]);let f=I.useRef(c),p=I.useRef(!1),m=hM(),h=()=>{f.current=!1,l(!1),a()};rA(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=lj(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return XM({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var n_e={tabIndex:-1,[xhe]:``};function r_e(e){return t=>t!==`touch`||e.current}function i_e(e,t=!1){let n=vM(),r=RM()!=null,i=Hk(()=>e(n,r)).current;return Qge({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function a_e({handle:e,store:t}){return rA(()=>e.attachStore(t),[e,t]),null}function ZM(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function o_e(e,t){let n=I.useRef(null);return lj(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),ZM(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ZM(t))})}function s_e(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function c_e(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function l_e(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=o_e(e,n),o=lj(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=lj(e=>{a(e),e&&o(e)});return rA(()=>(s(t.current),()=>s(null)),[s,t,n,e]),rA(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function u_e(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=I.useRef(null),i=e.useState(`open`);rA(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=ZA(Uhe);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function d_e(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=t_e({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return Hk(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function f_e(e,t){e.useSyncedValues(t),rA(()=>()=>{e.update({activeTriggerProps:Qk,inactiveTriggerProps:Qk,popupProps:Qk})},[e])}function p_e(e,t){rA(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),rA(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var m_e=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},QM=KO(),h_e=yM(19)?__e:v_e;function $M(e,t,n,r,i){return h_e(e,t,n,r,i)}function g_e(e,t,n,r,i){let a=I.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,QM.useSyncExternalStore)(e.subscribe,a,a)}Kk({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,QM.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function __e(e,t,n,r,i){let a=Gk();if(!a)return g_e(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function v_e(e,t,n,r,i){return(0,JO.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var y_e=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return $M(this,e,t,n,r)}},eN=class extends y_e{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){I.useDebugValue(e);let n=this;rA(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;rA(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;rA(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){I.useDebugValue(e);let n=this,r=t!==void 0;rA(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return I.useDebugValue(e),$M(this,this.selectors[e],t,n,r)}useContextCallback(e,t){I.useDebugValue(e);let n=lj(t??Xk);this.context[e]=n}useStateSetter(e){let t=I.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},b_e={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},x_e=class extends eN{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:FM(),nested:n,triggerElements:i},b_e),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ghe(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function S_e(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new x_e({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Qk,inactiveTriggerProps:Qk,popupProps:Qk}}var tN=e=>e.triggerIdProp??e.activeTriggerId,nN=e=>e.openProp??e.open,rN=e=>(e.popupElement?.id??e.floatingId)||void 0;function iN(e,t){return t!==void 0&&nN(e)&&tN(e)===t}function C_e(e,t){return iN(e,t)?!0:t!==void 0&&nN(e)&&tN(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var aN={open:nN,mounted:e=>e.mounted,transitionStatus:e=>nN(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:tN,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:rN,isTriggerActive:(e,t)=>t!==void 0&&tN(e)===t,isOpenedByTrigger:(e,t)=>iN(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&tN(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>C_e(e,t)?rN(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function w_e(e){let t=I.useCallback(t=>e===void 0?Xk:e.subscribeStore(t),[e]),n=I.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,QM.useSyncExternalStore)(t,n,()=>e?.serverStore)}var T_e=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new tA;restTimeout=new tA;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},oN=new WeakMap;function sN(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&oN.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),oN.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function cN(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=oN.get(n);a&&a!==e&&sN(a),sN(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,oN.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function lN(e){let t=e.context.dataRef.current,n=Hk(()=>t.hoverInteractionState??T_e.create()).current;return t.hoverInteractionState||=n,$k(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function E_e(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=zM(),u=RM(),d=lN(e),f=nA(),p=lj(()=>XA(c.current.openEvent?.type,d.interactedInside)),m=lj(()=>Hhe(c.current.openEvent?.type)),h=lj(()=>{sN(d)});rA(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),I.useEffect(()=>h,[h]),rA(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&yA(s)&&o){let e=s,t=o,n=mj(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??LA(e,`[data-rootownerid]`)??n.body;return cN(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),I.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&eM(l.nodesRef.current,u).length>0)}function a(t){let n=JA(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,ZA($A,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=RA(e);if(!Bhe(t)){d.interactedInside=!1;return}d.interactedInside=LA(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(UA(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&yA(o)&&eM(l.nodesRef.current,r,!1).some(e=>IA(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,ZA($A,n)),l.events.emit(`floating.closed`,n)})}let y=o;return nj(y&&tj(y,`mouseenter`,g),y&&tj(y,`mouseleave`,_),y&&tj(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var D_e={current:null};function O_e(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=D_e,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=zM(l),v=lN(e),y=I.useRef(!1),b=oj(i),x=oj(r),S=oj(o),C=oj(n),w=oj(p),T=oj(f),E=lj(()=>XA(h.current.openEvent?.type,v.interactedInside)),D=lj(()=>w.current?.()!==!1),O=lj((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!IA(t,n);if(!yA(r))return!1;let a=r;return i.hasMatchingElement(e=>IA(e,a))&&(!t||!IA(t,a))}),k=lj(()=>{v.handler&&=(mj(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=lj(()=>{sN(v)});return u&&(v.handleCloseOptions=i?.__options),I.useEffect(()=>k,[k]),I.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===$A,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),I.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=JA(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,ZA($A,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,ZA($A,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!yA(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!pA(v.pointerType))return;let n=YA(S.current),r=JA(x.current,`open`,v.pointerType),i=RA(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(yA(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(IA(t,i)){c=t;break}}yA(o)&&yA(s)&&!e.context.triggerElements.hasElement(o)&&IA(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&yA(c)&&yA(s)&&IA(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,ZA($A,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,ZA($A,t,c))}):g&&D()&&e.setOpen(!0,ZA($A,t,c)))}function o(n){if(E()){A();return}k();let r=mj(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!UA(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!IA(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){IA(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?tj(r,`mouseout`,l):void 0;return s?nj(tj(r,`mousemove`,i,{once:!0}),tj(r,`mouseenter`,i),tj(r,`mouseleave`,o),f):nj(tj(r,`mouseenter`,i),tj(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),I.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!pA(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;cN(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=YA(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,ZA($A,n,r))}v.pointerType===`touch`?gn.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}var uN=.1,k_e=uN*uN,dN=.5;function fN(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function pN(e,t,n,r,i,a,o,s,c,l){let u=!1;return fN(e,t,n,r,i,a)&&(u=!u),fN(e,t,i,a,o,s)&&(u=!u),fN(e,t,o,s,c,l)&&(u=!u),fN(e,t,c,l,n,r)&&(u=!u),u}function A_e(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function mN(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function j_e(e={}){let{blockPointerEvents:t=!1}=e,n=new tA,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*k_e;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=RA(r),g=r.type===`mouseleave`,_=IA(u,h),v=IA(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&yA(r.relatedTarget)&&IA(u,r.relatedTarget))return;function y(){return!!(s&&eM(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=mN(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=mN(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=mN(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=mN(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!A_e(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?dN/2:dN*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+dN+1,o=C||T?S.bottom-dN:S.top,s=C?T?S.bottom-dN:S.top:S.bottom-dN;M=pN(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?dN/2:dN*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-dN,o=C||T?S.top+dN:S.bottom,s=C?T?S.top+dN:S.bottom:S.top+dN;M=pN(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?dN/2:dN*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+dN+1,o=w||E?S.right-dN:S.left,s=w?E?S.right-dN:S.left:S.right-dN;M=pN(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?dN/2:dN*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-dN,o=w||E?S.left+dN:S.right,s=w?E?S.left+dN:S.right:S.left+dN;M=pN(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function hN(e,t,n){let{reference:r,floating:i}=e,a=Oj(t),o=kj(t),s=Dj(o),c=wj(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Tj(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function M_e(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Cj(t,e),p=Pj(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Fj(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Fj(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var N_e=50,P_e=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:M_e},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hN(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<N_e&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=hN(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},F_e=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Cj(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=wj(r),_=Oj(o),v=wj(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Nj(o)]:rge(o)),x=p!==`none`;!d&&x&&b.push(...sge(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=nge(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Oj(t)||T.every(e=>Oj(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Oj(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},gN=new Set([`left`,`top`]);async function I_e(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=wj(n),s=Tj(n),c=Oj(n)===`y`,l=gN.has(o)?-1:1,u=a&&c?-1:1,d=Cj(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var L_e=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await I_e(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},R_e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Cj(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Oj(i),p=Ej(f),m=u[p],h=u[f],g=(e,t)=>Sj(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},z_e=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Cj(e,t),u={x:n,y:r},d=Oj(i),f=Ej(d),p=u[f],m=u[d],h=Cj(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=gN.has(wj(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},B_e=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Cj(e,t),c=await i.detectOverflow(t,s),l=wj(n),u=Tj(n),d=Oj(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=_j(p-c[m],g),y=_j(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*vj(c.left,c.right):S=p-2*vj(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function _N(e){let t=kA(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=bA(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=yj(n)!==a||yj(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function vN(e){return yA(e)?e:e.contextElement}function yN(e){let t=vN(e);if(!bA(t))return xj(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=_N(t),o=(a?yj(n.width):n.width)/r,s=(a?yj(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var V_e=xj(0);function bN(e){let t=gA(e);return!DA()||!t.visualViewport?V_e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function H_e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===gA(e)}function xN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=vN(e),o=xj(1);t&&(r?yA(r)&&(o=yN(r)):o=yN(e));let s=H_e(a,n,r)?bN(a):xj(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=gA(a),t=yA(r)?gA(r):r,n=e,i=PA(n);for(;i&&t!==n;){let e=yN(i),t=i.getBoundingClientRect(),r=kA(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=gA(i),i=PA(n)}}return Fj({width:u,height:d,x:c,y:l})}function SN(e,t){let n=AA(e).scrollLeft;return t?t.left+n:xN(_A(e)).left+n}function CN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-SN(e,n),y:n.top+t.scrollTop}}function U_e(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=_A(r),s=t?CA(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=xj(1),u=xj(0),d=bA(r);if((d||!a)&&((hA(r)!==`body`||SA(o))&&(c=AA(r)),d)){let e=xN(r);l=yN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?CN(o,c):xj(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function W_e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function G_e(e){let t=AA(e),n=e.ownerDocument.body,r=vj(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=vj(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+SN(e),o=-t.scrollTop;return kA(n).direction===`rtl`&&(a+=vj(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var K_e=25;function q_e(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=gA(e),a=_A(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!DA()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(SN(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=K_e&&(s-=o)}return{width:s,height:c,x:l,y:u}}function J_e(e,t){let n=xN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=yN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function wN(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=q_e(e,n,t);else if(t===`document`)r=G_e(_A(e));else if(yA(t))r=J_e(t,n);else{let n=bN(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Fj(r)}function Y_e(e,t){let n=t.get(e);if(n)return n;let r=NA(e,[],!1).filter(e=>yA(e)&&hA(e)!==`body`),i=null,a=kA(e).position===`fixed`,o=a?jA(e):e;for(;yA(o)&&!OA(o);){let e=kA(o),t=EA(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=jA(o)}return t.set(e,r),r}function X_e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?CA(t)?[]:Y_e(t,this._c):[].concat(n),r],o=wN(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=wN(t,a[e],i);s=vj(n.top,s),c=_j(n.right,c),l=_j(n.bottom,l),u=vj(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Z_e(e){let{width:t,height:n}=_N(e);return{width:t,height:n}}function Q_e(e,t,n){let r=bA(t),i=_A(t),a=n===`fixed`,o=xN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=xj(0);if((r||!a)&&((hA(t)!==`body`||SA(i))&&(s=AA(t)),r)){let e=xN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=SN(i));let l=i&&!r&&!a?CN(i,s):xj(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function TN(e){return kA(e).position===`static`}function EN(e,t){if(!bA(e)||kA(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return _A(e)===n&&(n=n.ownerDocument.body),n}function DN(e,t){let n=gA(e);if(CA(e))return n;if(!bA(e)){let t=jA(e);for(;t&&!OA(t);){if(yA(t)&&!TN(t))return t;t=jA(t)}return n}let r=EN(e,t);for(;r&&_he(r)&&TN(r);)r=EN(r,t);return r&&OA(r)&&TN(r)&&!EA(r)?n:r||bhe(e)||n}var $_e=async function(e){let t=this.getOffsetParent||DN,n=this.getDimensions,r=await n(e.floating);return{reference:Q_e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eve(e){return kA(e).direction===`rtl`}var tve={convertOffsetParentRelativeRectToViewportRelativeRect:U_e,getDocumentElement:_A,getClippingRect:X_e,getOffsetParent:DN,getElementRects:$_e,getClientRects:W_e,getDimensions:Z_e,getScale:yN,isElement:yA,isRTL:eve};function ON(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nve(e,t,n){let r=null,i,a=_A(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=bj(d),h=bj(a.clientWidth-(u+f)),g=bj(a.clientHeight-(d+p)),_=bj(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:vj(0,_j(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ON(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=gA(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function kN(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=vN(e),u=i||a?[...l?NA(l):[],...t?NA(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?nve(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?xN(e):null;c&&g();function g(){let t=xN(e);h&&!ON(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var rve=L_e,ive=R_e,ave=F_e,ove=B_e,sve=z_e,cve=(e,t,n)=>{let r=new Map,i=n??{},a={...tve,...i.platform,_c:r};return P_e(e,t,{...i,platform:a})},AN=typeof document<`u`?I.useLayoutEffect:function(){};function jN(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,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!jN(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!jN(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function MN(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function NN(e,t){let n=MN(e);return Math.round(t*n)/n}function PN(e){let t=I.useRef(e);return AN(()=>{t.current=e}),t}function lve(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=I.useState(r);jN(f,r)||p(r);let[m,h]=I.useState(null),[g,_]=I.useState(null),v=I.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=I.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=I.useRef(null),C=I.useRef(null),w=I.useRef(u),T=c!=null,E=PN(c),D=PN(i),O=PN(l),k=I.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),cve(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!jN(w.current,t)&&(w.current=t,gn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);AN(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=I.useRef(!1);AN(()=>(A.current=!0,()=>{A.current=!1}),[]),AN(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=I.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=I.useMemo(()=>({reference:b,floating:x}),[b,x]),N=I.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=NN(M.floating,u.x),r=NN(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...MN(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return I.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var uve=(e,t)=>{let n=rve(e);return{name:n.name,fn:n.fn,options:[e,t]}},dve=(e,t)=>{let n=ive(e);return{name:n.name,fn:n.fn,options:[e,t]}},fve=(e,t)=>({fn:sve(e).fn,options:[e,t]}),pve=(e,t)=>{let n=ave(e);return{name:n.name,fn:n.fn,options:[e,t]}},mve=(e,t)=>{let n=ove(e);return{name:n.name,fn:n.fn,options:[e,t]}},FN=I.createContext(void 0);function IN(e){let t=I.useContext(FN);if(t===void 0&&!e)throw Error(KM(47));return t}var hve={...aN,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!aN.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&aN.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>aN.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},gve=class extends eN{constructor(e,t,n){let r=new m_e;super(_ve(e,r,t,n),vve(r),hve)}setOpen=(e,t)=>{let n=t.reason===$A,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=c_e(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=s_e(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),gn.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function _ve(e,t,n,r=!1){let i={...S_e(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function vve(e){return{popupRef:I.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:I.createRef(),beforeTriggerFocusGuardRef:I.createRef(),beforeContentFocusGuardRef:I.createRef(),stickIfOpenTimeout:new tA,stickIfOpen:!0,triggerElements:e}}var LN=qk(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=bve(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),p_e(u,d),u_e(u);let{forceUnmount:m}=d_e(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),I.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),I.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,ZA(Khe))}),[m,u]);let h=d||f||s!=null;return(0,F.jsxs)(FN.Provider,{value:u,children:[s&&(0,F.jsx)(a_e,{handle:s,store:u}),h&&(0,F.jsx)(xve,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function yve(e){return IN(!0)?(0,F.jsx)(LN,{props:e}):(0,F.jsx)(Hge,{children:(0,F.jsx)(LN,{props:e})})}function bve(e,t){let n=i_e((e,n)=>new gve(t,e,n));return I.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function xve({store:e,modal:t}){let n=Xge(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return f_e(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var Sve=I.createContext(void 0);function Cve(e=!1){let t=I.useContext(Sve);if(t===void 0&&!e)throw Error(KM(16));return t}function wve(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:I.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function RN(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(gA(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Tve(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=I.useRef(null),s=Cve(!0),c=a??s!==void 0,{props:l}=wve({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=I.useCallback(()=>{let e=o.current;zN(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return rA(u,[u]),{getButtonProps:I.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return CM({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(kM(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=zN(r),s=!i&&Eve(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),RN(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),RN(r,e)))},onKeyUp(e){if(!t){if(kM(e),a?.(e),e.target===e.currentTarget&&i&&c&&zN(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),RN(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:lj(e=>{o.current=e,u()})}}function zN(e){return bA(e)&&e.tagName===`BUTTON`}function Eve(e){return bA(e)&&e.tagName===`A`&&!!e.href}function Dve(e){return vM(e,`base-ui`)}function Ove(e,t){function n(n,r,i){let a=n.currentTarget;gn.flushSync(()=>{e.setOpen(!1,ZA(ej,n.nativeEvent,a))}),mge(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&Qj(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function kve(e){let t=I.useRef(``),n=I.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:I.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Ave(e,t){let{onClick:n,onPointerDown:r}=kve(lj((n,r)=>{(typeof e==`function`?e():e)||t(r||(sA?`touch`:``))}));return I.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}var jve=Jk(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=IN(!0),h=w_e(s)??m;if(!h)throw Error(KM(74));let g=Dve(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=I.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=l_e(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=O_e(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:j_e(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=qge(v,{stickIfOpen:lj(()=>h.context.stickIfOpen)}),k=Ave(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=Tve({disabled:a,native:o}),N={open(e){return w?Lhe.open(e):Ihe.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:ee}=Ove(h,x),te=MM(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[Nge]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),ne=(0,F.jsx)(I.Fragment,{children:te},g);return E?(0,F.jsxs)(I.Fragment,{children:[(0,F.jsx)(gj,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),ne,(0,F.jsx)(gj,{ref:h.context.triggerFocusTargetRef,onFocus:ee})]}):ne}),BN=I.createContext(void 0);function Mve(){let e=I.useContext(BN);if(e===void 0)throw Error(KM(45));return e}var Nve=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return IN().useState(`mounted`)||n?(0,F.jsx)(BN.Provider,{value:n,children:(0,F.jsx)(Rge,{ref:t,...r})}):null});function Pve(e){return yM(19)?e:e?`true`:void 0}var VN=I.createContext(void 0);function Fve(){let e=I.useContext(VN);if(!e)throw Error(KM(46));return e}function Ive(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=I.useState(null),d=I.useRef(null),f=zM(n),p=I.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=lve({...e,elements:{...p,...l&&{reference:l}}}),h=I.useCallback(e=>{let t=yA(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=I.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=I.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=I.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return rA(()=>{o&&(d.current=o)},[o]),rA(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),I.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var Lve=I.createContext(void 0);function Rve(){return I.useContext(Lve)?.direction??`ltr`}var zve=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Cj(e,t)||{};if(l==null)return{};let d=Pj(u),f={x:n,y:r},p=kj(i),m=Dj(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=Sj(D,k,O),j=!c.arrow&&Tj(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Bve=(e,t)=>{let{name:n,fn:r}=zve(e);return{name:n,fn:r,options:[e,t]}},Vve={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Hve={sideX:`left`,sideY:`top`},Uve=`--available-width`,Wve=`--available-height`,Gve=`--anchor-width`,Kve=`--anchor-height`,qve=`--transform-origin`,HN=Uve,UN=Wve;function WN(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function GN(e,t,n){let{rects:r,placement:i}=e;return{side:WN(t,wj(i),n),align:Tj(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Jve(e){return Yve(e,Ive)}function Yve(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=lj(O),A=O?k:n,j=oj(n),M=oj(g),N=Rve()===`rtl`,[P,ee]=I.useState(null);!g&&P!==null&&ee(null);let te=x===`placement`,ne=P?wj(P):null,re=P&&te?Tj(P)||`center`:null,ie=ne||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],ae=re||o,oe=ae===`center`?ie:`${ie}-${ae}`,se=l;typeof se==`number`?se={top:se,right:se,bottom:se,left:se}:se&&={top:se.top||0,right:se.right||0,bottom:se.bottom||0,left:se.left||0};let ce=+(i===`bottom`),le=+(i===`top`),ue=+(i===`right`),de=+(i===`left`),fe={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:se},pe=I.useRef(null),me=oj(a),he=oj(s),ge=typeof a==`function`?0:a,_e=typeof s==`function`?0:s,ve=[];p&&ve.push(p),ve.push(uve(e=>{let t=GN(e,i,N),n=typeof me.current==`function`?me.current(t):me.current,r=typeof he.current==`function`?he.current(t):he.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ge,_e,N,i]));let ye=w===`none`&&C!==`shift`,be=!ye&&(u||E||C===`shift`),xe=C===`none`?null:pve({...fe,padding:{top:se.top+1+ce,right:se.right+1+de,bottom:se.bottom+1+le,left:se.left+1+ue},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),Se=ye?null:dve({...fe,rootBoundary:D,mainAxis:w!==`none`,crossAxis:be,limiter:u||E?void 0:fve(e=>{if(!pe.current)return{};let{width:t,height:n}=pe.current.getBoundingClientRect(),r=Oj(wj(e.placement)),i=r===`y`?t:n,a=r===`y`?se.left+se.right:se.top+se.bottom;return{offset:i/2+a/2}})},[fe,u,E,D,se,w]);C===`shift`||w===`shift`||ae===`center`?ve.push(Se,xe):ve.push(xe,Se),ve.push(mve({...fe,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(HN,`${t}px`),i.setProperty(UN,`${n}px`);let a=gA(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(Gve,`${u}px`),i.setProperty(Kve,`${d}px`)}}),Bve(e=>({element:pe.current||mj(e.elements.floating).createElement(`div`),padding:pe.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=wj(r),u=Tj(r),d=Oj(l)===`y`,f=pe.current,p=typeof a==`function`?a(GN(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return be&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(qve,d?`${m} ${h}`:`${h} ${m}`),{}}},Vve,b),rA(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let Ce=I.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:we,elements:Te,x:Ee,y:De,middlewareData:Oe,update:ke,placement:Ae,context:je,isPositioned:Me,floatingStyles:Ne}=t({rootContext:h,open:m?g:void 0,placement:oe,middleware:ve,strategy:r,whileElementsMounted:m?void 0:(...e)=>kN(...e,Ce),nodeId:y,externalTree:S}),{sideX:Pe,sideY:Fe}=Oe.adaptiveOrigin||Hve,Ie=Me?r:`fixed`,Le=I.useMemo(()=>{let e;return e=Me?b?{position:Ie,[Pe]:Ee,[Fe]:De}:{...Ne,position:Ie}:{position:Ie,top:0,left:0},e[HN]=`100vw`,e[UN]=`100vh`,Me||(e.opacity=0),e},[b,Ie,Pe,Ee,Fe,De,Ne,Me]),Re=I.useRef(null);rA(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(KN(t)?t.current:t)||null;n!==Re.current&&(we.setPositionReference(n),Re.current=n)},[g,we,A,j]),I.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&KN(e)&&e.current!==Re.current&&(we.setPositionReference(e.current),Re.current=e.current)},[g,we,A,j]),I.useEffect(()=>{if(m&&g&&Te.reference&&Te.floating)return kN(Te.reference,Te.floating,ke,Ce)},[m,g,Te,ke,Ce]);let ze=wj(Ae),Be=WN(i,ze,N),Ve=Tj(Ae)||`center`,He=!!Oe.hide?.referenceHidden;rA(()=>{x&&g&&Me&&(ze!==ie||te&&Ve!==ae)&&ee(Ae)},[x,te,g,Me,Ae,ze,Ve,ie,ae]);let Ue=I.useMemo(()=>({position:`absolute`,top:Oe.arrow?.y,left:Oe.arrow?.x}),[Oe.arrow]),We=Oe.arrow?.centerOffset!==0;return I.useMemo(()=>({positionerStyles:Le,arrowStyles:Ue,arrowRef:pe,arrowUncentered:We,side:Be,align:Ve,physicalSide:ze,anchorHidden:He,refs:we,context:je,isPositioned:Me,update:ke}),[Le,Ue,pe,We,Be,Ve,ze,He,we,je,Me,ke])}function KN(e){return e!=null&&`current`in e}var Xve=I.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,F.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Zve(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=I.useRef(null),o=I.useRef(null),s=YM(r);rA(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),rA(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function qN(e){return e===`starting`?Mge:Qk}function Qve(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),MM(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},qN(r),i],stateAttributesMapping:VA})}var JN={},YN={},XN=``;function ZN(e,t){return SA(e)?e:t}function QN(e,t,n){return/hidden|clip/.test(e.getComputedStyle(ZN(t,n)).overflowY)}function $ve(e){if(typeof document>`u`)return!1;let t=mj(e);return gA(t).innerWidth-t.documentElement.clientWidth>0}function eye(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=mj(e),n=t.documentElement,r=t.body,i=ZN(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function tye(e){let t=mj(e),n=t.documentElement,r=t.body,i=ZN(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function nye(e){let t=mj(e),n=t.documentElement,r=t.body,i=gA(n),a=0,o=0,s=!1,c=fj.create();if(uA&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,JN={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},XN=n.style.scrollBehavior,YN={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=ZN(n,r);if(s=eye(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,JN),Object.assign(r.style,YN),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=XN)}function d(){u(),c.request(l)}l();let f=tj(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var rye=new class{lockCount=0;restore=null;timeoutLock=tA.create();timeoutUnlock=tA.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=mj(e),n=t.documentElement,r=t.body,i=gA(n);if(QN(i,n,r)){let t=new i.MutationObserver(()=>{QN(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=sA||!$ve(e);this.restore=a?tye(e):nye(e)}};function iye(e=!0,t=null){rA(()=>{if(e)return rye.acquire(t)},[e,t])}var aye=20;function oye(e,t,n,r){let[i,a]=I.useState(!1);rA(()=>{if(!e||!t||n==null){a(!1);return}let r=mj(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-aye)},[e,t,n]),iye(e&&(!t||i),r)}var sye=I.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=Pge,..._}=e,v=IN(),y=Mve(),b=Bge(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=Jve({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});Zve({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;oye(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=Qve(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,F.jsxs)(VN.Provider,{value:j,children:[S&&M&&(0,F.jsx)(Xve,{inert:Pve(!C),cutout:T}),(0,F.jsx)(Vge,{id:b,children:P})]})}),cye=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),lye=I.createContext(void 0);function uye(e){let t=I.useContext(lye);if(t===void 0&&!e)throw Error(KM(69));return t}var dye=I.createContext(void 0);function fye(){let[e,t]=I.useState(0),n=lj(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:I.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var pye=I.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=IN(),l=Fve(),u=uye(!0)!=null,{context:d,hasClosePart:f}=fye(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);XM({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),E_e(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?r_e(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=MM(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...n_e,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&cye.has(e.key)&&e.stopPropagation()}},qN(g),s],stateAttributesMapping:Rhe});return(0,F.jsx)(Kge,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:bA(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,F.jsx)(dye.Provider,{value:d,children:M})})}),$N=`data-glide-stand-in`;function eP(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function tP(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function mye(e){let t=(0,I.useRef)(null);return(0,I.useCallback)(n=>{t.current?.(),t.current=n?hye(n,e):null},[e])}function hye(e,t){if(!Bd(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?eP(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute($N);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),a=t,t},u=(t,n)=>{let r=Fd(e),u=eP(e,t),d=o&&a?eP(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute($N,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute($N,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([tP(d),tP(u)],{duration:r.normal,easing:zd(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}var nP=(0,I.forwardRef)(function({className:e,invalid:t,...n},r){return(0,F.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Dd(`input caps-input w-full`,e),ref:r})});(0,I.forwardRef)(function({leading:e,className:t,...n},r){return(0,F.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,F.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,F.jsx)(nP,{...n,type:`search`,className:t,ref:r})]})});function gye({getKey:e,isDisabled:t=()=>!1,items:n,getFallbackKey:r}){let i=(0,I.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[a,o]=(0,I.useState)(null),s=r?.(i)??null,c=a!==null&&i.some(t=>e(t)===a)?a:s!==null&&i.some(t=>e(t)===s)?s:null;(0,I.useEffect)(()=>{a!==null&&!i.some(t=>e(t)===a)&&o(null)},[a,i,e]);let l=i.find(t=>e(t)===c),u=l?i.findIndex(t=>e(t)===c):-1;return{activeIndex:u,activeItem:l,activeKey:c,enabledItems:i,move:(t,n)=>{if(i.length===0)return;let r=n?n===`start`?0:i.length-1:u<0?t>0?0:i.length-1:(u+t+i.length)%i.length,a=i[r];a&&o(e(a))},setActiveKey:o}}var _ye=(0,I.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,F.jsxs)(`button`,{...r,ref:i,type:n,className:Dd(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,F.jsx)(`span`,{children:e}),(0,F.jsx)(nr,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function vye({defaultInputValue:e,defaultOpen:t,defaultValue:n,getKey:r,getSearchText:i,groupBy:a,id:o,isDisabled:s,items:c,onOpenChange:l,onCommit:u,multiple:d,controlledOpen:f,controlledKeys:p,trigger:m}){let h=`${o}-listbox`,[g,_]=(0,I.useState)(e),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(n),[S,C]=(0,I.useState)(t),w=p??(b===null?[]:[b]),T=m?f??S:!0,E=(0,I.useMemo)(()=>{let e=g.trim().toLowerCase();return e?c.filter(t=>i(t).toLowerCase().includes(e)):c},[i,c,g]),D=gye({getKey:r,isDisabled:s,items:E});(0,I.useEffect)(()=>{if(D.activeKey!==null)return;let e=D.enabledItems.find(e=>w.includes(r(e)))??D.enabledItems[0];e&&D.setActiveKey(r(e))},[D.activeKey,D.enabledItems,D.setActiveKey,r,w]);let O=e=>{y(!1),e||_(``),f===void 0&&C(e),l?.(e)},k=e=>`${h}-option-${encodeURIComponent(e)}`,A=e=>{let t=r(e);p===void 0&&x(t),u(e),m&&!d&&O(!1)},j=e=>{y(!0),_(e.target.value),D.setActiveKey(null)},M=e=>{if(Bk(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(y(!0),e.preventDefault(),D.move(t[0],t[1])):e.key===`Enter`&&D.activeItem&&(e.preventDefault(),A(D.activeItem))},N=(0,I.useMemo)(()=>{if(!a)return[{label:``,items:E}];let e=new Map;for(let t of E){let n=a(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[E,a]);return{keyboardNavigation:v,onPointerMove:()=>{y(!1)},activeKey:D.activeKey,activeItem:D.activeItem,groups:N,inputValue:g,listboxId:h,onInputChange:j,onInputKeyDown:M,optionId:k,open:T,commit:A,selectedKeys:w,setOpen:O}}function yye(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultInputValue:l=``,defaultOpen:u=!1,defaultValue:d=null,emptyMessage:f=`No matches`,getKey:p,getLabel:m,getSearchText:h=m,groupBy:g,id:_,inputProps:v,inputRef:y,isDisabled:b=()=>!1,items:x,onOpenChange:S,onValueChange:C,multiple:w,open:T,placeholder:E=`Search…`,renderItem:D,rootRef:O,trigger:k,triggerRef:A,value:j,...M}=e,N=e=>{let t=p(e);if(w){let e=j.includes(t)?j.filter(e=>e!==t):[...j,t];C?.(e,x.filter(t=>e.includes(p(t))))}else C?.(t,e)},P;w?P=j:j!==void 0&&(P=j===null?[]:[j]);let ee=(0,I.useId)(),te=k?.props??v,ne=_??te?.id??ee,re={id:ne,"aria-describedby":[t,te?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??te?.[`aria-invalid`],"aria-label":te?.[`aria-label`]??r,"aria-labelledby":te?.[`aria-labelledby`]??i,"aria-required":a??te?.[`aria-required`]},{keyboardNavigation:ie,onPointerMove:ae,activeItem:oe,activeKey:se,commit:ce,groups:le,inputValue:ue,listboxId:de,onInputChange:fe,onInputKeyDown:pe,open:me,optionId:he,selectedKeys:ge,setOpen:_e}=vye({defaultInputValue:l,defaultOpen:u,defaultValue:d,getKey:p,getSearchText:h,groupBy:g,id:ne,isDisabled:b,items:x,onOpenChange:S,onCommit:N,multiple:w??!1,controlledOpen:T,controlledKeys:P,trigger:k});hne(()=>{k&&_e(!1)});let ve=ym(`popover`),ye=s===void 0?ve:s,be=mye(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),xe=(0,F.jsx)(nP,{...v,...k?{}:re,"aria-activedescendant":oe?he(p(oe)):void 0,"aria-autocomplete":`list`,"aria-controls":de,"aria-expanded":!0,className:Dd(`input-sm`,v?.className),id:k?v?.id??`${ne}-input`:ne,onChange:e=>{v?.onChange?.(e),fe(e)},onKeyDown:e=>{v?.onKeyDown?.(e),e.defaultPrevented||pe(e)},placeholder:v?.placeholder??E,ref:y,role:`combobox`,value:ue}),Se=(0,F.jsx)(`div`,{id:de,ref:be,className:`caps-combobox-list`,"data-navigation":ie?`keyboard`:`pointer`,onPointerMove:ae,role:`listbox`,"aria-multiselectable":w??void 0,children:le.every(e=>e.items.length===0)?(0,F.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:f}):le.map(e=>(0,F.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,F.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=p(e),n=b(e),r=se===t,i={active:r,disabled:n,selected:ge.includes(t)};return(0,F.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&ie,disabled:n,id:he(t),onClick:()=>{ce(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,F.jsx)(tr,{}):null}),D?.(e,r,i)??m(e)]},t)})]},e.label))});return k?(0,F.jsx)(`div`,{...M,className:Dd(M.className),ref:O,children:(0,F.jsxs)(yve,{modal:!0,onOpenChange:_e,open:me,children:[(0,F.jsx)(jve,{...re,"aria-haspopup":`dialog`,className:`btn`,ref:A,render:k}),ye===null?null:(0,F.jsx)(Nve,{container:ye,children:(0,F.jsx)(sye,{align:`start`,side:`bottom`,sideOffset:4,className:`z-(--stipe-layer-popover)`,children:(0,F.jsxs)(pye,{"data-active-tone":o,className:Dd(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,F.jsx)(`div`,{className:`caps-combobox-search`,children:xe}),Se]})})})]})}):(0,F.jsx)(`div`,{...M,className:Dd(M.className),ref:O,children:(0,F.jsxs)(`div`,{className:Dd(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,F.jsx)(`div`,{className:`caps-combobox-search`,children:xe}),Se]})})}var bye=(0,I.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,F.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,F.jsx)(Rk,{...a,appearance:r??`default`,"aria-label":e,className:Dd(`caps-icon-choice-input`,i),indicator:(0,F.jsx)(rD,{icon:t,caption:n}),ref:o})})}),xye=(0,I.forwardRef)(function({label:e,icon:t,hint:n,className:r,...i},a){let o=(0,I.useId)(),s=[i[`aria-describedby`],n?o:null].filter(Boolean).join(` `)||void 0;return(0,F.jsx)(`label`,{className:`caps-check-key`,children:(0,F.jsx)(Rk,{...i,"aria-label":e,"aria-describedby":s,className:Dd(`caps-check-key-input`,r),indicator:(0,F.jsxs)(`span`,{className:`caps-check-key-face`,"aria-hidden":`true`,children:[t?(0,F.jsx)(`span`,{className:`caps-check-key-icon`,children:t}):null,(0,F.jsxs)(`span`,{className:`caps-check-key-copy`,children:[(0,F.jsx)(`span`,{className:`caps-check-key-label`,children:e}),n?(0,F.jsx)(`span`,{className:`caps-check-key-hint`,id:o,children:n}):null]}),(0,F.jsx)(`span`,{className:`caps-check-key-lamp`})]}),ref:a})})});function Sye({className:e,...t}){return(0,F.jsx)(`div`,{...t,className:Dd(`caps-check-keys`,e)})}function Cye({checked:e}){let t=`caps-radio-${(0,I.useId)().replaceAll(`:`,``)}`,n=(0,I.useRef)(null),r=(0,I.useRef)(e).current,i=(0,I.useRef)(e),a=(0,I.useRef)(null),o=Ld(a),{reduced:s}=o;return(0,I.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=pm(o,{ease:`outCubic`,duration:75}),c=e?fm(o,{bounce:.65,duration:300}):pm(o,{ease:`inCubic`,duration:100}),l=Qp(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,F.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(tm,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,F.jsx)(nm,{id:`${t}-shadow`}),(0,F.jsx)(rm,{id:`${t}-inset`}),(0,F.jsx)(`clipPath`,{id:`${t}-well`,children:(0,F.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,F.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,F.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,F.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var rP=(0,I.createContext)(null),wye=(0,I.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,I.useId)(),d=(0,I.useRef)(null);(0,I.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,I.useState)(n),h=s??p;return(0,I.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,F.jsx)(rP.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,F.jsx)(`fieldset`,{...c,className:Dd(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),iP=(0,I.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,I.useContext)(rP);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,F.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,F.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:Dd(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,F.jsx)(Cye,{checked:c}):t]})}),Tye=(0,I.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,I.useContext)(rP),s=(0,I.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,F.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,F.jsx)(iP,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,F.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,F.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,F.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,F.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),Eye=(0,I.forwardRef)(function({label:e,icon:t,caption:n,art:r=`dim`,className:i,...a},o){return(0,F.jsx)(`label`,{className:`caps-icon-choice`,"data-art":r===`color`?r:void 0,children:(0,F.jsx)(iP,{...a,"aria-label":e,className:Dd(`caps-icon-choice-input`,i),indicator:(0,F.jsx)(rD,{icon:t,caption:n}),ref:o})})});(0,I.forwardRef)(function({label:e,color:t,className:n,...r},i){return(0,F.jsx)(`label`,{className:`caps-icon-choice`,"data-art":`color`,"data-swatch":``,title:e,children:(0,F.jsx)(iP,{...r,"aria-label":e,className:Dd(`caps-icon-choice-input`,n),indicator:(0,F.jsx)(rD,{icon:(0,F.jsx)(`span`,{className:`caps-swatch-dot`,style:{backgroundColor:t}})}),ref:i})})});var Dye=(0,I.forwardRef)(function({className:e,invalid:t,...n},r){return(0,F.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,F.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Dd(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,F.jsx)(nr,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})});function Oye({checked:e}){let t=`caps-switch-${(0,I.useId)().replaceAll(`:`,``)}`,n=(0,I.useRef)(null),r=(0,I.useRef)(null),i=(0,I.useRef)(e).current,a=(0,I.useRef)(e),o=Hd();return(0,I.useLayoutEffect)(()=>{if(!n.current||!r.current)return;let t=o||a.current===e;a.current=e;let i=e?16:8,s=Fd(n.current),c=fm(s,{bounce:.25,duration:440}),l=pm(s,{ease:`inOutSine`,duration:100}),u=Qp(n.current,t?{x:2,y:2,width:i,height:8,duration:0}:{x:[{to:e?2.5:1.5,...l},{to:2,...c}],y:[{to:1.5,...l},{to:2,...c}],height:[{to:9,...l},{to:8,...c}],width:[{to:e?7:16.5,...l},{to:i,...c}]}),d=Qp(r.current,{gradientTransform:e?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`,...t?{duration:0}:{delay:l.duration,...c}});return()=>{u.cancel(),d.cancel()}},[e,o]),(0,F.jsxs)(`svg`,{className:`caps-switch-visual`,width:`40`,height:`24`,viewBox:`0 0 20 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(tm,{ref:r,id:`${t}-surface`,transform:i?`matrix(2 0 0 1 10 6)`:`matrix(1 0 0 1 6 6)`}),(0,F.jsx)(nm,{id:`${t}-shadow`}),(0,F.jsx)(rm,{id:`${t}-inset`}),(0,F.jsx)(`clipPath`,{id:`${t}-track`,children:(0,F.jsx)(`rect`,{x:`1`,y:`1`,width:`18`,height:`10`,rx:`5`})})]}),(0,F.jsx)(`rect`,{className:`caps-switch-track`,filter:`url(#${t}-inset)`,x:`0.5`,y:`0.5`,width:`19`,height:`11`,rx:`5.5`}),(0,F.jsx)(`g`,{clipPath:`url(#${t}-track)`,children:(0,F.jsx)(`rect`,{ref:n,x:`2`,y:`2`,width:i?16:8,height:`8`,rx:`4`,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var kye=(0,I.forwardRef)(function({className:e,checked:t,defaultChecked:n=!1,onChange:r,onCheckedChange:i,...a},o){let s=(0,I.useRef)(null),[c,l]=(0,I.useState)(n),u=t??c;return(0,I.useImperativeHandle)(o,()=>{if(!s.current)throw Error(`Switch input is not mounted`);return s.current},[]),(0,I.useEffect)(()=>{let e=s.current?.form;if(!e||t!==void 0)return;let r=e=>{queueMicrotask(()=>{!e.defaultPrevented&&s.current&&l(n)})};return e.addEventListener(`reset`,r),()=>{e.removeEventListener(`reset`,r)}},[t,n,a.form]),(0,F.jsxs)(`span`,{className:`caps-switch`,"data-checked":u,children:[(0,F.jsx)(`input`,{...a,checked:u,className:Dd(`caps-switch-input`,e),onChange:e=>{t===void 0&&l(e.target.checked),r?.(e),i?.(e.target.checked)},ref:s,role:`switch`,type:`checkbox`}),(0,F.jsx)(Oye,{checked:u})]})}),Aye=(0,I.forwardRef)(function({className:e,invalid:t,...n},r){return(0,F.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:Dd(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})}),jye=xb(jb),Mye=xb(Nb),Nye=xb(zb(Ub)),Pye=xb(Fb(jb)),aP=Fb(Vb(File)),Fye=xb(aP),oP=Lb([jb,Ub,Nb,kb,Ab,Fb(jb),aP]),Iye=xb(oP),sP=e=>Um(jye(e.state.value),()=>``),cP=e=>Um(Mye(e.state.value),()=>!1),Lye=e=>Um(Nye(e.state.value),()=>null),Rye=e=>Um(Pye(e.state.value),()=>[]),zye=e=>Um(Fye(e.state.value),()=>[]),Bye=e=>Um(Iye(e.state.value),()=>null);function Vye({field:e,spec:t,locked:n,...r}){let[i,a]=(0,I.useState)(!1);return(0,F.jsxs)(dk,{children:[(0,F.jsx)(nP,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:sP(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,F.jsx)(ir,{"aria-hidden":`true`}):(0,F.jsx)(ar,{"aria-hidden":`true`})})]})}var Hye={text:`text`,email:`email`,url:`url`,tel:`tel`};function Uye({spec:e,field:t,locked:n,...r}){let i=zye(t),a=n||e.readOnly===!0,o=(0,I.useRef)(null);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,F.jsx)(Md,{asChild:!0,children:(0,F.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,F.jsx)(ZE,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,F.jsx)(Ak,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function Wye({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,F.jsx)(nP,{...a,type:Hye[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,F.jsx)(Aye,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,F.jsx)(Vye,{...r,field:t,spec:e,locked:n});case`money`:return(0,F.jsxs)(dk,{children:[(0,F.jsx)(fk,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,F.jsx)(nP,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,F.jsx)(nP,{...a,type:`date`,readOnly:e.readOnly,value:sP(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,F.jsx)(Dk,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:Lye(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,F.jsxs)(Dye,{...a,value:sP(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,F.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,F.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,F.jsx)(yye,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:sP(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,F.jsx)(_ye,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===sP(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,F.jsx)(Uye,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,F.jsx)(Rk,{...a,disabled:n||e.readOnly===!0,checked:cP(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,F.jsx)(kye,{...a,disabled:n||e.readOnly===!0,checked:cP(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var Gye=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function Kye({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=Rye(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,F.jsx)(bk,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,F.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,F.jsx)(bye,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):(0,F.jsx)(Sye,{children:e.options.map(r=>(0,F.jsx)(xye,{name:e.name,value:r.value,label:r.label,icon:r.icon,hint:r.description,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))})})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,F.jsx)(bk,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,F.jsx)(wye,{name:e.name,"aria-label":o,value:sP(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,F.jsx)(Eye,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,F.jsx)(Tye,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,F.jsx)(Sk,{label:t.label,orientation:`inline`,children:(0,F.jsx)(iP,{value:t.value,disabled:t.disabled})},t.value))})})}function qye({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:Bye(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function Jye({form:e,spec:t,locked:n,layout:r}){let i=QO({form:e,name:t.name}),a=XO(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?lk(i.state.meta):void 0;if(t.render===void 0&&Gye.has(t.kind))return(0,F.jsx)(Kye,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,F.jsx)(Sk,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,F.jsx)(Wye,{spec:t,field:i,locked:n}):(0,F.jsx)(qye,{spec:t,field:i,locked:n,error:o,render:t.render})})}var Yye=xb(noe(jb,oP));function lP({form:e,spec:t,locked:n,layout:r}){let i=t.when;return XO(e.store,e=>i===void 0||i(Um(Yye(e.values),()=>({}))))?(0,F.jsx)(Jye,{form:e,spec:t,locked:n,layout:r}):null}function Xye({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,F.jsx)(lP,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,F.jsx)(yk,{title:t.title,description:t.description,layout:r,children:i})}function uP({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,F.jsx)(Xye,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,F.jsx)(lP,{form:i,spec:a,locked:n,layout:r},t)})}var dP=class{annotation;constructor(e){this.annotation=e}},Zye=class{sections;constructor(e){this.sections=e}},fP=`caps/form`,pP=0;function mP(e){pP+=1;let t={[`${fP}:${String(pP)}`]:new dP(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}jb.annotate(mP({kind:`secret`})).pipe(ioe(`Secret`));var hP=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function Qye(e){return Object.values(e??{}).reduce((e,t)=>t instanceof dP?{...e,...t.annotation}:e,{})}function gP(e){return e.reduce((e,t)=>({...e,...Qye(t)}),{})}function _P(e){let t=e?.[fP];return t instanceof Zye?t.sections:{}}var vP=xb(jb);function yP(e){if(tv(e))return Mne(vP(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!av(e))return null;let t=[];for(let n of e.types){if($_(n))continue;let e=yP(n);if(e===null)return null;t.push(...e)}return t}function bP(e){if(ev(e))return{type:`string`,literals:[]};if(dae(e))return{type:`number`,nullable:!1};if(fae(e))return{type:`boolean`};let t=yP(e);if(t!==null)return{type:`string`,literals:t};if(rv(e)){let[t]=e.rest;if(t===void 0)return null;if(ev(t))return{type:`strings`,literals:[]};let n=yP(t);return n===null?null:{type:`strings`,literals:n}}if(av(e)){let t=e.types.filter(e=>!$_(e)&&!Q_(e)),n=e.types.some(e=>Q_(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=bP(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function $ye(e){let t=e.ast;if(!iv(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=Fy(e.type),r=gP([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:bP(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:Zy(e.type),description:Qy(e.type)}}),sections:_P(Xy(t))}}function xP(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof hu)n=!0,t=t.unwrap();else if(t instanceof yu)r=!0,t=t.unwrap();else if(t instanceof xu)t=t.unwrap();else if(t instanceof ku)t=t.in;else return{node:t,optional:n,nullable:r}}function SP(e){if(e instanceof $l){let t=e.options.map(e=>SP(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof lu?e.options:e instanceof du?[...e.values]:null;if(t===null)return null;let n=t.map(e=>vP(e));return n.every(Hm)?n.map(e=>e.value):null}function ebe(e){let{node:t,nullable:n}=xP(e);if(t instanceof ll)return{type:`string`,literals:[]};if(t instanceof Nl)return{type:`number`,nullable:n};if(t instanceof Ll)return{type:`boolean`};let r=SP(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof ql){let e=xP(t.element).node;if(e instanceof ll)return{type:`strings`,literals:[]};let n=SP(e);return n===null?null:{type:`strings`,literals:n}}return null}function CP(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof hu||e instanceof yu||e instanceof xu?e.unwrap():e instanceof ku?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>Zo.get(e))}function wP(e){return CP(e).reduce((e,t)=>({...e,...t}),{})}function tbe(e){return Object.entries(e.shape)}function nbe(e){let t=xP(e).node;if(!(t instanceof Yl))throw Error(`A schema form needs a z.object.`);return{fields:tbe(t).map(([e,t])=>{let n=gP(CP(t)),r=n.kind===`file`?{type:`files`}:ebe(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=wP(t);return{name:e,valueType:r,optional:xP(t).optional,annotation:n,title:i.title,description:i.description}}),sections:_P(wP(e))}}function rbe(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??hP(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function ibe(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function abe(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function obe(e){let t=e instanceof sl?nbe(e):$ye(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=rbe(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??hP(e.name),help:a,kind:n??ibe(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=abe(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function TP(e){let t=e instanceof sl?e:$ae(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>EP(e)):EP(n)}}}}function EP(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var DP=`onServer`;function OP(e){let t=e.querySelector(`[aria-invalid="true"]`),n=t?.matches(`input, select, textarea, button, [tabindex]`)?t:t?.querySelector(`input, select, textarea, button`);return n?.focus(),n!=null}function sbe(e){if(OP(e))return()=>void 0;let t=new MutationObserver(()=>{OP(e)&&t.disconnect()});return t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`aria-invalid`]}),()=>{t.disconnect()}}function cbe(e){return e.state.meta.errorMap.onServer!==void 0}function lbe(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[DP]:void 0}}))}function ube(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[DP]:n}}))}function kP(e){let[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(e.defaultValues),[s,c]=(0,I.useState)(null);hO(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,I.useMemo)(()=>obe(l),[l]),d=(0,I.useMemo)(()=>TP(l),[l]),f=ok({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),cbe(e)&&lbe(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await TP(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&ube(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function AP(e){return{dirty:XO(e.form.store,e=>!e.isDefaultValue),submitting:XO(e.form.store,e=>e.isSubmitting),canSubmit:XO(e.form.store,e=>e.canSubmit)}}function jP({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=AP(e),f=(0,I.useRef)(null),p=(0,I.useRef)(()=>void 0);return(0,I.useEffect)(()=>()=>{p.current()},[]),(0,F.jsxs)(_k,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{p.current();let t=f.current;t!==null&&!e.form.state.isValid&&(p.current=sbe(t))})},children:[c??(0,F.jsx)(uP,{model:e,disabled:l,layout:o}),s===void 0?(0,F.jsx)(fbe,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function dbe({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=kP({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,F.jsx)(jP,{...a,model:o})}function MP(e){return`model`in e?(0,F.jsx)(jP,{...e}):(0,F.jsx)(dbe,{...e})}function fbe({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=AP(e),d=u?null:e.saved&&!l?(0,F.jsx)(vm,{tone:`success`,size:`compact`,label:e.saved}):l?(0,F.jsx)(vm,{tone:`neutral`,size:`compact`,label:o}):null;return(0,F.jsxs)(gk,{...c,error:e.error,status:d,children:[r?(0,F.jsx)(ZE,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,F.jsx)(ZE,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,F.jsx)(ZE,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var NP=new Set([`Enter`,` `]),pbe=(0,I.forwardRef)(function({children:e,onConfirm:t,holdMs:n=900,holdHint:r=`Press and hold to confirm.`,className:i,disabled:a,loading:o=!1,result:s,resultLabel:c,onBlur:l,onKeyDown:u,onKeyUp:d,onPointerDown:f,onPointerUp:p,onPointerLeave:m,onPointerCancel:h,...g},_){let v=(0,I.useRef)(null),y=(0,I.useRef)(null),b=(0,I.useRef)(null),x=(0,I.useRef)(null),S=(0,I.useRef)(t),C=(0,I.useId)();(0,I.useEffect)(()=>{S.current=t},[t]),(0,I.useEffect)(()=>()=>{y.current?.cancel(),b.current!==null&&clearTimeout(b.current)},[]);let w=()=>{y.current=null,b.current=null,x.current=null,S.current();let e=v.current;if(!e||!Bd(e))return;let t=Fd(e);e.animate([{opacity:1},{opacity:0}],{duration:t.normal,easing:zd(t,t.easeExit)})},T=e=>{let t=v.current;if(a===!0||o||!t||y.current||b.current)return;if(x.current=e,!Bd(t)){b.current=setTimeout(w,n);return}let r=Fd(t),i=t.animate([{transform:`scaleY(0)`},{transform:`scaleY(1)`}],{duration:n,easing:r.reduced?`steps(3, end)`:zd(r,`cubic-bezier(0.3, 0, 0.7, 1)`)});i.addEventListener(`finish`,w),y.current=i},E=e=>{if(e!==void 0&&x.current!==e)return;x.current=null,b.current!==null&&(clearTimeout(b.current),b.current=null);let t=y.current,n=v.current;if(!t||!n)return;y.current=null;let r=getComputedStyle(n).transform;t.cancel();let i=Fd(n);n.animate([{transform:r===`none`?`scaleY(0)`:r},{transform:`scaleY(0)`}],{duration:i.fast,easing:zd(i,i.ease)})};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(ZE,{...g,ref:_,disabled:a,loading:o,result:s,resultLabel:c??(s===void 0?void 0:e),"aria-describedby":C,className:Dd(`caps-hold-button`,i),onBlur:e=>{E(),l?.(e)},onPointerDown:e=>{f?.(e),e.button===0&&T(e.pointerId)},onPointerUp:e=>{p?.(e),E(e.pointerId)},onPointerLeave:e=>{m?.(e),E(e.pointerId)},onPointerCancel:e=>{h?.(e),E(e.pointerId)},onKeyDown:e=>{u?.(e),e.key===`Escape`&&E(),NP.has(e.key)&&(e.preventDefault(),e.repeat||T(`key`))},onKeyUp:e=>{d?.(e),NP.has(e.key)&&(e.preventDefault(),E(`key`))},children:[(0,F.jsx)(`span`,{ref:v,"aria-hidden":`true`,className:`caps-hold-fill`}),e]}),(0,F.jsx)(Md,{id:C,children:r})]})}),PP=(0,I.forwardRef)(function({className:e,...t},n){return(0,F.jsx)(`code`,{...t,className:Dd(`caps-inline-code`,e),ref:n})}),mbe=8e3,FP=(0,I.forwardRef)(function({className:e,detail:t,framed:n=!0,icon:r,message:i,onRetry:a,size:o=`md`,slowAfterMs:s=mbe,variant:c=`line`,...l},u){let[d,f]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{if(f(!1),!Number.isFinite(s))return;let e=globalThis.setTimeout(()=>{f(!0)},s);return()=>{globalThis.clearTimeout(e)}},[s,i]),(0,F.jsxs)(`div`,{...l,className:Dd(`caps-loading-state`,e),"data-framed":n?void 0:`false`,"data-icon":r?``:void 0,"data-size":o,"data-slow":d||void 0,ref:u,role:`status`,children:[r?(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`caps-loading-state-icon`,children:r}):null,(0,F.jsx)(um,{decorative:!0,size:o,variant:c}),(0,F.jsxs)(`span`,{className:`caps-loading-state-copy`,children:[(0,F.jsx)(`span`,{children:i}),t?(0,F.jsx)(`span`,{className:`caps-loading-state-detail`,children:t}):null,d?(0,F.jsx)(`span`,{className:`caps-loading-state-detail`,children:`Still working…`}):null]}),d&&a?(0,F.jsx)(ZE,{className:`caps-loading-state-retry`,size:`sm`,variant:`outline`,onClick:a,children:`Retry`}):null]})}),IP=`data-reorder-key`;function hbe(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{element:t,top:r.top-n.top+e.scrollTop,left:r.left-n.left+e.scrollLeft,width:r.width,height:r.height}}function gbe(e,t,n){e.forEach((e,r)=>{e.animate(t.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,transform:`translateY(${String(t.distance)}px)`},{opacity:1,transform:`none`}],{duration:t.normal,delay:n+r*t.stagger,easing:zd(t,t.ease),fill:`backwards`})})}function _be(e,t,n){let r=t.element.cloneNode(!0);if(!(r instanceof HTMLElement))return;r.removeAttribute(IP),r.removeAttribute(`id`),r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`inert`,``),Object.assign(r.style,{position:`absolute`,top:`${String(t.top-e.clientTop)}px`,left:`${String(t.left-e.clientLeft)}px`,width:`${String(t.width)}px`,height:`${String(t.height)}px`,margin:`0`,pointerEvents:`none`});let i=getComputedStyle(e).position!==`static`;i||(e.style.position=`relative`),e.append(r);let a=r.animate(n.reduced?[{opacity:1},{opacity:0}]:[{opacity:1,transform:`none`},{opacity:0,transform:`translateY(${String(-n.distance)}px)`}],{duration:n.fast,easing:zd(n,n.easeExit),fill:`forwards`}),o=()=>{r.remove(),!i&&e.querySelector(`:scope > [inert]`)===null&&e.style.removeProperty(`position`)};a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o)}function vbe(e,t,n,r){let i=e.style.overflow;e.style.overflow=`clip`;let a=e.animate([{height:`${String(t)}px`},{height:`${String(n)}px`}],r),o=()=>{e.style.overflow=i};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a}function ybe(e,t){let n=(0,I.useRef)(null),r=(0,I.useRef)(0),i=(0,I.useRef)(null),a=t.join(`\0`);(0,I.useLayoutEffect)(()=>{let o=e.current;if(o===null){n.current=null;return}let s=n.current,c=s?.order!==a,l=i.current?o.getBoundingClientRect().height:r.current;c&&(i.current?.cancel(),i.current=null);let u=c?o.getBoundingClientRect().height:r.current;r.current=u;let d=new Map;for(let e of o.querySelectorAll(`:scope [${IP}]`)){let t=e.getAttribute(IP);if(t===null)continue;let n=s?.rows.get(t);d.set(t,!c&&n?.element===e?n:hbe(o,e))}let f=new Set(t);if(n.current={order:a,keys:f,rows:d},s===null||!c||!Bd(o))return;let p=Fd(o),m=[...s.rows].filter(([e,t])=>!f.has(e)&&!t.element.isConnected),h={duration:p.slow,delay:m.length>0?p.fast:0,easing:zd(p,p.ease),fill:`backwards`},g=[],_=[];for(let[e,t]of d){let n=s.rows.get(e);if(n===void 0){s.keys.has(e)||g.push(t.element);continue}let r=n.left-t.left,i=n.top-t.top;(r!==0||i!==0)&&(_.push(t.element),!(p.reduced||p.slow<=0)&&t.element.animate([{transform:`translate(${String(r)}px, ${String(i)}px)`},{transform:`none`}],h))}if(p.reduced)for(let e of _)e.animate([{opacity:.3},{opacity:1}],{duration:p.fast,easing:p.ease});else for(let[,e]of m)_be(o,e,p);if(gbe(g,p,_.length>0&&!p.reduced?p.fast:0),!p.reduced&&Math.abs(l-u)>.5){let e=vbe(o,l,u,h);i.current=e,e.addEventListener(`finish`,()=>{i.current===e&&(i.current=null)})}})}var LP=(0,I.createContext)(null);function RP(){let e=(0,I.useContext)(LP);if(!e)throw Error(`Shed data requires a workspace provider`);return e}function zP({label:e,order:t,children:n,listRoot:r}){let i=(0,I.useRef)(null),a=r??i;return ybe(a,t),(0,F.jsx)(`div`,{ref:a,children:(0,F.jsx)(Kme,{role:`list`,"aria-label":e,children:n})})}var bbe=R({command:$b.pipe(Bb(Zb(16384))).annotate(mP({label:`Command`,required:!0,placeholder:`pnpm dev`})),port:zb(vC.fields.port).annotate(mP({label:`Port (optional)`,help:`Web server preview only.`,min:1,max:65535,render:e=>(0,F.jsx)(nP,{name:e.name,id:e.id,type:`number`,inputMode:`numeric`,placeholder:`5173`,min:1,max:65535,step:1,value:e.value??``,disabled:e.disabled,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],onBlur:()=>{e.onBlur()},onChange:t=>{let n=t.currentTarget;e.onChange(n.value===``?null:n.valueAsNumber)}})}))}),xbe=[{command:`pwd`,label:`Folder`,port:null},{command:`ls`,label:`Files`,port:null},{command:`echo hello`,label:`Hello`,port:null}];function BP({openPreview:e,processNavigation:t}){let{ports:{items:n},processes:{items:r,loading:i,error:a,fix:o,actions:s,stop:c,start:l,output:u,unavailableReason:d}}=RP(),f=(0,I.useRef)(null),p=(0,I.useRef)(null),m=(0,I.useRef)(null),h=(0,I.useRef)(null),g=(0,I.useRef)(0),[_,v]=(0,I.useState)(null),y=e=>{Date.now()-g.current<900&&v(e)},b=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!t||b.current===t.requestId||!f.current)return;let e=[...f.current.querySelectorAll(`[${IP}]`)].find(e=>e.getAttribute(IP)===t.processId);e&&(e.focus(),b.current=t.requestId)},[t,r]);let x=u?.processId??null,S=u?.data!==null;(0,I.useEffect)(()=>{x!==null&&S&&m.current?.scrollIntoView({block:`start`})},[x,S]);let C=u?.data?.lines.length??0,w=u?.data?.process.state===`running`;(0,I.useEffect)(()=>{let e=p.current;w&&e&&(e.scrollTop=e.scrollHeight)},[w,C]);let T=kP({schema:bbe,defaultValues:{command:``,port:null},onSubmit:async({command:e,port:t})=>await l?.(t===null?{command:e}:{command:e,port:t})?{kind:`saved`}:{kind:`refused`}}),E=r!==null||i||a!==null?i&&r===null?(0,F.jsx)(FP,{message:`Loading command history`,size:`sm`,framed:!1}):a!==null&&r===null?(0,F.jsx)(`div`,{className:`px-2 pb-3`,children:(0,F.jsx)(SD,{variant:`quiet`,role:`status`,title:`Can't run commands`,description:a.message,actions:o===void 0?void 0:(0,F.jsx)(ZE,{size:`xs`,variant:`outline`,onClick:()=>void o(),children:a.action===`grant`?`Allow access`:`Try again`})})}):r===null||r.length===0?(0,F.jsx)(`div`,{className:`px-2 pb-3`,children:(0,F.jsx)(SD,{variant:`quiet`,visual:`blobs`,headingLevel:3,title:`Your first command starts here`,description:`Choose a starter above, then press Start. Output and past commands stay here.`})}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`-mx-1`,children:(0,F.jsx)(zP,{label:`Computer process inventory`,order:r.map(({id:e})=>e),listRoot:f,children:r.map(t=>{let r=s?.get(t.id),i=t.state===`running`?n?.find(e=>e.port===t.port):void 0,a,o;t.state===`running`?(a=`success`,o=`Running`):t.state===`uncertain`?(a=`warning`,o=`Status unknown`):t.endedReason===`idle-sleep`?(a=`warning`,o=`Stopped when the Computer went to sleep`):t.exitCode===null?(a=`warning`,o=`Ended · exit not recorded`):(a=t.exitCode===0?`success`:`error`,o=`Exit ${String(t.exitCode)}`);let l=t.state===`exited`&&t.sync===`pending`;return(0,F.jsx)(zD,{[IP]:t.id,role:`listitem`,"data-process-state":t.state,"data-process-sync":t.sync,className:`py-2`,tabIndex:-1,primary:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(PP,{className:`block truncate`,"data-process-command":!0,children:t.command}),(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-normal`,children:[(0,F.jsx)(vm,{size:`compact`,tone:a,className:a===`error`?`text-error`:void 0,label:r===`stopping`?`Stopping`:o}),t.port===null?null:(0,F.jsxs)(`span`,{"data-process-port":!0,children:[`Port `,t.port]})]}),(0,F.jsxs)(F.Fragment,{children:[_===t.id?(0,F.jsx)(`span`,{role:`status`,className:`block text-xs font-normal text-(--stipe-fg-muted)`,children:`Hold to stop`}):null,l?(0,F.jsx)(`span`,{className:`block truncate text-xs font-normal text-(--stipe-fg-muted)`,children:`Changes still copying to your files`}):null,t.cwd===null?null:(0,F.jsx)(`span`,{className:`block truncate text-xs font-normal text-(--stipe-fg-muted)`,children:t.cwd})]})]}),actions:(0,F.jsxs)(F.Fragment,{children:[u?(0,F.jsx)(ZE,{size:`sm`,variant:`ghost`,"aria-label":`Show output of ${t.command}`,onClick:()=>{u.select(t.id)},children:`Output`}):null,i?(0,F.jsxs)(ZE,{size:`sm`,variant:`ghost`,"aria-label":`Open preview of port ${String(i.port)}`,onClick:()=>{e(i)},children:[(0,F.jsx)(er,{size:14,"aria-hidden":`true`}),` Open`]}):null,t.state===`running`&&c?(0,F.jsx)(pbe,{holdHint:`A stopped process cannot be resumed. Press and hold to stop it.`,size:`sm`,variant:`ghost`,className:`hover:text-error`,disabled:r===`stopping`,"aria-label":`Stop process ${t.command}`,onPointerDown:()=>{g.current=Date.now(),v(null)},onPointerUp:()=>{y(t.id)},onConfirm:()=>{v(null),c(t.id)},children:r===`stopping`?`Stopping…`:`Stop`}):null]})},t.id)})})}),i?(0,F.jsx)(FP,{message:`Refreshing processes…`,size:`sm`,framed:!1}):null]}):(0,F.jsx)(BD,{title:`Processes can't be listed yet`,children:`Allow Computer access to see and run commands.`});return(0,F.jsxs)(`div`,{className:`space-y-5 p-4 sm:p-6`,ref:h,children:[d?(0,F.jsx)(`p`,{role:`status`,className:`px-2 pt-3 text-sm`,children:d}):null,l&&(a===null||a.reason===`failed`)?(0,F.jsx)(T.form.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(MP,{model:T,"aria-label":`Start a process`,className:`space-y-3`,disabled:e||d!==void 0,footer:null,children:(0,F.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,F.jsx)(uP,{model:T,disabled:e||d!==void 0}),(0,F.jsx)(ZE,{className:`sm:col-span-2 sm:justify-self-start`,type:`submit`,variant:`primary`,loading:e,disabled:e||d!==void 0,onClick:()=>{T.form.setFieldMeta(`command`,e=>({...e,errorMap:{...e.errorMap,onServer:void 0}}))},children:`Start`})]})}),(0,F.jsx)(`ul`,{"aria-label":`Try one of these`,className:`m-0 mt-3 flex list-none flex-wrap gap-2 p-0`,children:xbe.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(ZE,{size:`sm`,variant:`outline`,disabled:e||d!==void 0,title:t.command,onClick:()=>{T.form.setFieldValue(`command`,t.command),T.form.setFieldValue(`port`,t.port),h.current?.querySelector(`input[name="command"]`)?.focus()},children:[t.label,` `,(0,F.jsx)(PP,{children:t.command})]})},t.command))})]})}):null,u?.processId?(0,F.jsxs)(`section`,{ref:m,"aria-label":`Process output`,className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`min-w-0 break-words font-mono text-sm font-semibold`,children:u.data?.process.command??`Process output`}),(0,F.jsx)(ZE,{size:`xs`,variant:`ghost`,onClick:()=>{u.select(null)},children:`Close output`})]}),u.failed?(0,F.jsx)(SD,{variant:`quiet`,title:`Output unavailable`,description:`Retry to read this command’s output.`,primaryAction:{label:`Retry`,onSelect:()=>void u.retry()}}):u.loading?(0,F.jsx)(FP,{size:`sm`,message:`Loading output`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(iD,{children:(0,F.jsx)(`pre`,{ref:p,className:`max-h-48 overflow-auto whitespace-pre-wrap break-all p-3 text-xs`,children:u.data?.lines.length===0?u.data.process.state===`exited`?`Finished without output.`:`No output yet.`:u.data?.lines.join(`
|
|
96
96
|
`)})}),u.data?.process.state===`running`?(0,F.jsx)(`p`,{role:`status`,className:`text-xs`,children:`Updating while it runs`}):null,u.data?.process.endedReason===`idle-sleep`?(0,F.jsx)(`p`,{className:`text-xs`,children:`Stopped when the Computer went to sleep.`}):null,u.data?.process.exitCode==null?null:(0,F.jsxs)(`p`,{className:`text-xs`,children:[`Exit `,u.data.process.exitCode]}),u.data?.truncated?(0,F.jsx)(`p`,{className:`text-xs`,children:`Showing the most recent output.`}):null]})]}):null,(0,F.jsxs)(`section`,{"aria-label":`Process history`,className:`space-y-3`,children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold`,children:`History`}),E]})]})}function Sbe(e){return BP(e)}var Cbe=xb(bC.fields.id);function wbe(e,t){let n=MC(),r=e?.context.get().computerId??null,[i,a]=(0,I.useState)(null),o=i!==null&&i.computerId===r?i.id:null,s=vw({...ME(e,xC,jE.of(e,`process-output`,o),e=>{if(o===null)throw Error(`Choose a process to read its output`);return e.logs(o)}),enabled:o!==null&&e?.context.get().computerId!=null&&e.capabilities.has(xC),refetchInterval:e=>t&&o!==null&&e.state.data?.process.state!==`exited`?2e3:!1}),c={processId:o,data:s.data??null,loading:s.isPending,failed:s.isError,retry:async()=>{await s.refetch()},select:e=>{a(e===null?null:{computerId:r,id:e})}},l=e?.context.get().computerId!=null&&e.capabilities.has(xC),u=jE.of(e,`processes`),d=vw({...ME(e,xC,u,e=>e.list()),enabled:l,refetchInterval:t?1e4:!1});(0,I.useEffect)(()=>{d.isError&&DC(`Could not refresh processes. Try again.`,d.error)},[d.isError,d.errorUpdatedAt,d.error]),(0,I.useEffect)(()=>{s.isError&&DC(`Could not read command output. Try again.`,s.error)},[s.isError,s.errorUpdatedAt,s.error]);let f=l?e.capabilities.require(xC):null,p=xw({mutationKey:u,mutationFn:e=>{if(!f)throw new rx(`Processes are not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});return f.kill(e)},onError:e=>{DC(`Could not stop the process. Try again.`,e)},onSettled:()=>n.invalidateQueries({queryKey:u,exact:!0})}),m=(0,I.useRef)(null),h=xw({mutationKey:jE.of(e,`process-start`),mutationFn:e=>{if(!f)throw new rx(`Processes are not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});return f.start(e)},onSettled:()=>Promise.all([n.invalidateQueries({queryKey:u,exact:!0}),n.invalidateQueries({queryKey:jE.of(e,`ports`),exact:!0})])});async function g(e){let t=JSON.stringify(e),n=m.current?.input===t?m.current:{input:t,requestId:Qde()};m.current=n;try{let t=await h.mutateAsync({...e,requestId:n.requestId});return a({computerId:r,id:t.id}),m.current===n&&(m.current=null),!0}catch(e){return DC(`Couldn’t confirm the process start. Try again.`,e),!1}}let _=bw({filters:{mutationKey:u,exact:!0},select:({state:e})=>({id:Gm(Cbe(e.variables)),status:e.status})}),v=new Map;for(let{id:e,status:t}of _)e!==null&&(t===`pending`?v.set(e,`stopping`):t===`error`?v.set(e,`failed`):v.delete(e));return{query:d,stop:p,actions:v,enabled:l,startCommand:g,output:c}}var Tbe=xb(R({port:vC.fields.port,expose:Nb}));function Ebe(e,t){let n=MC(),r=e?.context.get().computerId!=null&&e.capabilities.has(yC),i=jE.of(e,`ports`),a=vw({...ME(e,yC,i,()=>{if(!e)throw new rx(`No App connection`,{code:`DISCONNECTED`,retryable:!0});return Pce(e.capabilities)}),enabled:r,refetchInterval:e=>t&&!(e.state.data&&`error`in e.state.data)?1e4:!1}),o=r?e.capabilities.require(yC):null,s=xw({mutationKey:i,mutationFn:async({port:e,expose:t})=>{if(!o)throw new rx(`Ports are not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});t?await o.expose(e):await o.unexpose(e)},onSettled:()=>n.invalidateQueries({queryKey:i,exact:!0})}),c=bw({filters:{mutationKey:i,exact:!0},select:({state:e})=>({change:Gm(Tbe(e.variables)),status:e.status})}),l=new Map;for(let{change:e,status:t}of c)e&&(t===`pending`||t===`error`?l.set(e.port,{expose:e.expose,status:t===`pending`?`pending`:`failed`}):l.delete(e.port));return{query:a,enabled:r,status:r?a.isPending?`loading`:a.isError?`error`:`error`in a.data?`not-configured`:a.isFetching?`loading`:`loaded`:`unavailable`,actions:l,ports:r&&a.data&&`ports`in a.data?a.data.ports:null,change:async(e,t)=>{try{return await s.mutateAsync({port:e,expose:t}),!0}catch{return!1}}}}var VP=o((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase()}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))(),HP=(e,t,n)=>{let r=e instanceof RegExp?UP(e,n):e,i=t instanceof RegExp?UP(t,n):t,a=r!==null&&i!=null&&Dbe(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},UP=(e,t)=>{let n=t.match(e);return n?n[0]:null},Dbe=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},WP=`\0SLASH`+Math.random()+`\0`,GP=`\0OPEN`+Math.random()+`\0`,KP=`\0CLOSE`+Math.random()+`\0`,qP=`\0COMMA`+Math.random()+`\0`,JP=`\0PERIOD`+Math.random()+`\0`,Obe=new RegExp(WP,`g`),kbe=new RegExp(GP,`g`),Abe=new RegExp(KP,`g`),jbe=new RegExp(qP,`g`),Mbe=new RegExp(JP,`g`),Nbe=/\\\\/g,Pbe=/\\{/g,Fbe=/\\}/g,Ibe=/\\,/g,Lbe=/\\\./g,Rbe=1e5,zbe=4e6;function YP(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Bbe(e){return e.replace(Nbe,WP).replace(Pbe,GP).replace(Fbe,KP).replace(Ibe,qP).replace(Lbe,JP)}function Vbe(e){return e.replace(Obe,`\\`).replace(kbe,`{`).replace(Abe,`}`).replace(jbe,`,`).replace(Mbe,`.`)}function XP(e){if(!e)return[``];let t=[],n=HP(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=XP(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function Hbe(e,t={}){if(!e)return[];let{max:n=Rbe,maxLength:r=zbe}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),QP(Bbe(e),n,r,!0).map(Vbe)}function Ube(e){return`{`+e+`}`}function Wbe(e){return/^-?0\d/.test(e)}function Gbe(e,t){return e<=t}function Kbe(e,t){return e>=t}function ZP(e,t,n,r,i,a){let o=[],s=0;for(let c=0;c<e.length;c++)for(let l=0;l<n.length;l++){if(o.length>=r)return o;let u=e[c]+t+n[l];if(!(a&&!u)){if(s+u.length>i)return o;o.push(u),s+=u.length}}return o}function qbe(e,t,n,r){let i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;let o=YP(i[0]),s=YP(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(YP(i[2])),1):1,u=Gbe;s<o&&(l*=-1,u=Kbe);let d=i.some(Wbe),f=0;for(let e=o;u(e,s)&&a.length<n;e+=l){let n;if(t)n=String.fromCharCode(e),n===`\\`&&(n=``);else if(n=String(e),d){let t=c-n.length;if(t>0){let r=Array(t+1).join(`0`);n=e<0?`-`+r+n.slice(1):r+n}}if(f+n.length>r)break;a.push(n),f+=n.length}return a}function QP(e,t,n,r){let i=[``],a=!1,o=!0;for(;;){let s=HP(`{`,`}`,e);if(!s)return ZP(i,e,[``],t,n,a);let c=s.pre;if(/\$$/.test(c)){if(i=ZP(i,c+`{`+s.body+`}`,[``],t,n,a&&!s.post.length),o=!1,!s.post.length)break;e=s.post;continue}let l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),d=l||u,f=s.body.indexOf(`,`)>=0;if(!d&&!f){if(s.post.match(/,(?!,).*\}/)){e=s.pre+`{`+s.body+KP+s.post,r=!0;continue}return ZP(i,c+`{`+s.body+`}`+s.post,[``],t,n,a)}o&&=(a=r&&!d,!1);let p;if(d)p=qbe(s.body,u,t,n);else{let r=XP(s.body);if(r.length===1&&r[0]!==void 0&&(r=QP(r[0],t,n,!1).map(Ube),r.length===1)){if(i=ZP(i,c+r[0],[``],t,n,a&&!s.post.length),!s.post.length)break;e=s.post;continue}let o=a&&!s.post.length&&!c;for(let e=0;o&&e<i.length;e++)i[e]&&(o=!1);p=[];let l=0;outer:for(let e=0;e<r.length;e++){let i=QP(r[e],t,n,!1);for(let e=0;e<i.length;e++){let r=i[e];if(!(o&&!r)){if(p.length>=t||l+r.length>n)break outer;p.push(r),l+=r.length}}}}if(i=ZP(i,c,p,t,n,a&&!s.post.length),!s.post.length)break;e=s.post}return i}var Jbe=65536,$P=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>Jbe)throw TypeError(`pattern is too long`)},Ybe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},eF=e=>e.replace(/[[\]\\-]/g,`\\$&`),Xbe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),tF=e=>e.join(``),Zbe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(Ybe))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(eF(d)+`-`+eF(t)):t===d&&r.push(eF(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(eF(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(eF(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[Xbe(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+tF(r)+`]`,p=`[`+(l?``:`^`)+tF(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},nF=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`),rF,Qbe=new Set([`!`,`?`,`+`,`*`,`@`]),iF=e=>Qbe.has(e),aF=e=>iF(e.type),$be=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),exe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),txe=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),oF=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),nxe=`(?!(?:^|/)\\.\\.?(?:$|/))`,sF=`(?!\\.)`,rxe=new Set([`[`,`.`]),ixe=new Set([`..`,`.`]),axe=new Set(`().*{}+?[]^$\\!`),oxe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),sxe=`[^/]`,cxe=`[^/]*?`,cF=`[^/]+?`,lxe=0,lF=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++lxe;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof rF&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof rF&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new rF(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&iF(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new rF(n,t);u=rF.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new rF(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&iF(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new rF(n,d);d.push(o),u=rF.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new rF(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,exe)}#m(e,t=$be){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=txe){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new rF(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!oF.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=oF.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new rF(null,void 0,t);return rF.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!aF(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?rF.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&ixe.has(this.#r[0]))){let n=rxe,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?nxe:o?sF:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,nF(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,nF(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?sF:``)+cF;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?sF:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,nF(i),this.#t=!!this.#t,this.#n]}#x(){if(aF(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(axe.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?cF:cxe,t=!0;continue}if(o=!1,c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=Zbe(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=sxe,t=!0;continue}i+=oxe(c)}return[i,nF(e),!!t,a]}};rF=lF;var uxe=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),uF=(e,t,n={})=>($P(t),!n.nocomment&&t.charAt(0)===`#`?!1:new yF(t,n).match(e)),dxe=/^\*+([^+@!?*[(]*)$/,fxe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),pxe=e=>t=>t.endsWith(e),mxe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),hxe=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),gxe=/^\*+\.\*+$/,_xe=e=>!e.startsWith(`.`)&&e.includes(`.`),vxe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),yxe=/^\.\*+$/,bxe=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),xxe=/^\*+$/,Sxe=e=>e.length!==0&&!e.startsWith(`.`),Cxe=e=>e.length!==0&&e!==`.`&&e!==`..`,wxe=/^\?+([^+@!?*[(]*)?$/,Txe=([e,t=``])=>{let n=dF([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Exe=([e,t=``])=>{let n=fF([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Dxe=([e,t=``])=>{let n=fF([e]);return t?e=>n(e)&&e.endsWith(t):n},Oxe=([e,t=``])=>{let n=dF([e]);return t?e=>n(e)&&e.endsWith(t):n},dF=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},fF=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},pF=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,mF={win32:{sep:`\\`},posix:{sep:`/`}};uF.sep=pF===`win32`?mF.win32.sep:mF.posix.sep;var hF=Symbol(`globstar **`);uF.GLOBSTAR=hF;var kxe=`[^/]*?`,Axe=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,jxe=`(?:(?!(?:\\/|^)\\.).)*?`;uF.filter=(e,t={})=>n=>uF(n,e,t);var gF=(e,t={})=>Object.assign({},e,t);uF.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return uF;let t=uF;return Object.assign((n,r,i={})=>t(n,r,gF(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,gF(e,n))}static defaults(n){return t.defaults(gF(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,gF(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,gF(e,r))}},unescape:(n,r={})=>t.unescape(n,gF(e,r)),escape:(n,r={})=>t.escape(n,gF(e,r)),filter:(n,r={})=>t.filter(n,gF(e,r)),defaults:n=>t.defaults(gF(e,n)),makeRe:(n,r={})=>t.makeRe(n,gF(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,gF(e,r)),match:(n,r,i={})=>t.match(n,r,gF(e,i)),sep:t.sep,GLOBSTAR:hF})};var _F=(e,t={})=>($P(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Hbe(e,{max:t.braceExpandMax}));uF.braceExpand=_F,uF.makeRe=(e,t={})=>new yF(e,t).makeRe(),uF.match=(e,t,n={})=>{let r=new yF(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var vF=/[?*]|[+@!]\(.*?\)|\[|\]/,Mxe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),yF=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){$P(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||pF,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!vF.test(e[2]))&&!vF.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];(n!==1||r!==``||e[0]!==``)&&(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];(e!==1||r!==``||n[0]!==``)&&(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(hF)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(hF,i),o=t.lastIndexOf(hF),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===hF?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===hF)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return _F(this.pattern,this.options)}parse(e){$P(e);let t=this.options;if(e===`**`)return hF;if(e===``)return``;let n,r=null;(n=e.match(xxe))?r=t.dot?Cxe:Sxe:(n=e.match(dxe))?r=(t.nocase?t.dot?hxe:mxe:t.dot?pxe:fxe)(n[1]):(n=e.match(wxe))?r=(t.nocase?t.dot?Exe:Txe:t.dot?Dxe:Oxe)(n):(n=e.match(gxe))?r=t.dot?vxe:_xe:(n=e.match(yxe))&&(r=bxe);let i=lF.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?kxe:t.dot?Axe:jxe,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?Mxe(e):e===hF?hF:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e===hF&&a!==hF&&(a===void 0?i!==void 0&&i!==hF?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==hF&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=hF))});let i=t.filter(e=>e!==hF);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return uF.defaults(e).Minimatch}};uF.AST=lF,uF.Minimatch=yF,uF.escape=uxe,uF.unescape=nF;var bF=4,xF=0,SF=1,Nxe=2;function CF(e){let t=e.length;for(;--t>=0;)e[t]=0}var wF=29,TF=256,EF=286,DF=30,OF=19,kF=573,AF=15,jF=16,Pxe=7,MF=256,Fxe=16,Ixe=17,Lxe=18,NF=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),PF=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Rxe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),FF=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zxe=512,IF=Array(576);CF(IF);var LF=Array(DF*2);CF(LF);var RF=Array(zxe);CF(RF);var zF=Array(256);CF(zF);var BF=Array(wF);CF(BF);var VF=Array(DF);CF(VF);var HF=class{constructor(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}},UF,WF,GF,KF=class{constructor(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}},qF=e=>e<256?RF[e]:RF[256+(e>>>7)],JF=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},YF=(e,t,n)=>{e.bi_valid>jF-n?(e.bi_buf|=t<<e.bi_valid&65535,JF(e,e.bi_buf),e.bi_buf=t>>jF-e.bi_valid,e.bi_valid+=n-jF):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},XF=(e,t,n)=>{YF(e,n[t*2],n[t*2+1])},ZF=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Bxe=e=>{e.bi_valid===16?(JF(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Vxe=(e,t)=>{let n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=AF;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<kF;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}},QF=(e,t,n)=>{let r=Array(16),i=0,a,o;for(a=1;a<=AF;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=t;o++){let t=e[o*2+1];t!==0&&(e[o*2]=ZF(r[t]++,t))}},Hxe=()=>{let e,t,n,r,i,a=Array(16);for(n=0,r=0;r<wF-1;r++)for(BF[r]=n,e=0;e<1<<NF[r];e++)zF[n++]=r;for(zF[n-1]=r,i=0,r=0;r<16;r++)for(VF[r]=i,e=0;e<1<<PF[r];e++)RF[i++]=r;for(i>>=7;r<DF;r++)for(VF[r]=i<<7,e=0;e<1<<PF[r]-7;e++)RF[256+i++]=r;for(t=0;t<=AF;t++)a[t]=0;for(e=0;e<=143;)IF[e*2+1]=8,e++,a[8]++;for(;e<=255;)IF[e*2+1]=9,e++,a[9]++;for(;e<=279;)IF[e*2+1]=7,e++,a[7]++;for(;e<=287;)IF[e*2+1]=8,e++,a[8]++;for(QF(IF,287,a),e=0;e<DF;e++)LF[e*2+1]=5,LF[e*2]=ZF(e,5);UF=new HF(IF,NF,257,EF,AF),WF=new HF(LF,PF,0,DF,AF),GF=new HF([],Rxe,0,OF,Pxe)},$F=e=>{let t;for(t=0;t<EF;t++)e.dyn_ltree[t*2]=0;for(t=0;t<DF;t++)e.dyn_dtree[t*2]=0;for(t=0;t<OF;t++)e.bl_tree[t*2]=0;e.dyn_ltree[MF*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},eI=e=>{e.bi_valid>8?JF(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},tI=(e,t,n,r)=>{let i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]},nI=(e,t,n)=>{let r=e.heap[n],i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&tI(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!tI(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},rI=(e,t,n)=>{let r,i,a=0,o,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+a++]&255,r+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],r===0?XF(e,i,t):(o=zF[i],XF(e,o+TF+1,t),s=NF[o],s!==0&&(i-=BF[o],YF(e,i,s)),r--,o=qF(r),XF(e,o,n),s=PF[o],s!==0&&(r-=VF[o],YF(e,r,s)));while(a<e.sym_next);XF(e,MF,t)},iI=(e,t)=>{let n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=kF,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)nI(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],nI(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,nI(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Vxe(e,t),QF(n,c,e.bl_count)},aI=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[34]++:e.bl_tree[36]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[32]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},oI=(e,t,n)=>{let r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do XF(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(XF(e,Ixe,e.bl_tree),YF(e,s-3,3)):(XF(e,Lxe,e.bl_tree),YF(e,s-11,7)):(a!==i&&(XF(e,a,e.bl_tree),s--),XF(e,Fxe,e.bl_tree),YF(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},Uxe=e=>{let t;for(aI(e,e.dyn_ltree,e.l_desc.max_code),aI(e,e.dyn_dtree,e.d_desc.max_code),iI(e,e.bl_desc),t=18;t>=3&&e.bl_tree[FF[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},Wxe=(e,t,n,r)=>{let i;for(YF(e,t-257,5),YF(e,n-1,5),YF(e,r-4,4),i=0;i<r;i++)YF(e,e.bl_tree[FF[i]*2+1],3);oI(e,e.dyn_ltree,t-1),oI(e,e.dyn_dtree,n-1)},Gxe=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return xF;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return SF;for(n=32;n<TF;n++)if(e.dyn_ltree[n*2]!==0)return SF;return xF},Kxe=!1,qxe=e=>{Kxe||=(Hxe(),!0),e.l_desc=new KF(e.dyn_ltree,UF),e.d_desc=new KF(e.dyn_dtree,WF),e.bl_desc=new KF(e.bl_tree,GF),e.bi_buf=0,e.bi_valid=0,$F(e)},sI=(e,t,n,r)=>{YF(e,0+ +!!r,3),eI(e),JF(e,n),JF(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Jxe=e=>{YF(e,2,3),XF(e,MF,IF),Bxe(e)},Yxe=(e,t,n,r)=>{let i,a,o=0;e.level>0?(e.strm.data_type===Nxe&&(e.strm.data_type=Gxe(e)),iI(e,e.l_desc),iI(e,e.d_desc),o=Uxe(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,(a<=i||e.strategy===bF)&&(i=a)):i=a=n+5,n+4<=i&&t!==-1?sI(e,t,n,r):e.strategy===bF||a===i?(YF(e,2+ +!!r,3),rI(e,IF,LF)):(YF(e,4+ +!!r,3),Wxe(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),rI(e,e.dyn_ltree,e.dyn_dtree)),$F(e),r&&eI(e)},cI=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(zF[n]+TF+1)*2]++,e.dyn_dtree[qF(t)*2]++),e.sym_next===e.sym_end),lI=(e,t,n,r)=>{let i=e&65535|0,a=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},Xxe=(()=>{let e=new Uint32Array(2048),t;for(let n=0;n<256;n++){t=n;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}for(let n=0;n<256;n++){t=e[n];for(let r=256;r<2048;r+=256)t=e[t&255]^t>>>8,e[r+n]=t}return e})(),uI=(e,t,n,r)=>{let i=Xxe,a=r+n,o=r;e^=-1;for(let n=a-7;o<n;o+=8)e^=t[o]|t[o+1]<<8|t[o+2]<<16|t[o+3]<<24,e=i[1792+(e&255)]^i[1536+(e>>>8&255)]^i[1280+(e>>>16&255)]^i[1024+(e>>>24)]^i[768+t[o+4]]^i[512+t[o+5]]^i[256+t[o+6]]^i[t[o+7]];for(;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1},dI={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`},Zxe=9,Qxe=573,fI=3,pI=258,mI=262,$xe=32,hI=42,gI=57,_I=69,vI=73,yI=91,bI=103,xI=113,SI=666,CI=1,wI=2,TI=3,EI=4,eSe=3,DI=(e,t)=>(e.msg=dI[t],t),OI=e=>e*2-(e>4?9:0),kI=e=>{let t=e.length;for(;--t>=0;)e[t]=0},tSe=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)},AI=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,jI=(e,t)=>{let n;if(e.legacy_hash)n=e.ins_h=AI(e,e.ins_h,e.window[t+fI-1]);else{let r=e.window,i=r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24;n=e.ins_h=Math.imul(i,66521)+66521>>>16&e.hash_mask}let r=e.prev[t&e.w_mask]=e.head[n];return e.head[n]=t,r},MI=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},NI=(e,t)=>{Yxe(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,MI(e.strm)},PI=(e,t)=>{e.pending_buf[e.pending++]=t},FI=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},II=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=lI(e.adler,t,i,n):e.state.wrap===2&&(e.adler=uI(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},LI=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-mI?e.strstart-(e.w_size-mI):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+pI,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,l[i+o]===m&&l[i+o-1]===p&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=pI-(f-r),r=f-pI,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},RI=e=>{let t=e.w_size,n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-mI)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),tSe(e),r+=t),e.strm.avail_in===0)break;if(n=II(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,!e.legacy_hash){if(e.lookahead+e.insert>fI)for(i=e.strstart-e.insert;e.insert&&(jI(e,i),i++,e.insert--,!(e.lookahead+e.insert<=fI)););}else if(e.lookahead+e.insert>=fI)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=AI(e,e.ins_h,e.window[i+1]);e.insert&&(jI(e,i),i++,e.insert--,!(e.lookahead+e.insert<fI)););}while(e.lookahead<mI&&e.strm.avail_in!==0)},zI=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,a,o=0,s=e.strm.avail_in;do{if(r=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&t!==4||t===0||r!==i+e.strm.avail_in)))break;o=+(t===4&&r===i+e.strm.avail_in),sI(e,0,0,o),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,MI(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(II(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(o===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?EI:t!==0&&t!==4&&e.strm.avail_in===0&&e.strstart===e.block_start?wI:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(II(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,n=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=n||(i||t===4)&&t!==0&&e.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=+(t===4&&e.strm.avail_in===0&&r===i),sI(e,e.block_start,r,o),e.block_start+=r,MI(e.strm)),o?TI:CI)},BI=(e,t)=>{let n,r;for(;;){if(e.lookahead<mI){if(RI(e),e.lookahead<mI&&t===0)return CI;if(e.lookahead===0)break}if(n=0,e.lookahead>=fI&&(n=jI(e,e.strstart)),n!==0&&e.strstart-n<=e.w_size-mI&&(e.match_length=LI(e,n)),e.match_length>=fI){if(r=cI(e,e.strstart-e.match_start,e.match_length-fI),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=fI){e.match_length--;do e.strstart++,n=jI(e,e.strstart);while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=AI(e,e.ins_h,e.window[e.strstart+1]))}else r=cI(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(NI(e,!1),e.strm.avail_out===0))return CI}return e.insert=e.strstart<fI-1?e.strstart:fI-1,t===4?(NI(e,!0),e.strm.avail_out===0?TI:EI):e.sym_next&&(NI(e,!1),e.strm.avail_out===0)?CI:wI},VI=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<mI){if(RI(e),e.lookahead<mI&&t===0)return CI;if(e.lookahead===0)break}if(n=0,e.lookahead>=fI&&(n=jI(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=fI-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-mI&&(e.match_length=LI(e,n),e.match_length<=5&&(e.strategy===1||e.match_length===fI&&e.strstart-e.match_start>4096)&&(e.match_length=fI-1)),e.prev_length>=fI&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-fI,r=cI(e,e.strstart-1-e.prev_match,e.prev_length-fI),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(n=jI(e,e.strstart));while(--e.prev_length!==0);if(e.match_available=0,e.match_length=fI-1,e.strstart++,r&&(NI(e,!1),e.strm.avail_out===0))return CI}else if(e.match_available){if(r=cI(e,0,e.window[e.strstart-1]),r&&NI(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return CI}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(r=cI(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<fI-1?e.strstart:fI-1,t===4?(NI(e,!0),e.strm.avail_out===0?TI:EI):e.sym_next&&(NI(e,!1),e.strm.avail_out===0)?CI:wI},nSe=(e,t)=>{let n,r,i,a,o=e.window;for(;;){if(e.lookahead<=pI){if(RI(e),e.lookahead<=pI&&t===0)return CI;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=fI&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=e.strstart+pI;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);e.match_length=pI-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=fI?(n=cI(e,1,e.match_length-fI),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=cI(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(NI(e,!1),e.strm.avail_out===0))return CI}return e.insert=0,t===4?(NI(e,!0),e.strm.avail_out===0?TI:EI):e.sym_next&&(NI(e,!1),e.strm.avail_out===0)?CI:wI},rSe=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(RI(e),e.lookahead===0)){if(t===0)return CI;break}if(e.match_length=0,n=cI(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(NI(e,!1),e.strm.avail_out===0))return CI}return e.insert=0,t===4?(NI(e,!0),e.strm.avail_out===0?TI:EI):e.sym_next&&(NI(e,!1),e.strm.avail_out===0)?CI:wI},HI=class{constructor(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}},UI=[new HI(0,0,0,0,zI),new HI(4,4,8,4,BI),new HI(4,5,16,8,BI),new HI(4,6,32,32,BI),new HI(4,4,16,16,VI),new HI(8,16,32,32,VI),new HI(8,16,128,128,VI),new HI(8,32,128,256,VI),new HI(32,128,258,1024,VI),new HI(32,258,258,4096,VI)],iSe=e=>{e.window_size=2*e.w_size,kI(e.head),e.max_lazy_match=UI[e.level].max_lazy,e.good_match=UI[e.level].good_length,e.nice_match=UI[e.level].nice_length,e.max_chain_length=UI[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=fI-1,e.match_available=0,e.ins_h=0},aSe=class{constructor(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Qxe*2),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kI(this.dyn_ltree),kI(this.dyn_dtree),kI(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kI(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kI(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}},WI=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.status!==hI&&t.status!==gI&&t.status!==_I&&t.status!==vI&&t.status!==yI&&t.status!==bI&&t.status!==xI&&t.status!==SI)},oSe=e=>{if(WI(e))return DI(e,-2);e.total_in=e.total_out=0,e.data_type=2;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?gI:t.wrap?hI:xI,e.adler=t.wrap===2?0:1,t.last_flush=-2,qxe(t),0},sSe=e=>{let t=oSe(e);return t===0&&iSe(e.state),t},cSe=(e,t,n,r,i,a,o)=>{if(!e)return-2;let s=1;if(t===-1&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>Zxe||n!==8||r<8||r>15||t<0||t>9||a<0||a>4||r===8&&s!==1)return DI(e,-2);r===8&&(r=9);let c=new aSe;return e.state=c,c.strm=e,c.status=hI,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.legacy_hash=+!!o,c.hash_bits=i+7,!c.legacy_hash&&c.hash_bits<15&&(c.hash_bits=15),c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+fI-1)/fI),c.window=new Uint8Array(c.w_size*2),c.head=new Uint16Array(c.hash_size),c.prev=new Uint16Array(c.w_size),c.lit_bufsize=1<<i+6,c.pending_buf_size=c.lit_bufsize*4,c.pending_buf=new Uint8Array(c.pending_buf_size),c.sym_buf=c.lit_bufsize,c.sym_end=(c.lit_bufsize-1)*3,c.level=t,c.strategy=a,c.method=n,sSe(e)},lSe=(e,t)=>{if(WI(e)||t>5||t<0)return e?DI(e,-2):-2;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===SI&&t!==4)return DI(e,e.avail_out===0?-5:-2);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(MI(e),e.avail_out===0)return n.last_flush=-1,0}else if(e.avail_in===0&&OI(t)<=OI(r)&&t!==4)return DI(e,-5);if(n.status===SI&&e.avail_in!==0)return DI(e,-5);if(n.status===hI&&n.wrap===0&&(n.status=xI),n.status===hI){let t=8+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=2||n.level<2?0:n.level<6?1:n.level===6?2:3,t|=r<<6,n.strstart!==0&&(t|=$xe),t+=31-t%31,FI(n,t),n.strstart!==0&&(FI(n,e.adler>>>16),FI(n,e.adler&65535)),e.adler=1,n.status=xI,MI(e),n.pending!==0)return n.last_flush=-1,0}if(n.status===gI){if(e.adler=0,PI(n,31),PI(n,139),PI(n,8),n.gzhead)PI(n,+!!n.gzhead.text+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),PI(n,n.gzhead.time&255),PI(n,n.gzhead.time>>8&255),PI(n,n.gzhead.time>>16&255),PI(n,n.gzhead.time>>24&255),PI(n,n.level===9?2:n.strategy>=2||n.level<2?4:0),PI(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(PI(n,n.gzhead.extra.length&255),PI(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=uI(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=_I;else if(PI(n,0),PI(n,0),PI(n,0),PI(n,0),PI(n,0),PI(n,n.level===9?2:n.strategy>=2||n.level<2?4:0),PI(n,eSe),n.status=xI,MI(e),n.pending!==0)return n.last_flush=-1,0}if(n.status===_I){if(n.gzhead.extra){let t=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=uI(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,MI(e),n.pending!==0)return n.last_flush=-1,0;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=uI(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=vI}if(n.status===vI){if(n.gzhead.name){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=uI(e.adler,n.pending_buf,n.pending-t,t)),MI(e),n.pending!==0)return n.last_flush=-1,0;t=0}r=n.gzindex<n.gzhead.name.length?n.gzhead.name.charCodeAt(n.gzindex++)&255:0,PI(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=uI(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=yI}if(n.status===yI){if(n.gzhead.comment){let t=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>t&&(e.adler=uI(e.adler,n.pending_buf,n.pending-t,t)),MI(e),n.pending!==0)return n.last_flush=-1,0;t=0}r=n.gzindex<n.gzhead.comment.length?n.gzhead.comment.charCodeAt(n.gzindex++)&255:0,PI(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>t&&(e.adler=uI(e.adler,n.pending_buf,n.pending-t,t))}n.status=bI}if(n.status===bI){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(MI(e),n.pending!==0))return n.last_flush=-1,0;PI(n,e.adler&255),PI(n,e.adler>>8&255),e.adler=0}if(n.status=xI,MI(e),n.pending!==0)return n.last_flush=-1,0}if(e.avail_in!==0||n.lookahead!==0||t!==0&&n.status!==SI){let r=n.level===0?zI(n,t):n.strategy===2?rSe(n,t):n.strategy===3?nSe(n,t):UI[n.level].func(n,t);if((r===TI||r===EI)&&(n.status=SI),r===CI||r===TI)return e.avail_out===0&&(n.last_flush=-1),0;if(r===wI&&(t===1?Jxe(n):t!==5&&(sI(n,0,0,!1),t===3&&(kI(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),MI(e),e.avail_out===0))return n.last_flush=-1,0}return t===4?n.wrap<=0?1:(n.wrap===2?(PI(n,e.adler&255),PI(n,e.adler>>8&255),PI(n,e.adler>>16&255),PI(n,e.adler>>24&255),PI(n,e.total_in&255),PI(n,e.total_in>>8&255),PI(n,e.total_in>>16&255),PI(n,e.total_in>>24&255)):(FI(n,e.adler>>>16),FI(n,e.adler&65535)),MI(e),n.wrap>0&&(n.wrap=-n.wrap),+(n.pending===0)):0},uSe=e=>{if(WI(e))return-2;let t=e.state.status;return e.state=null,t===xI?DI(e,-3):0},dSe=(e,t)=>{let n=t.length;if(WI(e))return-2;let r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==hI||r.lookahead)return-2;if(i===1&&(e.adler=lI(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(kI(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}let a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,RI(r);r.lookahead>=fI;){let e=r.strstart,t=r.lookahead-(fI-1);do jI(r,e),e++;while(--t);r.strstart=e,r.lookahead=fI-1,RI(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=fI-1,r.match_available=0,e.next_in=o,e.input=s,e.avail_in=a,r.wrap=i,0},GI=16209,fSe=16191;function pSe(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=e.state;n=e.next_in,w=e.input,r=n+(e.avail_in-5),i=e.next_out,T=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=E.dmax,c=E.wsize,l=E.whave,u=E.wnext,d=E.window,f=E.hold,p=E.bits,m=E.lencode,h=E.distcode,g=(1<<E.lenbits)-1,_=(1<<E.distbits)-1;top:do{p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=m[f&g];dolen:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y===0)T[i++]=v&65535;else if(y&16){b=v&65535,y&=15,y&&(p<y&&(f+=w[n++]<<p,p+=8),b+=f&(1<<y)-1,f>>>=y,p-=y),p<15&&(f+=w[n++]<<p,p+=8,f+=w[n++]<<p,p+=8),v=h[f&_];dodist:for(;;){if(y=v>>>24,f>>>=y,p-=y,y=v>>>16&255,y&16){if(x=v&65535,y&=15,p<y&&(f+=w[n++]<<p,p+=8,p<y&&(f+=w[n++]<<p,p+=8)),x+=f&(1<<y)-1,x>s){e.msg=`invalid distance too far back`,E.mode=GI;break top}if(f>>>=y,p-=y,y=i-a,x>y){if(y=x-y,y>l&&E.sane){e.msg=`invalid distance too far back`,E.mode=GI;break top}if(S=0,C=d,u===0){if(S+=c-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}else if(u<y){if(S+=c+u-y,y-=u,y<b){b-=y;do T[i++]=d[S++];while(--y);if(S=0,u<b){y=u,b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}}}else if(S+=u-y,y<b){b-=y;do T[i++]=d[S++];while(--y);S=i-x,C=T}for(;b>2;)T[i++]=C[S++],T[i++]=C[S++],T[i++]=C[S++],b-=3;b&&(T[i++]=C[S++],b>1&&(T[i++]=C[S++]))}else{S=i-x;do T[i++]=T[S++],T[i++]=T[S++],T[i++]=T[S++],b-=3;while(b>2);b&&(T[i++]=T[S++],b>1&&(T[i++]=T[S++]))}}else if(y&64){e.msg=`invalid distance code`,E.mode=GI;break top}else{v=h[(v&65535)+(f&(1<<y)-1)];continue dodist}break}}else if(!(y&64)){v=m[(v&65535)+(f&(1<<y)-1)];continue dolen}else if(y&32){E.mode=fSe;break top}else{e.msg=`invalid literal/length code`,E.mode=GI;break top}break}}while(n<r&&i<o);b=p>>3,n-=b,p-=b<<3,f&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?5+(r-n):5-(n-r),e.avail_out=i<o?257+(o-i):257-(i-o),E.hold=f,E.bits=p}var KI=15,qI=852,JI=592,YI=0,XI=1,ZI=2,mSe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),hSe=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),gSe=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_Se=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),QI=(e,t,n,r,i,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y,b,x,S,C,w=null,T,E=new Uint16Array(16),D=new Uint16Array(16),O=null,k,A,j;for(l=0;l<=KI;l++)E[l]=0;for(u=0;u<r;u++)E[t[n+u]]++;for(p=c,f=KI;f>=1&&E[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(d=1;d<f&&E[d]===0;d++);for(p<d&&(p=d),g=1,l=1;l<=KI;l++)if(g<<=1,g-=E[l],g<0)return-1;if(g>0&&(e===YI||f!==1))return-1;for(D[1]=0,l=1;l<KI;l++)D[l+1]=D[l]+E[l];for(u=0;u<r;u++)t[n+u]!==0&&(o[D[t[n+u]]++]=u);if(e===YI?(w=O=o,T=20):e===XI?(w=mSe,O=hSe,T=257):(w=gSe,O=_Se,T=0),v=0,u=0,l=d,C=a,m=p,h=0,x=-1,_=1<<p,S=_-1,e===XI&&_>qI||e===ZI&&_>JI)return 1;for(;;){k=l-h,o[u]+1<T?(A=0,j=o[u]):o[u]>=T?(A=O[o[u]-T],j=w[o[u]-T]):(A=96,j=0),y=1<<l-h,b=1<<m,d=b;do b-=y,i[C+(v>>h)+b]=k<<24|A<<16|j|0;while(b!==0);for(y=1<<l-1;v&y;)y>>=1;if(y===0?v=0:(v&=y-1,v+=y),u++,--E[l]===0){if(l===f)break;l=t[n+o[u]]}if(l>p&&(v&S)!==x){for(h===0&&(h=p),C+=d,m=l-h,g=1<<m;m+h<f&&(g-=E[m+h],!(g<=0));)m++,g<<=1;if(_+=1<<m,e===XI&&_>qI||e===ZI&&_>JI)return 1;x=v&S,i[x]=p<<24|m<<16|C-a|0}}return v!==0&&(i[C+v]=l-h<<24|4194304),s.bits=p,0},vSe=0,$I=1,eL=2,tL=16180,nL=16181,rL=16182,iL=16183,aL=16184,oL=16185,sL=16186,cL=16187,lL=16188,uL=16189,dL=16190,fL=16191,pL=16192,mL=16193,hL=16194,gL=16195,_L=16196,vL=16197,yL=16198,bL=16199,xL=16200,SL=16201,CL=16202,wL=16203,TL=16204,EL=16205,DL=16206,OL=16207,kL=16208,AL=16209,jL=16210,ML=16211,ySe=852,bSe=592,NL=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24),xSe=class{constructor(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}},PL=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<tL||t.mode>ML)},SSe=e=>{if(PL(e))return-2;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=t.wrap&1),t.mode=tL,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(ySe),t.distcode=t.distdyn=new Int32Array(bSe),t.sane=1,t.back=-1,0},FL=e=>{if(PL(e))return-2;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,SSe(e)},CSe=(e,t)=>{let n;if(PL(e))return-2;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?-2:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,FL(e))},wSe=(e,t)=>{if(!e)return-2;let n=new xSe;e.state=n,n.strm=e,n.window=null,n.mode=tL;let r=CSe(e,t);return r!==0&&(e.state=null),r},IL=!0,LL,RL,TSe=e=>{if(IL){LL=new Int32Array(512),RL=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(QI($I,e.lens,0,288,LL,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;QI(eL,e.lens,0,32,RL,0,e.work,{bits:5}),IL=!1}e.lencode=LL,e.lenbits=9,e.distcode=RL,e.distbits=5},zL=(e,t,n,r)=>{let i,a=e.state;return a.window===null&&(a.window=new Uint8Array(1<<a.wbits)),a.wsize===0&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0),r>=a.wsize?(a.window.set(t.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(t.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(t.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},BL=(e,t)=>{let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g=0,_,v,y,b,x,S,C,w,T=new Uint8Array(4),E,D,O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(PL(e)||!e.output||!e.input&&e.avail_in!==0)return-2;n=e.state,n.mode===fL&&(n.mode=pL),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,d=s,f=c,w=0;inf_leave:for(;;)switch(n.mode){case tL:if(n.wrap===0){n.mode=pL;break}for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=l&255,T[1]=l>>>8&255,n.check=uI(n.check,T,2,0),l=0,u=0,n.mode=nL;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg=`incorrect header check`,n.mode=AL;break}if((l&15)!=8){e.msg=`unknown compression method`,n.mode=AL;break}if(l>>>=4,u-=4,C=(l&15)+8,n.wbits===0&&(n.wbits=C),C>15||C>n.wbits){e.msg=`invalid window size`,n.mode=AL;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=l&512?uL:fL,l=0,u=0;break;case nL:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.flags=l,(n.flags&255)!=8){e.msg=`unknown compression method`,n.mode=AL;break}if(n.flags&57344){e.msg=`unknown header flags set`,n.mode=AL;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=uI(n.check,T,2,0)),l=0,u=0,n.mode=rL;case rL:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.time=l>>>0),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,T[2]=l>>>16&255,T[3]=l>>>24&255,n.check=uI(n.check,T,4,0)),l=0,u=0,n.mode=iL;case iL:for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=uI(n.check,T,2,0)),l=0,u=0,n.mode=aL;case aL:if(n.flags&1024){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(T[0]=l&255,T[1]=l>>>8&255,n.check=uI(n.check,T,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=oL;case oL:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),C)),n.flags&512&&n.wrap&4&&(n.check=uI(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break inf_leave;n.length=0,n.mode=sL;case sL:if(n.flags&2048){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C),n.length++);while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=uI(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.name=null);n.length=0,n.mode=cL;case cL:if(n.flags&4096){if(s===0)break inf_leave;p=0;do C=r[a+p++],n.head&&C&&n.length<65536&&(n.head.comment+=String.fromCharCode(C),n.length++);while(C&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=uI(n.check,r,p,a)),s-=p,a+=p,C)break inf_leave}else n.head&&(n.head.comment=null);n.mode=lL;case lL:if(n.flags&512){for(;u<16;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){e.msg=`header crc mismatch`,n.mode=AL;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=fL;break;case uL:for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}e.adler=n.check=NL(l),l=0,u=0,n.mode=dL;case dL:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,2;e.adler=n.check=1,n.mode=fL;case fL:if(t===5||t===6)break inf_leave;case pL:if(n.last){l>>>=u&7,u-=u&7,n.mode=DL;break}for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}switch(n.last=l&1,l>>>=1,--u,l&3){case 0:n.mode=mL;break;case 1:if(TSe(n),n.mode=bL,t===6){l>>>=2,u-=2;break inf_leave}break;case 2:n.mode=_L;break;case 3:e.msg=`invalid block type`,n.mode=AL}l>>>=2,u-=2;break;case mL:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if((l&65535)!=(l>>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=AL;break}if(n.length=l&65535,l=0,u=0,n.mode=hL,t===6)break inf_leave;case hL:n.mode=gL;case gL:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break inf_leave;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=fL;break;case _L:for(;u<14;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg=`too many length or distance symbols`,n.mode=AL;break}n.have=0,n.mode=vL;case vL:for(;n.have<n.ncode;){for(;u<3;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.lens[O[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},w=QI(vSe,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid code lengths set`,n.mode=AL;break}n.have=0,n.mode=yL;case yL:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,n.lens[n.have++]=y;else{if(y===16){for(D=_+2;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(l>>>=_,u-=_,n.have===0){e.msg=`invalid bit length repeat`,n.mode=AL;break}C=n.lens[n.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(D=_+3;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=3+(l&7),l>>>=3,u-=3}else{for(D=_+7;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=_,u-=_,C=0,p=11+(l&127),l>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=AL;break}for(;p--;)n.lens[n.have++]=C}}if(n.mode===AL)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=AL;break}if(n.lenbits=9,E={bits:n.lenbits},w=QI($I,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,w){e.msg=`invalid literal/lengths set`,n.mode=AL;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},w=QI(eL,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,w){e.msg=`invalid distances set`,n.mode=AL;break}if(n.mode=bL,t===6)break inf_leave;case bL:n.mode=xL;case xL:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,pSe(e,f),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,l=n.hold,u=n.bits,n.mode===fL&&(n.back=-1);break}for(n.back=0;g=n.lencode[l&(1<<n.lenbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(v&&!(v&240)){for(b=_,x=v,S=y;g=n.lencode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,n.length=y,v===0){n.mode=EL;break}if(v&32){n.back=-1,n.mode=fL;break}if(v&64){e.msg=`invalid literal/length code`,n.mode=AL;break}n.extra=v&15,n.mode=SL;case SL:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=CL;case CL:for(;g=n.distcode[l&(1<<n.distbits)-1],_=g>>>24,v=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(!(v&240)){for(b=_,x=v,S=y;g=n.distcode[S+((l&(1<<b+x)-1)>>b)],_=g>>>24,v=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}l>>>=b,u-=b,n.back+=b}if(l>>>=_,u-=_,n.back+=_,v&64){e.msg=`invalid distance code`,n.mode=AL;break}n.offset=y,n.extra=v&15,n.mode=wL;case wL:if(n.extra){for(D=n.extra;u<D;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=AL;break}n.mode=TL;case TL:if(c===0)break inf_leave;if(p=f-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=AL;break}p>n.wnext?(p-=n.wnext,m=n.wsize-p):m=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,m=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=h[m++];while(--p);n.length===0&&(n.mode=xL);break;case EL:if(c===0)break inf_leave;i[o++]=n.length,c--,n.mode=xL;break;case DL:if(n.wrap){for(;u<32;){if(s===0)break inf_leave;s--,l|=r[a++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?uI(n.check,i,f,o-f):lI(n.check,i,f,o-f)),f=c,n.wrap&4&&(n.flags?l:NL(l))!==n.check){e.msg=`incorrect data check`,n.mode=AL;break}l=0,u=0}n.mode=OL;case OL:if(n.wrap&&n.flags){for(;u<32;){if(s===0)break inf_leave;s--,l+=r[a++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){e.msg=`incorrect length check`,n.mode=AL;break}l=0,u=0}n.mode=kL;case kL:w=1;break inf_leave;case AL:w=-3;break inf_leave;case jL:return-4;case ML:default:return-2}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,n.hold=l,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<AL&&(n.mode<DL||t!==4))&&zL(e,e.output,e.next_out,f-e.avail_out)?(n.mode=jL,-4):(d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?uI(n.check,i,f,e.next_out-f):lI(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===fL?128:0)+(n.mode===bL||n.mode===hL?256:0),(d===0&&f===0||t===4)&&w===0&&(w=-5),w)},VL=e=>{if(PL(e))return-2;let t=e.state;return t.window&&=null,e.state=null,0},HL=(e,t)=>{let n=t.length,r,i,a;return PL(e)||(r=e.state,r.wrap!==0&&r.mode!==dL)?-2:r.mode===dL&&(i=1,i=lI(i,t,n,0),i!==r.check)?-3:(a=zL(e,t,n,n),a?(r.mode=jL,-4):(r.havedict=1,0))},UL=class{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},WL=e=>{let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},GL=Object.prototype.toString,ESe={level:-1,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,raw:!1,gzip:!1,legacyHash:!1,dictionary:new Uint8Array},DSe=class{options;err;msg;ended;started;chunks;strm;result;constructor(e={}){this.options=Object.assign({},ESe,e);let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array,this.strm=new UL,this.strm.avail_out=0;let n=cSe(this.strm,t.level,8,t.windowBits,t.memLevel,t.strategy,t.legacyHash);if(n!==0)throw Error(dI[n]);GL.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary));let r=t.dictionary;if(r.length){if(t.gzip)throw Error(`dictionary is not supported with gzip`);if(n=dSe(this.strm,r),n!==0)throw Error(dI[n])}}push(e,t=!1){let n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;for(a=typeof t==`number`?t:t===!0?4:0,n.input=typeof e==`string`?new TextEncoder().encode(e):GL.call(e)===`[object ArrayBuffer]`?new Uint8Array(e):e,n.next_in=0,n.avail_in=n.input.length,this.started||(this.started=!0,this.onStart(n));;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===2||a===3)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=lSe(n,a),i===-2)break;if(i===1){n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=uSe(this.strm);break}if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)return!0}return this.err=i,this.msg=n.msg||dI[i],this.ended=!0,this.onEnd(i),i===0}onStart(e){}onData(e){this.chunks.push(e)}onEnd(e){e===0&&(this.result=WL(this.chunks)),this.chunks=[]}},KL=Object.prototype.toString,OSe={chunkSize:65536,windowBits:15,raw:!1,dictionary:new Uint8Array},kSe=class{options;err;msg;ended;started;chunks;strm;result;constructor(e={}){this.options=Object.assign({},OSe,e);let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!e.windowBits&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array,this.strm=new UL,this.strm.avail_out=0;let n=wSe(this.strm,t.windowBits);if(n!==0)throw Error(dI[n]);KL.call(t.dictionary)===`[object ArrayBuffer]`&&(t.dictionary=new Uint8Array(t.dictionary));let r=t.dictionary;if(t.raw&&r.length&&(n=HL(this.strm,r),n!==0))throw Error(dI[n])}push(e,t=!1){let n=this.strm,r=this.options.chunkSize,i,a,o;if(this.ended)return this.err===0;for(a=typeof t==`number`?t:t===!0?4:0,n.input=KL.call(e)===`[object ArrayBuffer]`?new Uint8Array(e):e,n.next_in=0,n.avail_in=n.input.length,this.started||(this.started=!0,this.onStart(n));;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),i=BL(n,a),i===2){let e=this.options.dictionary;e.length&&(i=HL(n,e),i===0?i=BL(n,a):i===-3&&(i=2))}for(;n.avail_in>0&&i===1&&n.state.wrap&2&&n.state.flags!==0&&n.input[n.next_in]!==0;)FL(n),i=BL(n,a);if(i===-2||i===-3||i===2||i===-4)break;if(o=n.avail_out,n.next_out&&(n.avail_out===0||i===1||a>0)&&(this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out)),n.avail_out=0,n.next_out=0),i!==0&&i!==-5||o!==0){if(i===1){i=VL(this.strm);break}if(n.avail_in===0){if(a===4){i=VL(this.strm),i===0&&(i=-5);break}return!0}}}return this.err=i,this.msg=n.msg||dI[i],this.ended=!0,this.onEnd(i),i===0}onStart(e){}onData(e){this.chunks.push(e)}onEnd(e){e===0&&(this.result=WL(this.chunks)),this.chunks=[]}};function qL(e,t,n){let r=0,i=e.onData;if(e.onData=function(e){if(e.byteLength>n-r)throw Error(`gzip output exceeds limit (${n} bytes)`);r+=e.byteLength,i.call(this,e)},!e.push(t,!0)||e.err||e.result===void 0)throw Error(e.msg||`Invalid or incomplete gzip stream`);return e.result}function JL(e){if(!Number.isSafeInteger(e)||e<=0)throw Error(`gzip output limit must be a positive safe integer`);return Math.min(e,65536)}function YL(e,t){return qL(new kSe({windowBits:31,chunkSize:JL(t)}),e,t)}function ASe(e,t,n){return qL(new DSe({gzip:!0,level:n,chunkSize:JL(t)}),e,t)}var XL=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends XL{};function ZL(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function QL(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function $L(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function eR(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function tR(e,t){return $L(e,t,``)}function nR(e,t){return eR(e,t,``)}function rR(e,t){return t.slice(0,jSe(e,t))}function jSe(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function iR(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function aR(e,t){if(t)return sR(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function oR(e,t){if(t)return sR(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function sR(e,t){if(!t)return[oR(e),aR(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=iR(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var cR=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,MSe=RegExp(`[${cR}]+|\\s+|[^${cR}]`,`ug`);new class extends XL{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=iR(e,r)}else n=e.match(MSe)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&lR(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&lR(n,i,r,null,t.intlSegmenter),e}};function lR(e,t,n,r,i){if(t&&n){let[a,o]=sR(t.value,i),[s,c]=sR(n.value,i);if(e){let r=ZL(a,s);e.value=eR(e.value,s,r),t.value=tR(t.value,r),n.value=tR(n.value,r)}if(r){let e=QL(o,c);r.value=$L(r.value,c,e),t.value=nR(t.value,e),n.value=nR(n.value,e)}}else if(n){if(e){let e=oR(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=oR(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=oR(r.value,i),[a,o]=sR(t.value,i),s=ZL(n,a);t.value=tR(t.value,s);let c=QL(tR(n,s),o);t.value=nR(t.value,c),r.value=$L(r.value,n,c),e.value=eR(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=oR(r.value,i),n=rR(aR(t.value,i),e);t.value=nR(t.value,n)}else if(e){let n=rR(aR(e.value,i),oR(t.value,i));t.value=tR(t.value,n)}}new class extends XL{tokenize(e){let t=RegExp(`(\\r?\\n)|[${cR}]+|[^\\S\\n\\r]+|[^${cR}]`,`ug`);return e.match(t)||[]}};var NSe=new class extends XL{constructor(){super(...arguments),this.tokenize=dR}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
97
97
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
98
98
|
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|